@esportsplus/reactivity 0.24.3 → 0.24.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.
@@ -31,19 +31,26 @@ function addImportsTransformer(neededImports, ns) {
31
31
  if (needsConstants) {
32
32
  newStatements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamespaceImport(factory.createIdentifier(ns.constants))), factory.createStringLiteral('@esportsplus/reactivity/constants')));
33
33
  }
34
- let insertIndex = 0, statements = sourceFile.statements;
34
+ let filteredStatements = [], insertIndex = 0, statements = sourceFile.statements;
35
35
  for (let i = 0, n = statements.length; i < n; i++) {
36
- if (ts.isImportDeclaration(statements[i])) {
37
- insertIndex = i + 1;
38
- }
39
- else {
40
- break;
36
+ let stmt = statements[i];
37
+ if (ts.isImportDeclaration(stmt)) {
38
+ insertIndex = filteredStatements.length + 1;
39
+ if (ts.isStringLiteral(stmt.moduleSpecifier)) {
40
+ let module = stmt.moduleSpecifier.text;
41
+ if (module === '@esportsplus/reactivity' ||
42
+ module === '@esportsplus/reactivity/reactive/array' ||
43
+ module === '@esportsplus/reactivity/constants') {
44
+ continue;
45
+ }
46
+ }
41
47
  }
48
+ filteredStatements.push(stmt);
42
49
  }
43
50
  let updatedStatements = [
44
- ...statements.slice(0, insertIndex),
51
+ ...filteredStatements.slice(0, insertIndex),
45
52
  ...newStatements,
46
- ...statements.slice(insertIndex)
53
+ ...filteredStatements.slice(insertIndex)
47
54
  ];
48
55
  return factory.updateSourceFile(sourceFile, updatedStatements);
49
56
  };
package/package.json CHANGED
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "type": "module",
38
38
  "types": "build/index.d.ts",
39
- "version": "0.24.3",
39
+ "version": "0.24.4",
40
40
  "scripts": {
41
41
  "build": "tsc",
42
42
  "build:test": "pnpm build && vite build --config test/vite.config.ts",
@@ -78,23 +78,38 @@ function addImportsTransformer(
78
78
  );
79
79
  }
80
80
 
81
- // Insert new imports after existing imports
82
- let insertIndex = 0,
81
+ // Filter out original @esportsplus/reactivity imports (they lose symbol bindings)
82
+ let filteredStatements: ts.Statement[] = [],
83
+ insertIndex = 0,
83
84
  statements = sourceFile.statements;
84
85
 
85
86
  for (let i = 0, n = statements.length; i < n; i++) {
86
- if (ts.isImportDeclaration(statements[i])) {
87
- insertIndex = i + 1;
88
- }
89
- else {
90
- break;
87
+ let stmt = statements[i];
88
+
89
+ if (ts.isImportDeclaration(stmt)) {
90
+ insertIndex = filteredStatements.length + 1;
91
+
92
+ // Skip imports from @esportsplus/reactivity packages
93
+ if (ts.isStringLiteral(stmt.moduleSpecifier)) {
94
+ let module = stmt.moduleSpecifier.text;
95
+
96
+ if (
97
+ module === '@esportsplus/reactivity' ||
98
+ module === '@esportsplus/reactivity/reactive/array' ||
99
+ module === '@esportsplus/reactivity/constants'
100
+ ) {
101
+ continue;
102
+ }
103
+ }
91
104
  }
105
+
106
+ filteredStatements.push(stmt);
92
107
  }
93
108
 
94
109
  let updatedStatements = [
95
- ...statements.slice(0, insertIndex),
110
+ ...filteredStatements.slice(0, insertIndex),
96
111
  ...newStatements,
97
- ...statements.slice(insertIndex)
112
+ ...filteredStatements.slice(insertIndex)
98
113
  ];
99
114
 
100
115
  return factory.updateSourceFile(sourceFile, updatedStatements);