solid-optimizer 1.0.0-next.7 → 1.0.0-next.8

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-O1Z60VsW.mjs","names":["parse","exportName","parse","isAccessor","parse","parseHTML","parse"],"sources":["../src/ast.ts","../src/context.ts","../src/scope.ts","../src/value.ts","../src/constants.ts","../src/jsx.ts","../src/size.ts","../src/fold.ts","../src/provider.ts","../src/copy-size.ts","../src/inline.ts","../src/memo.ts","../src/nesting.ts","../src/conditional.ts","../src/terminate.ts","../src/compile.ts"],"sourcesContent":["import type { Expression, JSXChild, Node, ParserOptions, Program } from 'oxc-parser';\nimport { parseSync, rawTransferSupported, visitorKeys } from 'oxc-parser';\n\n/**\n * Keys that only hold TypeScript types. Types never run, so no pass reads or rewrites them.\n */\nconst TYPE_KEYS = new Set([\n 'typeAnnotation',\n 'typeParameters',\n 'typeArguments',\n 'returnType',\n 'superTypeArguments',\n 'implements',\n]);\n\n/**\n * TypeScript nodes that wrap a runtime expression.\n * Every other TypeScript node is skipped along with its children.\n */\nconst TS_EXPRESSION_WRAPPERS = new Set([\n 'TSAsExpression',\n 'TSSatisfiesExpression',\n 'TSNonNullExpression',\n 'TSTypeAssertion',\n 'TSInstantiationExpression',\n 'TSExportAssignment',\n]);\n\nexport function isNode(value: unknown): value is Node {\n return (\n typeof value === 'object' && value !== null && 'type' in value && typeof value.type === 'string'\n );\n}\n\n/**\n * Calls `visit` for each child node of `node`, in source order.\n */\nexport function forEachChild(node: Node, visit: (child: Node) => void): void {\n if (node.type.startsWith('TS')) {\n if (TS_EXPRESSION_WRAPPERS.has(node.type)) {\n const expression: unknown = Reflect.get(node, 'expression');\n if (isNode(expression)) {\n visit(expression);\n }\n } else if (node.type === 'TSParameterProperty') {\n visit(node.parameter);\n }\n return;\n }\n if (!Object.hasOwn(visitorKeys, node.type)) {\n return;\n }\n for (const key of visitorKeys[node.type]) {\n if (TYPE_KEYS.has(key)) {\n continue;\n }\n const value: unknown = Reflect.get(node, key);\n if (Array.isArray(value)) {\n const items: unknown[] = value;\n for (const item of items) {\n if (isNode(item)) {\n visit(item);\n }\n }\n } else if (isNode(value)) {\n visit(value);\n }\n }\n}\n\nexport type Parents = Map<Node, Node>;\n\nexport function collectParents(program: Program): Parents {\n const parents: Parents = new Map();\n const visit = (node: Node): void => {\n forEachChild(node, (child) => {\n parents.set(child, node);\n visit(child);\n });\n };\n visit(program);\n return parents;\n}\n\n/**\n * Raw transfer hands the AST over in shared memory instead of as JSON, which\n * is several times faster to read. It is not in the options' type yet.\n */\nconst RAW_TRANSFER = rawTransferSupported();\n\nexport function parse(filename: string, code: string): Program {\n const options: ParserOptions & { experimentalRawTransfer?: boolean } = {\n lang: getLanguage(filename),\n sourceType: 'module',\n preserveParens: true,\n experimentalRawTransfer: RAW_TRANSFER,\n };\n const result = parseSync(filename, code, options);\n const error = result.errors.at(0);\n if (error) {\n throw new SyntaxError(`[solid-optimizer] ${filename}: ${error.codeframe ?? error.message}`);\n }\n return result.program;\n}\n\nfunction getLanguage(filename: string): 'jsx' | 'ts' | 'tsx' {\n if (/\\.tsx$/i.test(filename)) {\n return 'tsx';\n }\n if (/\\.[cm]?ts$/i.test(filename)) {\n return 'ts';\n }\n // Plain `.js` files are parsed as JSX, since bundled chunks keep the JSX they preserved.\n return 'jsx';\n}\n\n/**\n * Removes the parentheses and TypeScript wrappers around an expression.\n */\nexport function unwrap(node: Expression): Expression {\n let current = node;\n while (\n current.type === 'ParenthesizedExpression' ||\n current.type === 'TSAsExpression' ||\n current.type === 'TSSatisfiesExpression' ||\n current.type === 'TSNonNullExpression' ||\n current.type === 'TSTypeAssertion' ||\n current.type === 'TSInstantiationExpression'\n ) {\n current = current.expression;\n }\n return current;\n}\n\nexport function isFunctionNode(node: Node): boolean {\n return (\n node.type === 'FunctionDeclaration' ||\n node.type === 'FunctionExpression' ||\n node.type === 'ArrowFunctionExpression'\n );\n}\n\n/**\n * An intrinsic element name, such as `div` or `my-element`.\n * JSX treats a lowercase first letter as an intrinsic element.\n */\nexport function isIntrinsicTag(name: string): boolean {\n return /^[a-z][\\w-]*$/.test(name);\n}\n\n/**\n * Whether JSX drops this text: whitespace that contains a line break.\n */\nexport function isFilteredText(child: JSXChild): boolean {\n return child.type === 'JSXText' && /^\\s*$/.test(child.value) && /[\\r\\n]/.test(child.value);\n}\n\n/**\n * Whether a JSX child renders nothing: dropped whitespace, or a container\n * that only holds a comment, like `{/* note *\\/}`.\n */\nexport function isInsignificant(child: JSXChild): boolean {\n return (\n isFilteredText(child) ||\n (child.type === 'JSXExpressionContainer' && child.expression.type === 'JSXEmptyExpression')\n );\n}\n\n/**\n * Whether a JSX element or fragment sits in a list of JSX children.\n */\nexport function isJSXChild(node: Node, parents: Parents): boolean {\n const parent = parents.get(node);\n return parent?.type === 'JSXElement' || parent?.type === 'JSXFragment';\n}\n\n/**\n * Node types that bind tighter than any operator, so their text can replace\n * any expression without parentheses.\n */\nconst PRIMARY_TYPES = new Set([\n 'Identifier',\n 'Literal',\n 'ThisExpression',\n 'ArrayExpression',\n 'TemplateLiteral',\n 'ParenthesizedExpression',\n 'JSXElement',\n 'JSXFragment',\n]);\n\nexport function isPrimary(node: Node): boolean {\n if (node.type === 'Literal') {\n // `-1` is a unary expression, but a literal like `1` is primary.\n return typeof node.value !== 'number' || node.value >= 0;\n }\n return PRIMARY_TYPES.has(node.type);\n}\n\n/**\n * The node that starts an expression's text, such as `a` in `a.b()`.\n */\nfunction leftmost(node: Node): Node {\n switch (node.type) {\n case 'MemberExpression':\n return leftmost(node.object);\n case 'CallExpression':\n return leftmost(node.callee);\n case 'TaggedTemplateExpression':\n return leftmost(node.tag);\n case 'BinaryExpression':\n case 'LogicalExpression':\n return leftmost(node.left);\n case 'AssignmentExpression':\n return leftmost(node.left);\n case 'ConditionalExpression':\n return leftmost(node.test);\n case 'SequenceExpression':\n return node.expressions[0] ? leftmost(node.expressions[0]) : node;\n case 'ChainExpression':\n return leftmost(node.expression);\n case 'UpdateExpression':\n return node.prefix ? node : leftmost(node.argument);\n case 'TSAsExpression':\n case 'TSSatisfiesExpression':\n case 'TSNonNullExpression':\n return leftmost(node.expression);\n default:\n return node;\n }\n}\n\n/**\n * Whether `replacement` needs parentheses to take the place of `target`.\n *\n * Replacing an expression with one of its own operands never needs them, since an operand\n * binds at least as tightly as the expression around it. The exceptions are the positions\n * where the first token decides what the parser reads: a statement cannot start with `{`,\n * `function`, or `class`, and neither can an arrow function body.\n */\nexport function needsParensAt(target: Node, replacement: Node, parents: Parents): boolean {\n const parent = parents.get(target);\n if (parent === undefined) {\n return false;\n }\n const statementStart =\n parent.type === 'ExpressionStatement' ||\n parent.type === 'ExportDefaultDeclaration' ||\n (parent.type === 'ArrowFunctionExpression' && parent.body === target);\n if (!statementStart) {\n return false;\n }\n const first = leftmost(replacement);\n return (\n startsLikeStatement(first) ||\n // A string at the start of a statement can turn into a directive, like `\"use strict\"`.\n (first.type === 'Literal' && typeof first.value === 'string')\n );\n}\n\n/**\n * Whether an expression statement starting with `node` would parse as\n * something else: a block, a function declaration, or a class declaration.\n */\nexport function startsLikeStatement(node: Node): boolean {\n const first = leftmost(node);\n return (\n first.type === 'ObjectExpression' ||\n first.type === 'FunctionExpression' ||\n first.type === 'ClassExpression'\n );\n}\n","import type MagicString from 'magic-string';\nimport type { Node, Program } from 'oxc-parser';\nimport type { Parents } from './ast';\nimport type { ResolvedImportedConstants } from './constants';\nimport type { Binding, ScopeAnalysis } from './scope';\nimport type { Primitive } from './value';\n\nexport interface ResolvedOptions {\n /** The control-flow components a tag may resolve to. */\n readonly builtIns: ReadonlySet<string>;\n /** The modules Solid's built-in components are imported from. */\n readonly moduleSources: readonly string[];\n /** Top-level names that refer to a Solid export, keyed by name. */\n readonly builtInAliases: ReadonlyMap<string, string>;\n /** Whether a top-level `var` that nothing writes to counts as a constant. */\n readonly constantVars: boolean;\n /** The constants imported modules export, by import specifier and export name. */\n readonly importedConstants: ResolvedImportedConstants;\n /** Values of global names and paths, like `__DEV__` or `import.meta.env.MODE`. */\n readonly globalConstants: ReadonlyMap<string, Primitive>;\n /** The exports of imported modules that are contexts, by import specifier. */\n readonly importedContexts: ReadonlyMap<string, ReadonlySet<string>>;\n /** Components other modules use too, by the number of modules that use them. */\n readonly sharedComponents: ReadonlyMap<string, number>;\n /** Whether to inline components even where the copies are larger. */\n readonly alwaysInline: boolean;\n /** Components to inline wherever they can be, whatever their size. */\n readonly alwaysInlineComponents: ReadonlySet<string>;\n}\n\n/**\n * Whether a binding keeps the value it was declared with, like a `const`.\n *\n * `var` is excluded by default. A read before its declaration sees\n * `undefined` rather than throwing. A bundler turns top-level `const` into\n * `var`, so the `constantVars` option counts those too.\n */\nexport function isConstantDeclaration(binding: Binding, options: ResolvedOptions): boolean {\n if (binding.mutated) {\n return false;\n }\n if (binding.kind === 'const' || binding.kind === 'let') {\n return true;\n }\n return binding.kind === 'var' && options.constantVars && binding.scope.parent === undefined;\n}\n\n/**\n * The Solid export a binding refers to, by the name Solid exports it under.\n *\n * An import from a Solid module is decided by its exported name, so `m` from\n * `import { createMemo as m }` is `createMemo`. A bundled chunk declares or\n * imports Solid's exports under names the bundler chose, which\n * `builtInAliases` maps back.\n */\nexport function solidExport(binding: Binding, options: ResolvedOptions): string | undefined {\n if (binding.scope.parent === undefined && options.builtInAliases.has(binding.name)) {\n return options.builtInAliases.get(binding.name);\n }\n if (\n binding.kind === 'import' &&\n binding.source !== undefined &&\n options.moduleSources.includes(binding.source)\n ) {\n return binding.imported;\n }\n return undefined;\n}\n\n/** The passes that record what they leave alone. */\nexport type SkipPass = 'inline' | 'contexts' | 'memos';\n\n/**\n * Something a pass left alone, and why. The `compile` option `report`\n * collects them.\n */\nexport interface Skip {\n readonly pass: SkipPass;\n /** A short code for the reason, like `call-spread`. */\n readonly reason: string;\n /** The component, context, or memo it is about. */\n readonly name: string;\n}\n\n/**\n * Everything a pass needs: the parsed code and the string it edits.\n *\n * A pass reads the AST of the code as it was before the pass started, and\n * writes its edits to `s`. The next pass parses the result again.\n */\nexport interface PassContext {\n readonly code: string;\n /** The file name, which picks the parser. */\n readonly filename: string;\n readonly s: MagicString;\n readonly program: Program;\n readonly parents: Parents;\n readonly scopes: ScopeAnalysis;\n readonly options: ResolvedOptions;\n /** Where a pass records what it leaves alone, when the caller asked for a report. */\n readonly skips: Skip[] | undefined;\n}\n\n/**\n * Records that a pass left something alone, when the caller asked for a report.\n */\nexport function recordSkip(\n context: PassContext,\n pass: SkipPass,\n reason: string,\n name: string,\n): void {\n context.skips?.push({ pass, reason, name });\n}\n\n/**\n * The current text of `node`, including the edits made inside it so far.\n */\nexport function getText(context: PassContext, node: Node): string {\n return context.s.slice(node.start, node.end);\n}\n","/**\n * Binding resolution for the passes.\n *\n * oxc-parser returns an ESTree AST without scope information, so this module\n * resolves every identifier reference to the declaration it binds to. The\n * passes use it to fold a constant only where it is the same binding, to tell\n * Solid's own components from local ones, and to rename the bindings of an\n * inlined component.\n *\n * Code is treated as an ES module: it is strict, and a function declared in a\n * block is scoped to that block.\n */\nimport type {\n BindingPattern,\n Class,\n Directive,\n Function as FunctionNode,\n JSXElementName,\n ModuleExportName,\n Node,\n ParamPattern,\n Program,\n Statement,\n} from 'oxc-parser';\nimport type { Parents } from './ast';\nimport { forEachChild, isIntrinsicTag } from './ast';\n\nexport type BindingKind =\n | 'var'\n | 'let'\n | 'const'\n | 'function'\n | 'class'\n | 'param'\n | 'import'\n | 'catch'\n | 'other';\n\nexport interface Binding {\n readonly name: string;\n readonly kind: BindingKind;\n readonly scope: Scope;\n /** The identifier that declares the binding. */\n readonly identifier: Node;\n /**\n * The node that declares the binding: a `VariableDeclarator`, a function, a\n * class, an import specifier, or the function or clause that owns a parameter.\n */\n readonly declaration: Node;\n /** The module an import binding comes from. */\n readonly source: string | undefined;\n /** The name an import binding has in its module: an export name, `default`, or `*`. */\n readonly imported: string | undefined;\n /** Every reference, including JSX tag names in opening and closing tags. */\n readonly references: Node[];\n /** Whether anything writes to the binding after its declaration. */\n mutated: boolean;\n}\n\nexport interface Scope {\n readonly node: Node;\n readonly parent: Scope | undefined;\n /** Whether `var` declarations stop here. */\n readonly isFunction: boolean;\n readonly bindings: Map<string, Binding>;\n}\n\nexport interface ScopeAnalysis {\n readonly root: Scope;\n /** What each identifier reference resolves to. `undefined` means a global. */\n readonly references: Map<Node, Binding | undefined>;\n /** The scope each scope-creating node opens. A function body shares its function's scope. */\n readonly scopes: Map<Node, Scope>;\n /** Every identifier name in the program, for generating names that collide with none. */\n readonly names: Set<string>;\n}\n\ninterface PendingReference {\n readonly node: Node;\n readonly name: string;\n readonly scope: Scope;\n readonly write: boolean;\n}\n\nexport function lookup(scope: Scope, name: string): Binding | undefined {\n let current: Scope | undefined = scope;\n while (current) {\n const binding = current.bindings.get(name);\n if (binding) {\n return binding;\n }\n current = current.parent;\n }\n return undefined;\n}\n\n/**\n * The innermost scope that contains `node`.\n */\nexport function scopeAt(analysis: ScopeAnalysis, parents: Parents, node: Node): Scope {\n let current: Node | undefined = parents.get(node);\n while (current) {\n const scope = analysis.scopes.get(current);\n if (scope) {\n return scope;\n }\n current = parents.get(current);\n }\n return analysis.root;\n}\n\n/**\n * Whether `scope` is `ancestor` or nested inside it.\n */\nexport function isWithinScope(scope: Scope, ancestor: Scope): boolean {\n let current: Scope | undefined = scope;\n while (current) {\n if (current === ancestor) {\n return true;\n }\n current = current.parent;\n }\n return false;\n}\n\nfunction exportName(name: ModuleExportName): string {\n return name.type === 'Literal' ? name.value : name.name;\n}\n\nclass Analyzer {\n private scope: Scope;\n\n readonly root: Scope;\n\n readonly scopes = new Map<Node, Scope>();\n\n readonly names = new Set<string>();\n\n private readonly pending: PendingReference[] = [];\n\n constructor(program: Program) {\n this.root = {\n node: program,\n parent: undefined,\n isFunction: true,\n bindings: new Map(),\n };\n this.scopes.set(program, this.root);\n this.scope = this.root;\n }\n\n finish(): Map<Node, Binding | undefined> {\n const references = new Map<Node, Binding | undefined>();\n for (const item of this.pending) {\n const binding = lookup(item.scope, item.name);\n if (binding) {\n binding.references.push(item.node);\n if (item.write) {\n binding.mutated = true;\n }\n }\n references.set(item.node, binding);\n }\n return references;\n }\n\n private withScope(node: Node, isFunction: boolean, run: () => void): Scope {\n const scope: Scope = {\n node,\n parent: this.scope,\n isFunction,\n bindings: new Map(),\n };\n this.scopes.set(node, scope);\n const previous = this.scope;\n this.scope = scope;\n run();\n this.scope = previous;\n return scope;\n }\n\n private declare(\n identifier: Node & { name: string },\n kind: BindingKind,\n declaration: Node,\n source?: string,\n imported?: string,\n ): void {\n let target = this.scope;\n if (kind === 'var') {\n while (!target.isFunction && target.parent) {\n target = target.parent;\n }\n }\n this.names.add(identifier.name);\n const existing = target.bindings.get(identifier.name);\n if (existing) {\n // A redeclaration, like `var a; var a;`. The binding is no longer a\n // single declaration, so no pass treats it as a constant.\n existing.mutated = true;\n existing.references.push(identifier);\n return;\n }\n target.bindings.set(identifier.name, {\n name: identifier.name,\n kind,\n scope: target,\n identifier,\n declaration,\n source,\n imported,\n references: [],\n mutated: false,\n });\n }\n\n private reference(node: Node & { name: string }, write: boolean): void {\n this.names.add(node.name);\n this.pending.push({ node, name: node.name, scope: this.scope, write });\n }\n\n private declarePattern(\n pattern: BindingPattern | ParamPattern,\n kind: BindingKind,\n declaration: Node,\n ): void {\n switch (pattern.type) {\n case 'Identifier':\n this.declare(pattern, kind, declaration);\n break;\n case 'ObjectPattern':\n for (const property of pattern.properties) {\n if (property.type === 'RestElement') {\n this.declarePattern(property.argument, kind, declaration);\n } else {\n if (property.computed) {\n this.visit(property.key);\n }\n this.declarePattern(property.value, kind, declaration);\n }\n }\n break;\n case 'ArrayPattern':\n for (const element of pattern.elements) {\n if (element) {\n this.declarePattern(element, kind, declaration);\n }\n }\n break;\n case 'AssignmentPattern':\n this.declarePattern(pattern.left, kind, declaration);\n this.visit(pattern.right);\n break;\n case 'RestElement':\n this.declarePattern(pattern.argument, kind, declaration);\n break;\n case 'TSParameterProperty':\n this.declarePattern(pattern.parameter, kind, declaration);\n break;\n default:\n break;\n }\n }\n\n /**\n * Visits the target of an assignment, marking every identifier it writes.\n */\n private visitTarget(target: Node): void {\n switch (target.type) {\n case 'Identifier':\n this.reference(target, true);\n break;\n case 'ObjectPattern':\n for (const property of target.properties) {\n if (property.type === 'RestElement') {\n this.visitTarget(property.argument);\n } else {\n if (property.computed) {\n this.visit(property.key);\n }\n this.visitTarget(property.value);\n }\n }\n break;\n case 'ArrayPattern':\n for (const element of target.elements) {\n if (element) {\n this.visitTarget(element);\n }\n }\n break;\n case 'AssignmentPattern':\n this.visitTarget(target.left);\n this.visit(target.right);\n break;\n case 'RestElement':\n this.visitTarget(target.argument);\n break;\n case 'ParenthesizedExpression':\n case 'TSAsExpression':\n case 'TSSatisfiesExpression':\n case 'TSNonNullExpression':\n case 'TSTypeAssertion':\n this.visitTarget(target.expression);\n break;\n default:\n this.visit(target);\n break;\n }\n }\n\n private visitStatements(statements: (Statement | Directive)[]): void {\n for (const statement of statements) {\n this.visit(statement);\n }\n }\n\n private visitFunction(node: FunctionNode): void {\n this.withScope(node, true, () => {\n if (node.type === 'FunctionExpression' && node.id) {\n this.declare(node.id, 'other', node);\n }\n for (const param of node.params) {\n this.declarePattern(param, 'param', node);\n }\n if (node.body) {\n this.scopes.set(node.body, this.scope);\n this.visitStatements(node.body.body);\n }\n });\n }\n\n private visitClass(node: Class): void {\n for (const decorator of node.decorators) {\n this.visit(decorator);\n }\n if (node.superClass) {\n this.visit(node.superClass);\n }\n for (const element of node.body.body) {\n switch (element.type) {\n case 'MethodDefinition':\n case 'PropertyDefinition':\n case 'AccessorProperty':\n for (const decorator of element.decorators) {\n this.visit(decorator);\n }\n if (element.computed) {\n this.visit(element.key);\n }\n if (element.value) {\n this.visit(element.value);\n }\n break;\n case 'StaticBlock':\n this.withScope(element, true, () => {\n this.visitStatements(element.body);\n });\n break;\n default:\n break;\n }\n }\n }\n\n private visitJSXName(name: JSXElementName): void {\n if (name.type === 'JSXIdentifier') {\n if (!isIntrinsicTag(name.name) && name.name !== 'this') {\n this.reference(name, false);\n }\n } else if (name.type === 'JSXMemberExpression') {\n let object = name.object;\n while (object.type === 'JSXMemberExpression') {\n object = object.object;\n }\n if (object.name !== 'this') {\n this.reference(object, false);\n }\n }\n }\n\n visit(node: Node): void {\n switch (node.type) {\n case 'Identifier':\n this.reference(node, false);\n break;\n case 'VariableDeclaration': {\n // `declare const` only tells TypeScript about a global. It is stripped\n // with the types and declares nothing, so its name stays global.\n if (node.declare) {\n break;\n }\n // `using` binds a disposable resource, so it is never a folding candidate.\n let kind: BindingKind = 'other';\n if (node.kind === 'var' || node.kind === 'let' || node.kind === 'const') {\n kind = node.kind;\n }\n for (const declarator of node.declarations) {\n this.declarePattern(declarator.id, kind, declarator);\n if (declarator.init) {\n this.visit(declarator.init);\n }\n }\n break;\n }\n case 'FunctionDeclaration':\n if (node.id) {\n this.declare(node.id, 'function', node);\n }\n this.visitFunction(node);\n break;\n // An overload signature or a `declare function` has no body and is\n // stripped with the types. The implementation declares the name, if there is one.\n case 'TSDeclareFunction':\n this.visitFunction(node);\n break;\n case 'FunctionExpression':\n this.visitFunction(node);\n break;\n case 'ArrowFunctionExpression':\n this.withScope(node, true, () => {\n for (const param of node.params) {\n this.declarePattern(param, 'param', node);\n }\n if (node.body.type === 'BlockStatement') {\n this.scopes.set(node.body, this.scope);\n this.visitStatements(node.body.body);\n } else {\n this.visit(node.body);\n }\n });\n break;\n case 'ClassDeclaration':\n // A `declare class` is stripped with the types, like `declare const`.\n if (node.declare) {\n break;\n }\n if (node.id) {\n this.declare(node.id, 'class', node);\n }\n this.visitClass(node);\n break;\n case 'ClassExpression':\n this.withScope(node, false, () => {\n if (node.id) {\n this.declare(node.id, 'other', node);\n }\n this.visitClass(node);\n });\n break;\n case 'BlockStatement':\n this.withScope(node, false, () => {\n this.visitStatements(node.body);\n });\n break;\n case 'ForStatement':\n this.withScope(node, false, () => {\n if (node.init) {\n this.visit(node.init);\n }\n if (node.test) {\n this.visit(node.test);\n }\n if (node.update) {\n this.visit(node.update);\n }\n this.visit(node.body);\n });\n break;\n case 'ForInStatement':\n case 'ForOfStatement':\n this.withScope(node, false, () => {\n if (node.left.type === 'VariableDeclaration') {\n this.visit(node.left);\n } else {\n this.visitTarget(node.left);\n }\n this.visit(node.right);\n this.visit(node.body);\n });\n break;\n case 'CatchClause':\n this.withScope(node, false, () => {\n if (node.param) {\n this.declarePattern(node.param, 'catch', node);\n }\n this.visit(node.body);\n });\n break;\n case 'SwitchStatement':\n this.visit(node.discriminant);\n this.withScope(node, false, () => {\n for (const item of node.cases) {\n if (item.test) {\n this.visit(item.test);\n }\n this.visitStatements(item.consequent);\n }\n });\n break;\n case 'ImportDeclaration': {\n const source = node.source.value;\n for (const specifier of node.specifiers) {\n let imported = '*';\n if (specifier.type === 'ImportSpecifier') {\n imported = exportName(specifier.imported);\n } else if (specifier.type === 'ImportDefaultSpecifier') {\n imported = 'default';\n }\n this.declare(specifier.local, 'import', specifier, source, imported);\n }\n break;\n }\n case 'ExportNamedDeclaration':\n if (node.declaration) {\n this.visit(node.declaration);\n } else if (!node.source) {\n for (const specifier of node.specifiers) {\n if (specifier.local.type === 'Identifier') {\n this.reference(specifier.local, false);\n }\n }\n }\n break;\n case 'ExportAllDeclaration':\n case 'BreakStatement':\n case 'ContinueStatement':\n case 'MetaProperty':\n case 'PrivateIdentifier':\n case 'Super':\n case 'ThisExpression':\n case 'JSXText':\n case 'JSXEmptyExpression':\n break;\n case 'LabeledStatement':\n this.visit(node.body);\n break;\n case 'MemberExpression':\n this.visit(node.object);\n if (node.computed) {\n this.visit(node.property);\n }\n break;\n case 'Property':\n if (node.computed) {\n this.visit(node.key);\n }\n this.visit(node.value);\n break;\n case 'AssignmentExpression':\n this.visitTarget(node.left);\n this.visit(node.right);\n break;\n case 'UpdateExpression':\n this.visitTarget(node.argument);\n break;\n case 'JSXElement':\n this.visitJSXName(node.openingElement.name);\n for (const attribute of node.openingElement.attributes) {\n if (attribute.type === 'JSXSpreadAttribute') {\n this.visit(attribute.argument);\n } else if (attribute.value) {\n this.visit(attribute.value);\n }\n }\n for (const child of node.children) {\n this.visit(child);\n }\n if (node.closingElement) {\n this.visitJSXName(node.closingElement.name);\n }\n break;\n case 'TSEnumDeclaration':\n case 'TSImportEqualsDeclaration':\n this.declare(node.id, 'other', node);\n break;\n case 'TSModuleDeclaration':\n if (node.id.type === 'Identifier') {\n this.declare(node.id, 'other', node);\n }\n break;\n default:\n forEachChild(node, (child) => {\n this.visit(child);\n });\n break;\n }\n }\n}\n\nexport function analyzeScopes(program: Program): ScopeAnalysis {\n const analyzer = new Analyzer(program);\n analyzer.visit(program);\n const references = analyzer.finish();\n return {\n root: analyzer.root,\n references,\n scopes: analyzer.scopes,\n names: analyzer.names,\n };\n}\n","/**\n * The constant lattice the fold pass evaluates against.\n *\n * Only primitives live here, and every operator runs on them natively, so a\n * folded value is exactly what the engine would produce. Evaluating an\n * operator on primitives runs no user code. Anything that could, like `in`,\n * `instanceof`, or an object operand, is not folded.\n */\nimport type { Expression, Node } from 'oxc-parser';\n\nexport type Primitive = string | number | boolean | null | undefined;\n\nexport interface Const {\n readonly value: Primitive;\n}\n\n/**\n * Looks up the constant a reference resolves to: an identifier, or a member\n * of a namespace import.\n */\nexport type ConstantLookup = (reference: Node) => Const | undefined;\n\nfunction binary(operator: string, left: Primitive, right: Primitive): Const | undefined {\n switch (operator) {\n case '+':\n if (typeof left === 'string' || typeof right === 'string') {\n return { value: String(left) + String(right) };\n }\n return { value: Number(left) + Number(right) };\n case '-':\n return { value: Number(left) - Number(right) };\n case '*':\n return { value: Number(left) * Number(right) };\n case '/':\n return { value: Number(left) / Number(right) };\n case '%':\n return { value: Number(left) % Number(right) };\n case '**':\n return { value: Number(left) ** Number(right) };\n case '===':\n return { value: left === right };\n case '!==':\n return { value: left !== right };\n case '==':\n // Loose equality is the operator being folded, so it has to run as written.\n // oxlint-disable-next-line eqeqeq\n return { value: left == right };\n case '!=':\n // oxlint-disable-next-line eqeqeq\n return { value: left != right };\n case '<':\n case '<=':\n case '>':\n case '>=':\n return { value: compare(operator, left, right) };\n case '&':\n return { value: Number(left) & Number(right) };\n case '|':\n return { value: Number(left) | Number(right) };\n case '^':\n return { value: Number(left) ^ Number(right) };\n case '<<':\n return { value: Number(left) << Number(right) };\n case '>>':\n return { value: Number(left) >> Number(right) };\n case '>>>':\n return { value: Number(left) >>> Number(right) };\n default:\n return undefined;\n }\n}\n\nfunction compare(operator: string, left: Primitive, right: Primitive): boolean {\n // Two strings compare by code unit. Every other pair compares as numbers.\n if (typeof left === 'string' && typeof right === 'string') {\n switch (operator) {\n case '<':\n return left < right;\n case '<=':\n return left <= right;\n case '>':\n return left > right;\n default:\n return left >= right;\n }\n }\n const a = Number(left);\n const b = Number(right);\n switch (operator) {\n case '<':\n return a < b;\n case '<=':\n return a <= b;\n case '>':\n return a > b;\n default:\n return a >= b;\n }\n}\n\nfunction unary(operator: string, argument: Primitive): Const | undefined {\n switch (operator) {\n case '!':\n return { value: !argument };\n case 'typeof':\n return { value: typeof argument };\n case '+':\n return { value: Number(argument) };\n case '-':\n return { value: -Number(argument) };\n case '~':\n return { value: ~Number(argument) };\n case 'void':\n return { value: undefined };\n default:\n return undefined;\n }\n}\n\n/**\n * Evaluates `node` to a primitive, or returns `undefined` when it is not a\n * constant that evaluates without side effects.\n */\nexport function evaluate(node: Node, lookup: ConstantLookup): Const | undefined {\n switch (node.type) {\n case 'Literal':\n if (\n typeof node.value === 'string' ||\n typeof node.value === 'number' ||\n typeof node.value === 'boolean' ||\n node.value === null\n ) {\n // A regular expression whose flags the runtime does not support also has a `null` value.\n return 'regex' in node ? undefined : { value: node.value };\n }\n return undefined;\n case 'Identifier':\n case 'MemberExpression':\n return lookup(node);\n case 'ParenthesizedExpression':\n case 'TSAsExpression':\n case 'TSSatisfiesExpression':\n case 'TSNonNullExpression':\n return evaluate(node.expression, lookup);\n case 'TemplateLiteral': {\n let out = '';\n for (const [index, quasi] of node.quasis.entries()) {\n // A cooked value of `null` means an invalid escape, which only a tagged template allows.\n if (quasi.value.cooked === null) {\n return undefined;\n }\n out += quasi.value.cooked;\n const expression = node.expressions.at(index);\n if (expression) {\n const value = evaluate(expression, lookup);\n if (!value) {\n return undefined;\n }\n out += String(value.value);\n }\n }\n return { value: out };\n }\n case 'UnaryExpression': {\n if (node.operator === 'delete') {\n return undefined;\n }\n const argument = evaluate(node.argument, lookup);\n return argument ? unary(node.operator, argument.value) : undefined;\n }\n case 'BinaryExpression': {\n const left = evaluate(node.left, lookup);\n if (!left) {\n return undefined;\n }\n const right = evaluate(node.right, lookup);\n return right ? binary(node.operator, left.value, right.value) : undefined;\n }\n case 'LogicalExpression': {\n const left = evaluate(node.left, lookup);\n if (!left) {\n return undefined;\n }\n let shortCircuits: boolean;\n if (node.operator === '&&') {\n shortCircuits = !left.value;\n } else if (node.operator === '||') {\n shortCircuits = !!left.value;\n } else {\n shortCircuits = left.value != null;\n }\n return shortCircuits ? left : evaluate(node.right, lookup);\n }\n case 'ConditionalExpression': {\n const test = evaluate(node.test, lookup);\n if (!test) {\n return undefined;\n }\n return evaluate(test.value ? node.consequent : node.alternate, lookup);\n }\n default:\n return undefined;\n }\n}\n\n/**\n * Whether `node` is known to be truthy or falsy.\n *\n * This is wider than `evaluate`. An object, array, function, class, or JSX\n * value has no constant value but is always truthy.\n */\nexport function truthiness(node: Node, lookup: ConstantLookup): boolean | undefined {\n switch (node.type) {\n case 'ObjectExpression':\n case 'ArrayExpression':\n case 'ArrowFunctionExpression':\n case 'FunctionExpression':\n case 'ClassExpression':\n case 'JSXElement':\n case 'JSXFragment':\n return true;\n case 'ParenthesizedExpression':\n return truthiness(node.expression, lookup);\n case 'UnaryExpression':\n if (node.operator === '!') {\n const value = truthiness(node.argument, lookup);\n return value === undefined ? undefined : !value;\n }\n break;\n case 'SequenceExpression': {\n // A sequence evaluates to its last expression. A fold that keeps an\n // effectful condition leaves one in test position.\n const last = node.expressions.at(-1);\n return last ? truthiness(last, lookup) : undefined;\n }\n default:\n break;\n }\n const value = evaluate(node, lookup);\n return value ? !!value.value : undefined;\n}\n\nfunction areSideEffectFree(nodes: readonly Node[]): boolean {\n for (const node of nodes) {\n if (!isSideEffectFree(node)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Whether skipping `node` entirely loses nothing observable.\n *\n * Every fold that reads a condition also discards it. `truthiness` answers\n * what a value is worth. This answers whether producing it can be skipped.\n * `[effect()]` is always truthy, yet evaluating it runs a call.\n */\nexport function isSideEffectFree(node: Node): boolean {\n switch (node.type) {\n // Creating a function does not run its body.\n case 'Literal':\n case 'Identifier':\n case 'ThisExpression':\n case 'ArrowFunctionExpression':\n case 'FunctionExpression':\n return true;\n case 'ParenthesizedExpression':\n return isSideEffectFree(node.expression);\n case 'TemplateLiteral':\n return areSideEffectFree(node.expressions);\n case 'UnaryExpression':\n // `delete` changes its target.\n return node.operator !== 'delete' && isSideEffectFree(node.argument);\n case 'BinaryExpression':\n // `in` and `instanceof` read the right operand's prototype chain, which a\n // proxy or `Symbol.hasInstance` can observe.\n return (\n node.operator !== 'in' &&\n node.operator !== 'instanceof' &&\n isSideEffectFree(node.left) &&\n isSideEffectFree(node.right)\n );\n case 'LogicalExpression':\n return isSideEffectFree(node.left) && isSideEffectFree(node.right);\n case 'SequenceExpression':\n return areSideEffectFree(node.expressions);\n case 'ConditionalExpression':\n return (\n isSideEffectFree(node.test) &&\n isSideEffectFree(node.consequent) &&\n isSideEffectFree(node.alternate)\n );\n case 'ArrayExpression':\n // A spread iterates its argument, which is observable.\n for (const element of node.elements) {\n if (element !== null && (element.type === 'SpreadElement' || !isSideEffectFree(element))) {\n return false;\n }\n }\n return true;\n case 'ObjectExpression':\n for (const property of node.properties) {\n // A spread reads the source's own properties, which a getter observes.\n if (\n property.type !== 'Property' ||\n (property.computed && !isSideEffectFree(property.key)) ||\n !isSideEffectFree(property.value)\n ) {\n return false;\n }\n }\n return true;\n default:\n // A class is never skippable. Evaluating one runs its heritage\n // expression, computed keys, static fields, and static blocks.\n return false;\n }\n}\n\n/**\n * The parts of `node` that must still run when its value is discarded.\n * A sequence is flattened, and every part that can be skipped is dropped.\n */\nexport function effectfulParts(node: Expression, parts: Expression[] = []): Expression[] {\n if (isSideEffectFree(node)) {\n return parts;\n }\n if (node.type === 'SequenceExpression') {\n for (const part of node.expressions) {\n effectfulParts(part, parts);\n }\n } else if (node.type === 'ParenthesizedExpression') {\n effectfulParts(node.expression, parts);\n } else {\n parts.push(node);\n }\n return parts;\n}\n\n/**\n * The element count of an array literal with no spread elements.\n */\nexport function arrayLiteralLength(node: Node): number | undefined {\n if (node.type === 'ParenthesizedExpression') {\n return arrayLiteralLength(node.expression);\n }\n if (node.type !== 'ArrayExpression') {\n return undefined;\n }\n for (const element of node.elements) {\n if (element?.type === 'SpreadElement') {\n return undefined;\n }\n }\n return node.elements.length;\n}\n\n/**\n * The source text of a constant, or `undefined` when it has no literal\n * spelling worth emitting. `undefined`, `NaN`, the infinities, and `-0`\n * need an expression or a global that a local binding could shadow.\n */\nexport function literalText(value: Primitive): string | undefined {\n switch (typeof value) {\n case 'string':\n return JSON.stringify(value);\n case 'boolean':\n return String(value);\n case 'number':\n if (!Number.isFinite(value) || Object.is(value, -0)) {\n return undefined;\n }\n // A negative number is a unary expression. The parentheses keep it one\n // operand wherever it lands, such as `a - (-1)` or `(-1).toFixed()`.\n return value < 0 ? `(${String(value)})` : String(value);\n case 'object':\n return 'null';\n default:\n return undefined;\n }\n}\n\n/**\n * Whether `node` is already the spelling `literalText` would produce.\n * Folding it again would change nothing.\n */\nexport function isLiteralForm(node: Node): boolean {\n switch (node.type) {\n case 'Literal':\n return true;\n case 'UnaryExpression':\n return (\n node.operator === '-' &&\n node.argument.type === 'Literal' &&\n typeof node.argument.value === 'number'\n );\n case 'ParenthesizedExpression':\n return isLiteralForm(node.expression);\n default:\n return false;\n }\n}\n","/**\n * Constants bindings resolve to, within a module and across its imports.\n *\n * A module only sees its own code, so the values its imports resolve to come\n * from `importedConstants`, which a caller fills with `constantExports` of\n * each imported module.\n */\nimport type { ImportDeclaration, MemberExpression, Node, Program } from 'oxc-parser';\nimport type { ResolvedOptions } from './context';\nimport { isConstantDeclaration } from './context';\nimport type { Binding, ScopeAnalysis } from './scope';\nimport { analyzeScopes } from './scope';\nimport type { Const, ConstantLookup, Primitive } from './value';\nimport { evaluate } from './value';\n\n/**\n * The constants each imported module exports, keyed by the import specifier\n * as the module writes it, then by export name.\n */\nexport type ImportedConstants = Readonly<Record<string, Readonly<Record<string, Primitive>>>>;\n\nexport type ResolvedImportedConstants = ReadonlyMap<string, ReadonlyMap<string, Const>>;\n\nexport function resolveImportedConstants(\n constants: ImportedConstants | undefined,\n): ResolvedImportedConstants {\n const result = new Map<string, Map<string, Const>>();\n for (const [source, exports] of Object.entries(constants ?? {})) {\n const entries = new Map<string, Const>();\n for (const [name, value] of Object.entries(exports)) {\n entries.set(name, { value });\n }\n result.set(source, entries);\n }\n return result;\n}\n\nfunction globalValue(name: string): Const | undefined {\n switch (name) {\n case 'undefined':\n return { value: undefined };\n case 'NaN':\n return { value: Number.NaN };\n case 'Infinity':\n return { value: Number.POSITIVE_INFINITY };\n default:\n return undefined;\n }\n}\n\n/**\n * Resolves identifier references to constants, caching each binding.\n */\nexport class ConstantTable {\n readonly lookup: ConstantLookup;\n\n private readonly constants = new Map<Binding, Const | null>();\n\n private readonly evaluating = new Set<Binding>();\n\n constructor(\n scopes: ScopeAnalysis,\n private readonly options: ResolvedOptions,\n ) {\n this.lookup = (reference) => {\n if (reference.type === 'MemberExpression') {\n return this.namespaceMember(scopes, reference) ?? this.globalMember(scopes, reference);\n }\n if (!scopes.references.has(reference) || reference.type !== 'Identifier') {\n return undefined;\n }\n const binding = scopes.references.get(reference);\n if (binding) {\n return this.getConstant(binding);\n }\n return this.globalConstant(reference.name) ?? globalValue(reference.name);\n };\n }\n\n private globalConstant(path: string): Const | undefined {\n const { globalConstants } = this.options;\n return globalConstants.has(path) ? { value: globalConstants.get(path) } : undefined;\n }\n\n /**\n * The value of a path like `import.meta.env.MODE` or `process.env.X` that\n * `globalConstants` holds. The path starts at `import.meta` or at a name\n * nothing declares, and goes through plain property reads.\n */\n private globalMember(scopes: ScopeAnalysis, node: MemberExpression): Const | undefined {\n if (this.options.globalConstants.size === 0) {\n return undefined;\n }\n const names: string[] = [];\n let current: Node = node;\n while (current.type === 'MemberExpression') {\n if (current.computed || current.optional || current.property.type !== 'Identifier') {\n return undefined;\n }\n names.unshift(current.property.name);\n current = current.object;\n }\n if (current.type === 'MetaProperty') {\n names.unshift(`${current.meta.name}.${current.property.name}`);\n } else if (\n current.type === 'Identifier' &&\n scopes.references.has(current) &&\n scopes.references.get(current) === undefined\n ) {\n names.unshift(current.name);\n } else {\n return undefined;\n }\n return this.globalConstant(names.join('.'));\n }\n\n /**\n * The value of `ns.NAME`, where `ns` is `import * as ns` from a module\n * whose constants are known.\n */\n private namespaceMember(scopes: ScopeAnalysis, node: MemberExpression): Const | undefined {\n const { object, property } = node;\n if (object.type !== 'Identifier' || node.optional) {\n return undefined;\n }\n const binding = scopes.references.get(object);\n if (binding?.kind !== 'import' || binding.imported !== '*' || binding.source === undefined) {\n return undefined;\n }\n let name: string | undefined;\n if (!node.computed && property.type === 'Identifier') {\n name = property.name;\n } else if (node.computed && property.type === 'Literal' && typeof property.value === 'string') {\n name = property.value;\n }\n return name === undefined\n ? undefined\n : this.options.importedConstants.get(binding.source)?.get(name);\n }\n\n /**\n * The value of a `const`, of a `let` nothing writes to, or of an import\n * whose module exports a known constant.\n *\n * A reference that runs before its declaration throws at runtime, and\n * folding turns it into the value. Minifiers make the same trade.\n */\n getConstant(binding: Binding): Const | undefined {\n const cached = this.constants.get(binding);\n if (cached !== undefined) {\n return cached ?? undefined;\n }\n let value: Const | undefined;\n const { declaration } = binding;\n if (binding.kind === 'import') {\n if (binding.source !== undefined && binding.imported !== undefined) {\n value = this.options.importedConstants.get(binding.source)?.get(binding.imported);\n }\n } else if (\n isConstantDeclaration(binding, this.options) &&\n declaration.type === 'VariableDeclarator' &&\n declaration.id === binding.identifier &&\n declaration.init &&\n !this.evaluating.has(binding)\n ) {\n this.evaluating.add(binding);\n value = evaluate(declaration.init, this.lookup);\n this.evaluating.delete(binding);\n }\n this.constants.set(binding, value ?? null);\n return value;\n }\n}\n\n/**\n * The modules `program` imports or re-exports bindings from. Their\n * constant exports are what `importedConstants` can hold.\n *\n * An import counts only when one of its bindings is read as a value. A\n * binding read only in types has no constant to fold, and TypeScript drops its\n * import, so the module it names may not even build for this target.\n */\nexport function namedImportSources(\n program: Program,\n scopes: ScopeAnalysis = analyzeScopes(program),\n): string[] {\n const sources = new Set<string>();\n for (const statement of program.body) {\n if (statement.type === 'ImportDeclaration') {\n if (statement.importKind !== 'type' && readsAsValue(statement.specifiers, scopes)) {\n sources.add(statement.source.value);\n }\n } else if (\n (statement.type === 'ExportNamedDeclaration' && statement.source) ||\n (statement.type === 'ExportAllDeclaration' && !statement.exported)\n ) {\n if (statement.exportKind !== 'type' && statement.source) {\n sources.add(statement.source.value);\n }\n }\n }\n return [...sources];\n}\n\n/**\n * The modules a module still imports once its types are stripped: the\n * sources of `namedImportSources`, and imports for side effects only, like\n * `import './setup'`.\n */\nexport function runtimeImportSources(\n program: Program,\n scopes: ScopeAnalysis = analyzeScopes(program),\n): string[] {\n const sources = new Set(namedImportSources(program, scopes));\n for (const statement of program.body) {\n if (\n statement.type === 'ImportDeclaration' &&\n statement.importKind !== 'type' &&\n statement.specifiers.length === 0\n ) {\n sources.add(statement.source.value);\n }\n }\n return [...sources];\n}\n\n/**\n * Whether the module reads one of these import bindings as a value. Scope\n * analysis skips type positions, so a binding used only in types has no\n * references.\n */\nfunction readsAsValue(specifiers: ImportDeclaration['specifiers'], scopes: ScopeAnalysis): boolean {\n for (const specifier of specifiers) {\n if (specifier.type === 'ImportSpecifier' && specifier.importKind === 'type') {\n continue;\n }\n if (scopes.root.bindings.get(specifier.local.name)?.references.length) {\n return true;\n }\n }\n return false;\n}\n\nfunction exportName(node: Node): string | undefined {\n if (node.type === 'Identifier') {\n return node.name;\n }\n if (node.type === 'Literal' && typeof node.value === 'string') {\n return node.value;\n }\n return undefined;\n}\n\n/**\n * The constants a module exports: `export const` bindings whose value folds,\n * and names exported from such a binding, or re-exported from a module in\n * `importedConstants`.\n *\n * A `let` counts when the module never writes to it, since nothing else can.\n */\nexport function constantExports(\n program: Program,\n options: ResolvedOptions,\n scopes: ScopeAnalysis = analyzeScopes(program),\n): Record<string, Primitive> {\n const table = new ConstantTable(scopes, options);\n const topLevel = scopes.root;\n const result: Record<string, Primitive> = {};\n const add = (name: string | undefined, value: Const | undefined): void => {\n if (name !== undefined && value) {\n result[name] = value.value;\n }\n };\n const starSources: string[] = [];\n for (const statement of program.body) {\n if (statement.type === 'ExportDefaultDeclaration') {\n const { declaration } = statement;\n if (declaration.type !== 'FunctionDeclaration' && declaration.type !== 'ClassDeclaration') {\n add('default', evaluate(declaration, table.lookup));\n }\n continue;\n }\n if (statement.type === 'ExportAllDeclaration') {\n if (!statement.exported && statement.exportKind !== 'type') {\n starSources.push(statement.source.value);\n }\n continue;\n }\n if (statement.type !== 'ExportNamedDeclaration' || statement.exportKind === 'type') {\n continue;\n }\n const { declaration } = statement;\n if (declaration?.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (declarator.id.type === 'Identifier') {\n const binding = topLevel.bindings.get(declarator.id.name);\n add(declarator.id.name, binding ? table.getConstant(binding) : undefined);\n }\n }\n continue;\n }\n for (const specifier of statement.specifiers) {\n if (specifier.exportKind === 'type') {\n continue;\n }\n const local = exportName(specifier.local);\n const exported = exportName(specifier.exported);\n if (local === undefined) {\n continue;\n }\n if (statement.source) {\n add(exported, options.importedConstants.get(statement.source.value)?.get(local));\n } else {\n const binding = topLevel.bindings.get(local);\n add(exported, binding ? table.getConstant(binding) : undefined);\n }\n }\n }\n // `export *` never re-exports `default`, and loses to a name the module\n // exports itself. A name two of them export is ambiguous, so neither counts.\n const explicit = new Set(Object.keys(result));\n const starred = new Map<string, Const | null>();\n for (const source of starSources) {\n for (const [name, value] of options.importedConstants.get(source) ?? []) {\n if (name !== 'default' && !explicit.has(name)) {\n starred.set(name, starred.has(name) ? null : value);\n }\n }\n }\n for (const [name, value] of starred) {\n add(name, value ?? undefined);\n }\n return result;\n}\n","/**\n * Helpers for replacing JSX children as text.\n *\n * Adjacent JSX text is one text node to the parser, and JSX trims a text\n * node as a whole: `a` and `b` on separate lines render as `ab` when an\n * element sits between them, but as `a b` once they are one text node. So\n * whenever a replacement would put two texts that were apart next to each\n * other, an empty `{}` keeps them apart.\n */\nimport type { JSXAttribute, JSXChild, JSXElement, JSXFragment, Node } from 'oxc-parser';\nimport type MagicString from 'magic-string';\n\n/**\n * What a JSX child turns into.\n */\nexport interface Piece {\n /** The child the piece replaces. */\n readonly node: JSXChild;\n /** The replacement text, or `undefined` to keep the child as written. */\n text: string | undefined;\n /** The JSX text the piece starts with, or `undefined` when it starts with a tag or a container. */\n startText: string | undefined;\n /** The JSX text the piece ends with. */\n endText: string | undefined;\n}\n\nexport function keptPiece(node: JSXChild): Piece {\n const text = node.type === 'JSXText' ? node.value : undefined;\n return { node, text: undefined, startText: text, endText: text };\n}\n\n/**\n * A piece that splices `children` in place of `node`.\n */\nexport function splicePiece(s: MagicString, node: JSXChild, children: readonly JSXChild[]): Piece {\n const first = children.at(0);\n const last = children.at(-1);\n if (!first || !last) {\n return replacedPiece(node, '');\n }\n return replacedPiece(node, s.slice(first.start, last.end));\n}\n\n/**\n * A piece that writes `text`, JSX children as source, in place of `node`.\n *\n * The texts it starts and ends with are read from `text` itself, not from\n * the children it came from. A fold inside them in the same round can have\n * turned a child that was an element into text, such as an inner `<Show>`.\n * JSX text holds no `<`, `>`, `{`, or `}`, so the first and last of those\n * mark where the text ends.\n */\nexport function replacedPiece(node: JSXChild, text: string): Piece {\n const start = text.search(/[<{]/);\n const end = Math.max(text.lastIndexOf('>'), text.lastIndexOf('}'));\n const startText = start === -1 ? text : text.slice(0, start);\n const endText = text.slice(end + 1);\n return {\n node,\n text,\n startText: startText === '' ? undefined : startText,\n endText: endText === '' ? undefined : endText,\n };\n}\n\n/** Whether JSX drops this text: whitespace that contains a line break. */\nfunction isDroppedText(text: string): boolean {\n return /^\\s*$/.test(text) && /[\\r\\n]/.test(text);\n}\n\n/**\n * Whether two texts render differently as one text node than apart.\n * Two texts that JSX drops, like line breaks and indentation, still drop together.\n */\nfunction mergeChangesText(before: string | undefined, after: string | undefined): boolean {\n return (\n before !== undefined && after !== undefined && !(isDroppedText(before) && isDroppedText(after))\n );\n}\n\n/**\n * Puts `{}` between two pieces that meet as text, on whichever side is replaced.\n */\nfunction separate(previous: Piece, next: Piece, emptiesBetween: readonly Piece[]): void {\n if (next.text !== undefined) {\n next.text = `{}${next.text}`;\n next.startText = undefined;\n return;\n }\n if (previous.text !== undefined) {\n previous.text = `${previous.text}{}`;\n previous.endText = undefined;\n return;\n }\n // Two kept texts only meet across a removed child.\n const empty = emptiesBetween.at(-1);\n if (empty) {\n empty.text = '{}';\n }\n}\n\n/**\n * Writes the replaced pieces of a child list, adding `{}` wherever two texts\n * would otherwise merge.\n */\nexport function writePieces(s: MagicString, pieces: readonly Piece[]): boolean {\n let changed = false;\n // The last piece that renders anything, and the empty pieces after it.\n let previous: Piece | undefined;\n let emptiesSincePrevious: Piece[] = [];\n for (const piece of pieces) {\n if (piece.text === '') {\n emptiesSincePrevious.push(piece);\n continue;\n }\n if (previous && mergeChangesText(previous.endText, piece.startText)) {\n separate(previous, piece, emptiesSincePrevious);\n }\n previous = piece;\n emptiesSincePrevious = [];\n }\n for (const piece of pieces) {\n if (piece.text === undefined) {\n continue;\n }\n changed = true;\n if (piece.text === '') {\n s.remove(piece.node.start, piece.node.end);\n } else {\n s.overwrite(piece.node.start, piece.node.end, piece.text);\n }\n }\n return changed;\n}\n\nexport function findAttribute(element: JSXElement, name: string): JSXAttribute | undefined {\n for (const attribute of element.openingElement.attributes) {\n if (\n attribute.type === 'JSXAttribute' &&\n attribute.name.type === 'JSXIdentifier' &&\n attribute.name.name === name\n ) {\n return attribute;\n }\n }\n return undefined;\n}\n\nexport function hasSpreadAttribute(element: JSXElement): boolean {\n for (const attribute of element.openingElement.attributes) {\n if (attribute.type === 'JSXSpreadAttribute') {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Whether any child is a function, which the runtime may call with the\n * narrowed value. Folding one away would drop that call.\n */\nexport function hasCallbackChild(children: readonly JSXChild[]): boolean {\n for (const child of children) {\n if (child.type !== 'JSXExpressionContainer') {\n continue;\n }\n let expression: Node = child.expression;\n while (expression.type === 'ParenthesizedExpression') {\n expression = expression.expression;\n }\n if (expression.type === 'ArrowFunctionExpression' || expression.type === 'FunctionExpression') {\n return true;\n }\n }\n return false;\n}\n\n/**\n * The text between an element's tags, or an empty string for a self-closing element.\n */\nexport function innerText(s: MagicString, node: JSXElement | JSXFragment): string {\n if (node.type === 'JSXFragment') {\n return s.slice(node.openingFragment.end, node.closingFragment.start);\n }\n if (!node.closingElement) {\n return '';\n }\n return s.slice(node.openingElement.end, node.closingElement.start);\n}\n","/**\n * Estimates how many bytes code takes once Solid's JSX transform has\n * lowered it and a minifier has compacted it.\n *\n * The inline pass compares the call sites of a component with the copies\n * that would replace them. A copy merges its elements into the template\n * around it and drops the component call, but repeats the component's own\n * code at every call. The estimate only has to rank the two, so it counts\n * what lowering adds to the JSX as written:\n *\n * - each template: its declaration and the clone that renders it;\n * - each dynamic attribute, child, spread, or event handler of an element:\n * the effect or `insert` that sets it, and the walk to its element;\n * - each component element: the `createComponent` call, and a getter for\n * each prop that is not a literal.\n *\n * Other code counts as its text without the whitespace a minifier removes.\n */\nimport type {\n Expression,\n JSXAttribute,\n JSXAttributeItem,\n JSXChild,\n JSXElement,\n JSXElementName,\n JSXEmptyExpression,\n JSXFragment,\n Node,\n} from 'oxc-parser';\nimport { forEachChild, isInsignificant, isIntrinsicTag, unwrap } from './ast';\n\n/** A template's declaration, and the function that clones and returns it. */\nconst TEMPLATE = 40;\n/** A walk to an element, like `e.firstChild.nextSibling`. */\nconst WALK = 12;\n/** An `insert()` of a dynamic child. */\nconst INSERT = 12;\n/** A render effect that sets an attribute, like `createRenderEffect(() => setAttribute(...))`. */\nconst EFFECT = 24;\n/** An event handler assignment, like `e.$$click = ...`. */\nconst HANDLER = 10;\n/** A `spread()` of props onto an element. */\nconst SPREAD = 16;\n/** A `createComponent(Name, {})` call. */\nconst COMPONENT = 8;\n/** A getter, `get name() { return ... }`. */\nconst GETTER = 16;\n/** A `mergeProps()` around the props of a component with a spread. */\nconst MERGE = 6;\n\n/**\n * The length of `text` once a minifier removes the whitespace it does not need.\n */\nexport function compactLength(text: string): number {\n return text.replaceAll(/\\s*([{}()[\\];,:=<>+\\-*/?&|!.])\\s*/g, '$1').replaceAll(/\\s+/g, ' ').length;\n}\n\nfunction nameLength(name: JSXElementName): number {\n switch (name.type) {\n case 'JSXIdentifier':\n return name.name.length;\n case 'JSXNamespacedName':\n return name.namespace.name.length + name.name.name.length + 1;\n case 'JSXMemberExpression':\n return nameLength(name.object) + name.property.name.length + 1;\n default:\n return 4;\n }\n}\n\n/** Whether an expression lowers to text in the template, like a literal. */\nfunction isStaticText(node: Expression | JSXEmptyExpression): boolean {\n if (node.type === 'JSXEmptyExpression') {\n return false;\n }\n const inner = unwrap(node);\n if (inner.type === 'Literal') {\n return typeof inner.value === 'string' || typeof inner.value === 'number';\n }\n if (inner.type === 'TemplateLiteral') {\n return inner.expressions.length === 0;\n }\n return (\n inner.type === 'UnaryExpression' &&\n inner.operator === '-' &&\n inner.argument.type === 'Literal' &&\n typeof inner.argument.value === 'number'\n );\n}\n\nfunction isIntrinsic(element: JSXElement): boolean {\n const { name } = element.openingElement;\n return name.type === 'JSXIdentifier' && isIntrinsicTag(name.name);\n}\n\nfunction attributeName(attribute: JSXAttribute): string {\n const { name } = attribute;\n return name.type === 'JSXIdentifier' ? name.name : `${name.namespace.name}:${name.name.name}`;\n}\n\n/**\n * Estimates lowered sizes in one piece of code.\n */\nexport class SizeEstimator {\n constructor(private readonly code: string) {}\n\n private text(node: Node): number {\n return compactLength(this.code.slice(node.start, node.end));\n }\n\n /**\n * The size of any node: JSX as lowered, other code as its compact text\n * with the JSX in it as lowered.\n */\n node(node: Node): number {\n if (node.type === 'JSXElement' || node.type === 'JSXFragment') {\n return this.jsx(node, false);\n }\n let size = this.text(node);\n const visit = (child: Node): void => {\n if (child.type === 'JSXElement' || child.type === 'JSXFragment') {\n size += this.jsx(child, false) - this.text(child);\n return;\n }\n forEachChild(child, visit);\n };\n forEachChild(node, visit);\n return size;\n }\n\n /**\n * The size of a JSX element or fragment. `inTemplate` is whether it sits\n * directly in an element, whose template it joins.\n */\n jsx(node: JSXElement | JSXFragment, inTemplate: boolean): number {\n if (node.type === 'JSXFragment') {\n return this.children(node.children) + 2;\n }\n if (!isIntrinsic(node)) {\n return (inTemplate ? INSERT + WALK : 0) + this.component(node);\n }\n const tag = nameLength(node.openingElement.name);\n let size = (inTemplate ? 0 : TEMPLATE) + tag * 2 + 5;\n let dynamic = false;\n for (const attribute of node.openingElement.attributes) {\n const cost = this.elementAttribute(attribute);\n size += cost.size;\n dynamic ||= cost.dynamic;\n }\n for (const child of node.children) {\n if (isInsignificant(child)) {\n continue;\n }\n if (child.type === 'JSXText') {\n size += compactLength(child.value);\n } else if (child.type === 'JSXExpressionContainer' && isStaticText(child.expression)) {\n // A literal child is written into the template as text.\n size += this.text(child.expression);\n } else if (child.type === 'JSXElement') {\n size += this.jsx(child, true);\n } else {\n size += INSERT + this.child(child);\n dynamic = true;\n }\n }\n return size + (dynamic ? WALK : 0);\n }\n\n private elementAttribute(attribute: JSXAttributeItem): { size: number; dynamic: boolean } {\n if (attribute.type === 'JSXSpreadAttribute') {\n return { size: SPREAD + this.node(attribute.argument), dynamic: true };\n }\n const name = attributeName(attribute);\n const { value } = attribute;\n if (!value || value.type === 'Literal') {\n return { size: name.length + (value ? this.text(value) : 0) + 1, dynamic: false };\n }\n if (value.type !== 'JSXExpressionContainer') {\n return { size: name.length + 1 + this.jsx(value, false), dynamic: true };\n }\n const { expression } = value;\n if (expression.type === 'JSXEmptyExpression') {\n return { size: 0, dynamic: false };\n }\n const inner = unwrap(expression);\n // A literal in braces lowers like a quoted value.\n if (\n inner.type === 'Literal' ||\n (inner.type === 'TemplateLiteral' && inner.expressions.length === 0)\n ) {\n return { size: name.length + this.text(inner) + 1, dynamic: false };\n }\n const extra = /^on[A-Z:]/.test(name) || name === 'ref' ? HANDLER : EFFECT;\n return { size: extra + name.length + this.node(inner), dynamic: true };\n }\n\n private child(child: JSXChild): number {\n if (child.type === 'JSXExpressionContainer') {\n return child.expression.type === 'JSXEmptyExpression' ? 0 : this.node(child.expression);\n }\n if (child.type === 'JSXSpreadChild') {\n return this.node(child.expression);\n }\n if (child.type === 'JSXText') {\n return compactLength(child.value) + 2;\n }\n return this.jsx(child, false);\n }\n\n /**\n * Children outside a template, which lower to an array of values.\n */\n private children(children: readonly JSXChild[]): number {\n let size = 0;\n for (const child of children) {\n if (!isInsignificant(child)) {\n size += this.child(child) + 1;\n }\n }\n return size;\n }\n\n private component(element: JSXElement): number {\n let size = COMPONENT + nameLength(element.openingElement.name);\n let spread = false;\n for (const attribute of element.openingElement.attributes) {\n if (attribute.type === 'JSXSpreadAttribute') {\n spread = true;\n size += this.node(attribute.argument) + 1;\n continue;\n }\n const name = attributeName(attribute);\n const { value } = attribute;\n if (!value || value.type === 'Literal') {\n size += name.length + 1 + (value ? this.text(value) : 4);\n } else if (value.type === 'JSXExpressionContainer') {\n const { expression } = value;\n if (expression.type !== 'JSXEmptyExpression') {\n const inner = unwrap(expression);\n const literal =\n inner.type === 'Literal' ||\n inner.type === 'Identifier' ||\n inner.type === 'ArrowFunctionExpression' ||\n inner.type === 'FunctionExpression';\n size += name.length + 1 + (literal ? 0 : GETTER) + this.node(inner);\n }\n } else {\n size += name.length + GETTER + this.jsx(value, false);\n }\n }\n const significant: JSXChild[] = [];\n for (const child of element.children) {\n if (!isInsignificant(child)) {\n significant.push(child);\n }\n }\n if (significant.length > 0) {\n size += GETTER + 'children'.length + this.children(significant);\n }\n return size + (spread ? MERGE : 0);\n }\n\n /**\n * The size of what a component returns. JSX lowers as JSX, and anything\n * else is inserted when it sits in an element.\n */\n root(node: Expression, inTemplate: boolean): number {\n const inner = unwrap(node);\n if (inner.type === 'JSXElement' || inner.type === 'JSXFragment') {\n return this.jsx(inner, inTemplate);\n }\n return (inTemplate ? INSERT + WALK : 0) + this.node(inner);\n }\n}\n","/**\n * The fold pass: constant folding, dead-code elimination, and static\n * resolution of Solid's control-flow components.\n *\n * It runs on JSX before it is lowered, so whatever it resolves never reaches\n * the JSX transform. A `<Show>` whose condition is a constant becomes its\n * branch, and the branch joins the surrounding template instead of paying for\n * a component call, a memo, and an insert.\n *\n * This is a port of the `optimize` option of `@solidjs/compiler`\n * (https://github.com/solidjs/solid/pull/3231).\n *\n * # What folds\n *\n * - Constant expressions: literals, template literals, and the unary, binary,\n * logical, and conditional operators over them.\n * - `const` bindings, and `let` bindings nothing writes to, at any scope.\n * - Statements a constant condition makes unreachable: `if`/`else` branches,\n * `while (false)` loops, and anything after a `return`, `throw`, `break`,\n * or `continue`.\n * - A call of an arrow function whose body is JSX, with constant arguments,\n * as an element's child. The call becomes the JSX with the arguments in\n * place of the parameters, so it joins the template around it.\n * - `<For>` over a constant list, which becomes one copy of its row per\n * item when the copies are no larger than the loop.\n * - `<Show when>`, `<For each>`, `<Repeat count>`, `<Switch>`/`<Match when>`,\n * and `<Dynamic component>` with a static intrinsic tag name or a\n * component declared at the top level that nothing reassigns.\n *\n * # What does not fold\n *\n * `<Portal>`, `<Loading>`, `<Errored>`, and `<Reveal>` exist for a runtime\n * condition no static analysis can decide. A control-flow component with a\n * spread attribute is left alone, since the spread can supply or override the\n * prop the fold reads. Function children also stop a fold, since the runtime\n * decides from their arity whether to call them.\n */\nimport type {\n CallExpression,\n ConditionalExpression,\n Directive,\n Expression,\n IdentifierReference,\n IfStatement,\n JSXChild,\n JSXElement,\n JSXEmptyExpression,\n JSXFragment,\n LogicalExpression,\n Node,\n Statement,\n WhileStatement,\n} from 'oxc-parser';\nimport MagicString from 'magic-string';\nimport type { Parents } from './ast';\nimport {\n forEachChild,\n isInsignificant,\n isIntrinsicTag,\n isJSXChild,\n isPrimary,\n needsParensAt,\n parse,\n startsLikeStatement,\n unwrap,\n} from './ast';\nimport type { PassContext } from './context';\nimport { ConstantTable } from './constants';\nimport { getText, isConstantDeclaration, solidExport } from './context';\nimport type { Piece } from './jsx';\nimport {\n findAttribute,\n hasCallbackChild,\n hasSpreadAttribute,\n innerText,\n keptPiece,\n replacedPiece,\n splicePiece,\n writePieces,\n} from './jsx';\nimport type { Binding } from './scope';\nimport { lookup, scopeAt } from './scope';\nimport { SizeEstimator, compactLength } from './size';\nimport type { Const, ConstantLookup } from './value';\nimport {\n arrayLiteralLength,\n effectfulParts,\n evaluate,\n isLiteralForm,\n isSideEffectFree,\n literalText,\n truthiness,\n} from './value';\n\n/**\n * The control-flow components this pass resolves.\n * `Match` is absent: it only has meaning inside a `<Switch>`, which folds it.\n */\nconst FOLDABLE_FLOW = new Set(['Show', 'For', 'Repeat', 'Switch', 'Dynamic']);\n\n/**\n * What a resolved control-flow element renders in its place.\n */\ntype Fold =\n /** JSX children, spliced in. */\n | { readonly kind: 'children'; readonly children: readonly JSXChild[] }\n /** An element or fragment, as source text. */\n | { readonly kind: 'jsx'; readonly text: string }\n /** An expression, such as a `fallback` prop's value. */\n | {\n readonly kind: 'expression';\n readonly text: string;\n readonly primary: boolean;\n }\n | { readonly kind: 'empty' };\n\nconst EMPTY: Fold = { kind: 'empty' };\n\n/** Solid's calls that only create a value, so the bundler can drop an unused one. */\nconst PURE_CALLS = new Set(['lazy', 'createContext']);\n\n/**\n * Solid's calls that only create a value when their first argument is not a\n * function. Given a function, they create a computation, which runs it.\n */\nconst PURE_VALUE_CALLS = new Set(['createSignal', 'createStore']);\n\n/** Expression types that are never a function. */\nconst NOT_FUNCTION = new Set(['Literal', 'TemplateLiteral', 'ObjectExpression', 'ArrayExpression']);\n\n/**\n * The globals worth folding. They only apply to a reference that binds to\n * nothing, which is when the global is what runs.\n */\n/**\n * Whether `node` is written to: assigned, updated, deleted, or destructured into.\n */\nfunction isWriteTarget(node: Node, parents: Parents): boolean {\n let current = node;\n let parent = parents.get(current);\n // A destructuring pattern writes to every target inside it.\n while (\n parent &&\n (parent.type === 'ArrayPattern' ||\n parent.type === 'ObjectPattern' ||\n parent.type === 'RestElement' ||\n parent.type === 'AssignmentPattern' ||\n (parent.type === 'Property' && parents.get(parent)?.type === 'ObjectPattern'))\n ) {\n if (parent.type === 'AssignmentPattern' && parent.left !== current) {\n return false;\n }\n current = parent;\n parent = parents.get(current);\n }\n if (!parent) {\n return false;\n }\n switch (parent.type) {\n case 'AssignmentExpression':\n return parent.left === current;\n case 'UpdateExpression':\n return true;\n case 'UnaryExpression':\n return parent.operator === 'delete';\n case 'ForInStatement':\n case 'ForOfStatement':\n return parent.left === current;\n default:\n return current !== node;\n }\n}\n\nfunction isTerminator(statement: Node): boolean {\n return (\n statement.type === 'ReturnStatement' ||\n statement.type === 'ThrowStatement' ||\n statement.type === 'BreakStatement' ||\n statement.type === 'ContinueStatement'\n );\n}\n\n/**\n * Whether removing `statement` would remove a `var` or function declaration\n * that is hoisted out of it. Nested functions are their own scope.\n */\nfunction containsHoistedDeclaration(statement: Node): boolean {\n let found = false;\n const visit = (node: Node): void => {\n if (found) {\n return;\n }\n if (node.type === 'VariableDeclaration' && node.kind === 'var') {\n found = true;\n return;\n }\n if (node.type === 'FunctionDeclaration') {\n found = true;\n return;\n }\n if (\n node.type === 'FunctionExpression' ||\n node.type === 'ArrowFunctionExpression' ||\n node.type === 'ClassDeclaration' ||\n node.type === 'ClassExpression'\n ) {\n return;\n }\n forEachChild(node, visit);\n };\n visit(statement);\n return found;\n}\n\n/** The source text of each node. */\nfunction getTexts(context: PassContext, nodes: readonly Node[]): string[] {\n const texts: string[] = [];\n for (const node of nodes) {\n texts.push(getText(context, node));\n }\n return texts;\n}\n\n/** The children that are not whitespace-only text or an empty expression. */\nfunction getSignificant(children: readonly JSXChild[]): JSXChild[] {\n const significant: JSXChild[] = [];\n for (const child of children) {\n if (!isInsignificant(child)) {\n significant.push(child);\n }\n }\n return significant;\n}\n\n/** Whether the element has a `keyed` attribute that is not `{false}`. */\nfunction hasEnabledKeyed(element: JSXElement): boolean {\n for (const attribute of element.openingElement.attributes) {\n if (\n attribute.type === 'JSXAttribute' &&\n attribute.name.type === 'JSXIdentifier' &&\n attribute.name.name === 'keyed' &&\n !(\n attribute.value?.type === 'JSXExpressionContainer' &&\n attribute.value.expression.type === 'Literal' &&\n attribute.value.expression.value === false\n )\n ) {\n return true;\n }\n }\n return false;\n}\n\n/** The summed size estimate of the children of a fragment spliced into a template. */\nfunction estimateChildren(estimator: SizeEstimator, children: readonly JSXChild[]): number {\n let size = 0;\n for (const child of children) {\n size += child.type === 'JSXElement' ? estimator.jsx(child, true) : estimator.node(child);\n }\n return size;\n}\n\n/**\n * Whether a statement starting with `text` could join the statement before\n * it when that one has no semicolon.\n */\nfunction continuesPreviousStatement(text: string): boolean {\n return /^[([`+\\-/]/.test(text);\n}\n\n/** The name a property key or a computed member's string literal gives. */\nfunction keyName(node: Node): string | undefined {\n if (node.type === 'Identifier') {\n return node.name;\n }\n return node.type === 'Literal' && typeof node.value === 'string' ? node.value : undefined;\n}\n\n/** Whether a call has no first argument, or one that is never a function. */\nfunction isValueArgument(call: CallExpression): boolean {\n if (call.arguments.length === 0) {\n return true;\n }\n const first = call.arguments[0];\n return first.type !== 'SpreadElement' && NOT_FUNCTION.has(unwrap(first).type);\n}\n\ntype ConstantItem =\n | { readonly kind: 'primitive'; readonly text: string }\n | { readonly kind: 'object'; readonly keys: ReadonlyMap<string, string> };\n\n/**\n * The text of an expression that always gives the same primitive: a literal\n * other than a regular expression, a template literal without expressions,\n * or a negated number.\n */\nfunction primitiveText(context: PassContext, node: Expression): string | undefined {\n let expression: Expression = node;\n while (expression.type === 'ParenthesizedExpression') {\n expression = expression.expression;\n }\n switch (expression.type) {\n case 'Literal':\n return 'regex' in expression ? undefined : getText(context, expression);\n case 'TemplateLiteral':\n return expression.expressions.length === 0 ? getText(context, expression) : undefined;\n case 'UnaryExpression':\n return expression.operator === '-' &&\n expression.argument.type === 'Literal' &&\n typeof expression.argument.value === 'number'\n ? getText(context, expression)\n : undefined;\n default:\n return undefined;\n }\n}\n\n/** Whether a child of `parent` is inserted into its template, not passed as a prop. */\nfunction joinsTemplate(parent: JSXElement | JSXFragment): boolean {\n if (parent.type === 'JSXFragment') {\n return true;\n }\n const { name } = parent.openingElement;\n return name.type === 'JSXIdentifier' && isIntrinsicTag(name.name);\n}\n\n/**\n * Whether JSX holds a `ref` or a spread, which run while the JSX is made.\n */\nfunction hasRefOrSpread(root: Node): boolean {\n let found = false;\n const visit = (node: Node): void => {\n if (found) {\n return;\n }\n if (\n node.type === 'JSXSpreadAttribute' ||\n node.type === 'JSXSpreadChild' ||\n (node.type === 'JSXAttribute' &&\n node.name.type === 'JSXIdentifier' &&\n node.name.name === 'ref')\n ) {\n found = true;\n return;\n }\n forEachChild(node, visit);\n };\n visit(root);\n return found;\n}\n\nclass Folder {\n changed = false;\n\n private readonly lookup: ConstantLookup;\n\n constructor(private readonly context: PassContext) {\n this.lookup = new ConstantTable(context.scopes, context.options).lookup;\n }\n\n // ---------------------------------------------------------------------------\n // Traversal\n // ---------------------------------------------------------------------------\n\n walk(node: Node): void {\n forEachChild(node, (child) => {\n this.walk(child);\n });\n this.exit(node);\n }\n\n private exit(node: Node): void {\n switch (node.type) {\n case 'Program':\n case 'BlockStatement':\n case 'StaticBlock':\n this.eliminateDeadStatements(node.body);\n break;\n case 'SwitchCase':\n this.eliminateDeadStatements(node.consequent);\n break;\n case 'JSXElement':\n this.foldChildren(node);\n if (!this.isJSXChildOrAttribute(node)) {\n this.foldFlowExpression(node);\n }\n break;\n case 'JSXFragment':\n this.foldChildren(node);\n break;\n case 'LogicalExpression':\n this.foldLogical(node);\n break;\n case 'ConditionalExpression':\n this.foldConditional(node);\n break;\n case 'Identifier':\n if (this.context.scopes.references.has(node)) {\n this.foldConstant(node);\n }\n break;\n case 'TemplateLiteral':\n // A tagged template passes its strings to the tag, so they are not constants.\n if (this.context.parents.get(node)?.type !== 'TaggedTemplateExpression') {\n this.foldConstant(node);\n }\n break;\n case 'UnaryExpression':\n case 'BinaryExpression':\n case 'ParenthesizedExpression':\n this.foldConstant(node);\n break;\n case 'MemberExpression':\n // Only a read folds. Writing to a namespace member throws, so it stays.\n if (!isWriteTarget(node, this.context.parents)) {\n this.foldConstant(node);\n }\n break;\n case 'CallExpression':\n this.annotatePure(node);\n this.foldUntrack(node);\n break;\n default:\n break;\n }\n }\n\n private isJSXChildOrAttribute(node: Node): boolean {\n return (\n isJSXChild(node, this.context.parents) ||\n this.context.parents.get(node)?.type === 'JSXAttribute'\n );\n }\n\n private replace(node: Node, text: string): void {\n if (getText(this.context, node) === text) {\n return;\n }\n this.context.s.overwrite(node.start, node.end, text);\n this.changed = true;\n }\n\n // ---------------------------------------------------------------------------\n // Expressions\n // ---------------------------------------------------------------------------\n\n /**\n * Marks a call to Solid's `lazy` or `createContext` as pure. `lazy` only\n * creates the component, and loads nothing until it renders. A folded\n * branch can leave it unused, and the annotation lets the bundler drop it\n * along with its dynamic import. `createContext` only creates the context,\n * which inlining can leave unused.\n *\n * `createSignal` and `createStore` with a first argument that is not a\n * function only create a node. It takes no owner and no hydration id, so\n * dropping an unused one changes nothing else.\n */\n private annotatePure(call: CallExpression): void {\n if (call.callee.type !== 'Identifier') {\n return;\n }\n const binding = this.context.scopes.references.get(call.callee);\n const identity = binding ? solidExport(binding, this.context.options) : undefined;\n if (identity === undefined) {\n return;\n }\n if (!PURE_CALLS.has(identity) && !(PURE_VALUE_CALLS.has(identity) && isValueArgument(call))) {\n return;\n }\n const before = this.context.code.slice(0, call.start).trimEnd();\n if (/(#|@)__PURE__\\s*\\*\\/$/.test(before)) {\n return;\n }\n this.context.s.prependLeft(call.start, '/* @__PURE__ */ ');\n this.changed = true;\n }\n\n /**\n * `untrack(() => value)` is the value, when the value is a constant.\n * Nothing is read, so there is nothing to untrack. A component inlined\n * with a literal prop leaves this, like Kobalte's `untrack(() => props.as)`.\n */\n private foldUntrack(call: CallExpression): void {\n if (call.callee.type !== 'Identifier' || call.arguments.length !== 1) {\n return;\n }\n const binding = this.context.scopes.references.get(call.callee);\n const identity = binding ? solidExport(binding, this.context.options) : undefined;\n const callback = call.arguments.at(0);\n if (\n identity !== 'untrack' ||\n callback?.type !== 'ArrowFunctionExpression' ||\n callback.async ||\n callback.params.length > 0 ||\n !callback.expression ||\n callback.body.type === 'BlockStatement'\n ) {\n return;\n }\n const value = evaluate(callback.body, this.lookup);\n if (value) {\n this.foldConstant(call, value);\n }\n }\n\n private foldConstant(node: Node, known?: Const): void {\n if (isLiteralForm(node)) {\n return;\n }\n const value = known ?? evaluate(node, this.lookup);\n if (!value) {\n return;\n }\n let text = literalText(value.value);\n if (text === undefined) {\n return;\n }\n const parent = this.context.parents.get(node);\n if (node.type === 'Identifier') {\n // `export { A }` names the binding, not its value.\n if (parent?.type === 'ExportSpecifier') {\n return;\n }\n // `{ enabled }` cannot stay shorthand once its value is a literal.\n if (parent?.type === 'Property' && parent.shorthand) {\n this.replace(node, `${node.name}: ${text}`);\n return;\n }\n }\n if (\n parent?.type === 'MemberExpression' &&\n parent.object === node &&\n typeof value.value === 'number' &&\n !text.startsWith('(')\n ) {\n // `1.toFixed()` does not parse.\n text = `(${text})`;\n }\n if (parent?.type === 'ExpressionStatement' && typeof value.value === 'string') {\n // A string at the start of a statement can turn into a directive.\n text = `(${text})`;\n }\n this.replace(node, text);\n }\n\n /**\n * Keeps `value`, evaluating `discarded` first when it has side effects.\n * `(discarded, value)` runs it in the same order and yields the same result.\n */\n private keepAfter(target: Node, discarded: Expression | undefined, value: Expression): string {\n const parts = discarded ? effectfulParts(discarded) : [];\n if (parts.length === 0) {\n const text = getText(this.context, value);\n return needsParensAt(target, value, this.context.parents) ? `(${text})` : text;\n }\n const texts = getTexts(this.context, parts);\n texts.push(getText(this.context, value));\n return `(${texts.join(', ')})`;\n }\n\n private foldLogical(node: LogicalExpression): void {\n const left = truthiness(node.left, this.lookup);\n if (left === undefined) {\n return;\n }\n let takesLeft: boolean;\n if (node.operator === '&&') {\n takesLeft = !left;\n } else if (node.operator === '||') {\n takesLeft = left;\n } else {\n // `??` depends on nullishness, not truthiness, so it only folds against a constant.\n const value = evaluate(node.left, this.lookup);\n if (!value) {\n return;\n }\n takesLeft = value.value != null;\n }\n // The side a short-circuit never reaches never runs, so dropping it is free.\n // The side that does run has to be skippable before the other replaces it.\n if (takesLeft) {\n this.replace(node, this.keepAfter(node, undefined, node.left));\n } else {\n const discarded = this.isSkippable(node.left) ? undefined : node.left;\n this.replace(node, this.keepAfter(node, discarded, node.right));\n }\n }\n\n /**\n * Whether dropping `node` changes nothing. An expression that evaluates to\n * a constant only reads bindings and runs operators on primitives.\n */\n private isSkippable(node: Expression): boolean {\n return isSideEffectFree(node) || evaluate(node, this.lookup) !== undefined;\n }\n\n private foldConditional(node: ConditionalExpression): void {\n const test = truthiness(node.test, this.lookup);\n if (test === undefined) {\n return;\n }\n const discarded = this.isSkippable(node.test) ? undefined : node.test;\n this.replace(node, this.keepAfter(node, discarded, test ? node.consequent : node.alternate));\n }\n\n // ---------------------------------------------------------------------------\n // Control-flow components\n // ---------------------------------------------------------------------------\n\n /**\n * The Solid built-in a tag refers to.\n *\n * Being in `builtIns` only makes a name a candidate. The tag has to resolve\n * to Solid's own component: a tag that binds to nothing is the built-in the\n * JSX transform imports, and an import from a Solid module is decided by\n * the name the module exports, so `<Cond>` from `import { Show as Cond }` is\n * `Show`. A local `Show` or one from another module is a different component.\n */\n private builtInTag(element: JSXElement): string | undefined {\n const { name } = element.openingElement;\n if (name.type !== 'JSXIdentifier') {\n return undefined;\n }\n const { references } = this.context.scopes;\n if (!references.has(name)) {\n return undefined;\n }\n const binding = references.get(name);\n const identity = binding ? solidExport(binding, this.context.options) : name.name;\n if (identity === undefined || !this.context.options.builtIns.has(identity)) {\n return undefined;\n }\n return identity;\n }\n\n /**\n * The name of the component an identifier refers to, when it is a\n * capitalized top-level binding nothing reassigns, holding a function or a\n * `lazy` component. A JSX tag with that name calls the same component. An\n * import could hold anything, such as a tag name string, so it is left out.\n */\n private componentName(identifier: IdentifierReference): string | undefined {\n const binding = this.context.scopes.references.get(identifier);\n if (\n !binding ||\n binding.mutated ||\n binding.scope.parent !== undefined ||\n !/^[A-Z]/.test(binding.name)\n ) {\n return undefined;\n }\n const { declaration } = binding;\n if (declaration.type === 'FunctionDeclaration') {\n return declaration.async || declaration.generator ? undefined : binding.name;\n }\n if (\n declaration.type !== 'VariableDeclarator' ||\n declaration.id !== binding.identifier ||\n !declaration.init ||\n !isConstantDeclaration(binding, this.context.options)\n ) {\n return undefined;\n }\n let init: Expression = declaration.init;\n while (init.type === 'ParenthesizedExpression') {\n init = init.expression;\n }\n if (init.type === 'ArrowFunctionExpression' || init.type === 'FunctionExpression') {\n return init.async || init.generator ? undefined : binding.name;\n }\n if (init.type === 'CallExpression' && init.callee.type === 'Identifier') {\n const callee = this.context.scopes.references.get(init.callee);\n return callee && solidExport(callee, this.context.options) === 'lazy'\n ? binding.name\n : undefined;\n }\n return undefined;\n }\n\n private flowTag(element: JSXElement): string | undefined {\n const tag = this.builtInTag(element);\n return tag !== undefined && FOLDABLE_FLOW.has(tag) ? tag : undefined;\n }\n\n private foldFlow(element: JSXElement): Fold | undefined {\n const tag = this.flowTag(element);\n if (tag === undefined || hasSpreadAttribute(element)) {\n return undefined;\n }\n switch (tag) {\n case 'Show':\n return this.foldShow(element);\n case 'For':\n return this.foldFor(element);\n case 'Repeat':\n return this.foldRepeat(element);\n case 'Switch':\n return this.foldSwitch(element);\n case 'Dynamic':\n return this.foldDynamic(element);\n default:\n return undefined;\n }\n }\n\n /**\n * Whether a prop is statically truthy or falsy. A bare attribute is `true`.\n * The prop is discarded by the fold, so it also has to be skippable.\n */\n private attributeTruthiness(element: JSXElement, name: string): boolean | undefined {\n const attribute = findAttribute(element, name);\n if (!attribute) {\n return undefined;\n }\n const { value } = attribute;\n if (value === null) {\n return true;\n }\n switch (value.type) {\n case 'Literal':\n return value.value !== '';\n case 'JSXElement':\n case 'JSXFragment':\n return true;\n default:\n if (value.expression.type === 'JSXEmptyExpression' || !isSideEffectFree(value.expression)) {\n return undefined;\n }\n return truthiness(value.expression, this.lookup);\n }\n }\n\n /**\n * What the element renders when its condition fails: its `fallback` prop, or nothing.\n */\n private fallback(element: JSXElement): Fold | undefined {\n const attribute = findAttribute(element, 'fallback');\n if (!attribute?.value) {\n // A bare `fallback` is `fallback={true}`, which renders nothing.\n return EMPTY;\n }\n const { value } = attribute;\n switch (value.type) {\n case 'Literal':\n // An attribute string can hold HTML entities, which are not decoded here.\n if (value.value.includes('&')) {\n return undefined;\n }\n return {\n kind: 'expression',\n text: JSON.stringify(value.value),\n primary: true,\n };\n case 'JSXElement':\n case 'JSXFragment':\n return this.foldedJSX(value);\n default:\n if (value.expression.type === 'JSXEmptyExpression') {\n return EMPTY;\n }\n // JSX in a container splices like JSX, so it can join the surrounding template.\n if (value.expression.type === 'JSXElement' || value.expression.type === 'JSXFragment') {\n return this.foldedJSX(value.expression);\n }\n return {\n kind: 'expression',\n text: getText(this.context, value.expression),\n primary: isPrimary(value.expression),\n };\n }\n }\n\n /**\n * What a JSX value renders, read after the folds of this round. A fold\n * inside it can have replaced it with an expression already, such as an\n * inner `<Show>` that became its string `fallback`.\n */\n private foldedJSX(node: JSXElement | JSXFragment): Fold {\n const text = getText(this.context, node);\n if (text.startsWith('<')) {\n return { kind: 'jsx', text };\n }\n return { kind: 'expression', text, primary: false };\n }\n\n private foldShow(element: JSXElement): Fold | undefined {\n const when = this.attributeTruthiness(element, 'when');\n if (when === undefined) {\n return undefined;\n }\n if (!when) {\n return this.fallback(element);\n }\n if (hasCallbackChild(element.children)) {\n return undefined;\n }\n return { kind: 'children', children: element.children };\n }\n\n private foldFor(element: JSXElement): Fold | undefined {\n const each = findAttribute(element, 'each');\n if (\n each?.value?.type !== 'JSXExpressionContainer' ||\n each.value.expression.type === 'JSXEmptyExpression'\n ) {\n return undefined;\n }\n const { expression } = each.value;\n // `each={[]}` renders the fallback, and so does a statically falsy `each`,\n // which `mapArray` treats as an empty list. Either way the expression is\n // dropped, so it has to be skippable.\n const empty =\n arrayLiteralLength(expression) === 0 || truthiness(expression, this.lookup) === false;\n if (!empty) {\n return this.unrollFor(element, expression);\n }\n if (!isSideEffectFree(expression)) {\n return undefined;\n }\n return this.fallback(element);\n }\n\n /**\n * Unrolls `<For>` over a constant list into one copy of its row per item.\n *\n * The list is an array literal, or a binding of one that only `<For>`\n * reads, so nothing can change it. Each item is a primitive literal, or an\n * object literal of them. The row is an arrow function whose body is JSX,\n * and reads the item as `item.key`, or as itself when it is a primitive.\n * Each row ran once, untracked, under its own owner. A copy is made with\n * the JSX around it instead, which runs untracked too, and the JSX\n * transform gives every dynamic part its own effect. A `ref` or a spread\n * would run while the copy is made, so either one keeps the loop.\n */\n private unrollFor(element: JSXElement, expression: Expression): Fold | undefined {\n if (hasEnabledKeyed(element)) {\n return undefined;\n }\n const byIndex = findAttribute(element, 'keyed') !== undefined;\n const list = this.constantList(expression);\n if (!list) {\n return undefined;\n }\n const significant = getSignificant(element.children);\n const only = significant.at(0);\n if (significant.length !== 1 || only?.type !== 'JSXExpressionContainer') {\n return undefined;\n }\n let row: Node = only.expression;\n while (row.type === 'ParenthesizedExpression') {\n row = row.expression;\n }\n if (\n row.type !== 'ArrowFunctionExpression' ||\n row.async ||\n !row.expression ||\n row.params.length > 2\n ) {\n return undefined;\n }\n let body: Node = row.body;\n while (body.type === 'ParenthesizedExpression') {\n body = body.expression;\n }\n if ((body.type !== 'JSXElement' && body.type !== 'JSXFragment') || hasRefOrSpread(body)) {\n return undefined;\n }\n // A fold inside the row in this pass would be lost, so it waits for the next pass.\n if (\n this.context.s.slice(body.start, body.end) !== this.context.code.slice(body.start, body.end)\n ) {\n return undefined;\n }\n const scope = this.context.scopes.scopes.get(row);\n if (!scope) {\n return undefined;\n }\n const params: Binding[] = [];\n for (const param of row.params) {\n const binding = param.type === 'Identifier' ? scope.bindings.get(param.name) : undefined;\n if (!binding || binding.mutated) {\n return undefined;\n }\n params.push(binding);\n }\n const itemParam = params.at(0);\n const indexParam = params.at(1);\n const rows: string[] = [];\n for (const [index, item] of list.items.entries()) {\n const copy = new MagicString(this.context.code);\n // With `keyed={false}` the item is an accessor and the index a number, and the other way around otherwise.\n if (\n (itemParam && !this.substituteItem(copy, itemParam, item, byIndex)) ||\n (indexParam && !this.substituteIndex(copy, indexParam, index, !byIndex))\n ) {\n return undefined;\n }\n rows.push(copy.slice(body.start, body.end));\n }\n const text = `<>${rows.join('')}</>`;\n if (!this.unrollingPays(element, text, list.declaration)) {\n return undefined;\n }\n return { kind: 'jsx', text };\n }\n\n /**\n * The items of a constant list, and the declaration that goes once no\n * `<For>` reads it.\n */\n private constantList(\n expression: Expression,\n ): { items: ConstantItem[]; declaration: Node | undefined } | undefined {\n // `as const` and `satisfies` change nothing at runtime.\n let node: Expression = unwrap(expression);\n let declaration: Node | undefined;\n if (node.type === 'Identifier') {\n const binding = this.context.scopes.references.get(node);\n if (\n binding?.declaration.type !== 'VariableDeclarator' ||\n binding.declaration.id !== binding.identifier ||\n !binding.declaration.init ||\n !isConstantDeclaration(binding, this.context.options)\n ) {\n return undefined;\n }\n // Any other use could change the list, and an export can be changed by another module.\n const statement = this.context.parents.get(binding.declaration);\n const owner = statement ? this.context.parents.get(statement) : undefined;\n let onlyForEach = true;\n for (const reference of binding.references) {\n if (!this.isForEach(reference)) {\n onlyForEach = false;\n break;\n }\n }\n if (owner?.type === 'ExportNamedDeclaration' || !onlyForEach) {\n return undefined;\n }\n node = unwrap(binding.declaration.init);\n declaration =\n binding.references.length === 1 &&\n statement?.type === 'VariableDeclaration' &&\n statement.declarations.length === 1\n ? statement\n : undefined;\n }\n if (node.type !== 'ArrayExpression') {\n return undefined;\n }\n const items: ConstantItem[] = [];\n for (const element of node.elements) {\n const item =\n element && element.type !== 'SpreadElement' ? this.constantItem(element) : undefined;\n if (!item) {\n return undefined;\n }\n items.push(item);\n }\n return { items, declaration };\n }\n\n /** Whether a reference is the whole `each` of a Solid `<For>`. */\n private isForEach(reference: Node): boolean {\n const container = this.context.parents.get(reference);\n const attribute = container ? this.context.parents.get(container) : undefined;\n const opening = attribute ? this.context.parents.get(attribute) : undefined;\n const element = opening ? this.context.parents.get(opening) : undefined;\n return (\n container?.type === 'JSXExpressionContainer' &&\n attribute?.type === 'JSXAttribute' &&\n attribute.name.type === 'JSXIdentifier' &&\n attribute.name.name === 'each' &&\n element?.type === 'JSXElement' &&\n this.builtInTag(element) === 'For'\n );\n }\n\n /** A list item whose value is known: a primitive literal, or an object literal of them. */\n private constantItem(node: Expression): ConstantItem | undefined {\n const primitive = primitiveText(this.context, node);\n if (primitive !== undefined) {\n return { kind: 'primitive', text: primitive };\n }\n if (node.type !== 'ObjectExpression') {\n return undefined;\n }\n const keys = new Map<string, string>();\n for (const property of node.properties) {\n if (\n property.type !== 'Property' ||\n property.kind !== 'init' ||\n property.method ||\n property.computed\n ) {\n return undefined;\n }\n const key = keyName(property.key);\n const value = primitiveText(this.context, property.value);\n if (key === undefined || value === undefined || key === '__proto__') {\n return undefined;\n }\n keys.set(key, value);\n }\n return { kind: 'object', keys };\n }\n\n /**\n * Writes an item's value over each read of the row's item parameter.\n * `false` when a read is not one the value can take the place of.\n */\n private substituteItem(\n copy: MagicString,\n param: Binding,\n item: ConstantItem,\n accessor: boolean,\n ): boolean {\n for (const reference of param.references) {\n let read: Node = reference;\n if (accessor) {\n const call = this.context.parents.get(reference);\n if (\n call?.type !== 'CallExpression' ||\n call.callee !== reference ||\n call.arguments.length > 0\n ) {\n return false;\n }\n read = call;\n }\n if (item.kind === 'primitive') {\n copy.overwrite(read.start, read.end, this.valueAt(read, item.text));\n continue;\n }\n const member = this.context.parents.get(read);\n if (\n member?.type !== 'MemberExpression' ||\n member.object !== read ||\n isWriteTarget(member, this.context.parents)\n ) {\n return false;\n }\n // `item[name]` reads a variable key, so only a string literal counts when computed.\n let key: string | undefined;\n if (!member.computed) {\n key = member.property.type === 'Identifier' ? member.property.name : undefined;\n } else if (member.property.type === 'Literal') {\n key = keyName(member.property);\n }\n // A call would run with the item as `this`, and a missing key could be on the prototype.\n const parent = this.context.parents.get(member);\n if (\n key === undefined ||\n (parent?.type === 'CallExpression' && parent.callee === member) ||\n !item.keys.has(key)\n ) {\n return false;\n }\n copy.overwrite(\n member.start,\n member.end,\n this.valueAt(member, item.keys.get(key) ?? 'void 0'),\n );\n }\n return true;\n }\n\n /** A value's text in place of `node`, with parentheses unless it fills a JSX container. */\n private valueAt(node: Node, text: string): string {\n return this.context.parents.get(node)?.type === 'JSXExpressionContainer' ? text : `(${text})`;\n }\n\n /** Writes an item's index over each read of the row's index parameter. */\n private substituteIndex(\n copy: MagicString,\n param: Binding,\n index: number,\n accessor: boolean,\n ): boolean {\n for (const reference of param.references) {\n let read: Node = reference;\n if (accessor) {\n const call = this.context.parents.get(reference);\n if (\n call?.type !== 'CallExpression' ||\n call.callee !== reference ||\n call.arguments.length > 0\n ) {\n return false;\n }\n read = call;\n }\n copy.overwrite(read.start, read.end, String(index));\n }\n return true;\n }\n\n /**\n * Whether the copies are estimated to be no larger, once lowered, than\n * the loop and the list it no longer needs.\n */\n private unrollingPays(element: JSXElement, text: string, declaration: Node | undefined): boolean {\n const inTemplate = this.joinsParentTemplate(element);\n const loop =\n new SizeEstimator(this.context.code).jsx(element, inTemplate) +\n (declaration\n ? compactLength(this.context.code.slice(declaration.start, declaration.end))\n : 0);\n const code = `const __so_rows__ = ${text};`;\n const program = parse(this.context.filename, code);\n const statement = program.body.at(0);\n const init =\n statement?.type === 'VariableDeclaration' ? statement.declarations.at(0)?.init : undefined;\n if (init?.type !== 'JSXFragment') {\n return false;\n }\n // In an element, the rows splice into its template. Elsewhere they are a fragment of templates.\n const estimator = new SizeEstimator(code);\n const unrolled = inTemplate\n ? estimateChildren(estimator, init.children)\n : estimator.jsx(init, false);\n return unrolled <= loop;\n }\n\n /** Whether an element sits directly in an element or fragment whose template it joins. */\n private joinsParentTemplate(element: JSXElement): boolean {\n const parent = this.context.parents.get(element);\n return (\n (parent?.type === 'JSXElement' && joinsTemplate(parent)) || parent?.type === 'JSXFragment'\n );\n }\n\n private foldRepeat(element: JSXElement): Fold | undefined {\n const count = findAttribute(element, 'count');\n if (\n count?.value?.type !== 'JSXExpressionContainer' ||\n count.value.expression.type === 'JSXEmptyExpression'\n ) {\n return undefined;\n }\n const value = evaluate(count.value.expression, this.lookup);\n if (typeof value?.value !== 'number') {\n return undefined;\n }\n // Written this way so `NaN` counts as empty, like `repeat` does.\n if (value.value >= 1) {\n return undefined;\n }\n return this.fallback(element);\n }\n\n /**\n * Resolves a `<Switch>` as far as its `<Match when>` conditions allow.\n * Statically false matches are dropped, a statically true match with no\n * undecided match before it wins, and a switch whose every match is false\n * renders its fallback.\n */\n private foldSwitch(element: JSXElement): Fold | undefined {\n const matches: { element: JSXElement; when: boolean | undefined }[] = [];\n for (const child of element.children) {\n if (isInsignificant(child)) {\n continue;\n }\n // Anything else in a `<Switch>` is outside what this pass models.\n if (\n child.type !== 'JSXElement' ||\n this.builtInTag(child) !== 'Match' ||\n hasSpreadAttribute(child) ||\n !findAttribute(child, 'when')\n ) {\n return undefined;\n }\n matches.push({ element: child, when: this.attributeTruthiness(child, 'when') });\n }\n if (matches.length === 0) {\n return undefined;\n }\n\n // Find the first true match, and whether every match before it is false.\n let winner = -1;\n let allFalse = true;\n for (const [index, item] of matches.entries()) {\n if (item.when === true) {\n winner = index;\n break;\n }\n if (item.when !== false) {\n allFalse = false;\n }\n }\n if (winner !== -1 && allFalse) {\n const match = matches.at(winner);\n if (!match || hasCallbackChild(match.element.children)) {\n return undefined;\n }\n return { kind: 'children', children: match.element.children };\n }\n\n if (winner === -1 && allFalse) {\n return this.fallback(element);\n }\n\n // No outcome yet. A statically false match never renders, but the runtime\n // would still evaluate it each time the switch updates, so it is removed.\n for (const item of matches) {\n if (item.when === false) {\n this.context.s.remove(item.element.start, item.element.end);\n this.changed = true;\n }\n }\n return undefined;\n }\n\n /**\n * `<Dynamic component=\"div\">` is just `<div>`, which the JSX transform can\n * put in a template instead of creating the element at runtime.\n */\n /**\n * `<Dynamic component=\"div\">` becomes `<div>`. `<Dynamic component={Card}>`\n * becomes `<Card>` when `Card` is a component declared at the top level\n * that nothing reassigns. `<Dynamic>` then only renders `Card` with the\n * other props, through a memo that never changes.\n */\n private foldDynamic(element: JSXElement): Fold | undefined {\n const component = findAttribute(element, 'component');\n if (!component?.value) {\n return undefined;\n }\n let tag: string | undefined;\n const { value } = component;\n if (value.type === 'Literal') {\n tag = isIntrinsicTag(value.value) ? value.value : undefined;\n } else if (\n value.type === 'JSXExpressionContainer' &&\n value.expression.type !== 'JSXEmptyExpression'\n ) {\n const expression =\n value.expression.type === 'ParenthesizedExpression'\n ? value.expression.expression\n : value.expression;\n if (expression.type === 'Identifier') {\n tag = this.componentName(expression);\n }\n if (tag === undefined) {\n const result = evaluate(value.expression, this.lookup);\n if (typeof result?.value === 'string' && isIntrinsicTag(result.value)) {\n tag = result.value;\n }\n }\n }\n if (tag === undefined) {\n return undefined;\n }\n const attributes: string[] = [];\n for (const attribute of element.openingElement.attributes) {\n if (attribute !== component) {\n attributes.push(getText(this.context, attribute));\n }\n }\n const opening = [tag, ...attributes].join(' ');\n const text = element.closingElement\n ? `<${opening}>${innerText(this.context.s, element)}</${tag}>`\n : `<${opening} />`;\n return { kind: 'jsx', text };\n }\n\n /**\n * Replaces a control-flow element that is not a JSX child.\n */\n private foldFlowExpression(element: JSXElement): void {\n const resolved = this.foldFlow(element);\n if (!resolved) {\n return;\n }\n this.replace(element, this.expressionText(resolved));\n }\n\n private expressionText(resolved: Fold): string {\n switch (resolved.kind) {\n case 'empty':\n return 'null';\n case 'jsx':\n return resolved.text;\n case 'expression':\n return resolved.primary ? resolved.text : `(${resolved.text})`;\n default: {\n const significant = getSignificant(resolved.children);\n const only = significant.at(0);\n if (only === undefined) {\n return 'null';\n }\n if (\n significant.length === 1 &&\n (only.type === 'JSXElement' || only.type === 'JSXFragment')\n ) {\n return getText(this.context, only);\n }\n const first = resolved.children.at(0);\n const last = resolved.children.at(-1);\n if (!first || !last) {\n return 'null';\n }\n return `<>${this.context.s.slice(first.start, last.end)}</>`;\n }\n }\n }\n\n /**\n * Replaces every resolvable control-flow child with what it renders.\n */\n private foldChildren(parent: JSXElement | JSXFragment): void {\n const pieces: Piece[] = [];\n let folded = false;\n for (const child of parent.children) {\n // A fragment among JSX children is the same as its children, and Solid's\n // JSX transform only compiles the spliced form.\n if (child.type === 'JSXFragment') {\n folded = true;\n pieces.push(splicePiece(this.context.s, child, child.children));\n continue;\n }\n const reduced =\n child.type === 'JSXExpressionContainer' && joinsTemplate(parent)\n ? this.reducedCall(child.expression)\n : undefined;\n if (reduced !== undefined) {\n folded = true;\n pieces.push(replacedPiece(child, reduced));\n continue;\n }\n const resolved = child.type === 'JSXElement' ? this.foldFlow(child) : undefined;\n if (!resolved) {\n pieces.push(keptPiece(child));\n continue;\n }\n folded = true;\n switch (resolved.kind) {\n case 'children':\n pieces.push(splicePiece(this.context.s, child, resolved.children));\n break;\n case 'jsx':\n pieces.push(replacedPiece(child, resolved.text));\n break;\n case 'expression':\n pieces.push(replacedPiece(child, `{${resolved.text}}`));\n break;\n default:\n pieces.push(replacedPiece(child, ''));\n break;\n }\n }\n if (folded && writePieces(this.context.s, pieces)) {\n this.changed = true;\n }\n }\n\n /**\n * The JSX a call like `((n) => <li>{n}</li>)(1)` makes, with each\n * argument in place of its parameter, or `undefined` when that could\n * behave differently.\n *\n * The child is inserted by an effect that makes the JSX. The JSX\n * transform wraps every dynamic part of JSX in an effect of its own, so\n * making it reads nothing the outer effect tracks, and the outer effect\n * runs once. A `ref` runs while the JSX is made, and a spread reads its\n * object there, so either one keeps the call. Each argument has to be a\n * constant or a binding nothing reassigns, so reading it again where the\n * parameter was gives the same value.\n */\n private reducedCall(expression: Expression | JSXEmptyExpression): string | undefined {\n if (expression.type !== 'CallExpression' || expression.optional) {\n return undefined;\n }\n let callee: Expression = expression.callee;\n while (callee.type === 'ParenthesizedExpression') {\n callee = callee.expression;\n }\n if (callee.type !== 'ArrowFunctionExpression' || callee.async || !callee.expression) {\n return undefined;\n }\n let body: Node = callee.body;\n while (body.type === 'ParenthesizedExpression') {\n body = body.expression;\n }\n if (body.type !== 'JSXElement' && body.type !== 'JSXFragment') {\n return undefined;\n }\n const { params } = callee;\n const args = expression.arguments;\n if (params.length !== args.length || hasRefOrSpread(body)) {\n return undefined;\n }\n // A fold inside the body in this pass would be lost, so it waits for the next pass.\n if (\n this.context.s.slice(body.start, body.end) !== this.context.code.slice(body.start, body.end)\n ) {\n return undefined;\n }\n const scope = this.context.scopes.scopes.get(callee);\n if (!scope) {\n return undefined;\n }\n const copy = new MagicString(this.context.code);\n for (const [index, param] of params.entries()) {\n const arg = args.at(index);\n if (param.type !== 'Identifier' || !arg || arg.type === 'SpreadElement') {\n return undefined;\n }\n const binding = scope.bindings.get(param.name);\n const text = this.argumentText(arg);\n if (!binding || binding.mutated || text === undefined) {\n return undefined;\n }\n for (const reference of binding.references) {\n // A binding argument has to mean the same where the parameter was read.\n if (\n arg.type === 'Identifier' &&\n lookup(scopeAt(this.context.scopes, this.context.parents, reference), arg.name) !==\n this.context.scopes.references.get(arg)\n ) {\n return undefined;\n }\n const parent = this.context.parents.get(reference);\n const shorthand =\n parent?.type === 'Property' && parent.shorthand && parent.value === reference;\n copy.overwrite(reference.start, reference.end, shorthand ? `${param.name}: ${text}` : text);\n }\n }\n return copy.slice(body.start, body.end);\n }\n\n /** The text of an argument that reads the same wherever it is copied. */\n private argumentText(arg: Expression): string | undefined {\n let node: Expression = arg;\n while (node.type === 'ParenthesizedExpression') {\n node = node.expression;\n }\n switch (node.type) {\n case 'Literal':\n return 'regex' in node ? undefined : getText(this.context, node);\n case 'TemplateLiteral':\n return node.expressions.length === 0 ? getText(this.context, node) : undefined;\n case 'UnaryExpression':\n return node.operator === '-' && node.argument.type === 'Literal'\n ? `(${getText(this.context, node)})`\n : undefined;\n case 'Identifier': {\n const binding = this.context.scopes.references.get(node);\n return binding && !binding.mutated ? node.name : undefined;\n }\n default:\n return undefined;\n }\n }\n\n // ---------------------------------------------------------------------------\n // Dead statements\n // ---------------------------------------------------------------------------\n\n private eliminateDeadStatements(statements: (Statement | Directive)[]): void {\n let terminator = -1;\n for (const [index, statement] of statements.entries()) {\n let terminates = isTerminator(statement);\n if (statement.type === 'IfStatement') {\n const kept = this.resolveIf(statement);\n if (kept !== undefined) {\n terminates = kept !== null && isTerminator(kept);\n }\n } else if (statement.type === 'WhileStatement') {\n this.resolveWhile(statement);\n }\n if (terminates && terminator === -1) {\n terminator = index;\n }\n }\n\n // Everything after the first terminator is unreachable, but a `var` or\n // function declaration in it is still hoisted, so the list stays intact.\n if (terminator === -1) {\n return;\n }\n const unreachable = statements.slice(terminator + 1);\n const first = unreachable.at(0);\n const last = unreachable.at(-1);\n let hoists = false;\n for (const statement of unreachable) {\n if (containsHoistedDeclaration(statement)) {\n hoists = true;\n break;\n }\n }\n if (first && last && !hoists) {\n this.context.s.remove(first.start, last.end);\n this.changed = true;\n }\n }\n\n private replaceStatement(statement: Node, text: string): void {\n if (text === '') {\n this.context.s.remove(statement.start, statement.end);\n this.changed = true;\n return;\n }\n this.replace(statement, continuesPreviousStatement(text) ? `;${text}` : text);\n }\n\n /**\n * A statement that keeps a discarded test's side effects, or `undefined`\n * when skipping the test changes nothing.\n */\n private discardedTest(test: Expression): string | undefined {\n const parts = effectfulParts(test);\n const first = parts.at(0);\n if (first === undefined) {\n return undefined;\n }\n const text = getTexts(this.context, parts).join(', ');\n return startsLikeStatement(first) ? `(${text});` : `${text};`;\n }\n\n /**\n * Resolves an `if` with a constant test. Returns the kept branch, `null`\n * when no branch is kept, or `undefined` when the statement stays.\n */\n private resolveIf(statement: IfStatement): Statement | null | undefined {\n const test = truthiness(statement.test, this.lookup);\n if (test === undefined) {\n return undefined;\n }\n const dropped = test ? statement.alternate : statement.consequent;\n if (dropped && containsHoistedDeclaration(dropped)) {\n return undefined;\n }\n const kept = test ? statement.consequent : statement.alternate;\n // A bare function declaration as a branch is web-compatibility semantics,\n // not something to move into the enclosing list.\n if (kept?.type === 'FunctionDeclaration') {\n return undefined;\n }\n const parts: string[] = [];\n const effect = this.discardedTest(statement.test);\n if (effect !== undefined) {\n parts.push(effect);\n }\n if (kept) {\n parts.push(getText(this.context, kept));\n }\n this.replaceStatement(statement, parts.join(' '));\n return kept;\n }\n\n private resolveWhile(statement: WhileStatement): void {\n if (truthiness(statement.test, this.lookup) !== false) {\n return;\n }\n if (containsHoistedDeclaration(statement.body)) {\n return;\n }\n // A `while` with a falsy test evaluates the test once and never enters the body.\n this.replaceStatement(statement, this.discardedTest(statement.test) ?? '');\n }\n}\n\n/**\n * Runs the fold pass over a parsed program. Returns whether anything changed.\n */\nexport function fold(context: PassContext): boolean {\n const folder = new Folder(context);\n folder.walk(context.program);\n return folder.changed;\n}\n","/**\n * The provider pass: removes context providers whose reads are all visible.\n *\n * In Solid 2.0, a context is its own provider component. The provider reads\n * `props.value` once, untracked, when it is created, and every\n * `useContext(Ctx)` under it returns that value. When every code path that\n * can run under a provider is visible, each read can take the value\n * directly, and the provider only costs a component call, a root owner, and\n * a template boundary:\n *\n * ```jsx\n * <Theme value=\"dark\">\n * <span>{useContext(Theme)}</span>\n * </Theme>\n * ```\n *\n * becomes `<><span>{\"dark\"}</span></>`.\n *\n * Most reads sit in a consumer component's statements. The inline pass\n * moves those consumers out through a closed provider and replaces their\n * reads, and this pass removes the provider once nothing under it is a\n * component anymore.\n *\n * # Accepted differences\n *\n * - The provider's root owner is gone, which shifts the hydration keys\n * after it. A server build and its client build must compile with the\n * same options.\n * - A getter defined by the app, other than on a component's props, that\n * calls `useContext` is not seen.\n */\nimport type {\n CallExpression,\n Expression,\n JSXAttribute,\n JSXElement,\n MemberExpression,\n Node,\n ObjectExpression,\n} from 'oxc-parser';\nimport { forEachChild, isFunctionNode, isIntrinsicTag, unwrap } from './ast';\nimport type { PassContext } from './context';\nimport { isConstantDeclaration, recordSkip, solidExport } from './context';\nimport type { Binding } from './scope';\nimport { lookup, scopeAt } from './scope';\nimport { evaluate, isSideEffectFree, literalText } from './value';\n\n/**\n * Solid's primitives that run no code of the app, except the functions\n * passed to them. Those functions are checked like any other code.\n */\nexport const CONTEXT_SAFE_PRIMITIVES = [\n 'createSignal',\n 'createMemo',\n 'createEffect',\n 'createRenderEffect',\n 'createStore',\n 'createProjection',\n 'createOptimistic',\n 'onCleanup',\n 'onSettled',\n 'untrack',\n 'useContext',\n 'flush',\n 'mapArray',\n 'repeat',\n 'merge',\n 'omit',\n];\n\n/** Primitives that return a getter and a setter, as `[get, set]`. */\nconst ACCESSOR_PAIRS = new Set(['createSignal', 'createStore', 'createOptimistic']);\n\nexport interface Provider {\n readonly element: JSXElement;\n /** The top-level `createContext()` binding the tag refers to. */\n readonly context: Binding;\n readonly value: Expression;\n}\n\n/**\n * The provider a JSX element creates: a tag that refers to a top-level\n * `createContext(...)` from Solid, nothing writes to, with one `value`\n * attribute holding a value that is never `undefined`.\n *\n * `useContext` throws when the value and the default are both `undefined`,\n * so a value that could be `undefined` keeps its provider.\n */\nexport function findProvider(context: PassContext, element: JSXElement): Provider | undefined {\n const binding = contextBinding(context, element.openingElement.name);\n if (!binding || element.openingElement.selfClosing) {\n return undefined;\n }\n const { attributes } = element.openingElement;\n const attribute = attributes.at(0);\n if (\n attributes.length !== 1 ||\n attribute?.type !== 'JSXAttribute' ||\n attribute.name.type !== 'JSXIdentifier' ||\n attribute.name.name !== 'value' ||\n !attribute.value\n ) {\n return undefined;\n }\n let value: Expression;\n if (attribute.value.type === 'Literal') {\n value = attribute.value;\n } else if (\n attribute.value.type === 'JSXExpressionContainer' &&\n attribute.value.expression.type !== 'JSXEmptyExpression'\n ) {\n value = attribute.value.expression;\n } else {\n return undefined;\n }\n if (!isDefined(context, value, 0)) {\n return undefined;\n }\n return { element, context: binding, value };\n}\n\n/**\n * The top-level context binding a tag or identifier refers to.\n */\nexport function contextBinding(context: PassContext, name: Node): Binding | undefined {\n if (name.type !== 'JSXIdentifier' && name.type !== 'Identifier') {\n return undefined;\n }\n const binding = context.scopes.references.get(name);\n if (!binding || binding.mutated || binding.scope.parent !== undefined) {\n return undefined;\n }\n if (binding.kind === 'import') {\n const { source, imported } = binding;\n const known =\n source !== undefined &&\n imported !== undefined &&\n context.options.importedContexts.get(source)?.has(imported) === true;\n return known ? binding : undefined;\n }\n const { declaration } = binding;\n if (\n declaration.type !== 'VariableDeclarator' ||\n declaration.id !== binding.identifier ||\n !isConstantDeclaration(binding, context.options) ||\n !declaration.init\n ) {\n return undefined;\n }\n const init = unwrap(declaration.init);\n return init.type === 'CallExpression' && solidCallee(context, init) === 'createContext'\n ? binding\n : undefined;\n}\n\n/**\n * The Solid export a call calls, like `createSignal`.\n */\nexport function solidCallee(context: PassContext, call: CallExpression): string | undefined {\n const callee = unwrap(call.callee);\n if (callee.type !== 'Identifier') {\n return undefined;\n }\n const binding = context.scopes.references.get(callee);\n return binding ? solidExport(binding, context.options) : undefined;\n}\n\n/**\n * Whether evaluating `node` never gives `undefined`.\n */\nfunction isDefined(context: PassContext, node: Expression, depth: number): boolean {\n const expression = unwrap(node);\n switch (expression.type) {\n case 'ObjectExpression':\n case 'ArrayExpression':\n case 'ArrowFunctionExpression':\n case 'FunctionExpression':\n case 'ClassExpression':\n case 'NewExpression':\n case 'TemplateLiteral':\n case 'JSXElement':\n case 'JSXFragment':\n return true;\n case 'Identifier': {\n const binding = context.scopes.references.get(expression);\n if (!binding || binding.mutated || depth > 2) {\n return false;\n }\n if (binding.kind === 'function' || binding.kind === 'class' || isAccessor(context, binding)) {\n return true;\n }\n const { declaration } = binding;\n return (\n isConstantDeclaration(binding, context.options) &&\n declaration.type === 'VariableDeclarator' &&\n declaration.id === binding.identifier &&\n declaration.init !== null &&\n isDefined(context, declaration.init, depth + 1)\n );\n }\n default: {\n return evaluate(expression, () => undefined)?.value !== undefined;\n }\n }\n}\n\n/**\n * The text a read of a provider's value can be replaced with at `site`: a\n * literal, or a binding that never changes and means the same there.\n * `undefined` when the value has to be stored first.\n */\nexport function stableValueText(\n context: PassContext,\n provider: Provider,\n site: Node,\n): string | undefined {\n const value = unwrap(provider.value);\n const constant = evaluate(value, () => undefined);\n if (constant) {\n return literalText(constant.value);\n }\n if (value.type !== 'Identifier') {\n return undefined;\n }\n const binding = context.scopes.references.get(value);\n if (!binding || binding.mutated) {\n return undefined;\n }\n const unchanging =\n binding.kind === 'function' ||\n binding.kind === 'class' ||\n binding.kind === 'import' ||\n isConstantDeclaration(binding, context.options);\n if (!unchanging) {\n return undefined;\n }\n const scope = scopeAt(context.scopes, context.parents, site);\n return lookup(scope, value.name) === binding ? value.name : undefined;\n}\n\n/**\n * Whether an attribute is an event handler given as a function. The\n * function runs with no owner, so a `useContext` in it throws whether or\n * not a provider is above it.\n */\nfunction isHandlerFunction(attribute: JSXAttribute): boolean {\n const { name, value } = attribute;\n const text =\n name.type === 'JSXIdentifier' ? name.name : `${name.namespace.name}:${name.name.name}`;\n if (!/^on(?:[A-Z]|:)/.test(text) || value?.type !== 'JSXExpressionContainer') {\n return false;\n }\n const expression = value.expression.type === 'JSXEmptyExpression' ? undefined : value.expression;\n return expression !== undefined && isFunctionNode(unwrap(expression));\n}\n\n/**\n * Whether a binding is a signal or store getter or setter, or a memo, which\n * run no code of the app when called.\n */\nfunction isAccessor(context: PassContext, binding: Binding): boolean {\n if (binding.mutated) {\n return false;\n }\n const { declaration } = binding;\n if (declaration.type !== 'VariableDeclarator') {\n return false;\n }\n const { id, init } = declaration;\n const call = init ? unwrap(init) : undefined;\n if (call?.type !== 'CallExpression') {\n return false;\n }\n const callee = solidCallee(context, call);\n if (id === binding.identifier) {\n return callee === 'createMemo';\n }\n if (id.type !== 'ArrayPattern' || callee === undefined || !ACCESSOR_PAIRS.has(callee)) {\n return false;\n }\n // Only the first two slots of the pair are accessors.\n for (const [index, element] of id.elements.entries()) {\n if (element === binding.identifier) {\n return index === 0 || index === 1;\n }\n }\n return false;\n}\n\nexport interface ClosedOptions {\n /** Whether a component element can be treated as visible code. */\n readonly component: (element: JSXElement) => boolean;\n /** A component's own props, whose reads are replaced when it is inlined. */\n readonly props?: Binding;\n /** The value a read of a context gets, when the provider is known. */\n readonly contextValue?: (target: Binding) => Expression | undefined;\n /** Called with a short code for the code that is not visible, for the report. */\n readonly onOpen?: (reason: string) => void;\n}\n\n/**\n * Whether all code that can run under `root` is visible, so a provider\n * above it has no reader that is not in it.\n *\n * Calls are limited to Solid's primitives, signal and memo accessors, and\n * methods of known object literals. A use of another component's props\n * runs code of its parent, so it counts as a call. A component's own props\n * are replaced when it is inlined.\n */\nexport function isClosed(context: PassContext, root: Node, options: ClosedOptions): boolean {\n let closed = true;\n const open = (reason: string): void => {\n closed = false;\n options.onOpen?.(reason);\n };\n const visit = (node: Node): void => {\n if (!closed) {\n return;\n }\n switch (node.type) {\n case 'JSXAttribute':\n if (isHandlerFunction(node)) {\n return;\n }\n break;\n case 'JSXSpreadAttribute':\n // A view of the component's own props is expanded when it inlines.\n if (!isOwnView(context, node.argument, options.props, 0)) {\n open('open-spread');\n return;\n }\n break;\n case 'NewExpression':\n open('open-new');\n return;\n case 'JSXSpreadChild':\n case 'TaggedTemplateExpression':\n case 'ImportExpression':\n open('open-other');\n return;\n case 'JSXElement':\n if (!isVisibleElement(context, node, options)) {\n open('open-component');\n return;\n }\n break;\n case 'CallExpression':\n if (!isVisibleCall(context, node, options)) {\n open('open-call');\n return;\n }\n break;\n case 'Identifier': {\n // Another component's props run its parent's code when read, and\n // passing them on, as to `merge()`, reads them somewhere else. A\n // binding declared under `root`, like a callback's parameter, is a value.\n const binding = context.scopes.references.get(node);\n if (binding && runsOutsideCode(context, binding, root, options, 0)) {\n open('open-outer');\n return;\n }\n break;\n }\n default:\n break;\n }\n forEachChild(node, visit);\n };\n visit(root);\n return closed;\n}\n\n/**\n * Whether using a binding declared outside `root` can run code that is not\n * under `root`:\n *\n * - another component's props, whose getters run its parent's code;\n * - a value built from them, like `mergeDefaultProps(defaults, props)`,\n * whose getters do the same;\n * - a function, which `root` can call or pass on to be called.\n *\n * A component's own props, and values built from them, are replaced when\n * it is inlined.\n */\nfunction runsOutsideCode(\n context: PassContext,\n binding: Binding,\n root: Node,\n options: ClosedOptions,\n depth: number,\n): boolean {\n const { identifier, declaration } = binding;\n if (\n binding === options.props ||\n (identifier.start >= root.start && identifier.end <= root.end) ||\n isAccessor(context, binding) ||\n // Calls of Solid's own functions are checked where they are made.\n solidExport(binding, context.options) !== undefined\n ) {\n return false;\n }\n if (binding.kind === 'param' || binding.kind === 'function' || depth > 4) {\n return true;\n }\n if (declaration.type !== 'VariableDeclarator' || !declaration.init) {\n return false;\n }\n const init = unwrap(declaration.init);\n if (isFunctionNode(init)) {\n return true;\n }\n let found = false;\n const visit = (node: Node): void => {\n if (found) {\n return;\n }\n if (node.type === 'Identifier') {\n const target = context.scopes.references.get(node);\n if (\n target &&\n target !== binding &&\n (target.kind === 'param' || target.kind === 'const' || target.kind === 'let') &&\n runsOutsideCode(context, target, root, options, depth + 1)\n ) {\n found = true;\n return;\n }\n }\n forEachChild(node, visit);\n };\n visit(init);\n return found;\n}\n\n/**\n * Whether an expression is a `merge()` or `omit()` view of a component's\n * own props, with only literal objects and keys besides.\n */\nfunction isOwnView(\n context: PassContext,\n node: Expression,\n props: Binding | undefined,\n depth: number,\n): boolean {\n const expression = unwrap(node);\n if (props === undefined || depth > 4) {\n return false;\n }\n let call: Node | undefined = expression;\n if (expression.type === 'Identifier') {\n const binding = context.scopes.references.get(expression);\n if (binding === props) {\n return true;\n }\n const init = binding ? constantInit(context, binding) : undefined;\n call = init ? unwrap(init) : undefined;\n }\n if (call?.type !== 'CallExpression') {\n return false;\n }\n const callee = solidCallee(context, call);\n if (callee !== 'merge' && callee !== 'omit') {\n return false;\n }\n for (const argument of call.arguments) {\n if (argument.type === 'SpreadElement') {\n return false;\n }\n const inner = unwrap(argument);\n if (\n inner.type !== 'ObjectExpression' &&\n !(inner.type === 'Literal' && typeof inner.value === 'string') &&\n !isOwnView(context, inner, props, depth + 1)\n ) {\n return false;\n }\n }\n return true;\n}\n\nfunction isVisibleElement(\n context: PassContext,\n element: JSXElement,\n options: ClosedOptions,\n): boolean {\n const { name } = element.openingElement;\n if (name.type !== 'JSXIdentifier') {\n return false;\n }\n if (isIntrinsicTag(name.name)) {\n return true;\n }\n if (contextBinding(context, name)) {\n return true;\n }\n const binding = context.scopes.references.get(name);\n const identity = binding ? solidExport(binding, context.options) : name.name;\n // `<Dynamic>` renders a component it is given, which is not visible.\n if (identity !== undefined && identity !== 'Dynamic' && context.options.builtIns.has(identity)) {\n return true;\n }\n return options.component(element);\n}\n\nfunction isVisibleCall(\n context: PassContext,\n call: CallExpression,\n options: ClosedOptions,\n): boolean {\n const callee = unwrap(call.callee);\n if (callee.type === 'MemberExpression') {\n return isVisibleMethod(context, callee, options);\n }\n if (callee.type !== 'Identifier') {\n return false;\n }\n const binding = context.scopes.references.get(callee);\n if (!binding) {\n return false;\n }\n const identity = solidExport(binding, context.options);\n if (identity !== undefined) {\n return CONTEXT_SAFE_PRIMITIVES.includes(identity);\n }\n return isAccessorValue(context, callee, options, 0);\n}\n\n/**\n * Whether an expression evaluates to a signal, store, or memo accessor,\n * through bindings that never change and reads of a context whose value is\n * known.\n */\nfunction isAccessorValue(\n context: PassContext,\n node: Expression,\n options: ClosedOptions,\n depth: number,\n): boolean {\n const expression = unwrap(node);\n if (depth > 4) {\n return false;\n }\n if (expression.type === 'CallExpression') {\n const value = findContextValue(context, expression, options);\n return value !== undefined && isAccessorValue(context, value, options, depth + 1);\n }\n if (expression.type !== 'Identifier') {\n return false;\n }\n const binding = context.scopes.references.get(expression);\n if (!binding) {\n return false;\n }\n if (isAccessor(context, binding)) {\n return true;\n }\n const init = constantInit(context, binding);\n return init !== undefined && isAccessorValue(context, init, options, depth + 1);\n}\n\n/**\n * The initializer of a binding that never changes, declared on its own.\n */\nfunction constantInit(context: PassContext, binding: Binding): Expression | undefined {\n const { declaration } = binding;\n if (\n !isConstantDeclaration(binding, context.options) ||\n declaration.type !== 'VariableDeclarator' ||\n declaration.id !== binding.identifier ||\n !declaration.init\n ) {\n return undefined;\n }\n return declaration.init;\n}\n\n/**\n * The value `useContext(Ctx)` returns, when the provider is known.\n */\nfunction findContextValue(\n context: PassContext,\n call: CallExpression,\n options: ClosedOptions,\n): Expression | undefined {\n const argument = call.arguments.at(0);\n if (\n solidCallee(context, call) !== 'useContext' ||\n call.arguments.length !== 1 ||\n argument === undefined ||\n argument.type === 'SpreadElement'\n ) {\n return undefined;\n }\n const target = contextBinding(context, unwrap(argument));\n return target ? options.contextValue?.(target) : undefined;\n}\n\n/**\n * Whether calling `object.name()` runs only visible code: the object is an\n * object literal, directly or through bindings that never change or a\n * context read, and the property is an accessor or a visible function.\n */\nfunction isVisibleMethod(\n context: PassContext,\n member: MemberExpression,\n options: ClosedOptions,\n): boolean {\n if (member.computed || member.property.type !== 'Identifier' || member.optional) {\n return false;\n }\n const object = findObjectLiteral(context, member.object, options, 0);\n if (!object) {\n return false;\n }\n const { name } = member.property;\n const matches: typeof object.properties = [];\n for (const property of object.properties) {\n if (property.type !== 'Property') {\n return false;\n }\n if (!property.computed && property.key.type === 'Identifier' && property.key.name === name) {\n matches.push(property);\n }\n }\n const property = matches.at(0);\n if (matches.length !== 1 || property?.type !== 'Property' || property.kind !== 'init') {\n return false;\n }\n const value = unwrap(property.value);\n if (isFunctionNode(value)) {\n return isClosed(context, value, options);\n }\n if (value.type !== 'Identifier') {\n return false;\n }\n const binding = context.scopes.references.get(value);\n if (!binding) {\n return false;\n }\n const identity = solidExport(binding, context.options);\n return identity === undefined\n ? isAccessorValue(context, value, options, 0)\n : CONTEXT_SAFE_PRIMITIVES.includes(identity);\n}\n\n/**\n * The object literal an expression evaluates to, through bindings that\n * never change and reads of a context whose value is known.\n */\nfunction findObjectLiteral(\n context: PassContext,\n node: Expression,\n options: ClosedOptions,\n depth: number,\n): ObjectExpression | undefined {\n const expression = unwrap(node);\n if (depth > 4) {\n return undefined;\n }\n if (expression.type === 'ObjectExpression') {\n return expression;\n }\n if (expression.type === 'CallExpression') {\n const value = findContextValue(context, expression, options);\n return value ? findObjectLiteral(context, value, options, depth + 1) : undefined;\n }\n if (expression.type !== 'Identifier') {\n return undefined;\n }\n const binding = context.scopes.references.get(expression);\n const init = binding ? constantInit(context, binding) : undefined;\n return init ? findObjectLiteral(context, init, options, depth + 1) : undefined;\n}\n\n/**\n * The `useContext(Ctx)` calls under `root` that run under its owner, so\n * not in an event handler, and that no other provider of `Ctx` under\n * `root` answers.\n */\nexport function contextReads(context: PassContext, root: Node, target: Binding): CallExpression[] {\n const reads: CallExpression[] = [];\n const visit = (node: Node): void => {\n if (node.type === 'JSXAttribute' && isHandlerFunction(node)) {\n return;\n }\n // A read under another provider of the same context belongs to that one.\n if (\n node !== root &&\n node.type === 'JSXElement' &&\n contextBinding(context, node.openingElement.name) === target\n ) {\n return;\n }\n if (node.type === 'CallExpression' && solidCallee(context, node) === 'useContext') {\n const argument = node.arguments.at(0);\n if (\n node.arguments.length === 1 &&\n argument?.type !== 'SpreadElement' &&\n argument !== undefined &&\n contextBinding(context, unwrap(argument)) === target\n ) {\n reads.push(node);\n }\n }\n forEachChild(node, visit);\n };\n visit(root);\n return reads;\n}\n\n/**\n * Whether a provider of the same context sits under `element`. A read under\n * it belongs to it, so the inner one is rewritten first.\n */\nexport function hasNestedProvider(context: PassContext, provider: Provider): boolean {\n let nested = false;\n const visit = (node: Node): void => {\n if (nested) {\n return;\n }\n if (\n node !== provider.element &&\n node.type === 'JSXElement' &&\n contextBinding(context, node.openingElement.name) === provider.context\n ) {\n nested = true;\n return;\n }\n forEachChild(node, visit);\n };\n for (const child of provider.element.children) {\n visit(child);\n }\n return nested;\n}\n\n/**\n * Every provider in the program, outermost first.\n */\nexport function findProviders(context: PassContext): Provider[] {\n const providers: Provider[] = [];\n const visit = (node: Node): void => {\n if (node.type === 'JSXElement') {\n const provider = findProvider(context, node);\n if (provider) {\n providers.push(provider);\n }\n }\n forEachChild(node, visit);\n };\n visit(context.program);\n return providers;\n}\n\nclass ProviderRemover {\n changed = false;\n\n constructor(private readonly context: PassContext) {}\n\n private readonly removed: JSXElement[] = [];\n\n run(): void {\n for (const provider of findProviders(this.context)) {\n // A provider inside one removed in this pass waits for the next pass,\n // so their edits do not overlap.\n const { element } = provider;\n let overlaps = false;\n for (const other of this.removed) {\n if (element.start < other.end && other.start < element.end) {\n overlaps = true;\n break;\n }\n }\n if (overlaps) {\n continue;\n }\n if (hasNestedProvider(this.context, provider)) {\n this.skip(provider, 'provider-nested');\n } else if (this.tryRemove(provider)) {\n this.removed.push(element);\n }\n }\n if (this.context.skips) {\n this.reportShapes();\n }\n }\n\n private skip(provider: Provider, reason: string): void {\n recordSkip(this.context, 'contexts', reason, provider.context.name);\n }\n\n /**\n * Records each context tag that is not a provider this pass understands,\n * such as one with more attributes than `value`.\n */\n private reportShapes(): void {\n const visit = (node: Node): void => {\n if (node.type === 'JSXElement') {\n const binding = contextBinding(this.context, node.openingElement.name);\n if (binding && !findProvider(this.context, node)) {\n // A lone `value` is turned down because it could be `undefined`.\n const { attributes } = node.openingElement;\n const attribute = attributes.at(0);\n const onlyValue =\n attributes.length === 1 &&\n attribute?.type === 'JSXAttribute' &&\n attribute.name.type === 'JSXIdentifier' &&\n attribute.name.name === 'value';\n recordSkip(\n this.context,\n 'contexts',\n onlyValue && !node.openingElement.selfClosing ? 'provider-undefined' : 'provider-shape',\n binding.name,\n );\n }\n }\n forEachChild(node, visit);\n };\n visit(this.context.program);\n }\n\n private tryRemove(provider: Provider): boolean {\n const { element } = provider;\n const children = element.children;\n let reason = 'open-other';\n const closure: ClosedOptions = {\n component: () => false,\n contextValue: (target) => (target === provider.context ? provider.value : undefined),\n onOpen: (open) => {\n reason = open;\n },\n };\n let closed = true;\n for (const child of children) {\n if (!isClosed(this.context, child, closure)) {\n closed = false;\n break;\n }\n }\n if (!closed) {\n this.skip(provider, reason);\n return false;\n }\n const reads: ReturnType<typeof contextReads> = [];\n for (const child of children) {\n reads.push(...contextReads(this.context, child, provider.context));\n }\n const texts: string[] = [];\n for (const read of reads) {\n const text = stableValueText(this.context, provider, read);\n if (text === undefined) {\n this.skip(provider, 'provider-value');\n return false;\n }\n texts.push(text);\n }\n // With no reads, the value is only dropped when evaluating it does nothing.\n if (reads.length === 0 && !isSideEffectFree(provider.value)) {\n const stable = stableValueText(this.context, provider, element);\n if (stable === undefined) {\n this.skip(provider, 'provider-value');\n return false;\n }\n }\n const { s } = this.context;\n for (const [index, read] of reads.entries()) {\n s.overwrite(read.start, read.end, texts[index] ?? '');\n }\n const { openingElement, closingElement } = element;\n s.overwrite(openingElement.start, openingElement.end, '<>');\n if (closingElement) {\n s.overwrite(closingElement.start, closingElement.end, '</>');\n }\n this.changed = true;\n return true;\n }\n}\n\n/**\n * Runs the provider pass over a parsed program. Returns whether anything changed.\n */\nexport function removeProviders(context: PassContext): boolean {\n const remover = new ProviderRemover(context);\n remover.run();\n return remover.changed;\n}\n","/**\n * Measures a component's copy at a call site: folds it, and inlines the\n * components it calls, as the passes after inlining would. Then it estimates\n * its size with `SizeEstimator`.\n */\nimport MagicString from 'magic-string';\nimport { collectParents, parse } from './ast';\nimport type { PassContext, ResolvedOptions } from './context';\nimport { fold } from './fold';\nimport { analyzeScopes } from './scope';\nimport { SizeEstimator } from './size';\n\n/**\n * The name of the function a copy is wrapped in to be folded and measured.\n * It is capitalized, so the inline pass can move statements into it.\n */\nconst WRAPPER = 'SoSize$$';\n\n/**\n * How many copies are being measured inside each other. Components that\n * call each other would otherwise measure each other without end.\n */\nlet depth = 0;\nconst MAX_DEPTH = 3;\n\n/** The module's components a copy calls, which can inline into it. */\nexport interface CalledComponents {\n /** Their declarations. */\n readonly declarations: string;\n /** The inline pass. It is passed in, since it measures copies with this module. */\n readonly inline: (context: PassContext) => boolean;\n}\n\nexport interface Copy {\n /** The statements the copy hoists out of the JSX. */\n readonly statements: readonly string[];\n /** The JSX that replaces the call site. */\n readonly root: string;\n}\n\n/**\n * The size of a component's copy at one call site, once its props have\n * folded. `header` declares the names the fold pass needs to know, like\n * imports of Solid. `called` holds the module's components the copy calls,\n * which inline into it when its props resolve their call sites.\n * `inTemplate` is whether the call site sits directly in an element.\n * `measured` receives the code that was measured.\n */\nexport function copySize(\n filename: string,\n header: string,\n copy: Copy,\n inTemplate: boolean,\n options: ResolvedOptions,\n called?: CalledComponents,\n measured?: { code: string },\n): number {\n const calls = depth < MAX_DEPTH ? called : undefined;\n let code = `${header}\\n${calls?.declarations ?? ''}\\nfunction ${WRAPPER}() {\\n${copy.statements.join('\\n')}\\nreturn (${copy.root});\\n}\\n`;\n // Constant props fold the copy's conditions, and can let the calls in it\n // inline, as later passes would.\n for (let round = 0; round < 4; round += 1) {\n let changed = false;\n for (const pass of calls ? [fold, calls.inline] : [fold]) {\n const program = parse(filename, code);\n const s = new MagicString(code);\n depth += 1;\n let passChanged: boolean;\n try {\n passChanged = pass({\n code,\n filename,\n s,\n program,\n parents: collectParents(program),\n scopes: analyzeScopes(program),\n options,\n // Only the copy is measured, so nothing it skips is reported.\n skips: undefined,\n });\n } finally {\n depth -= 1;\n }\n if (passChanged) {\n code = s.toString();\n changed = true;\n }\n }\n if (!changed) {\n break;\n }\n }\n if (measured) {\n measured.code = code;\n }\n const program = parse(filename, code);\n const wrapper = program.body.at(-1);\n if (wrapper?.type !== 'FunctionDeclaration' || !wrapper.body) {\n return Number.POSITIVE_INFINITY;\n }\n const estimator = new SizeEstimator(code);\n let size = 0;\n for (const statement of wrapper.body.body) {\n if (statement.type !== 'ReturnStatement') {\n size += estimator.node(statement);\n continue;\n }\n if (statement.argument) {\n size += estimator.root(statement.argument, inTemplate);\n }\n }\n return size;\n}\n","/**\n * The inline pass: replaces a component call with the component's body.\n *\n * `<Card title=\"Hi\" />` with `function Card(props) { return <div>{props.title}</div>; }`\n * becomes `<div>{\"Hi\"}</div>`. The JSX transform then sees one tree instead of\n * two, so it emits one template, one clone, and fewer hydration markers.\n *\n * A component inlines when its shape keeps the result equivalent:\n *\n * - It is declared once at the top level of the module, with a capitalized\n * name, as a function declaration or a `const` bound to a function. A\n * tag of an alias, like `const Separator = SeparatorRoot`, is renamed to\n * the component first. See `renameAliasTags`.\n * - It takes no parameter, or one identifier that is only read as `props.name`,\n * or spread onto an element as `{...props}`.\n * - Its body is statements followed by one final `return` of JSX, or an arrow\n * function whose body is JSX.\n * - It does not use `this`, `arguments`, `new.target`, or `super`.\n *\n * A call site inlines when it passes plain attributes: no spread and no\n * namespaced attribute. A `ref` moves to the element the component forwards\n * `props.ref` to. See `refValue`.\n *\n * # How props keep their meaning\n *\n * Solid passes a dynamic prop as a getter, so every read of `props.name`\n * evaluates the attribute's expression again. Inlining replaces each read\n * with the expression itself, which does the same.\n *\n * A static prop, such as an identifier or a function, is evaluated once when\n * the component is created. Its expression is substituted directly when that\n * gives the same value, such as a literal or a binding nothing reassigns, or\n * when the prop is read exactly once. Otherwise its value is stored in a\n * `const` before the component body runs.\n *\n * # Where a component body can go\n *\n * A component whose body is only JSX inlines anywhere JSX can go.\n *\n * Statements, and stored props, have to run where the component would have\n * been created. Solid runs a component untracked, so the statements move into\n * the function whose returned JSX holds the call, when that function also\n * runs untracked:\n *\n * - a component;\n * - the child callback of `<For>` or `<Repeat>`, which runs once per item\n * under its own owner;\n * - the child callback of `<Show>` or `<Match>` that takes the value, which\n * runs once each time the condition turns true;\n * - the callback given to `render`, which runs once under its root.\n *\n * The call has to be in that returned JSX with only intrinsic elements and\n * fragments around it, so it is created exactly once each time that function\n * runs.\n *\n * A context provider is a component, so statements do not move out of it,\n * and `useContext` still runs under it. The exception is a provider whose\n * subtree only runs visible code. Statements move out through it, and each\n * `useContext` of its context in a copy becomes its value. See `provider.ts`.\n *\n * The props can also be read through `merge()` and `omit()` views declared\n * in the component. Each call site knows which props it passes, so a read\n * of a view resolves to a prop, a literal default, or `undefined`, and a\n * spread of a view becomes the attributes it holds.\n *\n * # Accepted differences\n *\n * - A prop that is a function and is called as `props.name()` runs with\n * `this` set to its own receiver instead of the props object.\n * - Statements moved into the host run before the host's JSX is created,\n * instead of while it is created. The order of `onSettled` and effect\n * registration across siblings can change.\n */\nimport MagicString from 'magic-string';\nimport type {\n ArrayExpressionElement,\n ArrowFunctionExpression,\n CallExpression,\n Expression,\n Function as FunctionNode,\n JSXAttribute,\n JSXChild,\n JSXElement,\n JSXExpressionContainer,\n JSXFragment,\n JSXSpreadAttribute,\n MemberExpression,\n Node,\n ObjectPropertyKind,\n ReturnStatement,\n Statement,\n VariableDeclarator,\n} from 'oxc-parser';\nimport {\n forEachChild,\n isFunctionNode,\n isInsignificant,\n isIntrinsicTag,\n isJSXChild,\n isPrimary,\n unwrap,\n} from './ast';\nimport type { PassContext, ResolvedOptions } from './context';\nimport { getText, isConstantDeclaration, recordSkip, solidExport } from './context';\nimport type { Piece } from './jsx';\nimport type { ClosedOptions, Provider } from './provider';\nimport {\n contextBinding,\n contextReads,\n findProviders,\n isClosed,\n solidCallee,\n stableValueText,\n} from './provider';\nimport { keptPiece, replacedPiece, splicePiece, writePieces } from './jsx';\nimport type { Binding, Scope } from './scope';\nimport { isWithinScope, lookup, scopeAt } from './scope';\nimport { copySize } from './copy-size';\nimport { SizeEstimator } from './size';\nimport { evaluate, literalText } from './value';\n\ntype ComponentFunction = FunctionNode | ArrowFunctionExpression;\n\ninterface ReadCount {\n /** Whether the read can run more than once per component instance. */\n readonly repeated: boolean;\n}\n\ninterface PropRead extends ReadCount {\n readonly member: MemberExpression;\n readonly name: string;\n}\n\n/**\n * One source of a `merge()` or `omit()` view: the props, or an object of\n * literal defaults, with the keys an `omit()` hides from it.\n */\ninterface ViewSource {\n /** The default of each key, as literal text, or `undefined` for the props. */\n readonly defaults: ReadonlyMap<string, string> | undefined;\n readonly hidden: ReadonlySet<string>;\n}\n\n/** A props object made with `merge()` and `omit()`, in source order. */\ninterface View {\n readonly sources: readonly ViewSource[];\n}\n\ninterface ViewRead extends PropRead {\n readonly view: View;\n}\n\ninterface ResolvedSpread {\n readonly spread: ViewSpread;\n /** Each key and its default text, or `undefined` when the props hold it. */\n readonly keys: ReadonlyMap<string, string | undefined>;\n}\n\ninterface ResolvedViews {\n /** Reads of the props, including view reads the props answer. */\n readonly propReads: readonly PropRead[];\n /** View reads a default or nothing answers, and their text. */\n readonly texts: ReadonlyMap<Node, string>;\n readonly spreads: readonly ResolvedSpread[];\n}\n\ninterface ViewSpread extends ReadCount {\n readonly attribute: JSXSpreadAttribute;\n readonly element: JSXElement;\n readonly view: View;\n}\n\ninterface OuterReference {\n readonly name: string;\n readonly binding: Binding | undefined;\n}\n\ninterface Component {\n readonly binding: Binding;\n readonly fn: ComponentFunction;\n /** The statement that declares the component, when it can be removed. */\n readonly declaration: Node | undefined;\n readonly statements: readonly Statement[];\n readonly root: JSXElement | JSXFragment;\n readonly props: readonly PropRead[];\n /** The props parameter, when there is one. */\n readonly param: Binding | undefined;\n /** Reads of a `merge()` or `omit()` view, which a call site resolves. */\n readonly viewReads: readonly ViewRead[];\n /** Spreads of a view onto an element, which become the attributes it holds. */\n readonly viewSpreads: readonly ViewSpread[];\n /** The declarations of the views, which a copy drops. */\n readonly viewDeclarations: readonly Statement[];\n /** Bindings declared inside the component, which get fresh names in every copy. */\n readonly locals: readonly Binding[];\n /** References to bindings outside the component, which must mean the same at the call site. */\n readonly outer: readonly OuterReference[];\n}\n\ninterface CallSite {\n readonly component: Component;\n readonly element: JSXElement;\n}\n\n/** A copy of a component, ready to replace a call site. */\ninterface PreparedSite {\n readonly element: JSXElement;\n /** Where the statements go, when there are any. */\n readonly host: { fn: Node; host: Host } | undefined;\n readonly statements: string[];\n readonly root: string;\n}\n\nfunction isWithin(node: Node, container: Node): boolean {\n return node.start >= container.start && node.end <= container.end;\n}\n\n/**\n * Orders call sites so every call inside a component's body comes before\n * the calls to that component, and every call nested inside another call's\n * element comes before that call. An outer call copies the current text of\n * the calls inside it, so they must be done first.\n */\nfunction inBodyOrder(sites: readonly CallSite[]): CallSite[] {\n const pending = [...sites];\n const ordered: CallSite[] = [];\n while (pending.length > 0) {\n const ready: CallSite[] = [];\n for (const site of pending) {\n if (!hasPendingDependency(pending, site)) {\n ready.push(site);\n }\n }\n // A cycle cannot happen, since a component that renders itself is not\n // inlined, but falling back to the original order keeps this finite.\n const next = ready.length > 0 ? ready : pending;\n for (const site of next) {\n ordered.push(site);\n pending.splice(pending.indexOf(site), 1);\n }\n }\n return ordered;\n}\n\n/**\n * Where a component's statements go.\n */\ntype Host =\n | { readonly kind: 'return'; readonly statement: ReturnStatement }\n | { readonly kind: 'arrow'; readonly body: Expression };\n\n/**\n * How one prop is read in a copy of the component.\n */\ntype PropValue =\n /** Replaced with an expression at every read. */\n | { readonly kind: 'expression'; readonly text: string; readonly primary: boolean }\n /** JSX, spliced in place when read as a JSX child. */\n | { readonly kind: 'jsx'; readonly text: string; readonly primary: boolean }\n /** JSX children, spliced in place when read as a JSX child. */\n | {\n readonly kind: 'children';\n readonly children: readonly JSXChild[];\n readonly text: string;\n readonly primary: boolean;\n };\n\nconst UNDEFINED: PropValue = { kind: 'expression', text: 'void 0', primary: false };\n\n/** The function a copy is wrapped in when it is measured. See `copy-size.ts`. */\nconst COPY_WRAPPER = 'function SoSize$$(';\n\n/** Whether code has a JSX tag named `name`. */\nfunction hasTag(code: string, name: string): boolean {\n return new RegExp(`<${name.replaceAll('$', String.raw`\\$`)}[\\\\s/>]`).test(code);\n}\n\nfunction isCapitalized(name: string): boolean {\n return /^[A-Z]/.test(name);\n}\n\nfunction isReservedPropName(name: string): boolean {\n return name === '__proto__' || Object.hasOwn(Object.prototype, name);\n}\n\n/**\n * Whether `node` uses what its enclosing function provides: `this`,\n * `arguments`, `super`, `new.target`, `await`, or `yield`. Moving such code\n * into another function would change what it refers to.\n */\nexport function usesFunctionContext(context: PassContext, node: Node): boolean {\n let found = false;\n const visit = (current: Node): void => {\n if (found) {\n return;\n }\n switch (current.type) {\n case 'ThisExpression':\n case 'Super':\n case 'AwaitExpression':\n case 'YieldExpression':\n found = true;\n return;\n case 'MetaProperty':\n found = current.meta.name === 'new';\n return;\n case 'Identifier':\n // `arguments` and a direct `eval` read the function they run in.\n found =\n (current.name === 'arguments' || current.name === 'eval') &&\n context.scopes.references.has(current) &&\n context.scopes.references.get(current) === undefined;\n break;\n // These have their own `this`, `arguments`, and `new.target`.\n case 'FunctionDeclaration':\n case 'FunctionExpression':\n case 'ClassDeclaration':\n case 'ClassExpression':\n return;\n default:\n forEachChild(current, visit);\n }\n };\n forEachChild(node, visit);\n return found;\n}\n\n/**\n * Whether `node` contains a `return` that belongs to the function being searched.\n */\nfunction containsReturn(node: Node): boolean {\n let found = false;\n const visit = (current: Node): void => {\n if (found || isFunctionNode(current)) {\n return;\n }\n if (current.type === 'ReturnStatement') {\n found = true;\n return;\n }\n forEachChild(current, visit);\n };\n visit(node);\n return found;\n}\n\n/**\n * Collects the nodes an assignment target writes through: an identifier, or\n * the root of a member chain, like `cache` in `cache.items[0] = x`. A root\n * that is not a name, like a call, is collected as it is.\n */\nfunction collectWriteRoots(target: Node, roots: Node[]): void {\n switch (target.type) {\n case 'MemberExpression':\n collectWriteRoots(target.object, roots);\n break;\n case 'ParenthesizedExpression':\n case 'TSAsExpression':\n case 'TSSatisfiesExpression':\n case 'TSNonNullExpression':\n case 'TSTypeAssertion':\n collectWriteRoots(target.expression, roots);\n break;\n case 'ObjectPattern':\n for (const property of target.properties) {\n collectWriteRoots(\n property.type === 'RestElement' ? property.argument : property.value,\n roots,\n );\n }\n break;\n case 'ArrayPattern':\n for (const element of target.elements) {\n if (element) {\n collectWriteRoots(element, roots);\n }\n }\n break;\n case 'AssignmentPattern':\n collectWriteRoots(target.left, roots);\n break;\n case 'RestElement':\n collectWriteRoots(target.argument, roots);\n break;\n default:\n roots.push(target);\n break;\n }\n}\n\n/**\n * Whether Solid would pass an attribute expression as a getter. The JSX\n * transform wraps any expression that reads a member or calls a function.\n */\nfunction isDynamic(node: Node): boolean {\n let found = false;\n const visit = (current: Node): void => {\n if (found) {\n return;\n }\n switch (current.type) {\n case 'CallExpression':\n case 'NewExpression':\n case 'MemberExpression':\n case 'TaggedTemplateExpression':\n case 'ChainExpression':\n case 'JSXElement':\n case 'JSXFragment':\n found = true;\n break;\n case 'ArrowFunctionExpression':\n case 'FunctionExpression':\n break;\n default:\n forEachChild(current, visit);\n }\n };\n visit(node);\n return found;\n}\n\n/**\n * Whether any expression short of a sequence can replace `node` without\n * parentheses, because its slot is a whole expression of its own.\n */\nfunction acceptsAnyExpression(context: PassContext, node: Node): boolean {\n const parent = context.parents.get(node);\n if (!parent) {\n return false;\n }\n switch (parent.type) {\n case 'JSXExpressionContainer':\n case 'JSXSpreadAttribute':\n case 'SpreadElement':\n case 'ArrayExpression':\n case 'TemplateLiteral':\n case 'ReturnStatement':\n return true;\n case 'CallExpression':\n case 'NewExpression':\n return parent.callee !== node;\n case 'VariableDeclarator':\n return parent.init === node;\n case 'AssignmentExpression':\n return parent.right === node;\n case 'Property':\n return parent.value === node && !parent.shorthand;\n default:\n return false;\n }\n}\n\n/**\n * The function a top-level binding declares, if it declares one.\n */\nfunction findComponentFunction(\n binding: Binding,\n options: ResolvedOptions,\n): ComponentFunction | undefined {\n const { declaration } = binding;\n if (binding.kind === 'function' && declaration.type === 'FunctionDeclaration') {\n return declaration;\n }\n if (\n isConstantDeclaration(binding, options) &&\n declaration.type === 'VariableDeclarator' &&\n declaration.id === binding.identifier &&\n declaration.init\n ) {\n const init = unwrap(declaration.init);\n if (init.type === 'ArrowFunctionExpression' || init.type === 'FunctionExpression') {\n return init;\n }\n }\n return undefined;\n}\n\n/**\n * The attributes of a call site by name, or `undefined` when one cannot be inlined.\n */\nfunction getAttributes(\n context: PassContext,\n element: JSXElement,\n): Map<string, JSXAttribute> | undefined {\n const attributes = new Map<string, JSXAttribute>();\n for (const attribute of element.openingElement.attributes) {\n // A spread can supply any prop, and a namespaced attribute is something\n // the JSX transform handles on its own.\n if (\n attribute.type !== 'JSXAttribute' ||\n attribute.name.type !== 'JSXIdentifier' ||\n (attribute.name.name === 'ref' && !isForwardableRef(context, attribute)) ||\n attributes.has(attribute.name.name)\n ) {\n return undefined;\n }\n attributes.set(attribute.name.name, attribute);\n }\n return attributes;\n}\n\n/**\n * Whether a top-level statement declares only constants made of literals,\n * like `const ROWS = [{ name: 'a' }]`. An export keeps its `export`, since\n * the fold pass treats an exported list differently.\n */\nfunction isDataDeclaration(statement: Node): boolean {\n const declaration =\n statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;\n return (\n declaration?.type === 'VariableDeclaration' &&\n !declaration.declare &&\n (declaration.kind === 'const' || declaration.kind === 'var') &&\n areDataDeclarators(declaration.declarations)\n );\n}\n\n/** Whether an expression is a literal, or an array or object literal of them. */\nfunction isDataLiteral(node: Expression): boolean {\n switch (node.type) {\n case 'Literal':\n return !('regex' in node);\n case 'TemplateLiteral':\n return node.expressions.length === 0;\n case 'UnaryExpression':\n return node.operator === '-' && node.argument.type === 'Literal';\n case 'ParenthesizedExpression':\n case 'TSAsExpression':\n case 'TSSatisfiesExpression':\n return isDataLiteral(node.expression);\n case 'ArrayExpression':\n return areDataElements(node.elements);\n case 'ObjectExpression':\n return areDataProperties(node.properties);\n default:\n return false;\n }\n}\n\nfunction isMemberRead(read: ReadCount): read is PropRead {\n return 'member' in read;\n}\n\n/**\n * Whether a `ref` at a call site can move to the element the component\n * forwards it to: a name, a function, or an array of them. A name is\n * assigned the element, so it has to stay the name itself. Anything else\n * would be evaluated when the element is made, outside the `untrack` the\n * component's `ref` runs it in.\n *\n * Inside an array, `void 0` and `untrack(() => target)` count too. Solid\n * skips an empty entry of a ref array, and evaluates the whole `ref`\n * untracked. They come from a component that forwards `props.ref` in an\n * array, once a call site that passes no `ref` is inlined.\n */\nfunction isForwardableRef(context: PassContext, attribute: JSXAttribute): boolean {\n const { value } = attribute;\n if (value?.type !== 'JSXExpressionContainer' || value.expression.type === 'JSXEmptyExpression') {\n return false;\n }\n const isTarget = (node: Expression, inArray: boolean): boolean => {\n const inner = unwrap(node);\n if (inner.type === 'ArrayExpression') {\n for (const element of inner.elements) {\n if (element === null || element.type === 'SpreadElement' || !isTarget(element, true)) {\n return false;\n }\n }\n return true;\n }\n if (inArray && isVoidZero(inner)) {\n return true;\n }\n if (inArray && inner.type === 'CallExpression' && solidCallee(context, inner) === 'untrack') {\n const callback = inner.arguments.at(0);\n return (\n inner.arguments.length === 1 &&\n callback?.type === 'ArrowFunctionExpression' &&\n callback.expression &&\n callback.params.length === 0 &&\n callback.body.type !== 'BlockStatement' &&\n isTarget(callback.body, true)\n );\n }\n return (\n inner.type === 'Identifier' ||\n inner.type === 'ArrowFunctionExpression' ||\n inner.type === 'FunctionExpression'\n );\n };\n return isTarget(value.expression, false);\n}\n\n/** Whether an expression is `void 0`. */\nfunction isVoidZero(node: Expression): boolean {\n return (\n node.type === 'UnaryExpression' &&\n node.operator === 'void' &&\n node.argument.type === 'Literal' &&\n node.argument.value === 0\n );\n}\n\n/**\n * Why `getAttributes` turns down a call site, for the report.\n */\nfunction callSiteReason(element: JSXElement): string {\n const names = new Set<string>();\n for (const attribute of element.openingElement.attributes) {\n if (attribute.type !== 'JSXAttribute') {\n return 'call-spread';\n }\n if (attribute.name.type !== 'JSXIdentifier') {\n return 'call-namespace';\n }\n if (attribute.name.name === 'ref') {\n return 'call-ref';\n }\n if (names.has(attribute.name.name)) {\n break;\n }\n names.add(attribute.name.name);\n }\n return 'call-duplicate';\n}\n\nfunction isAssignmentTarget(context: PassContext, node: Node): boolean {\n const parent = context.parents.get(node);\n if (!parent) {\n return false;\n }\n switch (parent.type) {\n case 'AssignmentExpression':\n return parent.left === node;\n case 'UpdateExpression':\n return true;\n case 'UnaryExpression':\n return parent.operator === 'delete';\n case 'ForInStatement':\n case 'ForOfStatement':\n return parent.left === node;\n case 'ArrayPattern':\n case 'ObjectPattern':\n case 'RestElement':\n return true;\n case 'AssignmentPattern':\n return parent.left === node;\n case 'Property':\n return parent.value === node && context.parents.get(parent)?.type === 'ObjectPattern';\n case 'ParenthesizedExpression':\n return isAssignmentTarget(context, parent);\n default:\n return false;\n }\n}\n\nclass Inliner {\n changed = false;\n\n private readonly hosts = new Map<Node, { host: Host; texts: string[] }>();\n\n /**\n * Providers whose subtree is closed, so statements can move out through\n * them. Each maps to the text its reads become, or `undefined` when a\n * binding that never changes is read at each site.\n */\n private readonly transparent = new Map<JSXElement, { provider: Provider; text?: string }>();\n\n constructor(private readonly context: PassContext) {}\n\n /** Why the last component or call site was turned down, for the report. */\n private reason = '';\n\n /**\n * Whether a binding holds a component made by Solid's `lazy`, for the\n * report. In a chunk, `lazy` can be a local declaration under another\n * name, so a call given a function with a dynamic import counts too.\n */\n private isLazy(binding: Binding): boolean {\n const { declaration } = binding;\n const init =\n declaration.type === 'VariableDeclarator' && declaration.init\n ? unwrap(declaration.init)\n : undefined;\n if (init?.type !== 'CallExpression' || init.callee.type !== 'Identifier') {\n return false;\n }\n const callee = this.context.scopes.references.get(init.callee);\n if (callee && solidExport(callee, this.context.options) === 'lazy') {\n return true;\n }\n const loader = init.arguments.at(0);\n if (!loader || !isFunctionNode(loader)) {\n return false;\n }\n let imports = false;\n const visit = (node: Node): void => {\n if (node.type === 'ImportExpression') {\n imports = true;\n }\n if (!imports) {\n forEachChild(node, visit);\n }\n };\n visit(loader);\n return imports;\n }\n\n // ---------------------------------------------------------------------------\n // Components\n // ---------------------------------------------------------------------------\n\n private getScope(fn: ComponentFunction): Scope | undefined {\n return this.context.scopes.scopes.get(fn);\n }\n\n /**\n * The statement to remove once nothing uses the component, or `undefined`\n * when the declaration has to stay, like an exported one.\n */\n private removableDeclaration(binding: Binding): Node | undefined {\n const { declaration } = binding;\n if (declaration.type === 'FunctionDeclaration') {\n return this.context.parents.get(declaration)?.type === 'Program' ? declaration : undefined;\n }\n const statement = this.context.parents.get(declaration);\n if (\n statement?.type === 'VariableDeclaration' &&\n statement.declarations.length === 1 &&\n this.context.parents.get(statement)?.type === 'Program'\n ) {\n return statement;\n }\n return undefined;\n }\n\n /**\n * Whether statements assign, update, or delete through a binding declared\n * outside `scope`, or through a global. Writes inside nested functions\n * count too, since a function can run right away, like a memo's.\n */\n private writesOutside(statements: readonly Statement[], scope: Scope): boolean {\n const roots: Node[] = [];\n const visit = (node: Node): void => {\n if (node.type === 'AssignmentExpression') {\n collectWriteRoots(node.left, roots);\n } else if (node.type === 'UpdateExpression') {\n collectWriteRoots(node.argument, roots);\n } else if (node.type === 'UnaryExpression' && node.operator === 'delete') {\n collectWriteRoots(node.argument, roots);\n }\n forEachChild(node, visit);\n };\n for (const statement of statements) {\n visit(statement);\n }\n for (const root of roots) {\n if (root.type !== 'Identifier') {\n return true;\n }\n const target = this.context.scopes.references.get(root);\n if (!target || !isWithinScope(target.scope, scope)) {\n return true;\n }\n }\n return false;\n }\n\n private analyzeComponent(binding: Binding): Component | undefined {\n if (!isCapitalized(binding.name)) {\n return undefined;\n }\n if (binding.mutated) {\n this.reason = 'component-mutated';\n return undefined;\n }\n const fn = findComponentFunction(binding, this.context.options);\n if (!fn?.body) {\n this.reason = this.isLazy(binding) ? 'lazy' : 'not-a-function';\n return undefined;\n }\n if (fn.async || fn.generator) {\n this.reason = 'component-async';\n return undefined;\n }\n if (fn.params.length > 1) {\n this.reason = 'component-params';\n return undefined;\n }\n const scope = this.getScope(fn);\n if (!scope) {\n this.reason = 'not-a-function';\n return undefined;\n }\n\n // The body: statements, then one `return` of JSX.\n let statements: Statement[] = [];\n let root: Expression;\n if (fn.body.type === 'BlockStatement') {\n const body = fn.body.body;\n const last = body.at(-1);\n if (last?.type !== 'ReturnStatement' || !last.argument) {\n this.reason = 'component-body';\n return undefined;\n }\n const rest: Statement[] = [];\n for (const statement of body.slice(0, -1)) {\n // A directive like `\"use strict\"` changes how the body runs.\n // TypeScript's AST gives every expression statement a `directive`\n // key, which is `null` unless the statement is a directive.\n const directive = 'directive' in statement ? statement.directive : null;\n if (typeof directive === 'string') {\n this.reason = 'component-directive';\n return undefined;\n }\n if (containsReturn(statement)) {\n this.reason = 'component-return';\n return undefined;\n }\n rest.push(statement);\n }\n statements = rest;\n root = unwrap(last.argument);\n } else {\n root = unwrap(fn.body);\n }\n if (root.type !== 'JSXElement' && root.type !== 'JSXFragment') {\n this.reason = 'component-body';\n return undefined;\n }\n if (usesFunctionContext(this.context, fn.body)) {\n this.reason = 'component-this';\n return undefined;\n }\n // A copy's statements run before any JSX of the function they move into,\n // so JSX there could read a value they write later than it should.\n if (this.writesOutside(statements, scope)) {\n this.reason = 'component-write';\n return undefined;\n }\n\n // The parameter is only read as `props.name`.\n const param = fn.params.at(0);\n let paramBinding: Binding | undefined;\n if (param) {\n if (param.type !== 'Identifier') {\n this.reason = 'component-params';\n return undefined;\n }\n paramBinding = scope.bindings.get(param.name);\n if (!paramBinding || paramBinding.mutated) {\n this.reason = 'props-use';\n return undefined;\n }\n }\n const views = this.analyzeViews(fn, scope, statements, paramBinding);\n if (!views) {\n this.reason = 'view-use';\n return undefined;\n }\n const props: PropRead[] = [];\n for (const reference of paramBinding?.references ?? []) {\n if (views.arguments.has(reference)) {\n continue;\n }\n const read = this.propRead(fn, reference);\n if (!read) {\n this.reason = 'props-use';\n return undefined;\n }\n props.push(read);\n }\n const kept: typeof statements = [];\n for (const statement of statements) {\n if (!views.declarations.includes(statement)) {\n kept.push(statement);\n }\n }\n statements = kept;\n\n const locals: Binding[] = [];\n const seen = new Set<Scope>();\n for (const inner of this.context.scopes.scopes.values()) {\n if (seen.has(inner) || !isWithinScope(inner, scope)) {\n continue;\n }\n seen.add(inner);\n for (const local of inner.bindings.values()) {\n // A view's declaration and every use of it are replaced in a copy.\n if (local !== paramBinding && !views.bindings.has(local)) {\n locals.push(local);\n }\n }\n }\n\n const outer: OuterReference[] = [];\n for (const [reference, target] of this.context.scopes.references) {\n if (reference.start < fn.start || reference.end > fn.end) {\n continue;\n }\n // A component that renders itself cannot be inlined into itself.\n if (target === binding) {\n this.reason = 'component-recursive';\n return undefined;\n }\n if (target && isWithinScope(target.scope, scope)) {\n continue;\n }\n if (reference.type === 'Identifier' || reference.type === 'JSXIdentifier') {\n outer.push({ name: reference.name, binding: target });\n }\n }\n\n return {\n binding,\n fn,\n declaration: this.removableDeclaration(binding),\n statements,\n root,\n props,\n param: paramBinding,\n viewReads: views.reads,\n viewSpreads: views.spreads,\n viewDeclarations: views.declarations,\n locals,\n outer,\n };\n }\n\n private propRead(fn: ComponentFunction, reference: Node): PropRead | undefined {\n const member = this.context.parents.get(reference);\n if (member?.type !== 'MemberExpression' || member.object !== reference) {\n return undefined;\n }\n let name: string;\n if (!member.computed && member.property.type === 'Identifier') {\n name = member.property.name;\n } else if (\n member.computed &&\n member.property.type === 'Literal' &&\n typeof member.property.value === 'string'\n ) {\n name = member.property.value;\n } else {\n return undefined;\n }\n if (isReservedPropName(name) || isAssignmentTarget(this.context, member)) {\n return undefined;\n }\n return { member, name, repeated: this.isRepeated(fn, member) };\n }\n\n /**\n * Whether `node` can run more than once each time `fn` runs.\n */\n private isRepeated(fn: ComponentFunction, node: Node): boolean {\n let current = this.context.parents.get(node);\n while (current && current !== fn) {\n if (\n isFunctionNode(current) ||\n current.type === 'ForStatement' ||\n current.type === 'ForInStatement' ||\n current.type === 'ForOfStatement' ||\n current.type === 'WhileStatement' ||\n current.type === 'DoWhileStatement'\n ) {\n return true;\n }\n current = this.context.parents.get(current);\n }\n return false;\n }\n\n /**\n * Finds the `merge()` and `omit()` views of the props declared in a\n * component's statements, and how each is used. A view can only be read\n * as `view.name`, spread onto an element, or passed to another view.\n * `undefined` when a view is used any other way.\n */\n private analyzeViews(\n fn: ComponentFunction,\n scope: Scope,\n statements: readonly Statement[],\n param: Binding | undefined,\n ):\n | {\n bindings: Set<Binding>;\n arguments: Set<Node>;\n declarations: Statement[];\n reads: ViewRead[];\n spreads: ViewSpread[];\n }\n | undefined {\n const views = new Map<Binding, View>();\n const args = new Set<Node>();\n const declarations: Statement[] = [];\n for (const statement of statements) {\n const declarator =\n statement.type === 'VariableDeclaration' ? statement.declarations.at(0) : undefined;\n if (\n statement.type !== 'VariableDeclaration' ||\n statement.kind !== 'const' ||\n statement.declarations.length !== 1 ||\n declarator?.id.type !== 'Identifier' ||\n !declarator.init\n ) {\n continue;\n }\n const init = unwrap(declarator.init);\n const callee = init.type === 'CallExpression' ? solidCallee(this.context, init) : undefined;\n if (init.type !== 'CallExpression' || (callee !== 'merge' && callee !== 'omit')) {\n continue;\n }\n const view = this.resolveView(callee, init, param, views, args);\n if (view === null) {\n continue;\n }\n const binding = scope.bindings.get(declarator.id.name);\n if (!view || !binding || binding.mutated) {\n return undefined;\n }\n views.set(binding, view);\n declarations.push(statement);\n }\n\n const reads: ViewRead[] = [];\n const spreads: ViewSpread[] = [];\n // `{...props}` spreads every prop, like a view of the props with nothing hidden.\n const whole: View = { sources: [{ defaults: undefined, hidden: new Set() }] };\n for (const reference of param?.references ?? []) {\n const spread = this.spreadOnElement(reference);\n if (spread) {\n args.add(reference);\n spreads.push({\n attribute: spread.attribute,\n element: spread.element,\n view: whole,\n repeated: this.isRepeated(fn, spread.attribute),\n });\n }\n }\n for (const [binding, view] of views) {\n for (const reference of binding.references) {\n if (args.has(reference)) {\n continue;\n }\n const spread = this.spreadOnElement(reference);\n if (spread) {\n spreads.push({\n attribute: spread.attribute,\n element: spread.element,\n view,\n repeated: this.isRepeated(fn, spread.attribute),\n });\n continue;\n }\n const read = this.propRead(fn, reference);\n if (!read) {\n return undefined;\n }\n reads.push({ ...read, view });\n }\n }\n return { bindings: new Set(views.keys()), arguments: args, declarations, reads, spreads };\n }\n\n /** The spread a reference is the whole argument of, and the element it is on. */\n private spreadOnElement(\n reference: Node,\n ): { attribute: JSXSpreadAttribute; element: JSXElement } | undefined {\n const parent = this.context.parents.get(reference);\n const opening = parent ? this.context.parents.get(parent) : undefined;\n const element = opening ? this.context.parents.get(opening) : undefined;\n return parent?.type === 'JSXSpreadAttribute' &&\n opening?.type === 'JSXOpeningElement' &&\n element?.type === 'JSXElement'\n ? { attribute: parent, element }\n : undefined;\n }\n\n /**\n * The view a `merge()` or `omit()` call makes. `null` when it does not\n * take the props or another view, and `undefined` when it does but its\n * other arguments are not literal.\n */\n private resolveView(\n callee: 'merge' | 'omit',\n call: CallExpression,\n param: Binding | undefined,\n views: ReadonlyMap<Binding, View>,\n args: Set<Node>,\n ): View | null | undefined {\n const resolveSources = (argument: Node): readonly ViewSource[] | undefined => {\n if (argument.type === 'CallExpression') {\n const nested = solidCallee(this.context, argument);\n if (nested !== 'merge' && nested !== 'omit') {\n return undefined;\n }\n return this.resolveView(nested, argument, param, views, args)?.sources;\n }\n if (argument.type !== 'Identifier') {\n return undefined;\n }\n const binding = this.context.scopes.references.get(argument);\n if (binding && binding === param) {\n return [{ defaults: undefined, hidden: new Set() }];\n }\n return binding ? views.get(binding)?.sources : undefined;\n };\n let involved = false;\n for (const argument of call.arguments) {\n if (argument.type !== 'SpreadElement' && resolveSources(unwrap(argument)) !== undefined) {\n involved = true;\n break;\n }\n }\n if (!involved) {\n return null;\n }\n\n if (callee === 'omit') {\n const first = call.arguments.at(0);\n const keys = call.arguments.slice(1);\n if (first === undefined || first.type === 'SpreadElement') {\n return undefined;\n }\n const target = unwrap(first);\n const base = resolveSources(target);\n const hidden: string[] = [];\n for (const key of keys) {\n if (key.type !== 'Literal' || typeof key.value !== 'string') {\n return undefined;\n }\n hidden.push(key.value);\n }\n if (!base) {\n return undefined;\n }\n args.add(target);\n const hiddenSources: ViewSource[] = [];\n for (const source of base) {\n hiddenSources.push({\n defaults: source.defaults,\n hidden: new Set([...source.hidden, ...hidden]),\n });\n }\n return { sources: hiddenSources };\n }\n\n const sources: ViewSource[] = [];\n for (const argument of call.arguments) {\n if (argument.type === 'SpreadElement') {\n return undefined;\n }\n const inner = unwrap(argument);\n const existing = resolveSources(inner);\n if (existing) {\n args.add(inner);\n sources.push(...existing);\n continue;\n }\n if (inner.type !== 'ObjectExpression') {\n return undefined;\n }\n const defaults = new Map<string, string>();\n for (const property of inner.properties) {\n if (property.type !== 'Property' || property.kind !== 'init' || property.computed) {\n return undefined;\n }\n let key: string;\n if (property.key.type === 'Identifier') {\n key = property.key.name;\n } else if (property.key.type === 'Literal' && typeof property.key.value === 'string') {\n key = property.key.value;\n } else {\n return undefined;\n }\n const value = evaluate(property.value, () => undefined);\n const text = value ? literalText(value.value) : undefined;\n if (text === undefined || isReservedPropName(key)) {\n return undefined;\n }\n defaults.set(key, text);\n }\n sources.push({ defaults, hidden: new Set() });\n }\n return { sources };\n }\n\n // ---------------------------------------------------------------------------\n // Call sites\n // ---------------------------------------------------------------------------\n\n /**\n * Whether a function is a component, which Solid runs untracked. Only a\n * capitalized function bound at its declaration counts.\n */\n private isComponentFunction(fn: Node): boolean {\n if (fn.type === 'FunctionDeclaration') {\n return !fn.async && !fn.generator && fn.id !== null && isCapitalized(fn.id.name);\n }\n if (fn.type !== 'FunctionExpression' && fn.type !== 'ArrowFunctionExpression') {\n return false;\n }\n if (fn.async || fn.generator) {\n return false;\n }\n let parent = this.context.parents.get(fn);\n while (parent?.type === 'ParenthesizedExpression') {\n parent = this.context.parents.get(parent);\n }\n return (\n parent?.type === 'VariableDeclarator' &&\n parent.id.type === 'Identifier' &&\n isCapitalized(parent.id.name)\n );\n }\n\n /**\n * Whether a function runs untracked, once each time the JSX it returns is\n * created, so it can take a component's statements. See \"Where a component\n * body can go\" above.\n */\n private isHostFunction(fn: Node): boolean {\n if (this.isComponentFunction(fn)) {\n return true;\n }\n if (\n (fn.type !== 'FunctionExpression' && fn.type !== 'ArrowFunctionExpression') ||\n fn.async ||\n fn.generator\n ) {\n return false;\n }\n let node: Node = fn;\n let parent = this.context.parents.get(node);\n while (parent?.type === 'ParenthesizedExpression') {\n node = parent;\n parent = this.context.parents.get(node);\n }\n // `render(() => <App />, element)` calls it once under a new root.\n if (parent?.type === 'CallExpression') {\n return parent.arguments.at(0) === node && this.solidCallee(parent.callee) === 'render';\n }\n // A built-in's only child.\n const element =\n parent?.type === 'JSXExpressionContainer' ? this.context.parents.get(parent) : undefined;\n if (element?.type !== 'JSXElement') {\n return false;\n }\n const significant = getSignificantChildren(element.children);\n if (significant.length !== 1 || significant.at(0) !== parent) {\n return false;\n }\n switch (this.solidCallee(element.openingElement.name)) {\n case 'For':\n case 'Repeat':\n return true;\n // These only call a callback that takes the value. One without a parameter is a child to insert.\n case 'Show':\n case 'Match':\n return fn.params.length > 0;\n default:\n return false;\n }\n }\n\n /** The Solid export a callee or tag refers to. */\n private solidCallee(name: Node): string | undefined {\n if (name.type !== 'Identifier' && name.type !== 'JSXIdentifier') {\n return undefined;\n }\n const { references } = this.context.scopes;\n if (!references.has(name)) {\n return undefined;\n }\n const binding = references.get(name);\n return binding ? solidExport(binding, this.context.options) : undefined;\n }\n\n /**\n * Where the statements of a component created at `element` can go: the\n * returned JSX of a component, with only intrinsic elements, fragments,\n * and closed providers between it and the call.\n */\n private findHost(element: JSXElement): { fn: Node; host: Host } | undefined {\n let node: Node = element;\n for (;;) {\n const parent = this.context.parents.get(node);\n if (!parent) {\n return undefined;\n }\n if (parent.type === 'JSXElement') {\n const { name } = parent.openingElement;\n const passable =\n this.assumedHosts?.has(parent) === true ||\n (name.type === 'JSXIdentifier' &&\n (isIntrinsicTag(name.name) || this.transparent.has(parent)));\n if (!passable) {\n return undefined;\n }\n const child = node;\n if (!hasChild(parent.children, child)) {\n return undefined;\n }\n } else if (parent.type === 'ReturnStatement') {\n const list = this.context.parents.get(parent);\n if (list?.type !== 'BlockStatement' && list?.type !== 'SwitchCase') {\n return undefined;\n }\n let fn = this.context.parents.get(list);\n while (fn && !isFunctionNode(fn)) {\n fn = this.context.parents.get(fn);\n }\n if (!fn || !this.isHostFunction(fn)) {\n return undefined;\n }\n return { fn, host: { kind: 'return', statement: parent } };\n } else if (parent.type === 'ArrowFunctionExpression') {\n if (parent.body !== node || !this.isHostFunction(parent)) {\n return undefined;\n }\n return { fn: parent, host: { kind: 'arrow', body: parent.body } };\n } else if (parent.type !== 'JSXFragment' && parent.type !== 'ParenthesizedExpression') {\n return undefined;\n }\n node = parent;\n }\n }\n\n private childrenValue(\n element: JSXElement,\n reads: readonly ReadCount[],\n fresh: (base: string) => string,\n snapshots: string[],\n ): PropValue | undefined {\n const { children } = element;\n if (hasSpreadChild(children)) {\n return undefined;\n }\n const significant = getSignificantChildren(children);\n const only = significant.at(0);\n if (only === undefined) {\n return { kind: 'children', children: [], text: 'void 0', primary: false };\n }\n let text: string;\n let primary = true;\n if (significant.length > 1 || only.type === 'JSXText') {\n text = `<>${this.context.s.slice(element.openingElement.end, element.closingElement?.start ?? element.end)}</>`;\n } else if (only.type === 'JSXExpressionContainer') {\n if (only.expression.type === 'JSXEmptyExpression') {\n return undefined;\n }\n // A single expression is passed like an attribute value, such as a\n // render function that has to stay one function.\n const value = this.expressionValue(only.expression, 'children', reads, fresh, snapshots);\n if (value.kind !== 'expression' || value.text !== getText(this.context, only.expression)) {\n return value;\n }\n text = value.text;\n primary = value.primary;\n } else {\n text = getText(this.context, only);\n }\n return { kind: 'children', children, text, primary };\n }\n\n /**\n * How a `ref` from the call site reads in a copy. Solid passes a `ref` to\n * a component as a function that sets the call site's ref to the element\n * it is given. The component applies it with its own `ref`, which runs\n * while the element is made, so the call site's `ref` can move to that\n * element. Every read has to be the whole `ref` of an element or of\n * another component, or a key of a spread, which becomes one.\n */\n private refValue(\n attribute: JSXAttribute | undefined,\n reads: readonly ReadCount[],\n ): PropValue | undefined {\n const value = attribute?.value;\n if (\n value?.type !== 'JSXExpressionContainer' ||\n value.expression.type === 'JSXEmptyExpression'\n ) {\n return undefined;\n }\n for (const read of reads) {\n if (!isMemberRead(read)) {\n continue;\n }\n const container = this.context.parents.get(read.member);\n const owner = container ? this.context.parents.get(container) : undefined;\n if (\n container?.type !== 'JSXExpressionContainer' ||\n owner?.type !== 'JSXAttribute' ||\n owner.name.type !== 'JSXIdentifier' ||\n owner.name.name !== 'ref'\n ) {\n return undefined;\n }\n }\n return { kind: 'expression', text: getText(this.context, value.expression), primary: true };\n }\n\n /**\n * How a prop reads in a copy of the component, and the `const` that stores\n * it first when the value has to be evaluated once.\n */\n private propValue(\n attribute: JSXAttribute | undefined,\n reads: readonly ReadCount[],\n fresh: (base: string) => string,\n snapshots: string[],\n ): PropValue | undefined {\n if (!attribute) {\n return UNDEFINED;\n }\n const { value } = attribute;\n if (value === null) {\n return { kind: 'expression', text: 'true', primary: true };\n }\n switch (value.type) {\n case 'Literal':\n // An attribute string can hold HTML entities, which are not decoded here.\n if (value.value.includes('&')) {\n return undefined;\n }\n return { kind: 'expression', text: JSON.stringify(value.value), primary: true };\n case 'JSXElement':\n case 'JSXFragment':\n return { kind: 'jsx', text: getText(this.context, value), primary: true };\n default:\n break;\n }\n const { expression } = value;\n if (expression.type === 'JSXEmptyExpression') {\n return undefined;\n }\n const name = attribute.name.type === 'JSXIdentifier' ? attribute.name.name : 'prop';\n return this.expressionValue(expression, name, reads, fresh, snapshots);\n }\n\n /**\n * How an expression passed as a prop reads in a copy of the component.\n */\n private expressionValue(\n expression: Expression,\n name: string,\n reads: readonly ReadCount[],\n fresh: (base: string) => string,\n snapshots: string[],\n ): PropValue {\n const text = getText(this.context, expression);\n const inner = unwrap(expression);\n if (inner.type === 'JSXElement' || inner.type === 'JSXFragment') {\n return { kind: 'jsx', text, primary: true };\n }\n const primary = isPrimary(expression);\n if (isDynamic(expression) || this.isStable(inner)) {\n return { kind: 'expression', text, primary };\n }\n // A static value is evaluated once. One read that runs once keeps that.\n const read = reads.at(0);\n if (reads.length === 1 && read && !read.repeated) {\n return { kind: 'expression', text, primary };\n }\n const local = fresh(name);\n snapshots.push(`const ${local} = ${text};`);\n return { kind: 'expression', text: local, primary: true };\n }\n\n /**\n * Whether evaluating `node` again gives the same value.\n */\n private isStable(node: Node): boolean {\n switch (node.type) {\n case 'Literal':\n // A regular expression literal creates a new object each time.\n return !('regex' in node);\n case 'TemplateLiteral':\n return node.expressions.length === 0;\n case 'UnaryExpression':\n return node.operator === '-' && node.argument.type === 'Literal';\n case 'Identifier': {\n const { references } = this.context.scopes;\n if (!references.has(node)) {\n return false;\n }\n const binding = references.get(node);\n if (!binding) {\n return node.name === 'undefined' || node.name === 'NaN' || node.name === 'Infinity';\n }\n return !binding.mutated;\n }\n default:\n return false;\n }\n }\n\n /** The names `freshName` takes from while copies are only measured. */\n private scratchNames: Set<string> | undefined;\n\n /**\n * Component calls measured as if they were inlined already, so the calls\n * in their children can hoist statements through them.\n */\n private assumedHosts: ReadonlySet<JSXElement> | undefined;\n\n private freshName(name: string): string {\n const names = this.scratchNames ?? this.context.scopes.names;\n // A name a copy gave out before, like `theme$1`, is renamed from `theme` again.\n const base = name.replace(/\\$\\d+$/, '');\n let index = 1;\n let fresh = `${base}$${String(index)}`;\n while (names.has(fresh)) {\n index += 1;\n fresh = `${base}$${String(index)}`;\n }\n names.add(fresh);\n return fresh;\n }\n\n /**\n * The copy of `component` that would replace `element`, or `undefined`\n * when it cannot be inlined there. Nothing is written until `commit`.\n */\n private prepare(component: Component, element: JSXElement): PreparedSite | undefined {\n const attributes = getAttributes(this.context, element);\n if (!attributes) {\n this.reason = callSiteReason(element);\n return undefined;\n }\n const hasChildren = getSignificantChildren(element.children).length > 0;\n if (hasChildren && attributes.has('children')) {\n this.reason = 'call-children';\n return undefined;\n }\n for (const attribute of attributes.values()) {\n if (attribute.value && usesFunctionContext(this.context, attribute.value)) {\n this.reason = 'call-this';\n return undefined;\n }\n }\n for (const child of element.children) {\n if (usesFunctionContext(this.context, child)) {\n this.reason = 'call-this';\n return undefined;\n }\n }\n\n // What each view read and spread resolves to at this call site.\n const views = this.resolveViews(component, attributes, hasChildren);\n if (!views) {\n this.reason = 'view-conflict';\n return undefined;\n }\n\n // What each prop reads as.\n const snapshots: string[] = [];\n const fresh = (base: string): string => this.freshName(base);\n const readsByName = new Map<string, ReadCount[]>();\n const count = (name: string, read: ReadCount): void => {\n const reads = readsByName.get(name) ?? [];\n reads.push(read);\n readsByName.set(name, reads);\n };\n for (const read of views.propReads) {\n count(read.name, read);\n }\n for (const spread of views.spreads) {\n for (const [key, source] of spread.keys) {\n if (source === undefined) {\n count(key, spread.spread);\n }\n }\n }\n const values = new Map<string, PropValue>();\n for (const [name, reads] of readsByName) {\n let value: PropValue | undefined;\n if (name === 'children' && !attributes.has('children')) {\n value = this.childrenValue(element, reads, fresh, snapshots);\n } else if (name === 'ref' && attributes.has('ref')) {\n value = this.refValue(attributes.get('ref'), reads);\n } else {\n value = this.propValue(attributes.get(name), reads, fresh, snapshots);\n }\n if (!value) {\n // A `ref` is turned down when the component uses it other than as a `ref`.\n this.reason = name === 'ref' && attributes.has('ref') ? 'ref-use' : 'prop-value';\n return undefined;\n }\n values.set(name, value);\n }\n\n // The component's outer references must mean the same at the call site.\n const scope = scopeAt(this.context.scopes, this.context.parents, element);\n for (const reference of component.outer) {\n if (lookup(scope, reference.name) !== reference.binding) {\n this.reason = 'shadowed';\n return undefined;\n }\n }\n\n const hoisted = component.statements.length > 0 || snapshots.length > 0;\n const host = hoisted ? this.findHost(element) : undefined;\n if (hoisted && !host) {\n this.reason = 'no-host';\n return undefined;\n }\n\n const contextTexts = this.contextTexts(component, element);\n if (!contextTexts) {\n this.reason = 'context-value';\n return undefined;\n }\n\n // Build the copy on the original code, so this pass's other edits stay out of it.\n const copy = new MagicString(this.context.code);\n this.renameLocals(copy, component, fresh);\n this.substituteProps(copy, views.propReads, values);\n this.substituteViews(copy, component, element, views, values);\n for (const [read, text] of contextTexts) {\n copy.overwrite(read.start, read.end, text);\n }\n\n const statements = [...snapshots];\n const first = component.statements.at(0);\n const last = component.statements.at(-1);\n if (first && last) {\n // The last statement can rely on a line break that it loses here.\n const text = copy.slice(first.start, last.end);\n statements.push(text.endsWith(';') ? text : `${text};`);\n }\n return {\n element,\n host,\n statements,\n root: copy.slice(component.root.start, component.root.end),\n };\n }\n\n /** Queues statements for a host. Each `return` gets its own, since their scopes can differ. */\n private addToHost(found: { fn: Node; host: Host }, texts: readonly string[]): void {\n const key = found.host.kind === 'return' ? found.host.statement : found.fn;\n const entry = this.hosts.get(key) ?? { host: found.host, texts: [] };\n entry.texts.push(...texts);\n this.hosts.set(key, entry);\n }\n\n /**\n * Writes a prepared copy over its call site.\n */\n private commit(site: PreparedSite): void {\n this.context.s.overwrite(site.element.start, site.element.end, site.root);\n if (site.host) {\n this.addToHost(site.host, site.statements);\n }\n }\n\n /**\n * The context reads in a component's copy at `element` that a closed\n * provider above it answers, with the text each becomes. `undefined` when\n * a read cannot take the value there.\n */\n private contextTexts(component: Component, element: JSXElement): Map<Node, string> | undefined {\n const texts = new Map<Node, string>();\n for (const { provider, text } of this.answeringProviders(element)) {\n for (const read of contextReads(this.context, component.fn, provider.context)) {\n const value = text ?? stableValueText(this.context, provider, element);\n if (value === undefined) {\n return undefined;\n }\n texts.set(read, value);\n }\n }\n return texts;\n }\n\n /**\n * The closed providers that answer context reads at `element`. The nearest\n * provider of each context answers its reads, closed or not.\n */\n private answeringProviders(element: JSXElement): { provider: Provider; text?: string }[] {\n const answering: { provider: Provider; text?: string }[] = [];\n const seen = new Set<Binding>();\n for (\n let node = this.context.parents.get(element);\n node;\n node = this.context.parents.get(node)\n ) {\n const target =\n node.type === 'JSXElement'\n ? contextBinding(this.context, node.openingElement.name)\n : undefined;\n if (node.type !== 'JSXElement' || !target || seen.has(target)) {\n continue;\n }\n seen.add(target);\n const entry = this.transparent.get(node);\n if (entry) {\n answering.push(entry);\n }\n }\n return answering;\n }\n\n /**\n * Finds the providers statements can move out through: a subtree with\n * only visible code, where every component is one this pass can inline.\n * A value that is not a literal or a binding that never changes is\n * stored in a `const` of the host first, so every read gets the same one.\n */\n private findTransparentProviders(\n components: readonly Component[],\n sites: readonly CallSite[],\n ): Component[] {\n const byBinding = new Map<Binding, Component>();\n for (const component of components) {\n byBinding.set(component.binding, component);\n }\n // Whether a subtree under `provider` only runs visible code, where each\n // component is one this pass inlines and is visible too.\n const closedUnder = (provider: Provider): ((node: Node) => boolean) => {\n const closedComponents = new Map<Component, boolean>();\n const options: ClosedOptions = {\n component: (element) => {\n const binding = this.context.scopes.references.get(element.openingElement.name);\n const component = binding ? byBinding.get(binding) : undefined;\n if (!component) {\n return false;\n }\n const known = closedComponents.get(component);\n if (known !== undefined) {\n return known;\n }\n // A component that renders itself is never closed.\n closedComponents.set(component, false);\n const closed = isClosed(this.context, component.fn, {\n ...options,\n props: component.param,\n });\n closedComponents.set(component, closed);\n return closed;\n },\n contextValue: (target) => (target === provider.context ? provider.value : undefined),\n };\n return (node) => isClosed(this.context, node, options);\n };\n\n const changed: Component[] = [];\n for (const provider of findProviders(this.context)) {\n const { element } = provider;\n const inside = hasSiteInside(sites, element);\n if (!inside) {\n continue;\n }\n const isClosedNode = closedUnder(provider);\n let closed = true;\n for (const child of element.children) {\n if (!isClosedNode(child)) {\n closed = false;\n break;\n }\n }\n if (!closed) {\n continue;\n }\n if (stableValueText(this.context, provider, element) !== undefined) {\n this.transparent.set(element, { provider });\n continue;\n }\n const host = this.findHost(element);\n if (!host) {\n continue;\n }\n const name = this.freshName(\n `${provider.context.name.charAt(0).toLowerCase()}${provider.context.name.slice(1)}Value`,\n );\n this.addToHost(host, [`const ${name} = ${getText(this.context, provider.value)};`]);\n this.context.s.overwrite(provider.value.start, provider.value.end, name);\n this.transparent.set(element, { provider, text: name });\n this.changed = true;\n for (const component of components) {\n if (isWithin(element, component.fn)) {\n changed.push(component);\n }\n }\n }\n return changed;\n }\n\n /**\n * Resolves each view read and spread of a component at a call site. A\n * read becomes a read of the props, or the text of a default. A spread\n * becomes the keys it holds, in the order `merge()` gives them, and its\n * `children` become the element's children. `undefined` when a spread\n * repeats an attribute, or holds `children` for an element that has some.\n */\n private resolveViews(\n component: Component,\n attributes: ReadonlyMap<string, JSXAttribute>,\n hasChildren: boolean,\n ): ResolvedViews | undefined {\n const has = (key: string): boolean =>\n attributes.has(key) || (key === 'children' && hasChildren);\n // The last source that has the key answers, even when its value is `undefined`.\n const resolve = (view: View, key: string): string | undefined => {\n for (let index = view.sources.length - 1; index >= 0; index -= 1) {\n const source = view.sources.at(index);\n if (!source || source.hidden.has(key)) {\n continue;\n }\n const text = source.defaults?.get(key);\n if (text !== undefined) {\n return text;\n }\n if (!source.defaults && has(key)) {\n return undefined;\n }\n }\n return 'void 0';\n };\n\n const propReads: PropRead[] = [...component.props];\n const texts = new Map<Node, string>();\n for (const read of component.viewReads) {\n const text = resolve(read.view, read.name);\n if (text === undefined) {\n propReads.push(read);\n } else {\n texts.set(read.member, text);\n }\n }\n\n const callKeys = [...attributes.keys()];\n if (hasChildren && !attributes.has('children')) {\n callKeys.push('children');\n }\n const spreads: ResolvedSpread[] = [];\n const taken = new Map<JSXElement, Set<string>>();\n for (const spread of component.viewSpreads) {\n // A key sits where the last source that carries it puts it.\n const order: string[] = [];\n for (const source of spread.view.sources) {\n const keys = source.defaults ? [...source.defaults.keys()] : callKeys;\n for (const key of keys) {\n if (source.hidden.has(key)) {\n continue;\n }\n const index = order.indexOf(key);\n if (index !== -1) {\n order.splice(index, 1);\n }\n order.push(key);\n }\n }\n let names = taken.get(spread.element);\n if (!names) {\n names = new Set();\n for (const attribute of spread.element.openingElement.attributes) {\n if (attribute.type === 'JSXAttribute') {\n names.add(\n attribute.name.type === 'JSXIdentifier'\n ? attribute.name.name\n : getText(this.context, attribute.name),\n );\n }\n }\n taken.set(spread.element, names);\n }\n const keys = new Map<string, string | undefined>();\n for (const key of order) {\n // Children become the element's children, so it must have none of its own.\n const fits =\n key === 'children'\n ? spread.element.openingElement.selfClosing\n : /^[A-Za-z_$][\\w$-]*$/.test(key);\n if (!fits || names.has(key)) {\n return undefined;\n }\n names.add(key);\n keys.set(key, resolve(spread.view, key));\n }\n spreads.push({ spread, keys });\n }\n return { propReads, texts, spreads };\n }\n\n /**\n * Writes the resolved view reads and spreads into a copy, and drops the\n * view declarations.\n */\n private substituteViews(\n copy: MagicString,\n component: Component,\n element: JSXElement,\n views: ResolvedViews,\n values: ReadonlyMap<string, PropValue>,\n ): void {\n for (const [member, text] of views.texts) {\n const bare = text !== 'void 0' || acceptsAnyExpression(this.context, member);\n copy.overwrite(member.start, member.end, bare ? text : `(${text})`);\n }\n for (const { spread, keys } of views.spreads) {\n const parts: string[] = [];\n let children: string | undefined;\n for (const [key, text] of keys) {\n const value = values.get(key);\n if (key === 'children') {\n children = this.spreadChildren(element, text, value);\n } else {\n parts.push(`${key}={${text ?? value?.text ?? 'void 0'}}`);\n }\n }\n const { attribute } = spread;\n if (parts.length === 0) {\n copy.remove(attribute.start, attribute.end);\n } else {\n copy.overwrite(attribute.start, attribute.end, parts.join(' '));\n }\n if (children !== undefined) {\n const opening = spread.element.openingElement;\n // Read the tag from the copy, which holds the renamed locals.\n const tag = copy.slice(opening.name.start, opening.name.end);\n const close = this.context.code.lastIndexOf('/>', opening.end);\n copy.overwrite(close, opening.end, `>${children}</${tag}>`);\n }\n }\n for (const declaration of component.viewDeclarations) {\n copy.remove(declaration.start, declaration.end);\n }\n }\n\n /**\n * The JSX children a spread's `children` becomes: the call site's own\n * children, or the value of a single expression or default.\n */\n private spreadChildren(\n element: JSXElement,\n text: string | undefined,\n value: PropValue | undefined,\n ): string | undefined {\n if (text !== undefined) {\n return text === 'void 0' ? undefined : `{${text}}`;\n }\n if (!value) {\n return undefined;\n }\n if (value.kind === 'children' && element.closingElement) {\n return this.context.s.slice(element.openingElement.end, element.closingElement.start);\n }\n return `{${value.text}}`;\n }\n\n private renameLocals(\n copy: MagicString,\n component: Component,\n fresh: (base: string) => string,\n ): void {\n for (const local of component.locals) {\n const name = fresh(local.name);\n for (const node of [local.identifier, ...local.references]) {\n const parent = this.context.parents.get(node);\n // `{ a }` and `{ a = 1 }` are shorthand for `{ a: a }` and `{ a: a = 1 }`.\n const shorthand =\n (parent?.type === 'Property' && parent.shorthand) ||\n (parent?.type === 'AssignmentPattern' &&\n this.context.parents.get(parent)?.type === 'Property' &&\n parent.left === node &&\n this.isShorthandValue(parent));\n copy.overwrite(node.start, node.end, shorthand ? `${local.name}: ${name}` : name);\n }\n }\n }\n\n private isShorthandValue(node: Node): boolean {\n const parent = this.context.parents.get(node);\n return parent?.type === 'Property' && parent.shorthand && parent.value === node;\n }\n\n private substituteProps(\n copy: MagicString,\n reads: readonly PropRead[],\n values: ReadonlyMap<string, PropValue>,\n ): void {\n // Reads that are a JSX child on their own, like `{props.children}`,\n // splice their JSX in place. They are grouped by parent so neighboring\n // text stays apart.\n const spliced = new Map<JSXElement | JSXFragment, Map<JSXChild, Piece>>();\n for (const read of reads) {\n const value = values.get(read.name);\n if (!value) {\n continue;\n }\n const container = this.context.parents.get(read.member);\n const parent = container ? this.context.parents.get(container) : undefined;\n if (\n value.kind !== 'expression' &&\n container?.type === 'JSXExpressionContainer' &&\n (parent?.type === 'JSXElement' || parent?.type === 'JSXFragment') &&\n isJSXChild(container, this.context.parents)\n ) {\n const pieces = spliced.get(parent) ?? new Map<JSXChild, Piece>();\n pieces.set(container, this.splicedPiece(container, value));\n spliced.set(parent, pieces);\n continue;\n }\n const bare = value.primary || acceptsAnyExpression(this.context, read.member);\n copy.overwrite(read.member.start, read.member.end, bare ? value.text : `(${value.text})`);\n }\n for (const [parent, pieces] of spliced) {\n const children: Piece[] = [];\n for (const child of parent.children) {\n children.push(pieces.get(child) ?? keptPiece(child));\n }\n writePieces(copy, children);\n }\n }\n\n private splicedPiece(container: JSXExpressionContainer, value: PropValue): Piece {\n if (value.kind === 'children') {\n return splicePiece(this.context.s, container, value.children);\n }\n return replacedPiece(container, value.text);\n }\n\n // ---------------------------------------------------------------------------\n // Pass\n // ---------------------------------------------------------------------------\n\n /**\n * The components worth inlining in this pass: those whose copies are no\n * larger than what they replace, which is their calls, and their\n * declaration when nothing else uses it.\n */\n private worthwhileComponents(\n sites: readonly CallSite[],\n postponed: ReadonlySet<Component>,\n otherUses: ReadonlyMap<Component, number>,\n ): Set<Component> {\n const byComponent = new Map<Component, JSXElement[]>();\n for (const site of sites) {\n if (!postponed.has(site.component)) {\n const elements = byComponent.get(site.component) ?? [];\n elements.push(site.element);\n byComponent.set(site.component, elements);\n }\n }\n const result = new Set<Component>();\n const { alwaysInline, alwaysInlineComponents } = this.context.options;\n for (const component of byComponent.keys()) {\n if (alwaysInline || alwaysInlineComponents.has(component.binding.name)) {\n result.add(component);\n byComponent.delete(component);\n }\n }\n if (byComponent.size === 0) {\n return result;\n }\n // The copies made here are only measured, so their fresh names are not kept.\n this.scratchNames = new Set(this.context.scopes.names);\n try {\n const copiesOf = new Map<Component, Map<JSXElement, PreparedSite | undefined>>();\n for (const [component, elements] of byComponent) {\n const prepared = new Map<JSXElement, PreparedSite | undefined>();\n for (const element of elements) {\n prepared.set(element, this.prepare(component, element));\n }\n copiesOf.set(component, prepared);\n }\n this.sites = sites;\n this.otherUses = otherUses;\n this.blocked = new Map();\n for (const [inner, byElement] of copiesOf) {\n for (const [element, copy] of byElement) {\n const outer = copy ? undefined : findOuterComponent(this.components, inner, element);\n if (outer) {\n const list = this.blocked.get(outer) ?? [];\n list.push(inner);\n this.blocked.set(outer, list);\n }\n }\n }\n for (const [component, byElement] of copiesOf) {\n const copies = collectPrepared(byElement.values());\n if (copies.length === 0) {\n continue;\n }\n const gain =\n this.inliningGain(component, copies, this.removedShare(component, byElement, otherUses)) +\n this.enabledGain(component, copies, copiesOf, otherUses);\n if (gain >= 0) {\n result.add(component);\n }\n }\n } finally {\n this.scratchNames = undefined;\n this.otherUses = undefined;\n this.blocked = new Map();\n }\n return result;\n }\n\n /**\n * How much of a component's declaration inlining every call removes: all\n * of it when nothing else uses it, the module's share when other modules\n * use it too, and none when a call cannot be inlined or anything else\n * keeps it.\n */\n private removedShare(\n component: Component,\n copies: ReadonlyMap<JSXElement, PreparedSite | undefined>,\n otherUses: ReadonlyMap<Component, number>,\n ): number {\n if (\n component.declaration === undefined ||\n otherUses.get(component) !== 0 ||\n hasMissingCopy(copies.values())\n ) {\n return 0;\n }\n const users = this.context.options.sharedComponents.get(component.binding.name) ?? 1;\n return users > 0 ? 1 / users : 0;\n }\n\n /**\n * What inlining `component` saves through the calls in its children that\n * can only be inlined once it is: a component with statements needs an\n * element around its call to hoist them to.\n */\n private enabledGain(\n component: Component,\n copies: readonly PreparedSite[],\n copiesOf: ReadonlyMap<Component, ReadonlyMap<JSXElement, PreparedSite | undefined>>,\n otherUses: ReadonlyMap<Component, number>,\n ): number {\n const elements: JSXElement[] = [];\n for (const copy of copies) {\n elements.push(copy.element);\n }\n this.assumedHosts = new Set(elements);\n let gain = 0;\n try {\n for (const [other, byElement] of copiesOf) {\n if (other === component) {\n continue;\n }\n const enabled = new Map(byElement);\n let changed = false;\n for (const [element, copy] of byElement) {\n if (!copy && isWithinAny(element, elements)) {\n const next = this.prepare(other, element);\n enabled.set(element, next);\n changed ||= next !== undefined;\n }\n }\n if (!changed) {\n continue;\n }\n const now = collectPrepared(byElement.values());\n const then = collectPrepared(enabled.values());\n const before = now.length > 0 ? Math.max(0, this.inliningGain(other, now, 0)) : 0;\n const after = this.inliningGain(other, then, this.removedShare(other, enabled, otherUses));\n gain += Math.max(0, after - before);\n }\n } finally {\n this.assumedHosts = undefined;\n }\n return gain;\n }\n\n /**\n * How much smaller the copies are than the calls they replace, once\n * lowered, counting the `share` of the declaration they remove.\n * Negative when they are larger.\n */\n private inliningGain(\n component: Component,\n copies: readonly PreparedSite[],\n share: number,\n ): number {\n const estimator = this.estimator();\n let calls =\n share > 0 && component.declaration ? share * estimator.node(component.declaration) : 0;\n let inlined = 0;\n const blocked = this.blockedWithin(component);\n // The blocked components that some copy still calls once measured.\n const kept = new Set<Component>();\n for (const copy of copies) {\n const inTemplate = this.sitsInTemplate(copy.element);\n calls += estimator.jsx(copy.element, inTemplate);\n const measured = { code: '' };\n inlined += copySize(\n this.context.filename,\n this.sizeHeader(),\n copy,\n inTemplate,\n this.context.options,\n blocked.length > 0 ? { declarations: this.createDeclarations(blocked), inline } : undefined,\n measured,\n );\n const body = measured.code.slice(measured.code.lastIndexOf(COPY_WRAPPER));\n for (const inner of blocked) {\n if (hasTag(body, inner.binding.name)) {\n kept.add(inner);\n }\n }\n }\n // A blocked component that inlines into every copy goes away with this\n // one, when nothing else uses it.\n if (share > 0) {\n for (const inner of blocked) {\n if (!kept.has(inner) && inner.declaration && this.onlyUsedWithin(inner, component)) {\n calls += share * estimator.node(inner.declaration);\n }\n }\n }\n return calls - inlined;\n }\n\n /**\n * The components whose calls in a component's body cannot be inlined\n * there, but may be in a copy, once the call site resolves the props\n * they are given. Those they call in turn count too.\n */\n private blockedWithin(component: Component): Component[] {\n const found: Component[] = [];\n const pending = [component];\n for (let outer = pending.pop(); outer; outer = pending.pop()) {\n for (const inner of this.blocked.get(outer) ?? []) {\n if (inner !== component && !found.includes(inner)) {\n found.push(inner);\n pending.push(inner);\n }\n }\n }\n return found;\n }\n\n /** The declarations of components, for a copy measured on its own. */\n private createDeclarations(components: readonly Component[]): string {\n const texts: string[] = [];\n for (const component of components) {\n const statement = this.topLevelStatement(component.binding.declaration);\n if (statement) {\n texts.push(getText(this.context, statement));\n }\n }\n return texts.join('\\n');\n }\n\n /** Whether every call of `inner` is in `outer`, and nothing else uses it. */\n private onlyUsedWithin(inner: Component, outer: Component): boolean {\n if (this.otherUses?.get(inner) !== 0) {\n return false;\n }\n for (const site of this.sites) {\n if (site.component === inner && !isWithin(site.element, outer.fn)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Whether an element sits directly in an intrinsic element, whose\n * template its copy joins. A provider this pass makes transparent is\n * removed once its consumers are inlined, so the element above it counts.\n */\n private sitsInTemplate(element: JSXElement): boolean {\n let parent = this.context.parents.get(element);\n while (parent?.type === 'JSXElement' && this.transparent.has(parent)) {\n parent = this.context.parents.get(parent);\n }\n if (parent?.type === 'JSXElement' && this.assumedHosts?.has(parent) === true) {\n return true;\n }\n return (\n parent?.type === 'JSXElement' &&\n parent.openingElement.name.type === 'JSXIdentifier' &&\n isIntrinsicTag(parent.openingElement.name.name)\n );\n }\n\n private sizeEstimator: SizeEstimator | undefined;\n\n private estimator(): SizeEstimator {\n this.sizeEstimator ??= new SizeEstimator(this.context.code);\n return this.sizeEstimator;\n }\n\n private header: string | undefined;\n\n /** The components of the module this pass can inline. */\n private readonly components: Component[] = [];\n\n /** The call sites of those components. */\n private sites: readonly CallSite[] = [];\n\n /** How many times each component is used other than as a call, while estimating. */\n private otherUses: ReadonlyMap<Component, number> | undefined;\n\n /**\n * The components called in each component's body where the call cannot\n * be inlined as it is, while estimating.\n */\n private blocked = new Map<Component, Component[]>();\n\n /** The top-level statement a node is part of, without an `export`. */\n private topLevelStatement(node: Node): Node | undefined {\n let current = node;\n for (let parent = this.context.parents.get(current); parent;) {\n if (parent.type === 'Program') {\n return current.type === 'ExportNamedDeclaration' ||\n current.type === 'ExportDefaultDeclaration'\n ? (current.declaration ?? undefined)\n : current;\n }\n current = parent;\n parent = this.context.parents.get(current);\n }\n return undefined;\n }\n\n /**\n * What a copy measured on its own needs to know: the module's imports,\n * and the names that alias Solid's exports.\n */\n private sizeHeader(): string {\n if (this.header === undefined) {\n // The imports, and the top-level constants made of literals, so a copy\n // folds with the values its call site passes by name, as it will once inlined.\n const imports: string[] = [];\n for (const statement of this.context.program.body) {\n if (statement.type === 'ImportDeclaration' || isDataDeclaration(statement)) {\n imports.push(this.context.code.slice(statement.start, statement.end));\n }\n }\n const aliases = [...this.context.options.builtInAliases.keys()];\n if (aliases.length > 0) {\n imports.push(`var ${aliases.join(', ')};`);\n }\n this.header = imports.join('\\n');\n }\n return this.header;\n }\n\n /**\n * The component a top-level alias like `const Button = ButtonRoot` names,\n * or `undefined` when the binding is not one.\n */\n private aliasTarget(binding: Binding): Binding | undefined {\n const { declaration } = binding;\n if (\n !isCapitalized(binding.name) ||\n !isConstantDeclaration(binding, this.context.options) ||\n declaration.type !== 'VariableDeclarator' ||\n declaration.id !== binding.identifier ||\n !declaration.init\n ) {\n return undefined;\n }\n const init = unwrap(declaration.init);\n if (init.type !== 'Identifier') {\n return undefined;\n }\n const target = this.context.scopes.references.get(init);\n return target &&\n target !== binding &&\n target.scope.parent === undefined &&\n !target.mutated &&\n isCapitalized(target.name)\n ? target\n : undefined;\n }\n\n /**\n * The parts of a compound component like Kobalte's\n * `const Dialog = Object.assign(DialogRoot, { Trigger: DialogTrigger })`,\n * or `undefined` when the binding is not one. `<Dialog>` is `<DialogRoot>`,\n * since `Object.assign` returns its first argument, and `<Dialog.Trigger>`\n * is `<DialogTrigger>` while nothing writes to a member of either.\n */\n private compoundTarget(\n binding: Binding,\n ): { root: Binding; parts: ReadonlyMap<string, Binding> } | undefined {\n const { declaration } = binding;\n if (\n !isCapitalized(binding.name) ||\n !isConstantDeclaration(binding, this.context.options) ||\n declaration.type !== 'VariableDeclarator' ||\n declaration.id !== binding.identifier ||\n !declaration.init\n ) {\n return undefined;\n }\n const init = unwrap(declaration.init);\n if (\n init.type !== 'CallExpression' ||\n init.optional ||\n init.arguments.length !== 2 ||\n !this.isObjectAssign(init.callee)\n ) {\n return undefined;\n }\n const [first, second] = init.arguments;\n if (first.type !== 'Identifier' || second.type !== 'ObjectExpression') {\n return undefined;\n }\n const root = this.topLevelComponent(first);\n if (!root || root === binding || this.hasMemberWrite(binding) || this.hasMemberWrite(root)) {\n return undefined;\n }\n const parts = new Map<string, Binding>();\n for (const property of second.properties) {\n if (\n property.type !== 'Property' ||\n property.kind !== 'init' ||\n property.computed ||\n property.method ||\n property.value.type !== 'Identifier'\n ) {\n return undefined;\n }\n const key = propertyKeyName(property.key);\n if (key === undefined) {\n return undefined;\n }\n // Only parts with a capitalized name can be tags. The others stay reads.\n const part = this.topLevelComponent(property.value);\n if (part) {\n parts.set(key, part);\n }\n }\n return { root, parts };\n }\n\n /** Whether `callee` is the global `Object.assign`. */\n private isObjectAssign(callee: Node): boolean {\n return (\n callee.type === 'MemberExpression' &&\n !callee.computed &&\n !callee.optional &&\n callee.object.type === 'Identifier' &&\n callee.object.name === 'Object' &&\n !this.context.scopes.references.get(callee.object) &&\n callee.property.type === 'Identifier' &&\n callee.property.name === 'assign'\n );\n }\n\n /** The top-level binding with a capitalized name that `reference` reads, when nothing reassigns it. */\n private topLevelComponent(reference: Node): Binding | undefined {\n const target = this.context.scopes.references.get(reference);\n return target &&\n target.scope.parent === undefined &&\n !target.mutated &&\n isCapitalized(target.name)\n ? target\n : undefined;\n }\n\n /** Whether anything assigns to, updates, or deletes a member of the binding. */\n private hasMemberWrite(binding: Binding): boolean {\n for (const reference of binding.references) {\n const member = this.context.parents.get(reference);\n if (member?.type !== 'MemberExpression' || member.object !== reference) {\n continue;\n }\n const use = this.context.parents.get(member);\n if (\n (use?.type === 'AssignmentExpression' && use.left === member) ||\n use?.type === 'UpdateExpression' ||\n (use?.type === 'UnaryExpression' && use.operator === 'delete')\n ) {\n return true;\n }\n }\n return false;\n }\n\n /** Whether the code reads a member of the binding, like `DialogRoot.Trigger`. */\n private hasMemberRead(binding: Binding): boolean {\n for (const reference of binding.references) {\n const member = this.context.parents.get(reference);\n if (\n (member?.type === 'MemberExpression' || member?.type === 'JSXMemberExpression') &&\n member.object === reference\n ) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * The statement of an alias nothing uses that `reference` is the value\n * of, like `const Separator = SeparatorRoot` once its tags are renamed.\n * It does not keep the component, and goes away with it. A compound\n * component counts too, when its tags are renamed and nothing reads the\n * members `Object.assign` gave its root.\n */\n private unusedAlias(reference: Node): Node | undefined {\n let declarator = this.context.parents.get(reference);\n if (declarator?.type === 'Property') {\n declarator = this.context.parents.get(declarator);\n }\n if (declarator?.type === 'ObjectExpression' || declarator?.type === 'CallExpression') {\n const call =\n declarator.type === 'CallExpression' ? declarator : this.context.parents.get(declarator);\n declarator = call ? this.context.parents.get(call) : undefined;\n }\n if (declarator?.type !== 'VariableDeclarator' || declarator.id.type !== 'Identifier') {\n return undefined;\n }\n const alias = this.context.scopes.root.bindings.get(declarator.id.name);\n if (alias?.declaration !== declarator || alias.references.length > 0) {\n return undefined;\n }\n const compound = this.compoundTarget(alias);\n if (this.aliasTarget(alias) === undefined && (!compound || this.hasMemberRead(compound.root))) {\n return undefined;\n }\n const statement = this.context.parents.get(declarator);\n return statement?.type === 'VariableDeclaration' &&\n statement.declarations.length === 1 &&\n this.context.parents.get(statement)?.type === 'Program'\n ? statement\n : undefined;\n }\n\n /**\n * Renames each tag of an alias to the component it names, where that name\n * means the same. Libraries often export a component under a second name,\n * like `const Separator = SeparatorRoot`. The next pass inlines the calls.\n */\n private renameAliasTags(): boolean {\n let renamed = false;\n for (const binding of this.context.scopes.root.bindings.values()) {\n const compound = this.compoundTarget(binding);\n const target = this.aliasTarget(binding) ?? compound?.root;\n if (!target) {\n continue;\n }\n for (const reference of binding.references) {\n const parent = this.context.parents.get(reference);\n // `<Dialog.Trigger>` is the part `Object.assign` gave the root.\n let tag: Node = reference;\n let renamedTo = target;\n if (parent?.type === 'JSXMemberExpression' && parent.object === reference) {\n const part = compound?.parts.get(parent.property.name);\n if (!part) {\n continue;\n }\n tag = parent;\n renamedTo = part;\n }\n const element = this.context.parents.get(tag);\n if (\n (element?.type !== 'JSXOpeningElement' && element?.type !== 'JSXClosingElement') ||\n element.name !== tag\n ) {\n continue;\n }\n const scope = scopeAt(this.context.scopes, this.context.parents, reference);\n if (lookup(scope, renamedTo.name) !== renamedTo) {\n continue;\n }\n this.context.s.overwrite(tag.start, tag.end, renamedTo.name);\n renamed = true;\n }\n }\n return renamed;\n }\n\n run(): void {\n // The calls through an alias inline in the next pass, from the renamed tags.\n if (this.renameAliasTags()) {\n this.changed = true;\n return;\n }\n const { components } = this;\n const rejected = new Map<Binding, string>();\n for (const binding of this.context.scopes.root.bindings.values()) {\n this.reason = 'not-a-function';\n const component = this.analyzeComponent(binding);\n if (component) {\n components.push(component);\n } else {\n rejected.set(binding, this.reason);\n }\n }\n // Why each call site that stays a call was not inlined, for the report.\n const siteReasons = new Map<JSXElement, string>();\n if (components.length === 0) {\n this.report(rejected, siteReasons);\n return;\n }\n\n const sites: CallSite[] = [];\n const otherUses = new Map<Component, number>();\n // The aliases nothing uses, which are removed with their component.\n const aliases = new Map<Component, Node[]>();\n for (const component of components) {\n let uses = 0;\n for (const reference of component.binding.references) {\n const parent = this.context.parents.get(reference);\n if (parent?.type === 'JSXClosingElement') {\n continue;\n }\n const element = parent ? this.context.parents.get(parent) : undefined;\n const alias = this.unusedAlias(reference);\n if (parent?.type === 'JSXOpeningElement' && element?.type === 'JSXElement') {\n sites.push({ component, element });\n } else if (alias) {\n aliases.set(component, [...(aliases.get(component) ?? []), alias]);\n } else {\n uses += 1;\n }\n }\n otherUses.set(component, uses);\n }\n\n // Inner call sites first, so an outer one copies their inlined text.\n sites.sort((a, b) => a.element.end - b.element.end);\n const inlined = new Map<Component, JSXElement[]>();\n // A component whose body changed in this pass is copied in the next one,\n // from its new body. A copy made now would miss what was inlined into it.\n const changedBodies = new Set<Component>(this.findTransparentProviders(components, sites));\n const worthwhile = this.worthwhileComponents(sites, changedBodies, otherUses);\n for (const site of inBodyOrder(sites)) {\n const postponed = changedBodies.has(site.component);\n // Each copy is made now, so it takes in the call sites inside it that\n // were inlined before it.\n const copy =\n postponed || !worthwhile.has(site.component)\n ? undefined\n : this.prepare(site.component, site.element);\n const done = copy !== undefined;\n if (copy) {\n this.commit(copy);\n this.changed = true;\n const elements = inlined.get(site.component) ?? [];\n elements.push(site.element);\n inlined.set(site.component, elements);\n } else {\n otherUses.set(site.component, (otherUses.get(site.component) ?? 0) + 1);\n if (this.context.skips && !postponed) {\n siteReasons.set(site.element, this.siteReason(site, worthwhile));\n }\n }\n // A component holding a call that was inlined now, or postponed to the\n // next pass, waits too. A copy made now would copy the call as it is.\n if (done || postponed) {\n for (const component of components) {\n if (isWithin(site.element, component.fn)) {\n changedBodies.add(component);\n }\n }\n }\n }\n\n this.writeHosts();\n this.report(rejected, siteReasons);\n\n // A component nothing uses anymore is removed. A copy made in this pass\n // comes from the original code, so a component used inside a copied\n // component stays until the next pass inlines it there too.\n const copied = [...inlined.keys()];\n for (const [component, elements] of inlined) {\n const insideCopy = isInsideOtherCopy(component, elements, copied);\n if (component.declaration && otherUses.get(component) === 0 && !insideCopy) {\n this.context.s.remove(component.declaration.start, component.declaration.end);\n for (const alias of aliases.get(component) ?? []) {\n this.context.s.remove(alias.start, alias.end);\n }\n }\n }\n }\n\n /**\n * Why a call site of a component was not inlined. A component that is\n * not worth inlining is only turned down for its size when the call site\n * could be inlined.\n */\n private siteReason(site: CallSite, worthwhile: ReadonlySet<Component>): string {\n if (worthwhile.has(site.component)) {\n return this.reason;\n }\n this.scratchNames = new Set(this.context.scopes.names);\n try {\n return this.prepare(site.component, site.element) ? 'size' : this.reason;\n } finally {\n this.scratchNames = undefined;\n }\n }\n\n /**\n * Records each component call that stays a call, and why. Solid's\n * built-ins and context providers are left out. The provider pass\n * reports providers.\n */\n private report(\n rejected: ReadonlyMap<Binding, string>,\n siteReasons: ReadonlyMap<JSXElement, string>,\n ): void {\n if (!this.context.skips) {\n return;\n }\n const visit = (node: Node): void => {\n if (node.type === 'JSXElement') {\n const reason = this.callReason(node, rejected, siteReasons);\n if (reason) {\n recordSkip(this.context, 'inline', reason.reason, reason.name);\n }\n }\n forEachChild(node, visit);\n };\n visit(this.context.program);\n }\n\n private callReason(\n element: JSXElement,\n rejected: ReadonlyMap<Binding, string>,\n siteReasons: ReadonlyMap<JSXElement, string>,\n ): { reason: string; name: string } | undefined {\n const tag = element.openingElement.name;\n if (tag.type === 'JSXMemberExpression') {\n return { reason: 'member-tag', name: getText(this.context, tag) };\n }\n if (tag.type !== 'JSXIdentifier' || !isCapitalized(tag.name)) {\n return undefined;\n }\n const { name } = tag;\n const binding = this.context.scopes.references.get(tag);\n const identity = binding ? solidExport(binding, this.context.options) : name;\n if (\n (identity !== undefined && this.context.options.builtIns.has(identity)) ||\n contextBinding(this.context, tag)\n ) {\n return undefined;\n }\n if (!binding) {\n return { reason: 'global', name };\n }\n if (binding.kind === 'import') {\n // A chunk imports other chunks through placeholders the bundler fills in later.\n const source = (binding.source ?? '').replaceAll(/!~\\{\\w+\\}~/g, '*');\n return { reason: 'imported', name: `${name} (${source})` };\n }\n if (binding.scope.parent !== undefined) {\n return { reason: 'nested', name };\n }\n const reason = rejected.get(binding) ?? siteReasons.get(element);\n return reason === undefined ? undefined : { reason, name };\n }\n\n /**\n * The whitespace before `position` on its line.\n */\n private indentationAt(position: number): string {\n const { code } = this.context;\n const lineStart = code.lastIndexOf('\\n', position - 1) + 1;\n return /^[ \\t]*/.exec(code.slice(lineStart, position))?.[0] ?? '';\n }\n\n private writeHosts(): void {\n for (const { host, texts } of this.hosts.values()) {\n if (host.kind === 'return') {\n const indent = this.indentationAt(host.statement.start);\n let written = '';\n for (const text of texts) {\n written += `${text}\\n${indent}`;\n }\n this.context.s.prependRight(host.statement.start, written);\n } else {\n this.context.s.prependRight(host.body.start, `{ ${texts.join(' ')} return `);\n this.context.s.appendLeft(host.body.end, '; }');\n }\n }\n }\n}\n\n/**\n * Runs the inline pass over a parsed program. Returns whether anything changed.\n */\nexport function inline(context: PassContext): boolean {\n const inliner = new Inliner(context);\n inliner.run();\n return inliner.changed;\n}\n\n/** Whether another pending site must be done before this one. */\nfunction hasPendingDependency(pending: readonly CallSite[], site: CallSite): boolean {\n for (const other of pending) {\n if (\n other !== site &&\n (isWithin(other.element, site.component.fn) || isWithin(other.element, site.element))\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction areDataDeclarators(declarators: readonly VariableDeclarator[]): boolean {\n for (const declarator of declarators) {\n if (\n declarator.id.type !== 'Identifier' ||\n declarator.init === null ||\n !isDataLiteral(declarator.init)\n ) {\n return false;\n }\n }\n return true;\n}\n\nfunction areDataElements(elements: readonly (ArrayExpressionElement | null)[]): boolean {\n for (const element of elements) {\n if (element === null || element.type === 'SpreadElement' || !isDataLiteral(element)) {\n return false;\n }\n }\n return true;\n}\n\nfunction areDataProperties(properties: readonly ObjectPropertyKind[]): boolean {\n for (const property of properties) {\n if (\n property.type !== 'Property' ||\n property.kind !== 'init' ||\n property.method ||\n property.computed ||\n !isDataLiteral(property.value)\n ) {\n return false;\n }\n }\n return true;\n}\n\nfunction getSignificantChildren(children: readonly JSXChild[]): JSXChild[] {\n const significant: JSXChild[] = [];\n for (const child of children) {\n if (!isInsignificant(child)) {\n significant.push(child);\n }\n }\n return significant;\n}\n\nfunction hasSpreadChild(children: readonly JSXChild[]): boolean {\n for (const child of children) {\n if (child.type === 'JSXSpreadChild') {\n return true;\n }\n }\n return false;\n}\n\nfunction hasSiteInside(sites: readonly CallSite[], element: JSXElement): boolean {\n for (const site of sites) {\n if (isWithin(site.element, element) && site.element !== element) {\n return true;\n }\n }\n return false;\n}\n\nfunction findOuterComponent(\n components: readonly Component[],\n inner: Component,\n element: JSXElement,\n): Component | undefined {\n for (const item of components) {\n if (item !== inner && isWithin(element, item.fn)) {\n return item;\n }\n }\n return undefined;\n}\n\nfunction collectPrepared(copies: Iterable<PreparedSite | undefined>): PreparedSite[] {\n const prepared: PreparedSite[] = [];\n for (const copy of copies) {\n if (copy !== undefined) {\n prepared.push(copy);\n }\n }\n return prepared;\n}\n\nfunction hasMissingCopy(copies: Iterable<PreparedSite | undefined>): boolean {\n for (const copy of copies) {\n if (copy === undefined) {\n return true;\n }\n }\n return false;\n}\n\nfunction isWithinAny(element: JSXElement, outers: readonly JSXElement[]): boolean {\n for (const outer of outers) {\n if (isWithin(element, outer)) {\n return true;\n }\n }\n return false;\n}\n\nfunction isInsideOtherCopy(\n component: Component,\n elements: readonly JSXElement[],\n copied: readonly Component[],\n): boolean {\n for (const element of elements) {\n for (const other of copied) {\n if (other !== component && element.start >= other.fn.start && element.end <= other.fn.end) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction hasChild(children: readonly Node[], child: Node): boolean {\n for (const item of children) {\n if (item === child) {\n return true;\n }\n }\n return false;\n}\n\n/** The name a non-computed object key spells, like `Trigger` or `'Trigger'`. */\nfunction propertyKeyName(key: Node): string | undefined {\n if (key.type === 'Identifier') {\n return key.name;\n }\n return key.type === 'Literal' && typeof key.value === 'string' ? key.value : undefined;\n}\n","/**\n * The memo pass: inlines a `createMemo` whose memoization does nothing.\n *\n * A memo does two things for its readers. It runs its computation once and\n * shares the result, and it only notifies them when the result changes. A\n * memo that returns a new object, array, function, or JSX element on every\n * run, or that sets `equals: false`, notifies on every run, so the second\n * part never applies. When such a memo is also read exactly once, the first\n * part does not apply either, and the read can run the computation itself:\n *\n * ```jsx\n * const style = createMemo(() => ({ color: color() }));\n * return <p style={style()} />;\n * ```\n *\n * becomes `<p style={{ color: color() }} />`.\n *\n * The read has to be the whole of a tracked expression, so it depends on\n * exactly what the memo depended on and reruns exactly as often. It also has\n * to run once each time the function holding the memo runs, so a read in a\n * callback, a loop, or a component's children stays a read of the memo.\n *\n * A memo whose computation folds to a literal reads no signals, so it never\n * runs again and its value never changes. Every read of it becomes the\n * literal, however many there are:\n *\n * ```jsx\n * const size = createMemo(() => 3);\n * return <p>{size() * 2}</p>;\n * ```\n *\n * becomes `<p>{3 * 2}</p>`, which the next fold turns into `6`.\n *\n * Solid's `children` helper is a memo too. It resolves the children once,\n * caches them, and flattens them in a second memo. When the children are JSX,\n * nothing they read at the top makes either memo run again, and inserting the\n * JSX directly resolves it the same way. So a `children(() => <jsx />)` read\n * once as an element's child becomes that JSX, which joins the template:\n *\n * ```jsx\n * const c = children(() => <b>x</b>);\n * return <div>{c()}</div>;\n * ```\n *\n * becomes `<div><b>x</b></div>`.\n *\n * A signal that nothing writes is a constant too. When its setter is left\n * out or never referenced, and its initial value is a literal, every read\n * becomes the literal:\n *\n * ```jsx\n * const [size] = createSignal(3);\n * return <p>{size()}</p>;\n * ```\n *\n * becomes `<p>{3}</p>`. A signal with a value that is not a function takes no\n * owner and no hydration id, so removing it changes nothing else.\n *\n * A plain arrow that only returns an expression, like a derived accessor,\n * has no cache and no owner, so each call already runs its body again. The\n * calls can become the body:\n *\n * ```jsx\n * const label = () => (props.open ? 'Close' : 'Open');\n * return <button>{label()}</button>;\n * ```\n *\n * becomes `<button>{(props.open ? 'Close' : 'Open')}</button>`. With more than\n * one call, the body is copied only when the copies are no larger than the\n * arrow and its calls.\n *\n * # Accepted differences\n *\n * - The computation first runs when its reader first runs, instead of when\n * the memo is created.\n * - The memo no longer takes a slot in the owner tree, which shifts the\n * hydration keys after it. A server build and its client build must\n * compile with the same options.\n * - A call that runs before the declaration, from a hoisted function the\n * declaration comes before, throws on the original and returns the value\n * on the output.\n */\nimport type {\n ArrowFunctionExpression,\n CallExpression,\n Expression,\n Function as FunctionNode,\n JSXExpressionContainer,\n Node,\n ObjectExpression,\n VariableDeclarator,\n} from 'oxc-parser';\nimport { isFunctionNode, isIntrinsicTag, isPrimary, unwrap } from './ast';\nimport type { PassContext } from './context';\nimport { getText, recordSkip, solidExport } from './context';\nimport { usesFunctionContext } from './inline';\nimport type { Binding } from './scope';\nimport { lookup, scopeAt } from './scope';\nimport { compactLength } from './size';\n\n/**\n * Props of Solid's built-in components that are read inside a memo, once per update.\n */\nconst TRACKED_PROPS = new Map([\n ['Show', 'when'],\n ['Match', 'when'],\n ['For', 'each'],\n ['Repeat', 'count'],\n]);\n\n/**\n * Global constructors whose instances are never thenable or async iterable.\n */\nconst SYNC_CONSTRUCTORS = new Set([\n 'Array',\n 'Date',\n 'Error',\n 'Map',\n 'RegExp',\n 'Set',\n 'URL',\n 'URLSearchParams',\n 'WeakMap',\n 'WeakSet',\n]);\n\n/**\n * Whether an object literal can have a `then` method or `Symbol.asyncIterator`,\n * its own or from a `__proto__` it sets.\n */\nfunction mayBeThenable(node: ObjectExpression): boolean {\n for (const property of node.properties) {\n if (property.type === 'SpreadElement' || property.computed) {\n return true;\n }\n const { key } = property;\n let name: unknown;\n if (key.type === 'Identifier') {\n name = key.name;\n } else if ('value' in key) {\n name = key.value;\n }\n if (name === 'then' || name === '__proto__') {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Whether evaluating `node` always creates a new value, which reference\n * equality never finds equal to the last one. The value is never a promise\n * or an async iterable, which a memo waits for and an inlined read does not.\n * `isGlobal` tells whether a name is one the module does not declare.\n */\nfunction isFresh(node: Node, isGlobal: (node: Node) => boolean): boolean {\n switch (node.type) {\n case 'ArrayExpression':\n case 'ArrowFunctionExpression':\n case 'FunctionExpression':\n case 'JSXElement':\n case 'JSXFragment':\n return true;\n case 'ObjectExpression':\n return !mayBeThenable(node);\n case 'NewExpression':\n return (\n node.callee.type === 'Identifier' &&\n SYNC_CONSTRUCTORS.has(node.callee.name) &&\n isGlobal(node.callee)\n );\n case 'ParenthesizedExpression':\n return isFresh(node.expression, isGlobal);\n case 'ConditionalExpression':\n return isFresh(node.consequent, isGlobal) && isFresh(node.alternate, isGlobal);\n case 'SequenceExpression': {\n const last = node.expressions.at(-1);\n return last !== undefined && isFresh(last, isGlobal);\n }\n default:\n return false;\n }\n}\n\n/**\n * Whether `node` evaluates to a value that is never a promise or an async\n * iterable. A memo waits for one of those, and an inlined read does not.\n */\nfunction isSync(node: Node, isGlobal: (node: Node) => boolean): boolean {\n switch (node.type) {\n case 'Literal':\n case 'TemplateLiteral':\n case 'UnaryExpression':\n case 'UpdateExpression':\n case 'BinaryExpression':\n return true;\n case 'ParenthesizedExpression':\n return isSync(node.expression, isGlobal);\n case 'ConditionalExpression':\n return isSync(node.consequent, isGlobal) && isSync(node.alternate, isGlobal);\n case 'LogicalExpression':\n return isSync(node.left, isGlobal) && isSync(node.right, isGlobal);\n case 'SequenceExpression': {\n const last = node.expressions.at(-1);\n return last !== undefined && isSync(last, isGlobal);\n }\n default:\n return isFresh(node, isGlobal);\n }\n}\n\n/**\n * The expression a compute function returns, when that is all it does.\n */\ntype MemoKind = 'createMemo' | 'children';\n\n/**\n * The text of an expression that always gives the same primitive: a literal\n * other than a regular expression, a template literal without expressions,\n * or a negated number.\n */\nfunction constantText(context: PassContext, node: Expression): string | undefined {\n const expression = unwrap(node);\n switch (expression.type) {\n case 'Literal':\n return 'regex' in expression ? undefined : getText(context, expression);\n case 'TemplateLiteral':\n return expression.expressions.length === 0 ? getText(context, expression) : undefined;\n case 'UnaryExpression':\n return expression.operator === '-' &&\n expression.argument.type === 'Literal' &&\n typeof expression.argument.value === 'number'\n ? getText(context, expression)\n : undefined;\n default:\n return undefined;\n }\n}\n\nfunction returnedExpression(fn: FunctionNode | ArrowFunctionExpression): Expression | undefined {\n if (fn.async || fn.generator || fn.params.length > 0 || !fn.body) {\n return undefined;\n }\n if (fn.body.type !== 'BlockStatement') {\n return fn.body;\n }\n const statements = fn.body.body;\n const statement = statements.at(0);\n if (statements.length !== 1 || statement?.type !== 'ReturnStatement' || !statement.argument) {\n return undefined;\n }\n return statement.argument;\n}\n\nclass MemoInliner {\n changed = false;\n\n /** Ranges of the source rewritten so far in this run. */\n private readonly edited: [number, number][] = [];\n\n constructor(private readonly context: PassContext) {}\n\n /** Why the last memo was turned down, for the report. Empty for a call that is not a memo. */\n private reason = '';\n\n /** Whether a callee is Solid's `createMemo` or `children`. */\n private memoKind(callee: Node): MemoKind | undefined {\n if (callee.type !== 'Identifier') {\n return undefined;\n }\n const binding = this.context.scopes.references.get(callee);\n const identity = binding ? solidExport(binding, this.context.options) : undefined;\n return identity === 'createMemo' || identity === 'children' ? identity : undefined;\n }\n\n /**\n * The expression a memo's computation returns, and whether `equals: false`\n * makes it notify on every run.\n */\n private computation(\n declarator: VariableDeclarator,\n ): { expression: Expression; alwaysNotifies: boolean; kind: MemoKind } | undefined {\n const init = declarator.init ? unwrap(declarator.init) : undefined;\n const kind = init?.type === 'CallExpression' ? this.memoKind(init.callee) : undefined;\n if (init?.type !== 'CallExpression' || kind === undefined) {\n return undefined;\n }\n const args = init.arguments;\n if (kind === 'children' && args.length > 1) {\n this.reason = 'memo-options';\n return undefined;\n }\n const compute = args.at(0);\n const options = args.at(1);\n if (args.length > 2 || compute === undefined || compute.type === 'SpreadElement') {\n this.reason = 'memo-computation';\n return undefined;\n }\n const fn = unwrap(compute);\n if (fn.type !== 'ArrowFunctionExpression' && fn.type !== 'FunctionExpression') {\n this.reason = 'memo-computation';\n return undefined;\n }\n const expression = returnedExpression(fn);\n if (!expression) {\n this.reason = 'memo-computation';\n return undefined;\n }\n let alwaysNotifies = false;\n if (options !== undefined) {\n // Only `equals: false` is understood. Any other option changes what the memo does.\n if (options.type !== 'ObjectExpression' || options.properties.length !== 1) {\n this.reason = 'memo-options';\n return undefined;\n }\n const property = options.properties.at(0);\n if (\n property?.type !== 'Property' ||\n property.computed ||\n property.key.type !== 'Identifier' ||\n property.key.name !== 'equals' ||\n property.value.type !== 'Literal' ||\n property.value.value !== false\n ) {\n this.reason = 'memo-options';\n return undefined;\n }\n alwaysNotifies = true;\n }\n return { expression, alwaysNotifies, kind };\n }\n\n /**\n * Replaces every read of a memo or signal whose value is a literal with the\n * literal. Each reference has to be a call after the declaration, since a\n * call before it would throw.\n */\n private inlineConstant(\n declarator: VariableDeclarator,\n binding: Binding,\n text: string,\n kind: 'memo' | 'signal' = 'memo',\n ): true | undefined {\n const statement = this.context.parents.get(declarator);\n if (statement?.type !== 'VariableDeclaration' || statement.declarations.length !== 1) {\n this.reason = `${kind}-declaration`;\n return undefined;\n }\n const calls: CallExpression[] = [];\n for (const reference of binding.references) {\n const call = this.context.parents.get(reference);\n if (\n call?.type !== 'CallExpression' ||\n call.callee !== reference ||\n call.arguments.length > 0 ||\n call.start < declarator.end\n ) {\n this.reason = `${kind}-constant`;\n return undefined;\n }\n calls.push(call);\n }\n for (const call of calls) {\n // `3.toFixed()` and `-1 ** 2` do not parse, so a literal under an operator or a member gets parentheses.\n const parent = this.context.parents.get(call);\n const bare =\n parent?.type === 'JSXExpressionContainer' ||\n parent?.type === 'VariableDeclarator' ||\n parent?.type === 'ReturnStatement' ||\n parent?.type === 'ArrayExpression' ||\n parent?.type === 'Property' ||\n (parent?.type === 'CallExpression' && parent.callee !== call);\n this.context.s.overwrite(call.start, call.end, bare ? text : `(${text})`);\n this.edited.push([call.start, call.end]);\n }\n this.context.s.remove(statement.start, statement.end);\n this.edited.push([statement.start, statement.end]);\n this.changed = true;\n return true;\n }\n\n /**\n * The function a node runs in.\n */\n private findEnclosingFunction(node: Node): Node | undefined {\n let current = this.context.parents.get(node);\n while (current && !isFunctionNode(current)) {\n current = this.context.parents.get(current);\n }\n return current;\n }\n\n /** The JSX expression container a call is the whole of. */\n private findContainer(call: Node): JSXExpressionContainer | undefined {\n let parent = this.context.parents.get(call);\n while (parent?.type === 'ParenthesizedExpression') {\n parent = this.context.parents.get(parent);\n }\n return parent?.type === 'JSXExpressionContainer' ? parent : undefined;\n }\n\n /**\n * Whether a call is the whole of an expression that Solid tracks, and that\n * runs once each time `fn` runs.\n */\n private isSingleTrackedRead(call: Node, fn: Node): boolean {\n let node = call;\n let parent = this.context.parents.get(node);\n while (parent?.type === 'ParenthesizedExpression') {\n node = parent;\n parent = this.context.parents.get(node);\n }\n if (parent?.type !== 'JSXExpressionContainer') {\n return false;\n }\n const container = parent;\n const owner = this.context.parents.get(container);\n let element: Node | undefined;\n if (owner?.type === 'JSXFragment') {\n element = owner;\n } else if (owner?.type === 'JSXElement') {\n // A child of an element is inserted, which tracks it. A child of a\n // component is a prop, which the component can read any number of times.\n const { name } = owner.openingElement;\n if (name.type !== 'JSXIdentifier' || !isIntrinsicTag(name.name)) {\n return false;\n }\n element = owner;\n } else if (owner?.type === 'JSXAttribute' && owner.name.type === 'JSXIdentifier') {\n const attribute = owner.name.name;\n const opening = this.context.parents.get(owner);\n element = opening ? this.context.parents.get(opening) : undefined;\n if (element?.type !== 'JSXElement' || element.openingElement.name.type !== 'JSXIdentifier') {\n return false;\n }\n const tag = element.openingElement.name.name;\n if (isIntrinsicTag(tag)) {\n // An event handler or ref is read once and never tracked.\n if (attribute.startsWith('on') || attribute === 'ref') {\n return false;\n }\n } else if (\n this.getBuiltIn(element.openingElement.name) !== tag ||\n TRACKED_PROPS.get(tag) !== attribute\n ) {\n // A component can read a prop any number of times.\n return false;\n }\n } else {\n return false;\n }\n return this.isStaticJSX(element, fn);\n }\n\n private getBuiltIn(name: Node): string | undefined {\n if (name.type !== 'JSXIdentifier') {\n return undefined;\n }\n const { references } = this.context.scopes;\n if (!references.has(name)) {\n return undefined;\n }\n const binding = references.get(name);\n return binding ? solidExport(binding, this.context.options) : name.name;\n }\n\n /**\n * Whether JSX is created once each time `fn` runs: it sits in JSX that `fn`\n * returns, with only intrinsic elements and fragments around it.\n */\n private isStaticJSX(element: Node, fn: Node): boolean {\n let node = element;\n for (;;) {\n const parent = this.context.parents.get(node);\n if (!parent) {\n return false;\n }\n if (parent === fn) {\n // An arrow function's expression body.\n return true;\n }\n switch (parent.type) {\n case 'JSXElement': {\n const { name } = parent.openingElement;\n if (name.type !== 'JSXIdentifier' || !isIntrinsicTag(name.name)) {\n return false;\n }\n break;\n }\n case 'JSXFragment':\n case 'ParenthesizedExpression':\n break;\n case 'ReturnStatement':\n return this.findEnclosingFunction(parent) === fn && !this.inLoop(parent, fn);\n default:\n return false;\n }\n node = parent;\n }\n }\n\n private inLoop(node: Node, fn: Node): boolean {\n let current = this.context.parents.get(node);\n while (current && current !== fn) {\n if (\n current.type === 'ForStatement' ||\n current.type === 'ForInStatement' ||\n current.type === 'ForOfStatement' ||\n current.type === 'WhileStatement' ||\n current.type === 'DoWhileStatement'\n ) {\n return true;\n }\n current = this.context.parents.get(current);\n }\n return false;\n }\n\n /**\n * Whether every name in `expression` means the same at `site`.\n */\n private resolvesSameAt(expression: Node, site: Node, memo: Binding): boolean {\n const scope = scopeAt(this.context.scopes, this.context.parents, site);\n for (const [reference, binding] of this.context.scopes.references) {\n if (reference.start < expression.start || reference.end > expression.end) {\n continue;\n }\n if (binding === memo) {\n return false;\n }\n // A name declared inside the computation, like a callback's parameter, moves with it.\n if (\n binding !== undefined &&\n binding.identifier.start >= expression.start &&\n binding.identifier.end <= expression.end\n ) {\n continue;\n }\n if (\n (reference.type === 'Identifier' || reference.type === 'JSXIdentifier') &&\n lookup(scope, reference.name) !== binding\n ) {\n return false;\n }\n }\n return true;\n }\n\n private tryInline(declarator: VariableDeclarator, binding: Binding): void {\n this.reason = '';\n if (this.inline(declarator, binding) === undefined && this.reason !== '') {\n recordSkip(this.context, 'memos', this.reason, binding.name);\n }\n }\n\n private inline(declarator: VariableDeclarator, binding: Binding): true | undefined {\n const found = this.computation(declarator);\n if (!found) {\n return undefined;\n }\n const { expression, alwaysNotifies, kind } = found;\n if (kind === 'children') {\n // Only JSX is resolved the same by `insert`, and never makes the helper run again.\n const root = unwrap(expression);\n if (root.type !== 'JSXElement' && root.type !== 'JSXFragment') {\n this.reason = 'children-dynamic';\n return undefined;\n }\n } else {\n const constant = constantText(this.context, expression);\n if (constant !== undefined) {\n return this.inlineConstant(declarator, binding, constant);\n }\n const isGlobal = (node: Node): boolean =>\n this.context.scopes.references.get(node) === undefined;\n // A memo whose result can equal its last one stops updates, which is what it is for.\n if (!alwaysNotifies && !isFresh(expression, isGlobal)) {\n return undefined;\n }\n // A memo waits for a promise or an async iterable. The insert an inlined\n // read becomes takes the value as it is.\n if (alwaysNotifies && !isSync(expression, isGlobal)) {\n this.reason = 'memo-async';\n return undefined;\n }\n }\n if (binding.references.length !== 1) {\n this.reason = 'memo-reads';\n return undefined;\n }\n const statement = this.context.parents.get(declarator);\n const fn = this.findEnclosingFunction(declarator);\n if (statement?.type !== 'VariableDeclaration' || statement.declarations.length !== 1 || !fn) {\n this.reason = 'memo-declaration';\n return undefined;\n }\n const reference = binding.references.at(0);\n const call = reference ? this.context.parents.get(reference) : undefined;\n if (call?.type !== 'CallExpression' || call.callee !== reference || call.arguments.length > 0) {\n this.reason = 'memo-read';\n return undefined;\n }\n if (!this.isSingleTrackedRead(call, fn)) {\n this.reason = 'memo-read-place';\n return undefined;\n }\n // The resolved children are inserted, so the read has to be a child, not an attribute.\n const container = this.findContainer(call);\n const owner = container ? this.context.parents.get(container) : undefined;\n if (\n kind === 'children' &&\n (!container || (owner?.type !== 'JSXElement' && owner?.type !== 'JSXFragment'))\n ) {\n this.reason = 'memo-read-place';\n return undefined;\n }\n if (\n !this.resolvesSameAt(expression, call, binding) ||\n usesFunctionContext(this.context, expression)\n ) {\n this.reason = 'memo-scope';\n return undefined;\n }\n if (kind === 'children' && container) {\n // The JSX takes the place of its container, so it joins the template around it.\n this.context.s.overwrite(container.start, container.end, getText(this.context, expression));\n this.edited.push([container.start, container.end]);\n } else {\n // The read sits in a JSX container, which takes any expression.\n this.context.s.overwrite(call.start, call.end, getText(this.context, expression));\n this.edited.push([call.start, call.end]);\n }\n this.context.s.remove(statement.start, statement.end);\n this.edited.push([statement.start, statement.end]);\n this.changed = true;\n return true;\n }\n\n /**\n * The literal a signal always holds: `const [get] = createSignal(literal)`,\n * or `const [get, set] = ...` with nothing referencing `set`. Options can\n * change what a read does, such as `unobserved`, so a signal with options\n * stays.\n */\n private signalConstant(declarator: VariableDeclarator, binding: Binding): string | undefined {\n const pattern = declarator.id;\n const init = declarator.init ? unwrap(declarator.init) : undefined;\n if (\n pattern.type !== 'ArrayPattern' ||\n pattern.elements.at(0) !== binding.identifier ||\n pattern.elements.length > 2 ||\n init?.type !== 'CallExpression' ||\n init.callee.type !== 'Identifier' ||\n init.arguments.length !== 1\n ) {\n return undefined;\n }\n const callee = this.context.scopes.references.get(init.callee);\n if (!callee || solidExport(callee, this.context.options) !== 'createSignal') {\n return undefined;\n }\n const value = init.arguments.at(0);\n if (!value || value.type === 'SpreadElement') {\n return undefined;\n }\n // Other modules can read an exported getter.\n const statement = this.context.parents.get(declarator);\n if (statement && this.context.parents.get(statement)?.type === 'ExportNamedDeclaration') {\n return undefined;\n }\n const setter = pattern.elements.at(1);\n if (setter) {\n const setterBinding =\n setter.type === 'Identifier' ? binding.scope.bindings.get(setter.name) : undefined;\n if (setterBinding?.identifier !== setter || setterBinding.references.length > 0) {\n return undefined;\n }\n }\n return constantText(this.context, value);\n }\n\n private tryInlineSignal(declarator: VariableDeclarator, binding: Binding): void {\n const text = this.signalConstant(declarator, binding);\n if (text === undefined) {\n return;\n }\n this.reason = '';\n if (this.inlineConstant(declarator, binding, text, 'signal') === undefined) {\n recordSkip(this.context, 'memos', this.reason, binding.name);\n }\n }\n\n /**\n * Replaces every call of `const name = () => expression` with the\n * expression. Each reference has to be a call with no arguments after the\n * declaration, and every name in the body has to mean the same at the call.\n */\n private tryInlineArrow(declarator: VariableDeclarator, binding: Binding): void {\n const fn = declarator.init ? unwrap(declarator.init) : undefined;\n if (fn?.type !== 'ArrowFunctionExpression' || fn.async || fn.params.length > 0) {\n return;\n }\n const body = returnedExpression(fn);\n const statement = this.context.parents.get(declarator);\n if (\n !body ||\n statement?.type !== 'VariableDeclaration' ||\n statement.declarations.length !== 1 ||\n // Other modules can call an exported arrow.\n this.context.parents.get(statement)?.type === 'ExportNamedDeclaration'\n ) {\n return;\n }\n const calls: CallExpression[] = [];\n for (const reference of binding.references) {\n const call = this.context.parents.get(reference);\n if (\n call?.type !== 'CallExpression' ||\n call.callee !== reference ||\n call.optional ||\n call.arguments.length > 0 ||\n call.start < declarator.end\n ) {\n // The arrow is used as a value, like an event handler. That is not a derivation.\n return;\n }\n // `l()()` calls the result with no `this`, but `(a.b)()` passes `a`, and\n // `delete (a.b)` deletes what `delete l()` leaves alone.\n const parent = this.context.parents.get(call);\n if (\n (parent?.type === 'CallExpression' && parent.callee === call) ||\n (parent?.type === 'TaggedTemplateExpression' && parent.tag === call) ||\n (parent?.type === 'UnaryExpression' && parent.operator === 'delete')\n ) {\n return;\n }\n calls.push(call);\n }\n if (calls.length === 0) {\n return;\n }\n // The body is copied from the source, so it must not hold an edit from this run.\n // The next round sees the edit.\n for (const [start, end] of this.edited) {\n if (start < statement.end && end > statement.start) {\n return;\n }\n }\n const text = getText(this.context, body);\n // Minified, the arrow costs `const a=()=>body;`, 13 characters besides the\n // body, and each call `a()` costs 3. Copying adds the body to every call\n // but one, and removes the rest.\n const length = compactLength(text);\n if ((calls.length - 1) * length > calls.length * 3 + 13) {\n return;\n }\n if (usesFunctionContext(this.context, fn)) {\n return;\n }\n for (const call of calls) {\n if (!this.resolvesSameAt(body, call, binding)) {\n return;\n }\n }\n const bare = isPrimary(body);\n for (const call of calls) {\n const parent = this.context.parents.get(call);\n const inContainer =\n parent?.type === 'JSXExpressionContainer' && body.type !== 'SequenceExpression';\n this.context.s.overwrite(call.start, call.end, bare || inContainer ? text : `(${text})`);\n this.edited.push([call.start, call.end]);\n }\n this.context.s.remove(statement.start, statement.end);\n this.edited.push([statement.start, statement.end]);\n this.changed = true;\n }\n\n run(): void {\n for (const scope of new Set(this.context.scopes.scopes.values())) {\n for (const binding of scope.bindings.values()) {\n const { declaration } = binding;\n if (\n binding.kind !== 'const' ||\n binding.mutated ||\n declaration.type !== 'VariableDeclarator'\n ) {\n continue;\n }\n if (declaration.id.type === 'ArrayPattern') {\n // A signal takes no owner, so one outside any function works the same.\n this.tryInlineSignal(declaration, binding);\n } else if (declaration.id === binding.identifier) {\n // An arrow has no owner, so one outside any function works the same.\n this.tryInlineArrow(declaration, binding);\n // A memo outside any function has no owner, and disposes differently.\n if (scope.parent !== undefined) {\n this.tryInline(declaration, binding);\n }\n }\n }\n }\n }\n}\n\n/**\n * Runs the memo pass over a parsed program. Returns whether anything changed.\n */\nexport function inlineMemos(context: PassContext): boolean {\n const inliner = new MemoInliner(context);\n inliner.run();\n return inliner.changed;\n}\n","/**\n * Keeps every template valid HTML.\n *\n * Solid's JSX transform puts an element and the elements written inside it\n * into one HTML template. It rejects a template that a browser would parse\n * into another tree, such as `<p><div></div></p>`, which parses as\n * `<p></p><div></div><p></p>`. Before the passes, such an element is often\n * apart from the template: `<p><Box /></p>` inserts the `<div>` that `Box`\n * returns at runtime, which works. Inlining `Box`, resolving `<Show>`,\n * unrolling `<For>`, or resolving `<Dynamic>` puts the `<div>` into the\n * `<p>`'s template, and the build fails.\n *\n * This pass checks each template the way Solid does: it parses the\n * template's tags as the body's `innerHTML` and compares the result. When\n * the tree changes, the element that changes it is wrapped in `{}`. An\n * element in an expression container starts its own template and is\n * inserted at runtime, as it was before the pass.\n */\nimport type { JSXChild, JSXElement, Node } from 'oxc-parser';\nimport type { DefaultTreeAdapterMap } from 'parse5';\nimport { parseFragment, parse as parseHTML, serialize } from 'parse5';\nimport { forEachChild, isIntrinsicTag } from './ast';\nimport type { PassContext } from './context';\n\nconst VOID_ELEMENTS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'keygen',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n]);\n\n// Solid's list of SVG tags, from dom-expressions. `a`, `script`, `style`, and\n// `title` are in both namespaces, so a template rooted at one is HTML.\nconst SVG_ELEMENTS = new Set([\n 'altGlyph',\n 'altGlyphDef',\n 'altGlyphItem',\n 'animate',\n 'animateColor',\n 'animateMotion',\n 'animateTransform',\n 'circle',\n 'clipPath',\n 'cursor',\n 'defs',\n 'desc',\n 'ellipse',\n 'feBlend',\n 'feColorMatrix',\n 'feComponentTransfer',\n 'feComposite',\n 'feConvolveMatrix',\n 'feDiffuseLighting',\n 'feDisplacementMap',\n 'feDistantLight',\n 'feDropShadow',\n 'feFlood',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feImage',\n 'feMerge',\n 'feMergeNode',\n 'feMorphology',\n 'feOffset',\n 'fePointLight',\n 'feSpecularLighting',\n 'feSpotLight',\n 'feTile',\n 'feTurbulence',\n 'filter',\n 'font',\n 'foreignObject',\n 'g',\n 'glyph',\n 'glyphRef',\n 'hkern',\n 'image',\n 'line',\n 'linearGradient',\n 'marker',\n 'mask',\n 'metadata',\n 'mpath',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialGradient',\n 'rect',\n 'set',\n 'stop',\n 'switch',\n 'symbol',\n 'text',\n 'textPath',\n 'tref',\n 'tspan',\n 'use',\n 'view',\n 'vkern',\n]);\n\ntype ParentNode = DefaultTreeAdapterMap['parentNode'];\n\nfunction findElement(parent: ParentNode, name: string): ParentNode {\n for (const child of parent.childNodes) {\n if (child.nodeName === name && 'childNodes' in child) {\n return child;\n }\n }\n throw new Error(`[solid-optimizer] no <${name}> in an empty document`);\n}\n\nlet body: ParentNode | undefined;\n\n/** What a browser makes of `html` set as the body's `innerHTML`. */\nfunction parseAsBody(html: string): string {\n body ??= findElement(\n findElement(parseHTML('<!DOCTYPE html><html><body></body></html>'), 'html'),\n 'body',\n );\n return serialize(parseFragment(body, html, {}));\n}\n\n/** The tag of an intrinsic element, or `undefined` for a component or a namespaced tag. */\nfunction readIntrinsicTag(element: JSXElement): string | undefined {\n const name = element.openingElement.name;\n return name.type === 'JSXIdentifier' && isIntrinsicTag(name.name) ? name.name : undefined;\n}\n\n/** A template element and the elements in the same template. */\ninterface TemplateNode {\n readonly element: JSXElement;\n readonly tag: string;\n readonly children: TemplateNode[];\n}\n\n/**\n * The template rooted at `element`. Elements inside fragments join it.\n * Elements in expression containers or under a component start their own.\n */\nfunction collectTemplate(element: JSXElement, tag: string): TemplateNode {\n const node: TemplateNode = { element, tag, children: [] };\n addTemplateChildren(node, element.children);\n return node;\n}\n\nfunction addTemplateChildren(node: TemplateNode, children: readonly JSXChild[]): void {\n for (const child of children) {\n if (child.type === 'JSXFragment') {\n addTemplateChildren(node, child.children);\n } else if (child.type === 'JSXElement') {\n const tag = readIntrinsicTag(child);\n if (tag !== undefined) {\n node.children.push(collectTemplate(child, tag));\n }\n }\n }\n}\n\n/**\n * The tags of a template, without text or attributes. Elements not in\n * `included` are left out with what they hold.\n */\nfunction writeTags(node: TemplateNode, included: ReadonlySet<TemplateNode>): string {\n if (VOID_ELEMENTS.has(node.tag)) {\n return `<${node.tag}>`;\n }\n let inner = '';\n for (const child of node.children) {\n if (included.has(child)) {\n inner += writeTags(child, included);\n }\n }\n return `<${node.tag}>${inner}</${node.tag}>`;\n}\n\n/**\n * Table parts parse only inside a table, and SVG parts only inside an\n * `<svg>`, so a template rooted at one is checked inside one, as Solid\n * creates it.\n */\nfunction placeInContext(tag: string, html: string): string {\n if (SVG_ELEMENTS.has(tag)) {\n return `<svg>${html}</svg>`;\n }\n switch (tag) {\n case 'td':\n case 'th':\n return `<table><tbody><tr>${html}</tr></tbody></table>`;\n case 'tr':\n return `<table><tbody>${html}</tbody></table>`;\n case 'col':\n return `<table><colgroup>${html}</colgroup></table>`;\n case 'thead':\n case 'tbody':\n case 'tfoot':\n case 'colgroup':\n case 'caption':\n return `<table>${html}</table>`;\n default:\n return html;\n }\n}\n\n/** Whether a `<template>` in the template holds an element, which Solid rejects. */\nfunction hasTemplateContent(node: TemplateNode, included: ReadonlySet<TemplateNode>): boolean {\n for (const child of node.children) {\n if (included.has(child) && (node.tag === 'template' || hasTemplateContent(child, included))) {\n return true;\n }\n }\n return false;\n}\n\nfunction isValidTemplate(root: TemplateNode, included: ReadonlySet<TemplateNode>): boolean {\n if (hasTemplateContent(root, included)) {\n return false;\n }\n const html = placeInContext(root.tag, writeTags(root, included));\n return parseAsBody(html).toLowerCase() === html.toLowerCase();\n}\n\nfunction collectAll(node: TemplateNode, into: Set<TemplateNode>): Set<TemplateNode> {\n into.add(node);\n for (const child of node.children) {\n collectAll(child, into);\n }\n return into;\n}\n\n/**\n * Wraps the elements that make `root`'s template parse differently, and\n * returns the wrapped elements, each the root of a template of its own.\n */\nfunction wrapInvalidElements(context: PassContext, root: TemplateNode): TemplateNode[] {\n if (isValidTemplate(root, collectAll(root, new Set()))) {\n return [];\n }\n // A template that is already wrong without its children is the source's own.\n const included = new Set([root]);\n if (!isValidTemplate(root, included)) {\n return [];\n }\n // Add the elements one at a time, in source order, and keep apart each one\n // that changes the parse. A kept-apart element takes what it holds along.\n const wrapped: TemplateNode[] = [];\n const pending: TemplateNode[] = [];\n pushChildren(pending, root);\n for (let node = pending.pop(); node; node = pending.pop()) {\n included.add(node);\n if (!isValidTemplate(root, included)) {\n included.delete(node);\n // Each brace sticks to its own element, so two wrapped neighbors read `}{`.\n context.s.prependRight(node.element.start, '{');\n context.s.appendLeft(node.element.end, '}');\n wrapped.push(node);\n continue;\n }\n pushChildren(pending, node);\n }\n return wrapped;\n}\n\n/** Pushes the children of `node` so that they pop in source order. */\nfunction pushChildren(pending: TemplateNode[], node: TemplateNode): void {\n for (let index = node.children.length - 1; index >= 0; index -= 1) {\n pending.push(node.children[index]);\n }\n}\n\nexport function repairNesting(context: PassContext): boolean {\n const roots: TemplateNode[] = [];\n const visit = (node: Node, inTemplate: boolean): void => {\n if (node.type === 'JSXElement') {\n const tag = readIntrinsicTag(node);\n if (tag !== undefined && !inTemplate) {\n roots.push(collectTemplate(node, tag));\n }\n // An intrinsic element's children join its template. A component's\n // children, an expression container, and an attribute value start over.\n for (const child of node.children) {\n visit(child, tag !== undefined);\n }\n for (const attribute of node.openingElement.attributes) {\n visit(attribute, false);\n }\n return;\n }\n if (node.type === 'JSXFragment') {\n for (const child of node.children) {\n visit(child, inTemplate);\n }\n return;\n }\n forEachChild(node, (child) => {\n visit(child, false);\n });\n };\n visit(context.program, false);\n\n let changed = false;\n for (let root = roots.pop(); root; root = roots.pop()) {\n const wrapped = wrapInvalidElements(context, root);\n if (wrapped.length > 0) {\n changed = true;\n roots.push(...wrapped);\n }\n }\n return changed;\n}\n","/**\n * `<Show>` and `<Switch>` lowering.\n *\n * Solid's JSX transform compiles `{when ? children : fallback}` to a memo of\n * `!!when` and a function that renders the branch it selects, which is what\n * `<Show>` does without a callback child or `keyed`. The ternary skips the\n * component call, the props object with its getters, and two of `<Show>`'s\n * three memos.\n *\n * A `<Switch>` becomes a chain, `a ? A : b ? B : fallback`. The transform\n * gives each later condition its own memo, read only when the ones before it\n * are falsy, as `<Switch>` reads its `<Match>` conditions.\n *\n * A callback child like `{(user) => <b>{user().name}</b>}` becomes its body,\n * with each `user()` read as `when` again. Only a `when` that reads names,\n * members, and signals or memos is copied, so reading it again gives the same\n * value. `<Show>`'s\n * accessor throws when it is read after the condition turns falsy, and the\n * copy reads the falsy value instead.\n */\nimport type { ArrowFunctionExpression, JSXAttribute, JSXChild, JSXElement, Node } from 'oxc-parser';\nimport { forEachChild, isFunctionNode, isInsignificant, isIntrinsicTag, unwrap } from './ast';\nimport type { PassContext } from './context';\nimport { solidExport } from './context';\nimport { findAttribute } from './jsx';\nimport { lookup, scopeAt } from './scope';\n\n/**\n * How a lowered `<Show>` or `<Switch>` is written where it stands.\n *\n * - `container`: `{when ? children : fallback}`. A child of an element is\n * inserted, and a child of a fragment becomes a memo, so both track the\n * ternary.\n * - `fragment`: `<>{when ? children : fallback}</>`, which compiles to a memo.\n * A ternary alone as a component's child would be read again on every read\n * of `props.children`, without a memo around it.\n */\ntype Form = 'container' | 'fragment';\n\n/**\n * Rewrites each `<Show>` and `<Switch>` that can be lowered. One inside\n * another that is lowered stays for the next run, since both would edit the\n * same text.\n */\nexport function lowerConditionals(context: PassContext): boolean {\n let changed = false;\n visit(context.program);\n return changed;\n\n function visit(node: Node): void {\n if (node.type === 'JSXElement') {\n const ternary = ternaryOf(context, node);\n const form = ternary === undefined ? undefined : formAt(context, node);\n if (ternary !== undefined && form !== undefined) {\n context.s.overwrite(\n node.start,\n node.end,\n form === 'container' ? `{${ternary}}` : `<>{${ternary}}</>`,\n );\n changed = true;\n return;\n }\n }\n forEachChild(node, visit);\n }\n}\n\n/**\n * The Solid built-in an element's tag resolves to, by the name Solid exports it under.\n */\nfunction builtInOf(context: PassContext, element: JSXElement): string | undefined {\n const { name } = element.openingElement;\n if (name.type !== 'JSXIdentifier') {\n return undefined;\n }\n const { references } = context.scopes;\n if (!references.has(name)) {\n return undefined;\n }\n const binding = references.get(name);\n const identity = binding ? solidExport(binding, context.options) : name.name;\n return identity !== undefined && context.options.builtIns.has(identity) ? identity : undefined;\n}\n\n/**\n * The ternary a `<Show>` or `<Switch>` lowers to, or `undefined` when its\n * props or children need the component.\n */\nfunction ternaryOf(context: PassContext, element: JSXElement): string | undefined {\n switch (builtInOf(context, element)) {\n case 'Show': {\n const branch = branchOf(context, element, ['when', 'fallback']);\n if (branch === undefined) {\n return undefined;\n }\n return `${branch.when} ? ${branch.children} : ${branch.fallback ?? 'undefined'}`;\n }\n case 'Switch':\n return switchTernary(context, element);\n default:\n return undefined;\n }\n}\n\n/**\n * A `<Switch>` whose children are all `<Match>`es that lower, as a chain of ternaries.\n */\nfunction switchTernary(context: PassContext, element: JSXElement): string | undefined {\n const props = propsOf(context, element, ['fallback']);\n if (props === undefined) {\n return undefined;\n }\n let chain = '';\n let count = 0;\n for (const child of significantChildren(element.children)) {\n if (child.type !== 'JSXElement' || builtInOf(context, child) !== 'Match') {\n return undefined;\n }\n const branch = branchOf(context, child, ['when']);\n if (branch === undefined) {\n return undefined;\n }\n chain += `${branch.when} ? ${branch.children} : `;\n count += 1;\n }\n // A `<Switch>` without a `<Match>` renders its fallback, which the fold pass resolves.\n if (count === 0) {\n return undefined;\n }\n return `${chain}${props.get('fallback') ?? 'undefined'}`;\n}\n\n/**\n * How a `<Show>` or `<Switch>` at this position is written once lowered, or `undefined`\n * when the position is not supported.\n */\nfunction formAt(context: PassContext, element: JSXElement): Form | undefined {\n const parent = context.parents.get(element);\n if (parent === undefined) {\n return 'fragment';\n }\n switch (parent.type) {\n case 'JSXFragment':\n return 'container';\n case 'JSXElement': {\n const { name } = parent.openingElement;\n // A namespaced tag like `svg:g` is an element too.\n if (\n name.type === 'JSXNamespacedName' ||\n (name.type === 'JSXIdentifier' && isIntrinsicTag(name.name))\n ) {\n return 'container';\n }\n // A component's children are one prop. Only a sole child keeps that prop a memo.\n return isSoleChild(parent.children, element) ? 'fragment' : undefined;\n }\n case 'JSXExpressionContainer':\n case 'JSXAttribute':\n return undefined;\n default:\n // An expression outside JSX, such as a return value or a callback's body.\n return isInJSXExpression(context, parent) ? undefined : 'fragment';\n }\n}\n\n/**\n * Whether a node is part of an expression in a JSX container, such as\n * `{ok && <Show />}`, where a function boundary does not separate them.\n */\nfunction isInJSXExpression(context: PassContext, node: Node): boolean {\n let current: Node | undefined = node;\n while (current !== undefined && !isFunctionNode(current)) {\n if (current.type === 'JSXExpressionContainer') {\n return true;\n }\n current = context.parents.get(current);\n }\n return false;\n}\n\nfunction isSoleChild(children: readonly JSXChild[], element: JSXElement): boolean {\n for (const child of children) {\n if (child !== element && !isInsignificant(child)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * The text of each prop of an element, or `undefined` when it has a prop\n * other than `names`, a spread, or a prop more than once. A repeated prop\n * takes its last value, and a spread could hold any prop, such as `keyed`.\n */\nfunction propsOf(\n context: PassContext,\n element: JSXElement,\n names: readonly string[],\n): Map<string, string> | undefined {\n const props = new Map<string, string>();\n for (const attribute of element.openingElement.attributes) {\n if (\n attribute.type !== 'JSXAttribute' ||\n attribute.name.type !== 'JSXIdentifier' ||\n !names.includes(attribute.name.name) ||\n props.has(attribute.name.name)\n ) {\n return undefined;\n }\n const text = expressionText(context, attribute);\n if (text === undefined) {\n return undefined;\n }\n props.set(attribute.name.name, text);\n }\n return props;\n}\n\ninterface Branch {\n readonly when: string;\n readonly children: string;\n readonly fallback: string | undefined;\n}\n\n/**\n * The condition and children of a `<Show>` or `<Match>`, or `undefined` when\n * the children could need the narrowed value.\n */\nfunction branchOf(\n context: PassContext,\n element: JSXElement,\n names: readonly string[],\n): Branch | undefined {\n const props = propsOf(context, element, names);\n const when = props?.get('when');\n if (props === undefined || when === undefined) {\n return undefined;\n }\n const significant = significantChildren(element.children);\n const sole = significant.length === 1 ? significant[0] : undefined;\n\n // A callback child becomes its body, with the narrowed value read as `when`.\n const callback =\n sole?.type === 'JSXExpressionContainer' && sole.expression.type !== 'JSXEmptyExpression'\n ? unwrap(sole.expression)\n : undefined;\n if (callback?.type === 'ArrowFunctionExpression') {\n const body = callbackBody(context, element, callback);\n return body === undefined\n ? undefined\n : { when, children: body, fallback: props.get('fallback') };\n }\n\n // Any other function child also receives the narrowed value. A sole child\n // that could hold a function, like `{render}`, counts too. Several\n // children are an array, which is rendered as it is.\n if (\n sole?.type === 'JSXExpressionContainer' &&\n sole.expression.type !== 'JSXEmptyExpression' &&\n !isNeverFunction(sole.expression)\n ) {\n return undefined;\n }\n for (const child of significant) {\n if (\n child.type === 'JSXExpressionContainer' &&\n child.expression.type !== 'JSXEmptyExpression' &&\n isFunctionNode(unwrap(child.expression))\n ) {\n return undefined;\n }\n }\n\n // The children become one fragment, which keeps JSX's own whitespace rules for them.\n const { closingElement } = element;\n const inner = closingElement\n ? context.s.slice(element.openingElement.end, closingElement.start)\n : '';\n return {\n when,\n children: significant.length > 0 ? `<>${inner}</>` : 'undefined',\n fallback: props.get('fallback'),\n };\n}\n\n/**\n * The body of a callback child with each read of its parameter written as\n * `when`, or `undefined` when that could change what the body renders.\n */\nfunction callbackBody(\n context: PassContext,\n element: JSXElement,\n callback: ArrowFunctionExpression,\n): string | undefined {\n // `<Show>` only passes the value to a callback that takes a parameter, and\n // calls it untracked. A body that is only JSX reads nothing as it is made.\n const param = callback.params.at(0);\n if (\n callback.async ||\n callback.body.type === 'BlockStatement' ||\n callback.params.length !== 1 ||\n param?.type !== 'Identifier'\n ) {\n return undefined;\n }\n const body = unwrap(callback.body);\n if (body.type !== 'JSXElement' && body.type !== 'JSXFragment') {\n return undefined;\n }\n const attribute = findAttribute(element, 'when');\n const value = attribute?.value;\n if (\n value?.type !== 'JSXExpressionContainer' ||\n value.expression.type === 'JSXEmptyExpression' ||\n !isPlainRead(context, value.expression)\n ) {\n return undefined;\n }\n const when = value.expression;\n const whenText = `(${context.s.slice(when.start, when.end)})`;\n\n // Each name `when` reads has to mean the same thing where the body reads the parameter.\n const names: Node[] = [];\n collectReferences(context, when, names);\n const binding = lookup(scopeAt(context.scopes, context.parents, param), param.name);\n // A write to the parameter, or a type that names it, has no copy to point at.\n if (binding?.identifier !== param || binding.mutated || namesInTypes(body, param.name)) {\n return undefined;\n }\n const edits: { start: number; end: number; text: string }[] = [];\n for (const reference of binding.references) {\n // A tag like `<C />` names a component, which an expression cannot replace.\n if (reference.type !== 'Identifier') {\n return undefined;\n }\n const scope = scopeAt(context.scopes, context.parents, reference);\n for (const name of names) {\n if (\n name.type !== 'Identifier' ||\n lookup(scope, name.name) !== context.scopes.references.get(name)\n ) {\n return undefined;\n }\n }\n const parent = context.parents.get(reference);\n if (\n parent?.type === 'CallExpression' &&\n parent.callee === reference &&\n parent.arguments.length === 0 &&\n !parent.optional\n ) {\n edits.push({ start: parent.start, end: parent.end, text: whenText });\n } else if (parent?.type === 'Property' && parent.shorthand) {\n return undefined;\n } else {\n edits.push({ start: reference.start, end: reference.end, text: `(() => ${whenText})` });\n }\n }\n\n // Write the body with the edits, in order.\n edits.sort((a, b) => a.start - b.start);\n let text = '';\n let at = body.start;\n for (const edit of edits) {\n text += context.s.slice(at, edit.start) + edit.text;\n at = edit.end;\n }\n return text + context.s.slice(at, body.end);\n}\n\n/**\n * Whether reading an expression again gives the same value, with nothing run\n * between the reads: names, members, literals, and operators, and calls of\n * a signal or a memo. Another call could change something or return\n * something new, and `this` changes inside a `function` in the body.\n */\nfunction isPlainRead(context: PassContext, node: Node): boolean {\n switch (node.type) {\n case 'Identifier':\n case 'Literal':\n return true;\n case 'ParenthesizedExpression':\n case 'TSAsExpression':\n case 'TSSatisfiesExpression':\n case 'TSNonNullExpression':\n case 'ChainExpression':\n return isPlainRead(context, node.expression);\n case 'MemberExpression':\n return (\n isPlainRead(context, node.object) && (!node.computed || isPlainRead(context, node.property))\n );\n case 'CallExpression':\n return node.arguments.length === 0 && isAccessor(context, node.callee);\n case 'UnaryExpression':\n return node.operator !== 'delete' && isPlainRead(context, node.argument);\n case 'BinaryExpression':\n case 'LogicalExpression':\n return isPlainRead(context, node.left) && isPlainRead(context, node.right);\n case 'ConditionalExpression':\n return (\n isPlainRead(context, node.test) &&\n isPlainRead(context, node.consequent) &&\n isPlainRead(context, node.alternate)\n );\n default:\n return false;\n }\n}\n\n/**\n * Whether a callee is the getter of a `createSignal` or a `createMemo` from\n * Solid, declared with `const` and never written, which returns its current\n * value without running anything else.\n */\nfunction isAccessor(context: PassContext, callee: Node): boolean {\n if (callee.type !== 'Identifier') {\n return false;\n }\n const binding = context.scopes.references.get(callee);\n if (!binding || binding.mutated || binding.kind !== 'const') {\n return false;\n }\n const { declaration } = binding;\n if (declaration.type !== 'VariableDeclarator' || !declaration.init) {\n return false;\n }\n const init = unwrap(declaration.init);\n if (init.type !== 'CallExpression' || init.callee.type !== 'Identifier') {\n return false;\n }\n const factory = context.scopes.references.get(init.callee);\n const name = factory ? solidExport(factory, context.options) : undefined;\n if (name === 'createMemo') {\n return declaration.id === binding.identifier;\n }\n // The getter is the first name of `const [value, setValue] = createSignal()`.\n return (\n name === 'createSignal' &&\n declaration.id.type === 'ArrayPattern' &&\n declaration.id.elements.at(0) === binding.identifier\n );\n}\n\n/** Whether a TypeScript type in `node`, like `typeof v`, names `name`. */\nfunction namesInTypes(node: unknown, name: string): boolean {\n if (typeof node !== 'object' || node === null) {\n return false;\n }\n if (Array.isArray(node)) {\n for (const item of node) {\n if (namesInTypes(item, name)) {\n return true;\n }\n }\n return false;\n }\n const type: unknown = Reflect.get(node, 'type');\n if (type === 'TSTypeQuery') {\n const exprName: unknown = Reflect.get(node, 'exprName');\n return (\n typeof exprName === 'object' && exprName !== null && Reflect.get(exprName, 'name') === name\n );\n }\n for (const key of Object.keys(node)) {\n if (key !== 'parent' && namesInTypes(Reflect.get(node, key), name)) {\n return true;\n }\n }\n return false;\n}\n\n/** The identifiers in an expression that refer to a binding or a global. */\nfunction collectReferences(context: PassContext, node: Node, out: Node[]): void {\n if (node.type === 'Identifier' && context.scopes.references.has(node)) {\n out.push(node);\n }\n forEachChild(node, (child) => {\n collectReferences(context, child, out);\n });\n}\n\n/**\n * Whether an expression's value can never be a function: a literal, JSX, or\n * an operator that returns a string, number, or boolean.\n */\nfunction isNeverFunction(node: Node): boolean {\n switch (node.type) {\n case 'Literal':\n case 'TemplateLiteral':\n case 'JSXElement':\n case 'JSXFragment':\n case 'BinaryExpression':\n case 'UnaryExpression':\n case 'UpdateExpression':\n return true;\n case 'ParenthesizedExpression':\n return isNeverFunction(node.expression);\n case 'ConditionalExpression':\n return isNeverFunction(node.consequent) && isNeverFunction(node.alternate);\n case 'LogicalExpression':\n return isNeverFunction(node.left) && isNeverFunction(node.right);\n default:\n return false;\n }\n}\n\nfunction significantChildren(children: readonly JSXChild[]): JSXChild[] {\n const result: JSXChild[] = [];\n for (const child of children) {\n if (!isInsignificant(child)) {\n result.push(child);\n }\n }\n return result;\n}\n\n/**\n * The text of an attribute's value as an expression, or `undefined` when the\n * value is not supported.\n */\nfunction expressionText(context: PassContext, attribute: JSXAttribute): string | undefined {\n const { value } = attribute;\n if (value === null) {\n // A bare attribute is `true`. The fold pass resolves those.\n return undefined;\n }\n switch (value.type) {\n case 'JSXExpressionContainer':\n if (value.expression.type === 'JSXEmptyExpression') {\n return undefined;\n }\n return `(${context.s.slice(value.expression.start, value.expression.end)})`;\n case 'JSXElement':\n case 'JSXFragment':\n return context.s.slice(value.start, value.end);\n default:\n // A string literal can hold HTML entities, which a JS string does not decode.\n return undefined;\n }\n}\n","/**\n * Ends each statement that relies on a line break.\n *\n * The other passes replace a read with text that can start with `(` or a\n * template literal, like `(p.close)()` for `props.close()`. After a statement\n * with no semicolon, that text continues the statement instead of starting a\n * new one, so `open()` and `(p.close)()` on separate lines call what `open()`\n * returned. A semicolon keeps the statements the parser found.\n */\nimport type { Node } from 'oxc-parser';\nimport { forEachChild } from './ast';\nimport type { PassContext } from './context';\n\nconst TERMINATED = new Set([\n 'BreakStatement',\n 'ContinueStatement',\n 'DebuggerStatement',\n 'DoWhileStatement',\n 'ExportAllDeclaration',\n 'ExpressionStatement',\n 'ImportDeclaration',\n 'ReturnStatement',\n 'ThrowStatement',\n 'TSTypeAliasDeclaration',\n 'VariableDeclaration',\n]);\n\nconst LOOP_HEADS = new Set(['ForStatement', 'ForInStatement', 'ForOfStatement']);\n\nfunction isTerminated(node: Node, context: PassContext): boolean {\n if (node.type === 'VariableDeclaration') {\n const parent = context.parents.get(node);\n return !(parent && LOOP_HEADS.has(parent.type) && Reflect.get(parent, 'body') !== node);\n }\n if (node.type === 'ExportNamedDeclaration') {\n return !node.declaration;\n }\n if (node.type === 'ExportDefaultDeclaration') {\n const { type } = node.declaration;\n return type !== 'FunctionDeclaration' && type !== 'ClassDeclaration';\n }\n return TERMINATED.has(node.type);\n}\n\nconst TRIVIA = /(?:\\s|\\/\\/[^\\n\\r\\u2028\\u2029]*|\\/\\*[\\s\\S]*?\\*\\/)*/y;\n\n/** Whether code other than the closing brace of a block follows `position`. */\nfunction hasCodeAfter(code: string, position: number): boolean {\n TRIVIA.lastIndex = position;\n TRIVIA.exec(code);\n return TRIVIA.lastIndex < code.length && code[TRIVIA.lastIndex] !== '}';\n}\n\nexport function terminateStatements(context: PassContext): boolean {\n const { code, s } = context;\n let changed = false;\n const visit = (node: Node): void => {\n if (isTerminated(node, context) && code[node.end - 1] !== ';' && hasCodeAfter(code, node.end)) {\n s.appendLeft(node.end, ';');\n changed = true;\n }\n forEachChild(node, visit);\n };\n visit(context.program);\n return changed;\n}\n","import type { SourceMap } from '@jridgewell/remapping';\nimport type { Program } from 'oxc-parser';\nimport remapping from '@jridgewell/remapping';\nimport MagicString from 'magic-string';\nimport type { Parents } from './ast';\nimport { collectParents, parse } from './ast';\nimport type { ImportedConstants } from './constants';\nimport { constantExports, namedImportSources, resolveImportedConstants } from './constants';\nimport type { PassContext, ResolvedOptions, Skip } from './context';\nimport { fold } from './fold';\nimport { inline } from './inline';\nimport { inlineMemos } from './memo';\nimport { repairNesting } from './nesting';\nimport { removeProviders } from './provider';\nimport { lowerConditionals } from './conditional';\nimport type { ScopeAnalysis } from './scope';\nimport { analyzeScopes } from './scope';\nimport { terminateStatements } from './terminate';\nimport type { Primitive } from './value';\n\nexport interface CompileOptions {\n /**\n * The file name, used to pick the parser (`.ts` and `.tsx` parse as\n * TypeScript, anything else as JSX) and as the source in the source map.\n *\n * @default 'input.jsx'\n */\n filename?: string;\n /**\n * Fold constants, remove unreachable code, and resolve control-flow\n * components whose props are constants.\n *\n * @default true\n */\n fold?: boolean;\n /**\n * Replace component calls with the component's body.\n *\n * @default true\n */\n inline?: boolean;\n /**\n * Remove context providers whose reads are all visible, and give each\n * read the provider's value.\n *\n * @default true\n */\n contexts?: boolean;\n /**\n * Replace a `createMemo` that always produces a new value and is read once\n * with its computation.\n *\n * @default true\n */\n memos?: boolean;\n /**\n * Replace a `<Show>` or `<Switch>` without callback children or `keyed`\n * with a ternary, which Solid's JSX transform compiles to memos without a\n * component.\n *\n * @default true\n */\n conditionals?: boolean;\n /**\n * The names of Solid's built-in components. A tag only folds when it is\n * one of these, and an empty list turns control-flow folding off.\n *\n * @default ['For', 'Show', 'Switch', 'Match', 'Loading', 'Reveal', 'Portal', 'Repeat', 'Dynamic', 'Errored']\n */\n builtIns?: readonly string[];\n /**\n * The modules that export Solid's built-in components. A tag imported from\n * anywhere else is a different component.\n *\n * @default ['solid-js', '@solidjs/web']\n */\n moduleSources?: readonly string[];\n /**\n * Top-level names that refer to Solid's built-in components, mapped to the\n * built-in's name. A bundler renames bindings, so a chunk can call `Show`\n * something else, or declare it instead of importing it.\n */\n builtInAliases?: Readonly<Record<string, string>>;\n /**\n * Treat a top-level `var` that nothing writes to as a constant. Bundlers\n * turn top-level `const` into `var`, so this is on for bundled chunks.\n *\n * @default false\n */\n constantVars?: boolean;\n /**\n * The constants imported modules export, keyed by the import specifier as\n * the code writes it, then by export name. An import of one of them folds\n * like a local `const`. `constantExports` reads them from a module.\n */\n importedConstants?: ImportedConstants;\n /**\n * Values of global names and paths that fold like constants, such as the\n * `define` entries of a bundler: `{ __DEV__: false, 'import.meta.env.MODE': 'production' }`.\n * A path starts at `import.meta` or at a name the module does not declare.\n */\n globalConstants?: Readonly<Record<string, Primitive>>;\n /**\n * The exports of imported modules that are contexts made by Solid's\n * `createContext`, keyed by the import specifier as the code writes it.\n * A provider of an imported context can be removed like a local one.\n */\n importedContexts?: Readonly<Record<string, readonly string[]>>;\n /**\n * Top-level components that other modules use too, by the number of\n * modules that use them, this one included. Inlining one here only counts\n * its share of the declaration, which goes away once every one of them\n * inlines it. `0` keeps it whatever is inlined, like a component that is\n * also passed as a value.\n */\n sharedComponents?: Readonly<Record<string, number>>;\n /**\n * Inline every component that can be, even where the copies are larger\n * than the calls and declaration they replace. By default, a component is\n * only inlined where its copies are estimated to be no larger.\n *\n * @default false\n */\n alwaysInline?: boolean;\n /**\n * Top-level components to inline wherever they can be, like\n * `alwaysInline` does for every component. The Vite plugin lists the\n * copies of components from `optimizer.packages` here.\n */\n alwaysInlineComponents?: readonly string[];\n /**\n * The most passes to run. One pass can expose work for the next, such as\n * an inlined component whose props now fold. Compilation stops early once\n * a pass changes nothing.\n *\n * @default 10\n */\n maxPasses?: number;\n /**\n * Generate a source map.\n *\n * @default true\n */\n sourceMap?: boolean;\n /**\n * Record what the inline, provider, and memo passes leave alone, and why.\n * The result lists them in `skipped`.\n *\n * @default false\n */\n report?: boolean;\n}\n\nexport interface CompileResult {\n code: string;\n /** The map from the output back to the input, or `null` when nothing changed or maps are off. */\n map: SourceMap | null;\n /**\n * What the last round left alone, and why, when `report` is set. The last\n * round changes nothing, unless `maxPasses` stopped the rounds first.\n */\n skipped?: Skip[];\n}\n\nconst DEFAULT_BUILT_INS = [\n 'For',\n 'Show',\n 'Switch',\n 'Match',\n 'Loading',\n 'Reveal',\n 'Portal',\n 'Repeat',\n 'Dynamic',\n 'Errored',\n];\n\nconst DEFAULT_MODULE_SOURCES = ['solid-js', '@solidjs/web'];\n\nfunction resolveOptions(options: CompileOptions): ResolvedOptions {\n // Each module's context names become a set.\n const importedContexts = new Map<string, Set<string>>();\n for (const [source, names] of Object.entries(options.importedContexts ?? {})) {\n importedContexts.set(source, new Set(names));\n }\n\n return {\n builtIns: new Set(options.builtIns ?? DEFAULT_BUILT_INS),\n moduleSources: options.moduleSources ?? DEFAULT_MODULE_SOURCES,\n builtInAliases: new Map(Object.entries(options.builtInAliases ?? {})),\n constantVars: options.constantVars ?? false,\n importedConstants: resolveImportedConstants(options.importedConstants),\n globalConstants: new Map(Object.entries(options.globalConstants ?? {})),\n importedContexts,\n sharedComponents: new Map(Object.entries(options.sharedComponents ?? {})),\n alwaysInline: options.alwaysInline ?? false,\n alwaysInlineComponents: new Set(options.alwaysInlineComponents ?? []),\n };\n}\n\ntype Pass = (context: PassContext) => boolean;\n\ninterface PassResult {\n code: string;\n map: string | undefined;\n}\n\n/** A parse of some code, which passes that change nothing can share. */\ninterface Parsed {\n readonly code: string;\n readonly program: Program;\n readonly parents: Parents;\n readonly scopes: ScopeAnalysis;\n}\n\nfunction parseCode(code: string, filename: string): Parsed {\n const program = parse(filename, code);\n return { code, program, parents: collectParents(program), scopes: analyzeScopes(program) };\n}\n\nfunction runPass(\n parsed: Parsed,\n filename: string,\n options: ResolvedOptions,\n sourceMap: boolean,\n pass: Pass,\n skips: Skip[] | undefined,\n): PassResult | undefined {\n const { code } = parsed;\n const context: PassContext = {\n code,\n filename,\n s: new MagicString(code),\n program: parsed.program,\n parents: parsed.parents,\n // A pass adds the names it gives out, so each pass starts from the parse's own.\n scopes: { ...parsed.scopes, names: new Set(parsed.scopes.names) },\n options,\n skips,\n };\n if (!pass(context)) {\n return undefined;\n }\n return {\n code: context.s.toString(),\n map: sourceMap\n ? context.s.generateMap({ source: filename, hires: true, includeContent: true }).toString()\n : undefined,\n };\n}\n\n/**\n * Optimizes JSX before it is lowered by Solid's JSX transform.\n *\n * The input is JavaScript or TypeScript with JSX, such as a module, or a\n * bundled chunk that kept its JSX. The output keeps JSX too, so the JSX\n * transform runs after this.\n *\n * The output changes the shape of the rendered tree, and with it the\n * hydration keys. A server build and its client build must compile the same\n * code with the same options.\n */\nexport function compile(code: string, options: CompileOptions = {}): CompileResult {\n const filename = options.filename ?? 'input.jsx';\n const sourceMap = options.sourceMap ?? true;\n const resolved = resolveOptions(options);\n const passes: Pass[] = [];\n if (options.fold ?? true) {\n passes.push(fold);\n }\n if (options.inline ?? true) {\n passes.push(inline);\n }\n if (options.contexts ?? true) {\n passes.push(removeProviders);\n }\n if (options.memos ?? true) {\n passes.push(inlineMemos);\n }\n\n const maps: string[] = [];\n let current = code;\n // A pass that changes nothing leaves the code as it was, so the next pass\n // reuses the parse instead of parsing the same code again.\n let parsed: Parsed | undefined;\n const parsedCurrent = (): Parsed => {\n if (parsed?.code !== current) {\n parsed = parseCode(current, filename);\n }\n return parsed;\n };\n const terminated = runPass(\n parsedCurrent(),\n filename,\n resolved,\n sourceMap,\n terminateStatements,\n undefined,\n );\n if (terminated) {\n current = terminated.code;\n if (terminated.map !== undefined) {\n maps.push(terminated.map);\n }\n }\n const start = current;\n const maxPasses = options.maxPasses ?? 10;\n let skipped: Skip[] | undefined;\n for (let round = 0; round < maxPasses; round += 1) {\n let changed = false;\n // Only the last round's skips are kept. An earlier round can skip what a later one takes.\n skipped = options.report === true ? [] : undefined;\n for (const pass of passes) {\n const result = runPass(parsedCurrent(), filename, resolved, sourceMap, pass, skipped);\n if (result) {\n changed = true;\n current = result.code;\n if (result.map !== undefined) {\n maps.push(result.map);\n }\n }\n }\n if (!changed) {\n break;\n }\n }\n\n // `<Show>` and `<Switch>` are lowered last. The other passes read `when` of\n // `<Show>` and `<Match>` as a tracked place, and a ternary's condition is\n // not one. A lowered one can hold another, which the next round lowers.\n if (options.conditionals ?? true) {\n for (let round = 0; round < maxPasses; round += 1) {\n const result = runPass(\n parsedCurrent(),\n filename,\n resolved,\n sourceMap,\n lowerConditionals,\n undefined,\n );\n if (!result) {\n break;\n }\n current = result.code;\n if (result.map !== undefined) {\n maps.push(result.map);\n }\n }\n }\n\n // A pass can put an element straight inside a parent that cannot hold it,\n // which Solid's JSX transform rejects. Only a changed module can have one\n // that its source did not.\n if (current !== start) {\n const result = runPass(\n parsedCurrent(),\n filename,\n resolved,\n sourceMap,\n repairNesting,\n undefined,\n );\n if (result) {\n current = result.code;\n if (result.map !== undefined) {\n maps.push(result.map);\n }\n }\n }\n\n const report = skipped ? { skipped } : {};\n // Semicolons alone are no reason to change a module.\n if (current === start) {\n return { code, map: null, ...report };\n }\n if (maps.length === 0) {\n return { code: current, map: null, ...report };\n }\n // Each map points at the output of the pass before it, so they chain from the last one.\n return { code: current, map: remapping(maps.reverse(), () => null), ...report };\n}\n\nexport interface ModuleConstants {\n /**\n * The modules this module imports or re-exports named bindings from, as\n * written. `importedConstants` of `compile` takes their constants.\n */\n imports: string[];\n /**\n * The constants this module exports, by export name: `export const`\n * bindings whose value folds, names exported from them, and names\n * re-exported from `importedConstants`.\n */\n exports: Record<string, Primitive>;\n}\n\n/**\n * Reads what a module imports and the constants it exports, so that\n * `compile` can fold them in the modules that import it.\n *\n * Only `filename`, `importedConstants`, and `globalConstants` of the options are used.\n */\nexport function readModuleConstants(\n code: string,\n options: Pick<CompileOptions, 'filename' | 'importedConstants' | 'globalConstants'> = {},\n): ModuleConstants {\n const program = parse(options.filename ?? 'input.jsx', code);\n const scopes = analyzeScopes(program);\n return {\n imports: namedImportSources(program, scopes),\n exports: constantExports(program, resolveOptions(options), scopes),\n };\n}\n"],"mappings":";;;;;;;;AAMA,MAAM,4BAAY,IAAI,IAAI;CACxB;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAMD,MAAM,yCAAyB,IAAI,IAAI;CACrC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,OAAO,OAA+B;CACpD,OACE,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAS,OAAO,MAAM,SAAS;AAE5F;;;;AAKA,SAAgB,aAAa,MAAY,OAAoC;CAC3E,IAAI,KAAK,KAAK,WAAW,IAAI,GAAG;EAC9B,IAAI,uBAAuB,IAAI,KAAK,IAAI,GAAG;GACzC,MAAM,aAAsB,QAAQ,IAAI,MAAM,YAAY;GAC1D,IAAI,OAAO,UAAU,GACnB,MAAM,UAAU;EAEpB,OAAO,IAAI,KAAK,SAAS,uBACvB,MAAM,KAAK,SAAS;EAEtB;CACF;CACA,IAAI,CAAC,OAAO,OAAO,aAAa,KAAK,IAAI,GACvC;CAEF,KAAK,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