solid-optimizer 0.3.0 → 0.4.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 +26 -1
- package/dist/{compile-BroGlagZ.d.mts → compile-BQuBDA0Q.d.mts} +29 -2
- package/dist/compile-BQuBDA0Q.d.mts.map +1 -0
- package/dist/{compile-ocDYvJUW.mjs → compile-D3caSUtw.mjs} +401 -67
- package/dist/compile-D3caSUtw.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/vite.d.mts +19 -1
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +419 -141
- package/dist/vite.mjs.map +1 -1
- package/package.json +1 -1
- package/src/ast.ts +12 -4
- package/src/compile.ts +61 -10
- package/src/context.ts +29 -0
- package/src/index.ts +1 -0
- package/src/inline.ts +225 -16
- package/src/memo.ts +43 -10
- package/src/provider.ts +65 -8
- package/src/size.ts +2 -0
- package/src/vite/index.ts +277 -34
- package/src/vite/inject.ts +41 -2
- package/src/vite/refs.ts +99 -0
- package/src/vite/report.ts +74 -0
- package/src/vite/runtime.ts +0 -20
- package/dist/compile-BroGlagZ.d.mts.map +0 -1
- package/dist/compile-ocDYvJUW.mjs.map +0 -1
package/dist/vite.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.mjs","names":["generateMap"],"sources":["../src/vite/runtime.ts","../src/vite/inject.ts","../src/vite/namespace.ts","../src/vite/usage.ts","../src/vite/index.ts"],"sourcesContent":["/**\n * Keeps Solid's runtime helpers reachable while JSX waits in a bundled chunk.\n *\n * Solid's JSX transform imports helpers like `template` and `insert` from\n * `solid-js/web`. When the transform runs on a chunk, the bundle is already\n * built, so a new bare import cannot be resolved or bundled anymore. Instead,\n * every module imports the helpers it will need before bundling, and passes\n * them to a marker call. The bundler keeps the call, since it could have side\n * effects, and renames the helpers to whatever they are called in the chunk.\n * The chunk step reads the marker, removes it, and points the lowered code at\n * those names.\n *\n * The marker also records which bindings are Solid's built-in components, so\n * the fold pass still recognizes `Show` after the bundler renamed it.\n */\nimport MagicString from 'magic-string';\nimport { parseSync } from 'oxc-parser';\nimport type {\n ExpressionStatement,\n ImportDeclarationSpecifier,\n ImportSpecifier,\n Node,\n Program,\n} from 'oxc-parser';\nimport { collectParents, forEachChild, parse, unwrap } from '../ast';\nimport type { ScopeAnalysis } from '../scope';\nimport { analyzeScopes, lookup, scopeAt } from '../scope';\n\nexport const MARKER = '__SOLID_OPTIMIZER_KEEP__';\n\n/**\n * The lowered chunk needs a helper that no module in the chunk kept.\n */\nexport class MissingHelperError extends Error {\n override readonly name = 'MissingHelperError';\n}\n\nconst HELPER_PREFIX = 'helper:';\nconst BUILT_IN_PREFIX = 'builtin:';\n\nexport interface EditResult {\n code: string;\n map: string;\n}\n\nfunction generateMap(s: MagicString, filename: string): string {\n return s.generateMap({ source: filename, hires: true, includeContent: true }).toString();\n}\n\nfunction freshName(scopes: ScopeAnalysis, base: string): string {\n let name = base;\n let index = 1;\n while (scopes.names.has(name)) {\n name = `${base}$${String(index)}`;\n index += 1;\n }\n scopes.names.add(name);\n return name;\n}\n\n/**\n * Whether an import specifier was added by Solid's JSX transform, which\n * names every helper it imports `_$name`.\n */\nfunction isGeneratedSpecifier(specifier: ImportDeclarationSpecifier): boolean {\n return specifier.type === 'ImportSpecifier' && specifier.local.name.startsWith('_$');\n}\n\nfunction exportedName(specifier: ImportSpecifier): string {\n return specifier.imported.type === 'Literal' ? specifier.imported.value : specifier.imported.name;\n}\n\n/**\n * The helpers Solid's JSX transform imported from `source` into its output.\n * The module's own imports, including type imports, are left out.\n */\nexport function generatedImports(code: string, filename: string, source: string): string[] {\n const program = parse(filename, code);\n const names: string[] = [];\n for (const statement of program.body) {\n if (statement.type !== 'ImportDeclaration' || statement.source.value !== source) {\n continue;\n }\n for (const specifier of statement.specifiers) {\n if (specifier.type === 'ImportSpecifier' && isGeneratedSpecifier(specifier)) {\n names.push(exportedName(specifier));\n }\n }\n }\n return names;\n}\n\nexport interface MarkerOptions {\n /** The module the helpers come from, usually `solid-js/web`. */\n readonly moduleName: string;\n /** The helpers to keep. */\n readonly helpers: ReadonlySet<string>;\n /** The modules Solid's built-in components come from. */\n readonly moduleSources: readonly string[];\n /** The names of Solid's built-in components. */\n readonly builtIns: ReadonlySet<string>;\n}\n\n/**\n * The functions declared at the top level of a module, with the statement\n * that declares each: `function A() {}`, `const A = () => ...`, and their\n * `export` forms.\n */\nfunction topLevelFunctions(program: Program): { statement: Node; fn: Node }[] {\n const found: { statement: Node; fn: Node }[] = [];\n for (const statement of program.body) {\n const declaration =\n statement.type === 'ExportNamedDeclaration' || statement.type === 'ExportDefaultDeclaration'\n ? statement.declaration\n : statement;\n if (!declaration) {\n continue;\n }\n if (declaration.type === 'FunctionDeclaration') {\n found.push({ statement, fn: declaration });\n } else if (\n declaration.type === 'VariableDeclaration' &&\n declaration.declarations.length === 1\n ) {\n const init = declaration.declarations.at(0)?.init;\n const fn = init ? unwrap(init) : undefined;\n if (fn?.type === 'ArrowFunctionExpression' || fn?.type === 'FunctionExpression') {\n found.push({ statement, fn });\n }\n }\n }\n return found;\n}\n\nfunction containsJSX(node: Node): boolean {\n let found = false;\n const visit = (current: Node): void => {\n if (found) {\n return;\n }\n if (current.type === 'JSXElement' || current.type === 'JSXFragment') {\n found = true;\n return;\n }\n forEachChild(current, visit);\n };\n visit(node);\n return found;\n}\n\n/**\n * Adds the helper imports and the marker calls to a module.\n *\n * Each top-level function with JSX gets its own marker, so a component the\n * bundler drops takes its helpers with it. JSX anywhere else gets a marker\n * at the top level. Returns `undefined` when the module needs no helper.\n */\nexport function addMarker(\n code: string,\n filename: string,\n options: MarkerOptions,\n): EditResult | undefined {\n if (options.helpers.size === 0) {\n return undefined;\n }\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const entries: string[] = [];\n const specifiers: string[] = [];\n for (const helper of options.helpers) {\n const local = freshName(scopes, `__so$${helper}`);\n specifiers.push(`${helper} as ${local}`);\n entries.push(`${JSON.stringify(HELPER_PREFIX + helper)}: ${local}`);\n }\n for (const statement of program.body) {\n if (\n statement.type !== 'ImportDeclaration' ||\n statement.importKind === 'type' ||\n !options.moduleSources.includes(statement.source.value)\n ) {\n continue;\n }\n for (const specifier of statement.specifiers) {\n if (specifier.type !== 'ImportSpecifier' || specifier.importKind === 'type') {\n continue;\n }\n const imported = exportedName(specifier);\n // A built-in that folding left unused stays out, so the bundler can drop it.\n const used = (scopes.root.bindings.get(specifier.local.name)?.references.length ?? 0) > 0;\n if (options.builtIns.has(imported) && used) {\n entries.push(`${JSON.stringify(BUILT_IN_PREFIX + imported)}: ${specifier.local.name}`);\n }\n }\n }\n const call = `${MARKER}({ ${entries.join(', ')} })`;\n const s = new MagicString(code);\n const functions = topLevelFunctions(program).filter(({ fn }) => containsJSX(fn));\n for (const { fn } of functions) {\n if (\n fn.type !== 'FunctionDeclaration' &&\n fn.type !== 'FunctionExpression' &&\n fn.type !== 'ArrowFunctionExpression'\n ) {\n continue;\n }\n const { body } = fn;\n if (!body) {\n continue;\n }\n if (body.type === 'BlockStatement') {\n s.appendLeft(body.start + 1, `${call};`);\n } else {\n s.prependRight(body.start, `{ ${call}; return `);\n s.appendLeft(body.end, '; }');\n }\n }\n const outside = program.body.some(\n (statement) =>\n !functions.some((entry) => entry.statement === statement) && containsJSX(statement),\n );\n s.append(\n `\\nimport { ${specifiers.join(', ')} } from ${JSON.stringify(options.moduleName)};\\n` +\n (outside ? `${call};\\n` : ''),\n );\n return { code: s.toString(), map: generateMap(s, filename) };\n}\n\n/**\n * Puts back the parentheses around a comma expression that is the whole of a\n * JSX expression container. Rolldown drops them when it prints a chunk that\n * kept its JSX, and JSX does not allow the result. Returns `undefined` when\n * the chunk has none.\n */\nexport function repairJSXSequences(code: string, filename: string): EditResult | undefined {\n // The chunk does not parse cleanly, which is why this runs, so errors are expected.\n const { program } = parseSync(filename, code, {\n lang: 'jsx',\n sourceType: 'module',\n preserveParens: true,\n });\n const sequences: Node[] = [];\n const visit = (node: Node): void => {\n if (node.type === 'JSXExpressionContainer' && node.expression.type === 'SequenceExpression') {\n sequences.push(node.expression);\n }\n forEachChild(node, visit);\n };\n visit(program);\n if (sequences.length === 0) {\n return undefined;\n }\n const s = new MagicString(code);\n for (const sequence of sequences) {\n s.appendLeft(sequence.start, '(');\n s.prependRight(sequence.end, ')');\n }\n return { code: s.toString(), map: generateMap(s, filename) };\n}\n\nexport interface ChunkRuntime extends EditResult {\n /** The chunk's name for each helper, keyed by the name `solid-js/web` exports. */\n readonly helpers: ReadonlyMap<string, string>;\n /** The built-in each chunk binding refers to, keyed by the chunk's name for it. */\n readonly builtInAliases: Record<string, string>;\n}\n\nfunction propertyKey(node: Node): string | undefined {\n if (node.type === 'Literal' && typeof node.value === 'string') {\n return node.value;\n }\n if (node.type === 'Identifier') {\n return node.name;\n }\n return undefined;\n}\n\n/**\n * Reads and removes the marker calls of a chunk.\n * Returns `undefined` when the chunk has none.\n */\nexport function readMarkers(code: string, filename: string): ChunkRuntime | undefined {\n if (!code.includes(MARKER)) {\n return undefined;\n }\n const program = parse(filename, code);\n const s = new MagicString(code);\n const helpers = new Map<string, string>();\n const builtInAliases: Record<string, string> = {};\n // A marker is usually a top-level statement. The bundler moves a module\n // into an init function when it has to run lazily, such as a module that\n // a dynamic import pulled into the same chunk, so every statement is searched.\n const markers: ExpressionStatement[] = [];\n const visit = (node: Node): void => {\n if (\n node.type === 'ExpressionStatement' &&\n node.expression.type === 'CallExpression' &&\n node.expression.callee.type === 'Identifier' &&\n node.expression.callee.name === MARKER\n ) {\n markers.push(node);\n return;\n }\n forEachChild(node, visit);\n };\n visit(program);\n for (const statement of markers) {\n s.remove(statement.start, statement.end);\n if (statement.expression.type !== 'CallExpression') {\n continue;\n }\n const argument = statement.expression.arguments.at(0);\n if (argument?.type !== 'ObjectExpression') {\n continue;\n }\n for (const property of argument.properties) {\n if (property.type !== 'Property' || property.value.type !== 'Identifier') {\n continue;\n }\n const key = propertyKey(property.key);\n if (key?.startsWith(HELPER_PREFIX)) {\n helpers.set(key.slice(HELPER_PREFIX.length), property.value.name);\n } else if (key?.startsWith(BUILT_IN_PREFIX)) {\n builtInAliases[property.value.name] = key.slice(BUILT_IN_PREFIX.length);\n }\n }\n }\n if (markers.length === 0) {\n return undefined;\n }\n return {\n code: s.toString(),\n map: generateMap(s, filename),\n helpers,\n builtInAliases,\n };\n}\n\n/**\n * Replaces the helper imports that Solid's JSX transform added to a chunk\n * with the chunk's own names for those helpers.\n */\nexport function linkHelpers(\n code: string,\n filename: string,\n moduleName: string,\n helpers: ReadonlyMap<string, string>,\n): EditResult {\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const parents = collectParents(program);\n const s = new MagicString(code);\n for (const statement of program.body) {\n if (\n statement.type !== 'ImportDeclaration' ||\n statement.source.value !== moduleName ||\n !statement.specifiers.every(isGeneratedSpecifier)\n ) {\n continue;\n }\n for (const specifier of statement.specifiers) {\n if (specifier.type !== 'ImportSpecifier') {\n continue;\n }\n const imported = exportedName(specifier);\n const target = helpers.get(imported);\n if (target === undefined) {\n throw new MissingHelperError(\n `[solid-optimizer] ${filename} needs \"${imported}\" from \"${moduleName}\", but no module in the chunk imports it.`,\n );\n }\n const binding = scopes.root.bindings.get(specifier.local.name);\n const targetBinding = scopes.root.bindings.get(target);\n if (!targetBinding) {\n throw new Error(\n `[solid-optimizer] ${filename} has no top-level \"${target}\" for \"${imported}\".`,\n );\n }\n for (const reference of binding?.references ?? []) {\n if (lookup(scopeAt(scopes, parents, reference), target) !== targetBinding) {\n throw new Error(\n `[solid-optimizer] ${filename} shadows \"${target}\" where the JSX transform uses \"${imported}\".`,\n );\n }\n s.overwrite(reference.start, reference.end, target);\n }\n }\n s.remove(statement.start, statement.end);\n }\n return { code: s.toString(), map: generateMap(s, filename) };\n}\n","/**\n * Copies components from other modules into a module before bundling, so\n * the inline pass can inline them there.\n *\n * In chunk mode, the chunk step inlines any component in the same chunk.\n * It runs after the bundler has split the chunks, so a shared chunk still\n * exports what an inlined component needed, like the runtime's `spread`.\n * Inlining an imported component while its importer is transformed lets\n * the bundler drop the component, and what only it used, before splitting.\n *\n * A copy refers to the bindings of its own module. Imports are imported\n * again by the module they resolve to. A binding the module declares but\n * does not export is exported under an extra name, which `exposeLocals`\n * adds when the module is transformed.\n */\nimport MagicString from 'magic-string';\nimport type { Node, Program } from 'oxc-parser';\nimport { forEachChild, parse, unwrap } from '../ast';\nimport type { Binding, ScopeAnalysis } from '../scope';\nimport { analyzeScopes } from '../scope';\nimport { MARKER } from './runtime';\nimport type { EditResult } from './runtime';\n\n/**\n * Whether a binding is `const X = createContext(...)`, with `createContext`\n * imported from Solid.\n */\nfunction isContext(\n binding: Binding,\n scopes: ScopeAnalysis,\n moduleSources: readonly string[],\n): boolean {\n const { declaration } = binding;\n if (\n binding.kind !== 'const' ||\n binding.mutated ||\n declaration.type !== 'VariableDeclarator' ||\n !declaration.init\n ) {\n return false;\n }\n const init = unwrap(declaration.init);\n if (init.type !== 'CallExpression' || init.callee.type !== 'Identifier') {\n return false;\n }\n const callee = scopes.references.get(init.callee);\n return (\n callee?.kind === 'import' &&\n callee.imported === 'createContext' &&\n callee.source !== undefined &&\n moduleSources.includes(callee.source)\n );\n}\n\n/** The prefix of the name a module exports a local binding under. */\nexport const LOCAL_EXPORT = '__so_local$';\n\nfunction generateMap(s: MagicString, filename: string): string {\n return s.generateMap({ source: filename, hires: true, includeContent: true }).toString();\n}\n\nfunction isCapitalized(name: string): boolean {\n return /^[A-Z]/.test(name);\n}\n\ninterface TopLevelFunction {\n readonly binding: Binding;\n /** The function, or the arrow or function expression a `const` holds. */\n readonly fn: Node;\n /** The node to copy: the function declaration, or the expression. */\n readonly kind: 'declaration' | 'expression';\n}\n\n/**\n * The function a top-level binding holds: `function A() {}`, or\n * `const A = () => ...`.\n */\nfunction functionOf(binding: Binding): TopLevelFunction | undefined {\n const { declaration } = binding;\n if (declaration.type === 'FunctionDeclaration') {\n return { binding, fn: declaration, kind: 'declaration' };\n }\n if (\n declaration.type === 'VariableDeclarator' &&\n binding.kind === 'const' &&\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 { binding, fn: init, kind: 'expression' };\n }\n }\n return undefined;\n}\n\n/**\n * The names a module exports, each with the top-level binding it exports.\n */\nfunction exportsOf(program: Program, scopes: ScopeAnalysis): Map<string, Binding> {\n const exports = new Map<string, Binding>();\n const { bindings } = scopes.root;\n for (const statement of program.body) {\n if (statement.type === 'ExportNamedDeclaration' && !statement.source) {\n const { declaration } = statement;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n const binding = bindings.get(declaration.id.name);\n if (binding) {\n exports.set(declaration.id.name, binding);\n }\n } else if (declaration?.type === 'VariableDeclaration') {\n const declared = declaration.declarations.map((declarator) =>\n declarator.id.type === 'Identifier' ? bindings.get(declarator.id.name) : undefined,\n );\n for (const binding of declared.filter((item) => item !== undefined)) {\n exports.set(binding.name, binding);\n }\n }\n for (const specifier of statement.specifiers) {\n const local = specifier.local.type === 'Identifier' ? specifier.local.name : undefined;\n const exported =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n const binding = local === undefined ? undefined : bindings.get(local);\n if (binding) {\n exports.set(exported, binding);\n }\n }\n } else if (statement.type === 'ExportDefaultDeclaration') {\n const { declaration } = statement;\n if (declaration.type === 'FunctionDeclaration' && declaration.id) {\n const binding = bindings.get(declaration.id.name);\n if (binding) {\n exports.set('default', binding);\n }\n } else if (declaration.type === 'Identifier') {\n const binding = bindings.get(declaration.name);\n if (binding) {\n exports.set('default', binding);\n }\n }\n }\n }\n return exports;\n}\n\n/**\n * The top-level bindings a function refers to, other than itself.\n */\nfunction outerBindings(fn: Node, self: Binding, scopes: ScopeAnalysis): Map<Node, Binding> {\n const outer = new Map<Node, Binding>();\n for (const [reference, binding] of scopes.references) {\n if (\n binding &&\n binding !== self &&\n binding.scope === scopes.root &&\n reference.start >= fn.start &&\n reference.end <= fn.end\n ) {\n outer.set(reference, binding);\n }\n }\n return outer;\n}\n\n/**\n * Exports the top-level bindings that the module's exported components\n * refer to but the module does not export, under an extra name. A copy of\n * such a component in another module imports them from here.\n */\nexport function exposeLocals(code: string, filename: string): EditResult | undefined {\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const exports = exportsOf(program, scopes);\n const exported = new Set(exports.values());\n const needed = new Set<Binding>();\n for (const [name, binding] of exports) {\n const component =\n isCapitalized(binding.name) || name === 'default' ? functionOf(binding) : undefined;\n if (!component) {\n continue;\n }\n for (const outer of outerBindings(component.fn, binding, scopes).values()) {\n if (outer.kind !== 'import' && !exported.has(outer)) {\n needed.add(outer);\n }\n }\n }\n if (needed.size === 0) {\n return undefined;\n }\n const s = new MagicString(code);\n const specifiers = [...needed].map(\n (binding) => `${binding.name} as ${LOCAL_EXPORT}${binding.name}`,\n );\n s.append(`\\nexport { ${specifiers.join(', ')} };\\n`);\n return { code: s.toString(), map: generateMap(s, filename) };\n}\n\n/** A binding a copied component needs from its own module's scope. */\nexport type Dependency =\n /** An import of that module, imported again by the module it resolves to. */\n | { readonly kind: 'import'; readonly source: string; readonly imported: string }\n /** A binding that module exports, imported from it under this name. */\n | { readonly kind: 'export'; readonly exported: string; readonly context: boolean };\n\nexport interface ExportedComponent {\n /** Each top-level binding the component refers to, by its name in the module. */\n readonly dependencies: ReadonlyMap<string, Dependency>;\n /**\n * The component's declaration under `name`, with each dependency renamed\n * as `rename` gives it.\n */\n readonly copy: (name: string, rename: ReadonlyMap<string, string>) => string;\n}\n\n/**\n * Reads the component a module exports under `exportName`, from the module\n * as the bundler loaded it. `undefined` when that export is not a function\n * component, or it refers to a top-level binding the module cannot export.\n */\nexport function readExportedComponent(\n code: string,\n filename: string,\n exportName: string,\n moduleSources: readonly string[],\n): ExportedComponent | undefined {\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const exports = exportsOf(program, scopes);\n const binding = exports.get(exportName);\n const component = binding ? functionOf(binding) : undefined;\n if (!binding || !component) {\n return undefined;\n }\n const exportNames = new Map<Binding, string>();\n for (const [name, exported] of exports) {\n if (!exportNames.has(exported)) {\n exportNames.set(exported, name);\n }\n }\n\n const outer = outerBindings(component.fn, binding, scopes);\n const dependencies = new Map<string, Dependency>();\n for (const dependency of outer.values()) {\n if (dependencies.has(dependency.name)) {\n continue;\n }\n if (dependency.kind === 'import') {\n if (dependency.source === undefined || dependency.imported === undefined) {\n return undefined;\n }\n dependencies.set(dependency.name, {\n kind: 'import',\n source: dependency.source,\n imported: dependency.imported,\n });\n continue;\n }\n // A local binding is exported under its extra name, which `exposeLocals` added.\n const name = exportNames.get(dependency);\n if (name === undefined) {\n return undefined;\n }\n dependencies.set(dependency.name, {\n kind: 'export',\n exported: name,\n context: isContext(dependency, scopes, moduleSources),\n });\n }\n\n // The helper markers in the copy belong to the module it comes from.\n const markers: Node[] = [];\n const findMarkers = (node: Node): void => {\n if (\n node.type === 'ExpressionStatement' &&\n node.expression.type === 'CallExpression' &&\n node.expression.callee.type === 'Identifier' &&\n node.expression.callee.name === MARKER\n ) {\n markers.push(node);\n return;\n }\n forEachChild(node, findMarkers);\n };\n findMarkers(component.fn);\n\n const copy = (name: string, rename: ReadonlyMap<string, string>): string => {\n const s = new MagicString(code);\n for (const [reference, dependency] of outer) {\n const renamed = rename.get(dependency.name);\n if (renamed !== undefined && renamed !== dependency.name) {\n s.overwrite(reference.start, reference.end, renamed);\n }\n }\n for (const marker of markers) {\n s.remove(marker.start, marker.end);\n }\n if (\n component.kind === 'declaration' &&\n component.fn.type === 'FunctionDeclaration' &&\n component.fn.id\n ) {\n s.overwrite(component.fn.id.start, component.fn.id.end, name);\n return s.slice(component.fn.start, component.fn.end);\n }\n return `const ${name} = ${s.slice(component.fn.start, component.fn.end)};`;\n };\n return { dependencies, copy };\n}\n","/**\n * Rewrites JSX tags that read a member of a namespace import, like\n * `<Button.Root>` with `import * as Button from '...'`, to a named import.\n *\n * A bundler resolves `Button.Root` in code to the export it reads, and\n * drops the namespace. In a JSX tag name it does not, so a module that\n * keeps its JSX through bundling would make the bundle build a namespace\n * object with every export of the module.\n */\nimport MagicString from 'magic-string';\nimport { collectParents, parse } from '../ast';\nimport { analyzeScopes } from '../scope';\nimport type { EditResult } from './runtime';\n\nexport function nameNamespaceTags(code: string, filename: string): EditResult | undefined {\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const parents = collectParents(program);\n const s = new MagicString(code);\n const names = new Set(scopes.names);\n const imports: string[] = [];\n for (const binding of scopes.root.bindings.values()) {\n const statement = parents.get(binding.declaration);\n if (\n binding.kind !== 'import' ||\n binding.imported !== '*' ||\n binding.source === undefined ||\n statement?.type !== 'ImportDeclaration' ||\n statement.importKind === 'type'\n ) {\n continue;\n }\n // One local name for each member, shared by its opening and closing tags.\n const locals = new Map<string, string>();\n for (const reference of binding.references) {\n const member = parents.get(reference);\n if (\n reference.type !== 'JSXIdentifier' ||\n member?.type !== 'JSXMemberExpression' ||\n member.object !== reference\n ) {\n continue;\n }\n const { name } = member.property;\n let local = locals.get(name);\n if (local === undefined) {\n local = `${binding.name}$${name}`;\n for (let index = 1; names.has(local); index += 1) {\n local = `${binding.name}$${name}$${String(index)}`;\n }\n names.add(local);\n locals.set(name, local);\n imports.push(`import { ${name} as ${local} } from ${JSON.stringify(binding.source)};`);\n }\n s.overwrite(member.start, member.end, local);\n }\n }\n if (imports.length === 0) {\n return undefined;\n }\n s.prepend(`${imports.join('\\n')}\\n`);\n return {\n code: s.toString(),\n map: s.generateMap({ source: filename, hires: true, includeContent: true }).toString(),\n };\n}\n","/**\n * Which modules use each export of the app, read from the files on disk.\n *\n * A component copied into the module that uses it is only smaller overall\n * when the original goes away, which takes that module being its only user.\n * The index answers that from the whole module graph, so it does not depend\n * on the order the bundler transforms modules in, and a server build and its\n * client build make the same decisions.\n *\n * Anything the index cannot follow counts as another use: a re-export, a\n * dynamic import, a namespace used as a value, or a use inside the module\n * that declares the export.\n */\nimport type { Node, Program } from 'oxc-parser';\nimport { collectParents, forEachChild, parse } from '../ast';\nimport type { Parents } from '../ast';\nimport type { Binding, ScopeAnalysis } from '../scope';\nimport { analyzeScopes } from '../scope';\n\nexport interface UsageIndex {\n /**\n * How many modules use `exportName` of `module`, counting `user`, when\n * they only use it as JSX tags. `0` when anything else uses it, which\n * keeps it whoever copies it. `absorbed` holds, by module, the exported\n * components that were copied into `user` and leave their module, so the\n * uses inside them count as uses in `user`.\n */\n users(\n module: string,\n exportName: string,\n user: string,\n absorbed: ReadonlyMap<string, ReadonlySet<string>>,\n ): number;\n}\n\nexport interface UsageHost {\n /** The id `source` resolves to from `importer`, or `undefined` outside the app. */\n resolve(source: string, importer: string): Promise<string | undefined>;\n /** The code of a module, or `undefined` when it cannot be read. */\n read(id: string): Promise<string | undefined>;\n}\n\n/** The name a use counts under when it is not inside an exported declaration. */\nconst UNEXPORTED = '';\n\ninterface ExportUsage {\n /**\n * The modules that use the export as a JSX tag, each with the export\n * names of the top-level declarations the uses sit in.\n */\n readonly importers: Map<string, Set<string>>;\n /** Whether anything uses it other than as a tag. */\n other: boolean;\n}\n\nconst SCRIPT = /\\.[mc]?[jt]sx?$/;\n\nclass Usage implements UsageIndex {\n private readonly exports = new Map<string, ExportUsage>();\n\n /** Modules any of whose exports can be used in a way the index does not follow. */\n private readonly opaque = new Set<string>();\n\n /** The modules each module imports. */\n readonly imports = new Map<string, readonly string[]>();\n\n /** Whether `from` imports `to`, directly or through other modules. */\n private reaches(from: string, to: string): boolean {\n const seen = new Set<string>();\n const stack = [from];\n for (let id = stack.pop(); id !== undefined; id = stack.pop()) {\n if (id === to) {\n return true;\n }\n if (!seen.has(id)) {\n seen.add(id);\n stack.push(...(this.imports.get(id) ?? []));\n }\n }\n return false;\n }\n\n private entry(module: string, name: string): ExportUsage {\n const key = `${module}\\0${name}`;\n let usage = this.exports.get(key);\n if (!usage) {\n usage = { importers: new Map(), other: false };\n this.exports.set(key, usage);\n }\n return usage;\n }\n\n tag(module: string, name: string, importer: string, containers: readonly string[]): void {\n const { importers } = this.entry(module, name);\n const known = importers.get(importer) ?? new Set();\n for (const container of containers) {\n known.add(container);\n }\n importers.set(importer, known);\n }\n\n other(module: string, name: string): void {\n this.entry(module, name).other = true;\n }\n\n all(module: string): void {\n this.opaque.add(module);\n }\n\n users(\n module: string,\n exportName: string,\n user: string,\n absorbed: ReadonlyMap<string, ReadonlySet<string>>,\n ): number {\n if (this.opaque.has(module)) {\n return 0;\n }\n const usage = this.exports.get(`${module}\\0${exportName}`);\n if (!usage || usage.other || usage.importers.size === 0) {\n return 0;\n }\n const users = new Set([user]);\n for (const [importer, containers] of usage.importers) {\n const moved = absorbed.get(importer);\n users.add([...containers].every((name) => moved?.has(name) === true) ? user : importer);\n }\n // A module the component's module imports never gets a copy of it, so\n // the original stays for it.\n return [...users].some((id) => this.reaches(module, id)) ? 0 : users.size;\n }\n}\n\nfunction isTagName(reference: Node, parents: Parents): boolean {\n const parent = parents.get(reference);\n return parent?.type === 'JSXOpeningElement' && parent.name === reference;\n}\n\nfunction isClosingTagName(reference: Node, parents: Parents): boolean {\n const parent = parents.get(reference);\n return parent?.type === 'JSXClosingElement' && parent.name === reference;\n}\n\n/** The names a declaration exported with `export` declares. */\nfunction declaredNames(declaration: Node | null | undefined): string[] {\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n return [declaration.id.name];\n }\n if (declaration?.type === 'VariableDeclaration') {\n return declaration.declarations.flatMap((declarator) =>\n declarator.id.type === 'Identifier' ? [declarator.id.name] : [],\n );\n }\n return [];\n}\n\n/** The top-level bindings a module exports, each with its export names. */\nfunction exportedBindings(program: Program, scopes: ScopeAnalysis): Map<Binding, string[]> {\n const exported = new Map<Binding, string[]>();\n const add = (local: string, name: string): void => {\n const binding = scopes.root.bindings.get(local);\n if (binding) {\n exported.set(binding, [...(exported.get(binding) ?? []), name]);\n }\n };\n for (const statement of program.body) {\n if (statement.type === 'ExportNamedDeclaration' && !statement.source) {\n for (const name of declaredNames(statement.declaration)) {\n add(name, name);\n }\n for (const specifier of statement.specifiers) {\n if (specifier.local.type === 'Identifier') {\n add(\n specifier.local.name,\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value,\n );\n }\n }\n } else if (statement.type === 'ExportDefaultDeclaration') {\n const { declaration } = statement;\n if (declaration.type === 'FunctionDeclaration' && declaration.id) {\n add(declaration.id.name, 'default');\n } else if (declaration.type === 'Identifier') {\n add(declaration.name, 'default');\n }\n }\n }\n return exported;\n}\n\n/**\n * Records how a module uses what it imports, and the uses of its own\n * exports inside it.\n */\nfunction recordModule(\n usage: Usage,\n id: string,\n program: Program,\n targets: ReadonlyMap<string, string>,\n): void {\n const scopes = analyzeScopes(program);\n const parents = collectParents(program);\n\n // A module that uses its own export keeps it, whoever else copies it.\n const exported = exportedBindings(program, scopes);\n // The export names of the top-level declaration a use sits in.\n const containersOf = (reference: Node): string[] => {\n let node: Node = reference;\n let parent = parents.get(node);\n while (parent && parent.type !== 'Program') {\n node = parent;\n parent = parents.get(node);\n }\n const declaration =\n (node.type === 'ExportNamedDeclaration' || node.type === 'ExportDefaultDeclaration') &&\n node.declaration\n ? node.declaration\n : node;\n const bindings: (Binding | undefined)[] = [];\n if (declaration.type === 'FunctionDeclaration' && declaration.id) {\n bindings.push(scopes.root.bindings.get(declaration.id.name));\n } else if (declaration.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (\n declarator.id.type === 'Identifier' &&\n reference.start >= declarator.start &&\n reference.end <= declarator.end\n ) {\n bindings.push(scopes.root.bindings.get(declarator.id.name));\n }\n }\n }\n const names = bindings.flatMap((binding) => (binding ? (exported.get(binding) ?? []) : []));\n return names.length > 0 ? names : [UNEXPORTED];\n };\n\n const record = (binding: Binding, target: string): void => {\n const imported = binding.imported ?? '*';\n for (const reference of binding.references) {\n if (isClosingTagName(reference, parents)) {\n continue;\n }\n if (imported !== '*') {\n if (isTagName(reference, parents)) {\n usage.tag(target, imported, id, containersOf(reference));\n } else {\n usage.other(target, imported);\n }\n continue;\n }\n // `<Ns.Member>` and `Ns.member` use one export. Anything else may use any.\n const member = parents.get(reference);\n if (member?.type === 'JSXMemberExpression' && member.object === reference) {\n if (isTagName(member, parents)) {\n usage.tag(target, member.property.name, id, containersOf(reference));\n } else {\n usage.other(target, member.property.name);\n }\n } else if (\n member?.type === 'MemberExpression' &&\n member.object === reference &&\n !member.computed &&\n member.property.type === 'Identifier'\n ) {\n usage.other(target, member.property.name);\n } else {\n usage.all(target);\n }\n }\n };\n for (const binding of scopes.root.bindings.values()) {\n if (binding.kind === 'import' && binding.source !== undefined) {\n const target = targets.get(binding.source);\n if (target !== undefined) {\n record(binding, target);\n }\n }\n }\n\n // Re-exports pass an export on, which the index does not follow.\n for (const statement of program.body) {\n if (statement.type === 'ExportAllDeclaration') {\n const target = targets.get(statement.source.value);\n if (target !== undefined) {\n usage.all(target);\n }\n } else if (statement.type === 'ExportNamedDeclaration' && statement.source) {\n const target = targets.get(statement.source.value);\n for (const specifier of statement.specifiers) {\n const name =\n specifier.local.type === 'Identifier' ? specifier.local.name : specifier.local.value;\n if (target !== undefined) {\n usage.other(target, name);\n }\n }\n }\n }\n\n for (const [binding, names] of exported) {\n const used = binding.references.some((reference) => {\n const parent = parents.get(reference);\n return (\n parent?.type !== 'ExportSpecifier' &&\n parent?.type !== 'ExportDefaultDeclaration' &&\n !isClosingTagName(reference, parents)\n );\n });\n if (used) {\n for (const name of names) {\n usage.other(id, name);\n }\n }\n }\n}\n\n/** The import specifiers a module loads, statically or with `import()`. */\nfunction specifiersOf(program: Program): { static: Set<string>; dynamic: Set<string> } {\n const statics = new Set<string>();\n const dynamics = new Set<string>();\n for (const statement of program.body) {\n if (\n (statement.type === 'ImportDeclaration' && statement.importKind !== 'type') ||\n ((statement.type === 'ExportNamedDeclaration' || statement.type === 'ExportAllDeclaration') &&\n statement.source &&\n statement.exportKind !== 'type')\n ) {\n const value = statement.source?.value;\n if (value !== undefined) {\n statics.add(value);\n }\n }\n }\n const visit = (node: Node): void => {\n if (\n node.type === 'ImportExpression' &&\n node.source.type === 'Literal' &&\n typeof node.source.value === 'string'\n ) {\n dynamics.add(node.source.value);\n }\n forEachChild(node, visit);\n };\n visit(program);\n return { static: statics, dynamic: dynamics };\n}\n\n/**\n * Reads every module reachable from `entries` and records how each export\n * is used.\n */\nexport async function buildUsageIndex(\n entries: readonly string[],\n host: UsageHost,\n): Promise<UsageIndex> {\n const usage = new Usage();\n // An entry's exports are its public API.\n for (const entry of entries) {\n usage.all(entry);\n }\n const seen = new Set<string>();\n let frontier = entries.filter((id) => SCRIPT.test(id.replace(/\\?.*$/, '')));\n while (frontier.length > 0) {\n for (const id of frontier) {\n seen.add(id);\n }\n // oxlint-disable-next-line no-await-in-loop\n const next = await Promise.all(\n frontier.map(async (id) => {\n const code = await host.read(id);\n let program: Program;\n try {\n program = parse(id.replace(/\\?.*$/, ''), code ?? '');\n } catch {\n return [];\n }\n const { static: statics, dynamic } = specifiersOf(program);\n const targets = new Map<string, string>();\n await Promise.all(\n [...statics, ...dynamic].map(async (source) => {\n const target = await host.resolve(source, id);\n if (target !== undefined) {\n targets.set(source, target);\n }\n }),\n );\n // A module loaded with `import()` is used as a whole.\n for (const source of dynamic) {\n const target = targets.get(source);\n if (target !== undefined) {\n usage.all(target);\n }\n }\n recordModule(usage, id, program, targets);\n usage.imports.set(id, [...targets.values()]);\n return [...targets.values()];\n }),\n );\n frontier = [...new Set(next.flat())].filter(\n (id) => !seen.has(id) && SCRIPT.test(id.replace(/\\?.*$/, '')),\n );\n }\n return usage;\n}\n","/**\n * `solid-optimizer/vite`: `vite-plugin-solid` with the optimizer built in.\n *\n * It takes the same options as `vite-plugin-solid`, plus `optimizer`, and\n * returns the official plugin with the optimizer wired in. It runs in one of\n * two modes.\n *\n * - Chunk mode keeps JSX through bundling. Each chunk is optimized as a whole\n * and then lowered by Solid's JSX transform, so a component inlines into\n * any other component in the same chunk. It applies to client builds that\n * do not hydrate.\n * - Module mode optimizes each module before the official plugin lowers it.\n * It applies everywhere else. A server build and its client build chunk\n * differently, and hydration needs both to render the same tree, so\n * hydrating builds only optimize within a module.\n */\nimport { readFile } from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport remapping from '@jridgewell/remapping';\nimport type * as Babel from '@babel/core';\nimport MagicString from 'magic-string';\nimport type { Node, Program } from 'oxc-parser';\nimport type { Plugin, ResolvedConfig, Rollup } from 'vite';\nimport { createFilter, transformWithOxc } from 'vite';\nimport type { Options as SolidPluginOptions } from 'vite-plugin-solid';\nimport solidPlugin from 'vite-plugin-solid';\nimport type { CompileOptions, CompileResult, ModuleConstants } from '../compile';\nimport { compile, readModuleConstants } from '../compile';\nimport { collectParents, parse } from '../ast';\nimport { analyzeScopes } from '../scope';\nimport { CONTEXT_SAFE_PRIMITIVES } from '../provider';\nimport type { ImportedConstants } from '../constants';\nimport type { Primitive } from '../value';\nimport { exposeLocals, readExportedComponent } from './inject';\nimport { nameNamespaceTags } from './namespace';\nimport type { UsageIndex } from './usage';\nimport { buildUsageIndex } from './usage';\nimport {\n MARKER,\n MissingHelperError,\n addMarker,\n generatedImports,\n linkHelpers,\n readMarkers,\n repairJSXSequences,\n} from './runtime';\n\nexport interface OptimizerOptions extends Pick<\n CompileOptions,\n 'fold' | 'inline' | 'alwaysInline' | 'contexts' | 'memos' | 'maxPasses'\n> {\n /**\n * Reduce Solid's reactive primitives to what they do on the server, in\n * server builds. See the `server` option of `compile`.\n *\n * @default true\n */\n server?: boolean;\n /**\n * Where the optimizer runs.\n *\n * - `auto` uses chunk mode for client builds that do not hydrate, and module mode otherwise.\n * - `module` optimizes each module on its own.\n *\n * @default 'auto'\n */\n mode?: 'auto' | 'module';\n /**\n * Also optimize while serving, in module mode.\n *\n * @default false\n */\n dev?: boolean;\n}\n\nexport interface Options extends Partial<SolidPluginOptions> {\n /** Set to `false` to use `vite-plugin-solid` as it is. */\n optimizer?: OptimizerOptions | false;\n}\n\n/** The options `babel-preset-solid` takes. */\ntype JSXOptions = NonNullable<SolidPluginOptions['solid']> & {\n generate?: 'dom' | 'ssr' | 'universal';\n hydratable?: boolean;\n};\n\ninterface Compiler {\n readonly babel: typeof Babel;\n readonly preset: Babel.PluginTarget;\n}\n\nconst DEFAULT_MODULE_NAME = 'solid-js/web';\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 JSX_MODULE = /\\.[mc]?[jt]sx$/i;\n\n/**\n * Helpers the JSX transform picks between for the same attribute. Inlining\n * can turn one form into the other: a style object that was a prop becomes a\n * literal, which the transform writes one property at a time. A module that\n * needs one keeps the other too.\n */\nconst RELATED_HELPERS: Readonly<Record<string, readonly string[]>> = {\n style: ['setStyleProperty'],\n setStyleProperty: ['style'],\n};\n\nfunction withRelated(helpers: readonly string[]): Set<string> {\n const result = new Set(helpers);\n for (const helper of helpers) {\n for (const related of RELATED_HELPERS[helper] ?? []) {\n result.add(related);\n }\n }\n return result;\n}\n\nfunction loadCompiler(): Compiler {\n // Use the Babel and preset `vite-plugin-solid` uses, so both lower JSX the same way.\n const require = createRequire(import.meta.url);\n const pluginRequire = createRequire(require.resolve('vite-plugin-solid'));\n const presetRequire = createRequire(pluginRequire.resolve('babel-preset-solid'));\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const babel = presetRequire('@babel/core') as typeof Babel;\n const preset: unknown = pluginRequire('babel-preset-solid');\n if (typeof preset !== 'function') {\n throw new TypeError('[solid-optimizer] babel-preset-solid did not load');\n }\n return { babel, preset };\n}\n\n/**\n * Lowers JSX with `babel-preset-solid`, as `vite-plugin-solid` does.\n */\nfunction lower(\n compiler: Compiler,\n code: string,\n filename: string,\n options: JSXOptions,\n): { code: string; map: string | undefined } {\n const result = compiler.babel.transformSync(code, {\n filename,\n sourceFileName: filename,\n presets: [[compiler.preset, options]],\n ast: false,\n sourceMaps: true,\n configFile: false,\n babelrc: false,\n parserOpts: {\n plugins: /\\.[mc]?tsx$/i.test(filename) ? ['jsx', 'typescript'] : ['jsx'],\n },\n });\n // An empty module, like a chunk a library build left empty, lowers to ''.\n if (typeof result?.code !== 'string') {\n throw new Error(`[solid-optimizer] babel-preset-solid produced no code for ${filename}`);\n }\n return { code: result.code, map: result.map ? JSON.stringify(result.map) : undefined };\n}\n\nfunction stripQuery(id: string): string {\n return id.replace(/\\?.*$/, '');\n}\n\nfunction combineMaps(maps: (string | null | undefined)[]): string | null {\n const present = maps.filter((map): map is string => typeof map === 'string');\n if (present.length === 0) {\n return null;\n }\n return remapping(present.reverse(), () => null).toString();\n}\n\n/**\n * The local name of each value a module imports, keyed by its source and\n * the name it is imported as: an export name, `default`, or `*`.\n */\nfunction importedNames(program: Program): Map<string, string> {\n const names = new Map<string, string>();\n for (const statement of program.body) {\n if (statement.type !== 'ImportDeclaration' || statement.importKind === 'type') {\n continue;\n }\n for (const specifier of statement.specifiers) {\n let imported = '*';\n if (specifier.type === 'ImportDefaultSpecifier') {\n imported = 'default';\n } else if (specifier.type === 'ImportSpecifier') {\n imported =\n specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value;\n }\n const typeOnly = specifier.type === 'ImportSpecifier' && specifier.importKind === 'type';\n if (!typeOnly) {\n names.set(`${statement.source.value}\\0${imported}`, specifier.local.name);\n }\n }\n }\n return names;\n}\n\n/**\n * A key for a module in the build environment of `context`. The server and\n * client builds transform the same module into different code.\n */\nfunction environmentKey(context: { environment?: { name: string } }, id: string): string {\n return `${context.environment?.name ?? ''}\\0${id}`;\n}\n\nfunction isClient(context: { environment?: { config: { consumer: string } } }): boolean {\n return context.environment?.config.consumer === 'client';\n}\n\nexport default function solidOptimizer(options: Options = {}): Plugin[] {\n const { optimizer: optimizerOption, ...solidOptions } = options;\n const main = solidPlugin(solidOptions);\n if (optimizerOption === false) {\n return [main];\n }\n const optimizer = optimizerOption ?? {};\n const moduleName = solidOptions.solid?.moduleName ?? DEFAULT_MODULE_NAME;\n const moduleSources = [...new Set(['solid-js', DEFAULT_MODULE_NAME, moduleName])];\n const builtIns = new Set(solidOptions.solid?.builtIns ?? DEFAULT_BUILT_INS);\n const compileOptions: CompileOptions = {\n fold: optimizer.fold,\n inline: optimizer.inline,\n alwaysInline: optimizer.alwaysInline,\n contexts: optimizer.contexts,\n memos: optimizer.memos,\n maxPasses: optimizer.maxPasses,\n builtIns: [...builtIns],\n moduleSources,\n };\n\n let config: ResolvedConfig | undefined;\n let compiler: Compiler | undefined;\n let filter: ((id: string) => boolean) | undefined;\n const getCompiler = (): Compiler => {\n compiler ??= loadCompiler();\n return compiler;\n };\n\n const isBuild = (): boolean => config?.command === 'build';\n\n /**\n * The JSX options the official plugin passes for a posture, so the\n * lowering here matches it. Mirrors the `transform` hook of `vite-plugin-solid`.\n */\n const jsxOptions = (isSsr: boolean): JSXOptions => {\n let posture: JSXOptions = { generate: 'dom', hydratable: false };\n if (solidOptions.ssr) {\n posture = { generate: isSsr ? 'ssr' : 'dom', hydratable: true };\n }\n return { ...posture, ...solidOptions.solid };\n };\n\n /**\n * Whether client builds keep JSX until chunks are rendered.\n */\n const chunkMode = (): boolean => {\n if (!isBuild() || (optimizer.mode ?? 'auto') !== 'auto') {\n return false;\n }\n // The user's Babel plugins have to see the modules, which chunk mode skips.\n if (solidOptions.babel) {\n return false;\n }\n const client = jsxOptions(false);\n return client.generate === 'dom' && client.hydratable !== true;\n };\n\n const isJSXModule = (id: string): boolean => {\n filter ??= createFilter(solidOptions.include, solidOptions.exclude);\n return filter(id) && JSX_MODULE.test(stripQuery(id));\n };\n\n /** Modules that keep their JSX, which the bundler must parse as JSX. */\n const preserved = new Set<string>();\n\n /** What each module imports and the constants it exports, by module id. */\n const moduleConstants = new Map<string, Promise<ModuleConstants | undefined>>();\n\n /**\n * The module an import resolves to, when its constants can be read.\n *\n * A module with JSX is skipped. This plugin's transform may be waiting for\n * it, and it may be waiting for this one, so loading it could deadlock.\n * Dependencies are skipped to keep the build fast.\n */\n async function resolveConstantModule(\n context: Rollup.PluginContext,\n specifier: string,\n importer: string,\n ): Promise<string | undefined> {\n if (moduleSources.includes(specifier)) {\n return undefined;\n }\n const resolved = await context.resolve(specifier, importer);\n if (\n !resolved ||\n resolved.external ||\n resolved.id.includes('/node_modules/') ||\n isJSXModule(resolved.id)\n ) {\n return undefined;\n }\n return resolved.id;\n }\n\n /**\n * The constants of the modules `code` imports, keyed by import specifier.\n *\n * Each module is read as the bundler loads it, after every plugin has\n * transformed it, so a plugin that replaces or rewrites a module is seen.\n * A module that imports constants itself resolves them first, and a cycle\n * leaves the modules in it without them.\n */\n async function importedConstants(\n context: Rollup.PluginContext,\n imports: readonly string[],\n importer: string,\n visiting: ReadonlySet<string>,\n ): Promise<ImportedConstants> {\n const entries = await Promise.all(\n imports.map(async (specifier) => {\n const id = await resolveConstantModule(context, specifier, importer);\n if (id === undefined || visiting.has(id)) {\n return undefined;\n }\n const constants = await constantsOf(context, id, visiting);\n if (!constants || Object.keys(constants.exports).length === 0) {\n return undefined;\n }\n return [specifier, constants.exports] as const;\n }),\n );\n return Object.fromEntries(\n entries.filter(\n (entry): entry is readonly [string, Record<string, Primitive>] => entry !== undefined,\n ),\n );\n }\n\n async function constantsOf(\n context: Rollup.PluginContext,\n id: string,\n visiting: ReadonlySet<string>,\n ): Promise<ModuleConstants | undefined> {\n let pending = moduleConstants.get(id);\n if (!pending) {\n pending = (async () => {\n const { code } = await context.load({ id });\n if (code === null) {\n return undefined;\n }\n // Loaded code is JavaScript, whatever the module was written in.\n const filename = `${stripQuery(id)}.js`;\n try {\n const own = readModuleConstants(code, { filename });\n if (own.imports.length === 0) {\n return own;\n }\n const imported = await importedConstants(\n context,\n own.imports,\n id,\n new Set([...visiting, id]),\n );\n return readModuleConstants(code, { filename, importedConstants: imported });\n } catch (error) {\n // A module the parser rejects fails its own transform, with a better error.\n if (error instanceof SyntaxError) {\n return undefined;\n }\n throw error;\n }\n })();\n moduleConstants.set(id, pending);\n }\n return pending;\n }\n\n /**\n * The compile options for a module, with the constants of its imports.\n */\n async function moduleOptions(\n context: Rollup.PluginContext,\n code: string,\n id: string,\n ): Promise<CompileOptions> {\n const filename = stripQuery(id);\n // The dev server cannot give back the code of a loaded module.\n if (optimizer.fold === false || !isBuild()) {\n return { ...compileOptions, filename };\n }\n const { imports } = readModuleConstants(code, { filename });\n return {\n ...compileOptions,\n filename,\n importedConstants: await importedConstants(context, imports, filename, new Set([filename])),\n };\n }\n\n /** The modules each transform waits for, so two never wait for each other. */\n const waiting = new Map<string, Set<string>>();\n\n /** Whether the transform of `from` waits, directly or not, for `to`. */\n const waitsFor = (from: string, to: string): boolean => {\n const seen = new Set<string>();\n const stack = [from];\n for (let current = stack.pop(); current !== undefined; current = stack.pop()) {\n if (current === to) {\n return true;\n }\n if (!seen.has(current)) {\n seen.add(current);\n stack.push(...(waiting.get(current) ?? []));\n }\n }\n return false;\n };\n\n /**\n * The code of a module with JSX, as the bundler loads it. `undefined`\n * when that module's transform waits for the importer, which would then\n * wait for it in turn.\n */\n async function loadModule(\n context: Rollup.PluginContext,\n importer: string,\n target: string,\n ): Promise<string | undefined> {\n if (waitsFor(target, importer)) {\n return undefined;\n }\n const targets = waiting.get(importer) ?? new Set<string>();\n targets.add(target);\n waiting.set(importer, targets);\n try {\n const info = await context.load({ id: target });\n return info.code ?? undefined;\n } finally {\n targets.delete(target);\n }\n }\n\n /**\n * The code of each module with JSX as this plugin's module step returned\n * it, before Solid's JSX transform lowers it. In module mode, an importer\n * copies components from it.\n */\n const recorded = new Map<string, string>();\n\n /** The modules with JSX each module imports, read from its file. */\n const jsxImports = new Map<string, Promise<string[]>>();\n\n /**\n * The modules with JSX a module imports. They come from the file on disk,\n * so they do not depend on the order modules are transformed in.\n */\n async function jsxImportsOf(context: Rollup.PluginContext, id: string): Promise<string[]> {\n let pending = jsxImports.get(id);\n if (!pending) {\n pending = (async () => {\n let code: string;\n try {\n code = await readFile(stripQuery(id), 'utf8');\n } catch {\n return [];\n }\n let program: Program;\n try {\n program = parse(stripQuery(id), code);\n } catch {\n return [];\n }\n const sources = new Set<string>();\n for (const statement of program.body) {\n if (\n (statement.type === 'ImportDeclaration' && statement.importKind !== 'type') ||\n ((statement.type === 'ExportNamedDeclaration' ||\n statement.type === 'ExportAllDeclaration') &&\n statement.source &&\n statement.exportKind !== 'type')\n ) {\n const value = statement.source?.value;\n if (value !== undefined && !moduleSources.includes(value)) {\n sources.add(value);\n }\n }\n }\n const resolved = await Promise.all(\n [...sources].map(async (source) => context.resolve(source, id)),\n );\n return resolved\n .filter((target) => target && !target.external && isJSXModule(target.id))\n .map((target) => target?.id ?? '');\n })();\n jsxImports.set(id, pending);\n }\n return pending;\n }\n\n /** Whether `from` imports `to`, directly or through other modules with JSX. */\n async function reaches(\n context: Rollup.PluginContext,\n from: string,\n to: string,\n ): Promise<boolean> {\n const seen = new Set<string>();\n let frontier = [from];\n while (frontier.length > 0) {\n if (frontier.includes(to)) {\n return true;\n }\n for (const id of frontier) {\n seen.add(id);\n }\n // oxlint-disable-next-line no-await-in-loop\n const next = await Promise.all(frontier.map(async (id) => jsxImportsOf(context, id)));\n frontier = [...new Set(next.flat())].filter((id) => !seen.has(id));\n }\n return false;\n }\n\n /**\n * The code of a module with JSX before Solid's JSX transform, with its\n * types stripped. A module that imports the importer back is skipped, so\n * no two transforms wait for each other, and the server and client builds\n * skip the same ones.\n */\n async function loadRecorded(\n context: Rollup.PluginContext,\n importer: string,\n target: string,\n ): Promise<string | undefined> {\n if (await reaches(context, target, importer)) {\n return undefined;\n }\n await context.load({ id: target });\n const code = recorded.get(environmentKey(context, target));\n if (code === undefined) {\n return undefined;\n }\n const stripped = await transformWithOxc(code, stripQuery(target), {\n jsx: 'preserve',\n sourcemap: false,\n });\n return stripped.code;\n }\n\n /**\n * The scripts an entry runs: the entry itself, or the module scripts of an\n * HTML entry. `undefined` when an HTML entry has an inline module script,\n * whose imports the usage index cannot read.\n */\n async function scriptEntries(\n context: Rollup.PluginContext,\n id: string,\n ): Promise<string[] | undefined> {\n if (/\\.[mc]?[jt]sx?(?:\\?|$)/.test(id)) {\n return [id];\n }\n let html: string;\n try {\n html = await readFile(stripQuery(id), 'utf8');\n } catch {\n return undefined;\n }\n const scripts: string[] = [];\n for (const [tag] of html.matchAll(/<script\\b[^>]*>/gi)) {\n if (!/\\btype\\s*=\\s*[\"']?module/i.test(tag)) {\n continue;\n }\n const src = /\\bsrc\\s*=\\s*[\"']([^\"']+)[\"']/i.exec(tag)?.[1];\n if (src === undefined) {\n return undefined;\n }\n // oxlint-disable-next-line no-await-in-loop\n const resolved = await context.resolve(src, id);\n if (!resolved || resolved.external) {\n return undefined;\n }\n scripts.push(resolved.id);\n }\n return scripts;\n }\n\n /** How the app uses each export, built once per environment and build. */\n const usageIndexes = new Map<string, Promise<UsageIndex>>();\n\n /**\n * How the app uses each export, read from the modules the entries reach.\n */\n async function usageIndex(context: Rollup.PluginContext): Promise<UsageIndex> {\n const key = environmentKey(context, '');\n let pending = usageIndexes.get(key);\n if (!pending) {\n pending = (async () => {\n const entries = await Promise.all(\n [...context.getModuleIds()]\n .filter((id) => context.getModuleInfo(id)?.isEntry === true)\n .map(async (id) => scriptEntries(context, id)),\n );\n // A script the index cannot read could use any export.\n const known = entries.every((scripts) => scripts !== undefined);\n return buildUsageIndex(known ? entries.flat() : [], {\n resolve: async (source, importer) => {\n const resolved = await context.resolve(source, importer);\n return !resolved || resolved.external || resolved.id.includes('/node_modules/')\n ? undefined\n : resolved.id;\n },\n read: async (id) => {\n try {\n return await readFile(stripQuery(id), 'utf8');\n } catch {\n return undefined;\n }\n },\n });\n })();\n usageIndexes.set(key, pending);\n }\n return pending;\n }\n\n /**\n * The text that imports a binding under `local`.\n */\n function importText(local: string, imported: string, source: string): string {\n const from = JSON.stringify(source);\n if (imported === '*') {\n return `import * as ${local} from ${from};`;\n }\n if (imported === 'default') {\n return `import ${local} from ${from};`;\n }\n return `import { ${imported} as ${local} } from ${from};`;\n }\n\n interface Copy {\n /** The module and export the copy comes from. */\n readonly key: string;\n readonly name: string;\n /** The tags in the importer that call it. */\n readonly tags: Node[];\n readonly text: string;\n }\n\n interface CopyState {\n /** Components that cannot be copied, or were left over before. */\n readonly excluded: Set<string>;\n /** The contexts the copies import, by module. */\n readonly contexts: Map<string, Set<string>>;\n /** Imports a binding into the importer, and gives its local name. */\n readonly importAs: (base: string, imported: string, from: string) => string;\n /** The code of a module with JSX to copy from, or `undefined` to skip it. */\n readonly load: (target: string) => Promise<string | undefined>;\n }\n\n /**\n * Reads the component `source` exports as `imported`, and imports what it\n * needs into the importer. `undefined` when it cannot be copied.\n */\n async function copyImported(\n context: Rollup.PluginContext,\n id: string,\n source: string,\n imported: string,\n state: CopyState,\n ): Promise<{ key: string; text: (name: string) => string } | undefined> {\n const resolved = await context.resolve(source, id);\n if (\n !resolved ||\n resolved.external ||\n resolved.id === id ||\n resolved.id.includes('/node_modules/') ||\n !isJSXModule(resolved.id)\n ) {\n return undefined;\n }\n const key = `${resolved.id}\\0${imported}`;\n if (state.excluded.has(key)) {\n return undefined;\n }\n const loaded = await state.load(resolved.id);\n const component = loaded\n ? readExportedComponent(loaded, stripQuery(resolved.id), imported, moduleSources)\n : undefined;\n if (!component) {\n state.excluded.add(key);\n return undefined;\n }\n // Each import of the module resolves from it, so the copy imports the same module.\n const targets = new Map<string, string>();\n for (const dependency of component.dependencies.values()) {\n if (dependency.kind === 'import' && !moduleSources.includes(dependency.source)) {\n // oxlint-disable-next-line no-await-in-loop\n const target = await context.resolve(dependency.source, resolved.id);\n if (!target) {\n state.excluded.add(key);\n return undefined;\n }\n targets.set(dependency.source, target.external ? dependency.source : target.id);\n }\n }\n const rename = new Map<string, string>();\n for (const [local, dependency] of component.dependencies) {\n if (dependency.kind === 'import') {\n const from = targets.get(dependency.source) ?? dependency.source;\n rename.set(local, state.importAs(local, dependency.imported, from));\n continue;\n }\n rename.set(local, state.importAs(local, dependency.exported, resolved.id));\n if (dependency.context) {\n const known = state.contexts.get(resolved.id) ?? new Set<string>();\n known.add(dependency.exported);\n state.contexts.set(resolved.id, known);\n }\n }\n return { key, text: (name) => component.copy(name, rename) };\n }\n\n /**\n * Copies the components a module imports from other modules with JSX into\n * it, and inlines them there. A copy the inline pass cannot inline at\n * every call is left out, so a component is never in both places. Copies\n * can import components in turn, which a few more rounds take in.\n */\n async function inlineImports(\n context: Rollup.PluginContext,\n source: string,\n id: string,\n compileOptionsOfModule: CompileOptions,\n load: (target: string) => Promise<string | undefined>,\n ): Promise<{ code: string; maps: string[] } | undefined> {\n const filename = stripQuery(id);\n const maps: string[] = [];\n const excluded = new Set<string>();\n const usage = await usageIndex(context);\n // The components copied here that leave their module, by module.\n const absorbed = new Map<string, Set<string>>();\n // How many modules use the original of a copy, this one included.\n const usersOf = (copy: Copy): number => {\n const [module = '', exported = ''] = copy.key.split('\\0');\n return usage.users(module, exported, id, absorbed);\n };\n // The contexts the copies import, which the provider pass needs to know.\n const contexts = new Map<string, Set<string>>();\n let code = source;\n for (let round = 0; round < 4; round += 1) {\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const parents = collectParents(program);\n const names = new Set(scopes.names);\n const fresh = (base: string): string => {\n let name = base;\n for (let index = 1; names.has(name); index += 1) {\n name = `${base}$${String(index)}`;\n }\n names.add(name);\n return name;\n };\n\n // The module's own imports, so a copy reuses one instead of adding another.\n // Two imports of one context would be two bindings to the provider pass.\n const existing = importedNames(program);\n // Imports added in this round, shared by every copy.\n const imports: string[] = [];\n const added = new Map<string, string>();\n const importAs = (base: string, imported: string, from: string): string => {\n const key = `${from}\\0${imported}`;\n const known = existing.get(key) ?? added.get(key);\n if (known !== undefined) {\n return known;\n }\n const name = fresh(base);\n added.set(key, name);\n imports.push(importText(name, imported, from));\n return name;\n };\n\n // Each imported binding used as a JSX tag, and its copy.\n const copies: Copy[] = [];\n for (const statement of program.body) {\n if (\n statement.type !== 'ImportDeclaration' ||\n statement.importKind === 'type' ||\n moduleSources.includes(statement.source.value)\n ) {\n continue;\n }\n for (const specifier of statement.specifiers) {\n const binding = scopes.root.bindings.get(specifier.local.name);\n // Only tags are copied. The import stays for any other use.\n const tags = (binding?.references ?? []).filter((reference) => {\n const parent = parents.get(reference);\n return (\n (parent?.type === 'JSXOpeningElement' || parent?.type === 'JSXClosingElement') &&\n parent.name === reference\n );\n });\n if (\n specifier.type === 'ImportNamespaceSpecifier' ||\n binding?.imported === undefined ||\n tags.length === 0\n ) {\n continue;\n }\n // oxlint-disable-next-line no-await-in-loop\n const copy = await copyImported(context, id, statement.source.value, binding.imported, {\n excluded,\n contexts,\n importAs,\n load,\n });\n if (copy) {\n const name = fresh(specifier.local.name);\n copies.push({ key: copy.key, name, tags, text: copy.text(name) });\n }\n }\n }\n if (copies.length === 0) {\n break;\n }\n\n // Drop the copies the inline pass leaves behind, and try again without them.\n let result: CompileResult | undefined;\n let edit: MagicString | undefined;\n for (let attempt = 0; attempt < 4 && copies.length > 0; attempt += 1) {\n edit = new MagicString(code);\n for (const copy of copies) {\n for (const tag of copy.tags) {\n edit.overwrite(tag.start, tag.end, copy.name);\n }\n edit.append(`\\n${copy.text}\\n`);\n }\n edit.append(`\\n${imports.join('\\n')}\\n`);\n result = compile(edit.toString(), {\n ...compileOptionsOfModule,\n filename,\n sourceMap: true,\n importedContexts: Object.fromEntries(\n [...contexts].map(([module, exported]) => [module, [...exported]]),\n ),\n // The original of a copy stays in its module for its other users.\n sharedComponents: Object.fromEntries(\n copies\n .map((copy): [string, number] => [copy.name, usersOf(copy)])\n .filter(([, users]) => users !== 1),\n ),\n });\n const left = analyzeScopes(parse(filename, result.code)).root.bindings;\n const stuck = copies.filter((copy) => left.has(copy.name));\n if (stuck.length === 0) {\n break;\n }\n for (const copy of stuck) {\n excluded.add(copy.key);\n copies.splice(copies.indexOf(copy), 1);\n }\n result = undefined;\n }\n if (!result || !edit) {\n break;\n }\n // Their uses of other components move here with them.\n for (const copy of copies.filter((item) => usersOf(item) === 1)) {\n const [module = '', exported = ''] = copy.key.split('\\0');\n absorbed.set(module, new Set([...(absorbed.get(module) ?? []), exported]));\n }\n maps.push(\n edit.generateMap({ source: filename, hires: true, includeContent: true }).toString(),\n );\n if (result.map) {\n maps.push(result.map.toString());\n }\n code = result.code;\n }\n return code === source ? undefined : { code, maps };\n }\n\n /**\n * Prepares a client module for chunk mode. It adds the helper marker\n * instead of lowering JSX. Vite strips the types afterwards.\n */\n async function keepJSX(\n context: Rollup.PluginContext,\n source: string,\n id: string,\n ): Promise<Rollup.TransformResult> {\n const filename = stripQuery(id);\n // Fold and inline memos before bundling. A branch that folds away takes\n // its imports and `lazy()` chunks out of the module graph, which the\n // chunk step can no longer do. Inlining waits for the chunk, where the\n // components it can reach are known.\n const moduleCompileOptions = await moduleOptions(context, source, id);\n const local = compile(source, { ...moduleCompileOptions, inline: false });\n let code = local.code;\n const maps: (string | null | undefined)[] = [local.map?.toString()];\n // `<Ns.Member>` would keep a namespace object, which lowered code does not.\n const named = nameNamespaceTags(code, filename);\n if (named) {\n code = named.code;\n maps.push(named.map);\n }\n\n // Components imported from other modules inline here, so the bundler\n // drops them, and what only they used, before it splits the chunks.\n if (moduleCompileOptions.inline !== false) {\n const imported = await inlineImports(\n context,\n code,\n id,\n moduleCompileOptions,\n async (target) => loadModule(context, id, target),\n );\n if (imported) {\n code = imported.code;\n maps.push(...imported.maps);\n }\n }\n // An entry's exports are its public API, so it gets no extra names.\n const exposed = context.getModuleInfo(id)?.isEntry ? undefined : exposeLocals(code, filename);\n if (exposed) {\n code = exposed.code;\n maps.push(exposed.map);\n }\n // The helpers the module's JSX needs, as written and with its own\n // components inlined. Inlining can turn a spread into attributes, which\n // need helpers the spread did not.\n const inlined =\n moduleCompileOptions.inline === false\n ? undefined\n : compile(code, { ...moduleCompileOptions, sourceMap: false });\n const needed = new Set<string>();\n for (const version of new Set([code, inlined?.code ?? code])) {\n const dryRun = lower(getCompiler(), version, filename, jsxOptions(false));\n for (const helper of generatedImports(dryRun.code, filename, moduleName)) {\n needed.add(helper);\n }\n }\n preserved.add(id);\n if (needed.size === 0) {\n return code === source ? null : { code, map: combineMaps(maps) };\n }\n const marked = addMarker(code, filename, {\n moduleName,\n helpers: withRelated([...needed]),\n moduleSources,\n // The passes also recognize these primitives, which a chunk renames too.\n builtIns: new Set([...builtIns, 'createContext', ...CONTEXT_SAFE_PRIMITIVES]),\n });\n if (!marked) {\n return code === source ? null : { code, map: combineMaps(maps) };\n }\n return {\n code: marked.code,\n map: combineMaps([...maps, marked.map]),\n };\n }\n\n const originalTransform = main.transform;\n const originalHandler =\n typeof originalTransform === 'function' ? originalTransform : originalTransform?.handler;\n if (originalHandler) {\n main.transform = async function transform(code, id, transformOptions) {\n if (chunkMode() && isClient(this) && isJSXModule(id)) {\n return keepJSX(this, code, id);\n }\n return originalHandler.call(this, code, id, transformOptions);\n };\n }\n\n const modulePlugin: Plugin = {\n name: 'solid-optimizer:module',\n enforce: 'pre',\n configResolved(resolved) {\n config = resolved;\n },\n buildStart() {\n moduleConstants.clear();\n jsxImports.clear();\n usageIndexes.clear();\n },\n watchChange() {\n moduleConstants.clear();\n jsxImports.clear();\n usageIndexes.clear();\n },\n async transform(source, id) {\n if (!isBuild() && optimizer.dev !== true) {\n return null;\n }\n if ((chunkMode() && isClient(this)) || !isJSXModule(id)) {\n return null;\n }\n const filename = stripQuery(id);\n const sourceOptions: CompileOptions = {\n ...(await moduleOptions(this, source, id)),\n // The server renders once, so its reactive primitives reduce to plain calls.\n server: optimizer.server !== false && !isClient(this),\n };\n const result = compile(source, sourceOptions);\n let code = result.code;\n const maps: (string | null | undefined)[] = [result.map?.toString()];\n // Components imported from other modules inline here too. The server\n // and client builds read the same modules, so they inline the same ones.\n if (isBuild() && sourceOptions.inline !== false) {\n const imported = await inlineImports(this, code, id, sourceOptions, async (target) =>\n loadRecorded(this, id, target),\n );\n if (imported) {\n code = imported.code;\n maps.push(...imported.maps);\n }\n // Entries get the extra exports too. The server and client builds\n // have different entries, and both have to copy the same components.\n const exposed = exposeLocals(code, filename);\n if (exposed) {\n code = exposed.code;\n maps.push(exposed.map);\n }\n }\n recorded.set(environmentKey(this, id), code);\n if (code === source) {\n return null;\n }\n return { code, map: combineMaps(maps) };\n },\n };\n\n const chunkPlugin: Plugin = {\n name: 'solid-optimizer:chunk',\n enforce: 'post',\n config(_, env) {\n if (env.command !== 'build') {\n return undefined;\n }\n // Kept JSX has to reach the bundler as JSX. Modules the official plugin\n // lowers have no JSX left, so this changes nothing for them.\n return {\n oxc: { jsx: 'preserve' },\n build: { rolldownOptions: { transform: { jsx: 'preserve' } } },\n };\n },\n renderChunk: {\n order: 'pre',\n handler(code, chunk) {\n if (!chunkMode() || !isClient(this) || !code.includes(MARKER)) {\n return null;\n }\n const filename = chunk.fileName;\n let repaired: { code: string; map: string } | undefined;\n let runtime: ReturnType<typeof readMarkers>;\n try {\n runtime = readMarkers(code, filename);\n } catch (error) {\n repaired = error instanceof SyntaxError ? repairJSXSequences(code, filename) : undefined;\n if (!repaired) {\n throw error;\n }\n runtime = readMarkers(repaired.code, filename);\n }\n if (!runtime) {\n return null;\n }\n let optimized: CompileResult | undefined = compile(runtime.code, {\n ...compileOptions,\n filename,\n constantVars: true,\n builtInAliases: runtime.builtInAliases,\n });\n let lowered = lower(getCompiler(), optimized.code, filename, jsxOptions(false));\n let linked: { code: string; map: string };\n try {\n linked = linkHelpers(lowered.code, filename, moduleName, runtime.helpers);\n } catch (error) {\n if (!(error instanceof MissingHelperError)) {\n throw error;\n }\n // Each module keeps the helpers its own JSX needs, and a merged\n // tree can need one none of them did. Without it, the chunk is\n // lowered as its modules were written. Chunk mode never hydrates,\n // so the chunks do not have to match anything else.\n this.warn(`${error.message} ${filename} is not optimized.`);\n optimized = undefined;\n lowered = lower(getCompiler(), runtime.code, filename, jsxOptions(false));\n linked = linkHelpers(lowered.code, filename, moduleName, runtime.helpers);\n }\n return {\n code: linked.code,\n map: combineMaps([\n repaired?.map,\n runtime.map,\n optimized?.map?.toString(),\n lowered.map,\n linked.map,\n ]),\n };\n },\n },\n };\n\n // Runs after `vite:oxc` strips types, which reports the module as plain\n // JavaScript, and before the built-in plugins that parse it again.\n const moduleTypePlugin: Plugin = {\n name: 'solid-optimizer:module-type',\n transform(code, id) {\n if (!preserved.has(id)) {\n return null;\n }\n // `vite:oxc` prints JSX like Rolldown does, without the parentheses a\n // comma expression needs in a JSX expression container.\n const repaired = repairJSXSequences(code, stripQuery(id));\n return repaired\n ? { code: repaired.code, map: repaired.map, moduleType: 'jsx' }\n : { code, moduleType: 'jsx' };\n },\n };\n\n return [modulePlugin, main, moduleTypePlugin, chunkPlugin];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,SAAS;;;;AAKtB,IAAa,qBAAb,cAAwC,MAAM;;;EACnB,KAAA,OAAA;;AAC3B;AAEA,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AAOxB,SAASA,cAAY,GAAgB,UAA0B;CAC7D,OAAO,EAAE,YAAY;EAAE,QAAQ;EAAU,OAAO;EAAM,gBAAgB;CAAK,CAAC,CAAC,CAAC,SAAS;AACzF;AAEA,SAAS,UAAU,QAAuB,MAAsB;CAC9D,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,OAAO,OAAO,MAAM,IAAI,IAAI,GAAG;EAC7B,OAAO,GAAG,KAAK,GAAG,OAAO,KAAK;EAC9B,SAAS;CACX;CACA,OAAO,MAAM,IAAI,IAAI;CACrB,OAAO;AACT;;;;;AAMA,SAAS,qBAAqB,WAAgD;CAC5E,OAAO,UAAU,SAAS,qBAAqB,UAAU,MAAM,KAAK,WAAW,IAAI;AACrF;AAEA,SAAS,aAAa,WAAoC;CACxD,OAAO,UAAU,SAAS,SAAS,YAAY,UAAU,SAAS,QAAQ,UAAU,SAAS;AAC/F;;;;;AAMA,SAAgB,iBAAiB,MAAc,UAAkB,QAA0B;CACzF,MAAM,UAAU,MAAM,UAAU,IAAI;CACpC,MAAM,Q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3D"}
|
|
1
|
+
{"version":3,"file":"vite.mjs","names":["generateMap","generateMap"],"sources":["../src/vite/report.ts","../src/vite/runtime.ts","../src/vite/inject.ts","../src/vite/namespace.ts","../src/vite/refs.ts","../src/vite/usage.ts","../src/vite/index.ts"],"sourcesContent":["/**\n * The report of what the optimizer leaves alone in a build, and why.\n *\n * Each pass records a short reason code for every component call, provider,\n * and memo it does not optimize. The plugin collects them from the final\n * compile of each chunk or module, and prints them grouped by reason.\n */\nimport type { Skip, SkipPass } from '../context';\n\n/** What the optimizer left alone in one build environment. */\nexport interface OptimizerReport {\n /** The Vite environment, like `client` or `ssr`. */\n readonly environment: string;\n readonly skips: readonly Skip[];\n}\n\nexport interface ReasonSummary {\n readonly pass: SkipPass;\n readonly reason: string;\n readonly count: number;\n /** How many times each name was skipped for this reason, most first. */\n readonly names: readonly (readonly [string, number])[];\n}\n\n/**\n * Groups skips by pass and reason, most frequent first.\n */\nexport function summarizeSkips(skips: readonly Skip[]): ReasonSummary[] {\n const groups = new Map<string, { pass: SkipPass; reason: string; names: Map<string, number> }>();\n for (const skip of skips) {\n const key = `${skip.pass}\\0${skip.reason}`;\n const group = groups.get(key) ?? { pass: skip.pass, reason: skip.reason, names: new Map() };\n group.names.set(skip.name, (group.names.get(skip.name) ?? 0) + 1);\n groups.set(key, group);\n }\n return [...groups.values()]\n .map(({ pass, reason, names }) => ({\n pass,\n reason,\n count: [...names.values()].reduce((sum, count) => sum + count, 0),\n names: [...names].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])),\n }))\n .sort(\n (a, b) =>\n b.count - a.count || a.pass.localeCompare(b.pass) || a.reason.localeCompare(b.reason),\n );\n}\n\n/** The most names listed for a reason. */\nconst NAMES_SHOWN = 6;\n\n/**\n * The report as text, one line per reason.\n */\nexport function formatReport(report: OptimizerReport): string {\n const lines = [`solid-optimizer: what stays as written in ${report.environment}`];\n const summaries = summarizeSkips(report.skips);\n if (summaries.length === 0) {\n lines.push(' nothing');\n }\n const reasonWidth = Math.max(0, ...summaries.map((summary) => summary.reason.length));\n for (const summary of summaries) {\n const shown = summary.names\n .slice(0, NAMES_SHOWN)\n .map(([name, count]) => (count > 1 ? `${name}×${String(count)}` : name));\n if (summary.names.length > NAMES_SHOWN) {\n shown.push(`${String(summary.names.length - NAMES_SHOWN)} more`);\n }\n lines.push(\n ` ${summary.pass.padEnd(8)} ${summary.reason.padEnd(reasonWidth)} ${String(summary.count).padStart(4)} ${shown.join(', ')}`,\n );\n }\n return lines.join('\\n');\n}\n","/**\n * Keeps Solid's runtime helpers reachable while JSX waits in a bundled chunk.\n *\n * Solid's JSX transform imports helpers like `template` and `insert` from\n * `solid-js/web`. When the transform runs on a chunk, the bundle is already\n * built, so a new bare import cannot be resolved or bundled anymore. Instead,\n * every module imports the helpers it will need before bundling, and passes\n * them to a marker call. The bundler keeps the call, since it could have side\n * effects, and renames the helpers to whatever they are called in the chunk.\n * The chunk step reads the marker, removes it, and points the lowered code at\n * those names.\n *\n * The marker also records which bindings are Solid's built-in components, so\n * the fold pass still recognizes `Show` after the bundler renamed it.\n */\nimport MagicString from 'magic-string';\nimport { parseSync } from 'oxc-parser';\nimport type {\n ExpressionStatement,\n ImportDeclarationSpecifier,\n ImportSpecifier,\n Node,\n Program,\n} from 'oxc-parser';\nimport { collectParents, forEachChild, parse, unwrap } from '../ast';\nimport type { ScopeAnalysis } from '../scope';\nimport { analyzeScopes, lookup, scopeAt } from '../scope';\n\nexport const MARKER = '__SOLID_OPTIMIZER_KEEP__';\n\n/**\n * The lowered chunk needs a helper that no module in the chunk kept.\n */\nexport class MissingHelperError extends Error {\n override readonly name = 'MissingHelperError';\n}\n\nconst HELPER_PREFIX = 'helper:';\nconst BUILT_IN_PREFIX = 'builtin:';\n\nexport interface EditResult {\n code: string;\n map: string;\n}\n\nfunction generateMap(s: MagicString, filename: string): string {\n return s.generateMap({ source: filename, hires: true, includeContent: true }).toString();\n}\n\nfunction freshName(scopes: ScopeAnalysis, base: string): string {\n let name = base;\n let index = 1;\n while (scopes.names.has(name)) {\n name = `${base}$${String(index)}`;\n index += 1;\n }\n scopes.names.add(name);\n return name;\n}\n\n/**\n * Whether an import specifier was added by Solid's JSX transform, which\n * names every helper it imports `_$name`.\n */\nfunction isGeneratedSpecifier(specifier: ImportDeclarationSpecifier): boolean {\n return specifier.type === 'ImportSpecifier' && specifier.local.name.startsWith('_$');\n}\n\nfunction exportedName(specifier: ImportSpecifier): string {\n return specifier.imported.type === 'Literal' ? specifier.imported.value : specifier.imported.name;\n}\n\nexport interface MarkerOptions {\n /** The module the helpers come from, usually `solid-js/web`. */\n readonly moduleName: string;\n /** The helpers to keep. */\n readonly helpers: ReadonlySet<string>;\n /** The modules Solid's built-in components come from. */\n readonly moduleSources: readonly string[];\n /** The names of Solid's built-in components. */\n readonly builtIns: ReadonlySet<string>;\n}\n\n/**\n * The functions declared at the top level of a module, with the statement\n * that declares each: `function A() {}`, `const A = () => ...`, and their\n * `export` forms.\n */\nfunction topLevelFunctions(program: Program): { statement: Node; fn: Node }[] {\n const found: { statement: Node; fn: Node }[] = [];\n for (const statement of program.body) {\n const declaration =\n statement.type === 'ExportNamedDeclaration' || statement.type === 'ExportDefaultDeclaration'\n ? statement.declaration\n : statement;\n if (!declaration) {\n continue;\n }\n if (declaration.type === 'FunctionDeclaration') {\n found.push({ statement, fn: declaration });\n } else if (\n declaration.type === 'VariableDeclaration' &&\n declaration.declarations.length === 1\n ) {\n const init = declaration.declarations.at(0)?.init;\n const fn = init ? unwrap(init) : undefined;\n if (fn?.type === 'ArrowFunctionExpression' || fn?.type === 'FunctionExpression') {\n found.push({ statement, fn });\n }\n }\n }\n return found;\n}\n\nfunction containsJSX(node: Node): boolean {\n let found = false;\n const visit = (current: Node): void => {\n if (found) {\n return;\n }\n if (current.type === 'JSXElement' || current.type === 'JSXFragment') {\n found = true;\n return;\n }\n forEachChild(current, visit);\n };\n visit(node);\n return found;\n}\n\n/**\n * Adds the helper imports and the marker calls to a module.\n *\n * Each top-level function with JSX gets its own marker, so a component the\n * bundler drops takes its helpers with it. JSX anywhere else gets a marker\n * at the top level. Returns `undefined` when the module needs no helper.\n */\nexport function addMarker(\n code: string,\n filename: string,\n options: MarkerOptions,\n): EditResult | undefined {\n if (options.helpers.size === 0) {\n return undefined;\n }\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const entries: string[] = [];\n const specifiers: string[] = [];\n for (const helper of options.helpers) {\n const local = freshName(scopes, `__so$${helper}`);\n specifiers.push(`${helper} as ${local}`);\n entries.push(`${JSON.stringify(HELPER_PREFIX + helper)}: ${local}`);\n }\n for (const statement of program.body) {\n if (\n statement.type !== 'ImportDeclaration' ||\n statement.importKind === 'type' ||\n !options.moduleSources.includes(statement.source.value)\n ) {\n continue;\n }\n for (const specifier of statement.specifiers) {\n if (specifier.type !== 'ImportSpecifier' || specifier.importKind === 'type') {\n continue;\n }\n const imported = exportedName(specifier);\n // A built-in that folding left unused stays out, so the bundler can drop it.\n const used = (scopes.root.bindings.get(specifier.local.name)?.references.length ?? 0) > 0;\n if (options.builtIns.has(imported) && used) {\n entries.push(`${JSON.stringify(BUILT_IN_PREFIX + imported)}: ${specifier.local.name}`);\n }\n }\n }\n const call = `${MARKER}({ ${entries.join(', ')} })`;\n const s = new MagicString(code);\n const functions = topLevelFunctions(program).filter(({ fn }) => containsJSX(fn));\n for (const { fn } of functions) {\n if (\n fn.type !== 'FunctionDeclaration' &&\n fn.type !== 'FunctionExpression' &&\n fn.type !== 'ArrowFunctionExpression'\n ) {\n continue;\n }\n const { body } = fn;\n if (!body) {\n continue;\n }\n if (body.type === 'BlockStatement') {\n s.appendLeft(body.start + 1, `${call};`);\n } else {\n s.prependRight(body.start, `{ ${call}; return `);\n s.appendLeft(body.end, '; }');\n }\n }\n const outside = program.body.some(\n (statement) =>\n !functions.some((entry) => entry.statement === statement) && containsJSX(statement),\n );\n s.append(\n `\\nimport { ${specifiers.join(', ')} } from ${JSON.stringify(options.moduleName)};\\n` +\n (outside ? `${call};\\n` : ''),\n );\n return { code: s.toString(), map: generateMap(s, filename) };\n}\n\n/**\n * Puts back the parentheses around a comma expression that is the whole of a\n * JSX expression container. Rolldown drops them when it prints a chunk that\n * kept its JSX, and JSX does not allow the result. Returns `undefined` when\n * the chunk has none.\n */\nexport function repairJSXSequences(code: string, filename: string): EditResult | undefined {\n // The chunk does not parse cleanly, which is why this runs, so errors are expected.\n const { program } = parseSync(filename, code, {\n lang: 'jsx',\n sourceType: 'module',\n preserveParens: true,\n });\n const sequences: Node[] = [];\n const visit = (node: Node): void => {\n if (node.type === 'JSXExpressionContainer' && node.expression.type === 'SequenceExpression') {\n sequences.push(node.expression);\n }\n forEachChild(node, visit);\n };\n visit(program);\n if (sequences.length === 0) {\n return undefined;\n }\n const s = new MagicString(code);\n for (const sequence of sequences) {\n s.appendLeft(sequence.start, '(');\n s.prependRight(sequence.end, ')');\n }\n return { code: s.toString(), map: generateMap(s, filename) };\n}\n\nexport interface ChunkRuntime extends EditResult {\n /** The chunk's name for each helper, keyed by the name `solid-js/web` exports. */\n readonly helpers: ReadonlyMap<string, string>;\n /** The built-in each chunk binding refers to, keyed by the chunk's name for it. */\n readonly builtInAliases: Record<string, string>;\n}\n\nfunction propertyKey(node: Node): string | undefined {\n if (node.type === 'Literal' && typeof node.value === 'string') {\n return node.value;\n }\n if (node.type === 'Identifier') {\n return node.name;\n }\n return undefined;\n}\n\n/**\n * Reads and removes the marker calls of a chunk.\n * Returns `undefined` when the chunk has none.\n */\nexport function readMarkers(code: string, filename: string): ChunkRuntime | undefined {\n if (!code.includes(MARKER)) {\n return undefined;\n }\n const program = parse(filename, code);\n const s = new MagicString(code);\n const helpers = new Map<string, string>();\n const builtInAliases: Record<string, string> = {};\n // A marker is usually a top-level statement. The bundler moves a module\n // into an init function when it has to run lazily, such as a module that\n // a dynamic import pulled into the same chunk, so every statement is searched.\n const markers: ExpressionStatement[] = [];\n const visit = (node: Node): void => {\n if (\n node.type === 'ExpressionStatement' &&\n node.expression.type === 'CallExpression' &&\n node.expression.callee.type === 'Identifier' &&\n node.expression.callee.name === MARKER\n ) {\n markers.push(node);\n return;\n }\n forEachChild(node, visit);\n };\n visit(program);\n for (const statement of markers) {\n s.remove(statement.start, statement.end);\n if (statement.expression.type !== 'CallExpression') {\n continue;\n }\n const argument = statement.expression.arguments.at(0);\n if (argument?.type !== 'ObjectExpression') {\n continue;\n }\n for (const property of argument.properties) {\n if (property.type !== 'Property' || property.value.type !== 'Identifier') {\n continue;\n }\n const key = propertyKey(property.key);\n if (key?.startsWith(HELPER_PREFIX)) {\n helpers.set(key.slice(HELPER_PREFIX.length), property.value.name);\n } else if (key?.startsWith(BUILT_IN_PREFIX)) {\n builtInAliases[property.value.name] = key.slice(BUILT_IN_PREFIX.length);\n }\n }\n }\n if (markers.length === 0) {\n return undefined;\n }\n return {\n code: s.toString(),\n map: generateMap(s, filename),\n helpers,\n builtInAliases,\n };\n}\n\n/**\n * Replaces the helper imports that Solid's JSX transform added to a chunk\n * with the chunk's own names for those helpers.\n */\nexport function linkHelpers(\n code: string,\n filename: string,\n moduleName: string,\n helpers: ReadonlyMap<string, string>,\n): EditResult {\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const parents = collectParents(program);\n const s = new MagicString(code);\n for (const statement of program.body) {\n if (\n statement.type !== 'ImportDeclaration' ||\n statement.source.value !== moduleName ||\n !statement.specifiers.every(isGeneratedSpecifier)\n ) {\n continue;\n }\n for (const specifier of statement.specifiers) {\n if (specifier.type !== 'ImportSpecifier') {\n continue;\n }\n const imported = exportedName(specifier);\n const target = helpers.get(imported);\n if (target === undefined) {\n throw new MissingHelperError(\n `[solid-optimizer] ${filename} needs \"${imported}\" from \"${moduleName}\", but no module in the chunk imports it.`,\n );\n }\n const binding = scopes.root.bindings.get(specifier.local.name);\n const targetBinding = scopes.root.bindings.get(target);\n if (!targetBinding) {\n throw new Error(\n `[solid-optimizer] ${filename} has no top-level \"${target}\" for \"${imported}\".`,\n );\n }\n for (const reference of binding?.references ?? []) {\n if (lookup(scopeAt(scopes, parents, reference), target) !== targetBinding) {\n throw new Error(\n `[solid-optimizer] ${filename} shadows \"${target}\" where the JSX transform uses \"${imported}\".`,\n );\n }\n s.overwrite(reference.start, reference.end, target);\n }\n }\n s.remove(statement.start, statement.end);\n }\n return { code: s.toString(), map: generateMap(s, filename) };\n}\n","/**\n * Copies components from other modules into a module before bundling, so\n * the inline pass can inline them there.\n *\n * In chunk mode, the chunk step inlines any component in the same chunk.\n * It runs after the bundler has split the chunks, so a shared chunk still\n * exports what an inlined component needed, like the runtime's `spread`.\n * Inlining an imported component while its importer is transformed lets\n * the bundler drop the component, and what only it used, before splitting.\n *\n * A copy refers to the bindings of its own module. Imports are imported\n * again by the module they resolve to. A binding the module declares but\n * does not export is exported under an extra name, which `exposeLocals`\n * adds when the module is transformed.\n */\nimport MagicString from 'magic-string';\nimport type { Expression, Node, Program } from 'oxc-parser';\nimport { forEachChild, parse, unwrap } from '../ast';\nimport type { Binding, ScopeAnalysis } from '../scope';\nimport { analyzeScopes } from '../scope';\nimport { MARKER } from './runtime';\nimport type { EditResult } from './runtime';\n\n/**\n * Whether a binding is `const X = createContext(...)`, with `createContext`\n * imported from Solid.\n */\nfunction isContext(\n binding: Binding,\n scopes: ScopeAnalysis,\n moduleSources: readonly string[],\n): boolean {\n const { declaration } = binding;\n if (\n binding.kind !== 'const' ||\n binding.mutated ||\n declaration.type !== 'VariableDeclarator' ||\n !declaration.init\n ) {\n return false;\n }\n const init = unwrap(declaration.init);\n if (init.type !== 'CallExpression' || init.callee.type !== 'Identifier') {\n return false;\n }\n const callee = scopes.references.get(init.callee);\n return (\n callee?.kind === 'import' &&\n callee.imported === 'createContext' &&\n callee.source !== undefined &&\n moduleSources.includes(callee.source)\n );\n}\n\n/** The prefix of the name a module exports a local binding under. */\nexport const LOCAL_EXPORT = '__so_local$';\n\nfunction generateMap(s: MagicString, filename: string): string {\n return s.generateMap({ source: filename, hires: true, includeContent: true }).toString();\n}\n\nfunction isCapitalized(name: string): boolean {\n return /^[A-Z]/.test(name);\n}\n\ninterface TopLevelFunction {\n readonly binding: Binding;\n /** The function, or the arrow or function expression a `const` holds. */\n readonly fn: Node;\n /** The node to copy: the function declaration, or the expression. */\n readonly kind: 'declaration' | 'expression';\n}\n\n/**\n * The function a top-level binding holds: `function A() {}`, or\n * `const A = () => ...`.\n */\nfunction functionOf(binding: Binding): TopLevelFunction | undefined {\n const { declaration } = binding;\n if (declaration.type === 'FunctionDeclaration') {\n return { binding, fn: declaration, kind: 'declaration' };\n }\n if (\n declaration.type === 'VariableDeclarator' &&\n binding.kind === 'const' &&\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 { binding, fn: init, kind: 'expression' };\n }\n }\n return undefined;\n}\n\n/**\n * The names a module exports, each with the top-level binding it exports.\n */\nfunction exportsOf(program: Program, scopes: ScopeAnalysis): Map<string, Binding> {\n const exports = new Map<string, Binding>();\n const { bindings } = scopes.root;\n for (const statement of program.body) {\n if (statement.type === 'ExportNamedDeclaration' && !statement.source) {\n const { declaration } = statement;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n const binding = bindings.get(declaration.id.name);\n if (binding) {\n exports.set(declaration.id.name, binding);\n }\n } else if (declaration?.type === 'VariableDeclaration') {\n const declared = declaration.declarations.map((declarator) =>\n declarator.id.type === 'Identifier' ? bindings.get(declarator.id.name) : undefined,\n );\n for (const binding of declared.filter((item) => item !== undefined)) {\n exports.set(binding.name, binding);\n }\n }\n for (const specifier of statement.specifiers) {\n const local = specifier.local.type === 'Identifier' ? specifier.local.name : undefined;\n const exported =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n const binding = local === undefined ? undefined : bindings.get(local);\n if (binding) {\n exports.set(exported, binding);\n }\n }\n } else if (statement.type === 'ExportDefaultDeclaration') {\n const { declaration } = statement;\n if (declaration.type === 'FunctionDeclaration' && declaration.id) {\n const binding = bindings.get(declaration.id.name);\n if (binding) {\n exports.set('default', binding);\n }\n } else if (declaration.type === 'Identifier') {\n const binding = bindings.get(declaration.name);\n if (binding) {\n exports.set('default', binding);\n }\n }\n }\n }\n return exports;\n}\n\n/**\n * The top-level bindings a function refers to, other than itself.\n */\nfunction outerBindings(fn: Node, self: Binding, scopes: ScopeAnalysis): Map<Node, Binding> {\n const outer = new Map<Node, Binding>();\n for (const [reference, binding] of scopes.references) {\n if (\n binding &&\n binding !== self &&\n binding.scope === scopes.root &&\n reference.start >= fn.start &&\n reference.end <= fn.end\n ) {\n outer.set(reference, binding);\n }\n }\n return outer;\n}\n\n/**\n * Exports the top-level bindings that the module's exported components\n * refer to but the module does not export, under an extra name. A copy of\n * such a component in another module imports them from here.\n */\nexport function exposeLocals(code: string, filename: string): EditResult | undefined {\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const exports = exportsOf(program, scopes);\n const exported = new Set(exports.values());\n const needed = new Set<Binding>();\n for (const [name, binding] of exports) {\n const component =\n isCapitalized(binding.name) || name === 'default' ? functionOf(binding) : undefined;\n if (!component) {\n continue;\n }\n for (const outer of outerBindings(component.fn, binding, scopes).values()) {\n if (outer.kind !== 'import' && !exported.has(outer)) {\n needed.add(outer);\n }\n }\n }\n if (needed.size === 0) {\n return undefined;\n }\n const s = new MagicString(code);\n const specifiers = [...needed].map(\n (binding) => `${binding.name} as ${LOCAL_EXPORT}${binding.name}`,\n );\n s.append(`\\nexport { ${specifiers.join(', ')} };\\n`);\n return { code: s.toString(), map: generateMap(s, filename) };\n}\n\n/** A binding a copied component needs from its own module's scope. */\nexport type Dependency =\n /** An import of that module, imported again by the module it resolves to. */\n | { readonly kind: 'import'; readonly source: string; readonly imported: string }\n /** A binding that module exports, imported from it under this name. */\n | { readonly kind: 'export'; readonly exported: string; readonly context: boolean };\n\nexport interface ExportedComponent {\n /** Each top-level binding the component refers to, by its name in the module. */\n readonly dependencies: ReadonlyMap<string, Dependency>;\n /**\n * The component's declaration under `name`, with each dependency renamed\n * as `rename` gives it.\n */\n readonly copy: (name: string, rename: ReadonlyMap<string, string>) => string;\n /**\n * Whether the component only returns a call of another component of its\n * module, like `(props) => <Icon {...props}><path /></Icon>`.\n */\n readonly wrapsLocal: boolean;\n}\n\n/**\n * Whether a function returns JSX whose root calls a component declared at\n * the top of its own module.\n */\nfunction returnsLocalCall(fn: TopLevelFunction['fn'], scopes: ScopeAnalysis): boolean {\n if (\n fn.type !== 'FunctionDeclaration' &&\n fn.type !== 'FunctionExpression' &&\n fn.type !== 'ArrowFunctionExpression'\n ) {\n return false;\n }\n const { body } = fn;\n if (!body) {\n return false;\n }\n let root: Expression | null | undefined;\n if (body.type === 'BlockStatement') {\n const last = body.body.at(-1);\n root = last?.type === 'ReturnStatement' ? last.argument : undefined;\n } else {\n root = body;\n }\n if (!root) {\n return false;\n }\n const inner = unwrap(root);\n if (inner.type !== 'JSXElement' || inner.openingElement.name.type !== 'JSXIdentifier') {\n return false;\n }\n const binding = scopes.references.get(inner.openingElement.name);\n return binding !== undefined && binding.scope === scopes.root && binding.kind !== 'import';\n}\n\n/**\n * Reads the component a module exports under `exportName`, from the module\n * as the bundler loaded it. `undefined` when that export is not a function\n * component, or it refers to a top-level binding the module cannot export.\n */\nexport function readExportedComponent(\n code: string,\n filename: string,\n exportName: string,\n moduleSources: readonly string[],\n): ExportedComponent | undefined {\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const exports = exportsOf(program, scopes);\n const binding = exports.get(exportName);\n const component = binding ? functionOf(binding) : undefined;\n if (!binding || !component) {\n return undefined;\n }\n const exportNames = new Map<Binding, string>();\n for (const [name, exported] of exports) {\n if (!exportNames.has(exported)) {\n exportNames.set(exported, name);\n }\n }\n\n const outer = outerBindings(component.fn, binding, scopes);\n const dependencies = new Map<string, Dependency>();\n for (const dependency of outer.values()) {\n if (dependencies.has(dependency.name)) {\n continue;\n }\n if (dependency.kind === 'import') {\n if (dependency.source === undefined || dependency.imported === undefined) {\n return undefined;\n }\n dependencies.set(dependency.name, {\n kind: 'import',\n source: dependency.source,\n imported: dependency.imported,\n });\n continue;\n }\n // A local binding is exported under its extra name, which `exposeLocals` added.\n const name = exportNames.get(dependency);\n if (name === undefined) {\n return undefined;\n }\n dependencies.set(dependency.name, {\n kind: 'export',\n exported: name,\n context: isContext(dependency, scopes, moduleSources),\n });\n }\n\n // The helper markers in the copy belong to the module it comes from.\n const markers: Node[] = [];\n const findMarkers = (node: Node): void => {\n if (\n node.type === 'ExpressionStatement' &&\n node.expression.type === 'CallExpression' &&\n node.expression.callee.type === 'Identifier' &&\n node.expression.callee.name === MARKER\n ) {\n markers.push(node);\n return;\n }\n forEachChild(node, findMarkers);\n };\n findMarkers(component.fn);\n\n const copy = (name: string, rename: ReadonlyMap<string, string>): string => {\n const s = new MagicString(code);\n for (const [reference, dependency] of outer) {\n const renamed = rename.get(dependency.name);\n if (renamed !== undefined && renamed !== dependency.name) {\n s.overwrite(reference.start, reference.end, renamed);\n }\n }\n for (const marker of markers) {\n s.remove(marker.start, marker.end);\n }\n if (\n component.kind === 'declaration' &&\n component.fn.type === 'FunctionDeclaration' &&\n component.fn.id\n ) {\n s.overwrite(component.fn.id.start, component.fn.id.end, name);\n return s.slice(component.fn.start, component.fn.end);\n }\n return `const ${name} = ${s.slice(component.fn.start, component.fn.end)};`;\n };\n return { dependencies, copy, wrapsLocal: returnsLocalCall(component.fn, scopes) };\n}\n","/**\n * Rewrites JSX tags that read a member of a namespace import, like\n * `<Button.Root>` with `import * as Button from '...'`, to a named import.\n *\n * A bundler resolves `Button.Root` in code to the export it reads, and\n * drops the namespace. In a JSX tag name it does not, so a module that\n * keeps its JSX through bundling would make the bundle build a namespace\n * object with every export of the module.\n */\nimport MagicString from 'magic-string';\nimport { collectParents, parse } from '../ast';\nimport { analyzeScopes } from '../scope';\nimport type { EditResult } from './runtime';\n\nexport function nameNamespaceTags(code: string, filename: string): EditResult | undefined {\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const parents = collectParents(program);\n const s = new MagicString(code);\n const names = new Set(scopes.names);\n const imports: string[] = [];\n for (const binding of scopes.root.bindings.values()) {\n const statement = parents.get(binding.declaration);\n if (\n binding.kind !== 'import' ||\n binding.imported !== '*' ||\n binding.source === undefined ||\n statement?.type !== 'ImportDeclaration' ||\n statement.importKind === 'type'\n ) {\n continue;\n }\n // One local name for each member, shared by its opening and closing tags.\n const locals = new Map<string, string>();\n for (const reference of binding.references) {\n const member = parents.get(reference);\n if (\n reference.type !== 'JSXIdentifier' ||\n member?.type !== 'JSXMemberExpression' ||\n member.object !== reference\n ) {\n continue;\n }\n const { name } = member.property;\n let local = locals.get(name);\n if (local === undefined) {\n local = `${binding.name}$${name}`;\n for (let index = 1; names.has(local); index += 1) {\n local = `${binding.name}$${name}$${String(index)}`;\n }\n names.add(local);\n locals.set(name, local);\n imports.push(`import { ${name} as ${local} } from ${JSON.stringify(binding.source)};`);\n }\n s.overwrite(member.start, member.end, local);\n }\n }\n if (imports.length === 0) {\n return undefined;\n }\n s.prepend(`${imports.join('\\n')}\\n`);\n return {\n code: s.toString(),\n map: s.generateMap({ source: filename, hires: true, includeContent: true }).toString(),\n };\n}\n","/**\n * Keeps a `ref` that names a variable working through bundling.\n *\n * Solid's JSX transform turns `<input ref={el} />` into code that assigns\n * the element to `el`. In chunk mode the JSX reaches the bundler before that\n * code exists, so the bundler only sees `el` read. A `let el` that nothing\n * else writes to then looks like it is always `undefined`, and the bundler\n * folds its reads, like `el ? el.value : ''`, to the `undefined` branch.\n *\n * Before bundling, `ref={el}` becomes `ref={__SO_REF__(el, (v) => (el = v))}`,\n * which shows the bundler the write. The bundler renames both uses of `el`\n * alike. Before the chunk is lowered, the call becomes `ref={el}` again, so\n * the JSX transform writes the same code it would have.\n */\nimport type { CallExpression, JSXAttribute, Node } from 'oxc-parser';\nimport MagicString from 'magic-string';\nimport { forEachChild, parse } from '../ast';\nimport { analyzeScopes } from '../scope';\nimport type { EditResult } from './runtime';\n\nexport const REF_MARKER = '__SO_REF__';\n\nfunction generateMap(s: MagicString, filename: string): string {\n return s.generateMap({ source: filename, hires: true, includeContent: true }).toString();\n}\n\nfunction isRefAttribute(node: Node): node is JSXAttribute {\n return (\n node.type === 'JSXAttribute' && node.name.type === 'JSXIdentifier' && node.name.name === 'ref'\n );\n}\n\n/**\n * Wraps each `ref` whose value is a `let` or `var` binding, so the bundler\n * sees it written. `undefined` when there is none.\n */\nexport function protectRefs(code: string, filename: string): EditResult | undefined {\n if (!code.includes('ref')) {\n return undefined;\n }\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const s = new MagicString(code);\n const visit = (node: Node): void => {\n if (isRefAttribute(node) && node.value?.type === 'JSXExpressionContainer') {\n const { expression } = node.value;\n const binding =\n expression.type === 'Identifier' ? scopes.references.get(expression) : undefined;\n if (\n expression.type === 'Identifier' &&\n (binding?.kind === 'let' || binding?.kind === 'var')\n ) {\n const { name } = expression;\n s.overwrite(\n expression.start,\n expression.end,\n `${REF_MARKER}(${name}, (__so_ref) => (${name} = __so_ref))`,\n );\n }\n }\n forEachChild(node, visit);\n };\n visit(program);\n return s.hasChanged() ? { code: s.toString(), map: generateMap(s, filename) } : undefined;\n}\n\n/**\n * Turns each wrapped `ref` back into its variable. `undefined` when there\n * is none.\n */\nexport function restoreRefs(code: string, filename: string): EditResult | undefined {\n if (!code.includes(REF_MARKER)) {\n return undefined;\n }\n const program = parse(filename, code);\n const s = new MagicString(code);\n const visit = (node: Node): void => {\n if (isRefAttribute(node) && node.value?.type === 'JSXExpressionContainer') {\n const { expression } = node.value;\n if (isMarkerCall(expression)) {\n const target = expression.arguments.at(0);\n if (target?.type === 'Identifier') {\n s.overwrite(expression.start, expression.end, target.name);\n }\n }\n }\n forEachChild(node, visit);\n };\n visit(program);\n return s.hasChanged() ? { code: s.toString(), map: generateMap(s, filename) } : undefined;\n}\n\nfunction isMarkerCall(node: Node): node is CallExpression {\n return (\n node.type === 'CallExpression' &&\n node.callee.type === 'Identifier' &&\n node.callee.name === REF_MARKER\n );\n}\n","/**\n * Which modules use each export of the app, read from the files on disk.\n *\n * A component copied into the module that uses it is only smaller overall\n * when the original goes away, which takes that module being its only user.\n * The index answers that from the whole module graph, so it does not depend\n * on the order the bundler transforms modules in, and a server build and its\n * client build make the same decisions.\n *\n * Anything the index cannot follow counts as another use: a re-export, a\n * dynamic import, a namespace used as a value, or a use inside the module\n * that declares the export.\n */\nimport type { Node, Program } from 'oxc-parser';\nimport { collectParents, forEachChild, parse } from '../ast';\nimport type { Parents } from '../ast';\nimport type { Binding, ScopeAnalysis } from '../scope';\nimport { analyzeScopes } from '../scope';\n\nexport interface UsageIndex {\n /**\n * How many modules use `exportName` of `module`, counting `user`, when\n * they only use it as JSX tags. `0` when anything else uses it, which\n * keeps it whoever copies it. `absorbed` holds, by module, the exported\n * components that were copied into `user` and leave their module, so the\n * uses inside them count as uses in `user`.\n */\n users(\n module: string,\n exportName: string,\n user: string,\n absorbed: ReadonlyMap<string, ReadonlySet<string>>,\n ): number;\n}\n\nexport interface UsageHost {\n /** The id `source` resolves to from `importer`, or `undefined` outside the app. */\n resolve(source: string, importer: string): Promise<string | undefined>;\n /** The code of a module, or `undefined` when it cannot be read. */\n read(id: string): Promise<string | undefined>;\n}\n\n/** The name a use counts under when it is not inside an exported declaration. */\nconst UNEXPORTED = '';\n\ninterface ExportUsage {\n /**\n * The modules that use the export as a JSX tag, each with the export\n * names of the top-level declarations the uses sit in.\n */\n readonly importers: Map<string, Set<string>>;\n /** Whether anything uses it other than as a tag. */\n other: boolean;\n}\n\nconst SCRIPT = /\\.[mc]?[jt]sx?$/;\n\nclass Usage implements UsageIndex {\n private readonly exports = new Map<string, ExportUsage>();\n\n /** Modules any of whose exports can be used in a way the index does not follow. */\n private readonly opaque = new Set<string>();\n\n /** The modules each module imports. */\n readonly imports = new Map<string, readonly string[]>();\n\n /** Whether `from` imports `to`, directly or through other modules. */\n private reaches(from: string, to: string): boolean {\n const seen = new Set<string>();\n const stack = [from];\n for (let id = stack.pop(); id !== undefined; id = stack.pop()) {\n if (id === to) {\n return true;\n }\n if (!seen.has(id)) {\n seen.add(id);\n stack.push(...(this.imports.get(id) ?? []));\n }\n }\n return false;\n }\n\n private entry(module: string, name: string): ExportUsage {\n const key = `${module}\\0${name}`;\n let usage = this.exports.get(key);\n if (!usage) {\n usage = { importers: new Map(), other: false };\n this.exports.set(key, usage);\n }\n return usage;\n }\n\n tag(module: string, name: string, importer: string, containers: readonly string[]): void {\n const { importers } = this.entry(module, name);\n const known = importers.get(importer) ?? new Set();\n for (const container of containers) {\n known.add(container);\n }\n importers.set(importer, known);\n }\n\n other(module: string, name: string): void {\n this.entry(module, name).other = true;\n }\n\n all(module: string): void {\n this.opaque.add(module);\n }\n\n users(\n module: string,\n exportName: string,\n user: string,\n absorbed: ReadonlyMap<string, ReadonlySet<string>>,\n ): number {\n if (this.opaque.has(module)) {\n return 0;\n }\n const usage = this.exports.get(`${module}\\0${exportName}`);\n if (!usage || usage.other || usage.importers.size === 0) {\n return 0;\n }\n const users = new Set([user]);\n for (const [importer, containers] of usage.importers) {\n const moved = absorbed.get(importer);\n users.add([...containers].every((name) => moved?.has(name) === true) ? user : importer);\n }\n // A module the component's module imports never gets a copy of it, so\n // the original stays for it.\n return [...users].some((id) => this.reaches(module, id)) ? 0 : users.size;\n }\n}\n\nfunction isTagName(reference: Node, parents: Parents): boolean {\n const parent = parents.get(reference);\n return parent?.type === 'JSXOpeningElement' && parent.name === reference;\n}\n\nfunction isClosingTagName(reference: Node, parents: Parents): boolean {\n const parent = parents.get(reference);\n return parent?.type === 'JSXClosingElement' && parent.name === reference;\n}\n\n/** The names a declaration exported with `export` declares. */\nfunction declaredNames(declaration: Node | null | undefined): string[] {\n if (declaration?.type === 'FunctionDeclaration' && declaration.id) {\n return [declaration.id.name];\n }\n if (declaration?.type === 'VariableDeclaration') {\n return declaration.declarations.flatMap((declarator) =>\n declarator.id.type === 'Identifier' ? [declarator.id.name] : [],\n );\n }\n return [];\n}\n\n/** The top-level bindings a module exports, each with its export names. */\nfunction exportedBindings(program: Program, scopes: ScopeAnalysis): Map<Binding, string[]> {\n const exported = new Map<Binding, string[]>();\n const add = (local: string, name: string): void => {\n const binding = scopes.root.bindings.get(local);\n if (binding) {\n exported.set(binding, [...(exported.get(binding) ?? []), name]);\n }\n };\n for (const statement of program.body) {\n if (statement.type === 'ExportNamedDeclaration' && !statement.source) {\n for (const name of declaredNames(statement.declaration)) {\n add(name, name);\n }\n for (const specifier of statement.specifiers) {\n if (specifier.local.type === 'Identifier') {\n add(\n specifier.local.name,\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value,\n );\n }\n }\n } else if (statement.type === 'ExportDefaultDeclaration') {\n const { declaration } = statement;\n if (declaration.type === 'FunctionDeclaration' && declaration.id) {\n add(declaration.id.name, 'default');\n } else if (declaration.type === 'Identifier') {\n add(declaration.name, 'default');\n }\n }\n }\n return exported;\n}\n\n/**\n * Records how a module uses what it imports, and the uses of its own\n * exports inside it.\n */\nfunction recordModule(\n usage: Usage,\n id: string,\n program: Program,\n targets: ReadonlyMap<string, string>,\n): void {\n const scopes = analyzeScopes(program);\n const parents = collectParents(program);\n\n // A module that uses its own export keeps it, whoever else copies it.\n const exported = exportedBindings(program, scopes);\n // The export names of the top-level declaration a use sits in.\n const containersOf = (reference: Node): string[] => {\n let node: Node = reference;\n let parent = parents.get(node);\n while (parent && parent.type !== 'Program') {\n node = parent;\n parent = parents.get(node);\n }\n const declaration =\n (node.type === 'ExportNamedDeclaration' || node.type === 'ExportDefaultDeclaration') &&\n node.declaration\n ? node.declaration\n : node;\n const bindings: (Binding | undefined)[] = [];\n if (declaration.type === 'FunctionDeclaration' && declaration.id) {\n bindings.push(scopes.root.bindings.get(declaration.id.name));\n } else if (declaration.type === 'VariableDeclaration') {\n for (const declarator of declaration.declarations) {\n if (\n declarator.id.type === 'Identifier' &&\n reference.start >= declarator.start &&\n reference.end <= declarator.end\n ) {\n bindings.push(scopes.root.bindings.get(declarator.id.name));\n }\n }\n }\n const names = bindings.flatMap((binding) => (binding ? (exported.get(binding) ?? []) : []));\n return names.length > 0 ? names : [UNEXPORTED];\n };\n\n const record = (binding: Binding, target: string): void => {\n const imported = binding.imported ?? '*';\n for (const reference of binding.references) {\n if (isClosingTagName(reference, parents)) {\n continue;\n }\n if (imported !== '*') {\n if (isTagName(reference, parents)) {\n usage.tag(target, imported, id, containersOf(reference));\n } else {\n usage.other(target, imported);\n }\n continue;\n }\n // `<Ns.Member>` and `Ns.member` use one export. Anything else may use any.\n const member = parents.get(reference);\n if (member?.type === 'JSXMemberExpression' && member.object === reference) {\n if (isTagName(member, parents)) {\n usage.tag(target, member.property.name, id, containersOf(reference));\n } else {\n usage.other(target, member.property.name);\n }\n } else if (\n member?.type === 'MemberExpression' &&\n member.object === reference &&\n !member.computed &&\n member.property.type === 'Identifier'\n ) {\n usage.other(target, member.property.name);\n } else {\n usage.all(target);\n }\n }\n };\n for (const binding of scopes.root.bindings.values()) {\n if (binding.kind === 'import' && binding.source !== undefined) {\n const target = targets.get(binding.source);\n if (target !== undefined) {\n record(binding, target);\n }\n }\n }\n\n // Re-exports pass an export on, which the index does not follow.\n for (const statement of program.body) {\n if (statement.type === 'ExportAllDeclaration') {\n const target = targets.get(statement.source.value);\n if (target !== undefined) {\n usage.all(target);\n }\n } else if (statement.type === 'ExportNamedDeclaration' && statement.source) {\n const target = targets.get(statement.source.value);\n for (const specifier of statement.specifiers) {\n const name =\n specifier.local.type === 'Identifier' ? specifier.local.name : specifier.local.value;\n if (target !== undefined) {\n usage.other(target, name);\n }\n }\n }\n }\n\n for (const [binding, names] of exported) {\n const used = binding.references.some((reference) => {\n const parent = parents.get(reference);\n return (\n parent?.type !== 'ExportSpecifier' &&\n parent?.type !== 'ExportDefaultDeclaration' &&\n !isClosingTagName(reference, parents)\n );\n });\n if (used) {\n for (const name of names) {\n usage.other(id, name);\n }\n }\n }\n}\n\n/** The import specifiers a module loads, statically or with `import()`. */\nfunction specifiersOf(program: Program): { static: Set<string>; dynamic: Set<string> } {\n const statics = new Set<string>();\n const dynamics = new Set<string>();\n for (const statement of program.body) {\n if (\n (statement.type === 'ImportDeclaration' && statement.importKind !== 'type') ||\n ((statement.type === 'ExportNamedDeclaration' || statement.type === 'ExportAllDeclaration') &&\n statement.source &&\n statement.exportKind !== 'type')\n ) {\n const value = statement.source?.value;\n if (value !== undefined) {\n statics.add(value);\n }\n }\n }\n const visit = (node: Node): void => {\n if (\n node.type === 'ImportExpression' &&\n node.source.type === 'Literal' &&\n typeof node.source.value === 'string'\n ) {\n dynamics.add(node.source.value);\n }\n forEachChild(node, visit);\n };\n visit(program);\n return { static: statics, dynamic: dynamics };\n}\n\n/**\n * Reads every module reachable from `entries` and records how each export\n * is used.\n */\nexport async function buildUsageIndex(\n entries: readonly string[],\n host: UsageHost,\n): Promise<UsageIndex> {\n const usage = new Usage();\n // An entry's exports are its public API.\n for (const entry of entries) {\n usage.all(entry);\n }\n const seen = new Set<string>();\n let frontier = entries.filter((id) => SCRIPT.test(id.replace(/\\?.*$/, '')));\n while (frontier.length > 0) {\n for (const id of frontier) {\n seen.add(id);\n }\n // oxlint-disable-next-line no-await-in-loop\n const next = await Promise.all(\n frontier.map(async (id) => {\n const code = await host.read(id);\n let program: Program;\n try {\n program = parse(id.replace(/\\?.*$/, ''), code ?? '');\n } catch {\n return [];\n }\n const { static: statics, dynamic } = specifiersOf(program);\n const targets = new Map<string, string>();\n await Promise.all(\n [...statics, ...dynamic].map(async (source) => {\n const target = await host.resolve(source, id);\n if (target !== undefined) {\n targets.set(source, target);\n }\n }),\n );\n // A module loaded with `import()` is used as a whole.\n for (const source of dynamic) {\n const target = targets.get(source);\n if (target !== undefined) {\n usage.all(target);\n }\n }\n recordModule(usage, id, program, targets);\n usage.imports.set(id, [...targets.values()]);\n return [...targets.values()];\n }),\n );\n frontier = [...new Set(next.flat())].filter(\n (id) => !seen.has(id) && SCRIPT.test(id.replace(/\\?.*$/, '')),\n );\n }\n return usage;\n}\n","/**\n * `solid-optimizer/vite`: `vite-plugin-solid` with the optimizer built in.\n *\n * It takes the same options as `vite-plugin-solid`, plus `optimizer`, and\n * returns the official plugin with the optimizer wired in. It runs in one of\n * two modes.\n *\n * - Chunk mode keeps JSX through bundling. Each chunk is optimized as a whole\n * and then lowered by Solid's JSX transform, so a component inlines into\n * any other component in the same chunk. It applies to client builds that\n * do not hydrate.\n * - Module mode optimizes each module before the official plugin lowers it.\n * It applies everywhere else. A server build and its client build chunk\n * differently, and hydration needs both to render the same tree, so\n * hydrating builds only optimize within a module.\n */\nimport { readFile } from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport remapping from '@jridgewell/remapping';\nimport type * as Babel from '@babel/core';\nimport MagicString from 'magic-string';\nimport type { Node, Program } from 'oxc-parser';\nimport type { Plugin, ResolvedConfig, Rollup } from 'vite';\nimport { createFilter, transformWithOxc } from 'vite';\nimport type { Options as SolidPluginOptions } from 'vite-plugin-solid';\nimport solidPlugin from 'vite-plugin-solid';\nimport type { CompileOptions, CompileResult, ModuleConstants } from '../compile';\nimport { compile, readModuleConstants } from '../compile';\nimport { collectParents, forEachChild, isIntrinsicTag, parse } from '../ast';\nimport { analyzeScopes } from '../scope';\nimport { CONTEXT_SAFE_PRIMITIVES } from '../provider';\nimport type { ImportedConstants } from '../constants';\nimport type { Primitive } from '../value';\nimport type { Skip } from '../context';\nimport type { OptimizerReport } from './report';\nimport { formatReport } from './report';\nimport { exposeLocals, readExportedComponent } from './inject';\nimport { nameNamespaceTags } from './namespace';\nimport { protectRefs, restoreRefs } from './refs';\nimport type { UsageIndex } from './usage';\nimport { buildUsageIndex } from './usage';\nimport {\n MARKER,\n MissingHelperError,\n addMarker,\n linkHelpers,\n readMarkers,\n repairJSXSequences,\n} from './runtime';\n\nexport interface OptimizerOptions extends Pick<\n CompileOptions,\n 'fold' | 'inline' | 'alwaysInline' | 'contexts' | 'memos' | 'maxPasses'\n> {\n /**\n * Reduce Solid's reactive primitives to what they do on the server, in\n * server builds. See the `server` option of `compile`.\n *\n * @default true\n */\n server?: boolean;\n /**\n * Where the optimizer runs.\n *\n * - `auto` uses chunk mode for client builds that do not hydrate, and module mode otherwise.\n * - `module` optimizes each module on its own.\n *\n * @default 'auto'\n */\n mode?: 'auto' | 'module';\n /**\n * Also optimize while serving, in module mode.\n *\n * @default false\n */\n dev?: boolean;\n /**\n * Report what the optimizer leaves alone in each build, and why: each\n * component call that stays a call, each provider that stays, and each\n * memo that stays. `true` prints the report. A function receives it\n * instead, once per build environment.\n *\n * @default false\n */\n report?: boolean | ((report: OptimizerReport) => void);\n}\n\nexport type { OptimizerReport } from './report';\n\nexport interface Options extends Partial<SolidPluginOptions> {\n /** Set to `false` to use `vite-plugin-solid` as it is. */\n optimizer?: OptimizerOptions | false;\n}\n\n/** The options `babel-preset-solid` takes. */\ntype JSXOptions = NonNullable<SolidPluginOptions['solid']> & {\n generate?: 'dom' | 'ssr' | 'universal';\n hydratable?: boolean;\n};\n\ninterface Compiler {\n readonly babel: typeof Babel;\n readonly preset: Babel.PluginTarget;\n}\n\nconst DEFAULT_MODULE_NAME = 'solid-js/web';\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 JSX_MODULE = /\\.[mc]?[jt]sx$/i;\n\n/**\n * Helpers the JSX transform picks between for the same attribute. Inlining\n * can turn one form into the other: a style object that was a prop becomes a\n * literal, which the transform writes one property at a time. A module that\n * needs one keeps the other too.\n */\nconst RELATED_HELPERS: Readonly<Record<string, readonly string[]>> = {\n style: ['setStyleProperty'],\n setStyleProperty: ['style'],\n};\n\nfunction withRelated(helpers: readonly string[]): Set<string> {\n const result = new Set(helpers);\n for (const helper of helpers) {\n for (const related of RELATED_HELPERS[helper] ?? []) {\n result.add(related);\n }\n }\n return result;\n}\n\n/**\n * The common kinds of attribute: a class, any other attribute, events, and\n * children. Inlining a component turns a spread onto an element into\n * attributes like these, in a module that may not use their helpers itself.\n * A rarer kind, like `style`, can still need a helper no module imports.\n * The chunk is then lowered without optimizing it.\n */\nconst ATTRIBUTE_SAMPLE = `const a = () => 0;\nexport const Sample = () => (\n <div class={a()} id={a()} onClick={a()} onScroll={a()}>{a()}</div>\n);`;\n\n/** Whether the code spreads anything onto an intrinsic element. */\nfunction spreadsOntoElement(code: string, filename: string): boolean {\n if (!code.includes('...')) {\n return false;\n }\n let found = false;\n const visit = (node: Node): void => {\n if (found) {\n return;\n }\n if (\n node.type === 'JSXOpeningElement' &&\n node.name.type === 'JSXIdentifier' &&\n isIntrinsicTag(node.name.name) &&\n node.attributes.some((attribute) => attribute.type === 'JSXSpreadAttribute')\n ) {\n found = true;\n return;\n }\n forEachChild(node, visit);\n };\n visit(parse(filename, code));\n return found;\n}\n\nfunction loadCompiler(): Compiler {\n // Use the Babel and preset `vite-plugin-solid` uses, so both lower JSX the same way.\n const require = createRequire(import.meta.url);\n const pluginRequire = createRequire(require.resolve('vite-plugin-solid'));\n const presetRequire = createRequire(pluginRequire.resolve('babel-preset-solid'));\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const babel = presetRequire('@babel/core') as typeof Babel;\n const preset: unknown = pluginRequire('babel-preset-solid');\n if (typeof preset !== 'function') {\n throw new TypeError('[solid-optimizer] babel-preset-solid did not load');\n }\n return { babel, preset };\n}\n\n/**\n * Lowers JSX with `babel-preset-solid`, as `vite-plugin-solid` does.\n */\nfunction lower(\n compiler: Compiler,\n code: string,\n filename: string,\n options: JSXOptions,\n sourceMaps: boolean,\n): { code: string; map: string | undefined } {\n const result = compiler.babel.transformSync(code, {\n filename,\n sourceFileName: filename,\n presets: [[compiler.preset, options]],\n ast: false,\n sourceMaps,\n configFile: false,\n babelrc: false,\n parserOpts: {\n plugins: /\\.[mc]?tsx$/i.test(filename) ? ['jsx', 'typescript'] : ['jsx'],\n },\n });\n // An empty module, like a chunk a library build left empty, lowers to ''.\n if (typeof result?.code !== 'string') {\n throw new Error(`[solid-optimizer] babel-preset-solid produced no code for ${filename}`);\n }\n return { code: result.code, map: result.map ? JSON.stringify(result.map) : undefined };\n}\n\n/**\n * The helpers `babel-preset-solid` imports from `moduleName` to lower `code`.\n * Only the AST is built, since its code would only be read for its imports.\n */\nfunction helpersOf(\n compiler: Compiler,\n code: string,\n filename: string,\n options: JSXOptions,\n moduleName: string,\n): string[] {\n const result = compiler.babel.transformSync(code, {\n filename,\n presets: [[compiler.preset, options]],\n ast: true,\n code: false,\n configFile: false,\n babelrc: false,\n parserOpts: {\n plugins: /\\.[mc]?tsx$/i.test(filename) ? ['jsx', 'typescript'] : ['jsx'],\n },\n });\n const names: string[] = [];\n for (const statement of result?.ast?.program.body ?? []) {\n if (statement.type !== 'ImportDeclaration' || statement.source.value !== moduleName) {\n continue;\n }\n for (const specifier of statement.specifiers) {\n // Generated imports are named `_$helper`, which the module's own are not.\n if (specifier.type === 'ImportSpecifier' && specifier.local.name.startsWith('_$')) {\n const { imported } = specifier;\n names.push(imported.type === 'StringLiteral' ? imported.value : imported.name);\n }\n }\n }\n return names;\n}\n\nfunction stripQuery(id: string): string {\n return id.replace(/\\?.*$/, '');\n}\n\n/**\n * Chains the maps of each step into one, or `null` when the build writes no\n * source maps, since chaining the maps of a large chunk takes a while.\n */\nfunction combineMaps(wanted: boolean, maps: (string | null | undefined)[]): string | null {\n const present = maps.filter((map): map is string => typeof map === 'string');\n if (!wanted || present.length === 0) {\n return null;\n }\n return remapping(present.reverse(), () => null).toString();\n}\n\n/**\n * The local name of each value a module imports, keyed by its source and\n * the name it is imported as: an export name, `default`, or `*`.\n */\nfunction importedNames(program: Program): Map<string, string> {\n const names = new Map<string, string>();\n for (const statement of program.body) {\n if (statement.type !== 'ImportDeclaration' || statement.importKind === 'type') {\n continue;\n }\n for (const specifier of statement.specifiers) {\n let imported = '*';\n if (specifier.type === 'ImportDefaultSpecifier') {\n imported = 'default';\n } else if (specifier.type === 'ImportSpecifier') {\n imported =\n specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value;\n }\n const typeOnly = specifier.type === 'ImportSpecifier' && specifier.importKind === 'type';\n if (!typeOnly) {\n names.set(`${statement.source.value}\\0${imported}`, specifier.local.name);\n }\n }\n }\n return names;\n}\n\n/**\n * A key for a module in the build environment of `context`. The server and\n * client builds transform the same module into different code.\n */\nfunction environmentKey(context: { environment?: { name: string } }, id: string): string {\n return `${context.environment?.name ?? ''}\\0${id}`;\n}\n\nfunction isClient(context: { environment?: { config: { consumer: string } } }): boolean {\n return context.environment?.config.consumer === 'client';\n}\n\nexport default function solidOptimizer(options: Options = {}): Plugin[] {\n const { optimizer: optimizerOption, ...solidOptions } = options;\n const main = solidPlugin(solidOptions);\n if (optimizerOption === false) {\n return [main];\n }\n const optimizer = optimizerOption ?? {};\n const moduleName = solidOptions.solid?.moduleName ?? DEFAULT_MODULE_NAME;\n const moduleSources = [...new Set(['solid-js', DEFAULT_MODULE_NAME, moduleName])];\n const builtIns = new Set(solidOptions.solid?.builtIns ?? DEFAULT_BUILT_INS);\n const compileOptions: CompileOptions = {\n fold: optimizer.fold,\n inline: optimizer.inline,\n alwaysInline: optimizer.alwaysInline,\n contexts: optimizer.contexts,\n memos: optimizer.memos,\n maxPasses: optimizer.maxPasses,\n builtIns: [...builtIns],\n moduleSources,\n report: optimizer.report !== undefined && optimizer.report !== false,\n };\n\n let config: ResolvedConfig | undefined;\n /**\n * A skip's name with the module it names, like `Card (/app/src/card.tsx)`,\n * relative to the project root, or to `node_modules` for a package.\n */\n const shortName = (name: string): string =>\n name.replace(/\\((\\/.*)\\)$/, (whole, file: string) => {\n const index = file.lastIndexOf('/node_modules/');\n if (index !== -1) {\n return `(${file.slice(index + '/node_modules/'.length)})`;\n }\n return config ? `(${path.relative(config.root, file)})` : whole;\n });\n\n /** What the final compile of each chunk or module left alone, by environment. */\n const skips = new Map<string, Skip[]>();\n const addSkips = (context: { environment?: { name: string } }, list?: readonly Skip[]): void => {\n if (!list) {\n return;\n }\n const environment = context.environment?.name ?? 'client';\n const entries = skips.get(environment) ?? [];\n entries.push(...list.map((skip) => ({ ...skip, name: shortName(skip.name) })));\n skips.set(environment, entries);\n };\n\n let compiler: Compiler | undefined;\n let filter: ((id: string) => boolean) | undefined;\n const getCompiler = (): Compiler => {\n compiler ??= loadCompiler();\n return compiler;\n };\n\n const isBuild = (): boolean => config?.command === 'build';\n /** Whether the output needs source maps: while serving, or when the build writes them. */\n const wantsMaps = (): boolean => !isBuild() || Boolean(config?.build.sourcemap);\n\n /**\n * The JSX options the official plugin passes for a posture, so the\n * lowering here matches it. Mirrors the `transform` hook of `vite-plugin-solid`.\n */\n const jsxOptions = (isSsr: boolean): JSXOptions => {\n let posture: JSXOptions = { generate: 'dom', hydratable: false };\n if (solidOptions.ssr) {\n posture = { generate: isSsr ? 'ssr' : 'dom', hydratable: true };\n }\n return { ...posture, ...solidOptions.solid };\n };\n\n let sampleHelpers: string[] | undefined;\n /** The helpers the JSX transform uses for attributes in chunk mode. */\n const attributeHelpers = (): string[] => {\n sampleHelpers ??= helpersOf(\n getCompiler(),\n ATTRIBUTE_SAMPLE,\n 'sample.jsx',\n jsxOptions(false),\n moduleName,\n );\n return sampleHelpers;\n };\n\n /**\n * Whether client builds keep JSX until chunks are rendered.\n */\n const chunkMode = (): boolean => {\n if (!isBuild() || (optimizer.mode ?? 'auto') !== 'auto') {\n return false;\n }\n // The user's Babel plugins have to see the modules, which chunk mode skips.\n if (solidOptions.babel) {\n return false;\n }\n const client = jsxOptions(false);\n return client.generate === 'dom' && client.hydratable !== true;\n };\n\n const isJSXModule = (id: string): boolean => {\n filter ??= createFilter(solidOptions.include, solidOptions.exclude);\n return filter(id) && JSX_MODULE.test(stripQuery(id));\n };\n\n /** Modules that keep their JSX, which the bundler must parse as JSX. */\n const preserved = new Set<string>();\n\n /** What each module imports and the constants it exports, by module id. */\n const moduleConstants = new Map<string, Promise<ModuleConstants | undefined>>();\n\n /**\n * The module an import resolves to, when its constants can be read.\n *\n * A module with JSX is skipped. This plugin's transform may be waiting for\n * it, and it may be waiting for this one, so loading it could deadlock.\n * Dependencies are skipped to keep the build fast.\n */\n async function resolveConstantModule(\n context: Rollup.PluginContext,\n specifier: string,\n importer: string,\n ): Promise<string | undefined> {\n if (moduleSources.includes(specifier)) {\n return undefined;\n }\n const resolved = await context.resolve(specifier, importer);\n if (\n !resolved ||\n resolved.external ||\n resolved.id.includes('/node_modules/') ||\n isJSXModule(resolved.id)\n ) {\n return undefined;\n }\n return resolved.id;\n }\n\n /**\n * The constants of the modules `code` imports, keyed by import specifier.\n *\n * Each module is read as the bundler loads it, after every plugin has\n * transformed it, so a plugin that replaces or rewrites a module is seen.\n * A module that imports constants itself resolves them first, and a cycle\n * leaves the modules in it without them.\n */\n async function importedConstants(\n context: Rollup.PluginContext,\n imports: readonly string[],\n importer: string,\n visiting: ReadonlySet<string>,\n ): Promise<ImportedConstants> {\n const entries = await Promise.all(\n imports.map(async (specifier) => {\n const id = await resolveConstantModule(context, specifier, importer);\n if (id === undefined || visiting.has(id)) {\n return undefined;\n }\n const constants = await constantsOf(context, id, visiting);\n if (!constants || Object.keys(constants.exports).length === 0) {\n return undefined;\n }\n return [specifier, constants.exports] as const;\n }),\n );\n return Object.fromEntries(\n entries.filter(\n (entry): entry is readonly [string, Record<string, Primitive>] => entry !== undefined,\n ),\n );\n }\n\n async function constantsOf(\n context: Rollup.PluginContext,\n id: string,\n visiting: ReadonlySet<string>,\n ): Promise<ModuleConstants | undefined> {\n let pending = moduleConstants.get(id);\n if (!pending) {\n pending = (async () => {\n const { code } = await context.load({ id });\n if (code === null) {\n return undefined;\n }\n // Loaded code is JavaScript, whatever the module was written in.\n const filename = `${stripQuery(id)}.js`;\n try {\n const own = readModuleConstants(code, { filename });\n if (own.imports.length === 0) {\n return own;\n }\n const imported = await importedConstants(\n context,\n own.imports,\n id,\n new Set([...visiting, id]),\n );\n return readModuleConstants(code, { filename, importedConstants: imported });\n } catch (error) {\n // A module the parser rejects fails its own transform, with a better error.\n if (error instanceof SyntaxError) {\n return undefined;\n }\n throw error;\n }\n })();\n moduleConstants.set(id, pending);\n }\n return pending;\n }\n\n /**\n * The compile options for a module, with the constants of its imports.\n */\n async function moduleOptions(\n context: Rollup.PluginContext,\n code: string,\n id: string,\n ): Promise<CompileOptions> {\n const filename = stripQuery(id);\n // The dev server cannot give back the code of a loaded module.\n if (optimizer.fold === false || !isBuild()) {\n return { ...compileOptions, filename, sourceMap: wantsMaps() };\n }\n const { imports } = readModuleConstants(code, { filename });\n return {\n ...compileOptions,\n filename,\n sourceMap: wantsMaps(),\n importedConstants: await importedConstants(context, imports, filename, new Set([filename])),\n };\n }\n\n /** The modules each transform waits for, so two never wait for each other. */\n const waiting = new Map<string, Set<string>>();\n\n /** Whether the transform of `from` waits, directly or not, for `to`. */\n const waitsFor = (from: string, to: string): boolean => {\n const seen = new Set<string>();\n const stack = [from];\n for (let current = stack.pop(); current !== undefined; current = stack.pop()) {\n if (current === to) {\n return true;\n }\n if (!seen.has(current)) {\n seen.add(current);\n stack.push(...(waiting.get(current) ?? []));\n }\n }\n return false;\n };\n\n /**\n * The code of a module with JSX, as the bundler loads it. `undefined`\n * when that module's transform waits for the importer, which would then\n * wait for it in turn.\n */\n async function loadModule(\n context: Rollup.PluginContext,\n importer: string,\n target: string,\n ): Promise<string | undefined> {\n if (waitsFor(target, importer)) {\n return undefined;\n }\n const targets = waiting.get(importer) ?? new Set<string>();\n targets.add(target);\n waiting.set(importer, targets);\n try {\n const info = await context.load({ id: target });\n return info.code ?? undefined;\n } finally {\n targets.delete(target);\n }\n }\n\n /**\n * The code of each module with JSX as this plugin's module step returned\n * it, before Solid's JSX transform lowers it. In module mode, an importer\n * copies components from it.\n */\n const recorded = new Map<string, string>();\n\n /** The modules with JSX each module imports, read from its file. */\n const jsxImports = new Map<string, Promise<string[]>>();\n\n /**\n * The modules with JSX a module imports. They come from the file on disk,\n * so they do not depend on the order modules are transformed in.\n */\n async function jsxImportsOf(context: Rollup.PluginContext, id: string): Promise<string[]> {\n let pending = jsxImports.get(id);\n if (!pending) {\n pending = (async () => {\n let code: string;\n try {\n code = await readFile(stripQuery(id), 'utf8');\n } catch {\n return [];\n }\n let program: Program;\n try {\n program = parse(stripQuery(id), code);\n } catch {\n return [];\n }\n const sources = new Set<string>();\n for (const statement of program.body) {\n if (\n (statement.type === 'ImportDeclaration' && statement.importKind !== 'type') ||\n ((statement.type === 'ExportNamedDeclaration' ||\n statement.type === 'ExportAllDeclaration') &&\n statement.source &&\n statement.exportKind !== 'type')\n ) {\n const value = statement.source?.value;\n if (value !== undefined && !moduleSources.includes(value)) {\n sources.add(value);\n }\n }\n }\n const resolved = await Promise.all(\n [...sources].map(async (source) => context.resolve(source, id)),\n );\n return resolved\n .filter((target) => target && !target.external && isJSXModule(target.id))\n .map((target) => target?.id ?? '');\n })();\n jsxImports.set(id, pending);\n }\n return pending;\n }\n\n /** Whether `from` imports `to`, directly or through other modules with JSX. */\n async function reaches(\n context: Rollup.PluginContext,\n from: string,\n to: string,\n ): Promise<boolean> {\n const seen = new Set<string>();\n let frontier = [from];\n while (frontier.length > 0) {\n if (frontier.includes(to)) {\n return true;\n }\n for (const id of frontier) {\n seen.add(id);\n }\n // oxlint-disable-next-line no-await-in-loop\n const next = await Promise.all(frontier.map(async (id) => jsxImportsOf(context, id)));\n frontier = [...new Set(next.flat())].filter((id) => !seen.has(id));\n }\n return false;\n }\n\n /**\n * The code of a module with JSX before Solid's JSX transform, with its\n * types stripped. A module that imports the importer back is skipped, so\n * no two transforms wait for each other, and the server and client builds\n * skip the same ones.\n */\n async function loadRecorded(\n context: Rollup.PluginContext,\n importer: string,\n target: string,\n ): Promise<string | undefined> {\n if (await reaches(context, target, importer)) {\n return undefined;\n }\n await context.load({ id: target });\n const code = recorded.get(environmentKey(context, target));\n if (code === undefined) {\n return undefined;\n }\n const stripped = await transformWithOxc(code, stripQuery(target), {\n jsx: 'preserve',\n sourcemap: false,\n });\n return stripped.code;\n }\n\n /**\n * The scripts an entry runs: the entry itself, or the module scripts of an\n * HTML entry. `undefined` when an HTML entry has an inline module script,\n * whose imports the usage index cannot read.\n */\n async function scriptEntries(\n context: Rollup.PluginContext,\n id: string,\n ): Promise<string[] | undefined> {\n if (/\\.[mc]?[jt]sx?(?:\\?|$)/.test(id)) {\n return [id];\n }\n let html: string;\n try {\n html = await readFile(stripQuery(id), 'utf8');\n } catch {\n return undefined;\n }\n const scripts: string[] = [];\n for (const [tag] of html.matchAll(/<script\\b[^>]*>/gi)) {\n if (!/\\btype\\s*=\\s*[\"']?module/i.test(tag)) {\n continue;\n }\n const src = /\\bsrc\\s*=\\s*[\"']([^\"']+)[\"']/i.exec(tag)?.[1];\n if (src === undefined) {\n return undefined;\n }\n // oxlint-disable-next-line no-await-in-loop\n const resolved = await context.resolve(src, id);\n if (!resolved || resolved.external) {\n return undefined;\n }\n scripts.push(resolved.id);\n }\n return scripts;\n }\n\n /** How the app uses each export, built once per environment and build. */\n const usageIndexes = new Map<string, Promise<UsageIndex>>();\n\n /**\n * How the app uses each export, read from the modules the entries reach.\n */\n async function usageIndex(context: Rollup.PluginContext): Promise<UsageIndex> {\n const key = environmentKey(context, '');\n let pending = usageIndexes.get(key);\n if (!pending) {\n pending = (async () => {\n const entries = await Promise.all(\n [...context.getModuleIds()]\n .filter((id) => context.getModuleInfo(id)?.isEntry === true)\n .map(async (id) => scriptEntries(context, id)),\n );\n // A script the index cannot read could use any export.\n const known = entries.every((scripts) => scripts !== undefined);\n return buildUsageIndex(known ? entries.flat() : [], {\n resolve: async (source, importer) => {\n const resolved = await context.resolve(source, importer);\n return !resolved || resolved.external || resolved.id.includes('/node_modules/')\n ? undefined\n : resolved.id;\n },\n read: async (id) => {\n try {\n return await readFile(stripQuery(id), 'utf8');\n } catch {\n return undefined;\n }\n },\n });\n })();\n usageIndexes.set(key, pending);\n }\n return pending;\n }\n\n /**\n * The text that imports a binding under `local`.\n */\n function importText(local: string, imported: string, source: string): string {\n const from = JSON.stringify(source);\n if (imported === '*') {\n return `import * as ${local} from ${from};`;\n }\n if (imported === 'default') {\n return `import ${local} from ${from};`;\n }\n return `import { ${imported} as ${local} } from ${from};`;\n }\n\n interface Copy {\n /** The module and export the copy comes from. */\n readonly key: string;\n readonly name: string;\n /** The tags in the importer that call it. */\n readonly tags: Node[];\n readonly text: string;\n }\n\n interface CopyState {\n /** Components that cannot be copied, or were left over before. */\n readonly excluded: Set<string>;\n /** The contexts the copies import, by module. */\n readonly contexts: Map<string, Set<string>>;\n /** Imports a binding into the importer, and gives its local name. */\n readonly importAs: (base: string, imported: string, from: string) => string;\n /** The code of a module with JSX to copy from, or `undefined` to skip it. */\n readonly load: (target: string) => Promise<string | undefined>;\n /** Where the copies that are not made are recorded, when the report is on. */\n readonly skips: Skip[] | undefined;\n }\n\n /**\n * Reads the component `source` exports as `imported`, and imports what it\n * needs into the importer. `undefined` when it cannot be copied.\n */\n async function copyImported(\n context: Rollup.PluginContext,\n id: string,\n source: string,\n imported: string,\n state: CopyState,\n ): Promise<{ key: string; text: (name: string) => string } | undefined> {\n const skip = (reason: string): void => {\n state.skips?.push({ pass: 'inline', reason, name: `${imported} (${source})` });\n };\n const resolved = await context.resolve(source, id);\n if (!resolved || resolved.external) {\n skip('copy-external');\n return undefined;\n }\n if (resolved.id.includes('/node_modules/')) {\n skip('copy-package');\n return undefined;\n }\n if (resolved.id === id) {\n return undefined;\n }\n if (!isJSXModule(resolved.id)) {\n skip('copy-not-jsx');\n return undefined;\n }\n const key = `${resolved.id}\\0${imported}`;\n if (state.excluded.has(key)) {\n return undefined;\n }\n const loaded = await state.load(resolved.id);\n if (loaded === undefined) {\n state.excluded.add(key);\n skip('copy-cycle');\n return undefined;\n }\n const component = readExportedComponent(\n loaded,\n stripQuery(resolved.id),\n imported,\n moduleSources,\n );\n if (!component) {\n state.excluded.add(key);\n skip('copy-shape');\n return undefined;\n }\n // Its copy would still call a component of that module, so the call\n // site gains nothing. Moving its template out of its module makes both\n // compress worse.\n if (component.wrapsLocal) {\n state.excluded.add(key);\n skip('copy-wrapper');\n return undefined;\n }\n // Each import of the module resolves from it, so the copy imports the same module.\n const targets = new Map<string, string>();\n for (const dependency of component.dependencies.values()) {\n if (dependency.kind === 'import' && !moduleSources.includes(dependency.source)) {\n // oxlint-disable-next-line no-await-in-loop\n const target = await context.resolve(dependency.source, resolved.id);\n if (!target) {\n state.excluded.add(key);\n skip('copy-external');\n return undefined;\n }\n targets.set(dependency.source, target.external ? dependency.source : target.id);\n }\n }\n const rename = new Map<string, string>();\n for (const [local, dependency] of component.dependencies) {\n if (dependency.kind === 'import') {\n const from = targets.get(dependency.source) ?? dependency.source;\n rename.set(local, state.importAs(local, dependency.imported, from));\n continue;\n }\n rename.set(local, state.importAs(local, dependency.exported, resolved.id));\n if (dependency.context) {\n const known = state.contexts.get(resolved.id) ?? new Set<string>();\n known.add(dependency.exported);\n state.contexts.set(resolved.id, known);\n }\n }\n return { key, text: (name) => component.copy(name, rename) };\n }\n\n /**\n * Copies the components a module imports from other modules with JSX into\n * it, and inlines them there. A copy the inline pass cannot inline at\n * every call is left out, so a component is never in both places. Copies\n * can import components in turn, which a few more rounds take in.\n */\n async function inlineImports(\n context: Rollup.PluginContext,\n source: string,\n id: string,\n compileOptionsOfModule: CompileOptions,\n load: (target: string) => Promise<string | undefined>,\n copySkips?: Skip[],\n ): Promise<{ code: string; maps: string[]; skipped?: Skip[] } | undefined> {\n const filename = stripQuery(id);\n const maps: string[] = [];\n let skipped: Skip[] | undefined;\n const excluded = new Set<string>();\n const usage = await usageIndex(context);\n // The components copied here that leave their module, by module.\n const absorbed = new Map<string, Set<string>>();\n // How many modules use the original of a copy, this one included.\n const usersOf = (copy: Copy): number => {\n const [module = '', exported = ''] = copy.key.split('\\0');\n return usage.users(module, exported, id, absorbed);\n };\n // The contexts the copies import, which the provider pass needs to know.\n const contexts = new Map<string, Set<string>>();\n let code = source;\n const copyNames = new Map<string, string>();\n for (let round = 0; round < 4; round += 1) {\n const program = parse(filename, code);\n const scopes = analyzeScopes(program);\n const parents = collectParents(program);\n const names = new Set(scopes.names);\n const fresh = (base: string): string => {\n let name = base;\n for (let index = 1; names.has(name); index += 1) {\n name = `${base}$${String(index)}`;\n }\n names.add(name);\n return name;\n };\n\n // The module's own imports, so a copy reuses one instead of adding another.\n // Two imports of one context would be two bindings to the provider pass.\n const existing = importedNames(program);\n // Imports added in this round, shared by every copy.\n const imports: string[] = [];\n const added = new Map<string, string>();\n const importAs = (base: string, imported: string, from: string): string => {\n const key = `${from}\\0${imported}`;\n const known = existing.get(key) ?? added.get(key);\n if (known !== undefined) {\n return known;\n }\n const name = fresh(base);\n added.set(key, name);\n imports.push(importText(name, imported, from));\n return name;\n };\n\n // Each imported binding used as a JSX tag, and its copy.\n const copies: Copy[] = [];\n for (const statement of program.body) {\n if (\n statement.type !== 'ImportDeclaration' ||\n statement.importKind === 'type' ||\n moduleSources.includes(statement.source.value)\n ) {\n continue;\n }\n for (const specifier of statement.specifiers) {\n const binding = scopes.root.bindings.get(specifier.local.name);\n // Only tags are copied. The import stays for any other use.\n const tags = (binding?.references ?? []).filter((reference) => {\n const parent = parents.get(reference);\n return (\n (parent?.type === 'JSXOpeningElement' || parent?.type === 'JSXClosingElement') &&\n parent.name === reference\n );\n });\n if (\n specifier.type === 'ImportNamespaceSpecifier' ||\n binding?.imported === undefined ||\n tags.length === 0\n ) {\n continue;\n }\n // oxlint-disable-next-line no-await-in-loop\n const copy = await copyImported(context, id, statement.source.value, binding.imported, {\n excluded,\n contexts,\n importAs,\n load,\n skips: copySkips,\n });\n if (copy && copySkips) {\n // A copy the inline pass leaves behind is recorded under the reason it gave.\n copyNames.set(copy.key, `${binding.imported} (${statement.source.value})`);\n }\n if (copy) {\n const name = fresh(specifier.local.name);\n copies.push({ key: copy.key, name, tags, text: copy.text(name) });\n }\n }\n }\n if (copies.length === 0) {\n break;\n }\n\n // Drop the copies the inline pass leaves behind, and try again without them.\n let result: CompileResult | undefined;\n let edit: MagicString | undefined;\n for (let attempt = 0; attempt < 4 && copies.length > 0; attempt += 1) {\n edit = new MagicString(code);\n for (const copy of copies) {\n for (const tag of copy.tags) {\n edit.overwrite(tag.start, tag.end, copy.name);\n }\n edit.append(`\\n${copy.text}\\n`);\n }\n edit.append(`\\n${imports.join('\\n')}\\n`);\n result = compile(edit.toString(), {\n ...compileOptionsOfModule,\n filename,\n sourceMap: wantsMaps(),\n importedContexts: Object.fromEntries(\n [...contexts].map(([module, exported]) => [module, [...exported]]),\n ),\n // The original of a copy stays in its module for its other users.\n sharedComponents: Object.fromEntries(\n copies\n .map((copy): [string, number] => [copy.name, usersOf(copy)])\n .filter(([, users]) => users !== 1),\n ),\n });\n const left = analyzeScopes(parse(filename, result.code)).root.bindings;\n const stuck = copies.filter((copy) => left.has(copy.name));\n if (stuck.length === 0) {\n break;\n }\n for (const copy of stuck) {\n excluded.add(copy.key);\n copies.splice(copies.indexOf(copy), 1);\n const reason = result.skipped?.find((entry) => entry.name === copy.name)?.reason;\n copySkips?.push({\n pass: 'inline',\n reason: `copy-${reason ?? 'left'}`,\n name: copyNames.get(copy.key) ?? copy.name,\n });\n }\n result = undefined;\n }\n if (!result || !edit) {\n break;\n }\n // Their uses of other components move here with them.\n for (const copy of copies.filter((item) => usersOf(item) === 1)) {\n const [module = '', exported = ''] = copy.key.split('\\0');\n absorbed.set(module, new Set([...(absorbed.get(module) ?? []), exported]));\n }\n if (wantsMaps()) {\n maps.push(\n edit.generateMap({ source: filename, hires: true, includeContent: true }).toString(),\n );\n }\n if (result.map) {\n maps.push(result.map.toString());\n }\n code = result.code;\n ({ skipped } = result);\n }\n return code === source ? undefined : { code, maps, skipped };\n }\n\n /**\n * Prepares a client module for chunk mode. It adds the helper marker\n * instead of lowering JSX. Vite strips the types afterwards.\n */\n async function keepJSX(\n context: Rollup.PluginContext,\n source: string,\n id: string,\n ): Promise<Rollup.TransformResult> {\n const filename = stripQuery(id);\n // Fold and inline memos before bundling. A branch that folds away takes\n // its imports and `lazy()` chunks out of the module graph, which the\n // chunk step can no longer do. Inlining waits for the chunk, where the\n // components it can reach are known.\n const moduleCompileOptions = await moduleOptions(context, source, id);\n const local = compile(source, { ...moduleCompileOptions, inline: false });\n let code = local.code;\n const maps: (string | null | undefined)[] = [local.map?.toString()];\n // `<Ns.Member>` would keep a namespace object, which lowered code does not.\n const named = nameNamespaceTags(code, filename);\n if (named) {\n code = named.code;\n maps.push(named.map);\n }\n\n // Components imported from other modules inline here, so the bundler\n // drops them, and what only they used, before it splits the chunks.\n if (moduleCompileOptions.inline !== false) {\n const copySkips: Skip[] | undefined = compileOptions.report ? [] : undefined;\n const imported = await inlineImports(\n context,\n code,\n id,\n moduleCompileOptions,\n async (target) => loadModule(context, id, target),\n copySkips,\n );\n // The rest of the report comes from the chunk this module ends up in.\n addSkips(context, copySkips);\n if (imported) {\n code = imported.code;\n maps.push(...imported.maps);\n }\n }\n // An entry's exports are its public API, so it gets no extra names.\n const exposed = context.getModuleInfo(id)?.isEntry ? undefined : exposeLocals(code, filename);\n if (exposed) {\n code = exposed.code;\n maps.push(exposed.map);\n }\n // The helpers the module's JSX needs, as written and with its own\n // components inlined. Inlining can turn a spread into attributes, which\n // need helpers the spread did not.\n const inlined =\n moduleCompileOptions.inline === false\n ? undefined\n : compile(code, { ...moduleCompileOptions, sourceMap: false });\n const needed = new Set<string>();\n for (const version of new Set([code, inlined?.code ?? code])) {\n for (const helper of helpersOf(\n getCompiler(),\n version,\n filename,\n jsxOptions(false),\n moduleName,\n )) {\n needed.add(helper);\n }\n }\n // A component inlined into another module of the chunk can turn its\n // spread into any attribute.\n if (moduleCompileOptions.inline !== false && spreadsOntoElement(code, filename)) {\n for (const helper of attributeHelpers()) {\n needed.add(helper);\n }\n }\n // The bundler has to see that a `ref` writes its variable. See `refs.ts`.\n const protectedRefs = protectRefs(code, filename);\n if (protectedRefs) {\n code = protectedRefs.code;\n maps.push(protectedRefs.map);\n }\n preserved.add(id);\n if (needed.size === 0) {\n return code === source ? null : { code, map: combineMaps(wantsMaps(), maps) };\n }\n const marked = addMarker(code, filename, {\n moduleName,\n helpers: withRelated([...needed]),\n moduleSources,\n // The passes also recognize these primitives, which a chunk renames too.\n builtIns: new Set([...builtIns, 'createContext', ...CONTEXT_SAFE_PRIMITIVES]),\n });\n if (!marked) {\n return code === source ? null : { code, map: combineMaps(wantsMaps(), maps) };\n }\n return {\n code: marked.code,\n map: combineMaps(wantsMaps(), [...maps, marked.map]),\n };\n }\n\n const originalTransform = main.transform;\n const originalHandler =\n typeof originalTransform === 'function' ? originalTransform : originalTransform?.handler;\n if (originalHandler) {\n main.transform = async function transform(code, id, transformOptions) {\n if (chunkMode() && isClient(this) && isJSXModule(id)) {\n return keepJSX(this, code, id);\n }\n return originalHandler.call(this, code, id, transformOptions);\n };\n }\n\n const modulePlugin: Plugin = {\n name: 'solid-optimizer:module',\n enforce: 'pre',\n configResolved(resolved) {\n config = resolved;\n },\n buildStart() {\n moduleConstants.clear();\n jsxImports.clear();\n usageIndexes.clear();\n skips.delete(this.environment.name);\n },\n watchChange() {\n moduleConstants.clear();\n jsxImports.clear();\n usageIndexes.clear();\n },\n async transform(source, id) {\n if (!isBuild() && optimizer.dev !== true) {\n return null;\n }\n if ((chunkMode() && isClient(this)) || !isJSXModule(id)) {\n return null;\n }\n const filename = stripQuery(id);\n const sourceOptions: CompileOptions = {\n ...(await moduleOptions(this, source, id)),\n // The server renders once, so its reactive primitives reduce to plain calls.\n server: optimizer.server !== false && !isClient(this),\n };\n const result = compile(source, sourceOptions);\n let code = result.code;\n const maps: (string | null | undefined)[] = [result.map?.toString()];\n // Components imported from other modules inline here too. The server\n // and client builds read the same modules, so they inline the same ones.\n let { skipped } = result;\n if (isBuild() && sourceOptions.inline !== false) {\n const copySkips: Skip[] | undefined = compileOptions.report ? [] : undefined;\n const imported = await inlineImports(\n this,\n code,\n id,\n sourceOptions,\n async (target) => loadRecorded(this, id, target),\n copySkips,\n );\n addSkips(this, copySkips);\n if (imported) {\n code = imported.code;\n maps.push(...imported.maps);\n skipped = imported.skipped ?? skipped;\n }\n // Entries get the extra exports too. The server and client builds\n // have different entries, and both have to copy the same components.\n const exposed = exposeLocals(code, filename);\n if (exposed) {\n code = exposed.code;\n maps.push(exposed.map);\n }\n }\n addSkips(this, skipped);\n recorded.set(environmentKey(this, id), code);\n if (code === source) {\n return null;\n }\n return { code, map: combineMaps(wantsMaps(), maps) };\n },\n };\n\n const chunkPlugin: Plugin = {\n name: 'solid-optimizer:chunk',\n enforce: 'post',\n config(_, env) {\n if (env.command !== 'build') {\n return undefined;\n }\n // Kept JSX has to reach the bundler as JSX. Modules the official plugin\n // lowers have no JSX left, so this changes nothing for them.\n return {\n oxc: { jsx: 'preserve' },\n build: { rolldownOptions: { transform: { jsx: 'preserve' } } },\n };\n },\n renderChunk: {\n order: 'pre',\n handler(code, chunk) {\n if (!chunkMode() || !isClient(this) || !code.includes(MARKER)) {\n return null;\n }\n const filename = chunk.fileName;\n let repaired: { code: string; map: string } | undefined;\n let runtime: ReturnType<typeof readMarkers>;\n try {\n runtime = readMarkers(code, filename);\n } catch (error) {\n repaired = error instanceof SyntaxError ? repairJSXSequences(code, filename) : undefined;\n if (!repaired) {\n throw error;\n }\n runtime = readMarkers(repaired.code, filename);\n }\n if (!runtime) {\n return null;\n }\n const restored = restoreRefs(runtime.code, filename);\n const chunkCode = restored?.code ?? runtime.code;\n let optimized: CompileResult | undefined = compile(chunkCode, {\n ...compileOptions,\n filename,\n sourceMap: wantsMaps(),\n constantVars: true,\n builtInAliases: runtime.builtInAliases,\n });\n let lowered = lower(\n getCompiler(),\n optimized.code,\n filename,\n jsxOptions(false),\n wantsMaps(),\n );\n let linked: { code: string; map: string };\n try {\n linked = linkHelpers(lowered.code, filename, moduleName, runtime.helpers);\n addSkips(this, optimized.skipped);\n } catch (error) {\n if (!(error instanceof MissingHelperError)) {\n throw error;\n }\n // Each module keeps the helpers its own JSX needs, and a merged\n // tree can need one none of them did. Without it, the chunk is\n // lowered as its modules were written. Chunk mode never hydrates,\n // so the chunks do not have to match anything else.\n this.warn(`${error.message} ${filename} is not optimized.`);\n optimized = undefined;\n addSkips(this, [{ pass: 'inline', reason: 'missing-helper', name: filename }]);\n lowered = lower(getCompiler(), chunkCode, filename, jsxOptions(false), wantsMaps());\n linked = linkHelpers(lowered.code, filename, moduleName, runtime.helpers);\n }\n return {\n code: linked.code,\n map: combineMaps(wantsMaps(), [\n repaired?.map,\n runtime.map,\n restored?.map,\n optimized?.map?.toString(),\n lowered.map,\n linked.map,\n ]),\n };\n },\n },\n };\n\n // Prints the report once every chunk is rendered.\n chunkPlugin.generateBundle = function generateBundle() {\n const { report } = optimizer;\n if (report === undefined || report === false) {\n return;\n }\n const environment = this.environment.name;\n const result: OptimizerReport = { environment, skips: skips.get(environment) ?? [] };\n if (typeof report === 'function') {\n report(result);\n } else {\n this.environment.logger.info(formatReport(result));\n }\n };\n\n // Runs after `vite:oxc` strips types, which reports the module as plain\n // JavaScript, and before the built-in plugins that parse it again.\n const moduleTypePlugin: Plugin = {\n name: 'solid-optimizer:module-type',\n transform(code, id) {\n if (!preserved.has(id)) {\n return null;\n }\n // `vite:oxc` prints JSX like Rolldown does, without the parentheses a\n // comma expression needs in a JSX expression container.\n const repaired = repairJSXSequences(code, stripQuery(id));\n return repaired\n ? { code: repaired.code, map: repaired.map, moduleType: 'jsx' }\n : { code, moduleType: 'jsx' };\n },\n };\n\n return [modulePlugin, main, moduleTypePlugin, chunkPlugin];\n}\n"],"mappings":";;;;;;;;;;;;;AA2BA,SAAgB,eAAe,OAAyC;CACtE,MAAM,yBAAS,IAAI,IAA4E;CAC/F,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,MAAM,GAAG,KAAK,KAAK,IAAI,KAAK;EAClC,MAAM,QAAQ,OAAO,IAAI,GAAG,KAAK;GAAE,MAAM,KAAK;GAAM,QAAQ,KAAK;GAAQ,uBAAO,IAAI,IAAI;EAAE;EAC1F,MAAM,MAAM,IAAI,KA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