@fluixi/compiler 1.0.0-alpha.83 → 1.0.0-alpha.85
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.cjs +62 -1
- package/dist/analyze/expr-shape.d.cts +14 -0
- package/dist/analyze/expr-shape.d.ts +2 -2
- package/dist/analyze/expr-shape.js +1 -1
- package/dist/analyze/expr-shape.mjs +41 -1
- package/dist/analyze/intrinsics.cjs +80 -1
- package/dist/analyze/intrinsics.d.cts +66 -0
- 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 +59 -1
- package/dist/analyze/paren.cjs +134 -0
- package/dist/analyze/paren.d.cts +23 -0
- package/dist/analyze/paren.d.ts +24 -0
- package/dist/analyze/paren.d.ts.map +1 -0
- package/dist/analyze/paren.js +168 -0
- package/dist/analyze/paren.mjs +113 -0
- package/dist/analyze/props-destructure.cjs +226 -1
- package/dist/analyze/props-destructure.d.cts +83 -0
- 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/props-destructure.mjs +205 -1
- package/dist/analyze/reactive-bindings.cjs +190 -1
- package/dist/analyze/reactive-bindings.d.cts +42 -0
- package/dist/analyze/reactive-bindings.d.ts +1 -1
- package/dist/analyze/reactive-bindings.js +2 -2
- package/dist/analyze/reactive-bindings.mjs +167 -1
- package/dist/analyze/reactive-expr.cjs +38 -1
- package/dist/analyze/reactive-expr.d.cts +38 -0
- 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/reactive-expr.mjs +17 -1
- package/dist/analyze/static-graph.cjs +811 -1
- package/dist/analyze/static-graph.d.cts +102 -0
- 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 +793 -1
- package/dist/babel-TGY76XJ7.mjs +636 -0
- package/dist/chunk-4PLHS2FP.mjs +158 -0
- package/dist/chunk-6DB5FXS4.mjs +1718 -0
- package/dist/chunk-F74GFKSL.mjs +16 -0
- package/dist/chunk-G6QC2WRJ.mjs +11 -0
- package/dist/chunk-RUDJDZAA.mjs +1078 -0
- package/dist/codegen/backend.cjs +18 -1
- package/dist/codegen/backend.d.cts +35 -0
- package/dist/codegen/backends/imperative.cjs +542 -1
- package/dist/codegen/backends/imperative.d.cts +11 -0
- package/dist/codegen/backends/imperative.d.ts +1 -1
- package/dist/codegen/backends/imperative.d.ts.map +1 -1
- package/dist/codegen/backends/imperative.js +24 -20
- package/dist/codegen/backends/imperative.mjs +519 -1
- package/dist/codegen/contract.cjs +52 -1
- package/dist/codegen/contract.d.cts +24 -0
- package/dist/codegen/contract.d.ts +2 -2
- package/dist/codegen/contract.js +2 -2
- package/dist/codegen/contract.mjs +31 -1
- package/dist/codegen/partial-template.cjs +176 -1
- package/dist/codegen/partial-template.d.cts +61 -0
- package/dist/codegen/partial-template.d.ts +4 -4
- package/dist/codegen/partial-template.js +0 -0
- package/dist/codegen/partial-template.mjs +153 -1
- package/dist/codegen/serialize-static.cjs +125 -1
- package/dist/codegen/serialize-static.d.cts +38 -0
- package/dist/codegen/serialize-static.d.ts +3 -3
- package/dist/codegen/serialize-static.js +6 -6
- package/dist/codegen/serialize-static.mjs +104 -1
- package/dist/frontend/babel/build-ir-lit.cjs +1509 -1
- package/dist/frontend/babel/build-ir-lit.d.cts +26 -0
- package/dist/frontend/babel/build-ir-lit.d.ts +2 -2
- package/dist/frontend/babel/build-ir-lit.mjs +1478 -1
- package/dist/frontend/babel/build-ir.cjs +1524 -1
- package/dist/frontend/babel/build-ir.d.cts +35 -0
- 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 +1495 -1
- package/dist/frontend/babel/index.cjs +2186 -1
- package/dist/frontend/babel/index.d.cts +33 -0
- package/dist/frontend/babel/index.d.ts +1 -1
- package/dist/frontend/babel/index.js +1 -1
- package/dist/frontend/babel/index.mjs +2156 -1
- package/dist/frontend/babel/lower-template.cjs +1507 -1
- package/dist/frontend/babel/lower-template.d.cts +23 -0
- 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 +1478 -1
- package/dist/frontend/babel/plugin.cjs +2132 -1
- package/dist/frontend/babel/plugin.d.cts +95 -0
- 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 +2103 -1
- package/dist/frontend/babel/server-functions.cjs +110 -1
- package/dist/frontend/babel/server-functions.d.cts +10 -0
- package/dist/frontend/babel/server-functions.mjs +89 -1
- package/dist/frontend/babel/types.cjs +18 -1
- package/dist/frontend/babel/types.d.cts +33 -0
- package/dist/frontend/types.cjs +18 -1
- package/dist/frontend/types.d.cts +25 -0
- package/dist/frontend/vocabulary.cjs +98 -0
- package/dist/frontend/vocabulary.d.cts +79 -0
- package/dist/frontend/vocabulary.d.ts +80 -0
- package/dist/frontend/vocabulary.d.ts.map +1 -0
- package/dist/frontend/vocabulary.js +124 -0
- package/dist/frontend/vocabulary.mjs +77 -0
- package/dist/index.cjs +1595 -14
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +1575 -14
- package/dist/integrations.cjs +4312 -26
- package/dist/integrations.d.cts +215 -0
- 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 +536 -18
- package/dist/ir/nodes.cjs +18 -1
- package/dist/ir/nodes.d.cts +168 -0
- package/dist/ir/nodes.d.ts +6 -6
- package/dist/lower/compile-template.cjs +1356 -1
- package/dist/lower/compile-template.d.cts +69 -0
- package/dist/lower/compile-template.d.ts +3 -3
- package/dist/lower/compile-template.js +1 -1
- package/dist/lower/compile-template.mjs +1336 -1
- package/dist/lower/jsx.cjs +529 -1
- package/dist/lower/jsx.d.cts +25 -0
- package/dist/lower/jsx.d.ts +1 -1
- package/dist/lower/jsx.d.ts.map +1 -1
- package/dist/lower/jsx.js +6 -5
- package/dist/lower/jsx.mjs +506 -1
- package/dist/lower/template.cjs +1061 -1
- package/dist/lower/template.d.cts +53 -0
- package/dist/lower/template.d.ts +3 -3
- package/dist/lower/template.d.ts.map +1 -1
- package/dist/lower/template.js +12 -11
- package/dist/lower/template.mjs +1042 -1
- package/dist/lower/text.cjs +42 -1
- package/dist/lower/text.d.cts +10 -0
- 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/lower/text.mjs +21 -1
- package/dist/optimize/analyze-static.cjs +112 -1
- package/dist/optimize/analyze-static.d.cts +39 -0
- package/dist/optimize/analyze-static.d.ts +2 -2
- package/dist/optimize/analyze-static.js +2 -2
- package/dist/optimize/analyze-static.mjs +91 -1
- package/dist/optimize/collapse-strategies.cjs +90 -1
- package/dist/optimize/collapse-strategies.d.cts +30 -0
- package/dist/optimize/collapse-strategies.d.ts +3 -3
- package/dist/optimize/collapse-strategies.mjs +67 -1
- package/dist/options.cjs +33 -1
- package/dist/options.d.cts +39 -0
- package/dist/options.d.ts +2 -2
- package/dist/options.mjs +12 -1
- package/dist/resolve/builtins.cjs +73 -1
- package/dist/resolve/builtins.d.cts +68 -0
- 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 +53 -1
- package/dist/resolve/component-globals.cjs +234 -14
- package/dist/resolve/component-globals.d.cts +80 -0
- package/dist/resolve/component-globals.d.ts +5 -5
- package/dist/resolve/component-globals.js +10 -10
- package/dist/resolve/component-globals.mjs +211 -14
- package/dist/resolve/component-resolver.cjs +80 -1
- package/dist/resolve/component-resolver.d.cts +68 -0
- 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/component-resolver.mjs +59 -1
- package/dist/resolve/load-directive.cjs +93 -1
- package/dist/resolve/load-directive.d.cts +53 -0
- package/dist/resolve/load-directive.d.ts +5 -5
- package/dist/resolve/load-directive.js +6 -6
- package/dist/resolve/load-directive.mjs +72 -1
- package/dist/resolve/resolve-ir.cjs +108 -1
- package/dist/resolve/resolve-ir.d.cts +53 -0
- 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/resolve-ir.mjs +85 -1
- package/dist/resolve/write-globals.cjs +319 -14
- package/dist/resolve/write-globals.d.cts +30 -0
- package/dist/resolve/write-globals.js +2 -2
- package/dist/resolve/write-globals.mjs +298 -14
- package/dist/server-fns-ZYWQTSZU.mjs +78 -0
- package/dist/server-functions-PCERFA7A.mjs +82 -0
- package/dist/transform/bindings.cjs +71 -1
- package/dist/transform/bindings.d.cts +16 -0
- package/dist/transform/bindings.d.ts +1 -1
- package/dist/transform/bindings.js +1 -1
- package/dist/transform/bindings.mjs +50 -1
- package/dist/transform/index.cjs +2732 -8
- package/dist/transform/index.d.cts +15 -0
- package/dist/transform/index.mjs +3773 -17
- package/dist/transform/intrinsics.cjs +216 -3
- package/dist/transform/intrinsics.d.cts +21 -0
- package/dist/transform/intrinsics.js +1 -1
- package/dist/transform/intrinsics.mjs +193 -3
- package/dist/transform/props.cjs +441 -3
- package/dist/transform/props.d.cts +45 -0
- 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/props.mjs +1482 -12
- package/dist/transform/server-fn-id.cjs +35 -1
- package/dist/transform/server-fn-id.d.cts +9 -0
- package/dist/transform/server-fn-id.d.ts +1 -1
- package/dist/transform/server-fn-id.js +2 -2
- package/dist/transform/server-fn-id.mjs +14 -1
- package/dist/transform/server-fns.cjs +114 -2
- package/dist/transform/server-fns.d.cts +12 -0
- package/dist/transform/server-fns.js +3 -3
- package/dist/transform/server-fns.mjs +1155 -11
- package/dist/transform/source-locations.cjs +330 -1
- package/dist/transform/source-locations.d.cts +43 -0
- package/dist/transform/source-locations.d.ts +1 -1
- package/dist/transform/source-locations.js +5 -5
- package/dist/transform/source-locations.mjs +307 -1
- package/dist/transform/templates.cjs +2701 -7
- package/dist/transform/templates.d.cts +69 -0
- 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 +3743 -16
- package/dist/transform-RWDTQUF5.mjs +893 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/dist/babel-VXKH6MRQ.mjs +0 -1
- package/dist/chunk-3SAEGOMQ.mjs +0 -1
- package/dist/chunk-5KMMN5QP.mjs +0 -1
- package/dist/chunk-IBRM4W7I.mjs +0 -10
- package/dist/chunk-OHHZCYIQ.mjs +0 -1
- package/dist/chunk-YKZ54NVE.mjs +0 -1
- package/dist/server-fns-6QM243HC.mjs +0 -2
- package/dist/server-functions-E3LKCZ4R.mjs +0 -1
- package/dist/transform-C4ZXRVGP.mjs +0 -8
|
@@ -2,8 +2,9 @@ import { planPartialTemplate } from '../partial-template.js';
|
|
|
2
2
|
import { isSerializable, serializeStatic, templatePositions, isPlainLiteralAttr, htmlAttrName, } from '../serialize-static.js';
|
|
3
3
|
import { RUNTIME_CONTRACT_V1 } from '../contract.js';
|
|
4
4
|
import { markHole, markProps, SOURCE_MARKER } from '../../transform/source-locations.js';
|
|
5
|
+
import { paren } from '../../analyze/paren.js';
|
|
5
6
|
/**
|
|
6
|
-
* Imperative fine-grained backend
|
|
7
|
+
* Imperative fine-grained backend: emits createNativeElement/insert/spread/
|
|
7
8
|
* createComponent (RUNTIME_CONTRACT_V1), the runtime proven by the @fluixi/dom
|
|
8
9
|
* contract tests.
|
|
9
10
|
*
|
|
@@ -38,12 +39,12 @@ function propValue(p) {
|
|
|
38
39
|
// A ref is not reactive, but which variable ends up holding the element is worth
|
|
39
40
|
// saying, so it carries its own text and position.
|
|
40
41
|
if (p.name === 'ref' && p.at)
|
|
41
|
-
return markHole(
|
|
42
|
+
return markHole(paren(p.expr, 'value'), p.at.line, p.at.column, p.expr);
|
|
42
43
|
// Events and non-reactive expressions pass through; reactive ones become thunks
|
|
43
44
|
// so the runtime (spread/insert) can wire a render effect.
|
|
44
45
|
if (!p.reactive)
|
|
45
|
-
return
|
|
46
|
-
const accessor = `() =>
|
|
46
|
+
return paren(p.expr, 'value');
|
|
47
|
+
const accessor = `() => ${paren(p.expr, 'arrowBody')}`;
|
|
47
48
|
// `at` is the gate: a production build carries no marker.
|
|
48
49
|
return p.at ? markHole(accessor, p.at.line, p.at.column, p.directive) : accessor;
|
|
49
50
|
}
|
|
@@ -52,14 +53,15 @@ function propValue(p) {
|
|
|
52
53
|
/**
|
|
53
54
|
* Component props are passed as VALUES, not thunks (unlike native-element attrs).
|
|
54
55
|
* The whole `createComponent(...)` call sits inside a `createMemo`, so reading a
|
|
55
|
-
* signal in a prop re-evaluates when the memo re-runs
|
|
56
|
+
* signal in a prop re-evaluates when the memo re-runs, no per-prop thunk needed.
|
|
56
57
|
* This matches the inline codegen; wrapping a prop like
|
|
57
58
|
* `history={createMemoryHistory()}` in `() => …` would hand the component a
|
|
58
59
|
* function instead of the value (e.g. `history.get is not a function`).
|
|
59
60
|
*/
|
|
60
61
|
function componentPropValue(p) {
|
|
62
|
+
// Sits in a `return`, where a top-level comma would read as a sequence.
|
|
61
63
|
if (p.expr !== undefined)
|
|
62
|
-
return
|
|
64
|
+
return paren(p.expr, 'value');
|
|
63
65
|
return JSON.stringify(p.literal ?? true);
|
|
64
66
|
}
|
|
65
67
|
/** Build a props object literal (or mergeProps(...) when spreads are present). */
|
|
@@ -79,7 +81,7 @@ function emitProps(props, childrenExpr, used) {
|
|
|
79
81
|
/**
|
|
80
82
|
* The memo a component lowers to is an accessor, so it takes the same hole mark as any
|
|
81
83
|
* other reactive binding. Without it, the insert that places the subtree reports whatever
|
|
82
|
-
* the runtime stack says
|
|
84
|
+
* the runtime stack says: a position in the compiled file.
|
|
83
85
|
*/
|
|
84
86
|
function markBind(code, at) {
|
|
85
87
|
return at ? markHole(code, at.line, at.column) : code;
|
|
@@ -120,20 +122,20 @@ function emitComponent(name, props, children, used, templates, at) {
|
|
|
120
122
|
propAt[p.name] = [p.at.line, p.at.column];
|
|
121
123
|
if (Object.keys(propAt).length)
|
|
122
124
|
obj = markProps(obj, propAt);
|
|
123
|
-
// The memo never recomputes
|
|
125
|
+
// The memo never recomputes: every prop is a getter, so this callback reads nothing
|
|
124
126
|
// reactive. It is here for what it makes `insert` do, and it cannot be elided.
|
|
125
127
|
//
|
|
126
128
|
// A component whose return value is *itself* bare control flow (`return <Show …/>`)
|
|
127
129
|
// produces a memo, which `createComponent` deliberately does not stamp as a component.
|
|
128
130
|
// Without this wrapper `insert` stops re-reading it, and the subtree goes stale when a
|
|
129
|
-
// sibling updates the context it depends on
|
|
131
|
+
// sibling updates the context it depends on: see `show-context-insert.spec.ts`.
|
|
130
132
|
//
|
|
131
133
|
// Static props are not a sufficient condition for dropping it either: safety depends on
|
|
132
134
|
// what the callee *returns*, which lives in another module and is not visible here.
|
|
133
135
|
//
|
|
134
136
|
// Nor can it be a plain `() => createComponent(...)` thunk. The memo also provides
|
|
135
137
|
// *identity*: it runs once and caches. A thunk is re-invoked by insert's render effect
|
|
136
|
-
// on every run, rebuilding the component with a fresh owner
|
|
138
|
+
// on every run, rebuilding the component with a fresh owner, which loses context,
|
|
137
139
|
// duplicates the tree on hydration and piles up Portals. Measured: dropping the wrapper
|
|
138
140
|
// fails 3 tests, replacing it with a thunk fails 14.
|
|
139
141
|
//
|
|
@@ -145,7 +147,9 @@ function emitComponent(name, props, children, used, templates, at) {
|
|
|
145
147
|
const mark = at
|
|
146
148
|
? `globalThis.${SOURCE_MARKER}?.(${JSON.stringify(at.file)},${at.line},${at.column},${JSON.stringify(name)}), `
|
|
147
149
|
: '';
|
|
148
|
-
|
|
150
|
+
// The mark makes this a sequence, which has to stay wrapped to pass as one argument.
|
|
151
|
+
// Without one there is nothing to wrap, and a production build never has one.
|
|
152
|
+
return `createMemo(${paren(`${mark}() => createComponent(${name}, ${obj})`, 'value')})`;
|
|
149
153
|
}
|
|
150
154
|
/** `el.setAttribute("class", "card")` for a compile-time constant. */
|
|
151
155
|
function staticAttrAssignment(el, prop) {
|
|
@@ -165,8 +169,8 @@ function emitNode(node, used, templates) {
|
|
|
165
169
|
return JSON.stringify(node.value);
|
|
166
170
|
case 'expr': {
|
|
167
171
|
if (!node.reactive)
|
|
168
|
-
return
|
|
169
|
-
const accessor = `() =>
|
|
172
|
+
return paren(node.code, 'value');
|
|
173
|
+
const accessor = `() => ${paren(node.code, 'arrowBody')}`;
|
|
170
174
|
return node.at ? markHole(accessor, node.at.line, node.at.column) : accessor;
|
|
171
175
|
}
|
|
172
176
|
case 'fragment':
|
|
@@ -175,7 +179,7 @@ function emitNode(node, used, templates) {
|
|
|
175
179
|
return emitChildren(node.children, used, templates);
|
|
176
180
|
case 'component':
|
|
177
181
|
// No reactive prop means no `bindAt`, which is most tags. The insert that places the
|
|
178
|
-
// subtree still has to report somewhere, and the tag itself is where it was written
|
|
182
|
+
// subtree still has to report somewhere, and the tag itself is where it was written ,
|
|
179
183
|
// without this it reports whatever the runtime stack says, a line in the compiled file.
|
|
180
184
|
return markBind(emitComponent(node.name, node.props, node.children, used, templates, node.at), node.bindAt ?? node.at);
|
|
181
185
|
case 'control': {
|
|
@@ -188,7 +192,7 @@ function emitNode(node, used, templates) {
|
|
|
188
192
|
// one cloneNode instead of an createNativeElement + spread per element.
|
|
189
193
|
// SVG is excluded: the runtime wraps SVG template HTML in an <svg> host and
|
|
190
194
|
// `cloneTemplate(t, true)` returns that wrapper, not the serialized element, so
|
|
191
|
-
// cloning would hand back the wrong node. Correctness first
|
|
195
|
+
// cloning would hand back the wrong node. Correctness first, SVG keeps the
|
|
192
196
|
// imperative path until the runtime grows an unwrapping clone.
|
|
193
197
|
if (templates && node.static && !node.svg && isSerializable(node)) {
|
|
194
198
|
used.add('templateNode');
|
|
@@ -201,7 +205,7 @@ function emitNode(node, used, templates) {
|
|
|
201
205
|
? `templateNode(${id}, ${JSON.stringify(node.tag)}, false, false, ${JSON.stringify(at)})`
|
|
202
206
|
: `templateNode(${id}, ${JSON.stringify(node.tag)})`;
|
|
203
207
|
}
|
|
204
|
-
// Structure static, contents dynamic
|
|
208
|
+
// Structure static, contents dynamic: the common shape. One template for the
|
|
205
209
|
// structure, then each hole filled through a reference into the clone. Every
|
|
206
210
|
// reference is read before any insertion, since inserting shifts later positions.
|
|
207
211
|
if (templates && partial) {
|
|
@@ -223,13 +227,13 @@ function emitNode(node, used, templates) {
|
|
|
223
227
|
for (const step of plan.steps)
|
|
224
228
|
lines.push(`const ${step.ref} = ${step.expr};`);
|
|
225
229
|
for (const hole of plan.holes) {
|
|
226
|
-
// The fourth argument is what the hole already holds
|
|
230
|
+
// The fourth argument is what the hole already holds, nothing on a fresh
|
|
227
231
|
// clone, the server's content when hydrating. `insert` reconciles against it,
|
|
228
232
|
// so hydration reuses those nodes rather than building new ones.
|
|
229
233
|
// `holeScope` places the hydration cursor at what the server rendered for
|
|
230
234
|
// this hole, so anything the content builds internally adopts too.
|
|
231
235
|
lines.push(`insert(${hole.parentRef}, holeScope(${hole.startRef}, () => ` +
|
|
232
|
-
|
|
236
|
+
`${paren(emitNode(hole.node, used, templates), 'arrowBody')}), ` +
|
|
233
237
|
`${hole.endRef}, holeContent(${hole.startRef}, ${hole.endRef}));`);
|
|
234
238
|
}
|
|
235
239
|
lines.push('return _el$;');
|
|
@@ -251,7 +255,7 @@ function emitNode(node, used, templates) {
|
|
|
251
255
|
if (node.props.length > 0) {
|
|
252
256
|
// Literal attributes are written straight on. `spread` is a generic helper that
|
|
253
257
|
// walks every prop checking for reactivity, events, refs, class/style objects and
|
|
254
|
-
// namespaces
|
|
258
|
+
// namespaces: none of which a compile-time constant needs. Same predicate the
|
|
255
259
|
// template serializer uses, so the two agree on what a plain attribute is.
|
|
256
260
|
if (!node.svg && node.props.every(isPlainLiteralAttr)) {
|
|
257
261
|
for (const p of node.props)
|
|
@@ -283,7 +287,7 @@ function emitNode(node, used, templates) {
|
|
|
283
287
|
/**
|
|
284
288
|
* Substitute template declarations into the code as inline `createTemplate` calls.
|
|
285
289
|
*
|
|
286
|
-
* For hosts that cannot hoist
|
|
290
|
+
* For hosts that cannot hoist: nested JSX lowered inside an expression, where there is
|
|
287
291
|
* no module scope to reach. `createTemplate` caches by HTML string, so this costs a Map
|
|
288
292
|
* lookup per instantiation rather than a re-parse, and is still far cheaper than
|
|
289
293
|
* building the subtree element by element.
|