@fluixi/compiler 1.0.0-alpha.84 → 1.0.0-alpha.86
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/dist/analyze/expr-shape.d.cts +2 -2
- package/dist/analyze/expr-shape.d.ts +2 -2
- package/dist/analyze/expr-shape.js +1 -1
- package/dist/analyze/intrinsics.cjs +1 -1
- package/dist/analyze/intrinsics.d.cts +7 -7
- package/dist/analyze/intrinsics.d.ts +7 -7
- package/dist/analyze/intrinsics.d.ts.map +1 -1
- package/dist/analyze/intrinsics.js +3 -3
- package/dist/analyze/intrinsics.mjs +1 -1
- package/dist/analyze/props-destructure.d.cts +3 -3
- package/dist/analyze/props-destructure.d.ts +3 -3
- package/dist/analyze/props-destructure.d.ts.map +1 -1
- package/dist/analyze/props-destructure.js +4 -4
- package/dist/analyze/reactive-bindings.cjs +1 -1
- package/dist/analyze/reactive-bindings.d.cts +1 -1
- package/dist/analyze/reactive-bindings.d.ts +1 -1
- package/dist/analyze/reactive-bindings.js +2 -2
- package/dist/analyze/reactive-bindings.mjs +1 -1
- package/dist/analyze/reactive-expr.d.cts +4 -4
- package/dist/analyze/reactive-expr.d.ts +4 -4
- package/dist/analyze/reactive-expr.d.ts.map +1 -1
- package/dist/analyze/reactive-expr.js +2 -2
- package/dist/analyze/static-graph.cjs +2 -2
- package/dist/analyze/static-graph.d.cts +1 -1
- package/dist/analyze/static-graph.d.ts +1 -1
- package/dist/analyze/static-graph.d.ts.map +1 -1
- package/dist/analyze/static-graph.js +11 -11
- package/dist/analyze/static-graph.mjs +2 -2
- package/dist/{babel-NRW4EFTG.mjs → babel-EFKUQT45.mjs} +6 -6
- package/dist/{chunk-R2VHAZAX.mjs → chunk-D3ZN6JUI.mjs} +1 -1
- package/dist/{chunk-FSSWUXUR.mjs → chunk-DREDGBKD.mjs} +1 -1
- package/dist/{chunk-MJV3UXIL.mjs → chunk-H6UK4N32.mjs} +2 -2
- package/dist/{chunk-EZR7NZOY.mjs → chunk-LOFOPSDV.mjs} +3 -3
- package/dist/{chunk-3YKZ4GNH.mjs → chunk-SYNSZIB2.mjs} +1 -1
- package/dist/codegen/backends/imperative.cjs +1 -1
- package/dist/codegen/backends/imperative.d.cts +1 -1
- package/dist/codegen/backends/imperative.d.ts +1 -1
- package/dist/codegen/backends/imperative.js +12 -12
- package/dist/codegen/backends/imperative.mjs +1 -1
- package/dist/codegen/contract.d.cts +2 -2
- package/dist/codegen/contract.d.ts +2 -2
- package/dist/codegen/contract.js +2 -2
- package/dist/codegen/partial-template.d.cts +4 -4
- package/dist/codegen/partial-template.d.ts +4 -4
- package/dist/codegen/partial-template.js +0 -0
- package/dist/codegen/serialize-static.d.cts +3 -3
- package/dist/codegen/serialize-static.d.ts +3 -3
- package/dist/codegen/serialize-static.js +6 -6
- package/dist/frontend/babel/build-ir-lit.cjs +3 -3
- package/dist/frontend/babel/build-ir-lit.d.cts +2 -2
- package/dist/frontend/babel/build-ir-lit.d.ts +2 -2
- package/dist/frontend/babel/build-ir-lit.mjs +3 -3
- package/dist/frontend/babel/build-ir.cjs +3 -3
- package/dist/frontend/babel/build-ir.d.cts +2 -2
- package/dist/frontend/babel/build-ir.d.ts +2 -2
- package/dist/frontend/babel/build-ir.js +2 -2
- package/dist/frontend/babel/build-ir.mjs +3 -3
- package/dist/frontend/babel/index.cjs +5 -5
- package/dist/frontend/babel/index.d.cts +1 -1
- package/dist/frontend/babel/index.d.ts +1 -1
- package/dist/frontend/babel/index.js +1 -1
- package/dist/frontend/babel/index.mjs +5 -5
- package/dist/frontend/babel/lower-template.cjs +3 -3
- package/dist/frontend/babel/lower-template.d.cts +1 -1
- package/dist/frontend/babel/lower-template.d.ts +1 -1
- package/dist/frontend/babel/lower-template.js +2 -2
- package/dist/frontend/babel/lower-template.mjs +3 -3
- package/dist/frontend/babel/plugin.cjs +4 -4
- package/dist/frontend/babel/plugin.d.cts +5 -5
- package/dist/frontend/babel/plugin.d.ts +5 -5
- package/dist/frontend/babel/plugin.d.ts.map +1 -1
- package/dist/frontend/babel/plugin.js +14 -14
- package/dist/frontend/babel/plugin.mjs +4 -4
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +5 -5
- package/dist/integrations.cjs +12 -8
- package/dist/integrations.d.cts +9 -9
- package/dist/integrations.d.ts +9 -9
- package/dist/integrations.d.ts.map +1 -1
- package/dist/integrations.js +29 -8
- package/dist/integrations.mjs +15 -11
- package/dist/ir/nodes.d.cts +6 -6
- package/dist/ir/nodes.d.ts +6 -6
- package/dist/lower/compile-template.cjs +3 -3
- package/dist/lower/compile-template.d.cts +3 -3
- package/dist/lower/compile-template.d.ts +3 -3
- package/dist/lower/compile-template.js +1 -1
- package/dist/lower/compile-template.mjs +3 -3
- package/dist/lower/jsx.d.cts +1 -1
- package/dist/lower/jsx.d.ts +1 -1
- package/dist/lower/jsx.js +4 -4
- package/dist/lower/template.cjs +2 -2
- package/dist/lower/template.d.cts +3 -3
- package/dist/lower/template.d.ts +3 -3
- package/dist/lower/template.d.ts.map +1 -1
- package/dist/lower/template.js +7 -7
- package/dist/lower/template.mjs +2 -2
- package/dist/lower/text.d.cts +2 -2
- package/dist/lower/text.d.ts +2 -2
- package/dist/lower/text.d.ts.map +1 -1
- package/dist/lower/text.js +2 -2
- package/dist/optimize/analyze-static.d.cts +2 -2
- package/dist/optimize/analyze-static.d.ts +2 -2
- package/dist/optimize/analyze-static.js +2 -2
- package/dist/optimize/collapse-strategies.d.cts +3 -3
- package/dist/optimize/collapse-strategies.d.ts +3 -3
- package/dist/options.d.cts +2 -2
- package/dist/options.d.ts +2 -2
- package/dist/resolve/builtins.cjs +1 -1
- package/dist/resolve/builtins.d.cts +8 -8
- package/dist/resolve/builtins.d.ts +8 -8
- package/dist/resolve/builtins.d.ts.map +1 -1
- package/dist/resolve/builtins.js +4 -4
- package/dist/resolve/builtins.mjs +1 -1
- package/dist/resolve/component-globals.cjs +3 -3
- package/dist/resolve/component-globals.d.cts +5 -5
- package/dist/resolve/component-globals.d.ts +5 -5
- package/dist/resolve/component-globals.js +10 -10
- package/dist/resolve/component-globals.mjs +3 -3
- package/dist/resolve/component-resolver.d.cts +3 -3
- package/dist/resolve/component-resolver.d.ts +3 -3
- package/dist/resolve/component-resolver.d.ts.map +1 -1
- package/dist/resolve/component-resolver.js +3 -3
- package/dist/resolve/load-directive.d.cts +5 -5
- package/dist/resolve/load-directive.d.ts +5 -5
- package/dist/resolve/load-directive.js +6 -6
- package/dist/resolve/resolve-ir.d.cts +6 -6
- package/dist/resolve/resolve-ir.d.ts +6 -6
- package/dist/resolve/resolve-ir.d.ts.map +1 -1
- package/dist/resolve/resolve-ir.js +1 -1
- package/dist/resolve/write-globals.cjs +3 -3
- package/dist/resolve/write-globals.js +2 -2
- package/dist/resolve/write-globals.mjs +3 -3
- package/dist/{server-fns-4ZXN6DYU.mjs → server-fns-7I2C3D5P.mjs} +4 -4
- package/dist/{server-functions-V6D6DRIA.mjs → server-functions-GMKMN3D7.mjs} +3 -3
- package/dist/transform/bindings.d.cts +1 -1
- package/dist/transform/bindings.d.ts +1 -1
- package/dist/transform/bindings.js +1 -1
- package/dist/transform/index.cjs +3 -3
- package/dist/transform/index.mjs +3 -3
- package/dist/transform/intrinsics.cjs +1 -1
- package/dist/transform/intrinsics.js +1 -1
- package/dist/transform/intrinsics.mjs +1 -1
- package/dist/transform/props.d.cts +1 -1
- package/dist/transform/props.d.ts +1 -1
- package/dist/transform/props.d.ts.map +1 -1
- package/dist/transform/props.js +4 -4
- package/dist/transform/server-fn-id.d.cts +1 -1
- package/dist/transform/server-fn-id.d.ts +1 -1
- package/dist/transform/server-fn-id.js +2 -2
- package/dist/transform/server-fns.js +3 -3
- package/dist/transform/source-locations.cjs +1 -1
- package/dist/transform/source-locations.d.cts +1 -1
- package/dist/transform/source-locations.d.ts +1 -1
- package/dist/transform/source-locations.js +5 -5
- package/dist/transform/source-locations.mjs +1 -1
- package/dist/transform/templates.cjs +2 -2
- package/dist/transform/templates.d.cts +2 -2
- package/dist/transform/templates.d.ts +2 -2
- package/dist/transform/templates.d.ts.map +1 -1
- package/dist/transform/templates.js +7 -7
- package/dist/transform/templates.mjs +2 -2
- package/dist/{transform-BT4MMASR.mjs → transform-CRVH2C2I.mjs} +5 -5
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -34,7 +34,7 @@ var INTRINSICS = {
|
|
|
34
34
|
$store: { export: "store", module: "@fluixi/reactive/store", returns: "store-handle" },
|
|
35
35
|
$resource: { export: "resource", module: REACTIVE_MODULE, returns: "resource-handle" },
|
|
36
36
|
// No short runtime form for these yet, so the intrinsic stands for the `create*`
|
|
37
|
-
// name. Still worth having
|
|
37
|
+
// name. Still worth having: no import to write, and when a shorter form is
|
|
38
38
|
// designed, the change is this line rather than a compiler pass.
|
|
39
39
|
$selector: { export: "createSelector", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
40
40
|
$deferred: { export: "createDeferred", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* → const [count, setCount] = createSignal(0); + the import
|
|
6
6
|
*
|
|
7
7
|
* Only the callee is rewritten, so arguments keep the author's text and the span stays
|
|
8
|
-
* put
|
|
8
|
+
* put: `$signal(0)` and `createSignal(0)` map to the same place. Imports are collected
|
|
9
9
|
* from what the module actually used, so a file with one `$signal` gets one import.
|
|
10
10
|
*
|
|
11
11
|
* A module that binds `$signal` itself keeps its own meaning and is reported instead;
|
|
@@ -7,7 +7,7 @@ var INTRINSICS = {
|
|
|
7
7
|
$store: { export: "store", module: "@fluixi/reactive/store", returns: "store-handle" },
|
|
8
8
|
$resource: { export: "resource", module: REACTIVE_MODULE, returns: "resource-handle" },
|
|
9
9
|
// No short runtime form for these yet, so the intrinsic stands for the `create*`
|
|
10
|
-
// name. Still worth having
|
|
10
|
+
// name. Still worth having: no import to write, and when a shorter form is
|
|
11
11
|
// designed, the change is this line rather than a compiler pass.
|
|
12
12
|
$selector: { export: "createSelector", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
13
13
|
$deferred: { export: "createDeferred", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
@@ -31,7 +31,7 @@ export interface PropsEdit {
|
|
|
31
31
|
export interface PropsEditsResult {
|
|
32
32
|
edits: PropsEdit[];
|
|
33
33
|
diagnostics: PropsDiagnostic[];
|
|
34
|
-
/** Runtime symbols the emitted code needs
|
|
34
|
+
/** Runtime symbols the emitted code needs: `splitProps`, when a pattern had a rest. */
|
|
35
35
|
used: Set<string>;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
@@ -31,7 +31,7 @@ export interface PropsEdit {
|
|
|
31
31
|
export interface PropsEditsResult {
|
|
32
32
|
edits: PropsEdit[];
|
|
33
33
|
diagnostics: PropsDiagnostic[];
|
|
34
|
-
/** Runtime symbols the emitted code needs
|
|
34
|
+
/** Runtime symbols the emitted code needs: `splitProps`, when a pattern had a rest. */
|
|
35
35
|
used: Set<string>;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/transform/props.ts"],"names":[],"mappings":"AAaA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAqC,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAU1G,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAA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AC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,uFAAuF;IACvF,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnB;AA+ED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,qBAA0B,GAClC,gBAAgB,CAuFlB;AAgBD,qFAAqF;AACrF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,SAAe,EACvB,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CA0BtB"}
|
package/dist/transform/props.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `function Card({ title, size = 'md' })` becomes `function Card(props)` with `title`
|
|
5
5
|
* rewritten to `props.title` wherever it's used, so the reads stay live. What can't be
|
|
6
|
-
* rewritten is left alone and reported
|
|
6
|
+
* rewritten is left alone and reported: see analyze/props-destructure for the rules.
|
|
7
7
|
*
|
|
8
8
|
* Source in, source out, spans spliced with magic-string, so the author's formatting
|
|
9
9
|
* survives and the map comes out of the splice. It runs before templates are compiled,
|
|
@@ -133,7 +133,7 @@ export function collectPropsEdits(program, code, options = {}) {
|
|
|
133
133
|
edits.push({ start: pattern.start, end: annotation?.start ?? pattern.end, code: parameter });
|
|
134
134
|
// `...rest` becomes the splitProps call the author would have written. splitProps
|
|
135
135
|
// carries the getters over instead of reading them, which is the whole reason a
|
|
136
|
-
// plain rest can't be rewritten
|
|
136
|
+
// plain rest can't be rewritten: so this hands the job to the runtime helper that
|
|
137
137
|
// does it properly rather than refusing the pattern.
|
|
138
138
|
if (plan.rest) {
|
|
139
139
|
const keys = plan.rest.keys.map((k) => JSON.stringify(k)).join(', ');
|
|
@@ -170,7 +170,7 @@ export function collectPropsEdits(program, code, options = {}) {
|
|
|
170
170
|
edits.push({ start: match.node.start, end: match.node.end, code: match.text });
|
|
171
171
|
}
|
|
172
172
|
// Say it in the AST too, not only in the text. Whether a hole is wired reactively
|
|
173
|
-
// is decided from the expression's shape, and a bare identifier is not reactive
|
|
173
|
+
// is decided from the expression's shape, and a bare identifier is not reactive ,
|
|
174
174
|
// so leaving the node as an Identifier emits `props.text` read once, which is the
|
|
175
175
|
// bug this whole pass exists to remove. A member read is reactive, which is what
|
|
176
176
|
// the emitted code now is.
|
|
@@ -207,7 +207,7 @@ export function transformProps(code, filename = 'module.tsx', options = {}) {
|
|
|
207
207
|
else
|
|
208
208
|
source.overwrite(e.start, e.end, e.code);
|
|
209
209
|
}
|
|
210
|
-
// Standalone, there's no prologue to join, so the import goes in here
|
|
210
|
+
// Standalone, there's no prologue to join, so the import goes in here, unless the
|
|
211
211
|
// module already has the name bound.
|
|
212
212
|
if (used.has('splitProps') && !moduleBindings(ast.program).has('splitProps')) {
|
|
213
213
|
source.prepend(`import { splitProps } from ${JSON.stringify(options.runtimeModule ?? '@fluixi/dom')};\n`);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The id a server function is registered and called by.
|
|
3
3
|
*
|
|
4
4
|
* Client stub and server registration are produced by separate builds of the
|
|
5
|
-
* same file, so this has to agree across them exactly
|
|
5
|
+
* same file, so this has to agree across them exactly, same hash, same
|
|
6
6
|
* relative path, same index. Shared rather than duplicated for that reason.
|
|
7
7
|
*/
|
|
8
8
|
export declare function hash(s: string): string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The id a server function is registered and called by.
|
|
3
3
|
*
|
|
4
4
|
* Client stub and server registration are produced by separate builds of the
|
|
5
|
-
* same file, so this has to agree across them exactly
|
|
5
|
+
* same file, so this has to agree across them exactly, same hash, same
|
|
6
6
|
* relative path, same index. Shared rather than duplicated for that reason.
|
|
7
7
|
*/
|
|
8
8
|
export declare function hash(s: string): string;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* The id a server function is registered and called by.
|
|
3
3
|
*
|
|
4
4
|
* Client stub and server registration are produced by separate builds of the
|
|
5
|
-
* same file, so this has to agree across them exactly
|
|
5
|
+
* same file, so this has to agree across them exactly, same hash, same
|
|
6
6
|
* relative path, same index. Shared rather than duplicated for that reason.
|
|
7
7
|
*/
|
|
8
|
-
// djb2
|
|
8
|
+
// djb2: tiny, stable, dependency-free. Hex, so the id is a valid identifier suffix.
|
|
9
9
|
export function hash(s) {
|
|
10
10
|
let h = 5381;
|
|
11
11
|
for (let i = 0; i < s.length; i++)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `"use server"
|
|
2
|
+
* `"use server"`: a function carrying the directive runs only on the server and
|
|
3
3
|
* is callable from the client over RPC.
|
|
4
4
|
*
|
|
5
5
|
* const getUser = async (id) => { 'use server'; return db.users.find(id); };
|
|
@@ -32,7 +32,7 @@ function directive(node) {
|
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* Server functions in source order, not descending into one already found
|
|
35
|
+
* Server functions in source order, not descending into one already found, a
|
|
36
36
|
* nested `"use server"` belongs to the body that is about to be replaced or
|
|
37
37
|
* shipped whole, exactly as the babel visitor's `path.skip()` decided.
|
|
38
38
|
*/
|
|
@@ -76,7 +76,7 @@ export function transformServerFns(code, options) {
|
|
|
76
76
|
const id = serverFnId(options.filename, options.root, index);
|
|
77
77
|
const declaration = fn.type === 'FunctionDeclaration';
|
|
78
78
|
if (!options.ssr) {
|
|
79
|
-
// The body never reaches the client
|
|
79
|
+
// The body never reaches the client: it is replaced, not emptied.
|
|
80
80
|
const stub = `${helper}(${JSON.stringify(id)})`;
|
|
81
81
|
out.overwrite(fn.start, fn.end, declaration ? `const ${fn.id.name} = ${stub};` : stub);
|
|
82
82
|
return;
|
|
@@ -40,7 +40,7 @@ var INTRINSICS = {
|
|
|
40
40
|
$store: { export: "store", module: "@fluixi/reactive/store", returns: "store-handle" },
|
|
41
41
|
$resource: { export: "resource", module: REACTIVE_MODULE, returns: "resource-handle" },
|
|
42
42
|
// No short runtime form for these yet, so the intrinsic stands for the `create*`
|
|
43
|
-
// name. Still worth having
|
|
43
|
+
// name. Still worth having: no import to write, and when a shorter form is
|
|
44
44
|
// designed, the change is this line rather than a compiler pass.
|
|
45
45
|
$selector: { export: "createSelector", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
46
46
|
$deferred: { export: "createDeferred", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
@@ -33,7 +33,7 @@ export declare const markHole: (accessor: string, line: number, column: number,
|
|
|
33
33
|
*
|
|
34
34
|
* The props object is built as getters, so nothing in it can carry a position of its own.
|
|
35
35
|
* The marker takes the object and a name-to-position map, and hands the object straight
|
|
36
|
-
* back
|
|
36
|
+
* back: devtools keeps the map, and a build without it passes the object through.
|
|
37
37
|
*/
|
|
38
38
|
export declare const PROPS_MARKER = "__fx_props";
|
|
39
39
|
/** `_({ get a() {…} }, {"a":[9,25]})`, or the object untouched when nothing is watching. */
|
|
@@ -33,7 +33,7 @@ export declare const markHole: (accessor: string, line: number, column: number,
|
|
|
33
33
|
*
|
|
34
34
|
* The props object is built as getters, so nothing in it can carry a position of its own.
|
|
35
35
|
* The marker takes the object and a name-to-position map, and hands the object straight
|
|
36
|
-
* back
|
|
36
|
+
* back: devtools keeps the map, and a build without it passes the object through.
|
|
37
37
|
*/
|
|
38
38
|
export declare const PROPS_MARKER = "__fx_props";
|
|
39
39
|
/** `_({ get a() {…} }, {"a":[9,25]})`, or the object untouched when nothing is watching. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* → globalThis.__fx_source?.("src/App.ts",1,14,"count"); const count = signal(0);
|
|
6
6
|
*
|
|
7
7
|
* A statement in front of the one that creates the node, not a wrapper round the call: the
|
|
8
|
-
* call may already be being rewritten
|
|
8
|
+
* call may already be being rewritten: `$signal` becomes `signal`, and two passes editing
|
|
9
9
|
* one span is a splice over a splice.
|
|
10
10
|
*
|
|
11
11
|
* A global rather than an import, so the author's modules do not each take a dependency on
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Positions come from the original source, before any pass moves anything.
|
|
15
15
|
*
|
|
16
|
-
* Development only, and one mark per statement
|
|
16
|
+
* Development only, and one mark per statement: the runtime keeps a single slot, so
|
|
17
17
|
* marking two calls in one statement would hand the first node the second's location.
|
|
18
18
|
*/
|
|
19
19
|
import { INTRINSICS, isIntrinsicName } from '../analyze/intrinsics.js';
|
|
@@ -43,7 +43,7 @@ export const markHole = (accessor, line, column, name) => `(globalThis.${HOLE_MA
|
|
|
43
43
|
*
|
|
44
44
|
* The props object is built as getters, so nothing in it can carry a position of its own.
|
|
45
45
|
* The marker takes the object and a name-to-position map, and hands the object straight
|
|
46
|
-
* back
|
|
46
|
+
* back: devtools keeps the map, and a build without it passes the object through.
|
|
47
47
|
*/
|
|
48
48
|
export const PROPS_MARKER = '__fx_props';
|
|
49
49
|
/** `_({ get a() {…} }, {"a":[9,25]})`, or the object untouched when nothing is watching. */
|
|
@@ -149,7 +149,7 @@ export function collectSourceEdits(program, filename) {
|
|
|
149
149
|
// template pass overwrites.
|
|
150
150
|
//
|
|
151
151
|
// Only through what wraps a declaration. Anything else above it is a block or an
|
|
152
|
-
// argument list, and a statement appended there lands outside the grammar
|
|
152
|
+
// argument list, and a statement appended there lands outside the grammar ,
|
|
153
153
|
// `function Page(){}` inside `it('…', () => { … })` ended up between the `}` and the
|
|
154
154
|
// `)`, which is a syntax error in a file that compiled a moment earlier.
|
|
155
155
|
let end = node.end;
|
|
@@ -201,7 +201,7 @@ export function collectSourceEdits(program, filename) {
|
|
|
201
201
|
if (!statement)
|
|
202
202
|
return;
|
|
203
203
|
// `export const [cart] = createStore(…)` finds the declaration, which starts after the
|
|
204
|
-
// keyword
|
|
204
|
+
// keyword: a mark there splits `export` from what it exports.
|
|
205
205
|
let start = statement.start;
|
|
206
206
|
let end = statement.end;
|
|
207
207
|
for (let i = index - 1; i >= 0; i--) {
|
|
@@ -7,7 +7,7 @@ var INTRINSICS = {
|
|
|
7
7
|
$store: { export: "store", module: "@fluixi/reactive/store", returns: "store-handle" },
|
|
8
8
|
$resource: { export: "resource", module: REACTIVE_MODULE, returns: "resource-handle" },
|
|
9
9
|
// No short runtime form for these yet, so the intrinsic stands for the `create*`
|
|
10
|
-
// name. Still worth having
|
|
10
|
+
// name. Still worth having: no import to write, and when a shorter form is
|
|
11
11
|
// designed, the change is this line rather than a compiler pass.
|
|
12
12
|
$selector: { export: "createSelector", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
13
13
|
$deferred: { export: "createDeferred", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
@@ -482,7 +482,7 @@ var INTRINSICS = {
|
|
|
482
482
|
$store: { export: "store", module: "@fluixi/reactive/store", returns: "store-handle" },
|
|
483
483
|
$resource: { export: "resource", module: REACTIVE_MODULE, returns: "resource-handle" },
|
|
484
484
|
// No short runtime form for these yet, so the intrinsic stands for the `create*`
|
|
485
|
-
// name. Still worth having
|
|
485
|
+
// name. Still worth having: no import to write, and when a shorter form is
|
|
486
486
|
// designed, the change is this line rather than a compiler pass.
|
|
487
487
|
$selector: { export: "createSelector", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
488
488
|
$deferred: { export: "createDeferred", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
@@ -1574,7 +1574,7 @@ var Lowerer = class {
|
|
|
1574
1574
|
}
|
|
1575
1575
|
];
|
|
1576
1576
|
}
|
|
1577
|
-
/** A plain attribute (incl. lit `?bool`, mixed values)
|
|
1577
|
+
/** A plain attribute (incl. lit `?bool`, mixed values), old `mkProp` behavior. */
|
|
1578
1578
|
plainAttr(a) {
|
|
1579
1579
|
const v = a.value;
|
|
1580
1580
|
let name = a.name;
|
|
@@ -37,7 +37,7 @@ export interface TransformOptions extends CompileTemplateOptions {
|
|
|
37
37
|
*/
|
|
38
38
|
sourceRoot?: string;
|
|
39
39
|
/**
|
|
40
|
-
* Compile the `$` reactive intrinsics
|
|
40
|
+
* Compile the `$` reactive intrinsics: `$signal`, `$memo`, `$effect`, `$store`, into
|
|
41
41
|
* the runtime calls they stand for, importing what they need.
|
|
42
42
|
* @default true
|
|
43
43
|
*/
|
|
@@ -63,7 +63,7 @@ export interface TransformResult {
|
|
|
63
63
|
intrinsicDiagnostics?: IntrinsicDiagnostic[];
|
|
64
64
|
/** `load:` directives that could not take effect, and why. */
|
|
65
65
|
loadDiagnostics?: LoadDiagnostic[];
|
|
66
|
-
/** Capitalised tags nothing supplies
|
|
66
|
+
/** Capitalised tags nothing supplies: they compile to an undefined reference. */
|
|
67
67
|
unresolvedDiagnostics?: UnresolvedDiagnostic[];
|
|
68
68
|
}
|
|
69
69
|
export declare function transformTemplates(code: string, id: string, options?: TransformOptions): TransformResult | null;
|
|
@@ -37,7 +37,7 @@ export interface TransformOptions extends CompileTemplateOptions {
|
|
|
37
37
|
*/
|
|
38
38
|
sourceRoot?: string;
|
|
39
39
|
/**
|
|
40
|
-
* Compile the `$` reactive intrinsics
|
|
40
|
+
* Compile the `$` reactive intrinsics: `$signal`, `$memo`, `$effect`, `$store`, into
|
|
41
41
|
* the runtime calls they stand for, importing what they need.
|
|
42
42
|
* @default true
|
|
43
43
|
*/
|
|
@@ -63,7 +63,7 @@ export interface TransformResult {
|
|
|
63
63
|
intrinsicDiagnostics?: IntrinsicDiagnostic[];
|
|
64
64
|
/** `load:` directives that could not take effect, and why. */
|
|
65
65
|
loadDiagnostics?: LoadDiagnostic[];
|
|
66
|
-
/** Capitalised tags nothing supplies
|
|
66
|
+
/** Capitalised tags nothing supplies: they compile to an undefined reference. */
|
|
67
67
|
unresolvedDiagnostics?: UnresolvedDiagnostic[];
|
|
68
68
|
}
|
|
69
69
|
export declare function transformTemplates(code: string, id: string, options?: TransformOptions): TransformResult | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/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CAAC;IACb,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5C,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,wEAAwE;IACxE,oBAAoB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC7C,8DAA8D;IAC9D,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,iFAAiF;IACjF,qBAAqB,CAAC,EAAE,oBAAoB,EAAE,CAAC;CAChD;AAwTD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,gBAAqB,GAC7B,eAAe,GAAG,IAAI,CAiNxB"}
|
|
@@ -25,7 +25,7 @@ import { collectSourceEdits, mayHaveReactiveCall } from './source-locations.js';
|
|
|
25
25
|
import { mayHaveIntrinsic } from '../analyze/intrinsics.js';
|
|
26
26
|
import { declaredNames } from '../analyze/reactive-bindings.js';
|
|
27
27
|
import { DOM_CONTROL_FLOW, CORE_CONTROL_FLOW, ROUTER_COMPONENTS } from '../resolve/builtins.js';
|
|
28
|
-
// Which builtin comes from which module is published by resolve/builtins.ts
|
|
28
|
+
// Which builtin comes from which module is published by resolve/builtins.ts ,
|
|
29
29
|
// the same lists the resolve pass and the TS plugin read. Restating them here is
|
|
30
30
|
// how `Await` ended up imported from the dom runtime, which does not export it.
|
|
31
31
|
const CONTROL_FLOW = new Set(DOM_CONTROL_FLOW);
|
|
@@ -56,7 +56,7 @@ const isJsx = (node) => node.type === 'JSXElement' || node.type === 'JSXFragment
|
|
|
56
56
|
/**
|
|
57
57
|
* A JSX node the transform compiles on its own.
|
|
58
58
|
*
|
|
59
|
-
* A direct child
|
|
59
|
+
* A direct child: `<li>` in `<ul><li/></ul>`: is not one: the builder recurses
|
|
60
60
|
* into it, and compiling it separately would splice its output into the middle of
|
|
61
61
|
* its parent's. JSX reached through an expression or an attribute value *is* one,
|
|
62
62
|
* because the builder asks for that expression as source text and needs it
|
|
@@ -88,7 +88,7 @@ function outermost(list) {
|
|
|
88
88
|
* Apply edits to a slice of the source.
|
|
89
89
|
*
|
|
90
90
|
* Only the outermost ones: a contained edit was already folded into its
|
|
91
|
-
* container's emitted code, and applying both would splice it twice
|
|
91
|
+
* container's emitted code, and applying both would splice it twice, the second
|
|
92
92
|
* write landing at an offset the first has already moved.
|
|
93
93
|
*/
|
|
94
94
|
function slice(code, start, end, edits) {
|
|
@@ -131,7 +131,7 @@ function bindHole(code, expr, edits, keepPosition = false) {
|
|
|
131
131
|
*
|
|
132
132
|
* Hoisted names deliberately do not use the backend's `_tmpl$N` namespace. Roots
|
|
133
133
|
* are emitted innermost first and spliced into their parent, so by the time the
|
|
134
|
-
* outer one is renamed its code already contains hoisted names
|
|
134
|
+
* outer one is renamed its code already contains hoisted names, and with a
|
|
135
135
|
* shared prefix the rename rewrites those too, pointing two templates at one
|
|
136
136
|
* string. A separate prefix makes the two impossible to confuse.
|
|
137
137
|
*/
|
|
@@ -186,7 +186,7 @@ function collectNeeds(node, out) {
|
|
|
186
186
|
* chunk splits like any other.
|
|
187
187
|
*
|
|
188
188
|
* Only when the name is used **exclusively as a tag**. JSX element names are
|
|
189
|
-
* `JSXIdentifier`, so a component used only in markup has zero `Identifier` references
|
|
189
|
+
* `JSXIdentifier`, so a component used only in markup has zero `Identifier` references ,
|
|
190
190
|
* which makes the check exact rather than a guess. Anything else (passed to a function,
|
|
191
191
|
* re-exported, `Chart.displayName`) keeps its import and its warning: replacing the real
|
|
192
192
|
* binding with a lazy wrapper would change what those sites see.
|
|
@@ -221,7 +221,7 @@ function hasNamespaceImport(program, name) {
|
|
|
221
221
|
}
|
|
222
222
|
return false;
|
|
223
223
|
}
|
|
224
|
-
/** Whether `name` is referenced as a value anywhere
|
|
224
|
+
/** Whether `name` is referenced as a value anywhere, a tag alone does not count. */
|
|
225
225
|
function usedAsValue(program, name, specifier) {
|
|
226
226
|
let seen = false;
|
|
227
227
|
walk(program, (node) => {
|
|
@@ -338,7 +338,7 @@ export function transformTemplates(code, id, options = {}) {
|
|
|
338
338
|
const sources = options.sourceLocations === true
|
|
339
339
|
? collectSourceEdits(ast.program, sourceName)
|
|
340
340
|
: { edits: [], marked: 0 };
|
|
341
|
-
// Nothing to emit still returns a result when there's something to say
|
|
341
|
+
// Nothing to emit still returns a result when there's something to say, a shadowed
|
|
342
342
|
// intrinsic is a diagnostic even though the code comes back untouched.
|
|
343
343
|
const silent = found.length === 0 &&
|
|
344
344
|
props.edits.length === 0 &&
|
|
@@ -1520,7 +1520,7 @@ var INTRINSICS = {
|
|
|
1520
1520
|
$store: { export: "store", module: "@fluixi/reactive/store", returns: "store-handle" },
|
|
1521
1521
|
$resource: { export: "resource", module: REACTIVE_MODULE, returns: "resource-handle" },
|
|
1522
1522
|
// No short runtime form for these yet, so the intrinsic stands for the `create*`
|
|
1523
|
-
// name. Still worth having
|
|
1523
|
+
// name. Still worth having: no import to write, and when a shorter form is
|
|
1524
1524
|
// designed, the change is this line rather than a compiler pass.
|
|
1525
1525
|
$selector: { export: "createSelector", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
1526
1526
|
$deferred: { export: "createDeferred", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
@@ -2614,7 +2614,7 @@ var Lowerer = class {
|
|
|
2614
2614
|
}
|
|
2615
2615
|
];
|
|
2616
2616
|
}
|
|
2617
|
-
/** A plain attribute (incl. lit `?bool`, mixed values)
|
|
2617
|
+
/** A plain attribute (incl. lit `?bool`, mixed values), old `mkProp` behavior. */
|
|
2618
2618
|
plainAttr(a) {
|
|
2619
2619
|
const v = a.value;
|
|
2620
2620
|
let name = a.name;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/compiler v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/compiler v1.0.0-alpha.86 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
import {
|
|
3
3
|
analyzeStatic,
|
|
4
4
|
buildJsxIR,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
resolveComponentSources,
|
|
15
15
|
resolveReactiveBindings,
|
|
16
16
|
shapeOf
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LOFOPSDV.mjs";
|
|
18
18
|
import {
|
|
19
19
|
CORE_CONTROL_FLOW,
|
|
20
20
|
DOM_CONTROL_FLOW,
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
createComponentResolver,
|
|
24
24
|
isIntrinsicName,
|
|
25
25
|
mayHaveIntrinsic
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-H6UK4N32.mjs";
|
|
27
27
|
import {
|
|
28
28
|
MagicString
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-D3ZN6JUI.mjs";
|
|
30
|
+
import "./chunk-SYNSZIB2.mjs";
|
|
31
31
|
|
|
32
32
|
// src/transform/templates.ts
|
|
33
33
|
import { parse as parse2 } from "@babel/parser";
|