solid-optimizer 0.4.0 → 1.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -47
- package/dist/{compile-BQuBDA0Q.d.mts → compile-BRCj4UN7.d.mts} +15 -22
- package/dist/compile-BRCj4UN7.d.mts.map +1 -0
- package/dist/{compile-D3caSUtw.mjs → compile-Cz6hbiQv.mjs} +943 -670
- package/dist/compile-Cz6hbiQv.mjs.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/vite.d.mts +3 -10
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +305 -204
- package/dist/vite.mjs.map +1 -1
- package/package.json +10 -11
- package/src/compile.ts +16 -40
- package/src/constants.ts +42 -2
- package/src/context.ts +3 -0
- package/src/copy-size.ts +73 -0
- package/src/fold.ts +619 -17
- package/src/inline.ts +352 -292
- package/src/memo.ts +161 -30
- package/src/provider.ts +40 -75
- package/src/scope.ts +14 -1
- package/src/size.ts +35 -75
- package/src/vite/globals.ts +67 -0
- package/src/vite/index.ts +279 -264
- package/src/vite/inject.ts +14 -4
- package/src/vite/runtime.ts +23 -3
- package/dist/compile-BQuBDA0Q.d.mts.map +0 -1
- package/dist/compile-D3caSUtw.mjs.map +0 -1
- package/src/server.ts +0 -275
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-D3caSUtw.mjs","names":["exportName","continuesPreviousStatement"],"sources":["../src/ast.ts","../src/context.ts","../src/scope.ts","../src/value.ts","../src/constants.ts","../src/jsx.ts","../src/fold.ts","../src/provider.ts","../src/size.ts","../src/inline.ts","../src/memo.ts","../src/server.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: languageOf(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 languageOf(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 ) {\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';\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 /** 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}\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 textOf(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 // `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 case 'TSDeclareFunction':\n if (node.id) {\n this.declare(node.id, 'function', node);\n }\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 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\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 node.expressions.every(isSideEffectFree);\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 node.expressions.every(isSideEffectFree);\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 return node.elements.every(\n (element) =>\n element === null || (element.type !== 'SpreadElement' && isSideEffectFree(element)),\n );\n case 'ObjectExpression':\n return node.properties.every(\n (property) =>\n // A spread reads the source's own properties, which a getter observes.\n property.type === 'Property' &&\n (!property.computed || isSideEffectFree(property.key)) &&\n isSideEffectFree(property.value),\n );\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 if (node.elements.some((element) => element?.type === 'SpreadElement')) {\n return undefined;\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 { 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 result.set(source, new Map(Object.entries(exports).map(([name, value]) => [name, { value }])));\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);\n }\n if (!scopes.references.has(reference) || reference.type !== 'Identifier') {\n return undefined;\n }\n const binding = scopes.references.get(reference);\n return binding ? this.constantOf(binding) : globalValue(reference.name);\n };\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 constantOf(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 */\nexport function namedImportSources(program: Program): string[] {\n const sources = new Set<string>();\n for (const statement of program.body) {\n if (statement.type === 'ImportDeclaration') {\n if (\n statement.importKind !== 'type' &&\n statement.specifiers.some(\n (specifier) => !(specifier.type === 'ImportSpecifier' && specifier.importKind === 'type'),\n )\n ) {\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\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.constantOf(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.constantOf(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, JSXText, Node } from 'oxc-parser';\nimport { isFilteredText } from './ast';\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 replacement starts with. */\n startText: JSXText | undefined;\n /** The JSX text the replacement ends with. */\n endText: JSXText | undefined;\n}\n\nexport function keptPiece(node: JSXChild): Piece {\n const text = node.type === 'JSXText' ? node : 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 {\n node,\n text: s.slice(first.start, last.end),\n startText: first.type === 'JSXText' ? first : undefined,\n endText: last.type === 'JSXText' ? last : undefined,\n };\n}\n\nexport function replacedPiece(node: JSXChild, text: string): Piece {\n return { node, text, startText: undefined, endText: undefined };\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: JSXText | undefined, after: JSXText | undefined): boolean {\n return (\n before !== undefined &&\n after !== undefined &&\n !(isFilteredText(before) && isFilteredText(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 return element.openingElement.attributes.some(\n (attribute) => attribute.type === 'JSXSpreadAttribute',\n );\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 return children.some((child) => {\n if (child.type !== 'JSXExpressionContainer') {\n return false;\n }\n let expression: Node = child.expression;\n while (expression.type === 'ParenthesizedExpression') {\n expression = expression.expression;\n }\n return (\n expression.type === 'ArrowFunctionExpression' || expression.type === 'FunctionExpression'\n );\n });\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 * 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 * It follows the `optimize` option of Solid 2.0's `@solidjs/compiler`\n * (https://github.com/solidjs/solid/pull/3231), applied to Solid 1's\n * control-flow components.\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 * - `<Show when>`, `<For each>`, `<Index each>`, `<Switch>`/`<Match when>`,\n * and `<Dynamic component>` with a static intrinsic tag name.\n *\n * # What does not fold\n *\n * `<Portal>`, `<Suspense>`, `<SuspenseList>`, and `<ErrorBoundary>` exist for\n * a runtime 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 IfStatement,\n JSXChild,\n JSXElement,\n JSXFragment,\n LogicalExpression,\n Node,\n Statement,\n WhileStatement,\n} from 'oxc-parser';\nimport type { Parents } from './ast';\nimport {\n forEachChild,\n isInsignificant,\n isIntrinsicTag,\n isJSXChild,\n isPrimary,\n needsParensAt,\n startsLikeStatement,\n} from './ast';\nimport type { PassContext } from './context';\nimport { ConstantTable } from './constants';\nimport { solidExport, textOf } 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 { 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', 'Index', '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 * 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/**\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\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 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 (textOf(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 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 || !PURE_CALLS.has(identity)) {\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 private foldConstant(node: Node): void {\n if (isLiteralForm(node)) {\n return;\n }\n const value = 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 = textOf(this.context, value);\n return needsParensAt(target, value, this.context.parents) ? `(${text})` : text;\n }\n const texts = parts.map((part) => textOf(this.context, part));\n texts.push(textOf(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 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 case 'Index':\n return this.foldFor(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 { kind: 'jsx', text: textOf(this.context, 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 { kind: 'jsx', text: textOf(this.context, value.expression) };\n }\n return {\n kind: 'expression',\n text: textOf(this.context, value.expression),\n primary: isPrimary(value.expression),\n };\n }\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` and `indexArray` treat 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 || !isSideEffectFree(expression)) {\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 const winner = matches.findIndex((item) => item.when === true);\n if (winner !== -1 && matches.slice(0, winner).every((item) => item.when === false)) {\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 (matches.every((item) => item.when === false)) {\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 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 = value.value;\n } else if (\n value.type === 'JSXExpressionContainer' &&\n value.expression.type !== 'JSXEmptyExpression'\n ) {\n const result = evaluate(value.expression, this.lookup);\n if (typeof result?.value === 'string') {\n tag = result.value;\n }\n }\n if (tag === undefined || !isIntrinsicTag(tag)) {\n return undefined;\n }\n const attributes = element.openingElement.attributes\n .filter((attribute) => attribute !== component)\n .map((attribute) => textOf(this.context, attribute));\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 = resolved.children.filter((child) => !isInsignificant(child));\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 textOf(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 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 // 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 if (first && last && !unreachable.some(containsHoistedDeclaration)) {\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 = parts.map((part) => textOf(this.context, part)).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(textOf(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 1, a context carries a provider component, `Ctx.Provider`. The\n * provider reads `props.value` once, untracked, when it is created, and\n * every `useContext(Ctx)` under it returns that value. When every code path\n * that can run under a provider is visible, each read can take the value\n * directly, and the provider only costs a component call, a render effect,\n * and a template boundary:\n *\n * ```jsx\n * <Theme.Provider value=\"dark\">\n * <span>{useContext(Theme)}</span>\n * </Theme.Provider>\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 owner is gone, which shifts the hydration keys after\n * it. A server build and its client build must compile with the same\n * 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 'createComputed',\n 'onCleanup',\n 'onMount',\n 'untrack',\n 'batch',\n 'useContext',\n 'mapArray',\n 'indexArray',\n 'mergeProps',\n 'splitProps',\n];\n\n/** Primitives that return a getter and a setter, as `[get, set]`. */\nconst ACCESSOR_PAIRS = new Set(['createSignal']);\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: `Ctx.Provider`, where `Ctx` is a\n * top-level `createContext(...)` from Solid that nothing writes to, with one\n * `value` attribute holding a value that is never `undefined`.\n *\n * `useContext` returns the default when the value is `undefined`, so a\n * value that could be `undefined` keeps its provider.\n */\nexport function providerOf(context: PassContext, element: JSXElement): Provider | undefined {\n const binding = providerContext(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 context a `Ctx.Provider` tag provides.\n */\nexport function providerContext(context: PassContext, name: Node): Binding | undefined {\n if (\n name.type !== 'JSXMemberExpression' ||\n name.object.type !== 'JSXIdentifier' ||\n name.property.name !== 'Provider'\n ) {\n return undefined;\n }\n return contextBinding(context, name.object);\n}\n\n/**\n * The top-level context binding an 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 const index = id.elements.findIndex((element) => element === binding.identifier);\n return index === 0 || index === 1;\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 `mergeProps()`, 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 `mergeProps()` or `splitProps()` view of a\n * component's 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 call = binding ? viewInit(context, binding) : undefined;\n }\n if (call?.type !== 'CallExpression') {\n return false;\n }\n const callee = solidCallee(context, call);\n if (callee !== 'mergeProps' && callee !== 'splitProps') {\n return false;\n }\n return call.arguments.every((argument) => {\n if (argument.type === 'SpreadElement') {\n return false;\n }\n const inner = unwrap(argument);\n return (\n inner.type === 'ObjectExpression' ||\n (inner.type === 'ArrayExpression' &&\n inner.elements.every((key) => key?.type === 'Literal' && typeof key.value === 'string')) ||\n isOwnView(context, inner, props, depth + 1)\n );\n });\n}\n\n/**\n * The call a view binding comes from: `const view = mergeProps(...)`, or\n * one of the names in `const [a, b] = splitProps(...)`.\n */\nfunction viewInit(context: PassContext, binding: Binding): Node | undefined {\n const init = constantInit(context, binding);\n if (init) {\n return unwrap(init);\n }\n const { declaration } = binding;\n if (\n binding.mutated ||\n binding.kind !== 'const' ||\n declaration.type !== 'VariableDeclarator' ||\n declaration.id.type !== 'ArrayPattern' ||\n !declaration.id.elements.some((element) => element === binding.identifier) ||\n !declaration.init\n ) {\n return undefined;\n }\n return unwrap(declaration.init);\n}\n\nfunction isVisibleElement(\n context: PassContext,\n element: JSXElement,\n options: ClosedOptions,\n): boolean {\n const { name } = element.openingElement;\n if (providerContext(context, name)) {\n return true;\n }\n if (name.type !== 'JSXIdentifier') {\n return false;\n }\n if (isIntrinsicTag(name.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 = contextValueOf(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 contextValueOf(\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 = objectLiteralOf(context, member.object, options, 0);\n if (!object || object.properties.some((property) => property.type !== 'Property')) {\n return false;\n }\n const { name } = member.property;\n const matches = object.properties.filter(\n (property) =>\n property.type === 'Property' &&\n !property.computed &&\n property.key.type === 'Identifier' &&\n property.key.name === name,\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 objectLiteralOf(\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 = contextValueOf(context, expression, options);\n return value ? objectLiteralOf(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 ? objectLiteralOf(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 providerContext(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 providerContext(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 = providerOf(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 const overlaps = this.removed.some(\n (other) => element.start < other.end && other.start < element.end,\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 = providerContext(this.context, node.openingElement.name);\n if (binding && !providerOf(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 closed = children.every((child) =>\n isClosed(this.context, child, {\n component: () => false,\n contextValue: (target) => (target === provider.context ? provider.value : undefined),\n onOpen: (open) => {\n reason = open;\n },\n }),\n );\n if (!closed) {\n this.skip(provider, reason);\n return false;\n }\n const reads = children.flatMap((child) => contextReads(this.context, child, provider.context));\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 * 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 JSXAttribute,\n JSXAttributeItem,\n JSXChild,\n JSXElement,\n JSXElementName,\n JSXFragment,\n Node,\n} from 'oxc-parser';\nimport MagicString from 'magic-string';\nimport {\n collectParents,\n forEachChild,\n isInsignificant,\n isIntrinsicTag,\n parse,\n unwrap,\n} from './ast';\nimport type { ResolvedOptions } from './context';\nimport { fold } from './fold';\nimport { analyzeScopes } from './scope';\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\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 === '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 = element.children.filter((child) => !isInsignificant(child));\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 name of the function a copy is wrapped in to be folded and measured. */\nconst WRAPPER = '__so_size__';\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. `inTemplate` is whether the call site sits directly in\n * an element.\n */\nexport function copySize(\n filename: string,\n header: string,\n copy: Copy,\n inTemplate: boolean,\n options: ResolvedOptions,\n): number {\n let code = `${header}\\nfunction ${WRAPPER}() {\\n${copy.statements.join('\\n')}\\nreturn (${copy.root});\\n}\\n`;\n // Constant props fold the copy's conditions, as later passes would.\n for (let round = 0; round < 3; round += 1) {\n const program = parse(filename, code);\n const s = new MagicString(code);\n const changed = fold({\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 if (!changed) {\n break;\n }\n code = s.toString();\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 const argument = statement.argument ? unwrap(statement.argument) : undefined;\n if (argument?.type === 'JSXElement' || argument?.type === 'JSXFragment') {\n size += estimator.jsx(argument, inTemplate);\n } else if (argument) {\n size += (inTemplate ? INSERT + WALK : 0) + estimator.node(argument);\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.\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, no `ref`,\n * and no namespaced attribute.\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: a component itself, which\n * also runs untracked. The call has to be in that returned JSX with only\n * intrinsic elements and fragments around it, so it is created exactly once\n * each time that function 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 `mergeProps()` and `splitProps()` views\n * declared in the component. Each call site knows which props it passes, so\n * a read of a view resolves to a prop, a prop with a literal default, a\n * default, or `undefined`, and a spread of a view becomes the attributes it\n * 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 `onMount` and effect\n * registration across siblings can change.\n */\nimport MagicString from 'magic-string';\nimport type {\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 ReturnStatement,\n Statement,\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 { isConstantDeclaration, recordSkip, solidExport, textOf } from './context';\nimport type { Piece } from './jsx';\nimport type { ClosedOptions, Provider } from './provider';\nimport {\n contextReads,\n findProviders,\n isClosed,\n providerContext,\n solidCallee,\n stableValueText,\n} from './provider';\nimport { keptPiece, replacedPiece, writePieces } from './jsx';\nimport type { Binding, Scope } from './scope';\nimport { isWithinScope, lookup, scopeAt } from './scope';\nimport { SizeEstimator, copySize } 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 `mergeProps()` or `splitProps()` view: the props, or an\n * object of literal defaults, with the keys a `splitProps()` hides from it\n * or keeps only.\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 /** The only keys it holds, for a group `splitProps()` picked. */\n readonly only: ReadonlySet<string> | undefined;\n}\n\n/** A props object made with `mergeProps()` and `splitProps()`, in source order. */\ninterface View {\n readonly sources: readonly ViewSource[];\n}\n\ninterface ViewRead extends PropRead {\n readonly view: View;\n}\n\n/**\n * What a key of a view reads as at a call site: the prop, the prop with a\n * default for when it is `undefined`, or a text.\n */\ntype Resolution =\n | { readonly kind: 'props' }\n | { readonly kind: 'fallback'; readonly text: string }\n | { readonly kind: 'text'; readonly text: string };\n\ninterface ResolvedSpread {\n readonly spread: ViewSpread;\n readonly keys: ReadonlyMap<string, Resolution>;\n}\n\ninterface ResolvedViews {\n /** Reads of the props, including view reads the props answer. */\n readonly propReads: readonly PropRead[];\n /** View reads the props answer, unless the prop is `undefined`. */\n readonly fallbacks: ReadonlyMap<PropRead, string>;\n /** View reads a default or nothing answers, and their text. */\n readonly texts: ReadonlyMap<Node, string>;\n readonly spreads: readonly ResolvedSpread[];\n}\n\n/**\n * A prop read that falls back to a default when the prop is `undefined`,\n * the way `mergeProps()` reads it.\n */\nfunction withFallback(text: string, fallback: string): string {\n return `((value) => (value !== undefined ? value : ${fallback}))(${text})`;\n}\n\nfunction allows(source: ViewSource, key: string): boolean {\n return !source.hidden.has(key) && (source.only === undefined || source.only.has(key));\n}\n\n/**\n * Whether an expression passed as a prop is never `undefined`.\n */\nfunction isDefinedExpression(node: Expression): boolean {\n const inner = unwrap(node);\n switch (inner.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 default:\n return evaluate(inner, () => undefined)?.value !== undefined;\n }\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 `mergeProps()` or `splitProps()` 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 = pending.filter(\n (site) =>\n !pending.some(\n (other) =>\n other !== site &&\n (isWithin(other.element, site.component.fn) || isWithin(other.element, site.element)),\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\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 * 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 */\nexport function 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 functionOf(binding: Binding, options: ResolvedOptions): 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 attributesOf(element: JSXElement): 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 or `ref` is\n // something the JSX transform handles on its own.\n if (\n attribute.type !== 'JSXAttribute' ||\n attribute.name.type !== 'JSXIdentifier' ||\n attribute.name.name === 'ref' ||\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 * Why `attributesOf` 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 scopeOf(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 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 = functionOf(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.scopeOf(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\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 statements = statements.filter((statement) => !views.declarations.includes(statement));\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 `mergeProps()` and `splitProps()` views of the props declared\n * in a component's statements, and how each is used. A view can only be\n * read 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?.init\n ) {\n continue;\n }\n const init = unwrap(declarator.init);\n if (init.type !== 'CallExpression') {\n continue;\n }\n const callee = solidCallee(this.context, init);\n let declared: [Node | null, View][] | null | undefined;\n if (callee === 'mergeProps' && declarator.id.type === 'Identifier') {\n const view = this.viewOf(init, param, views, args);\n declared = view ? [[declarator.id, view]] : view;\n } else if (callee === 'splitProps' && declarator.id.type === 'ArrayPattern') {\n declared = this.splitViews(init, declarator.id.elements, param, views, args);\n } else {\n continue;\n }\n if (declared === null) {\n continue;\n }\n if (!declared) {\n return undefined;\n }\n for (const [identifier, view] of declared) {\n if (identifier?.type !== 'Identifier') {\n continue;\n }\n const binding = scope.bindings.get(identifier.name);\n if (!binding || binding.mutated) {\n return undefined;\n }\n views.set(binding, view);\n }\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(), only: undefined }] };\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 sources a view argument stands for: the props, a view, or a nested\n * `mergeProps()` call.\n */\n private viewSources(\n argument: Node,\n param: Binding | undefined,\n views: ReadonlyMap<Binding, View>,\n args: Set<Node>,\n ): readonly ViewSource[] | undefined {\n if (argument.type === 'CallExpression') {\n if (solidCallee(this.context, argument) !== 'mergeProps') {\n return undefined;\n }\n return this.viewOf(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(), only: undefined }];\n }\n return binding ? views.get(binding)?.sources : undefined;\n }\n\n /**\n * The view a `mergeProps()` call makes. `null` when it does not take the\n * props or another view, and `undefined` when it does but its other\n * arguments are not literal objects.\n */\n private viewOf(\n call: CallExpression,\n param: Binding | undefined,\n views: ReadonlyMap<Binding, View>,\n args: Set<Node>,\n ): View | null | undefined {\n const involved = call.arguments.some(\n (argument) =>\n argument.type !== 'SpreadElement' &&\n this.viewSources(unwrap(argument), param, views, new Set()) !== undefined,\n );\n if (!involved) {\n return null;\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 = this.viewSources(inner, param, views, args);\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(), only: undefined });\n }\n return { sources };\n }\n\n /**\n * The views `const [a, b, rest] = splitProps(view, ['x'], ['y'])` makes,\n * each with its identifier. A key belongs to the first group that names\n * it, and the last view holds the keys no group names. `null` when the\n * call does not take the props or a view.\n */\n private splitViews(\n call: CallExpression,\n elements: readonly (Node | null)[],\n param: Binding | undefined,\n views: ReadonlyMap<Binding, View>,\n args: Set<Node>,\n ): [Node | null, View][] | null | undefined {\n const first = call.arguments.at(0);\n if (first === undefined || first.type === 'SpreadElement') {\n return null;\n }\n const target = unwrap(first);\n const base = this.viewSources(target, param, views, args);\n if (!base) {\n return null;\n }\n args.add(target);\n const groups: string[][] = [];\n for (const group of call.arguments.slice(1)) {\n if (group.type !== 'ArrayExpression') {\n return undefined;\n }\n const keys: string[] = [];\n for (const key of group.elements) {\n if (key?.type !== 'Literal' || typeof key.value !== 'string') {\n return undefined;\n }\n keys.push(key.value);\n }\n groups.push(keys);\n }\n if (\n elements.length > groups.length + 1 ||\n elements.some((element) => element?.type === 'RestElement')\n ) {\n return undefined;\n }\n const claimed = new Set<string>();\n const filters = groups.map((keys) => {\n const owned = keys.filter((key) => !claimed.has(key));\n for (const key of owned) {\n claimed.add(key);\n }\n return new Set(owned);\n });\n return elements.map((element, index): [Node | null, View] => {\n const only = filters.at(index);\n const sources = base.map((source) => ({\n defaults: source.defaults,\n hidden: only ? source.hidden : new Set([...source.hidden, ...claimed]),\n only: only\n ? new Set([...only].filter((key) => source.only === undefined || source.only.has(key)))\n : source.only,\n }));\n return [element, { sources }];\n });\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 * 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 hostOf(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.transparent.has(parent) ||\n this.assumedHosts?.has(parent) === true ||\n (name.type === 'JSXIdentifier' && isIntrinsicTag(name.name));\n if (!passable) {\n return undefined;\n }\n const child = node;\n if (!parent.children.some((item) => item === 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.isComponentFunction(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.isComponentFunction(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 (children.some((child) => child.type === 'JSXSpreadChild')) {\n return undefined;\n }\n const significant = children.filter((child) => !isInsignificant(child));\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 !== textOf(this.context, only.expression)) {\n return value;\n }\n text = value.text;\n primary = value.primary;\n } else {\n text = textOf(this.context, only);\n }\n return { kind: 'children', children, text, primary };\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: textOf(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 = textOf(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(base: string): string {\n const names = this.scratchNames ?? this.context.scopes.names;\n let index = 1;\n let name = `${base}$${String(index)}`;\n while (names.has(name)) {\n index += 1;\n name = `${base}$${String(index)}`;\n }\n names.add(name);\n return name;\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 = attributesOf(element);\n if (!attributes) {\n this.reason = callSiteReason(element);\n return undefined;\n }\n const hasChildren = element.children.some((child) => !isInsignificant(child));\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, element, 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 read of views.fallbacks.keys()) {\n count(read.name, read);\n }\n for (const spread of views.spreads) {\n for (const [key, resolution] of spread.keys) {\n if (resolution.kind !== 'text') {\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 {\n value = this.propValue(attributes.get(name), reads, fresh, snapshots);\n }\n if (!value) {\n this.reason = '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.hostOf(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 statements.push(copy.slice(first.start, last.end));\n }\n return {\n element,\n host,\n statements,\n root: copy.slice(component.root.start, component.root.end),\n };\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 const entry = this.hosts.get(site.host.fn) ?? { host: site.host.host, texts: [] };\n entry.texts.push(...site.statements);\n this.hosts.set(site.host.fn, entry);\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 ? providerContext(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(components.map((component) => [component.binding, component]));\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 = sites.some(\n (site) => isWithin(site.element, element) && site.element !== element,\n );\n if (!inside) {\n continue;\n }\n const isClosedNode = closedUnder(provider);\n const closed = element.children.every((child) => isClosedNode(child));\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.hostOf(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 const entry = this.hosts.get(host.fn) ?? { host: host.host, texts: [] };\n entry.texts.push(`const ${name} = ${textOf(this.context, provider.value)};`);\n this.hosts.set(host.fn, entry);\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.\n * `mergeProps()` reads the last source whose value is not `undefined`, so\n * a prop that can be `undefined` falls back to the default behind it. A\n * spread becomes the keys it holds, and its `children` become the\n * element's children. `undefined` when a spread repeats an attribute, or\n * holds `children` for an element that has some.\n */\n private resolveViews(\n component: Component,\n element: JSXElement,\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 // Whether the prop the call site passes for `key` is never `undefined`.\n const defined = (key: string): boolean => {\n const attribute = attributes.get(key);\n if (attribute) {\n const { value } = attribute;\n if (value?.type !== 'JSXExpressionContainer') {\n return true;\n }\n return (\n value.expression.type !== 'JSXEmptyExpression' && isDefinedExpression(value.expression)\n );\n }\n const significant = element.children.filter((child) => !isInsignificant(child));\n const only = significant.at(0);\n if (significant.length !== 1 || only?.type !== 'JSXExpressionContainer') {\n return true;\n }\n return only.expression.type !== 'JSXEmptyExpression' && isDefinedExpression(only.expression);\n };\n const resolve = (view: View, key: string): Resolution => {\n const sources = view.sources.filter((source) => allows(source, key));\n for (let index = sources.length - 1; index >= 0; index -= 1) {\n const source = sources.at(index);\n const text = source?.defaults?.get(key);\n if (text !== undefined) {\n return { kind: 'text', text };\n }\n if (source && !source.defaults && has(key)) {\n if (defined(key)) {\n return { kind: 'props' };\n }\n const fallback = sources\n .slice(0, index)\n .findLast((earlier) => earlier.defaults?.has(key))\n ?.defaults?.get(key);\n return fallback === undefined ? { kind: 'props' } : { kind: 'fallback', text: fallback };\n }\n }\n return { kind: 'text', text: 'void 0' };\n };\n\n const propReads: PropRead[] = [...component.props];\n const fallbacks = new Map<PropRead, string>();\n const texts = new Map<Node, string>();\n for (const read of component.viewReads) {\n const resolution = resolve(read.view, read.name);\n if (resolution.kind === 'props') {\n propReads.push(read);\n } else if (resolution.kind === 'fallback') {\n fallbacks.set(read, resolution.text);\n } else {\n texts.set(read.member, resolution.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 // Keys come in the order the sources first hold them.\n const order = new Set<string>();\n for (const source of spread.view.sources) {\n const keys = source.defaults ? [...source.defaults.keys()] : callKeys;\n for (const key of keys.filter((name) => allows(source, name))) {\n order.add(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 : textOf(this.context, attribute.name),\n );\n }\n }\n taken.set(spread.element, names);\n }\n const keys = new Map<string, Resolution>();\n for (const key of order) {\n const resolution = resolve(spread.view, key);\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 && resolution.kind !== 'fallback'\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, resolution);\n }\n spreads.push({ spread, keys });\n }\n return { propReads, fallbacks, 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 [read, fallback] of views.fallbacks) {\n const text = values.get(read.name)?.text ?? 'void 0';\n copy.overwrite(read.member.start, read.member.end, withFallback(text, fallback));\n }\n for (const { spread, keys } of views.spreads) {\n const parts: string[] = [];\n let children: string | undefined;\n for (const [key, resolution] of keys) {\n const value = values.get(key);\n if (key === 'children') {\n children = this.spreadChildren(element, resolution, value);\n continue;\n }\n let text = value?.text ?? 'void 0';\n if (resolution.kind === 'text') {\n text = resolution.text;\n } else if (resolution.kind === 'fallback') {\n text = withFallback(text, resolution.text);\n }\n parts.push(`${key}={${text}}`);\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 const tag = textOf(this.context, opening.name);\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 resolution: Resolution,\n value: PropValue | undefined,\n ): string | undefined {\n if (resolution.kind === 'text') {\n return resolution.text === 'void 0' ? undefined : `{${resolution.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 writePieces(\n copy,\n parent.children.map((child) => pieces.get(child) ?? keptPiece(child)),\n );\n }\n }\n\n private splicedPiece(container: JSXExpressionContainer, value: PropValue): Piece {\n if (value.kind === 'children') {\n const first = value.children.at(0);\n const last = value.children.at(-1);\n if (!first || !last) {\n return replacedPiece(container, '');\n }\n return {\n node: container,\n text: this.context.s.slice(first.start, last.end),\n startText: first.type === 'JSXText' ? first : undefined,\n endText: last.type === 'JSXText' ? last : undefined,\n };\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 if (this.context.options.alwaysInline) {\n for (const component of byComponent.keys()) {\n result.add(component);\n }\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 copiesOf.set(\n component,\n new Map(elements.map((element) => [element, this.prepare(component, element)])),\n );\n }\n for (const [component, byElement] of copiesOf) {\n const copies = [...byElement.values()].filter((copy) => copy !== undefined);\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 }\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 [...copies.values()].some((copy) => copy === undefined)\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 = copies.map((copy) => copy.element);\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 && elements.some((outer) => isWithin(element, outer))) {\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 = [...byElement.values()].filter((copy) => copy !== undefined);\n const then = [...enabled.values()].filter((copy) => copy !== undefined);\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 for (const copy of copies) {\n const inTemplate = this.sitsInTemplate(copy.element);\n calls += estimator.jsx(copy.element, inTemplate);\n inlined += copySize(\n this.context.filename,\n this.sizeHeader(),\n copy,\n inTemplate,\n this.context.options,\n );\n }\n return calls - inlined;\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 /**\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 const imports = this.context.program.body\n .filter((statement) => statement.type === 'ImportDeclaration')\n .map((statement) => this.context.code.slice(statement.start, statement.end));\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 run(): void {\n const components: Component[] = [];\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 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 if (parent?.type === 'JSXOpeningElement' && element?.type === 'JSXElement') {\n sites.push({ component, element });\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 = elements.some((element) =>\n copied.some(\n (other) =>\n other !== component && element.start >= other.fn.start && element.end <= other.fn.end,\n ),\n );\n if (component.declaration && otherUses.get(component) === 0 && !insideCopy) {\n this.context.s.remove(component.declaration.start, component.declaration.end);\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 // The provider pass reports providers.\n if (providerContext(this.context, tag)) {\n return undefined;\n }\n if (tag.type === 'JSXMemberExpression') {\n return { reason: 'member-tag', name: textOf(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 (identity !== undefined && this.context.options.builtIns.has(identity)) {\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 this.context.s.prependRight(\n host.statement.start,\n texts.map((text) => `${text}\\n${indent}`).join(''),\n );\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 * 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 * # 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 */\nimport type {\n ArrowFunctionExpression,\n Expression,\n Function as FunctionNode,\n Node,\n VariableDeclarator,\n} from 'oxc-parser';\nimport { isFunctionNode, isIntrinsicTag, unwrap } from './ast';\nimport type { PassContext } from './context';\nimport { recordSkip, solidExport, textOf } from './context';\nimport { usesFunctionContext } from './inline';\nimport type { Binding } from './scope';\nimport { lookup, scopeAt } from './scope';\nimport { isSideEffectFree } from './value';\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 ['Index', 'each'],\n]);\n\n/**\n * Whether evaluating `node` always creates a new value, which reference\n * equality never finds equal to the last one.\n */\nfunction isFresh(node: Node): boolean {\n switch (node.type) {\n case 'ObjectExpression':\n case 'ArrayExpression':\n case 'ArrowFunctionExpression':\n case 'FunctionExpression':\n case 'ClassExpression':\n case 'NewExpression':\n case 'JSXElement':\n case 'JSXFragment':\n return true;\n case 'ParenthesizedExpression':\n return isFresh(node.expression);\n case 'ConditionalExpression':\n return isFresh(node.consequent) && isFresh(node.alternate);\n case 'SequenceExpression': {\n const last = node.expressions.at(-1);\n return last !== undefined && isFresh(last);\n }\n default:\n return false;\n }\n}\n\n/**\n * The expression a compute function returns, when that is all it does.\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 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 private isCreateMemo(callee: Node): boolean {\n if (callee.type !== 'Identifier') {\n return false;\n }\n const binding = this.context.scopes.references.get(callee);\n return binding !== undefined && solidExport(binding, this.context.options) === 'createMemo';\n }\n\n /**\n * The computation of a memo whose result is never equal to its last one.\n */\n private unstableComputation(declarator: VariableDeclarator): Expression | undefined {\n const init = declarator.init ? unwrap(declarator.init) : undefined;\n if (init?.type !== 'CallExpression' || !this.isCreateMemo(init.callee)) {\n return undefined;\n }\n // Solid 1 takes `createMemo(compute, initialValue?, options?)`. The\n // initial value only reaches the computation as `prev`, which a\n // computation without parameters never reads.\n const args = init.arguments;\n const compute = args.at(0);\n const initialValue = args.at(1);\n const options = args.at(2);\n if (\n args.length > 3 ||\n compute === undefined ||\n compute.type === 'SpreadElement' ||\n initialValue?.type === 'SpreadElement' ||\n (initialValue !== undefined && !isSideEffectFree(initialValue))\n ) {\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 if (alwaysNotifies || isFresh(expression)) {\n return expression;\n }\n // A memo whose result can equal its last one stops updates, which is what it is for.\n if (unwrap(expression).type === 'Literal') {\n this.reason = 'memo-constant';\n }\n return undefined;\n }\n\n /**\n * The function a node runs in.\n */\n private functionOf(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 /**\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.builtInOf(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 builtInOf(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.functionOf(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 expression = this.unstableComputation(declarator);\n if (!expression) {\n return undefined;\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.functionOf(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 if (\n !this.resolvesSameAt(expression, call, binding) ||\n usesFunctionContext(this.context, expression)\n ) {\n this.reason = 'memo-scope';\n return undefined;\n }\n // The read sits in a JSX container, which takes any expression.\n this.context.s.overwrite(call.start, call.end, textOf(this.context, expression));\n this.context.s.remove(statement.start, statement.end);\n this.changed = true;\n return true;\n }\n\n run(): void {\n for (const scope of new Set(this.context.scopes.scopes.values())) {\n // A memo outside any function has no owner, and disposes differently.\n if (scope.parent === undefined) {\n continue;\n }\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 declaration.id === binding.identifier\n ) {\n this.tryInline(declaration, binding);\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 * The server pass: rewrites Solid's reactive primitives to what they do on the server.\n *\n * It runs once, after the other passes. Running it first would change what\n * the inliner and fold pass see on the server but not on the client, and the\n * two builds would render different trees. A component whose only statement\n * is `onMount(...)` would inline on the server and stay a component on the\n * client, which breaks hydration. It still runs while modules are\n * transformed, so the bundler drops whatever only the removed calls used.\n *\n * On the server, Solid renders once and never updates, so most primitives\n * reduce to a plain call (`solid-js/dist/server.js` in Solid 1.9):\n *\n * - `createEffect(fn)` and `onMount(fn)` do nothing, so they are removed.\n * Anything only they used, like a charting library, can then be dropped\n * from the server bundle.\n * - `untrack(fn)` and `batch(fn)` return `fn()`.\n * - `startTransition(fn)` calls `fn()` and returns nothing.\n * - `createDeferred(source)` returns `source`.\n * - `getListener()` returns `null`.\n * - `createMemo(fn, value)` runs `fn(value)` once and returns a getter for the\n * result. `createRenderEffect(fn, value)` and `createComputed(fn, value)`\n * run `fn(value)` once.\n *\n * A call with a spread argument is left alone, and so is a removed call whose\n * arguments have side effects beyond creating functions.\n *\n * # Accepted differences\n *\n * `createMemo`, `createRenderEffect`, and `createComputed` run their function\n * inside a new owner, and send an error to the nearest error handler. After\n * the rewrite the function runs in the enclosing owner:\n *\n * - An `onCleanup` inside it registers on the enclosing owner.\n * - Inside a `catchError` or `<ErrorBoundary>`, an error thrown by it stops\n * the component that holds it, instead of leaving the memo `undefined` and\n * rendering on. Without an error handler, both throw.\n */\nimport type { CallExpression, Expression, Node } from 'oxc-parser';\nimport { forEachChild, isPrimary, unwrap } from './ast';\nimport type { PassContext } from './context';\nimport { solidExport, textOf } from './context';\nimport { acceptsAnyExpression } from './inline';\nimport { isSideEffectFree } from './value';\n\n/** Calls the server does not run. */\nconst REMOVED = new Set(['createEffect', 'onMount']);\n\n/** Calls the server runs once, in place. */\nconst RUN_ONCE = new Set(['createRenderEffect', 'createComputed']);\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\nclass ServerSimplifier {\n changed = false;\n\n constructor(private readonly context: PassContext) {}\n\n /**\n * The Solid export a callee refers to, through a named import, an alias,\n * or a namespace import like `solid.untrack`.\n */\n private calleeName(callee: Node): string | undefined {\n const { references } = this.context.scopes;\n if (callee.type === 'Identifier') {\n const binding = references.get(callee);\n return binding ? solidExport(binding, this.context.options) : undefined;\n }\n if (callee.type !== 'MemberExpression' || callee.object.type !== 'Identifier') {\n return undefined;\n }\n const binding = references.get(callee.object);\n if (\n binding?.kind !== 'import' ||\n binding.imported !== '*' ||\n binding.source === undefined ||\n !this.context.options.moduleSources.includes(binding.source)\n ) {\n return undefined;\n }\n if (!callee.computed && callee.property.type === 'Identifier') {\n return callee.property.name;\n }\n if (\n callee.computed &&\n callee.property.type === 'Literal' &&\n typeof callee.property.value === 'string'\n ) {\n return callee.property.value;\n }\n return undefined;\n }\n\n /**\n * Whether dropping `node` loses nothing observable. Solid's `on` only\n * creates a function, so `createEffect(on(source, fn))` can go too.\n */\n private isDiscardable(node: Node): boolean {\n if (isSideEffectFree(node)) {\n return true;\n }\n const inner = node.type === 'ParenthesizedExpression' ? unwrap(node) : node;\n return (\n inner.type === 'CallExpression' &&\n this.calleeName(inner.callee) === 'on' &&\n inner.arguments.every(\n (argument) => argument.type !== 'SpreadElement' && this.isDiscardable(argument),\n )\n );\n }\n\n /**\n * The text of calling `fn` with `args`, the way Solid's server calls it,\n * and whether it binds as tightly as a call does.\n */\n private callText(fn: Expression, args: readonly Expression[]): { text: string; call: boolean } {\n const inner = unwrap(fn);\n const argsText = args.map((argument) => textOf(this.context, argument)).join(', ');\n if (\n inner.type === 'ArrowFunctionExpression' &&\n inner.expression &&\n inner.params.length === 0 &&\n args.length === 0 &&\n inner.body.type !== 'BlockStatement'\n ) {\n // `() => value` called with nothing is `value`.\n const { body } = inner;\n return {\n text: textOf(this.context, body),\n call: isPrimary(body) || body.type === 'CallExpression',\n };\n }\n const text = textOf(this.context, fn);\n if (inner.type === 'Identifier') {\n return { text: `${text}(${argsText})`, call: true };\n }\n if (\n inner.type === 'ArrowFunctionExpression' ||\n inner.type === 'FunctionExpression' ||\n fn.type === 'ParenthesizedExpression'\n ) {\n return { text: `(${text})(${argsText})`, call: true };\n }\n // `(0, obj.method)()` calls without `obj` as `this`, like Solid does.\n return { text: `(0, ${text})(${argsText})`, call: true };\n }\n\n /**\n * Whether a statement at `position` could be read as a continuation of\n * the one before it, which happens when that one has no semicolon.\n */\n private followsOpenStatement(position: number): boolean {\n const before = this.context.code.slice(0, position).trimEnd();\n return before !== '' && !before.endsWith(';') && !before.endsWith('{');\n }\n\n private replace(call: CallExpression, text: string | undefined, primary = false): void {\n const parent = this.context.parents.get(call);\n if (parent?.type === 'ExpressionStatement') {\n if (text === undefined) {\n // A statement in a list can go. One that is the whole body of an\n // `if` or a loop has to leave an empty statement behind.\n const list = this.context.parents.get(parent)?.type;\n const inList =\n list === 'Program' ||\n list === 'BlockStatement' ||\n list === 'StaticBlock' ||\n list === 'SwitchCase';\n if (inList) {\n this.context.s.remove(parent.start, parent.end);\n } else {\n this.context.s.overwrite(parent.start, parent.end, ';');\n }\n } else {\n let statement = text;\n // A statement cannot start with `{`, `function`, or `class`.\n if (/^(\\{|function\\b|async function\\b|class\\b)/.test(statement)) {\n statement = `(${statement})`;\n }\n const guarded =\n continuesPreviousStatement(statement) && this.followsOpenStatement(parent.start);\n this.context.s.overwrite(call.start, call.end, guarded ? `;${statement}` : statement);\n }\n } else {\n const value = text ?? 'void 0';\n // `new (f())()` is not `new f()()`.\n const isNewCallee = parent?.type === 'NewExpression' && parent.callee === call;\n const bare = !isNewCallee && (primary || acceptsAnyExpression(this.context, call));\n this.context.s.overwrite(call.start, call.end, bare ? value : `(${value})`);\n }\n this.changed = true;\n }\n\n private simplify(call: CallExpression): void {\n const name = this.calleeName(call.callee);\n if (name === undefined || call.arguments.some((arg) => arg.type === 'SpreadElement')) {\n return;\n }\n // Spread arguments were ruled out above.\n const args = call.arguments.filter((arg): arg is Expression => arg.type !== 'SpreadElement');\n const first = args.at(0);\n const second = args.at(1);\n const rest = args.slice(2);\n const inStatement = this.context.parents.get(call)?.type === 'ExpressionStatement';\n\n if (REMOVED.has(name)) {\n if (args.every((arg) => this.isDiscardable(arg))) {\n this.replace(call, undefined);\n }\n return;\n }\n switch (name) {\n case 'getListener':\n if (args.length === 0) {\n this.replace(call, 'null');\n }\n return;\n case 'untrack':\n case 'batch':\n if (first && args.length === 1) {\n const run = this.callText(first, []);\n this.replace(call, run.text, run.call);\n }\n return;\n case 'startTransition':\n if (first && args.length === 1) {\n const { text } = this.callText(first, []);\n this.replace(call, inStatement ? text : `(${text}, void 0)`, !inStatement);\n }\n return;\n case 'createDeferred':\n if (first && args.slice(1).every((arg) => this.isDiscardable(arg))) {\n const text = textOf(this.context, first);\n this.replace(call, text, isPrimary(first));\n }\n return;\n case 'createMemo':\n // `createMemo(fn, value, options)`: the options only matter for updates.\n if (first && rest.every((arg) => this.isDiscardable(arg))) {\n const { text } = this.callText(first, second ? [second] : []);\n this.replace(call, `((value) => () => value)(${text})`, true);\n }\n return;\n default:\n if (RUN_ONCE.has(name) && first && rest.length === 0) {\n const { text } = this.callText(first, second ? [second] : []);\n this.replace(call, inStatement ? text : `(${text}, void 0)`, !inStatement);\n }\n }\n }\n\n walk(node: Node): void {\n forEachChild(node, (child) => {\n this.walk(child);\n });\n if (node.type === 'CallExpression') {\n this.simplify(node);\n }\n }\n}\n\n/**\n * Runs the server pass over a parsed program. Returns whether anything changed.\n */\nexport function simplifyServer(context: PassContext): boolean {\n const simplifier = new ServerSimplifier(context);\n simplifier.walk(context.program);\n return simplifier.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 { simplifyServer } from './server';\nimport { removeProviders } from './provider';\nimport type { ScopeAnalysis } from './scope';\nimport { analyzeScopes } from './scope';\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 * Compile for the server: remove `createEffect` and `onMount`, and reduce\n * `untrack`, `batch`, `startTransition`, `createDeferred`, `getListener`,\n * `createMemo`, `createRenderEffect`, and `createComputed` to what they do\n * on the server.\n *\n * This runs once, after the other passes. The server and client build\n * make the same folding and inlining decisions from the same code, so the\n * server renders the tree the client hydrates.\n *\n * @default false\n */\n server?: 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 * 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', 'Suspense', 'SuspenseList', 'Portal', 'Index', 'Dynamic', 'ErrorBoundary']\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', 'solid-js/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 * 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 * 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 'Suspense',\n 'SuspenseList',\n 'Portal',\n 'Index',\n 'Dynamic',\n 'ErrorBoundary',\n];\n\nconst DEFAULT_MODULE_SOURCES = ['solid-js', 'solid-js/web'];\n\nfunction resolveOptions(options: CompileOptions): ResolvedOptions {\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 importedContexts: new Map(\n Object.entries(options.importedContexts ?? {}).map(([source, names]) => [\n source,\n new Set(names),\n ]),\n ),\n sharedComponents: new Map(Object.entries(options.sharedComponents ?? {})),\n alwaysInline: options.alwaysInline ?? false,\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 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 if (options.server ?? false) {\n const result = runPass(\n parsedCurrent(),\n filename,\n resolved,\n sourceMap,\n simplifyServer,\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 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` and `importedConstants` of the options are used.\n */\nexport function readModuleConstants(\n code: string,\n options: Pick<CompileOptions, 'filename' | 'importedConstants'> = {},\n): ModuleConstants {\n const program = parse(options.filename ?? 'input.jsx', code);\n return {\n imports: namedImportSources(program),\n exports: constantExports(program, resolveOptions(options)),\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,O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