@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/LICENSE.md
CHANGED
|
@@ -1,105 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
## Abbreviation
|
|
4
|
-
|
|
5
|
-
FSL-1.1-ALv2
|
|
6
|
-
|
|
7
|
-
## Notice
|
|
1
|
+
MIT License
|
|
8
2
|
|
|
9
3
|
Copyright 2026 General Translation, Inc.
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
-
|
|
30
|
-
### Permitted Purpose
|
|
31
|
-
|
|
32
|
-
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
-
means making the Software available to others in a commercial product or
|
|
34
|
-
service that:
|
|
35
|
-
|
|
36
|
-
1. substitutes for the Software;
|
|
37
|
-
|
|
38
|
-
2. substitutes for any other product or service we offer using the Software
|
|
39
|
-
that exists as of the date we make the Software available; or
|
|
40
|
-
|
|
41
|
-
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
-
|
|
43
|
-
Permitted Purposes specifically include using the Software:
|
|
44
|
-
|
|
45
|
-
1. for your internal use and access;
|
|
46
|
-
|
|
47
|
-
2. for non-commercial education;
|
|
48
|
-
|
|
49
|
-
3. for non-commercial research; and
|
|
50
|
-
|
|
51
|
-
4. in connection with professional services that you provide to a licensee
|
|
52
|
-
using the Software in accordance with these Terms and Conditions.
|
|
53
|
-
|
|
54
|
-
### Patents
|
|
55
|
-
|
|
56
|
-
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
-
patents, the license grant above includes a license under our patents. If you
|
|
58
|
-
make a claim against any party that the Software infringes or contributes to
|
|
59
|
-
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
-
immediately.
|
|
61
|
-
|
|
62
|
-
### Redistribution
|
|
63
|
-
|
|
64
|
-
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
-
the Software.
|
|
66
|
-
|
|
67
|
-
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
-
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
-
remove any copyright notices provided in or with the Software.
|
|
70
|
-
|
|
71
|
-
### Disclaimer
|
|
72
|
-
|
|
73
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
-
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
-
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
-
|
|
77
|
-
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
-
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
-
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
-
|
|
81
|
-
### Trademarks
|
|
82
|
-
|
|
83
|
-
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
-
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
-
trademarks, trade names, service marks or product names.
|
|
86
|
-
|
|
87
|
-
## Grant of Future License
|
|
88
|
-
|
|
89
|
-
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
-
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
-
the date we make the Software available. On or after that date, you may use the
|
|
92
|
-
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
-
will apply:
|
|
94
|
-
|
|
95
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
-
this file except in compliance with the License.
|
|
97
|
-
|
|
98
|
-
You may obtain a copy of the License at
|
|
99
|
-
|
|
100
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
-
|
|
102
|
-
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
-
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
-
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
-
specific language governing permissions and limitations under the License.
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/detect.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects declared or publicly re-exported gt-vue ownership without loading
|
|
3
|
+
* the Vue compiler.
|
|
4
|
+
*
|
|
5
|
+
* Local wrapper packages are parsed only to prove their public provenance.
|
|
6
|
+
* The full template and project extractor remains behind the `project` export.
|
|
7
|
+
*/
|
|
8
|
+
export { detectVueProject } from './internal/project/detectVueProject.js';
|
package/dist/detect.js
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { extractFromVueSource } from './internal/extractFromVueSource.js';
|
|
2
|
-
export
|
|
2
|
+
export { planVueExtraction } from './integration.js';
|
|
3
|
+
export type { InlineExtractionOutput, PrimaryInlineExtractor, VueExtractionPlan, VueExtractionPlannerOptions, VueExtractionRunOptions, } from './integration.js';
|
|
4
|
+
export type { VueCompilerOptions, VueCompiler, VueExtractionMetadata, VueExtractionOptions, VueExtractionOutput, VueExtractionResult, VueBranchSource, VueGTProp, VueJsxChild, VueJsxChildren, VueJsxElement, VueProjectExtractionOptions, VueProjectExtractionOutput, VueProjectExtractionResult, VueProjectInspection, VueSourceCode, } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inspects root and workspace Vue ownership without loading the Vue compiler
|
|
3
|
+
* or full source analyzer.
|
|
4
|
+
*
|
|
5
|
+
* Pass the returned plan to `extractFromVueProject` to avoid repeating
|
|
6
|
+
* workspace traversal during mixed-framework extraction.
|
|
7
|
+
*/
|
|
8
|
+
export { inspectVueProject, inspectVueProjectAsync, partitionVueSourcePatterns, readVueSfcExclusionPatterns, } from './internal/project/inspectVueProject.js';
|
|
9
|
+
export type { VueProjectInspection } from './types.js';
|
package/dist/inspect.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { VueCompilerOptions } from './types.js';
|
|
2
|
+
import type { InlineExtractionOutput } from './internal/project/mergeVueProjectExtraction.js';
|
|
3
|
+
/**
|
|
4
|
+
* Framework-neutral inline extractor supplied by a host CLI.
|
|
5
|
+
*
|
|
6
|
+
* The planner calls this function at most once. When no explicit source
|
|
7
|
+
* partition is necessary, it receives the caller's original pattern value
|
|
8
|
+
* before the planner performs asynchronous Vue work.
|
|
9
|
+
*/
|
|
10
|
+
export type PrimaryInlineExtractor = (filePatterns: string[] | undefined) => Promise<InlineExtractionOutput>;
|
|
11
|
+
/** Options captured while deciding whether a project needs Vue extraction. */
|
|
12
|
+
export type VueExtractionPlannerOptions = {
|
|
13
|
+
/** Inline runtime selected by the host CLI. */
|
|
14
|
+
library: string;
|
|
15
|
+
/** Absolute or caller-relative project root captured before any async work. */
|
|
16
|
+
projectRoot: string;
|
|
17
|
+
/** Explicit source patterns. `undefined` retains framework defaults. */
|
|
18
|
+
filePatterns?: string[];
|
|
19
|
+
/** Includes surrounding source lines in extracted update metadata. */
|
|
20
|
+
includeSourceCodeContext?: boolean;
|
|
21
|
+
/** Package export conditions used by static local-module resolution. */
|
|
22
|
+
conditionNames?: string[];
|
|
23
|
+
/** Explicit hash-affecting Vue compiler options. */
|
|
24
|
+
vueCompilerOptions?: VueCompilerOptions;
|
|
25
|
+
/** Explicit Vite config path relative to the captured project root. */
|
|
26
|
+
viteConfigPath?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Explicit tsconfig.json or jsconfig.json path relative to the captured
|
|
29
|
+
* project root. When omitted, the nearest config is discovered per importer.
|
|
30
|
+
*/
|
|
31
|
+
tsconfigPath?: string;
|
|
32
|
+
/** Number of source lines captured before and after a translation. */
|
|
33
|
+
surroundingLineCount?: number;
|
|
34
|
+
};
|
|
35
|
+
/** Host callbacks used only after a plan has proven Vue ownership. */
|
|
36
|
+
export type VueExtractionRunOptions = {
|
|
37
|
+
/** Existing React, Node, or Python extraction to preserve and merge. */
|
|
38
|
+
extractPrimary?: PrimaryInlineExtractor;
|
|
39
|
+
};
|
|
40
|
+
/** A synchronous decision that leaves non-Vue projects completely untouched. */
|
|
41
|
+
export type VueExtractionPlan = {
|
|
42
|
+
/** The root has no direct Vue extraction ownership. */
|
|
43
|
+
readonly handled: false;
|
|
44
|
+
} | {
|
|
45
|
+
/** The selected runtime or root manifest directly owns gt-vue. */
|
|
46
|
+
readonly handled: true;
|
|
47
|
+
/** Executes package-owned Vue inspection, extraction, and merging. */
|
|
48
|
+
run(options?: VueExtractionRunOptions): Promise<InlineExtractionOutput>;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Returns whether a package manifest directly enables gt-vue extraction.
|
|
52
|
+
*
|
|
53
|
+
* Only production and development dependencies establish ownership. An
|
|
54
|
+
* optional declaration is authoritative and vetoes a matching declaration in
|
|
55
|
+
* either field, while peer dependencies never establish ownership.
|
|
56
|
+
*/
|
|
57
|
+
export declare function manifestDirectlyDeclaresGTVue(manifest: unknown): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Plans Vue extraction without changing historical framework behavior.
|
|
60
|
+
*
|
|
61
|
+
* Activation is intentionally narrow: only an explicitly selected `gt-vue`
|
|
62
|
+
* runtime or a non-optional root `package.json` dependency/devDependency can
|
|
63
|
+
* handle the project. An optional declaration vetoes manifest ownership; peer,
|
|
64
|
+
* workspace-child, wrapper, source, and transitive evidence is ignored. The
|
|
65
|
+
* false branch is synchronous and performs no source scan, workspace traversal,
|
|
66
|
+
* dynamic import, or asynchronous work.
|
|
67
|
+
*/
|
|
68
|
+
export declare function planVueExtraction(options: VueExtractionPlannerOptions): VueExtractionPlan;
|
|
69
|
+
export type { InlineExtractionOutput } from './internal/project/mergeVueProjectExtraction.js';
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
//#region src/integration.ts
|
|
4
|
+
const GT_VUE_PACKAGE = "gt-vue";
|
|
5
|
+
const UNHANDLED_PLAN = Object.freeze({ handled: false });
|
|
6
|
+
/**
|
|
7
|
+
* Returns whether a package manifest directly enables gt-vue extraction.
|
|
8
|
+
*
|
|
9
|
+
* Only production and development dependencies establish ownership. An
|
|
10
|
+
* optional declaration is authoritative and vetoes a matching declaration in
|
|
11
|
+
* either field, while peer dependencies never establish ownership.
|
|
12
|
+
*/
|
|
13
|
+
function manifestDirectlyDeclaresGTVue(manifest) {
|
|
14
|
+
if (!isRecord(manifest)) return false;
|
|
15
|
+
if (hasOwnDependency(manifest.optionalDependencies, GT_VUE_PACKAGE)) return false;
|
|
16
|
+
return hasOwnDependency(manifest.dependencies, GT_VUE_PACKAGE) || hasOwnDependency(manifest.devDependencies, GT_VUE_PACKAGE);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Plans Vue extraction without changing historical framework behavior.
|
|
20
|
+
*
|
|
21
|
+
* Activation is intentionally narrow: only an explicitly selected `gt-vue`
|
|
22
|
+
* runtime or a non-optional root `package.json` dependency/devDependency can
|
|
23
|
+
* handle the project. An optional declaration vetoes manifest ownership; peer,
|
|
24
|
+
* workspace-child, wrapper, source, and transitive evidence is ignored. The
|
|
25
|
+
* false branch is synchronous and performs no source scan, workspace traversal,
|
|
26
|
+
* dynamic import, or asynchronous work.
|
|
27
|
+
*/
|
|
28
|
+
function planVueExtraction(options) {
|
|
29
|
+
const captured = capturePlannerOptions(options);
|
|
30
|
+
if (captured.library !== GT_VUE_PACKAGE && !rootDirectlyDeclaresGTVue(captured.projectRoot)) return UNHANDLED_PLAN;
|
|
31
|
+
return Object.freeze({
|
|
32
|
+
handled: true,
|
|
33
|
+
run: (runOptions = {}) => runVueExtraction(captured, runOptions)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** Resolves the root immediately so later cwd changes cannot retarget work. */
|
|
37
|
+
function capturePlannerOptions(options) {
|
|
38
|
+
const absoluteRoot = path.resolve(options.projectRoot);
|
|
39
|
+
let projectRoot = absoluteRoot;
|
|
40
|
+
try {
|
|
41
|
+
projectRoot = fs.realpathSync(absoluteRoot);
|
|
42
|
+
} catch {}
|
|
43
|
+
return {
|
|
44
|
+
...options,
|
|
45
|
+
projectRoot
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** Reads the root manifest fields that determine effective direct ownership. */
|
|
49
|
+
function rootDirectlyDeclaresGTVue(projectRoot) {
|
|
50
|
+
let manifest;
|
|
51
|
+
try {
|
|
52
|
+
manifest = JSON.parse(fs.readFileSync(path.join(projectRoot, "package.json"), "utf8"));
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return manifestDirectlyDeclaresGTVue(manifest);
|
|
57
|
+
}
|
|
58
|
+
function hasOwnDependency(value, packageName) {
|
|
59
|
+
return isRecord(value) && Object.hasOwn(value, packageName);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Runs the handled branch while preserving primary extractor timing.
|
|
63
|
+
*
|
|
64
|
+
* With framework-default patterns, the primary extractor starts synchronously
|
|
65
|
+
* and receives the exact original `undefined` value before the first await.
|
|
66
|
+
* Explicit patterns wait for package-owned SFC partitioning; if another task
|
|
67
|
+
* changes `process.cwd()` in the meantime, only relative primary patterns are
|
|
68
|
+
* anchored back to the captured project root.
|
|
69
|
+
*/
|
|
70
|
+
async function runVueExtraction(options, { extractPrimary }) {
|
|
71
|
+
const filePatterns = options.filePatterns;
|
|
72
|
+
if (filePatterns === void 0) {
|
|
73
|
+
if (extractPrimary) {
|
|
74
|
+
const primaryPromise = extractPrimary(filePatterns);
|
|
75
|
+
let primaryRejected = false;
|
|
76
|
+
let primaryError;
|
|
77
|
+
const observedPrimaryPromise = primaryPromise.catch((error) => {
|
|
78
|
+
primaryRejected = true;
|
|
79
|
+
primaryError = error;
|
|
80
|
+
throw error;
|
|
81
|
+
});
|
|
82
|
+
const vuePromise = afterCurrentTurn(async () => {
|
|
83
|
+
if (primaryRejected) throw primaryError;
|
|
84
|
+
const { inspection, project } = await loadVueExtractionContext(options);
|
|
85
|
+
return {
|
|
86
|
+
project,
|
|
87
|
+
vue: await project.extractFromVueProject(createProjectExtractionOptions(options, inspection, filePatterns))
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
const [primary, { project, vue }] = await Promise.all([observedPrimaryPromise, vuePromise]);
|
|
91
|
+
return project.mergeVueProjectExtraction(primary, vue);
|
|
92
|
+
}
|
|
93
|
+
const { project, inspection } = await loadVueExtractionContext(options);
|
|
94
|
+
return adaptVueOnlyExtraction(project, await project.extractFromVueProject(createProjectExtractionOptions(options, inspection, filePatterns)));
|
|
95
|
+
}
|
|
96
|
+
const { inspectionModule, project, inspection } = await loadVueExtractionContext(options);
|
|
97
|
+
if (!extractPrimary) return adaptVueOnlyExtraction(project, await project.extractFromVueProject(createProjectExtractionOptions(options, inspection, filePatterns)));
|
|
98
|
+
const partition = inspection.hasVueScopes ? inspectionModule.partitionVueSourcePatterns(inspection, filePatterns) : {
|
|
99
|
+
primaryExclusionPatterns: [],
|
|
100
|
+
vueExclusionPatterns: []
|
|
101
|
+
};
|
|
102
|
+
const stablePrimaryPatterns = process.cwd() === options.projectRoot ? filePatterns : await anchorFilePatterns(options.projectRoot, filePatterns);
|
|
103
|
+
const primaryPatterns = partition.primaryExclusionPatterns.length === 0 ? stablePrimaryPatterns : [...stablePrimaryPatterns, ...partition.primaryExclusionPatterns];
|
|
104
|
+
const vuePatterns = partition.vueExclusionPatterns.length === 0 ? filePatterns : [...filePatterns, ...partition.vueExclusionPatterns];
|
|
105
|
+
const primaryPromise = extractPrimary(primaryPatterns);
|
|
106
|
+
const vuePromise = project.extractFromVueProject(createProjectExtractionOptions(options, inspection, vuePatterns));
|
|
107
|
+
const [primary, vue] = await Promise.all([primaryPromise, vuePromise]);
|
|
108
|
+
return project.mergeVueProjectExtraction(primary, vue);
|
|
109
|
+
}
|
|
110
|
+
/** Lets an already-settled primary extractor reach the host before Vue loads. */
|
|
111
|
+
function afterCurrentTurn(callback) {
|
|
112
|
+
return new Promise((resolve) => setImmediate(resolve)).then(callback);
|
|
113
|
+
}
|
|
114
|
+
/** Adapts accurate Vue wire types at the legacy host-CLI Updates boundary. */
|
|
115
|
+
function adaptVueOnlyExtraction(project, vue) {
|
|
116
|
+
return project.mergeVueProjectExtraction({
|
|
117
|
+
updates: [],
|
|
118
|
+
errors: [],
|
|
119
|
+
warnings: []
|
|
120
|
+
}, vue);
|
|
121
|
+
}
|
|
122
|
+
/** Loads the lazy Vue modules and performs package-owned project inspection. */
|
|
123
|
+
async function loadVueExtractionContext(options) {
|
|
124
|
+
const [inspectionModule, project] = await Promise.all([import("./internal/project/inspectVueProject.js"), import("./project.js")]);
|
|
125
|
+
return {
|
|
126
|
+
inspectionModule,
|
|
127
|
+
project,
|
|
128
|
+
inspection: await inspectionModule.inspectVueProjectForRuntime(options.projectRoot, options.library === GT_VUE_PACKAGE)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function createProjectExtractionOptions(options, inspection, filePatterns) {
|
|
132
|
+
return {
|
|
133
|
+
cwd: options.projectRoot,
|
|
134
|
+
inspection,
|
|
135
|
+
filePatterns,
|
|
136
|
+
includeSourceCodeContext: options.includeSourceCodeContext,
|
|
137
|
+
conditionNames: options.conditionNames,
|
|
138
|
+
vueCompilerOptions: options.vueCompilerOptions,
|
|
139
|
+
viteConfigPath: options.viteConfigPath,
|
|
140
|
+
tsconfigPath: options.tsconfigPath,
|
|
141
|
+
surroundingLineCount: options.surroundingLineCount
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/** Anchors relative globs without changing absolute or negative patterns. */
|
|
145
|
+
async function anchorFilePatterns(projectRoot, filePatterns) {
|
|
146
|
+
const { default: fg } = await import("fast-glob");
|
|
147
|
+
const rootPattern = fg.convertPathToPattern(projectRoot).replace(/\/$/, "");
|
|
148
|
+
return filePatterns.map((pattern) => {
|
|
149
|
+
const negative = pattern.startsWith("!") && pattern[1] !== "(";
|
|
150
|
+
const positivePattern = negative ? pattern.slice(1) : pattern;
|
|
151
|
+
if (path.isAbsolute(positivePattern)) return pattern;
|
|
152
|
+
const anchoredPattern = `${rootPattern}/${positivePattern.startsWith("./") ? positivePattern.slice(2) : positivePattern}`;
|
|
153
|
+
return negative ? `!${anchoredPattern}` : anchoredPattern;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function isRecord(value) {
|
|
157
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
export { manifestDirectlyDeclaresGTVue, planVueExtraction };
|
|
161
|
+
|
|
162
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","names":[],"sources":["../src/integration.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport type {\n VueCompilerOptions,\n VueProjectExtractionOutput,\n} from './types.js';\nimport type { InlineExtractionOutput } from './internal/project/mergeVueProjectExtraction.js';\n\nconst GT_VUE_PACKAGE = 'gt-vue';\n\n/**\n * Framework-neutral inline extractor supplied by a host CLI.\n *\n * The planner calls this function at most once. When no explicit source\n * partition is necessary, it receives the caller's original pattern value\n * before the planner performs asynchronous Vue work.\n */\nexport type PrimaryInlineExtractor = (\n filePatterns: string[] | undefined\n) => Promise<InlineExtractionOutput>;\n\n/** Options captured while deciding whether a project needs Vue extraction. */\nexport type VueExtractionPlannerOptions = {\n /** Inline runtime selected by the host CLI. */\n library: string;\n /** Absolute or caller-relative project root captured before any async work. */\n projectRoot: string;\n /** Explicit source patterns. `undefined` retains framework defaults. */\n filePatterns?: string[];\n /** Includes surrounding source lines in extracted update metadata. */\n includeSourceCodeContext?: boolean;\n /** Package export conditions used by static local-module resolution. */\n conditionNames?: string[];\n /** Explicit hash-affecting Vue compiler options. */\n vueCompilerOptions?: VueCompilerOptions;\n /** Explicit Vite config path relative to the captured project root. */\n viteConfigPath?: string;\n /**\n * Explicit tsconfig.json or jsconfig.json path relative to the captured\n * project root. When omitted, the nearest config is discovered per importer.\n */\n tsconfigPath?: string;\n /** Number of source lines captured before and after a translation. */\n surroundingLineCount?: number;\n};\n\n/** Host callbacks used only after a plan has proven Vue ownership. */\nexport type VueExtractionRunOptions = {\n /** Existing React, Node, or Python extraction to preserve and merge. */\n extractPrimary?: PrimaryInlineExtractor;\n};\n\n/** A synchronous decision that leaves non-Vue projects completely untouched. */\nexport type VueExtractionPlan =\n | {\n /** The root has no direct Vue extraction ownership. */\n readonly handled: false;\n }\n | {\n /** The selected runtime or root manifest directly owns gt-vue. */\n readonly handled: true;\n /** Executes package-owned Vue inspection, extraction, and merging. */\n run(options?: VueExtractionRunOptions): Promise<InlineExtractionOutput>;\n };\n\ntype CapturedPlannerOptions = Omit<\n VueExtractionPlannerOptions,\n 'projectRoot'\n> & {\n projectRoot: string;\n};\n\nconst UNHANDLED_PLAN = Object.freeze({ handled: false } as const);\n\n/**\n * Returns whether a package manifest directly enables gt-vue extraction.\n *\n * Only production and development dependencies establish ownership. An\n * optional declaration is authoritative and vetoes a matching declaration in\n * either field, while peer dependencies never establish ownership.\n */\nexport function manifestDirectlyDeclaresGTVue(manifest: unknown): boolean {\n if (!isRecord(manifest)) return false;\n if (hasOwnDependency(manifest.optionalDependencies, GT_VUE_PACKAGE)) {\n return false;\n }\n return (\n hasOwnDependency(manifest.dependencies, GT_VUE_PACKAGE) ||\n hasOwnDependency(manifest.devDependencies, GT_VUE_PACKAGE)\n );\n}\n\n/**\n * Plans Vue extraction without changing historical framework behavior.\n *\n * Activation is intentionally narrow: only an explicitly selected `gt-vue`\n * runtime or a non-optional root `package.json` dependency/devDependency can\n * handle the project. An optional declaration vetoes manifest ownership; peer,\n * workspace-child, wrapper, source, and transitive evidence is ignored. The\n * false branch is synchronous and performs no source scan, workspace traversal,\n * dynamic import, or asynchronous work.\n */\nexport function planVueExtraction(\n options: VueExtractionPlannerOptions\n): VueExtractionPlan {\n const captured = capturePlannerOptions(options);\n if (\n captured.library !== GT_VUE_PACKAGE &&\n !rootDirectlyDeclaresGTVue(captured.projectRoot)\n ) {\n return UNHANDLED_PLAN;\n }\n\n return Object.freeze({\n handled: true as const,\n run: (runOptions: VueExtractionRunOptions = {}) =>\n runVueExtraction(captured, runOptions),\n });\n}\n\n/** Resolves the root immediately so later cwd changes cannot retarget work. */\nfunction capturePlannerOptions(\n options: VueExtractionPlannerOptions\n): CapturedPlannerOptions {\n const absoluteRoot = path.resolve(options.projectRoot);\n let projectRoot = absoluteRoot;\n try {\n projectRoot = fs.realpathSync(absoluteRoot);\n } catch {\n // A missing root is still captured absolutely; activation will remain\n // inert unless the runtime was selected explicitly.\n }\n return {\n ...options,\n projectRoot,\n };\n}\n\n/** Reads the root manifest fields that determine effective direct ownership. */\nfunction rootDirectlyDeclaresGTVue(projectRoot: string): boolean {\n let manifest: unknown;\n try {\n manifest = JSON.parse(\n fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8')\n );\n } catch {\n return false;\n }\n return manifestDirectlyDeclaresGTVue(manifest);\n}\n\nfunction hasOwnDependency(value: unknown, packageName: string): boolean {\n return isRecord(value) && Object.hasOwn(value, packageName);\n}\n\n/**\n * Runs the handled branch while preserving primary extractor timing.\n *\n * With framework-default patterns, the primary extractor starts synchronously\n * and receives the exact original `undefined` value before the first await.\n * Explicit patterns wait for package-owned SFC partitioning; if another task\n * changes `process.cwd()` in the meantime, only relative primary patterns are\n * anchored back to the captured project root.\n */\nasync function runVueExtraction(\n options: CapturedPlannerOptions,\n { extractPrimary }: VueExtractionRunOptions\n): Promise<InlineExtractionOutput> {\n const filePatterns = options.filePatterns;\n if (filePatterns === undefined) {\n if (extractPrimary) {\n const primaryPromise = extractPrimary(filePatterns);\n let primaryRejected = false;\n let primaryError: unknown;\n const observedPrimaryPromise = primaryPromise.catch((error: unknown) => {\n primaryRejected = true;\n primaryError = error;\n throw error;\n });\n // Observe both branches immediately. This lets an already-rejected\n // primary extractor retain its error identity before Node starts the\n // comparatively expensive lazy Vue imports. Successful primary work and\n // Vue inspection still overlap after the current event-loop turn.\n const vuePromise = afterCurrentTurn(async () => {\n if (primaryRejected) throw primaryError;\n const { inspection, project } = await loadVueExtractionContext(options);\n return {\n project,\n vue: await project.extractFromVueProject(\n createProjectExtractionOptions(options, inspection, filePatterns)\n ),\n };\n });\n const [primary, { project, vue }] = await Promise.all([\n observedPrimaryPromise,\n vuePromise,\n ]);\n return project.mergeVueProjectExtraction(primary, vue);\n }\n\n const { project, inspection } = await loadVueExtractionContext(options);\n return adaptVueOnlyExtraction(\n project,\n await project.extractFromVueProject(\n createProjectExtractionOptions(options, inspection, filePatterns)\n )\n );\n }\n\n const vueContextPromise = loadVueExtractionContext(options);\n const { inspectionModule, project, inspection } = await vueContextPromise;\n\n if (!extractPrimary) {\n return adaptVueOnlyExtraction(\n project,\n await project.extractFromVueProject(\n createProjectExtractionOptions(options, inspection, filePatterns)\n )\n );\n }\n\n const partition = inspection.hasVueScopes\n ? inspectionModule.partitionVueSourcePatterns(inspection, filePatterns)\n : { primaryExclusionPatterns: [], vueExclusionPatterns: [] };\n const stablePrimaryPatterns =\n process.cwd() === options.projectRoot\n ? filePatterns\n : await anchorFilePatterns(options.projectRoot, filePatterns);\n const primaryPatterns =\n partition.primaryExclusionPatterns.length === 0\n ? stablePrimaryPatterns\n : [...stablePrimaryPatterns, ...partition.primaryExclusionPatterns];\n const vuePatterns =\n partition.vueExclusionPatterns.length === 0\n ? filePatterns\n : [...filePatterns, ...partition.vueExclusionPatterns];\n\n // Calling before constructing/awaiting Vue extraction preserves the\n // historical extractor's synchronous process.cwd() observation.\n const primaryPromise = extractPrimary(primaryPatterns);\n const vuePromise = project.extractFromVueProject(\n createProjectExtractionOptions(options, inspection, vuePatterns)\n );\n const [primary, vue] = await Promise.all([primaryPromise, vuePromise]);\n return project.mergeVueProjectExtraction(primary, vue);\n}\n\n/** Lets an already-settled primary extractor reach the host before Vue loads. */\nfunction afterCurrentTurn<T>(callback: () => Promise<T>): Promise<T> {\n return new Promise<void>((resolve) => setImmediate(resolve)).then(callback);\n}\n\n/** Adapts accurate Vue wire types at the legacy host-CLI Updates boundary. */\nfunction adaptVueOnlyExtraction(\n project: typeof import('./project.js'),\n vue: VueProjectExtractionOutput\n): InlineExtractionOutput {\n return project.mergeVueProjectExtraction(\n { updates: [], errors: [], warnings: [] },\n vue\n );\n}\n\n/** Loads the lazy Vue modules and performs package-owned project inspection. */\nasync function loadVueExtractionContext(options: CapturedPlannerOptions) {\n const [inspectionModule, project] = await Promise.all([\n import('./internal/project/inspectVueProject.js'),\n import('./project.js'),\n ]);\n const inspection = await inspectionModule.inspectVueProjectForRuntime(\n options.projectRoot,\n options.library === GT_VUE_PACKAGE\n );\n return { inspectionModule, project, inspection };\n}\n\nfunction createProjectExtractionOptions(\n options: CapturedPlannerOptions,\n inspection: import('./types.js').VueProjectInspection,\n filePatterns: string[] | undefined\n): import('./types.js').VueProjectExtractionOptions {\n return {\n cwd: options.projectRoot,\n inspection,\n filePatterns,\n includeSourceCodeContext: options.includeSourceCodeContext,\n conditionNames: options.conditionNames,\n vueCompilerOptions: options.vueCompilerOptions,\n viteConfigPath: options.viteConfigPath,\n tsconfigPath: options.tsconfigPath,\n surroundingLineCount: options.surroundingLineCount,\n };\n}\n\n/** Anchors relative globs without changing absolute or negative patterns. */\nasync function anchorFilePatterns(\n projectRoot: string,\n filePatterns: readonly string[]\n): Promise<string[]> {\n const { default: fg } = await import('fast-glob');\n const rootPattern = fg.convertPathToPattern(projectRoot).replace(/\\/$/, '');\n return filePatterns.map((pattern) => {\n const negative = pattern.startsWith('!') && pattern[1] !== '(';\n const positivePattern = negative ? pattern.slice(1) : pattern;\n if (path.isAbsolute(positivePattern)) return pattern;\n const relativePattern = positivePattern.startsWith('./')\n ? positivePattern.slice(2)\n : positivePattern;\n const anchoredPattern = `${rootPattern}/${relativePattern}`;\n return negative ? `!${anchoredPattern}` : anchoredPattern;\n });\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nexport type { InlineExtractionOutput } from './internal/project/mergeV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
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Vite's standard config filenames in lookup precedence order. */
|
|
2
|
+
export declare const VITE_CONFIG_FILES: readonly ["vite.config.js", "vite.config.mjs", "vite.config.ts", "vite.config.cjs", "vite.config.mts", "vite.config.cts"];
|
|
3
|
+
/** Nuxt's standard config filenames in lookup precedence order. */
|
|
4
|
+
export declare const NUXT_CONFIG_FILES: readonly ["nuxt.config.js", "nuxt.config.ts", "nuxt.config.mjs", "nuxt.config.cjs", "nuxt.config.mts", "nuxt.config.cts"];
|
|
5
|
+
/** JavaScript and TypeScript extensions accepted for an explicit Vite config. */
|
|
6
|
+
export declare const VITE_CONFIG_EXTENSIONS: Set<string>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/internal/config/configFiles.ts
|
|
2
|
+
/** Vite's standard config filenames in lookup precedence order. */
|
|
3
|
+
const VITE_CONFIG_FILES = [
|
|
4
|
+
"vite.config.js",
|
|
5
|
+
"vite.config.mjs",
|
|
6
|
+
"vite.config.ts",
|
|
7
|
+
"vite.config.cjs",
|
|
8
|
+
"vite.config.mts",
|
|
9
|
+
"vite.config.cts"
|
|
10
|
+
];
|
|
11
|
+
/** Nuxt's standard config filenames in lookup precedence order. */
|
|
12
|
+
const NUXT_CONFIG_FILES = [
|
|
13
|
+
"nuxt.config.js",
|
|
14
|
+
"nuxt.config.ts",
|
|
15
|
+
"nuxt.config.mjs",
|
|
16
|
+
"nuxt.config.cjs",
|
|
17
|
+
"nuxt.config.mts",
|
|
18
|
+
"nuxt.config.cts"
|
|
19
|
+
];
|
|
20
|
+
/** JavaScript and TypeScript extensions accepted for an explicit Vite config. */
|
|
21
|
+
const VITE_CONFIG_EXTENSIONS = new Set([
|
|
22
|
+
".js",
|
|
23
|
+
".jsx",
|
|
24
|
+
".mjs",
|
|
25
|
+
".cjs",
|
|
26
|
+
".ts",
|
|
27
|
+
".tsx",
|
|
28
|
+
".mts",
|
|
29
|
+
".cts"
|
|
30
|
+
]);
|
|
31
|
+
//#endregion
|
|
32
|
+
export { NUXT_CONFIG_FILES, VITE_CONFIG_EXTENSIONS, VITE_CONFIG_FILES };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=configFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configFiles.js","names":[],"sources":["../../../src/internal/config/configFiles.ts"],"sourcesContent":["/** Vite's standard config filenames in lookup precedence order. */\nexport const VITE_CONFIG_FILES = [\n 'vite.config.js',\n 'vite.config.mjs',\n 'vite.config.ts',\n 'vite.config.cjs',\n 'vite.config.mts',\n 'vite.config.cts',\n] as const;\n\n/** Nuxt's standard config filenames in lookup precedence order. */\nexport const NUXT_CONFIG_FILES = [\n 'nuxt.config.js',\n 'nuxt.config.ts',\n 'nuxt.config.mjs',\n 'nuxt.config.cjs',\n 'nuxt.config.mts',\n 'nuxt.config.cts',\n] as const;\n\n/** JavaScript and TypeScript extensions accepted for an explicit Vite config. */\nexport const VITE_CONFIG_EXTENSIONS = new Set([\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n]);\n"],"mappings":";;AACA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,yBAAyB,IAAI,IAAI;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC"}
|
|
@@ -10,6 +10,12 @@ export type VueCompilerOptionsResolution = {
|
|
|
10
10
|
export type VueCompilerOptionsResolverOptions = {
|
|
11
11
|
/** A single explicit Vite config path, resolved relative to the project root. */
|
|
12
12
|
viteConfigPath?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether caller-supplied source globs already cover custom Nuxt layouts.
|
|
15
|
+
* This relaxes only layout validation; discovered config remains mandatory
|
|
16
|
+
* to read and parse successfully.
|
|
17
|
+
*/
|
|
18
|
+
sourceDiscoveryIsExplicit?: boolean;
|
|
13
19
|
};
|
|
14
20
|
/**
|
|
15
21
|
* Resolves hash-affecting Vue template compiler options without executing
|