@tamagui/compiler-core 3.0.0-beta.807.1 → 3.0.0-beta.881.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.
- package/dist/cjs/evaluate.cjs +57 -4
- package/dist/cjs/graph.cjs +10 -0
- package/dist/cjs/normalize.cjs +8 -2
- package/dist/cjs/planCache.cjs +41 -2
- package/dist/cjs/session.cjs +21 -12
- package/dist/cjs/zero.cjs +1 -2
- package/dist/esm/evaluate.mjs +57 -4
- package/dist/esm/evaluate.mjs.map +1 -1
- package/dist/esm/graph.mjs +10 -0
- package/dist/esm/graph.mjs.map +1 -1
- package/dist/esm/normalize.mjs +8 -2
- package/dist/esm/normalize.mjs.map +1 -1
- package/dist/esm/planCache.mjs +42 -4
- package/dist/esm/planCache.mjs.map +1 -1
- package/dist/esm/session.mjs +22 -13
- package/dist/esm/session.mjs.map +1 -1
- package/dist/esm/zero.mjs +1 -2
- package/dist/esm/zero.mjs.map +1 -1
- package/package.json +2 -2
- package/src/evaluate.ts +107 -4
- package/src/graph.ts +11 -0
- package/src/ir.ts +1 -1
- package/src/normalize.ts +9 -6
- package/src/planCache.ts +38 -3
- package/src/session.ts +29 -9
- package/src/zero.ts +1 -2
- package/types/evaluate.d.ts.map +1 -1
- package/types/graph.d.ts +2 -0
- package/types/graph.d.ts.map +1 -1
- package/types/ir.d.ts +1 -1
- package/types/ir.d.ts.map +1 -1
- package/types/normalize.d.ts.map +1 -1
- package/types/planCache.d.ts +11 -1
- package/types/planCache.d.ts.map +1 -1
- package/types/session.d.ts +8 -0
- package/types/session.d.ts.map +1 -1
- package/types/zero.d.ts.map +1 -1
package/dist/esm/normalize.mjs
CHANGED
|
@@ -430,6 +430,12 @@ const DOM_STYLE_FRONTENDS = /* @__PURE__ */ new Set([
|
|
|
430
430
|
"@tamagui/core/dom",
|
|
431
431
|
"@tamagui/tailwind"
|
|
432
432
|
]);
|
|
433
|
+
const STYLE_FRONTENDS = /* @__PURE__ */ new Set([
|
|
434
|
+
...DOM_STYLE_FRONTENDS,
|
|
435
|
+
"tamagui",
|
|
436
|
+
"@tamagui/core",
|
|
437
|
+
"@tamagui/web"
|
|
438
|
+
]);
|
|
433
439
|
function domStyleDefinitions(id, program, imports) {
|
|
434
440
|
const definitions = [];
|
|
435
441
|
walkAst(program, (node) => {
|
|
@@ -442,7 +448,7 @@ function domStyleDefinitions(id, program, imports) {
|
|
|
442
448
|
const factoryName = callee && identifierName(callee);
|
|
443
449
|
if (!factoryName) return;
|
|
444
450
|
const binding = importBinding(program, factoryName);
|
|
445
|
-
if (!binding || binding.imported !== "style" || !
|
|
451
|
+
if (!binding || binding.imported !== "style" || !STYLE_FRONTENDS.has(binding.source)) {
|
|
446
452
|
return;
|
|
447
453
|
}
|
|
448
454
|
const factory = hostImportProvenance(imports, binding.source, binding.imported);
|
|
@@ -473,7 +479,7 @@ function domStyleArgument(candidate, id, program, node) {
|
|
|
473
479
|
const factoryName = callee && identifierName(callee);
|
|
474
480
|
if (!factoryName) return null;
|
|
475
481
|
const binding = importBinding(program, factoryName);
|
|
476
|
-
if (!binding || binding.imported !== "style" || !
|
|
482
|
+
if (!binding || binding.imported !== "style" || !STYLE_FRONTENDS.has(binding.source)) {
|
|
477
483
|
return null;
|
|
478
484
|
}
|
|
479
485
|
return childNodes(call, "arguments")[0] ?? null;
|
|
@@ -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 optionsNode = 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 = args.length >= 3 ? args[1] : 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 };\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]);\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\" || !DOM_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\" || !DOM_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;EAC3C,WAAW,CAAC,CAAC,YACX,UACC,SAAS,KAAK,SAAS,yBAAyB,KAAK,SAAS,WAAW,WAAW,MAAM,cAAc,CAAC,CAAC,MACxG,cAAc,UAAU,UAAU,YAAY,KACjD,CACF;CACF,OA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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 optionsNode = 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 = args.length >= 3 ? args[1] : 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 };\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;EAC3C,WAAW,CAAC,CAAC,YACX,UACC,SAAS,KAAK,SAAS,yBAAyB,KAAK,SAAS,WAAW,WAAW,MAAM,cAAc,CAAC,CAAC,MACxG,cAAc,UAAU,UAAU,YAAY,KACjD,CACF;CACF,OAAO,IAAI,YAAY,SAAS,cAAc;EAC5C,MAAM,aAAa,YACjB,UACC,SAAS,KAAK,SAAS,wBAAwB,UAAU,MAAM,IAAI,CAAC,EAAE,UAAU,YAAY,KAC/F;EACA,IAAI,YAAY;GACd,cAAc,UAAU,YAAY,MAAM;GAC1C,WAAW,CAAC,CAAC,YACX,U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E;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"}
|
package/dist/esm/planCache.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { randomBytes } from "node:crypto";
|
|
1
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2
|
+
import { readFileSync, statSync } from "node:fs";
|
|
2
3
|
import { mkdir, readFile, readdir, rename, stat, unlink, writeFile } from "node:fs/promises";
|
|
3
4
|
import { dirname, join } from "node:path";
|
|
4
5
|
import { contentHash, stableStringify } from "./hash.mjs";
|
|
@@ -13,10 +14,47 @@ function tamaguiCacheRoot(projectRoot) {
|
|
|
13
14
|
function defaultPlanCacheRoot(projectRoot, target) {
|
|
14
15
|
return join(tamaguiCacheRoot(projectRoot), "plans", target);
|
|
15
16
|
}
|
|
16
|
-
function moduleClosureNode(input) {
|
|
17
|
+
function moduleClosureNode(input, options) {
|
|
17
18
|
return {
|
|
18
19
|
contentHash: moduleContentHash(input),
|
|
19
|
-
dependencies: input.imports.filter(({ external }) => !external).map(({ resolvedId }) => resolvedId)
|
|
20
|
+
dependencies: input.imports.filter(({ external }) => options?.includeExternal || !external).map(({ resolvedId }) => resolvedId)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function createExternalClosureLookup() {
|
|
24
|
+
const memo = /* @__PURE__ */ new Map();
|
|
25
|
+
return (id) => {
|
|
26
|
+
const file = id.split(/[?#]/, 1)[0];
|
|
27
|
+
if (!file.startsWith("/") && !/^[A-Za-z]:[\\/]/.test(file)) {
|
|
28
|
+
return {
|
|
29
|
+
contentHash: "external",
|
|
30
|
+
dependencies: []
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const stat2 = statSync(file);
|
|
35
|
+
const cached = memo.get(file);
|
|
36
|
+
if (cached && cached.size === stat2.size && cached.mtimeMs === stat2.mtimeMs) {
|
|
37
|
+
return {
|
|
38
|
+
contentHash: cached.contentHash,
|
|
39
|
+
dependencies: []
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const hash = createHash("sha256").update(readFileSync(file)).digest("hex");
|
|
43
|
+
memo.set(file, {
|
|
44
|
+
size: stat2.size,
|
|
45
|
+
mtimeMs: stat2.mtimeMs,
|
|
46
|
+
contentHash: hash
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
contentHash: hash,
|
|
50
|
+
dependencies: []
|
|
51
|
+
};
|
|
52
|
+
} catch {
|
|
53
|
+
return {
|
|
54
|
+
contentHash: "external",
|
|
55
|
+
dependencies: []
|
|
56
|
+
};
|
|
57
|
+
}
|
|
20
58
|
};
|
|
21
59
|
}
|
|
22
60
|
function moduleClosureDigest(id, lookup, memo) {
|
|
@@ -190,5 +228,5 @@ var ModulePlanCache = class {
|
|
|
190
228
|
}
|
|
191
229
|
};
|
|
192
230
|
|
|
193
|
-
export { JsonFileCache, ModulePlanCache, PLAN_CACHE_MAX_ENTRIES, PLAN_CACHE_SCHEMA_VERSION, defaultPlanCacheRoot, moduleClosureDigest, moduleClosureNode, planCacheKey, tamaguiCacheRoot };
|
|
231
|
+
export { JsonFileCache, ModulePlanCache, PLAN_CACHE_MAX_ENTRIES, PLAN_CACHE_SCHEMA_VERSION, createExternalClosureLookup, defaultPlanCacheRoot, moduleClosureDigest, moduleClosureNode, planCacheKey, tamaguiCacheRoot };
|
|
194
232
|
//# sourceMappingURL=planCache.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planCache.js","names":["#hits","#misses","#writes","#path","#created","#writesSincePrune","#prunedThisProcess","#prune","#files"],"sources":["esm/planCache.js"],"sourcesContent":["import { randomBytes } from \"node:crypto\";\nimport {\n mkdir,\n readdir,\n readFile,\n rename,\n stat,\n unlink,\n writeFile\n} from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { contentHash, stableStringify } from \"./hash\";\nimport { LOWERED_MODULE_PLAN_VERSION } from \"./lower\";\nimport { moduleContentHash } from \"./graph\";\nconst PLAN_CACHE_SCHEMA_VERSION = 1;\nconst PLAN_CACHE_MAX_ENTRIES = 2e4;\nfunction tamaguiCacheRoot(projectRoot) {\n return join(projectRoot, \"node_modules\", \".cache\", \"tamagui\");\n}\nfunction defaultPlanCacheRoot(projectRoot, target) {\n return join(tamaguiCacheRoot(projectRoot), \"plans\", target);\n}\nfunction moduleClosureNode(input) {\n return {\n contentHash: moduleContentHash(input),\n dependencies: input.imports.filter(({ external }) => !external).map(({ resolvedId }) => resolvedId)\n };\n}\nfunction moduleClosureDigest(id, lookup, memo) {\n const cached = memo?.get(id);\n if (cached !== void 0) return cached;\n const reached = /* @__PURE__ */ new Map();\n const queue = [id];\n let complete = true;\n while (queue.length) {\n const current = queue.pop();\n if (reached.has(current)) continue;\n const node = lookup(current);\n if (!node) {\n complete = false;\n break;\n }\n reached.set(current, node.contentHash);\n for (const dependency of node.dependencies) queue.push(dependency);\n }\n const digest = complete ? contentHash(\n [...reached].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([current, hash]) => `${current}\\0${hash}`).join(\"\\0\")\n ) : null;\n memo?.set(id, digest);\n return digest;\n}\nfunction planCacheKey(identity, id, closureDigest) {\n return contentHash(\n stableStringify({\n schema: PLAN_CACHE_SCHEMA_VERSION,\n plan: LOWERED_MODULE_PLAN_VERSION,\n stamp: identity.stamp,\n target: identity.target,\n structuralPassHash: identity.structuralPassHash,\n id,\n closureDigest\n })\n );\n}\nclass JsonFileCache {\n constructor(root, schemaVersion, maxEntries = PLAN_CACHE_MAX_ENTRIES) {\n this.root = root;\n this.schemaVersion = schemaVersion;\n this.maxEntries = maxEntries;\n }\n root;\n schemaVersion;\n maxEntries;\n #hits = 0;\n #misses = 0;\n #writes = 0;\n #writesSincePrune = 0;\n #prunedThisProcess = false;\n #created = /* @__PURE__ */ new Set();\n get stats() {\n return { hits: this.#hits, misses: this.#misses, writes: this.#writes };\n }\n resetStats() {\n this.#hits = 0;\n this.#misses = 0;\n this.#writes = 0;\n }\n #path(key) {\n return join(this.root, `v${this.schemaVersion}`, key.slice(0, 2), `${key}.json`);\n }\n /**\n * Null on anything short of an entry `validate` fully accepts. A miss\n * recompiles; nothing here repairs or partially trusts an entry, and a later\n * successful compile overwrites the bad file.\n */\n async read(key, validate) {\n let parsed;\n try {\n parsed = JSON.parse(await readFile(this.#path(key), \"utf8\"));\n } catch {\n this.#misses++;\n return null;\n }\n const entry = validate(parsed);\n if (entry === null) {\n this.#misses++;\n return null;\n }\n this.#hits++;\n return entry;\n }\n async write(key, value) {\n const path = this.#path(key);\n const directory = dirname(path);\n if (!this.#created.has(directory)) {\n await mkdir(directory, { recursive: true });\n this.#created.add(directory);\n }\n const temporaryPath = `${path}.${process.pid}-${randomBytes(6).toString(\"hex\")}.tmp`;\n await writeFile(temporaryPath, `${stableStringify(value)}\n`, \"utf8\");\n await rename(temporaryPath, path);\n this.#writes++;\n this.#writesSincePrune++;\n const batch = Math.max(1, Math.floor(this.maxEntries / 4));\n if (!this.#prunedThisProcess || this.#writesSincePrune >= batch) {\n this.#prunedThisProcess = true;\n this.#writesSincePrune = 0;\n await this.#prune();\n }\n }\n /**\n * Drops the oldest entries once the store exceeds its cap, oldest by the later\n * of read and write time so an entry a build keeps hitting is not treated as\n * dead on filesystems that maintain access times.\n */\n async #prune() {\n const versionRoot = join(this.root, `v${this.schemaVersion}`);\n let shards;\n try {\n shards = await readdir(versionRoot);\n } catch {\n return;\n }\n const paths = [];\n for (const shard of shards) {\n const directory = join(versionRoot, shard);\n let files;\n try {\n files = await readdir(directory);\n } catch {\n continue;\n }\n for (const file of files) {\n if (file.endsWith(\".json\")) paths.push(join(directory, file));\n }\n }\n if (paths.length <= this.maxEntries) return;\n const entries = [];\n for (const path of paths) {\n try {\n const stats = await stat(path);\n entries.push({ path, usedAt: Math.max(stats.atimeMs, stats.mtimeMs) });\n } catch {\n }\n }\n entries.sort((left, right) => left.usedAt - right.usedAt);\n for (const entry of entries.slice(0, Math.max(0, entries.length - this.maxEntries))) {\n await unlink(entry.path).catch(() => {\n });\n }\n }\n}\nclass ModulePlanCache {\n constructor(root) {\n this.root = root;\n this.#files = new JsonFileCache(root, PLAN_CACHE_SCHEMA_VERSION);\n }\n root;\n #files;\n get stats() {\n return this.#files.stats;\n }\n resetStats() {\n this.#files.resetStats();\n }\n read(key, id, closureDigest) {\n return this.#files.read(key, (value) => {\n const entry = value;\n const plan = entry?.plan;\n return entry?.schemaVersion === PLAN_CACHE_SCHEMA_VERSION && entry.moduleId === id && entry.closureDigest === closureDigest && plan && plan.version === LOWERED_MODULE_PLAN_VERSION && plan.id === id && typeof plan.sourceHash === \"string\" && typeof plan.css === \"string\" && Array.isArray(plan.edits) && Array.isArray(plan.diagnostics) && Array.isArray(plan.dependencies) && !!plan.stats ? entry : null;\n });\n }\n write(key, entry) {\n return this.#files.write(key, entry);\n }\n}\nexport {\n JsonFileCache,\n ModulePlanCache,\n PLAN_CACHE_MAX_ENTRIES,\n PLAN_CACHE_SCHEMA_VERSION,\n defaultPlanCacheRoot,\n moduleClosureDigest,\n moduleClosureNode,\n planCacheKey,\n tamaguiCacheRoot\n};\n//# sourceMappingURL=planCache.js.map\n"],"mappings":";;;;;;;;AAcA,MAAM,4BAA4B;AAClC,MAAM,yBAAyB;AAC/B,SAAS,iBAAiB,aAAa;CACrC,OAAO,KAAK,aAAa,gBAAgB,UAAU,SAAS;AAC9D;AACA,SAAS,qBAAqB,aAAa,QAAQ;CACj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aAAa;EACX,KAAKA,OAAO,WAAW;CACzB;CACA,KAAK,KAAK,IAAI,eAAe;EAC3B,OAAO,KAAKA,OAAO,KAAK,MAAM,UAAU;GACtC,MAAM,QAAQ;GACd,MAAM,OAAO,OAAO;GACpB,OAAO,OAAO,uBAA+C,MAAM,aAAa,MAAM,MAAM,kBAAkB,iBAAiB,QAAQ,KAAK,YAAY,+BAA+B,KAAK,OAAO,MAAM,OAAO,KAAK,eAAe,YAAY,OAAO,KAAK,QAAQ,YAAY,MAAM,QAAQ,KAAK,KAAK,KAAK,MAAM,QAAQ,KAAK,WAAW,KAAK,MAAM,QAAQ,KAAK,YAAY,KAAK,CAAC,CAAC,KAAK,QAAQ,QAAQ;EAC7Y,CAAC;CACH;CACA,MAAM,KAAK,OAAO;EAChB,OAAO,KAAKA,OAAO,MAAM,KAAK,KAAK;CACrC;AACF"}
|
|
1
|
+
{"version":3,"file":"planCache.js","names":["#hits","#misses","#writes","#path","#created","#writesSincePrune","#prunedThisProcess","#prune","#files"],"sources":["esm/planCache.js"],"sourcesContent":["import { createHash, randomBytes } from \"node:crypto\";\nimport { readFileSync, statSync } from \"node:fs\";\nimport {\n mkdir,\n readdir,\n readFile,\n rename,\n stat,\n unlink,\n writeFile\n} from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { contentHash, stableStringify } from \"./hash\";\nimport { LOWERED_MODULE_PLAN_VERSION } from \"./lower\";\nimport { moduleContentHash } from \"./graph\";\nconst PLAN_CACHE_SCHEMA_VERSION = 1;\nconst PLAN_CACHE_MAX_ENTRIES = 2e4;\nfunction tamaguiCacheRoot(projectRoot) {\n return join(projectRoot, \"node_modules\", \".cache\", \"tamagui\");\n}\nfunction defaultPlanCacheRoot(projectRoot, target) {\n return join(tamaguiCacheRoot(projectRoot), \"plans\", target);\n}\nfunction moduleClosureNode(input, options) {\n return {\n contentHash: moduleContentHash(input),\n dependencies: input.imports.filter(({ external }) => options?.includeExternal || !external).map(({ resolvedId }) => resolvedId)\n };\n}\nfunction createExternalClosureLookup() {\n const memo = /* @__PURE__ */ new Map();\n return (id) => {\n const file = id.split(/[?#]/, 1)[0];\n if (!file.startsWith(\"/\") && !/^[A-Za-z]:[\\\\/]/.test(file)) {\n return { contentHash: \"external\", dependencies: [] };\n }\n try {\n const stat2 = statSync(file);\n const cached = memo.get(file);\n if (cached && cached.size === stat2.size && cached.mtimeMs === stat2.mtimeMs) {\n return { contentHash: cached.contentHash, dependencies: [] };\n }\n const hash = createHash(\"sha256\").update(readFileSync(file)).digest(\"hex\");\n memo.set(file, { size: stat2.size, mtimeMs: stat2.mtimeMs, contentHash: hash });\n return { contentHash: hash, dependencies: [] };\n } catch {\n return { contentHash: \"external\", dependencies: [] };\n }\n };\n}\nfunction moduleClosureDigest(id, lookup, memo) {\n const cached = memo?.get(id);\n if (cached !== void 0) return cached;\n const reached = /* @__PURE__ */ new Map();\n const queue = [id];\n let complete = true;\n while (queue.length) {\n const current = queue.pop();\n if (reached.has(current)) continue;\n const node = lookup(current);\n if (!node) {\n complete = false;\n break;\n }\n reached.set(current, node.contentHash);\n for (const dependency of node.dependencies) queue.push(dependency);\n }\n const digest = complete ? contentHash(\n [...reached].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([current, hash]) => `${current}\\0${hash}`).join(\"\\0\")\n ) : null;\n memo?.set(id, digest);\n return digest;\n}\nfunction planCacheKey(identity, id, closureDigest) {\n return contentHash(\n stableStringify({\n schema: PLAN_CACHE_SCHEMA_VERSION,\n plan: LOWERED_MODULE_PLAN_VERSION,\n stamp: identity.stamp,\n target: identity.target,\n structuralPassHash: identity.structuralPassHash,\n id,\n closureDigest\n })\n );\n}\nclass JsonFileCache {\n constructor(root, schemaVersion, maxEntries = PLAN_CACHE_MAX_ENTRIES) {\n this.root = root;\n this.schemaVersion = schemaVersion;\n this.maxEntries = maxEntries;\n }\n root;\n schemaVersion;\n maxEntries;\n #hits = 0;\n #misses = 0;\n #writes = 0;\n #writesSincePrune = 0;\n #prunedThisProcess = false;\n #created = /* @__PURE__ */ new Set();\n get stats() {\n return { hits: this.#hits, misses: this.#misses, writes: this.#writes };\n }\n resetStats() {\n this.#hits = 0;\n this.#misses = 0;\n this.#writes = 0;\n }\n #path(key) {\n return join(this.root, `v${this.schemaVersion}`, key.slice(0, 2), `${key}.json`);\n }\n /**\n * Null on anything short of an entry `validate` fully accepts. A miss\n * recompiles; nothing here repairs or partially trusts an entry, and a later\n * successful compile overwrites the bad file.\n */\n async read(key, validate) {\n let parsed;\n try {\n parsed = JSON.parse(await readFile(this.#path(key), \"utf8\"));\n } catch {\n this.#misses++;\n return null;\n }\n const entry = validate(parsed);\n if (entry === null) {\n this.#misses++;\n return null;\n }\n this.#hits++;\n return entry;\n }\n async write(key, value) {\n const path = this.#path(key);\n const directory = dirname(path);\n if (!this.#created.has(directory)) {\n await mkdir(directory, { recursive: true });\n this.#created.add(directory);\n }\n const temporaryPath = `${path}.${process.pid}-${randomBytes(6).toString(\"hex\")}.tmp`;\n await writeFile(temporaryPath, `${stableStringify(value)}\n`, \"utf8\");\n await rename(temporaryPath, path);\n this.#writes++;\n this.#writesSincePrune++;\n const batch = Math.max(1, Math.floor(this.maxEntries / 4));\n if (!this.#prunedThisProcess || this.#writesSincePrune >= batch) {\n this.#prunedThisProcess = true;\n this.#writesSincePrune = 0;\n await this.#prune();\n }\n }\n /**\n * Drops the oldest entries once the store exceeds its cap, oldest by the later\n * of read and write time so an entry a build keeps hitting is not treated as\n * dead on filesystems that maintain access times.\n */\n async #prune() {\n const versionRoot = join(this.root, `v${this.schemaVersion}`);\n let shards;\n try {\n shards = await readdir(versionRoot);\n } catch {\n return;\n }\n const paths = [];\n for (const shard of shards) {\n const directory = join(versionRoot, shard);\n let files;\n try {\n files = await readdir(directory);\n } catch {\n continue;\n }\n for (const file of files) {\n if (file.endsWith(\".json\")) paths.push(join(directory, file));\n }\n }\n if (paths.length <= this.maxEntries) return;\n const entries = [];\n for (const path of paths) {\n try {\n const stats = await stat(path);\n entries.push({ path, usedAt: Math.max(stats.atimeMs, stats.mtimeMs) });\n } catch {\n }\n }\n entries.sort((left, right) => left.usedAt - right.usedAt);\n for (const entry of entries.slice(0, Math.max(0, entries.length - this.maxEntries))) {\n await unlink(entry.path).catch(() => {\n });\n }\n }\n}\nclass ModulePlanCache {\n constructor(root) {\n this.root = root;\n this.#files = new JsonFileCache(root, PLAN_CACHE_SCHEMA_VERSION);\n }\n root;\n #files;\n get stats() {\n return this.#files.stats;\n }\n resetStats() {\n this.#files.resetStats();\n }\n read(key, id, closureDigest) {\n return this.#files.read(key, (value) => {\n const entry = value;\n const plan = entry?.plan;\n return entry?.schemaVersion === PLAN_CACHE_SCHEMA_VERSION && entry.moduleId === id && entry.closureDigest === closureDigest && plan && plan.version === LOWERED_MODULE_PLAN_VERSION && plan.id === id && typeof plan.sourceHash === \"string\" && typeof plan.css === \"string\" && Array.isArray(plan.edits) && Array.isArray(plan.diagnostics) && Array.isArray(plan.dependencies) && !!plan.stats ? entry : null;\n });\n }\n write(key, entry) {\n return this.#files.write(key, entry);\n }\n}\nexport {\n JsonFileCache,\n ModulePlanCache,\n PLAN_CACHE_MAX_ENTRIES,\n PLAN_CACHE_SCHEMA_VERSION,\n createExternalClosureLookup,\n defaultPlanCacheRoot,\n moduleClosureDigest,\n moduleClosureNode,\n planCacheKey,\n tamaguiCacheRoot\n};\n//# sourceMappingURL=planCache.js.map\n"],"mappings":";;;;;;;;;AAeA,MAAM,4BAA4B;AAClC,MAAM,yBAAyB;AAC/B,SAAS,iBAAiB,aAAa;CACrC,OAAO,KAAK,aAAa,gBAAgB,UAAU,SAAS;AAC9D;AACA,SAAS,qBAAqB,aAAa,QAAQ;CACjD,OAAO,KAAK,iBAAiB,WAAW,GAAG,SAAS,MAAM;AAC5D;AACA,SAAS,kBAAkB,OAAO,SAAS;CACzC,OAAO;EACL,aAAa,kBAAkB,KAAK;EACpC,cAAc,MAAM,QAAQ,QAAQ,EAAE,eAAe,SAAS,mBAAmB,CAAC,QA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from "./lower.mjs";
|
|
3
3
|
import { materializeModule } from "./materialize.mjs";
|
|
4
4
|
import { applyLoweredModule } from "./output.mjs";
|
|
5
|
-
import { PLAN_CACHE_SCHEMA_VERSION, moduleClosureDigest, planCacheKey } from "./planCache.mjs";
|
|
5
|
+
import { PLAN_CACHE_SCHEMA_VERSION, createExternalClosureLookup, moduleClosureDigest, planCacheKey } from "./planCache.mjs";
|
|
6
6
|
import { yukuFactory } from "./yuku.mjs";
|
|
7
7
|
|
|
8
8
|
function compareIds(left, right) {
|
|
@@ -10,6 +10,7 @@ function compareIds(left, right) {
|
|
|
10
10
|
}
|
|
11
11
|
var CompilerSession = class {
|
|
12
12
|
#graph = new ProjectGraph(yukuFactory, { modules: [] });
|
|
13
|
+
#externalClosure = createExternalClosureLookup();
|
|
13
14
|
#queue = Promise.resolve();
|
|
14
15
|
compile(input) {
|
|
15
16
|
const operation = this.#queue.then(() => this.#compile(input));
|
|
@@ -43,10 +44,13 @@ var CompilerSession = class {
|
|
|
43
44
|
const cache = adapter.planCache?.stamp ? adapter.planCache : null;
|
|
44
45
|
const closureDigest = cache ? moduleClosureDigest(module.id, (id) => {
|
|
45
46
|
const hash = graph.contentHash(id);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
if (hash) {
|
|
48
|
+
return {
|
|
49
|
+
contentHash: hash,
|
|
50
|
+
dependencies: [...graph.dependenciesOf(id), ...graph.externalImportsOf(id)]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return this.#externalClosure(id);
|
|
50
54
|
}) : null;
|
|
51
55
|
const entry = cache && closureDigest ? {
|
|
52
56
|
store: cache.store,
|
|
@@ -58,14 +62,19 @@ var CompilerSession = class {
|
|
|
58
62
|
}, module.id, closureDigest)
|
|
59
63
|
} : null;
|
|
60
64
|
const cached = entry ? await entry.store.read(entry.key, module.id, entry.digest) : null;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
let plan = cached?.plan;
|
|
66
|
+
if (!plan) {
|
|
67
|
+
const materialized = materializeModule(graph, module.id);
|
|
68
|
+
if (adapter.prepare) await adapter.prepare(materialized);
|
|
69
|
+
plan = lowerModule({
|
|
70
|
+
module: materialized,
|
|
71
|
+
source: module.source,
|
|
72
|
+
target: adapter.target,
|
|
73
|
+
host: adapter.host,
|
|
74
|
+
options: { projectGeneration: adapter.projectGeneration },
|
|
75
|
+
structuralPass
|
|
76
|
+
});
|
|
77
|
+
}
|
|
69
78
|
if (entry && !cached) {
|
|
70
79
|
await entry.store.write(entry.key, {
|
|
71
80
|
schemaVersion: PLAN_CACHE_SCHEMA_VERSION,
|
package/dist/esm/session.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","names":["#queue","#compile","#enqueue","#graph","#install"],"sources":["esm/session.js"],"sourcesContent":["import { ProjectGraph } from \"./graph\";\nimport { lowerModule } from \"./lower\";\nimport { materializeModule } from \"./materialize\";\nimport { applyLoweredModule } from \"./output\";\nimport {
|
|
1
|
+
{"version":3,"file":"session.js","names":["#queue","#compile","#enqueue","#graph","#install","#externalClosure"],"sources":["esm/session.js"],"sourcesContent":["import { ProjectGraph } from \"./graph\";\nimport { lowerModule } from \"./lower\";\nimport { materializeModule } from \"./materialize\";\nimport { applyLoweredModule } from \"./output\";\nimport {\n PLAN_CACHE_SCHEMA_VERSION,\n createExternalClosureLookup,\n moduleClosureDigest,\n planCacheKey\n} from \"./planCache\";\nimport { yukuFactory } from \"./yuku\";\nfunction compareIds(left, right) {\n return left < right ? -1 : left > right ? 1 : 0;\n}\nclass CompilerSession {\n #graph = new ProjectGraph(yukuFactory, { modules: [] });\n #externalClosure = createExternalClosureLookup();\n #queue = Promise.resolve();\n compile(input) {\n const operation = this.#queue.then(() => this.#compile(input));\n this.#queue = operation.catch(() => void 0);\n return operation;\n }\n update(module) {\n return this.#enqueue(() => this.#graph.updateModule(module).invalidatedIds);\n }\n has(id) {\n return this.#graph.contentHash(id) !== null;\n }\n dependentsOf(id) {\n return this.#graph.dependentsOf(id);\n }\n remove(id) {\n return this.#enqueue(() => this.#graph.removeModule(id));\n }\n parseCount(id) {\n return this.#graph.parseCount(id);\n }\n #enqueue(operation) {\n const queued = this.#queue.then(operation);\n this.#queue = queued.catch(() => void 0);\n return queued;\n }\n async #compile({\n module,\n adapter,\n structuralPass\n }) {\n const invalidated = /* @__PURE__ */ new Set();\n await this.#install(module, adapter, /* @__PURE__ */ new Set(), invalidated);\n const graph = this.#graph;\n const cache = adapter.planCache?.stamp ? adapter.planCache : null;\n const closureDigest = cache ? moduleClosureDigest(module.id, (id) => {\n const hash = graph.contentHash(id);\n if (hash) {\n return {\n contentHash: hash,\n dependencies: [...graph.dependenciesOf(id), ...graph.externalImportsOf(id)]\n };\n }\n return this.#externalClosure(id);\n }) : null;\n const entry = cache && closureDigest ? {\n store: cache.store,\n digest: closureDigest,\n key: planCacheKey(\n {\n stamp: cache.stamp,\n target: adapter.target,\n structuralPassHash: structuralPass?.versionHash ?? `${adapter.target}-noop-v1`\n },\n module.id,\n closureDigest\n )\n } : null;\n const cached = entry ? await entry.store.read(entry.key, module.id, entry.digest) : null;\n let plan = cached?.plan;\n if (!plan) {\n const materialized = materializeModule(graph, module.id);\n if (adapter.prepare) await adapter.prepare(materialized);\n plan = lowerModule({\n module: materialized,\n source: module.source,\n target: adapter.target,\n host: adapter.host,\n options: { projectGeneration: adapter.projectGeneration },\n structuralPass\n });\n }\n if (entry && !cached) {\n await entry.store.write(entry.key, {\n schemaVersion: PLAN_CACHE_SCHEMA_VERSION,\n moduleId: module.id,\n closureDigest: entry.digest,\n plan\n });\n }\n return {\n plan,\n output: applyLoweredModule(module.source, module.id, plan),\n invalidatedIds: [...invalidated].sort(compareIds)\n };\n }\n async #install(module, adapter, visited, invalidated) {\n if (visited.has(module.id)) return;\n visited.add(module.id);\n for (const dependency of module.imports) {\n if (dependency.external || this.has(dependency.resolvedId)) continue;\n const loaded = await adapter.load(dependency.resolvedId);\n if (loaded) {\n await this.#install(loaded, adapter, visited, invalidated);\n }\n }\n const update = this.#graph.updateModule(module);\n for (const id of update.invalidatedIds) invalidated.add(id);\n }\n}\nexport {\n CompilerSession\n};\n//# sourceMappingURL=session.js.map\n"],"mappings":";;;;;;;;AAWA,SAAS,WAAW,MAAM,OAAO;CAC/B,OAAO,OAAO,QAAQ,CAAC,IAAI,OAAO,QAAQ,IAAI;AAChD;AACA,IAAM,kBAAN,MAAsB;CACpB,SAAS,IAAI,aAAa,aAAa,EAAE,SAAS,CAAC,EAAE,CAAC;CACtD,mBAAmB,4BAA4B;CAC/C,SAAS,QAAQ,QAAQ;CACzB,QAAQ,OAAO;EACb,MAAM,YAAY,KAAKA,OAAO,WAAW,KAAKC,SAAS,KAAK,CAAC;EAC7D,KAAKD,SAAS,UAAU,YAAY,KAAK,CAAC;EAC1C,OAAO;CACT;CACA,OAAO,QAAQ;EACb,OAAO,KAAKE,eAAe,KAAKC,OAAO,aAAa,MAAM,CAAC,CAAC,cAAc;CAC5E;CACA,IAAI,IAAI;EACN,OAAO,KAAKA,OAAO,YAAY,EAAE,MAAM;CACzC;CACA,aAAa,IAAI;EACf,OAAO,KAAKA,OAAO,aAAa,EAAE;CACpC;CACA,OAAO,IAAI;EACT,OAAO,KAAKD,eAAe,KAAKC,OAAO,aAAa,EAAE,CAAC;CACzD;CACA,WAAW,IAAI;EACb,OAAO,KAAKA,OAAO,WAAW,EAAE;CAClC;CACA,SAAS,WAAW;EAClB,MAAM,SAAS,KAAKH,OAAO,KAAK,SAAS;EACzC,KAAKA,SAAS,OAAO,YAAY,KAAK,CAAC;EACvC,OAAO;CACT;CACA,MAAMC,SAAS,EACb,QACA,SACA,kBACC;EACD,MAAM,8BAA8B,IAAI,IAAI;EAC5C,MAAM,KAAKG,SAAS,QAAQ,yBAAyB,IAAI,IAAI,GAAG,WAAW;EAC3E,MAAM,QAAQ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S,aAAa;EACpD,IAAI,QAAQ,IAAI,OAAO,EAAE,GAAG;EAC5B,QAAQ,IAAI,OAAO,EAAE;EACrB,KAAK,MAAM,cAAc,OAAO,SAAS;GACvC,IAAI,WAAW,YAAY,KAAK,IAAI,WAAW,UAAU,GAAG;GAC5D,MAAM,SAAS,MAAM,QAAQ,KAAK,WAAW,UAAU;GACvD,IAAI,QAAQ;IACV,MAAM,KAAKA,SAAS,QAAQ,SAAS,SAAS,WAAW;GAC3D;EACF;EACA,MAAM,SAAS,KAAKD,OAAO,aAAa,MAAM;EAC9C,KAAK,MAAM,MAAM,OAAO,gBAAgB,YAAY,IAAI,EAAE;CAC5D;AACF"}
|
package/dist/esm/zero.mjs
CHANGED
package/dist/esm/zero.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zero.js","names":[],"sources":["esm/zero.js"],"sourcesContent":["import { childNode, childNodes, walkAst } from \"./ast\";\nimport { zeroRuleForBailout } from \"./diagnostics\";\nimport { parseModuleAst } from \"./yuku\";\nconst ZERO_FAILURE_FOOTER = \"Fix every site or move the owning module to a declared full-runtime island. Zero-runtime never retains one component as a fallback.\";\nconst ZERO_DESIGN_STATE_APIS = /* @__PURE__ */ new Set([\n \"useMedia\",\n \"useTheme\",\n \"useThemeName\",\n \"useProps\",\n \"usePropsAndStyle\",\n \"getConfig\",\n \"getTokens\",\n \"useTokens\",\n \"getVariableValue\",\n \"getToken\",\n \"getTokenValue\",\n \"useConfiguration\",\n \"useAnimationDriver\",\n \"updateTheme\",\n \"addTheme\",\n \"replaceTheme\",\n \"forceUpdateThemes\"\n]);\nconst ZERO_PROVIDER_EXPORTS = /* @__PURE__ */ new Set([\n \"TamaguiProvider\",\n \"ThemeProvider\",\n \"TamaguiRoot\"\n]);\nconst ZERO_ANIMATED_NUMBER_HOOKS = /* @__PURE__ */ new Set([\n \"useAnimatedNumber\",\n \"useAnimatedNumberStyle\",\n \"useAnimatedNumbersStyle\",\n \"useAnimatedNumberReaction\"\n]);\nconst ZERO_ANIMATED_NUMBER_MODULE = \"@tamagui/animations-css/animated-number\";\nfunction zeroRuleMessage(rule, params) {\n const component = params.component ?? \"this component\";\n switch (rule) {\n case 1:\n return `Zero-runtime rule 1: ${component} cannot receive a prop spread because the compiler cannot prove it is style-free. Pass non-style props explicitly or move this module to a full-runtime island.`;\n case 2:\n return `Zero-runtime rule 2: component expression ${params.expression ?? component} does not resolve to one literal lowerable host component. Use a literal Tamagui or html.* component, or move this module to a full-runtime island.`;\n case 3:\n return `Zero-runtime rule 3: value for ${params.prop ?? \"a style prop\"} on ${component} cannot be lowered: ${params.detail ?? \"the compiler could not evaluate it\"}. Use a supported build-time value or move this module to a full-runtime island.`;\n case 4:\n return `Zero-runtime rule 4: ${params.detail ?? component} requires runtime theme or config state. Theme names and modifier targets must be statically enumerable, Theme value props and config must be build-time data, and runtime mutation belongs in a full-runtime island.`;\n case 5:\n return `Zero-runtime rule 5: ${params.detail ?? component} requires a component animation runtime. Use a static CSS transition or move this module to a full-runtime island.`;\n case 6:\n return `Zero-runtime rule 6: ${component} does not lower to one host element with className and is island-only. Move this module to a declared full-runtime island.`;\n case 7:\n return `Zero-runtime rule 7: ${params.api ?? component} reads Tamagui design state in JavaScript. Express the condition in CSS or move this module to a full-runtime island.`;\n case 8:\n return `Zero-runtime rule 8: ${params.detail ?? \"a module-level import\"} defeats the zero-runtime graph. ${params.remediation ?? \"\"}`.trimEnd();\n }\n}\nfunction zeroSideEffectImportMessage(specifier) {\n return zeroRuleMessage(8, {\n detail: `the bare side-effect import of \"${specifier}\", whose effects zero-runtime cannot prove or erase,`,\n remediation: `Remove it, or import the values this module uses so the compiler can lower and erase them.`\n });\n}\nfunction zeroStaticIslandImportMessage(specifier, islandId) {\n return zeroRuleMessage(8, {\n detail: `the static import of \"${specifier}\", which is declared as full-runtime island \"${islandId}\",`,\n remediation: `Import the generated island loader instead; the island is a separately built entry and the zero graph never contains it.`\n });\n}\nconst ZERO_PROVIDER_MESSAGE = \"[tamagui zero-runtime] Rule 4: TamaguiProvider is not used by a zero-runtime root. The bundler loads generated CSS and the compiler lowers static Theme nodes. Remove this provider or make this entry full-runtime.\";\nfunction zeroThemeBoundaryMessage(component, prop) {\n return `[tamagui zero-runtime] Rule 4: ${component} uses ${prop}, which creates a runtime component theme boundary. Replace it with a static <Theme name=\"...\"> wrapper (use name=\"inverse\" for themeInverse) or move this module to a full-runtime island.`;\n}\nfunction zeroConfigDriverMessage(name, outputStyle) {\n return `[tamagui zero-runtime] Rule 5: createTamagui animations must resolve to the CSS driver. Driver ${name} has outputStyle=${String(outputStyle)}. Remove it from the zero entry or move its consumers to a full-runtime island.`;\n}\nfunction zeroIslandThemeMessage(entry) {\n return `[tamagui zero-runtime] Rule 4: island ${entry} has no statically resolved theme context at this mount. Place the island boundary under a compiler-visible static <Theme> or make this entry full-runtime.`;\n}\nfunction zeroViolationsFromPlan(plan) {\n const violations = [];\n for (const diagnostic of plan.diagnostics) {\n if (!diagnostic.blocking) continue;\n const rule = zeroRuleForBailout(diagnostic);\n violations.push({\n rule,\n code: diagnostic.code,\n span: diagnostic.span,\n component: diagnostic.component,\n message: diagnostic.zeroMessage ?? zeroRuleMessage(rule, {\n component: diagnostic.component,\n prop: diagnostic.prop,\n detail: diagnostic.message\n })\n });\n }\n return violations;\n}\nfunction isTamaguiSpecifier(specifier) {\n return specifier === \"tamagui\" || specifier.startsWith(\"tamagui/\") || specifier.startsWith(\"@tamagui/\");\n}\nfunction collectNameOccurrences(program) {\n const occurrences = /* @__PURE__ */ new Map();\n walkAst(program, (node, parent, key) => {\n if (node.type !== \"Identifier\" && node.type !== \"JSXIdentifier\") return;\n const name = typeof node.name === \"string\" ? node.name : null;\n if (!name) return;\n if (parent) {\n if (parent.type === \"ImportSpecifier\" || parent.type === \"ImportDefaultSpecifier\" || parent.type === \"ImportNamespaceSpecifier\" || parent.type === \"ExportSpecifier\") {\n return;\n }\n if ((parent.type === \"MemberExpression\" || parent.type === \"JSXMemberExpression\" || parent.type === \"OptionalMemberExpression\") && key === \"property\" && !parent.computed) {\n return;\n }\n if ((parent.type === \"Property\" || parent.type === \"PropertyDefinition\") && key === \"key\" && !parent.computed) {\n return;\n }\n if (parent.type === \"JSXAttribute\" && key === \"name\") return;\n if ((parent.type === \"VariableDeclarator\" || parent.type === \"FunctionDeclaration\" || parent.type === \"ClassDeclaration\") && key === \"id\") {\n return;\n }\n }\n const entry = { start: node.start, end: node.end, parent: parent ?? null };\n const list = occurrences.get(name);\n if (list) list.push(entry);\n else occurrences.set(name, [entry]);\n });\n return occurrences;\n}\nfunction coversRange(outer, inner) {\n return outer.start <= inner.start && outer.end >= inner.end;\n}\nfunction stringValueOf(node) {\n return node && typeof node.value === \"string\" ? node.value : null;\n}\nfunction identifierNameOf(node) {\n return node && node.type === \"Identifier\" && typeof node.name === \"string\" ? node.name : null;\n}\nfunction referenceExpression(source, reference) {\n const parent = reference.parent;\n const node = parent && (parent.type === \"ConditionalExpression\" || parent.type === \"LogicalExpression\" || parent.type === \"CallExpression\" || parent.type === \"MemberExpression\" || parent.type === \"ArrayExpression\") ? parent : reference;\n const text = source.slice(node.start, node.end).replace(/\\s+/g, \" \").trim();\n return text.length > 80 ? `${text.slice(0, 77)}...` : text;\n}\nfunction collectStyledDeclarators(program, styledLocals) {\n const found = [];\n for (const statement of childNodes(program, \"body\")) {\n const exported = statement.type === \"ExportNamedDeclaration\";\n const declaration = exported ? childNode(statement, \"declaration\") : statement;\n if (!declaration || declaration.type !== \"VariableDeclaration\") continue;\n const declarators = childNodes(declaration, \"declarations\");\n if (declarators.length !== 1) continue;\n const declarator = declarators[0];\n const name = identifierNameOf(childNode(declarator, \"id\"));\n const init = childNode(declarator, \"init\");\n if (!name || !init || init.type !== \"CallExpression\") continue;\n const callee = identifierNameOf(childNode(init, \"callee\"));\n if (!callee || !styledLocals.has(callee)) continue;\n found.push({\n name,\n declarator,\n declaration: exported ? statement : declaration,\n exported\n });\n }\n return found;\n}\nfunction planZeroErasure(input) {\n const { id, source, loweredEdits } = input;\n const program = parseModuleAst(source, id);\n const violations = [];\n const span = (node) => ({ id, start: node.start, end: node.end });\n const bindings = [];\n const tamaguiDeclarations = [];\n for (const statement of childNodes(program, \"body\")) {\n if (statement.type !== \"ImportDeclaration\") continue;\n if (statement.importKind === \"type\") continue;\n const moduleSpecifier = stringValueOf(childNode(statement, \"source\"));\n if (!moduleSpecifier) continue;\n const islandId = input.islandIdFor(moduleSpecifier);\n if (islandId) {\n violations.push({\n rule: 8,\n code: \"zero/static-island-import\",\n span: span(statement),\n message: zeroStaticIslandImportMessage(moduleSpecifier, islandId)\n });\n continue;\n }\n if (!input.isTamaguiSpecifier(moduleSpecifier)) continue;\n tamaguiDeclarations.push(statement);\n const specifiers = childNodes(statement, \"specifiers\");\n if (specifiers.length === 0) {\n violations.push({\n rule: 8,\n code: \"zero/side-effect-import\",\n span: span(statement),\n message: zeroSideEffectImportMessage(moduleSpecifier)\n });\n continue;\n }\n for (const specifier of specifiers) {\n if (specifier.importKind === \"type\") continue;\n const local = identifierNameOf(childNode(specifier, \"local\"));\n if (!local) continue;\n bindings.push({\n local,\n imported: identifierNameOf(childNode(specifier, \"imported\")) ?? local,\n specifierNode: specifier,\n declaration: statement,\n moduleSpecifier\n });\n }\n }\n if (bindings.length === 0) {\n return {\n edits: [],\n removedModules: [],\n removedBindings: [],\n erasedStyledDefinitions: [],\n erasedExports: [],\n rewrittenAnimatedNumberHooks: [],\n liveBindings: [],\n violations\n };\n }\n const consumed = loweredEdits.filter((edit) => edit.end > edit.start).map((edit) => ({ start: edit.start, end: edit.end }));\n const occurrences = collectNameOccurrences(program);\n const referencesOf = (local) => occurrences.get(local) ?? [];\n const isConsumed = (reference) => consumed.some((range) => coversRange(range, reference));\n const styledLocals = new Set(\n bindings.filter((binding) => binding.imported === \"styled\").map((b) => b.local)\n );\n const erasedStyledDefinitions = [];\n const erasedExports = [];\n const styledEdits = [];\n for (const definition of collectStyledDeclarators(program, styledLocals)) {\n const references = referencesOf(definition.name);\n if (references.length === 0) continue;\n if (!references.every(isConsumed)) continue;\n styledEdits.push({\n start: definition.declaration.start,\n end: definition.declaration.end,\n content: \"\",\n origin: span(definition.declaration)\n });\n consumed.push({\n start: definition.declaration.start,\n end: definition.declaration.end\n });\n erasedStyledDefinitions.push(definition.name);\n if (definition.exported) erasedExports.push(definition.name);\n }\n const animatedNumberBindings = bindings.filter(\n (binding) => ZERO_ANIMATED_NUMBER_HOOKS.has(binding.imported) && referencesOf(binding.local).some((reference) => !isConsumed(reference))\n );\n const rewrittenAnimatedNumberHooks = animatedNumberBindings.map(\n (binding) => binding.imported\n );\n const animatedNumberSpecifiers = new Set(\n animatedNumberBindings.map((binding) => binding.specifierNode)\n );\n const leafImportEdits = [];\n for (const declaration of tamaguiDeclarations) {\n const rewritten = animatedNumberBindings.filter(\n (binding) => binding.declaration === declaration\n );\n if (rewritten.length === 0) continue;\n leafImportEdits.push({\n start: declaration.start,\n end: declaration.start,\n content: `import { ${rewritten.map(\n (binding) => binding.imported === binding.local ? binding.imported : `${binding.imported} as ${binding.local}`\n ).join(\", \")} } from ${JSON.stringify(ZERO_ANIMATED_NUMBER_MODULE)};\n`,\n origin: span(declaration)\n });\n }\n const deadBindings = new Set(animatedNumberSpecifiers);\n const removedBindings = [];\n const liveBindings = [];\n for (const binding of bindings) {\n if (animatedNumberSpecifiers.has(binding.specifierNode)) continue;\n const references = referencesOf(binding.local);\n if (references.length > 0 && !references.every(isConsumed)) {\n liveBindings.push(binding);\n continue;\n }\n deadBindings.add(binding.specifierNode);\n removedBindings.push(binding.local);\n }\n const edits = [...styledEdits, ...leafImportEdits];\n const removedModules = [];\n for (const declaration of tamaguiDeclarations) {\n const specifiers = childNodes(declaration, \"specifiers\").filter(\n (specifier) => specifier.importKind !== \"type\"\n );\n if (specifiers.length === 0) continue;\n const dead = specifiers.filter((specifier) => deadBindings.has(specifier));\n if (dead.length === 0) continue;\n if (dead.length === specifiers.length) {\n edits.push({\n start: declaration.start,\n end: declaration.end,\n content: \"\",\n origin: span(declaration)\n });\n removedModules.push(stringValueOf(childNode(declaration, \"source\")));\n continue;\n }\n const survivors = specifiers.filter((specifier) => !deadBindings.has(specifier));\n const braceStart = specifiers[0].start;\n const braceEnd = specifiers[specifiers.length - 1].end;\n edits.push({\n start: braceStart,\n end: braceEnd,\n content: survivors.map((specifier) => source.slice(specifier.start, specifier.end)).join(\", \"),\n origin: span({ start: braceStart, end: braceEnd })\n });\n }\n for (const binding of liveBindings) {\n const live = referencesOf(binding.local).filter(\n (reference) => !isConsumed(reference)\n )[0];\n if (ZERO_DESIGN_STATE_APIS.has(binding.imported)) {\n violations.push({\n rule: 7,\n code: \"zero/design-state-read\",\n span: span(live),\n message: zeroRuleMessage(7, { api: binding.imported })\n });\n continue;\n }\n if (ZERO_PROVIDER_EXPORTS.has(binding.imported)) {\n violations.push({\n rule: 4,\n code: \"zero/runtime-provider\",\n span: span(live),\n component: binding.imported,\n message: ZERO_PROVIDER_MESSAGE\n });\n continue;\n }\n violations.push({\n rule: 2,\n code: \"zero/live-tamagui-reference\",\n span: span(live),\n component: binding.local,\n message: zeroRuleMessage(2, { expression: referenceExpression(source, live) })\n });\n }\n return {\n edits,\n removedModules,\n removedBindings,\n erasedStyledDefinitions,\n erasedExports,\n rewrittenAnimatedNumberHooks,\n liveBindings: liveBindings.map((binding) => binding.local),\n violations\n };\n}\nexport {\n ZERO_ANIMATED_NUMBER_HOOKS,\n ZERO_ANIMATED_NUMBER_MODULE,\n ZERO_DESIGN_STATE_APIS,\n ZERO_FAILURE_FOOTER,\n ZERO_PROVIDER_EXPORTS,\n ZERO_PROVIDER_MESSAGE,\n isTamaguiSpecifier,\n planZeroErasure,\n zeroConfigDriverMessage,\n zeroIslandThemeMessage,\n zeroRuleMessage,\n zeroSideEffectImportMessage,\n zeroStaticIslandImportMessage,\n zeroThemeBoundaryMessage,\n zeroViolationsFromPlan\n};\n//# sourceMappingURL=zero.js.map\n"],"mappings":";;;;;AAGA,MAAM,sB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AI;IACf,WAAW,QAAQ;IACnB,SAAS;GACX,CAAC;GACD;EACF;EACA,WAAW,KAAK;GACd,MAAM;GACN,MAAM;GACN,MAAM,KAAK,IAAI;GACf,WAAW,QAAQ;GACnB,SAAS,gBAAgB,GAAG,EAAE,YAAY,oBAAoB,QAAQ,IAAI,EAAE,CAAC;EAC/E,CAAC;CACH;CACA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,cAAc,aAAa,KAAK,YAAY,QAAQ,KAAK;EACzD;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"zero.js","names":[],"sources":["esm/zero.js"],"sourcesContent":["import { childNode, childNodes, walkAst } from \"./ast\";\nimport { zeroRuleForBailout } from \"./diagnostics\";\nimport { parseModuleAst } from \"./yuku\";\nconst ZERO_FAILURE_FOOTER = \"Fix every site or move the owning module to a declared full-runtime island. Zero-runtime never retains one component as a fallback.\";\nconst ZERO_DESIGN_STATE_APIS = /* @__PURE__ */ new Set([\n \"useMedia\",\n \"useTheme\",\n \"useThemeName\",\n \"splitStyleProps\",\n \"getConfig\",\n \"getTokens\",\n \"useTokens\",\n \"getVariableValue\",\n \"getToken\",\n \"getTokenValue\",\n \"useConfiguration\",\n \"useAnimationDriver\",\n \"updateTheme\",\n \"addTheme\",\n \"replaceTheme\",\n \"forceUpdateThemes\"\n]);\nconst ZERO_PROVIDER_EXPORTS = /* @__PURE__ */ new Set([\n \"TamaguiProvider\",\n \"ThemeProvider\",\n \"TamaguiRoot\"\n]);\nconst ZERO_ANIMATED_NUMBER_HOOKS = /* @__PURE__ */ new Set([\n \"useAnimatedNumber\",\n \"useAnimatedNumberStyle\",\n \"useAnimatedNumbersStyle\",\n \"useAnimatedNumberReaction\"\n]);\nconst ZERO_ANIMATED_NUMBER_MODULE = \"@tamagui/animations-css/animated-number\";\nfunction zeroRuleMessage(rule, params) {\n const component = params.component ?? \"this component\";\n switch (rule) {\n case 1:\n return `Zero-runtime rule 1: ${component} cannot receive a prop spread because the compiler cannot prove it is style-free. Pass non-style props explicitly or move this module to a full-runtime island.`;\n case 2:\n return `Zero-runtime rule 2: component expression ${params.expression ?? component} does not resolve to one literal lowerable host component. Use a literal Tamagui or html.* component, or move this module to a full-runtime island.`;\n case 3:\n return `Zero-runtime rule 3: value for ${params.prop ?? \"a style prop\"} on ${component} cannot be lowered: ${params.detail ?? \"the compiler could not evaluate it\"}. Use a supported build-time value or move this module to a full-runtime island.`;\n case 4:\n return `Zero-runtime rule 4: ${params.detail ?? component} requires runtime theme or config state. Theme names and modifier targets must be statically enumerable, Theme value props and config must be build-time data, and runtime mutation belongs in a full-runtime island.`;\n case 5:\n return `Zero-runtime rule 5: ${params.detail ?? component} requires a component animation runtime. Use a static CSS transition or move this module to a full-runtime island.`;\n case 6:\n return `Zero-runtime rule 6: ${component} does not lower to one host element with className and is island-only. Move this module to a declared full-runtime island.`;\n case 7:\n return `Zero-runtime rule 7: ${params.api ?? component} reads Tamagui design state in JavaScript. Express the condition in CSS or move this module to a full-runtime island.`;\n case 8:\n return `Zero-runtime rule 8: ${params.detail ?? \"a module-level import\"} defeats the zero-runtime graph. ${params.remediation ?? \"\"}`.trimEnd();\n }\n}\nfunction zeroSideEffectImportMessage(specifier) {\n return zeroRuleMessage(8, {\n detail: `the bare side-effect import of \"${specifier}\", whose effects zero-runtime cannot prove or erase,`,\n remediation: `Remove it, or import the values this module uses so the compiler can lower and erase them.`\n });\n}\nfunction zeroStaticIslandImportMessage(specifier, islandId) {\n return zeroRuleMessage(8, {\n detail: `the static import of \"${specifier}\", which is declared as full-runtime island \"${islandId}\",`,\n remediation: `Import the generated island loader instead; the island is a separately built entry and the zero graph never contains it.`\n });\n}\nconst ZERO_PROVIDER_MESSAGE = \"[tamagui zero-runtime] Rule 4: TamaguiProvider is not used by a zero-runtime root. The bundler loads generated CSS and the compiler lowers static Theme nodes. Remove this provider or make this entry full-runtime.\";\nfunction zeroThemeBoundaryMessage(component, prop) {\n return `[tamagui zero-runtime] Rule 4: ${component} uses ${prop}, which creates a runtime component theme boundary. Replace it with a static <Theme name=\"...\"> wrapper (use name=\"inverse\" for themeInverse) or move this module to a full-runtime island.`;\n}\nfunction zeroConfigDriverMessage(name, outputStyle) {\n return `[tamagui zero-runtime] Rule 5: createTamagui animations must resolve to the CSS driver. Driver ${name} has outputStyle=${String(outputStyle)}. Remove it from the zero entry or move its consumers to a full-runtime island.`;\n}\nfunction zeroIslandThemeMessage(entry) {\n return `[tamagui zero-runtime] Rule 4: island ${entry} has no statically resolved theme context at this mount. Place the island boundary under a compiler-visible static <Theme> or make this entry full-runtime.`;\n}\nfunction zeroViolationsFromPlan(plan) {\n const violations = [];\n for (const diagnostic of plan.diagnostics) {\n if (!diagnostic.blocking) continue;\n const rule = zeroRuleForBailout(diagnostic);\n violations.push({\n rule,\n code: diagnostic.code,\n span: diagnostic.span,\n component: diagnostic.component,\n message: diagnostic.zeroMessage ?? zeroRuleMessage(rule, {\n component: diagnostic.component,\n prop: diagnostic.prop,\n detail: diagnostic.message\n })\n });\n }\n return violations;\n}\nfunction isTamaguiSpecifier(specifier) {\n return specifier === \"tamagui\" || specifier.startsWith(\"tamagui/\") || specifier.startsWith(\"@tamagui/\");\n}\nfunction collectNameOccurrences(program) {\n const occurrences = /* @__PURE__ */ new Map();\n walkAst(program, (node, parent, key) => {\n if (node.type !== \"Identifier\" && node.type !== \"JSXIdentifier\") return;\n const name = typeof node.name === \"string\" ? node.name : null;\n if (!name) return;\n if (parent) {\n if (parent.type === \"ImportSpecifier\" || parent.type === \"ImportDefaultSpecifier\" || parent.type === \"ImportNamespaceSpecifier\" || parent.type === \"ExportSpecifier\") {\n return;\n }\n if ((parent.type === \"MemberExpression\" || parent.type === \"JSXMemberExpression\" || parent.type === \"OptionalMemberExpression\") && key === \"property\" && !parent.computed) {\n return;\n }\n if ((parent.type === \"Property\" || parent.type === \"PropertyDefinition\") && key === \"key\" && !parent.computed) {\n return;\n }\n if (parent.type === \"JSXAttribute\" && key === \"name\") return;\n if ((parent.type === \"VariableDeclarator\" || parent.type === \"FunctionDeclaration\" || parent.type === \"ClassDeclaration\") && key === \"id\") {\n return;\n }\n }\n const entry = { start: node.start, end: node.end, parent: parent ?? null };\n const list = occurrences.get(name);\n if (list) list.push(entry);\n else occurrences.set(name, [entry]);\n });\n return occurrences;\n}\nfunction coversRange(outer, inner) {\n return outer.start <= inner.start && outer.end >= inner.end;\n}\nfunction stringValueOf(node) {\n return node && typeof node.value === \"string\" ? node.value : null;\n}\nfunction identifierNameOf(node) {\n return node && node.type === \"Identifier\" && typeof node.name === \"string\" ? node.name : null;\n}\nfunction referenceExpression(source, reference) {\n const parent = reference.parent;\n const node = parent && (parent.type === \"ConditionalExpression\" || parent.type === \"LogicalExpression\" || parent.type === \"CallExpression\" || parent.type === \"MemberExpression\" || parent.type === \"ArrayExpression\") ? parent : reference;\n const text = source.slice(node.start, node.end).replace(/\\s+/g, \" \").trim();\n return text.length > 80 ? `${text.slice(0, 77)}...` : text;\n}\nfunction collectStyledDeclarators(program, styledLocals) {\n const found = [];\n for (const statement of childNodes(program, \"body\")) {\n const exported = statement.type === \"ExportNamedDeclaration\";\n const declaration = exported ? childNode(statement, \"declaration\") : statement;\n if (!declaration || declaration.type !== \"VariableDeclaration\") continue;\n const declarators = childNodes(declaration, \"declarations\");\n if (declarators.length !== 1) continue;\n const declarator = declarators[0];\n const name = identifierNameOf(childNode(declarator, \"id\"));\n const init = childNode(declarator, \"init\");\n if (!name || !init || init.type !== \"CallExpression\") continue;\n const callee = identifierNameOf(childNode(init, \"callee\"));\n if (!callee || !styledLocals.has(callee)) continue;\n found.push({\n name,\n declarator,\n declaration: exported ? statement : declaration,\n exported\n });\n }\n return found;\n}\nfunction planZeroErasure(input) {\n const { id, source, loweredEdits } = input;\n const program = parseModuleAst(source, id);\n const violations = [];\n const span = (node) => ({ id, start: node.start, end: node.end });\n const bindings = [];\n const tamaguiDeclarations = [];\n for (const statement of childNodes(program, \"body\")) {\n if (statement.type !== \"ImportDeclaration\") continue;\n if (statement.importKind === \"type\") continue;\n const moduleSpecifier = stringValueOf(childNode(statement, \"source\"));\n if (!moduleSpecifier) continue;\n const islandId = input.islandIdFor(moduleSpecifier);\n if (islandId) {\n violations.push({\n rule: 8,\n code: \"zero/static-island-import\",\n span: span(statement),\n message: zeroStaticIslandImportMessage(moduleSpecifier, islandId)\n });\n continue;\n }\n if (!input.isTamaguiSpecifier(moduleSpecifier)) continue;\n tamaguiDeclarations.push(statement);\n const specifiers = childNodes(statement, \"specifiers\");\n if (specifiers.length === 0) {\n violations.push({\n rule: 8,\n code: \"zero/side-effect-import\",\n span: span(statement),\n message: zeroSideEffectImportMessage(moduleSpecifier)\n });\n continue;\n }\n for (const specifier of specifiers) {\n if (specifier.importKind === \"type\") continue;\n const local = identifierNameOf(childNode(specifier, \"local\"));\n if (!local) continue;\n bindings.push({\n local,\n imported: identifierNameOf(childNode(specifier, \"imported\")) ?? local,\n specifierNode: specifier,\n declaration: statement,\n moduleSpecifier\n });\n }\n }\n if (bindings.length === 0) {\n return {\n edits: [],\n removedModules: [],\n removedBindings: [],\n erasedStyledDefinitions: [],\n erasedExports: [],\n rewrittenAnimatedNumberHooks: [],\n liveBindings: [],\n violations\n };\n }\n const consumed = loweredEdits.filter((edit) => edit.end > edit.start).map((edit) => ({ start: edit.start, end: edit.end }));\n const occurrences = collectNameOccurrences(program);\n const referencesOf = (local) => occurrences.get(local) ?? [];\n const isConsumed = (reference) => consumed.some((range) => coversRange(range, reference));\n const styledLocals = new Set(\n bindings.filter((binding) => binding.imported === \"styled\").map((b) => b.local)\n );\n const erasedStyledDefinitions = [];\n const erasedExports = [];\n const styledEdits = [];\n for (const definition of collectStyledDeclarators(program, styledLocals)) {\n const references = referencesOf(definition.name);\n if (references.length === 0) continue;\n if (!references.every(isConsumed)) continue;\n styledEdits.push({\n start: definition.declaration.start,\n end: definition.declaration.end,\n content: \"\",\n origin: span(definition.declaration)\n });\n consumed.push({\n start: definition.declaration.start,\n end: definition.declaration.end\n });\n erasedStyledDefinitions.push(definition.name);\n if (definition.exported) erasedExports.push(definition.name);\n }\n const animatedNumberBindings = bindings.filter(\n (binding) => ZERO_ANIMATED_NUMBER_HOOKS.has(binding.imported) && referencesOf(binding.local).some((reference) => !isConsumed(reference))\n );\n const rewrittenAnimatedNumberHooks = animatedNumberBindings.map(\n (binding) => binding.imported\n );\n const animatedNumberSpecifiers = new Set(\n animatedNumberBindings.map((binding) => binding.specifierNode)\n );\n const leafImportEdits = [];\n for (const declaration of tamaguiDeclarations) {\n const rewritten = animatedNumberBindings.filter(\n (binding) => binding.declaration === declaration\n );\n if (rewritten.length === 0) continue;\n leafImportEdits.push({\n start: declaration.start,\n end: declaration.start,\n content: `import { ${rewritten.map(\n (binding) => binding.imported === binding.local ? binding.imported : `${binding.imported} as ${binding.local}`\n ).join(\", \")} } from ${JSON.stringify(ZERO_ANIMATED_NUMBER_MODULE)};\n`,\n origin: span(declaration)\n });\n }\n const deadBindings = new Set(animatedNumberSpecifiers);\n const removedBindings = [];\n const liveBindings = [];\n for (const binding of bindings) {\n if (animatedNumberSpecifiers.has(binding.specifierNode)) continue;\n const references = referencesOf(binding.local);\n if (references.length > 0 && !references.every(isConsumed)) {\n liveBindings.push(binding);\n continue;\n }\n deadBindings.add(binding.specifierNode);\n removedBindings.push(binding.local);\n }\n const edits = [...styledEdits, ...leafImportEdits];\n const removedModules = [];\n for (const declaration of tamaguiDeclarations) {\n const specifiers = childNodes(declaration, \"specifiers\").filter(\n (specifier) => specifier.importKind !== \"type\"\n );\n if (specifiers.length === 0) continue;\n const dead = specifiers.filter((specifier) => deadBindings.has(specifier));\n if (dead.length === 0) continue;\n if (dead.length === specifiers.length) {\n edits.push({\n start: declaration.start,\n end: declaration.end,\n content: \"\",\n origin: span(declaration)\n });\n removedModules.push(stringValueOf(childNode(declaration, \"source\")));\n continue;\n }\n const survivors = specifiers.filter((specifier) => !deadBindings.has(specifier));\n const braceStart = specifiers[0].start;\n const braceEnd = specifiers[specifiers.length - 1].end;\n edits.push({\n start: braceStart,\n end: braceEnd,\n content: survivors.map((specifier) => source.slice(specifier.start, specifier.end)).join(\", \"),\n origin: span({ start: braceStart, end: braceEnd })\n });\n }\n for (const binding of liveBindings) {\n const live = referencesOf(binding.local).filter(\n (reference) => !isConsumed(reference)\n )[0];\n if (ZERO_DESIGN_STATE_APIS.has(binding.imported)) {\n violations.push({\n rule: 7,\n code: \"zero/design-state-read\",\n span: span(live),\n message: zeroRuleMessage(7, { api: binding.imported })\n });\n continue;\n }\n if (ZERO_PROVIDER_EXPORTS.has(binding.imported)) {\n violations.push({\n rule: 4,\n code: \"zero/runtime-provider\",\n span: span(live),\n component: binding.imported,\n message: ZERO_PROVIDER_MESSAGE\n });\n continue;\n }\n violations.push({\n rule: 2,\n code: \"zero/live-tamagui-reference\",\n span: span(live),\n component: binding.local,\n message: zeroRuleMessage(2, { expression: referenceExpression(source, live) })\n });\n }\n return {\n edits,\n removedModules,\n removedBindings,\n erasedStyledDefinitions,\n erasedExports,\n rewrittenAnimatedNumberHooks,\n liveBindings: liveBindings.map((binding) => binding.local),\n violations\n };\n}\nexport {\n ZERO_ANIMATED_NUMBER_HOOKS,\n ZERO_ANIMATED_NUMBER_MODULE,\n ZERO_DESIGN_STATE_APIS,\n ZERO_FAILURE_FOOTER,\n ZERO_PROVIDER_EXPORTS,\n ZERO_PROVIDER_MESSAGE,\n isTamaguiSpecifier,\n planZeroErasure,\n zeroConfigDriverMessage,\n zeroIslandThemeMessage,\n zeroRuleMessage,\n zeroSideEffectImportMessage,\n zeroStaticIslandImportMessage,\n zeroThemeBoundaryMessage,\n zeroViolationsFromPlan\n};\n//# sourceMappingURL=zero.js.map\n"],"mappings":";;;;;AAGA,MAAM,sBAAsB;AAC5B,MAAM,yCAAyC,IAAI,IAAI;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,wCAAwC,IAAI,IAAI;CACpD;CACA;CACA;AACF,CAA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AAI,EAAE,CAAC;EAC/E,CAAC;CACH;CACA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,cAAc,aAAa,KAAK,YAAY,QAAQ,KAAK;EACzD;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/compiler-core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.881.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.
|
|
43
|
+
"@tamagui/build": "3.0.0-beta.881.1",
|
|
44
44
|
"typescript": "~6.0.3"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|