@generaltranslation/vue-extractor 0.0.0 → 0.1.0-iris.1

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 (89) hide show
  1. package/LICENSE.md +18 -102
  2. package/dist/detect.d.ts +8 -0
  3. package/dist/detect.js +2 -0
  4. package/dist/index.d.ts +3 -1
  5. package/dist/index.js +2 -1
  6. package/dist/inspect.d.ts +9 -0
  7. package/dist/inspect.js +2 -0
  8. package/dist/integration.d.ts +69 -0
  9. package/dist/integration.js +162 -0
  10. package/dist/integration.js.map +1 -0
  11. package/dist/internal/config/configFiles.d.ts +6 -0
  12. package/dist/internal/config/configFiles.js +34 -0
  13. package/dist/internal/config/configFiles.js.map +1 -0
  14. package/dist/internal/config/resolveVueCompilerOptions.d.ts +6 -0
  15. package/dist/internal/config/resolveVueCompilerOptions.js +74 -56
  16. package/dist/internal/config/resolveVueCompilerOptions.js.map +1 -1
  17. package/dist/internal/extractFromVueSource.d.ts +4 -3
  18. package/dist/internal/extractFromVueSource.js +255 -12
  19. package/dist/internal/extractFromVueSource.js.map +1 -1
  20. package/dist/internal/project/consumerUsage.d.ts +34 -0
  21. package/dist/internal/project/consumerUsage.js +1220 -0
  22. package/dist/internal/project/consumerUsage.js.map +1 -0
  23. package/dist/internal/project/detectVueProject.d.ts +13 -0
  24. package/dist/internal/project/detectVueProject.js +65 -0
  25. package/dist/internal/project/detectVueProject.js.map +1 -0
  26. package/dist/internal/project/extractFromVueProject.d.ts +10 -0
  27. package/dist/internal/project/extractFromVueProject.js +579 -0
  28. package/dist/internal/project/extractFromVueProject.js.map +1 -0
  29. package/dist/internal/project/inspectVueProject.d.ts +48 -0
  30. package/dist/internal/project/inspectVueProject.js +143 -0
  31. package/dist/internal/project/inspectVueProject.js.map +1 -0
  32. package/dist/internal/project/manifest.d.ts +64 -0
  33. package/dist/internal/project/manifest.js +270 -0
  34. package/dist/internal/project/manifest.js.map +1 -0
  35. package/dist/internal/project/mergeVueProjectExtraction.d.ts +18 -0
  36. package/dist/internal/project/mergeVueProjectExtraction.js +79 -0
  37. package/dist/internal/project/mergeVueProjectExtraction.js.map +1 -0
  38. package/dist/internal/project/moduleResolver.d.ts +18 -0
  39. package/dist/internal/project/moduleResolver.js +325 -0
  40. package/dist/internal/project/moduleResolver.js.map +1 -0
  41. package/dist/internal/project/scopes.d.ts +31 -0
  42. package/dist/internal/project/scopes.js +182 -0
  43. package/dist/internal/project/scopes.js.map +1 -0
  44. package/dist/internal/project/sourcePatterns.d.ts +4 -0
  45. package/dist/internal/project/sourcePatterns.js +32 -0
  46. package/dist/internal/project/sourcePatterns.js.map +1 -0
  47. package/dist/internal/project/viteAliases.d.ts +42 -0
  48. package/dist/internal/project/viteAliases.js +1020 -0
  49. package/dist/internal/project/viteAliases.js.map +1 -0
  50. package/dist/internal/project/vueSourceClassification.d.ts +13 -0
  51. package/dist/internal/project/vueSourceClassification.js +146 -0
  52. package/dist/internal/project/vueSourceClassification.js.map +1 -0
  53. package/dist/internal/project/workspaces.d.ts +31 -0
  54. package/dist/internal/project/workspaces.js +326 -0
  55. package/dist/internal/project/workspaces.js.map +1 -0
  56. package/dist/internal/project/wrapperProvenance.d.ts +21 -0
  57. package/dist/internal/project/wrapperProvenance.js +287 -0
  58. package/dist/internal/project/wrapperProvenance.js.map +1 -0
  59. package/dist/internal/script/analyze.js +323 -108
  60. package/dist/internal/script/analyze.js.map +1 -1
  61. package/dist/internal/script/jsx.d.ts +7 -4
  62. package/dist/internal/script/jsx.js +351 -79
  63. package/dist/internal/script/jsx.js.map +1 -1
  64. package/dist/internal/script/knownValues.js +4 -0
  65. package/dist/internal/script/knownValues.js.map +1 -1
  66. package/dist/internal/script/localModules.d.ts +23 -2
  67. package/dist/internal/script/localModules.js +535 -20
  68. package/dist/internal/script/localModules.js.map +1 -1
  69. package/dist/internal/script/model.d.ts +10 -3
  70. package/dist/internal/script/parser.js +2 -1
  71. package/dist/internal/script/parser.js.map +1 -1
  72. package/dist/internal/script/runtimeModules.d.ts +10 -0
  73. package/dist/internal/script/runtimeModules.js +27 -0
  74. package/dist/internal/script/runtimeModules.js.map +1 -0
  75. package/dist/internal/stringCalls.js +9 -3
  76. package/dist/internal/stringCalls.js.map +1 -1
  77. package/dist/internal/template.js +263 -141
  78. package/dist/internal/template.js.map +1 -1
  79. package/dist/internal/types.d.ts +5 -2
  80. package/dist/internal/utils.d.ts +14 -3
  81. package/dist/internal/utils.js +63 -3
  82. package/dist/internal/utils.js.map +1 -1
  83. package/dist/internal/vueCompiler.d.ts +9 -1
  84. package/dist/internal/vueCompiler.js +37 -14
  85. package/dist/internal/vueCompiler.js.map +1 -1
  86. package/dist/project.d.ts +11 -0
  87. package/dist/project.js +3 -0
  88. package/dist/types.d.ts +95 -4
  89. package/package.json +30 -4
@@ -1 +1 @@
1
- {"version":3,"file":"localModules.js","names":[],"sources":["../../../src/internal/script/localModules.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport traverseModule, { type Scope } from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport type { VueExtractionOptions } from '../../types.js';\nimport { parseScriptAst } from './parser.js';\n\nconst traverse = traverseModule.default || traverseModule;\n\nconst SOURCE_EXTENSIONS = [\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.mts',\n '.mjs',\n '.cts',\n '.cjs',\n '.vue',\n] as const;\n\nconst GT_EXPORT_NAMES = [\n 'T',\n 'Var',\n 'Num',\n 'DateTime',\n 'Currency',\n 'Plural',\n 'Branch',\n 'msg',\n 'useGT',\n 'useMessages',\n] as const;\n\nconst VUE_EXPORT_NAMES = [\n 'Suspense',\n 'computed',\n 'createVNode',\n 'defineComponent',\n 'defineAsyncComponent',\n 'Fragment',\n 'h',\n 'markRaw',\n 'reactive',\n 'readonly',\n 'ref',\n 'shallowReactive',\n 'shallowReadonly',\n 'shallowRef',\n 'toRaw',\n 'unref',\n] as const;\n\ntype ExternalModuleName = 'gt-vue' | 'vue';\n\ntype DeclaredExport =\n | { type: 'expression'; node: t.Node }\n | { type: 'local'; name: string }\n | { type: 'namespace'; source: string }\n | { type: 'reexport'; importedName: string; source: string };\n\ntype ImportedBinding = {\n importedName: string | '*';\n source: string;\n};\n\n/** One parsed local source module used exclusively for static analysis. */\nexport type LocalModuleRecord = {\n ast: t.File;\n explicitExports: Map<string, DeclaredExport | 'ambiguous'>;\n filePath: string;\n imports: Map<string, ImportedBinding>;\n programScope: Scope;\n starExports: string[];\n};\n\n/** A statically resolved ESM export without executing project code. */\nexport type LocalExportTarget =\n | {\n exportName: string;\n originKey: string;\n record: LocalModuleRecord;\n type: 'local';\n }\n | {\n node: t.Node;\n originKey: string;\n record: LocalModuleRecord;\n type: 'expression';\n }\n | {\n exportName: string;\n originKey: string;\n source: ExternalModuleName;\n type: 'external';\n }\n | {\n originKey: string;\n source: ExternalModuleName;\n type: 'external-namespace';\n }\n | {\n modulePath: string;\n originKey: string;\n type: 'namespace';\n };\n\n/** Result of resolving one named export through a local ESM graph. */\nexport type LocalExportResolution =\n | { status: 'absent' | 'ambiguous' | 'invalid' }\n | { status: 'resolved'; target: LocalExportTarget };\n\n/** Read-only local source resolver used by the Vue script analyzer. */\nexport type LocalModuleResolver = {\n getRecord(filePath: string): LocalModuleRecord | undefined;\n /** Whether the caller supplied project-specific bare-specifier semantics. */\n hasCustomResolver: boolean;\n listExportNames(filePath: string): string[];\n resolveExport(filePath: string, exportName: string): LocalExportResolution;\n resolveModule(importer: string, specifier: string): string | undefined;\n};\n\n/**\n * Creates a cycle-safe ESM resolver for local source files and index barrels.\n *\n * The resolver reads and parses source text but never imports or executes it.\n * Bare aliases are accepted only through the caller's explicit resolver hook.\n */\nexport function createLocalModuleResolver(\n resolveModuleOption: VueExtractionOptions['resolveModule']\n): LocalModuleResolver {\n const records = new Map<string, LocalModuleRecord | null>();\n const resolutions = new Map<string, LocalExportResolution>();\n\n const resolveModule = (\n importer: string,\n specifier: string\n ): string | undefined => {\n if (specifier === 'gt-vue' || specifier === 'vue') return undefined;\n let requested: string | undefined;\n if (resolveModuleOption) {\n try {\n const resolved = resolveModuleOption(specifier, importer);\n requested = resolved\n ? path.isAbsolute(resolved)\n ? resolved\n : path.resolve(path.dirname(importer), resolved)\n : undefined;\n } catch {\n // A project resolver is advisory. Relative paths retain the safe,\n // filesystem-only fallback below when the hook cannot resolve them.\n }\n }\n if (\n !requested &&\n (specifier.startsWith('.') || path.isAbsolute(specifier))\n ) {\n requested = path.isAbsolute(specifier)\n ? specifier\n : path.resolve(path.dirname(importer), specifier);\n }\n return requested ? resolveSourceFile(requested) : undefined;\n };\n\n const getRecord = (filePath: string): LocalModuleRecord | undefined => {\n const normalized = path.resolve(filePath);\n const cached = records.get(normalized);\n if (cached !== undefined) return cached ?? undefined;\n // The sentinel also makes self-imports and parse-time cycles fail closed.\n records.set(normalized, null);\n const parsed = parseLocalModule(normalized);\n records.set(normalized, parsed ?? null);\n return parsed;\n };\n\n const resolveExportInternal = (\n filePath: string,\n exportName: string,\n seen: Set<string>\n ): LocalExportResolution => {\n const normalized = path.resolve(filePath);\n const cycleKey = `${normalized}\\0${exportName}`;\n if (seen.has(cycleKey)) return { status: 'absent' };\n const record = getRecord(normalized);\n if (!record) return { status: 'invalid' };\n const nextSeen = new Set(seen).add(cycleKey);\n const explicit = record.explicitExports.get(exportName);\n if (explicit === 'ambiguous') return { status: 'ambiguous' };\n if (explicit) {\n return resolveDeclaredExport(record, exportName, explicit, nextSeen);\n }\n if (exportName === 'default') return { status: 'absent' };\n\n const candidates: LocalExportTarget[] = [];\n let invalid = false;\n for (const source of record.starExports) {\n const candidate = resolveFromSource(record, source, exportName, nextSeen);\n if (candidate.status === 'resolved') candidates.push(candidate.target);\n if (candidate.status === 'ambiguous') return candidate;\n if (candidate.status === 'invalid') invalid = true;\n }\n if (candidates.length === 0) {\n return { status: invalid ? 'invalid' : 'absent' };\n }\n const origins = new Set(candidates.map(({ originKey }) => originKey));\n return origins.size === 1\n ? { status: 'resolved', target: candidates[0]! }\n : { status: 'ambiguous' };\n };\n\n const resolveFromSource = (\n record: LocalModuleRecord,\n source: string,\n exportName: string,\n seen: Set<string>\n ): LocalExportResolution => {\n if (isExternalModule(source)) {\n return knownExternalExport(source, exportName)\n ? {\n status: 'resolved',\n target: {\n exportName,\n originKey: `${source}#${exportName}`,\n source,\n type: 'external',\n },\n }\n : { status: 'absent' };\n }\n const modulePath = resolveModule(record.filePath, source);\n return modulePath\n ? resolveExportInternal(modulePath, exportName, seen)\n : { status: 'invalid' };\n };\n\n const resolveDeclaredExport = (\n record: LocalModuleRecord,\n exportName: string,\n declared: DeclaredExport,\n seen: Set<string>\n ): LocalExportResolution => {\n if (declared.type === 'reexport') {\n return resolveFromSource(\n record,\n declared.source,\n declared.importedName,\n seen\n );\n }\n if (declared.type === 'namespace') {\n if (isExternalModule(declared.source)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${declared.source}#namespace`,\n source: declared.source,\n type: 'external-namespace',\n },\n };\n }\n const modulePath = resolveModule(record.filePath, declared.source);\n return modulePath\n ? {\n status: 'resolved',\n target: {\n modulePath,\n originKey: `${modulePath}#namespace`,\n type: 'namespace',\n },\n }\n : { status: 'invalid' };\n }\n if (declared.type === 'local') {\n const imported = record.imports.get(declared.name);\n if (imported) {\n if (imported.importedName === '*') {\n if (isExternalModule(imported.source)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${imported.source}#namespace`,\n source: imported.source,\n type: 'external-namespace',\n },\n };\n }\n const modulePath = resolveModule(record.filePath, imported.source);\n return modulePath\n ? {\n status: 'resolved',\n target: {\n modulePath,\n originKey: `${modulePath}#namespace`,\n type: 'namespace',\n },\n }\n : { status: 'invalid' };\n }\n return resolveFromSource(\n record,\n imported.source,\n imported.importedName,\n seen\n );\n }\n return {\n status: 'resolved',\n target: {\n exportName: declared.name,\n originKey: `${record.filePath}#local:${declared.name}`,\n record,\n type: 'local',\n },\n };\n }\n return {\n status: 'resolved',\n target: {\n node: declared.node,\n originKey: `${record.filePath}#expression:${exportName}`,\n record,\n type: 'expression',\n },\n };\n };\n\n const resolveExport = (\n filePath: string,\n exportName: string\n ): LocalExportResolution => {\n const cacheKey = `${path.resolve(filePath)}\\0${exportName}`;\n const cached = resolutions.get(cacheKey);\n if (cached) return cached;\n const result = resolveExportInternal(filePath, exportName, new Set());\n resolutions.set(cacheKey, result);\n return result;\n };\n\n const listExportNames = (filePath: string): string[] => {\n return [...collectExportNames(filePath, new Set())].sort();\n };\n\n const collectExportNames = (\n filePath: string,\n seen: Set<string>\n ): Set<string> => {\n const normalized = path.resolve(filePath);\n if (seen.has(normalized)) return new Set();\n const record = getRecord(normalized);\n if (!record) return new Set();\n const nextSeen = new Set(seen).add(normalized);\n const names = new Set(record.explicitExports.keys());\n for (const source of record.starExports) {\n if (source === 'gt-vue') {\n for (const name of GT_EXPORT_NAMES) names.add(name);\n } else if (source === 'vue') {\n for (const name of VUE_EXPORT_NAMES) names.add(name);\n } else {\n const modulePath = resolveModule(record.filePath, source);\n if (!modulePath) continue;\n for (const name of collectExportNames(modulePath, nextSeen)) {\n if (name !== 'default') names.add(name);\n }\n }\n }\n return names;\n };\n\n return {\n getRecord,\n hasCustomResolver: resolveModuleOption !== undefined,\n listExportNames,\n resolveExport,\n resolveModule,\n };\n}\n\nfunction resolveSourceFile(requested: string): string | undefined {\n const candidates: string[] = [requested];\n const extension = path.extname(requested).toLowerCase();\n if (!extension) {\n for (const sourceExtension of SOURCE_EXTENSIONS) {\n candidates.push(`${requested}${sourceExtension}`);\n }\n for (const sourceExtension of SOURCE_EXTENSIONS) {\n candidates.push(path.join(requested, `index${sourceExtension}`));\n }\n } else if (['.js', '.jsx', '.mjs'].includes(extension)) {\n const base = requested.slice(0, -extension.length);\n for (const sourceExtension of SOURCE_EXTENSIONS) {\n candidates.push(`${base}${sourceExtension}`);\n }\n }\n return candidates.find(isReadableFile);\n}\n\nfunction isReadableFile(filePath: string): boolean {\n try {\n return fs.statSync(filePath).isFile();\n } catch {\n return false;\n }\n}\n\nfunction parseLocalModule(filePath: string): LocalModuleRecord | undefined {\n let source: string;\n try {\n source = fs.readFileSync(filePath, 'utf8');\n } catch {\n return undefined;\n }\n const extension = path.extname(filePath).toLowerCase();\n // Node treats these extensions as CommonJS regardless of package metadata.\n // Parsing ESM-looking syntax here would prove an identity the application\n // cannot actually import with ESM semantics, so both formats fail closed.\n if (extension === '.cjs' || extension === '.cts') return undefined;\n let language = extension.slice(1);\n if (extension === '.mjs') language = 'js';\n if (extension === '.mts') language = 'ts';\n // A local .vue module must be parsed with the consuming application's exact\n // compiler. The extractor deliberately fails closed here instead of\n // reintroducing a bundled-compiler mismatch through barrel resolution.\n if (extension === '.vue') return undefined;\n if (!['js', 'jsx', 'ts', 'tsx'].includes(language)) return undefined;\n\n let ast: t.File;\n try {\n ast = parseScriptAst(source, language);\n } catch {\n return undefined;\n }\n let programScope: Scope | undefined;\n traverse(ast, {\n Program(programPath) {\n programScope = programPath.scope;\n programPath.stop();\n },\n });\n if (!programScope) return undefined;\n\n const record: LocalModuleRecord = {\n ast,\n explicitExports: new Map(),\n filePath,\n imports: collectImportedBindings(ast),\n programScope,\n starExports: [],\n };\n collectExports(record);\n return record;\n}\n\nfunction collectImportedBindings(ast: t.File): Map<string, ImportedBinding> {\n const imports = new Map<string, ImportedBinding>();\n for (const statement of ast.program.body) {\n if (\n statement.type !== 'ImportDeclaration' ||\n statement.importKind === 'type'\n ) {\n continue;\n }\n for (const specifier of statement.specifiers) {\n if (\n specifier.type === 'ImportSpecifier' &&\n specifier.importKind !== 'type'\n ) {\n imports.set(specifier.local.name, {\n importedName:\n specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value,\n source: statement.source.value,\n });\n } else if (specifier.type === 'ImportDefaultSpecifier') {\n imports.set(specifier.local.name, {\n importedName: 'default',\n source: statement.source.value,\n });\n } else if (specifier.type === 'ImportNamespaceSpecifier') {\n imports.set(specifier.local.name, {\n importedName: '*',\n source: statement.source.value,\n });\n }\n }\n }\n return imports;\n}\n\nfunction collectExports(record: LocalModuleRecord): void {\n for (const statement of record.ast.program.body) {\n if (statement.type === 'ExportAllDeclaration') {\n if (statement.exportKind !== 'type') {\n record.starExports.push(statement.source.value);\n }\n continue;\n }\n if (statement.type === 'ExportDefaultDeclaration') {\n addExplicitExport(record, 'default', {\n node: statement.declaration,\n type: 'expression',\n });\n continue;\n }\n if (\n statement.type !== 'ExportNamedDeclaration' ||\n statement.exportKind === 'type'\n ) {\n continue;\n }\n if (statement.declaration) {\n for (const name of declaredNames(statement.declaration)) {\n addExplicitExport(record, name, { name, type: 'local' });\n }\n }\n for (const specifier of statement.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.exportKind === 'type'\n ) {\n continue;\n }\n const exportedName =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n if (specifier.type === 'ExportNamespaceSpecifier') {\n if (statement.source) {\n addExplicitExport(record, exportedName, {\n source: statement.source.value,\n type: 'namespace',\n });\n }\n continue;\n }\n if (specifier.type !== 'ExportSpecifier') continue;\n const localName = specifier.local.name;\n addExplicitExport(\n record,\n exportedName,\n statement.source\n ? {\n importedName: localName,\n source: statement.source.value,\n type: 'reexport',\n }\n : { name: localName, type: 'local' }\n );\n }\n }\n}\n\nfunction addExplicitExport(\n record: LocalModuleRecord,\n name: string,\n value: DeclaredExport\n): void {\n record.explicitExports.set(\n name,\n record.explicitExports.has(name) ? 'ambiguous' : value\n );\n}\n\nfunction declaredNames(declaration: t.Declaration): string[] {\n if (\n declaration.type === 'FunctionDeclaration' ||\n declaration.type === 'ClassDeclaration'\n ) {\n return declaration.id ? [declaration.id.name] : [];\n }\n if (declaration.type !== 'VariableDeclaration') return [];\n return declaration.declarations.flatMap(({ id }) => patternNames(id));\n}\n\nfunction patternNames(pattern: t.Node): string[] {\n if (pattern.type === 'Identifier') return [pattern.name];\n if (pattern.type === 'RestElement') return patternNames(pattern.argument);\n if (pattern.type === 'AssignmentPattern') return patternNames(pattern.left);\n if (pattern.type === 'ArrayPattern') {\n return pattern.elements.flatMap((element) =>\n element ? patternNames(element) : []\n );\n }\n if (pattern.type === 'ObjectPattern') {\n return pattern.properties.flatMap((property) =>\n property.type === 'RestElement'\n ? patternNames(property.argument)\n : patternNames(property.value)\n );\n }\n return [];\n}\n\nfunction isExternalModule(source: string): source is ExternalModuleName {\n return source === 'gt-vue' || source === 'vue';\n}\n\nfunction knownExternalExport(\n source: ExternalModuleName,\n exportName: string\n): boolean {\n return source === 'gt-vue'\n ? (GT_EXPORT_NAMES as readonly string[]).includes(exportName)\n : (VUE_EXPORT_NAMES as readonly string[]).includes(exportName);\n}\n"],"mappings":";;;;;AAOA,MAAM,WAAW,eAAe,WAAW;AAE3C,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;AA6ED,SAAgB,0BACd,qBACqB;CACrB,MAAM,0BAAU,IAAI,KAAuC;CAC3D,MAAM,8BAAc,IAAI,KAAoC;CAE5D,MAAM,iBACJ,UACA,cACuB;AACvB,MAAI,cAAc,YAAY,cAAc,MAAO,QAAO,KAAA;EAC1D,IAAI;AACJ,MAAI,oBACF,KAAI;GACF,MAAM,WAAW,oBAAoB,WAAW,SAAS;AACzD,eAAY,WACR,KAAK,WAAW,SAAS,GACvB,WACA,KAAK,QAAQ,KAAK,QAAQ,SAAS,EAAE,SAAS,GAChD,KAAA;UACE;AAKV,MACE,CAAC,cACA,UAAU,WAAW,IAAI,IAAI,KAAK,WAAW,UAAU,EAExD,aAAY,KAAK,WAAW,UAAU,GAClC,YACA,KAAK,QAAQ,KAAK,QAAQ,SAAS,EAAE,UAAU;AAErD,SAAO,YAAY,kBAAkB,UAAU,GAAG,KA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AE,CACrC;AAEH,KAAI,QAAQ,SAAS,gBACnB,QAAO,QAAQ,WAAW,SAAS,aACjC,SAAS,SAAS,gBACd,aAAa,SAAS,SAAS,GAC/B,aAAa,SAAS,MAAM,CACjC;AAEH,QAAO,EAAE;;AAGX,SAAS,iBAAiB,QAA8C;AACtE,QAAO,WAAW,YAAY,WAAW;;AAG3C,SAAS,oBACP,QACA,YACS;AACT,QAAO,WAAW,WACb,gBAAsC,SAAS,WAAW,GAC1D,iBAAuC,SAAS,WAAW"}
1
+ {"version":3,"file":"localModules.js","names":["parseModuleImports"],"sources":["../../../src/internal/script/localModules.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport traverseModule, {\n type Binding,\n type NodePath,\n type Scope,\n} from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport {\n initSync as initModuleLexer,\n parse as parseModuleImports,\n} from 'es-module-lexer';\nimport type { VueExtractionOptions } from '../../types.js';\nimport { parseScriptAst } from './parser.js';\nimport { isKnownNonVueGTRuntime } from './runtimeModules.js';\n\nconst traverse = traverseModule.default || traverseModule;\n\nconst SOURCE_EXTENSIONS = [\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.mts',\n '.mjs',\n '.cts',\n '.cjs',\n '.vue',\n] as const;\n\nconst GT_EXPORT_NAMES = [\n 'T',\n 'Var',\n 'Num',\n 'DateTime',\n 'Currency',\n 'Plural',\n 'Branch',\n 'msg',\n 't',\n 'useGT',\n 'useMessages',\n] as const;\n\n/** Complete public value surface currently exported by the gt-vue runtime. */\nconst GT_RUNTIME_EXPORT_NAMES = [\n ...GT_EXPORT_NAMES,\n 'createGT',\n 'initializeGTSPA',\n 'useLocale',\n 'useSetLocale',\n] as const;\n\nconst VUE_EXPORT_NAMES = [\n 'Suspense',\n 'computed',\n 'createVNode',\n 'defineComponent',\n 'defineAsyncComponent',\n 'Fragment',\n 'h',\n 'markRaw',\n 'reactive',\n 'readonly',\n 'ref',\n 'shallowReactive',\n 'shallowReadonly',\n 'shallowRef',\n 'toRaw',\n 'unref',\n] as const;\n\ntype ExternalModuleName = 'gt-vue' | 'vue';\n\ntype DeclaredExport =\n | { type: 'expression'; node: t.Node }\n | { type: 'local'; name: string }\n | { type: 'namespace'; source: string }\n | { type: 'reexport'; importedName: string; source: string };\n\ntype RecoveredDeclaredExport = Extract<\n DeclaredExport,\n { type: 'namespace' | 'reexport' }\n>;\n\ntype RecoveredModuleRecord = {\n explicitExports: Map<string, RecoveredDeclaredExport | 'ambiguous'>;\n filePath: string;\n starExports: string[];\n};\n\ntype ImportedBinding = {\n importedName: string | '*';\n source: string;\n};\n\n/** One parsed local source module used exclusively for static analysis. */\nexport type LocalModuleRecord = {\n ast: t.File;\n explicitExports: Map<string, DeclaredExport | 'ambiguous'>;\n filePath: string;\n imports: Map<string, ImportedBinding>;\n programScope: Scope;\n starExports: string[];\n};\n\n/** A statically resolved ESM export without executing project code. */\nexport type LocalExportTarget =\n | {\n exportName: string;\n originKey: string;\n record: LocalModuleRecord;\n type: 'local';\n }\n | {\n node: t.Node;\n originKey: string;\n record: LocalModuleRecord;\n type: 'expression';\n }\n | {\n exportName: string;\n originKey: string;\n source: ExternalModuleName;\n type: 'external';\n }\n | {\n originKey: string;\n source: ExternalModuleName;\n type: 'external-namespace';\n }\n | {\n /** A statically proven export from an official non-Vue GT runtime. */\n originKey: string;\n type: 'ordinary-external';\n }\n | {\n modulePath: string;\n originKey: string;\n type: 'namespace';\n };\n\n/** Result of resolving one named export through a local ESM graph. */\nexport type LocalExportResolution =\n | { status: 'absent' | 'ambiguous' }\n | {\n gtExportName?: string | '*';\n hasGTSourceReference?: boolean;\n /** Fully resolved targets recovered from an otherwise invalid module. */\n recoveredTargets?: LocalExportTarget[];\n status: 'invalid';\n }\n | { status: 'resolved'; target: LocalExportTarget };\n\n/** Read-only local source resolver used by the Vue script analyzer. */\nexport type LocalModuleResolver = {\n getRecord(filePath: string): LocalModuleRecord | undefined;\n /** Returns the exact GT leaf behind an export, excluding namespace containers. */\n getGTExportName(\n filePath: string,\n exportName: string\n ): string | '*' | undefined;\n /** Whether the caller supplied project-specific bare-specifier semantics. */\n hasCustomResolver: boolean;\n /** Whether a resolved module belongs to project source rather than an install. */\n isProjectModule(filePath: string): boolean;\n listExportNames(filePath: string): string[];\n /** Whether a named export is statically connected to the gt-vue runtime. */\n hasGTExportReference(filePath: string, exportName: string): boolean;\n resolveExport(filePath: string, exportName: string): LocalExportResolution;\n resolveModule(importer: string, specifier: string): string | undefined;\n};\n\n/** Package-provenance behavior that is broader than source extraction. */\nexport type LocalModuleResolverOptions = {\n /** Includes gt-vue setup and locale APIs that extraction never calls. */\n recognizeAllGTRuntimeExports?: boolean;\n};\n\n/**\n * Creates a cycle-safe ESM resolver for local source files and index barrels.\n *\n * The resolver reads and parses source text but never imports or executes it.\n * Bare aliases are accepted only through the caller's explicit resolver hook.\n */\nexport function createLocalModuleResolver(\n resolveModuleOption: VueExtractionOptions['resolveModule'],\n options: LocalModuleResolverOptions = {}\n): LocalModuleResolver {\n const records = new Map<string, LocalModuleRecord | null>();\n const recoveredRecords = new Map<string, RecoveredModuleRecord | null>();\n const resolutions = new Map<string, LocalExportResolution>();\n const recordPaths = new WeakMap<\n LocalModuleRecord,\n WeakMap<t.Node, NodePath<t.Node>>\n >();\n\n const isProjectModule = (filePath: string): boolean => {\n const realPath = readRealPath(path.resolve(filePath));\n // The caller's resolver contract accepts local workspace source even when\n // it sits above the metadata project root. Resolve symlinks before checking\n // the package boundary so linked workspaces remain local while installed\n // package implementations stay opaque.\n return !realPath.split(path.sep).includes('node_modules');\n };\n\n const resolveModule = (\n importer: string,\n specifier: string\n ): string | undefined => {\n if (specifier === 'gt-vue' || specifier === 'vue') return undefined;\n let requested: string | undefined;\n if (resolveModuleOption) {\n try {\n const resolved = resolveModuleOption(specifier, importer);\n requested = resolved\n ? path.isAbsolute(resolved)\n ? resolved\n : path.resolve(path.dirname(importer), resolved)\n : undefined;\n } catch {\n // A project resolver is advisory. Relative paths retain the safe,\n // filesystem-only fallback below when the hook cannot resolve them.\n }\n }\n if (\n !requested &&\n (specifier.startsWith('.') || path.isAbsolute(specifier))\n ) {\n requested = path.isAbsolute(specifier)\n ? specifier\n : path.resolve(path.dirname(importer), specifier);\n }\n return requested ? resolveSourceFile(requested) : undefined;\n };\n\n const getRecord = (filePath: string): LocalModuleRecord | undefined => {\n const normalized = path.resolve(filePath);\n if (!isProjectModule(normalized)) return undefined;\n const cached = records.get(normalized);\n if (cached !== undefined) return cached ?? undefined;\n // The sentinel also makes self-imports and parse-time cycles fail closed.\n records.set(normalized, null);\n const parsed = parseLocalModule(normalized);\n records.set(normalized, parsed ?? null);\n return parsed;\n };\n\n const getRecoveredRecord = (\n filePath: string\n ): RecoveredModuleRecord | undefined => {\n const normalized = path.resolve(filePath);\n if (!isProjectModule(normalized)) return undefined;\n const cached = recoveredRecords.get(normalized);\n if (cached !== undefined) return cached ?? undefined;\n const recovered = recoverMalformedModuleExports(normalized);\n recoveredRecords.set(normalized, recovered ?? null);\n return recovered;\n };\n\n const resolveExportInternal = (\n filePath: string,\n exportName: string,\n seen: Set<string>\n ): LocalExportResolution => {\n const normalized = path.resolve(filePath);\n if (!isProjectModule(normalized)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${normalized}#${exportName}`,\n type: 'ordinary-external',\n },\n };\n }\n const cycleKey = `${normalized}\\0${exportName}`;\n if (seen.has(cycleKey)) return { status: 'absent' };\n const nextSeen = new Set(seen).add(cycleKey);\n const record = getRecord(normalized);\n if (!record) {\n const recovered = getRecoveredRecord(normalized);\n return recovered\n ? resolveRecoveredExport(recovered, exportName, nextSeen)\n : { status: 'invalid' };\n }\n const explicit = record.explicitExports.get(exportName);\n if (explicit === 'ambiguous') return { status: 'ambiguous' };\n if (explicit) {\n return resolveDeclaredExport(record, exportName, explicit, nextSeen);\n }\n if (exportName === 'default') return { status: 'absent' };\n\n const candidates: LocalExportTarget[] = [];\n let ambiguous = false;\n let invalid = false;\n let invalidGTExportName: string | '*' | undefined;\n let invalidGTSourceReference = false;\n let recoveredTargets: LocalExportTarget[] | undefined = [];\n for (const source of record.starExports) {\n const candidate = resolveFromSource(record, source, exportName, nextSeen);\n if (candidate.status === 'absent') continue;\n const candidateGTExportName = readGTExportName(candidate, nextSeen);\n invalidGTSourceReference ||= candidateGTExportName !== undefined;\n invalidGTExportName ??= candidateGTExportName;\n if (candidate.status === 'resolved') {\n candidates.push(candidate.target);\n recoveredTargets?.push(candidate.target);\n }\n if (candidate.status === 'ambiguous') {\n ambiguous = true;\n recoveredTargets = undefined;\n }\n if (candidate.status === 'invalid') {\n invalid = true;\n invalidGTSourceReference ||= candidate.hasGTSourceReference === true;\n invalidGTExportName ??= candidate.gtExportName;\n if (recoveredTargets && candidate.recoveredTargets) {\n recoveredTargets.push(...candidate.recoveredTargets);\n } else {\n recoveredTargets = undefined;\n }\n }\n }\n const origins = new Set(candidates.map(({ originKey }) => originKey));\n if (origins.size > 1) {\n ambiguous = true;\n recoveredTargets = undefined;\n }\n if (\n recoveredTargets &&\n new Set(recoveredTargets.map(({ originKey }) => originKey)).size > 1\n ) {\n ambiguous = true;\n recoveredTargets = undefined;\n }\n if (invalid) {\n return {\n ...(invalidGTSourceReference && {\n hasGTSourceReference: true,\n }),\n ...(invalidGTExportName && {\n gtExportName: invalidGTExportName,\n }),\n ...(recoveredTargets?.length && {\n recoveredTargets: uniqueRecoveredTargets(recoveredTargets),\n }),\n status: 'invalid',\n };\n }\n if (ambiguous) return { status: 'ambiguous' };\n return candidates.length === 0\n ? { status: 'absent' }\n : { status: 'resolved', target: candidates[0]! };\n };\n\n const resolveRecoveredExport = (\n record: RecoveredModuleRecord,\n exportName: string,\n seen: Set<string>\n ): LocalExportResolution => {\n const explicit = record.explicitExports.get(exportName);\n if (explicit === 'ambiguous') return { status: 'ambiguous' };\n if (explicit) {\n const resolution =\n explicit.type === 'reexport'\n ? resolveFromSource(\n record,\n explicit.source,\n explicit.importedName,\n seen\n )\n : resolveRecoveredNamespace(record, explicit.source);\n return invalidateRecoveredResolution(resolution, seen);\n }\n if (exportName === 'default') return { status: 'invalid' };\n\n let gtExportName: string | '*' | undefined;\n let recoveredTargets: LocalExportTarget[] | undefined = [];\n for (const source of record.starExports) {\n const candidate = resolveFromSource(record, source, exportName, seen);\n if (candidate.status === 'absent') continue;\n gtExportName ??= readGTExportName(candidate, seen);\n if (recoveredTargets && candidate.status === 'resolved') {\n recoveredTargets.push(candidate.target);\n } else if (\n recoveredTargets &&\n candidate.status === 'invalid' &&\n candidate.recoveredTargets\n ) {\n recoveredTargets.push(...candidate.recoveredTargets);\n } else {\n recoveredTargets = undefined;\n }\n }\n if (\n recoveredTargets &&\n new Set(recoveredTargets.map(({ originKey }) => originKey)).size > 1\n ) {\n recoveredTargets = undefined;\n }\n return {\n ...(gtExportName && {\n gtExportName,\n hasGTSourceReference: true,\n }),\n ...(recoveredTargets?.length && {\n recoveredTargets: uniqueRecoveredTargets(recoveredTargets),\n }),\n status: 'invalid',\n };\n };\n\n const resolveRecoveredNamespace = (\n record: RecoveredModuleRecord,\n source: string\n ): LocalExportResolution => {\n if (isKnownNonVueGTRuntime(source)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${source}#namespace`,\n type: 'ordinary-external',\n },\n };\n }\n if (isExternalModule(source)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${source}#namespace`,\n source,\n type: 'external-namespace',\n },\n };\n }\n const modulePath = resolveModule(record.filePath, source);\n if (!modulePath) return { status: 'invalid' };\n if (!isProjectModule(modulePath)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${modulePath}#namespace`,\n type: 'ordinary-external',\n },\n };\n }\n return {\n status: 'resolved',\n target: {\n modulePath,\n originKey: `${modulePath}#namespace`,\n type: 'namespace',\n },\n };\n };\n\n const invalidateRecoveredResolution = (\n resolution: LocalExportResolution,\n seen: Set<string>\n ): LocalExportResolution => {\n const gtExportName = readGTExportName(resolution, seen);\n return {\n ...(gtExportName && {\n gtExportName,\n hasGTSourceReference: true,\n }),\n ...(resolution.status === 'resolved'\n ? { recoveredTargets: [resolution.target] }\n : resolution.status === 'invalid' && resolution.recoveredTargets\n ? { recoveredTargets: resolution.recoveredTargets }\n : {}),\n status: 'invalid',\n };\n };\n\n const readGTExportName = (\n resolution: LocalExportResolution,\n seen: Set<string>,\n allowNamespaceContainers = true\n ): string | '*' | undefined => {\n if (resolution.status === 'invalid') {\n return allowNamespaceContainers || resolution.gtExportName !== '*'\n ? resolution.gtExportName\n : undefined;\n }\n if (resolution.status !== 'resolved') return undefined;\n const { target } = resolution;\n if (target.type === 'external') {\n return target.source === 'gt-vue' ? target.exportName : undefined;\n }\n if (target.type === 'external-namespace') {\n return allowNamespaceContainers && target.source === 'gt-vue'\n ? '*'\n : undefined;\n }\n if (target.type === 'namespace') {\n if (!allowNamespaceContainers) return undefined;\n const candidateNames = options.recognizeAllGTRuntimeExports\n ? [...GT_RUNTIME_EXPORT_NAMES]\n : [...GT_EXPORT_NAMES];\n return candidateNames.some((name) =>\n Boolean(\n readGTExportName(\n resolveExportInternal(target.modulePath, name, seen),\n seen,\n allowNamespaceContainers\n )\n )\n )\n ? '*'\n : undefined;\n }\n if (target.type === 'ordinary-external') return undefined;\n const state: DerivedGTState = {\n bindings: new Set(),\n nodes: new Set(),\n record: target.record,\n resolutions: seen,\n allowNamespaceContainers,\n };\n if (target.type === 'expression') {\n return readDerivedGT(target.node, state);\n }\n const binding = target.record.programScope.getBinding(target.exportName);\n return binding ? readDerivedGTBinding(binding, state) : undefined;\n };\n\n type DerivedGTState = {\n allowNamespaceContainers: boolean;\n bindings: Set<Binding>;\n nodes: Set<t.Node>;\n record: LocalModuleRecord;\n resolutions: Set<string>;\n };\n\n /** Lazily indexes lexical paths only when package provenance needs them. */\n const readNodePath = (\n record: LocalModuleRecord,\n node: t.Node\n ): NodePath<t.Node> | undefined => {\n let paths = recordPaths.get(record);\n if (!paths) {\n paths = new WeakMap();\n traverse(record.ast, {\n enter(nodePath) {\n paths!.set(nodePath.node, nodePath as NodePath<t.Node>);\n },\n });\n recordPaths.set(record, paths);\n }\n return paths.get(node);\n };\n\n /** Rejects a namespace member whose value is overwritten in this module. */\n const namespaceMemberIsWritten = (\n binding: Binding,\n exportName: string\n ): boolean => {\n return binding.referencePaths.some((reference) => {\n const member = reference.parentPath;\n if (\n (!member?.isMemberExpression() &&\n !member?.isOptionalMemberExpression()) ||\n member.node.object !== reference.node ||\n readStaticMemberName(member.node) !== exportName\n ) {\n return false;\n }\n const parent = member.parentPath?.node;\n return Boolean(\n (parent?.type === 'AssignmentExpression' &&\n parent.left === member.node) ||\n (parent?.type === 'UpdateExpression' &&\n parent.argument === member.node) ||\n (parent?.type === 'UnaryExpression' &&\n parent.operator === 'delete' &&\n parent.argument === member.node) ||\n ((parent?.type === 'ForInStatement' ||\n parent?.type === 'ForOfStatement') &&\n parent.left === member.node)\n );\n });\n };\n\n /** Follows immutable aliases while rejecting mutation and lexical shadows. */\n const readDerivedGTBinding = (\n binding: Binding,\n state: DerivedGTState\n ): string | '*' | undefined => {\n if (!binding.constant || state.bindings.has(binding)) return undefined;\n const next = {\n ...state,\n bindings: new Set(state.bindings).add(binding),\n };\n if (binding.kind === 'module') {\n const imported = state.record.imports.get(binding.identifier.name);\n if (!imported) return undefined;\n if (imported.importedName === '*') {\n return state.allowNamespaceContainers && imported.source === 'gt-vue'\n ? '*'\n : undefined;\n }\n return readGTExportName(\n resolveFromSource(\n state.record,\n imported.source,\n imported.importedName,\n state.resolutions\n ),\n state.resolutions,\n state.allowNamespaceContainers\n );\n }\n const declaration = binding.path.node;\n if (declaration.type === 'VariableDeclarator') {\n if (declaration.id.type === 'Identifier') {\n return readDerivedGT(declaration.init, next);\n }\n return readDestructuredGTBinding(binding, declaration, next);\n }\n return declaration.type === 'FunctionDeclaration'\n ? readDerivedGT(declaration, next)\n : undefined;\n };\n\n /** Resolves one exact leaf destructured from a direct gt-vue namespace. */\n const readDestructuredGTBinding = (\n binding: Binding,\n declaration: t.VariableDeclarator,\n state: DerivedGTState\n ): string | undefined => {\n if (\n declaration.id.type !== 'ObjectPattern' ||\n declaration.id.properties.some(\n (property) => property.type === 'RestElement'\n )\n ) {\n return undefined;\n }\n const property = declaration.id.properties.find(\n (candidate): candidate is t.ObjectProperty =>\n candidate.type === 'ObjectProperty' &&\n !candidate.computed &&\n candidate.value.type === 'Identifier' &&\n candidate.value === binding.identifier\n );\n const exportName = property ? readStaticObjectKey(property) : undefined;\n if (\n !exportName ||\n !knownExternalExport(\n 'gt-vue',\n exportName,\n options.recognizeAllGTRuntimeExports === true\n )\n ) {\n return undefined;\n }\n\n const namespace = unwrapLocalExpression(declaration.init);\n if (!namespace || namespace.type !== 'Identifier') return undefined;\n const namespaceBinding = readNodePath(\n state.record,\n namespace\n )?.scope.getBinding(namespace.name);\n const imported = namespaceBinding\n ? state.record.imports.get(namespaceBinding.identifier.name)\n : undefined;\n return namespaceBinding?.kind === 'module' &&\n namespaceBinding.constant &&\n imported?.source === 'gt-vue' &&\n imported.importedName === '*' &&\n !namespaceMemberIsWritten(namespaceBinding, exportName)\n ? exportName\n : undefined;\n };\n\n /** Resolves a direct gt-vue value, including immutable local aliases. */\n const readDirectGT = (\n node: t.Node | null | undefined,\n state: DerivedGTState\n ): string | '*' | undefined => {\n const expression = unwrapLocalExpression(node);\n if (!expression || state.nodes.has(expression)) return undefined;\n const next = { ...state, nodes: new Set(state.nodes).add(expression) };\n if (expression.type === 'Identifier') {\n const binding = readNodePath(state.record, expression)?.scope.getBinding(\n expression.name\n );\n return binding ? readDerivedGTBinding(binding, next) : undefined;\n }\n if (\n expression.type !== 'MemberExpression' &&\n expression.type !== 'OptionalMemberExpression'\n ) {\n return undefined;\n }\n const property = readStaticMemberName(expression);\n const object = unwrapLocalExpression(expression.object);\n if (!property || object?.type !== 'Identifier') return undefined;\n const binding = readNodePath(state.record, object)?.scope.getBinding(\n object.name\n );\n if (!binding || binding.kind !== 'module' || !binding.constant) {\n return undefined;\n }\n const imported = state.record.imports.get(binding.identifier.name);\n if (!imported || imported.importedName !== '*') return undefined;\n if (namespaceMemberIsWritten(binding, property)) return undefined;\n if (imported.source === 'gt-vue') {\n return knownExternalExport(\n imported.source,\n property,\n options.recognizeAllGTRuntimeExports === true\n )\n ? property\n : undefined;\n }\n const modulePath = resolveModule(state.record.filePath, imported.source);\n return modulePath && isProjectModule(modulePath)\n ? readGTExportName(\n resolveExportInternal(modulePath, property, state.resolutions),\n state.resolutions,\n state.allowNamespaceContainers\n )\n : undefined;\n };\n\n /** Recognizes only explicit aliases and Vue component wrapper forms. */\n const readDerivedGT = (\n node: t.Node | null | undefined,\n state: DerivedGTState\n ): string | '*' | undefined => {\n const direct = readDirectGT(node, state);\n if (direct) return direct;\n const expression = unwrapLocalExpression(node);\n if (!expression || state.nodes.has(expression)) return undefined;\n const next = { ...state, nodes: new Set(state.nodes).add(expression) };\n if (\n expression.type === 'ArrowFunctionExpression' ||\n expression.type === 'FunctionExpression' ||\n expression.type === 'FunctionDeclaration' ||\n expression.type === 'ObjectMethod'\n ) {\n return readFunctionRenderedGT(expression, next);\n }\n if (expression.type === 'ObjectExpression') {\n return readComponentObjectGT(expression, next);\n }\n if (\n (expression.type === 'CallExpression' ||\n expression.type === 'OptionalCallExpression') &&\n isVueHelper(expression.callee, state, 'defineComponent')\n ) {\n const component = expression.arguments[0];\n return component &&\n component.type !== 'SpreadElement' &&\n component.type !== 'ArgumentPlaceholder'\n ? readDerivedGT(component, next)\n : undefined;\n }\n return readRenderedGT(expression, state);\n };\n\n /** Checks only return values owned by the wrapper function itself. */\n const readFunctionRenderedGT = (\n fn: t.Function,\n state: DerivedGTState\n ): string | '*' | undefined => {\n if (\n fn.type === 'ArrowFunctionExpression' &&\n fn.body.type !== 'BlockStatement'\n ) {\n return readRenderedGT(fn.body, state);\n }\n const functionPath = readNodePath(state.record, fn);\n if (!functionPath) return undefined;\n let result: string | '*' | undefined;\n functionPath.traverse({\n ReturnStatement(returnPath) {\n if (result || returnPath.getFunctionParent()?.node !== fn) return;\n result = readRenderedGT(returnPath.node.argument, state);\n },\n });\n return result;\n };\n\n /** Checks the two component options that can directly produce rendered output. */\n const readComponentObjectGT = (\n object: t.ObjectExpression,\n state: DerivedGTState\n ): string | '*' | undefined => {\n for (const property of object.properties) {\n if (property.type === 'SpreadElement') continue;\n const name = readStaticObjectKey(property);\n if (name !== 'render' && name !== 'setup') continue;\n const value =\n property.type === 'ObjectProperty' ? property.value : property;\n const result = readDerivedGT(value, state);\n if (result) return result;\n }\n return undefined;\n };\n\n /** Recognizes GT only in returned JSX or the h/createVNode component slot. */\n const readRenderedGT = (\n node: t.Node | null | undefined,\n state: DerivedGTState\n ): string | '*' | undefined => {\n const expression = unwrapLocalExpression(node);\n if (!expression || state.nodes.has(expression)) return undefined;\n const next = { ...state, nodes: new Set(state.nodes).add(expression) };\n if (\n expression.type === 'ArrowFunctionExpression' ||\n expression.type === 'FunctionExpression'\n ) {\n return readFunctionRenderedGT(expression, next);\n }\n if (expression.type === 'JSXElement') {\n const component = readJSXComponentGT(\n expression.openingElement.name,\n next\n );\n if (component) return component;\n for (const child of expression.children) {\n const value =\n child.type === 'JSXExpressionContainer'\n ? child.expression.type === 'JSXEmptyExpression'\n ? undefined\n : child.expression\n : child;\n const result = readRenderedGT(value, next);\n if (result) return result;\n }\n return undefined;\n }\n if (expression.type === 'JSXFragment') {\n for (const child of expression.children) {\n const value =\n child.type === 'JSXExpressionContainer'\n ? child.expression.type === 'JSXEmptyExpression'\n ? undefined\n : child.expression\n : child;\n const result = readRenderedGT(value, next);\n if (result) return result;\n }\n return undefined;\n }\n if (expression.type === 'ConditionalExpression') {\n return (\n readRenderedGT(expression.consequent, next) ??\n readRenderedGT(expression.alternate, next)\n );\n }\n if (expression.type === 'LogicalExpression') {\n return (\n readRenderedGT(expression.left, next) ??\n readRenderedGT(expression.right, next)\n );\n }\n if (\n (expression.type !== 'CallExpression' &&\n expression.type !== 'OptionalCallExpression') ||\n (!isVueHelper(expression.callee, state, 'h') &&\n !isVueHelper(expression.callee, state, 'createVNode'))\n ) {\n return undefined;\n }\n const component = expression.arguments[0];\n return component &&\n component.type !== 'SpreadElement' &&\n component.type !== 'ArgumentPlaceholder'\n ? readDirectGT(component, next)\n : undefined;\n };\n\n /** Resolves an imported GT component used as a JSX element name. */\n const readJSXComponentGT = (\n name: t.JSXIdentifier | t.JSXMemberExpression | t.JSXNamespacedName,\n state: DerivedGTState\n ): string | '*' | undefined => {\n if (name.type === 'JSXMemberExpression') {\n if (name.object.type !== 'JSXIdentifier') return undefined;\n const binding = readNodePath(state.record, name.object)?.scope.getBinding(\n name.object.name\n );\n if (!binding || binding.kind !== 'module' || !binding.constant) {\n return undefined;\n }\n const imported = state.record.imports.get(binding.identifier.name);\n if (!imported || imported.importedName !== '*') return undefined;\n const property = name.property.name;\n if (namespaceMemberIsWritten(binding, property)) return undefined;\n if (imported.source === 'gt-vue') {\n return knownExternalExport(\n imported.source,\n property,\n options.recognizeAllGTRuntimeExports === true\n )\n ? property\n : undefined;\n }\n const modulePath = resolveModule(state.record.filePath, imported.source);\n return modulePath && isProjectModule(modulePath)\n ? readGTExportName(\n resolveExportInternal(modulePath, property, state.resolutions),\n state.resolutions,\n state.allowNamespaceContainers\n )\n : undefined;\n }\n if (name.type !== 'JSXIdentifier' || /^[a-z]/.test(name.name)) return;\n const binding = readNodePath(state.record, name)?.scope.getBinding(\n name.name\n );\n return binding ? readDerivedGTBinding(binding, state) : undefined;\n };\n\n /** Matches a direct or namespace ESM import from Vue without evaluating calls. */\n const isVueHelper = (\n node: t.Node,\n state: DerivedGTState,\n exportName: 'createVNode' | 'defineComponent' | 'h'\n ): boolean => {\n const expression = unwrapLocalExpression(node);\n if (!expression) return false;\n const identifier =\n expression.type === 'Identifier'\n ? expression\n : (expression.type === 'MemberExpression' ||\n expression.type === 'OptionalMemberExpression') &&\n readStaticMemberName(expression) === exportName\n ? unwrapLocalExpression(expression.object)\n : undefined;\n if (!identifier || identifier.type !== 'Identifier') return false;\n const binding = readNodePath(state.record, identifier)?.scope.getBinding(\n identifier.name\n );\n const imported =\n binding?.kind === 'module'\n ? state.record.imports.get(binding.identifier.name)\n : undefined;\n const expectedImport = expression.type === 'Identifier' ? exportName : '*';\n return (\n binding?.constant === true &&\n imported?.source === 'vue' &&\n imported.importedName === expectedImport &&\n (expectedImport !== '*' || !namespaceMemberIsWritten(binding, exportName))\n );\n };\n\n const readStaticMemberName = (\n member: t.MemberExpression | t.OptionalMemberExpression\n ): string | undefined => {\n if (!member.computed && member.property.type === 'Identifier') {\n return member.property.name;\n }\n return member.computed && member.property.type === 'StringLiteral'\n ? member.property.value\n : undefined;\n };\n\n const readStaticObjectKey = (property: {\n computed?: boolean;\n key?: t.Node;\n }): string | undefined => {\n if (!property.key) return undefined;\n if (!property.computed && property.key.type === 'Identifier') {\n return property.key.name;\n }\n return property.key.type === 'StringLiteral'\n ? property.key.value\n : undefined;\n };\n\n const resolutionReferencesGT = (\n resolution: LocalExportResolution,\n seen: Set<string>\n ): boolean => {\n return readGTExportName(resolution, seen) !== undefined;\n };\n\n const resolveFromSource = (\n record: Pick<LocalModuleRecord, 'filePath'>,\n source: string,\n exportName: string,\n seen: Set<string>\n ): LocalExportResolution => {\n if (isKnownNonVueGTRuntime(source)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${source}#${exportName}`,\n type: 'ordinary-external',\n },\n };\n }\n if (isExternalModule(source)) {\n return knownExternalExport(\n source,\n exportName,\n options.recognizeAllGTRuntimeExports === true\n )\n ? {\n status: 'resolved',\n target: {\n exportName,\n originKey: `${source}#${exportName}`,\n source,\n type: 'external',\n },\n }\n : { status: 'absent' };\n }\n const modulePath = resolveModule(record.filePath, source);\n if (!modulePath) return { status: 'invalid' };\n if (!isProjectModule(modulePath)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${modulePath}#${exportName}`,\n type: 'ordinary-external',\n },\n };\n }\n return resolveExportInternal(modulePath, exportName, seen);\n };\n\n const resolveDeclaredExport = (\n record: LocalModuleRecord,\n exportName: string,\n declared: DeclaredExport,\n seen: Set<string>\n ): LocalExportResolution => {\n if (declared.type === 'reexport') {\n return resolveFromSource(\n record,\n declared.source,\n declared.importedName,\n seen\n );\n }\n if (declared.type === 'namespace') {\n if (isKnownNonVueGTRuntime(declared.source)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${declared.source}#namespace`,\n type: 'ordinary-external',\n },\n };\n }\n if (isExternalModule(declared.source)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${declared.source}#namespace`,\n source: declared.source,\n type: 'external-namespace',\n },\n };\n }\n const modulePath = resolveModule(record.filePath, declared.source);\n if (modulePath && !isProjectModule(modulePath)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${modulePath}#namespace`,\n type: 'ordinary-external',\n },\n };\n }\n return modulePath\n ? {\n status: 'resolved',\n target: {\n modulePath,\n originKey: `${modulePath}#namespace`,\n type: 'namespace',\n },\n }\n : { status: 'invalid' };\n }\n if (declared.type === 'local') {\n const imported = record.imports.get(declared.name);\n if (imported) {\n if (imported.importedName === '*') {\n if (isKnownNonVueGTRuntime(imported.source)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${imported.source}#namespace`,\n type: 'ordinary-external',\n },\n };\n }\n if (isExternalModule(imported.source)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${imported.source}#namespace`,\n source: imported.source,\n type: 'external-namespace',\n },\n };\n }\n const modulePath = resolveModule(record.filePath, imported.source);\n if (modulePath && !isProjectModule(modulePath)) {\n return {\n status: 'resolved',\n target: {\n originKey: `${modulePath}#namespace`,\n type: 'ordinary-external',\n },\n };\n }\n return modulePath\n ? {\n status: 'resolved',\n target: {\n modulePath,\n originKey: `${modulePath}#namespace`,\n type: 'namespace',\n },\n }\n : { status: 'invalid' };\n }\n return resolveFromSource(\n record,\n imported.source,\n imported.importedName,\n seen\n );\n }\n return {\n status: 'resolved',\n target: {\n exportName: declared.name,\n originKey: `${record.filePath}#local:${declared.name}`,\n record,\n type: 'local',\n },\n };\n }\n return {\n status: 'resolved',\n target: {\n node: declared.node,\n originKey: `${record.filePath}#expression:${exportName}`,\n record,\n type: 'expression',\n },\n };\n };\n\n const resolveExport = (\n filePath: string,\n exportName: string\n ): LocalExportResolution => {\n const cacheKey = `${path.resolve(filePath)}\\0${exportName}`;\n const cached = resolutions.get(cacheKey);\n if (cached) return cached;\n const result = resolveExportInternal(filePath, exportName, new Set());\n resolutions.set(cacheKey, result);\n return result;\n };\n\n const listExportNames = (filePath: string): string[] => {\n return [...collectExportNames(filePath, new Set())].sort();\n };\n\n const collectExportNames = (\n filePath: string,\n seen: Set<string>\n ): Set<string> => {\n const normalized = path.resolve(filePath);\n if (seen.has(normalized)) return new Set();\n const record = getRecord(normalized);\n const recovered = record ? undefined : getRecoveredRecord(normalized);\n if (!record && !recovered) return new Set();\n const moduleRecord = record ?? recovered!;\n const nextSeen = new Set(seen).add(normalized);\n const names = new Set(moduleRecord.explicitExports.keys());\n for (const source of moduleRecord.starExports) {\n if (source === 'gt-vue') {\n for (const name of GT_EXPORT_NAMES) names.add(name);\n } else if (source === 'vue') {\n for (const name of VUE_EXPORT_NAMES) names.add(name);\n } else if (isKnownNonVueGTRuntime(source)) {\n continue;\n } else {\n const modulePath = resolveModule(moduleRecord.filePath, source);\n if (!modulePath || !isProjectModule(modulePath)) continue;\n for (const name of collectExportNames(modulePath, nextSeen)) {\n if (name !== 'default') names.add(name);\n }\n }\n }\n return names;\n };\n\n const hasGTExportReference = (\n filePath: string,\n exportName: string\n ): boolean => {\n return resolutionReferencesGT(\n resolveExportInternal(filePath, exportName, new Set()),\n new Set()\n );\n };\n\n const getGTExportName = (\n filePath: string,\n exportName: string\n ): string | '*' | undefined => {\n const resolution = resolveExportInternal(filePath, exportName, new Set());\n return resolution.status === 'resolved'\n ? readGTExportName(resolution, new Set(), false)\n : undefined;\n };\n\n return {\n getRecord,\n getGTExportName,\n hasCustomResolver: resolveModuleOption !== undefined,\n hasGTExportReference,\n isProjectModule,\n listExportNames,\n resolveExport,\n resolveModule,\n };\n}\n\n/** Removes syntax-only wrappers without importing the compiler-facing utilities. */\nfunction unwrapLocalExpression(\n input: t.Node | null | undefined\n): t.Node | undefined {\n let current = input ?? undefined;\n while (\n current &&\n (current.type === 'TSAsExpression' ||\n current.type === 'TSTypeAssertion' ||\n current.type === 'TSNonNullExpression' ||\n current.type === 'TSSatisfiesExpression' ||\n current.type === 'TSInstantiationExpression' ||\n current.type === 'TypeCastExpression' ||\n current.type === 'ParenthesizedExpression')\n ) {\n current = current.expression;\n }\n return current;\n}\n\n/** Deduplicates recovered graph targets without discarding their identities. */\nfunction uniqueRecoveredTargets(\n targets: LocalExportTarget[]\n): LocalExportTarget[] {\n return [\n ...new Map(targets.map((target) => [target.originKey, target])).values(),\n ];\n}\n\nfunction resolveSourceFile(requested: string): string | undefined {\n const candidates: string[] = [requested];\n const extension = path.extname(requested).toLowerCase();\n if (!extension) {\n for (const sourceExtension of SOURCE_EXTENSIONS) {\n candidates.push(`${requested}${sourceExtension}`);\n }\n for (const sourceExtension of SOURCE_EXTENSIONS) {\n candidates.push(path.join(requested, `index${sourceExtension}`));\n }\n } else if (['.js', '.jsx', '.mjs'].includes(extension)) {\n const base = requested.slice(0, -extension.length);\n for (const sourceExtension of SOURCE_EXTENSIONS) {\n candidates.push(`${base}${sourceExtension}`);\n }\n }\n return candidates.find(isReadableFile);\n}\n\nfunction isReadableFile(filePath: string): boolean {\n try {\n return fs.statSync(filePath).isFile();\n } catch {\n return false;\n }\n}\n\n/** Resolves symlinks when possible while retaining missing-path diagnostics. */\nfunction readRealPath(filePath: string): string {\n try {\n return fs.realpathSync.native(filePath);\n } catch {\n return filePath;\n }\n}\n\nfunction parseLocalModule(filePath: string): LocalModuleRecord | undefined {\n let source: string;\n try {\n source = fs.readFileSync(filePath, 'utf8');\n } catch {\n return undefined;\n }\n const extension = path.extname(filePath).toLowerCase();\n // Node treats these extensions as CommonJS regardless of package metadata.\n // Parsing ESM-looking syntax here would prove an identity the application\n // cannot actually import with ESM semantics, so both formats fail closed.\n if (extension === '.cjs' || extension === '.cts') return undefined;\n let language = extension.slice(1);\n if (extension === '.mjs') language = 'js';\n if (extension === '.mts') language = 'ts';\n // A local .vue module must be parsed with the consuming application's exact\n // compiler. The extractor deliberately fails closed here instead of\n // reintroducing a bundled-compiler mismatch through barrel resolution.\n if (extension === '.vue') return undefined;\n if (!['js', 'jsx', 'ts', 'tsx'].includes(language)) return undefined;\n\n let ast: t.File;\n try {\n ast = parseScriptAst(source, language);\n } catch {\n return undefined;\n }\n let programScope: Scope | undefined;\n traverse(ast, {\n Program(programPath) {\n programScope = programPath.scope;\n programPath.stop();\n },\n });\n if (!programScope) return undefined;\n\n const record: LocalModuleRecord = {\n ast,\n explicitExports: new Map(),\n filePath,\n imports: collectImportedBindings(ast),\n programScope,\n starExports: [],\n };\n collectExports(record);\n return record;\n}\n\nlet moduleLexerInitialized = false;\n\n/**\n * Recovers only source-bound runtime exports from an otherwise invalid module.\n *\n * The recovered declarations establish provenance, but never become executable\n * analyzer input. Their resolutions remain invalid so consumers fail closed\n * while type-only and unrelated module references stay invisible.\n */\nfunction recoverMalformedModuleExports(\n filePath: string\n): RecoveredModuleRecord | undefined {\n const extension = path.extname(filePath).toLowerCase();\n if (extension === '.cjs' || extension === '.cts' || extension === '.vue') {\n return undefined;\n }\n let source: string;\n try {\n source = fs.readFileSync(filePath, 'utf8');\n } catch {\n return undefined;\n }\n if (!moduleLexerInitialized) {\n initModuleLexer();\n moduleLexerInitialized = true;\n }\n let moduleImports: ReturnType<typeof parseModuleImports>[0];\n try {\n [moduleImports] = parseModuleImports(source);\n } catch {\n return undefined;\n }\n\n const record: RecoveredModuleRecord = {\n explicitExports: new Map(),\n filePath,\n starExports: [],\n };\n const statements = new Set<string>();\n for (const moduleImport of moduleImports) {\n if (\n moduleImport.d !== -1 ||\n moduleImport.ss < 0 ||\n moduleImport.se <= moduleImport.ss\n ) {\n continue;\n }\n statements.add(source.slice(moduleImport.ss, moduleImport.se));\n }\n\n for (const statementSource of statements) {\n const statement = parseRecoveredModuleStatement(statementSource, extension);\n if (!statement) continue;\n collectRecoveredExport(record, statement);\n }\n return record.explicitExports.size > 0 || record.starExports.length > 0\n ? record\n : undefined;\n}\n\n/** Parses one lexed declaration under the source file's supported grammars. */\nfunction parseRecoveredModuleStatement(\n source: string,\n extension: string\n): t.Statement | undefined {\n const declaredLanguage =\n extension === '.mjs'\n ? 'js'\n : extension === '.mts'\n ? 'ts'\n : extension.slice(1);\n const languages = new Set<string>([declaredLanguage]);\n if (declaredLanguage === 'js' || declaredLanguage === 'jsx') {\n languages.add('flow');\n }\n languages.add('tsx');\n for (const language of languages) {\n try {\n const ast = parseScriptAst(source, language);\n if (ast.program.body.length === 1) return ast.program.body[0];\n } catch {\n // Try the next project-compatible grammar for this isolated statement.\n }\n }\n return undefined;\n}\n\n/** Adds runtime re-exports without trusting declarations around the syntax error. */\nfunction collectRecoveredExport(\n record: RecoveredModuleRecord,\n statement: t.Statement\n): void {\n if (statement.type === 'ExportAllDeclaration') {\n if (statement.exportKind !== 'type') {\n record.starExports.push(statement.source.value);\n }\n return;\n }\n if (\n statement.type !== 'ExportNamedDeclaration' ||\n statement.exportKind === 'type' ||\n !statement.source\n ) {\n return;\n }\n for (const specifier of statement.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.exportKind === 'type'\n ) {\n continue;\n }\n const exportedName =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n if (specifier.type === 'ExportNamespaceSpecifier') {\n addRecoveredExplicitExport(record, exportedName, {\n source: statement.source.value,\n type: 'namespace',\n });\n continue;\n }\n if (specifier.type !== 'ExportSpecifier') continue;\n addRecoveredExplicitExport(record, exportedName, {\n importedName: specifier.local.name,\n source: statement.source.value,\n type: 'reexport',\n });\n }\n}\n\n/** Preserves ambiguity instead of selecting an arbitrary recovered identity. */\nfunction addRecoveredExplicitExport(\n record: RecoveredModuleRecord,\n name: string,\n value: RecoveredDeclaredExport\n): void {\n record.explicitExports.set(\n name,\n record.explicitExports.has(name) ? 'ambiguous' : value\n );\n}\n\nfunction collectImportedBindings(ast: t.File): Map<string, ImportedBinding> {\n const imports = new Map<string, ImportedBinding>();\n for (const statement of ast.program.body) {\n if (\n statement.type !== 'ImportDeclaration' ||\n isTypeOnlyImportKind(statement.importKind)\n ) {\n continue;\n }\n for (const specifier of statement.specifiers) {\n if (\n specifier.type === 'ImportSpecifier' &&\n !isTypeOnlyImportKind(specifier.importKind)\n ) {\n imports.set(specifier.local.name, {\n importedName:\n specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value,\n source: statement.source.value,\n });\n } else if (specifier.type === 'ImportDefaultSpecifier') {\n imports.set(specifier.local.name, {\n importedName: 'default',\n source: statement.source.value,\n });\n } else if (specifier.type === 'ImportNamespaceSpecifier') {\n imports.set(specifier.local.name, {\n importedName: '*',\n source: statement.source.value,\n });\n }\n }\n }\n return imports;\n}\n\n/** Returns whether Babel classified an ESM binding as type-only. */\nfunction isTypeOnlyImportKind(kind: string | null | undefined): boolean {\n return kind === 'type' || kind === 'typeof';\n}\n\nfunction collectExports(record: LocalModuleRecord): void {\n for (const statement of record.ast.program.body) {\n if (statement.type === 'ExportAllDeclaration') {\n if (statement.exportKind !== 'type') {\n record.starExports.push(statement.source.value);\n }\n continue;\n }\n if (statement.type === 'ExportDefaultDeclaration') {\n addExplicitExport(record, 'default', {\n node: statement.declaration,\n type: 'expression',\n });\n continue;\n }\n if (\n statement.type !== 'ExportNamedDeclaration' ||\n statement.exportKind === 'type'\n ) {\n continue;\n }\n if (statement.declaration) {\n for (const name of declaredNames(statement.declaration)) {\n addExplicitExport(record, name, { name, type: 'local' });\n }\n }\n for (const specifier of statement.specifiers) {\n if (\n specifier.type === 'ExportSpecifier' &&\n specifier.exportKind === 'type'\n ) {\n continue;\n }\n const exportedName =\n specifier.exported.type === 'Identifier'\n ? specifier.exported.name\n : specifier.exported.value;\n if (specifier.type === 'ExportNamespaceSpecifier') {\n if (statement.source) {\n addExplicitExport(record, exportedName, {\n source: statement.source.value,\n type: 'namespace',\n });\n }\n continue;\n }\n if (specifier.type !== 'ExportSpecifier') continue;\n const localName = specifier.local.name;\n addExplicitExport(\n record,\n exportedName,\n statement.source\n ? {\n importedName: localName,\n source: statement.source.value,\n type: 'reexport',\n }\n : { name: localName, type: 'local' }\n );\n }\n }\n}\n\nfunction addExplicitExport(\n record: LocalModuleRecord,\n name: string,\n value: DeclaredExport\n): void {\n record.explicitExports.set(\n name,\n record.explicitExports.has(name) ? 'ambiguous' : value\n );\n}\n\nfunction declaredNames(declaration: t.Declaration): string[] {\n if (\n declaration.type === 'FunctionDeclaration' ||\n declaration.type === 'ClassDeclaration'\n ) {\n return declaration.id ? [declaration.id.name] : [];\n }\n if (declaration.type !== 'VariableDeclaration') return [];\n return declaration.declarations.flatMap(({ id }) => patternNames(id));\n}\n\nfunction patternNames(pattern: t.Node): string[] {\n if (pattern.type === 'Identifier') return [pattern.name];\n if (pattern.type === 'RestElement') return patternNames(pattern.argument);\n if (pattern.type === 'AssignmentPattern') return patternNames(pattern.left);\n if (pattern.type === 'ArrayPattern') {\n return pattern.elements.flatMap((element) =>\n element ? patternNames(element) : []\n );\n }\n if (pattern.type === 'ObjectPattern') {\n return pattern.properties.flatMap((property) =>\n property.type === 'RestElement'\n ? patternNames(property.argument)\n : patternNames(property.value)\n );\n }\n return [];\n}\n\nfunction isExternalModule(source: string): source is ExternalModuleName {\n return source === 'gt-vue' || source === 'vue';\n}\n\nfunction knownExternalExport(\n source: ExternalModuleName,\n exportName: string,\n recognizeAllGTRuntimeExports: boolean\n): boolean {\n if (source === 'vue') {\n return (VUE_EXPORT_NAMES as readonly string[]).includes(exportName);\n }\n const recognizedNames = recognizeAllGTRuntimeExports\n ? GT_RUNTIME_EXPORT_NAMES\n : GT_EXPORT_NAMES;\n return (recognizedNames as readonly string[]).includes(exportName);\n}\n"],"mappings":";;;;;;;AAgBA,MAAM,WAAW,eAAe,WAAW;AAE3C,MAAM,oBAAoB;CAC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;;;AAKP,SAAS,kBACP,QACA,MACA,OACM;AACN,QAAO,gBAAgB,IACrB,MACA,OAAO,gBAAgB,IAAI,KAAK,GAAG,cAAc,MAClD;;AAGH,SAAS,cAAc,aAAsC;AAC3D,KACE,YAAY,SAAS,yBACrB,YAAY,SAAS,mBAErB,QAAO,YAAY,KAAK,CAAC,YAAY,GAAG,KAAK,GAAG,EAAE;AAEpD,KAAI,YAAY,SAAS,sBAAuB,QAAO,EAAE;AACzD,QAAO,YAAY,aAAa,SAAS,EAAE,SAAS,aAAa,GAAG,CAAC;;AAGvE,SAAS,aAAa,SAA2B;AAC/C,KAAI,QAAQ,SAAS,aAAc,QAAO,CAAC,QAAQ,KAAK;AACxD,KAAI,QAAQ,SAAS,cAAe,QAAO,aAAa,QAAQ,SAAS;AACzE,KAAI,QAAQ,SAAS,oBAAqB,QAAO,aAAa,QAAQ,KAAK;AAC3E,KAAI,QAAQ,SAAS,eACnB,QAAO,QAAQ,SAAS,SAAS,YAC/B,UAAU,aAAa,QAAQ,GAAG,EAAE,CACrC;AAEH,KAAI,QAAQ,SAAS,gBACnB,QAAO,QAAQ,WAAW,SAAS,aACjC,SAAS,SAAS,gBACd,aAAa,SAAS,SAAS,GAC/B,aAAa,SAAS,MAAM,CACjC;AAEH,QAAO,EAAE;;AAGX,SAAS,iBAAiB,QAA8C;AACtE,QAAO,WAAW,YAAY,WAAW;;AAG3C,SAAS,oBACP,QACA,YACA,8BACS;AACT,KAAI,WAAW,MACb,QAAQ,iBAAuC,SAAS,WAAW;AAKrE,SAHwB,+BACpB,0BACA,iBAC0C,SAAS,WAAW"}
@@ -1,6 +1,7 @@
1
1
  import type { Binding, NodePath, Scope } from '@babel/traverse';
2
2
  import type * as t from '@babel/types';
3
3
  import type { GTComponentName, StringFunctionKind, TemplateContainerKind, VueBuiltinName } from '../types.js';
4
+ import type { StaticPrimitive } from '../utils.js';
4
5
  import type { LocalModuleResolver } from './localModules.js';
5
6
  /** A statically recognized value that affects Vue translation extraction. */
6
7
  export type KnownValue = {
@@ -8,7 +9,7 @@ export type KnownValue = {
8
9
  name: GTComponentName;
9
10
  } | {
10
11
  type: 'hook';
11
- kind: Exclude<StringFunctionKind, 'msg'>;
12
+ kind: Exclude<StringFunctionKind, 'msg' | 't'>;
12
13
  } | {
13
14
  type: 'string';
14
15
  kind: StringFunctionKind;
@@ -47,6 +48,8 @@ export type VueScriptAnalysis = {
47
48
  stats?: VueScriptAnalysisStats;
48
49
  /** Absolute path of the source file currently being extracted. */
49
50
  entryFile?: string;
51
+ /** Whether static analysis reached the gt-vue package through source code. */
52
+ hasGTSourceReference: boolean;
50
53
  /** Read-only local ESM graph used to resolve application barrels. */
51
54
  localModules?: LocalModuleResolver;
52
55
  /** Lengths of statically known, non-mutated normal-script arrays. */
@@ -65,7 +68,7 @@ export type VueScriptAnalysis = {
65
68
  possibleGTContainers: Set<string>;
66
69
  /** Normal-script callables returning containers that may directly contain T. */
67
70
  gtContainerFactories: Set<string>;
68
- staticValues: Map<string, string | number | bigint | boolean | null>;
71
+ staticValues: Map<string, StaticPrimitive>;
69
72
  /** Values exposed to templates after Vue's top-level ref unwrapping. */
70
73
  templateValues: Map<string, KnownValue>;
71
74
  /** Cross-block component bindings whose runtime identity is not provable. */
@@ -140,7 +143,7 @@ export type TemplateExposure = {
140
143
  values: Set<string>;
141
144
  } | {
142
145
  type: 'static';
143
- value: string | number | bigint | boolean | null;
146
+ value: StaticPrimitive;
144
147
  };
145
148
  export type GTContainerExposure = {
146
149
  containers: Set<string>;
@@ -313,5 +316,9 @@ export type ScriptState = {
313
316
  transformArrayEntriesInProgress: Set<Binding>;
314
317
  /** Import and alias bindings that may call a forwarded translator. */
315
318
  uncertainTranslationHelperBindings: Set<Binding>;
319
+ /** Whether this block uses GT through an unsupported dynamic import. */
320
+ unsupportedDynamicGTReference: boolean;
321
+ /** Whether a used GT reference came through a malformed local module. */
322
+ unsupportedMalformedGTReference: boolean;
316
323
  unsafeMutableNamespaceSources: Set<'gt-vue' | 'vue'>;
317
324
  };
@@ -5,7 +5,8 @@ function getParserPlugins(language) {
5
5
  const normalizedLanguage = language?.toLowerCase();
6
6
  const plugins = ["decorators-legacy"];
7
7
  if (normalizedLanguage === "ts" || normalizedLanguage === "tsx") plugins.push("typescript");
8
- if (normalizedLanguage === "jsx" || normalizedLanguage === "tsx") plugins.push("jsx");
8
+ if (normalizedLanguage === "flow") plugins.push("flow");
9
+ if (normalizedLanguage === void 0 || normalizedLanguage === "js" || normalizedLanguage === "jsx" || normalizedLanguage === "flow" || normalizedLanguage === "tsx") plugins.push("jsx");
9
10
  return plugins;
10
11
  }
11
12
  /** Parses one JavaScript or TypeScript block using Vue-compatible syntax. */
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","names":[],"sources":["../../../src/internal/script/parser.ts"],"sourcesContent":["import { parse, type ParserPlugin } from '@babel/parser';\nimport type * as t from '@babel/types';\n\n/** Returns the Babel syntax plugins accepted by a Vue script language. */\nfunction getParserPlugins(language: string | undefined): ParserPlugin[] {\n const normalizedLanguage = language?.toLowerCase();\n const plugins: ParserPlugin[] = ['decorators-legacy'];\n if (normalizedLanguage === 'ts' || normalizedLanguage === 'tsx') {\n plugins.push('typescript');\n }\n if (normalizedLanguage === 'jsx' || normalizedLanguage === 'tsx') {\n plugins.push('jsx');\n }\n return plugins;\n}\n\n/** Parses one JavaScript or TypeScript block using Vue-compatible syntax. */\nexport function parseScriptAst(\n source: string,\n language: string | undefined\n): t.File {\n return parse(source, {\n plugins: getParserPlugins(language),\n sourceType: 'module',\n });\n}\n"],"mappings":";;;AAIA,SAAS,iBAAiB,UAA8C;CACtE,MAAM,qBAAqB,UAAU,aAAa;CAClD,MAAM,UAA0B,CAAC,oBAAoB;AACrD,KAAI,uBAAuB,QAAQ,uBAAuB,MACxD,SAAQ,KAAK,aAAa;AAE5B,KAAI,uBAAuB,SAAS,uBAAuB,MACzD,SAAQ,KAAK,MAAM;AAErB,QAAO;;;AAIT,SAAgB,eACd,QACA,UACQ;AACR,QAAO,MAAM,QAAQ;EACnB,SAAS,iBAAiB,SAAS;EACnC,YAAY;EACb,CAAC"}
1
+ {"version":3,"file":"parser.js","names":[],"sources":["../../../src/internal/script/parser.ts"],"sourcesContent":["import { parse, type ParserPlugin } from '@babel/parser';\nimport type * as t from '@babel/types';\n\n/** Returns the Babel syntax plugins accepted by a Vue script language. */\nfunction getParserPlugins(language: string | undefined): ParserPlugin[] {\n const normalizedLanguage = language?.toLowerCase();\n const plugins: ParserPlugin[] = ['decorators-legacy'];\n if (normalizedLanguage === 'ts' || normalizedLanguage === 'tsx') {\n plugins.push('typescript');\n }\n if (normalizedLanguage === 'flow') {\n plugins.push('flow');\n }\n // JavaScript files commonly contain JSX without using a .jsx extension.\n // TypeScript retains its explicit .tsx contract to avoid interpreting type\n // syntax as JSX.\n if (\n normalizedLanguage === undefined ||\n normalizedLanguage === 'js' ||\n normalizedLanguage === 'jsx' ||\n normalizedLanguage === 'flow' ||\n normalizedLanguage === 'tsx'\n ) {\n plugins.push('jsx');\n }\n return plugins;\n}\n\n/** Parses one JavaScript or TypeScript block using Vue-compatible syntax. */\nexport function parseScriptAst(\n source: string,\n language: string | undefined\n): t.File {\n return parse(source, {\n plugins: getParserPlugins(language),\n sourceType: 'module',\n });\n}\n"],"mappings":";;;AAIA,SAAS,iBAAiB,UAA8C;CACtE,MAAM,qBAAqB,UAAU,aAAa;CAClD,MAAM,UAA0B,CAAC,oBAAoB;AACrD,KAAI,uBAAuB,QAAQ,uBAAuB,MACxD,SAAQ,KAAK,aAAa;AAE5B,KAAI,uBAAuB,OACzB,SAAQ,KAAK,OAAO;AAKtB,KACE,uBAAuB,KAAA,KACvB,uBAAuB,QACvB,uBAAuB,SACvB,uBAAuB,UACvB,uBAAuB,MAEvB,SAAQ,KAAK,MAAM;AAErB,QAAO;;;AAIT,SAAgB,eACd,QACA,UACQ;AACR,QAAO,MAAM,QAAQ;EACnB,SAAS,iBAAiB,SAAS;EACnC,YAAY;EACb,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Identifies an official GT runtime whose exports are ordinary to gt-vue.
3
+ *
4
+ * Package subpaths retain the identity of their package root. Explicitly
5
+ * classifying these imports prevents a mixed-framework scan from treating a
6
+ * React or server API named `T`, `msg`, `t`, or `useGT` as an unresolved gt-vue
7
+ * alias. Unknown packages and application aliases remain unresolved so the
8
+ * analyzer can continue to fail closed for custom gt-vue reexports.
9
+ */
10
+ export declare function isKnownNonVueGTRuntime(source: string): boolean;
@@ -0,0 +1,27 @@
1
+ //#region src/internal/script/runtimeModules.ts
2
+ /** Package roots that can expose GT-shaped names but never gt-vue values. */
3
+ const KNOWN_NON_VUE_GT_RUNTIME_PACKAGES = [
4
+ "@generaltranslation/react-core",
5
+ "gt-i18n",
6
+ "gt-next",
7
+ "gt-node",
8
+ "gt-react",
9
+ "gt-react-native",
10
+ "gt-tanstack-start"
11
+ ];
12
+ /**
13
+ * Identifies an official GT runtime whose exports are ordinary to gt-vue.
14
+ *
15
+ * Package subpaths retain the identity of their package root. Explicitly
16
+ * classifying these imports prevents a mixed-framework scan from treating a
17
+ * React or server API named `T`, `msg`, `t`, or `useGT` as an unresolved gt-vue
18
+ * alias. Unknown packages and application aliases remain unresolved so the
19
+ * analyzer can continue to fail closed for custom gt-vue reexports.
20
+ */
21
+ function isKnownNonVueGTRuntime(source) {
22
+ return KNOWN_NON_VUE_GT_RUNTIME_PACKAGES.some((packageName) => source === packageName || source.startsWith(`${packageName}/`));
23
+ }
24
+ //#endregion
25
+ export { isKnownNonVueGTRuntime };
26
+
27
+ //# sourceMappingURL=runtimeModules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeModules.js","names":[],"sources":["../../../src/internal/script/runtimeModules.ts"],"sourcesContent":["/** Package roots that can expose GT-shaped names but never gt-vue values. */\nconst KNOWN_NON_VUE_GT_RUNTIME_PACKAGES = [\n '@generaltranslation/react-core',\n 'gt-i18n',\n 'gt-next',\n 'gt-node',\n 'gt-react',\n 'gt-react-native',\n 'gt-tanstack-start',\n] as const;\n\n/**\n * Identifies an official GT runtime whose exports are ordinary to gt-vue.\n *\n * Package subpaths retain the identity of their package root. Explicitly\n * classifying these imports prevents a mixed-framework scan from treating a\n * React or server API named `T`, `msg`, `t`, or `useGT` as an unresolved gt-vue\n * alias. Unknown packages and application aliases remain unresolved so the\n * analyzer can continue to fail closed for custom gt-vue reexports.\n */\nexport function isKnownNonVueGTRuntime(source: string): boolean {\n return KNOWN_NON_VUE_GT_RUNTIME_PACKAGES.some(\n (packageName) =>\n source === packageName || source.startsWith(`${packageName}/`)\n );\n}\n"],"mappings":";;AACA,MAAM,oCAAoC;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;;;AAWD,SAAgB,uBAAuB,QAAyB;AAC9D,QAAO,kCAAkC,MACtC,gBACC,WAAW,eAAe,OAAO,WAAW,GAAG,YAAY,GAAG,CACjE"}
@@ -25,7 +25,7 @@ function processVueStringCall(call, kind, location, context, readStatic = readSt
25
25
  const value = unwrappedFirstArgument?.type === "SpreadElement" || unwrappedFirstArgument?.type === "ArgumentPlaceholder" ? { ok: false } : readStatic(unwrappedFirstArgument);
26
26
  if (!value.ok || typeof value.value !== "string") {
27
27
  if (kind === "messages") return;
28
- addVueError(context, location, `Found dynamic content in a gt-vue ${kind === "gt" ? "gt()" : "msg()"} call`, "Use a string literal or a template literal without expressions");
28
+ addVueError(context, location, `Found dynamic content in a gt-vue ${stringFunctionName(kind)} call`, "Use a string literal or a template literal without expressions");
29
29
  return;
30
30
  }
31
31
  const options = readContextOptions(call.arguments[1], location, context, readStatic);
@@ -36,16 +36,22 @@ function processVueStringCall(call, kind, location, context, readStatic = readSt
36
36
  }
37
37
  addStringUpdate(value.value, options.context, location, context);
38
38
  }
39
+ /** Returns the public callable name represented by one extraction identity. */
40
+ function stringFunctionName(kind) {
41
+ return kind === "gt" ? "gt()" : kind === "msg" ? "msg()" : "t()";
42
+ }
39
43
  function addStringUpdate(source, translationContext, location, context) {
40
44
  context.results.push({
41
45
  dataFormat: "STRING",
42
46
  source,
43
- metadata: createInlineMetadata(context, location, translationContext)
47
+ metadata: createInlineMetadata(context, location, { ...translationContext !== void 0 && { context: translationContext } })
44
48
  });
45
49
  }
46
50
  function readContextOptions(argument, location, context, readStatic) {
47
51
  if (argument === void 0) return { ok: true };
48
52
  const options = unwrapExpression(argument);
53
+ const staticOptions = readStatic(options);
54
+ if (staticOptions.ok && staticOptions.value === void 0) return { ok: true };
49
55
  if (options?.type !== "ObjectExpression") {
50
56
  addVueError(context, location, "Found dynamic options in a gt-vue string translation call", "Pass a static object containing only a string $context field");
51
57
  return { ok: false };
@@ -62,7 +68,7 @@ function readContextOptions(argument, location, context, readStatic) {
62
68
  return { ok: false };
63
69
  }
64
70
  const value = readStatic(property.value);
65
- if (!value.ok || typeof value.value !== "string") {
71
+ if (!value.ok || typeof value.value !== "string" && value.value !== void 0) {
66
72
  addVueError(context, location, "Found a dynamic $context in a gt-vue string translation call", "Use a string literal or a template literal without expressions");
67
73
  return { ok: false };
68
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stringCalls.js","names":[],"sources":["../../src/internal/stringCalls.ts"],"sourcesContent":["import type * as t from '@babel/types';\nimport type {\n ExtractionLocation,\n StringFunctionKind,\n VueExtractionContext,\n} from './types.js';\nimport {\n addVueError,\n createInlineMetadata,\n readStaticPrimitive,\n type StaticPrimitiveResult,\n unwrapExpression,\n} from './utils.js';\n\ntype VueStringCall = t.CallExpression | t.OptionalCallExpression;\ntype StaticPrimitiveReader = (\n input: t.Node | null | undefined\n) => StaticPrimitiveResult;\n\nexport function processVueStringCall(\n call: VueStringCall,\n kind: StringFunctionKind,\n location: ExtractionLocation | undefined,\n context: VueExtractionContext,\n readStatic: StaticPrimitiveReader = readStaticPrimitive\n): void {\n const firstArgument = call.arguments[0];\n const unwrappedFirstArgument = unwrapExpression(firstArgument);\n\n if (kind === 'msg' && unwrappedFirstArgument?.type === 'ArrayExpression') {\n const options = readContextOptions(\n call.arguments[1],\n location,\n context,\n readStatic\n );\n if (!options.ok) return;\n if (call.arguments.length > 2) {\n addUnsupportedArgumentsError(location, context);\n return;\n }\n\n const messages: string[] = [];\n for (const element of unwrappedFirstArgument.elements) {\n const value = readStatic(element);\n if (!value.ok || typeof value.value !== 'string') {\n addVueError(\n context,\n location,\n 'Found a dynamic entry in a gt-vue msg() message list',\n 'Use only string literals or template literals without expressions'\n );\n return;\n }\n messages.push(value.value);\n }\n for (const message of messages) {\n addStringUpdate(message, options.context, location, context);\n }\n return;\n }\n\n const value =\n unwrappedFirstArgument?.type === 'SpreadElement' ||\n unwrappedFirstArgument?.type === 'ArgumentPlaceholder'\n ? { ok: false as const }\n : readStatic(unwrappedFirstArgument);\n\n // useMessages() can receive a previously encoded msg() value. Only direct\n // literal calls register new source content.\n if (!value.ok || typeof value.value !== 'string') {\n if (kind === 'messages') return;\n addVueError(\n context,\n location,\n `Found dynamic content in a gt-vue ${kind === 'gt' ? 'gt()' : 'msg()'} call`,\n 'Use a string literal or a template literal without expressions'\n );\n return;\n }\n\n const options = readContextOptions(\n call.arguments[1],\n location,\n context,\n readStatic\n );\n if (!options.ok) return;\n if (call.arguments.length > 2) {\n addUnsupportedArgumentsError(location, context);\n return;\n }\n addStringUpdate(value.value, options.context, location, context);\n}\n\nfunction addStringUpdate(\n source: string,\n translationContext: string | undefined,\n location: ExtractionLocation | undefined,\n context: VueExtractionContext\n): void {\n context.results.push({\n dataFormat: 'STRING',\n source,\n metadata: createInlineMetadata(context, location, translationContext),\n });\n}\n\nfunction readContextOptions(\n argument: VueStringCall['arguments'][number] | undefined,\n location: ExtractionLocation | undefined,\n context: VueExtractionContext,\n readStatic: StaticPrimitiveReader\n): { ok: true; context?: string } | { ok: false } {\n if (argument === undefined) return { ok: true };\n const options = unwrapExpression(argument);\n if (options?.type !== 'ObjectExpression') {\n addVueError(\n context,\n location,\n 'Found dynamic options in a gt-vue string translation call',\n 'Pass a static object containing only a string $context field'\n );\n return { ok: false };\n }\n\n let translationContext: string | undefined;\n for (const property of options.properties) {\n if (\n property.type !== 'ObjectProperty' ||\n (property.computed && property.key.type !== 'StringLiteral')\n ) {\n addVueError(\n context,\n location,\n 'Found unsupported options in a gt-vue string translation call',\n 'Pass a static object containing only a string $context field'\n );\n return { ok: false };\n }\n const key =\n property.key.type === 'Identifier'\n ? property.key.name\n : property.key.type === 'StringLiteral'\n ? property.key.value\n : undefined;\n if (key !== '$context') {\n addVueError(\n context,\n location,\n `Found unsupported gt-vue string option ${key ? `\"${key}\"` : ''}`.trim(),\n 'gt-vue string translation currently supports only $context'\n );\n return { ok: false };\n }\n const value = readStatic(property.value);\n if (!value.ok || typeof value.value !== 'string') {\n addVueError(\n context,\n location,\n 'Found a dynamic $context in a gt-vue string translation call',\n 'Use a string literal or a template literal without expressions'\n );\n return { ok: false };\n }\n translationContext = value.value;\n }\n return { ok: true, context: translationContext };\n}\n\nfunction addUnsupportedArgumentsError(\n location: ExtractionLocation | undefined,\n context: VueExtractionContext\n): void {\n addVueError(\n context,\n location,\n 'Found unsupported arguments in a gt-vue string translation call',\n 'Pass the source string and, optionally, an object containing only $context'\n );\n}\n"],"mappings":";;AAmBA,SAAgB,qBACd,MACA,MACA,UACA,SACA,aAAoC,qBAC9B;CACN,MAAM,gBAAgB,KAAK,UAAU;CACrC,MAAM,yBAAyB,iBAAiB,cAAc;AAE9D,KAAI,SAAS,SAAS,wBAAwB,SAAS,mBAAmB;EACxE,MAAM,UAAU,mBACd,KAAK,UAAU,IACf,UACA,SACA,WACD;AACD,MAAI,CAAC,QAAQ,GAAI;AACjB,MAAI,KAAK,UAAU,SAAS,GAAG;AAC7B,gCAA6B,UAAU,QAAQ;AAC/C;;EAGF,MAAM,WAAqB,EAAE;AAC7B,OAAK,MAAM,WAAW,uBAAuB,UAAU;GACrD,MAAM,QAAQ,WAAW,QAAQ;AACjC,OAAI,CAAC,MAAM,MAAM,OAAO,MAAM,UAAU,UAAU;AAChD,gBACE,SACA,UACA,wDACA,oEACD;AACD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R,MAAI,QAAQ,YAAY;AACtB,eACE,SACA,UACA,0CAA0C,MAAM,IAAI,IAAI,KAAK,KAAK,MAAM,EACxE,6DACD;AACD,UAAO,EAAE,IAAI,OAAO;;EAEtB,MAAM,QAAQ,WAAW,SAAS,MAAM;AACxC,MAAI,CAAC,MAAM,MAAM,OAAO,MAAM,UAAU,UAAU;AAChD,eACE,SACA,UACA,gEACA,iEACD;AACD,UAAO,EAAE,IAAI,OAAO;;AAEtB,uBAAqB,MAAM;;AAE7B,QAAO;EAAE,IAAI;EAAM,SAAS;EAAoB;;AAGlD,SAAS,6BACP,UACA,SACM;AACN,aACE,SACA,UACA,mEACA,6EACD"}
1
+ {"version":3,"file":"stringCalls.js","names":[],"sources":["../../src/internal/stringCalls.ts"],"sourcesContent":["import type * as t from '@babel/types';\nimport type {\n ExtractionLocation,\n StringFunctionKind,\n VueExtractionContext,\n} from './types.js';\nimport {\n addVueError,\n createInlineMetadata,\n readStaticPrimitive,\n type StaticPrimitiveResult,\n unwrapExpression,\n} from './utils.js';\n\ntype VueStringCall = t.CallExpression | t.OptionalCallExpression;\ntype StaticPrimitiveReader = (\n input: t.Node | null | undefined\n) => StaticPrimitiveResult;\n\nexport function processVueStringCall(\n call: VueStringCall,\n kind: StringFunctionKind,\n location: ExtractionLocation | undefined,\n context: VueExtractionContext,\n readStatic: StaticPrimitiveReader = readStaticPrimitive\n): void {\n const firstArgument = call.arguments[0];\n const unwrappedFirstArgument = unwrapExpression(firstArgument);\n\n if (kind === 'msg' && unwrappedFirstArgument?.type === 'ArrayExpression') {\n const options = readContextOptions(\n call.arguments[1],\n location,\n context,\n readStatic\n );\n if (!options.ok) return;\n if (call.arguments.length > 2) {\n addUnsupportedArgumentsError(location, context);\n return;\n }\n\n const messages: string[] = [];\n for (const element of unwrappedFirstArgument.elements) {\n const value = readStatic(element);\n if (!value.ok || typeof value.value !== 'string') {\n addVueError(\n context,\n location,\n 'Found a dynamic entry in a gt-vue msg() message list',\n 'Use only string literals or template literals without expressions'\n );\n return;\n }\n messages.push(value.value);\n }\n for (const message of messages) {\n addStringUpdate(message, options.context, location, context);\n }\n return;\n }\n\n const value =\n unwrappedFirstArgument?.type === 'SpreadElement' ||\n unwrappedFirstArgument?.type === 'ArgumentPlaceholder'\n ? { ok: false as const }\n : readStatic(unwrappedFirstArgument);\n\n // useMessages() can receive a previously encoded msg() value. Only direct\n // literal calls register new source content.\n if (!value.ok || typeof value.value !== 'string') {\n if (kind === 'messages') return;\n addVueError(\n context,\n location,\n `Found dynamic content in a gt-vue ${stringFunctionName(kind)} call`,\n 'Use a string literal or a template literal without expressions'\n );\n return;\n }\n\n const options = readContextOptions(\n call.arguments[1],\n location,\n context,\n readStatic\n );\n if (!options.ok) return;\n if (call.arguments.length > 2) {\n addUnsupportedArgumentsError(location, context);\n return;\n }\n addStringUpdate(value.value, options.context, location, context);\n}\n\n/** Returns the public callable name represented by one extraction identity. */\nfunction stringFunctionName(kind: Exclude<StringFunctionKind, 'messages'>) {\n return kind === 'gt' ? 'gt()' : kind === 'msg' ? 'msg()' : 't()';\n}\n\nfunction addStringUpdate(\n source: string,\n translationContext: string | undefined,\n location: ExtractionLocation | undefined,\n context: VueExtractionContext\n): void {\n context.results.push({\n dataFormat: 'STRING',\n source,\n metadata: createInlineMetadata(context, location, {\n ...(translationContext !== undefined && {\n context: translationContext,\n }),\n }),\n });\n}\n\nfunction readContextOptions(\n argument: VueStringCall['arguments'][number] | undefined,\n location: ExtractionLocation | undefined,\n context: VueExtractionContext,\n readStatic: StaticPrimitiveReader\n): { ok: true; context?: string } | { ok: false } {\n if (argument === undefined) return { ok: true };\n const options = unwrapExpression(argument);\n const staticOptions = readStatic(options);\n if (staticOptions.ok && staticOptions.value === undefined) {\n return { ok: true };\n }\n if (options?.type !== 'ObjectExpression') {\n addVueError(\n context,\n location,\n 'Found dynamic options in a gt-vue string translation call',\n 'Pass a static object containing only a string $context field'\n );\n return { ok: false };\n }\n\n let translationContext: string | undefined;\n for (const property of options.properties) {\n if (\n property.type !== 'ObjectProperty' ||\n (property.computed && property.key.type !== 'StringLiteral')\n ) {\n addVueError(\n context,\n location,\n 'Found unsupported options in a gt-vue string translation call',\n 'Pass a static object containing only a string $context field'\n );\n return { ok: false };\n }\n const key =\n property.key.type === 'Identifier'\n ? property.key.name\n : property.key.type === 'StringLiteral'\n ? property.key.value\n : undefined;\n if (key !== '$context') {\n addVueError(\n context,\n location,\n `Found unsupported gt-vue string option ${key ? `\"${key}\"` : ''}`.trim(),\n 'gt-vue string translation currently supports only $context'\n );\n return { ok: false };\n }\n const value = readStatic(property.value);\n if (\n !value.ok ||\n (typeof value.value !== 'string' && value.value !== undefined)\n ) {\n addVueError(\n context,\n location,\n 'Found a dynamic $context in a gt-vue string translation call',\n 'Use a string literal or a template literal without expressions'\n );\n return { ok: false };\n }\n translationContext = value.value;\n }\n return { ok: true, context: translationContext };\n}\n\nfunction addUnsupportedArgumentsError(\n location: ExtractionLocation | undefined,\n context: VueExtractionContext\n): void {\n addVueError(\n context,\n location,\n 'Found unsupported arguments in a gt-vue string translation call',\n 'Pass the source string and, optionally, an object containing only $context'\n );\n}\n"],"mappings":";;AAmBA,SAAgB,qBACd,MACA,MACA,UACA,SACA,aAAoC,qBAC9B;CACN,MAAM,gBAAgB,KAAK,UAAU;CACrC,MAAM,yBAAyB,iBAAiB,cAAc;AAE9D,KAAI,SAAS,SAAS,wBAAwB,SAAS,mBAAmB;EACxE,MAAM,UAAU,mBACd,KAAK,UAAU,IACf,UACA,SACA,WACD;AACD,MAAI,CAAC,QAAQ,GAAI;AACjB,MAAI,KAAK,UAAU,SAAS,GAAG;AAC7B,gCAA6B,UAAU,QAAQ;AAC/C;;EAGF,MAAM,WAAqB,EAAE;AAC7B,OAAK,MAAM,WAAW,uBAAuB,UAAU;GACrD,MAAM,QAAQ,WAAW,QAAQ;AACjC,OAAI,CAAC,MAAM,MAAM,OAAO,MAAM,UAAU,UAAU;AAChD,gBACE,SACA,UACA,wDACA,oEACD;AACD;;AAE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