@openelement/compiler 1.0.0-alpha.15 → 1.0.0-alpha.16

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.
Files changed (51) hide show
  1. package/package.json +3 -2
  2. package/src/compiler.d.ts +8 -6
  3. package/src/compiler.js +7 -6
  4. package/src/internal/compiler/compiled-artifact-class-candidates.d.ts +5 -30
  5. package/src/internal/compiler/compiled-artifact-class-candidates.js +18 -32
  6. package/src/internal/compiler/compiled-artifact-style-requests.d.ts +9 -7
  7. package/src/internal/compiler/compiled-artifact-style-requests.js +9 -7
  8. package/src/internal/compiler/plugin.d.ts +31 -50
  9. package/src/internal/compiler/plugin.js +41 -108
  10. package/src/internal/compiler/semantic-core/analyze-module.d.ts +1 -45
  11. package/src/internal/compiler/semantic-core/analyze-module.js +10 -405
  12. package/src/internal/compiler/semantic-core/attribute-classification.js +92 -0
  13. package/src/internal/compiler/semantic-core/compiler-diagnostics.js +2 -16
  14. package/src/internal/compiler/semantic-core/expression-lowering.js +469 -0
  15. package/src/internal/compiler/semantic-core/expression-registry.js +165 -0
  16. package/src/internal/compiler/semantic-core/function-frontend.js +1229 -0
  17. package/src/internal/compiler/semantic-core/island-policy-statement.js +52 -0
  18. package/src/internal/compiler/semantic-core/jsx-module-id.d.ts +4 -0
  19. package/src/internal/compiler/semantic-core/jsx-module-id.js +7 -0
  20. package/src/internal/compiler/semantic-core/lower-program.d.ts +51 -0
  21. package/src/internal/compiler/semantic-core/lower-program.js +186 -90
  22. package/src/internal/compiler/semantic-core/module-analysis.d.ts +28 -5
  23. package/src/internal/compiler/semantic-core/module-analysis.js +16 -17
  24. package/src/internal/compiler/semantic-core/parse-module.js +16 -16
  25. package/src/internal/compiler/semantic-core/scope-resolution.d.ts +208 -0
  26. package/src/internal/compiler/semantic-core/scope-resolution.js +1121 -0
  27. package/src/internal/compiler/semantic-core/server-component.d.ts +22 -7
  28. package/src/internal/compiler/semantic-core/server-component.js +163 -57
  29. package/src/internal/compiler/semantic-core/type-erasure.js +156 -0
  30. package/src/internal/compiler/semantic-ir/generated-element/compile.d.ts +61 -0
  31. package/src/internal/compiler/semantic-ir/generated-element/compile.js +137 -0
  32. package/src/internal/compiler/semantic-ir/generated-element/contract.d.ts +201 -0
  33. package/src/internal/compiler/semantic-ir/generated-element/contract.js +147 -0
  34. package/src/internal/compiler/semantic-ir/generated-element/emit.js +452 -0
  35. package/src/internal/compiler/semantic-ir/generated-element/site.js +1195 -0
  36. package/src/internal/compiler/semantic-ir/generated-leaf/claim-emission.js +1372 -0
  37. package/src/internal/compiler/semantic-ir/generated-leaf/codegen-literals.js +31 -0
  38. package/src/internal/compiler/semantic-ir/generated-leaf/component-emission.js +647 -0
  39. package/src/internal/compiler/semantic-ir/generated-leaf/emission.js +388 -0
  40. package/src/internal/compiler/semantic-ir/generated-leaf/generate.js +395 -0
  41. package/src/internal/compiler/semantic-ir/generated-leaf/instance-emission.js +865 -0
  42. package/src/internal/compiler/semantic-ir/generated-leaf/mount-emission.js +960 -0
  43. package/src/internal/compiler/semantic-ir/generated-leaf/server-emission.js +1011 -0
  44. package/src/internal/compiler/semantic-ir/generated-leaf/structure.js +714 -0
  45. package/src/internal/compiler/style-requests.d.ts +0 -8
  46. package/src/internal/compiler/style-requests.js +1 -14
  47. package/src/internal/compiler/semantic-core/compile.d.ts +0 -47
  48. package/src/internal/compiler/semantic-core/compile.js +0 -100
  49. package/src/internal/compiler/semantic-core/emit-module.js +0 -317
  50. package/src/internal/compiler/semantic-core/emit-program.js +0 -141
  51. package/src/internal/compiler/semantic-core/style-imports.js +0 -87
@@ -0,0 +1,137 @@
1
+ import { CompiledElementError } from "../../semantic-core/compiler-diagnostics.js";
2
+ import { isJsxModuleId } from "../../semantic-core/jsx-module-id.js";
3
+ import { analyzeModuleSemantics } from "../../semantic-core/module-analysis.js";
4
+ import { typescriptParser } from "../../semantic-core/parse-module.js";
5
+ import { compileFunctionModule } from "../../semantic-core/function-frontend.js";
6
+ import { GENERATED_ELEMENT_DIAGNOSTIC, GENERATED_ELEMENT_IMPORT_CLASSIFIER } from "./contract.js";
7
+ import { generateElementModule } from "./emit.js";
8
+ import { admitGeneratedElementSite, gateGeneratedElementBindings, gateGeneratedElementRootProps } from "./site.js";
9
+ //#region src/internal/compiler/semantic-ir/generated-element/compile.ts
10
+ /**
11
+ * M09-1a — the generated-element lane entry.
12
+ *
13
+ * Mirrors `compileServerComponentIfAdmitted`: returns null for a module the
14
+ * lane does not own (no host site fact, non-JSX-bearing, or the class lane's decorator
15
+ * grammar) and fails closed with the single compiler error dialect when it does
16
+ * own a module it must refuse. The host calls it between the class lane and the
17
+ * server function lane in `compiledElementPlugin.transform`.
18
+ *
19
+ * The lane is inert in a real build: no production host passes a
20
+ * `generatedElementSite` option in M09-1a, so every real module returns null at
21
+ * the first gate. The router wiring that supplies a site is M09-1b.
22
+ */
23
+ /**
24
+ * Whether one lowered component's tree contains a `when` or `each` Block.
25
+ *
26
+ * The walk descends conditions and list templates because a Block nested inside one
27
+ * still needs the block builders at runtime. Component references are NOT followed:
28
+ * a child component's Blocks are its own module's business, and the router's scan
29
+ * asks every island module separately — following them here would make one island's
30
+ * answer depend on another's, which is exactly the coupling the per-module scan
31
+ * avoids.
32
+ */
33
+ function componentUsesBlocks(component) {
34
+ let found = false;
35
+ const visit = (nodes) => {
36
+ for (const node of nodes) {
37
+ if (found) return;
38
+ if (node.kind === "condition") {
39
+ found = true;
40
+ return;
41
+ }
42
+ if (node.kind === "list") {
43
+ found = true;
44
+ return;
45
+ }
46
+ if (node.kind === "element" || node.kind === "fragment") visit(node.children);
47
+ }
48
+ };
49
+ visit(component.roots);
50
+ return found;
51
+ }
52
+ function toCompilerDiagnostic(diagnostic) {
53
+ return {
54
+ code: diagnostic.code,
55
+ message: diagnostic.message,
56
+ file: diagnostic.span.file,
57
+ line: diagnostic.span.line,
58
+ character: diagnostic.span.column,
59
+ start: diagnostic.span.start,
60
+ end: diagnostic.span.end
61
+ };
62
+ }
63
+ function notAComponent(componentName, moduleFile) {
64
+ return {
65
+ severity: "error",
66
+ code: GENERATED_ELEMENT_DIAGNOSTIC.NOT_A_COMPONENT,
67
+ message: `the default export "${componentName}" is a function, but the function frontend did not admit it as a component (a component returns JSX); M09-1 will not ship a non-constructor default export for an island`,
68
+ span: {
69
+ file: moduleFile,
70
+ start: 0,
71
+ end: 0,
72
+ line: 1,
73
+ column: 1
74
+ },
75
+ origin: "module"
76
+ };
77
+ }
78
+ /**
79
+ * Compile one module through the generated native element lane when — and only
80
+ * when — the host supplied a site fact for it.
81
+ *
82
+ * Admission order (design §4.2): site fact → class-lane ownership → syntactic
83
+ * default-export/sidecar admission (the root and focus facts and the property
84
+ * table included: the lane reads them from the sidecar, D-root-source /
85
+ * D-delegatesFocus / D-props) → props parameter/type cross-check → leaf
86
+ * generation → bindings requirement. The final emitter step is append-only over the leaf text, so
87
+ * every refusal happens before a half-built module can be returned.
88
+ */
89
+ function compileGeneratedElementIfAdmitted(code, id, options) {
90
+ if (options.site === null) return null;
91
+ if (!isJsxModuleId(id)) return null;
92
+ const classFacts = analyzeModuleSemantics(code, id);
93
+ if (classFacts.compiledElementDecorator || classFacts.unsupportedElementDecorator !== void 0) return null;
94
+ const parsed = typescriptParser.parseModule(code, id);
95
+ if (parsed.syntaxDiagnostics.length > 0) return null;
96
+ const siteAdmission = admitGeneratedElementSite(parsed.sourceFile, options.site);
97
+ if (siteAdmission.kind === "declined") return null;
98
+ if (siteAdmission.kind === "refused") throw new CompiledElementError(siteAdmission.diagnostics.map(toCompilerDiagnostic));
99
+ const admission = siteAdmission.admission;
100
+ const frontend = compileFunctionModule(code, id, {
101
+ importClassifier: GENERATED_ELEMENT_IMPORT_CLASSIFIER,
102
+ lifecycleAdmission: { admission: "module" }
103
+ });
104
+ if (frontend.module === null) throw new CompiledElementError([...frontend.diagnostics]);
105
+ const root = frontend.module.components.find((component) => component.name === admission.componentName);
106
+ if (root === void 0) throw new CompiledElementError([toCompilerDiagnostic(notAComponent(admission.componentName, id))]);
107
+ const propsDiagnostics = gateGeneratedElementRootProps(admission, root);
108
+ if (propsDiagnostics.length > 0) throw new CompiledElementError(propsDiagnostics.map(toCompilerDiagnostic));
109
+ const emitted = generateElementModule(frontend.module, options.site, {
110
+ rootComponent: root.name,
111
+ allowDirectShadowDriver: admission.propsParameter === null,
112
+ ...admission.root === void 0 ? {} : { root: admission.root },
113
+ ...admission.delegatesFocus ? { delegatesFocus: true } : {},
114
+ ...admission.formAssociated ? { formAssociated: true } : {},
115
+ ...admission.properties.length === 0 ? {} : { properties: admission.properties },
116
+ ...admission.declaresStyles && admission.root === "shadow-open" ? { styleLinkPrefix: true } : {},
117
+ clientOnly: admission.clientOnly,
118
+ ...admission.declaresStyles ? { styles: admission.styles } : {},
119
+ ...options.authoredSource === void 0 ? {} : { authoredSource: options.authoredSource }
120
+ });
121
+ if (emitted.diagnostics.length > 0) throw new CompiledElementError(emitted.diagnostics.map(toCompilerDiagnostic));
122
+ const bindingDiagnostics = gateGeneratedElementBindings(id, emitted);
123
+ if (bindingDiagnostics.length > 0) throw new CompiledElementError(bindingDiagnostics.map(toCompilerDiagnostic));
124
+ if (emitted.module === null) throw new CompiledElementError([toCompilerDiagnostic(notAComponent(admission.componentName, id))]);
125
+ return {
126
+ code: emitted.module,
127
+ map: emitted.sourceMap,
128
+ tag: options.site.tag,
129
+ component: root.name,
130
+ ssrHostExport: emitted.ssrHostExport,
131
+ lightSsr: emitted.lightSsr,
132
+ classCandidates: emitted.classCandidates,
133
+ usesBlocks: componentUsesBlocks(root)
134
+ };
135
+ }
136
+ //#endregion
137
+ export { compileGeneratedElementIfAdmitted };
@@ -0,0 +1,201 @@
1
+ import { ImportClassifier } from "../../semantic-core/scope-resolution.js";
2
+ //#region src/internal/compiler/semantic-ir/generated-element/contract.d.ts
3
+ /**
4
+ * The internal shell specifier the emitted CE module imports.
5
+ *
6
+ * Deliberately NOT a package `exports` subpath in M09-1a: the directory is
7
+ * still excluded from `@openelement/element`'s packed `files` set, and the
8
+ * compiler lane has no production caller. M09-1b deletes the exclusion, adds
9
+ * the export subpath, and points the emitted module at the exported spelling.
10
+ * Source-level M09-1a tests alias this specifier to the workspace source; the
11
+ * unresolved spelling cannot reach a real build because no production host
12
+ * passes a site fact yet.
13
+ */
14
+ declare const GENERATED_ELEMENT_SHELL_SPECIFIER = "@openelement/element/internal/compiled/generated-element/shell";
15
+ /**
16
+ * The host-supplied fact that admits one module to the generated-element lane.
17
+ * It is an internal compiler option value, never author syntax: the router
18
+ * derives it from the island path (M09-1b) and the compiler cannot derive it
19
+ * itself because the island transform runs after this compiler plugin.
20
+ *
21
+ * The fact carries the TAG only. The root used to ride here too; D-root-source
22
+ * (2026-11-13) moved it to the compiler lane's own read of the authored
23
+ * sidecar (`site.ts` `readIslandRoot`), so one stale host scan can no longer
24
+ * pin a root that the source no longer declares.
25
+ */
26
+ export interface GeneratedElementSite {
27
+ /** The custom-element tag the host's island pipeline will register. */
28
+ readonly tag: string;
29
+ /**
30
+ * The descriptor root the host will create, when the host already knows it
31
+ * (P-1, 2026-11-21). The router resolves this from the island's OWN
32
+ * declaration — the same fact the DSD link list and the shell's `root` come
33
+ * from — so a shadow generated island's statically admitted class tokens can
34
+ * be registered as SHADOW candidates (the component stylesheet) rather than
35
+ * light ones (the document sheet, which a shadow root never sees).
36
+ *
37
+ * Optional and defaulting to the pre-P-1 answer (`light`): a host that does
38
+ * not know the root keeps today's behaviour, and the compiler never infers it
39
+ * from the sidecar here — the host owns the site fact.
40
+ */
41
+ readonly root?: 'light' | 'shadow' | 'closed';
42
+ }
43
+ /** Host hook for the site fact; returning null keeps the lane inert. */
44
+ type GeneratedElementSiteResolver = (moduleId: string) => GeneratedElementSite | null;
45
+ /** The three primitive property types the generated-element shell admits. */
46
+ export type GeneratedElementPrimitiveType = 'string' | 'number' | 'boolean';
47
+ /**
48
+ * The property-only non-primitive types this lane retains (plan §14): no
49
+ * attribute channel, no JSON wire, no converter. `trustedHtml` is the existing
50
+ * brand; array/object values are caller-owned references.
51
+ */
52
+ export type GeneratedElementNonPrimitiveType = 'array' | 'object' | 'trustedHtml';
53
+ /** Every property type a descriptor row may declare. */
54
+ export type GeneratedElementPlatformPropertyType = GeneratedElementPrimitiveType | GeneratedElementNonPrimitiveType;
55
+ /**
56
+ * The literal default graph an array/object row may carry: JSON-safe values
57
+ * only (the emitter renders it as a fresh-literal factory; the shell never
58
+ * clones caller writes). `trustedHtml` calls are not part of this graph; a
59
+ * trustedHtml default is the literal HTML string carried separately.
60
+ */
61
+ export type GeneratedElementDefaultGraph = string | number | boolean | null | readonly GeneratedElementDefaultGraph[] | {
62
+ readonly [key: string]: GeneratedElementDefaultGraph;
63
+ };
64
+ /**
65
+ * One resolved property row the emitter writes into the descriptor.
66
+ *
67
+ * This is the compiler-side mirror of the shell's landed
68
+ * `GeneratedElementProperty`: the same five facts, already resolved from the
69
+ * sidecar table and the typed props member (attribute name, primitive type,
70
+ * reflection, declared/zero default). `attribute: null` is a property-only
71
+ * channel; the shell derives observedAttributes from the non-null rows.
72
+ *
73
+ * It is deliberately NOT `GeneratedElementProperty` itself: the compiler lane
74
+ * must not import the browser runtime shell (the emitted module is the only
75
+ * consumer of the shell specifier), so the descriptor ABI stays a structural
76
+ * contract on both sides of the boundary.
77
+ */
78
+ interface GeneratedElementPlatformProperty {
79
+ /** JS property name and the key the generated props record exposes. */
80
+ readonly name: string;
81
+ /** Resolved attribute name, or null for a property-only channel. */
82
+ readonly attribute: string | null;
83
+ readonly type: GeneratedElementPlatformPropertyType;
84
+ /** Reflect property writes back to the attribute. */
85
+ readonly reflect: boolean;
86
+ /**
87
+ * Declared initial value. Primitive rows carry the value; a `trustedHtml`
88
+ * row carries the literal HTML string the shell brands per materialisation;
89
+ * array/object rows carry the generated fresh-literal factory NAME in
90
+ * `defaultFactory` instead (the emitter declares one module-level factory),
91
+ * so the descriptor never holds a mutable module-level default graph.
92
+ */
93
+ readonly default?: string | number | boolean;
94
+ /**
95
+ * Emitted module-level factory for an array/object default. Re-evaluating it
96
+ * builds a deep-fresh literal graph; the shell calls it once per element
97
+ * instance and the SSR resolver once per render.
98
+ */
99
+ readonly defaultFactory?: string;
100
+ /** The literal graph the emitted factory returns (array/object rows). */
101
+ readonly defaultGraph?: GeneratedElementDefaultGraph;
102
+ }
103
+ /**
104
+ * The internal diagnostic codes this lane can raise. They follow the shell's
105
+ * `OEIR_*` convention and are deliberately absent from the public error
106
+ * catalogue and the interface snapshot.
107
+ */
108
+ declare const GENERATED_ELEMENT_DIAGNOSTIC: {
109
+ /** A site module default-exports a function that is not an admitted component. */
110
+ readonly NOT_A_COMPONENT: "OEIR_GENERATED_ELEMENT_NOT_A_COMPONENT";
111
+ /** The root component takes a props parameter; M09-1a cannot declare attributes. */
112
+ readonly UNDECLARED_PROPS: "OEIR_GENERATED_ELEMENT_UNDECLARED_PROPS";
113
+ /** The generated body reads `host.bindings[*]` and no binding source exists. */
114
+ readonly UNBOUND_BINDING: "OEIR_GENERATED_ELEMENT_UNBOUND_BINDING";
115
+ /** A fixed CE-tail identifier already occurs in the leaf text. */
116
+ readonly NAME_COLLISION: "OEIR_GENERATED_ELEMENT_NAME_COLLISION";
117
+ /** The host admitted the module but the island sidecar is absent. */
118
+ readonly MISSING_SITE_MARKER: "OEIR_GENERATED_ELEMENT_MISSING_SITE_MARKER";
119
+ /**
120
+ * The sidecar's `root` cannot be read as one of `'light' | 'shadow'`
121
+ * (a dynamic value, another literal, a duplicate key, or a config object
122
+ * whose key set is not static). The router scanner's `ISLAND_METADATA_ERROR`
123
+ * remains the author-facing authority; this code is the lane's own
124
+ * fail-closed verdict inside the compiler.
125
+ */
126
+ readonly ROOT_INVALID: "OEIR_GENERATED_ELEMENT_ROOT_INVALID";
127
+ /**
128
+ * The sidecar's `delegatesFocus` cannot be read as one boolean literal (a
129
+ * dynamic value, a duplicate key, or a config object whose key set is not
130
+ * static). Like `ROOT_INVALID`, this is the lane's fail-closed verdict; the
131
+ * router scanner's `ISLAND_METADATA_ERROR` remains the author-facing
132
+ * authority and the two readers are held together by the seam drift guard.
133
+ */
134
+ readonly DELEGATES_FOCUS_INVALID: "OEIR_GENERATED_ELEMENT_DELEGATES_FOCUS_INVALID";
135
+ /**
136
+ * The sidecar declares `delegatesFocus: true` without `root: 'shadow'`. A
137
+ * light root has no shadow boundary to delegate focus through; the shell's
138
+ * descriptor validation refuses the pair too, so the lane refuses before a
139
+ * module exists instead of shipping a class that throws on evaluation.
140
+ */
141
+ readonly DELEGATES_FOCUS_WITHOUT_SHADOW: "OEIR_GENERATED_ELEMENT_DELEGATES_FOCUS_WITHOUT_SHADOW";
142
+ /**
143
+ * The root component's props parameter cannot be read as a typed primitive
144
+ * member list: no annotation, a destructured/rest parameter, an imported or
145
+ * generic type, a non-property member, an optional member or a non-primitive
146
+ * member type. The generated element's props record is a fixed
147
+ * string/number/boolean table; anything it cannot express fails closed
148
+ * instead of being silently dropped from the attribute channel.
149
+ */
150
+ readonly PROPS_TYPE_UNSUPPORTED: "OEIR_GENERATED_ELEMENT_PROPS_TYPE_UNSUPPORTED";
151
+ /**
152
+ * The sidecar `properties` table and the typed props member list disagree
153
+ * (a declared key with no typed member or a typed member with no entry, or a
154
+ * declaration without a props parameter). The two declarations are
155
+ * cross-checked, never inferred one from the other.
156
+ */
157
+ readonly PROPERTY_MISMATCH: "OEIR_GENERATED_ELEMENT_PROPERTY_MISMATCH";
158
+ /**
159
+ * One sidecar property entry is not representable: an unknown option, a
160
+ * non-literal default, an unsafe attribute name, a duplicate attribute, a
161
+ * reflected property with no attribute channel, a reserved lifecycle name, or
162
+ * a default whose literal type does not match the typed member.
163
+ */
164
+ readonly PROPERTY_INVALID: "OEIR_GENERATED_ELEMENT_PROPERTY_INVALID";
165
+ /** The sidecar's `formAssociated` is not one boolean literal. */
166
+ readonly FORM_ASSOCIATED_INVALID: "OEIR_GENERATED_ELEMENT_FORM_ASSOCIATED_INVALID";
167
+ /**
168
+ * The sidecar's `tag` is not one static string literal, or it is not a valid
169
+ * custom-element name. The lane refuses rather than admitting a module whose
170
+ * identity it cannot prove: the tag is the one host fact the compiler cannot
171
+ * derive, so a dynamic or malformed spelling would either admit the wrong
172
+ * module or register a name the platform rejects.
173
+ */
174
+ readonly TAG_INVALID: "OEIR_GENERATED_ELEMENT_TAG_INVALID";
175
+ /**
176
+ * The form-associated declaration cannot be mapped to the bounded mechanics:
177
+ * no declared string `value` property, a non-boolean `required`/`disabled`,
178
+ * or a reflected `disabled` row (the fieldset state must stay reversible).
179
+ */
180
+ readonly FORM_VALUE_UNSUPPORTED: "OEIR_GENERATED_ELEMENT_FORM_VALUE_UNSUPPORTED";
181
+ /**
182
+ * The sidecar's `ssr` cannot be read as one boolean literal (a dynamic value
183
+ * or a duplicate key). Only the EXPLICIT literal `false` is the client-only
184
+ * fact; `true` and an absent key are the same case, so a value this reader
185
+ * cannot prove must refuse instead of guessing the delivery phase.
186
+ */
187
+ readonly SSR_INVALID: "OEIR_GENERATED_ELEMENT_SSR_INVALID";
188
+ /**
189
+ * A client-only island declares `styles`, but no static `.css` specifier
190
+ * reached the emitter. A client-only island has no DSD template to carry the
191
+ * marked `<link>`, so the sheet can only arrive through a real module-graph
192
+ * import; emitting the descriptor without one would render unstyled. This is
193
+ * the build-time half of the shim #24 failure closure, kept by the client
194
+ * style slice.
195
+ */
196
+ readonly CLIENT_STYLES_UNWIRED: "OEIR_GENERATED_ELEMENT_CLIENT_STYLES_UNWIRED";
197
+ /** The appended tail did not parse (an emitter invariant, not author input). */
198
+ readonly INVALID_ARTIFACT: "OEIR_GENERATED_ELEMENT_INVALID_ARTIFACT";
199
+ };
200
+ declare const GENERATED_ELEMENT_IMPORT_CLASSIFIER: ImportClassifier;
201
+ //#endregion
@@ -0,0 +1,147 @@
1
+ //#region src/internal/compiler/semantic-ir/generated-element/contract.ts
2
+ /**
3
+ * The internal shell specifier the emitted CE module imports.
4
+ *
5
+ * Deliberately NOT a package `exports` subpath in M09-1a: the directory is
6
+ * still excluded from `@openelement/element`'s packed `files` set, and the
7
+ * compiler lane has no production caller. M09-1b deletes the exclusion, adds
8
+ * the export subpath, and points the emitted module at the exported spelling.
9
+ * Source-level M09-1a tests alias this specifier to the workspace source; the
10
+ * unresolved spelling cannot reach a real build because no production host
11
+ * passes a site fact yet.
12
+ */
13
+ const GENERATED_ELEMENT_SHELL_SPECIFIER = "@openelement/element/internal/compiled/generated-element/shell";
14
+ /**
15
+ * The internal diagnostic codes this lane can raise. They follow the shell's
16
+ * `OEIR_*` convention and are deliberately absent from the public error
17
+ * catalogue and the interface snapshot.
18
+ */
19
+ const GENERATED_ELEMENT_DIAGNOSTIC = {
20
+ /** A site module default-exports a function that is not an admitted component. */
21
+ NOT_A_COMPONENT: "OEIR_GENERATED_ELEMENT_NOT_A_COMPONENT",
22
+ /** The root component takes a props parameter; M09-1a cannot declare attributes. */
23
+ UNDECLARED_PROPS: "OEIR_GENERATED_ELEMENT_UNDECLARED_PROPS",
24
+ /** The generated body reads `host.bindings[*]` and no binding source exists. */
25
+ UNBOUND_BINDING: "OEIR_GENERATED_ELEMENT_UNBOUND_BINDING",
26
+ /** A fixed CE-tail identifier already occurs in the leaf text. */
27
+ NAME_COLLISION: "OEIR_GENERATED_ELEMENT_NAME_COLLISION",
28
+ /** The host admitted the module but the island sidecar is absent. */
29
+ MISSING_SITE_MARKER: "OEIR_GENERATED_ELEMENT_MISSING_SITE_MARKER",
30
+ /**
31
+ * The sidecar's `root` cannot be read as one of `'light' | 'shadow'`
32
+ * (a dynamic value, another literal, a duplicate key, or a config object
33
+ * whose key set is not static). The router scanner's `ISLAND_METADATA_ERROR`
34
+ * remains the author-facing authority; this code is the lane's own
35
+ * fail-closed verdict inside the compiler.
36
+ */
37
+ ROOT_INVALID: "OEIR_GENERATED_ELEMENT_ROOT_INVALID",
38
+ /**
39
+ * The sidecar's `delegatesFocus` cannot be read as one boolean literal (a
40
+ * dynamic value, a duplicate key, or a config object whose key set is not
41
+ * static). Like `ROOT_INVALID`, this is the lane's fail-closed verdict; the
42
+ * router scanner's `ISLAND_METADATA_ERROR` remains the author-facing
43
+ * authority and the two readers are held together by the seam drift guard.
44
+ */
45
+ DELEGATES_FOCUS_INVALID: "OEIR_GENERATED_ELEMENT_DELEGATES_FOCUS_INVALID",
46
+ /**
47
+ * The sidecar declares `delegatesFocus: true` without `root: 'shadow'`. A
48
+ * light root has no shadow boundary to delegate focus through; the shell's
49
+ * descriptor validation refuses the pair too, so the lane refuses before a
50
+ * module exists instead of shipping a class that throws on evaluation.
51
+ */
52
+ DELEGATES_FOCUS_WITHOUT_SHADOW: "OEIR_GENERATED_ELEMENT_DELEGATES_FOCUS_WITHOUT_SHADOW",
53
+ /**
54
+ * The root component's props parameter cannot be read as a typed primitive
55
+ * member list: no annotation, a destructured/rest parameter, an imported or
56
+ * generic type, a non-property member, an optional member or a non-primitive
57
+ * member type. The generated element's props record is a fixed
58
+ * string/number/boolean table; anything it cannot express fails closed
59
+ * instead of being silently dropped from the attribute channel.
60
+ */
61
+ PROPS_TYPE_UNSUPPORTED: "OEIR_GENERATED_ELEMENT_PROPS_TYPE_UNSUPPORTED",
62
+ /**
63
+ * The sidecar `properties` table and the typed props member list disagree
64
+ * (a declared key with no typed member or a typed member with no entry, or a
65
+ * declaration without a props parameter). The two declarations are
66
+ * cross-checked, never inferred one from the other.
67
+ */
68
+ PROPERTY_MISMATCH: "OEIR_GENERATED_ELEMENT_PROPERTY_MISMATCH",
69
+ /**
70
+ * One sidecar property entry is not representable: an unknown option, a
71
+ * non-literal default, an unsafe attribute name, a duplicate attribute, a
72
+ * reflected property with no attribute channel, a reserved lifecycle name, or
73
+ * a default whose literal type does not match the typed member.
74
+ */
75
+ PROPERTY_INVALID: "OEIR_GENERATED_ELEMENT_PROPERTY_INVALID",
76
+ /** The sidecar's `formAssociated` is not one boolean literal. */
77
+ FORM_ASSOCIATED_INVALID: "OEIR_GENERATED_ELEMENT_FORM_ASSOCIATED_INVALID",
78
+ /**
79
+ * The sidecar's `tag` is not one static string literal, or it is not a valid
80
+ * custom-element name. The lane refuses rather than admitting a module whose
81
+ * identity it cannot prove: the tag is the one host fact the compiler cannot
82
+ * derive, so a dynamic or malformed spelling would either admit the wrong
83
+ * module or register a name the platform rejects.
84
+ */
85
+ TAG_INVALID: "OEIR_GENERATED_ELEMENT_TAG_INVALID",
86
+ /**
87
+ * The form-associated declaration cannot be mapped to the bounded mechanics:
88
+ * no declared string `value` property, a non-boolean `required`/`disabled`,
89
+ * or a reflected `disabled` row (the fieldset state must stay reversible).
90
+ */
91
+ FORM_VALUE_UNSUPPORTED: "OEIR_GENERATED_ELEMENT_FORM_VALUE_UNSUPPORTED",
92
+ /**
93
+ * The sidecar's `ssr` cannot be read as one boolean literal (a dynamic value
94
+ * or a duplicate key). Only the EXPLICIT literal `false` is the client-only
95
+ * fact; `true` and an absent key are the same case, so a value this reader
96
+ * cannot prove must refuse instead of guessing the delivery phase.
97
+ */
98
+ SSR_INVALID: "OEIR_GENERATED_ELEMENT_SSR_INVALID",
99
+ /**
100
+ * A client-only island declares `styles`, but no static `.css` specifier
101
+ * reached the emitter. A client-only island has no DSD template to carry the
102
+ * marked `<link>`, so the sheet can only arrive through a real module-graph
103
+ * import; emitting the descriptor without one would render unstyled. This is
104
+ * the build-time half of the shim #24 failure closure, kept by the client
105
+ * style slice.
106
+ */
107
+ CLIENT_STYLES_UNWIRED: "OEIR_GENERATED_ELEMENT_CLIENT_STYLES_UNWIRED",
108
+ /** The appended tail did not parse (an emitter invariant, not author input). */
109
+ INVALID_ARTIFACT: "OEIR_GENERATED_ELEMENT_INVALID_ARTIFACT"
110
+ };
111
+ /**
112
+ * The function lane's import classifier: the canonical core factories the
113
+ * function grammar knows. The class lane's `CORE_VOCABULARY` has no `signal`
114
+ * entry, and the function frontend had no production caller before this lane
115
+ * (R12), so an omitted classifier would turn known factories into incidental
116
+ * refusals. Only the two factory names the function grammar admits are named;
117
+ * every other import stays host-classified by the caller.
118
+ */
119
+ /**
120
+ * The two specifiers that name the same factory/intrinsic symbols. The
121
+ * tree-shakeable `/lifecycle` subpath re-exports the identical functions, so it
122
+ * classifies identically — a consumer imported from either spelling is a real
123
+ * signal, and the tracked-slot dependency rule must not depend on which one the
124
+ * author happened to use.
125
+ */
126
+ const FACTORY_SPECIFIERS = /* @__PURE__ */ new Set(["@openelement/element", "@openelement/element/lifecycle"]);
127
+ const GENERATED_ELEMENT_IMPORT_CLASSIFIER = {
128
+ classifySymbol: (specifier, importedName) => {
129
+ if (!FACTORY_SPECIFIERS.has(specifier)) return void 0;
130
+ if (importedName === "signal" || importedName === "computed") return "factory";
131
+ if (importedName === "useContext") return "factory";
132
+ return "value";
133
+ },
134
+ classifyValue: (specifier, importedName) => {
135
+ if (importedName === null) return void 0;
136
+ if (FACTORY_SPECIFIERS.has(specifier)) return void 0;
137
+ return "plain";
138
+ },
139
+ classifyCall: (specifier, importedName) => {
140
+ if (!FACTORY_SPECIFIERS.has(specifier)) return void 0;
141
+ if (importedName === "signal") return { call: "signal" };
142
+ if (importedName === "computed") return { call: "computed" };
143
+ if (importedName === "useContext") return { call: "signal" };
144
+ }
145
+ };
146
+ //#endregion
147
+ export { GENERATED_ELEMENT_DIAGNOSTIC, GENERATED_ELEMENT_IMPORT_CLASSIFIER, GENERATED_ELEMENT_SHELL_SPECIFIER };