Skip to content

Commit

Permalink
fix(snackager): resolve reanimated __reanimatedWorkletInit is not a…
Browse files Browse the repository at this point in the history
… function (#554)

* chore(snackager): bump react native babel preset and reanmiated babel plugin

* chore(snackager): bust cache for all reanimated libraries

* chore: bump package lockfile

* fix(snackager): add react-native external for `@shopify/react-native-skia`

* fix(snackager): force-bump babel dependencies to latest versions

* fix(snackager): bump jest to latest

* chore(snackager): manually update bundling snapshot to latest

* chore(snackager): update the remaining bundling snapshots

* chore(snackager): update cache busing for final staging test

* fix(snackager): add missing `@babel/runtime`

* chore(snackager): update bundle snapshot for [email protected]

* fix(snackager): add missing babel plugin for reanimated

* fix(runtime): add missing react-native external

* fix(runtime): force-disable `fs` operations for sourcemaps

* chore(runtime): add patch note about disabling sourcemaps in reanimated plugin
  • Loading branch information
byCedric authored Feb 12, 2024
1 parent 38ef84f commit eb6dbee
Show file tree
Hide file tree
Showing 14 changed files with 1,774 additions and 2,070 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,11 @@
"chalet": "^0.9.0",
"env-cmd": "^10.1.0",
"turbo": "^1.10.14"
},
"resolutions": {
"@babel/core": "^7.23.6",
"@babel/plugin-transform-typescript": "^7.23.6",
"@babel/runtime": "^7.23.6",
"@babel/types": "^7.23.9"
}
}
1 change: 1 addition & 0 deletions runtime/src/aliases/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const aliases: { [key: string]: any } = {
'react-native/Libraries/Core/Devtools/getDevServer': require('react-native/Libraries/Core/Devtools/getDevServer'), // Used by @sentry/[email protected]
'react-native/Libraries/Utilities/PolyfillFunctions': require('react-native/Libraries/Utilities/PolyfillFunctions'), // Used by @sentry/[email protected]
'react-native/Libraries/Utilities/codegenNativeCommands': require('react-native/Libraries/Utilities/codegenNativeCommands'), // Used by [email protected]
'react-native/Libraries/NativeComponent/NativeComponentRegistry': require('react-native/Libraries/NativeComponent/NativeComponentRegistry'), // Used by @shopify/[email protected]

// Does not work in Snackager, likely due to Webpack / Codegen
'react-native-pager-view': require('react-native-pager-view'),
Expand Down
4 changes: 3 additions & 1 deletion runtime/vendor/reanimated-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Other changes:
// `shouldGenerateSourceMap` → always return false, this would invoke `fs` otherwise
// `var fs = __importStar(require("fs"));` → `var fs = { readFileSync: () => { throw new Error(`Can't invoke "fs" in React Native`) } };`
// `const includeSourceMap = !(0, utils_1.isRelease)();` → `const includeSourceMap = false; // Disabled due to no `fs` available in React Native`
// `var version = require("../../package.json").version;` → `var version = "3.3.0";`

"use strict";
Expand Down Expand Up @@ -108,7 +109,8 @@ var require_buildWorkletString = __commonJS({
const workletFunction = (0, types_1.functionExpression)((0, types_1.identifier)(name), expression.params, expression.body);
const code = (0, generator_1.default)(workletFunction).code;
(0, assert_1.strict)(inputMap, "[Reanimated] `inputMap` is undefined.");
const includeSourceMap = !(0, utils_1.isRelease)();
// const includeSourceMap = !(0, utils_1.isRelease)();
const includeSourceMap = false; // Disabled due to no `fs` available in React Native
if (includeSourceMap) {
inputMap.sourcesContent = [];
for (const sourceFile of inputMap.sources) {
Expand Down
16 changes: 9 additions & 7 deletions snackager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
"@babel/generator": "^7.23.6",
"@babel/plugin-transform-export-namespace-from": "7.23.4",
"@babel/plugin-transform-runtime": "^7.23.6",
"@babel/plugin-transform-template-literals": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@expo/config": "^3.3.28",
"@expo/spawn-async": "^1.5.0",
"@babel/runtime": "^7.23.6",
"@expo/config": "^8.5.4",
"@expo/spawn-async": "^1.7.2",
"aws-sdk": "^2.487.0",
"babel-loader": "^8.2.5",
"bunyan": "^1.8.12",
Expand All @@ -36,12 +38,12 @@
"lodash": "^4.17.11",
"md5": "^2.2.1",
"memory-fs": "^0.4.1",
"metro-react-native-babel-preset": "^0.76.8",
"@react-native/babel-preset": "^0.73.19",
"node-fetch": "^2.6.0",
"picomatch": "^4.0.1",
"querystring": "^0.2.0",
"raven": "^2.6.4",
"react-native-reanimated": "2.0.0-rc.3",
"react-native-reanimated": "~3.6.0",
"redis": "^3.0.2",
"rimraf": "^2.6.3",
"sander": "^0.6.0",
Expand Down Expand Up @@ -82,13 +84,13 @@
"eslint": "^8.49.0",
"eslint-config-universe": "^12.0.0",
"glob": "^7.1.6",
"jest": "^26.6.3",
"jest": "^29.7.0",
"js-yaml": "^4.1.0",
"prettier": "^3.0.3",
"supertest": "^6.1.3",
"ts-jest": "^26.4.4",
"ts-jest": "^29.1.2",
"ts-node-dev": "^1.1.1",
"typescript": "^4.6.3"
"typescript": "^5.3.3"
},
"eslintConfig": {
"extends": "universe/node",
Expand Down
Loading

0 comments on commit eb6dbee

Please sign in to comment.