@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.
- package/build/transformer/index.js +15 -8
- package/package.json +1 -1
- package/src/transformer/index.ts +24 -9
|
@@ -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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
...
|
|
51
|
+
...filteredStatements.slice(0, insertIndex),
|
|
45
52
|
...newStatements,
|
|
46
|
-
...
|
|
53
|
+
...filteredStatements.slice(insertIndex)
|
|
47
54
|
];
|
|
48
55
|
return factory.updateSourceFile(sourceFile, updatedStatements);
|
|
49
56
|
};
|
package/package.json
CHANGED
package/src/transformer/index.ts
CHANGED
|
@@ -78,23 +78,38 @@ function addImportsTransformer(
|
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
//
|
|
82
|
-
let
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
...
|
|
110
|
+
...filteredStatements.slice(0, insertIndex),
|
|
96
111
|
...newStatements,
|
|
97
|
-
...
|
|
112
|
+
...filteredStatements.slice(insertIndex)
|
|
98
113
|
];
|
|
99
114
|
|
|
100
115
|
return factory.updateSourceFile(sourceFile, updatedStatements);
|