@callstack/repack-plugin-reanimated 5.2.2 → 5.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/plugin.js +28 -1
  2. package/package.json +6 -6
package/dist/plugin.js CHANGED
@@ -7,6 +7,28 @@ exports.ReanimatedPlugin = void 0;
7
7
  const node_path_1 = __importDefault(require("node:path"));
8
8
  const semver_1 = __importDefault(require("semver"));
9
9
  const rules_js_1 = require("./rules.js");
10
+ const REANIMATED_SETUP_TESTS_WARNING = /'`setUpTests` is available only in Jest environment\.'/;
11
+ const WORKLETS_CRITICAL_DEPENDENCY_WARNING = /Critical dependency: require function is used in a way in which dependencies cannot be statically extracted/;
12
+ const WORKLETS_INITIALIZERS_MODULE = /react-native-(?:worklets|reanimated)[\\/].*initializers(?:\.[cm]?[jt]sx?)?/;
13
+ function warningToSearchableText(warning) {
14
+ if (typeof warning === 'string') {
15
+ return warning;
16
+ }
17
+ if (!warning || typeof warning !== 'object') {
18
+ return '';
19
+ }
20
+ const warningObject = warning;
21
+ return [
22
+ warningObject.message,
23
+ warningObject.details,
24
+ warningObject.moduleName,
25
+ warningObject.moduleIdentifier,
26
+ warningObject.module?.resource,
27
+ warningObject.module?.userRequest,
28
+ ]
29
+ .filter((value) => typeof value === 'string')
30
+ .join('\n');
31
+ }
10
32
  class ReanimatedPlugin {
11
33
  constructor(options = {}) {
12
34
  this.options = options;
@@ -25,7 +47,12 @@ class ReanimatedPlugin {
25
47
  }
26
48
  // ignore the 'setUpTests' warning from reanimated which is not relevant
27
49
  compiler.options.ignoreWarnings = compiler.options.ignoreWarnings ?? [];
28
- compiler.options.ignoreWarnings.push((warning) => /'`setUpTests` is available only in Jest environment\.'/.test(warning.message));
50
+ compiler.options.ignoreWarnings.push((warning) => {
51
+ const warningText = warningToSearchableText(warning);
52
+ return (REANIMATED_SETUP_TESTS_WARNING.test(warningText) ||
53
+ (WORKLETS_CRITICAL_DEPENDENCY_WARNING.test(warningText) &&
54
+ WORKLETS_INITIALIZERS_MODULE.test(warningText)));
55
+ });
29
56
  }
30
57
  ensureDependencyInstalled(context, dependency) {
31
58
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@callstack/repack-plugin-reanimated",
3
- "version": "5.2.2",
3
+ "version": "5.2.4",
4
4
  "description": "A plugin for @callstack/repack that integrates react-native-reanimated",
5
5
  "author": "Jakub Romańczyk <jakub.romanczyk@callstack.com>",
6
6
  "license": "MIT",
@@ -44,15 +44,15 @@
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@babel/core": "^7.20",
47
- "@callstack/repack": "5.2.2"
47
+ "@callstack/repack": "5.2.4"
48
48
  },
49
49
  "devDependencies": {
50
- "@rspack/core": "^1.4.11",
50
+ "@rspack/core": "^1.6.0",
51
51
  "@types/babel__core": "7.20.5",
52
- "@types/node": "^20",
52
+ "@types/node": "^20.19.31",
53
53
  "@types/semver": "^7.7.0",
54
- "webpack": "^5.99.9",
55
- "@callstack/repack": "5.2.2"
54
+ "webpack": "^5.104.1",
55
+ "@callstack/repack": "5.2.4"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsc -p tsconfig.build.json",