@generaltranslation/vue-extractor 0.0.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.
Files changed (62) hide show
  1. package/LICENSE.md +105 -0
  2. package/dist/config.d.ts +2 -0
  3. package/dist/config.js +2 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.js +2 -0
  6. package/dist/internal/compilerAst.d.ts +43 -0
  7. package/dist/internal/compilerAst.js +77 -0
  8. package/dist/internal/compilerAst.js.map +1 -0
  9. package/dist/internal/config/resolveVueCompilerOptions.d.ts +23 -0
  10. package/dist/internal/config/resolveVueCompilerOptions.js +987 -0
  11. package/dist/internal/config/resolveVueCompilerOptions.js.map +1 -0
  12. package/dist/internal/extractFromVueSource.d.ts +9 -0
  13. package/dist/internal/extractFromVueSource.js +332 -0
  14. package/dist/internal/extractFromVueSource.js.map +1 -0
  15. package/dist/internal/script/analyze.d.ts +13 -0
  16. package/dist/internal/script/analyze.js +4761 -0
  17. package/dist/internal/script/analyze.js.map +1 -0
  18. package/dist/internal/script/jsx.d.ts +36 -0
  19. package/dist/internal/script/jsx.js +667 -0
  20. package/dist/internal/script/jsx.js.map +1 -0
  21. package/dist/internal/script/knownValues.d.ts +14 -0
  22. package/dist/internal/script/knownValues.js +148 -0
  23. package/dist/internal/script/knownValues.js.map +1 -0
  24. package/dist/internal/script/localModules.d.ts +80 -0
  25. package/dist/internal/script/localModules.js +364 -0
  26. package/dist/internal/script/localModules.js.map +1 -0
  27. package/dist/internal/script/model.d.ts +317 -0
  28. package/dist/internal/script/model.js +1 -0
  29. package/dist/internal/script/parser.d.ts +3 -0
  30. package/dist/internal/script/parser.js +21 -0
  31. package/dist/internal/script/parser.js.map +1 -0
  32. package/dist/internal/script/replay.d.ts +53 -0
  33. package/dist/internal/script/replay.js +1611 -0
  34. package/dist/internal/script/replay.js.map +1 -0
  35. package/dist/internal/script/snapshot.d.ts +25 -0
  36. package/dist/internal/script/snapshot.js +293 -0
  37. package/dist/internal/script/snapshot.js.map +1 -0
  38. package/dist/internal/script/syntax.d.ts +21 -0
  39. package/dist/internal/script/syntax.js +46 -0
  40. package/dist/internal/script/syntax.js.map +1 -0
  41. package/dist/internal/script.d.ts +2 -0
  42. package/dist/internal/script.js +2 -0
  43. package/dist/internal/stringCalls.d.ts +7 -0
  44. package/dist/internal/stringCalls.js +82 -0
  45. package/dist/internal/stringCalls.js.map +1 -0
  46. package/dist/internal/template.d.ts +4 -0
  47. package/dist/internal/template.js +2198 -0
  48. package/dist/internal/template.js.map +1 -0
  49. package/dist/internal/templatePath.d.ts +12 -0
  50. package/dist/internal/templatePath.js +23 -0
  51. package/dist/internal/templatePath.js.map +1 -0
  52. package/dist/internal/types.d.ts +69 -0
  53. package/dist/internal/types.js +1 -0
  54. package/dist/internal/utils.d.ts +19 -0
  55. package/dist/internal/utils.js +149 -0
  56. package/dist/internal/utils.js.map +1 -0
  57. package/dist/internal/vueCompiler.d.ts +35 -0
  58. package/dist/internal/vueCompiler.js +320 -0
  59. package/dist/internal/vueCompiler.js.map +1 -0
  60. package/dist/types.d.ts +80 -0
  61. package/dist/types.js +1 -0
  62. package/package.json +78 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveVueCompilerOptions.js","names":[],"sources":["../../../src/internal/config/resolveVueCompilerOptions.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\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 { createDiagnosticMessage } from 'generaltranslation/internal';\nimport type { VueCompilerOptions } from '../../types.js';\n\nconst traverse = traverseModule.default || traverseModule;\n\nconst VITE_CONFIG_FILES = [\n 'vite.config.js',\n 'vite.config.mjs',\n 'vite.config.ts',\n 'vite.config.cjs',\n 'vite.config.mts',\n 'vite.config.cts',\n] as const;\n\nconst NUXT_CONFIG_FILES = [\n 'nuxt.config.js',\n 'nuxt.config.ts',\n 'nuxt.config.mjs',\n 'nuxt.config.cjs',\n 'nuxt.config.mts',\n 'nuxt.config.cts',\n] as const;\n\nconst CUSTOM_VITE_CONFIG_EXTENSIONS = new Set([\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n]);\n\ntype CompilerOptionName = keyof VueCompilerOptions;\n\ntype OptionSource = {\n file: string;\n node?: t.Node;\n};\n\ntype CompilerOptionState = {\n options: VueCompilerOptions;\n sources: Partial<Record<CompilerOptionName, OptionSource>>;\n};\n\ntype ObjectEntry = {\n node: t.Node;\n scope: Scope;\n};\n\ntype StaticObject = {\n entries: Map<string, ObjectEntry>;\n};\n\ntype ObjectResolution =\n | { ok: true; value: StaticObject }\n | { ok: false; node: t.Node };\n\ntype ActiveConfigResolution =\n | { ok: true; value: ObjectEntry }\n | { ok: false; node: t.Node };\n\ntype ConfigHelperResolution = 'dynamic' | 'static' | undefined;\n\ntype ScopedPluginCall = {\n node: t.CallExpression | t.OptionalCallExpression;\n scope: Scope;\n};\n\ntype VitePluginContext = {\n moduleSource: '@vitejs/plugin-vue' | '@vitejs/plugin-vue-jsx';\n namespaceBindings: Set<Binding>;\n pluginBindings: Set<Binding>;\n referencePositions: number[];\n};\n\n/** Result of resolving hash-affecting options from project configuration. */\nexport type VueCompilerOptionsResolution = {\n /** Static compiler options that must be passed to Vue source extraction. */\n compilerOptions: VueCompilerOptions;\n /** Diagnostics that make extraction unsafe until the configuration is fixed. */\n errors: string[];\n};\n\n/** Controls project configuration discovery for compiler-option resolution. */\nexport type VueCompilerOptionsResolverOptions = {\n /** A single explicit Vite config path, resolved relative to the project root. */\n viteConfigPath?: string;\n};\n\n/**\n * Resolves hash-affecting Vue template compiler options without executing\n * project configuration files.\n *\n * Explicit `gt.config.json` values are combined with statically analyzable\n * Vite and Nuxt configuration. Conflicting, dynamic, or unsupported relevant\n * options produce errors so extraction never publishes hashes calculated with\n * compiler behavior that the runtime does not share.\n */\nexport function resolveVueCompilerOptions(\n cwd: string,\n explicitOptions: VueCompilerOptions | undefined,\n resolverOptions: VueCompilerOptionsResolverOptions = {}\n): VueCompilerOptionsResolution {\n const state: CompilerOptionState = { options: {}, sources: {} };\n const errors: string[] = [];\n\n readExplicitOptions(explicitOptions, state, errors);\n\n if (resolverOptions.viteConfigPath !== undefined) {\n const file = resolveCustomViteConfig(\n cwd,\n resolverOptions.viteConfigPath,\n errors\n );\n if (file) readViteConfig(file, state, errors);\n return { compilerOptions: state.options, errors };\n }\n\n const nuxtConfig = findFirstConfig(cwd, NUXT_CONFIG_FILES);\n const viteConfig = findFirstConfig(cwd, VITE_CONFIG_FILES);\n if (nuxtConfig && viteConfig) {\n errors.push(\n optionError(\n 'Found both Nuxt and Vite project config files',\n 'For direct Vite builds, set files.gt.parsingFlags.viteConfigPath to the active Vite config. For Nuxt builds, remove or relocate the inactive Vite config so the compiler configuration is unambiguous'\n )\n );\n return { compilerOptions: state.options, errors };\n }\n if (nuxtConfig) {\n readNuxtConfig(nuxtConfig, state, errors);\n return { compilerOptions: state.options, errors };\n }\n\n if (viteConfig) readViteConfig(viteConfig, state, errors);\n\n return { compilerOptions: state.options, errors };\n}\n\n/** Selects the first config file in the framework's documented lookup order. */\nfunction findFirstConfig(\n cwd: string,\n filenames: readonly string[]\n): string | undefined {\n for (const filename of filenames) {\n const file = path.resolve(cwd, filename);\n if (fs.existsSync(file)) return file;\n }\n return undefined;\n}\n\n/** Validates an explicit Vite config without searching or executing files. */\nfunction resolveCustomViteConfig(\n cwd: string,\n configuredPath: unknown,\n errors: string[]\n): string | undefined {\n if (typeof configuredPath !== 'string' || !configuredPath.trim()) {\n errors.push(\n optionError(\n 'Found an empty Vite config path',\n 'Set files.gt.parsingFlags.viteConfigPath to one in-project Vite config file'\n )\n );\n return undefined;\n }\n const root = path.resolve(cwd);\n const candidate = path.resolve(root, configuredPath);\n const relativeCandidate = path.relative(root, candidate);\n if (\n relativeCandidate.startsWith(`..${path.sep}`) ||\n relativeCandidate === '..' ||\n path.isAbsolute(relativeCandidate) ||\n relativeCandidate.split(path.sep).includes('node_modules')\n ) {\n errors.push(\n optionError(\n 'Found a Vite config path outside the project source boundary',\n 'Choose a Vite config file inside the project root and outside node_modules'\n )\n );\n return undefined;\n }\n if (\n !CUSTOM_VITE_CONFIG_EXTENSIONS.has(path.extname(candidate).toLowerCase())\n ) {\n errors.push(\n optionError(\n 'Found an unsupported Vite config file extension',\n 'Use a JavaScript or TypeScript Vite config file'\n )\n );\n return undefined;\n }\n if (!fs.existsSync(candidate) || !fs.statSync(candidate).isFile()) {\n errors.push(\n optionError(\n 'Could not find the configured Vite config file',\n 'Set files.gt.parsingFlags.viteConfigPath to an existing file inside the project root'\n )\n );\n return undefined;\n }\n\n const realRoot = fs.realpathSync(root);\n const realCandidate = fs.realpathSync(candidate);\n const realRelative = path.relative(realRoot, realCandidate);\n if (\n realRelative.startsWith(`..${path.sep}`) ||\n realRelative === '..' ||\n path.isAbsolute(realRelative) ||\n realRelative.split(path.sep).includes('node_modules')\n ) {\n errors.push(\n optionError(\n 'Found a Vite config path outside the project source boundary',\n 'Choose a Vite config file inside the project root and outside node_modules'\n )\n );\n return undefined;\n }\n return realCandidate;\n}\n\nfunction readExplicitOptions(\n input: VueCompilerOptions | undefined,\n state: CompilerOptionState,\n errors: string[]\n): void {\n if (input === undefined) return;\n if (!isRecord(input)) {\n errors.push(\n optionError(\n 'Found an invalid vueCompilerOptions parsing setting',\n 'Set files.gt.parsingFlags.vueCompilerOptions to an object containing only whitespace and delimiters'\n )\n );\n return;\n }\n\n for (const key of Object.keys(input)) {\n if (key !== 'whitespace' && key !== 'delimiters') {\n errors.push(\n optionError(\n `Found unsupported Vue compiler option \"${key}\" in gt.config.json`,\n 'Configure only whitespace and delimiters in files.gt.parsingFlags.vueCompilerOptions'\n )\n );\n }\n }\n\n if (input.whitespace !== undefined) {\n if (input.whitespace !== 'condense' && input.whitespace !== 'preserve') {\n errors.push(\n optionError(\n 'Found an invalid Vue whitespace compiler option in gt.config.json',\n 'Set whitespace to either \"condense\" or \"preserve\"'\n )\n );\n } else {\n mergeOption(\n state,\n 'whitespace',\n input.whitespace,\n { file: 'gt.config.json' },\n errors\n );\n }\n }\n\n if (input.delimiters !== undefined) {\n if (!isDelimiterPair(input.delimiters)) {\n errors.push(\n optionError(\n 'Found invalid Vue interpolation delimiters in gt.config.json',\n 'Set delimiters to exactly two non-empty strings, such as [\"[[\", \"]]\"]'\n )\n );\n } else {\n mergeOption(\n state,\n 'delimiters',\n input.delimiters,\n { file: 'gt.config.json' },\n errors\n );\n }\n }\n}\n\nfunction readViteConfig(\n file: string,\n state: CompilerOptionState,\n errors: string[]\n): void {\n const ast = parseConfig(file, errors);\n if (!ast) return;\n\n const pluginBindings = new Set<Binding>();\n const namespaceBindings = new Set<Binding>();\n const jsxPluginBindings = new Set<Binding>();\n const jsxNamespaceBindings = new Set<Binding>();\n const defineConfigBindings = new Set<Binding>();\n\n traverse(ast, {\n ImportDeclaration(importPath) {\n if (importPath.node.source.value === 'vite') {\n for (const specifierPath of importPath.get('specifiers')) {\n const specifier = specifierPath.node;\n if (\n specifier.type !== 'ImportSpecifier' ||\n (specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value) !== 'defineConfig'\n ) {\n continue;\n }\n const binding = specifierPath.scope.getBinding(specifier.local.name);\n if (binding) defineConfigBindings.add(binding);\n }\n return;\n }\n const moduleSource = importPath.node.source.value;\n if (\n moduleSource !== '@vitejs/plugin-vue' &&\n moduleSource !== '@vitejs/plugin-vue-jsx'\n ) {\n return;\n }\n const targetPluginBindings =\n moduleSource === '@vitejs/plugin-vue-jsx'\n ? jsxPluginBindings\n : pluginBindings;\n const targetNamespaceBindings =\n moduleSource === '@vitejs/plugin-vue-jsx'\n ? jsxNamespaceBindings\n : namespaceBindings;\n for (const specifierPath of importPath.get('specifiers')) {\n const specifier = specifierPath.node;\n const binding = specifierPath.scope.getBinding(specifier.local.name);\n if (!binding) continue;\n if (specifier.type === 'ImportNamespaceSpecifier') {\n targetNamespaceBindings.add(binding);\n } else if (\n specifier.type === 'ImportDefaultSpecifier' ||\n (specifier.type === 'ImportSpecifier' &&\n (specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value) === 'default')\n ) {\n targetPluginBindings.add(binding);\n }\n }\n },\n TSImportEqualsDeclaration(importPath) {\n const reference = importPath.node.moduleReference;\n if (\n reference.type !== 'TSExternalModuleReference' ||\n reference.expression.type !== 'StringLiteral' ||\n (reference.expression.value !== '@vitejs/plugin-vue' &&\n reference.expression.value !== '@vitejs/plugin-vue-jsx')\n ) {\n return;\n }\n const binding = importPath.scope.getBinding(importPath.node.id.name);\n if (!binding) return;\n if (reference.expression.value === '@vitejs/plugin-vue-jsx') {\n jsxNamespaceBindings.add(binding);\n } else {\n namespaceBindings.add(binding);\n }\n },\n VariableDeclarator(variablePath) {\n const vueRequireKind = getPluginVueRequireKind(\n variablePath.node.init,\n '@vitejs/plugin-vue'\n );\n const jsxRequireKind = getPluginVueRequireKind(\n variablePath.node.init,\n '@vitejs/plugin-vue-jsx'\n );\n const requireKind = vueRequireKind ?? jsxRequireKind;\n if (!requireKind) return;\n const targetPluginBindings = jsxRequireKind\n ? jsxPluginBindings\n : pluginBindings;\n const targetNamespaceBindings = jsxRequireKind\n ? jsxNamespaceBindings\n : namespaceBindings;\n if (variablePath.node.id.type === 'Identifier') {\n const binding = variablePath.scope.getBinding(\n variablePath.node.id.name\n );\n if (!binding) return;\n if (requireKind === 'namespace') targetNamespaceBindings.add(binding);\n else targetPluginBindings.add(binding);\n return;\n }\n if (\n requireKind !== 'namespace' ||\n variablePath.node.id.type !== 'ObjectPattern'\n ) {\n return;\n }\n for (const property of variablePath.node.id.properties) {\n if (\n property.type !== 'ObjectProperty' ||\n readPropertyKey(property) !== 'default'\n ) {\n continue;\n }\n const localName = readBindingIdentifier(property.value);\n const binding = localName\n ? variablePath.scope.getBinding(localName)\n : undefined;\n if (binding) targetPluginBindings.add(binding);\n }\n },\n });\n\n const activeExport = findActiveConfigExport(ast, file, errors);\n if (!activeExport) return;\n const functionReturns = collectFunctionReturns(ast);\n const configRoot = resolveActiveConfigRoot(\n activeExport.node,\n activeExport.scope,\n functionReturns,\n (callee, scope) =>\n resolveConfigHelperCall(callee, scope, defineConfigBindings, undefined),\n new Set()\n );\n if (!configRoot.ok) {\n errors.push(dynamicConfigError(file, configRoot.node));\n return;\n }\n\n const configObject = resolveStaticObject(\n configRoot.value.node,\n configRoot.value.scope,\n new Set()\n );\n if (!configObject.ok) {\n errors.push(dynamicConfigError(file, configObject.node));\n return;\n }\n const plugins = configObject.value.entries.get('plugins');\n if (!plugins) return;\n\n const pluginContext: VitePluginContext = {\n moduleSource: '@vitejs/plugin-vue',\n namespaceBindings,\n pluginBindings,\n referencePositions: [...pluginBindings, ...namespaceBindings].flatMap(\n (binding) =>\n binding.referencePaths\n .map((reference) => reference.node.start)\n .filter((position): position is number => position !== null)\n ),\n };\n const calls: ScopedPluginCall[] = [];\n const unresolved = collectActiveVuePluginCalls(\n plugins.node,\n plugins.scope,\n pluginContext,\n calls,\n new Set()\n );\n if (unresolved) {\n errors.push(dynamicConfigError(file, unresolved));\n return;\n }\n if (calls.length > 1) {\n errors.push(dynamicConfigError(file, calls[1]!.node));\n return;\n }\n const call = calls[0];\n if (call) {\n const argument = call.node.arguments[0];\n if (\n argument?.type === 'SpreadElement' ||\n argument?.type === 'ArgumentPlaceholder'\n ) {\n errors.push(dynamicConfigError(file, argument));\n return;\n }\n if (argument) {\n rejectCustomVueCompiler(argument, call.scope, file, errors);\n readNestedCompilerOptions(\n argument,\n call.scope,\n ['template', 'compilerOptions'],\n file,\n true,\n state,\n errors\n );\n }\n }\n\n const jsxPluginContext: VitePluginContext = {\n moduleSource: '@vitejs/plugin-vue-jsx',\n namespaceBindings: jsxNamespaceBindings,\n pluginBindings: jsxPluginBindings,\n referencePositions: [...jsxPluginBindings, ...jsxNamespaceBindings].flatMap(\n (binding) =>\n binding.referencePaths\n .map((reference) => reference.node.start)\n .filter((position): position is number => position !== null)\n ),\n };\n const jsxCalls: ScopedPluginCall[] = [];\n const unresolvedJSX = collectActiveVuePluginCalls(\n plugins.node,\n plugins.scope,\n jsxPluginContext,\n jsxCalls,\n new Set()\n );\n if (unresolvedJSX) {\n errors.push(dynamicVueJSXConfigError(file, unresolvedJSX));\n return;\n }\n if (jsxCalls.length > 1) {\n errors.push(dynamicVueJSXConfigError(file, jsxCalls[1]!.node));\n return;\n }\n if (jsxCalls[0]) readVueJSXPluginOptions(jsxCalls[0], file, errors);\n}\n\n/** Rejects Vite JSX options that can invalidate source-to-VNode parity. */\nfunction readVueJSXPluginOptions(\n call: ScopedPluginCall,\n file: string,\n errors: string[]\n): void {\n const argument = call.node.arguments[0];\n if (!argument) return;\n if (\n argument.type === 'SpreadElement' ||\n argument.type === 'ArgumentPlaceholder'\n ) {\n errors.push(dynamicVueJSXConfigError(file, argument));\n return;\n }\n const options = resolveStaticObject(argument, call.scope, new Set());\n if (!options.ok) {\n errors.push(dynamicVueJSXConfigError(file, options.node));\n return;\n }\n\n for (const [name, entry] of options.value.entries) {\n let supported = false;\n if (name === 'optimize') {\n // Optimization changes patch metadata only. The real dev/production\n // oracle proves both values preserve GT source data.\n supported =\n resolveStaticBoolean(entry.node, entry.scope, new Set()) !== undefined;\n } else if (name === 'transformOn') {\n supported =\n resolveStaticBoolean(entry.node, entry.scope, new Set()) === false;\n } else if (name === 'enableObjectSlots' || name === 'mergeProps') {\n supported =\n resolveStaticBoolean(entry.node, entry.scope, new Set()) === true;\n } else if (name === 'resolveType') {\n supported =\n resolveStaticBoolean(entry.node, entry.scope, new Set()) === false;\n } else if (name === 'pragma') {\n supported =\n resolveStaticString(entry.node, entry.scope, new Set()) === '';\n } else if (name === 'defineComponentName') {\n supported = isDefaultDefineComponentNames(\n entry.node,\n entry.scope,\n new Set()\n );\n } else if (name === 'babelPlugins') {\n supported = isDefinitelyEmptyArray(entry.node, entry.scope, new Set());\n } else if (name === 'tsPluginOptions') {\n const resolved = resolveStaticObject(entry.node, entry.scope, new Set());\n supported = resolved.ok && resolved.value.entries.size === 0;\n }\n if (supported) continue;\n errors.push(\n locatedOptionError(\n file,\n entry.node,\n `Found unsupported @vitejs/plugin-vue-jsx option \"${name}\"`,\n 'Use default-equivalent Vue JSX options; only a static optimize value may differ in files containing gt-vue translations'\n )\n );\n }\n}\n\n/** Resolves an immutable boolean option without coercing another type. */\nfunction resolveStaticBoolean(\n input: t.Node,\n scope: Scope,\n seen: Set<Binding>\n): boolean | undefined {\n const node = unwrapExpression(input);\n if (node.type === 'BooleanLiteral') return node.value;\n if (node.type !== 'Identifier') return undefined;\n const binding = scope.getBinding(node.name);\n if (!binding?.constant || bindingHasMutation(binding) || seen.has(binding)) {\n return undefined;\n }\n const declaration = binding.path.node;\n if (declaration.type !== 'VariableDeclarator' || !declaration.init) {\n return undefined;\n }\n const nextSeen = new Set(seen);\n nextSeen.add(binding);\n return resolveStaticBoolean(declaration.init, binding.path.scope, nextSeen);\n}\n\n/** Proves the explicit component-name option equals the plugin default. */\nfunction isDefaultDefineComponentNames(\n input: t.Node,\n scope: Scope,\n seen: Set<Binding>\n): boolean {\n const node = unwrapExpression(input);\n if (node.type === 'ArrayExpression') {\n return (\n node.elements.length === 1 &&\n node.elements[0]?.type === 'StringLiteral' &&\n node.elements[0].value === 'defineComponent'\n );\n }\n if (node.type !== 'Identifier') return false;\n const binding = scope.getBinding(node.name);\n if (!binding?.constant || bindingHasMutation(binding) || seen.has(binding)) {\n return false;\n }\n const declaration = binding.path.node;\n if (declaration.type !== 'VariableDeclarator' || !declaration.init) {\n return false;\n }\n const nextSeen = new Set(seen);\n nextSeen.add(binding);\n return isDefaultDefineComponentNames(\n declaration.init,\n binding.path.scope,\n nextSeen\n );\n}\n\n/** Proves an immutable config value is an empty array. */\nfunction isDefinitelyEmptyArray(\n input: t.Node,\n scope: Scope,\n seen: Set<Binding>\n): boolean {\n const node = unwrapExpression(input);\n if (node.type === 'ArrayExpression') return node.elements.length === 0;\n if (node.type !== 'Identifier') return false;\n const binding = scope.getBinding(node.name);\n if (!binding?.constant || bindingHasMutation(binding) || seen.has(binding)) {\n return false;\n }\n const declaration = binding.path.node;\n if (declaration.type !== 'VariableDeclarator' || !declaration.init) {\n return false;\n }\n const nextSeen = new Set(seen);\n nextSeen.add(binding);\n return isDefinitelyEmptyArray(declaration.init, binding.path.scope, nextSeen);\n}\n\n/**\n * Rejects Vite's custom compiler override because source-file resolution can\n * only prove parity with that app's `vue/compiler-sfc` export.\n */\nfunction rejectCustomVueCompiler(\n root: t.Node,\n scope: Scope,\n file: string,\n errors: string[]\n): void {\n const rootObject = resolveStaticObject(root, scope, new Set());\n if (!rootObject.ok) return;\n const compiler = rootObject.value.entries.get('compiler');\n if (!compiler) return;\n errors.push(\n locatedOptionError(\n file,\n compiler.node,\n 'Found a custom Vue compiler instance in the Vite plugin',\n \"Remove the compiler override so extraction and Vite both use the app's vue/compiler-sfc version\"\n )\n );\n}\n\nfunction readNuxtConfig(\n file: string,\n state: CompilerOptionState,\n errors: string[]\n): void {\n const ast = parseConfig(file, errors);\n if (!ast) return;\n\n const defineNuxtConfigBindings = new Set<Binding>();\n traverse(ast, {\n ImportDeclaration(importPath) {\n if (\n importPath.node.source.value !== 'nuxt/config' &&\n importPath.node.source.value !== 'nuxt' &&\n importPath.node.source.value !== '#imports'\n ) {\n return;\n }\n for (const specifierPath of importPath.get('specifiers')) {\n const specifier = specifierPath.node;\n if (\n specifier.type !== 'ImportSpecifier' ||\n (specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value) !== 'defineNuxtConfig'\n ) {\n continue;\n }\n const binding = specifierPath.scope.getBinding(specifier.local.name);\n if (binding) defineNuxtConfigBindings.add(binding);\n }\n },\n });\n\n const activeExport = findActiveConfigExport(ast, file, errors);\n if (!activeExport) return;\n const configRoot = resolveActiveConfigRoot(\n activeExport.node,\n activeExport.scope,\n collectFunctionReturns(ast),\n (callee, scope) =>\n resolveConfigHelperCall(\n callee,\n scope,\n defineNuxtConfigBindings,\n 'defineNuxtConfig'\n ),\n new Set()\n );\n if (!configRoot.ok) {\n errors.push(dynamicConfigError(file, configRoot.node));\n return;\n }\n const configObject = resolveStaticObject(\n configRoot.value.node,\n configRoot.value.scope,\n new Set()\n );\n if (!configObject.ok) {\n errors.push(dynamicConfigError(file, configObject.node));\n return;\n }\n const extendsEntry = configObject.value.entries.get('extends');\n if (\n extendsEntry &&\n !isDefinitelyEmptyNuxtExtends(extendsEntry.node, extendsEntry.scope)\n ) {\n errors.push(\n locatedOptionError(\n file,\n extendsEntry.node,\n 'Found Nuxt layer inheritance that could change Vue compiler options',\n 'Run extraction from a Nuxt configuration without inherited layers until gt-vue can resolve the complete layer chain safely'\n )\n );\n return;\n }\n const unsupportedSourceLayout = findUnsupportedNuxtSourceLayout(\n configObject.value\n );\n if (unsupportedSourceLayout) {\n errors.push(\n locatedOptionError(\n file,\n unsupportedSourceLayout,\n 'Found custom Nuxt source directories that default Vue discovery cannot scan safely',\n 'Use Nuxt source directories covered by the default app, src, pages, layouts, plugins, and related globs until custom directory discovery is supported'\n )\n );\n return;\n }\n readNestedCompilerOptions(\n configRoot.value.node,\n configRoot.value.scope,\n ['vue', 'compilerOptions'],\n file,\n true,\n state,\n errors\n );\n}\n\n/** Finds a Nuxt source-layout override not covered by default CLI globs. */\nfunction findUnsupportedNuxtSourceLayout(\n config: StaticObject\n): t.Node | undefined {\n const srcDir = config.entries.get('srcDir');\n if (srcDir) {\n const value = resolveStaticString(srcDir.node, srcDir.scope, new Set());\n const normalized = value\n ? path.posix.normalize(value.replaceAll('\\\\', '/')).replace(/\\/+$/, '') ||\n '.'\n : undefined;\n if (!normalized || !['.', 'app', 'src'].includes(normalized)) {\n return srcDir.node;\n }\n }\n\n const directoryOptions = config.entries.get('dir');\n if (directoryOptions) {\n const resolved = resolveStaticObject(\n directoryOptions.node,\n directoryOptions.scope,\n new Set()\n );\n if (!resolved.ok || resolved.value.entries.size > 0) {\n return directoryOptions.node;\n }\n }\n return undefined;\n}\n\n/** Returns true only when a Nuxt extends value provably selects no layers. */\nfunction isDefinitelyEmptyNuxtExtends(input: t.Node, scope: Scope): boolean {\n const node = unwrapExpression(input);\n if (node.type === 'NullLiteral') return true;\n if (node.type === 'ArrayExpression') return node.elements.length === 0;\n if (node.type !== 'Identifier') return false;\n if (node.name === 'undefined' && !scope.getBinding(node.name)) return true;\n const binding = scope.getBinding(node.name);\n const declaration = binding?.path.node;\n return !!(\n binding?.constant &&\n !bindingHasMutation(binding) &&\n declaration?.type === 'VariableDeclarator' &&\n declaration.init &&\n isDefinitelyEmptyNuxtExtends(declaration.init, binding.path.scope)\n );\n}\n\n/** Returns the one top-level export that the config loader evaluates. */\nfunction findActiveConfigExport(\n ast: t.File,\n file: string,\n errors: string[]\n): ObjectEntry | undefined {\n const esmExports: ObjectEntry[] = [];\n const commonJsExports = new Map<\n 'exports-default' | 'module-exports',\n ObjectEntry[]\n >();\n\n traverse(ast, {\n ExportDefaultDeclaration(exportPath) {\n esmExports.push({\n node: exportPath.node.declaration,\n scope: exportPath.scope,\n });\n },\n AssignmentExpression(assignmentPath) {\n if (\n assignmentPath.node.operator !== '=' ||\n assignmentPath.getFunctionParent() ||\n !assignmentPath.parentPath.isExpressionStatement() ||\n !assignmentPath.parentPath.parentPath?.isProgram()\n ) {\n return;\n }\n const kind = readCommonJsConfigExportKind(\n assignmentPath.node.left,\n assignmentPath.scope\n );\n if (!kind) return;\n const entries = commonJsExports.get(kind) ?? [];\n entries.push({\n node: assignmentPath.node.right,\n scope: assignmentPath.scope,\n });\n commonJsExports.set(kind, entries);\n },\n });\n\n const commonJsKinds = [...commonJsExports.keys()];\n if (\n esmExports.length > 1 ||\n (esmExports.length > 0 && commonJsKinds.length > 0) ||\n commonJsKinds.length > 1\n ) {\n const node =\n esmExports[1]?.node ??\n commonJsExports.get(commonJsKinds[1]!)?.[0]?.node ??\n esmExports[0]?.node ??\n ast.program;\n errors.push(dynamicConfigError(file, node));\n return undefined;\n }\n if (esmExports[0]) return esmExports[0];\n const commonJs = commonJsExports.get(commonJsKinds[0]!);\n return commonJs?.[commonJs.length - 1];\n}\n\n/** Records return expressions by their immediately containing function. */\nfunction collectFunctionReturns(ast: t.File): Map<t.Function, ObjectEntry[]> {\n const result = new Map<t.Function, ObjectEntry[]>();\n traverse(ast, {\n ReturnStatement(returnPath) {\n if (!returnPath.node.argument) return;\n const functionPath = returnPath.getFunctionParent();\n if (!functionPath) return;\n const entries = result.get(functionPath.node) ?? [];\n entries.push({ node: returnPath.node.argument, scope: returnPath.scope });\n result.set(functionPath.node, entries);\n },\n });\n return result;\n}\n\n/** Resolves an exported object or single-return config function statically. */\nfunction resolveActiveConfigRoot(\n input: t.Node,\n scope: Scope,\n functionReturns: Map<t.Function, ObjectEntry[]>,\n resolveHelper: (input: t.Node, scope: Scope) => ConfigHelperResolution,\n seen: Set<t.Node>\n): ActiveConfigResolution {\n const node = unwrapExpression(input);\n if (seen.has(node)) return { ok: false, node };\n const nextSeen = new Set(seen);\n nextSeen.add(node);\n\n if (node.type === 'ObjectExpression') {\n return { ok: true, value: { node, scope } };\n }\n if (node.type === 'Identifier') {\n const binding = scope.getBinding(node.name);\n if (!binding?.constant || bindingHasMutation(binding)) {\n return { ok: false, node };\n }\n if (binding.path.isFunctionDeclaration()) {\n return resolveActiveConfigRoot(\n binding.path.node,\n binding.path.scope,\n functionReturns,\n resolveHelper,\n nextSeen\n );\n }\n const declaration = binding.path.node;\n return declaration.type === 'VariableDeclarator' && declaration.init\n ? resolveActiveConfigRoot(\n declaration.init,\n binding.path.scope,\n functionReturns,\n resolveHelper,\n nextSeen\n )\n : { ok: false, node };\n }\n if (\n node.type === 'CallExpression' ||\n node.type === 'OptionalCallExpression'\n ) {\n const helper = resolveHelper(node.callee, scope);\n if (helper !== 'static') return { ok: false, node: node.callee };\n const argument = node.arguments[0];\n return argument &&\n argument.type !== 'SpreadElement' &&\n argument.type !== 'ArgumentPlaceholder'\n ? resolveActiveConfigRoot(\n argument,\n scope,\n functionReturns,\n resolveHelper,\n nextSeen\n )\n : { ok: false, node };\n }\n if (\n node.type === 'ArrowFunctionExpression' ||\n node.type === 'FunctionExpression' ||\n node.type === 'FunctionDeclaration'\n ) {\n if (\n node.type === 'ArrowFunctionExpression' &&\n node.body.type !== 'BlockStatement'\n ) {\n return resolveActiveConfigRoot(\n node.body,\n scope,\n functionReturns,\n resolveHelper,\n nextSeen\n );\n }\n const returns = functionReturns.get(node) ?? [];\n return returns.length === 1\n ? resolveActiveConfigRoot(\n returns[0]!.node,\n returns[0]!.scope,\n functionReturns,\n resolveHelper,\n nextSeen\n )\n : { ok: false, node };\n }\n if (node.type === 'ConditionalExpression') {\n const condition = resolveStaticTruthiness(node.test, scope, new Set());\n return condition === undefined\n ? { ok: false, node }\n : resolveActiveConfigRoot(\n condition ? node.consequent : node.alternate,\n scope,\n functionReturns,\n resolveHelper,\n nextSeen\n );\n }\n if (node.type === 'SequenceExpression') {\n const last = node.expressions[node.expressions.length - 1];\n return last\n ? resolveActiveConfigRoot(\n last,\n scope,\n functionReturns,\n resolveHelper,\n nextSeen\n )\n : { ok: false, node };\n }\n if (node.type === 'AwaitExpression') {\n return resolveActiveConfigRoot(\n node.argument,\n scope,\n functionReturns,\n resolveHelper,\n nextSeen\n );\n }\n return { ok: false, node };\n}\n\n/** Resolves imported/global config helpers and their immutable aliases. */\nfunction resolveConfigHelperCall(\n input: t.Node,\n scope: Scope,\n knownBindings: Set<Binding>,\n globalName: string | undefined,\n seen: Set<Binding> = new Set()\n): ConfigHelperResolution {\n const node = unwrapExpression(input);\n if (node.type !== 'Identifier') return undefined;\n const binding = scope.getBinding(node.name);\n if (!binding) return node.name === globalName ? 'static' : undefined;\n if (knownBindings.has(binding)) return 'static';\n if (seen.has(binding)) return undefined;\n const declaration = binding.path.node;\n if (declaration.type !== 'VariableDeclarator' || !declaration.init) {\n return undefined;\n }\n const nextSeen = new Set(seen);\n nextSeen.add(binding);\n const initialValue = resolveConfigHelperCall(\n declaration.init,\n binding.path.scope,\n knownBindings,\n globalName,\n nextSeen\n );\n return !binding.constant && initialValue ? 'dynamic' : initialValue;\n}\n\n/** Collects Vue plugin calls reachable through the active `plugins` value. */\nfunction collectActiveVuePluginCalls(\n input: t.Node,\n scope: Scope,\n context: VitePluginContext,\n calls: ScopedPluginCall[],\n seen: Set<Binding>\n): t.Node | undefined {\n const node = unwrapExpression(input);\n\n if (node.type === 'Identifier') {\n const value = resolvePluginVueValue(\n node,\n scope,\n context.pluginBindings,\n context.namespaceBindings,\n context.moduleSource,\n new Set()\n );\n if (value === 'dynamic' || value === 'default') return node;\n const binding = scope.getBinding(node.name);\n if (!binding || seen.has(binding)) {\n return mayReferenceVuePlugin(node, scope, context, new Set())\n ? node\n : undefined;\n }\n const declaration = binding.path.node;\n if (declaration.type !== 'VariableDeclarator' || !declaration.init) {\n return mayReferenceVuePlugin(node, scope, context, new Set())\n ? node\n : undefined;\n }\n if (bindingHasMutation(binding)) return node;\n if (!binding.constant) {\n return mayReferenceVuePlugin(\n declaration.init,\n binding.path.scope,\n context,\n new Set()\n )\n ? node\n : undefined;\n }\n const nextSeen = new Set(seen);\n nextSeen.add(binding);\n return collectActiveVuePluginCalls(\n declaration.init,\n binding.path.scope,\n context,\n calls,\n nextSeen\n );\n }\n if (node.type === 'ArrayExpression') {\n for (const element of node.elements) {\n if (!element) continue;\n const unresolved = collectActiveVuePluginCalls(\n element.type === 'SpreadElement' ? element.argument : element,\n scope,\n context,\n calls,\n seen\n );\n if (unresolved) return unresolved;\n }\n return undefined;\n }\n if (\n node.type === 'CallExpression' ||\n node.type === 'OptionalCallExpression'\n ) {\n const value = resolvePluginVueValue(\n node.callee,\n scope,\n context.pluginBindings,\n context.namespaceBindings,\n context.moduleSource,\n new Set()\n );\n if (value === 'dynamic') return node.callee;\n if (value === 'default') {\n calls.push({ node, scope });\n return undefined;\n }\n return mayReferenceVuePlugin(node, scope, context, new Set())\n ? node\n : undefined;\n }\n if (node.type === 'ConditionalExpression') {\n const condition = resolveStaticTruthiness(node.test, scope, new Set());\n if (condition !== undefined) {\n return collectActiveVuePluginCalls(\n condition ? node.consequent : node.alternate,\n scope,\n context,\n calls,\n seen\n );\n }\n return mayReferenceVuePlugin(node, scope, context, new Set())\n ? node\n : undefined;\n }\n if (node.type === 'LogicalExpression') {\n const left = resolveStaticTruthiness(node.left, scope, new Set());\n if (left !== undefined) {\n const selected =\n node.operator === '&&'\n ? left\n ? node.right\n : node.left\n : node.operator === '||'\n ? left\n ? node.left\n : node.right\n : undefined;\n if (selected) {\n return collectActiveVuePluginCalls(\n selected,\n scope,\n context,\n calls,\n seen\n );\n }\n }\n return mayReferenceVuePlugin(node, scope, context, new Set())\n ? node\n : undefined;\n }\n if (node.type === 'SequenceExpression') {\n const last = node.expressions[node.expressions.length - 1];\n return last\n ? collectActiveVuePluginCalls(last, scope, context, calls, seen)\n : undefined;\n }\n return mayReferenceVuePlugin(node, scope, context, new Set())\n ? node\n : undefined;\n}\n\n/** Conservatively follows wrapper bindings that reference the Vue plugin. */\nfunction mayReferenceVuePlugin(\n input: t.Node,\n scope: Scope,\n context: VitePluginContext,\n seen: Set<Binding>\n): boolean {\n const node = unwrapExpression(input);\n const start = node.start;\n const end = node.end;\n if (\n typeof start === 'number' &&\n typeof end === 'number' &&\n context.referencePositions.some(\n (position) => position >= start && position <= end\n )\n ) {\n return true;\n }\n const target =\n node.type === 'Identifier'\n ? node\n : node.type === 'CallExpression' || node.type === 'OptionalCallExpression'\n ? unwrapExpression(node.callee)\n : undefined;\n if (target?.type !== 'Identifier') return false;\n const binding = scope.getBinding(target.name);\n if (!binding) return false;\n if (\n context.pluginBindings.has(binding) ||\n context.namespaceBindings.has(binding)\n ) {\n return true;\n }\n if (seen.has(binding)) return false;\n const nextSeen = new Set(seen);\n nextSeen.add(binding);\n const declaration = binding.path.node;\n if (declaration.type === 'VariableDeclarator' && declaration.init) {\n return mayReferenceVuePlugin(\n declaration.init,\n binding.path.scope,\n context,\n nextSeen\n );\n }\n const declarationStart = declaration.start;\n const declarationEnd = declaration.end;\n return (\n typeof declarationStart === 'number' &&\n typeof declarationEnd === 'number' &&\n context.referencePositions.some(\n (position) => position >= declarationStart && position <= declarationEnd\n )\n );\n}\n\n/** Evaluates only primitive truthiness used to choose a static config branch. */\nfunction resolveStaticTruthiness(\n input: t.Node,\n scope: Scope,\n seen: Set<Binding>\n): boolean | undefined {\n const node = unwrapExpression(input);\n if (node.type === 'BooleanLiteral') return node.value;\n if (node.type === 'NullLiteral') return false;\n if (node.type === 'NumericLiteral') return !!node.value;\n if (node.type === 'BigIntLiteral') return node.value !== '0';\n if (node.type === 'StringLiteral') return node.value.length > 0;\n if (node.type === 'UnaryExpression' && node.operator === '!') {\n const value = resolveStaticTruthiness(node.argument, scope, seen);\n return value === undefined ? undefined : !value;\n }\n if (node.type !== 'Identifier') return undefined;\n if (node.name === 'undefined' && !scope.getBinding(node.name)) return false;\n const binding = scope.getBinding(node.name);\n if (!binding?.constant || bindingHasMutation(binding) || seen.has(binding)) {\n return undefined;\n }\n const declaration = binding.path.node;\n if (declaration.type !== 'VariableDeclarator' || !declaration.init) {\n return undefined;\n }\n const nextSeen = new Set(seen);\n nextSeen.add(binding);\n return resolveStaticTruthiness(\n declaration.init,\n binding.path.scope,\n nextSeen\n );\n}\n\nfunction readNestedCompilerOptions(\n root: t.Node,\n scope: Scope,\n keys: [string, string],\n file: string,\n failOnDynamicRoot: boolean,\n state: CompilerOptionState,\n errors: string[]\n): void {\n const rootObject = resolveStaticObject(root, scope, new Set());\n if (!rootObject.ok) {\n if (failOnDynamicRoot)\n errors.push(dynamicConfigError(file, rootObject.node));\n return;\n }\n\n const parentEntry = rootObject.value.entries.get(keys[0]);\n if (!parentEntry) return;\n const parentObject = resolveStaticObject(\n parentEntry.node,\n parentEntry.scope,\n new Set()\n );\n if (!parentObject.ok) {\n errors.push(dynamicConfigError(file, parentObject.node));\n return;\n }\n\n const compilerEntry = parentObject.value.entries.get(keys[1]);\n if (!compilerEntry) return;\n const compilerObject = resolveStaticObject(\n compilerEntry.node,\n compilerEntry.scope,\n new Set()\n );\n if (!compilerObject.ok) {\n errors.push(dynamicConfigError(file, compilerObject.node));\n return;\n }\n\n readCompilerOptionsObject(compilerObject.value, file, state, errors);\n}\n\nfunction readCompilerOptionsObject(\n object: StaticObject,\n file: string,\n state: CompilerOptionState,\n errors: string[]\n): void {\n for (const [key, entry] of object.entries) {\n if (key !== 'whitespace' && key !== 'delimiters') {\n errors.push(\n locatedOptionError(\n file,\n entry.node,\n `Found unsupported Vue compiler option \"${key}\"`,\n 'gt-vue extraction currently supports only static whitespace and delimiters compiler options'\n )\n );\n }\n }\n\n const whitespaceEntry = object.entries.get('whitespace');\n if (whitespaceEntry) {\n const value = resolveStaticString(\n whitespaceEntry.node,\n whitespaceEntry.scope,\n new Set()\n );\n if (value !== 'condense' && value !== 'preserve') {\n errors.push(dynamicConfigError(file, whitespaceEntry.node));\n } else {\n mergeOption(\n state,\n 'whitespace',\n value,\n { file, node: whitespaceEntry.node },\n errors\n );\n }\n }\n\n const delimitersEntry = object.entries.get('delimiters');\n if (delimitersEntry) {\n const value = resolveStaticDelimiters(\n delimitersEntry.node,\n delimitersEntry.scope,\n new Set()\n );\n if (!value) {\n errors.push(dynamicConfigError(file, delimitersEntry.node));\n } else {\n mergeOption(\n state,\n 'delimiters',\n value,\n { file, node: delimitersEntry.node },\n errors\n );\n }\n }\n}\n\nfunction resolveStaticObject(\n input: t.Node,\n scope: Scope,\n seen: Set<t.Node>\n): ObjectResolution {\n const node = unwrapExpression(input);\n if (seen.has(node)) return { ok: false, node };\n seen.add(node);\n\n if (node.type === 'Identifier') {\n const binding = scope.getBinding(node.name);\n const declaration = binding?.path.node;\n if (\n !binding?.constant ||\n bindingHasMutation(binding) ||\n declaration?.type !== 'VariableDeclarator' ||\n !declaration.init\n ) {\n return { ok: false, node };\n }\n return resolveStaticObject(declaration.init, binding.path.scope, seen);\n }\n if (node.type !== 'ObjectExpression') return { ok: false, node };\n\n const entries = new Map<string, ObjectEntry>();\n for (const property of node.properties) {\n if (property.type === 'SpreadElement') {\n const spread = resolveStaticObject(property.argument, scope, seen);\n if (!spread.ok) return { ok: false, node: spread.node };\n for (const [key, entry] of spread.value.entries) entries.set(key, entry);\n continue;\n }\n const key = readPropertyKey(property);\n if (!key) return { ok: false, node: property };\n if (property.type !== 'ObjectProperty') {\n entries.set(key, { node: property, scope });\n continue;\n }\n entries.set(key, { node: property.value, scope });\n }\n return { ok: true, value: { entries } };\n}\n\nfunction resolveStaticString(\n input: t.Node,\n scope: Scope,\n seen: Set<t.Node>\n): string | undefined {\n const node = unwrapExpression(input);\n if (seen.has(node)) return undefined;\n seen.add(node);\n if (node.type === 'StringLiteral') return node.value;\n if (node.type === 'TemplateLiteral' && node.expressions.length === 0) {\n return node.quasis\n .map((quasi) => quasi.value.cooked ?? quasi.value.raw)\n .join('');\n }\n if (node.type !== 'Identifier') return undefined;\n const binding = scope.getBinding(node.name);\n const declaration = binding?.path.node;\n return binding?.constant &&\n !bindingHasMutation(binding) &&\n declaration?.type === 'VariableDeclarator' &&\n declaration.init\n ? resolveStaticString(declaration.init, binding.path.scope, seen)\n : undefined;\n}\n\nfunction resolveStaticDelimiters(\n input: t.Node,\n scope: Scope,\n seen: Set<t.Node>\n): [string, string] | undefined {\n const node = unwrapExpression(input);\n if (seen.has(node)) return undefined;\n seen.add(node);\n if (node.type === 'Identifier') {\n const binding = scope.getBinding(node.name);\n const declaration = binding?.path.node;\n return binding?.constant &&\n !bindingHasMutation(binding) &&\n declaration?.type === 'VariableDeclarator' &&\n declaration.init\n ? resolveStaticDelimiters(declaration.init, binding.path.scope, seen)\n : undefined;\n }\n if (node.type !== 'ArrayExpression' || node.elements.length !== 2) {\n return undefined;\n }\n const values = node.elements.map((element) =>\n element && element.type !== 'SpreadElement'\n ? resolveStaticString(element, scope, new Set())\n : undefined\n );\n return isDelimiterPair(values) ? values : undefined;\n}\n\nfunction unwrapExpression(input: t.Node): t.Node {\n let node = input;\n while (\n node.type === 'TSAsExpression' ||\n node.type === 'TSSatisfiesExpression' ||\n node.type === 'TSTypeAssertion' ||\n node.type === 'TSNonNullExpression' ||\n node.type === 'TypeCastExpression' ||\n node.type === 'ParenthesizedExpression'\n ) {\n node = node.expression;\n }\n return node;\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 return undefined;\n}\n\nfunction getPluginVueRequireKind(\n input: t.Expression | null | undefined,\n moduleSource: '@vitejs/plugin-vue' | '@vitejs/plugin-vue-jsx'\n): 'default' | 'namespace' | undefined {\n if (!input) return undefined;\n const node = unwrapExpression(input);\n if (\n node.type === 'CallExpression' &&\n node.callee.type === 'Identifier' &&\n node.callee.name === 'require' &&\n node.arguments[0]?.type === 'StringLiteral' &&\n node.arguments[0].value === moduleSource\n ) {\n return 'namespace';\n }\n if (\n (node.type === 'MemberExpression' ||\n node.type === 'OptionalMemberExpression') &&\n isDefaultMember(node)\n ) {\n return getPluginVueRequireKind(node.object as t.Expression, moduleSource)\n ? 'default'\n : undefined;\n }\n return undefined;\n}\n\n/** Resolves immutable aliases of the Vue Vite plugin without executing config. */\nfunction resolvePluginVueValue(\n input: t.Node,\n scope: Scope,\n pluginBindings: Set<Binding>,\n namespaceBindings: Set<Binding>,\n moduleSource: '@vitejs/plugin-vue' | '@vitejs/plugin-vue-jsx',\n seen: Set<Binding>\n): 'default' | 'dynamic' | 'namespace' | undefined {\n const node = unwrapExpression(input);\n const requireKind =\n node.type === 'CallExpression' ||\n node.type === 'MemberExpression' ||\n node.type === 'OptionalMemberExpression'\n ? getPluginVueRequireKind(node, moduleSource)\n : undefined;\n if (requireKind) return requireKind;\n\n if (node.type === 'Identifier') {\n const binding = scope.getBinding(node.name);\n if (!binding) return undefined;\n if (pluginBindings.has(binding)) return 'default';\n if (namespaceBindings.has(binding)) return 'namespace';\n if (seen.has(binding)) return undefined;\n const declaration = binding.path.node;\n if (declaration.type !== 'VariableDeclarator' || !declaration.init) {\n return undefined;\n }\n const nextSeen = new Set(seen);\n nextSeen.add(binding);\n const initialValue = resolvePluginVueValue(\n declaration.init,\n binding.path.scope,\n pluginBindings,\n namespaceBindings,\n moduleSource,\n nextSeen\n );\n return !binding.constant && initialValue ? 'dynamic' : initialValue;\n }\n if (\n (node.type === 'MemberExpression' ||\n node.type === 'OptionalMemberExpression') &&\n isDefaultMember(node)\n ) {\n const objectValue = resolvePluginVueValue(\n node.object,\n scope,\n pluginBindings,\n namespaceBindings,\n moduleSource,\n seen\n );\n if (objectValue === 'dynamic') return 'dynamic';\n if (objectValue === 'namespace') return 'default';\n }\n return undefined;\n}\n\n/** Recognizes every static spelling of a module namespace default export. */\nfunction isDefaultMember(\n node: t.MemberExpression | t.OptionalMemberExpression\n): boolean {\n return (\n (!node.computed &&\n node.property.type === 'Identifier' &&\n node.property.name === 'default') ||\n (node.computed &&\n node.property.type === 'StringLiteral' &&\n node.property.value === 'default')\n );\n}\n\n/** Classifies supported unshadowed CommonJS config exports. */\nfunction readCommonJsConfigExportKind(\n node: t.Node,\n scope: Scope\n): 'exports-default' | 'module-exports' | undefined {\n if (\n node.type !== 'MemberExpression' ||\n node.object.type !== 'Identifier' ||\n !(\n (!node.computed && node.property.type === 'Identifier') ||\n (node.computed && node.property.type === 'StringLiteral')\n )\n ) {\n return undefined;\n }\n const property =\n node.property.type === 'Identifier'\n ? node.property.name\n : node.property.value;\n if (\n node.object.name === 'module' &&\n property === 'exports' &&\n !scope.getBinding('module')\n ) {\n return 'module-exports';\n }\n return node.object.name === 'exports' &&\n property === 'default' &&\n !scope.getBinding('exports')\n ? 'exports-default'\n : undefined;\n}\n\nfunction readBindingIdentifier(node: t.Node): string | undefined {\n if (node.type === 'Identifier') return node.name;\n return node.type === 'AssignmentPattern' && node.left.type === 'Identifier'\n ? node.left.name\n : undefined;\n}\n\nconst MUTATING_METHODS = new Set([\n 'clear',\n 'copyWithin',\n 'delete',\n 'fill',\n 'pop',\n 'push',\n 'reverse',\n 'set',\n 'shift',\n 'sort',\n 'splice',\n 'unshift',\n]);\n\n/** Detects property, collection, and alias mutations Babel does not mark constant. */\nfunction bindingHasMutation(\n binding: Binding,\n seen: Set<Binding> = new Set()\n): boolean {\n if (seen.has(binding)) return false;\n const nextSeen = new Set(seen);\n nextSeen.add(binding);\n\n for (const reference of binding.referencePaths) {\n let current = reference as NodePath<t.Node>;\n while (\n current.parentPath &&\n (current.parentPath.isMemberExpression() ||\n current.parentPath.isOptionalMemberExpression()) &&\n current.parentPath.node.object === current.node\n ) {\n current = current.parentPath as NodePath<t.Node>;\n }\n\n const parent = current.parentPath;\n if (\n (parent?.isAssignmentExpression() && parent.node.left === current.node) ||\n (parent?.isUpdateExpression() && parent.node.argument === current.node) ||\n (parent?.isUnaryExpression({ operator: 'delete' }) &&\n parent.node.argument === current.node)\n ) {\n return true;\n }\n\n if (parent?.isCallExpression() || parent?.isOptionalCallExpression()) {\n if (\n parent.node.callee === current.node &&\n (current.isMemberExpression() ||\n current.isOptionalMemberExpression()) &&\n MUTATING_METHODS.has(readStaticMemberName(current.node) ?? '')\n ) {\n return true;\n }\n if (\n parent.node.arguments[0] === current.node &&\n isGlobalMutationCall(parent.node.callee, parent.scope)\n ) {\n return true;\n }\n if (\n parent.node.arguments.some((argument) => argument === current.node) &&\n !isKnownReadOnlyConfigConsumer(parent.node, current.node, parent.scope)\n ) {\n return true;\n }\n }\n\n const aliasParent = reference.parentPath;\n if (\n aliasParent?.isVariableDeclarator() &&\n aliasParent.node.init === reference.node &&\n aliasParent.node.id.type === 'Identifier'\n ) {\n const alias = aliasParent.scope.getBinding(aliasParent.node.id.name);\n if (alias && bindingHasMutation(alias, nextSeen)) return true;\n }\n if (\n aliasParent?.isVariableDeclarator() &&\n aliasParent.node.init === reference.node &&\n aliasParent.node.id.type !== 'Identifier'\n ) {\n for (const name of collectBindingNames(aliasParent.node.id)) {\n const alias = aliasParent.scope.getBinding(name);\n if (alias && bindingHasMutation(alias, nextSeen)) return true;\n }\n }\n if (\n parent?.isAssignmentExpression({ operator: '=' }) &&\n parent.node.right === current.node\n ) {\n for (const name of collectBindingNames(parent.node.left)) {\n const alias = parent.scope.getBinding(name);\n if (alias && bindingHasMutation(alias, nextSeen)) return true;\n }\n }\n }\n return false;\n}\n\nfunction collectBindingNames(input: t.Node): string[] {\n if (input.type === 'Identifier') return [input.name];\n if (input.type === 'AssignmentPattern') {\n return collectBindingNames(input.left);\n }\n if (input.type === 'RestElement') return collectBindingNames(input.argument);\n if (input.type === 'ArrayPattern') {\n return input.elements.flatMap((element) =>\n element ? collectBindingNames(element) : []\n );\n }\n if (input.type === 'ObjectPattern') {\n return input.properties.flatMap((property) =>\n property.type === 'RestElement'\n ? collectBindingNames(property.argument)\n : collectBindingNames(property.value)\n );\n }\n return [];\n}\n\nfunction readStaticMemberName(\n node: t.MemberExpression | t.OptionalMemberExpression\n): string | undefined {\n if (!node.computed && node.property.type === 'Identifier') {\n return node.property.name;\n }\n return node.computed && node.property.type === 'StringLiteral'\n ? node.property.value\n : undefined;\n}\n\nfunction isGlobalMutationCall(input: t.Node, scope: Scope): boolean {\n const node = unwrapExpression(input);\n if (\n node.type !== 'MemberExpression' &&\n node.type !== 'OptionalMemberExpression'\n ) {\n return false;\n }\n const method = readStaticMemberName(node);\n if (node.object.type !== 'Identifier' || scope.getBinding(node.object.name)) {\n return false;\n }\n return (\n (node.object.name === 'Object' &&\n (method === 'assign' ||\n method === 'defineProperty' ||\n method === 'defineProperties')) ||\n (node.object.name === 'Reflect' &&\n (method === 'set' || method === 'deleteProperty'))\n );\n}\n\nfunction isKnownReadOnlyConfigConsumer(\n call: t.CallExpression | t.OptionalCallExpression,\n argument: t.Node,\n scope: Scope\n): boolean {\n if (resolveKnownConfigConsumer(call.callee, scope, new Set())) return true;\n const callee = unwrapExpression(call.callee);\n if (\n callee.type !== 'MemberExpression' &&\n callee.type !== 'OptionalMemberExpression'\n ) {\n return false;\n }\n const method = readStaticMemberName(callee);\n if (\n callee.object.type !== 'Identifier' ||\n scope.getBinding(callee.object.name)\n ) {\n return false;\n }\n const argumentIndex = call.arguments.findIndex(\n (candidate) => candidate === argument\n );\n if (callee.object.name === 'Object') {\n if (method === 'assign') return argumentIndex > 0;\n return new Set([\n 'entries',\n 'freeze',\n 'getOwnPropertyDescriptor',\n 'getOwnPropertyDescriptors',\n 'getOwnPropertyNames',\n 'getOwnPropertySymbols',\n 'isExtensible',\n 'isFrozen',\n 'isSealed',\n 'keys',\n 'preventExtensions',\n 'seal',\n 'values',\n ]).has(method ?? '');\n }\n return (\n (callee.object.name === 'Array' && method === 'isArray') ||\n (callee.object.name === 'JSON' && method === 'stringify')\n );\n}\n\nfunction resolveKnownConfigConsumer(\n input: t.Node,\n scope: Scope,\n seen: Set<Binding>\n): boolean {\n const node = unwrapExpression(input);\n if (node.type === 'Identifier') {\n const binding = scope.getBinding(node.name);\n if (!binding) return node.name === 'defineNuxtConfig';\n if (seen.has(binding)) return false;\n if (binding.path.isImportDefaultSpecifier()) {\n const declaration = binding.path.parentPath;\n return (\n declaration.isImportDeclaration() &&\n (declaration.node.source.value === '@vitejs/plugin-vue' ||\n declaration.node.source.value === '@vitejs/plugin-vue-jsx')\n );\n }\n if (binding.path.isImportSpecifier()) {\n const declaration = binding.path.parentPath;\n if (!declaration.isImportDeclaration()) return false;\n const imported = binding.path.node.imported;\n const name =\n imported.type === 'Identifier' ? imported.name : imported.value;\n const source = declaration.node.source.value;\n return (\n ((source === '@vitejs/plugin-vue' ||\n source === '@vitejs/plugin-vue-jsx') &&\n name === 'default') ||\n (source === 'vite' && name === 'defineConfig') ||\n ((source === 'nuxt' ||\n source === 'nuxt/config' ||\n source === '#imports') &&\n name === 'defineNuxtConfig')\n );\n }\n const declaration = binding.path.node;\n if (\n binding.constant &&\n declaration.type === 'VariableDeclarator' &&\n declaration.init\n ) {\n const nextSeen = new Set(seen);\n nextSeen.add(binding);\n return resolveKnownConfigConsumer(\n declaration.init,\n binding.path.scope,\n nextSeen\n );\n }\n return false;\n }\n return (\n (node.type === 'MemberExpression' ||\n node.type === 'OptionalMemberExpression') &&\n isDefaultMember(node) &&\n (getPluginVueRequireKind(node as t.Expression, '@vitejs/plugin-vue') ===\n 'default' ||\n getPluginVueRequireKind(\n node as t.Expression,\n '@vitejs/plugin-vue-jsx'\n ) === 'default')\n );\n}\n\nfunction parseConfig(file: string, errors: string[]): t.File | undefined {\n const source = fs.readFileSync(file, 'utf8');\n try {\n return parse(source, {\n sourceType: 'unambiguous',\n plugins: parserPlugins(file),\n });\n } catch (error) {\n if (\n !/compilerOptions|whitespace|delimiters|@vitejs\\/plugin-vue-jsx|babelPlugins|pragma/.test(\n source\n )\n ) {\n return undefined;\n }\n const syntaxError = error as SyntaxError & {\n loc?: { column: number; line: number };\n };\n errors.push(\n withLocation(\n file,\n createDiagnosticMessage({\n whatHappened:\n 'Could not parse a project configuration containing Vue compiler options',\n details: syntaxError.message,\n fix: 'Use a statically analyzable Vite or Nuxt configuration, or configure files.gt.parsingFlags.vueCompilerOptions explicitly',\n }),\n syntaxError.loc\n ? `${syntaxError.loc.line}:${syntaxError.loc.column + 1}`\n : undefined\n )\n );\n return undefined;\n }\n}\n\nfunction parserPlugins(file: string): ParserPlugin[] {\n const extension = path.extname(file).toLowerCase();\n const plugins: ParserPlugin[] = [];\n if (\n extension === '.ts' ||\n extension === '.mts' ||\n extension === '.cts' ||\n extension === '.tsx'\n ) {\n plugins.push('typescript', 'decorators-legacy');\n }\n if (extension === '.jsx' || extension === '.tsx') plugins.push('jsx');\n return plugins;\n}\n\nfunction mergeOption<K extends CompilerOptionName>(\n state: CompilerOptionState,\n key: K,\n value: Required<Pick<VueCompilerOptions, K>>[K],\n source: OptionSource,\n errors: string[]\n): void {\n const existing = state.options[key];\n if (existing !== undefined && !sameOption(existing, value)) {\n errors.push(\n locatedOptionError(\n source.file,\n source.node,\n `Found conflicting Vue ${key} compiler options`,\n 'Use the same Vue compiler options in the project configuration and files.gt.parsingFlags.vueCompilerOptions'\n )\n );\n return;\n }\n Object.assign(state.options, { [key]: value });\n state.sources[key] ??= source;\n}\n\nfunction sameOption(\n first: VueCompilerOptions[CompilerOptionName],\n second: VueCompilerOptions[CompilerOptionName]\n): boolean {\n return Array.isArray(first) && Array.isArray(second)\n ? first[0] === second[0] && first[1] === second[1]\n : first === second;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction isDelimiterPair(value: unknown): value is [string, string] {\n return (\n Array.isArray(value) &&\n value.length === 2 &&\n value.every(\n (delimiter) => typeof delimiter === 'string' && delimiter.length > 0\n )\n );\n}\n\nfunction dynamicConfigError(file: string, node: t.Node): string {\n return locatedOptionError(\n file,\n node,\n 'Could not statically resolve Vue compiler options',\n 'Use static object and string literals for Vue whitespace and delimiters compiler options so extraction hashes match the compiled app'\n );\n}\n\nfunction dynamicVueJSXConfigError(file: string, node: t.Node): string {\n return locatedOptionError(\n file,\n node,\n 'Could not statically resolve @vitejs/plugin-vue-jsx options',\n 'Use one statically configured Vue JSX plugin with the default VNode transform so extraction hashes match the compiled app'\n );\n}\n\nfunction locatedOptionError(\n file: string,\n node: t.Node | undefined,\n whatHappened: string,\n fix: string\n): string {\n return withLocation(\n file,\n createDiagnosticMessage({ whatHappened, fix }),\n node?.loc\n ? `${node.loc.start.line}:${node.loc.start.column + 1}`\n : undefined\n );\n}\n\nfunction optionError(whatHappened: string, fix: string): string {\n return createDiagnosticMessage({ whatHappened, fix });\n}\n\nfunction withLocation(\n file: string,\n message: string,\n location?: string\n): string {\n return `${file}${location ? ` (${location})` : ''}: ${message}`;\n}\n"],"mappings":";;;;;;AAYA,MAAM,WAAW,eAAe,WAAW;AAE3C,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,oBAAoB;CACxB;CACA;CACA;C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,MAAM,IACpB,MAAM,WAAW,KACjB,MAAM,OACH,cAAc,OAAO,cAAc,YAAY,UAAU,SAAS,EACpE;;AAIL,SAAS,mBAAmB,MAAc,MAAsB;AAC9D,QAAO,mBACL,MACA,MACA,qDACA,uIACD;;AAGH,SAAS,yBAAyB,MAAc,MAAsB;AACpE,QAAO,mBACL,MACA,MACA,+DACA,4HACD;;AAGH,SAAS,mBACP,MACA,MACA,cACA,KACQ;AACR,QAAO,aACL,MACA,wBAAwB;EAAE;EAAc;EAAK,CAAC,EAC9C,MAAM,MACF,GAAG,KAAK,IAAI,MAAM,KAAK,GAAG,KAAK,IAAI,MAAM,SAAS,MAClD,KAAA,EACL;;AAGH,SAAS,YAAY,cAAsB,KAAqB;AAC9D,QAAO,wBAAwB;EAAE;EAAc;EAAK,CAAC;;AAGvD,SAAS,aACP,MACA,SACA,UACQ;AACR,QAAO,GAAG,OAAO,WAAW,KAAK,SAAS,KAAK,GAAG,IAAI"}
@@ -0,0 +1,9 @@
1
+ import type { VueExtractionOptions, VueExtractionOutput } from '../types.js';
2
+ /**
3
+ * Extracts General Translation content from one Vue SFC or JavaScript file.
4
+ *
5
+ * The caller owns file discovery, I/O, hashing, and deduplication. This keeps
6
+ * the extractor usable independently from the `gt` CLI, like the Python
7
+ * extractor package.
8
+ */
9
+ export declare function extractFromVueSource(sourceCode: string, filePath: string, options?: VueExtractionOptions): Promise<VueExtractionOutput>;
@@ -0,0 +1,332 @@
1
+ import { addVueError, createVueExtractionContext } from "./utils.js";
2
+ import { collectVueScriptImports, createVueScriptAnalysis, exposeVueScriptImportsToTemplate, parseVueScript } from "./script/analyze.js";
3
+ import { shiftCompilerAstLocations, shiftCompilerLocation } from "./compilerAst.js";
4
+ import { createLocalModuleResolver } from "./script/localModules.js";
5
+ import { parseVueTemplate } from "./template.js";
6
+ import { inspectVueCompiler, resolveVueCompiler } from "./vueCompiler.js";
7
+ import { extname } from "node:path";
8
+ //#region src/internal/extractFromVueSource.ts
9
+ const DEFAULT_SURROUNDING_LINE_COUNT = 5;
10
+ /**
11
+ * Extracts General Translation content from one Vue SFC or JavaScript file.
12
+ *
13
+ * The caller owns file discovery, I/O, hashing, and deduplication. This keeps
14
+ * the extractor usable independently from the `gt` CLI, like the Python
15
+ * extractor package.
16
+ */
17
+ async function extractFromVueSource(sourceCode, filePath, options = {}) {
18
+ const results = [];
19
+ const errors = [];
20
+ const warnings = /* @__PURE__ */ new Set();
21
+ const context = createVueExtractionContext(filePath, sourceCode, options.projectRoot ?? process.cwd(), options.includeSourceCodeContext ?? false, options.surroundingLineCount ?? DEFAULT_SURROUNDING_LINE_COUNT, results, errors, warnings);
22
+ const extension = extname(filePath).toLowerCase();
23
+ const scriptAnalysis = createVueScriptAnalysis();
24
+ scriptAnalysis.entryFile = filePath;
25
+ scriptAnalysis.localModules = createLocalModuleResolver(options.resolveModule);
26
+ if (extension === ".vue") {
27
+ const compilerResolution = options.compiler !== void 0 ? inspectVueCompiler(options.compiler) : resolveVueCompiler(filePath, options.projectRoot ?? process.cwd());
28
+ if (!compilerResolution.ok) {
29
+ addVueError(context, void 0, "Could not load the Vue compiler used by this single-file component", `Install a supported Vue 3 compiler beside the app. ${compilerResolution.details}`);
30
+ return {
31
+ results,
32
+ errors,
33
+ warnings: [...warnings]
34
+ };
35
+ }
36
+ context.implicitSlotWhitespace = compilerResolution.value.implicitSlotWhitespace;
37
+ parseVueSingleFileComponent(sourceCode, context, options.compilerOptions ?? {}, compilerResolution.value, scriptAnalysis);
38
+ } else parseVueScript(sourceCode, languageFromExtension(extension), context, createTemplateBindings(), false, scriptAnalysis, false);
39
+ return {
40
+ results,
41
+ errors,
42
+ warnings: [...warnings]
43
+ };
44
+ }
45
+ function parseVueSingleFileComponent(source, context, compilerOptions, resolvedCompiler, scriptAnalysis) {
46
+ const { compiler } = resolvedCompiler;
47
+ if (compilerOptions.delimiters && !resolvedCompiler.templateCompiler && !resolvedCompiler.templateParseOptionsSupported) {
48
+ addVueError(context, void 0, "Could not safely apply custom Vue template delimiters with the supplied compiler", "Let the extractor resolve the consuming app compiler, or supply a Vue compiler that applies templateParseOptions during SFC parsing");
49
+ return;
50
+ }
51
+ const expressionPlugins = sourceUsesTypeScript(source) ? ["typescript"] : [];
52
+ const templateCompiler = createConfiguredTemplateCompiler(resolvedCompiler, compilerOptions, expressionPlugins, true);
53
+ const result = compiler.parse(source, {
54
+ ...templateCompiler && { compiler: templateCompiler },
55
+ filename: context.file,
56
+ pad: "space",
57
+ sourceMap: false,
58
+ templateParseOptions: {
59
+ ...compilerOptions,
60
+ comments: true,
61
+ expressionPlugins
62
+ }
63
+ });
64
+ for (const error of result.errors) {
65
+ const compilerError = typeof error === "string" ? void 0 : error;
66
+ addVueError(context, compilerError?.loc ? normalizeCompilerLocation(compilerError.loc) : void 0, `Could not parse a gt-vue single-file component: ${typeof error === "string" ? error : error.message}`, "Fix the Vue template syntax before extracting translations");
67
+ }
68
+ if (result.errors.length > 0) return;
69
+ const bindings = createTemplateBindings();
70
+ collectScriptBlockImports(result.descriptor.script, scriptAnalysis);
71
+ collectScriptBlockImports(result.descriptor.scriptSetup, scriptAnalysis);
72
+ const scriptValid = parseScriptBlock(result.descriptor.script, false, context, bindings, scriptAnalysis);
73
+ if (result.descriptor.scriptSetup) exposeVueScriptImportsToTemplate(scriptAnalysis, bindings);
74
+ const scriptSetupValid = parseScriptBlock(result.descriptor.scriptSetup, true, context, bindings, scriptAnalysis);
75
+ if (!scriptValid || !scriptSetupValid) {
76
+ context.results.length = 0;
77
+ return;
78
+ }
79
+ const template = result.descriptor.template;
80
+ if (!template) return;
81
+ if (template.lang && template.lang !== "html") {
82
+ addVueError(context, template.loc, `Found unsupported Vue template language "${template.lang}"`, "Use a standard HTML Vue template for gt-vue extraction");
83
+ context.results.length = 0;
84
+ return;
85
+ }
86
+ if (template.src) {
87
+ addVueError(context, template.loc, "Found an externally sourced Vue template", "Keep the template in the .vue file so gt-vue can extract it");
88
+ context.results.length = 0;
89
+ return;
90
+ }
91
+ const templateAst = resolvedCompiler.parseTemplate ? parseTemplateWithCompiler(template.content, compilerOptions, expressionPlugins, true, context, resolvedCompiler.parseTemplate, template.loc.start) : template.ast;
92
+ if (templateAst) {
93
+ const templateResultStart = context.results.length;
94
+ const templateErrorStart = context.errors.length;
95
+ parseVueTemplate(templateAst, bindings, expressionPlugins, context);
96
+ if (context.errors.length === templateErrorStart && template.content.includes("<!--") && !matchesProductionTemplate(source, compilerOptions, expressionPlugins, bindings, context, templateResultStart, resolvedCompiler)) {
97
+ context.results.length = templateResultStart;
98
+ addVueError(context, template.loc, "Found translatable Vue content whose hash changes between development and production", "Remove comments that split translatable text or whitespace, or move those comments outside gt-vue <T> components");
99
+ }
100
+ }
101
+ }
102
+ /**
103
+ * Verifies that Vite's production comment stripping preserves extracted data.
104
+ *
105
+ * Vue parses templates with comments in development and without them in
106
+ * production. Removing a comment can renormalize adjacent whitespace, so a
107
+ * single persisted catalog key cannot serve both builds. The second parse is
108
+ * limited to templates that contain comments and never executes project code.
109
+ */
110
+ function matchesProductionTemplate(source, compilerOptions, expressionPlugins, bindings, context, developmentResultStart, resolvedCompiler) {
111
+ const { compiler } = resolvedCompiler;
112
+ const templateCompiler = createConfiguredTemplateCompiler(resolvedCompiler, compilerOptions, expressionPlugins, false);
113
+ const production = compiler.parse(source, {
114
+ ...templateCompiler && { compiler: templateCompiler },
115
+ filename: context.file,
116
+ pad: "space",
117
+ sourceMap: false,
118
+ templateParseOptions: {
119
+ ...compilerOptions,
120
+ comments: false,
121
+ expressionPlugins
122
+ }
123
+ });
124
+ const template = production.descriptor.template;
125
+ if (production.errors.length > 0 || !template) return false;
126
+ const productionContext = {
127
+ ...context,
128
+ errors: [],
129
+ results: [],
130
+ warnings: /* @__PURE__ */ new Set()
131
+ };
132
+ const templateAst = resolvedCompiler.parseTemplate ? parseTemplateWithCompiler(template.content, compilerOptions, expressionPlugins, false, productionContext, resolvedCompiler.parseTemplate, template.loc.start) : template.ast;
133
+ if (!templateAst) return false;
134
+ parseVueTemplate(templateAst, bindings, expressionPlugins, productionContext);
135
+ if (productionContext.errors.length > 0) return false;
136
+ return comparableTemplateResults(context.results.slice(developmentResultStart)) === comparableTemplateResults(productionContext.results);
137
+ }
138
+ /**
139
+ * Applies hash-affecting options during compiler-sfc's structural parse.
140
+ *
141
+ * Vue 3.3 ignores `templateParseOptions`, which can make delimiter-shaped text
142
+ * close an SFC block before the exact template-content parse runs. Supplying
143
+ * the adjacent compiler-dom parser makes the descriptor structural parse use
144
+ * the same delimiters and whitespace. Vue 3.3 caches SFC parses using the
145
+ * parser function's string form, so its deterministic identity includes every
146
+ * closure-captured option to prevent cross-option cache poisoning.
147
+ */
148
+ function createConfiguredTemplateCompiler(resolvedCompiler, compilerOptions, expressionPlugins, comments) {
149
+ const templateCompiler = resolvedCompiler.templateCompiler;
150
+ if (!templateCompiler) return void 0;
151
+ const parse = (source, baseOptions) => templateCompiler.parse(source, {
152
+ ...baseOptions,
153
+ ...compilerOptions,
154
+ comments,
155
+ expressionPlugins
156
+ });
157
+ const identity = JSON.stringify({
158
+ comments,
159
+ delimiters: compilerOptions.delimiters,
160
+ expressionPlugins,
161
+ version: resolvedCompiler.version,
162
+ whitespace: compilerOptions.whitespace
163
+ });
164
+ Object.defineProperty(parse, "toString", { value: () => `gtVueTemplateParse:${identity}` });
165
+ return {
166
+ compile: templateCompiler.compile,
167
+ parse
168
+ };
169
+ }
170
+ /** Parses template content with the exact compiler-dom beside consumer Vue. */
171
+ function parseTemplateWithCompiler(source, compilerOptions, expressionPlugins, comments, context, parseTemplate, origin) {
172
+ const errors = [];
173
+ const ast = parseTemplate(source, {
174
+ ...compilerOptions,
175
+ comments,
176
+ expressionPlugins,
177
+ onError(error) {
178
+ errors.push(error);
179
+ }
180
+ });
181
+ if (errors.length === 0) {
182
+ shiftCompilerAstLocations(ast, origin);
183
+ return ast;
184
+ }
185
+ const shiftedErrorPositions = /* @__PURE__ */ new WeakSet();
186
+ for (const error of errors) {
187
+ if (error.loc) shiftCompilerLocation(error.loc, origin, shiftedErrorPositions);
188
+ addVueError(context, error.loc ? normalizeCompilerLocation(error.loc) : void 0, `Could not parse a gt-vue template: ${error.message}`, "Fix the Vue template syntax before extracting translations");
189
+ }
190
+ }
191
+ /** Omits location-only metadata while comparing persisted template content. */
192
+ function comparableTemplateResults(results) {
193
+ return JSON.stringify(results.map((result) => ({
194
+ dataFormat: result.dataFormat,
195
+ context: result.metadata.context,
196
+ source: result.source
197
+ })));
198
+ }
199
+ function collectScriptBlockImports(block, scriptAnalysis) {
200
+ if (!block || block.src || !isSupportedScriptLanguage(block.lang)) return;
201
+ collectVueScriptImports(block.content, block.lang, scriptAnalysis);
202
+ }
203
+ function parseScriptBlock(block, exposeToTemplate, context, bindings, scriptAnalysis) {
204
+ if (!block) return true;
205
+ if (block.src) {
206
+ addVueError(context, block.loc, "Found an externally sourced Vue script block", "Keep translation calls and gt-vue imports in the .vue file");
207
+ return false;
208
+ }
209
+ if (!isSupportedScriptLanguage(block.lang)) {
210
+ addVueError(context, block.loc, `Found unsupported Vue script language "${block.lang}"`, "Use JavaScript or TypeScript for gt-vue extraction");
211
+ return false;
212
+ }
213
+ return parseVueScript(block.content, block.lang, context, bindings, exposeToTemplate, scriptAnalysis);
214
+ }
215
+ function createTemplateBindings() {
216
+ return {
217
+ arrayLengths: /* @__PURE__ */ new Map(),
218
+ componentFactories: /* @__PURE__ */ new Set(),
219
+ components: /* @__PURE__ */ new Map(),
220
+ containerKinds: /* @__PURE__ */ new Map(),
221
+ possibleGTContainers: /* @__PURE__ */ new Set(),
222
+ gtContainerFactories: /* @__PURE__ */ new Set(),
223
+ directBindings: /* @__PURE__ */ new Set(),
224
+ registeredComponents: /* @__PURE__ */ new Map(),
225
+ registeredVueBuiltins: /* @__PURE__ */ new Map(),
226
+ staticValues: /* @__PURE__ */ new Map(),
227
+ identityFunctions: /* @__PURE__ */ new Set(),
228
+ possibleStaticStrings: /* @__PURE__ */ new Map(),
229
+ stringFunctions: /* @__PURE__ */ new Map(),
230
+ uncertainStringFunctions: /* @__PURE__ */ new Set(),
231
+ uncertainComponents: /* @__PURE__ */ new Set(),
232
+ uncertainGTComponents: /* @__PURE__ */ new Set(),
233
+ gtComponentFactories: /* @__PURE__ */ new Set(),
234
+ uncertainRegisteredComponents: /* @__PURE__ */ new Set(),
235
+ uncertainRegisteredGTComponents: /* @__PURE__ */ new Set(),
236
+ vueBuiltins: /* @__PURE__ */ new Map()
237
+ };
238
+ }
239
+ function sourceUsesTypeScript(source) {
240
+ let offset = 0;
241
+ while (offset < source.length) {
242
+ const start = source.indexOf("<script", offset);
243
+ if (start === -1) return false;
244
+ const boundary = source[start + 7];
245
+ if (boundary !== ">" && !boundary?.match(/\s/)) {
246
+ offset = start + 7;
247
+ continue;
248
+ }
249
+ const end = findOpeningTagEnd(source, start + 7);
250
+ if (end === -1) return false;
251
+ const language = readOpeningTagAttribute(source.slice(start + 7, end), "lang");
252
+ if (typeof language === "string" && /^tsx?$/i.test(language)) return true;
253
+ offset = end + 1;
254
+ }
255
+ return false;
256
+ }
257
+ function isSupportedScriptLanguage(language) {
258
+ const normalizedLanguage = language?.toLowerCase();
259
+ return normalizedLanguage === void 0 || normalizedLanguage === "js" || normalizedLanguage === "jsx" || normalizedLanguage === "ts" || normalizedLanguage === "tsx";
260
+ }
261
+ /** Finds an opening tag boundary while respecting quoted attribute values. */
262
+ function findOpeningTagEnd(source, start) {
263
+ let quote;
264
+ for (let index = start; index < source.length; index += 1) {
265
+ const character = source[index];
266
+ if (quote) {
267
+ if (character === quote) quote = void 0;
268
+ } else if (character === "\"" || character === "'") quote = character;
269
+ else if (character === ">") return index;
270
+ }
271
+ return -1;
272
+ }
273
+ /** Reads one case-sensitive SFC attribute with quoted or unquoted syntax. */
274
+ function readOpeningTagAttribute(attributes, requestedName) {
275
+ let offset = 0;
276
+ while (offset < attributes.length) {
277
+ while (offset < attributes.length && /\s/.test(attributes[offset])) offset += 1;
278
+ if (attributes[offset] === "/") {
279
+ offset += 1;
280
+ continue;
281
+ }
282
+ const nameStart = offset;
283
+ while (offset < attributes.length && !/[\s=]/.test(attributes[offset])) offset += 1;
284
+ const name = attributes.slice(nameStart, offset);
285
+ if (!name) break;
286
+ while (offset < attributes.length && /\s/.test(attributes[offset])) offset += 1;
287
+ let value = true;
288
+ if (attributes[offset] === "=") {
289
+ offset += 1;
290
+ while (offset < attributes.length && /\s/.test(attributes[offset])) offset += 1;
291
+ const quote = attributes[offset];
292
+ if (quote === "\"" || quote === "'") {
293
+ offset += 1;
294
+ const valueStart = offset;
295
+ while (offset < attributes.length && attributes[offset] !== quote) offset += 1;
296
+ value = attributes.slice(valueStart, offset);
297
+ if (attributes[offset] === quote) offset += 1;
298
+ } else {
299
+ const valueStart = offset;
300
+ while (offset < attributes.length && !/\s/.test(attributes[offset])) offset += 1;
301
+ value = attributes.slice(valueStart, offset);
302
+ }
303
+ }
304
+ if (name === requestedName) return value;
305
+ }
306
+ }
307
+ function languageFromExtension(extension) {
308
+ if (extension === ".ts" || extension === ".mts" || extension === ".cts") return "ts";
309
+ if (extension === ".tsx") return "tsx";
310
+ if (extension === ".jsx") return "jsx";
311
+ return "js";
312
+ }
313
+ function normalizeCompilerLocation(location) {
314
+ const start = location.start ?? {};
315
+ const end = location.end ?? start;
316
+ return {
317
+ start: {
318
+ column: start.column ?? 1,
319
+ line: start.line ?? 1,
320
+ offset: start.offset ?? 0
321
+ },
322
+ end: {
323
+ column: end.column ?? start.column ?? 1,
324
+ line: end.line ?? start.line ?? 1,
325
+ offset: end.offset ?? start.offset ?? 0
326
+ }
327
+ };
328
+ }
329
+ //#endregion
330
+ export { extractFromVueSource };
331
+
332
+ //# sourceMappingURL=extractFromVueSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractFromVueSource.js","names":[],"sources":["../../src/internal/extractFromVueSource.ts"],"sourcesContent":["import { extname } from 'node:path';\nimport type { ParserPlugin } from '@babel/parser';\nimport type { SFCBlock, TemplateCompiler } from '#vue-compiler-sfc';\nimport type { RootNode } from '@vue/compiler-dom';\nimport type {\n VueCompilerOptions,\n VueExtractionOptions,\n VueExtractionOutput,\n} from '../types.js';\nimport {\n collectVueScriptImports,\n createVueScriptAnalysis,\n exposeVueScriptImportsToTemplate,\n parseVueScript,\n type VueScriptAnalysis,\n} from './script.js';\nimport {\n shiftCompilerAstLocations,\n shiftCompilerLocation,\n} from './compilerAst.js';\nimport { createLocalModuleResolver } from './script/localModules.js';\nimport { parseVueTemplate } from './template.js';\nimport type { TemplateBindings, VueExtractionContext } from './types.js';\nimport { addVueError, createVueExtractionContext } from './utils.js';\nimport {\n inspectVueCompiler,\n resolveVueCompiler,\n type ResolvedVueCompiler,\n} from './vueCompiler.js';\n\nconst DEFAULT_SURROUNDING_LINE_COUNT = 5;\n\n/**\n * Extracts General Translation content from one Vue SFC or JavaScript file.\n *\n * The caller owns file discovery, I/O, hashing, and deduplication. This keeps\n * the extractor usable independently from the `gt` CLI, like the Python\n * extractor package.\n */\nexport async function extractFromVueSource(\n sourceCode: string,\n filePath: string,\n options: VueExtractionOptions = {}\n): Promise<VueExtractionOutput> {\n const results: VueExtractionOutput['results'] = [];\n const errors: string[] = [];\n const warnings = new Set<string>();\n const context = createVueExtractionContext(\n filePath,\n sourceCode,\n options.projectRoot ?? process.cwd(),\n options.includeSourceCodeContext ?? false,\n options.surroundingLineCount ?? DEFAULT_SURROUNDING_LINE_COUNT,\n results,\n errors,\n warnings\n );\n const extension = extname(filePath).toLowerCase();\n const scriptAnalysis = createVueScriptAnalysis();\n scriptAnalysis.entryFile = filePath;\n scriptAnalysis.localModules = createLocalModuleResolver(\n options.resolveModule\n );\n\n if (extension === '.vue') {\n const compilerResolution =\n options.compiler !== undefined\n ? inspectVueCompiler(options.compiler)\n : resolveVueCompiler(filePath, options.projectRoot ?? process.cwd());\n if (!compilerResolution.ok) {\n addVueError(\n context,\n undefined,\n 'Could not load the Vue compiler used by this single-file component',\n `Install a supported Vue 3 compiler beside the app. ${compilerResolution.details}`\n );\n return { results, errors, warnings: [...warnings] };\n }\n context.implicitSlotWhitespace =\n compilerResolution.value.implicitSlotWhitespace;\n parseVueSingleFileComponent(\n sourceCode,\n context,\n options.compilerOptions ?? {},\n compilerResolution.value,\n scriptAnalysis\n );\n } else {\n parseVueScript(\n sourceCode,\n languageFromExtension(extension),\n context,\n createTemplateBindings(),\n false,\n scriptAnalysis,\n false\n );\n }\n\n return { results, errors, warnings: [...warnings] };\n}\n\nfunction parseVueSingleFileComponent(\n source: string,\n context: VueExtractionContext,\n compilerOptions: VueCompilerOptions,\n resolvedCompiler: ResolvedVueCompiler,\n scriptAnalysis: VueScriptAnalysis\n): void {\n const { compiler } = resolvedCompiler;\n if (\n compilerOptions.delimiters &&\n !resolvedCompiler.templateCompiler &&\n !resolvedCompiler.templateParseOptionsSupported\n ) {\n addVueError(\n context,\n undefined,\n 'Could not safely apply custom Vue template delimiters with the supplied compiler',\n 'Let the extractor resolve the consuming app compiler, or supply a Vue compiler that applies templateParseOptions during SFC parsing'\n );\n return;\n }\n const expressionPlugins: ParserPlugin[] = sourceUsesTypeScript(source)\n ? ['typescript']\n : [];\n const templateCompiler = createConfiguredTemplateCompiler(\n resolvedCompiler,\n compilerOptions,\n expressionPlugins,\n true\n );\n const result = compiler.parse(source, {\n ...(templateCompiler && { compiler: templateCompiler }),\n filename: context.file,\n pad: 'space',\n sourceMap: false,\n templateParseOptions: {\n ...compilerOptions,\n comments: true,\n expressionPlugins,\n },\n });\n\n for (const error of result.errors) {\n const compilerError =\n typeof error === 'string'\n ? undefined\n : (error as SyntaxError & {\n loc?: Parameters<typeof normalizeCompilerLocation>[0];\n });\n addVueError(\n context,\n compilerError?.loc\n ? normalizeCompilerLocation(compilerError.loc)\n : undefined,\n `Could not parse a gt-vue single-file component: ${typeof error === 'string' ? error : error.message}`,\n 'Fix the Vue template syntax before extracting translations'\n );\n }\n // Vue's SFC parser recovers a partial AST for malformed markup. Publishing\n // translations from that recovery tree can replace complete catalogs with\n // an incomplete source set, so structural parse errors are file-fatal.\n if (result.errors.length > 0) return;\n\n const bindings = createTemplateBindings();\n collectScriptBlockImports(result.descriptor.script, scriptAnalysis);\n collectScriptBlockImports(result.descriptor.scriptSetup, scriptAnalysis);\n const scriptValid = parseScriptBlock(\n result.descriptor.script,\n false,\n context,\n bindings,\n scriptAnalysis\n );\n if (result.descriptor.scriptSetup) {\n exposeVueScriptImportsToTemplate(scriptAnalysis, bindings);\n }\n const scriptSetupValid = parseScriptBlock(\n result.descriptor.scriptSetup,\n true,\n context,\n bindings,\n scriptAnalysis\n );\n if (!scriptValid || !scriptSetupValid) {\n context.results.length = 0;\n return;\n }\n\n const template = result.descriptor.template;\n if (!template) return;\n if (template.lang && template.lang !== 'html') {\n addVueError(\n context,\n template.loc,\n `Found unsupported Vue template language \"${template.lang}\"`,\n 'Use a standard HTML Vue template for gt-vue extraction'\n );\n context.results.length = 0;\n return;\n }\n if (template.src) {\n addVueError(\n context,\n template.loc,\n 'Found an externally sourced Vue template',\n 'Keep the template in the .vue file so gt-vue can extract it'\n );\n context.results.length = 0;\n return;\n }\n const templateAst = resolvedCompiler.parseTemplate\n ? parseTemplateWithCompiler(\n template.content,\n compilerOptions,\n expressionPlugins,\n true,\n context,\n resolvedCompiler.parseTemplate,\n template.loc.start\n )\n : template.ast;\n if (templateAst) {\n const templateResultStart = context.results.length;\n const templateErrorStart = context.errors.length;\n parseVueTemplate(templateAst, bindings, expressionPlugins, context);\n if (\n context.errors.length === templateErrorStart &&\n template.content.includes('<!--') &&\n !matchesProductionTemplate(\n source,\n compilerOptions,\n expressionPlugins,\n bindings,\n context,\n templateResultStart,\n resolvedCompiler\n )\n ) {\n context.results.length = templateResultStart;\n addVueError(\n context,\n template.loc,\n 'Found translatable Vue content whose hash changes between development and production',\n 'Remove comments that split translatable text or whitespace, or move those comments outside gt-vue <T> components'\n );\n }\n }\n}\n\n/**\n * Verifies that Vite's production comment stripping preserves extracted data.\n *\n * Vue parses templates with comments in development and without them in\n * production. Removing a comment can renormalize adjacent whitespace, so a\n * single persisted catalog key cannot serve both builds. The second parse is\n * limited to templates that contain comments and never executes project code.\n */\nfunction matchesProductionTemplate(\n source: string,\n compilerOptions: VueCompilerOptions,\n expressionPlugins: ParserPlugin[],\n bindings: TemplateBindings,\n context: VueExtractionContext,\n developmentResultStart: number,\n resolvedCompiler: ResolvedVueCompiler\n): boolean {\n const { compiler } = resolvedCompiler;\n const templateCompiler = createConfiguredTemplateCompiler(\n resolvedCompiler,\n compilerOptions,\n expressionPlugins,\n false\n );\n const production = compiler.parse(source, {\n ...(templateCompiler && { compiler: templateCompiler }),\n filename: context.file,\n pad: 'space',\n sourceMap: false,\n templateParseOptions: {\n ...compilerOptions,\n comments: false,\n expressionPlugins,\n },\n });\n const template = production.descriptor.template;\n if (production.errors.length > 0 || !template) return false;\n\n const productionContext: VueExtractionContext = {\n ...context,\n errors: [],\n results: [],\n warnings: new Set(),\n };\n const templateAst = resolvedCompiler.parseTemplate\n ? parseTemplateWithCompiler(\n template.content,\n compilerOptions,\n expressionPlugins,\n false,\n productionContext,\n resolvedCompiler.parseTemplate,\n template.loc.start\n )\n : template.ast;\n if (!templateAst) return false;\n parseVueTemplate(templateAst, bindings, expressionPlugins, productionContext);\n if (productionContext.errors.length > 0) return false;\n\n const developmentResults = context.results.slice(developmentResultStart);\n return (\n comparableTemplateResults(developmentResults) ===\n comparableTemplateResults(productionContext.results)\n );\n}\n\n/**\n * Applies hash-affecting options during compiler-sfc's structural parse.\n *\n * Vue 3.3 ignores `templateParseOptions`, which can make delimiter-shaped text\n * close an SFC block before the exact template-content parse runs. Supplying\n * the adjacent compiler-dom parser makes the descriptor structural parse use\n * the same delimiters and whitespace. Vue 3.3 caches SFC parses using the\n * parser function's string form, so its deterministic identity includes every\n * closure-captured option to prevent cross-option cache poisoning.\n */\nfunction createConfiguredTemplateCompiler(\n resolvedCompiler: ResolvedVueCompiler,\n compilerOptions: VueCompilerOptions,\n expressionPlugins: ParserPlugin[],\n comments: boolean\n): TemplateCompiler | undefined {\n const templateCompiler = resolvedCompiler.templateCompiler;\n if (!templateCompiler) return undefined;\n\n const parse: TemplateCompiler['parse'] = (source, baseOptions) =>\n templateCompiler.parse(source, {\n ...baseOptions,\n ...compilerOptions,\n comments,\n expressionPlugins,\n });\n const identity = JSON.stringify({\n comments,\n delimiters: compilerOptions.delimiters,\n expressionPlugins,\n version: resolvedCompiler.version,\n whitespace: compilerOptions.whitespace,\n });\n Object.defineProperty(parse, 'toString', {\n value: () => `gtVueTemplateParse:${identity}`,\n });\n\n return { compile: templateCompiler.compile, parse };\n}\n\n/** Parses template content with the exact compiler-dom beside consumer Vue. */\nfunction parseTemplateWithCompiler(\n source: string,\n compilerOptions: VueCompilerOptions,\n expressionPlugins: ParserPlugin[],\n comments: boolean,\n context: VueExtractionContext,\n parseTemplate: NonNullable<ResolvedVueCompiler['parseTemplate']>,\n origin: CompilerPosition\n): RootNode | undefined {\n const errors: Array<SyntaxError & { loc?: ExtractionLocationLike }> = [];\n const ast = parseTemplate(source, {\n ...compilerOptions,\n comments,\n expressionPlugins,\n onError(error) {\n errors.push(error as SyntaxError & { loc?: ExtractionLocationLike });\n },\n });\n if (errors.length === 0) {\n shiftCompilerAstLocations(ast, origin);\n return ast;\n }\n const shiftedErrorPositions = new WeakSet<object>();\n for (const error of errors) {\n if (error.loc) {\n shiftCompilerLocation(error.loc, origin, shiftedErrorPositions);\n }\n addVueError(\n context,\n error.loc ? normalizeCompilerLocation(error.loc) : undefined,\n `Could not parse a gt-vue template: ${error.message}`,\n 'Fix the Vue template syntax before extracting translations'\n );\n }\n return undefined;\n}\n\ntype ExtractionLocationLike = Parameters<typeof normalizeCompilerLocation>[0];\ntype CompilerPosition = {\n column: number;\n line: number;\n offset: number;\n};\n\n/** Omits location-only metadata while comparing persisted template content. */\nfunction comparableTemplateResults(\n results: VueExtractionOutput['results']\n): string {\n return JSON.stringify(\n results.map((result) => ({\n dataFormat: result.dataFormat,\n context: result.metadata.context,\n source: result.source,\n }))\n );\n}\n\nfunction collectScriptBlockImports(\n block: SFCBlock | null,\n scriptAnalysis: VueScriptAnalysis\n): void {\n if (!block || block.src || !isSupportedScriptLanguage(block.lang)) return;\n collectVueScriptImports(block.content, block.lang, scriptAnalysis);\n}\n\nfunction parseScriptBlock(\n block: SFCBlock | null,\n exposeToTemplate: boolean,\n context: VueExtractionContext,\n bindings: TemplateBindings,\n scriptAnalysis: VueScriptAnalysis\n): boolean {\n if (!block) return true;\n if (block.src) {\n addVueError(\n context,\n block.loc,\n 'Found an externally sourced Vue script block',\n 'Keep translation calls and gt-vue imports in the .vue file'\n );\n return false;\n }\n if (!isSupportedScriptLanguage(block.lang)) {\n addVueError(\n context,\n block.loc,\n `Found unsupported Vue script language \"${block.lang}\"`,\n 'Use JavaScript or TypeScript for gt-vue extraction'\n );\n return false;\n }\n\n return parseVueScript(\n block.content,\n block.lang,\n context,\n bindings,\n exposeToTemplate,\n scriptAnalysis\n );\n}\n\nfunction createTemplateBindings(): TemplateBindings {\n return {\n arrayLengths: new Map(),\n componentFactories: new Set(),\n components: new Map(),\n containerKinds: new Map(),\n possibleGTContainers: new Set(),\n gtContainerFactories: new Set(),\n directBindings: new Set(),\n registeredComponents: new Map(),\n registeredVueBuiltins: new Map(),\n staticValues: new Map(),\n identityFunctions: new Set(),\n possibleStaticStrings: new Map(),\n stringFunctions: new Map(),\n uncertainStringFunctions: new Set(),\n uncertainComponents: new Set(),\n uncertainGTComponents: new Set(),\n gtComponentFactories: new Set(),\n uncertainRegisteredComponents: new Set(),\n uncertainRegisteredGTComponents: new Set(),\n vueBuiltins: new Map(),\n };\n}\n\nfunction sourceUsesTypeScript(source: string): boolean {\n let offset = 0;\n while (offset < source.length) {\n const start = source.indexOf('<script', offset);\n if (start === -1) return false;\n const boundary = source[start + '<script'.length];\n if (boundary !== '>' && !boundary?.match(/\\s/)) {\n offset = start + '<script'.length;\n continue;\n }\n\n const end = findOpeningTagEnd(source, start + '<script'.length);\n if (end === -1) return false;\n const language = readOpeningTagAttribute(\n source.slice(start + '<script'.length, end),\n 'lang'\n );\n if (typeof language === 'string' && /^tsx?$/i.test(language)) return true;\n offset = end + 1;\n }\n return false;\n}\n\nfunction isSupportedScriptLanguage(language: string | undefined): boolean {\n const normalizedLanguage = language?.toLowerCase();\n return (\n normalizedLanguage === undefined ||\n normalizedLanguage === 'js' ||\n normalizedLanguage === 'jsx' ||\n normalizedLanguage === 'ts' ||\n normalizedLanguage === 'tsx'\n );\n}\n\n/** Finds an opening tag boundary while respecting quoted attribute values. */\nfunction findOpeningTagEnd(source: string, start: number): number {\n let quote: '\"' | \"'\" | undefined;\n for (let index = start; index < source.length; index += 1) {\n const character = source[index];\n if (quote) {\n if (character === quote) quote = undefined;\n } else if (character === '\"' || character === \"'\") {\n quote = character;\n } else if (character === '>') {\n return index;\n }\n }\n return -1;\n}\n\n/** Reads one case-sensitive SFC attribute with quoted or unquoted syntax. */\nfunction readOpeningTagAttribute(\n attributes: string,\n requestedName: string\n): string | true | undefined {\n let offset = 0;\n while (offset < attributes.length) {\n while (offset < attributes.length && /\\s/.test(attributes[offset])) {\n offset += 1;\n }\n if (attributes[offset] === '/') {\n offset += 1;\n continue;\n }\n const nameStart = offset;\n while (offset < attributes.length && !/[\\s=]/.test(attributes[offset])) {\n offset += 1;\n }\n const name = attributes.slice(nameStart, offset);\n if (!name) break;\n\n while (offset < attributes.length && /\\s/.test(attributes[offset])) {\n offset += 1;\n }\n let value: string | true = true;\n if (attributes[offset] === '=') {\n offset += 1;\n while (offset < attributes.length && /\\s/.test(attributes[offset])) {\n offset += 1;\n }\n const quote = attributes[offset];\n if (quote === '\"' || quote === \"'\") {\n offset += 1;\n const valueStart = offset;\n while (offset < attributes.length && attributes[offset] !== quote) {\n offset += 1;\n }\n value = attributes.slice(valueStart, offset);\n if (attributes[offset] === quote) offset += 1;\n } else {\n const valueStart = offset;\n while (offset < attributes.length && !/\\s/.test(attributes[offset])) {\n offset += 1;\n }\n value = attributes.slice(valueStart, offset);\n }\n }\n if (name === requestedName) return value;\n }\n return undefined;\n}\n\nfunction languageFromExtension(extension: string): string {\n if (extension === '.ts' || extension === '.mts' || extension === '.cts') {\n return 'ts';\n }\n if (extension === '.tsx') return 'tsx';\n if (extension === '.jsx') return 'jsx';\n return 'js';\n}\n\nfunction normalizeCompilerLocation(location: {\n end?: { column?: number; line?: number; offset?: number };\n start?: { column?: number; line?: number; offset?: number };\n}) {\n const start = location.start ?? {};\n const end = location.end ?? start;\n return {\n start: {\n column: start.column ?? 1,\n line: start.line ?? 1,\n offset: start.offset ?? 0,\n },\n end: {\n column: end.column ?? start.column ?? 1,\n line: end.line ?? start.line ?? 1,\n offset: end.offset ?? start.offset ?? 0,\n },\n };\n}\n"],"mappings":";;;;;;;;AA8BA,MAAM,iCAAiC;;;;;;;;AASvC,eAAsB,qBACpB,YACA,UACA,UAAgC,EAAE,EACJ;CAC9B,MAAM,UAA0C,EAAE;CAClD,MAAM,SAAmB,EAAE;CAC3B,MAAM,2BAAW,IAAI,KAAa;CAClC,MAAM,UAAU,2BACd,UACA,YACA,QAAQ,eAAe,QAAQ,KAAK,EACpC,QAAQ,4BAA4B,OACpC,QAAQ,wBAAwB,gCAChC,SACA,QACA,SACD;CACD,MAAM,YAAY,QAAQ,SAAS,CAAC,aAAa;CACjD,MAAM,iBAAiB,yBAAyB;AAChD,gBAAe,YAAY;AAC3B,gBAAe,eAAe,0BAC5B,QAAQ,cACT;AAED,KAAI,cAAc,QAAQ;EACxB,MAAM,qBACJ,QAAQ,aAAa,KAAA,IACjB,mBAAmB,QAAQ,SAAS,GACpC,mBAAmB,UAAU,QAAQ,eAAe,QAAQ,KAAK,CAAC;AACxE,MAAI,CAAC,mBAAmB,IAAI;AAC1B,eACE,SACA,KAAA,GACA,sEACA,sDAAsD,mBAAmB,UAC1E;AACD,UAAO;IAAE;IAAS;IAAQ,UAAU,CAAC,GAAG,SAAS;IAAE;;AAErD,UAAQ,yBACN,mBAAmB,MAAM;AAC3B,8BACE,YACA,SACA,QAAQ,mBAAmB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