@tamagui/compiler-core 3.0.13 → 3.0.14
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/cjs/lower.cjs +1 -1
- package/dist/esm/lower.mjs +2 -2
- package/dist/esm/lower.mjs.map +1 -1
- package/package.json +3 -3
- package/src/lower.ts +1 -1
- package/types/lower.d.ts +1 -1
package/dist/cjs/lower.cjs
CHANGED
|
@@ -26,7 +26,7 @@ __export(lower_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(lower_exports);
|
|
27
27
|
var import_diagnostics = require("./diagnostics.cjs");
|
|
28
28
|
var import_output = require("./output.cjs");
|
|
29
|
-
const LOWERED_MODULE_PLAN_VERSION =
|
|
29
|
+
const LOWERED_MODULE_PLAN_VERSION = 7;
|
|
30
30
|
function compareCodeUnits(left, right) {
|
|
31
31
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
32
32
|
}
|
package/dist/esm/lower.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { localBailout } from "./diagnostics.mjs";
|
|
2
2
|
import { sourceContentHash, validateSourceEdits } from "./output.mjs";
|
|
3
3
|
|
|
4
|
-
const LOWERED_MODULE_PLAN_VERSION =
|
|
4
|
+
const LOWERED_MODULE_PLAN_VERSION = 7;
|
|
5
5
|
function compareCodeUnits(left, right) {
|
|
6
6
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
7
7
|
}
|
|
@@ -191,7 +191,7 @@ function lowerModule({ module, source, target, host, options, structuralPass })
|
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
return {
|
|
194
|
-
version:
|
|
194
|
+
version: 7,
|
|
195
195
|
id: module.id,
|
|
196
196
|
target,
|
|
197
197
|
inputHash: module.inputHash,
|
package/dist/esm/lower.mjs.map
CHANGED
|
@@ -1 +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 = 6;\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?.(\n entry.name,\n component,\n entry.value.kind,\n entry.value.kind === \"bailout\" ? entry.value.dynamic : null\n )) {\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 if (entry.kind === \"prop\" && entry.value.kind === \"object\") {\n for (const member of entry.value.members) {\n if (member.value.kind !== \"bailout\" && member.value.kind !== \"conditional\") continue;\n if (!host.isStyleProp(member.name, component) || !host.canLowerDynamicStyleProp?.(\n member.name,\n component,\n member.value.kind,\n member.value.kind === \"bailout\" ? member.value.dynamic : null\n )) {\n return diagnostic(\n \"local/dynamic-style-value\",\n element,\n `Style prop ${member.name} could not be evaluated`,\n member.name\n );\n }\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: module.declarationsAt,\n end: module.declarationsAt,\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,2BACtJ,MAAM,MACN,WACA,MAAM,MAAM,MACZ,MAAM,MAAM,SAAS,YAAY,MAAM,MAAM,UAAU,IACzD,GAAG;EACD,OAAO,WACL,6BACA,SACA,cAAc,MAAM,KAAK,0BACzB,MAAM,IACR;CACF;CACA,IAAI,MAAM,SA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,MAAM;EAC7B,KAAK,MAAM,QAAQ,OAAO,KAAK,IAAI,IAAI,IAAI;EAC3C,KAAK,MAAM,mBAAmB,OAAO,SAAS;GAC5C,IAAI,CAAC,QAAQ,IAAI,gBAAgB,OAAO,GAAG;IACzC,QAAQ,IAAI,gBAAgB,SAAS,eAAe;GACtD;EACF;EACA,KAAK,MAAM,cAAc,OAAO,gBAAgB,CAAC,GAAG,aAAa,IAAI,UAAU;EAC/E,MAAM;EACN,IAAI,OAAO,WAAW,MAAM;EAC5B,IAAI,kBAAkB,MAAM;CAC9B;CACA,KAAK,MAAM,mBAAmB,QAAQ,OAAO,GAAG;EAC9C,MAAM,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,CAAC,CAAC,KAAK,EAAE;EACrB;EACA,cAAc,CAAC,GAAG,YAAY,CAAC,CAAC,KAAK,gBAAgB;EACrD;CACF;AACF"}
|
|
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 = 7;\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?.(\n entry.name,\n component,\n entry.value.kind,\n entry.value.kind === \"bailout\" ? entry.value.dynamic : null\n )) {\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 if (entry.kind === \"prop\" && entry.value.kind === \"object\") {\n for (const member of entry.value.members) {\n if (member.value.kind !== \"bailout\" && member.value.kind !== \"conditional\") continue;\n if (!host.isStyleProp(member.name, component) || !host.canLowerDynamicStyleProp?.(\n member.name,\n component,\n member.value.kind,\n member.value.kind === \"bailout\" ? member.value.dynamic : null\n )) {\n return diagnostic(\n \"local/dynamic-style-value\",\n element,\n `Style prop ${member.name} could not be evaluated`,\n member.name\n );\n }\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: module.declarationsAt,\n end: module.declarationsAt,\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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K,MAAM,mBAAmB,QAAQ,OAAO,GAAG;EAC9C,MAAM,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,CAAC,CAAC,KAAK,EAAE;EACrB;EACA,cAAc,CAAC,GAAG,YAAY,CAAC,CAAC,KAAK,gBAAgB;EACrD;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/compiler-core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.14",
|
|
4
4
|
"description": "Shared parser-independent Tamagui compiler graph and element IR",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"yuku-analyzer": "0.6.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@tamagui/build": "3.0.
|
|
43
|
+
"@tamagui/build": "3.0.14",
|
|
44
44
|
"typescript": "7.0.2"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"url": "git+https://github.com/tamagui/tamagui.git",
|
|
49
49
|
"directory": "code/compiler/compiler-core"
|
|
50
50
|
},
|
|
51
|
-
"releaseSourceCommit": "
|
|
51
|
+
"releaseSourceCommit": "61a8bd09550319d14c141581a8e4bb286a9795a6"
|
|
52
52
|
}
|
package/src/lower.ts
CHANGED
package/types/lower.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { DynamicEvaluation } from './evaluate';
|
|
|
3
3
|
import { type BailoutReason } from './diagnostics';
|
|
4
4
|
import type { MaterializedElement, MaterializedModule, MaterializedStyledDefinition } from './materialize';
|
|
5
5
|
import { type ApplicableLoweredModulePlan, type SourceEdit } from './output';
|
|
6
|
-
export declare const LOWERED_MODULE_PLAN_VERSION =
|
|
6
|
+
export declare const LOWERED_MODULE_PLAN_VERSION = 7;
|
|
7
7
|
export type CompilerTarget = 'web' | 'native';
|
|
8
8
|
export interface LoweredModuleStats {
|
|
9
9
|
found: number;
|