@tamagui/compiler-core 0.0.0-bootstrap.0 → 3.0.0-beta.643.1

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 (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -1
  3. package/dist/cjs/ast.cjs +95 -0
  4. package/dist/cjs/contracts.cjs +62 -0
  5. package/dist/cjs/diagnostics.cjs +69 -0
  6. package/dist/cjs/evaluate.cjs +351 -0
  7. package/dist/cjs/graph.cjs +279 -0
  8. package/dist/cjs/hash.cjs +49 -0
  9. package/dist/cjs/index.cjs +44 -0
  10. package/dist/cjs/ir.cjs +33 -0
  11. package/dist/cjs/lower.cjs +225 -0
  12. package/dist/cjs/materialize.cjs +200 -0
  13. package/dist/cjs/normalize.cjs +622 -0
  14. package/dist/cjs/output.cjs +149 -0
  15. package/dist/cjs/planCache.cjs +224 -0
  16. package/dist/cjs/session.cjs +119 -0
  17. package/dist/cjs/yuku.cjs +159 -0
  18. package/dist/cjs/zero.cjs +387 -0
  19. package/dist/esm/ast.mjs +65 -0
  20. package/dist/esm/ast.mjs.map +1 -0
  21. package/dist/esm/contracts.mjs +34 -0
  22. package/dist/esm/contracts.mjs.map +1 -0
  23. package/dist/esm/diagnostics.mjs +44 -0
  24. package/dist/esm/diagnostics.mjs.map +1 -0
  25. package/dist/esm/evaluate.mjs +327 -0
  26. package/dist/esm/evaluate.mjs.map +1 -0
  27. package/dist/esm/graph.mjs +256 -0
  28. package/dist/esm/graph.mjs.map +1 -0
  29. package/dist/esm/hash.mjs +26 -0
  30. package/dist/esm/hash.mjs.map +1 -0
  31. package/dist/esm/index.mjs +30 -0
  32. package/dist/esm/ir.mjs +12 -0
  33. package/dist/esm/ir.mjs.map +1 -0
  34. package/dist/esm/lower.mjs +202 -0
  35. package/dist/esm/lower.mjs.map +1 -0
  36. package/dist/esm/materialize.mjs +179 -0
  37. package/dist/esm/materialize.mjs.map +1 -0
  38. package/dist/esm/normalize.mjs +596 -0
  39. package/dist/esm/normalize.mjs.map +1 -0
  40. package/dist/esm/output.mjs +119 -0
  41. package/dist/esm/output.mjs.map +1 -0
  42. package/dist/esm/planCache.mjs +194 -0
  43. package/dist/esm/planCache.mjs.map +1 -0
  44. package/dist/esm/session.mjs +99 -0
  45. package/dist/esm/session.mjs.map +1 -0
  46. package/dist/esm/yuku.mjs +136 -0
  47. package/dist/esm/yuku.mjs.map +1 -0
  48. package/dist/esm/zero.mjs +352 -0
  49. package/dist/esm/zero.mjs.map +1 -0
  50. package/package.json +42 -4
  51. package/src/ast.ts +86 -0
  52. package/src/contracts.ts +148 -0
  53. package/src/diagnostics.ts +96 -0
  54. package/src/evaluate.ts +497 -0
  55. package/src/graph.ts +347 -0
  56. package/src/hash.ts +36 -0
  57. package/src/index.ts +15 -0
  58. package/src/ir.ts +154 -0
  59. package/src/lower.ts +418 -0
  60. package/src/materialize.ts +330 -0
  61. package/src/normalize.ts +846 -0
  62. package/src/output.ts +175 -0
  63. package/src/planCache.ts +327 -0
  64. package/src/session.ts +172 -0
  65. package/src/yuku.ts +189 -0
  66. package/src/zero.ts +598 -0
  67. package/types/ast.d.ts +10 -0
  68. package/types/ast.d.ts.map +1 -0
  69. package/types/contracts.d.ts +97 -0
  70. package/types/contracts.d.ts.map +1 -0
  71. package/types/diagnostics.d.ts +31 -0
  72. package/types/diagnostics.d.ts.map +1 -0
  73. package/types/evaluate.d.ts +36 -0
  74. package/types/evaluate.d.ts.map +1 -0
  75. package/types/graph.d.ts +37 -0
  76. package/types/graph.d.ts.map +1 -0
  77. package/types/hash.d.ts +8 -0
  78. package/types/hash.d.ts.map +1 -0
  79. package/types/index.d.ts +16 -0
  80. package/types/index.d.ts.map +1 -0
  81. package/types/ir.d.ts +118 -0
  82. package/types/ir.d.ts.map +1 -0
  83. package/types/lower.d.ts +99 -0
  84. package/types/lower.d.ts.map +1 -0
  85. package/types/materialize.d.ts +104 -0
  86. package/types/materialize.d.ts.map +1 -0
  87. package/types/normalize.d.ts +8 -0
  88. package/types/normalize.d.ts.map +1 -0
  89. package/types/output.d.ts +32 -0
  90. package/types/output.d.ts.map +1 -0
  91. package/types/planCache.d.ts +113 -0
  92. package/types/planCache.d.ts.map +1 -0
  93. package/types/session.d.ts +44 -0
  94. package/types/session.d.ts.map +1 -0
  95. package/types/yuku.d.ts +4 -0
  96. package/types/yuku.d.ts.map +1 -0
  97. package/types/zero.d.ts +98 -0
  98. package/types/zero.d.ts.map +1 -0
@@ -0,0 +1,26 @@
1
+ import { createHash } from "node:crypto";
2
+
3
+ function contentHash(value) {
4
+ return createHash("sha256").update(value).digest("hex");
5
+ }
6
+ function compareCodeUnits(left, right) {
7
+ return left < right ? -1 : left > right ? 1 : 0;
8
+ }
9
+ function stringify(value) {
10
+ if (Array.isArray(value)) {
11
+ return `[${value.map((child) => stringify(child) ?? "null").join(",")}]`;
12
+ }
13
+ if (value && typeof value === "object") {
14
+ const entries = Object.entries(value).sort(([left], [right]) => compareCodeUnits(left, right)).map(([key, child]) => [key, stringify(child)]).filter((entry) => entry[1] !== void 0);
15
+ return `{${entries.map(([key, child]) => `${JSON.stringify(key)}:${child}`).join(",")}}`;
16
+ }
17
+ return JSON.stringify(value);
18
+ }
19
+ function stableStringify(value) {
20
+ const serialized = stringify(value);
21
+ if (serialized === void 0) throw new Error("Cannot serialize undefined cache root");
22
+ return serialized;
23
+ }
24
+
25
+ export { contentHash, stableStringify };
26
+ //# sourceMappingURL=hash.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.js","names":[],"sources":["esm/hash.js"],"sourcesContent":["import { createHash } from \"node:crypto\";\nfunction contentHash(value) {\n return createHash(\"sha256\").update(value).digest(\"hex\");\n}\nfunction compareCodeUnits(left, right) {\n return left < right ? -1 : left > right ? 1 : 0;\n}\nfunction stringify(value) {\n if (Array.isArray(value)) {\n return `[${value.map((child) => stringify(child) ?? \"null\").join(\",\")}]`;\n }\n if (value && typeof value === \"object\") {\n const entries = Object.entries(value).sort(([left], [right]) => compareCodeUnits(left, right)).map(([key, child]) => [key, stringify(child)]).filter((entry) => entry[1] !== void 0);\n return `{${entries.map(([key, child]) => `${JSON.stringify(key)}:${child}`).join(\",\")}}`;\n }\n return JSON.stringify(value);\n}\nfunction stableStringify(value) {\n const serialized = stringify(value);\n if (serialized === void 0) throw new Error(\"Cannot serialize undefined cache root\");\n return serialized;\n}\nexport {\n contentHash,\n stableStringify\n};\n//# sourceMappingURL=hash.js.map\n"],"mappings":";;;AACA,SAAS,YAAY,OAAO;CAC1B,OAAO,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AACxD;AACA,SAAS,iBAAiB,MAAM,OAAO;CACrC,OAAO,OAAO,QAAQ,CAAC,IAAI,OAAO,QAAQ,IAAI;AAChD;AACA,SAAS,UAAU,OAAO;CACxB,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,OAAO,IAAI,MAAM,KAAK,UAAU,UAAU,KAAK,KAAK,MAAM,EAAE,KAAK,GAAG,EAAE;CACxE;CACA,IAAI,SAAS,OAAO,UAAU,UAAU;EACtC,MAAM,UAAU,OAAO,QAAQ,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW,iBAAiB,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,UAAU,KAAK,CAAC,CAAC,EAAE,QAAQ,UAAU,MAAM,OAAO,KAAK,CAAC;EACnL,OAAO,IAAI,QAAQ,KAAK,CAAC,KAAK,WAAW,GAAG,KAAK,UAAU,GAAG,EAAE,GAAG,OAAO,EAAE,KAAK,GAAG,EAAE;CACxF;CACA,OAAO,KAAK,UAAU,KAAK;AAC7B;AACA,SAAS,gBAAgB,OAAO;CAC9B,MAAM,aAAa,UAAU,KAAK;CAClC,IAAI,eAAe,KAAK,GAAG,MAAM,IAAI,MAAM,uCAAuC;CAClF,OAAO;AACT"}
@@ -0,0 +1,30 @@
1
+ import { normalizeElements } from "./normalize.mjs";
2
+ import { parseModuleAst, yukuFactory } from "./yuku.mjs";
3
+
4
+ export * from "./ast.mjs"
5
+
6
+ export * from "./contracts.mjs"
7
+
8
+ export * from "./diagnostics.mjs"
9
+
10
+ export * from "./evaluate.mjs"
11
+
12
+ export * from "./graph.mjs"
13
+
14
+ export * from "./hash.mjs"
15
+
16
+ export * from "./ir.mjs"
17
+
18
+ export * from "./lower.mjs"
19
+
20
+ export * from "./materialize.mjs"
21
+
22
+ export * from "./output.mjs"
23
+
24
+ export * from "./planCache.mjs"
25
+
26
+ export * from "./session.mjs"
27
+
28
+ export * from "./zero.mjs"
29
+
30
+ export { normalizeElements, parseModuleAst, yukuFactory };
@@ -0,0 +1,12 @@
1
+ function hostImportProvenance(imports, specifier, importedName) {
2
+ const resolution = imports.find((candidate) => candidate.specifier === specifier);
3
+ return resolution ? {
4
+ specifier,
5
+ importedName,
6
+ resolvedId: resolution.resolvedId,
7
+ external: resolution.external === true
8
+ } : null;
9
+ }
10
+
11
+ export { hostImportProvenance };
12
+ //# sourceMappingURL=ir.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ir.js","names":[],"sources":["esm/ir.js"],"sourcesContent":["function hostImportProvenance(imports, specifier, importedName) {\n const resolution = imports.find((candidate) => candidate.specifier === specifier);\n return resolution ? {\n specifier,\n importedName,\n resolvedId: resolution.resolvedId,\n external: resolution.external === true\n } : null;\n}\nexport {\n hostImportProvenance\n};\n//# sourceMappingURL=ir.js.map\n"],"mappings":";AAAA,SAAS,qBAAqB,SAAS,WAAW,cAAc;CAC9D,MAAM,aAAa,QAAQ,MAAM,cAAc,UAAU,cAAc,SAAS;CAChF,OAAO,aAAa;EAClB;EACA;EACA,YAAY,WAAW;EACvB,UAAU,WAAW,aAAa;CACpC,IAAI;AACN"}
@@ -0,0 +1,202 @@
1
+ import { localBailout } from "./diagnostics.mjs";
2
+ import { sourceContentHash, validateSourceEdits } from "./output.mjs";
3
+
4
+ const LOWERED_MODULE_PLAN_VERSION = 2;
5
+ function compareCodeUnits(left, right) {
6
+ return left < right ? -1 : left > right ? 1 : 0;
7
+ }
8
+ function blocking(reason) {
9
+ return {
10
+ ...reason,
11
+ blocking: true
12
+ };
13
+ }
14
+ function diagnostic(code, element, message, prop) {
15
+ return {
16
+ ...localBailout(code, element.span, message),
17
+ component: element.component.name,
18
+ specifier: element.component.provenance?.specifier,
19
+ prop
20
+ };
21
+ }
22
+ function styledDefinitionFor(module, element) {
23
+ const definition = element.component.definition;
24
+ if (!definition) return null;
25
+ return module.styledDefinitions.find((candidate) => candidate.id === definition.id && candidate.name === definition.name) ?? null;
26
+ }
27
+ function unsafeEntry(element, entry, component, host) {
28
+ if (entry.kind === "spread" && entry.value.kind !== "static") {
29
+ return diagnostic("local/unsafe-style-spread", element, "Unevaluated spread may change style and duplicate-prop precedence");
30
+ }
31
+ if (entry.kind === "prop" && host.isStyleProp(entry.name, component) && (entry.value.kind === "bailout" || entry.value.kind === "conditional") && !host.canLowerDynamicStyleProp?.(entry.name, component, entry.value.kind)) {
32
+ return diagnostic("local/dynamic-style-value", element, `Style prop ${entry.name} could not be evaluated`, entry.name);
33
+ }
34
+ return null;
35
+ }
36
+ function editsAreCandidateLocal(element, edits) {
37
+ return edits.every((edit) => edit.origin.id === element.id && edit.start >= element.span.start && edit.end <= element.span.end);
38
+ }
39
+ function overlapsCommitted(edits, committed) {
40
+ return edits.some((edit) => committed.some((existing) => {
41
+ if (edit.start === edit.end) {
42
+ return edit.start > existing.start && edit.start < existing.end;
43
+ }
44
+ if (existing.start === existing.end) {
45
+ return existing.start > edit.start && existing.start < edit.end;
46
+ }
47
+ return edit.start < existing.end && existing.start < edit.end;
48
+ }));
49
+ }
50
+ function lowerModule({ module, source, target, host, options, structuralPass }) {
51
+ const stats = {
52
+ found: 0,
53
+ lowered: 0,
54
+ flattened: 0,
55
+ styled: 0,
56
+ bailed: 0
57
+ };
58
+ const structural = structuralPass ? structuralPass.transform({
59
+ module,
60
+ source,
61
+ target
62
+ }) : {
63
+ module,
64
+ edits: [],
65
+ imports: [],
66
+ diagnostics: [],
67
+ dependencies: []
68
+ };
69
+ if (structural.module.id !== module.id) {
70
+ throw new Error(`Structural pass changed module identity from ${module.id} to ${structural.module.id}`);
71
+ }
72
+ if (structuralPass && !structuralPass.versionHash) {
73
+ throw new Error("Structural pass must provide a non-empty version hash");
74
+ }
75
+ module = structural.module;
76
+ validateSourceEdits(source, structural.edits);
77
+ const edits = [...structural.edits];
78
+ const css = /* @__PURE__ */ new Set();
79
+ const diagnostics = [...module.diagnostics, ...structural.diagnostics];
80
+ const dependencies = /* @__PURE__ */ new Set([...module.dependencies, ...structural.dependencies]);
81
+ const imports = new Map(structural.imports.map((candidateImport) => [candidateImport.content, candidateImport]));
82
+ for (const element of module.elements) {
83
+ const styledDefinition = styledDefinitionFor(module, element);
84
+ const component = host.resolveComponent(element, styledDefinition);
85
+ if (!component) continue;
86
+ stats.found++;
87
+ const input = {
88
+ id: module.id,
89
+ source,
90
+ target,
91
+ module,
92
+ element,
93
+ styledDefinition,
94
+ component
95
+ };
96
+ const commitDevelopmentDebug = (result2) => {
97
+ const debugEdits = host.developmentDebugInstrumentation?.(input, result2);
98
+ if (!debugEdits) return;
99
+ validateSourceEdits(source, debugEdits);
100
+ if (!editsAreCandidateLocal(element, debugEdits) || overlapsCommitted(debugEdits, edits)) {
101
+ throw new Error("Development debug instrumentation must stay candidate-local");
102
+ }
103
+ edits.push(...debugEdits);
104
+ };
105
+ if (!element.complete || styledDefinition && !styledDefinition.complete) {
106
+ const reasons = [...element.bailouts.map(blocking), ...(styledDefinition?.bailouts ?? []).map(blocking)];
107
+ diagnostics.push(...reasons);
108
+ const reason = reasons[0];
109
+ if (reason) commitDevelopmentDebug({
110
+ ok: false,
111
+ bailout: reason
112
+ });
113
+ stats.bailed++;
114
+ continue;
115
+ }
116
+ const unsafe = element.entries.map((entry) => unsafeEntry(element, entry, component, host)).find((result2) => result2 !== null);
117
+ if (unsafe) {
118
+ diagnostics.push(blocking(unsafe));
119
+ commitDevelopmentDebug({
120
+ ok: false,
121
+ bailout: blocking(unsafe)
122
+ });
123
+ stats.bailed++;
124
+ continue;
125
+ }
126
+ let result;
127
+ try {
128
+ result = host.lowerCandidate(input);
129
+ } catch (error) {
130
+ result = {
131
+ ok: false,
132
+ bailout: diagnostic("local/style-resolution-failed", element, `Style resolution failed: ${error instanceof Error ? error.message : String(error)}`)
133
+ };
134
+ }
135
+ if (!result.ok) {
136
+ diagnostics.push(blocking(result.bailout));
137
+ commitDevelopmentDebug(result);
138
+ stats.bailed++;
139
+ continue;
140
+ }
141
+ try {
142
+ validateSourceEdits(source, result.edits);
143
+ } catch (error) {
144
+ const reason = blocking(diagnostic("local/overlapping-edit", element, error instanceof Error ? error.message : String(error)));
145
+ diagnostics.push(reason);
146
+ commitDevelopmentDebug({
147
+ ok: false,
148
+ bailout: reason
149
+ });
150
+ stats.bailed++;
151
+ continue;
152
+ }
153
+ if (!editsAreCandidateLocal(element, result.edits) || overlapsCommitted(result.edits, edits)) {
154
+ const reason = blocking(diagnostic("local/overlapping-edit", element, "Candidate edits overlap another candidate or escape the element span"));
155
+ diagnostics.push(reason);
156
+ commitDevelopmentDebug({
157
+ ok: false,
158
+ bailout: reason
159
+ });
160
+ stats.bailed++;
161
+ continue;
162
+ }
163
+ diagnostics.push(...result.diagnostics ?? []);
164
+ edits.push(...result.edits);
165
+ commitDevelopmentDebug(result);
166
+ for (const rule of result.css) css.add(rule);
167
+ for (const candidateImport of result.imports) {
168
+ if (!imports.has(candidateImport.content)) {
169
+ imports.set(candidateImport.content, candidateImport);
170
+ }
171
+ }
172
+ for (const dependency of result.dependencies ?? []) dependencies.add(dependency);
173
+ stats.lowered++;
174
+ if (result.flattened) stats.flattened++;
175
+ if (styledDefinition) stats.styled++;
176
+ }
177
+ for (const candidateImport of imports.values()) {
178
+ edits.push({
179
+ start: source.length,
180
+ end: source.length,
181
+ content: candidateImport.content,
182
+ origin: candidateImport.origin
183
+ });
184
+ }
185
+ return {
186
+ version: 2,
187
+ id: module.id,
188
+ target,
189
+ inputHash: module.inputHash,
190
+ sourceHash: sourceContentHash(source),
191
+ projectGeneration: options.projectGeneration,
192
+ structuralPassHash: structuralPass?.versionHash ?? `${target}-noop-v1`,
193
+ edits,
194
+ css: [...css].join(""),
195
+ diagnostics,
196
+ dependencies: [...dependencies].sort(compareCodeUnits),
197
+ stats
198
+ };
199
+ }
200
+
201
+ export { LOWERED_MODULE_PLAN_VERSION, lowerModule };
202
+ //# sourceMappingURL=lower.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lower.js","names":[],"sources":["esm/lower.js"],"sourcesContent":["import { localBailout } from \"./diagnostics\";\nimport {\n sourceContentHash,\n validateSourceEdits\n} from \"./output\";\nconst LOWERED_MODULE_PLAN_VERSION = 2;\nfunction compareCodeUnits(left, right) {\n return left < right ? -1 : left > right ? 1 : 0;\n}\nfunction blocking(reason) {\n return { ...reason, blocking: true };\n}\nfunction diagnostic(code, element, message, prop) {\n return {\n ...localBailout(code, element.span, message),\n component: element.component.name,\n specifier: element.component.provenance?.specifier,\n prop\n };\n}\nfunction styledDefinitionFor(module, element) {\n const definition = element.component.definition;\n if (!definition) return null;\n return module.styledDefinitions.find(\n (candidate) => candidate.id === definition.id && candidate.name === definition.name\n ) ?? null;\n}\nfunction unsafeEntry(element, entry, component, host) {\n if (entry.kind === \"spread\" && entry.value.kind !== \"static\") {\n return diagnostic(\n \"local/unsafe-style-spread\",\n element,\n \"Unevaluated spread may change style and duplicate-prop precedence\"\n );\n }\n if (entry.kind === \"prop\" && host.isStyleProp(entry.name, component) && (entry.value.kind === \"bailout\" || entry.value.kind === \"conditional\") && !host.canLowerDynamicStyleProp?.(entry.name, component, entry.value.kind)) {\n return diagnostic(\n \"local/dynamic-style-value\",\n element,\n `Style prop ${entry.name} could not be evaluated`,\n entry.name\n );\n }\n return null;\n}\nfunction editsAreCandidateLocal(element, edits) {\n return edits.every(\n (edit) => edit.origin.id === element.id && edit.start >= element.span.start && edit.end <= element.span.end\n );\n}\nfunction overlapsCommitted(edits, committed) {\n return edits.some(\n (edit) => committed.some((existing) => {\n if (edit.start === edit.end) {\n return edit.start > existing.start && edit.start < existing.end;\n }\n if (existing.start === existing.end) {\n return existing.start > edit.start && existing.start < edit.end;\n }\n return edit.start < existing.end && existing.start < edit.end;\n })\n );\n}\nfunction lowerModule({\n module,\n source,\n target,\n host,\n options,\n structuralPass\n}) {\n const stats = {\n found: 0,\n lowered: 0,\n flattened: 0,\n styled: 0,\n bailed: 0\n };\n const structural = structuralPass ? structuralPass.transform({ module, source, target }) : {\n module,\n edits: [],\n imports: [],\n diagnostics: [],\n dependencies: []\n };\n if (structural.module.id !== module.id) {\n throw new Error(\n `Structural pass changed module identity from ${module.id} to ${structural.module.id}`\n );\n }\n if (structuralPass && !structuralPass.versionHash) {\n throw new Error(\"Structural pass must provide a non-empty version hash\");\n }\n module = structural.module;\n validateSourceEdits(source, structural.edits);\n const edits = [...structural.edits];\n const css = /* @__PURE__ */ new Set();\n const diagnostics = [...module.diagnostics, ...structural.diagnostics];\n const dependencies = /* @__PURE__ */ new Set([...module.dependencies, ...structural.dependencies]);\n const imports = new Map(\n structural.imports.map((candidateImport) => [\n candidateImport.content,\n candidateImport\n ])\n );\n for (const element of module.elements) {\n const styledDefinition = styledDefinitionFor(module, element);\n const component = host.resolveComponent(element, styledDefinition);\n if (!component) continue;\n stats.found++;\n const input = {\n id: module.id,\n source,\n target,\n module,\n element,\n styledDefinition,\n component\n };\n const commitDevelopmentDebug = (result2) => {\n const debugEdits = host.developmentDebugInstrumentation?.(input, result2);\n if (!debugEdits) return;\n validateSourceEdits(source, debugEdits);\n if (!editsAreCandidateLocal(element, debugEdits) || overlapsCommitted(debugEdits, edits)) {\n throw new Error(\"Development debug instrumentation must stay candidate-local\");\n }\n edits.push(...debugEdits);\n };\n if (!element.complete || styledDefinition && !styledDefinition.complete) {\n const reasons = [\n ...element.bailouts.map(blocking),\n ...(styledDefinition?.bailouts ?? []).map(blocking)\n ];\n diagnostics.push(...reasons);\n const reason = reasons[0];\n if (reason) commitDevelopmentDebug({ ok: false, bailout: reason });\n stats.bailed++;\n continue;\n }\n const unsafe = element.entries.map((entry) => unsafeEntry(element, entry, component, host)).find((result2) => result2 !== null);\n if (unsafe) {\n diagnostics.push(blocking(unsafe));\n commitDevelopmentDebug({ ok: false, bailout: blocking(unsafe) });\n stats.bailed++;\n continue;\n }\n let result;\n try {\n result = host.lowerCandidate(input);\n } catch (error) {\n result = {\n ok: false,\n bailout: diagnostic(\n \"local/style-resolution-failed\",\n element,\n `Style resolution failed: ${error instanceof Error ? error.message : String(error)}`\n )\n };\n }\n if (!result.ok) {\n diagnostics.push(blocking(result.bailout));\n commitDevelopmentDebug(result);\n stats.bailed++;\n continue;\n }\n try {\n validateSourceEdits(source, result.edits);\n } catch (error) {\n const reason = blocking(\n diagnostic(\n \"local/overlapping-edit\",\n element,\n error instanceof Error ? error.message : String(error)\n )\n );\n diagnostics.push(reason);\n commitDevelopmentDebug({ ok: false, bailout: reason });\n stats.bailed++;\n continue;\n }\n if (!editsAreCandidateLocal(element, result.edits) || overlapsCommitted(result.edits, edits)) {\n const reason = blocking(\n diagnostic(\n \"local/overlapping-edit\",\n element,\n \"Candidate edits overlap another candidate or escape the element span\"\n )\n );\n diagnostics.push(reason);\n commitDevelopmentDebug({ ok: false, bailout: reason });\n stats.bailed++;\n continue;\n }\n diagnostics.push(...result.diagnostics ?? []);\n edits.push(...result.edits);\n commitDevelopmentDebug(result);\n for (const rule of result.css) css.add(rule);\n for (const candidateImport of result.imports) {\n if (!imports.has(candidateImport.content)) {\n imports.set(candidateImport.content, candidateImport);\n }\n }\n for (const dependency of result.dependencies ?? []) dependencies.add(dependency);\n stats.lowered++;\n if (result.flattened) stats.flattened++;\n if (styledDefinition) stats.styled++;\n }\n for (const candidateImport of imports.values()) {\n edits.push({\n start: source.length,\n end: source.length,\n content: candidateImport.content,\n origin: candidateImport.origin\n });\n }\n return {\n version: LOWERED_MODULE_PLAN_VERSION,\n id: module.id,\n target,\n inputHash: module.inputHash,\n sourceHash: sourceContentHash(source),\n projectGeneration: options.projectGeneration,\n structuralPassHash: structuralPass?.versionHash ?? `${target}-noop-v1`,\n edits,\n css: [...css].join(\"\"),\n diagnostics,\n dependencies: [...dependencies].sort(compareCodeUnits),\n stats\n };\n}\nexport {\n LOWERED_MODULE_PLAN_VERSION,\n lowerModule\n};\n//# sourceMappingURL=lower.js.map\n"],"mappings":";;;;AAKA,MAAM,8BAA8B;AACpC,SAAS,iBAAiB,MAAM,OAAO;CACrC,OAAO,OAAO,QAAQ,CAAC,IAAI,OAAO,QAAQ,IAAI;AAChD;AACA,SAAS,SAAS,QAAQ;CACxB,OAAO;EAAE,GAAG;EAAQ,UAAU;CAAK;AACrC;AACA,SAAS,WAAW,MAAM,SAAS,SAAS,MAAM;CAChD,OAAO;EACL,GAAG,aAAa,MAAM,QAAQ,MAAM,OAAO;EAC3C,WAAW,QAAQ,UAAU;EAC7B,WAAW,QAAQ,UAAU,YAAY;EACzC;CACF;AACF;AACA,SAAS,oBAAoB,QAAQ,SAAS;CAC5C,MAAM,aAAa,QAAQ,UAAU;CACrC,IAAI,CAAC,YAAY,OAAO;CACxB,OAAO,OAAO,kBAAkB,MAC7B,cAAc,UAAU,OAAO,WAAW,MAAM,UAAU,SAAS,WAAW,IACjF,KAAK;AACP;AACA,SAAS,YAAY,SAAS,OAAO,WAAW,MAAM;CACpD,IAAI,MAAM,SAAS,YAAY,MAAM,MAAM,SAAS,UAAU;EAC5D,OAAO,WACL,6BACA,SACA,mEACF;CACF;CACA,IAAI,MAAM,SAAS,UAAU,KAAK,YAAY,MAAM,MAAM,SAAS,MAAM,MAAM,MAAM,SAAS,aAAa,MAAM,MAAM,SAAS,kBAAkB,CAAC,KAAK,2BAA2B,MAAM,MAAM,WAAW,MAAM,MAAM,IAAI,GAAG;EAC3N,OAAO,WACL,6BACA,SACA,cAAc,MAAM,KAAK,0BACzB,MAAM,IACR;CACF;CACA,OAAO;AACT;A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M,KAAK;GACT,OAAO,OAAO;GACd,KAAK,OAAO;GACZ,SAAS,gBAAgB;GACzB,QAAQ,gBAAgB;EAC1B,CAAC;CACH;CACA,OAAO;EACL;EACA,IAAI,OAAO;EACX;EACA,WAAW,OAAO;EAClB,YAAY,kBAAkB,MAAM;EACpC,mBAAmB,QAAQ;EAC3B,oBAAoB,gBAAgB,eAAe,GAAG,OAAO;EAC7D;EACA,KAAK,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE;EACrB;EACA,cAAc,CAAC,GAAG,YAAY,EAAE,KAAK,gBAAgB;EACrD;CACF;AACF"}
@@ -0,0 +1,179 @@
1
+ function compareCodeUnits(left, right) {
2
+ return left < right ? -1 : left > right ? 1 : 0;
3
+ }
4
+ function materializeValue(graph, value) {
5
+ if (value.kind === "static") {
6
+ return {
7
+ kind: "static",
8
+ value: value.value,
9
+ dependencies: [],
10
+ span: value.span,
11
+ literalOrigin: true
12
+ };
13
+ }
14
+ if (value.kind === "dom-style") {
15
+ return {
16
+ kind: "dom-style",
17
+ span: value.span,
18
+ items: value.items.map((item) => ({
19
+ condition: item.condition,
20
+ value: materializeValue(graph, item.value)
21
+ }))
22
+ };
23
+ }
24
+ const result = graph.evaluate(value);
25
+ if (result.ok) {
26
+ return {
27
+ kind: "static",
28
+ value: result.value,
29
+ dependencies: result.dependencies,
30
+ span: value
31
+ };
32
+ }
33
+ const conditional = graph.evaluateConditional(value);
34
+ if (conditional) {
35
+ return {
36
+ kind: "conditional",
37
+ test: conditional.test,
38
+ whenTrue: conditional.whenTrue.value,
39
+ whenFalse: conditional.whenFalse.value,
40
+ dependencies: [.../* @__PURE__ */ new Set([...conditional.whenTrue.dependencies, ...conditional.whenFalse.dependencies])].sort(compareCodeUnits),
41
+ bailout: result.bailout,
42
+ span: value
43
+ };
44
+ }
45
+ return {
46
+ kind: "bailout",
47
+ bailout: result.bailout,
48
+ span: value
49
+ };
50
+ }
51
+ function materializeEntry(graph, entry) {
52
+ if (entry.kind === "prop") {
53
+ return {
54
+ kind: entry.kind,
55
+ name: entry.name,
56
+ span: entry.span,
57
+ value: materializeValue(graph, entry.value)
58
+ };
59
+ }
60
+ if (entry.kind === "spread") {
61
+ return {
62
+ kind: entry.kind,
63
+ span: entry.span,
64
+ value: materializeValue(graph, entry.value)
65
+ };
66
+ }
67
+ if (entry.value.kind === "element" || entry.value.kind === "empty") {
68
+ return {
69
+ kind: entry.kind,
70
+ span: entry.span,
71
+ value: entry.value
72
+ };
73
+ }
74
+ return {
75
+ kind: entry.kind,
76
+ span: entry.span,
77
+ value: materializeValue(graph, entry.value)
78
+ };
79
+ }
80
+ function materializeElement(graph, element) {
81
+ const entries = element.complete ? element.entries : element.bailedEntries;
82
+ return {
83
+ kind: element.kind,
84
+ form: element.form,
85
+ id: element.id,
86
+ span: element.span,
87
+ propsSpan: element.propsSpan,
88
+ component: element.component,
89
+ complete: element.complete,
90
+ entries: entries.map((entry) => materializeEntry(graph, entry)),
91
+ bailouts: [...element.bailouts]
92
+ };
93
+ }
94
+ function materializeStyledDefinition(graph, definition) {
95
+ return {
96
+ kind: definition.kind,
97
+ id: definition.id,
98
+ name: definition.name,
99
+ span: definition.span,
100
+ definitionSpan: definition.definitionSpan,
101
+ factory: definition.factory,
102
+ base: definition.base,
103
+ baseClassName: definition.baseClassName ? materializeValue(graph, definition.baseClassName) : null,
104
+ options: materializeValue(graph, definition.options),
105
+ complete: definition.complete,
106
+ bailouts: [...definition.bailouts]
107
+ };
108
+ }
109
+ function collectDependencies(module) {
110
+ const dependencies = /* @__PURE__ */ new Set();
111
+ const collect = (value) => {
112
+ if (value.kind === "static" || value.kind === "conditional") {
113
+ for (const dependency of value.dependencies) dependencies.add(dependency);
114
+ } else if (value.kind === "dom-style") {
115
+ for (const item of value.items) collect(item.value);
116
+ } else if (value.bailout.dependencyId) {
117
+ dependencies.add(value.bailout.dependencyId);
118
+ }
119
+ };
120
+ for (const element of module.elements) {
121
+ if (element.component.provenance) {
122
+ dependencies.add(element.component.provenance.resolvedId);
123
+ }
124
+ if (element.component.definition) dependencies.add(element.component.definition.id);
125
+ for (const entry of element.entries) {
126
+ if ("value" in entry && entry.value.kind !== "element" && entry.value.kind !== "empty") {
127
+ collect(entry.value);
128
+ }
129
+ }
130
+ }
131
+ for (const definition of module.styledDefinitions) {
132
+ dependencies.add(definition.factory.resolvedId);
133
+ if (definition.base.provenance) dependencies.add(definition.base.provenance.resolvedId);
134
+ if (definition.base.definition) dependencies.add(definition.base.definition.id);
135
+ if (definition.baseClassName) collect(definition.baseClassName);
136
+ collect(definition.options);
137
+ }
138
+ for (const definition of module.domStyleDefinitions) {
139
+ dependencies.add(definition.factory.resolvedId);
140
+ collect(definition.value);
141
+ }
142
+ return [...dependencies].sort(compareCodeUnits);
143
+ }
144
+ function materializeModule(graph, id) {
145
+ const inputHash = graph.contentHash(id);
146
+ if (!inputHash) throw new Error(`Cannot materialize unknown host module ${id}`);
147
+ const result = graph.elementsOf(id);
148
+ const definitions = [...result.styledDefinitions];
149
+ const definitionKeys = new Set(definitions.map((definition) => `${definition.id}\0${definition.name}`));
150
+ for (const element of result.elements) {
151
+ const linked = element.component.definition;
152
+ if (!linked || linked.id === id) continue;
153
+ const definition = graph.elementsOf(linked.id).styledDefinitions.find((candidate) => candidate.id === linked.id && candidate.name === linked.name);
154
+ const key = definition && `${definition.id}\0${definition.name}`;
155
+ if (definition && key && !definitionKeys.has(key)) {
156
+ definitionKeys.add(key);
157
+ definitions.push(definition);
158
+ }
159
+ }
160
+ const base = {
161
+ version: 1,
162
+ id,
163
+ inputHash,
164
+ elements: result.elements.map((element) => materializeElement(graph, element)),
165
+ styledDefinitions: definitions.map((definition) => materializeStyledDefinition(graph, definition)),
166
+ domStyleDefinitions: result.domStyleDefinitions.map((definition) => ({
167
+ ...definition,
168
+ value: materializeValue(graph, definition.value)
169
+ })),
170
+ diagnostics: graph.diagnostics().filter(({ span }) => span.id === id)
171
+ };
172
+ return {
173
+ ...base,
174
+ dependencies: collectDependencies(base)
175
+ };
176
+ }
177
+
178
+ export { materializeModule };
179
+ //# sourceMappingURL=materialize.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materialize.js","names":[],"sources":["esm/materialize.js"],"sourcesContent":["function compareCodeUnits(left, right) {\n return left < right ? -1 : left > right ? 1 : 0;\n}\nfunction materializeValue(graph, value) {\n if (value.kind === \"static\") {\n return {\n kind: \"static\",\n value: value.value,\n dependencies: [],\n span: value.span,\n literalOrigin: true\n };\n }\n if (value.kind === \"dom-style\") {\n return {\n kind: \"dom-style\",\n span: value.span,\n items: value.items.map((item) => ({\n condition: item.condition,\n value: materializeValue(graph, item.value)\n }))\n };\n }\n const result = graph.evaluate(value);\n if (result.ok) {\n return {\n kind: \"static\",\n value: result.value,\n dependencies: result.dependencies,\n span: value\n };\n }\n const conditional = graph.evaluateConditional(value);\n if (conditional) {\n return {\n kind: \"conditional\",\n test: conditional.test,\n whenTrue: conditional.whenTrue.value,\n whenFalse: conditional.whenFalse.value,\n dependencies: [\n .../* @__PURE__ */ new Set([\n ...conditional.whenTrue.dependencies,\n ...conditional.whenFalse.dependencies\n ])\n ].sort(compareCodeUnits),\n bailout: result.bailout,\n span: value\n };\n }\n return { kind: \"bailout\", bailout: result.bailout, span: value };\n}\nfunction materializeEntry(graph, entry) {\n if (entry.kind === \"prop\") {\n return {\n kind: entry.kind,\n name: entry.name,\n span: entry.span,\n value: materializeValue(graph, entry.value)\n };\n }\n if (entry.kind === \"spread\") {\n return {\n kind: entry.kind,\n span: entry.span,\n value: materializeValue(graph, entry.value)\n };\n }\n if (entry.value.kind === \"element\" || entry.value.kind === \"empty\") {\n return { kind: entry.kind, span: entry.span, value: entry.value };\n }\n return {\n kind: entry.kind,\n span: entry.span,\n value: materializeValue(graph, entry.value)\n };\n}\nfunction materializeElement(graph, element) {\n const entries = element.complete ? element.entries : element.bailedEntries;\n return {\n kind: element.kind,\n form: element.form,\n id: element.id,\n span: element.span,\n propsSpan: element.propsSpan,\n component: element.component,\n complete: element.complete,\n entries: entries.map((entry) => materializeEntry(graph, entry)),\n bailouts: [...element.bailouts]\n };\n}\nfunction materializeStyledDefinition(graph, definition) {\n return {\n kind: definition.kind,\n id: definition.id,\n name: definition.name,\n span: definition.span,\n definitionSpan: definition.definitionSpan,\n factory: definition.factory,\n base: definition.base,\n baseClassName: definition.baseClassName ? materializeValue(graph, definition.baseClassName) : null,\n options: materializeValue(graph, definition.options),\n complete: definition.complete,\n bailouts: [...definition.bailouts]\n };\n}\nfunction collectDependencies(module) {\n const dependencies = /* @__PURE__ */ new Set();\n const collect = (value) => {\n if (value.kind === \"static\" || value.kind === \"conditional\") {\n for (const dependency of value.dependencies) dependencies.add(dependency);\n } else if (value.kind === \"dom-style\") {\n for (const item of value.items) collect(item.value);\n } else if (value.bailout.dependencyId) {\n dependencies.add(value.bailout.dependencyId);\n }\n };\n for (const element of module.elements) {\n if (element.component.provenance) {\n dependencies.add(element.component.provenance.resolvedId);\n }\n if (element.component.definition) dependencies.add(element.component.definition.id);\n for (const entry of element.entries) {\n if (\"value\" in entry && entry.value.kind !== \"element\" && entry.value.kind !== \"empty\") {\n collect(entry.value);\n }\n }\n }\n for (const definition of module.styledDefinitions) {\n dependencies.add(definition.factory.resolvedId);\n if (definition.base.provenance)\n dependencies.add(definition.base.provenance.resolvedId);\n if (definition.base.definition) dependencies.add(definition.base.definition.id);\n if (definition.baseClassName) collect(definition.baseClassName);\n collect(definition.options);\n }\n for (const definition of module.domStyleDefinitions) {\n dependencies.add(definition.factory.resolvedId);\n collect(definition.value);\n }\n return [...dependencies].sort(compareCodeUnits);\n}\nfunction materializeModule(graph, id) {\n const inputHash = graph.contentHash(id);\n if (!inputHash) throw new Error(`Cannot materialize unknown host module ${id}`);\n const result = graph.elementsOf(id);\n const definitions = [...result.styledDefinitions];\n const definitionKeys = new Set(\n definitions.map((definition) => `${definition.id}\\0${definition.name}`)\n );\n for (const element of result.elements) {\n const linked = element.component.definition;\n if (!linked || linked.id === id) continue;\n const definition = graph.elementsOf(linked.id).styledDefinitions.find(\n (candidate) => candidate.id === linked.id && candidate.name === linked.name\n );\n const key = definition && `${definition.id}\\0${definition.name}`;\n if (definition && key && !definitionKeys.has(key)) {\n definitionKeys.add(key);\n definitions.push(definition);\n }\n }\n const base = {\n version: 1,\n id,\n inputHash,\n elements: result.elements.map((element) => materializeElement(graph, element)),\n styledDefinitions: definitions.map(\n (definition) => materializeStyledDefinition(graph, definition)\n ),\n domStyleDefinitions: result.domStyleDefinitions.map((definition) => ({\n ...definition,\n value: materializeValue(graph, definition.value)\n })),\n diagnostics: graph.diagnostics().filter(({ span }) => span.id === id)\n };\n return { ...base, dependencies: collectDependencies(base) };\n}\nexport {\n materializeModule\n};\n//# sourceMappingURL=materialize.js.map\n"],"mappings":";AAAA,SAAS,iBAAiB,MAAM,OAAO;CACrC,OAAO,OAAO,QAAQ,CAAC,IAAI,OAAO,QAAQ,IAAI;AAChD;AACA,SAAS,iBAAiB,OAAO,OAAO;CACtC,IAAI,MAAM,SAAS,UAAU;EAC3B,OAAO;GACL,MAAM;GACN,OAAO,MAAM;GACb,cAAc,CAAC;GACf,MAAM,MAAM;GACZ,eAAe;EACjB;CACF;CACA,IAAI,MAAM,SAAS,aAAa;EAC9B,OAAO;GACL,MAAM;GACN,MAAM,MAAM;GACZ,OAAO,MAAM,MAAM,KAAK,UAAU;IAChC,WAAW,KAAK;IAChB,OAAO,iBAAiB,OAAO,KAAK,KAAK;GAC3C,EAAE;EACJ;CACF;CACA,MAAM,SAAS,MAAM,SAAS,KAAK;CACnC,IAAI,OAAO,IAAI;EACb,OAAO;GACL,MAAM;GACN,OAAO,OAAO;GACd,cAAc,OAAO;GACrB,MAAM;EACR;CACF;CACA,MAAM,cAAc,MAAM,oBAAoB,KAAK;CACnD,IAAI,aAAa;EACf,OAAO;GACL,MAAM;GACN,MAAM,YAAY;GAClB,UAAU,YAAY,SAAS;GAC/B,WAAW,YAAY,UAAU;GACjC,cAAc,CACZ,mBAAmB,IAAI,IAAI,CACzB,GA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