@esportsplus/reactivity 0.29.9 → 0.29.11
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/constants.d.ts +1 -1
- package/build/compiler/constants.js +1 -1
- package/build/compiler/index.js +5 -5
- package/build/compiler/plugins/tsc.d.ts +2 -2
- package/build/compiler/plugins/tsc.js +2 -1
- package/build/compiler/plugins/vite.js +2 -2
- package/build/constants.d.ts +2 -2
- package/build/constants.js +2 -2
- package/build/reactive/index.js +2 -2
- package/package.json +2 -2
- package/src/compiler/constants.ts +1 -1
- package/src/compiler/index.ts +5 -5
- package/src/compiler/plugins/tsc.ts +2 -1
- package/src/compiler/plugins/vite.ts +2 -2
- package/src/constants.ts +2 -2
- package/src/reactive/index.ts +2 -2
package/build/compiler/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ts } from '@esportsplus/typescript';
|
|
2
2
|
import { imports } from '@esportsplus/typescript/compiler';
|
|
3
|
-
import { ENTRYPOINT, NAMESPACE,
|
|
3
|
+
import { ENTRYPOINT, NAMESPACE, PACKAGE_NAME } from './constants.js';
|
|
4
4
|
import array from './array.js';
|
|
5
5
|
import object from './object.js';
|
|
6
6
|
import primitives from './primitives.js';
|
|
@@ -19,11 +19,11 @@ function isReactiveCallExpression(checker, node) {
|
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
21
|
if (checker) {
|
|
22
|
-
return imports.includes(checker, expr,
|
|
22
|
+
return imports.includes(checker, expr, PACKAGE_NAME, ENTRYPOINT);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
if (ts.isPropertyAccessExpression(expr) && expr.name.text === ENTRYPOINT && checker) {
|
|
26
|
-
return imports.includes(checker, expr,
|
|
26
|
+
return imports.includes(checker, expr, PACKAGE_NAME);
|
|
27
27
|
}
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
@@ -39,7 +39,7 @@ function visit(ctx, node) {
|
|
|
39
39
|
export default {
|
|
40
40
|
patterns: ['reactive(', 'reactive<'],
|
|
41
41
|
transform: (ctx) => {
|
|
42
|
-
if (!imports.all(ctx.sourceFile,
|
|
42
|
+
if (!imports.all(ctx.sourceFile, PACKAGE_NAME).some(i => i.specifiers.has(ENTRYPOINT))) {
|
|
43
43
|
return {};
|
|
44
44
|
}
|
|
45
45
|
let bindings = new Map(), intents = {
|
|
@@ -56,7 +56,7 @@ export default {
|
|
|
56
56
|
if (intents.replacements.length > 0 || intents.prepend.length > 0) {
|
|
57
57
|
intents.imports.push({
|
|
58
58
|
namespace: NAMESPACE,
|
|
59
|
-
package:
|
|
59
|
+
package: PACKAGE_NAME,
|
|
60
60
|
remove: [ENTRYPOINT]
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export default
|
|
1
|
+
declare const _default: () => import("@esportsplus/typescript/compiler").Plugin[];
|
|
2
|
+
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { plugin } from '@esportsplus/typescript/compiler';
|
|
2
|
-
import {
|
|
2
|
+
import { PACKAGE_NAME } from '../constants.js';
|
|
3
3
|
import reactivity from '../index.js';
|
|
4
4
|
export default plugin.vite({
|
|
5
|
-
name:
|
|
5
|
+
name: PACKAGE_NAME,
|
|
6
6
|
plugins: [reactivity]
|
|
7
7
|
});
|
package/build/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const COMPUTED: unique symbol;
|
|
2
|
-
declare const
|
|
2
|
+
declare const PACKAGE_NAME = "@esportsplus/reactivity";
|
|
3
3
|
declare const REACTIVE_ARRAY: unique symbol;
|
|
4
4
|
declare const REACTIVE_OBJECT: unique symbol;
|
|
5
5
|
declare const SIGNAL: unique symbol;
|
|
@@ -13,4 +13,4 @@ declare const STATE_DIRTY: number;
|
|
|
13
13
|
declare const STATE_RECOMPUTING: number;
|
|
14
14
|
declare const STATE_IN_HEAP: number;
|
|
15
15
|
declare const STATE_NOTIFY_MASK: number;
|
|
16
|
-
export { COMPUTED, REACTIVE_ARRAY, REACTIVE_OBJECT,
|
|
16
|
+
export { COMPUTED, REACTIVE_ARRAY, REACTIVE_OBJECT, PACKAGE_NAME, SIGNAL, STABILIZER_IDLE, STABILIZER_RESCHEDULE, STABILIZER_RUNNING, STABILIZER_SCHEDULED, STATE_CHECK, STATE_DIRTY, STATE_IN_HEAP, STATE_NONE, STATE_NOTIFY_MASK, STATE_RECOMPUTING };
|
package/build/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const COMPUTED = Symbol('reactivity.computed');
|
|
2
|
-
const
|
|
2
|
+
const PACKAGE_NAME = '@esportsplus/reactivity';
|
|
3
3
|
const REACTIVE_ARRAY = Symbol('reactivity.reactive.array');
|
|
4
4
|
const REACTIVE_OBJECT = Symbol('reactivity.reactive.object');
|
|
5
5
|
const SIGNAL = Symbol('reactivity.signal');
|
|
@@ -13,4 +13,4 @@ const STATE_DIRTY = 1 << 1;
|
|
|
13
13
|
const STATE_RECOMPUTING = 1 << 2;
|
|
14
14
|
const STATE_IN_HEAP = 1 << 3;
|
|
15
15
|
const STATE_NOTIFY_MASK = (STATE_CHECK | STATE_DIRTY);
|
|
16
|
-
export { COMPUTED, REACTIVE_ARRAY, REACTIVE_OBJECT,
|
|
16
|
+
export { COMPUTED, REACTIVE_ARRAY, REACTIVE_OBJECT, PACKAGE_NAME, SIGNAL, STABILIZER_IDLE, STABILIZER_RESCHEDULE, STABILIZER_RUNNING, STABILIZER_SCHEDULED, STATE_CHECK, STATE_DIRTY, STATE_IN_HEAP, STATE_NONE, STATE_NOTIFY_MASK, STATE_RECOMPUTING };
|
package/build/reactive/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { onCleanup, root } from '@esportsplus/reactivity';
|
|
|
2
2
|
import { isArray, isObject } from '@esportsplus/utilities';
|
|
3
3
|
import { ReactiveArray } from './array.js';
|
|
4
4
|
import { ReactiveObject } from './object.js';
|
|
5
|
-
import {
|
|
5
|
+
import { PACKAGE_NAME } from '../constants.js';
|
|
6
6
|
function reactive(input) {
|
|
7
7
|
let dispose = false, value = root(() => {
|
|
8
8
|
let response;
|
|
@@ -18,7 +18,7 @@ function reactive(input) {
|
|
|
18
18
|
}
|
|
19
19
|
return response;
|
|
20
20
|
}
|
|
21
|
-
throw new Error(`${
|
|
21
|
+
throw new Error(`${PACKAGE_NAME}: 'reactive' received invalid input - ${JSON.stringify(input)}`);
|
|
22
22
|
});
|
|
23
23
|
if (dispose) {
|
|
24
24
|
onCleanup(() => value.dispose());
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"@esportsplus/utilities": "^0.27.2"
|
|
5
5
|
},
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@esportsplus/typescript": "^0.27.
|
|
7
|
+
"@esportsplus/typescript": "^0.27.2",
|
|
8
8
|
"@types/node": "^25.0.3",
|
|
9
9
|
"vite": "^7.3.1"
|
|
10
10
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"type": "module",
|
|
37
37
|
"types": "build/index.d.ts",
|
|
38
|
-
"version": "0.29.
|
|
38
|
+
"version": "0.29.11",
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsc",
|
|
41
41
|
"build:test": "pnpm build && vite build --config test/vite.config.ts",
|
package/src/compiler/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ImportIntent, ReplacementIntent, TransformContext } from '@esportsplus/typescript/compiler';
|
|
2
2
|
import { ts } from '@esportsplus/typescript';
|
|
3
3
|
import { imports } from '@esportsplus/typescript/compiler';
|
|
4
|
-
import { ENTRYPOINT, NAMESPACE,
|
|
4
|
+
import { ENTRYPOINT, NAMESPACE, PACKAGE_NAME } from './constants';
|
|
5
5
|
import type { Bindings } from './types';
|
|
6
6
|
import array from './array';
|
|
7
7
|
import object from './object';
|
|
@@ -43,13 +43,13 @@ function isReactiveCallExpression(checker: ts.TypeChecker | undefined, node: ts.
|
|
|
43
43
|
|
|
44
44
|
// Use checker to resolve aliases
|
|
45
45
|
if (checker) {
|
|
46
|
-
return imports.includes(checker, expr,
|
|
46
|
+
return imports.includes(checker, expr, PACKAGE_NAME, ENTRYPOINT);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// Property access: ns.reactive(...)
|
|
51
51
|
if (ts.isPropertyAccessExpression(expr) && expr.name.text === ENTRYPOINT && checker) {
|
|
52
|
-
return imports.includes(checker, expr,
|
|
52
|
+
return imports.includes(checker, expr, PACKAGE_NAME);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
return false;
|
|
@@ -71,7 +71,7 @@ function visit(ctx: FindRemainingContext, node: ts.Node): void {
|
|
|
71
71
|
export default {
|
|
72
72
|
patterns: ['reactive(', 'reactive<'],
|
|
73
73
|
transform: (ctx: TransformContext) => {
|
|
74
|
-
if (!imports.all(ctx.sourceFile,
|
|
74
|
+
if (!imports.all(ctx.sourceFile, PACKAGE_NAME).some(i => i.specifiers.has(ENTRYPOINT))) {
|
|
75
75
|
return {};
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -105,7 +105,7 @@ export default {
|
|
|
105
105
|
if (intents.replacements.length > 0 || intents.prepend.length > 0) {
|
|
106
106
|
intents.imports.push({
|
|
107
107
|
namespace: NAMESPACE,
|
|
108
|
-
package:
|
|
108
|
+
package: PACKAGE_NAME,
|
|
109
109
|
remove: [ENTRYPOINT]
|
|
110
110
|
});
|
|
111
111
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { plugin } from '@esportsplus/typescript/compiler';
|
|
2
|
-
import {
|
|
2
|
+
import { PACKAGE_NAME } from '../constants';
|
|
3
3
|
import reactivity from '..';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export default plugin.vite({
|
|
7
|
-
name:
|
|
7
|
+
name: PACKAGE_NAME,
|
|
8
8
|
plugins: [reactivity]
|
|
9
9
|
});
|
package/src/constants.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const COMPUTED = Symbol('reactivity.computed');
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const PACKAGE_NAME = '@esportsplus/reactivity';
|
|
4
4
|
|
|
5
5
|
const REACTIVE_ARRAY = Symbol('reactivity.reactive.array');
|
|
6
6
|
|
|
@@ -32,7 +32,7 @@ const STATE_NOTIFY_MASK = (STATE_CHECK | STATE_DIRTY);
|
|
|
32
32
|
export {
|
|
33
33
|
COMPUTED,
|
|
34
34
|
REACTIVE_ARRAY, REACTIVE_OBJECT,
|
|
35
|
-
|
|
35
|
+
PACKAGE_NAME,
|
|
36
36
|
SIGNAL,
|
|
37
37
|
STABILIZER_IDLE, STABILIZER_RESCHEDULE, STABILIZER_RUNNING, STABILIZER_SCHEDULED,
|
|
38
38
|
STATE_CHECK, STATE_DIRTY, STATE_IN_HEAP, STATE_NONE, STATE_NOTIFY_MASK, STATE_RECOMPUTING
|
package/src/reactive/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { isArray, isObject } from '@esportsplus/utilities';
|
|
|
3
3
|
import { Reactive } from '~/types';
|
|
4
4
|
import { ReactiveArray } from './array';
|
|
5
5
|
import { ReactiveObject } from './object';
|
|
6
|
-
import {
|
|
6
|
+
import { PACKAGE_NAME } from '~/constants';
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
type Guard<T> =
|
|
@@ -37,7 +37,7 @@ function reactive<T>(input: T): Reactive<T> {
|
|
|
37
37
|
return response;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
throw new Error(`${
|
|
40
|
+
throw new Error(`${PACKAGE_NAME}: 'reactive' received invalid input - ${JSON.stringify(input)}`);
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
if (dispose) {
|