@fluixi/compiler 1.0.0-alpha.100 → 1.0.0-alpha.102
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/README.md +13 -13
- package/dist/analyze/props-destructure.d.cts +1 -1
- package/dist/analyze/props-destructure.d.ts +1 -1
- package/dist/analyze/props-destructure.js +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 +3 -3
- package/dist/analyze/static-graph.cjs +1 -1
- package/dist/analyze/static-graph.js +2 -2
- package/dist/analyze/static-graph.mjs +1 -1
- package/dist/{babel-I6BUWUCU.mjs → babel-WBQWG5BI.mjs} +23 -23
- package/dist/{chunk-C3XPDB4Y.mjs → chunk-AOKTQGX3.mjs} +1 -1
- package/dist/{chunk-HXEXPWJ2.mjs → chunk-EEUWXI5C.mjs} +2 -2
- package/dist/{chunk-3AICWNF7.mjs → chunk-HUWJHS6T.mjs} +1 -1
- package/dist/{chunk-NU3W67UZ.mjs → chunk-KGXFUVHJ.mjs} +2 -2
- package/dist/{chunk-GX5XV6Z7.mjs → chunk-MASWFMPJ.mjs} +1 -1
- package/dist/{chunk-SKAVY75W.mjs → chunk-TFGOAGRI.mjs} +1 -1
- package/dist/{chunk-6CWJWGE2.mjs → chunk-WUV5ZIYZ.mjs} +10 -10
- package/dist/codegen/backends/imperative.js +2 -2
- package/dist/frontend/babel/{build-ir-lit.cjs → build-ir-html.cjs} +19 -19
- package/dist/frontend/babel/{build-ir-lit.d.cts → build-ir-html.d.cts} +5 -5
- package/dist/frontend/babel/{build-ir-lit.d.ts → build-ir-html.d.ts} +6 -6
- package/dist/frontend/babel/build-ir-html.d.ts.map +1 -0
- package/dist/frontend/babel/{build-ir-lit.js → build-ir-html.js} +4 -4
- package/dist/frontend/babel/{build-ir-lit.mjs → build-ir-html.mjs} +15 -15
- package/dist/frontend/babel/build-ir.cjs +14 -14
- package/dist/frontend/babel/build-ir.d.cts +1 -1
- package/dist/frontend/babel/build-ir.d.ts +1 -1
- package/dist/frontend/babel/build-ir.js +5 -5
- package/dist/frontend/babel/build-ir.mjs +14 -14
- package/dist/frontend/babel/index.cjs +28 -28
- package/dist/frontend/babel/index.d.cts +0 -11
- package/dist/frontend/babel/index.d.ts +0 -11
- package/dist/frontend/babel/index.d.ts.map +1 -1
- package/dist/frontend/babel/index.js +2 -14
- package/dist/frontend/babel/index.mjs +28 -28
- package/dist/frontend/babel/lower-template.cjs +15 -15
- package/dist/frontend/babel/lower-template.d.cts +3 -3
- package/dist/frontend/babel/lower-template.d.ts +3 -3
- package/dist/frontend/babel/lower-template.d.ts.map +1 -1
- package/dist/frontend/babel/lower-template.js +4 -4
- package/dist/frontend/babel/lower-template.mjs +15 -15
- package/dist/frontend/babel/plugin.cjs +25 -25
- package/dist/frontend/babel/plugin.d.cts +6 -22
- package/dist/frontend/babel/plugin.d.ts +6 -22
- package/dist/frontend/babel/plugin.d.ts.map +1 -1
- package/dist/frontend/babel/plugin.js +19 -42
- package/dist/frontend/babel/plugin.mjs +25 -25
- package/dist/frontend/babel/server-functions.js +2 -2
- package/dist/index.cjs +9 -9
- package/dist/index.mjs +9 -9
- package/dist/integrations.cjs +42 -42
- package/dist/integrations.d.cts +7 -22
- package/dist/integrations.d.ts +7 -22
- package/dist/integrations.d.ts.map +1 -1
- package/dist/integrations.js +3 -34
- package/dist/integrations.mjs +13 -13
- package/dist/ir/nodes.d.cts +1 -1
- package/dist/ir/nodes.d.ts +1 -1
- package/dist/lower/compile-template.cjs +9 -9
- package/dist/lower/compile-template.d.cts +2 -2
- package/dist/lower/compile-template.d.ts +2 -2
- package/dist/lower/compile-template.d.ts.map +1 -1
- package/dist/lower/compile-template.js +1 -1
- package/dist/lower/compile-template.mjs +9 -9
- package/dist/lower/jsx.js +2 -2
- package/dist/lower/template.cjs +8 -8
- package/dist/lower/template.d.cts +6 -6
- package/dist/lower/template.d.ts +6 -6
- package/dist/lower/template.d.ts.map +1 -1
- package/dist/lower/template.js +14 -14
- package/dist/lower/template.mjs +8 -8
- package/dist/resolve/builtins.cjs +1 -1
- package/dist/resolve/builtins.d.cts +2 -2
- package/dist/resolve/builtins.d.ts +2 -2
- package/dist/resolve/builtins.js +1 -1
- package/dist/resolve/builtins.mjs +1 -1
- package/dist/resolve/component-globals.d.cts +2 -2
- package/dist/resolve/component-globals.d.ts +2 -2
- package/dist/resolve/component-globals.js +1 -1
- package/dist/resolve/load-directive.d.cts +1 -1
- package/dist/resolve/load-directive.d.ts +1 -1
- package/dist/resolve/load-directive.js +1 -1
- package/dist/resolve/resolve-ir.d.cts +1 -1
- package/dist/resolve/resolve-ir.d.ts +1 -1
- package/dist/{server-fns-VZLHMQTC.mjs → server-fns-I6FKYS22.mjs} +5 -5
- package/dist/{server-functions-UAZKOLZW.mjs → server-functions-MATGYTBX.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 +17 -17
- package/dist/transform/index.mjs +17 -17
- package/dist/transform/intrinsics.d.cts +1 -1
- package/dist/transform/intrinsics.d.ts +1 -1
- package/dist/transform/intrinsics.js +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.d.ts.map +1 -1
- package/dist/transform/source-locations.js +6 -6
- package/dist/transform/styles.d.cts +2 -2
- package/dist/transform/styles.d.ts +2 -2
- package/dist/transform/styles.d.ts.map +1 -1
- package/dist/transform/styles.js +5 -5
- package/dist/transform/templates.cjs +16 -16
- 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 +10 -10
- package/dist/transform/templates.mjs +16 -16
- package/dist/{transform-3W45L3EA.mjs → transform-AP5PSRT7.mjs} +15 -15
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/vite-styles.js +2 -2
- package/package.json +4 -4
- package/dist/frontend/babel/build-ir-lit.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/compiler v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/compiler v1.0.0-alpha.102 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1007,7 +1007,7 @@ var Lowerer = class {
|
|
|
1007
1007
|
for (const s of imports) this.used.add(s);
|
|
1008
1008
|
return inlineTemplates(code, templates);
|
|
1009
1009
|
}
|
|
1010
|
-
//
|
|
1010
|
+
// content
|
|
1011
1011
|
lowerRoot(children) {
|
|
1012
1012
|
const nodes = this.lowerChildren(children);
|
|
1013
1013
|
if (nodes.length === 1) return nodes[0];
|
|
@@ -1136,8 +1136,8 @@ var Lowerer = class {
|
|
|
1136
1136
|
}
|
|
1137
1137
|
return { slots, rest };
|
|
1138
1138
|
}
|
|
1139
|
-
//
|
|
1140
|
-
/** `<el if=${cond}
|
|
1139
|
+
// control-flow sugar
|
|
1140
|
+
/** `<el if=${cond}>...</el>` (+ optional `<el else>`) → `<Show when fallback>`. */
|
|
1141
1141
|
lowerIf(el, condHole, elseEl) {
|
|
1142
1142
|
const cond = this.hole(condHole);
|
|
1143
1143
|
const props = [
|
|
@@ -1152,8 +1152,8 @@ var Lowerer = class {
|
|
|
1152
1152
|
return { kind: "component", name: "Show", props, children: [child], ...at ? { at } : {}, ...cond.at ? { bindAt: cond.at } : {} };
|
|
1153
1153
|
}
|
|
1154
1154
|
/**
|
|
1155
|
-
* `<el each=${items} key?>${item =>
|
|
1156
|
-
* content is repeated per item. Content that is not a `${item =>
|
|
1155
|
+
* `<el each=${items} key?>${item => ...}</el>` → `<el><For each>{item => ...}</For></el>`: the
|
|
1156
|
+
* content is repeated per item. Content that is not a `${item => ...}` arrow is repeated as
|
|
1157
1157
|
* it is. Null when the element has no `each`.
|
|
1158
1158
|
*/
|
|
1159
1159
|
lowerEach(el) {
|
|
@@ -1190,7 +1190,7 @@ var Lowerer = class {
|
|
|
1190
1190
|
const clone = { ...el, attributes: el.attributes.filter((a) => !drop(a)) };
|
|
1191
1191
|
return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
|
|
1192
1192
|
}
|
|
1193
|
-
//
|
|
1193
|
+
// attributes
|
|
1194
1194
|
/**
|
|
1195
1195
|
* `element`: a DOM element, where each class:/style: value that moves is its own accessor.
|
|
1196
1196
|
* A component gets the object as before, rebuilt whole when any value moves.
|
|
@@ -1331,7 +1331,7 @@ var Lowerer = class {
|
|
|
1331
1331
|
if (mods.includes("passive")) opts.push("passive: true");
|
|
1332
1332
|
return opts.length ? `{ ${opts.join(", ")} }` : null;
|
|
1333
1333
|
}
|
|
1334
|
-
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e
|
|
1334
|
+
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e...value)}`. */
|
|
1335
1335
|
bindProps(prop, h) {
|
|
1336
1336
|
const sigCode = h.code;
|
|
1337
1337
|
const checked = prop === "checked";
|
|
@@ -1357,7 +1357,7 @@ var Lowerer = class {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
];
|
|
1359
1359
|
}
|
|
1360
|
-
/** A plain attribute (incl.
|
|
1360
|
+
/** A plain attribute (incl. html `?bool`, mixed values), old `mkProp` behavior. */
|
|
1361
1361
|
plainAttr(a) {
|
|
1362
1362
|
const v = a.value;
|
|
1363
1363
|
let name = a.name;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/compiler v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/compiler v1.0.0-alpha.102 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
|
|
3
3
|
// src/analyze/reactive-expr.ts
|
|
4
4
|
var STABLE_MEMBER = "children";
|
|
@@ -960,7 +960,7 @@ var Lowerer = class {
|
|
|
960
960
|
for (const s of imports) this.used.add(s);
|
|
961
961
|
return inlineTemplates(code, templates);
|
|
962
962
|
}
|
|
963
|
-
//
|
|
963
|
+
// content
|
|
964
964
|
lowerRoot(children) {
|
|
965
965
|
const nodes = this.lowerChildren(children);
|
|
966
966
|
if (nodes.length === 1) return nodes[0];
|
|
@@ -1089,8 +1089,8 @@ var Lowerer = class {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
return { slots, rest };
|
|
1091
1091
|
}
|
|
1092
|
-
//
|
|
1093
|
-
/** `<el if=${cond}
|
|
1092
|
+
// control-flow sugar
|
|
1093
|
+
/** `<el if=${cond}>...</el>` (+ optional `<el else>`) → `<Show when fallback>`. */
|
|
1094
1094
|
lowerIf(el, condHole, elseEl) {
|
|
1095
1095
|
const cond = this.hole(condHole);
|
|
1096
1096
|
const props = [
|
|
@@ -1105,8 +1105,8 @@ var Lowerer = class {
|
|
|
1105
1105
|
return { kind: "component", name: "Show", props, children: [child], ...at ? { at } : {}, ...cond.at ? { bindAt: cond.at } : {} };
|
|
1106
1106
|
}
|
|
1107
1107
|
/**
|
|
1108
|
-
* `<el each=${items} key?>${item =>
|
|
1109
|
-
* content is repeated per item. Content that is not a `${item =>
|
|
1108
|
+
* `<el each=${items} key?>${item => ...}</el>` → `<el><For each>{item => ...}</For></el>`: the
|
|
1109
|
+
* content is repeated per item. Content that is not a `${item => ...}` arrow is repeated as
|
|
1110
1110
|
* it is. Null when the element has no `each`.
|
|
1111
1111
|
*/
|
|
1112
1112
|
lowerEach(el) {
|
|
@@ -1143,7 +1143,7 @@ var Lowerer = class {
|
|
|
1143
1143
|
const clone = { ...el, attributes: el.attributes.filter((a) => !drop(a)) };
|
|
1144
1144
|
return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
|
|
1145
1145
|
}
|
|
1146
|
-
//
|
|
1146
|
+
// attributes
|
|
1147
1147
|
/**
|
|
1148
1148
|
* `element`: a DOM element, where each class:/style: value that moves is its own accessor.
|
|
1149
1149
|
* A component gets the object as before, rebuilt whole when any value moves.
|
|
@@ -1284,7 +1284,7 @@ var Lowerer = class {
|
|
|
1284
1284
|
if (mods.includes("passive")) opts.push("passive: true");
|
|
1285
1285
|
return opts.length ? `{ ${opts.join(", ")} }` : null;
|
|
1286
1286
|
}
|
|
1287
|
-
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e
|
|
1287
|
+
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e...value)}`. */
|
|
1288
1288
|
bindProps(prop, h) {
|
|
1289
1289
|
const sigCode = h.code;
|
|
1290
1290
|
const checked = prop === "checked";
|
|
@@ -1310,7 +1310,7 @@ var Lowerer = class {
|
|
|
1310
1310
|
}
|
|
1311
1311
|
];
|
|
1312
1312
|
}
|
|
1313
|
-
/** A plain attribute (incl.
|
|
1313
|
+
/** A plain attribute (incl. html `?bool`, mixed values), old `mkProp` behavior. */
|
|
1314
1314
|
plainAttr(a) {
|
|
1315
1315
|
const v = a.value;
|
|
1316
1316
|
let name = a.name;
|
package/dist/integrations.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/compiler v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/compiler v1.0.0-alpha.102 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -2183,7 +2183,7 @@ var init_template = __esm({
|
|
|
2183
2183
|
for (const s of imports) this.used.add(s);
|
|
2184
2184
|
return inlineTemplates(code, templates);
|
|
2185
2185
|
}
|
|
2186
|
-
//
|
|
2186
|
+
// content
|
|
2187
2187
|
lowerRoot(children) {
|
|
2188
2188
|
const nodes = this.lowerChildren(children);
|
|
2189
2189
|
if (nodes.length === 1) return nodes[0];
|
|
@@ -2312,8 +2312,8 @@ var init_template = __esm({
|
|
|
2312
2312
|
}
|
|
2313
2313
|
return { slots, rest };
|
|
2314
2314
|
}
|
|
2315
|
-
//
|
|
2316
|
-
/** `<el if=${cond}
|
|
2315
|
+
// control-flow sugar
|
|
2316
|
+
/** `<el if=${cond}>...</el>` (+ optional `<el else>`) → `<Show when fallback>`. */
|
|
2317
2317
|
lowerIf(el, condHole, elseEl) {
|
|
2318
2318
|
const cond = this.hole(condHole);
|
|
2319
2319
|
const props = [
|
|
@@ -2328,8 +2328,8 @@ var init_template = __esm({
|
|
|
2328
2328
|
return { kind: "component", name: "Show", props, children: [child], ...at ? { at } : {}, ...cond.at ? { bindAt: cond.at } : {} };
|
|
2329
2329
|
}
|
|
2330
2330
|
/**
|
|
2331
|
-
* `<el each=${items} key?>${item =>
|
|
2332
|
-
* content is repeated per item. Content that is not a `${item =>
|
|
2331
|
+
* `<el each=${items} key?>${item => ...}</el>` → `<el><For each>{item => ...}</For></el>`: the
|
|
2332
|
+
* content is repeated per item. Content that is not a `${item => ...}` arrow is repeated as
|
|
2333
2333
|
* it is. Null when the element has no `each`.
|
|
2334
2334
|
*/
|
|
2335
2335
|
lowerEach(el) {
|
|
@@ -2366,7 +2366,7 @@ var init_template = __esm({
|
|
|
2366
2366
|
const clone = { ...el, attributes: el.attributes.filter((a) => !drop(a)) };
|
|
2367
2367
|
return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
|
|
2368
2368
|
}
|
|
2369
|
-
//
|
|
2369
|
+
// attributes
|
|
2370
2370
|
/**
|
|
2371
2371
|
* `element`: a DOM element, where each class:/style: value that moves is its own accessor.
|
|
2372
2372
|
* A component gets the object as before, rebuilt whole when any value moves.
|
|
@@ -2507,7 +2507,7 @@ var init_template = __esm({
|
|
|
2507
2507
|
if (mods.includes("passive")) opts.push("passive: true");
|
|
2508
2508
|
return opts.length ? `{ ${opts.join(", ")} }` : null;
|
|
2509
2509
|
}
|
|
2510
|
-
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e
|
|
2510
|
+
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e...value)}`. */
|
|
2511
2511
|
bindProps(prop, h) {
|
|
2512
2512
|
const sigCode = h.code;
|
|
2513
2513
|
const checked = prop === "checked";
|
|
@@ -2533,7 +2533,7 @@ var init_template = __esm({
|
|
|
2533
2533
|
}
|
|
2534
2534
|
];
|
|
2535
2535
|
}
|
|
2536
|
-
/** A plain attribute (incl.
|
|
2536
|
+
/** A plain attribute (incl. html `?bool`, mixed values), old `mkProp` behavior. */
|
|
2537
2537
|
plainAttr(a) {
|
|
2538
2538
|
const v = a.value;
|
|
2539
2539
|
let name = a.name;
|
|
@@ -2597,7 +2597,7 @@ function bindHole(expr, used, onNested) {
|
|
|
2597
2597
|
if (import_core.types.isObjectExpression(expr)) hole.object = true;
|
|
2598
2598
|
return hole;
|
|
2599
2599
|
}
|
|
2600
|
-
function
|
|
2600
|
+
function lowerHtmlTemplate(node, used, opts = {}) {
|
|
2601
2601
|
const quasi = node.quasi;
|
|
2602
2602
|
const holes = quasi.expressions.map((e) => bindHole(e, used, opts.onNested));
|
|
2603
2603
|
return lowerTemplate(buildPieces(quasi), holes, used, opts);
|
|
@@ -2706,14 +2706,14 @@ var init_analyze_static = __esm({
|
|
|
2706
2706
|
}
|
|
2707
2707
|
});
|
|
2708
2708
|
|
|
2709
|
-
// src/frontend/babel/build-ir-
|
|
2710
|
-
function
|
|
2711
|
-
const ir =
|
|
2709
|
+
// src/frontend/babel/build-ir-html.ts
|
|
2710
|
+
function buildIRFromHtml(node, used = /* @__PURE__ */ new Set(), opts = {}) {
|
|
2711
|
+
const ir = lowerHtmlTemplate(node, used, opts);
|
|
2712
2712
|
analyzeStatic(ir);
|
|
2713
2713
|
return ir;
|
|
2714
2714
|
}
|
|
2715
|
-
var
|
|
2716
|
-
"src/frontend/babel/build-ir-
|
|
2715
|
+
var init_build_ir_html = __esm({
|
|
2716
|
+
"src/frontend/babel/build-ir-html.ts"() {
|
|
2717
2717
|
"use strict";
|
|
2718
2718
|
init_lower_template();
|
|
2719
2719
|
init_analyze_static();
|
|
@@ -3149,12 +3149,12 @@ function transformNestedJSX(node, used, onNested) {
|
|
|
3149
3149
|
const { code, imports, templates } = imperativeBackend.emit(nestedIR, {});
|
|
3150
3150
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
3151
3151
|
},
|
|
3152
|
-
// Nested
|
|
3152
|
+
// Nested html templates compose: ${cond ? html`...` : html`...`},
|
|
3153
3153
|
// ${list.map(x => html`<li>${x}</li>`)}. Compile them the same way.
|
|
3154
3154
|
TaggedTemplateExpression(path) {
|
|
3155
3155
|
const tag = path.node.tag;
|
|
3156
3156
|
if (!import_core2.types.isIdentifier(tag) || tag.name !== "html" && tag.name !== "svg") return;
|
|
3157
|
-
const ir =
|
|
3157
|
+
const ir = buildIRFromHtml(path.node, used, { svg: tag.name === "svg", onNested });
|
|
3158
3158
|
onNested?.(ir);
|
|
3159
3159
|
const { code, imports, templates } = imperativeBackend.emit(ir, {});
|
|
3160
3160
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
@@ -3186,7 +3186,7 @@ var init_build_ir = __esm({
|
|
|
3186
3186
|
import_core2 = require("@babel/core");
|
|
3187
3187
|
import_generator2 = __toESM(require("@babel/generator"), 1);
|
|
3188
3188
|
init_imperative();
|
|
3189
|
-
|
|
3189
|
+
init_build_ir_html();
|
|
3190
3190
|
init_jsx();
|
|
3191
3191
|
init_reactive_expr();
|
|
3192
3192
|
init_expr_shape();
|
|
@@ -3292,10 +3292,10 @@ function dedupeImports(imports) {
|
|
|
3292
3292
|
}
|
|
3293
3293
|
return out;
|
|
3294
3294
|
}
|
|
3295
|
-
function
|
|
3295
|
+
function emitHtmlViaIR(node, state) {
|
|
3296
3296
|
const used = /* @__PURE__ */ new Set();
|
|
3297
3297
|
const svg = import_core3.types.isIdentifier(node.tag) && node.tag.name === "svg";
|
|
3298
|
-
const ir =
|
|
3298
|
+
const ir = buildIRFromHtml(node, used, { svg, onNested: nestedHook(state) });
|
|
3299
3299
|
resolveComponentSources(ir, {
|
|
3300
3300
|
resolver: state.componentResolver,
|
|
3301
3301
|
modules: {
|
|
@@ -3310,7 +3310,7 @@ function emitLitViaIR(node, state) {
|
|
|
3310
3310
|
for (const s of imports) used.add(s);
|
|
3311
3311
|
for (const s of used) state.irImports.add(s);
|
|
3312
3312
|
collectRuntimeNeeds(ir, state);
|
|
3313
|
-
state.
|
|
3313
|
+
state.hasHtmlIR = true;
|
|
3314
3314
|
const expression = import_core3.template.expression(adoptTemplates(code, templates, state), {
|
|
3315
3315
|
placeholderPattern: false,
|
|
3316
3316
|
plugins: ["typescript"]
|
|
@@ -3382,7 +3382,7 @@ var init_plugin = __esm({
|
|
|
3382
3382
|
init_builtins();
|
|
3383
3383
|
import_core3 = require("@babel/core");
|
|
3384
3384
|
init_build_ir();
|
|
3385
|
-
|
|
3385
|
+
init_build_ir_html();
|
|
3386
3386
|
init_imperative();
|
|
3387
3387
|
CORE_ONLY_CONTROL_FLOW = new Set(CORE_CONTROL_FLOW);
|
|
3388
3388
|
ROUTER_COMPONENTS2 = new Set(ROUTER_COMPONENTS);
|
|
@@ -3400,11 +3400,11 @@ var init_plugin = __esm({
|
|
|
3400
3400
|
// `fluixi()` needs no `format` option. Injected imports are deduped, so a
|
|
3401
3401
|
// file mixing the two styles won't redeclare a binding.
|
|
3402
3402
|
format = "both",
|
|
3403
|
-
|
|
3403
|
+
htmlTag = "html",
|
|
3404
3404
|
resolve: resolveRules = []
|
|
3405
3405
|
} = options;
|
|
3406
3406
|
const componentResolver = createComponentResolver(resolveRules);
|
|
3407
|
-
const
|
|
3407
|
+
const compileHtml = format === "html" || format === "both";
|
|
3408
3408
|
const pluginState = {
|
|
3409
3409
|
irImports: /* @__PURE__ */ new Set(),
|
|
3410
3410
|
libModule: "@fluixi/core",
|
|
@@ -3413,7 +3413,7 @@ var init_plugin = __esm({
|
|
|
3413
3413
|
templateClone,
|
|
3414
3414
|
partialTemplates,
|
|
3415
3415
|
hasJSX: false,
|
|
3416
|
-
|
|
3416
|
+
hasHtmlTag: false,
|
|
3417
3417
|
needsControlFlowImport: false,
|
|
3418
3418
|
needsCreateMemo: false,
|
|
3419
3419
|
controlFlowComponents: /* @__PURE__ */ new Set(),
|
|
@@ -3437,8 +3437,8 @@ var init_plugin = __esm({
|
|
|
3437
3437
|
enter(path, state) {
|
|
3438
3438
|
Object.assign(state, {
|
|
3439
3439
|
hasJSX: false,
|
|
3440
|
-
|
|
3441
|
-
|
|
3440
|
+
hasHtmlTag: false,
|
|
3441
|
+
hasHtmlIR: false,
|
|
3442
3442
|
needsControlFlowImport: false,
|
|
3443
3443
|
needsCreateMemo: false,
|
|
3444
3444
|
controlFlowComponents: /* @__PURE__ */ new Set(),
|
|
@@ -3463,7 +3463,7 @@ var init_plugin = __esm({
|
|
|
3463
3463
|
},
|
|
3464
3464
|
exit(path, state) {
|
|
3465
3465
|
const imports = [];
|
|
3466
|
-
if (state.hasJSX || state.
|
|
3466
|
+
if (state.hasJSX || state.hasHtmlIR) {
|
|
3467
3467
|
if (state.irImports.size > 0) {
|
|
3468
3468
|
const CF = /* @__PURE__ */ new Set([
|
|
3469
3469
|
"Show",
|
|
@@ -3653,8 +3653,8 @@ var init_plugin = __esm({
|
|
|
3653
3653
|
path.replaceWith(emitViaIR(path.node, state));
|
|
3654
3654
|
},
|
|
3655
3655
|
TaggedTemplateExpression(path, state) {
|
|
3656
|
-
if (
|
|
3657
|
-
path.replaceWith(
|
|
3656
|
+
if (compileHtml && import_core3.types.isIdentifier(path.node.tag) && (path.node.tag.name === htmlTag || path.node.tag.name === "svg")) {
|
|
3657
|
+
path.replaceWith(emitHtmlViaIR(path.node, state));
|
|
3658
3658
|
}
|
|
3659
3659
|
}
|
|
3660
3660
|
}
|
|
@@ -3692,7 +3692,7 @@ function createPreset(options = {}) {
|
|
|
3692
3692
|
importSource: "@fluixi/jsx",
|
|
3693
3693
|
development: false,
|
|
3694
3694
|
detectReactivity: true,
|
|
3695
|
-
|
|
3695
|
+
useHtmlTag: true,
|
|
3696
3696
|
hoistStatics: true,
|
|
3697
3697
|
delegateEvents: true,
|
|
3698
3698
|
optimizeControlFlow: true,
|
|
@@ -3725,7 +3725,7 @@ var init_babel = __esm({
|
|
|
3725
3725
|
}),
|
|
3726
3726
|
minimal: createPreset({
|
|
3727
3727
|
detectReactivity: false,
|
|
3728
|
-
|
|
3728
|
+
useHtmlTag: false,
|
|
3729
3729
|
hoistStatics: false,
|
|
3730
3730
|
delegateEvents: false,
|
|
3731
3731
|
optimizeControlFlow: false
|
|
@@ -4306,7 +4306,7 @@ function outermost(list) {
|
|
|
4306
4306
|
(e) => !list.some(
|
|
4307
4307
|
(o) => o !== e && o.start <= e.start && o.end >= e.end && o.end - o.start > e.end - e.start && // An insertion at either edge of the container sits beside it, not inside it, so
|
|
4308
4308
|
// it is not something the container's code already folded in. A statement can
|
|
4309
|
-
// start where its callee starts (`$effect(
|
|
4309
|
+
// start where its callee starts (`$effect(...)`) and a declarator can end where its
|
|
4310
4310
|
// JSX ends (`const Row = () => <b/>`).
|
|
4311
4311
|
!(e.start === e.end && (e.start === o.start || e.start === o.end))
|
|
4312
4312
|
)
|
|
@@ -4323,7 +4323,7 @@ function bindHole2(code, expr, edits, keepPosition = false) {
|
|
|
4323
4323
|
const hole = {
|
|
4324
4324
|
code: slice(code, expr.start, expr.end, edits),
|
|
4325
4325
|
reactive: isReactiveShape(shapeOf(expr)),
|
|
4326
|
-
// Where the `${
|
|
4326
|
+
// Where the `${...}` is, so a binding made from it can say so. The source map cannot:
|
|
4327
4327
|
// the whole template is one overwrite. Only when source locations were asked for.
|
|
4328
4328
|
...at ? { at: { line: at.line, column: at.column } } : {}
|
|
4329
4329
|
};
|
|
@@ -4439,11 +4439,11 @@ function relativeToRoot(id, root) {
|
|
|
4439
4439
|
return id.startsWith(base) ? id.slice(base.length) : id;
|
|
4440
4440
|
}
|
|
4441
4441
|
function transformTemplates(code, id, options = {}) {
|
|
4442
|
-
const
|
|
4442
|
+
const htmlTag = options.htmlTag ?? "html";
|
|
4443
4443
|
const format = options.format ?? "both";
|
|
4444
|
-
const
|
|
4445
|
-
const wantsJsx = format !== "
|
|
4446
|
-
const mayHaveTemplate =
|
|
4444
|
+
const wantsHtml = format !== "jsx";
|
|
4445
|
+
const wantsJsx = format !== "html";
|
|
4446
|
+
const mayHaveTemplate = wantsHtml && (code.includes(`${htmlTag}\``) || code.includes("svg`"));
|
|
4447
4447
|
const wantsIntrinsics = options.intrinsics !== false && mayHaveIntrinsic(code);
|
|
4448
4448
|
const wantsSources = options.sourceLocations === true && mayHaveSourceMarks(code);
|
|
4449
4449
|
const sourceName = relativeToRoot(id, options.sourceRoot);
|
|
@@ -4455,12 +4455,12 @@ function transformTemplates(code, id, options = {}) {
|
|
|
4455
4455
|
errorRecovery: true
|
|
4456
4456
|
});
|
|
4457
4457
|
const intrinsicTags = options.intrinsics === false ? /* @__PURE__ */ new Map() : tagIntrinsics(moduleBindings(ast.program));
|
|
4458
|
-
const templateTags = /* @__PURE__ */ new Map([[
|
|
4458
|
+
const templateTags = /* @__PURE__ */ new Map([[htmlTag, "html"], ["svg", "svg"]]);
|
|
4459
4459
|
for (const [name, tag] of intrinsicTags) if (tag !== "css") templateTags.set(name, tag);
|
|
4460
4460
|
const cssTags = [...intrinsicTags].filter(([, tag]) => tag === "css").map(([name]) => name);
|
|
4461
4461
|
const found = [];
|
|
4462
4462
|
walk7(ast.program, (n, parent, key) => {
|
|
4463
|
-
if (
|
|
4463
|
+
if (wantsHtml && isTemplateTag(n, templateTags)) found.push(n);
|
|
4464
4464
|
else if (wantsJsx && isJsxRoot(n, parent, key)) found.push(n);
|
|
4465
4465
|
});
|
|
4466
4466
|
const props = options.propsDestructure === false ? { edits: [], diagnostics: [], used: /* @__PURE__ */ new Set() } : collectPropsEdits(ast.program, code, { runtimeModule: options.runtimeModule });
|
|
@@ -5356,7 +5356,7 @@ async function createBabelPlugin(options = {}) {
|
|
|
5356
5356
|
...options.resolve ? { resolve: options.resolve } : {},
|
|
5357
5357
|
...options.templateClone !== void 0 ? { templateClone: options.templateClone } : {},
|
|
5358
5358
|
...options.partialTemplates !== void 0 ? { partialTemplates: options.partialTemplates } : {},
|
|
5359
|
-
...options.
|
|
5359
|
+
...options.htmlTag ? { htmlTag: options.htmlTag } : {},
|
|
5360
5360
|
...options.signalModule ? { signalModule: options.signalModule } : {},
|
|
5361
5361
|
...options.controlFlowModule ? { controlFlowModule: options.controlFlowModule } : {},
|
|
5362
5362
|
...options.routerModule ? { routerModule: options.routerModule } : {},
|
|
@@ -5530,7 +5530,7 @@ function marks(options, id) {
|
|
|
5530
5530
|
function transformOptions(options, id) {
|
|
5531
5531
|
return {
|
|
5532
5532
|
resolve: options.resolve,
|
|
5533
|
-
|
|
5533
|
+
htmlTag: options.htmlTag,
|
|
5534
5534
|
sourceLocations: marks(options, id),
|
|
5535
5535
|
sourceRoot: options.sourceRoot,
|
|
5536
5536
|
templateClone: options.templateClone,
|
package/dist/integrations.d.cts
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Bundler integrations for the Fluixi compiler.
|
|
3
|
-
* @module @fluixi/compiler/integrations
|
|
4
|
-
*
|
|
5
|
-
* vite, webpack, rollup and esbuild adapters. Each is a few lines around
|
|
6
|
-
* `compileModule`, which rewrites the source in place, JSX and `` html`` `` both
|
|
7
|
-
* lower to the shared IR and the imperative backend. fluixi re-exports
|
|
8
|
-
* createVitePlugin from here.
|
|
9
|
-
*
|
|
10
|
-
* `babel: true` routes through the babel front-end instead, for a project whose
|
|
11
|
-
* own babel plugins have to see the output. It is the only thing that needs
|
|
12
|
-
* @babel/core, and it says so rather than degrading: source that was not compiled
|
|
13
|
-
* is source whose templates never became DOM calls, and a build that ships it
|
|
14
|
-
* looks successful until the page is opened.
|
|
15
|
-
*/
|
|
16
1
|
export interface CompilerOptions {
|
|
17
2
|
/**
|
|
18
3
|
* Rules that resolve an unbound capitalised tag to a module, so a component can be
|
|
@@ -62,11 +47,11 @@ export interface CompilerOptions {
|
|
|
62
47
|
*/
|
|
63
48
|
importSource?: string;
|
|
64
49
|
/**
|
|
65
|
-
* Authoring syntaxes to compile: 'jsx', '
|
|
50
|
+
* Authoring syntaxes to compile: 'jsx', 'html' (only `` html`...` `` templates),
|
|
66
51
|
* or 'both' (default). Both lower to the same IR and the same backend.
|
|
67
52
|
* @default 'both'
|
|
68
53
|
*/
|
|
69
|
-
format?: 'jsx' | '
|
|
54
|
+
format?: 'jsx' | 'html' | 'both';
|
|
70
55
|
/**
|
|
71
56
|
* Record where each reactive node is created, and serve the running app's graph to a tool
|
|
72
57
|
* that asks for it. Development only: a build never carries either.
|
|
@@ -95,10 +80,10 @@ export interface CompilerOptions {
|
|
|
95
80
|
*/
|
|
96
81
|
babel?: boolean;
|
|
97
82
|
/**
|
|
98
|
-
* Tag name marking
|
|
83
|
+
* Tag name marking an html template for compilation (when `format` includes html).
|
|
99
84
|
* @default 'html'
|
|
100
85
|
*/
|
|
101
|
-
|
|
86
|
+
htmlTag?: string;
|
|
102
87
|
/**
|
|
103
88
|
* Rewrite a component's destructured props into property reads, so
|
|
104
89
|
* `function Card({ title })` keeps updating instead of reading `title` once.
|
|
@@ -123,7 +108,7 @@ export interface CompilerOptions {
|
|
|
123
108
|
*/
|
|
124
109
|
controlFlowModule?: string;
|
|
125
110
|
/**
|
|
126
|
-
* Module the router components (Router/Outlet
|
|
111
|
+
* Module the router components (Router/Outlet/...) are auto-imported from.
|
|
127
112
|
* @default '@fluixi/core/router'
|
|
128
113
|
*/
|
|
129
114
|
routerModule?: string;
|
|
@@ -144,11 +129,11 @@ export declare function createBabelPlugin(options?: CompilerOptions): Promise<{
|
|
|
144
129
|
routerModule?: string | undefined;
|
|
145
130
|
controlFlowModule?: string | undefined;
|
|
146
131
|
signalModule?: string | undefined;
|
|
147
|
-
|
|
132
|
+
htmlTag?: string | undefined;
|
|
148
133
|
partialTemplates?: boolean | undefined;
|
|
149
134
|
templateClone?: boolean | undefined;
|
|
150
135
|
resolve?: readonly ComponentResolverRule[] | undefined;
|
|
151
|
-
format?: "
|
|
136
|
+
format?: "html" | "both" | "jsx" | undefined;
|
|
152
137
|
importSource: string;
|
|
153
138
|
development: boolean;
|
|
154
139
|
delegateEvents: boolean;
|
package/dist/integrations.d.ts
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Bundler integrations for the Fluixi compiler.
|
|
3
|
-
* @module @fluixi/compiler/integrations
|
|
4
|
-
*
|
|
5
|
-
* vite, webpack, rollup and esbuild adapters. Each is a few lines around
|
|
6
|
-
* `compileModule`, which rewrites the source in place, JSX and `` html`` `` both
|
|
7
|
-
* lower to the shared IR and the imperative backend. fluixi re-exports
|
|
8
|
-
* createVitePlugin from here.
|
|
9
|
-
*
|
|
10
|
-
* `babel: true` routes through the babel front-end instead, for a project whose
|
|
11
|
-
* own babel plugins have to see the output. It is the only thing that needs
|
|
12
|
-
* @babel/core, and it says so rather than degrading: source that was not compiled
|
|
13
|
-
* is source whose templates never became DOM calls, and a build that ships it
|
|
14
|
-
* looks successful until the page is opened.
|
|
15
|
-
*/
|
|
16
1
|
export interface CompilerOptions {
|
|
17
2
|
/**
|
|
18
3
|
* Rules that resolve an unbound capitalised tag to a module, so a component can be
|
|
@@ -62,11 +47,11 @@ export interface CompilerOptions {
|
|
|
62
47
|
*/
|
|
63
48
|
importSource?: string;
|
|
64
49
|
/**
|
|
65
|
-
* Authoring syntaxes to compile: 'jsx', '
|
|
50
|
+
* Authoring syntaxes to compile: 'jsx', 'html' (only `` html`...` `` templates),
|
|
66
51
|
* or 'both' (default). Both lower to the same IR and the same backend.
|
|
67
52
|
* @default 'both'
|
|
68
53
|
*/
|
|
69
|
-
format?: 'jsx' | '
|
|
54
|
+
format?: 'jsx' | 'html' | 'both';
|
|
70
55
|
/**
|
|
71
56
|
* Record where each reactive node is created, and serve the running app's graph to a tool
|
|
72
57
|
* that asks for it. Development only: a build never carries either.
|
|
@@ -95,10 +80,10 @@ export interface CompilerOptions {
|
|
|
95
80
|
*/
|
|
96
81
|
babel?: boolean;
|
|
97
82
|
/**
|
|
98
|
-
* Tag name marking
|
|
83
|
+
* Tag name marking an html template for compilation (when `format` includes html).
|
|
99
84
|
* @default 'html'
|
|
100
85
|
*/
|
|
101
|
-
|
|
86
|
+
htmlTag?: string;
|
|
102
87
|
/**
|
|
103
88
|
* Rewrite a component's destructured props into property reads, so
|
|
104
89
|
* `function Card({ title })` keeps updating instead of reading `title` once.
|
|
@@ -123,7 +108,7 @@ export interface CompilerOptions {
|
|
|
123
108
|
*/
|
|
124
109
|
controlFlowModule?: string;
|
|
125
110
|
/**
|
|
126
|
-
* Module the router components (Router/Outlet
|
|
111
|
+
* Module the router components (Router/Outlet/...) are auto-imported from.
|
|
127
112
|
* @default '@fluixi/core/router'
|
|
128
113
|
*/
|
|
129
114
|
routerModule?: string;
|
|
@@ -144,11 +129,11 @@ export declare function createBabelPlugin(options?: CompilerOptions): Promise<{
|
|
|
144
129
|
routerModule?: string | undefined;
|
|
145
130
|
controlFlowModule?: string | undefined;
|
|
146
131
|
signalModule?: string | undefined;
|
|
147
|
-
|
|
132
|
+
htmlTag?: string | undefined;
|
|
148
133
|
partialTemplates?: boolean | undefined;
|
|
149
134
|
templateClone?: boolean | undefined;
|
|
150
135
|
resolve?: readonly ComponentResolverRule[] | undefined;
|
|
151
|
-
format?: "
|
|
136
|
+
format?: "html" | "both" | "jsx" | undefined;
|
|
152
137
|
importSource: string;
|
|
153
138
|
development: boolean;
|
|
154
139
|
delegateEvents: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC3C;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACzB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IAEjC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAE5C;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAID;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,eAAoB;;;;;;;;;;;;;;;;;GAwCpE;AAID;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,eAAoB,aAIpD,GAAG,MAAM,YAAY,GAAG,SAkB5C;AAmCD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAE,eAAoB,GAAG,CAAC,CA+JpE;AAoID;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,eAAoB,IACxC,MAAM,GAAG,EAAE,QAAQ,MAAM,mBAUjD;AAID;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,eAAoB;;oBAItC,MAAM,MAAM,MAAM;;;;;;;;;;;;EAK3C;AAID;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,eAAoB;;iBAIhD,GAAG;EAwBnB;AAMD,YAAY,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAqD7E;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,CAAC,CAqCvF;;;;;;;;;AAED,wBAOE"}
|
package/dist/integrations.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
* @fileoverview Bundler integrations for the Fluixi compiler.
|
|
3
|
-
* @module @fluixi/compiler/integrations
|
|
4
|
-
*
|
|
5
|
-
* vite, webpack, rollup and esbuild adapters. Each is a few lines around
|
|
6
|
-
* `compileModule`, which rewrites the source in place, JSX and `` html`` `` both
|
|
7
|
-
* lower to the shared IR and the imperative backend. fluixi re-exports
|
|
8
|
-
* createVitePlugin from here.
|
|
9
|
-
*
|
|
10
|
-
* `babel: true` routes through the babel front-end instead, for a project whose
|
|
11
|
-
* own babel plugins have to see the output. It is the only thing that needs
|
|
12
|
-
* @babel/core, and it says so rather than degrading: source that was not compiled
|
|
13
|
-
* is source whose templates never became DOM calls, and a build that ships it
|
|
14
|
-
* looks successful until the page is opened.
|
|
15
|
-
*/
|
|
16
|
-
// ============================================================================
|
|
1
|
+
// Types
|
|
17
2
|
// Babel Plugin Helpers
|
|
18
|
-
// ============================================================================
|
|
19
3
|
/**
|
|
20
4
|
* Helper for creating a Babel plugin
|
|
21
5
|
*/
|
|
@@ -48,7 +32,7 @@ export async function createBabelPlugin(options = {}) {
|
|
|
48
32
|
...(options.partialTemplates !== undefined
|
|
49
33
|
? { partialTemplates: options.partialTemplates }
|
|
50
34
|
: {}),
|
|
51
|
-
...(options.
|
|
35
|
+
...(options.htmlTag ? { htmlTag: options.htmlTag } : {}),
|
|
52
36
|
...(options.signalModule ? { signalModule: options.signalModule } : {}),
|
|
53
37
|
...(options.controlFlowModule
|
|
54
38
|
? { controlFlowModule: options.controlFlowModule }
|
|
@@ -59,9 +43,7 @@ export async function createBabelPlugin(options = {}) {
|
|
|
59
43
|
},
|
|
60
44
|
};
|
|
61
45
|
}
|
|
62
|
-
// ============================================================================
|
|
63
46
|
// TypeScript Transformer Helpers
|
|
64
|
-
// ============================================================================
|
|
65
47
|
/**
|
|
66
48
|
* Helper for creating a TypeScript transformer
|
|
67
49
|
*/
|
|
@@ -104,9 +86,7 @@ function tryRequire(moduleName) {
|
|
|
104
86
|
return null;
|
|
105
87
|
}
|
|
106
88
|
}
|
|
107
|
-
// ============================================================================
|
|
108
89
|
// Vite Plugin
|
|
109
|
-
// ============================================================================
|
|
110
90
|
/**
|
|
111
91
|
* Subpaths that used to exist, and what to write instead. A rename is cheap to
|
|
112
92
|
* follow once you know it happened; the cost is finding out.
|
|
@@ -255,11 +235,6 @@ export function createVitePlugin(options = {}) {
|
|
|
255
235
|
plugins: plugins,
|
|
256
236
|
sourceMaps: options.sourceMaps !== false,
|
|
257
237
|
});
|
|
258
|
-
// console.log('[createVitePlugin] Transformation complete for:', id);
|
|
259
|
-
// console.log(
|
|
260
|
-
// '[createVitePlugin] Has mergeProps in output:',
|
|
261
|
-
// result?.code?.includes('mergeProps')
|
|
262
|
-
// );
|
|
263
238
|
return {
|
|
264
239
|
code: result?.code || code,
|
|
265
240
|
map: result?.map,
|
|
@@ -295,7 +270,7 @@ function marks(options, id) {
|
|
|
295
270
|
function transformOptions(options, id) {
|
|
296
271
|
return {
|
|
297
272
|
resolve: options.resolve,
|
|
298
|
-
|
|
273
|
+
htmlTag: options.htmlTag,
|
|
299
274
|
sourceLocations: marks(options, id),
|
|
300
275
|
sourceRoot: options.sourceRoot,
|
|
301
276
|
templateClone: options.templateClone,
|
|
@@ -386,9 +361,7 @@ async function compileModule(code, id, options) {
|
|
|
386
361
|
});
|
|
387
362
|
return result?.code ? { code: result.code, map: result.map } : null;
|
|
388
363
|
}
|
|
389
|
-
// ============================================================================
|
|
390
364
|
// Webpack Loader
|
|
391
|
-
// ============================================================================
|
|
392
365
|
/**
|
|
393
366
|
* Create a Webpack loader for JSX transformation
|
|
394
367
|
*/
|
|
@@ -404,9 +377,7 @@ export function createWebpackLoader(options = {}) {
|
|
|
404
377
|
});
|
|
405
378
|
};
|
|
406
379
|
}
|
|
407
|
-
// ============================================================================
|
|
408
380
|
// Rollup Plugin
|
|
409
|
-
// ============================================================================
|
|
410
381
|
/**
|
|
411
382
|
* Create a Rollup plugin for JSX transformation
|
|
412
383
|
*/
|
|
@@ -420,9 +391,7 @@ export function createRollupPlugin(options = {}) {
|
|
|
420
391
|
},
|
|
421
392
|
};
|
|
422
393
|
}
|
|
423
|
-
// ============================================================================
|
|
424
394
|
// ESBuild Plugin
|
|
425
|
-
// ============================================================================
|
|
426
395
|
/**
|
|
427
396
|
* Create an ESBuild plugin for JSX transformation
|
|
428
397
|
*/
|