@tamagui/compiler-core 3.0.0-beta.889.1 → 3.0.0-beta.901.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.
@@ -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 = 3;\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(compareCodeUn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BAAkB,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 = 3;\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 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?.(member.name, component, member.value.kind)) {\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: 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,KAA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;EACA,YAAY,KAAK,GAAG,OAAO,eAAe,CAAC,CAAC;EAC5C,MAAM,KAAK,GAAG,OAAO,KAAK;EAC1B,uBAAuB,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"}
@@ -49,13 +49,28 @@ function materializeValue(graph, value) {
49
49
  dynamic: graph.evaluateDynamic(value)
50
50
  };
51
51
  }
52
+ function materializeStyleObject(graph, reference, bailout) {
53
+ const members = graph.objectMembers(reference);
54
+ if (!members) return null;
55
+ return {
56
+ kind: "object",
57
+ span: reference,
58
+ members: members.map((member) => ({
59
+ name: member.name,
60
+ span: member.span,
61
+ value: materializeValue(graph, member.value)
62
+ })),
63
+ bailout
64
+ };
65
+ }
52
66
  function materializeEntry(graph, entry) {
53
67
  if (entry.kind === "prop") {
68
+ const value = materializeValue(graph, entry.value);
54
69
  return {
55
70
  kind: entry.kind,
56
71
  name: entry.name,
57
72
  span: entry.span,
58
- value: materializeValue(graph, entry.value)
73
+ value: entry.name === "style" && value.kind === "bailout" && entry.value.kind === "expression" ? materializeStyleObject(graph, entry.value, value.bailout) ?? value : value
59
74
  };
60
75
  }
61
76
  if (entry.kind === "spread") {
@@ -115,6 +130,9 @@ function collectDependencies(module) {
115
130
  for (const dependency of value.dependencies) dependencies.add(dependency);
116
131
  } else if (value.kind === "dom-style") {
117
132
  for (const item of value.items) collect(item.value);
133
+ } else if (value.kind === "object") {
134
+ for (const member of value.members) collect(member.value);
135
+ if (value.bailout.dependencyId) dependencies.add(value.bailout.dependencyId);
118
136
  } else {
119
137
  for (const dependency of value.dynamic?.dependencies ?? []) {
120
138
  dependencies.add(dependency);
@@ -1 +1 @@
1
- {"version":3,"file":"materialize.js","names":[],"sources":["esm/materialize.js"],"sourcesContent":["import { collectBranchDependencies } from \"./evaluate\";\nfunction 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 tree = graph.evaluateBranches(value);\n if (tree) {\n return {\n kind: \"conditional\",\n tree,\n dependencies: collectBranchDependencies(tree).sort(compareCodeUnits),\n bailout: result.bailout,\n span: value\n };\n }\n return {\n kind: \"bailout\",\n bailout: result.bailout,\n span: value,\n dynamic: graph.evaluateDynamic(value)\n };\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 staticConfig: definition.staticConfig ? materializeValue(graph, definition.staticConfig) : null,\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 {\n for (const dependency of value.dynamic?.dependencies ?? []) {\n dependencies.add(dependency);\n }\n if (value.bailout.dependencyId) 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 if (definition.staticConfig) collect(definition.staticConfig);\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":";;;AACA,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;G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E;EACA,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,IAAI,WAAW;EAC1D,IAAI,cAAc,OAAO,CAAC,eAAe,IAAI,GAAG,GAAG;GACjD,eAAe,IAAI,GAAG;GACtB,YAAY,KAAK,UAAU;EAC7B;CACF;CACA,MAAM,OAAO;EACX,SAAS;EACT;EACA;EACA,UAAU,OAAO,SAAS,KAAK,YAAY,mBAAmB,OAAO,OAAO,CAAC;EAC7E,mBAAmB,YAAY,KAC5B,eAAe,4BAA4B,OAAO,UAAU,CAC/D;EACA,qBAAqB,OAAO,oBAAoB,KAAK,gBAAgB;GACnE,GAAG;GACH,OAAO,iBAAiB,OAAO,WAAW,KAAK;EACjD,EAAE;EACF,aAAa,MAAM,YAAY,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,OAAO,EAAE;CACtE;CACA,OAAO;EAAE,GAAG;EAAM,cAAc,oBAAoB,IAAI;CAAE;AAC5D"}
1
+ {"version":3,"file":"materialize.js","names":[],"sources":["esm/materialize.js"],"sourcesContent":["import { collectBranchDependencies } from \"./evaluate\";\nfunction 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 tree = graph.evaluateBranches(value);\n if (tree) {\n return {\n kind: \"conditional\",\n tree,\n dependencies: collectBranchDependencies(tree).sort(compareCodeUnits),\n bailout: result.bailout,\n span: value\n };\n }\n return {\n kind: \"bailout\",\n bailout: result.bailout,\n span: value,\n dynamic: graph.evaluateDynamic(value)\n };\n}\nfunction materializeStyleObject(graph, reference, bailout) {\n const members = graph.objectMembers(reference);\n if (!members) return null;\n return {\n kind: \"object\",\n span: reference,\n members: members.map((member) => ({\n name: member.name,\n span: member.span,\n value: materializeValue(graph, member.value)\n })),\n bailout\n };\n}\nfunction materializeEntry(graph, entry) {\n if (entry.kind === \"prop\") {\n const value = materializeValue(graph, entry.value);\n return {\n kind: entry.kind,\n name: entry.name,\n span: entry.span,\n value: entry.name === \"style\" && value.kind === \"bailout\" && entry.value.kind === \"expression\" ? materializeStyleObject(graph, entry.value, value.bailout) ?? value : 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 staticConfig: definition.staticConfig ? materializeValue(graph, definition.staticConfig) : null,\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.kind === \"object\") {\n for (const member of value.members) collect(member.value);\n if (value.bailout.dependencyId) dependencies.add(value.bailout.dependencyId);\n } else {\n for (const dependency of value.dynamic?.dependencies ?? []) {\n dependencies.add(dependency);\n }\n if (value.bailout.dependencyId) 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 if (definition.staticConfig) collect(definition.staticConfig);\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":";;;AACA,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,OAAO,MAAM,iBAAiB,KAAK;CACzC,IAAI,MAAM;EACR,OAAO;GACL,MAAM;GACN;GACA,cAAc,0BAA0B,IAAI,CAAC,CAAC,KAAK,gBAAgB;GACnE,SAAS,OAAO;GAChB,MAAM;EACR;CACF;CACA,OAAO;EACL,MAAM;EACN,SAAS,OAAO;EAChB,MAAM;EACN,SAAS,MAAM,gBAAgB,KAAK;CACtC;AACF;AACA,SAAS,uBAAuB,OAAO,WAAW,SAAS;CACzD,MAAM,UAAU,MAAM,cAAc,SAAS;CAC7C,IAAI,CAAC,SAAS,OAAO;CACrB,OAAO;EACL,MAAM;EACN,MAAM;EACN,SAAS,QAAQ,KAAK,YAAY;GAChC,MAAM,OAAO;GACb,MAAM,OAAO;GACb,OAAO,iBAAiB,OAAO,OAAO,KAAK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B,eAAe,4BAA4B,OAAO,UAAU,CAC/D;EACA,qBAAqB,OAAO,oBAAoB,KAAK,gBAAgB;GACnE,GAAG;GACH,OAAO,iBAAiB,OAAO,WAAW,KAAK;EACjD,EAAE;EACF,aAAa,MAAM,YAAY,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,OAAO,EAAE;CACtE;CACA,OAAO;EAAE,GAAG;EAAM,cAAc,oBAAoB,IAAI;CAAE;AAC5D"}
@@ -587,12 +587,6 @@ function normalizeElements(candidate, rawId, imports = []) {
587
587
  bailouts: bailouts.sort((left, right) => left.span.start - right.span.start)
588
588
  };
589
589
  }
590
- function declarationForName(program, name) {
591
- return findAstNode(program, (node) => {
592
- if (node.type !== "VariableDeclarator") return false;
593
- return identifierName(childNode(node, "id")) === name;
594
- });
595
- }
596
590
  function nodeAtSpan(program, start, end) {
597
591
  return findAstNode(program, (node) => node.start === start && node.end === end);
598
592
  }
@@ -601,5 +595,5 @@ function asAstNode(value, label) {
601
595
  return value;
602
596
  }
603
597
 
604
- export { asAstNode, declarationForName, definitionFromDeclaration, nodeAtSpan, normalizeElements };
598
+ export { asAstNode, definitionFromDeclaration, nodeAtSpan, normalizeElements };
605
599
  //# sourceMappingURL=normalize.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.js","names":[],"sources":["esm/normalize.js"],"sourcesContent":["import {\n childNode,\n childNodes,\n findAstNode,\n identifierName,\n isAstNode,\n walkAst\n} from \"./ast\";\nimport {\n expressionReference,\n resolvedModuleId,\n spanOf\n} from \"./contracts\";\nimport { linkedBailout, localBailout } from \"./diagnostics\";\nimport { hostImportProvenance } from \"./ir\";\nfunction finalizeElement(base, entries, bailouts) {\n if (bailouts.length === 0) {\n return { ...base, complete: true, entries, bailouts: [] };\n }\n return {\n ...base,\n complete: false,\n bailedEntries: entries,\n bailouts\n };\n}\nfunction definitionFromDeclaration(id, name, program, declaration) {\n let identifier = declaration;\n let initializer = null;\n let constant = false;\n if (declaration.type === \"VariableDeclarator\") {\n identifier = childNode(declaration, \"id\") ?? declaration;\n initializer = childNode(declaration, \"init\");\n constant = !!findAstNode(\n program,\n (node) => node.type === \"VariableDeclaration\" && node.kind === \"const\" && childNodes(node, \"declarations\").some(\n (candidate) => candidate.start === declaration.start\n )\n );\n } else if (declaration.type === \"Identifier\") {\n const declarator = findAstNode(\n program,\n (node) => node.type === \"VariableDeclarator\" && childNode(node, \"id\")?.start === declaration.start\n );\n if (declarator) {\n initializer = childNode(declarator, \"init\");\n constant = !!findAstNode(\n program,\n (node) => node.type === \"VariableDeclaration\" && node.kind === \"const\" && childNodes(node, \"declarations\").some(\n (candidate) => candidate.start === declarator.start\n )\n );\n }\n }\n return {\n id: resolvedModuleId(id),\n name,\n start: identifier.start,\n end: identifier.end,\n initializer,\n constant\n };\n}\nfunction importBinding(program, localName) {\n for (const statement of childNodes(program, \"body\")) {\n if (statement.type !== \"ImportDeclaration\") continue;\n const source = childNode(statement, \"source\");\n const sourceValue = source && typeof source.value === \"string\" ? source.value : null;\n if (!sourceValue) continue;\n for (const specifier of childNodes(statement, \"specifiers\")) {\n if (identifierName(childNode(specifier, \"local\")) !== localName) continue;\n if (specifier.type === \"ImportDefaultSpecifier\") {\n return { source: sourceValue, imported: \"default\" };\n }\n if (specifier.type === \"ImportNamespaceSpecifier\") {\n return { source: sourceValue, imported: \"*\" };\n }\n const imported = childNode(specifier, \"imported\");\n const importedName = identifierName(imported) ?? (typeof imported?.value === \"string\" ? imported.value : null);\n return importedName ? { source: sourceValue, imported: importedName } : null;\n }\n }\n return null;\n}\nfunction asStaticValue(node) {\n if (!node) return void 0;\n if (node.type === \"NullLiteral\") return null;\n if (node.type === \"Literal\" || node.type.endsWith(\"Literal\")) {\n const value = node.value;\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\" || value === null) {\n return value;\n }\n }\n return void 0;\n}\nfunction elementValue(id, node) {\n const staticValue = asStaticValue(node);\n return staticValue === void 0 ? expressionReference(id, node) : { kind: \"static\", value: staticValue, span: spanOf(id, node) };\n}\nfunction symbolDefinition(definition) {\n if (!definition) return null;\n return {\n id: definition.id,\n name: definition.name,\n span: {\n id: definition.id,\n start: definition.start,\n end: definition.end\n },\n initializer: definition.initializer ? expressionReference(definition.id, definition.initializer) : null,\n constant: definition.constant\n };\n}\nfunction componentFromNode(candidate, id, program, imports, node, bailouts) {\n const literal = asStaticValue(node);\n if (typeof literal === \"string\") {\n return {\n kind: \"intrinsic\",\n name: literal,\n span: spanOf(id, node),\n closingSpan: null,\n definition: null,\n provenance: null\n };\n }\n if ((node.type === \"MemberExpression\" || node.type === \"JSXMemberExpression\") && node.computed !== true) {\n const objectName = identifierName(childNode(node, \"object\"));\n const memberName = identifierName(childNode(node, \"property\"));\n const binding2 = objectName ? importBinding(program, objectName) : null;\n if (memberName && binding2?.imported === \"html\") {\n const provenance2 = hostImportProvenance(imports, binding2.source, binding2.imported);\n if (provenance2) {\n return {\n kind: \"binding\",\n name: memberName,\n span: spanOf(id, node),\n closingSpan: null,\n definition: null,\n provenance: provenance2\n };\n }\n }\n }\n const name = identifierName(node);\n if (!name) {\n bailouts.push(\n localBailout(\n \"local/unsupported-element-name\",\n spanOf(id, node),\n `Element target ${node.type} is not a stable identifier or intrinsic tag`\n )\n );\n return null;\n }\n const intrinsic = /^[a-z]/.test(name);\n const binding = intrinsic ? null : importBinding(program, name);\n const provenance = binding ? hostImportProvenance(imports, binding.source, binding.imported) : null;\n const definition = intrinsic ? null : symbolDefinition(candidate.definitionOf(id, name));\n if (!intrinsic && !definition && !provenance) {\n bailouts.push(\n linkedBailout(\n \"linked/unresolved-component-binding\",\n spanOf(id, node),\n `Component binding ${name} has no linked definition`\n )\n );\n }\n return {\n kind: intrinsic ? \"intrinsic\" : \"binding\",\n name,\n span: spanOf(id, node),\n closingSpan: null,\n definition,\n provenance\n };\n}\nfunction jsxComponentNode(opening) {\n return childNode(opening, \"name\");\n}\nfunction jsxEntries(id, element, opening, bailouts) {\n const entries = [];\n for (const attribute of childNodes(opening, \"attributes\")) {\n if (attribute.type === \"JSXSpreadAttribute\") {\n const argument = childNode(attribute, \"argument\");\n if (argument) {\n entries.push({\n kind: \"spread\",\n span: spanOf(id, attribute),\n value: expressionReference(id, argument)\n });\n }\n continue;\n }\n if (attribute.type !== \"JSXAttribute\") continue;\n const nameNode = childNode(attribute, \"name\");\n const name = identifierName(nameNode);\n if (!name) {\n bailouts.push(\n localBailout(\n \"local/unsupported-prop-key\",\n spanOf(id, attribute),\n \"Namespaced JSX attributes are not statically supported\"\n )\n );\n continue;\n }\n const rawValue = childNode(attribute, \"value\");\n let value;\n if (!rawValue) {\n value = { kind: \"static\", value: true, span: spanOf(id, attribute) };\n } else if (rawValue.type === \"JSXExpressionContainer\") {\n const expression = childNode(rawValue, \"expression\");\n if (!expression || expression.type === \"JSXEmptyExpression\") {\n bailouts.push(\n localBailout(\n \"local/unsupported-expression\",\n spanOf(id, rawValue),\n `JSX prop ${name} has no expression`\n )\n );\n continue;\n }\n value = elementValue(id, expression);\n } else {\n value = elementValue(id, rawValue);\n }\n entries.push({ kind: \"prop\", name, span: spanOf(id, attribute), value });\n }\n for (const child of childNodes(element, \"children\")) {\n let value;\n if (child.type === \"JSXText\") {\n if (typeof child.value !== \"string\" || child.value.trim() === \"\") continue;\n value = {\n kind: \"static\",\n value: child.value,\n span: spanOf(id, child)\n };\n } else if (child.type === \"JSXExpressionContainer\") {\n const expression = childNode(child, \"expression\");\n value = !expression || expression.type === \"JSXEmptyExpression\" ? { kind: \"empty\", span: spanOf(id, child) } : elementValue(id, expression);\n } else if (child.type === \"JSXElement\" || child.type === \"JSXFragment\") {\n value = { kind: \"element\", span: spanOf(id, child) };\n } else {\n bailouts.push(\n localBailout(\n \"local/unsupported-child\",\n spanOf(id, child),\n `JSX child ${child.type} cannot be normalized`\n )\n );\n continue;\n }\n entries.push({ kind: \"child\", span: spanOf(id, child), value });\n }\n return entries.sort((left, right) => left.span.start - right.span.start);\n}\nfunction propertyName(property) {\n if (property.computed === true) return null;\n const key = childNode(property, \"key\");\n const name = identifierName(key);\n if (name) return name;\n const literal = asStaticValue(key);\n return typeof literal === \"string\" || typeof literal === \"number\" ? String(literal) : null;\n}\nfunction runtimeChildEntries(id, program, node, bailouts) {\n const rawNodes = node.type === \"ArrayExpression\" ? node.elements : null;\n if (Array.isArray(rawNodes) && rawNodes.some((child) => child === null || !isAstNode(child))) {\n bailouts.push(\n localBailout(\n \"local/unsupported-child\",\n spanOf(id, node),\n \"Sparse compiled children cannot be normalized without changing order\"\n )\n );\n return [];\n }\n const nodes = Array.isArray(rawNodes) ? rawNodes.filter(isAstNode) : [node];\n return nodes.flatMap((child) => {\n if (child.type === \"SpreadElement\") {\n bailouts.push(\n localBailout(\n \"local/unsupported-child\",\n spanOf(id, child),\n \"Spread children cannot be statically ordered\"\n )\n );\n return [];\n }\n if (child.type === \"CallExpression\" && runtimeCall(program, child)) {\n return [\n {\n kind: \"child\",\n span: spanOf(id, child),\n value: { kind: \"element\", span: spanOf(id, child) }\n }\n ];\n }\n return [{ kind: \"child\", span: spanOf(id, child), value: elementValue(id, child) }];\n });\n}\nfunction objectEntries(id, program, object, bailouts) {\n const entries = [];\n for (const property of childNodes(object, \"properties\")) {\n if (property.type === \"SpreadElement\") {\n const argument = childNode(property, \"argument\");\n if (argument) {\n const spread = {\n kind: \"spread\",\n span: spanOf(id, property),\n value: expressionReference(id, argument)\n };\n entries.push(spread);\n }\n continue;\n }\n if (property.type !== \"Property\" && property.type !== \"ObjectProperty\") {\n bailouts.push(\n localBailout(\n \"local/unsupported-prop-key\",\n spanOf(id, property),\n `Runtime props entry ${property.type} is not a data property`\n )\n );\n continue;\n }\n const name = propertyName(property);\n const valueNode = childNode(property, \"value\");\n if (!name || !valueNode) {\n bailouts.push(\n localBailout(\n \"local/unsupported-prop-key\",\n spanOf(id, property),\n \"Computed runtime prop keys are not statically supported\"\n )\n );\n continue;\n }\n if (name === \"children\") {\n entries.push(...runtimeChildEntries(id, program, valueNode, bailouts));\n continue;\n }\n const prop = {\n kind: \"prop\",\n name,\n span: spanOf(id, property),\n value: elementValue(id, valueNode)\n };\n entries.push(prop);\n }\n return entries;\n}\nfunction runtimeCall(program, call) {\n const callee = childNode(call, \"callee\");\n if (!callee) return null;\n const directName = identifierName(callee);\n if (directName) {\n const provenance2 = importBinding(program, directName);\n if (provenance2?.source === \"react/jsx-runtime\" && (provenance2.imported === \"jsx\" || provenance2.imported === \"jsxs\")) {\n return { form: \"jsx-runtime\" };\n }\n if (provenance2?.source === \"react\" && provenance2.imported === \"createElement\") {\n return { form: \"create-element\" };\n }\n }\n if (callee.type !== \"MemberExpression\" || callee.computed === true) return null;\n const objectName = identifierName(childNode(callee, \"object\"));\n const propertyName2 = identifierName(childNode(callee, \"property\"));\n if (propertyName2 !== \"createElement\" || !objectName) return null;\n const provenance = importBinding(program, objectName);\n return provenance?.source === \"react\" && (provenance.imported === \"default\" || provenance.imported === \"*\") ? { form: \"create-element\" } : null;\n}\nfunction normalizeRuntimeElement(candidate, id, program, imports, call, runtime, bailouts) {\n const bailoutStart = bailouts.length;\n const args = childNodes(call, \"arguments\");\n const target = args[0];\n if (!target) {\n bailouts.push(\n localBailout(\n \"local/invalid-element-call\",\n spanOf(id, call),\n `${runtime.form} call has no element target`\n )\n );\n return null;\n }\n const component = componentFromNode(candidate, id, program, imports, target, bailouts);\n if (!component) return null;\n const entries = [];\n const props = args[1];\n if (props && asStaticValue(props) !== null) {\n if (props.type === \"ObjectExpression\") {\n entries.push(...objectEntries(id, program, props, bailouts));\n } else {\n entries.push({\n kind: \"spread\",\n span: spanOf(id, props),\n value: expressionReference(id, props)\n });\n }\n }\n if (runtime.form === \"create-element\") {\n for (const child of args.slice(2)) {\n entries.push(...runtimeChildEntries(id, program, child, bailouts));\n }\n }\n return finalizeElement(\n {\n kind: \"element\",\n form: runtime.form,\n id,\n span: spanOf(id, call),\n propsSpan: props ? spanOf(id, props) : null,\n component\n },\n entries.sort((left, right) => left.span.start - right.span.start),\n bailouts.slice(bailoutStart)\n );\n}\nfunction styledDefinitions(candidate, id, program, imports, bailouts) {\n const definitions = [];\n walkAst(program, (node) => {\n if (node.type !== \"VariableDeclarator\") return;\n const identifier = childNode(node, \"id\");\n const name = identifierName(identifier);\n const call = childNode(node, \"init\");\n if (!name || !identifier || call?.type !== \"CallExpression\") return;\n const callee = childNode(call, \"callee\");\n const factoryName = callee && identifierName(callee);\n if (!factoryName) return;\n const binding = importBinding(program, factoryName);\n if (!binding || binding.imported !== \"styled\") return;\n const factory = hostImportProvenance(imports, binding.source, binding.imported);\n if (!factory) return;\n const definitionBailouts = [];\n const args = childNodes(call, \"arguments\");\n const baseNode = args[0];\n const objectForm = args[1]?.type === \"ObjectExpression\";\n const optionsNode = objectForm ? args[1] : args.length >= 3 ? args[2] : args[1];\n if (!baseNode || !optionsNode) {\n definitionBailouts.push(\n localBailout(\n \"local/unsupported-styled-definition\",\n spanOf(id, call),\n `styled definition ${name} must provide a base and options object`\n )\n );\n bailouts.push(...definitionBailouts);\n return;\n }\n const base = componentFromNode(\n candidate,\n id,\n program,\n imports,\n baseNode,\n definitionBailouts\n );\n if (!base) {\n bailouts.push(...definitionBailouts);\n return;\n }\n const baseClassNode = objectForm ? null : args.length >= 3 ? args[1] : null;\n const staticConfigNode = objectForm && args.length >= 3 ? args[2] : null;\n const baseDefinition = {\n kind: \"styled-definition\",\n id,\n name,\n span: spanOf(id, call),\n definitionSpan: spanOf(id, identifier),\n factory,\n base,\n baseClassName: baseClassNode ? elementValue(id, baseClassNode) : null,\n options: expressionReference(id, optionsNode),\n staticConfig: staticConfigNode ? expressionReference(id, staticConfigNode) : null\n };\n definitions.push(\n definitionBailouts.length === 0 ? { ...baseDefinition, complete: true, bailouts: [] } : {\n ...baseDefinition,\n complete: false,\n bailouts: definitionBailouts\n }\n );\n bailouts.push(...definitionBailouts);\n });\n return definitions.sort((left, right) => left.span.start - right.span.start);\n}\nconst DOM_STYLE_FRONTENDS = /* @__PURE__ */ new Set([\n \"tamagui/dom\",\n \"@tamagui/core/dom\",\n \"@tamagui/tailwind\"\n]);\nconst STYLE_FRONTENDS = /* @__PURE__ */ new Set([\n ...DOM_STYLE_FRONTENDS,\n \"tamagui\",\n \"@tamagui/core\",\n \"@tamagui/web\"\n]);\nfunction domStyleDefinitions(id, program, imports) {\n const definitions = [];\n walkAst(program, (node) => {\n if (node.type !== \"VariableDeclarator\") return;\n const identifier = childNode(node, \"id\");\n const name = identifierName(identifier);\n const call = childNode(node, \"init\");\n if (!name || !identifier || call?.type !== \"CallExpression\") return;\n const callee = childNode(call, \"callee\");\n const factoryName = callee && identifierName(callee);\n if (!factoryName) return;\n const binding = importBinding(program, factoryName);\n if (!binding || binding.imported !== \"style\" || !STYLE_FRONTENDS.has(binding.source)) {\n return;\n }\n const factory = hostImportProvenance(imports, binding.source, binding.imported);\n const value = childNodes(call, \"arguments\")[0];\n if (!factory || !value) return;\n definitions.push({\n kind: \"dom-style-definition\",\n id,\n name,\n span: spanOf(id, call),\n definitionSpan: spanOf(id, identifier),\n factory,\n value: expressionReference(id, value)\n });\n });\n return definitions.sort((left, right) => left.span.start - right.span.start);\n}\nfunction domStyleArgument(candidate, id, program, node) {\n let call = node;\n if (node.type === \"Identifier\") {\n const name = identifierName(node);\n const definition = name ? candidate.definitionOf(id, name) : null;\n if (!definition?.constant || !definition.initializer) return null;\n call = definition.initializer;\n }\n if (call.type !== \"CallExpression\") return null;\n const callee = childNode(call, \"callee\");\n const factoryName = callee && identifierName(callee);\n if (!factoryName) return null;\n const binding = importBinding(program, factoryName);\n if (!binding || binding.imported !== \"style\" || !STYLE_FRONTENDS.has(binding.source)) {\n return null;\n }\n return childNodes(call, \"arguments\")[0] ?? null;\n}\nfunction domStyleProgram(candidate, id, program, node) {\n if (node.type !== \"ArrayExpression\" || !Array.isArray(node.elements)) {\n const argument = domStyleArgument(candidate, id, program, node);\n return argument ? {\n kind: \"dom-style\",\n span: spanOf(id, node),\n items: [{ condition: null, value: expressionReference(id, argument) }]\n } : null;\n }\n const items = [];\n for (const rawItem of node.elements) {\n if (!isAstNode(rawItem)) return null;\n let item = rawItem;\n let condition = null;\n if (item.type === \"LogicalExpression\" && item.operator === \"&&\") {\n const left = childNode(item, \"left\");\n const right = childNode(item, \"right\");\n if (!left || !right) return null;\n condition = expressionReference(id, left);\n item = right;\n }\n const argument = domStyleArgument(candidate, id, program, item);\n if (!argument) {\n const staticValue = asStaticValue(item);\n if (staticValue === false || staticValue === null) continue;\n return null;\n }\n items.push({ condition, value: expressionReference(id, argument) });\n }\n return { kind: \"dom-style\", span: spanOf(id, node), items };\n}\nfunction normalizeElements(candidate, rawId, imports = []) {\n const id = resolvedModuleId(rawId);\n const program = candidate.programOf(id);\n const elements = [];\n const bailouts = [];\n walkAst(program, (node) => {\n if (node.type === \"JSXElement\") {\n const bailoutStart = bailouts.length;\n const opening = childNode(node, \"openingElement\");\n const target = opening && jsxComponentNode(opening);\n if (!opening || !target) return;\n const component = componentFromNode(\n candidate,\n id,\n program,\n imports,\n target,\n bailouts\n );\n if (!component) return;\n const closingElement = childNode(node, \"closingElement\");\n const closingName = closingElement && childNode(closingElement, \"name\");\n if (closingName) component.closingSpan = spanOf(id, closingName);\n const entries = jsxEntries(id, node, opening, bailouts);\n for (const entry of entries) {\n if (entry.kind !== \"prop\" || entry.name !== \"style\") continue;\n const raw = entry.value.kind === \"expression\" ? nodeAtSpan(program, entry.value.start, entry.value.end) : null;\n const styleProgram = raw && domStyleProgram(candidate, id, program, raw);\n const argument = raw && domStyleArgument(candidate, id, program, raw);\n if (styleProgram) entry.value = styleProgram;\n else if (argument) entry.value = expressionReference(id, argument);\n }\n elements.push(\n finalizeElement(\n {\n kind: \"element\",\n form: \"jsx\",\n id,\n span: spanOf(id, node),\n propsSpan: spanOf(id, opening),\n component\n },\n entries,\n bailouts.slice(bailoutStart)\n )\n );\n return;\n }\n if (node.type !== \"CallExpression\") return;\n const runtime = runtimeCall(program, node);\n if (!runtime) return;\n const element = normalizeRuntimeElement(\n candidate,\n id,\n program,\n imports,\n node,\n runtime,\n bailouts\n );\n if (element) {\n const entries = element.complete ? element.entries : element.bailedEntries;\n for (const entry of entries) {\n if (entry.kind !== \"prop\" || entry.name !== \"style\") continue;\n const raw = entry.value.kind === \"expression\" ? nodeAtSpan(program, entry.value.start, entry.value.end) : null;\n const styleProgram = raw && domStyleProgram(candidate, id, program, raw);\n const argument = raw && domStyleArgument(candidate, id, program, raw);\n if (styleProgram) entry.value = styleProgram;\n else if (argument) entry.value = expressionReference(id, argument);\n }\n elements.push(element);\n }\n });\n return {\n elements: elements.sort((left, right) => left.span.start - right.span.start),\n styledDefinitions: styledDefinitions(candidate, id, program, imports, bailouts),\n domStyleDefinitions: domStyleDefinitions(id, program, imports),\n bailouts: bailouts.sort((left, right) => left.span.start - right.span.start)\n };\n}\nfunction declarationForName(program, name) {\n return findAstNode(program, (node) => {\n if (node.type !== \"VariableDeclarator\") return false;\n return identifierName(childNode(node, \"id\")) === name;\n });\n}\nfunction nodeAtSpan(program, start, end) {\n return findAstNode(program, (node) => node.start === start && node.end === end);\n}\nfunction asAstNode(value, label) {\n if (!isAstNode(value)) throw new Error(`${label} is not an AST node`);\n return value;\n}\nexport {\n asAstNode,\n declarationForName,\n definitionFromDeclaration,\n nodeAtSpan,\n normalizeElements\n};\n//# sourceMappingURL=normalize.js.map\n"],"mappings":";;;;;;AAeA,SAAS,gBAAgB,MAAM,SAAS,UAAU;CAChD,IAAI,SAAS,WAAW,GAAG;EACzB,OAAO;GAAE,GAAG;GAAM,UAAU;GAAM;GAAS,UAAU,CAAC;EAAE;CAC1D;CACA,OAAO;EACL,GAAG;EACH,UAAU;EACV,eAAe;EACf;CACF;AACF;AACA,SAAS,0BAA0B,IAAI,MAAM,SAAS,aAAa;CACjE,IAAI,aAAa;CACjB,IAAI,cAAc;CAClB,IAAI,WAAW;CACf,IAAI,YAAY,SAAS,sBAAsB;EAC7C,aAAa,UAAU,aAAa,IAAI,KAAK;EAC7C,cAAc,UAAU,aAAa,MAAM;EAC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AM,MAAM,OAAO,MAAM,MAAM,GAAG,IAAI;IAC1G,MAAM,eAAe,OAAO,gBAAgB,WAAW,IAAI,SAAS,GAAG;IACvE,MAAM,WAAW,OAAO,iBAAiB,WAAW,IAAI,SAAS,GAAG;IACpE,IAAI,cAAc,MAAM,QAAQ;SAC3B,IAAI,UAAU,MAAM,QAAQ,oBAAoB,IAAI,QAAQ;GACnE;GACA,SAAS,KAAK,OAAO;EACvB;CACF,CAAC;CACD,OAAO;EACL,UAAU,SAAS,MAAM,MAAM,UAAU,KAAK,KAAK,QAAQ,MAAM,KAAK,KAAK;EAC3E,mBAAmB,kBAAkB,WAAW,IAAI,SAAS,SAAS,QAAQ;EAC9E,qBAAqB,oBAAoB,IAAI,SAAS,OAAO;EAC7D,UAAU,SAAS,MAAM,MAAM,UAAU,KAAK,KAAK,QAAQ,MAAM,KAAK,KAAK;CAC7E;AACF;AACA,SAAS,mBAAmB,SAAS,MAAM;CACzC,OAAO,YAAY,UAAU,SAAS;EACpC,IAAI,KAAK,SAAS,sBAAsB,OAAO;EAC/C,OAAO,eAAe,UAAU,MAAM,IAAI,CAAC,MAAM;CACnD,CAAC;AACH;AACA,SAAS,WAAW,SAAS,OAAO,KAAK;CACvC,OAAO,YAAY,UAAU,SAAS,KAAK,UAAU,SAAS,KAAK,QAAQ,GAAG;AAChF;AACA,SAAS,UAAU,OAAO,OAAO;CAC/B,IAAI,CAAC,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,MAAM,oBAAoB;CACpE,OAAO;AACT"}
1
+ {"version":3,"file":"normalize.js","names":[],"sources":["esm/normalize.js"],"sourcesContent":["import {\n childNode,\n childNodes,\n findAstNode,\n identifierName,\n isAstNode,\n walkAst\n} from \"./ast\";\nimport {\n expressionReference,\n resolvedModuleId,\n spanOf\n} from \"./contracts\";\nimport { linkedBailout, localBailout } from \"./diagnostics\";\nimport { hostImportProvenance } from \"./ir\";\nfunction finalizeElement(base, entries, bailouts) {\n if (bailouts.length === 0) {\n return { ...base, complete: true, entries, bailouts: [] };\n }\n return {\n ...base,\n complete: false,\n bailedEntries: entries,\n bailouts\n };\n}\nfunction definitionFromDeclaration(id, name, program, declaration) {\n let identifier = declaration;\n let initializer = null;\n let constant = false;\n if (declaration.type === \"VariableDeclarator\") {\n identifier = childNode(declaration, \"id\") ?? declaration;\n initializer = childNode(declaration, \"init\");\n constant = !!findAstNode(\n program,\n (node) => node.type === \"VariableDeclaration\" && node.kind === \"const\" && childNodes(node, \"declarations\").some(\n (candidate) => candidate.start === declaration.start\n )\n );\n } else if (declaration.type === \"Identifier\") {\n const declarator = findAstNode(\n program,\n (node) => node.type === \"VariableDeclarator\" && childNode(node, \"id\")?.start === declaration.start\n );\n if (declarator) {\n initializer = childNode(declarator, \"init\");\n constant = !!findAstNode(\n program,\n (node) => node.type === \"VariableDeclaration\" && node.kind === \"const\" && childNodes(node, \"declarations\").some(\n (candidate) => candidate.start === declarator.start\n )\n );\n }\n }\n return {\n id: resolvedModuleId(id),\n name,\n start: identifier.start,\n end: identifier.end,\n initializer,\n constant\n };\n}\nfunction importBinding(program, localName) {\n for (const statement of childNodes(program, \"body\")) {\n if (statement.type !== \"ImportDeclaration\") continue;\n const source = childNode(statement, \"source\");\n const sourceValue = source && typeof source.value === \"string\" ? source.value : null;\n if (!sourceValue) continue;\n for (const specifier of childNodes(statement, \"specifiers\")) {\n if (identifierName(childNode(specifier, \"local\")) !== localName) continue;\n if (specifier.type === \"ImportDefaultSpecifier\") {\n return { source: sourceValue, imported: \"default\" };\n }\n if (specifier.type === \"ImportNamespaceSpecifier\") {\n return { source: sourceValue, imported: \"*\" };\n }\n const imported = childNode(specifier, \"imported\");\n const importedName = identifierName(imported) ?? (typeof imported?.value === \"string\" ? imported.value : null);\n return importedName ? { source: sourceValue, imported: importedName } : null;\n }\n }\n return null;\n}\nfunction asStaticValue(node) {\n if (!node) return void 0;\n if (node.type === \"NullLiteral\") return null;\n if (node.type === \"Literal\" || node.type.endsWith(\"Literal\")) {\n const value = node.value;\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\" || value === null) {\n return value;\n }\n }\n return void 0;\n}\nfunction elementValue(id, node) {\n const staticValue = asStaticValue(node);\n return staticValue === void 0 ? expressionReference(id, node) : { kind: \"static\", value: staticValue, span: spanOf(id, node) };\n}\nfunction symbolDefinition(definition) {\n if (!definition) return null;\n return {\n id: definition.id,\n name: definition.name,\n span: {\n id: definition.id,\n start: definition.start,\n end: definition.end\n },\n initializer: definition.initializer ? expressionReference(definition.id, definition.initializer) : null,\n constant: definition.constant\n };\n}\nfunction componentFromNode(candidate, id, program, imports, node, bailouts) {\n const literal = asStaticValue(node);\n if (typeof literal === \"string\") {\n return {\n kind: \"intrinsic\",\n name: literal,\n span: spanOf(id, node),\n closingSpan: null,\n definition: null,\n provenance: null\n };\n }\n if ((node.type === \"MemberExpression\" || node.type === \"JSXMemberExpression\") && node.computed !== true) {\n const objectName = identifierName(childNode(node, \"object\"));\n const memberName = identifierName(childNode(node, \"property\"));\n const binding2 = objectName ? importBinding(program, objectName) : null;\n if (memberName && binding2?.imported === \"html\") {\n const provenance2 = hostImportProvenance(imports, binding2.source, binding2.imported);\n if (provenance2) {\n return {\n kind: \"binding\",\n name: memberName,\n span: spanOf(id, node),\n closingSpan: null,\n definition: null,\n provenance: provenance2\n };\n }\n }\n }\n const name = identifierName(node);\n if (!name) {\n bailouts.push(\n localBailout(\n \"local/unsupported-element-name\",\n spanOf(id, node),\n `Element target ${node.type} is not a stable identifier or intrinsic tag`\n )\n );\n return null;\n }\n const intrinsic = /^[a-z]/.test(name);\n const binding = intrinsic ? null : importBinding(program, name);\n const provenance = binding ? hostImportProvenance(imports, binding.source, binding.imported) : null;\n const definition = intrinsic ? null : symbolDefinition(candidate.definitionOf(id, name));\n if (!intrinsic && !definition && !provenance) {\n bailouts.push(\n linkedBailout(\n \"linked/unresolved-component-binding\",\n spanOf(id, node),\n `Component binding ${name} has no linked definition`\n )\n );\n }\n return {\n kind: intrinsic ? \"intrinsic\" : \"binding\",\n name,\n span: spanOf(id, node),\n closingSpan: null,\n definition,\n provenance\n };\n}\nfunction jsxComponentNode(opening) {\n return childNode(opening, \"name\");\n}\nfunction jsxEntries(id, element, opening, bailouts) {\n const entries = [];\n for (const attribute of childNodes(opening, \"attributes\")) {\n if (attribute.type === \"JSXSpreadAttribute\") {\n const argument = childNode(attribute, \"argument\");\n if (argument) {\n entries.push({\n kind: \"spread\",\n span: spanOf(id, attribute),\n value: expressionReference(id, argument)\n });\n }\n continue;\n }\n if (attribute.type !== \"JSXAttribute\") continue;\n const nameNode = childNode(attribute, \"name\");\n const name = identifierName(nameNode);\n if (!name) {\n bailouts.push(\n localBailout(\n \"local/unsupported-prop-key\",\n spanOf(id, attribute),\n \"Namespaced JSX attributes are not statically supported\"\n )\n );\n continue;\n }\n const rawValue = childNode(attribute, \"value\");\n let value;\n if (!rawValue) {\n value = { kind: \"static\", value: true, span: spanOf(id, attribute) };\n } else if (rawValue.type === \"JSXExpressionContainer\") {\n const expression = childNode(rawValue, \"expression\");\n if (!expression || expression.type === \"JSXEmptyExpression\") {\n bailouts.push(\n localBailout(\n \"local/unsupported-expression\",\n spanOf(id, rawValue),\n `JSX prop ${name} has no expression`\n )\n );\n continue;\n }\n value = elementValue(id, expression);\n } else {\n value = elementValue(id, rawValue);\n }\n entries.push({ kind: \"prop\", name, span: spanOf(id, attribute), value });\n }\n for (const child of childNodes(element, \"children\")) {\n let value;\n if (child.type === \"JSXText\") {\n if (typeof child.value !== \"string\" || child.value.trim() === \"\") continue;\n value = {\n kind: \"static\",\n value: child.value,\n span: spanOf(id, child)\n };\n } else if (child.type === \"JSXExpressionContainer\") {\n const expression = childNode(child, \"expression\");\n value = !expression || expression.type === \"JSXEmptyExpression\" ? { kind: \"empty\", span: spanOf(id, child) } : elementValue(id, expression);\n } else if (child.type === \"JSXElement\" || child.type === \"JSXFragment\") {\n value = { kind: \"element\", span: spanOf(id, child) };\n } else {\n bailouts.push(\n localBailout(\n \"local/unsupported-child\",\n spanOf(id, child),\n `JSX child ${child.type} cannot be normalized`\n )\n );\n continue;\n }\n entries.push({ kind: \"child\", span: spanOf(id, child), value });\n }\n return entries.sort((left, right) => left.span.start - right.span.start);\n}\nfunction propertyName(property) {\n if (property.computed === true) return null;\n const key = childNode(property, \"key\");\n const name = identifierName(key);\n if (name) return name;\n const literal = asStaticValue(key);\n return typeof literal === \"string\" || typeof literal === \"number\" ? String(literal) : null;\n}\nfunction runtimeChildEntries(id, program, node, bailouts) {\n const rawNodes = node.type === \"ArrayExpression\" ? node.elements : null;\n if (Array.isArray(rawNodes) && rawNodes.some((child) => child === null || !isAstNode(child))) {\n bailouts.push(\n localBailout(\n \"local/unsupported-child\",\n spanOf(id, node),\n \"Sparse compiled children cannot be normalized without changing order\"\n )\n );\n return [];\n }\n const nodes = Array.isArray(rawNodes) ? rawNodes.filter(isAstNode) : [node];\n return nodes.flatMap((child) => {\n if (child.type === \"SpreadElement\") {\n bailouts.push(\n localBailout(\n \"local/unsupported-child\",\n spanOf(id, child),\n \"Spread children cannot be statically ordered\"\n )\n );\n return [];\n }\n if (child.type === \"CallExpression\" && runtimeCall(program, child)) {\n return [\n {\n kind: \"child\",\n span: spanOf(id, child),\n value: { kind: \"element\", span: spanOf(id, child) }\n }\n ];\n }\n return [{ kind: \"child\", span: spanOf(id, child), value: elementValue(id, child) }];\n });\n}\nfunction objectEntries(id, program, object, bailouts) {\n const entries = [];\n for (const property of childNodes(object, \"properties\")) {\n if (property.type === \"SpreadElement\") {\n const argument = childNode(property, \"argument\");\n if (argument) {\n const spread = {\n kind: \"spread\",\n span: spanOf(id, property),\n value: expressionReference(id, argument)\n };\n entries.push(spread);\n }\n continue;\n }\n if (property.type !== \"Property\" && property.type !== \"ObjectProperty\") {\n bailouts.push(\n localBailout(\n \"local/unsupported-prop-key\",\n spanOf(id, property),\n `Runtime props entry ${property.type} is not a data property`\n )\n );\n continue;\n }\n const name = propertyName(property);\n const valueNode = childNode(property, \"value\");\n if (!name || !valueNode) {\n bailouts.push(\n localBailout(\n \"local/unsupported-prop-key\",\n spanOf(id, property),\n \"Computed runtime prop keys are not statically supported\"\n )\n );\n continue;\n }\n if (name === \"children\") {\n entries.push(...runtimeChildEntries(id, program, valueNode, bailouts));\n continue;\n }\n const prop = {\n kind: \"prop\",\n name,\n span: spanOf(id, property),\n value: elementValue(id, valueNode)\n };\n entries.push(prop);\n }\n return entries;\n}\nfunction runtimeCall(program, call) {\n const callee = childNode(call, \"callee\");\n if (!callee) return null;\n const directName = identifierName(callee);\n if (directName) {\n const provenance2 = importBinding(program, directName);\n if (provenance2?.source === \"react/jsx-runtime\" && (provenance2.imported === \"jsx\" || provenance2.imported === \"jsxs\")) {\n return { form: \"jsx-runtime\" };\n }\n if (provenance2?.source === \"react\" && provenance2.imported === \"createElement\") {\n return { form: \"create-element\" };\n }\n }\n if (callee.type !== \"MemberExpression\" || callee.computed === true) return null;\n const objectName = identifierName(childNode(callee, \"object\"));\n const propertyName2 = identifierName(childNode(callee, \"property\"));\n if (propertyName2 !== \"createElement\" || !objectName) return null;\n const provenance = importBinding(program, objectName);\n return provenance?.source === \"react\" && (provenance.imported === \"default\" || provenance.imported === \"*\") ? { form: \"create-element\" } : null;\n}\nfunction normalizeRuntimeElement(candidate, id, program, imports, call, runtime, bailouts) {\n const bailoutStart = bailouts.length;\n const args = childNodes(call, \"arguments\");\n const target = args[0];\n if (!target) {\n bailouts.push(\n localBailout(\n \"local/invalid-element-call\",\n spanOf(id, call),\n `${runtime.form} call has no element target`\n )\n );\n return null;\n }\n const component = componentFromNode(candidate, id, program, imports, target, bailouts);\n if (!component) return null;\n const entries = [];\n const props = args[1];\n if (props && asStaticValue(props) !== null) {\n if (props.type === \"ObjectExpression\") {\n entries.push(...objectEntries(id, program, props, bailouts));\n } else {\n entries.push({\n kind: \"spread\",\n span: spanOf(id, props),\n value: expressionReference(id, props)\n });\n }\n }\n if (runtime.form === \"create-element\") {\n for (const child of args.slice(2)) {\n entries.push(...runtimeChildEntries(id, program, child, bailouts));\n }\n }\n return finalizeElement(\n {\n kind: \"element\",\n form: runtime.form,\n id,\n span: spanOf(id, call),\n propsSpan: props ? spanOf(id, props) : null,\n component\n },\n entries.sort((left, right) => left.span.start - right.span.start),\n bailouts.slice(bailoutStart)\n );\n}\nfunction styledDefinitions(candidate, id, program, imports, bailouts) {\n const definitions = [];\n walkAst(program, (node) => {\n if (node.type !== \"VariableDeclarator\") return;\n const identifier = childNode(node, \"id\");\n const name = identifierName(identifier);\n const call = childNode(node, \"init\");\n if (!name || !identifier || call?.type !== \"CallExpression\") return;\n const callee = childNode(call, \"callee\");\n const factoryName = callee && identifierName(callee);\n if (!factoryName) return;\n const binding = importBinding(program, factoryName);\n if (!binding || binding.imported !== \"styled\") return;\n const factory = hostImportProvenance(imports, binding.source, binding.imported);\n if (!factory) return;\n const definitionBailouts = [];\n const args = childNodes(call, \"arguments\");\n const baseNode = args[0];\n const objectForm = args[1]?.type === \"ObjectExpression\";\n const optionsNode = objectForm ? args[1] : args.length >= 3 ? args[2] : args[1];\n if (!baseNode || !optionsNode) {\n definitionBailouts.push(\n localBailout(\n \"local/unsupported-styled-definition\",\n spanOf(id, call),\n `styled definition ${name} must provide a base and options object`\n )\n );\n bailouts.push(...definitionBailouts);\n return;\n }\n const base = componentFromNode(\n candidate,\n id,\n program,\n imports,\n baseNode,\n definitionBailouts\n );\n if (!base) {\n bailouts.push(...definitionBailouts);\n return;\n }\n const baseClassNode = objectForm ? null : args.length >= 3 ? args[1] : null;\n const staticConfigNode = objectForm && args.length >= 3 ? args[2] : null;\n const baseDefinition = {\n kind: \"styled-definition\",\n id,\n name,\n span: spanOf(id, call),\n definitionSpan: spanOf(id, identifier),\n factory,\n base,\n baseClassName: baseClassNode ? elementValue(id, baseClassNode) : null,\n options: expressionReference(id, optionsNode),\n staticConfig: staticConfigNode ? expressionReference(id, staticConfigNode) : null\n };\n definitions.push(\n definitionBailouts.length === 0 ? { ...baseDefinition, complete: true, bailouts: [] } : {\n ...baseDefinition,\n complete: false,\n bailouts: definitionBailouts\n }\n );\n bailouts.push(...definitionBailouts);\n });\n return definitions.sort((left, right) => left.span.start - right.span.start);\n}\nconst DOM_STYLE_FRONTENDS = /* @__PURE__ */ new Set([\n \"tamagui/dom\",\n \"@tamagui/core/dom\",\n \"@tamagui/tailwind\"\n]);\nconst STYLE_FRONTENDS = /* @__PURE__ */ new Set([\n ...DOM_STYLE_FRONTENDS,\n \"tamagui\",\n \"@tamagui/core\",\n \"@tamagui/web\"\n]);\nfunction domStyleDefinitions(id, program, imports) {\n const definitions = [];\n walkAst(program, (node) => {\n if (node.type !== \"VariableDeclarator\") return;\n const identifier = childNode(node, \"id\");\n const name = identifierName(identifier);\n const call = childNode(node, \"init\");\n if (!name || !identifier || call?.type !== \"CallExpression\") return;\n const callee = childNode(call, \"callee\");\n const factoryName = callee && identifierName(callee);\n if (!factoryName) return;\n const binding = importBinding(program, factoryName);\n if (!binding || binding.imported !== \"style\" || !STYLE_FRONTENDS.has(binding.source)) {\n return;\n }\n const factory = hostImportProvenance(imports, binding.source, binding.imported);\n const value = childNodes(call, \"arguments\")[0];\n if (!factory || !value) return;\n definitions.push({\n kind: \"dom-style-definition\",\n id,\n name,\n span: spanOf(id, call),\n definitionSpan: spanOf(id, identifier),\n factory,\n value: expressionReference(id, value)\n });\n });\n return definitions.sort((left, right) => left.span.start - right.span.start);\n}\nfunction domStyleArgument(candidate, id, program, node) {\n let call = node;\n if (node.type === \"Identifier\") {\n const name = identifierName(node);\n const definition = name ? candidate.definitionOf(id, name) : null;\n if (!definition?.constant || !definition.initializer) return null;\n call = definition.initializer;\n }\n if (call.type !== \"CallExpression\") return null;\n const callee = childNode(call, \"callee\");\n const factoryName = callee && identifierName(callee);\n if (!factoryName) return null;\n const binding = importBinding(program, factoryName);\n if (!binding || binding.imported !== \"style\" || !STYLE_FRONTENDS.has(binding.source)) {\n return null;\n }\n return childNodes(call, \"arguments\")[0] ?? null;\n}\nfunction domStyleProgram(candidate, id, program, node) {\n if (node.type !== \"ArrayExpression\" || !Array.isArray(node.elements)) {\n const argument = domStyleArgument(candidate, id, program, node);\n return argument ? {\n kind: \"dom-style\",\n span: spanOf(id, node),\n items: [{ condition: null, value: expressionReference(id, argument) }]\n } : null;\n }\n const items = [];\n for (const rawItem of node.elements) {\n if (!isAstNode(rawItem)) return null;\n let item = rawItem;\n let condition = null;\n if (item.type === \"LogicalExpression\" && item.operator === \"&&\") {\n const left = childNode(item, \"left\");\n const right = childNode(item, \"right\");\n if (!left || !right) return null;\n condition = expressionReference(id, left);\n item = right;\n }\n const argument = domStyleArgument(candidate, id, program, item);\n if (!argument) {\n const staticValue = asStaticValue(item);\n if (staticValue === false || staticValue === null) continue;\n return null;\n }\n items.push({ condition, value: expressionReference(id, argument) });\n }\n return { kind: \"dom-style\", span: spanOf(id, node), items };\n}\nfunction normalizeElements(candidate, rawId, imports = []) {\n const id = resolvedModuleId(rawId);\n const program = candidate.programOf(id);\n const elements = [];\n const bailouts = [];\n walkAst(program, (node) => {\n if (node.type === \"JSXElement\") {\n const bailoutStart = bailouts.length;\n const opening = childNode(node, \"openingElement\");\n const target = opening && jsxComponentNode(opening);\n if (!opening || !target) return;\n const component = componentFromNode(\n candidate,\n id,\n program,\n imports,\n target,\n bailouts\n );\n if (!component) return;\n const closingElement = childNode(node, \"closingElement\");\n const closingName = closingElement && childNode(closingElement, \"name\");\n if (closingName) component.closingSpan = spanOf(id, closingName);\n const entries = jsxEntries(id, node, opening, bailouts);\n for (const entry of entries) {\n if (entry.kind !== \"prop\" || entry.name !== \"style\") continue;\n const raw = entry.value.kind === \"expression\" ? nodeAtSpan(program, entry.value.start, entry.value.end) : null;\n const styleProgram = raw && domStyleProgram(candidate, id, program, raw);\n const argument = raw && domStyleArgument(candidate, id, program, raw);\n if (styleProgram) entry.value = styleProgram;\n else if (argument) entry.value = expressionReference(id, argument);\n }\n elements.push(\n finalizeElement(\n {\n kind: \"element\",\n form: \"jsx\",\n id,\n span: spanOf(id, node),\n propsSpan: spanOf(id, opening),\n component\n },\n entries,\n bailouts.slice(bailoutStart)\n )\n );\n return;\n }\n if (node.type !== \"CallExpression\") return;\n const runtime = runtimeCall(program, node);\n if (!runtime) return;\n const element = normalizeRuntimeElement(\n candidate,\n id,\n program,\n imports,\n node,\n runtime,\n bailouts\n );\n if (element) {\n const entries = element.complete ? element.entries : element.bailedEntries;\n for (const entry of entries) {\n if (entry.kind !== \"prop\" || entry.name !== \"style\") continue;\n const raw = entry.value.kind === \"expression\" ? nodeAtSpan(program, entry.value.start, entry.value.end) : null;\n const styleProgram = raw && domStyleProgram(candidate, id, program, raw);\n const argument = raw && domStyleArgument(candidate, id, program, raw);\n if (styleProgram) entry.value = styleProgram;\n else if (argument) entry.value = expressionReference(id, argument);\n }\n elements.push(element);\n }\n });\n return {\n elements: elements.sort((left, right) => left.span.start - right.span.start),\n styledDefinitions: styledDefinitions(candidate, id, program, imports, bailouts),\n domStyleDefinitions: domStyleDefinitions(id, program, imports),\n bailouts: bailouts.sort((left, right) => left.span.start - right.span.start)\n };\n}\nfunction nodeAtSpan(program, start, end) {\n return findAstNode(program, (node) => node.start === start && node.end === end);\n}\nfunction asAstNode(value, label) {\n if (!isAstNode(value)) throw new Error(`${label} is not an AST node`);\n return value;\n}\nexport {\n asAstNode,\n definitionFromDeclaration,\n nodeAtSpan,\n normalizeElements\n};\n//# sourceMappingURL=normalize.js.map\n"],"mappings":";;;;;;AAeA,SAAS,gBAAgB,MAAM,SAAS,UAAU;CAChD,IAAI,SAAS,WAAW,GAAG;EACzB,OAAO;GAAE,GAAG;GAAM,UAAU;GAAM;GAAS,UAAU,CAAC;EAAE;CAC1D;CACA,OAAO;EACL,GAAG;EACH,UAAU;EACV,eAAe;EACf;CACF;AACF;AACA,SAAS,0BAA0B,IAAI,MAAM,SAAS,aAAa;CACjE,IAAI,aAAa;CACjB,IAAI,cAAc;CAClB,IAAI,WAAW;CACf,IAAI,YAAY,SAAS,sBAAsB;EAC7C,aAAa,U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;IACrD,MAAM,MAAM,MAAM,MAAM,SAAS,eAAe,WAAW,SAAS,MAAM,MAAM,OAAO,MAAM,MAAM,GAAG,IAAI;IAC1G,MAAM,eAAe,OAAO,gBAAgB,WAAW,IAAI,SAAS,GAAG;IACvE,MAAM,WAAW,OAAO,iBAAiB,WAAW,IAAI,SAAS,GAAG;IACpE,IAAI,cAAc,MAAM,QAAQ;SAC3B,IAAI,UAAU,MAAM,QAAQ,oBAAoB,IAAI,QAAQ;GACnE;GACA,SAAS,KAAK,OAAO;EACvB;CACF,CAAC;CACD,OAAO;EACL,UAAU,SAAS,MAAM,MAAM,UAAU,KAAK,KAAK,QAAQ,MAAM,KAAK,KAAK;EAC3E,mBAAmB,kBAAkB,WAAW,IAAI,SAAS,SAAS,QAAQ;EAC9E,qBAAqB,oBAAoB,IAAI,SAAS,OAAO;EAC7D,UAAU,SAAS,MAAM,MAAM,UAAU,KAAK,KAAK,QAAQ,MAAM,KAAK,KAAK;CAC7E;AACF;AACA,SAAS,WAAW,SAAS,OAAO,KAAK;CACvC,OAAO,YAAY,UAAU,SAAS,KAAK,UAAU,SAAS,KAAK,QAAQ,GAAG;AAChF;AACA,SAAS,UAAU,OAAO,OAAO;CAC/B,IAAI,CAAC,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,MAAM,oBAAoB;CACpE,OAAO;AACT"}
package/dist/esm/yuku.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Analyzer } from "yuku-analyzer";
2
2
  import { resolveFromHost, resolvedModuleId } from "./contracts.mjs";
3
3
  import { childNode, walkAst } from "./ast.mjs";
4
- import { asAstNode, declarationForName, definitionFromDeclaration, nodeAtSpan } from "./normalize.mjs";
4
+ import { asAstNode, definitionFromDeclaration, nodeAtSpan } from "./normalize.mjs";
5
5
 
6
6
  var YukuCandidate = class {
7
7
  constructor(project) {
@@ -39,8 +39,7 @@ var YukuCandidate = class {
39
39
  const declaration = symbol.declarations[0];
40
40
  if (!declaration) return null;
41
41
  const program = asAstNode(symbol.module.ast, `${symbol.module.path} program`);
42
- const normalizedDeclaration = declarationForName(program, symbol.name) ?? asAstNode(declaration, `${symbol.name} declaration`);
43
- return definitionFromDeclaration(symbol.module.path, symbol.name, program, normalizedDeclaration);
42
+ return definitionFromDeclaration(symbol.module.path, symbol.name, program, asAstNode(declaration, `${symbol.name} declaration`));
44
43
  }
45
44
  definitionOf(id, localName) {
46
45
  const symbol = this.#canonicalSymbol(id, localName);
@@ -1 +1 @@
1
- {"version":3,"file":"yuku.js","names":["#analyzer","#parseCounts","#module","#canonicalSymbol","#definitionSite"],"sources":["esm/yuku.js"],"sourcesContent":["import { Analyzer } from \"yuku-analyzer\";\nimport { resolveFromHost, resolvedModuleId } from \"./contracts\";\nimport { childNode, walkAst } from \"./ast\";\nimport {\n asAstNode,\n declarationForName,\n definitionFromDeclaration,\n nodeAtSpan\n} from \"./normalize\";\nclass YukuCandidate {\n constructor(project) {\n this.project = project;\n this.#analyzer = new Analyzer({\n resolve: (specifier, importer) => resolveFromHost(this.project.resolutions, specifier, importer)\n });\n for (const [id, source] of project.files) this.addFile(id, source);\n }\n project;\n name = \"yuku\";\n #analyzer;\n #parseCounts = /* @__PURE__ */ new Map();\n addFile(id, source) {\n this.#analyzer.addFile(id, source, { preserveParens: true, sourceType: \"module\" });\n this.#parseCounts.set(id, (this.#parseCounts.get(id) ?? 0) + 1);\n }\n removeFile(id) {\n return this.#analyzer.removeFile(id);\n }\n link() {\n this.#analyzer.link();\n }\n #module(id) {\n const module = this.#analyzer.module(id);\n if (!module) throw new Error(`yuku: unknown module ${id}`);\n return module;\n }\n #canonicalSymbol(id, localName) {\n const symbol = this.#module(id).resolve(localName);\n return symbol ? this.#analyzer.definitionOf(symbol)?.symbol ?? null : null;\n }\n #definitionSite(symbol) {\n const declaration = symbol.declarations[0];\n if (!declaration) return null;\n const program = asAstNode(symbol.module.ast, `${symbol.module.path} program`);\n const normalizedDeclaration = declarationForName(program, symbol.name) ?? asAstNode(declaration, `${symbol.name} declaration`);\n return definitionFromDeclaration(\n symbol.module.path,\n symbol.name,\n program,\n normalizedDeclaration\n );\n }\n definitionOf(id, localName) {\n const symbol = this.#canonicalSymbol(id, localName);\n return symbol ? this.#definitionSite(symbol) : null;\n }\n definitionAt(id, start, end) {\n const module = this.#module(id);\n const node = nodeAtSpan(asAstNode(module.ast, `${module.path} program`), start, end);\n if (!node) return null;\n const symbol = module.symbolOf(node);\n const definition = symbol && this.#analyzer.definitionOf(symbol)?.symbol;\n return definition ? this.#definitionSite(definition) : null;\n }\n referencesOf(definition) {\n const symbol = this.#canonicalSymbol(definition.id, definition.name);\n if (!symbol) return [];\n return this.#analyzer.referencesOf(symbol).map(({ module, reference }) => ({\n id: resolvedModuleId(module.path),\n name: reference.name,\n start: reference.node.start,\n end: reference.node.end\n }));\n }\n dependenciesOf(id) {\n return this.#module(id).dependencies.map((module) => module.path).sort();\n }\n dependentsOf(id) {\n return this.#module(id).dependents.map((module) => module.path).sort();\n }\n affectedBy(id) {\n const affected = /* @__PURE__ */ new Set([id]);\n const queue = [id];\n while (queue.length) {\n const current = queue.shift();\n for (const dependent of this.dependentsOf(current)) {\n if (!affected.has(dependent)) {\n affected.add(dependent);\n queue.push(dependent);\n }\n }\n }\n return [...affected].sort();\n }\n programOf(id) {\n return asAstNode(this.#module(id).ast, `${id} program`);\n }\n sourceOf(id) {\n return this.#module(id).source;\n }\n parseCount(id) {\n return this.#parseCounts.get(id) ?? 0;\n }\n diagnostics() {\n const parseDiagnostics = [...this.#analyzer.modules.values()].flatMap(\n (module) => module.diagnostics.map((diagnostic) => ({\n kind: \"parse\",\n id: resolvedModuleId(module.path),\n message: diagnostic.message\n }))\n );\n return [\n ...parseDiagnostics,\n ...this.#analyzer.diagnostics.map((diagnostic) => ({\n kind: \"link\",\n id: resolvedModuleId(diagnostic.module),\n message: diagnostic.message\n }))\n ];\n }\n}\nconst yukuFactory = {\n name: \"yuku\",\n create: (project) => new YukuCandidate(project),\n scanImports(id, source) {\n const candidate = new YukuCandidate({\n files: /* @__PURE__ */ new Map([[id, source]]),\n resolutions: /* @__PURE__ */ new Map()\n });\n const found = [];\n walkAst(candidate.programOf(id), (node) => {\n if (node.type !== \"ImportDeclaration\" && node.type !== \"ExportNamedDeclaration\" && node.type !== \"ExportAllDeclaration\" && node.type !== \"ImportExpression\") {\n return;\n }\n const sourceNode = childNode(node, \"source\");\n if (sourceNode && typeof sourceNode.value === \"string\") {\n found.push({ start: node.start, specifier: sourceNode.value });\n }\n });\n return [\n ...new Set(\n found.sort((left, right) => left.start - right.start).map(({ specifier }) => specifier)\n )\n ];\n }\n};\nfunction parseModuleAst(source, id = \"/tamagui/compiler-module.tsx\") {\n const candidate = yukuFactory.create({\n files: /* @__PURE__ */ new Map([[id, source]]),\n resolutions: /* @__PURE__ */ new Map()\n });\n const diagnostics = candidate.diagnostics().filter((diagnostic) => diagnostic.kind === \"parse\");\n if (diagnostics.length) {\n throw new Error(\n `Unable to parse ${id}: ${diagnostics.map(({ message }) => message).join(\"; \")}`\n );\n }\n return candidate.programOf(id);\n}\nexport {\n parseModuleAst,\n yukuFactory\n};\n//# sourceMappingURL=yuku.js.map\n"],"mappings":";;;;;;AASA,IAAM,gBAAN,MAAoB;CAClB,YAAY,SAAS;EACnB,KAAK,UAAU;EACf,KAAKA,YAAY,IAAI,SAAS,EAC5B,UAAU,WAAW,aAAa,gBAAgB,KAAK,QAAQ,aAAa,WAAW,QAAQ,EACjG,CAAC;EACD,KAAK,MAAM,CAAC,IAAI,WAAW,QAAQ,OAAO,KAAK,QAAQ,IAAI,MAAM;CACnE;CACA;CACA,OAAO;CACP;CACA,+BAA+B,IAAI,IAAI;CACvC,QAAQ,IAAI,QAAQ;EAClB,KAAKA,UAAU,QAAQ,IAAI,QAAQ;GAAE,gBAAgB;GAAM,YAAY;EAAS,CAAC;EACjF,KAAKC,aAAa,IAAI,KAAK,KAAKA,aAAa,IAAI,EAAE,KAAK,KAAK,CAAC;CAChE;CACA,WAAW,IAAI;EAC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AI,GAC/E;CACF;CACA,OAAO,UAAU,UAAU,EAAE;AAC/B"}
1
+ {"version":3,"file":"yuku.js","names":["#analyzer","#parseCounts","#module","#canonicalSymbol","#definitionSite"],"sources":["esm/yuku.js"],"sourcesContent":["import { Analyzer } from \"yuku-analyzer\";\nimport { resolveFromHost, resolvedModuleId } from \"./contracts\";\nimport { childNode, walkAst } from \"./ast\";\nimport { asAstNode, definitionFromDeclaration, nodeAtSpan } from \"./normalize\";\nclass YukuCandidate {\n constructor(project) {\n this.project = project;\n this.#analyzer = new Analyzer({\n resolve: (specifier, importer) => resolveFromHost(this.project.resolutions, specifier, importer)\n });\n for (const [id, source] of project.files) this.addFile(id, source);\n }\n project;\n name = \"yuku\";\n #analyzer;\n #parseCounts = /* @__PURE__ */ new Map();\n addFile(id, source) {\n this.#analyzer.addFile(id, source, { preserveParens: true, sourceType: \"module\" });\n this.#parseCounts.set(id, (this.#parseCounts.get(id) ?? 0) + 1);\n }\n removeFile(id) {\n return this.#analyzer.removeFile(id);\n }\n link() {\n this.#analyzer.link();\n }\n #module(id) {\n const module = this.#analyzer.module(id);\n if (!module) throw new Error(`yuku: unknown module ${id}`);\n return module;\n }\n #canonicalSymbol(id, localName) {\n const symbol = this.#module(id).resolve(localName);\n return symbol ? this.#analyzer.definitionOf(symbol)?.symbol ?? null : null;\n }\n #definitionSite(symbol) {\n const declaration = symbol.declarations[0];\n if (!declaration) return null;\n const program = asAstNode(symbol.module.ast, `${symbol.module.path} program`);\n return definitionFromDeclaration(\n symbol.module.path,\n symbol.name,\n program,\n asAstNode(declaration, `${symbol.name} declaration`)\n );\n }\n definitionOf(id, localName) {\n const symbol = this.#canonicalSymbol(id, localName);\n return symbol ? this.#definitionSite(symbol) : null;\n }\n definitionAt(id, start, end) {\n const module = this.#module(id);\n const node = nodeAtSpan(asAstNode(module.ast, `${module.path} program`), start, end);\n if (!node) return null;\n const symbol = module.symbolOf(node);\n const definition = symbol && this.#analyzer.definitionOf(symbol)?.symbol;\n return definition ? this.#definitionSite(definition) : null;\n }\n referencesOf(definition) {\n const symbol = this.#canonicalSymbol(definition.id, definition.name);\n if (!symbol) return [];\n return this.#analyzer.referencesOf(symbol).map(({ module, reference }) => ({\n id: resolvedModuleId(module.path),\n name: reference.name,\n start: reference.node.start,\n end: reference.node.end\n }));\n }\n dependenciesOf(id) {\n return this.#module(id).dependencies.map((module) => module.path).sort();\n }\n dependentsOf(id) {\n return this.#module(id).dependents.map((module) => module.path).sort();\n }\n affectedBy(id) {\n const affected = /* @__PURE__ */ new Set([id]);\n const queue = [id];\n while (queue.length) {\n const current = queue.shift();\n for (const dependent of this.dependentsOf(current)) {\n if (!affected.has(dependent)) {\n affected.add(dependent);\n queue.push(dependent);\n }\n }\n }\n return [...affected].sort();\n }\n programOf(id) {\n return asAstNode(this.#module(id).ast, `${id} program`);\n }\n sourceOf(id) {\n return this.#module(id).source;\n }\n parseCount(id) {\n return this.#parseCounts.get(id) ?? 0;\n }\n diagnostics() {\n const parseDiagnostics = [...this.#analyzer.modules.values()].flatMap(\n (module) => module.diagnostics.map((diagnostic) => ({\n kind: \"parse\",\n id: resolvedModuleId(module.path),\n message: diagnostic.message\n }))\n );\n return [\n ...parseDiagnostics,\n ...this.#analyzer.diagnostics.map((diagnostic) => ({\n kind: \"link\",\n id: resolvedModuleId(diagnostic.module),\n message: diagnostic.message\n }))\n ];\n }\n}\nconst yukuFactory = {\n name: \"yuku\",\n create: (project) => new YukuCandidate(project),\n scanImports(id, source) {\n const candidate = new YukuCandidate({\n files: /* @__PURE__ */ new Map([[id, source]]),\n resolutions: /* @__PURE__ */ new Map()\n });\n const found = [];\n walkAst(candidate.programOf(id), (node) => {\n if (node.type !== \"ImportDeclaration\" && node.type !== \"ExportNamedDeclaration\" && node.type !== \"ExportAllDeclaration\" && node.type !== \"ImportExpression\") {\n return;\n }\n const sourceNode = childNode(node, \"source\");\n if (sourceNode && typeof sourceNode.value === \"string\") {\n found.push({ start: node.start, specifier: sourceNode.value });\n }\n });\n return [\n ...new Set(\n found.sort((left, right) => left.start - right.start).map(({ specifier }) => specifier)\n )\n ];\n }\n};\nfunction parseModuleAst(source, id = \"/tamagui/compiler-module.tsx\") {\n const candidate = yukuFactory.create({\n files: /* @__PURE__ */ new Map([[id, source]]),\n resolutions: /* @__PURE__ */ new Map()\n });\n const diagnostics = candidate.diagnostics().filter((diagnostic) => diagnostic.kind === \"parse\");\n if (diagnostics.length) {\n throw new Error(\n `Unable to parse ${id}: ${diagnostics.map(({ message }) => message).join(\"; \")}`\n );\n }\n return candidate.programOf(id);\n}\nexport {\n parseModuleAst,\n yukuFactory\n};\n//# sourceMappingURL=yuku.js.map\n"],"mappings":";;;;;;AAIA,IAAM,gBAAN,MAAoB;CAClB,YAAY,SAAS;EACnB,KAAK,UAAU;EACf,KAAKA,YAAY,IAAI,SAAS,EAC5B,UAAU,WAAW,aAAa,gBAAgB,KAAK,QAAQ,aAAa,WAAW,QAAQ,EACjG,CAAC;EACD,KAAK,MAAM,CAAC,IAAI,WAAW,QAAQ,OAAO,KAAK,QAAQ,IAAI,MAAM;CACnE;CACA;CACA,OAAO;CACP;CACA,+BAA+B,IAAI,IAAI;CACvC,QAAQ,IAAI,QAAQ;EAClB,KAAKA,UAAU,QAAQ,IAAI,QAAQ;GAAE,gBAAgB;GAAM,YAAY;EAAS,CAAC;EACjF,KAAKC,aAAa,IAAI,KAAK,KAAKA,aAAa,IAAI,EAAE,KAAK,KAAK,CAAC;CAChE;CACA,WAAW,IAAI;EACb,OAAO,KAAKD,UAAU,WAAW,EAAE;CACrC;CACA,OAAO;EACL,KAAKA,UAAU,KAAK;CACtB;CACA,QAAQ,IAAI;EACV,MAAM,SAAS,KAAKA,UAAU,OAAO,EAAE;EACvC,IAAI,CAAC,QAAQ,MAAM,IAAI,MAAM,wBAAwB,IAAI;EACzD,OAAO;CACT;CACA,iBAAiB,IAAI,WAAW;EAC9B,MAAM,SAAS,KAAKE,QAAQ,EAAE,CAAC,CAAC,QAAQ,SAAS;EACjD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6B,IAAI,IAAI;EACvC,CAAC;EACD,MAAM,QAAQ,CAAC;EACf,QAAQ,UAAU,UAAU,EAAE,IAAI,SAAS;GACzC,IAAI,KAAK,SAAS,uBAAuB,KAAK,SAAS,4BAA4B,KAAK,SAAS,0BAA0B,KAAK,SAAS,oBAAoB;IAC3J;GACF;GACA,MAAM,aAAa,UAAU,MAAM,QAAQ;GAC3C,IAAI,cAAc,OAAO,WAAW,UAAU,UAAU;IACtD,MAAM,KAAK;KAAE,OAAO,KAAK;KAAO,WAAW,WAAW;IAAM,CAAC;GAC/D;EACF,CAAC;EACD,OAAO,CACL,GAAG,IAAI,IACL,MAAM,MAAM,MAAM,UAAU,KAAK,QAAQ,MAAM,KAAK,CAAC,CAAC,KAAK,EAAE,gBAAgB,SAAS,CACxF,CACF;CACF;AACF;AACA,SAAS,eAAe,QAAQ,KAAK,gCAAgC;CACnE,MAAM,YAAY,YAAY,OAAO;EACnC,uBAAuB,IAAI,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;EAC7C,6BAA6B,IAAI,IAAI;CACvC,CAAC;CACD,MAAM,cAAc,UAAU,YAAY,CAAC,CAAC,QAAQ,eAAe,WAAW,SAAS,OAAO;CAC9F,IAAI,YAAY,QAAQ;EACtB,MAAM,IAAI,MACR,mBAAmB,GAAG,IAAI,YAAY,KAAK,EAAE,cAAc,OAAO,CAAC,CAAC,KAAK,IAAI,GAC/E;CACF;CACA,OAAO,UAAU,UAAU,EAAE;AAC/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/compiler-core",
3
- "version": "3.0.0-beta.889.1",
3
+ "version": "3.0.0-beta.901.1",
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.0-beta.889.1",
43
+ "@tamagui/build": "3.0.0-beta.901.1",
44
44
  "typescript": "~6.0.3"
45
45
  },
46
46
  "repository": {
package/src/evaluate.ts CHANGED
@@ -239,7 +239,9 @@ function evaluateNode(
239
239
  case 'Identifier': {
240
240
  const name = identifierName(node)
241
241
  if (!name) return unsupported(id, node)
242
- const definition = resolver.resolveBinding(id, name)
242
+ // by position, so a function-scope constant resolves and a parameter
243
+ // shadowing a module constant does not read the module's value
244
+ const definition = resolver.resolveReference(expressionReference(id, node))
243
245
  if (!definition) {
244
246
  return {
245
247
  ok: false,
@@ -479,6 +481,32 @@ function evaluateDynamicNode(
479
481
  }
480
482
  }
481
483
 
484
+ // a template whose every interpolation takes finitely many primitives takes
485
+ // finitely many strings: `w-6 ${colors[index % 2]}` is two class strings
486
+ if (node.type === 'TemplateLiteral') {
487
+ const quasis = childNodes(node, 'quasis')
488
+ const expressions = childNodes(node, 'expressions')
489
+ let values: string[] = ['']
490
+ for (let position = 0; position < quasis.length; position++) {
491
+ const text = quasiText(quasis[position])
492
+ values = values.map((value) => value + text)
493
+ const expression = expressions[position]
494
+ if (!expression) continue
495
+ const part = evaluateDynamicNode(resolver, id, expression, state)
496
+ if (!part?.values) return null
497
+ const next: string[] = []
498
+ for (const value of values) {
499
+ for (const primitive of part.values) {
500
+ const joined = value + String(primitive)
501
+ if (!next.includes(joined)) next.push(joined)
502
+ }
503
+ }
504
+ if (next.length > 32) return null
505
+ values = next
506
+ }
507
+ return { type: 'string', values }
508
+ }
509
+
482
510
  return null
483
511
  }
484
512
 
@@ -547,9 +575,8 @@ function evaluateBranchesNode(
547
575
  if (!isAstNode(node)) return null
548
576
 
549
577
  if (node.type === 'Identifier') {
550
- const name = identifierName(node)
551
- if (!name) return null
552
- const definition = resolver.resolveBinding(id, name)
578
+ if (!identifierName(node)) return null
579
+ const definition = resolver.resolveReference(expressionReference(id, node))
553
580
  if (!definition || !definition.constant || !definition.initializer) return null
554
581
  const initializer = resolver.expressionNode(definition.initializer)
555
582
  if (!initializer) return null
package/src/graph.ts CHANGED
@@ -9,10 +9,12 @@ import type {
9
9
  HostResolvedProject,
10
10
  ProjectInput,
11
11
  ResolvedModuleId,
12
+ SourceSpan,
12
13
  SymbolDefinition,
13
14
  SymbolResolver,
14
15
  } from './contracts'
15
- import { expressionReference, resolutionKey, resolvedModuleId } from './contracts'
16
+ import { expressionReference, resolutionKey, resolvedModuleId, spanOf } from './contracts'
17
+ import { childNode, childNodes, identifierName, unwrapExpression } from './ast'
16
18
  import { linkedBailout, localBailout, type BailoutReason } from './diagnostics'
17
19
  import {
18
20
  evaluateBinding,
@@ -197,6 +199,43 @@ export class ProjectGraph implements SymbolResolver {
197
199
  )
198
200
  }
199
201
 
202
+ /**
203
+ * The members of a plain object literal, each as its own expression:
204
+ * `{ width: expr, height: 10 }`. Null for anything else, and for an object
205
+ * that spreads, computes a key, or defines a method or accessor.
206
+ */
207
+ objectMembers(
208
+ reference: ExpressionReference
209
+ ): { name: string; span: SourceSpan; value: ExpressionReference }[] | null {
210
+ const node = this.expressionNode(reference)
211
+ if (!node) return null
212
+ const object = unwrapExpression(node)
213
+ if (object.type !== 'ObjectExpression') return null
214
+ const members: { name: string; span: SourceSpan; value: ExpressionReference }[] = []
215
+ for (const property of childNodes(object, 'properties')) {
216
+ if (
217
+ (property.type !== 'Property' && property.type !== 'ObjectProperty') ||
218
+ property.computed === true ||
219
+ property.method === true ||
220
+ (property.kind !== undefined && property.kind !== 'init')
221
+ ) {
222
+ return null
223
+ }
224
+ const key = childNode(property, 'key')
225
+ const value = childNode(property, 'value')
226
+ if (!key || !value) return null
227
+ const name =
228
+ identifierName(key) ?? (typeof key.value === 'string' ? key.value : null)
229
+ if (name === null) return null
230
+ members.push({
231
+ name,
232
+ span: spanOf(reference.id, property),
233
+ value: expressionReference(reference.id, value),
234
+ })
235
+ }
236
+ return members
237
+ }
238
+
200
239
  evaluate(reference: ExpressionReference): EvaluationResult {
201
240
  return evaluateExpression(this, reference)
202
241
  }
package/src/lower.ts CHANGED
@@ -193,6 +193,23 @@ function unsafeEntry(
193
193
  entry.name
194
194
  )
195
195
  }
196
+ // each dynamic member of a style object lowers like the direct prop of its name
197
+ if (entry.kind === 'prop' && entry.value.kind === 'object') {
198
+ for (const member of entry.value.members) {
199
+ if (member.value.kind !== 'bailout' && member.value.kind !== 'conditional') continue
200
+ if (
201
+ !host.isStyleProp(member.name, component) ||
202
+ !host.canLowerDynamicStyleProp?.(member.name, component, member.value.kind)
203
+ ) {
204
+ return diagnostic(
205
+ 'local/dynamic-style-value',
206
+ element,
207
+ `Style prop ${member.name} could not be evaluated`,
208
+ member.name
209
+ )
210
+ }
211
+ }
212
+ }
196
213
  return null
197
214
  }
198
215