@generaltranslation/vue-extractor 0.0.0 → 0.1.0-iris.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +18 -102
- package/dist/detect.d.ts +8 -0
- package/dist/detect.js +2 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/inspect.d.ts +9 -0
- package/dist/inspect.js +2 -0
- package/dist/integration.d.ts +69 -0
- package/dist/integration.js +162 -0
- package/dist/integration.js.map +1 -0
- package/dist/internal/config/configFiles.d.ts +6 -0
- package/dist/internal/config/configFiles.js +34 -0
- package/dist/internal/config/configFiles.js.map +1 -0
- package/dist/internal/config/resolveVueCompilerOptions.d.ts +6 -0
- package/dist/internal/config/resolveVueCompilerOptions.js +74 -56
- package/dist/internal/config/resolveVueCompilerOptions.js.map +1 -1
- package/dist/internal/extractFromVueSource.d.ts +4 -3
- package/dist/internal/extractFromVueSource.js +255 -12
- package/dist/internal/extractFromVueSource.js.map +1 -1
- package/dist/internal/project/consumerUsage.d.ts +34 -0
- package/dist/internal/project/consumerUsage.js +1220 -0
- package/dist/internal/project/consumerUsage.js.map +1 -0
- package/dist/internal/project/detectVueProject.d.ts +13 -0
- package/dist/internal/project/detectVueProject.js +65 -0
- package/dist/internal/project/detectVueProject.js.map +1 -0
- package/dist/internal/project/extractFromVueProject.d.ts +10 -0
- package/dist/internal/project/extractFromVueProject.js +579 -0
- package/dist/internal/project/extractFromVueProject.js.map +1 -0
- package/dist/internal/project/inspectVueProject.d.ts +48 -0
- package/dist/internal/project/inspectVueProject.js +143 -0
- package/dist/internal/project/inspectVueProject.js.map +1 -0
- package/dist/internal/project/manifest.d.ts +64 -0
- package/dist/internal/project/manifest.js +270 -0
- package/dist/internal/project/manifest.js.map +1 -0
- package/dist/internal/project/mergeVueProjectExtraction.d.ts +18 -0
- package/dist/internal/project/mergeVueProjectExtraction.js +79 -0
- package/dist/internal/project/mergeVueProjectExtraction.js.map +1 -0
- package/dist/internal/project/moduleResolver.d.ts +18 -0
- package/dist/internal/project/moduleResolver.js +325 -0
- package/dist/internal/project/moduleResolver.js.map +1 -0
- package/dist/internal/project/scopes.d.ts +31 -0
- package/dist/internal/project/scopes.js +182 -0
- package/dist/internal/project/scopes.js.map +1 -0
- package/dist/internal/project/sourcePatterns.d.ts +4 -0
- package/dist/internal/project/sourcePatterns.js +32 -0
- package/dist/internal/project/sourcePatterns.js.map +1 -0
- package/dist/internal/project/viteAliases.d.ts +42 -0
- package/dist/internal/project/viteAliases.js +1020 -0
- package/dist/internal/project/viteAliases.js.map +1 -0
- package/dist/internal/project/vueSourceClassification.d.ts +13 -0
- package/dist/internal/project/vueSourceClassification.js +146 -0
- package/dist/internal/project/vueSourceClassification.js.map +1 -0
- package/dist/internal/project/workspaces.d.ts +31 -0
- package/dist/internal/project/workspaces.js +326 -0
- package/dist/internal/project/workspaces.js.map +1 -0
- package/dist/internal/project/wrapperProvenance.d.ts +21 -0
- package/dist/internal/project/wrapperProvenance.js +287 -0
- package/dist/internal/project/wrapperProvenance.js.map +1 -0
- package/dist/internal/script/analyze.js +252 -85
- package/dist/internal/script/analyze.js.map +1 -1
- package/dist/internal/script/jsx.d.ts +7 -4
- package/dist/internal/script/jsx.js +351 -79
- package/dist/internal/script/jsx.js.map +1 -1
- package/dist/internal/script/localModules.d.ts +23 -2
- package/dist/internal/script/localModules.js +533 -20
- package/dist/internal/script/localModules.js.map +1 -1
- package/dist/internal/script/model.d.ts +9 -2
- package/dist/internal/script/parser.js +2 -1
- package/dist/internal/script/parser.js.map +1 -1
- package/dist/internal/script/runtimeModules.d.ts +10 -0
- package/dist/internal/script/runtimeModules.js +27 -0
- package/dist/internal/script/runtimeModules.js.map +1 -0
- package/dist/internal/stringCalls.js +1 -1
- package/dist/internal/stringCalls.js.map +1 -1
- package/dist/internal/template.js +263 -141
- package/dist/internal/template.js.map +1 -1
- package/dist/internal/types.d.ts +4 -1
- package/dist/internal/utils.d.ts +14 -3
- package/dist/internal/utils.js +63 -3
- package/dist/internal/utils.js.map +1 -1
- package/dist/internal/vueCompiler.d.ts +9 -1
- package/dist/internal/vueCompiler.js +37 -14
- package/dist/internal/vueCompiler.js.map +1 -1
- package/dist/project.d.ts +11 -0
- package/dist/project.js +3 -0
- package/dist/types.d.ts +95 -4
- package/package.json +30 -4
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GTProp, JsxElement, Variable } from '@generaltranslation/format/types';
|
|
2
|
+
/** A direct Branch or Plural source value preserved by the GT wire format. */
|
|
3
|
+
export type VueBranchSource = VueJsxChildren;
|
|
4
|
+
/** GT element metadata with the complete branch-source wire contract. */
|
|
5
|
+
export type VueGTProp = Omit<GTProp, 'b'> & {
|
|
6
|
+
/** Named Branch or Plural sources. */
|
|
7
|
+
b?: Record<string, VueBranchSource>;
|
|
8
|
+
};
|
|
9
|
+
/** A serialized Vue element in a rich translation source. */
|
|
10
|
+
export type VueJsxElement = Omit<JsxElement, 'c' | 'd'> & {
|
|
11
|
+
/** Nested serialized children. */
|
|
12
|
+
c?: VueJsxChildren;
|
|
13
|
+
/** Translation metadata attached to this element. */
|
|
14
|
+
d?: VueGTProp;
|
|
15
|
+
};
|
|
16
|
+
/** One serialized child in a rich Vue translation source. */
|
|
17
|
+
export type VueJsxChild = string | VueJsxElement | Variable;
|
|
18
|
+
/**
|
|
19
|
+
* The complete rich-source wire format returned by Vue extraction.
|
|
20
|
+
*
|
|
21
|
+
* Boolean and null values can occur at scalar root, element-child, Fragment,
|
|
22
|
+
* Branch, and Plural positions. React removes those values from authored child
|
|
23
|
+
* arrays, so arrays retain the narrower {@link VueJsxChild} member type.
|
|
24
|
+
* This Vue-specific export documents those exact recursive wire semantics for
|
|
25
|
+
* consumers without requiring framework-internal casts.
|
|
26
|
+
*/
|
|
27
|
+
export type VueJsxChildren = VueJsxChild | boolean | null | VueJsxChild[];
|
|
2
28
|
/**
|
|
3
29
|
* Version-neutral Vue compiler surface accepted by programmatic extraction.
|
|
4
30
|
*
|
|
@@ -32,13 +58,22 @@ export type VueSourceCode = {
|
|
|
32
58
|
/** Metadata attached to an extracted Vue translation. */
|
|
33
59
|
export type VueExtractionMetadata = {
|
|
34
60
|
context?: string;
|
|
61
|
+
/** Deprecated custom identifier retained for React catalog compatibility. */
|
|
62
|
+
id?: string;
|
|
63
|
+
/** Maximum translated character count included in the catalog identity. */
|
|
64
|
+
maxChars?: number;
|
|
65
|
+
/** Whether generated translations require human review. */
|
|
66
|
+
requiresReview?: boolean;
|
|
35
67
|
filePaths?: string[];
|
|
68
|
+
/** Stable catalog key calculated by project-level extraction. */
|
|
69
|
+
hash?: string;
|
|
36
70
|
sourceCode?: Record<string, VueSourceCode[]>;
|
|
37
71
|
};
|
|
38
72
|
/** A translation extracted from Vue source code before CLI post-processing. */
|
|
39
73
|
export type VueExtractionResult = {
|
|
40
74
|
dataFormat: 'JSX';
|
|
41
|
-
|
|
75
|
+
/** Missing when the authored T has no default-slot content. */
|
|
76
|
+
source: VueJsxChildren | undefined;
|
|
42
77
|
metadata: VueExtractionMetadata;
|
|
43
78
|
} | {
|
|
44
79
|
dataFormat: 'STRING';
|
|
@@ -55,6 +90,16 @@ export type VueExtractionOptions = {
|
|
|
55
90
|
includeSourceCodeContext?: boolean;
|
|
56
91
|
/** Root used to make metadata file paths relative. Defaults to `process.cwd()`. */
|
|
57
92
|
projectRoot?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Skips standalone script files that have no statically proven gt-vue
|
|
95
|
+
* provenance. Vue single-file components are always parsed.
|
|
96
|
+
*
|
|
97
|
+
* This is useful when a framework dispatcher sends the same JavaScript and
|
|
98
|
+
* TypeScript files to multiple extractors. A permissive, read-only preflight
|
|
99
|
+
* recognizes gt-vue imports through local barrels before the normal parser
|
|
100
|
+
* applies the source file's declared language.
|
|
101
|
+
*/
|
|
102
|
+
requireGTProvenance?: boolean;
|
|
58
103
|
/**
|
|
59
104
|
* Resolves a static module specifier to a source file without loading or
|
|
60
105
|
* executing that module. Relative source files and index barrels are
|
|
@@ -64,8 +109,9 @@ export type VueExtractionOptions = {
|
|
|
64
109
|
* The hook is consulted first for every specifier, including relative ones,
|
|
65
110
|
* so a project can preserve its compiler's source-over-build precedence.
|
|
66
111
|
*
|
|
67
|
-
* Returning `undefined` leaves the import unresolved
|
|
68
|
-
*
|
|
112
|
+
* Returning `undefined` leaves the import unresolved. GT-shaped uses fail
|
|
113
|
+
* closed only inside Vue SFCs or standalone files with separate proven
|
|
114
|
+
* gt-vue provenance. The returned path must identify a readable local source
|
|
69
115
|
* file.
|
|
70
116
|
*/
|
|
71
117
|
resolveModule?: (specifier: string, importer: string) => string | undefined;
|
|
@@ -78,3 +124,48 @@ export type VueExtractionOutput = {
|
|
|
78
124
|
errors: string[];
|
|
79
125
|
warnings: string[];
|
|
80
126
|
};
|
|
127
|
+
/** Options for extracting every gt-vue source owned by one project. */
|
|
128
|
+
export type VueProjectExtractionOptions = {
|
|
129
|
+
/** Project root. Defaults to `process.cwd()`. */
|
|
130
|
+
cwd?: string;
|
|
131
|
+
/** Reusable package-owned workspace inspection for this project root. */
|
|
132
|
+
inspection?: VueProjectInspection;
|
|
133
|
+
/** Optional project-root-relative globs that replace framework defaults. */
|
|
134
|
+
filePatterns?: string[];
|
|
135
|
+
/** Includes surrounding source lines in result metadata. */
|
|
136
|
+
includeSourceCodeContext?: boolean;
|
|
137
|
+
/** Package export conditions used by static local-module resolution. */
|
|
138
|
+
conditionNames?: string[];
|
|
139
|
+
/** Explicit hash-affecting Vue compiler options from project configuration. */
|
|
140
|
+
vueCompilerOptions?: VueCompilerOptions;
|
|
141
|
+
/** Explicit Vite config path relative to the project root. */
|
|
142
|
+
viteConfigPath?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Explicit tsconfig.json or jsconfig.json path relative to the project root.
|
|
145
|
+
* When omitted, module resolution discovers the nearest config per importer.
|
|
146
|
+
*/
|
|
147
|
+
tsconfigPath?: string;
|
|
148
|
+
/** Number of source lines captured before and after a translation. */
|
|
149
|
+
surroundingLineCount?: number;
|
|
150
|
+
};
|
|
151
|
+
/** Opaque summary returned by package-owned Vue workspace inspection. */
|
|
152
|
+
export type VueProjectInspection = {
|
|
153
|
+
/** Absolute root inspected for Vue-owned source scopes. */
|
|
154
|
+
readonly projectRoot: string;
|
|
155
|
+
/** Whether the root package itself activates the Vue command surface. */
|
|
156
|
+
readonly rootOwnsVue: boolean;
|
|
157
|
+
/** Whether the root or any declared workspace owns Vue source. */
|
|
158
|
+
readonly hasVueScopes: boolean;
|
|
159
|
+
};
|
|
160
|
+
/** A project result whose stable catalog hash has been calculated. */
|
|
161
|
+
export type VueProjectExtractionResult = VueExtractionResult & {
|
|
162
|
+
metadata: VueExtractionMetadata & {
|
|
163
|
+
hash: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
/** Complete output from atomic project-level Vue extraction. */
|
|
167
|
+
export type VueProjectExtractionOutput = {
|
|
168
|
+
updates: VueProjectExtractionResult[];
|
|
169
|
+
errors: string[];
|
|
170
|
+
warnings: string[];
|
|
171
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@generaltranslation/vue-extractor",
|
|
3
|
-
"version": "0.0.0",
|
|
3
|
+
"version": "0.1.0-iris.0",
|
|
4
4
|
"description": "Vue source code extraction for General Translation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"author": "General Translation, Inc.",
|
|
16
|
-
"license": "
|
|
16
|
+
"license": "MIT",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
19
|
"import": "./dist/index.js",
|
|
@@ -23,6 +23,22 @@
|
|
|
23
23
|
"import": "./dist/config.js",
|
|
24
24
|
"types": "./dist/config.d.ts"
|
|
25
25
|
},
|
|
26
|
+
"./detect": {
|
|
27
|
+
"import": "./dist/detect.js",
|
|
28
|
+
"types": "./dist/detect.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./inspect": {
|
|
31
|
+
"import": "./dist/inspect.js",
|
|
32
|
+
"types": "./dist/inspect.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./integration": {
|
|
35
|
+
"import": "./dist/integration.js",
|
|
36
|
+
"types": "./dist/integration.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./project": {
|
|
39
|
+
"import": "./dist/project.js",
|
|
40
|
+
"types": "./dist/project.d.ts"
|
|
41
|
+
},
|
|
26
42
|
"./types": {
|
|
27
43
|
"import": "./dist/types.js",
|
|
28
44
|
"types": "./dist/types.d.ts"
|
|
@@ -46,16 +62,26 @@
|
|
|
46
62
|
"@babel/traverse": "^7.25.7",
|
|
47
63
|
"@babel/types": "^7.25.7",
|
|
48
64
|
"@vue/shared": "^3.5.0",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
65
|
+
"enhanced-resolve": "^5.18.3",
|
|
66
|
+
"entities": "^7.0.1",
|
|
67
|
+
"es-module-lexer": "^2.3.1",
|
|
68
|
+
"fast-glob": "^3.3.3",
|
|
69
|
+
"semver": "^7.8.5",
|
|
70
|
+
"tsconfig-paths": "^4.2.0",
|
|
71
|
+
"yaml": "^2.8.0",
|
|
72
|
+
"@generaltranslation/format": "0.1.5-iris.0",
|
|
73
|
+
"generaltranslation": "9.1.3-iris.0"
|
|
51
74
|
},
|
|
52
75
|
"devDependencies": {
|
|
53
76
|
"@types/babel__traverse": "^7.20.6",
|
|
54
77
|
"@types/node": "^22.13.5",
|
|
78
|
+
"@types/semver": "^7.7.1",
|
|
55
79
|
"@vue/compiler-dom": "^3.5.0",
|
|
56
80
|
"@vue/compiler-sfc": "^3.5.0",
|
|
57
81
|
"tsdown": "^0.21.10",
|
|
58
82
|
"typescript": "^5.9.2",
|
|
83
|
+
"vue": "^3.5.0",
|
|
84
|
+
"vite": "^7.1.7",
|
|
59
85
|
"vitest": "^3.2.4"
|
|
60
86
|
},
|
|
61
87
|
"scripts": {
|