@fluixi/compiler 1.0.0-alpha.82 → 1.0.0-alpha.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyze/expr-shape.cjs +62 -1
- package/dist/analyze/expr-shape.d.cts +14 -0
- package/dist/analyze/expr-shape.mjs +41 -1
- package/dist/analyze/intrinsics.cjs +80 -1
- package/dist/analyze/intrinsics.d.cts +66 -0
- package/dist/analyze/intrinsics.mjs +59 -1
- package/dist/analyze/paren.cjs +134 -0
- package/dist/analyze/paren.d.cts +23 -0
- package/dist/analyze/paren.d.ts +24 -0
- package/dist/analyze/paren.d.ts.map +1 -0
- package/dist/analyze/paren.js +168 -0
- package/dist/analyze/paren.mjs +113 -0
- package/dist/analyze/props-destructure.cjs +226 -1
- package/dist/analyze/props-destructure.d.cts +83 -0
- package/dist/analyze/props-destructure.mjs +205 -1
- package/dist/analyze/reactive-bindings.cjs +190 -1
- package/dist/analyze/reactive-bindings.d.cts +42 -0
- package/dist/analyze/reactive-bindings.mjs +167 -1
- package/dist/analyze/reactive-expr.cjs +38 -1
- package/dist/analyze/reactive-expr.d.cts +38 -0
- package/dist/analyze/reactive-expr.mjs +17 -1
- package/dist/analyze/static-graph.cjs +811 -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 +869 -0
- package/dist/analyze/static-graph.mjs +793 -0
- package/dist/babel-NRW4EFTG.mjs +636 -0
- package/dist/chunk-3YKZ4GNH.mjs +11 -0
- package/dist/chunk-EZR7NZOY.mjs +1718 -0
- package/dist/chunk-FSSWUXUR.mjs +16 -0
- package/dist/chunk-MJV3UXIL.mjs +158 -0
- package/dist/chunk-R2VHAZAX.mjs +1078 -0
- package/dist/codegen/backend.cjs +18 -1
- package/dist/codegen/backend.d.cts +35 -0
- package/dist/codegen/backends/imperative.cjs +542 -1
- package/dist/codegen/backends/imperative.d.cts +11 -0
- package/dist/codegen/backends/imperative.d.ts.map +1 -1
- package/dist/codegen/backends/imperative.js +68 -13
- package/dist/codegen/backends/imperative.mjs +519 -1
- package/dist/codegen/contract.cjs +52 -1
- package/dist/codegen/contract.d.cts +24 -0
- package/dist/codegen/contract.mjs +31 -1
- package/dist/codegen/partial-template.cjs +176 -1
- package/dist/codegen/partial-template.d.cts +61 -0
- package/dist/codegen/partial-template.mjs +153 -1
- package/dist/codegen/serialize-static.cjs +125 -1
- package/dist/codegen/serialize-static.d.cts +38 -0
- package/dist/codegen/serialize-static.d.ts +16 -0
- package/dist/codegen/serialize-static.d.ts.map +1 -1
- package/dist/codegen/serialize-static.js +25 -0
- package/dist/codegen/serialize-static.mjs +104 -1
- package/dist/frontend/babel/build-ir-lit.cjs +1509 -1
- package/dist/frontend/babel/build-ir-lit.d.cts +26 -0
- package/dist/frontend/babel/build-ir-lit.mjs +1478 -1
- package/dist/frontend/babel/build-ir.cjs +1524 -1
- package/dist/frontend/babel/build-ir.d.cts +35 -0
- package/dist/frontend/babel/build-ir.mjs +1495 -1
- package/dist/frontend/babel/index.cjs +2186 -1
- package/dist/frontend/babel/index.d.cts +33 -0
- package/dist/frontend/babel/index.mjs +2156 -1
- package/dist/frontend/babel/lower-template.cjs +1507 -1
- package/dist/frontend/babel/lower-template.d.cts +23 -0
- package/dist/frontend/babel/lower-template.mjs +1478 -1
- package/dist/frontend/babel/plugin.cjs +2132 -1
- package/dist/frontend/babel/plugin.d.cts +95 -0
- package/dist/frontend/babel/plugin.mjs +2103 -1
- package/dist/frontend/babel/server-functions.cjs +110 -1
- package/dist/frontend/babel/server-functions.d.cts +10 -0
- package/dist/frontend/babel/server-functions.mjs +89 -1
- package/dist/frontend/babel/types.cjs +18 -1
- package/dist/frontend/babel/types.d.cts +33 -0
- package/dist/frontend/types.cjs +18 -1
- package/dist/frontend/types.d.cts +25 -0
- package/dist/frontend/vocabulary.cjs +98 -0
- package/dist/frontend/vocabulary.d.cts +79 -0
- package/dist/frontend/vocabulary.d.ts +80 -0
- package/dist/frontend/vocabulary.d.ts.map +1 -0
- package/dist/frontend/vocabulary.js +124 -0
- package/dist/frontend/vocabulary.mjs +77 -0
- package/dist/index.cjs +1594 -13
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.mjs +1574 -13
- package/dist/integrations.cjs +4307 -25
- package/dist/integrations.d.cts +215 -0
- package/dist/integrations.d.ts +16 -0
- package/dist/integrations.d.ts.map +1 -1
- package/dist/integrations.js +21 -2
- package/dist/integrations.mjs +531 -17
- package/dist/ir/nodes.cjs +18 -1
- package/dist/ir/nodes.d.cts +168 -0
- package/dist/ir/nodes.d.ts +46 -0
- package/dist/ir/nodes.d.ts.map +1 -1
- package/dist/lower/compile-template.cjs +1356 -1
- package/dist/lower/compile-template.d.cts +69 -0
- package/dist/lower/compile-template.d.ts +12 -0
- package/dist/lower/compile-template.d.ts.map +1 -1
- package/dist/lower/compile-template.js +5 -1
- package/dist/lower/compile-template.mjs +1336 -1
- package/dist/lower/jsx.cjs +529 -1
- package/dist/lower/jsx.d.cts +25 -0
- package/dist/lower/jsx.d.ts +2 -0
- package/dist/lower/jsx.d.ts.map +1 -1
- package/dist/lower/jsx.js +27 -4
- package/dist/lower/jsx.mjs +506 -1
- package/dist/lower/template.cjs +1061 -1
- package/dist/lower/template.d.cts +53 -0
- package/dist/lower/template.d.ts +14 -1
- package/dist/lower/template.d.ts.map +1 -1
- package/dist/lower/template.js +106 -19
- package/dist/lower/template.mjs +1042 -1
- package/dist/lower/text.cjs +42 -1
- package/dist/lower/text.d.cts +10 -0
- package/dist/lower/text.mjs +21 -1
- package/dist/optimize/analyze-static.cjs +112 -1
- package/dist/optimize/analyze-static.d.cts +39 -0
- package/dist/optimize/analyze-static.mjs +91 -1
- package/dist/optimize/collapse-strategies.cjs +90 -1
- package/dist/optimize/collapse-strategies.d.cts +30 -0
- package/dist/optimize/collapse-strategies.mjs +67 -1
- package/dist/options.cjs +33 -1
- package/dist/options.d.cts +39 -0
- package/dist/options.mjs +12 -1
- package/dist/resolve/builtins.cjs +73 -1
- package/dist/resolve/builtins.d.cts +68 -0
- package/dist/resolve/builtins.mjs +53 -1
- package/dist/resolve/component-globals.cjs +233 -13
- package/dist/resolve/component-globals.d.cts +80 -0
- package/dist/resolve/component-globals.mjs +210 -13
- package/dist/resolve/component-resolver.cjs +80 -1
- package/dist/resolve/component-resolver.d.cts +68 -0
- package/dist/resolve/component-resolver.mjs +59 -1
- package/dist/resolve/load-directive.cjs +93 -1
- package/dist/resolve/load-directive.d.cts +53 -0
- package/dist/resolve/load-directive.mjs +72 -1
- package/dist/resolve/resolve-ir.cjs +108 -1
- package/dist/resolve/resolve-ir.d.cts +53 -0
- package/dist/resolve/resolve-ir.mjs +85 -1
- package/dist/resolve/write-globals.cjs +318 -13
- package/dist/resolve/write-globals.d.cts +30 -0
- package/dist/resolve/write-globals.mjs +297 -13
- package/dist/server-fns-4ZXN6DYU.mjs +78 -0
- package/dist/server-functions-V6D6DRIA.mjs +82 -0
- package/dist/transform/bindings.cjs +71 -1
- package/dist/transform/bindings.d.cts +16 -0
- package/dist/transform/bindings.mjs +50 -1
- package/dist/transform/index.cjs +2732 -8
- package/dist/transform/index.d.cts +15 -0
- package/dist/transform/index.mjs +3773 -17
- package/dist/transform/intrinsics.cjs +216 -3
- package/dist/transform/intrinsics.d.cts +21 -0
- package/dist/transform/intrinsics.mjs +193 -3
- package/dist/transform/props.cjs +441 -3
- package/dist/transform/props.d.cts +45 -0
- package/dist/transform/props.mjs +1482 -12
- package/dist/transform/server-fn-id.cjs +35 -1
- package/dist/transform/server-fn-id.d.cts +9 -0
- package/dist/transform/server-fn-id.mjs +14 -1
- package/dist/transform/server-fns.cjs +114 -2
- package/dist/transform/server-fns.d.cts +12 -0
- package/dist/transform/server-fns.mjs +1155 -11
- package/dist/transform/source-locations.cjs +330 -0
- package/dist/transform/source-locations.d.cts +43 -0
- package/dist/transform/source-locations.d.ts +44 -0
- package/dist/transform/source-locations.d.ts.map +1 -0
- package/dist/transform/source-locations.js +238 -0
- package/dist/transform/source-locations.mjs +307 -0
- package/dist/transform/templates.cjs +2701 -7
- package/dist/transform/templates.d.cts +69 -0
- package/dist/transform/templates.d.ts +12 -4
- package/dist/transform/templates.d.ts.map +1 -1
- package/dist/transform/templates.js +72 -7
- package/dist/transform/templates.mjs +3743 -16
- package/dist/transform-BT4MMASR.mjs +893 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/dist/babel-4JUDAR2G.mjs +0 -1
- package/dist/chunk-3SAEGOMQ.mjs +0 -1
- package/dist/chunk-IBRM4W7I.mjs +0 -10
- package/dist/chunk-OHHZCYIQ.mjs +0 -1
- package/dist/chunk-PVR2SN3B.mjs +0 -1
- package/dist/chunk-QUIYULS2.mjs +0 -1
- package/dist/chunk-YR3SAEO7.mjs +0 -1
- package/dist/server-fns-6QM243HC.mjs +0 -2
- package/dist/server-functions-E3LKCZ4R.mjs +0 -1
- package/dist/transform-5WC4FWJE.mjs +0 -8
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The node-type names the parser-agnostic layer is allowed to branch on.
|
|
3
|
+
*
|
|
4
|
+
* `lower/`, `analyze/`, `optimize/`, `resolve/` and `codegen/` never import a
|
|
5
|
+
* parser. They declare `interface Node { type: string }`, read `node.type`, and
|
|
6
|
+
* ask the caller for an expression's source through `code(node)`. That makes the
|
|
7
|
+
* layer parser-agnostic in architecture while leaving it coupled to one parser's
|
|
8
|
+
* *vocabulary*: the spelling of those type names, which differs by dialect.
|
|
9
|
+
*
|
|
10
|
+
* Until this file existed the vocabulary was convention. Nothing wrote it down,
|
|
11
|
+
* so a second front-end had no definition of done and the current one could add a
|
|
12
|
+
* name without anyone noticing. It has grown from the 35 names counted in
|
|
13
|
+
* COMPILER-AUDIT §14.3 to the 53 below.
|
|
14
|
+
*
|
|
15
|
+
* ## Dialects
|
|
16
|
+
*
|
|
17
|
+
* Babel is the reference spelling because the babel front-end is the reference
|
|
18
|
+
* implementation. ESTree (acorn, oxc) collapses the literal family into `Literal`
|
|
19
|
+
* and calls an object entry `Property`; SWC renames more widely and carries
|
|
20
|
+
* `span` instead of `loc`. A second front-end is therefore an adapter: rename at
|
|
21
|
+
* the boundary and supply `code(node)`, which a span-carrying parser does better
|
|
22
|
+
* than babel, since it can slice the original text instead of reprinting it.
|
|
23
|
+
*
|
|
24
|
+
* ## The span convention
|
|
25
|
+
*
|
|
26
|
+
* Positions are read as `node.loc.start.line` (1-based) and
|
|
27
|
+
* `node.loc.start.column` (0-based). Nothing in this layer reads byte offsets;
|
|
28
|
+
* source text arrives through `code(node)`, so a front-end is free to back that
|
|
29
|
+
* with offsets, a printer, or anything else.
|
|
30
|
+
*
|
|
31
|
+
* ## What this file does not cover
|
|
32
|
+
*
|
|
33
|
+
* Names, not field reads. `vocabulary.spec.ts` fails on a name that is not listed
|
|
34
|
+
* here, which catches a front-end porting gap at the point it is introduced. It
|
|
35
|
+
* cannot see that some branch started reading `node.optional`, and adding that
|
|
36
|
+
* would mean tracking property access through the narrowed type, which the spec
|
|
37
|
+
* deliberately does not attempt.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Names whose ESTree spelling differs. These are the porting hazards: a front-end
|
|
41
|
+
* swap that misses one produces a layer that silently stops recognising a
|
|
42
|
+
* construct rather than failing.
|
|
43
|
+
*/
|
|
44
|
+
export const DIALECT_DIVERGENT = {
|
|
45
|
+
StringLiteral: { estree: 'Literal' },
|
|
46
|
+
NumericLiteral: { estree: 'Literal' },
|
|
47
|
+
BooleanLiteral: { estree: 'Literal' },
|
|
48
|
+
NullLiteral: { estree: 'Literal' },
|
|
49
|
+
BigIntLiteral: { estree: 'Literal' },
|
|
50
|
+
RegExpLiteral: { estree: 'Literal' },
|
|
51
|
+
ObjectProperty: { estree: 'Property' },
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The ESTree spellings the layer already accepts alongside the babel ones.
|
|
55
|
+
*
|
|
56
|
+
* Three sites handle both today (`lower/jsx.ts`, `analyze/props-destructure.ts`,
|
|
57
|
+
* `analyze/expr-shape.ts`) and three do not: `analyze/static-graph.ts` tests
|
|
58
|
+
* `StringLiteral` at one site and `ObjectProperty` at two, with no `Literal` or
|
|
59
|
+
* `Property` branch beside them. Those three are the known gap, and they are why
|
|
60
|
+
* this file lists the pairs rather than assuming the layer is already portable.
|
|
61
|
+
*/
|
|
62
|
+
export const ESTREE_ALIASES = {
|
|
63
|
+
Literal: { note: 'ESTree collapses the babel literal family into this' },
|
|
64
|
+
Property: { note: 'ESTree spelling of ObjectProperty' },
|
|
65
|
+
};
|
|
66
|
+
/** JSX. acorn-jsx keeps babel's names; SWC does not. */
|
|
67
|
+
export const JSX_NODES = {
|
|
68
|
+
JSXElement: {},
|
|
69
|
+
JSXFragment: {},
|
|
70
|
+
JSXOpeningElement: {},
|
|
71
|
+
JSXAttribute: {},
|
|
72
|
+
JSXSpreadAttribute: {},
|
|
73
|
+
JSXSpreadChild: {},
|
|
74
|
+
JSXExpressionContainer: {},
|
|
75
|
+
JSXEmptyExpression: { note: 'an empty container, and a JSX comment' },
|
|
76
|
+
JSXIdentifier: {},
|
|
77
|
+
JSXMemberExpression: { note: 'a dotted tag, read through code()' },
|
|
78
|
+
JSXNamespacedName: { note: 'carries the directive prefixes: use:, on:, class:' },
|
|
79
|
+
JSXText: {},
|
|
80
|
+
};
|
|
81
|
+
/** Names spelled the same in babel and ESTree. */
|
|
82
|
+
export const SHARED_NODES = {
|
|
83
|
+
ArrayExpression: {},
|
|
84
|
+
ArrayPattern: {},
|
|
85
|
+
ArrowFunctionExpression: {},
|
|
86
|
+
AssignmentExpression: {},
|
|
87
|
+
AssignmentPattern: {},
|
|
88
|
+
BinaryExpression: {},
|
|
89
|
+
BlockStatement: {},
|
|
90
|
+
CallExpression: {},
|
|
91
|
+
CatchClause: { note: 'introduces a binding, so scope tracking has to see it' },
|
|
92
|
+
ClassDeclaration: {},
|
|
93
|
+
ClassExpression: {},
|
|
94
|
+
ConditionalExpression: {},
|
|
95
|
+
ExportDefaultDeclaration: {},
|
|
96
|
+
ExportNamedDeclaration: {},
|
|
97
|
+
FunctionDeclaration: {},
|
|
98
|
+
FunctionExpression: {},
|
|
99
|
+
Identifier: {},
|
|
100
|
+
ImportDeclaration: {},
|
|
101
|
+
ImportDefaultSpecifier: {},
|
|
102
|
+
ImportNamespaceSpecifier: {},
|
|
103
|
+
ImportSpecifier: {},
|
|
104
|
+
LogicalExpression: {},
|
|
105
|
+
MemberExpression: {},
|
|
106
|
+
ObjectExpression: {},
|
|
107
|
+
ObjectPattern: {},
|
|
108
|
+
RestElement: {},
|
|
109
|
+
SpreadElement: {},
|
|
110
|
+
TaggedTemplateExpression: { note: 'html`` and svg``' },
|
|
111
|
+
TemplateLiteral: {},
|
|
112
|
+
UnaryExpression: {},
|
|
113
|
+
UpdateExpression: {},
|
|
114
|
+
VariableDeclarator: {},
|
|
115
|
+
};
|
|
116
|
+
/** Every name the parser-agnostic layer may branch on. */
|
|
117
|
+
export const VOCABULARY = {
|
|
118
|
+
...DIALECT_DIVERGENT,
|
|
119
|
+
...ESTREE_ALIASES,
|
|
120
|
+
...JSX_NODES,
|
|
121
|
+
...SHARED_NODES,
|
|
122
|
+
};
|
|
123
|
+
/** The directories that must not branch on anything outside `VOCABULARY`. */
|
|
124
|
+
export const PARSER_AGNOSTIC_DIRS = ['lower', 'analyze', 'optimize', 'resolve', 'codegen'];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// src/frontend/vocabulary.ts
|
|
2
|
+
var DIALECT_DIVERGENT = {
|
|
3
|
+
StringLiteral: { estree: "Literal" },
|
|
4
|
+
NumericLiteral: { estree: "Literal" },
|
|
5
|
+
BooleanLiteral: { estree: "Literal" },
|
|
6
|
+
NullLiteral: { estree: "Literal" },
|
|
7
|
+
BigIntLiteral: { estree: "Literal" },
|
|
8
|
+
RegExpLiteral: { estree: "Literal" },
|
|
9
|
+
ObjectProperty: { estree: "Property" }
|
|
10
|
+
};
|
|
11
|
+
var ESTREE_ALIASES = {
|
|
12
|
+
Literal: { note: "ESTree collapses the babel literal family into this" },
|
|
13
|
+
Property: { note: "ESTree spelling of ObjectProperty" }
|
|
14
|
+
};
|
|
15
|
+
var JSX_NODES = {
|
|
16
|
+
JSXElement: {},
|
|
17
|
+
JSXFragment: {},
|
|
18
|
+
JSXOpeningElement: {},
|
|
19
|
+
JSXAttribute: {},
|
|
20
|
+
JSXSpreadAttribute: {},
|
|
21
|
+
JSXSpreadChild: {},
|
|
22
|
+
JSXExpressionContainer: {},
|
|
23
|
+
JSXEmptyExpression: { note: "an empty container, and a JSX comment" },
|
|
24
|
+
JSXIdentifier: {},
|
|
25
|
+
JSXMemberExpression: { note: "a dotted tag, read through code()" },
|
|
26
|
+
JSXNamespacedName: { note: "carries the directive prefixes: use:, on:, class:" },
|
|
27
|
+
JSXText: {}
|
|
28
|
+
};
|
|
29
|
+
var SHARED_NODES = {
|
|
30
|
+
ArrayExpression: {},
|
|
31
|
+
ArrayPattern: {},
|
|
32
|
+
ArrowFunctionExpression: {},
|
|
33
|
+
AssignmentExpression: {},
|
|
34
|
+
AssignmentPattern: {},
|
|
35
|
+
BinaryExpression: {},
|
|
36
|
+
BlockStatement: {},
|
|
37
|
+
CallExpression: {},
|
|
38
|
+
CatchClause: { note: "introduces a binding, so scope tracking has to see it" },
|
|
39
|
+
ClassDeclaration: {},
|
|
40
|
+
ClassExpression: {},
|
|
41
|
+
ConditionalExpression: {},
|
|
42
|
+
ExportDefaultDeclaration: {},
|
|
43
|
+
ExportNamedDeclaration: {},
|
|
44
|
+
FunctionDeclaration: {},
|
|
45
|
+
FunctionExpression: {},
|
|
46
|
+
Identifier: {},
|
|
47
|
+
ImportDeclaration: {},
|
|
48
|
+
ImportDefaultSpecifier: {},
|
|
49
|
+
ImportNamespaceSpecifier: {},
|
|
50
|
+
ImportSpecifier: {},
|
|
51
|
+
LogicalExpression: {},
|
|
52
|
+
MemberExpression: {},
|
|
53
|
+
ObjectExpression: {},
|
|
54
|
+
ObjectPattern: {},
|
|
55
|
+
RestElement: {},
|
|
56
|
+
SpreadElement: {},
|
|
57
|
+
TaggedTemplateExpression: { note: "html`` and svg``" },
|
|
58
|
+
TemplateLiteral: {},
|
|
59
|
+
UnaryExpression: {},
|
|
60
|
+
UpdateExpression: {},
|
|
61
|
+
VariableDeclarator: {}
|
|
62
|
+
};
|
|
63
|
+
var VOCABULARY = {
|
|
64
|
+
...DIALECT_DIVERGENT,
|
|
65
|
+
...ESTREE_ALIASES,
|
|
66
|
+
...JSX_NODES,
|
|
67
|
+
...SHARED_NODES
|
|
68
|
+
};
|
|
69
|
+
var PARSER_AGNOSTIC_DIRS = ["lower", "analyze", "optimize", "resolve", "codegen"];
|
|
70
|
+
export {
|
|
71
|
+
DIALECT_DIVERGENT,
|
|
72
|
+
ESTREE_ALIASES,
|
|
73
|
+
JSX_NODES,
|
|
74
|
+
PARSER_AGNOSTIC_DIRS,
|
|
75
|
+
SHARED_NODES,
|
|
76
|
+
VOCABULARY
|
|
77
|
+
};
|