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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) 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 +252 -85
  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/localModules.d.ts +23 -2
  65. package/dist/internal/script/localModules.js +533 -20
  66. package/dist/internal/script/localModules.js.map +1 -1
  67. package/dist/internal/script/model.d.ts +9 -2
  68. package/dist/internal/script/parser.js +2 -1
  69. package/dist/internal/script/parser.js.map +1 -1
  70. package/dist/internal/script/runtimeModules.d.ts +10 -0
  71. package/dist/internal/script/runtimeModules.js +27 -0
  72. package/dist/internal/script/runtimeModules.js.map +1 -0
  73. package/dist/internal/stringCalls.js +1 -1
  74. package/dist/internal/stringCalls.js.map +1 -1
  75. package/dist/internal/template.js +263 -141
  76. package/dist/internal/template.js.map +1 -1
  77. package/dist/internal/types.d.ts +4 -1
  78. package/dist/internal/utils.d.ts +14 -3
  79. package/dist/internal/utils.js +63 -3
  80. package/dist/internal/utils.js.map +1 -1
  81. package/dist/internal/vueCompiler.d.ts +9 -1
  82. package/dist/internal/vueCompiler.js +37 -14
  83. package/dist/internal/vueCompiler.js.map +1 -1
  84. package/dist/project.d.ts +11 -0
  85. package/dist/project.js +3 -0
  86. package/dist/types.d.ts +95 -4
  87. package/package.json +30 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractFromVueProject.js","names":[],"sources":["../../../src/internal/project/extractFromVueProject.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport type { JsxChildren } from '@generaltranslation/format/types';\nimport fg from 'fast-glob';\nimport { hashSource } from 'generaltranslation/id';\nimport {\n createDiagnosticMessage,\n formatDiagnosticErrorDetails,\n} from 'generaltranslation/internal';\nimport { extractFromVueSource } from '../extractFromVueSource.js';\nimport {\n resolveVueCompilerOptions,\n type VueCompilerOptionsResolution,\n} from '../config/resolveVueCompilerOptions.js';\nimport { NUXT_CONFIG_FILES, VITE_CONFIG_FILES } from '../config/configFiles.js';\nimport {\n createProjectModuleResolver,\n DEFAULT_RESOLUTION_CONDITIONS,\n loadExplicitTypeScriptConfig,\n} from './moduleResolver.js';\nimport { resolveVueProjectAliasConfiguration } from './viteAliases.js';\nimport {\n declaresInstalledJavaScriptDependency,\n GT_VUE_PACKAGE,\n readJavaScriptPackageManifest,\n} from './manifest.js';\nimport {\n discoverVueProject,\n findVueSourceScope,\n readDefaultVueSourcePatterns,\n resolveProjectDirectory,\n type VueSourceScope,\n} from './scopes.js';\nimport {\n isVueSfcSource,\n readVueProjectInspection,\n} from './inspectVueProject.js';\nimport type {\n VueCompilerOptions,\n VueExtractionOutput,\n VueExtractionResult,\n VueProjectExtractionOptions,\n VueProjectExtractionOutput,\n VueProjectExtractionResult,\n VueSourceCode,\n} from '../../types.js';\n\nconst SCRIPT_EXTENSIONS = new Set([\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n]);\n\nconst JSX_CONFIG_EXTENSIONS = new Set(['.jsx', '.tsx']);\n\n/**\n * Extracts, hashes, and deduplicates every gt-vue message owned by a project.\n *\n * This is the package-level orchestration boundary used by host CLIs. It owns\n * workspace discovery, source matching, compiler/config resolution, static\n * module resolution, and catalog hashing so framework hosts do not need Vue\n * implementation details. Configuration failures return no partial updates.\n */\nexport async function extractFromVueProject(\n options: VueProjectExtractionOptions = {}\n): Promise<VueProjectExtractionOutput> {\n const projectRoot = resolveProjectDirectory(\n options.cwd ?? options.inspection?.projectRoot ?? process.cwd()\n );\n const discovery =\n readVueProjectInspection(options.inspection, projectRoot) ??\n discoverVueProject(projectRoot);\n const discoveryErrors =\n options.filePatterns === undefined\n ? validateNuxtSourceScopes(discovery.scopes, options.vueCompilerOptions)\n : [];\n if (discoveryErrors.length > 0) {\n return { updates: [], errors: discoveryErrors, warnings: [] };\n }\n const patterns =\n options.filePatterns ?? readDefaultVueSourcePatterns(discovery.scopes);\n if (patterns.length === 0) {\n return { updates: [], errors: [], warnings: [] };\n }\n\n const fileMatches = matchProjectFiles(projectRoot, patterns);\n if (fileMatches.errors.length > 0) {\n return { updates: [], errors: fileMatches.errors, warnings: [] };\n }\n const matchedFiles = fileMatches.files;\n const scopes = addExplicitSourceScopes(\n projectRoot,\n discovery.scopes,\n options.filePatterns === undefined ? [] : matchedFiles\n );\n const sourceByFile = new Map<string, string>();\n const standaloneResults = new Map<string, VueExtractionOutput>();\n const fileScopes = new Map(\n matchedFiles.map((file) => [file, findVueSourceScope(file, scopes)])\n );\n // Explicit globs can also match files owned by another framework package.\n // They are not Vue inputs unless discovery placed them in a Vue scope.\n const ownedFiles = matchedFiles.filter(\n (file) => fileScopes.get(file) !== undefined\n );\n const files = await filterVueSourceFiles(ownedFiles, sourceByFile);\n if (files.length === 0) {\n return { updates: [], errors: [], warnings: [] };\n }\n const errors: string[] = [];\n const warnings = new Set<string>();\n const tsconfigPath = resolveExplicitTypeScriptConfigPath(\n projectRoot,\n options.tsconfigPath,\n errors\n );\n if (errors.length > 0) {\n return { updates: [], errors, warnings: [] };\n }\n let explicitCompilerResolution = validateExplicitCompilerConfig(\n projectRoot,\n options,\n files.some((file) => path.extname(file).toLowerCase() === '.vue'),\n errors\n );\n if (errors.length > 0) {\n return { updates: [], errors, warnings: [] };\n }\n\n const moduleResolution = createVueModuleResolver(\n projectRoot,\n scopes,\n fileScopes,\n options,\n createProjectModuleResolver(\n options.conditionNames ?? DEFAULT_RESOLUTION_CONDITIONS,\n { tsconfigPath }\n )\n );\n errors.push(...moduleResolution.errors);\n if (errors.length > 0) {\n return { updates: [], errors, warnings: [] };\n }\n const resolveModuleForFile = moduleResolution.resolveModuleForFile;\n\n for (const file of files) {\n const extension = path.extname(file).toLowerCase();\n if (extension !== '.vue' && !SCRIPT_EXTENSIONS.has(extension)) continue;\n let source = sourceByFile.get(file);\n if (source === undefined) {\n try {\n source = await fs.promises.readFile(file, 'utf8');\n } catch (error) {\n errors.push(createReadDiagnostic(projectRoot, file, error));\n continue;\n }\n sourceByFile.set(file, source);\n }\n if (extension === '.vue') continue;\n standaloneResults.set(\n file,\n await extractFromVueSource(source, file, {\n compilerOptions: {},\n includeSourceCodeContext: options.includeSourceCodeContext,\n projectRoot,\n requireGTProvenance: true,\n resolveModule: resolveModuleForFile(file),\n surroundingLineCount: options.surroundingLineCount,\n })\n );\n }\n\n if (\n explicitCompilerResolution === undefined &&\n [...standaloneResults.values()].some(hasExtractionSignal)\n ) {\n explicitCompilerResolution = validateExplicitCompilerConfig(\n projectRoot,\n options,\n true,\n errors\n );\n }\n\n const potentialAliasProvenanceScopes = await probePotentialAliasProvenance(\n files,\n sourceByFile,\n fileScopes,\n standaloneResults,\n moduleResolution.resolvePotentialModulesForFile,\n projectRoot\n );\n\n validateIncompleteAliasScopes(\n files,\n fileScopes,\n standaloneResults,\n moduleResolution.incompleteAliasScopes,\n potentialAliasProvenanceScopes,\n errors\n );\n\n // I/O failures make project discovery incomplete, so never return a partial\n // catalog that a caller could mistake for a successful extraction.\n if (errors.length > 0) {\n return { updates: [], errors, warnings: [] };\n }\n\n const configAffectedFiles = files.filter((file) => {\n const extension = path.extname(file).toLowerCase();\n if (extension === '.vue') return true;\n const standaloneResult = standaloneResults.get(file);\n return (\n hasExtractionSignal(standaloneResult) &&\n (JSX_CONFIG_EXTENSIONS.has(extension) ||\n standaloneResult?.results.some(\n ({ dataFormat }) => dataFormat === 'JSX'\n ) === true)\n );\n });\n const compilerOptionsByScope = resolveCompilerOptionsByScope(\n projectRoot,\n configAffectedFiles,\n fileScopes,\n scopes,\n options,\n explicitCompilerResolution,\n errors\n );\n if (errors.length > 0) {\n return { updates: [], errors, warnings: [] };\n }\n\n const results: VueExtractionResult[] = [];\n for (const file of files) {\n const extension = path.extname(file).toLowerCase();\n if (extension !== '.vue' && !SCRIPT_EXTENSIONS.has(extension)) continue;\n const source = sourceByFile.get(file);\n if (source === undefined) continue;\n const result =\n extension === '.vue'\n ? await extractFromVueSource(source, file, {\n compilerOptions:\n compilerOptionsByScope.get(\n fileScopes.get(file)?.directory ?? ''\n ) ?? {},\n includeSourceCodeContext: options.includeSourceCodeContext,\n projectRoot,\n requireGTProvenance: true,\n resolveModule: resolveModuleForFile(file),\n surroundingLineCount: options.surroundingLineCount,\n })\n : standaloneResults.get(file);\n if (!result) continue;\n results.push(...result.results);\n errors.push(...result.errors);\n for (const warning of result.warnings) warnings.add(warning);\n }\n\n const updates = results.map(addCatalogHash);\n deduplicateProjectUpdates(updates);\n return {\n updates: errors.length > 0 ? [] : updates,\n errors,\n warnings: [...warnings],\n };\n}\n\n/** Excludes script modules whose filename happens to end in `.vue`. */\nasync function filterVueSourceFiles(\n files: readonly string[],\n sourceByFile: Map<string, string>\n): Promise<string[]> {\n const included = await Promise.all(\n files.map(async (file) => {\n if (path.extname(file).toLowerCase() !== '.vue') return true;\n try {\n const source = await fs.promises.readFile(file, 'utf8');\n sourceByFile.set(file, source);\n return isVueSfcSource(source);\n } catch {\n // Preserve the file so the normal extraction pass reports its I/O error.\n return true;\n }\n })\n );\n return files.filter((_file, index) => included[index]);\n}\n\n/** Returns whether a standalone file has observable gt-vue extraction work. */\nfunction hasExtractionSignal(result: VueExtractionOutput | undefined): boolean {\n return Boolean(\n result &&\n (result.results.length > 0 ||\n result.errors.length > 0 ||\n result.warnings.length > 0)\n );\n}\n\n/**\n * Proves whether a statically observed alias candidate can expose gt-vue.\n *\n * Incomplete config candidates are diagnostic evidence only: results from\n * these probes are never published. Reusing the normal provenance analyzer\n * avoids treating ordinary React/local helpers with GT-shaped names as Vue.\n */\nasync function probePotentialAliasProvenance(\n files: readonly string[],\n sourceByFile: ReadonlyMap<string, string>,\n fileScopes: ReadonlyMap<string, VueSourceScope | undefined>,\n standaloneResults: ReadonlyMap<string, VueExtractionOutput>,\n resolvePotentialModulesForFile: (\n sourceFile: string\n ) => Array<(specifier: string, importer: string) => string | undefined>,\n projectRoot: string\n): Promise<Set<string>> {\n const provenScopes = new Set<string>();\n for (const file of files) {\n if (path.extname(file).toLowerCase() === '.vue') continue;\n const scope = fileScopes.get(file);\n const source = sourceByFile.get(file);\n if (\n !scope ||\n source === undefined ||\n provenScopes.has(scope.directory) ||\n hasExtractionSignal(standaloneResults.get(file))\n ) {\n continue;\n }\n for (const resolveModule of resolvePotentialModulesForFile(file)) {\n const probe = await extractFromVueSource(source, file, {\n compilerOptions: {},\n projectRoot,\n requireGTProvenance: true,\n resolveModule,\n });\n if (!hasExtractionSignal(probe)) continue;\n provenScopes.add(scope.directory);\n break;\n }\n }\n return provenScopes;\n}\n\n/** Maximum diagnostic-only alias combinations explored for one application. */\nconst MAX_POTENTIAL_ALIAS_CONFIGURATIONS = 128;\n\n/** Builds deterministic candidate maps without trusting any as active config. */\nfunction createPotentialAliasConfigurations(\n potentialAliases: ReadonlyMap<string, ReadonlySet<string>> | undefined\n): Map<string, string>[] {\n if (!potentialAliases || potentialAliases.size === 0) return [];\n let configurations: Map<string, string>[] = [new Map()];\n for (const [key, replacements] of potentialAliases) {\n if (replacements.size === 0) continue;\n const next: Map<string, string>[] = [];\n for (const configuration of configurations) {\n for (const replacement of replacements) {\n next.push(new Map(configuration).set(key, replacement));\n if (next.length >= MAX_POTENTIAL_ALIAS_CONFIGURATIONS) break;\n }\n if (next.length >= MAX_POTENTIAL_ALIAS_CONFIGURATIONS) break;\n }\n configurations = next;\n if (configurations.length === 0) return [];\n }\n return configurations;\n}\n\nfunction addCatalogHash(\n result: VueExtractionResult\n): VueProjectExtractionResult {\n const hash = hashSource({\n // hashSource's historical shared type omits boolean/null branch sources,\n // although its runtime sanitizer has always supported those React values.\n source: result.source as JsxChildren | string,\n ...(result.metadata.context && { context: result.metadata.context }),\n ...(result.metadata.maxChars != null && {\n maxChars: result.metadata.maxChars,\n }),\n ...(result.metadata.requiresReview === true && { requiresReview: true }),\n dataFormat: result.dataFormat,\n });\n return {\n ...result,\n metadata: { ...result.metadata, hash },\n } as VueProjectExtractionResult;\n}\n\n/** Merges duplicate Vue hashes without repeating source-location metadata. */\nfunction deduplicateProjectUpdates(\n updates: VueProjectExtractionResult[]\n): void {\n const byHash = new Map<string, VueProjectExtractionResult>();\n for (const update of updates) {\n const existing = byHash.get(update.metadata.hash);\n if (!existing) {\n byHash.set(update.metadata.hash, update);\n continue;\n }\n existing.metadata.filePaths = mergeUnique(\n existing.metadata.filePaths,\n update.metadata.filePaths\n );\n existing.metadata.sourceCode = mergeSourceCode(\n existing.metadata.sourceCode,\n update.metadata.sourceCode\n );\n }\n updates.splice(0, updates.length, ...byHash.values());\n}\n\nfunction mergeUnique(\n left: string[] | undefined,\n right: string[] | undefined\n): string[] | undefined {\n const merged = [...new Set([...(left ?? []), ...(right ?? [])])];\n return merged.length > 0 ? merged : undefined;\n}\n\nfunction mergeSourceCode(\n left: Record<string, VueSourceCode[]> | undefined,\n right: Record<string, VueSourceCode[]> | undefined\n): Record<string, VueSourceCode[]> | undefined {\n if (!left && !right) return undefined;\n const merged: Record<string, VueSourceCode[]> = {};\n for (const sourceCode of [left, right]) {\n for (const [file, entries] of Object.entries(sourceCode ?? {})) {\n const known = new Set(\n (merged[file] ?? []).map((entry) => JSON.stringify(entry))\n );\n for (const entry of entries) {\n const key = JSON.stringify(entry);\n if (known.has(key)) continue;\n (merged[file] ??= []).push(entry);\n known.add(key);\n }\n }\n }\n return merged;\n}\n\n/** Matches source patterns without hiding filesystem discovery failures. */\nfunction matchProjectFiles(\n cwd: string,\n patterns: readonly string[]\n): { files: string[]; errors: string[] } {\n let matches: string[];\n try {\n matches = fg.sync([...patterns], {\n absolute: true,\n cwd,\n followSymbolicLinks: false,\n ignore: ['**/node_modules/**'],\n onlyFiles: true,\n unique: true,\n });\n } catch (error) {\n return {\n files: [],\n errors: [createGlobDiagnostic(patterns, error)],\n };\n }\n let realRoot: string;\n try {\n realRoot = fs.realpathSync(cwd);\n } catch (error) {\n return {\n files: [],\n errors: [createRootRealpathDiagnostic(cwd, error)],\n };\n }\n const files = new Set<string>();\n const errors: string[] = [];\n for (const file of matches) {\n let realFile: string;\n try {\n realFile = fs.realpathSync(file);\n } catch (error) {\n errors.push(createMatchedFileRealpathDiagnostic(cwd, file, error));\n continue;\n }\n const relative = path.relative(realRoot, realFile);\n if (\n relative === '' ||\n relative === '..' ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n ) {\n // Symlinks outside the project are intentionally outside its catalog.\n continue;\n }\n files.add(realFile);\n }\n return {\n errors,\n files: [...files].sort((left, right) => left.localeCompare(right)),\n };\n}\n\n/**\n * Makes custom Nuxt source layouts fail closed before another scope can make\n * an incomplete project look successful. Vite config does not influence\n * source discovery and remains gated on a matched SFC or proven gt-vue JSX.\n */\nfunction validateNuxtSourceScopes(\n scopes: readonly VueSourceScope[],\n explicitOptions: VueCompilerOptions | undefined\n): string[] {\n const errors: string[] = [];\n for (const scope of scopes) {\n if (\n !NUXT_CONFIG_FILES.some((file) =>\n fs.existsSync(path.join(scope.directory, file))\n )\n ) {\n continue;\n }\n errors.push(\n ...resolveVueCompilerOptions(scope.directory, explicitOptions).errors\n );\n }\n return errors;\n}\n\n/** Adds independent package boundaries only for explicit user-selected sources. */\nfunction addExplicitSourceScopes(\n projectRoot: string,\n discoveredScopes: readonly VueSourceScope[],\n files: readonly string[]\n): VueSourceScope[] {\n const scopes = [...discoveredScopes];\n const known = new Set(scopes.map(({ directory }) => directory));\n for (const file of files) {\n const directory = findNearestPackageDirectory(file, projectRoot);\n if (known.has(directory)) continue;\n const inheritedScope = findVueSourceScope(file, scopes);\n if (!inheritedScope) continue;\n if (!ownsIndependentVueConfiguration(directory)) {\n continue;\n }\n known.add(directory);\n scopes.push({\n directory,\n includeByDefault: false,\n relativeDirectory: toPosixPath(path.relative(projectRoot, directory)),\n });\n }\n return scopes;\n}\n\n/** Returns whether a package must resolve its own Vue build configuration. */\nfunction ownsIndependentVueConfiguration(directory: string): boolean {\n if (\n [...VITE_CONFIG_FILES, ...NUXT_CONFIG_FILES].some((file) =>\n fs.existsSync(path.join(directory, file))\n )\n ) {\n return true;\n }\n const manifest = readJavaScriptPackageManifest(\n path.join(directory, 'package.json')\n );\n return Boolean(\n manifest && declaresInstalledJavaScriptDependency(manifest, GT_VUE_PACKAGE)\n );\n}\n\nfunction findNearestPackageDirectory(\n file: string,\n projectRoot: string\n): string {\n let current = path.dirname(file);\n const root = path.resolve(projectRoot);\n while (current !== root && isWithin(root, current)) {\n if (fs.existsSync(path.join(current, 'package.json'))) return current;\n const parent = path.dirname(current);\n if (parent === current) break;\n current = parent;\n }\n return root;\n}\n\n/** Applies each Vue app's statically resolved Vite/Nuxt aliases before Node resolution. */\nfunction createVueModuleResolver(\n projectRoot: string,\n scopes: readonly VueSourceScope[],\n fileScopes: ReadonlyMap<string, VueSourceScope | undefined>,\n options: VueProjectExtractionOptions,\n resolveModule: (specifier: string, importer: string) => string | undefined\n): {\n resolveModuleForFile: (\n sourceFile: string\n ) => (specifier: string, importer: string) => string | undefined;\n resolvePotentialModulesForFile: (\n sourceFile: string\n ) => Array<(specifier: string, importer: string) => string | undefined>;\n errors: string[];\n incompleteAliasScopes: Set<string>;\n} {\n const matchedScopes = uniqueSourceScopes(fileScopes.values());\n const ownedMatchedScopes = matchedScopes.filter(\n ({ includeByDefault }) => includeByDefault\n );\n const candidateExplicitScopes =\n ownedMatchedScopes.length > 0 ? ownedMatchedScopes : matchedScopes;\n const aliasesByScope = new Map<string, Map<string, string>>();\n const errors: string[] = [];\n const incompleteAliasScopes = new Set<string>();\n const potentialAliasesByScope = new Map<string, Map<string, Set<string>>>();\n if (options.viteConfigPath !== undefined) {\n const explicitConfig = path.resolve(projectRoot, options.viteConfigPath);\n const explicitScope =\n candidateExplicitScopes.length === 1\n ? candidateExplicitScopes[0]\n : findVueSourceScope(explicitConfig, candidateExplicitScopes);\n if (!explicitScope) {\n errors.push(\n createExplicitConfigOwnershipDiagnostic(options.viteConfigPath)\n );\n } else {\n for (const scope of matchedScopes) {\n addAliasesForScope(\n aliasesByScope,\n incompleteAliasScopes,\n potentialAliasesByScope,\n scope,\n scope.directory === explicitScope.directory\n ? {\n directory: projectRoot,\n viteConfigPath: options.viteConfigPath,\n }\n : { directory: scope.directory }\n );\n }\n }\n } else {\n for (const scope of matchedScopes) {\n addAliasesForScope(\n aliasesByScope,\n incompleteAliasScopes,\n potentialAliasesByScope,\n scope,\n { directory: scope.directory }\n );\n }\n }\n\n return {\n errors,\n incompleteAliasScopes,\n resolveModuleForFile(sourceFile) {\n // Keep aliases attached to the application that initiated traversal.\n // A local barrel can live in a sibling/linked package and import another\n // application alias transitively; selecting by that barrel's directory\n // would either lose the alias or leak a different app's configuration.\n const sourceScope = findVueSourceScope(sourceFile, scopes);\n return (specifier, importer) => {\n const scope = sourceScope ?? findVueSourceScope(importer, scopes);\n const aliases = scope ? aliasesByScope.get(scope.directory) : undefined;\n return resolveModule(applyStaticAlias(specifier, aliases), importer);\n };\n },\n resolvePotentialModulesForFile(sourceFile) {\n const sourceScope = findVueSourceScope(sourceFile, scopes);\n if (!sourceScope) return [];\n return createPotentialAliasConfigurations(\n potentialAliasesByScope.get(sourceScope.directory)\n ).map(\n (aliases) => (specifier: string, importer: string) =>\n resolveModule(applyStaticAlias(specifier, aliases), importer)\n );\n },\n };\n}\n\nfunction addAliasesForScope(\n aliasesByScope: Map<string, Map<string, string>>,\n incompleteAliasScopes: Set<string>,\n potentialAliasesByScope: Map<string, Map<string, Set<string>>>,\n scope: VueSourceScope,\n config: { directory: string; viteConfigPath?: string }\n): void {\n const resolution = resolveVueProjectAliasConfiguration(config.directory, {\n viteConfigPath: config.viteConfigPath,\n });\n if (!resolution.complete) {\n incompleteAliasScopes.add(scope.directory);\n if (resolution.potentialAliases) {\n potentialAliasesByScope.set(scope.directory, resolution.potentialAliases);\n }\n aliasesByScope.set(scope.directory, new Map());\n return;\n }\n aliasesByScope.set(scope.directory, resolution.aliases);\n}\n\n/** Blocks incomplete aliases only after a source proves Vue ownership. */\nfunction validateIncompleteAliasScopes(\n files: readonly string[],\n fileScopes: ReadonlyMap<string, VueSourceScope | undefined>,\n standaloneResults: ReadonlyMap<string, VueExtractionOutput>,\n incompleteScopes: ReadonlySet<string>,\n potentialAliasProvenanceScopes: ReadonlySet<string>,\n errors: string[]\n): void {\n const diagnosedScopes = new Set<string>();\n for (const file of files) {\n const scope = fileScopes.get(file);\n if (\n !scope ||\n !incompleteScopes.has(scope.directory) ||\n diagnosedScopes.has(scope.directory)\n ) {\n continue;\n }\n const isVueSource = path.extname(file).toLowerCase() === '.vue';\n const hasVueSignal = hasExtractionSignal(standaloneResults.get(file));\n const hasPotentialAliasProvenance = potentialAliasProvenanceScopes.has(\n scope.directory\n );\n if (!isVueSource && !hasVueSignal && !hasPotentialAliasProvenance) {\n continue;\n }\n diagnosedScopes.add(scope.directory);\n errors.push(createIncompleteAliasDiagnostic(scope));\n }\n}\n\nfunction createIncompleteAliasDiagnostic(scope: VueSourceScope): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/vue-extractor',\n severity: 'Error',\n whatHappened:\n 'Could not statically resolve the Vue application module aliases',\n why: 'Dynamic alias behavior can hide gt-vue imports and produce an incomplete translation catalog',\n fix: 'Define Vite or Nuxt aliases with static string values and remove custom alias resolvers',\n details: scope.relativeDirectory || '.',\n });\n}\n\nfunction uniqueSourceScopes(\n scopes: Iterable<VueSourceScope | undefined>\n): VueSourceScope[] {\n const unique = new Map<string, VueSourceScope>();\n for (const scope of scopes) {\n if (scope) unique.set(scope.directory, scope);\n }\n return [...unique.values()];\n}\n\nfunction applyStaticAlias(\n specifier: string,\n aliases: ReadonlyMap<string, string> | undefined\n): string {\n if (!aliases) return specifier;\n for (const [find, replacement] of aliases) {\n const normalized =\n find.endsWith('/') && replacement.endsWith('/')\n ? {\n find: find.slice(0, -1),\n replacement: replacement.slice(0, -1),\n }\n : { find, replacement };\n if (\n specifier === normalized.find ||\n specifier.startsWith(`${normalized.find}/`)\n ) {\n return specifier.replace(normalized.find, normalized.replacement);\n }\n }\n return specifier;\n}\n\n/** Resolves every affected scope before parsing any SFC catalog content. */\nfunction resolveCompilerOptionsByScope(\n projectRoot: string,\n files: readonly string[],\n fileScopes: ReadonlyMap<string, VueSourceScope | undefined>,\n scopes: readonly VueSourceScope[],\n options: VueProjectExtractionOptions,\n explicitCompilerResolution: VueCompilerOptionsResolution | undefined,\n errors: string[]\n): Map<string, VueCompilerOptions> {\n const optionsByScope = new Map<string, VueCompilerOptions>();\n const affectedScopes = new Map<string, VueSourceScope>();\n for (const file of files) {\n const scope = fileScopes.get(file);\n if (scope) affectedScopes.set(scope.directory, scope);\n }\n if (affectedScopes.size === 0) return optionsByScope;\n\n if (options.viteConfigPath !== undefined) {\n const explicitConfig = path.resolve(projectRoot, options.viteConfigPath);\n const explicitResolution =\n explicitCompilerResolution ??\n resolveVueCompilerOptions(projectRoot, options.vueCompilerOptions, {\n viteConfigPath: options.viteConfigPath,\n sourceDiscoveryIsExplicit: options.filePatterns !== undefined,\n });\n errors.push(...explicitResolution.errors);\n if (explicitResolution.errors.length > 0) return optionsByScope;\n const explicitScope =\n affectedScopes.size === 1\n ? [...affectedScopes.values()][0]\n : findVueSourceScope(explicitConfig, scopes);\n if (!explicitScope || !affectedScopes.has(explicitScope.directory)) {\n errors.push(\n createExplicitConfigOwnershipDiagnostic(options.viteConfigPath)\n );\n return optionsByScope;\n }\n\n for (const scope of affectedScopes.values()) {\n const resolution =\n scope.directory === explicitScope.directory\n ? explicitResolution\n : resolveVueCompilerOptions(\n scope.directory,\n options.vueCompilerOptions,\n {\n sourceDiscoveryIsExplicit: options.filePatterns !== undefined,\n }\n );\n errors.push(...resolution.errors);\n optionsByScope.set(scope.directory, resolution.compilerOptions);\n }\n return optionsByScope;\n }\n\n for (const scope of affectedScopes.values()) {\n const resolution = resolveVueCompilerOptions(\n scope.directory,\n options.vueCompilerOptions,\n {\n sourceDiscoveryIsExplicit: options.filePatterns !== undefined,\n }\n );\n errors.push(...resolution.errors);\n optionsByScope.set(scope.directory, resolution.compilerOptions);\n }\n return optionsByScope;\n}\n\n/** Validates an explicitly selected config even when every match is STRING. */\nfunction validateExplicitCompilerConfig(\n projectRoot: string,\n options: VueProjectExtractionOptions,\n hasPotentialVueSource: boolean,\n errors: string[]\n): VueCompilerOptionsResolution | undefined {\n if (!hasPotentialVueSource || options.viteConfigPath === undefined) {\n return undefined;\n }\n const resolution = resolveVueCompilerOptions(\n projectRoot,\n options.vueCompilerOptions,\n {\n viteConfigPath: options.viteConfigPath,\n sourceDiscoveryIsExplicit: options.filePatterns !== undefined,\n }\n );\n errors.push(...resolution.errors);\n return resolution;\n}\n\nfunction createExplicitConfigOwnershipDiagnostic(configPath: string): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/vue-extractor',\n severity: 'Error',\n whatHappened:\n 'The configured Vite config does not own any matched Vue sources',\n fix: 'Run extraction from that application root, include only one centrally configured Vue application, or remove files.gt.parsingFlags.viteConfigPath',\n details: configPath,\n });\n}\n\n/** Resolves and validates one explicit TypeScript project file atomically. */\nfunction resolveExplicitTypeScriptConfigPath(\n projectRoot: string,\n configuredPath: string | undefined,\n errors: string[]\n): string | undefined {\n if (configuredPath === undefined) return undefined;\n const absolutePath = path.resolve(projectRoot, configuredPath);\n try {\n const configPath = fs.realpathSync(absolutePath);\n if (!fs.statSync(configPath).isFile()) {\n throw new Error('The configured path is not a file');\n }\n const resolution = loadExplicitTypeScriptConfig(configPath);\n if (resolution.resultType === 'failed') {\n throw new Error(resolution.message);\n }\n const loadedPath = fs.realpathSync(resolution.configFileAbsolutePath);\n if (loadedPath !== configPath) {\n throw new Error(\n `The resolver selected a different config file: ${loadedPath}`\n );\n }\n return configPath;\n } catch (error) {\n errors.push(\n createDiagnosticMessage({\n source: '@generaltranslation/vue-extractor',\n severity: 'Error',\n whatHappened: 'Could not load the configured TypeScript project file',\n why: 'Unresolved path aliases can hide gt-vue imports and produce an incomplete translation catalog',\n fix: 'Set tsconfigPath to a readable tsconfig.json or jsconfig.json file',\n details: [\n configuredPath,\n formatDiagnosticErrorDetails(error) ?? 'Unknown config error',\n ],\n })\n );\n return undefined;\n }\n}\n\nfunction createReadDiagnostic(\n projectRoot: string,\n file: string,\n error: unknown\n): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/vue-extractor',\n severity: 'Error',\n whatHappened: 'Could not read a matched Vue source file',\n fix: 'Restore read access or exclude the file from the configured source patterns',\n details: [\n toPosixPath(path.relative(projectRoot, file)),\n formatDiagnosticErrorDetails(error) ?? 'Unknown read error',\n ],\n });\n}\n\nfunction createGlobDiagnostic(\n patterns: readonly string[],\n error: unknown\n): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/vue-extractor',\n severity: 'Error',\n whatHappened: 'Could not match the configured Vue source patterns',\n fix: 'Correct the source patterns and rerun extraction',\n details: [\n patterns.join(', ') || '(no patterns)',\n formatDiagnosticErrorDetails(error) ?? 'Unknown glob error',\n ],\n });\n}\n\nfunction createRootRealpathDiagnostic(\n projectRoot: string,\n error: unknown\n): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/vue-extractor',\n severity: 'Error',\n whatHappened: 'Could not resolve the Vue project root',\n fix: 'Restore access to the project directory and rerun extraction',\n details: [\n projectRoot,\n formatDiagnosticErrorDetails(error) ?? 'Unknown filesystem error',\n ],\n });\n}\n\nfunction createMatchedFileRealpathDiagnostic(\n projectRoot: string,\n file: string,\n error: unknown\n): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/vue-extractor',\n severity: 'Error',\n whatHappened: 'Could not resolve a matched Vue source file',\n fix: 'Restore the file or exclude it from the configured source patterns',\n details: [\n toPosixPath(path.relative(projectRoot, file)),\n formatDiagnosticErrorDetails(error) ?? 'Unknown filesystem error',\n ],\n });\n}\n\nfunction isWithin(root: string, candidate: string): boolean {\n const relative = path.relative(path.resolve(root), path.resolve(candidate));\n return (\n relative === '' ||\n (relative !== '..' &&\n !relative.startsWith(`..${path.sep}`) &&\n !path.isAbsolute(relative))\n );\n}\n\nfunction toPosixPath(filePath: string): string {\n return filePath.split(path.sep).join(path.posix.sep);\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+CA,MAAM,oBAAoB,IAAI,IAAI;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,wBAAwB,IAAI,IAAI,CAAC,QAAQ,OAAO,CAAC;;;;;;;;;AAUvD,eAAsB,sBACpB,UAAuC,EAAE,EACJ;CACrC,MAAM,cAAc,wBAClB,QAAQ,OAAO,QAAQ,YAAY,eAAe,QAAQ,KAAK,CAChE;CACD,MAAM,YACJ,yBAAyB,QAAQ,YAAY,YAAY,IACzD,mBAAmB,YAAY;CACjC,MAAM,kBACJ,QAAQ,iBAAiB,KAAA,IACrB,yBAAyB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AAU;EACV,cAAc;EACd,KAAK;EACL,SAAS,CACP,YAAY,KAAK,SAAS,aAAa,KAAK,CAAC,EAC7C,6BAA6B,MAAM,IAAI,2BACxC;EACF,CAAC;;AAGJ,SAAS,SAAS,MAAc,WAA4B;CAC1D,MAAM,WAAW,KAAK,SAAS,KAAK,QAAQ,KAAK,EAAE,KAAK,QAAQ,UAAU,CAAC;AAC3E,QACE,aAAa,MACZ,aAAa,QACZ,CAAC,SAAS,WAAW,KAAK,KAAK,MAAM,IACrC,CAAC,KAAK,WAAW,SAAS;;AAIhC,SAAS,YAAY,UAA0B;AAC7C,QAAO,SAAS,MAAM,KAAK,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI"}
@@ -0,0 +1,48 @@
1
+ import type { VueProjectInspection } from '../../types.js';
2
+ import { type VueProjectDiscovery } from './scopes.js';
3
+ export { isVueSfcSource } from './vueSourceClassification.js';
4
+ /** Discovers Vue workspace ownership once and returns a reusable opaque plan. */
5
+ export declare function inspectVueProject(cwd?: string): VueProjectInspection;
6
+ /**
7
+ * Discovers Vue ownership while reading declared workspace manifests with
8
+ * bounded asynchronous I/O.
9
+ *
10
+ * The asynchronous traversal pre-populates the same per-inspection cache used
11
+ * by `discoverVueProject`, preserving its ownership semantics while allowing a
12
+ * host framework to continue its existing extraction concurrently.
13
+ */
14
+ export declare function inspectVueProjectAsync(cwd?: string): Promise<VueProjectInspection>;
15
+ /**
16
+ * Inspects Vue ownership for the high-level framework planner.
17
+ *
18
+ * An explicitly selected `gt-vue` runtime owns its root even when a host CLI
19
+ * supplied that selection independently of package-manifest detection. This
20
+ * override remains package-private so ordinary discovery cannot promote a
21
+ * React or file-only project.
22
+ */
23
+ export declare function inspectVueProjectForRuntime(cwd: string, forceRootOwnership: boolean): Promise<VueProjectInspection>;
24
+ /**
25
+ * Returns exact negative globs for real Vue SFCs selected by explicit input.
26
+ *
27
+ * A `.vue` suffix alone is insufficient because the historical React parser
28
+ * accepts arbitrary JSX modules with that extension. Only files inside a
29
+ * discovered Vue scope whose source is classified as an SFC are partitioned.
30
+ */
31
+ export declare function readVueSfcExclusionPatterns(inspection: VueProjectInspection, filePatterns: readonly string[]): string[];
32
+ /**
33
+ * Partitions explicitly selected `.vue` files between a historical parser and
34
+ * the companion Vue extractor.
35
+ *
36
+ * A lone `<template>`, `<script>`, or `<style>` expression is valid both as a
37
+ * Vue block and as a Babel JSX module. Those ambiguous files stay with the
38
+ * historical parser so adding Vue support cannot remove existing messages,
39
+ * while the companion Vue pass skips them to avoid duplicate or invalid SFC
40
+ * diagnostics. Vue-primary and default Vue discovery do not use this explicit
41
+ * mixed-framework partition and continue to accept template-only SFCs.
42
+ */
43
+ export declare function partitionVueSourcePatterns(inspection: VueProjectInspection, filePatterns: readonly string[]): {
44
+ primaryExclusionPatterns: string[];
45
+ vueExclusionPatterns: string[];
46
+ };
47
+ /** Returns the package-private discovery carried by a valid inspection. */
48
+ export declare function readVueProjectInspection(inspection: VueProjectInspection | undefined, projectRoot: string): VueProjectDiscovery | undefined;
@@ -0,0 +1,143 @@
1
+ import { readJavaScriptPackageManifest } from "./manifest.js";
2
+ import { classifyVueSource, isVueSfcSource } from "./vueSourceClassification.js";
3
+ import { createWorkspaceDiscoveryCache, readDeclaredWorkspacePackagesAsync } from "./workspaces.js";
4
+ import { discoverVueProject, findVueSourceScope, resolveProjectDirectory } from "./scopes.js";
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+ import fg from "fast-glob";
8
+ //#region src/internal/project/inspectVueProject.ts
9
+ const discoveryByInspection = /* @__PURE__ */ new WeakMap();
10
+ /** Discovers Vue workspace ownership once and returns a reusable opaque plan. */
11
+ function inspectVueProject(cwd = process.cwd()) {
12
+ return createVueProjectInspection(discoverVueProject(cwd));
13
+ }
14
+ /**
15
+ * Discovers Vue ownership while reading declared workspace manifests with
16
+ * bounded asynchronous I/O.
17
+ *
18
+ * The asynchronous traversal pre-populates the same per-inspection cache used
19
+ * by `discoverVueProject`, preserving its ownership semantics while allowing a
20
+ * host framework to continue its existing extraction concurrently.
21
+ */
22
+ async function inspectVueProjectAsync(cwd = process.cwd()) {
23
+ return inspectVueProjectForRuntime(cwd, false);
24
+ }
25
+ /**
26
+ * Inspects Vue ownership for the high-level framework planner.
27
+ *
28
+ * An explicitly selected `gt-vue` runtime owns its root even when a host CLI
29
+ * supplied that selection independently of package-manifest detection. This
30
+ * override remains package-private so ordinary discovery cannot promote a
31
+ * React or file-only project.
32
+ */
33
+ async function inspectVueProjectForRuntime(cwd, forceRootOwnership) {
34
+ const projectRoot = resolveProjectDirectory(cwd);
35
+ const rootManifest = readJavaScriptPackageManifest(path.join(projectRoot, "package.json"));
36
+ const cache = createWorkspaceDiscoveryCache();
37
+ if (rootManifest) await readDeclaredWorkspacePackagesAsync(projectRoot, rootManifest, cache);
38
+ const discovery = discoverVueProject(projectRoot, cache);
39
+ return createVueProjectInspection(forceRootOwnership ? addRootOwnership(discovery) : discovery);
40
+ }
41
+ /** Adds one forced root scope without changing discovered child scopes. */
42
+ function addRootOwnership(discovery) {
43
+ if (discovery.rootOwnsVue) return discovery;
44
+ return {
45
+ ...discovery,
46
+ rootOwnsVue: true,
47
+ scopes: [{
48
+ directory: discovery.projectRoot,
49
+ includeByDefault: true,
50
+ relativeDirectory: ""
51
+ }, ...discovery.scopes.filter(({ directory }) => directory !== discovery.projectRoot)]
52
+ };
53
+ }
54
+ function createVueProjectInspection(discovery) {
55
+ const inspection = Object.freeze({
56
+ projectRoot: discovery.projectRoot,
57
+ rootOwnsVue: discovery.rootOwnsVue,
58
+ hasVueScopes: discovery.scopes.length > 0
59
+ });
60
+ discoveryByInspection.set(inspection, discovery);
61
+ return inspection;
62
+ }
63
+ /**
64
+ * Returns exact negative globs for real Vue SFCs selected by explicit input.
65
+ *
66
+ * A `.vue` suffix alone is insufficient because the historical React parser
67
+ * accepts arbitrary JSX modules with that extension. Only files inside a
68
+ * discovered Vue scope whose source is classified as an SFC are partitioned.
69
+ */
70
+ function readVueSfcExclusionPatterns(inspection, filePatterns) {
71
+ return partitionVueSourcePatterns(inspection, filePatterns).primaryExclusionPatterns;
72
+ }
73
+ /**
74
+ * Partitions explicitly selected `.vue` files between a historical parser and
75
+ * the companion Vue extractor.
76
+ *
77
+ * A lone `<template>`, `<script>`, or `<style>` expression is valid both as a
78
+ * Vue block and as a Babel JSX module. Those ambiguous files stay with the
79
+ * historical parser so adding Vue support cannot remove existing messages,
80
+ * while the companion Vue pass skips them to avoid duplicate or invalid SFC
81
+ * diagnostics. Vue-primary and default Vue discovery do not use this explicit
82
+ * mixed-framework partition and continue to accept template-only SFCs.
83
+ */
84
+ function partitionVueSourcePatterns(inspection, filePatterns) {
85
+ const discovery = readVueProjectInspection(inspection, inspection.projectRoot);
86
+ if (!discovery) return {
87
+ primaryExclusionPatterns: [],
88
+ vueExclusionPatterns: []
89
+ };
90
+ let matches;
91
+ try {
92
+ matches = fg.sync([...filePatterns], {
93
+ absolute: true,
94
+ cwd: discovery.projectRoot,
95
+ followSymbolicLinks: false,
96
+ ignore: ["**/node_modules/**"],
97
+ onlyFiles: true,
98
+ unique: true
99
+ });
100
+ } catch {
101
+ return {
102
+ primaryExclusionPatterns: [],
103
+ vueExclusionPatterns: []
104
+ };
105
+ }
106
+ const primaryExclusionPatterns = [];
107
+ const vueExclusionPatterns = [];
108
+ for (const file of matches) {
109
+ let realFile;
110
+ try {
111
+ realFile = fs.realpathSync(file);
112
+ } catch {
113
+ continue;
114
+ }
115
+ if (path.extname(realFile).toLowerCase() !== ".vue" || !findVueSourceScope(realFile, discovery.scopes)) continue;
116
+ let source;
117
+ try {
118
+ source = fs.readFileSync(realFile, "utf8");
119
+ } catch {
120
+ continue;
121
+ }
122
+ const classification = classifyVueSource(source);
123
+ const exclusion = `!${fg.escapePath(toPosixPath(path.resolve(file)))}`;
124
+ if (classification === "definitive-sfc") primaryExclusionPatterns.push(exclusion);
125
+ else if (classification === "ambiguous-standard-tag-jsx") vueExclusionPatterns.push(exclusion);
126
+ }
127
+ return {
128
+ primaryExclusionPatterns: [...new Set(primaryExclusionPatterns)],
129
+ vueExclusionPatterns: [...new Set(vueExclusionPatterns)]
130
+ };
131
+ }
132
+ /** Returns the package-private discovery carried by a valid inspection. */
133
+ function readVueProjectInspection(inspection, projectRoot) {
134
+ if (!inspection || resolveProjectDirectory(inspection.projectRoot) !== resolveProjectDirectory(projectRoot)) return;
135
+ return discoveryByInspection.get(inspection);
136
+ }
137
+ function toPosixPath(filePath) {
138
+ return filePath.split(path.sep).join(path.posix.sep);
139
+ }
140
+ //#endregion
141
+ export { inspectVueProject, inspectVueProjectAsync, inspectVueProjectForRuntime, isVueSfcSource, partitionVueSourcePatterns, readVueProjectInspection, readVueSfcExclusionPatterns };
142
+
143
+ //# sourceMappingURL=inspectVueProject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectVueProject.js","names":[],"sources":["../../../src/internal/project/inspectVueProject.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport fg from 'fast-glob';\nimport type { VueProjectInspection } from '../../types.js';\nimport {\n discoverVueProject,\n findVueSourceScope,\n resolveProjectDirectory,\n type VueProjectDiscovery,\n} from './scopes.js';\nimport { readJavaScriptPackageManifest } from './manifest.js';\nimport {\n createWorkspaceDiscoveryCache,\n readDeclaredWorkspacePackagesAsync,\n} from './workspaces.js';\nimport { classifyVueSource } from './vueSourceClassification.js';\n\nexport { isVueSfcSource } from './vueSourceClassification.js';\n\nconst discoveryByInspection = new WeakMap<\n VueProjectInspection,\n VueProjectDiscovery\n>();\n\n/** Discovers Vue workspace ownership once and returns a reusable opaque plan. */\nexport function inspectVueProject(\n cwd: string = process.cwd()\n): VueProjectInspection {\n return createVueProjectInspection(discoverVueProject(cwd));\n}\n\n/**\n * Discovers Vue ownership while reading declared workspace manifests with\n * bounded asynchronous I/O.\n *\n * The asynchronous traversal pre-populates the same per-inspection cache used\n * by `discoverVueProject`, preserving its ownership semantics while allowing a\n * host framework to continue its existing extraction concurrently.\n */\nexport async function inspectVueProjectAsync(\n cwd: string = process.cwd()\n): Promise<VueProjectInspection> {\n return inspectVueProjectForRuntime(cwd, false);\n}\n\n/**\n * Inspects Vue ownership for the high-level framework planner.\n *\n * An explicitly selected `gt-vue` runtime owns its root even when a host CLI\n * supplied that selection independently of package-manifest detection. This\n * override remains package-private so ordinary discovery cannot promote a\n * React or file-only project.\n */\nexport async function inspectVueProjectForRuntime(\n cwd: string,\n forceRootOwnership: boolean\n): Promise<VueProjectInspection> {\n const projectRoot = resolveProjectDirectory(cwd);\n const rootManifest = readJavaScriptPackageManifest(\n path.join(projectRoot, 'package.json')\n );\n const cache = createWorkspaceDiscoveryCache();\n if (rootManifest) {\n await readDeclaredWorkspacePackagesAsync(projectRoot, rootManifest, cache);\n }\n const discovery = discoverVueProject(projectRoot, cache);\n return createVueProjectInspection(\n forceRootOwnership ? addRootOwnership(discovery) : discovery\n );\n}\n\n/** Adds one forced root scope without changing discovered child scopes. */\nfunction addRootOwnership(discovery: VueProjectDiscovery): VueProjectDiscovery {\n if (discovery.rootOwnsVue) return discovery;\n return {\n ...discovery,\n rootOwnsVue: true,\n scopes: [\n {\n directory: discovery.projectRoot,\n includeByDefault: true,\n relativeDirectory: '',\n },\n ...discovery.scopes.filter(\n ({ directory }) => directory !== discovery.projectRoot\n ),\n ],\n };\n}\n\nfunction createVueProjectInspection(\n discovery: VueProjectDiscovery\n): VueProjectInspection {\n const inspection = Object.freeze({\n projectRoot: discovery.projectRoot,\n rootOwnsVue: discovery.rootOwnsVue,\n hasVueScopes: discovery.scopes.length > 0,\n });\n discoveryByInspection.set(inspection, discovery);\n return inspection;\n}\n\n/**\n * Returns exact negative globs for real Vue SFCs selected by explicit input.\n *\n * A `.vue` suffix alone is insufficient because the historical React parser\n * accepts arbitrary JSX modules with that extension. Only files inside a\n * discovered Vue scope whose source is classified as an SFC are partitioned.\n */\nexport function readVueSfcExclusionPatterns(\n inspection: VueProjectInspection,\n filePatterns: readonly string[]\n): string[] {\n return partitionVueSourcePatterns(inspection, filePatterns)\n .primaryExclusionPatterns;\n}\n\n/**\n * Partitions explicitly selected `.vue` files between a historical parser and\n * the companion Vue extractor.\n *\n * A lone `<template>`, `<script>`, or `<style>` expression is valid both as a\n * Vue block and as a Babel JSX module. Those ambiguous files stay with the\n * historical parser so adding Vue support cannot remove existing messages,\n * while the companion Vue pass skips them to avoid duplicate or invalid SFC\n * diagnostics. Vue-primary and default Vue discovery do not use this explicit\n * mixed-framework partition and continue to accept template-only SFCs.\n */\nexport function partitionVueSourcePatterns(\n inspection: VueProjectInspection,\n filePatterns: readonly string[]\n): {\n primaryExclusionPatterns: string[];\n vueExclusionPatterns: string[];\n} {\n const discovery = readVueProjectInspection(\n inspection,\n inspection.projectRoot\n );\n if (!discovery) {\n return { primaryExclusionPatterns: [], vueExclusionPatterns: [] };\n }\n\n let matches: string[];\n try {\n matches = fg.sync([...filePatterns], {\n absolute: true,\n cwd: discovery.projectRoot,\n followSymbolicLinks: false,\n ignore: ['**/node_modules/**'],\n onlyFiles: true,\n unique: true,\n });\n } catch {\n return { primaryExclusionPatterns: [], vueExclusionPatterns: [] };\n }\n\n const primaryExclusionPatterns: string[] = [];\n const vueExclusionPatterns: string[] = [];\n for (const file of matches) {\n let realFile: string;\n try {\n realFile = fs.realpathSync(file);\n } catch {\n continue;\n }\n if (\n path.extname(realFile).toLowerCase() !== '.vue' ||\n !findVueSourceScope(realFile, discovery.scopes)\n ) {\n continue;\n }\n let source: string;\n try {\n source = fs.readFileSync(realFile, 'utf8');\n } catch {\n continue;\n }\n const classification = classifyVueSource(source);\n const exclusion = `!${fg.escapePath(toPosixPath(path.resolve(file)))}`;\n if (classification === 'definitive-sfc') {\n primaryExclusionPatterns.push(exclusion);\n } else if (classification === 'ambiguous-standard-tag-jsx') {\n vueExclusionPatterns.push(exclusion);\n }\n }\n return {\n primaryExclusionPatterns: [...new Set(primaryExclusionPatterns)],\n vueExclusionPatterns: [...new Set(vueExclusionPatterns)],\n };\n}\n\n/** Returns the package-private discovery carried by a valid inspection. */\nexport function readVueProjectInspection(\n inspection: VueProjectInspection | undefined,\n projectRoot: string\n): VueProjectDiscovery | undefined {\n if (\n !inspection ||\n resolveProjectDirectory(inspection.projectRoot) !==\n resolveProjectDirectory(projectRoot)\n ) {\n return undefined;\n }\n return discoveryByInspection.get(inspection);\n}\n\nfunction toPosixPath(filePath: string): string {\n return filePath.split(path.sep).join(path.posix.sep);\n}\n"],"mappings":";;;;;;;;AAmBA,MAAM,wCAAwB,IAAI,SAG/B;;AAGH,SAAgB,kBACd,MAAc,QAAQ,KAAK,EACL;AACtB,QAAO,2BAA2B,mBAAmB,IAAI,CAAC;;;;;;;;;;AAW5D,eAAsB,uBACpB,MAAc,QAAQ,KAAK,EACI;AAC/B,QAAO,4BAA4B,KAAK,MAAM;;;;;;;;;;AAWhD,eAAsB,4BACpB,KACA,oBAC+B;CAC/B,MAAM,cAAc,wBAAwB,IAAI;CAChD,MAAM,eAAe,8BACnB,KAAK,KAAK,aAAa,eAAe,CACvC;CACD,MAAM,QAAQ,+BAA+B;AAC7C,KAAI,aACF,OAAM,mCAAmC,aAAa,cAAc,MAAM;CAE5E,MAAM,YAAY,mBAAmB,aAAa,MAAM;AACxD,QAAO,2BACL,qBAAqB,iBAAiB,UAAU,GAAG,UACpD;;;AAIH,SAAS,iBAAiB,WAAqD;AAC7E,KAAI,UAAU,YAAa,QAAO;AAClC,QAAO;EACL,GAAG;EACH,aAAa;EACb,QAAQ,CACN;GACE,WAAW,UAAU;GACrB,kBAAkB;GAClB,mBAAmB;GACpB,EACD,GAAG,UAAU,OAAO,QACjB,EAAE,gBAAgB,cAAc,UAAU,YAC5C,CACF;EACF;;AAGH,SAAS,2BACP,WACsB;CACtB,MAAM,aAAa,OAAO,OAAO;EAC/B,aAAa,UAAU;EACvB,aAAa,UAAU;EACvB,cAAc,UAAU,OAAO,SAAS;EACzC,CAAC;AACF,uBAAsB,IAAI,YAAY,UAAU;AAChD,QAAO;;;;;;;;;AAUT,SAAgB,4BACd,Y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G9C,SAAS,YAAY,UAA0B;AAC7C,QAAO,SAAS,MAAM,KAAK,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI"}
@@ -0,0 +1,64 @@
1
+ /** Runtime package whose direct ownership activates Vue extraction. */
2
+ export declare const GT_VUE_PACKAGE = "gt-vue";
3
+ /** Minimal package manifest shape used by Vue project discovery. */
4
+ export type JavaScriptPackageManifest = {
5
+ name?: string;
6
+ version?: string;
7
+ dependencies?: Record<string, string>;
8
+ devDependencies?: Record<string, string>;
9
+ optionalDependencies?: Record<string, string>;
10
+ peerDependencies?: Record<string, string>;
11
+ peerDependenciesMeta?: Record<string, {
12
+ optional?: boolean;
13
+ }>;
14
+ workspaces?: string[] | {
15
+ packages?: string[];
16
+ };
17
+ };
18
+ /** One dependency name and specifier as written by a consuming package. */
19
+ export type JavaScriptDependencyBinding = {
20
+ name: string;
21
+ specifier: string;
22
+ };
23
+ /** An installed package directory resolved without evaluating its entrypoint. */
24
+ export type InstalledJavaScriptPackage = {
25
+ directory: string;
26
+ manifest: JavaScriptPackageManifest;
27
+ };
28
+ /** Reads one package manifest without throwing for absent or malformed input. */
29
+ export declare function readJavaScriptPackageManifest(packagePath: string): JavaScriptPackageManifest | undefined;
30
+ /** Checks dependency fields that make a runtime available to package code. */
31
+ export declare function declaresInstalledJavaScriptDependency(manifest: JavaScriptPackageManifest, packageName: string): boolean;
32
+ /** Checks direct ownership, requiring optional and peer runtimes to resolve. */
33
+ export declare function declaresAvailableJavaScriptDependency(manifest: JavaScriptPackageManifest, packageName: string, packageDirectory: string): boolean;
34
+ /** Checks package ownership without promoting optional workspace integrations. */
35
+ export declare function declaresWorkspaceJavaScriptDependency(manifest: JavaScriptPackageManifest, packageName: string, packageDirectory: string): boolean;
36
+ /** Lists required dependencies that can bind one workspace package to another. */
37
+ export declare function readWorkspaceDependencyNames(manifest: JavaScriptPackageManifest, packageDirectory: string): string[];
38
+ /** Reads installed dependencies and resolvable, non-optional required peers. */
39
+ export declare function readWorkspaceDependencyBindings(manifest: JavaScriptPackageManifest, packageDirectory: string): JavaScriptDependencyBinding[];
40
+ /** Reads dependency edges that may propagate wrapper ownership to consumers. */
41
+ export declare function readPropagatingDependencyBindings(manifest: JavaScriptPackageManifest, packageDirectory: string): JavaScriptDependencyBinding[];
42
+ /**
43
+ * Resolves an installed package directory without selecting an export branch.
44
+ *
45
+ * `require.resolve()` is insufficient for availability checks because a valid
46
+ * ESM package may intentionally expose only its `import` condition. Walking
47
+ * Node's lookup directories finds the package boundary without importing user
48
+ * code or depending on the package's public subpath exports.
49
+ */
50
+ export declare function resolveInstalledJavaScriptPackage(directory: string, bindingName: string): InstalledJavaScriptPackage | undefined;
51
+ /** Parses pnpm's explicit `workspace:alias@range` dependency syntax. */
52
+ export declare function parseWorkspaceDependencyAlias(specifier: string): {
53
+ packageName: string;
54
+ range: string;
55
+ } | undefined;
56
+ /** Reads the target package name from an npm alias dependency. */
57
+ export declare function parseNpmDependencyAlias(specifier: string): {
58
+ packageName: string;
59
+ range?: string;
60
+ } | undefined;
61
+ /** Reads a relative directory selected by an explicit local protocol. */
62
+ export declare function parseLocalDependencyPath(specifier: string): string | undefined;
63
+ /** Checks whether one binding's declared range accepts a selected package. */
64
+ export declare function dependencyBindingAcceptsPackageVersion(binding: JavaScriptDependencyBinding, packageName: string, packageVersion: string | undefined): boolean;