@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
package/dist/lower/jsx.d.cts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Build IR from a JSX tree.
|
|
3
3
|
*
|
|
4
4
|
* Reads `node.type` rather than a parser's helpers, and asks the caller for the
|
|
5
|
-
* source of an expression through `code()
|
|
5
|
+
* source of an expression through `code()`: a front-end that can slice the
|
|
6
6
|
* original text returns that, one that reprints returns the printed form. Either
|
|
7
7
|
* way the IR is the same, which is what keeps one builder for both.
|
|
8
8
|
*/
|
package/dist/lower/jsx.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Build IR from a JSX tree.
|
|
3
3
|
*
|
|
4
4
|
* Reads `node.type` rather than a parser's helpers, and asks the caller for the
|
|
5
|
-
* source of an expression through `code()
|
|
5
|
+
* source of an expression through `code()`: a front-end that can slice the
|
|
6
6
|
* original text returns that, one that reprints returns the printed form. Either
|
|
7
7
|
* way the IR is the same, which is what keeps one builder for both.
|
|
8
8
|
*/
|
package/dist/lower/jsx.js
CHANGED
|
@@ -14,7 +14,7 @@ const DELEGATED = new Set([
|
|
|
14
14
|
'keydown', 'keyup', 'keypress', 'mousedown', 'mouseup',
|
|
15
15
|
]);
|
|
16
16
|
const isReactive = (node) => isReactiveShape(shapeOf(node));
|
|
17
|
-
/** Only when the host asked for source locations
|
|
17
|
+
/** Only when the host asked for source locations, the flag that records usage sites too. */
|
|
18
18
|
const posOf = (node, ctx) => {
|
|
19
19
|
if (!ctx.sourceFile)
|
|
20
20
|
return undefined;
|
|
@@ -87,7 +87,7 @@ function buildAttr(attr, ctx) {
|
|
|
87
87
|
base.expr = ctx.code(expr);
|
|
88
88
|
base.reactive = isHandler ? false : isReactive(expr);
|
|
89
89
|
// Every prop, not only the ones that move: a panel names the line for each of them.
|
|
90
|
-
// Nothing treats this as a binding position
|
|
90
|
+
// Nothing treats this as a binding position: that asks for `reactive` as well.
|
|
91
91
|
base.at = posOf(expr, ctx);
|
|
92
92
|
if (expr.type === 'JSXElement' || expr.type === 'JSXFragment')
|
|
93
93
|
base.jsxElement = true;
|
|
@@ -118,7 +118,7 @@ function buildProps(attrs, ctx) {
|
|
|
118
118
|
}
|
|
119
119
|
if (a.type !== 'JSXAttribute')
|
|
120
120
|
continue;
|
|
121
|
-
// load: is a directive, not a prop
|
|
121
|
+
// load: is a directive, not a prop: the resolve pass reads it off the node.
|
|
122
122
|
if (isLoadDirective(attrName(a.name)))
|
|
123
123
|
continue;
|
|
124
124
|
const ns = a.name.type === 'JSXNamespacedName' ? a.name.namespace.name : null;
|
|
@@ -148,7 +148,7 @@ function buildChildren(children, ctx) {
|
|
|
148
148
|
const out = [];
|
|
149
149
|
for (const child of children) {
|
|
150
150
|
if (child.type === 'JSXText') {
|
|
151
|
-
// Drop whitespace-only text spanning a newline so a lone child stays lone
|
|
151
|
+
// Drop whitespace-only text spanning a newline so a lone child stays lone ,
|
|
152
152
|
// an array insert will not reactively bind a memo/component inside it.
|
|
153
153
|
const text = cleanTemplateText(child.value);
|
|
154
154
|
if (text)
|
package/dist/lower/template.cjs
CHANGED
|
@@ -284,7 +284,7 @@ var INTRINSICS = {
|
|
|
284
284
|
$store: { export: "store", module: "@fluixi/reactive/store", returns: "store-handle" },
|
|
285
285
|
$resource: { export: "resource", module: REACTIVE_MODULE, returns: "resource-handle" },
|
|
286
286
|
// No short runtime form for these yet, so the intrinsic stands for the `create*`
|
|
287
|
-
// name. Still worth having
|
|
287
|
+
// name. Still worth having: no import to write, and when a shorter form is
|
|
288
288
|
// designed, the change is this line rather than a compiler pass.
|
|
289
289
|
$selector: { export: "createSelector", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
290
290
|
$deferred: { export: "createDeferred", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
@@ -1014,7 +1014,7 @@ var Lowerer = class {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
];
|
|
1016
1016
|
}
|
|
1017
|
-
/** A plain attribute (incl. lit `?bool`, mixed values)
|
|
1017
|
+
/** A plain attribute (incl. lit `?bool`, mixed values), old `mkProp` behavior. */
|
|
1018
1018
|
plainAttr(a) {
|
|
1019
1019
|
const v = a.value;
|
|
1020
1020
|
let name = a.name;
|
|
@@ -10,7 +10,7 @@ import { type Piece } from '@fluixi/template-parser';
|
|
|
10
10
|
import type { HolePosition, IRNode } from '../ir/nodes.cjs';
|
|
11
11
|
/**
|
|
12
12
|
* One `${…}` slot, as the front-end describes it. Conclusions about the
|
|
13
|
-
* expression only
|
|
13
|
+
* expression only: never a syntax tree, or the parser dependency creeps back.
|
|
14
14
|
*/
|
|
15
15
|
export interface TemplateHole {
|
|
16
16
|
/** The expression source, verbatim. Anything nested inside it is already compiled. */
|
|
@@ -18,7 +18,7 @@ export interface TemplateHole {
|
|
|
18
18
|
/** Whether it must be wired reactively (see analyze/reactive-expr.ts). */
|
|
19
19
|
reactive: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* Set when the hole is a single-expression arrow
|
|
21
|
+
* Set when the hole is a single-expression arrow, `${item => …}`. `each` turns
|
|
22
22
|
* that into `For`'s render function, so it needs the parameters and the body
|
|
23
23
|
* separately rather than the arrow as written.
|
|
24
24
|
*/
|
|
@@ -27,7 +27,7 @@ export interface TemplateHole {
|
|
|
27
27
|
body: string;
|
|
28
28
|
bodyReactive: boolean;
|
|
29
29
|
};
|
|
30
|
-
/** Whether the hole is an object literal
|
|
30
|
+
/** Whether the hole is an object literal: `class=${{…}}` lowers to classList. */
|
|
31
31
|
object?: boolean;
|
|
32
32
|
/**
|
|
33
33
|
* Where the `${…}` was written. Only kept when the host asked for source locations.
|
package/dist/lower/template.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { type Piece } from '@fluixi/template-parser';
|
|
|
10
10
|
import type { HolePosition, IRNode } from '../ir/nodes.js';
|
|
11
11
|
/**
|
|
12
12
|
* One `${…}` slot, as the front-end describes it. Conclusions about the
|
|
13
|
-
* expression only
|
|
13
|
+
* expression only: never a syntax tree, or the parser dependency creeps back.
|
|
14
14
|
*/
|
|
15
15
|
export interface TemplateHole {
|
|
16
16
|
/** The expression source, verbatim. Anything nested inside it is already compiled. */
|
|
@@ -18,7 +18,7 @@ export interface TemplateHole {
|
|
|
18
18
|
/** Whether it must be wired reactively (see analyze/reactive-expr.ts). */
|
|
19
19
|
reactive: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* Set when the hole is a single-expression arrow
|
|
21
|
+
* Set when the hole is a single-expression arrow, `${item => …}`. `each` turns
|
|
22
22
|
* that into `For`'s render function, so it needs the parameters and the body
|
|
23
23
|
* separately rather than the arrow as written.
|
|
24
24
|
*/
|
|
@@ -27,7 +27,7 @@ export interface TemplateHole {
|
|
|
27
27
|
body: string;
|
|
28
28
|
bodyReactive: boolean;
|
|
29
29
|
};
|
|
30
|
-
/** Whether the hole is an object literal
|
|
30
|
+
/** Whether the hole is an object literal: `class=${{…}}` lowers to classList. */
|
|
31
31
|
object?: boolean;
|
|
32
32
|
/**
|
|
33
33
|
* Where the `${…}` was written. Only kept when the host asked for source locations.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/lower/template.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAML,KAAK,KAAK,EAGX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAsB,MAAM,gBAAgB,CAAC;AAM/E;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAE,CAAC;IAClE,
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/lower/template.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAML,KAAK,KAAK,EAGX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAsB,MAAM,gBAAgB,CAAC;AAM/E;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAE,CAAC;IAClE,iFAAiF;IACjF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,YAAY,CAAC;CACnB;AAmhBD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,KAAK,EAAE,EACf,KAAK,EAAE,YAAY,EAAE,EACrB,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EACjB,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAO,GACnH,MAAM,CAGR"}
|
package/dist/lower/template.js
CHANGED
|
@@ -149,13 +149,13 @@ class Lowerer {
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
lowerComponent(el) {
|
|
152
|
-
// `<${Comp} />`: the tag is an interpolated expression
|
|
152
|
+
// `<${Comp} />`: the tag is an interpolated expression, use the hole's code
|
|
153
153
|
// as the component identity, so `createComponent(<expr>, …)` is emitted.
|
|
154
154
|
const name = el.tagHole != null ? this.hole(el.tagHole).code : el.tag;
|
|
155
155
|
const props = this.lowerAttributes(el.attributes);
|
|
156
156
|
// Named slots: a child with `slot="header"` becomes `props.header` (a lazy
|
|
157
157
|
// getter, like `children`); the rest stay the default `children`. This is the
|
|
158
|
-
// Solid convention
|
|
158
|
+
// Solid convention: the component reads `props.header` / `props.children`.
|
|
159
159
|
const { slots, rest } = this.partitionSlots(el.children);
|
|
160
160
|
for (const [slotName, nodes] of slots) {
|
|
161
161
|
const ir = nodes.length === 1 ? nodes[0] : { kind: 'fragment', children: nodes };
|
|
@@ -166,7 +166,7 @@ class Lowerer {
|
|
|
166
166
|
jsxElement: true,
|
|
167
167
|
};
|
|
168
168
|
// A slot replaces a same-named attribute rather than joining it. `<Card header>`
|
|
169
|
-
// alongside `<span slot="header">` otherwise emits the key twice
|
|
169
|
+
// alongside `<span slot="header">` otherwise emits the key twice, valid JS where
|
|
170
170
|
// the last wins, but the first is dead code and esbuild warns on it. Content is
|
|
171
171
|
// the more specific intent, so the slot is what survives.
|
|
172
172
|
const clash = props.findIndex((p) => p.name === slotName);
|
|
@@ -183,7 +183,7 @@ class Lowerer {
|
|
|
183
183
|
: undefined;
|
|
184
184
|
// The parser's positions are relative to the template string, not the file, so the
|
|
185
185
|
// tag itself has none to give. The first hole is the closest thing that does, and for
|
|
186
|
-
// the control-flow components
|
|
186
|
+
// the control-flow components: `<Show when=${…}>`, `<For each=${…}>`, it is the
|
|
187
187
|
// expression driving the subtree anyway.
|
|
188
188
|
// A reactive one: a literal carries a position too now, and it drives nothing.
|
|
189
189
|
const bindAt = props.find((p) => p.at && p.reactive)?.at;
|
|
@@ -369,7 +369,7 @@ class Lowerer {
|
|
|
369
369
|
// Merge all class:/style: directives into one classList/style prop so they
|
|
370
370
|
// don't collide as duplicate keys in the emitted props object.
|
|
371
371
|
// One prop covers every directive of its kind, so it carries the first hole's
|
|
372
|
-
// position
|
|
372
|
+
// position: a real source line beats the stack fallback, which lands in the
|
|
373
373
|
// compiled file.
|
|
374
374
|
if (classEntries.length > 0) {
|
|
375
375
|
props.push({
|
|
@@ -471,11 +471,11 @@ class Lowerer {
|
|
|
471
471
|
},
|
|
472
472
|
];
|
|
473
473
|
}
|
|
474
|
-
/** A plain attribute (incl. lit `?bool`, mixed values)
|
|
474
|
+
/** A plain attribute (incl. lit `?bool`, mixed values), old `mkProp` behavior. */
|
|
475
475
|
plainAttr(a) {
|
|
476
476
|
const v = a.value;
|
|
477
477
|
// `class=${{...}}` (object literal) -> classList (Solid convention), so it
|
|
478
|
-
// doesn't collide with a static `class="box"` (which stays className)
|
|
478
|
+
// doesn't collide with a static `class="box"` (which stays className), both
|
|
479
479
|
// apply. `class` -> className; `style=${{...}}` stays `style` (runtime merges).
|
|
480
480
|
// `html=${x}` is the raw-HTML escape hatch -> innerHTML.
|
|
481
481
|
let name = a.name;
|
package/dist/lower/template.mjs
CHANGED
|
@@ -262,7 +262,7 @@ var INTRINSICS = {
|
|
|
262
262
|
$store: { export: "store", module: "@fluixi/reactive/store", returns: "store-handle" },
|
|
263
263
|
$resource: { export: "resource", module: REACTIVE_MODULE, returns: "resource-handle" },
|
|
264
264
|
// No short runtime form for these yet, so the intrinsic stands for the `create*`
|
|
265
|
-
// name. Still worth having
|
|
265
|
+
// name. Still worth having: no import to write, and when a shorter form is
|
|
266
266
|
// designed, the change is this line rather than a compiler pass.
|
|
267
267
|
$selector: { export: "createSelector", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
268
268
|
$deferred: { export: "createDeferred", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
@@ -992,7 +992,7 @@ var Lowerer = class {
|
|
|
992
992
|
}
|
|
993
993
|
];
|
|
994
994
|
}
|
|
995
|
-
/** A plain attribute (incl. lit `?bool`, mixed values)
|
|
995
|
+
/** A plain attribute (incl. lit `?bool`, mixed values), old `mkProp` behavior. */
|
|
996
996
|
plainAttr(a) {
|
|
997
997
|
const v = a.value;
|
|
998
998
|
let name = a.name;
|
package/dist/lower/text.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Whitespace handling for template text runs.
|
|
3
3
|
*
|
|
4
|
-
* JSX and `` html`...` `` collapse a text run the same way
|
|
4
|
+
* JSX and `` html`...` `` collapse a text run the same way, the rule came from
|
|
5
5
|
* JSX and the template syntax adopted it so an author moving between the two
|
|
6
6
|
* gets the same output. It is pure string work with no parser in it, so it lives
|
|
7
7
|
* here rather than in a front-end, where both can reach it and neither owns it.
|
|
8
8
|
*/
|
|
9
|
-
/** Canonical JSX text cleaning
|
|
9
|
+
/** Canonical JSX text cleaning: kept identical to plugin.ts cleanTemplateText. */
|
|
10
10
|
export declare function cleanTemplateText(value: string): string;
|
package/dist/lower/text.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Whitespace handling for template text runs.
|
|
3
3
|
*
|
|
4
|
-
* JSX and `` html`...` `` collapse a text run the same way
|
|
4
|
+
* JSX and `` html`...` `` collapse a text run the same way, the rule came from
|
|
5
5
|
* JSX and the template syntax adopted it so an author moving between the two
|
|
6
6
|
* gets the same output. It is pure string work with no parser in it, so it lives
|
|
7
7
|
* here rather than in a front-end, where both can reach it and neither owns it.
|
|
8
8
|
*/
|
|
9
|
-
/** Canonical JSX text cleaning
|
|
9
|
+
/** Canonical JSX text cleaning: kept identical to plugin.ts cleanTemplateText. */
|
|
10
10
|
export declare function cleanTemplateText(value: string): string;
|
|
11
11
|
//# sourceMappingURL=text.d.ts.map
|
package/dist/lower/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/lower/text.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/lower/text.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgBvD"}
|
package/dist/lower/text.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Whitespace handling for template text runs.
|
|
3
3
|
*
|
|
4
|
-
* JSX and `` html`...` `` collapse a text run the same way
|
|
4
|
+
* JSX and `` html`...` `` collapse a text run the same way, the rule came from
|
|
5
5
|
* JSX and the template syntax adopted it so an author moving between the two
|
|
6
6
|
* gets the same output. It is pure string work with no parser in it, so it lives
|
|
7
7
|
* here rather than in a front-end, where both can reach it and neither owns it.
|
|
8
8
|
*/
|
|
9
|
-
/** Canonical JSX text cleaning
|
|
9
|
+
/** Canonical JSX text cleaning: kept identical to plugin.ts cleanTemplateText. */
|
|
10
10
|
export function cleanTemplateText(value) {
|
|
11
11
|
const lines = value.split(/\r\n|\n|\r/);
|
|
12
12
|
let lastNonEmpty = 0;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A static subtree can be built once as an HTML string and cloned per instance, instead
|
|
5
5
|
* of constructed an element at a time. That is the difference between one `cloneNode`
|
|
6
|
-
* and N `createElement` + N `spread` calls
|
|
6
|
+
* and N `createElement` + N `spread` calls: measured at 2.1x faster for a three-element
|
|
7
7
|
* row and 2.4x for a nine-element card, with the gap widening as components grow.
|
|
8
8
|
*
|
|
9
9
|
* `IRElement.static` has existed since the IR was written, documented as
|
|
@@ -31,7 +31,7 @@ export interface StaticReport {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function analyzeStatic(root: IRNode | IRNode[]): StaticReport;
|
|
33
33
|
/**
|
|
34
|
-
* The outermost static elements
|
|
34
|
+
* The outermost static elements: the roots worth turning into templates.
|
|
35
35
|
*
|
|
36
36
|
* Cloning a static child of a static parent is wasted: the parent's template already
|
|
37
37
|
* contains it.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A static subtree can be built once as an HTML string and cloned per instance, instead
|
|
5
5
|
* of constructed an element at a time. That is the difference between one `cloneNode`
|
|
6
|
-
* and N `createElement` + N `spread` calls
|
|
6
|
+
* and N `createElement` + N `spread` calls: measured at 2.1x faster for a three-element
|
|
7
7
|
* row and 2.4x for a nine-element card, with the gap widening as components grow.
|
|
8
8
|
*
|
|
9
9
|
* `IRElement.static` has existed since the IR was written, documented as
|
|
@@ -31,7 +31,7 @@ export interface StaticReport {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function analyzeStatic(root: IRNode | IRNode[]): StaticReport;
|
|
33
33
|
/**
|
|
34
|
-
* The outermost static elements
|
|
34
|
+
* The outermost static elements: the roots worth turning into templates.
|
|
35
35
|
*
|
|
36
36
|
* Cloning a static child of a static parent is wasted: the parent's template already
|
|
37
37
|
* contains it.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* A prop is inert only when it is a plain attribute or property with a literal value.
|
|
3
3
|
*
|
|
4
4
|
* `expr` means arbitrary JS, which may read a signal or allocate, so it is dynamic even
|
|
5
|
-
* when `reactive` is false
|
|
5
|
+
* when `reactive` is false: a non-reactive expression still has to run per instance.
|
|
6
6
|
*/
|
|
7
7
|
function propReason(prop) {
|
|
8
8
|
switch (prop.kind) {
|
|
@@ -108,7 +108,7 @@ function childReason(node) {
|
|
|
108
108
|
return 'expression-child';
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
|
-
* The outermost static elements
|
|
111
|
+
* The outermost static elements: the roots worth turning into templates.
|
|
112
112
|
*
|
|
113
113
|
* Cloning a static child of a static parent is wasted: the parent's template already
|
|
114
114
|
* contains it.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Strategy collapsing
|
|
2
|
+
* Strategy collapsing: demote a deferred reference whose module is already present.
|
|
3
3
|
*
|
|
4
4
|
* This is not a nice-to-have. Without it the naive feature is a regression: if a module
|
|
5
5
|
* is referenced eagerly anywhere in the compilation unit, it is in the parent chunk
|
|
6
6
|
* already, so a `load:visible` boundary elsewhere adds a wrapper, a promise and a
|
|
7
|
-
* re-render in order to fetch nothing. The bytes are paid twice
|
|
8
|
-
* once in the deferral machinery
|
|
7
|
+
* re-render in order to fetch nothing. The bytes are paid twice, once in the chunk,
|
|
8
|
+
* once in the deferral machinery: and the component renders later than it needs to.
|
|
9
9
|
*
|
|
10
10
|
* Collapsing runs per module, not per component name, because a chunk is a module:
|
|
11
11
|
* `<Button>` eager and `<ButtonGroup load:visible>` from the same package means the
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Strategy collapsing
|
|
2
|
+
* Strategy collapsing: demote a deferred reference whose module is already present.
|
|
3
3
|
*
|
|
4
4
|
* This is not a nice-to-have. Without it the naive feature is a regression: if a module
|
|
5
5
|
* is referenced eagerly anywhere in the compilation unit, it is in the parent chunk
|
|
6
6
|
* already, so a `load:visible` boundary elsewhere adds a wrapper, a promise and a
|
|
7
|
-
* re-render in order to fetch nothing. The bytes are paid twice
|
|
8
|
-
* once in the deferral machinery
|
|
7
|
+
* re-render in order to fetch nothing. The bytes are paid twice, once in the chunk,
|
|
8
|
+
* once in the deferral machinery: and the component renders later than it needs to.
|
|
9
9
|
*
|
|
10
10
|
* Collapsing runs per module, not per component name, because a chunk is a module:
|
|
11
11
|
* `<Button>` eager and `<ButtonGroup load:visible>` from the same package means the
|
package/dist/options.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentResolverRule } from './resolve/component-resolver.cjs';
|
|
2
2
|
/**
|
|
3
|
-
* Public compiler options. This schema is the stable public API
|
|
3
|
+
* Public compiler options. This schema is the stable public API, it stays put
|
|
4
4
|
* as backends change. Switching DOM strategy is `backend`, not a rewrite.
|
|
5
5
|
*/
|
|
6
6
|
export interface CompilerOptions {
|
|
@@ -13,7 +13,7 @@ export interface CompilerOptions {
|
|
|
13
13
|
*/
|
|
14
14
|
templateClone?: boolean;
|
|
15
15
|
/**
|
|
16
|
-
* Also clone subtrees whose *structure* is static but which contain dynamic holes
|
|
16
|
+
* Also clone subtrees whose *structure* is static but which contain dynamic holes ,
|
|
17
17
|
* the common shape. Roughly halves the emitted code for such a subtree and replaces
|
|
18
18
|
* per-element construction with one clone.
|
|
19
19
|
*
|
package/dist/options.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentResolverRule } from './resolve/component-resolver.js';
|
|
2
2
|
/**
|
|
3
|
-
* Public compiler options. This schema is the stable public API
|
|
3
|
+
* Public compiler options. This schema is the stable public API, it stays put
|
|
4
4
|
* as backends change. Switching DOM strategy is `backend`, not a rewrite.
|
|
5
5
|
*/
|
|
6
6
|
export interface CompilerOptions {
|
|
@@ -13,7 +13,7 @@ export interface CompilerOptions {
|
|
|
13
13
|
*/
|
|
14
14
|
templateClone?: boolean;
|
|
15
15
|
/**
|
|
16
|
-
* Also clone subtrees whose *structure* is static but which contain dynamic holes
|
|
16
|
+
* Also clone subtrees whose *structure* is static but which contain dynamic holes ,
|
|
17
17
|
* the common shape. Roughly halves the emitted code for such a subtree and replaces
|
|
18
18
|
* per-element construction with one clone.
|
|
19
19
|
*
|
|
@@ -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
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Two different things have always been bundled into one hardcoded `Set` per group:
|
|
5
5
|
* *which module a name comes from*, and *whether the name has special lowering*. Only
|
|
6
|
-
* the first is interesting outside the compiler, and every tool needs it
|
|
6
|
+
* the first is interesting outside the compiler, and every tool needs it, the TS
|
|
7
7
|
* plugin, to resolve `<Show>` for hover and go-to-definition; the language server, to
|
|
8
8
|
* complete and validate tags inside `` html`…` ``; a codemod, to materialise imports.
|
|
9
9
|
* Having no published source, `@fluixi/ts-plugin` duplicated the list and pinned it
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
*
|
|
16
16
|
* The split matters: control-flow names cannot become ordinary rules. `Show`, `For`,
|
|
17
17
|
* `Index` and `Match` read a reactive *value* prop inside their own tracking scope, so
|
|
18
|
-
* the compiler emits that prop as a getter
|
|
18
|
+
* the compiler emits that prop as a getter: without it `each={items()}` snapshots once
|
|
19
19
|
* and never updates. They are also exempted from `createMemo` wrapping and may be
|
|
20
20
|
* replaced outright by `optimizeControlFlowComponent`. A rule only injects an import,
|
|
21
21
|
* so converting them would keep the import and silently drop the reactivity.
|
|
22
22
|
*
|
|
23
|
-
* Router components have no such behaviour
|
|
24
|
-
* import plumbing
|
|
23
|
+
* Router components have no such behaviour: every reference to them in the plugin is
|
|
24
|
+
* import plumbing: so they are a plain rule.
|
|
25
25
|
*/
|
|
26
26
|
import type { ComponentMapRule } from './component-resolver.cjs';
|
|
27
27
|
/** Where the built-in groups come from when the host does not override the module. */
|
|
@@ -35,7 +35,7 @@ export interface BuiltinModules {
|
|
|
35
35
|
}
|
|
36
36
|
/** Control flow lowered against the DOM runtime. */
|
|
37
37
|
export declare const DOM_CONTROL_FLOW: readonly ["Show", "For", "Index", "Switch", "Match", "Portal", "Dynamic", "ErrorBoundary"];
|
|
38
|
-
/** Control flow that only `@fluixi/core` exports
|
|
38
|
+
/** Control flow that only `@fluixi/core` exports, importing it from dom resolves to nothing. */
|
|
39
39
|
export declare const CORE_CONTROL_FLOW: readonly ["Suspense", "SuspenseList", "Await"];
|
|
40
40
|
/**
|
|
41
41
|
* Router components.
|
|
@@ -49,7 +49,7 @@ export declare const BUILTIN_COMPONENTS: readonly string[];
|
|
|
49
49
|
/**
|
|
50
50
|
* Names whose meaning is fixed by the compiler and cannot be reassigned by a rule.
|
|
51
51
|
*
|
|
52
|
-
* A rule naming one of these is a silent no-op
|
|
52
|
+
* A rule naming one of these is a silent no-op: the compiler matches the built-in
|
|
53
53
|
* first and the tag renders control flow instead of the intended component, with no
|
|
54
54
|
* error. Rule authors should check against this set and report rather than emit.
|
|
55
55
|
*/
|
|
@@ -60,9 +60,9 @@ export declare function builtinComponentMap(modules?: BuiltinModules): Record<st
|
|
|
60
60
|
* The built-ins as a resolver rule, for tools that want one uniform lookup.
|
|
61
61
|
*
|
|
62
62
|
* Note this is the *naming* half only. Feeding it to the compiler would not make
|
|
63
|
-
* control flow work through resolution
|
|
63
|
+
* control flow work through resolution: the compiler still recognises those names
|
|
64
64
|
* itself, for the codegen reasons above.
|
|
65
65
|
*/
|
|
66
66
|
export declare function builtinComponents(modules?: BuiltinModules): ComponentMapRule;
|
|
67
|
-
/** Just the router group as a rule
|
|
67
|
+
/** Just the router group as a rule: the one group that is purely an import. */
|
|
68
68
|
export declare function routerComponents(routerModule?: string): ComponentMapRule;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Two different things have always been bundled into one hardcoded `Set` per group:
|
|
5
5
|
* *which module a name comes from*, and *whether the name has special lowering*. Only
|
|
6
|
-
* the first is interesting outside the compiler, and every tool needs it
|
|
6
|
+
* the first is interesting outside the compiler, and every tool needs it, the TS
|
|
7
7
|
* plugin, to resolve `<Show>` for hover and go-to-definition; the language server, to
|
|
8
8
|
* complete and validate tags inside `` html`…` ``; a codemod, to materialise imports.
|
|
9
9
|
* Having no published source, `@fluixi/ts-plugin` duplicated the list and pinned it
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
*
|
|
16
16
|
* The split matters: control-flow names cannot become ordinary rules. `Show`, `For`,
|
|
17
17
|
* `Index` and `Match` read a reactive *value* prop inside their own tracking scope, so
|
|
18
|
-
* the compiler emits that prop as a getter
|
|
18
|
+
* the compiler emits that prop as a getter: without it `each={items()}` snapshots once
|
|
19
19
|
* and never updates. They are also exempted from `createMemo` wrapping and may be
|
|
20
20
|
* replaced outright by `optimizeControlFlowComponent`. A rule only injects an import,
|
|
21
21
|
* so converting them would keep the import and silently drop the reactivity.
|
|
22
22
|
*
|
|
23
|
-
* Router components have no such behaviour
|
|
24
|
-
* import plumbing
|
|
23
|
+
* Router components have no such behaviour: every reference to them in the plugin is
|
|
24
|
+
* import plumbing: so they are a plain rule.
|
|
25
25
|
*/
|
|
26
26
|
import type { ComponentMapRule } from './component-resolver.js';
|
|
27
27
|
/** Where the built-in groups come from when the host does not override the module. */
|
|
@@ -35,7 +35,7 @@ export interface BuiltinModules {
|
|
|
35
35
|
}
|
|
36
36
|
/** Control flow lowered against the DOM runtime. */
|
|
37
37
|
export declare const DOM_CONTROL_FLOW: readonly ["Show", "For", "Index", "Switch", "Match", "Portal", "Dynamic", "ErrorBoundary"];
|
|
38
|
-
/** Control flow that only `@fluixi/core` exports
|
|
38
|
+
/** Control flow that only `@fluixi/core` exports, importing it from dom resolves to nothing. */
|
|
39
39
|
export declare const CORE_CONTROL_FLOW: readonly ["Suspense", "SuspenseList", "Await"];
|
|
40
40
|
/**
|
|
41
41
|
* Router components.
|
|
@@ -49,7 +49,7 @@ export declare const BUILTIN_COMPONENTS: readonly string[];
|
|
|
49
49
|
/**
|
|
50
50
|
* Names whose meaning is fixed by the compiler and cannot be reassigned by a rule.
|
|
51
51
|
*
|
|
52
|
-
* A rule naming one of these is a silent no-op
|
|
52
|
+
* A rule naming one of these is a silent no-op: the compiler matches the built-in
|
|
53
53
|
* first and the tag renders control flow instead of the intended component, with no
|
|
54
54
|
* error. Rule authors should check against this set and report rather than emit.
|
|
55
55
|
*/
|
|
@@ -60,10 +60,10 @@ export declare function builtinComponentMap(modules?: BuiltinModules): Record<st
|
|
|
60
60
|
* The built-ins as a resolver rule, for tools that want one uniform lookup.
|
|
61
61
|
*
|
|
62
62
|
* Note this is the *naming* half only. Feeding it to the compiler would not make
|
|
63
|
-
* control flow work through resolution
|
|
63
|
+
* control flow work through resolution: the compiler still recognises those names
|
|
64
64
|
* itself, for the codegen reasons above.
|
|
65
65
|
*/
|
|
66
66
|
export declare function builtinComponents(modules?: BuiltinModules): ComponentMapRule;
|
|
67
|
-
/** Just the router group as a rule
|
|
67
|
+
/** Just the router group as a rule: the one group that is purely an import. */
|
|
68
68
|
export declare function routerComponents(routerModule?: string): ComponentMapRule;
|
|
69
69
|
//# sourceMappingURL=builtins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../src/resolve/builtins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,sFAAsF;AACtF,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,oDAAoD;AACpD,eAAO,MAAM,gBAAgB,4FASnB,CAAC;AAEX,
|
|
1
|
+
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../src/resolve/builtins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,sFAAsF;AACtF,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,oDAAoD;AACpD,eAAO,MAAM,gBAAgB,4FASnB,CAAC;AAEX,gGAAgG;AAChG,eAAO,MAAM,iBAAiB,gDAAiD,CAAC;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,mDAAoD,CAAC;AAEnF,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAI/C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAGlD,CAAC;AAEH,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,cAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,cAAmB,GAAG,gBAAgB,CAEhF;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAGxE"}
|
package/dist/resolve/builtins.js
CHANGED
|
@@ -9,7 +9,7 @@ export const DOM_CONTROL_FLOW = [
|
|
|
9
9
|
'Dynamic',
|
|
10
10
|
'ErrorBoundary',
|
|
11
11
|
];
|
|
12
|
-
/** Control flow that only `@fluixi/core` exports
|
|
12
|
+
/** Control flow that only `@fluixi/core` exports, importing it from dom resolves to nothing. */
|
|
13
13
|
export const CORE_CONTROL_FLOW = ['Suspense', 'SuspenseList', 'Await'];
|
|
14
14
|
/**
|
|
15
15
|
* Router components.
|
|
@@ -27,7 +27,7 @@ export const BUILTIN_COMPONENTS = [
|
|
|
27
27
|
/**
|
|
28
28
|
* Names whose meaning is fixed by the compiler and cannot be reassigned by a rule.
|
|
29
29
|
*
|
|
30
|
-
* A rule naming one of these is a silent no-op
|
|
30
|
+
* A rule naming one of these is a silent no-op: the compiler matches the built-in
|
|
31
31
|
* first and the tag renders control flow instead of the intended component, with no
|
|
32
32
|
* error. Rule authors should check against this set and report rather than emit.
|
|
33
33
|
*/
|
|
@@ -51,13 +51,13 @@ export function builtinComponentMap(modules = {}) {
|
|
|
51
51
|
* The built-ins as a resolver rule, for tools that want one uniform lookup.
|
|
52
52
|
*
|
|
53
53
|
* Note this is the *naming* half only. Feeding it to the compiler would not make
|
|
54
|
-
* control flow work through resolution
|
|
54
|
+
* control flow work through resolution: the compiler still recognises those names
|
|
55
55
|
* itself, for the codegen reasons above.
|
|
56
56
|
*/
|
|
57
57
|
export function builtinComponents(modules = {}) {
|
|
58
58
|
return { components: builtinComponentMap(modules) };
|
|
59
59
|
}
|
|
60
|
-
/** Just the router group as a rule
|
|
60
|
+
/** Just the router group as a rule: the one group that is purely an import. */
|
|
61
61
|
export function routerComponents(routerModule) {
|
|
62
62
|
const module = routerModule ?? '@fluixi/core/router';
|
|
63
63
|
return { components: Object.fromEntries(ROUTER_COMPONENTS.map((n) => [n, module])) };
|
|
@@ -125,7 +125,7 @@ var INTRINSICS = {
|
|
|
125
125
|
$store: { export: "store", module: "@fluixi/reactive/store", returns: "store-handle" },
|
|
126
126
|
$resource: { export: "resource", module: REACTIVE_MODULE, returns: "resource-handle" },
|
|
127
127
|
// No short runtime form for these yet, so the intrinsic stands for the `create*`
|
|
128
|
-
// name. Still worth having
|
|
128
|
+
// name. Still worth having: no import to write, and when a shorter form is
|
|
129
129
|
// designed, the change is this line rather than a compiler pass.
|
|
130
130
|
$selector: { export: "createSelector", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
131
131
|
$deferred: { export: "createDeferred", module: REACTIVE_MODULE, returns: "memo-accessor" },
|
|
@@ -211,7 +211,7 @@ function componentGlobals(rules, options = {}) {
|
|
|
211
211
|
return target.export === "default" ? ` const ${name}: typeof ${ns}.default;` : ` export import ${name} = ${ns}.${target.export};`;
|
|
212
212
|
});
|
|
213
213
|
const note = shadowedByDom.length > 0 ? `//
|
|
214
|
-
// Import these explicitly
|
|
214
|
+
// Import these explicitly: lib.dom already declares the name, so an ambient
|
|
215
215
|
// declaration cannot win:
|
|
216
216
|
` + shadowedByDom.map((n) => {
|
|
217
217
|
const module2 = resolver.resolve(n)?.module;
|
|
@@ -227,7 +227,7 @@ function componentGlobals(rules, options = {}) {
|
|
|
227
227
|
// a pattern matches unboundedly many names, so there is no list to emit. Those
|
|
228
228
|
// tags still resolve at build time; declare them by hand if the editor needs them.
|
|
229
229
|
` : "";
|
|
230
|
-
const source = `// GENERATED by ${generator}
|
|
230
|
+
const source = `// GENERATED by ${generator}, do not edit.
|
|
231
231
|
//
|
|
232
232
|
// The components \`resolve\` supplies without an import. This describes what the
|
|
233
233
|
// compiler already does; it does not enable it.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Ambient declarations for the components `resolve` supplies without an import.
|
|
3
3
|
*
|
|
4
|
-
* The compiler injects the import, so nothing in the source imports these
|
|
4
|
+
* The compiler injects the import, so nothing in the source imports these, which leaves
|
|
5
5
|
* TypeScript reporting `TS2304: Cannot find name`. The code compiles and runs; the editor
|
|
6
6
|
* is unusable and `tsc` fails. These declarations describe what the compiler already
|
|
7
7
|
* does. They do not enable it.
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* This lives next to the resolver, and takes rules rather than a flat map, because the
|
|
10
10
|
* resolver is the only thing that knows the whole picture: a UI library's components, the
|
|
11
11
|
* project's own, and the framework builtins all arrive through the same config. A
|
|
12
|
-
* component library cannot generate this on its own
|
|
13
|
-
* project resolves
|
|
12
|
+
* component library cannot generate this on its own, it does not know what else the
|
|
13
|
+
* project resolves: which is why the generator belongs here and the library-specific CLI
|
|
14
14
|
* that predates it does not.
|
|
15
15
|
*
|
|
16
16
|
* Pure, like the resolver: rules in, source out, no filesystem. Writing the file is the
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { type ComponentResolverRule } from './component-resolver.cjs';
|
|
20
20
|
export interface ComponentGlobalsOptions {
|
|
21
21
|
/**
|
|
22
|
-
* Packages the project can actually resolve
|
|
22
|
+
* Packages the project can actually resolve: normally its declared dependencies.
|
|
23
23
|
*
|
|
24
24
|
* Declaring a component from a package the project does not depend on produces an
|
|
25
25
|
* unresolvable `import(...)`, and under the usual `skipLibCheck: true` that failure is
|
|
@@ -27,7 +27,7 @@ export interface ComponentGlobalsOptions {
|
|
|
27
27
|
* worse than the error it replaced. Omit to declare everything, which is only correct
|
|
28
28
|
* when every package is present.
|
|
29
29
|
*
|
|
30
|
-
* Relative and alias specifiers are never filtered
|
|
30
|
+
* Relative and alias specifiers are never filtered, there is no package to check.
|
|
31
31
|
*/
|
|
32
32
|
available?: Iterable<string>;
|
|
33
33
|
/**
|