@esportsplus/reactivity 0.29.1 → 0.29.3
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/compiler/index.js
CHANGED
|
@@ -46,7 +46,9 @@ const plugin = {
|
|
|
46
46
|
replacements.push(...primitives(ctx.sourceFile, bindings, isReactive));
|
|
47
47
|
let objectResult = object(ctx.sourceFile, bindings);
|
|
48
48
|
prepend.push(...objectResult.prepend);
|
|
49
|
-
replacements.push(...objectResult.replacements
|
|
49
|
+
replacements.push(...objectResult.replacements);
|
|
50
|
+
replacements.push(...array(ctx.sourceFile, bindings));
|
|
51
|
+
replacements.push(...findRemainingCalls(ctx.checker, ctx.sourceFile, new Set(replacements.map(r => r.node))));
|
|
50
52
|
if (replacements.length > 0 || prepend.length > 0) {
|
|
51
53
|
importsIntent.push({
|
|
52
54
|
namespace: COMPILER_NAMESPACE,
|
|
@@ -17,7 +17,7 @@ const COMPOUND_OPERATORS = new Map([
|
|
|
17
17
|
[ts.SyntaxKind.QuestionQuestionEqualsToken, '??'],
|
|
18
18
|
[ts.SyntaxKind.SlashEqualsToken, '/']
|
|
19
19
|
]);
|
|
20
|
-
function
|
|
20
|
+
function inScope(reference, binding) {
|
|
21
21
|
let current = reference;
|
|
22
22
|
while (current) {
|
|
23
23
|
if (current === binding.scope) {
|
|
@@ -89,7 +89,7 @@ function visit(ctx, node) {
|
|
|
89
89
|
let bindings = ctx.scopedBindings, binding, name = node.text;
|
|
90
90
|
for (let i = 0, n = bindings.length; i < n; i++) {
|
|
91
91
|
let b = bindings[i];
|
|
92
|
-
if (b.name === name &&
|
|
92
|
+
if (b.name === name && inScope(node, b)) {
|
|
93
93
|
binding = b;
|
|
94
94
|
}
|
|
95
95
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"@esportsplus/utilities": "^0.27.2"
|
|
5
5
|
},
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@esportsplus/typescript": "^0.26.
|
|
7
|
+
"@esportsplus/typescript": "^0.26.2",
|
|
8
8
|
"@types/node": "^25.0.3",
|
|
9
9
|
"vite": "^7.3.1"
|
|
10
10
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"type": "module",
|
|
33
33
|
"types": "build/index.d.ts",
|
|
34
|
-
"version": "0.29.
|
|
34
|
+
"version": "0.29.3",
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsc",
|
|
37
37
|
"build:test": "pnpm build && vite build --config test/vite.config.ts",
|
package/src/compiler/index.ts
CHANGED
|
@@ -89,12 +89,13 @@ const plugin: Plugin = {
|
|
|
89
89
|
let objectResult = object(ctx.sourceFile, bindings);
|
|
90
90
|
|
|
91
91
|
prepend.push(...objectResult.prepend);
|
|
92
|
-
replacements.push(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
)
|
|
92
|
+
replacements.push(...objectResult.replacements);
|
|
93
|
+
|
|
94
|
+
// Run array transform separately ( avoid race conditions )
|
|
95
|
+
replacements.push(...array(ctx.sourceFile, bindings));
|
|
96
|
+
|
|
97
|
+
// Find remaining reactive() calls that weren't transformed and replace with namespace version
|
|
98
|
+
replacements.push(...findRemainingCalls(ctx.checker, ctx.sourceFile, new Set(replacements.map(r => r.node))));
|
|
98
99
|
|
|
99
100
|
// Build import intent
|
|
100
101
|
if (replacements.length > 0 || prepend.length > 0) {
|
|
@@ -39,7 +39,7 @@ const COMPOUND_OPERATORS = new Map<ts.SyntaxKind, string>([
|
|
|
39
39
|
]);
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
function
|
|
42
|
+
function inScope(reference: ts.Node, binding: ScopeBinding): boolean {
|
|
43
43
|
let current: ts.Node | undefined = reference;
|
|
44
44
|
|
|
45
45
|
while (current) {
|
|
@@ -142,7 +142,7 @@ function visit(ctx: TransformContext, node: ts.Node): void {
|
|
|
142
142
|
for (let i = 0, n = bindings.length; i < n; i++) {
|
|
143
143
|
let b = bindings[i];
|
|
144
144
|
|
|
145
|
-
if (b.name === name &&
|
|
145
|
+
if (b.name === name && inScope(node, b)) {
|
|
146
146
|
binding = b;
|
|
147
147
|
}
|
|
148
148
|
}
|