@fluixi/compiler 1.0.0-alpha.100
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/LICENSE +21 -0
- package/README.md +131 -0
- package/dist/analyze/expr-shape.cjs +62 -0
- package/dist/analyze/expr-shape.d.cts +14 -0
- package/dist/analyze/expr-shape.d.ts +15 -0
- package/dist/analyze/expr-shape.d.ts.map +1 -0
- package/dist/analyze/expr-shape.js +37 -0
- package/dist/analyze/expr-shape.mjs +41 -0
- package/dist/analyze/intrinsics.cjs +112 -0
- package/dist/analyze/intrinsics.d.cts +80 -0
- package/dist/analyze/intrinsics.d.ts +81 -0
- package/dist/analyze/intrinsics.d.ts.map +1 -0
- package/dist/analyze/intrinsics.js +126 -0
- package/dist/analyze/intrinsics.mjs +91 -0
- 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 -0
- package/dist/analyze/props-destructure.d.cts +83 -0
- package/dist/analyze/props-destructure.d.ts +84 -0
- package/dist/analyze/props-destructure.d.ts.map +1 -0
- package/dist/analyze/props-destructure.js +272 -0
- package/dist/analyze/props-destructure.mjs +205 -0
- package/dist/analyze/reactive-bindings.cjs +210 -0
- package/dist/analyze/reactive-bindings.d.cts +42 -0
- package/dist/analyze/reactive-bindings.d.ts +43 -0
- package/dist/analyze/reactive-bindings.d.ts.map +1 -0
- package/dist/analyze/reactive-bindings.js +191 -0
- package/dist/analyze/reactive-bindings.mjs +187 -0
- package/dist/analyze/reactive-expr.cjs +38 -0
- package/dist/analyze/reactive-expr.d.cts +38 -0
- package/dist/analyze/reactive-expr.d.ts +39 -0
- package/dist/analyze/reactive-expr.d.ts.map +1 -0
- package/dist/analyze/reactive-expr.js +31 -0
- package/dist/analyze/reactive-expr.mjs +17 -0
- package/dist/analyze/static-graph.cjs +831 -0
- package/dist/analyze/static-graph.d.cts +102 -0
- package/dist/analyze/static-graph.d.ts +103 -0
- package/dist/analyze/static-graph.d.ts.map +1 -0
- package/dist/analyze/static-graph.js +871 -0
- package/dist/analyze/static-graph.mjs +813 -0
- package/dist/babel-I6BUWUCU.mjs +636 -0
- package/dist/chunk-3AICWNF7.mjs +92 -0
- package/dist/chunk-6CWJWGE2.mjs +2170 -0
- package/dist/chunk-C3XPDB4Y.mjs +16 -0
- package/dist/chunk-GX5XV6Z7.mjs +190 -0
- package/dist/chunk-HXEXPWJ2.mjs +999 -0
- package/dist/chunk-NU3W67UZ.mjs +584 -0
- package/dist/chunk-SKAVY75W.mjs +11 -0
- package/dist/codegen/backend.cjs +18 -0
- package/dist/codegen/backend.d.cts +35 -0
- package/dist/codegen/backend.d.ts +36 -0
- package/dist/codegen/backend.d.ts.map +1 -0
- package/dist/codegen/backend.js +1 -0
- package/dist/codegen/backend.mjs +0 -0
- package/dist/codegen/backends/imperative.cjs +577 -0
- package/dist/codegen/backends/imperative.d.cts +11 -0
- package/dist/codegen/backends/imperative.d.ts +12 -0
- package/dist/codegen/backends/imperative.d.ts.map +1 -0
- package/dist/codegen/backends/imperative.js +362 -0
- package/dist/codegen/backends/imperative.mjs +554 -0
- package/dist/codegen/contract.cjs +52 -0
- package/dist/codegen/contract.d.cts +24 -0
- package/dist/codegen/contract.d.ts +25 -0
- package/dist/codegen/contract.d.ts.map +1 -0
- package/dist/codegen/contract.js +30 -0
- package/dist/codegen/contract.mjs +31 -0
- package/dist/codegen/partial-template.cjs +176 -0
- package/dist/codegen/partial-template.d.cts +61 -0
- package/dist/codegen/partial-template.d.ts +62 -0
- package/dist/codegen/partial-template.d.ts.map +1 -0
- package/dist/codegen/partial-template.js +0 -0
- package/dist/codegen/partial-template.mjs +153 -0
- package/dist/codegen/serialize-static.cjs +125 -0
- package/dist/codegen/serialize-static.d.cts +38 -0
- package/dist/codegen/serialize-static.d.ts +39 -0
- package/dist/codegen/serialize-static.d.ts.map +1 -0
- package/dist/codegen/serialize-static.js +165 -0
- package/dist/codegen/serialize-static.mjs +104 -0
- package/dist/frontend/babel/build-ir-lit.cjs +1933 -0
- package/dist/frontend/babel/build-ir-lit.d.cts +26 -0
- package/dist/frontend/babel/build-ir-lit.d.ts +27 -0
- package/dist/frontend/babel/build-ir-lit.d.ts.map +1 -0
- package/dist/frontend/babel/build-ir-lit.js +13 -0
- package/dist/frontend/babel/build-ir-lit.mjs +1902 -0
- package/dist/frontend/babel/build-ir.cjs +1948 -0
- package/dist/frontend/babel/build-ir.d.cts +35 -0
- package/dist/frontend/babel/build-ir.d.ts +36 -0
- package/dist/frontend/babel/build-ir.d.ts.map +1 -0
- package/dist/frontend/babel/build-ir.js +124 -0
- package/dist/frontend/babel/build-ir.mjs +1919 -0
- package/dist/frontend/babel/index.cjs +2610 -0
- package/dist/frontend/babel/index.d.cts +33 -0
- package/dist/frontend/babel/index.d.ts +34 -0
- package/dist/frontend/babel/index.d.ts.map +1 -0
- package/dist/frontend/babel/index.js +65 -0
- package/dist/frontend/babel/index.mjs +2580 -0
- package/dist/frontend/babel/lower-template.cjs +1931 -0
- package/dist/frontend/babel/lower-template.d.cts +23 -0
- package/dist/frontend/babel/lower-template.d.ts +24 -0
- package/dist/frontend/babel/lower-template.d.ts.map +1 -0
- package/dist/frontend/babel/lower-template.js +64 -0
- package/dist/frontend/babel/lower-template.mjs +1902 -0
- package/dist/frontend/babel/plugin.cjs +2556 -0
- package/dist/frontend/babel/plugin.d.cts +95 -0
- package/dist/frontend/babel/plugin.d.ts +96 -0
- package/dist/frontend/babel/plugin.d.ts.map +1 -0
- package/dist/frontend/babel/plugin.js +523 -0
- package/dist/frontend/babel/plugin.mjs +2527 -0
- package/dist/frontend/babel/server-functions.cjs +110 -0
- package/dist/frontend/babel/server-functions.d.cts +10 -0
- package/dist/frontend/babel/server-functions.d.ts +11 -0
- package/dist/frontend/babel/server-functions.d.ts.map +1 -0
- package/dist/frontend/babel/server-functions.js +81 -0
- package/dist/frontend/babel/server-functions.mjs +89 -0
- package/dist/frontend/babel/types.cjs +18 -0
- package/dist/frontend/babel/types.d.cts +33 -0
- package/dist/frontend/babel/types.d.ts +34 -0
- package/dist/frontend/babel/types.d.ts.map +1 -0
- package/dist/frontend/babel/types.js +1 -0
- package/dist/frontend/babel/types.mjs +0 -0
- package/dist/frontend/types.cjs +18 -0
- package/dist/frontend/types.d.cts +25 -0
- package/dist/frontend/types.d.ts +26 -0
- package/dist/frontend/types.d.ts.map +1 -0
- package/dist/frontend/types.js +1 -0
- package/dist/frontend/types.mjs +0 -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 +1957 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.mjs +1949 -0
- package/dist/integrations.cjs +5705 -0
- package/dist/integrations.d.cts +215 -0
- package/dist/integrations.d.ts +216 -0
- package/dist/integrations.d.ts.map +1 -0
- package/dist/integrations.js +566 -0
- package/dist/integrations.mjs +810 -0
- package/dist/ir/nodes.cjs +18 -0
- package/dist/ir/nodes.d.cts +168 -0
- package/dist/ir/nodes.d.ts +169 -0
- package/dist/ir/nodes.d.ts.map +1 -0
- package/dist/ir/nodes.js +1 -0
- package/dist/ir/nodes.mjs +0 -0
- package/dist/lower/compile-template.cjs +1670 -0
- package/dist/lower/compile-template.d.cts +82 -0
- package/dist/lower/compile-template.d.ts +83 -0
- package/dist/lower/compile-template.d.ts.map +1 -0
- package/dist/lower/compile-template.js +79 -0
- package/dist/lower/compile-template.mjs +1662 -0
- package/dist/lower/entities.cjs +288 -0
- package/dist/lower/entities.d.cts +1 -0
- package/dist/lower/entities.d.ts +2 -0
- package/dist/lower/entities.d.ts.map +1 -0
- package/dist/lower/entities.js +54 -0
- package/dist/lower/entities.mjs +267 -0
- package/dist/lower/jsx.cjs +1101 -0
- package/dist/lower/jsx.d.cts +33 -0
- package/dist/lower/jsx.d.ts +34 -0
- package/dist/lower/jsx.d.ts.map +1 -0
- package/dist/lower/jsx.js +414 -0
- package/dist/lower/jsx.mjs +1078 -0
- package/dist/lower/template.cjs +1354 -0
- package/dist/lower/template.d.cts +53 -0
- package/dist/lower/template.d.ts +54 -0
- package/dist/lower/template.d.ts.map +1 -0
- package/dist/lower/template.js +542 -0
- package/dist/lower/template.mjs +1335 -0
- package/dist/lower/text.cjs +42 -0
- package/dist/lower/text.d.cts +10 -0
- package/dist/lower/text.d.ts +11 -0
- package/dist/lower/text.d.ts.map +1 -0
- package/dist/lower/text.js +31 -0
- package/dist/lower/text.mjs +21 -0
- package/dist/optimize/analyze-static.cjs +112 -0
- package/dist/optimize/analyze-static.d.cts +39 -0
- package/dist/optimize/analyze-static.d.ts +40 -0
- package/dist/optimize/analyze-static.d.ts.map +1 -0
- package/dist/optimize/analyze-static.js +131 -0
- package/dist/optimize/analyze-static.mjs +91 -0
- package/dist/optimize/collapse-strategies.cjs +90 -0
- package/dist/optimize/collapse-strategies.d.cts +30 -0
- package/dist/optimize/collapse-strategies.d.ts +31 -0
- package/dist/optimize/collapse-strategies.d.ts.map +1 -0
- package/dist/optimize/collapse-strategies.js +33 -0
- package/dist/optimize/collapse-strategies.mjs +67 -0
- package/dist/options.cjs +33 -0
- package/dist/options.d.cts +39 -0
- package/dist/options.d.ts +40 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +8 -0
- package/dist/options.mjs +12 -0
- package/dist/resolve/builtins.cjs +73 -0
- package/dist/resolve/builtins.d.cts +68 -0
- package/dist/resolve/builtins.d.ts +69 -0
- package/dist/resolve/builtins.d.ts.map +1 -0
- package/dist/resolve/builtins.js +64 -0
- package/dist/resolve/builtins.mjs +53 -0
- package/dist/resolve/component-globals.cjs +272 -0
- package/dist/resolve/component-globals.d.cts +88 -0
- package/dist/resolve/component-globals.d.ts +89 -0
- package/dist/resolve/component-globals.d.ts.map +1 -0
- package/dist/resolve/component-globals.js +160 -0
- package/dist/resolve/component-globals.mjs +249 -0
- package/dist/resolve/component-resolver.cjs +80 -0
- package/dist/resolve/component-resolver.d.cts +68 -0
- package/dist/resolve/component-resolver.d.ts +69 -0
- package/dist/resolve/component-resolver.d.ts.map +1 -0
- package/dist/resolve/component-resolver.js +95 -0
- package/dist/resolve/component-resolver.mjs +59 -0
- package/dist/resolve/load-directive.cjs +93 -0
- package/dist/resolve/load-directive.d.cts +53 -0
- package/dist/resolve/load-directive.d.ts +54 -0
- package/dist/resolve/load-directive.d.ts.map +1 -0
- package/dist/resolve/load-directive.js +93 -0
- package/dist/resolve/load-directive.mjs +72 -0
- package/dist/resolve/resolve-ir.cjs +108 -0
- package/dist/resolve/resolve-ir.d.cts +53 -0
- package/dist/resolve/resolve-ir.d.ts +54 -0
- package/dist/resolve/resolve-ir.d.ts.map +1 -0
- package/dist/resolve/resolve-ir.js +58 -0
- package/dist/resolve/resolve-ir.mjs +85 -0
- package/dist/resolve/write-globals.cjs +383 -0
- package/dist/resolve/write-globals.d.cts +36 -0
- package/dist/resolve/write-globals.d.ts +37 -0
- package/dist/resolve/write-globals.d.ts.map +1 -0
- package/dist/resolve/write-globals.js +169 -0
- package/dist/resolve/write-globals.mjs +362 -0
- package/dist/server-fns-VZLHMQTC.mjs +79 -0
- package/dist/server-functions-UAZKOLZW.mjs +82 -0
- package/dist/transform/bindings.cjs +71 -0
- package/dist/transform/bindings.d.cts +16 -0
- package/dist/transform/bindings.d.ts +17 -0
- package/dist/transform/bindings.d.ts.map +1 -0
- package/dist/transform/bindings.js +69 -0
- package/dist/transform/bindings.mjs +50 -0
- package/dist/transform/index.cjs +3837 -0
- package/dist/transform/index.d.cts +15 -0
- package/dist/transform/index.d.ts +16 -0
- package/dist/transform/index.d.ts.map +1 -0
- package/dist/transform/index.js +12 -0
- package/dist/transform/index.mjs +4882 -0
- package/dist/transform/intrinsics.cjs +261 -0
- package/dist/transform/intrinsics.d.cts +33 -0
- package/dist/transform/intrinsics.d.ts +34 -0
- package/dist/transform/intrinsics.d.ts.map +1 -0
- package/dist/transform/intrinsics.js +120 -0
- package/dist/transform/intrinsics.mjs +238 -0
- package/dist/transform/props.cjs +441 -0
- package/dist/transform/props.d.cts +45 -0
- package/dist/transform/props.d.ts +46 -0
- package/dist/transform/props.d.ts.map +1 -0
- package/dist/transform/props.js +221 -0
- package/dist/transform/props.mjs +1487 -0
- package/dist/transform/server-fn-id.cjs +35 -0
- package/dist/transform/server-fn-id.d.cts +9 -0
- package/dist/transform/server-fn-id.d.ts +10 -0
- package/dist/transform/server-fn-id.d.ts.map +1 -0
- package/dist/transform/server-fn-id.js +18 -0
- package/dist/transform/server-fn-id.mjs +14 -0
- package/dist/transform/server-fns.cjs +114 -0
- package/dist/transform/server-fns.d.cts +12 -0
- package/dist/transform/server-fns.d.ts +13 -0
- package/dist/transform/server-fns.d.ts.map +1 -0
- package/dist/transform/server-fns.js +94 -0
- package/dist/transform/server-fns.mjs +1160 -0
- package/dist/transform/source-locations.cjs +393 -0
- package/dist/transform/source-locations.d.cts +48 -0
- package/dist/transform/source-locations.d.ts +49 -0
- package/dist/transform/source-locations.d.ts.map +1 -0
- package/dist/transform/source-locations.js +303 -0
- package/dist/transform/source-locations.mjs +370 -0
- package/dist/transform/styles.cjs +606 -0
- package/dist/transform/styles.d.cts +237 -0
- package/dist/transform/styles.d.ts +238 -0
- package/dist/transform/styles.d.ts.map +1 -0
- package/dist/transform/styles.js +743 -0
- package/dist/transform/styles.mjs +671 -0
- package/dist/transform/templates.cjs +3806 -0
- package/dist/transform/templates.d.cts +82 -0
- package/dist/transform/templates.d.ts +83 -0
- package/dist/transform/templates.d.ts.map +1 -0
- package/dist/transform/templates.js +613 -0
- package/dist/transform/templates.mjs +4852 -0
- package/dist/transform-3W45L3EA.mjs +951 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/dist/vite-styles.cjs +223 -0
- package/dist/vite-styles.d.cts +68 -0
- package/dist/vite-styles.d.ts +69 -0
- package/dist/vite-styles.d.ts.map +1 -0
- package/dist/vite-styles.js +241 -0
- package/dist/vite-styles.mjs +214 -0
- package/package.json +141 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component styles in a Vite build: the orchestration around the compiler's style pass.
|
|
3
|
+
*
|
|
4
|
+
* The CSS engine is reached through another plugin's `api.fluixiCss` (@fluixi-css/vite), which
|
|
5
|
+
* owns the project's shared context; the compiler owns ownership and scoping; this file only
|
|
6
|
+
* connects them. Each compiled block becomes a CSS module the component imports, so Vite's own
|
|
7
|
+
* CSS pipeline does the rest: extraction, chunking, dev style tags, hot updates, and the
|
|
8
|
+
* stylesheets @fluixi/start puts in server-rendered pages.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
11
|
+
import { basename, dirname, extname, join, relative } from 'node:path';
|
|
12
|
+
import { styleIds } from './transform/styles.js';
|
|
13
|
+
// A page stylesheet, or (`?inline`, Vite's own flag) a shadow root's CSS as a string; and a
|
|
14
|
+
// css`` value's CSS for a shadow class's `static styles`. The owner is what comes before.
|
|
15
|
+
const STYLE_ID = /\.fx-(\d+)\.css(?:\?inline)?$/;
|
|
16
|
+
const LITERAL_ID = /\.fx-literal-([\w$]+)\.css\?inline$/;
|
|
17
|
+
const SUFFIX = /\.fx-(?:\d+|literal-[\w$]+)\.css(?:\?inline)?$/;
|
|
18
|
+
/** The id a component's n-th style block is served under: a CSS request Vite treats as such. */
|
|
19
|
+
export const styleId = styleIds.block;
|
|
20
|
+
/** The source name the first positioned node carries: the module a value was written in. */
|
|
21
|
+
function firstLoc(nodes) {
|
|
22
|
+
for (const node of nodes) {
|
|
23
|
+
if (node.loc)
|
|
24
|
+
return node.loc.source;
|
|
25
|
+
if ((node.kind === 'rule' || node.kind === 'at-rule') && node.nodes.length) {
|
|
26
|
+
const inner = firstLoc(node.nodes);
|
|
27
|
+
if (inner)
|
|
28
|
+
return inner;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
/** The component a style id belongs to, as written in the id. */
|
|
34
|
+
const ownerOf = (id) => id.slice(0, id.search(SUFFIX));
|
|
35
|
+
// The same loader @fluixi-ui/tokens ships beside each slice: one <link>, added once.
|
|
36
|
+
const loader = (name) => `const href = new URL(${JSON.stringify(`./${name}`)}, import.meta.url).href;
|
|
37
|
+
if (typeof document !== 'undefined' && !document.querySelector(\`link[data-fx-css="\${href}"]\`)) {
|
|
38
|
+
const link = document.createElement('link');
|
|
39
|
+
link.rel = 'stylesheet';
|
|
40
|
+
link.href = href;
|
|
41
|
+
link.dataset.fxCss = href;
|
|
42
|
+
document.head.appendChild(link);
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
export function createComponentStyles(compile) {
|
|
46
|
+
let api;
|
|
47
|
+
let server;
|
|
48
|
+
let root = process.cwd();
|
|
49
|
+
// A library build (`build.lib`): the directory its entry is in, which its output mirrors.
|
|
50
|
+
let library;
|
|
51
|
+
// What a library build writes: the file under the output directory, and its CSS.
|
|
52
|
+
const emitted = new Map();
|
|
53
|
+
// A module id is a file path, or, for modules a plugin imports by URL (`/src/routes/…`),
|
|
54
|
+
// a path from the project root.
|
|
55
|
+
const fileOf = (id) => (existsSync(id) ? id : join(root, id));
|
|
56
|
+
// The CSS of each module's blocks, with the source it came from, for `load` and for telling
|
|
57
|
+
// what changed.
|
|
58
|
+
const cache = new Map();
|
|
59
|
+
const resolveReference = async (ref, importer, ctx, seen, modules) => {
|
|
60
|
+
const resolved = await ctx.resolve?.(ref.source, importer);
|
|
61
|
+
if (!resolved)
|
|
62
|
+
return null;
|
|
63
|
+
const file = resolved.id.split('?')[0];
|
|
64
|
+
if (seen.has(file))
|
|
65
|
+
return null;
|
|
66
|
+
let code;
|
|
67
|
+
try {
|
|
68
|
+
code = readFileSync(fileOf(file), 'utf8');
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const styles = api.styles(file);
|
|
74
|
+
let result = compile(code, file, styles);
|
|
75
|
+
// A value that composes values from further away: those first.
|
|
76
|
+
if (result?.styleReferences?.length) {
|
|
77
|
+
const imported = await resolveAll(result.styleReferences, file, ctx, new Set([...seen, file]), modules);
|
|
78
|
+
result = compile(code, file, { ...styles, imported, importedModules: modules });
|
|
79
|
+
}
|
|
80
|
+
const literal = result?.styleLiterals?.find((l) => l.name === ref.name);
|
|
81
|
+
if (!literal)
|
|
82
|
+
return null;
|
|
83
|
+
// Its rules as written, positions in its own module, which the composing block's map names.
|
|
84
|
+
const nodes = literal.nodes ?? styles.process(literal.css, file);
|
|
85
|
+
const named = firstLoc(nodes);
|
|
86
|
+
if (named)
|
|
87
|
+
modules.set(named, { id: file, code });
|
|
88
|
+
return nodes;
|
|
89
|
+
};
|
|
90
|
+
const resolveAll = async (refs, importer, ctx, seen, modules) => {
|
|
91
|
+
const imported = new Map();
|
|
92
|
+
for (const ref of refs) {
|
|
93
|
+
const nodes = await resolveReference(ref, importer, ctx, seen, modules);
|
|
94
|
+
if (nodes)
|
|
95
|
+
imported.set(`${ref.source}#${ref.name}`, nodes);
|
|
96
|
+
}
|
|
97
|
+
return imported;
|
|
98
|
+
};
|
|
99
|
+
const run = async (code, id, ctx) => {
|
|
100
|
+
// One name per file, whatever id it was reached by (`/src/…` from a plugin, an absolute
|
|
101
|
+
// path from `load`): the scope id is derived from it, and the elements and the CSS have to
|
|
102
|
+
// agree on it.
|
|
103
|
+
const file = fileOf(id);
|
|
104
|
+
const styles = api.styles(file);
|
|
105
|
+
let result = compile(code, file, styles);
|
|
106
|
+
if (result?.styleReferences?.length) {
|
|
107
|
+
const modules = new Map();
|
|
108
|
+
const imported = await resolveAll(result.styleReferences, id, ctx, new Set([file]), modules);
|
|
109
|
+
result = compile(code, file, { ...styles, imported, importedModules: modules });
|
|
110
|
+
}
|
|
111
|
+
const css = (result?.styles ?? []).map((s) => s.css);
|
|
112
|
+
const maps = (result?.styles ?? []).map((s) => s.map ?? null);
|
|
113
|
+
const literals = new Map((result?.styleLiterals ?? []).map((l) => [l.name, l.css]));
|
|
114
|
+
const before = cache.get(file);
|
|
115
|
+
cache.set(file, { source: code, css, maps, literals });
|
|
116
|
+
// A block whose CSS changed (its own edit, or a value it composes from another module) is
|
|
117
|
+
// reloaded: its module id did not change, so nothing else would tell Vite.
|
|
118
|
+
if (server && before) {
|
|
119
|
+
for (let i = 0; i < css.length; i++) {
|
|
120
|
+
if (before.css[i] === css[i])
|
|
121
|
+
continue;
|
|
122
|
+
const mod = server.moduleGraph.getModuleById(styleId(file, i));
|
|
123
|
+
if (mod)
|
|
124
|
+
void server.reloadModule(mod);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Page stylesheets are imported for their effect; a shadow element's blocks already reach
|
|
128
|
+
// its class through the `?inline` imports the compiler wrote.
|
|
129
|
+
const page = (result?.styles ?? []).flatMap((s, i) => (s.shadow ? [] : [i]));
|
|
130
|
+
if (!result || page.length === 0)
|
|
131
|
+
return result;
|
|
132
|
+
if (library) {
|
|
133
|
+
// A package ships a module's CSS as one file next to it, its blocks in source order,
|
|
134
|
+
// imported relatively: any bundler that takes a `.css` import takes it, and nothing in
|
|
135
|
+
// it needs this plugin. The `.css.js` beside it is for a page with no bundler: an import
|
|
136
|
+
// map points the stylesheet's url at it, and it adds the sheet as a <link>.
|
|
137
|
+
const name = `${basename(file, extname(file))}.css`;
|
|
138
|
+
if (existsSync(join(dirname(file), name))) {
|
|
139
|
+
throw new Error(`[fluixi] ${file} has <style> blocks, and ${name} next to it would be overwritten by their CSS. Rename one of them.`);
|
|
140
|
+
}
|
|
141
|
+
const out = join(relative(library, dirname(file)), name);
|
|
142
|
+
emitted.set(out, page.map((i) => css[i]).join('\n'));
|
|
143
|
+
emitted.set(`${out}.js`, loader(name));
|
|
144
|
+
return { ...result, code: `${result.code}\nimport ${JSON.stringify(`./${name}`)};` };
|
|
145
|
+
}
|
|
146
|
+
const imports = page.map((i) => `\nimport ${JSON.stringify(styleId(file, i))};`).join('');
|
|
147
|
+
return { ...result, code: result.code + imports };
|
|
148
|
+
};
|
|
149
|
+
return {
|
|
150
|
+
/** Looks for @fluixi-css/vite among the plugins; without it component styles stay off. */
|
|
151
|
+
connect(plugins, projectRoot) {
|
|
152
|
+
if (projectRoot)
|
|
153
|
+
root = projectRoot;
|
|
154
|
+
api = (plugins ?? [])
|
|
155
|
+
.map((p) => p?.api?.fluixiCss)
|
|
156
|
+
.find((a) => Boolean(a));
|
|
157
|
+
api?.useComponentStyles();
|
|
158
|
+
},
|
|
159
|
+
/** Turns on library output, from the directory of a `build.lib` entry. */
|
|
160
|
+
setLibrary(entryDir) {
|
|
161
|
+
library = entryDir;
|
|
162
|
+
},
|
|
163
|
+
/** A library build's style import: left for the package's consumer to bundle. */
|
|
164
|
+
isLibraryImport(id, importer) {
|
|
165
|
+
if (library === undefined || !importer || !id.startsWith('./') || !id.endsWith('.css'))
|
|
166
|
+
return false;
|
|
167
|
+
return emitted.has(join(relative(library, dirname(fileOf(importer))), id));
|
|
168
|
+
},
|
|
169
|
+
/** The style files a library build writes, by path under the output directory. */
|
|
170
|
+
libraryFiles() {
|
|
171
|
+
return emitted;
|
|
172
|
+
},
|
|
173
|
+
get active() {
|
|
174
|
+
return api !== undefined;
|
|
175
|
+
},
|
|
176
|
+
setServer(dev) {
|
|
177
|
+
server = dev;
|
|
178
|
+
},
|
|
179
|
+
isStyle(id) {
|
|
180
|
+
return STYLE_ID.test(id) || LITERAL_ID.test(id);
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* A style request as the module id Vite keeps: its owner's absolute path, then the suffix.
|
|
184
|
+
* One id per block however it was asked for (`/src/card.tsx.fx-0.css` from a page, the
|
|
185
|
+
* absolute path from the component), or the reload after an edit misses the copy in use.
|
|
186
|
+
* A css`` value imported from another module names that module relatively, as written.
|
|
187
|
+
*/
|
|
188
|
+
async resolveId(id, importer, ctx) {
|
|
189
|
+
const at = id.search(SUFFIX);
|
|
190
|
+
const owner = id.slice(0, at);
|
|
191
|
+
if (!owner.startsWith('.'))
|
|
192
|
+
return fileOf(owner) + id.slice(at);
|
|
193
|
+
const resolved = importer ? await ctx.resolve?.(owner, importer) : null;
|
|
194
|
+
return resolved ? resolved.id.split('?')[0] + id.slice(at) : null;
|
|
195
|
+
},
|
|
196
|
+
/**
|
|
197
|
+
* The style modules of a changed file, for the update Vite sends. Their ids do not name the
|
|
198
|
+
* file (they end in `.css`), so Vite would not find them itself.
|
|
199
|
+
*/
|
|
200
|
+
hotModules(file, graph) {
|
|
201
|
+
const entry = cache.get(file);
|
|
202
|
+
if (!entry)
|
|
203
|
+
return [];
|
|
204
|
+
const paths = [
|
|
205
|
+
...entry.css.map((_, i) => styleId(file, i)),
|
|
206
|
+
...[...entry.literals.keys()].map((name) => styleIds.literal(file, name).replace(/\?inline$/, '')),
|
|
207
|
+
];
|
|
208
|
+
return paths.flatMap((path) => [...(graph.getModulesByFile(path) ?? [])]);
|
|
209
|
+
},
|
|
210
|
+
compile: run,
|
|
211
|
+
/**
|
|
212
|
+
* A block's CSS and its map back to the module, compiling the module again when the cache
|
|
213
|
+
* does not match the file.
|
|
214
|
+
*/
|
|
215
|
+
async load(id, ctx) {
|
|
216
|
+
const match = STYLE_ID.exec(id);
|
|
217
|
+
const literal = LITERAL_ID.exec(id);
|
|
218
|
+
if ((!match && !literal) || !api)
|
|
219
|
+
return null;
|
|
220
|
+
const file = ownerOf(id);
|
|
221
|
+
let source;
|
|
222
|
+
try {
|
|
223
|
+
source = readFileSync(fileOf(file), 'utf8');
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
if (cache.get(fileOf(file))?.source !== source)
|
|
229
|
+
await run(source, file, ctx);
|
|
230
|
+
const entry = cache.get(fileOf(file));
|
|
231
|
+
if (literal) {
|
|
232
|
+
const css = entry?.literals.get(literal[1]);
|
|
233
|
+
if (css === undefined)
|
|
234
|
+
throw new Error(`[fluixi] ${literal[1]} in ${file} is not a css\`\` value, so it cannot be a shadow root's styles.`);
|
|
235
|
+
return { code: css, map: null, moduleType: 'css' };
|
|
236
|
+
}
|
|
237
|
+
const index = Number(match[1]);
|
|
238
|
+
return { code: entry?.css[index] ?? '', map: entry?.maps[index] ?? null, moduleType: 'css' };
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// src/vite-styles.ts
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, extname, join, relative } from "node:path";
|
|
4
|
+
|
|
5
|
+
// ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
6
|
+
var comma = ",".charCodeAt(0);
|
|
7
|
+
var semicolon = ";".charCodeAt(0);
|
|
8
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
9
|
+
var intToChar = new Uint8Array(64);
|
|
10
|
+
var charToInt = new Uint8Array(128);
|
|
11
|
+
for (let i = 0; i < chars.length; i++) {
|
|
12
|
+
const c = chars.charCodeAt(i);
|
|
13
|
+
intToChar[i] = c;
|
|
14
|
+
charToInt[c] = i;
|
|
15
|
+
}
|
|
16
|
+
var bufLength = 1024 * 16;
|
|
17
|
+
|
|
18
|
+
// src/transform/styles.ts
|
|
19
|
+
var styleIds = {
|
|
20
|
+
block: (owner, index) => `${owner}.fx-${index}.css`,
|
|
21
|
+
inline: (owner, index) => `${owner}.fx-${index}.css?inline`,
|
|
22
|
+
literal: (owner, name) => `${owner}.fx-literal-${name}.css?inline`
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/vite-styles.ts
|
|
26
|
+
var STYLE_ID = /\.fx-(\d+)\.css(?:\?inline)?$/;
|
|
27
|
+
var LITERAL_ID = /\.fx-literal-([\w$]+)\.css\?inline$/;
|
|
28
|
+
var SUFFIX = /\.fx-(?:\d+|literal-[\w$]+)\.css(?:\?inline)?$/;
|
|
29
|
+
var styleId = styleIds.block;
|
|
30
|
+
function firstLoc(nodes) {
|
|
31
|
+
for (const node of nodes) {
|
|
32
|
+
if (node.loc) return node.loc.source;
|
|
33
|
+
if ((node.kind === "rule" || node.kind === "at-rule") && node.nodes.length) {
|
|
34
|
+
const inner = firstLoc(node.nodes);
|
|
35
|
+
if (inner) return inner;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
var ownerOf = (id) => id.slice(0, id.search(SUFFIX));
|
|
41
|
+
var loader = (name) => `const href = new URL(${JSON.stringify(`./${name}`)}, import.meta.url).href;
|
|
42
|
+
if (typeof document !== 'undefined' && !document.querySelector(\`link[data-fx-css="\${href}"]\`)) {
|
|
43
|
+
const link = document.createElement('link');
|
|
44
|
+
link.rel = 'stylesheet';
|
|
45
|
+
link.href = href;
|
|
46
|
+
link.dataset.fxCss = href;
|
|
47
|
+
document.head.appendChild(link);
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
function createComponentStyles(compile) {
|
|
51
|
+
let api;
|
|
52
|
+
let server;
|
|
53
|
+
let root = process.cwd();
|
|
54
|
+
let library;
|
|
55
|
+
const emitted = /* @__PURE__ */ new Map();
|
|
56
|
+
const fileOf = (id) => existsSync(id) ? id : join(root, id);
|
|
57
|
+
const cache = /* @__PURE__ */ new Map();
|
|
58
|
+
const resolveReference = async (ref, importer, ctx, seen, modules) => {
|
|
59
|
+
const resolved = await ctx.resolve?.(ref.source, importer);
|
|
60
|
+
if (!resolved) return null;
|
|
61
|
+
const file = resolved.id.split("?")[0];
|
|
62
|
+
if (seen.has(file)) return null;
|
|
63
|
+
let code;
|
|
64
|
+
try {
|
|
65
|
+
code = readFileSync(fileOf(file), "utf8");
|
|
66
|
+
} catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const styles = api.styles(file);
|
|
70
|
+
let result = compile(code, file, styles);
|
|
71
|
+
if (result?.styleReferences?.length) {
|
|
72
|
+
const imported = await resolveAll(result.styleReferences, file, ctx, /* @__PURE__ */ new Set([...seen, file]), modules);
|
|
73
|
+
result = compile(code, file, { ...styles, imported, importedModules: modules });
|
|
74
|
+
}
|
|
75
|
+
const literal = result?.styleLiterals?.find((l) => l.name === ref.name);
|
|
76
|
+
if (!literal) return null;
|
|
77
|
+
const nodes = literal.nodes ?? styles.process(literal.css, file);
|
|
78
|
+
const named = firstLoc(nodes);
|
|
79
|
+
if (named) modules.set(named, { id: file, code });
|
|
80
|
+
return nodes;
|
|
81
|
+
};
|
|
82
|
+
const resolveAll = async (refs, importer, ctx, seen, modules) => {
|
|
83
|
+
const imported = /* @__PURE__ */ new Map();
|
|
84
|
+
for (const ref of refs) {
|
|
85
|
+
const nodes = await resolveReference(ref, importer, ctx, seen, modules);
|
|
86
|
+
if (nodes) imported.set(`${ref.source}#${ref.name}`, nodes);
|
|
87
|
+
}
|
|
88
|
+
return imported;
|
|
89
|
+
};
|
|
90
|
+
const run = async (code, id, ctx) => {
|
|
91
|
+
const file = fileOf(id);
|
|
92
|
+
const styles = api.styles(file);
|
|
93
|
+
let result = compile(code, file, styles);
|
|
94
|
+
if (result?.styleReferences?.length) {
|
|
95
|
+
const modules = /* @__PURE__ */ new Map();
|
|
96
|
+
const imported = await resolveAll(result.styleReferences, id, ctx, /* @__PURE__ */ new Set([file]), modules);
|
|
97
|
+
result = compile(code, file, { ...styles, imported, importedModules: modules });
|
|
98
|
+
}
|
|
99
|
+
const css = (result?.styles ?? []).map((s) => s.css);
|
|
100
|
+
const maps = (result?.styles ?? []).map((s) => s.map ?? null);
|
|
101
|
+
const literals = new Map((result?.styleLiterals ?? []).map((l) => [l.name, l.css]));
|
|
102
|
+
const before = cache.get(file);
|
|
103
|
+
cache.set(file, { source: code, css, maps, literals });
|
|
104
|
+
if (server && before) {
|
|
105
|
+
for (let i = 0; i < css.length; i++) {
|
|
106
|
+
if (before.css[i] === css[i]) continue;
|
|
107
|
+
const mod = server.moduleGraph.getModuleById(styleId(file, i));
|
|
108
|
+
if (mod) void server.reloadModule(mod);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const page = (result?.styles ?? []).flatMap((s, i) => s.shadow ? [] : [i]);
|
|
112
|
+
if (!result || page.length === 0) return result;
|
|
113
|
+
if (library) {
|
|
114
|
+
const name = `${basename(file, extname(file))}.css`;
|
|
115
|
+
if (existsSync(join(dirname(file), name))) {
|
|
116
|
+
throw new Error(`[fluixi] ${file} has <style> blocks, and ${name} next to it would be overwritten by their CSS. Rename one of them.`);
|
|
117
|
+
}
|
|
118
|
+
const out = join(relative(library, dirname(file)), name);
|
|
119
|
+
emitted.set(out, page.map((i) => css[i]).join("\n"));
|
|
120
|
+
emitted.set(`${out}.js`, loader(name));
|
|
121
|
+
return { ...result, code: `${result.code}
|
|
122
|
+
import ${JSON.stringify(`./${name}`)};` };
|
|
123
|
+
}
|
|
124
|
+
const imports = page.map((i) => `
|
|
125
|
+
import ${JSON.stringify(styleId(file, i))};`).join("");
|
|
126
|
+
return { ...result, code: result.code + imports };
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
/** Looks for @fluixi-css/vite among the plugins; without it component styles stay off. */
|
|
130
|
+
connect(plugins, projectRoot) {
|
|
131
|
+
if (projectRoot) root = projectRoot;
|
|
132
|
+
api = (plugins ?? []).map((p) => p?.api?.fluixiCss).find((a) => Boolean(a));
|
|
133
|
+
api?.useComponentStyles();
|
|
134
|
+
},
|
|
135
|
+
/** Turns on library output, from the directory of a `build.lib` entry. */
|
|
136
|
+
setLibrary(entryDir) {
|
|
137
|
+
library = entryDir;
|
|
138
|
+
},
|
|
139
|
+
/** A library build's style import: left for the package's consumer to bundle. */
|
|
140
|
+
isLibraryImport(id, importer) {
|
|
141
|
+
if (library === void 0 || !importer || !id.startsWith("./") || !id.endsWith(".css")) return false;
|
|
142
|
+
return emitted.has(join(relative(library, dirname(fileOf(importer))), id));
|
|
143
|
+
},
|
|
144
|
+
/** The style files a library build writes, by path under the output directory. */
|
|
145
|
+
libraryFiles() {
|
|
146
|
+
return emitted;
|
|
147
|
+
},
|
|
148
|
+
get active() {
|
|
149
|
+
return api !== void 0;
|
|
150
|
+
},
|
|
151
|
+
setServer(dev) {
|
|
152
|
+
server = dev;
|
|
153
|
+
},
|
|
154
|
+
isStyle(id) {
|
|
155
|
+
return STYLE_ID.test(id) || LITERAL_ID.test(id);
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* A style request as the module id Vite keeps: its owner's absolute path, then the suffix.
|
|
159
|
+
* One id per block however it was asked for (`/src/card.tsx.fx-0.css` from a page, the
|
|
160
|
+
* absolute path from the component), or the reload after an edit misses the copy in use.
|
|
161
|
+
* A css`` value imported from another module names that module relatively, as written.
|
|
162
|
+
*/
|
|
163
|
+
async resolveId(id, importer, ctx) {
|
|
164
|
+
const at = id.search(SUFFIX);
|
|
165
|
+
const owner = id.slice(0, at);
|
|
166
|
+
if (!owner.startsWith(".")) return fileOf(owner) + id.slice(at);
|
|
167
|
+
const resolved = importer ? await ctx.resolve?.(owner, importer) : null;
|
|
168
|
+
return resolved ? resolved.id.split("?")[0] + id.slice(at) : null;
|
|
169
|
+
},
|
|
170
|
+
/**
|
|
171
|
+
* The style modules of a changed file, for the update Vite sends. Their ids do not name the
|
|
172
|
+
* file (they end in `.css`), so Vite would not find them itself.
|
|
173
|
+
*/
|
|
174
|
+
hotModules(file, graph) {
|
|
175
|
+
const entry = cache.get(file);
|
|
176
|
+
if (!entry) return [];
|
|
177
|
+
const paths = [
|
|
178
|
+
...entry.css.map((_, i) => styleId(file, i)),
|
|
179
|
+
...[...entry.literals.keys()].map((name) => styleIds.literal(file, name).replace(/\?inline$/, ""))
|
|
180
|
+
];
|
|
181
|
+
return paths.flatMap((path) => [...graph.getModulesByFile(path) ?? []]);
|
|
182
|
+
},
|
|
183
|
+
compile: run,
|
|
184
|
+
/**
|
|
185
|
+
* A block's CSS and its map back to the module, compiling the module again when the cache
|
|
186
|
+
* does not match the file.
|
|
187
|
+
*/
|
|
188
|
+
async load(id, ctx) {
|
|
189
|
+
const match = STYLE_ID.exec(id);
|
|
190
|
+
const literal = LITERAL_ID.exec(id);
|
|
191
|
+
if (!match && !literal || !api) return null;
|
|
192
|
+
const file = ownerOf(id);
|
|
193
|
+
let source;
|
|
194
|
+
try {
|
|
195
|
+
source = readFileSync(fileOf(file), "utf8");
|
|
196
|
+
} catch {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
if (cache.get(fileOf(file))?.source !== source) await run(source, file, ctx);
|
|
200
|
+
const entry = cache.get(fileOf(file));
|
|
201
|
+
if (literal) {
|
|
202
|
+
const css = entry?.literals.get(literal[1]);
|
|
203
|
+
if (css === void 0) throw new Error(`[fluixi] ${literal[1]} in ${file} is not a css\`\` value, so it cannot be a shadow root's styles.`);
|
|
204
|
+
return { code: css, map: null, moduleType: "css" };
|
|
205
|
+
}
|
|
206
|
+
const index = Number(match[1]);
|
|
207
|
+
return { code: entry?.css[index] ?? "", map: entry?.maps[index] ?? null, moduleType: "css" };
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
export {
|
|
212
|
+
createComponentStyles,
|
|
213
|
+
styleId
|
|
214
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fluixi/compiler",
|
|
3
|
+
"version": "1.0.0-alpha.100",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": "Ibrahima Touré",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/fluixi/core.git",
|
|
9
|
+
"directory": "packages/compiler"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"registry": "https://registry.npmjs.org/",
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"description": "compiles JSX and html`` templates to direct DOM calls via shared IR; Babel is used as parser only",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.mjs",
|
|
30
|
+
"require": "./dist/index.cjs",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./compile": {
|
|
34
|
+
"types": "./dist/lower/compile-template.d.ts",
|
|
35
|
+
"import": "./dist/lower/compile-template.mjs",
|
|
36
|
+
"require": "./dist/lower/compile-template.cjs",
|
|
37
|
+
"default": "./dist/lower/compile-template.js"
|
|
38
|
+
},
|
|
39
|
+
"./babel": {
|
|
40
|
+
"types": "./dist/frontend/babel/index.d.ts",
|
|
41
|
+
"import": "./dist/frontend/babel/index.mjs",
|
|
42
|
+
"require": "./dist/frontend/babel/index.cjs",
|
|
43
|
+
"default": "./dist/frontend/babel/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./integrations": {
|
|
46
|
+
"types": "./dist/integrations.d.ts",
|
|
47
|
+
"import": "./dist/integrations.mjs",
|
|
48
|
+
"require": "./dist/integrations.cjs",
|
|
49
|
+
"default": "./dist/integrations.js"
|
|
50
|
+
},
|
|
51
|
+
"./builtins": {
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./dist/resolve/builtins.d.ts",
|
|
54
|
+
"default": "./dist/resolve/builtins.mjs"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./dist/resolve/builtins.d.cts",
|
|
58
|
+
"default": "./dist/resolve/builtins.cjs"
|
|
59
|
+
},
|
|
60
|
+
"default": "./dist/resolve/builtins.js"
|
|
61
|
+
},
|
|
62
|
+
"./transform": {
|
|
63
|
+
"import": {
|
|
64
|
+
"types": "./dist/transform/index.d.ts",
|
|
65
|
+
"default": "./dist/transform/index.mjs"
|
|
66
|
+
},
|
|
67
|
+
"require": {
|
|
68
|
+
"types": "./dist/transform/index.d.cts",
|
|
69
|
+
"default": "./dist/transform/index.cjs"
|
|
70
|
+
},
|
|
71
|
+
"default": "./dist/transform/index.js"
|
|
72
|
+
},
|
|
73
|
+
"./analyze": {
|
|
74
|
+
"import": {
|
|
75
|
+
"types": "./dist/analyze/static-graph.d.ts",
|
|
76
|
+
"default": "./dist/analyze/static-graph.mjs"
|
|
77
|
+
},
|
|
78
|
+
"require": {
|
|
79
|
+
"types": "./dist/analyze/static-graph.d.cts",
|
|
80
|
+
"default": "./dist/analyze/static-graph.cjs"
|
|
81
|
+
},
|
|
82
|
+
"default": "./dist/analyze/static-graph.js"
|
|
83
|
+
},
|
|
84
|
+
"./intrinsics": {
|
|
85
|
+
"types": "./dist/analyze/intrinsics.d.ts",
|
|
86
|
+
"import": "./dist/analyze/intrinsics.mjs",
|
|
87
|
+
"require": "./dist/analyze/intrinsics.cjs",
|
|
88
|
+
"default": "./dist/analyze/intrinsics.js"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"dependencies": {
|
|
92
|
+
"@babel/parser": "^7.28.5",
|
|
93
|
+
"@jridgewell/sourcemap-codec": "^1.5.5",
|
|
94
|
+
"magic-string": "^0.30.21",
|
|
95
|
+
"@fluixi/template-parser": "^1.0.0-alpha.100"
|
|
96
|
+
},
|
|
97
|
+
"devDependencies": {
|
|
98
|
+
"@babel/core": "^7.28.5",
|
|
99
|
+
"@babel/generator": "^7.29.1",
|
|
100
|
+
"@babel/helper-plugin-utils": "^7.27.1",
|
|
101
|
+
"@babel/plugin-transform-modules-commonjs": "^7.28.5",
|
|
102
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
103
|
+
"@bambiste/mix-builder": "^0.4.0",
|
|
104
|
+
"@jridgewell/trace-mapping": "^0.3.31",
|
|
105
|
+
"@types/babel__core": "^7.20.5",
|
|
106
|
+
"@types/babel__generator": "^7.27.0",
|
|
107
|
+
"@types/babel__helper-plugin-utils": "^7.10.3",
|
|
108
|
+
"cross-env": "^7.0.3",
|
|
109
|
+
"inquirer": "^14.0.2",
|
|
110
|
+
"jsdom": "^25.0.0",
|
|
111
|
+
"vitest": "^5.0.3",
|
|
112
|
+
"@fluixi/dom": "1.0.0-alpha.100",
|
|
113
|
+
"@fluixi/reactive": "1.0.0-alpha.100"
|
|
114
|
+
},
|
|
115
|
+
"peerDependencies": {
|
|
116
|
+
"@babel/core": "^7.28.5",
|
|
117
|
+
"@babel/generator": "^7.29.1",
|
|
118
|
+
"@babel/helper-plugin-utils": "^7.27.1",
|
|
119
|
+
"@babel/preset-typescript": "^7.28.5"
|
|
120
|
+
},
|
|
121
|
+
"peerDependenciesMeta": {
|
|
122
|
+
"@babel/core": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"@babel/generator": {
|
|
126
|
+
"optional": true
|
|
127
|
+
},
|
|
128
|
+
"@babel/helper-plugin-utils": {
|
|
129
|
+
"optional": true
|
|
130
|
+
},
|
|
131
|
+
"@babel/preset-typescript": {
|
|
132
|
+
"optional": true
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"scripts": {
|
|
136
|
+
"build:typings": "tsc -p tsconfig.lib.json",
|
|
137
|
+
"build": "cross-env NODE_ENV=production mix-builder",
|
|
138
|
+
"dev": "tsc -w -p tsconfig.lib.json",
|
|
139
|
+
"test": "vitest run"
|
|
140
|
+
}
|
|
141
|
+
}
|