@fluixi/compiler 1.0.0-alpha.100 → 1.0.0-alpha.101
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-4WLP2IRR.mjs} +23 -23
- package/dist/{chunk-SKAVY75W.mjs → chunk-46MIOLUB.mjs} +1 -1
- package/dist/{chunk-C3XPDB4Y.mjs → chunk-AIK66L2P.mjs} +1 -1
- package/dist/{chunk-3AICWNF7.mjs → chunk-B6GUZXJP.mjs} +1 -1
- package/dist/{chunk-HXEXPWJ2.mjs → chunk-BVY2ISKX.mjs} +2 -2
- package/dist/{chunk-6CWJWGE2.mjs → chunk-G2PQDYFN.mjs} +10 -10
- package/dist/{chunk-GX5XV6Z7.mjs → chunk-K4Q6GHV6.mjs} +1 -1
- package/dist/{chunk-NU3W67UZ.mjs → chunk-S3LT32LA.mjs} +2 -2
- 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-THMTJXV7.mjs} +5 -5
- package/dist/{server-functions-UAZKOLZW.mjs → server-functions-MP4I3DAX.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-27QH3X24.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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Babel front-end entry for
|
|
2
|
+
* Babel front-end entry for `` html`...` `` templates.
|
|
3
3
|
*
|
|
4
4
|
* Historically this file held a single-pass scanner that went straight from
|
|
5
5
|
* template text to compiler IR. That fused parsing, lowering, and Babel
|
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
* `@fluixi/template-parser` : Babel-free tokenizer + parser → Template AST
|
|
10
10
|
* `./lower-template` : Babel-aware lowering: Template AST → IR
|
|
11
11
|
*
|
|
12
|
-
* `
|
|
13
|
-
* composition, plugin's `
|
|
12
|
+
* `buildIRFromHtml` keeps its exact signature so every caller (build-ir's nested
|
|
13
|
+
* composition, plugin's `emitHtmlViaIR`) is unchanged; the shared Template AST
|
|
14
14
|
* now also powers the language server, TS plugin, and Biome plugin.
|
|
15
15
|
*/
|
|
16
16
|
import type { types as t } from '@babel/core';
|
|
17
17
|
import type { IRNode } from '../../ir/nodes.js';
|
|
18
18
|
/**
|
|
19
|
-
* Build IR from
|
|
19
|
+
* Build IR from an `` html`...` `` (or `` svg`...` ``) TaggedTemplateExpression.
|
|
20
20
|
* `used` collects runtime symbols emitted for anything nested inside a hole.
|
|
21
21
|
* Pass `svg: true` for an `` svg`...` `` root.
|
|
22
22
|
*/
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function buildIRFromHtml(node: t.TaggedTemplateExpression, used?: Set<string>, opts?: {
|
|
24
24
|
svg?: boolean;
|
|
25
25
|
onNested?: (ir: IRNode) => void;
|
|
26
26
|
}): IRNode;
|
|
27
|
-
//# sourceMappingURL=build-ir-
|
|
27
|
+
//# sourceMappingURL=build-ir-html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-ir-html.d.ts","sourceRoot":"","sources":["../../../src/frontend/babel/build-ir-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,KAAK,IAAI,CAAC,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,CAAC,CAAC,wBAAwB,EAChC,IAAI,GAAE,GAAG,CAAC,MAAM,CAAa,EAC7B,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAAO,GAC5D,MAAM,CAKR"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lowerHtmlTemplate } from './lower-template.js';
|
|
2
2
|
import { analyzeStatic } from '../../optimize/analyze-static.js';
|
|
3
3
|
/**
|
|
4
|
-
* Build IR from
|
|
4
|
+
* Build IR from an `` html`...` `` (or `` svg`...` ``) TaggedTemplateExpression.
|
|
5
5
|
* `used` collects runtime symbols emitted for anything nested inside a hole.
|
|
6
6
|
* Pass `svg: true` for an `` svg`...` `` root.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
9
|
-
const ir =
|
|
8
|
+
export function buildIRFromHtml(node, used = new Set(), opts = {}) {
|
|
9
|
+
const ir = lowerHtmlTemplate(node, used, opts);
|
|
10
10
|
// Same pass as the JSX frontend, so both agree on what is inert.
|
|
11
11
|
analyzeStatic(ir);
|
|
12
12
|
return ir;
|
|
@@ -942,7 +942,7 @@ var Lowerer = class {
|
|
|
942
942
|
for (const s of imports) this.used.add(s);
|
|
943
943
|
return inlineTemplates(code, templates);
|
|
944
944
|
}
|
|
945
|
-
//
|
|
945
|
+
// content
|
|
946
946
|
lowerRoot(children) {
|
|
947
947
|
const nodes = this.lowerChildren(children);
|
|
948
948
|
if (nodes.length === 1) return nodes[0];
|
|
@@ -1071,8 +1071,8 @@ var Lowerer = class {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
return { slots, rest };
|
|
1073
1073
|
}
|
|
1074
|
-
//
|
|
1075
|
-
/** `<el if=${cond}
|
|
1074
|
+
// control-flow sugar
|
|
1075
|
+
/** `<el if=${cond}>...</el>` (+ optional `<el else>`) → `<Show when fallback>`. */
|
|
1076
1076
|
lowerIf(el, condHole, elseEl) {
|
|
1077
1077
|
const cond = this.hole(condHole);
|
|
1078
1078
|
const props = [
|
|
@@ -1087,8 +1087,8 @@ var Lowerer = class {
|
|
|
1087
1087
|
return { kind: "component", name: "Show", props, children: [child], ...at ? { at } : {}, ...cond.at ? { bindAt: cond.at } : {} };
|
|
1088
1088
|
}
|
|
1089
1089
|
/**
|
|
1090
|
-
* `<el each=${items} key?>${item =>
|
|
1091
|
-
* content is repeated per item. Content that is not a `${item =>
|
|
1090
|
+
* `<el each=${items} key?>${item => ...}</el>` → `<el><For each>{item => ...}</For></el>`: the
|
|
1091
|
+
* content is repeated per item. Content that is not a `${item => ...}` arrow is repeated as
|
|
1092
1092
|
* it is. Null when the element has no `each`.
|
|
1093
1093
|
*/
|
|
1094
1094
|
lowerEach(el) {
|
|
@@ -1125,7 +1125,7 @@ var Lowerer = class {
|
|
|
1125
1125
|
const clone = { ...el, attributes: el.attributes.filter((a) => !drop(a)) };
|
|
1126
1126
|
return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
|
|
1127
1127
|
}
|
|
1128
|
-
//
|
|
1128
|
+
// attributes
|
|
1129
1129
|
/**
|
|
1130
1130
|
* `element`: a DOM element, where each class:/style: value that moves is its own accessor.
|
|
1131
1131
|
* A component gets the object as before, rebuilt whole when any value moves.
|
|
@@ -1266,7 +1266,7 @@ var Lowerer = class {
|
|
|
1266
1266
|
if (mods.includes("passive")) opts.push("passive: true");
|
|
1267
1267
|
return opts.length ? `{ ${opts.join(", ")} }` : null;
|
|
1268
1268
|
}
|
|
1269
|
-
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e
|
|
1269
|
+
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e...value)}`. */
|
|
1270
1270
|
bindProps(prop, h) {
|
|
1271
1271
|
const sigCode = h.code;
|
|
1272
1272
|
const checked = prop === "checked";
|
|
@@ -1292,7 +1292,7 @@ var Lowerer = class {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
];
|
|
1294
1294
|
}
|
|
1295
|
-
/** A plain attribute (incl.
|
|
1295
|
+
/** A plain attribute (incl. html `?bool`, mixed values), old `mkProp` behavior. */
|
|
1296
1296
|
plainAttr(a) {
|
|
1297
1297
|
const v = a.value;
|
|
1298
1298
|
let name = a.name;
|
|
@@ -1821,12 +1821,12 @@ function transformNestedJSX(node, used, onNested) {
|
|
|
1821
1821
|
const { code, imports, templates } = imperativeBackend.emit(nestedIR, {});
|
|
1822
1822
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
1823
1823
|
},
|
|
1824
|
-
// Nested
|
|
1824
|
+
// Nested html templates compose: ${cond ? html`...` : html`...`},
|
|
1825
1825
|
// ${list.map(x => html`<li>${x}</li>`)}. Compile them the same way.
|
|
1826
1826
|
TaggedTemplateExpression(path) {
|
|
1827
1827
|
const tag = path.node.tag;
|
|
1828
1828
|
if (!t.isIdentifier(tag) || tag.name !== "html" && tag.name !== "svg") return;
|
|
1829
|
-
const ir =
|
|
1829
|
+
const ir = buildIRFromHtml(path.node, used, { svg: tag.name === "svg", onNested });
|
|
1830
1830
|
onNested?.(ir);
|
|
1831
1831
|
const { code, imports, templates } = imperativeBackend.emit(ir, {});
|
|
1832
1832
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
@@ -1873,7 +1873,7 @@ function bindHole(expr, used, onNested) {
|
|
|
1873
1873
|
if (t2.isObjectExpression(expr)) hole.object = true;
|
|
1874
1874
|
return hole;
|
|
1875
1875
|
}
|
|
1876
|
-
function
|
|
1876
|
+
function lowerHtmlTemplate(node, used, opts = {}) {
|
|
1877
1877
|
const quasi = node.quasi;
|
|
1878
1878
|
const holes = quasi.expressions.map((e) => bindHole(e, used, opts.onNested));
|
|
1879
1879
|
return lowerTemplate(buildPieces(quasi), holes, used, opts);
|
|
@@ -1891,12 +1891,12 @@ function buildPieces(quasi) {
|
|
|
1891
1891
|
return pieces;
|
|
1892
1892
|
}
|
|
1893
1893
|
|
|
1894
|
-
// src/frontend/babel/build-ir-
|
|
1895
|
-
function
|
|
1896
|
-
const ir =
|
|
1894
|
+
// src/frontend/babel/build-ir-html.ts
|
|
1895
|
+
function buildIRFromHtml(node, used = /* @__PURE__ */ new Set(), opts = {}) {
|
|
1896
|
+
const ir = lowerHtmlTemplate(node, used, opts);
|
|
1897
1897
|
analyzeStatic(ir);
|
|
1898
1898
|
return ir;
|
|
1899
1899
|
}
|
|
1900
1900
|
export {
|
|
1901
|
-
|
|
1901
|
+
buildIRFromHtml
|
|
1902
1902
|
};
|
|
@@ -981,7 +981,7 @@ var Lowerer = class {
|
|
|
981
981
|
for (const s of imports) this.used.add(s);
|
|
982
982
|
return inlineTemplates(code, templates);
|
|
983
983
|
}
|
|
984
|
-
//
|
|
984
|
+
// content
|
|
985
985
|
lowerRoot(children) {
|
|
986
986
|
const nodes = this.lowerChildren(children);
|
|
987
987
|
if (nodes.length === 1) return nodes[0];
|
|
@@ -1110,8 +1110,8 @@ var Lowerer = class {
|
|
|
1110
1110
|
}
|
|
1111
1111
|
return { slots, rest };
|
|
1112
1112
|
}
|
|
1113
|
-
//
|
|
1114
|
-
/** `<el if=${cond}
|
|
1113
|
+
// control-flow sugar
|
|
1114
|
+
/** `<el if=${cond}>...</el>` (+ optional `<el else>`) → `<Show when fallback>`. */
|
|
1115
1115
|
lowerIf(el, condHole, elseEl) {
|
|
1116
1116
|
const cond = this.hole(condHole);
|
|
1117
1117
|
const props = [
|
|
@@ -1126,8 +1126,8 @@ var Lowerer = class {
|
|
|
1126
1126
|
return { kind: "component", name: "Show", props, children: [child], ...at ? { at } : {}, ...cond.at ? { bindAt: cond.at } : {} };
|
|
1127
1127
|
}
|
|
1128
1128
|
/**
|
|
1129
|
-
* `<el each=${items} key?>${item =>
|
|
1130
|
-
* content is repeated per item. Content that is not a `${item =>
|
|
1129
|
+
* `<el each=${items} key?>${item => ...}</el>` → `<el><For each>{item => ...}</For></el>`: the
|
|
1130
|
+
* content is repeated per item. Content that is not a `${item => ...}` arrow is repeated as
|
|
1131
1131
|
* it is. Null when the element has no `each`.
|
|
1132
1132
|
*/
|
|
1133
1133
|
lowerEach(el) {
|
|
@@ -1164,7 +1164,7 @@ var Lowerer = class {
|
|
|
1164
1164
|
const clone = { ...el, attributes: el.attributes.filter((a) => !drop(a)) };
|
|
1165
1165
|
return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
|
|
1166
1166
|
}
|
|
1167
|
-
//
|
|
1167
|
+
// attributes
|
|
1168
1168
|
/**
|
|
1169
1169
|
* `element`: a DOM element, where each class:/style: value that moves is its own accessor.
|
|
1170
1170
|
* A component gets the object as before, rebuilt whole when any value moves.
|
|
@@ -1305,7 +1305,7 @@ var Lowerer = class {
|
|
|
1305
1305
|
if (mods.includes("passive")) opts.push("passive: true");
|
|
1306
1306
|
return opts.length ? `{ ${opts.join(", ")} }` : null;
|
|
1307
1307
|
}
|
|
1308
|
-
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e
|
|
1308
|
+
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e...value)}`. */
|
|
1309
1309
|
bindProps(prop, h) {
|
|
1310
1310
|
const sigCode = h.code;
|
|
1311
1311
|
const checked = prop === "checked";
|
|
@@ -1331,7 +1331,7 @@ var Lowerer = class {
|
|
|
1331
1331
|
}
|
|
1332
1332
|
];
|
|
1333
1333
|
}
|
|
1334
|
-
/** A plain attribute (incl.
|
|
1334
|
+
/** A plain attribute (incl. html `?bool`, mixed values), old `mkProp` behavior. */
|
|
1335
1335
|
plainAttr(a) {
|
|
1336
1336
|
const v = a.value;
|
|
1337
1337
|
let name = a.name;
|
|
@@ -1398,7 +1398,7 @@ function bindHole(expr, used, onNested) {
|
|
|
1398
1398
|
if (import_core.types.isObjectExpression(expr)) hole.object = true;
|
|
1399
1399
|
return hole;
|
|
1400
1400
|
}
|
|
1401
|
-
function
|
|
1401
|
+
function lowerHtmlTemplate(node, used, opts = {}) {
|
|
1402
1402
|
const quasi = node.quasi;
|
|
1403
1403
|
const holes = quasi.expressions.map((e) => bindHole(e, used, opts.onNested));
|
|
1404
1404
|
return lowerTemplate(buildPieces(quasi), holes, used, opts);
|
|
@@ -1491,9 +1491,9 @@ function childReason(node) {
|
|
|
1491
1491
|
return "expression-child";
|
|
1492
1492
|
}
|
|
1493
1493
|
|
|
1494
|
-
// src/frontend/babel/build-ir-
|
|
1495
|
-
function
|
|
1496
|
-
const ir =
|
|
1494
|
+
// src/frontend/babel/build-ir-html.ts
|
|
1495
|
+
function buildIRFromHtml(node, used = /* @__PURE__ */ new Set(), opts = {}) {
|
|
1496
|
+
const ir = lowerHtmlTemplate(node, used, opts);
|
|
1497
1497
|
analyzeStatic(ir);
|
|
1498
1498
|
return ir;
|
|
1499
1499
|
}
|
|
@@ -1902,12 +1902,12 @@ function transformNestedJSX(node, used, onNested) {
|
|
|
1902
1902
|
const { code, imports, templates } = imperativeBackend.emit(nestedIR, {});
|
|
1903
1903
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
1904
1904
|
},
|
|
1905
|
-
// Nested
|
|
1905
|
+
// Nested html templates compose: ${cond ? html`...` : html`...`},
|
|
1906
1906
|
// ${list.map(x => html`<li>${x}</li>`)}. Compile them the same way.
|
|
1907
1907
|
TaggedTemplateExpression(path) {
|
|
1908
1908
|
const tag = path.node.tag;
|
|
1909
1909
|
if (!import_core2.types.isIdentifier(tag) || tag.name !== "html" && tag.name !== "svg") return;
|
|
1910
|
-
const ir =
|
|
1910
|
+
const ir = buildIRFromHtml(path.node, used, { svg: tag.name === "svg", onNested });
|
|
1911
1911
|
onNested?.(ir);
|
|
1912
1912
|
const { code, imports, templates } = imperativeBackend.emit(ir, {});
|
|
1913
1913
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* front-end reuse the exact same backend.
|
|
8
8
|
*
|
|
9
9
|
* JSX can appear nested inside arbitrary expressions (render-props, ternaries,
|
|
10
|
-
* `fallback={<p/>}`, `arr.map(x => <li/>)`, `() => cond && <div/>`,
|
|
10
|
+
* `fallback={<p/>}`, `arr.map(x => <li/>)`, `() => cond && <div/>`, ...). The IR
|
|
11
11
|
* models prop/child *expressions* as code strings, so any JSX inside such an
|
|
12
12
|
* expression is recursively compiled (build-ir -> emit) and spliced back in,
|
|
13
13
|
* with the runtime symbols it uses collected into `used` for import injection.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* front-end reuse the exact same backend.
|
|
8
8
|
*
|
|
9
9
|
* JSX can appear nested inside arbitrary expressions (render-props, ternaries,
|
|
10
|
-
* `fallback={<p/>}`, `arr.map(x => <li/>)`, `() => cond && <div/>`,
|
|
10
|
+
* `fallback={<p/>}`, `arr.map(x => <li/>)`, `() => cond && <div/>`, ...). The IR
|
|
11
11
|
* models prop/child *expressions* as code strings, so any JSX inside such an
|
|
12
12
|
* expression is recursively compiled (build-ir -> emit) and spliced back in,
|
|
13
13
|
* with the runtime symbols it uses collected into `used` for import injection.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* front-end reuse the exact same backend.
|
|
8
8
|
*
|
|
9
9
|
* JSX can appear nested inside arbitrary expressions (render-props, ternaries,
|
|
10
|
-
* `fallback={<p/>}`, `arr.map(x => <li/>)`, `() => cond && <div/>`,
|
|
10
|
+
* `fallback={<p/>}`, `arr.map(x => <li/>)`, `() => cond && <div/>`, ...). The IR
|
|
11
11
|
* models prop/child *expressions* as code strings, so any JSX inside such an
|
|
12
12
|
* expression is recursively compiled (build-ir -> emit) and spliced back in,
|
|
13
13
|
* with the runtime symbols it uses collected into `used` for import injection.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { types as t, traverse, template } from '@babel/core';
|
|
16
16
|
import _generate from '@babel/generator';
|
|
17
17
|
import { imperativeBackend, inlineTemplates } from '../../codegen/backends/imperative.js';
|
|
18
|
-
import {
|
|
18
|
+
import { buildIRFromHtml } from './build-ir-html.js';
|
|
19
19
|
import { buildJsxIR } from '../../lower/jsx.js';
|
|
20
20
|
import { isReactiveShape } from '../../analyze/reactive-expr.js';
|
|
21
21
|
import { shapeOf } from '../../analyze/expr-shape.js';
|
|
@@ -37,7 +37,7 @@ function transformNestedJSX(node, used, onNested) {
|
|
|
37
37
|
const emitInto = (path, code, imports) => {
|
|
38
38
|
for (const s of imports)
|
|
39
39
|
used.add(s);
|
|
40
|
-
// parse as TS: a hole/arrow param may carry a type annotation ((x: T) =>
|
|
40
|
+
// parse as TS: a hole/arrow param may carry a type annotation ((x: T) => ...);
|
|
41
41
|
// preset-typescript strips it downstream, but the reparse must accept it.
|
|
42
42
|
path.replaceWith(template.expression(code, { placeholderPattern: false, plugins: ['typescript'] })());
|
|
43
43
|
path.skip(); // build-ir already handled this subtree (incl. anything nested)
|
|
@@ -53,13 +53,13 @@ function transformNestedJSX(node, used, onNested) {
|
|
|
53
53
|
const { code, imports, templates } = imperativeBackend.emit(nestedIR, {});
|
|
54
54
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
55
55
|
},
|
|
56
|
-
// Nested
|
|
56
|
+
// Nested html templates compose: ${cond ? html`...` : html`...`},
|
|
57
57
|
// ${list.map(x => html`<li>${x}</li>`)}. Compile them the same way.
|
|
58
58
|
TaggedTemplateExpression(path) {
|
|
59
59
|
const tag = path.node.tag;
|
|
60
60
|
if (!t.isIdentifier(tag) || (tag.name !== 'html' && tag.name !== 'svg'))
|
|
61
61
|
return;
|
|
62
|
-
const ir =
|
|
62
|
+
const ir = buildIRFromHtml(path.node, used, { svg: tag.name === 'svg', onNested });
|
|
63
63
|
onNested?.(ir);
|
|
64
64
|
const { code, imports, templates } = imperativeBackend.emit(ir, {});
|
|
65
65
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
@@ -946,7 +946,7 @@ var Lowerer = class {
|
|
|
946
946
|
for (const s of imports) this.used.add(s);
|
|
947
947
|
return inlineTemplates(code, templates);
|
|
948
948
|
}
|
|
949
|
-
//
|
|
949
|
+
// content
|
|
950
950
|
lowerRoot(children) {
|
|
951
951
|
const nodes = this.lowerChildren(children);
|
|
952
952
|
if (nodes.length === 1) return nodes[0];
|
|
@@ -1075,8 +1075,8 @@ var Lowerer = class {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
return { slots, rest };
|
|
1077
1077
|
}
|
|
1078
|
-
//
|
|
1079
|
-
/** `<el if=${cond}
|
|
1078
|
+
// control-flow sugar
|
|
1079
|
+
/** `<el if=${cond}>...</el>` (+ optional `<el else>`) → `<Show when fallback>`. */
|
|
1080
1080
|
lowerIf(el, condHole, elseEl) {
|
|
1081
1081
|
const cond = this.hole(condHole);
|
|
1082
1082
|
const props = [
|
|
@@ -1091,8 +1091,8 @@ var Lowerer = class {
|
|
|
1091
1091
|
return { kind: "component", name: "Show", props, children: [child], ...at ? { at } : {}, ...cond.at ? { bindAt: cond.at } : {} };
|
|
1092
1092
|
}
|
|
1093
1093
|
/**
|
|
1094
|
-
* `<el each=${items} key?>${item =>
|
|
1095
|
-
* content is repeated per item. Content that is not a `${item =>
|
|
1094
|
+
* `<el each=${items} key?>${item => ...}</el>` → `<el><For each>{item => ...}</For></el>`: the
|
|
1095
|
+
* content is repeated per item. Content that is not a `${item => ...}` arrow is repeated as
|
|
1096
1096
|
* it is. Null when the element has no `each`.
|
|
1097
1097
|
*/
|
|
1098
1098
|
lowerEach(el) {
|
|
@@ -1129,7 +1129,7 @@ var Lowerer = class {
|
|
|
1129
1129
|
const clone = { ...el, attributes: el.attributes.filter((a) => !drop(a)) };
|
|
1130
1130
|
return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
|
|
1131
1131
|
}
|
|
1132
|
-
//
|
|
1132
|
+
// attributes
|
|
1133
1133
|
/**
|
|
1134
1134
|
* `element`: a DOM element, where each class:/style: value that moves is its own accessor.
|
|
1135
1135
|
* A component gets the object as before, rebuilt whole when any value moves.
|
|
@@ -1270,7 +1270,7 @@ var Lowerer = class {
|
|
|
1270
1270
|
if (mods.includes("passive")) opts.push("passive: true");
|
|
1271
1271
|
return opts.length ? `{ ${opts.join(", ")} }` : null;
|
|
1272
1272
|
}
|
|
1273
|
-
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e
|
|
1273
|
+
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e...value)}`. */
|
|
1274
1274
|
bindProps(prop, h) {
|
|
1275
1275
|
const sigCode = h.code;
|
|
1276
1276
|
const checked = prop === "checked";
|
|
@@ -1296,7 +1296,7 @@ var Lowerer = class {
|
|
|
1296
1296
|
}
|
|
1297
1297
|
];
|
|
1298
1298
|
}
|
|
1299
|
-
/** A plain attribute (incl.
|
|
1299
|
+
/** A plain attribute (incl. html `?bool`, mixed values), old `mkProp` behavior. */
|
|
1300
1300
|
plainAttr(a) {
|
|
1301
1301
|
const v = a.value;
|
|
1302
1302
|
let name = a.name;
|
|
@@ -1363,7 +1363,7 @@ function bindHole(expr, used, onNested) {
|
|
|
1363
1363
|
if (t.isObjectExpression(expr)) hole.object = true;
|
|
1364
1364
|
return hole;
|
|
1365
1365
|
}
|
|
1366
|
-
function
|
|
1366
|
+
function lowerHtmlTemplate(node, used, opts = {}) {
|
|
1367
1367
|
const quasi = node.quasi;
|
|
1368
1368
|
const holes = quasi.expressions.map((e) => bindHole(e, used, opts.onNested));
|
|
1369
1369
|
return lowerTemplate(buildPieces(quasi), holes, used, opts);
|
|
@@ -1456,9 +1456,9 @@ function childReason(node) {
|
|
|
1456
1456
|
return "expression-child";
|
|
1457
1457
|
}
|
|
1458
1458
|
|
|
1459
|
-
// src/frontend/babel/build-ir-
|
|
1460
|
-
function
|
|
1461
|
-
const ir =
|
|
1459
|
+
// src/frontend/babel/build-ir-html.ts
|
|
1460
|
+
function buildIRFromHtml(node, used = /* @__PURE__ */ new Set(), opts = {}) {
|
|
1461
|
+
const ir = lowerHtmlTemplate(node, used, opts);
|
|
1462
1462
|
analyzeStatic(ir);
|
|
1463
1463
|
return ir;
|
|
1464
1464
|
}
|
|
@@ -1867,12 +1867,12 @@ function transformNestedJSX(node, used, onNested) {
|
|
|
1867
1867
|
const { code, imports, templates } = imperativeBackend.emit(nestedIR, {});
|
|
1868
1868
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
1869
1869
|
},
|
|
1870
|
-
// Nested
|
|
1870
|
+
// Nested html templates compose: ${cond ? html`...` : html`...`},
|
|
1871
1871
|
// ${list.map(x => html`<li>${x}</li>`)}. Compile them the same way.
|
|
1872
1872
|
TaggedTemplateExpression(path) {
|
|
1873
1873
|
const tag = path.node.tag;
|
|
1874
1874
|
if (!t2.isIdentifier(tag) || tag.name !== "html" && tag.name !== "svg") return;
|
|
1875
|
-
const ir =
|
|
1875
|
+
const ir = buildIRFromHtml(path.node, used, { svg: tag.name === "svg", onNested });
|
|
1876
1876
|
onNested?.(ir);
|
|
1877
1877
|
const { code, imports, templates } = imperativeBackend.emit(ir, {});
|
|
1878
1878
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/compiler v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/compiler v1.0.0-alpha.101 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1157,7 +1157,7 @@ var Lowerer = class {
|
|
|
1157
1157
|
for (const s of imports) this.used.add(s);
|
|
1158
1158
|
return inlineTemplates(code, templates);
|
|
1159
1159
|
}
|
|
1160
|
-
//
|
|
1160
|
+
// content
|
|
1161
1161
|
lowerRoot(children) {
|
|
1162
1162
|
const nodes = this.lowerChildren(children);
|
|
1163
1163
|
if (nodes.length === 1) return nodes[0];
|
|
@@ -1286,8 +1286,8 @@ var Lowerer = class {
|
|
|
1286
1286
|
}
|
|
1287
1287
|
return { slots, rest };
|
|
1288
1288
|
}
|
|
1289
|
-
//
|
|
1290
|
-
/** `<el if=${cond}
|
|
1289
|
+
// control-flow sugar
|
|
1290
|
+
/** `<el if=${cond}>...</el>` (+ optional `<el else>`) → `<Show when fallback>`. */
|
|
1291
1291
|
lowerIf(el, condHole, elseEl) {
|
|
1292
1292
|
const cond = this.hole(condHole);
|
|
1293
1293
|
const props = [
|
|
@@ -1302,8 +1302,8 @@ var Lowerer = class {
|
|
|
1302
1302
|
return { kind: "component", name: "Show", props, children: [child], ...at ? { at } : {}, ...cond.at ? { bindAt: cond.at } : {} };
|
|
1303
1303
|
}
|
|
1304
1304
|
/**
|
|
1305
|
-
* `<el each=${items} key?>${item =>
|
|
1306
|
-
* content is repeated per item. Content that is not a `${item =>
|
|
1305
|
+
* `<el each=${items} key?>${item => ...}</el>` → `<el><For each>{item => ...}</For></el>`: the
|
|
1306
|
+
* content is repeated per item. Content that is not a `${item => ...}` arrow is repeated as
|
|
1307
1307
|
* it is. Null when the element has no `each`.
|
|
1308
1308
|
*/
|
|
1309
1309
|
lowerEach(el) {
|
|
@@ -1340,7 +1340,7 @@ var Lowerer = class {
|
|
|
1340
1340
|
const clone = { ...el, attributes: el.attributes.filter((a) => !drop(a)) };
|
|
1341
1341
|
return clone.kind === "Element" ? this.lowerElement(clone) : this.lowerComponent(clone);
|
|
1342
1342
|
}
|
|
1343
|
-
//
|
|
1343
|
+
// attributes
|
|
1344
1344
|
/**
|
|
1345
1345
|
* `element`: a DOM element, where each class:/style: value that moves is its own accessor.
|
|
1346
1346
|
* A component gets the object as before, rebuilt whole when any value moves.
|
|
@@ -1481,7 +1481,7 @@ var Lowerer = class {
|
|
|
1481
1481
|
if (mods.includes("passive")) opts.push("passive: true");
|
|
1482
1482
|
return opts.length ? `{ ${opts.join(", ")} }` : null;
|
|
1483
1483
|
}
|
|
1484
|
-
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e
|
|
1484
|
+
/** `bind:value=${sig}` → `value={read()}` + `onInput={e => write(e...value)}`. */
|
|
1485
1485
|
bindProps(prop, h) {
|
|
1486
1486
|
const sigCode = h.code;
|
|
1487
1487
|
const checked = prop === "checked";
|
|
@@ -1507,7 +1507,7 @@ var Lowerer = class {
|
|
|
1507
1507
|
}
|
|
1508
1508
|
];
|
|
1509
1509
|
}
|
|
1510
|
-
/** A plain attribute (incl.
|
|
1510
|
+
/** A plain attribute (incl. html `?bool`, mixed values), old `mkProp` behavior. */
|
|
1511
1511
|
plainAttr(a) {
|
|
1512
1512
|
const v = a.value;
|
|
1513
1513
|
let name = a.name;
|
|
@@ -1574,7 +1574,7 @@ function bindHole(expr, used, onNested) {
|
|
|
1574
1574
|
if (import_core.types.isObjectExpression(expr)) hole.object = true;
|
|
1575
1575
|
return hole;
|
|
1576
1576
|
}
|
|
1577
|
-
function
|
|
1577
|
+
function lowerHtmlTemplate(node, used, opts = {}) {
|
|
1578
1578
|
const quasi = node.quasi;
|
|
1579
1579
|
const holes = quasi.expressions.map((e) => bindHole(e, used, opts.onNested));
|
|
1580
1580
|
return lowerTemplate(buildPieces(quasi), holes, used, opts);
|
|
@@ -1667,9 +1667,9 @@ function childReason(node) {
|
|
|
1667
1667
|
return "expression-child";
|
|
1668
1668
|
}
|
|
1669
1669
|
|
|
1670
|
-
// src/frontend/babel/build-ir-
|
|
1671
|
-
function
|
|
1672
|
-
const ir =
|
|
1670
|
+
// src/frontend/babel/build-ir-html.ts
|
|
1671
|
+
function buildIRFromHtml(node, used = /* @__PURE__ */ new Set(), opts = {}) {
|
|
1672
|
+
const ir = lowerHtmlTemplate(node, used, opts);
|
|
1673
1673
|
analyzeStatic(ir);
|
|
1674
1674
|
return ir;
|
|
1675
1675
|
}
|
|
@@ -2078,12 +2078,12 @@ function transformNestedJSX(node, used, onNested) {
|
|
|
2078
2078
|
const { code, imports, templates } = imperativeBackend.emit(nestedIR, {});
|
|
2079
2079
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
2080
2080
|
},
|
|
2081
|
-
// Nested
|
|
2081
|
+
// Nested html templates compose: ${cond ? html`...` : html`...`},
|
|
2082
2082
|
// ${list.map(x => html`<li>${x}</li>`)}. Compile them the same way.
|
|
2083
2083
|
TaggedTemplateExpression(path) {
|
|
2084
2084
|
const tag = path.node.tag;
|
|
2085
2085
|
if (!import_core2.types.isIdentifier(tag) || tag.name !== "html" && tag.name !== "svg") return;
|
|
2086
|
-
const ir =
|
|
2086
|
+
const ir = buildIRFromHtml(path.node, used, { svg: tag.name === "svg", onNested });
|
|
2087
2087
|
onNested?.(ir);
|
|
2088
2088
|
const { code, imports, templates } = imperativeBackend.emit(ir, {});
|
|
2089
2089
|
emitInto(path, inlineTemplates(code, templates), imports);
|
|
@@ -2126,11 +2126,11 @@ var plugin_default = (0, import_helper_plugin_utils.declare)((api, options = {})
|
|
|
2126
2126
|
// `fluixi()` needs no `format` option. Injected imports are deduped, so a
|
|
2127
2127
|
// file mixing the two styles won't redeclare a binding.
|
|
2128
2128
|
format = "both",
|
|
2129
|
-
|
|
2129
|
+
htmlTag = "html",
|
|
2130
2130
|
resolve: resolveRules = []
|
|
2131
2131
|
} = options;
|
|
2132
2132
|
const componentResolver = createComponentResolver(resolveRules);
|
|
2133
|
-
const
|
|
2133
|
+
const compileHtml = format === "html" || format === "both";
|
|
2134
2134
|
const pluginState = {
|
|
2135
2135
|
irImports: /* @__PURE__ */ new Set(),
|
|
2136
2136
|
libModule: "@fluixi/core",
|
|
@@ -2139,7 +2139,7 @@ var plugin_default = (0, import_helper_plugin_utils.declare)((api, options = {})
|
|
|
2139
2139
|
templateClone,
|
|
2140
2140
|
partialTemplates,
|
|
2141
2141
|
hasJSX: false,
|
|
2142
|
-
|
|
2142
|
+
hasHtmlTag: false,
|
|
2143
2143
|
needsControlFlowImport: false,
|
|
2144
2144
|
needsCreateMemo: false,
|
|
2145
2145
|
controlFlowComponents: /* @__PURE__ */ new Set(),
|
|
@@ -2163,8 +2163,8 @@ var plugin_default = (0, import_helper_plugin_utils.declare)((api, options = {})
|
|
|
2163
2163
|
enter(path, state) {
|
|
2164
2164
|
Object.assign(state, {
|
|
2165
2165
|
hasJSX: false,
|
|
2166
|
-
|
|
2167
|
-
|
|
2166
|
+
hasHtmlTag: false,
|
|
2167
|
+
hasHtmlIR: false,
|
|
2168
2168
|
needsControlFlowImport: false,
|
|
2169
2169
|
needsCreateMemo: false,
|
|
2170
2170
|
controlFlowComponents: /* @__PURE__ */ new Set(),
|
|
@@ -2189,7 +2189,7 @@ var plugin_default = (0, import_helper_plugin_utils.declare)((api, options = {})
|
|
|
2189
2189
|
},
|
|
2190
2190
|
exit(path, state) {
|
|
2191
2191
|
const imports = [];
|
|
2192
|
-
if (state.hasJSX || state.
|
|
2192
|
+
if (state.hasJSX || state.hasHtmlIR) {
|
|
2193
2193
|
if (state.irImports.size > 0) {
|
|
2194
2194
|
const CF = /* @__PURE__ */ new Set([
|
|
2195
2195
|
"Show",
|
|
@@ -2379,8 +2379,8 @@ var plugin_default = (0, import_helper_plugin_utils.declare)((api, options = {})
|
|
|
2379
2379
|
path.replaceWith(emitViaIR(path.node, state));
|
|
2380
2380
|
},
|
|
2381
2381
|
TaggedTemplateExpression(path, state) {
|
|
2382
|
-
if (
|
|
2383
|
-
path.replaceWith(
|
|
2382
|
+
if (compileHtml && import_core3.types.isIdentifier(path.node.tag) && (path.node.tag.name === htmlTag || path.node.tag.name === "svg")) {
|
|
2383
|
+
path.replaceWith(emitHtmlViaIR(path.node, state));
|
|
2384
2384
|
}
|
|
2385
2385
|
}
|
|
2386
2386
|
}
|
|
@@ -2483,10 +2483,10 @@ function dedupeImports(imports) {
|
|
|
2483
2483
|
}
|
|
2484
2484
|
return out;
|
|
2485
2485
|
}
|
|
2486
|
-
function
|
|
2486
|
+
function emitHtmlViaIR(node, state) {
|
|
2487
2487
|
const used = /* @__PURE__ */ new Set();
|
|
2488
2488
|
const svg = import_core3.types.isIdentifier(node.tag) && node.tag.name === "svg";
|
|
2489
|
-
const ir =
|
|
2489
|
+
const ir = buildIRFromHtml(node, used, { svg, onNested: nestedHook(state) });
|
|
2490
2490
|
resolveComponentSources(ir, {
|
|
2491
2491
|
resolver: state.componentResolver,
|
|
2492
2492
|
modules: {
|
|
@@ -2501,7 +2501,7 @@ function emitLitViaIR(node, state) {
|
|
|
2501
2501
|
for (const s of imports) used.add(s);
|
|
2502
2502
|
for (const s of used) state.irImports.add(s);
|
|
2503
2503
|
collectRuntimeNeeds(ir, state);
|
|
2504
|
-
state.
|
|
2504
|
+
state.hasHtmlIR = true;
|
|
2505
2505
|
const expression = import_core3.template.expression(adoptTemplates(code, templates, state), {
|
|
2506
2506
|
placeholderPattern: false,
|
|
2507
2507
|
plugins: ["typescript"]
|
|
@@ -2577,7 +2577,7 @@ function createPreset(options = {}) {
|
|
|
2577
2577
|
importSource: "@fluixi/jsx",
|
|
2578
2578
|
development: false,
|
|
2579
2579
|
detectReactivity: true,
|
|
2580
|
-
|
|
2580
|
+
useHtmlTag: true,
|
|
2581
2581
|
hoistStatics: true,
|
|
2582
2582
|
delegateEvents: true,
|
|
2583
2583
|
optimizeControlFlow: true,
|
|
@@ -2602,7 +2602,7 @@ var presets = {
|
|
|
2602
2602
|
}),
|
|
2603
2603
|
minimal: createPreset({
|
|
2604
2604
|
detectReactivity: false,
|
|
2605
|
-
|
|
2605
|
+
useHtmlTag: false,
|
|
2606
2606
|
hoistStatics: false,
|
|
2607
2607
|
delegateEvents: false,
|
|
2608
2608
|
optimizeControlFlow: false
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Babel front-end adapter for the Fluixi compiler.
|
|
3
|
-
* @module @fluixi/compiler/babel
|
|
4
|
-
*
|
|
5
|
-
* This is one of the compiler's front-end adapters: it parses with @babel and
|
|
6
|
-
* runs the JSX transform. The transform/codegen it currently performs is the
|
|
7
|
-
* existing behaviour (emits the jsx() automatic runtime), switching codegen to
|
|
8
|
-
* the IR-driven backends (see ../../codegen) is a later step. SWC/other
|
|
9
|
-
* front-ends will plug in alongside this without touching the rest of the pipeline.
|
|
10
|
-
*/
|
|
11
1
|
export { default } from './plugin.cjs';
|
|
12
2
|
export type { PluginOptions } from './plugin.cjs';
|
|
13
3
|
export * from './types.cjs';
|
|
14
4
|
/** Named export for explicit usage */
|
|
15
5
|
export declare const babelPluginReactiveJSX: (api: object, options: import("./plugin.cjs").PluginOptions | null | undefined, dirname: string) => import("@babel/core").PluginObj<import("@babel/core").PluginPass>;
|
|
16
|
-
/** Helper to create plugin with options */
|
|
17
6
|
export declare function createPlugin(options?: any): any[];
|
|
18
7
|
/** Preset with recommended configuration */
|
|
19
8
|
export declare function createPreset(options?: any): {
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Babel front-end adapter for the Fluixi compiler.
|
|
3
|
-
* @module @fluixi/compiler/babel
|
|
4
|
-
*
|
|
5
|
-
* This is one of the compiler's front-end adapters: it parses with @babel and
|
|
6
|
-
* runs the JSX transform. The transform/codegen it currently performs is the
|
|
7
|
-
* existing behaviour (emits the jsx() automatic runtime), switching codegen to
|
|
8
|
-
* the IR-driven backends (see ../../codegen) is a later step. SWC/other
|
|
9
|
-
* front-ends will plug in alongside this without touching the rest of the pipeline.
|
|
10
|
-
*/
|
|
11
1
|
export { default } from './plugin.js';
|
|
12
2
|
export type { PluginOptions } from './plugin.js';
|
|
13
3
|
export * from './types.js';
|
|
14
4
|
/** Named export for explicit usage */
|
|
15
5
|
export declare const babelPluginReactiveJSX: (api: object, options: import("./plugin.js").PluginOptions | null | undefined, dirname: string) => import("@babel/core").PluginObj<import("@babel/core").PluginPass>;
|
|
16
|
-
/** Helper to create plugin with options */
|
|
17
6
|
export declare function createPlugin(options?: any): any[];
|
|
18
7
|
/** Preset with recommended configuration */
|
|
19
8
|
export declare function createPreset(options?: any): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frontend/babel/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frontend/babel/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,cAAc,YAAY,CAAC;AAK3B,sCAAsC;AACtC,eAAO,MAAM,sBAAsB,sKAAS,CAAC;AAE7C,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,GAAG,SAEzC;AAED,4CAA4C;AAC5C,wBAAgB,YAAY,CAAC,OAAO,GAAE,GAAQ;;EAoB7C;AAED,0BAA0B;AAC1B,eAAO,MAAM,OAAO;;;;;;;;;;CAmBnB,CAAC"}
|