@esportsplus/reactivity 0.25.4 → 0.25.5
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/constants.d.ts +1 -1
- package/build/constants.js +2 -1
- package/build/transformer/index.js +3 -4
- package/package.json +1 -1
- package/src/constants.ts +3 -1
- package/src/transformer/index.ts +3 -5
package/build/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const COMPILATION_ENTRYPOINT = "reactive";
|
|
2
2
|
declare const COMPILATION_ENTRYPOINT_REGEX: RegExp;
|
|
3
|
-
declare const COMPILATION_NAMESPACE
|
|
3
|
+
declare const COMPILATION_NAMESPACE: string;
|
|
4
4
|
declare const COMPILATION_TYPE_ARRAY = "array";
|
|
5
5
|
declare const COMPILATION_TYPE_COMPUTED = "computed";
|
|
6
6
|
declare const COMPILATION_TYPE_SIGNAL = "signal";
|
package/build/constants.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import uid from 'node_modules/@esportsplus/typescript/build/transformer/uid';
|
|
1
2
|
const COMPILATION_ENTRYPOINT = 'reactive';
|
|
2
3
|
const COMPILATION_ENTRYPOINT_REGEX = /\breactive\b/;
|
|
3
|
-
const COMPILATION_NAMESPACE =
|
|
4
|
+
const COMPILATION_NAMESPACE = uid(COMPILATION_ENTRYPOINT);
|
|
4
5
|
const COMPILATION_TYPE_ARRAY = 'array';
|
|
5
6
|
const COMPILATION_TYPE_COMPUTED = 'computed';
|
|
6
7
|
const COMPILATION_TYPE_SIGNAL = 'signal';
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { ts } from '@esportsplus/typescript';
|
|
2
|
-
import { uid } from '@esportsplus/typescript/transformer';
|
|
3
2
|
import { COMPILATION_NAMESPACE } from '../constants.js';
|
|
4
3
|
import { contains } from './detector.js';
|
|
5
4
|
import array from './transforms/array.js';
|
|
6
5
|
import object from './transforms/object.js';
|
|
7
6
|
import primitives from './transforms/primitives.js';
|
|
8
|
-
let
|
|
7
|
+
let transforms = [object, array, primitives];
|
|
9
8
|
const transform = (sourceFile) => {
|
|
10
9
|
let bindings = new Map(), code = sourceFile.getFullText(), current = sourceFile, result, transformed = false;
|
|
11
10
|
if (!contains(code)) {
|
|
12
11
|
return { code, sourceFile, transformed: false };
|
|
13
12
|
}
|
|
14
13
|
for (let i = 0, n = transforms.length; i < n; i++) {
|
|
15
|
-
result = transforms[i](current, bindings,
|
|
14
|
+
result = transforms[i](current, bindings, COMPILATION_NAMESPACE);
|
|
16
15
|
if (result !== code) {
|
|
17
16
|
current = ts.createSourceFile(sourceFile.fileName, result, sourceFile.languageVersion, true);
|
|
18
17
|
code = result;
|
|
@@ -20,7 +19,7 @@ const transform = (sourceFile) => {
|
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
if (transformed) {
|
|
23
|
-
code = `import * as ${
|
|
22
|
+
code = `import * as ${COMPILATION_NAMESPACE} from '@esportsplus/reactivity';\n` + code;
|
|
24
23
|
sourceFile = ts.createSourceFile(sourceFile.fileName, code, sourceFile.languageVersion, true);
|
|
25
24
|
}
|
|
26
25
|
return { code, sourceFile, transformed };
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import uid from 'node_modules/@esportsplus/typescript/build/transformer/uid';
|
|
2
|
+
|
|
1
3
|
const COMPILATION_ENTRYPOINT = 'reactive';
|
|
2
4
|
|
|
3
5
|
const COMPILATION_ENTRYPOINT_REGEX = /\breactive\b/;
|
|
4
6
|
|
|
5
|
-
const COMPILATION_NAMESPACE =
|
|
7
|
+
const COMPILATION_NAMESPACE = uid(COMPILATION_ENTRYPOINT);
|
|
6
8
|
|
|
7
9
|
const COMPILATION_TYPE_ARRAY = 'array';
|
|
8
10
|
|
package/src/transformer/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ts } from '@esportsplus/typescript';
|
|
2
|
-
import { uid } from '@esportsplus/typescript/transformer';
|
|
3
2
|
import { COMPILATION_NAMESPACE } from '~/constants.js';
|
|
4
3
|
import type { Bindings, TransformResult } from '~/types';
|
|
5
4
|
import { contains } from './detector';
|
|
@@ -8,8 +7,7 @@ import object from './transforms/object';
|
|
|
8
7
|
import primitives from './transforms/primitives';
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
let
|
|
12
|
-
transforms = [object, array, primitives];
|
|
10
|
+
let transforms = [object, array, primitives];
|
|
13
11
|
|
|
14
12
|
|
|
15
13
|
const transform = (sourceFile: ts.SourceFile): TransformResult => {
|
|
@@ -24,7 +22,7 @@ const transform = (sourceFile: ts.SourceFile): TransformResult => {
|
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
for (let i = 0, n = transforms.length; i < n; i++) {
|
|
27
|
-
result = transforms[i](current, bindings,
|
|
25
|
+
result = transforms[i](current, bindings, COMPILATION_NAMESPACE);
|
|
28
26
|
|
|
29
27
|
if (result !== code) {
|
|
30
28
|
current = ts.createSourceFile(sourceFile.fileName, result, sourceFile.languageVersion, true);
|
|
@@ -34,7 +32,7 @@ const transform = (sourceFile: ts.SourceFile): TransformResult => {
|
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
if (transformed) {
|
|
37
|
-
code = `import * as ${
|
|
35
|
+
code = `import * as ${COMPILATION_NAMESPACE} from '@esportsplus/reactivity';\n` + code;
|
|
38
36
|
sourceFile = ts.createSourceFile(sourceFile.fileName, code, sourceFile.languageVersion, true);
|
|
39
37
|
}
|
|
40
38
|
|