@generaltranslation/vue-extractor 0.0.0 → 0.1.0-iris.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/LICENSE.md +18 -102
- package/dist/detect.d.ts +8 -0
- package/dist/detect.js +2 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/inspect.d.ts +9 -0
- package/dist/inspect.js +2 -0
- package/dist/integration.d.ts +69 -0
- package/dist/integration.js +162 -0
- package/dist/integration.js.map +1 -0
- package/dist/internal/config/configFiles.d.ts +6 -0
- package/dist/internal/config/configFiles.js +34 -0
- package/dist/internal/config/configFiles.js.map +1 -0
- package/dist/internal/config/resolveVueCompilerOptions.d.ts +6 -0
- package/dist/internal/config/resolveVueCompilerOptions.js +74 -56
- package/dist/internal/config/resolveVueCompilerOptions.js.map +1 -1
- package/dist/internal/extractFromVueSource.d.ts +4 -3
- package/dist/internal/extractFromVueSource.js +255 -12
- package/dist/internal/extractFromVueSource.js.map +1 -1
- package/dist/internal/project/consumerUsage.d.ts +34 -0
- package/dist/internal/project/consumerUsage.js +1220 -0
- package/dist/internal/project/consumerUsage.js.map +1 -0
- package/dist/internal/project/detectVueProject.d.ts +13 -0
- package/dist/internal/project/detectVueProject.js +65 -0
- package/dist/internal/project/detectVueProject.js.map +1 -0
- package/dist/internal/project/extractFromVueProject.d.ts +10 -0
- package/dist/internal/project/extractFromVueProject.js +579 -0
- package/dist/internal/project/extractFromVueProject.js.map +1 -0
- package/dist/internal/project/inspectVueProject.d.ts +48 -0
- package/dist/internal/project/inspectVueProject.js +143 -0
- package/dist/internal/project/inspectVueProject.js.map +1 -0
- package/dist/internal/project/manifest.d.ts +64 -0
- package/dist/internal/project/manifest.js +270 -0
- package/dist/internal/project/manifest.js.map +1 -0
- package/dist/internal/project/mergeVueProjectExtraction.d.ts +18 -0
- package/dist/internal/project/mergeVueProjectExtraction.js +79 -0
- package/dist/internal/project/mergeVueProjectExtraction.js.map +1 -0
- package/dist/internal/project/moduleResolver.d.ts +18 -0
- package/dist/internal/project/moduleResolver.js +325 -0
- package/dist/internal/project/moduleResolver.js.map +1 -0
- package/dist/internal/project/scopes.d.ts +31 -0
- package/dist/internal/project/scopes.js +182 -0
- package/dist/internal/project/scopes.js.map +1 -0
- package/dist/internal/project/sourcePatterns.d.ts +4 -0
- package/dist/internal/project/sourcePatterns.js +32 -0
- package/dist/internal/project/sourcePatterns.js.map +1 -0
- package/dist/internal/project/viteAliases.d.ts +42 -0
- package/dist/internal/project/viteAliases.js +1020 -0
- package/dist/internal/project/viteAliases.js.map +1 -0
- package/dist/internal/project/vueSourceClassification.d.ts +13 -0
- package/dist/internal/project/vueSourceClassification.js +146 -0
- package/dist/internal/project/vueSourceClassification.js.map +1 -0
- package/dist/internal/project/workspaces.d.ts +31 -0
- package/dist/internal/project/workspaces.js +326 -0
- package/dist/internal/project/workspaces.js.map +1 -0
- package/dist/internal/project/wrapperProvenance.d.ts +21 -0
- package/dist/internal/project/wrapperProvenance.js +287 -0
- package/dist/internal/project/wrapperProvenance.js.map +1 -0
- package/dist/internal/script/analyze.js +252 -85
- package/dist/internal/script/analyze.js.map +1 -1
- package/dist/internal/script/jsx.d.ts +7 -4
- package/dist/internal/script/jsx.js +351 -79
- package/dist/internal/script/jsx.js.map +1 -1
- package/dist/internal/script/localModules.d.ts +23 -2
- package/dist/internal/script/localModules.js +533 -20
- package/dist/internal/script/localModules.js.map +1 -1
- package/dist/internal/script/model.d.ts +9 -2
- package/dist/internal/script/parser.js +2 -1
- package/dist/internal/script/parser.js.map +1 -1
- package/dist/internal/script/runtimeModules.d.ts +10 -0
- package/dist/internal/script/runtimeModules.js +27 -0
- package/dist/internal/script/runtimeModules.js.map +1 -0
- package/dist/internal/stringCalls.js +1 -1
- package/dist/internal/stringCalls.js.map +1 -1
- package/dist/internal/template.js +263 -141
- package/dist/internal/template.js.map +1 -1
- package/dist/internal/types.d.ts +4 -1
- package/dist/internal/utils.d.ts +14 -3
- package/dist/internal/utils.js +63 -3
- package/dist/internal/utils.js.map +1 -1
- package/dist/internal/vueCompiler.d.ts +9 -1
- package/dist/internal/vueCompiler.js +37 -14
- package/dist/internal/vueCompiler.js.map +1 -1
- package/dist/project.d.ts +11 -0
- package/dist/project.js +3 -0
- package/dist/types.d.ts +95 -4
- package/package.json +30 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viteAliases.js","names":[],"sources":["../../../src/internal/project/viteAliases.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { parse, type ParserPlugin } from '@babel/parser';\nimport traverseModule, {\n type Binding,\n type NodePath,\n type Scope,\n} from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport {\n NUXT_CONFIG_FILES,\n VITE_CONFIG_EXTENSIONS,\n VITE_CONFIG_FILES,\n} from '../config/configFiles.js';\n\nconst traverse = traverseModule.default || traverseModule;\n\ntype StaticEntry = {\n node: t.Node;\n scope: Scope;\n};\n\ntype StaticObject = Map<string, StaticEntry>;\n\ntype ConfigKind = 'vite' | 'nuxt';\n\ntype ConfigSource = {\n file: string;\n kind: ConfigKind;\n};\n\ntype ConfigDiscovery = {\n complete: boolean;\n source?: ConfigSource;\n};\n\ntype StaticAliases = {\n entries: Array<readonly [find: string, replacement: string]>;\n form: 'array' | 'object';\n};\n\ntype AliasResolution =\n | { ok: true; aliases: StaticAliases }\n | {\n ok: false;\n potentialAliasKeys: Set<string>;\n potentialAliases: Map<string, Set<string>>;\n };\n\ntype BindingSafety = 'alias' | 'config' | 'none';\n\ntype HelperBindings = {\n configFunctions: Set<Binding>;\n configNamespaces: Set<Binding>;\n fileURLToPathFunctions: Set<Binding>;\n pathNamespaces: Set<Binding>;\n pathResolveFunctions: Set<Binding>;\n urlConstructors: Set<Binding>;\n urlNamespaces: Set<Binding>;\n};\n\ntype EvaluationContext = {\n configFile: string;\n helpers: HelperBindings;\n nuxtMajorVersion?: number;\n packageRoot: string;\n scopes: WeakMap<t.Node, Scope>;\n};\n\n/** Controls static Vite alias discovery for a Vue package. */\nexport type VueProjectAliasResolverOptions = {\n /** A single Vite config path, resolved within the Vue package directory. */\n viteConfigPath?: string;\n /** Nuxt major selected by the package, when already known by the caller. */\n nuxtMajorVersion?: number;\n};\n\n/** Result of proving the active framework alias surface statically. */\nexport type VueProjectAliasConfiguration = {\n /** Ordered string aliases, present only when analysis is complete. */\n aliases: Map<string, string>;\n /** Whether every active alias behavior was proven without execution. */\n complete: boolean;\n /**\n * Statically observed key-to-replacement candidates whose precedence remains\n * uncertain. These mappings are diagnostic evidence only; callers must not\n * use them to resolve imports or extract translations.\n */\n potentialAliases?: Map<string, Set<string>>;\n /**\n * Statically observed alias keys whose final behavior remains uncertain.\n * These keys are diagnostic evidence only and must never be resolved as\n * trusted aliases while `complete` is false.\n */\n potentialAliasKeys?: Set<string>;\n};\n\n/**\n * Reads string aliases from statically analyzable Vite and Nuxt config.\n *\n * Config files are parsed as source and are never imported or executed.\n * Dynamic aliases, regular-expression find values, and unsupported syntax are\n * ignored so alias discovery cannot make otherwise valid extraction fatal.\n */\nexport function resolveVueProjectAliases(\n cwd: string,\n options: VueProjectAliasResolverOptions = {}\n): Map<string, string> {\n return resolveVueProjectAliasConfiguration(cwd, options).aliases;\n}\n\n/**\n * Resolves aliases and reports whether the active alias surface was proven.\n *\n * Incomplete analysis never returns partial aliases. This lets project-level\n * integrations distinguish a project with no configured aliases from one\n * whose dynamic resolver behavior must block safe static extraction.\n */\nexport function resolveVueProjectAliasConfiguration(\n cwd: string,\n options: VueProjectAliasResolverOptions = {}\n): VueProjectAliasConfiguration {\n const packageRoot = path.resolve(cwd);\n const hasExplicitConfig = options.viteConfigPath !== undefined;\n const explicitConfig =\n options.viteConfigPath !== undefined\n ? resolveExplicitConfig(packageRoot, options.viteConfigPath)\n : undefined;\n const discovery: ConfigDiscovery = hasExplicitConfig\n ? explicitConfig\n ? { complete: true, source: { file: explicitConfig, kind: 'vite' } }\n : { complete: false }\n : discoverConfigSource(packageRoot);\n if (!discovery.complete) return incompleteAliasConfiguration();\n if (!discovery.source) return completeAliasConfiguration();\n return readConfigAliases(\n discovery.source,\n packageRoot,\n options.nuxtMajorVersion\n );\n}\n\nfunction discoverConfigSource(cwd: string): ConfigDiscovery {\n const viteConfig = findFirstConfig(cwd, VITE_CONFIG_FILES);\n const nuxtConfig = findFirstConfig(cwd, NUXT_CONFIG_FILES);\n // Match compiler-option discovery: two active framework configs are\n // ambiguous, so no alias result is safer than resolving with the wrong one.\n if (!viteConfig.complete || !nuxtConfig.complete) return { complete: false };\n if (viteConfig.file && nuxtConfig.file) return { complete: false };\n if (nuxtConfig.file) {\n return {\n complete: true,\n source: { file: nuxtConfig.file, kind: 'nuxt' },\n };\n }\n if (viteConfig.file) {\n return {\n complete: true,\n source: { file: viteConfig.file, kind: 'vite' },\n };\n }\n return { complete: true };\n}\n\nfunction findFirstConfig(\n cwd: string,\n filenames: readonly string[]\n): { complete: boolean; file?: string } {\n for (const filename of filenames) {\n const candidate = path.join(cwd, filename);\n try {\n return fs.statSync(candidate).isFile()\n ? { complete: true, file: candidate }\n : { complete: false };\n } catch (error) {\n if (isMissingPathError(error)) continue;\n return { complete: false };\n }\n }\n return { complete: true };\n}\n\nfunction resolveExplicitConfig(\n cwd: string,\n configuredPath: string\n): string | undefined {\n if (!configuredPath.trim()) return undefined;\n const candidate = path.resolve(cwd, configuredPath);\n if (!isInsideDirectory(cwd, candidate)) return undefined;\n if (!VITE_CONFIG_EXTENSIONS.has(path.extname(candidate).toLowerCase())) {\n return undefined;\n }\n try {\n if (!fs.statSync(candidate).isFile()) return undefined;\n const realRoot = fs.realpathSync(cwd);\n const realCandidate = fs.realpathSync(candidate);\n if (!isInsideDirectory(realRoot, realCandidate)) return undefined;\n if (\n path\n .relative(realRoot, realCandidate)\n .split(path.sep)\n .includes('node_modules')\n ) {\n return undefined;\n }\n return candidate;\n } catch {\n return undefined;\n }\n}\n\nfunction isInsideDirectory(root: string, candidate: string): boolean {\n const relative = path.relative(root, candidate);\n return (\n relative !== '..' &&\n !relative.startsWith(`..${path.sep}`) &&\n !path.isAbsolute(relative)\n );\n}\n\nfunction isMissingPathError(error: unknown): boolean {\n return Boolean(\n error &&\n typeof error === 'object' &&\n 'code' in error &&\n (error.code === 'ENOENT' || error.code === 'ENOTDIR')\n );\n}\n\nfunction completeAliasConfiguration(\n aliases: Map<string, string> = new Map()\n): VueProjectAliasConfiguration {\n return { aliases, complete: true };\n}\n\nfunction incompleteAliasConfiguration(\n potentialAliasKeys: Iterable<string> = [],\n potentialAliases: ReadonlyMap<string, ReadonlySet<string>> = new Map()\n): VueProjectAliasConfiguration {\n const keys = new Set(potentialAliasKeys);\n const aliases = clonePotentialAliases(potentialAliases);\n for (const key of aliases.keys()) keys.add(key);\n return {\n aliases: new Map(),\n complete: false,\n ...(aliases.size > 0 && { potentialAliases: aliases }),\n ...(keys.size > 0 && { potentialAliasKeys: keys }),\n };\n}\n\nfunction collectAliasResolutionKeys(\n ...sources: Array<StaticAliases | AliasResolution | undefined>\n): Set<string> {\n const keys = new Set<string>();\n for (const source of sources) {\n if (!source) continue;\n if ('ok' in source) {\n addAll(\n keys,\n source.ok\n ? source.aliases.entries.map(([find]) => find)\n : source.potentialAliasKeys\n );\n continue;\n }\n for (const [find] of source.entries) keys.add(find);\n }\n return keys;\n}\n\nfunction collectAliasResolutionCandidates(\n ...sources: Array<StaticAliases | AliasResolution | undefined>\n): Map<string, Set<string>> {\n const aliases = new Map<string, Set<string>>();\n for (const source of sources) {\n if (!source) continue;\n if ('ok' in source) {\n if (source.ok) {\n for (const [find, replacement] of source.aliases.entries) {\n addPotentialAlias(aliases, find, replacement);\n }\n } else {\n mergePotentialAliases(aliases, source.potentialAliases);\n }\n continue;\n }\n for (const [find, replacement] of source.entries) {\n addPotentialAlias(aliases, find, replacement);\n }\n }\n return aliases;\n}\n\nfunction readConfigAliases(\n source: ConfigSource,\n packageRoot: string,\n configuredNuxtMajor: number | undefined\n): VueProjectAliasConfiguration {\n const ast = parseConfig(source.file);\n if (!ast) return incompleteAliasConfiguration();\n const { helpers, scopes } = collectAnalysisContext(ast);\n const activeExport = findActiveConfigExport(ast);\n if (!activeExport) return incompleteAliasConfiguration();\n const context: EvaluationContext = {\n configFile: source.file,\n helpers,\n nuxtMajorVersion:\n configuredNuxtMajor ?? readInstalledNuxtMajor(packageRoot),\n packageRoot,\n scopes,\n };\n const root = resolveConfigRoot(activeExport, context, new Set());\n const config = root\n ? resolveStaticObject(root, context, new Set(), 'config')\n : undefined;\n if (!config) return incompleteAliasConfiguration();\n\n if (source.kind === 'vite') {\n const aliases = readNestedAliasObject(\n config,\n ['resolve', 'alias'],\n context\n );\n if (!aliases) return completeAliasConfiguration();\n return aliases.ok\n ? completeAliasConfiguration(toFirstMatchMap(aliases.aliases.entries))\n : incompleteAliasConfiguration(\n aliases.potentialAliasKeys,\n aliases.potentialAliases\n );\n }\n\n const builtInAliases = readNuxtBuiltInAliases(config, context);\n if (!builtInAliases) return incompleteAliasConfiguration();\n const configuredNuxtAliases = readNestedAliasObject(\n config,\n ['alias'],\n context\n );\n const viteAliases = readNestedAliasObject(\n config,\n ['vite', 'resolve', 'alias'],\n context\n );\n if (configuredNuxtAliases && !configuredNuxtAliases.ok) {\n return incompleteAliasConfiguration(\n collectAliasResolutionKeys(\n builtInAliases,\n configuredNuxtAliases,\n viteAliases\n ),\n collectAliasResolutionCandidates(\n builtInAliases,\n configuredNuxtAliases,\n viteAliases\n )\n );\n }\n if (viteAliases && !viteAliases.ok) {\n return incompleteAliasConfiguration(\n collectAliasResolutionKeys(\n builtInAliases,\n configuredNuxtAliases,\n viteAliases\n ),\n collectAliasResolutionCandidates(\n builtInAliases,\n configuredNuxtAliases,\n viteAliases\n )\n );\n }\n if (\n configuredNuxtAliases?.ok &&\n configuredNuxtAliases.aliases.form !== 'object'\n ) {\n return incompleteAliasConfiguration(\n collectAliasResolutionKeys(\n builtInAliases,\n configuredNuxtAliases,\n viteAliases\n ),\n collectAliasResolutionCandidates(\n builtInAliases,\n configuredNuxtAliases,\n viteAliases\n )\n );\n }\n const nuxtAliases = mergeObjectAliases(\n builtInAliases,\n configuredNuxtAliases?.ok ? configuredNuxtAliases.aliases : undefined\n );\n return completeAliasConfiguration(\n mergeNuxtAliases(\n nuxtAliases,\n viteAliases?.ok ? viteAliases.aliases : undefined\n )\n );\n}\n\nfunction readNuxtBuiltInAliases(\n config: StaticObject,\n context: EvaluationContext\n): StaticAliases | undefined {\n const configuredRoot = config.get('rootDir');\n const rootDirValue = configuredRoot\n ? resolveStaticString(configuredRoot, context, new Set())\n : undefined;\n if (configuredRoot && rootDirValue === undefined) return undefined;\n const rootDir = resolveSafeNuxtDirectory(\n context.packageRoot,\n rootDirValue ?? '.'\n );\n if (!rootDir) return undefined;\n\n const configuredSource = config.get('srcDir');\n const sourceValue = configuredSource\n ? resolveStaticString(configuredSource, context, new Set())\n : undefined;\n if (configuredSource && sourceValue === undefined) return undefined;\n const compatibilityMajor = readNuxtCompatibilityMajor(config, context);\n if (compatibilityMajor === null) return undefined;\n const effectiveNuxtMajor = compatibilityMajor ?? context.nuxtMajorVersion;\n const hasExplicitSource = Boolean(configuredSource && sourceValue);\n if (!hasExplicitSource && effectiveNuxtMajor === undefined) return undefined;\n const srcDir = hasExplicitSource\n ? resolveSafeNuxtDirectory(rootDir, sourceValue!)\n : effectiveNuxtMajor! >= 4\n ? resolveDefaultNuxt4SourceDirectory(rootDir)\n : rootDir;\n if (!srcDir) return undefined;\n\n const sourceAlias = withTrailingSlash(srcDir);\n const rootAlias = withTrailingSlash(rootDir);\n return {\n entries: [\n ['~', sourceAlias],\n ['@', sourceAlias],\n ['~~', rootAlias],\n ['@@', rootAlias],\n ],\n form: 'object',\n };\n}\n\nfunction readNuxtCompatibilityMajor(\n config: StaticObject,\n context: EvaluationContext\n): number | null | undefined {\n const futureEntry = config.get('future');\n if (!futureEntry) return undefined;\n const future = resolveStaticObject(futureEntry, context, new Set(), 'config');\n if (!future) return null;\n const compatibilityEntry = future.get('compatibilityVersion');\n if (!compatibilityEntry) return undefined;\n return resolveStaticInteger(compatibilityEntry, context, new Set()) ?? null;\n}\n\nfunction resolveStaticInteger(\n entry: StaticEntry,\n context: EvaluationContext,\n seen: Set<t.Node>\n): number | undefined {\n const unwrapped = unwrapEntry(entry);\n if (seen.has(unwrapped.node)) return undefined;\n seen.add(unwrapped.node);\n try {\n if (\n unwrapped.node.type === 'NumericLiteral' &&\n Number.isInteger(unwrapped.node.value)\n ) {\n return unwrapped.node.value;\n }\n if (\n unwrapped.node.type === 'StringLiteral' &&\n /^\\d+$/.test(unwrapped.node.value)\n ) {\n return Number(unwrapped.node.value);\n }\n if (unwrapped.node.type !== 'Identifier') return undefined;\n const bound = resolveImmutableBinding(unwrapped, context, 'none');\n return bound ? resolveStaticInteger(bound, context, seen) : undefined;\n } finally {\n seen.delete(unwrapped.node);\n }\n}\n\nfunction resolveSafeNuxtDirectory(\n root: string,\n configuredPath: string\n): string | undefined {\n const candidate = path.resolve(root, configuredPath);\n if (!isInsideDirectory(root, candidate)) return undefined;\n if (path.relative(root, candidate).split(path.sep).includes('node_modules')) {\n return undefined;\n }\n try {\n const realRoot = fs.realpathSync(root);\n let existingAncestor = candidate;\n while (!fs.existsSync(existingAncestor)) {\n const parent = path.dirname(existingAncestor);\n if (parent === existingAncestor) return undefined;\n existingAncestor = parent;\n }\n const realAncestor = fs.realpathSync(existingAncestor);\n const realCandidate = path.resolve(\n realAncestor,\n path.relative(existingAncestor, candidate)\n );\n return isInsideDirectory(realRoot, realCandidate) ? candidate : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction resolveDefaultNuxt4SourceDirectory(rootDir: string): string {\n const appDir = path.join(rootDir, 'app');\n try {\n if (!fs.statSync(appDir).isDirectory()) return rootDir;\n const meaningfulAppEntries = fs\n .readdirSync(appDir)\n .filter(\n (entry) =>\n entry !== 'spa-loading-template.html' &&\n !entry.startsWith('router.options')\n );\n if (meaningfulAppEntries.length > 0) return appDir;\n if (\n [\n 'app.vue',\n 'App.vue',\n 'assets',\n 'layouts',\n 'middleware',\n 'pages',\n 'plugins',\n ]\n .map((entry) => path.join(rootDir, entry))\n .some((entry) => fs.existsSync(entry))\n ) {\n return rootDir;\n }\n return appDir;\n } catch {\n return rootDir;\n }\n}\n\nfunction withTrailingSlash(directory: string): string {\n return `${directory.replaceAll(path.sep, '/')}/`;\n}\n\nfunction readInstalledNuxtMajor(cwd: string): number | undefined {\n try {\n const requireFromProject = createRequire(path.join(cwd, 'package.json'));\n const manifestPath = requireFromProject.resolve('nuxt/package.json');\n const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as {\n version?: unknown;\n };\n if (typeof manifest.version !== 'string') return undefined;\n const major = Number(manifest.version.split('.')[0]);\n return Number.isInteger(major) ? major : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction parseConfig(configFile: string): t.File | undefined {\n try {\n const source = fs.readFileSync(configFile, 'utf8');\n const plugins: ParserPlugin[] = [\n 'decorators-legacy',\n 'typescript',\n 'jsx',\n 'importAttributes',\n ];\n return parse(source, {\n allowAwaitOutsideFunction: true,\n plugins,\n sourceType: 'unambiguous',\n });\n } catch {\n return undefined;\n }\n}\n\nfunction collectAnalysisContext(ast: t.File): {\n helpers: HelperBindings;\n scopes: WeakMap<t.Node, Scope>;\n} {\n const helpers: HelperBindings = {\n configFunctions: new Set(),\n configNamespaces: new Set(),\n fileURLToPathFunctions: new Set(),\n pathNamespaces: new Set(),\n pathResolveFunctions: new Set(),\n urlConstructors: new Set(),\n urlNamespaces: new Set(),\n };\n const scopes = new WeakMap<t.Node, Scope>();\n\n traverse(ast, {\n enter(nodePath) {\n scopes.set(nodePath.node, nodePath.scope);\n },\n ImportDeclaration(importPath) {\n const source = importPath.node.source.value;\n for (const specifierPath of importPath.get('specifiers')) {\n const binding = specifierPath.scope.getBinding(\n specifierPath.node.local.name\n );\n if (!binding || !binding.constant || hasDirectMemberMutation(binding)) {\n continue;\n }\n const importedName =\n specifierPath.node.type === 'ImportSpecifier'\n ? specifierPath.node.imported.type === 'Identifier'\n ? specifierPath.node.imported.name\n : specifierPath.node.imported.value\n : specifierPath.node.type === 'ImportDefaultSpecifier'\n ? 'default'\n : '*';\n registerHelperBinding(helpers, source, importedName, binding);\n }\n },\n VariableDeclarator(variablePath) {\n registerRequireBinding(variablePath, helpers);\n },\n });\n\n return { helpers, scopes };\n}\n\nfunction registerHelperBinding(\n helpers: HelperBindings,\n source: string,\n importedName: string,\n binding: Binding\n): void {\n if (\n source === 'vite' ||\n source === 'nuxt/config' ||\n source === 'nuxt' ||\n source === '#imports'\n ) {\n if (\n importedName === 'defineConfig' ||\n importedName === 'defineNuxtConfig'\n ) {\n helpers.configFunctions.add(binding);\n } else if (importedName === '*' || importedName === 'default') {\n helpers.configNamespaces.add(binding);\n }\n return;\n }\n if (source === 'node:path' || source === 'path') {\n if (importedName === 'resolve') {\n helpers.pathResolveFunctions.add(binding);\n } else if (importedName === '*' || importedName === 'default') {\n helpers.pathNamespaces.add(binding);\n }\n return;\n }\n if (source === 'node:url' || source === 'url') {\n if (importedName === 'fileURLToPath') {\n helpers.fileURLToPathFunctions.add(binding);\n } else if (importedName === 'URL') {\n helpers.urlConstructors.add(binding);\n } else if (importedName === '*' || importedName === 'default') {\n helpers.urlNamespaces.add(binding);\n }\n }\n}\n\nfunction registerRequireBinding(\n variablePath: NodePath<t.VariableDeclarator>,\n helpers: HelperBindings\n): void {\n const source = readRequireSource(variablePath.node.init);\n if (!source) return;\n const idPath = variablePath.get('id');\n if (idPath.isIdentifier()) {\n const binding = idPath.scope.getBinding(idPath.node.name);\n if (!binding || !binding.constant || hasDirectMemberMutation(binding)) {\n return;\n }\n registerHelperBinding(helpers, source, '*', binding);\n return;\n }\n if (!idPath.isObjectPattern()) return;\n for (const propertyPath of idPath.get('properties')) {\n if (!propertyPath.isObjectProperty()) continue;\n const importedName = readPropertyKey(propertyPath.node);\n const valuePath = propertyPath.get('value');\n const localPath = valuePath.isAssignmentPattern()\n ? valuePath.get('left')\n : valuePath;\n if (!importedName || !localPath.isIdentifier()) continue;\n const binding = localPath.scope.getBinding(localPath.node.name);\n if (binding?.constant && !hasDirectMemberMutation(binding)) {\n registerHelperBinding(helpers, source, importedName, binding);\n }\n }\n}\n\nfunction readRequireSource(\n node: t.Expression | null | undefined\n): string | undefined {\n const unwrapped = unwrapNode(node);\n if (\n !unwrapped ||\n unwrapped.type !== 'CallExpression' ||\n unwrapped.callee.type !== 'Identifier' ||\n unwrapped.callee.name !== 'require' ||\n unwrapped.arguments.length !== 1 ||\n unwrapped.arguments[0]?.type !== 'StringLiteral'\n ) {\n return undefined;\n }\n return unwrapped.arguments[0].value;\n}\n\nfunction findActiveConfigExport(ast: t.File): StaticEntry | undefined {\n const candidates: Array<StaticEntry & { start: number }> = [];\n traverse(ast, {\n ExportDefaultDeclaration(exportPath) {\n candidates.push({\n node: exportPath.node.declaration,\n scope: exportPath.scope,\n start: exportPath.node.start ?? -1,\n });\n },\n ExportNamedDeclaration(exportPath) {\n for (const specifierPath of exportPath.get('specifiers')) {\n if (!specifierPath.isExportSpecifier()) continue;\n const exported = specifierPath.node.exported;\n const exportedName =\n exported.type === 'Identifier' ? exported.name : exported.value;\n if (exportedName !== 'default') continue;\n candidates.push({\n node: specifierPath.node.local,\n scope: specifierPath.scope,\n start: exportPath.node.start ?? -1,\n });\n }\n },\n TSExportAssignment(exportPath) {\n candidates.push({\n node: exportPath.node.expression,\n scope: exportPath.scope,\n start: exportPath.node.start ?? -1,\n });\n },\n AssignmentExpression(assignmentPath) {\n if (!isCommonJsConfigExport(assignmentPath.node.left)) return;\n candidates.push({\n node: assignmentPath.node.right,\n scope: assignmentPath.scope,\n start: assignmentPath.node.start ?? -1,\n });\n },\n });\n candidates.sort((left, right) => left.start - right.start);\n return candidates.at(-1);\n}\n\nfunction isCommonJsConfigExport(\n node: t.LVal | t.OptionalMemberExpression\n): boolean {\n if (node.type !== 'MemberExpression' || node.computed) return false;\n if (\n node.object.type === 'Identifier' &&\n node.property.type === 'Identifier'\n ) {\n return (\n (node.object.name === 'module' && node.property.name === 'exports') ||\n (node.object.name === 'exports' && node.property.name === 'default')\n );\n }\n if (\n node.object.type === 'MemberExpression' &&\n !node.object.computed &&\n node.object.object.type === 'Identifier' &&\n node.object.object.name === 'module' &&\n node.object.property.type === 'Identifier' &&\n node.object.property.name === 'exports' &&\n node.property.type === 'Identifier' &&\n node.property.name === 'default'\n ) {\n return true;\n }\n return false;\n}\n\nfunction resolveConfigRoot(\n entry: StaticEntry,\n context: EvaluationContext,\n seen: Set<t.Node>\n): StaticEntry | undefined {\n const unwrapped = unwrapEntry(entry);\n if (seen.has(unwrapped.node)) return undefined;\n seen.add(unwrapped.node);\n try {\n if (unwrapped.node.type === 'Identifier') {\n const bound = resolveImmutableBinding(unwrapped, context, 'config');\n return bound ? resolveConfigRoot(bound, context, seen) : undefined;\n }\n if (\n unwrapped.node.type === 'CallExpression' ||\n unwrapped.node.type === 'OptionalCallExpression'\n ) {\n if (!isConfigHelperCall(unwrapped, context.helpers)) return undefined;\n const argument = unwrapped.node.arguments[0];\n if (\n !argument ||\n argument.type === 'SpreadElement' ||\n argument.type === 'ArgumentPlaceholder'\n ) {\n return undefined;\n }\n return resolveConfigRoot(\n scopedEntry(argument, unwrapped.scope, context),\n context,\n seen\n );\n }\n if (\n unwrapped.node.type === 'ArrowFunctionExpression' ||\n unwrapped.node.type === 'FunctionExpression' ||\n unwrapped.node.type === 'FunctionDeclaration'\n ) {\n const returned = readStaticFunctionReturn(unwrapped, context);\n return returned ? resolveConfigRoot(returned, context, seen) : undefined;\n }\n return unwrapped;\n } finally {\n seen.delete(unwrapped.node);\n }\n}\n\nfunction isConfigHelperCall(\n entry: StaticEntry,\n helpers: HelperBindings\n): boolean {\n if (\n entry.node.type !== 'CallExpression' &&\n entry.node.type !== 'OptionalCallExpression'\n ) {\n return false;\n }\n const callee = unwrapNode(entry.node.callee);\n if (!callee) return false;\n if (callee.type === 'Identifier') {\n const binding = entry.scope.getBinding(callee.name);\n return binding\n ? helpers.configFunctions.has(binding)\n : callee.name === 'defineConfig' || callee.name === 'defineNuxtConfig';\n }\n if (\n callee.type === 'MemberExpression' &&\n !callee.computed &&\n callee.object.type === 'Identifier' &&\n callee.property.type === 'Identifier' &&\n (callee.property.name === 'defineConfig' ||\n callee.property.name === 'defineNuxtConfig')\n ) {\n const binding = entry.scope.getBinding(callee.object.name);\n return Boolean(binding && helpers.configNamespaces.has(binding));\n }\n return false;\n}\n\nfunction readStaticFunctionReturn(\n entry: StaticEntry,\n context: EvaluationContext\n): StaticEntry | undefined {\n if (\n entry.node.type !== 'ArrowFunctionExpression' &&\n entry.node.type !== 'FunctionExpression' &&\n entry.node.type !== 'FunctionDeclaration'\n ) {\n return undefined;\n }\n if (entry.node.body.type !== 'BlockStatement') {\n return scopedEntry(entry.node.body, entry.scope, context);\n }\n const returns = entry.node.body.body.filter(\n (statement): statement is t.ReturnStatement =>\n statement.type === 'ReturnStatement' && Boolean(statement.argument)\n );\n if (returns.length !== 1 || !returns[0]!.argument) return undefined;\n return scopedEntry(returns[0]!.argument, entry.scope, context);\n}\n\nfunction readNestedAliasObject(\n root: StaticObject,\n keys: readonly string[],\n context: EvaluationContext\n): AliasResolution | undefined {\n let entry: StaticEntry | undefined;\n let object = root;\n for (const [index, key] of keys.entries()) {\n entry = object.get(key);\n if (!entry) return undefined;\n if (isDefinitelyAbsentAliasValue(entry, context, new Set())) {\n return undefined;\n }\n if (index === keys.length - 1) break;\n const nested = resolveStaticObject(entry, context, new Set(), 'config');\n if (!nested) {\n return {\n ok: false,\n potentialAliasKeys: new Set(),\n potentialAliases: new Map(),\n };\n }\n object = nested;\n }\n return entry ? readAliasValue(entry, context) : undefined;\n}\n\nfunction isDefinitelyAbsentAliasValue(\n entry: StaticEntry,\n context: EvaluationContext,\n seen: Set<t.Node>\n): boolean {\n const unwrapped = unwrapEntry(entry);\n if (seen.has(unwrapped.node)) return false;\n seen.add(unwrapped.node);\n try {\n if (unwrapped.node.type === 'NullLiteral') return true;\n if (unwrapped.node.type === 'BooleanLiteral' && !unwrapped.node.value) {\n return true;\n }\n if (\n unwrapped.node.type === 'Identifier' &&\n unwrapped.node.name === 'undefined' &&\n !unwrapped.scope.getBinding('undefined')\n ) {\n return true;\n }\n if (\n unwrapped.node.type === 'UnaryExpression' &&\n unwrapped.node.operator === 'void'\n ) {\n return true;\n }\n if (unwrapped.node.type !== 'Identifier') return false;\n const bound = resolveImmutableBinding(unwrapped, context, 'none');\n return bound ? isDefinitelyAbsentAliasValue(bound, context, seen) : false;\n } finally {\n seen.delete(unwrapped.node);\n }\n}\n\nfunction readAliasValue(\n entry: StaticEntry,\n context: EvaluationContext\n): AliasResolution {\n const potentialAliasKeys = collectPotentialAliasKeys(\n entry,\n context,\n new Set()\n );\n const potentialAliases = collectPotentialAliases(entry, context, new Set());\n const object = resolveStaticObject(entry, context, new Set(), 'alias');\n if (object) {\n const entries: Array<readonly [string, string]> = [];\n for (const [find, replacementEntry] of object) {\n const replacement = resolveStaticString(\n replacementEntry,\n context,\n new Set()\n );\n if (replacement === undefined) {\n return { ok: false, potentialAliasKeys, potentialAliases };\n }\n entries.push([find, replacement]);\n }\n return { ok: true, aliases: { entries, form: 'object' } };\n }\n\n const entries = resolveStaticArray(entry, context, new Set(), 'alias');\n if (!entries) {\n return { ok: false, potentialAliasKeys, potentialAliases };\n }\n const arrayAliases = new Map<string, string>();\n for (const item of entries) {\n const aliasObject = resolveStaticObject(item, context, new Set(), 'alias');\n if (!aliasObject || aliasObject.has('customResolver')) {\n return { ok: false, potentialAliasKeys, potentialAliases };\n }\n const findEntry = aliasObject.get('find');\n const replacementEntry = aliasObject.get('replacement');\n if (!findEntry || !replacementEntry) {\n return { ok: false, potentialAliasKeys, potentialAliases };\n }\n const find = resolveStaticString(findEntry, context, new Set());\n const replacement = resolveStaticString(\n replacementEntry,\n context,\n new Set()\n );\n if (find === undefined || replacement === undefined) {\n return { ok: false, potentialAliasKeys, potentialAliases };\n }\n if (!arrayAliases.has(find)) arrayAliases.set(find, replacement);\n }\n return {\n ok: true,\n aliases: { entries: [...arrayAliases], form: 'array' },\n };\n}\n\n/** Collects only fully static key-to-replacement candidates. */\nfunction collectPotentialAliases(\n entry: StaticEntry,\n context: EvaluationContext,\n seen: Set<t.Node>\n): Map<string, Set<string>> {\n const unwrapped = unwrapEntry(entry);\n if (seen.has(unwrapped.node)) return new Map();\n seen.add(unwrapped.node);\n try {\n if (unwrapped.node.type === 'Identifier') {\n const bound = resolveImmutableBinding(unwrapped, context, 'none');\n return bound ? collectPotentialAliases(bound, context, seen) : new Map();\n }\n if (unwrapped.node.type === 'ObjectExpression') {\n const aliases = new Map<string, Set<string>>();\n for (const property of unwrapped.node.properties) {\n if (property.type === 'SpreadElement') {\n mergePotentialAliases(\n aliases,\n collectPotentialAliases(\n scopedEntry(property.argument, unwrapped.scope, context),\n context,\n seen\n )\n );\n continue;\n }\n if (property.type !== 'ObjectProperty') continue;\n const find = readPropertyKey(property);\n if (find === undefined) continue;\n const replacement = resolveStaticString(\n scopedEntry(property.value, unwrapped.scope, context),\n context,\n new Set()\n );\n if (replacement !== undefined) {\n addPotentialAlias(aliases, find, replacement);\n }\n }\n return aliases;\n }\n if (unwrapped.node.type === 'ArrayExpression') {\n const aliases = new Map<string, Set<string>>();\n for (const element of unwrapped.node.elements) {\n if (!element) continue;\n if (element.type === 'SpreadElement') {\n mergePotentialAliases(\n aliases,\n collectPotentialAliases(\n scopedEntry(element.argument, unwrapped.scope, context),\n context,\n seen\n )\n );\n continue;\n }\n const item = scopedEntry(element, unwrapped.scope, context);\n const aliasObject = resolveStaticObject(\n item,\n context,\n new Set(),\n 'none'\n );\n const findEntry = aliasObject?.get('find');\n const replacementEntry = aliasObject?.get('replacement');\n if (!findEntry || !replacementEntry) continue;\n const find = resolveStaticString(findEntry, context, new Set());\n const replacement = resolveStaticString(\n replacementEntry,\n context,\n new Set()\n );\n if (find !== undefined && replacement !== undefined) {\n addPotentialAlias(aliases, find, replacement);\n }\n }\n return aliases;\n }\n return new Map();\n } finally {\n seen.delete(unwrapped.node);\n }\n}\n\n/**\n * Collects statically visible alias keys without claiming that their final\n * replacement or precedence is known. Dynamic spreads and overrides can make\n * the full alias surface incomplete, but the observed keys remain useful as\n * narrowly scoped evidence that an import may belong to the Vue project.\n */\nfunction collectPotentialAliasKeys(\n entry: StaticEntry,\n context: EvaluationContext,\n seen: Set<t.Node>\n): Set<string> {\n const unwrapped = unwrapEntry(entry);\n if (seen.has(unwrapped.node)) return new Set();\n seen.add(unwrapped.node);\n try {\n if (unwrapped.node.type === 'Identifier') {\n const bound = resolveImmutableBinding(unwrapped, context, 'none');\n return bound\n ? collectPotentialAliasKeys(bound, context, seen)\n : new Set();\n }\n if (unwrapped.node.type === 'ObjectExpression') {\n const keys = new Set<string>();\n for (const property of unwrapped.node.properties) {\n if (property.type === 'SpreadElement') {\n addAll(\n keys,\n collectPotentialAliasKeys(\n scopedEntry(property.argument, unwrapped.scope, context),\n context,\n seen\n )\n );\n continue;\n }\n if (\n property.type !== 'ObjectProperty' &&\n property.type !== 'ObjectMethod'\n ) {\n continue;\n }\n const key = readPropertyKey(property);\n if (key !== undefined) keys.add(key);\n }\n return keys;\n }\n if (unwrapped.node.type === 'ArrayExpression') {\n const keys = new Set<string>();\n for (const element of unwrapped.node.elements) {\n if (!element) continue;\n if (element.type === 'SpreadElement') {\n addAll(\n keys,\n collectPotentialAliasKeys(\n scopedEntry(element.argument, unwrapped.scope, context),\n context,\n seen\n )\n );\n continue;\n }\n addAll(\n keys,\n collectPotentialArrayAliasKeys(\n scopedEntry(element, unwrapped.scope, context),\n context,\n seen\n )\n );\n }\n return keys;\n }\n return new Set();\n } finally {\n seen.delete(unwrapped.node);\n }\n}\n\nfunction collectPotentialArrayAliasKeys(\n entry: StaticEntry,\n context: EvaluationContext,\n seen: Set<t.Node>\n): Set<string> {\n const unwrapped = unwrapEntry(entry);\n if (seen.has(unwrapped.node)) return new Set();\n seen.add(unwrapped.node);\n try {\n if (unwrapped.node.type === 'Identifier') {\n const bound = resolveImmutableBinding(unwrapped, context, 'none');\n return bound\n ? collectPotentialArrayAliasKeys(bound, context, seen)\n : new Set();\n }\n if (unwrapped.node.type !== 'ObjectExpression') return new Set();\n const keys = new Set<string>();\n for (const property of unwrapped.node.properties) {\n if (property.type === 'SpreadElement') {\n addAll(\n keys,\n collectPotentialArrayAliasKeys(\n scopedEntry(property.argument, unwrapped.scope, context),\n context,\n seen\n )\n );\n continue;\n }\n if (\n property.type !== 'ObjectProperty' ||\n readPropertyKey(property) !== 'find'\n ) {\n continue;\n }\n const find = resolveStaticString(\n scopedEntry(property.value, unwrapped.scope, context),\n context,\n new Set()\n );\n if (find !== undefined) keys.add(find);\n }\n return keys;\n } finally {\n seen.delete(unwrapped.node);\n }\n}\n\nfunction addAll(target: Set<string>, values: Iterable<string>): void {\n for (const value of values) target.add(value);\n}\n\nfunction addPotentialAlias(\n target: Map<string, Set<string>>,\n find: string,\n replacement: string\n): void {\n const replacements = target.get(find) ?? new Set<string>();\n replacements.add(replacement);\n target.set(find, replacements);\n}\n\nfunction mergePotentialAliases(\n target: Map<string, Set<string>>,\n source: ReadonlyMap<string, ReadonlySet<string>>\n): void {\n for (const [find, replacements] of source) {\n for (const replacement of replacements) {\n addPotentialAlias(target, find, replacement);\n }\n }\n}\n\nfunction clonePotentialAliases(\n aliases: ReadonlyMap<string, ReadonlySet<string>>\n): Map<string, Set<string>> {\n const clone = new Map<string, Set<string>>();\n mergePotentialAliases(clone, aliases);\n return clone;\n}\n\nfunction resolveStaticObject(\n entry: StaticEntry,\n context: EvaluationContext,\n seen: Set<t.Node>,\n bindingSafety: BindingSafety\n): StaticObject | undefined {\n const unwrapped = unwrapEntry(entry);\n if (seen.has(unwrapped.node)) return undefined;\n seen.add(unwrapped.node);\n try {\n if (unwrapped.node.type === 'Identifier') {\n const bound = resolveImmutableBinding(unwrapped, context, bindingSafety);\n return bound\n ? resolveStaticObject(bound, context, seen, bindingSafety)\n : undefined;\n }\n if (unwrapped.node.type !== 'ObjectExpression') return undefined;\n const object: StaticObject = new Map();\n for (const property of unwrapped.node.properties) {\n if (property.type === 'SpreadElement') {\n const spread = resolveStaticObject(\n scopedEntry(property.argument, unwrapped.scope, context),\n context,\n seen,\n bindingSafety\n );\n if (!spread) return undefined;\n for (const pair of spread) object.set(...pair);\n continue;\n }\n if (\n property.type !== 'ObjectProperty' &&\n property.type !== 'ObjectMethod'\n ) {\n continue;\n }\n const key = readPropertyKey(property);\n if (key === undefined) return undefined;\n object.set(\n key,\n scopedEntry(\n property.type === 'ObjectProperty' ? property.value : property,\n unwrapped.scope,\n context\n )\n );\n }\n return object;\n } finally {\n seen.delete(unwrapped.node);\n }\n}\n\nfunction resolveStaticArray(\n entry: StaticEntry,\n context: EvaluationContext,\n seen: Set<t.Node>,\n bindingSafety: BindingSafety\n): StaticEntry[] | undefined {\n const unwrapped = unwrapEntry(entry);\n if (seen.has(unwrapped.node)) return undefined;\n seen.add(unwrapped.node);\n try {\n if (unwrapped.node.type === 'Identifier') {\n const bound = resolveImmutableBinding(unwrapped, context, bindingSafety);\n return bound\n ? resolveStaticArray(bound, context, seen, bindingSafety)\n : undefined;\n }\n if (unwrapped.node.type !== 'ArrayExpression') return undefined;\n const result: StaticEntry[] = [];\n for (const element of unwrapped.node.elements) {\n if (!element) continue;\n if (element.type === 'SpreadElement') {\n const spread = resolveStaticArray(\n scopedEntry(element.argument, unwrapped.scope, context),\n context,\n seen,\n bindingSafety\n );\n if (!spread) return undefined;\n result.push(...spread);\n continue;\n }\n result.push(scopedEntry(element, unwrapped.scope, context));\n }\n return result;\n } finally {\n seen.delete(unwrapped.node);\n }\n}\n\nfunction resolveStaticString(\n entry: StaticEntry,\n context: EvaluationContext,\n seen: Set<t.Node>\n): string | undefined {\n const unwrapped = unwrapEntry(entry);\n if (seen.has(unwrapped.node)) return undefined;\n seen.add(unwrapped.node);\n try {\n const node = unwrapped.node;\n if (node.type === 'StringLiteral') return node.value;\n if (node.type === 'Identifier') {\n if (node.name === '__dirname' && !unwrapped.scope.getBinding(node.name)) {\n return path.dirname(context.configFile);\n }\n const bound = resolveImmutableBinding(unwrapped, context, 'none');\n return bound ? resolveStaticString(bound, context, seen) : undefined;\n }\n if (node.type === 'TemplateLiteral') {\n let value = node.quasis[0]?.value.cooked ?? '';\n for (const [index, expression] of node.expressions.entries()) {\n const resolved = resolveStaticString(\n scopedEntry(expression, unwrapped.scope, context),\n context,\n seen\n );\n if (resolved === undefined) return undefined;\n value += resolved + (node.quasis[index + 1]?.value.cooked ?? '');\n }\n return value;\n }\n if (node.type === 'BinaryExpression' && node.operator === '+') {\n const left = resolveStaticString(\n scopedEntry(node.left, unwrapped.scope, context),\n context,\n seen\n );\n const right = resolveStaticString(\n scopedEntry(node.right, unwrapped.scope, context),\n context,\n seen\n );\n return left === undefined || right === undefined\n ? undefined\n : left + right;\n }\n if (\n node.type === 'CallExpression' ||\n node.type === 'OptionalCallExpression'\n ) {\n if (isPathResolveCall(unwrapped, context.helpers)) {\n const parts: string[] = [];\n for (const argument of node.arguments) {\n if (\n argument.type === 'SpreadElement' ||\n argument.type === 'ArgumentPlaceholder'\n ) {\n return undefined;\n }\n const part = resolveStaticString(\n scopedEntry(argument, unwrapped.scope, context),\n context,\n seen\n );\n if (part === undefined) return undefined;\n parts.push(part);\n }\n if (parts.length === 0 || !path.isAbsolute(parts[0]!)) {\n return undefined;\n }\n return path.resolve(...parts);\n }\n if (isFileURLToPathCall(unwrapped, context.helpers)) {\n const argument = node.arguments[0];\n if (\n !argument ||\n argument.type === 'SpreadElement' ||\n argument.type === 'ArgumentPlaceholder'\n ) {\n return undefined;\n }\n const url = resolveStaticUrl(\n scopedEntry(argument, unwrapped.scope, context),\n context,\n seen\n );\n if (!url || url.protocol !== 'file:') return undefined;\n return fileURLToPath(url);\n }\n }\n if (\n node.type === 'MemberExpression' &&\n !node.computed &&\n node.object.type === 'MetaProperty' &&\n node.object.meta.name === 'import' &&\n node.object.property.name === 'meta' &&\n node.property.type === 'Identifier' &&\n node.property.name === 'dirname'\n ) {\n return path.dirname(context.configFile);\n }\n return undefined;\n } finally {\n seen.delete(unwrapped.node);\n }\n}\n\nfunction resolveStaticUrl(\n entry: StaticEntry,\n context: EvaluationContext,\n seen: Set<t.Node>\n): URL | undefined {\n const unwrapped = unwrapEntry(entry);\n if (seen.has(unwrapped.node)) return undefined;\n seen.add(unwrapped.node);\n try {\n if (unwrapped.node.type === 'Identifier') {\n const bound = resolveImmutableBinding(unwrapped, context, 'none');\n return bound ? resolveStaticUrl(bound, context, seen) : undefined;\n }\n if (\n unwrapped.node.type !== 'NewExpression' ||\n unwrapped.node.callee.type !== 'Identifier' ||\n unwrapped.node.callee.name !== 'URL' ||\n !isTrustedUrlConstructor(unwrapped, context.helpers) ||\n unwrapped.node.arguments.length !== 2\n ) {\n return undefined;\n }\n const [relativeArgument, baseArgument] = unwrapped.node.arguments;\n if (\n !relativeArgument ||\n relativeArgument.type === 'SpreadElement' ||\n relativeArgument.type === 'ArgumentPlaceholder' ||\n !baseArgument ||\n baseArgument.type === 'SpreadElement' ||\n baseArgument.type === 'ArgumentPlaceholder' ||\n !isImportMetaUrl(baseArgument)\n ) {\n return undefined;\n }\n const relative = resolveStaticString(\n scopedEntry(relativeArgument, unwrapped.scope, context),\n context,\n seen\n );\n if (relative === undefined) return undefined;\n return new URL(relative, pathToFileURL(context.configFile));\n } catch {\n return undefined;\n } finally {\n seen.delete(unwrapped.node);\n }\n}\n\n/** Accepts the global URL constructor and immutable imports from node:url. */\nfunction isTrustedUrlConstructor(\n entry: StaticEntry,\n helpers: HelperBindings\n): boolean {\n if (\n entry.node.type !== 'NewExpression' ||\n entry.node.callee.type !== 'Identifier' ||\n entry.node.callee.name !== 'URL'\n ) {\n return false;\n }\n const binding = entry.scope.getBinding(entry.node.callee.name);\n return binding === undefined || helpers.urlConstructors.has(binding);\n}\n\nfunction isPathResolveCall(\n entry: StaticEntry,\n helpers: HelperBindings\n): boolean {\n if (\n entry.node.type !== 'CallExpression' &&\n entry.node.type !== 'OptionalCallExpression'\n ) {\n return false;\n }\n const callee = unwrapNode(entry.node.callee);\n if (!callee) return false;\n if (callee.type === 'Identifier') {\n const binding = entry.scope.getBinding(callee.name);\n return Boolean(binding && helpers.pathResolveFunctions.has(binding));\n }\n if (\n callee.type === 'MemberExpression' &&\n !callee.computed &&\n callee.object.type === 'Identifier' &&\n callee.property.type === 'Identifier' &&\n callee.property.name === 'resolve'\n ) {\n const binding = entry.scope.getBinding(callee.object.name);\n return Boolean(binding && helpers.pathNamespaces.has(binding));\n }\n return false;\n}\n\nfunction isFileURLToPathCall(\n entry: StaticEntry,\n helpers: HelperBindings\n): boolean {\n if (\n entry.node.type !== 'CallExpression' &&\n entry.node.type !== 'OptionalCallExpression'\n ) {\n return false;\n }\n const callee = unwrapNode(entry.node.callee);\n if (!callee) return false;\n if (callee.type === 'Identifier') {\n const binding = entry.scope.getBinding(callee.name);\n return Boolean(binding && helpers.fileURLToPathFunctions.has(binding));\n }\n if (\n callee.type === 'MemberExpression' &&\n !callee.computed &&\n callee.object.type === 'Identifier' &&\n callee.property.type === 'Identifier' &&\n callee.property.name === 'fileURLToPath'\n ) {\n const binding = entry.scope.getBinding(callee.object.name);\n return Boolean(binding && helpers.urlNamespaces.has(binding));\n }\n return false;\n}\n\nfunction isImportMetaUrl(node: t.Node): boolean {\n const unwrapped = unwrapNode(node);\n return Boolean(\n unwrapped &&\n unwrapped.type === 'MemberExpression' &&\n !unwrapped.computed &&\n unwrapped.object.type === 'MetaProperty' &&\n unwrapped.object.meta.name === 'import' &&\n unwrapped.object.property.name === 'meta' &&\n unwrapped.property.type === 'Identifier' &&\n unwrapped.property.name === 'url'\n );\n}\n\nfunction resolveImmutableBinding(\n entry: StaticEntry,\n context: EvaluationContext,\n safety: BindingSafety\n): StaticEntry | undefined {\n if (entry.node.type !== 'Identifier') return undefined;\n const binding = entry.scope.getBinding(entry.node.name);\n if (\n !binding ||\n binding.kind !== 'const' ||\n !binding.constant ||\n binding.constantViolations.length > 0 ||\n !binding.path.isVariableDeclarator() ||\n hasDirectMemberMutation(binding) ||\n (safety === 'alias' &&\n hasUnsafeAliasBindingUse(binding, context, new Set())) ||\n (safety === 'config' &&\n !isSafeConfigBinding(binding, context, new Set())) ||\n !binding.path.node.init\n ) {\n return undefined;\n }\n return scopedEntry(binding.path.node.init, binding.path.scope, context);\n}\n\nfunction hasUnsafeAliasBindingUse(\n binding: Binding,\n context: EvaluationContext,\n seen: Set<Binding>\n): boolean {\n if (seen.has(binding)) return false;\n seen.add(binding);\n try {\n return binding.referencePaths.some((referencePath) => {\n let targetPath = unwrapReferencePath(referencePath);\n while (\n (targetPath.parentPath?.isMemberExpression() ||\n targetPath.parentPath?.isOptionalMemberExpression()) &&\n targetPath.parentPath.node.object === targetPath.node\n ) {\n targetPath = targetPath.parentPath;\n }\n const parentPath = targetPath.parentPath;\n if (!parentPath) return true;\n if (parentPath.isAssignmentExpression()) return true;\n if (parentPath.isUpdateExpression()) return true;\n if (parentPath.isUnaryExpression({ operator: 'delete' })) return true;\n if (\n parentPath.isCallExpression() ||\n parentPath.isOptionalCallExpression()\n ) {\n if (parentPath.node.callee === targetPath.node) return true;\n return !isConfigHelperCall(\n { node: parentPath.node, scope: parentPath.scope },\n context.helpers\n );\n }\n if (parentPath.isSpreadElement()) {\n return !isSafeConfigValuePath(parentPath.parentPath, context, seen);\n }\n if (parentPath.isObjectProperty()) {\n return !(\n parentPath.node.value === targetPath.node &&\n readPropertyKey(parentPath.node) === 'alias' &&\n isSafeConfigValuePath(parentPath.parentPath, context, seen)\n );\n }\n if (parentPath.isArrayExpression()) {\n return !isSafeConfigValuePath(parentPath, context, seen);\n }\n if (parentPath.isVariableDeclarator()) {\n if (\n parentPath.node.init !== targetPath.node ||\n parentPath.node.id.type !== 'Identifier' ||\n !parentPath.parentPath?.isVariableDeclaration({ kind: 'const' })\n ) {\n return true;\n }\n const aliasBinding = parentPath.scope.getBinding(\n parentPath.node.id.name\n );\n return (\n !aliasBinding || hasUnsafeAliasBindingUse(aliasBinding, context, seen)\n );\n }\n return true;\n });\n } finally {\n seen.delete(binding);\n }\n}\n\nfunction hasDirectMemberMutation(binding: Binding): boolean {\n return binding.referencePaths.some((referencePath) => {\n let targetPath = unwrapReferencePath(referencePath);\n while (\n (targetPath.parentPath?.isMemberExpression() ||\n targetPath.parentPath?.isOptionalMemberExpression()) &&\n targetPath.parentPath.node.object === targetPath.node\n ) {\n targetPath = targetPath.parentPath;\n }\n const parentPath = targetPath.parentPath;\n return Boolean(\n parentPath &&\n (parentPath.isAssignmentExpression() ||\n parentPath.isUpdateExpression() ||\n parentPath.isUnaryExpression({ operator: 'delete' }))\n );\n });\n}\n\nfunction isSafeConfigValuePath(\n inputPath: NodePath | null,\n context: EvaluationContext,\n seen: Set<Binding>\n): boolean {\n if (!inputPath) return false;\n const targetPath = unwrapReferencePath(inputPath);\n const parentPath = targetPath.parentPath;\n if (!parentPath) return false;\n if (parentPath.isObjectProperty()) {\n if (parentPath.node.value !== targetPath.node) return false;\n return isSafeConfigValuePath(parentPath.parentPath, context, seen);\n }\n if (parentPath.isSpreadElement()) {\n return isSafeConfigValuePath(parentPath.parentPath, context, seen);\n }\n if (parentPath.isArrowFunctionExpression()) {\n if (parentPath.node.body !== targetPath.node) return false;\n return isSafeConfigValuePath(parentPath, context, seen);\n }\n if (parentPath.isReturnStatement()) {\n const functionScope = parentPath.scope.getFunctionParent();\n return functionScope\n ? isSafeConfigValuePath(functionScope.path, context, seen)\n : false;\n }\n if (parentPath.isVariableDeclarator()) {\n if (\n parentPath.node.init !== targetPath.node ||\n parentPath.node.id.type !== 'Identifier' ||\n !parentPath.parentPath?.isVariableDeclaration({ kind: 'const' })\n ) {\n return false;\n }\n const binding = parentPath.scope.getBinding(parentPath.node.id.name);\n return binding ? isSafeConfigBinding(binding, context, seen) : false;\n }\n if (parentPath.isCallExpression() || parentPath.isOptionalCallExpression()) {\n if (!parentPath.node.arguments.includes(targetPath.node as t.Expression)) {\n return false;\n }\n return isConfigHelperCall(\n { node: parentPath.node, scope: parentPath.scope },\n context.helpers\n );\n }\n if (parentPath.isExportDefaultDeclaration()) return true;\n if (parentPath.isExportSpecifier()) {\n const exported = parentPath.node.exported;\n return (\n (exported.type === 'Identifier' ? exported.name : exported.value) ===\n 'default'\n );\n }\n if (parentPath.isAssignmentExpression()) {\n return (\n parentPath.node.right === targetPath.node &&\n isCommonJsConfigExport(parentPath.node.left)\n );\n }\n return false;\n}\n\nfunction isSafeConfigBinding(\n binding: Binding,\n context: EvaluationContext,\n seen: Set<Binding>\n): boolean {\n if (seen.has(binding)) return true;\n if (\n binding.kind !== 'const' ||\n !binding.constant ||\n binding.constantViolations.length > 0\n ) {\n return false;\n }\n seen.add(binding);\n try {\n return binding.referencePaths.every((referencePath) =>\n isSafeConfigValuePath(referencePath, context, seen)\n );\n } finally {\n seen.delete(binding);\n }\n}\n\nfunction unwrapReferencePath(referencePath: NodePath): NodePath {\n let targetPath = referencePath;\n while (\n targetPath.parentPath &&\n isTransparentExpression(targetPath.parentPath.node) &&\n targetPath.parentPath.node.expression === targetPath.node\n ) {\n targetPath = targetPath.parentPath;\n }\n return targetPath;\n}\n\nfunction isTransparentExpression(\n node: t.Node\n): node is\n | t.TSAsExpression\n | t.TSSatisfiesExpression\n | t.TSNonNullExpression\n | t.TypeCastExpression\n | t.ParenthesizedExpression\n | t.TSInstantiationExpression {\n return (\n node.type === 'TSAsExpression' ||\n node.type === 'TSSatisfiesExpression' ||\n node.type === 'TSNonNullExpression' ||\n node.type === 'TypeCastExpression' ||\n node.type === 'ParenthesizedExpression' ||\n node.type === 'TSInstantiationExpression'\n );\n}\n\nfunction scopedEntry(\n node: t.Node,\n fallbackScope: Scope,\n context: EvaluationContext\n): StaticEntry {\n return { node, scope: context.scopes.get(node) ?? fallbackScope };\n}\n\nfunction toFirstMatchMap(\n entries: readonly (readonly [string, string])[]\n): Map<string, string> {\n const aliases = new Map<string, string>();\n for (const [find, replacement] of entries) {\n if (!aliases.has(find)) aliases.set(find, replacement);\n }\n return aliases;\n}\n\nfunction mergeObjectAliases(\n defaults: StaticAliases,\n overrides: StaticAliases | undefined\n): StaticAliases {\n if (!overrides) return defaults;\n const entries = new Map(defaults.entries);\n for (const [find, replacement] of overrides.entries) {\n entries.set(find, replacement);\n }\n return { entries: [...entries], form: 'object' };\n}\n\n/**\n * Mirrors Vite's mergeAlias behavior used by Nuxt. Two object forms merge in\n * property order with nested `vite.resolve.alias` values overriding duplicate\n * Nuxt aliases. If either side is an array, nested Vite aliases are prepended\n * because Vite resolves array aliases from first to last.\n */\nfunction mergeNuxtAliases(\n nuxtAliases: StaticAliases | undefined,\n viteAliases: StaticAliases | undefined\n): Map<string, string> {\n if (!nuxtAliases) return toFirstMatchMap(viteAliases?.entries ?? []);\n if (!viteAliases) return toFirstMatchMap(nuxtAliases.entries);\n if (nuxtAliases.form === 'object' && viteAliases.form === 'object') {\n const merged = new Map(nuxtAliases.entries);\n for (const [find, replacement] of viteAliases.entries) {\n merged.set(find, replacement);\n }\n return merged;\n }\n return toFirstMatchMap([...viteAliases.entries, ...nuxtAliases.entries]);\n}\n\nfunction readPropertyKey(\n property: t.ObjectMethod | t.ObjectProperty\n): string | undefined {\n if (!property.computed && property.key.type === 'Identifier') {\n return property.key.name;\n }\n if (property.key.type === 'StringLiteral') return property.key.value;\n if (property.key.type === 'NumericLiteral') return String(property.key.value);\n return undefined;\n}\n\nfunction unwrapEntry(entry: StaticEntry): StaticEntry {\n return { node: unwrapNode(entry.node) ?? entry.node, scope: entry.scope };\n}\n\nfunction unwrapNode(node: t.Node | null | undefined): t.Node | undefined {\n let current = node;\n while (current) {\n if (isTransparentExpression(current)) {\n current = current.expression;\n continue;\n }\n break;\n }\n return current ?? undefined;\n}\n"],"mappings":";;;;;;;;AAiBA,MAAM,WAAW,eAAe,WAAW;;;;;;;;AAyF3C,SAAgB,yBACd,K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iC;AACpD,QAAO;EAAE,MAAM,WAAW,MAAM,KAAK,IAAI,MAAM;EAAM,OAAO,MAAM;EAAO;;AAG3E,SAAS,WAAW,MAAqD;CACvE,IAAI,UAAU;AACd,QAAO,SAAS;AACd,MAAI,wBAAwB,QAAQ,EAAE;AACpC,aAAU,QAAQ;AAClB;;AAEF;;AAEF,QAAO,WAAW,KAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Classification shared by source partitioning and lightweight ownership. */
|
|
2
|
+
export type VueSourceClassification = 'definitive-sfc' | 'ambiguous-standard-tag-jsx' | 'non-sfc';
|
|
3
|
+
/**
|
|
4
|
+
* Distinguishes a conventional SFC from a script module named with `.vue`.
|
|
5
|
+
*
|
|
6
|
+
* Vue tolerates arbitrary text before its first block, but treating every such
|
|
7
|
+
* file as an SFC would hide Babel-valid legacy modules from the existing
|
|
8
|
+
* parser. A complete JavaScript module wins even when its first JSX expression
|
|
9
|
+
* uses a standard SFC tag; lone standard-tag expressions remain Vue blocks.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isVueSfcSource(source: string): boolean;
|
|
12
|
+
/** Classifies standard-tag JSX separately from unambiguous Vue SFC source. */
|
|
13
|
+
export declare function classifyVueSource(source: string): VueSourceClassification;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { parseScriptAst } from "../script/parser.js";
|
|
2
|
+
//#region src/internal/project/vueSourceClassification.ts
|
|
3
|
+
const STANDARD_SFC_BLOCKS = new Set([
|
|
4
|
+
"template",
|
|
5
|
+
"script",
|
|
6
|
+
"style"
|
|
7
|
+
]);
|
|
8
|
+
/**
|
|
9
|
+
* Distinguishes a conventional SFC from a script module named with `.vue`.
|
|
10
|
+
*
|
|
11
|
+
* Vue tolerates arbitrary text before its first block, but treating every such
|
|
12
|
+
* file as an SFC would hide Babel-valid legacy modules from the existing
|
|
13
|
+
* parser. A complete JavaScript module wins even when its first JSX expression
|
|
14
|
+
* uses a standard SFC tag; lone standard-tag expressions remain Vue blocks.
|
|
15
|
+
*/
|
|
16
|
+
function isVueSfcSource(source) {
|
|
17
|
+
return classifyVueSource(source) !== "non-sfc";
|
|
18
|
+
}
|
|
19
|
+
/** Classifies standard-tag JSX separately from unambiguous Vue SFC source. */
|
|
20
|
+
function classifyVueSource(source) {
|
|
21
|
+
let remainder = source.replace(/^\uFEFF/, "").trimStart();
|
|
22
|
+
let javascriptClassification;
|
|
23
|
+
const readJavaScriptClassification = () => {
|
|
24
|
+
javascriptClassification ??= classifyJavaScriptModule(source);
|
|
25
|
+
return javascriptClassification;
|
|
26
|
+
};
|
|
27
|
+
while (remainder) {
|
|
28
|
+
const afterPrelude = stripLeadingSfcPrelude(remainder);
|
|
29
|
+
if (afterPrelude === void 0) return "non-sfc";
|
|
30
|
+
remainder = afterPrelude;
|
|
31
|
+
if (!remainder) return "non-sfc";
|
|
32
|
+
const openingTag = readLeadingBlockTag(remainder);
|
|
33
|
+
if (!openingTag) {
|
|
34
|
+
if (readJavaScriptClassification() === "module") return "non-sfc";
|
|
35
|
+
const nextBlock = findNextBlockStart(remainder);
|
|
36
|
+
if (nextBlock < 0) return "non-sfc";
|
|
37
|
+
remainder = remainder.slice(nextBlock);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (STANDARD_SFC_BLOCKS.has(openingTag.name.toLowerCase())) {
|
|
41
|
+
const classification = readJavaScriptClassification();
|
|
42
|
+
if (classification === "module") return "non-sfc";
|
|
43
|
+
return classification === "ambiguous-standard-tag-jsx" ? "ambiguous-standard-tag-jsx" : "definitive-sfc";
|
|
44
|
+
}
|
|
45
|
+
if (openingTag.selfClosing) {
|
|
46
|
+
remainder = remainder.slice(openingTag.end).trimStart();
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const closingTag = new RegExp(`</${escapeRegularExpression(openingTag.name)}\\s*>`, "i").exec(remainder.slice(openingTag.end));
|
|
50
|
+
if (!closingTag) return "non-sfc";
|
|
51
|
+
remainder = remainder.slice(openingTag.end + closingTag.index + closingTag[0].length).trimStart();
|
|
52
|
+
}
|
|
53
|
+
return "non-sfc";
|
|
54
|
+
}
|
|
55
|
+
/** Removes common top-level prelude forms accepted by Vue's SFC compiler. */
|
|
56
|
+
function stripLeadingSfcPrelude(source) {
|
|
57
|
+
let remainder = source.trimStart();
|
|
58
|
+
while (remainder) {
|
|
59
|
+
if (remainder.startsWith("<!--")) {
|
|
60
|
+
const end = remainder.indexOf("-->");
|
|
61
|
+
if (end < 0) return void 0;
|
|
62
|
+
remainder = remainder.slice(end + 3).trimStart();
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (remainder.startsWith("/*")) {
|
|
66
|
+
const end = remainder.indexOf("*/", 2);
|
|
67
|
+
if (end < 0) return void 0;
|
|
68
|
+
remainder = remainder.slice(end + 2).trimStart();
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (remainder.startsWith("//")) {
|
|
72
|
+
const end = remainder.search(/[\r\n]/);
|
|
73
|
+
remainder = end < 0 ? "" : remainder.slice(end + 1).trimStart();
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (remainder.startsWith("#!")) {
|
|
77
|
+
const end = remainder.search(/[\r\n]/);
|
|
78
|
+
remainder = end < 0 ? "" : remainder.slice(end + 1).trimStart();
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const doctype = /^<!doctype(?:\s[^>]*)?>/i.exec(remainder);
|
|
82
|
+
if (doctype) {
|
|
83
|
+
remainder = remainder.slice(doctype[0].length).trimStart();
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
return remainder;
|
|
89
|
+
}
|
|
90
|
+
/** Distinguishes complete modules from lone standard-tag JSX expressions. */
|
|
91
|
+
function classifyJavaScriptModule(source) {
|
|
92
|
+
for (const language of ["tsx", "flow"]) {
|
|
93
|
+
let ast;
|
|
94
|
+
try {
|
|
95
|
+
ast = parseScriptAst(source, language);
|
|
96
|
+
} catch {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (ast.program.directives.length > 0) return "module";
|
|
100
|
+
let foundStandardBlock = false;
|
|
101
|
+
for (const statement of ast.program.body) {
|
|
102
|
+
if (statement.type === "EmptyStatement") continue;
|
|
103
|
+
if (statement.type === "ExpressionStatement" && statement.expression.type === "JSXElement" && statement.expression.extra?.parenthesized !== true && statement.expression.openingElement.name.type === "JSXIdentifier" && STANDARD_SFC_BLOCKS.has(statement.expression.openingElement.name.name.toLowerCase())) {
|
|
104
|
+
foundStandardBlock = true;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
return "module";
|
|
108
|
+
}
|
|
109
|
+
return foundStandardBlock ? "ambiguous-standard-tag-jsx" : "module";
|
|
110
|
+
}
|
|
111
|
+
return "invalid";
|
|
112
|
+
}
|
|
113
|
+
/** Finds the next possible top-level block after compiler-tolerated text. */
|
|
114
|
+
function findNextBlockStart(source) {
|
|
115
|
+
return source.search(/<[A-Za-z][A-Za-z0-9._-]*(?=[\s/>])/);
|
|
116
|
+
}
|
|
117
|
+
/** Reads one complete opening block tag while respecting quoted attributes. */
|
|
118
|
+
function readLeadingBlockTag(source) {
|
|
119
|
+
const nameMatch = /^<([A-Za-z][A-Za-z0-9._-]*)(?=[\s/>])/.exec(source);
|
|
120
|
+
if (!nameMatch) return void 0;
|
|
121
|
+
let quote;
|
|
122
|
+
for (let index = nameMatch[0].length; index < source.length; index += 1) {
|
|
123
|
+
const character = source[index];
|
|
124
|
+
if (quote) {
|
|
125
|
+
if (character === quote) quote = void 0;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (character === "\"" || character === "'") {
|
|
129
|
+
quote = character;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (character !== ">") continue;
|
|
133
|
+
return {
|
|
134
|
+
end: index + 1,
|
|
135
|
+
name: nameMatch[1],
|
|
136
|
+
selfClosing: source.slice(0, index).trimEnd().endsWith("/")
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function escapeRegularExpression(value) {
|
|
141
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { classifyVueSource, isVueSfcSource };
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=vueSourceClassification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vueSourceClassification.js","names":[],"sources":["../../../src/internal/project/vueSourceClassification.ts"],"sourcesContent":["import { parseScriptAst } from '../script/parser.js';\n\n/** Classification shared by source partitioning and lightweight ownership. */\nexport type VueSourceClassification =\n | 'definitive-sfc'\n | 'ambiguous-standard-tag-jsx'\n | 'non-sfc';\n\nconst STANDARD_SFC_BLOCKS = new Set(['template', 'script', 'style']);\n\n/**\n * Distinguishes a conventional SFC from a script module named with `.vue`.\n *\n * Vue tolerates arbitrary text before its first block, but treating every such\n * file as an SFC would hide Babel-valid legacy modules from the existing\n * parser. A complete JavaScript module wins even when its first JSX expression\n * uses a standard SFC tag; lone standard-tag expressions remain Vue blocks.\n */\nexport function isVueSfcSource(source: string): boolean {\n return classifyVueSource(source) !== 'non-sfc';\n}\n\n/** Classifies standard-tag JSX separately from unambiguous Vue SFC source. */\nexport function classifyVueSource(source: string): VueSourceClassification {\n let remainder = source.replace(/^\\uFEFF/, '').trimStart();\n let javascriptClassification: JavaScriptModuleClassification | undefined;\n const readJavaScriptClassification = () => {\n javascriptClassification ??= classifyJavaScriptModule(source);\n return javascriptClassification;\n };\n while (remainder) {\n const afterPrelude = stripLeadingSfcPrelude(remainder);\n if (afterPrelude === undefined) return 'non-sfc';\n remainder = afterPrelude;\n if (!remainder) return 'non-sfc';\n\n const openingTag = readLeadingBlockTag(remainder);\n if (!openingTag) {\n if (readJavaScriptClassification() === 'module') return 'non-sfc';\n const nextBlock = findNextBlockStart(remainder);\n if (nextBlock < 0) return 'non-sfc';\n remainder = remainder.slice(nextBlock);\n continue;\n }\n if (STANDARD_SFC_BLOCKS.has(openingTag.name.toLowerCase())) {\n const classification = readJavaScriptClassification();\n if (classification === 'module') return 'non-sfc';\n return classification === 'ambiguous-standard-tag-jsx'\n ? 'ambiguous-standard-tag-jsx'\n : 'definitive-sfc';\n }\n\n if (openingTag.selfClosing) {\n remainder = remainder.slice(openingTag.end).trimStart();\n continue;\n }\n const closingTag = new RegExp(\n `</${escapeRegularExpression(openingTag.name)}\\\\s*>`,\n 'i'\n ).exec(remainder.slice(openingTag.end));\n if (!closingTag) return 'non-sfc';\n remainder = remainder\n .slice(openingTag.end + closingTag.index + closingTag[0].length)\n .trimStart();\n }\n return 'non-sfc';\n}\n\n/** Removes common top-level prelude forms accepted by Vue's SFC compiler. */\nfunction stripLeadingSfcPrelude(source: string): string | undefined {\n let remainder = source.trimStart();\n while (remainder) {\n if (remainder.startsWith('<!--')) {\n const end = remainder.indexOf('-->');\n if (end < 0) return undefined;\n remainder = remainder.slice(end + 3).trimStart();\n continue;\n }\n if (remainder.startsWith('/*')) {\n const end = remainder.indexOf('*/', 2);\n if (end < 0) return undefined;\n remainder = remainder.slice(end + 2).trimStart();\n continue;\n }\n if (remainder.startsWith('//')) {\n const end = remainder.search(/[\\r\\n]/);\n remainder = end < 0 ? '' : remainder.slice(end + 1).trimStart();\n continue;\n }\n if (remainder.startsWith('#!')) {\n const end = remainder.search(/[\\r\\n]/);\n remainder = end < 0 ? '' : remainder.slice(end + 1).trimStart();\n continue;\n }\n const doctype = /^<!doctype(?:\\s[^>]*)?>/i.exec(remainder);\n if (doctype) {\n remainder = remainder.slice(doctype[0].length).trimStart();\n continue;\n }\n break;\n }\n return remainder;\n}\n\ntype JavaScriptModuleClassification =\n | 'ambiguous-standard-tag-jsx'\n | 'invalid'\n | 'module';\n\n/** Distinguishes complete modules from lone standard-tag JSX expressions. */\nfunction classifyJavaScriptModule(\n source: string\n): JavaScriptModuleClassification {\n for (const language of ['tsx', 'flow']) {\n let ast: ReturnType<typeof parseScriptAst>;\n try {\n ast = parseScriptAst(source, language);\n } catch {\n continue;\n }\n if (ast.program.directives.length > 0) return 'module';\n\n let foundStandardBlock = false;\n for (const statement of ast.program.body) {\n if (statement.type === 'EmptyStatement') continue;\n if (\n statement.type === 'ExpressionStatement' &&\n statement.expression.type === 'JSXElement' &&\n statement.expression.extra?.parenthesized !== true &&\n statement.expression.openingElement.name.type === 'JSXIdentifier' &&\n STANDARD_SFC_BLOCKS.has(\n statement.expression.openingElement.name.name.toLowerCase()\n )\n ) {\n foundStandardBlock = true;\n continue;\n }\n return 'module';\n }\n return foundStandardBlock ? 'ambiguous-standard-tag-jsx' : 'module';\n }\n return 'invalid';\n}\n\n/** Finds the next possible top-level block after compiler-tolerated text. */\nfunction findNextBlockStart(source: string): number {\n return source.search(/<[A-Za-z][A-Za-z0-9._-]*(?=[\\s/>])/);\n}\n\n/** Reads one complete opening block tag while respecting quoted attributes. */\nfunction readLeadingBlockTag(\n source: string\n): { end: number; name: string; selfClosing: boolean } | undefined {\n const nameMatch = /^<([A-Za-z][A-Za-z0-9._-]*)(?=[\\s/>])/.exec(source);\n if (!nameMatch) return undefined;\n\n let quote: '\"' | \"'\" | undefined;\n for (let index = nameMatch[0].length; index < source.length; index += 1) {\n const character = source[index];\n if (quote) {\n if (character === quote) quote = undefined;\n continue;\n }\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n if (character !== '>') continue;\n return {\n end: index + 1,\n name: nameMatch[1]!,\n selfClosing: source.slice(0, index).trimEnd().endsWith('/'),\n };\n }\n return undefined;\n}\n\nfunction escapeRegularExpression(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n"],"mappings":";;AAQA,MAAM,sBAAsB,IAAI,IAAI;CAAC;CAAY;CAAU;CAAQ,CAAC;;;;;;;;;AAUpE,SAAgB,eAAe,QAAyB;AACtD,QAAO,kBAAkB,OAAO,KAAK;;;AAIvC,SAAgB,kBAA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KAAK,OAAO;AACtE,KAAI,CAAC,UAAW,QAAO,KAAA;CAEvB,IAAI;AACJ,MAAK,IAAI,QAAQ,UAAU,GAAG,QAAQ,QAAQ,OAAO,QAAQ,SAAS,GAAG;EACvE,MAAM,YAAY,OAAO;AACzB,MAAI,OAAO;AACT,OAAI,cAAc,MAAO,SAAQ,KAAA;AACjC;;AAEF,MAAI,cAAc,QAAO,cAAc,KAAK;AAC1C,WAAQ;AACR;;AAEF,MAAI,cAAc,IAAK;AACvB,SAAO;GACL,KAAK,QAAQ;GACb,MAAM,UAAU;GAChB,aAAa,OAAO,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,IAAI;GAC5D;;;AAKL,SAAS,wBAAwB,OAAuB;AACtD,QAAO,MAAM,QAAQ,uBAAuB,OAAO"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { JavaScriptPackageManifest } from './manifest.js';
|
|
2
|
+
/** A validated workspace package and its parsed manifest. */
|
|
3
|
+
export type DeclaredWorkspacePackage = {
|
|
4
|
+
directory: string;
|
|
5
|
+
manifest: JavaScriptPackageManifest;
|
|
6
|
+
};
|
|
7
|
+
/** Per-extraction cache that avoids traversing the same workspace repeatedly. */
|
|
8
|
+
export type WorkspaceDiscoveryCache = Map<string, {
|
|
9
|
+
manifestWorkspaces: string;
|
|
10
|
+
packages: DeclaredWorkspacePackage[];
|
|
11
|
+
}>;
|
|
12
|
+
/** Creates an isolated workspace cache for one detection or extraction call. */
|
|
13
|
+
export declare function createWorkspaceDiscoveryCache(): WorkspaceDiscoveryCache;
|
|
14
|
+
/**
|
|
15
|
+
* Reads declared workspace packages without following paths outside the root.
|
|
16
|
+
*
|
|
17
|
+
* A valid `pnpm-workspace.yaml` is authoritative over `package.json` because
|
|
18
|
+
* pnpm uses that file to include and exclude packages. Malformed workspace
|
|
19
|
+
* metadata is treated as no optional workspaces; it never hides a known root
|
|
20
|
+
* application or causes extraction to traverse the filesystem recursively.
|
|
21
|
+
*/
|
|
22
|
+
export declare function readDeclaredWorkspacePackages(cwd: string, rootManifest: JavaScriptPackageManifest, cache: WorkspaceDiscoveryCache): DeclaredWorkspacePackage[];
|
|
23
|
+
/**
|
|
24
|
+
* Reads declared workspace packages without blocking on every manifest.
|
|
25
|
+
*
|
|
26
|
+
* The returned packages and cache entry are identical to the synchronous
|
|
27
|
+
* implementation. Project inspection can populate this cache concurrently
|
|
28
|
+
* with a host framework's existing extraction, then reuse the established
|
|
29
|
+
* synchronous ownership logic without traversing the workspace twice.
|
|
30
|
+
*/
|
|
31
|
+
export declare function readDeclaredWorkspacePackagesAsync(cwd: string, rootManifest: JavaScriptPackageManifest, cache: WorkspaceDiscoveryCache): Promise<DeclaredWorkspacePackage[]>;
|