@immense/vue-pom-generator 1.0.118 → 1.0.120
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/README.md +111 -2
- package/RELEASE_NOTES.md +29 -27
- package/class-generation/index.ts +136 -76
- package/dist/class-generation/index.d.ts +7 -0
- package/dist/class-generation/index.d.ts.map +1 -1
- package/dist/index.cjs +313 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +313 -171
- package/dist/index.mjs.map +1 -1
- package/dist/manifest-generator.d.ts +18 -0
- package/dist/manifest-generator.d.ts.map +1 -1
- package/dist/plugin/create-vue-pom-generator-plugins.d.ts.map +1 -1
- package/dist/plugin/internal/build-plugin.d.ts.map +1 -1
- package/dist/plugin/internal/dev-plugin.d.ts.map +1 -1
- package/dist/plugin/path-utils.d.ts +1 -0
- package/dist/plugin/path-utils.d.ts.map +1 -1
- package/dist/plugin/resolved-generation-options.d.ts +2 -0
- package/dist/plugin/resolved-generation-options.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +14 -0
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/router-introspection.d.ts +10 -1
- package/dist/router-introspection.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -221,6 +221,8 @@ function resolveGenerationSupportOptions(options) {
|
|
|
221
221
|
requireCustomPomDir: options.requireCustomPomDir ?? false,
|
|
222
222
|
customPomImportAliases: options.customPomImportAliases,
|
|
223
223
|
customPomImportNameCollisionBehavior: options.customPomImportNameCollisionBehavior ?? "error",
|
|
224
|
+
customPomFixtures: options.customPomFixtures ?? [],
|
|
225
|
+
componentGraph: options.componentGraph ?? false,
|
|
224
226
|
nameCollisionBehavior: options.nameCollisionBehavior ?? "error",
|
|
225
227
|
missingSemanticNameBehavior: options.missingSemanticNameBehavior ?? "error",
|
|
226
228
|
existingIdBehavior: options.existingIdBehavior ?? "error",
|
|
@@ -3876,6 +3878,103 @@ function buildPomGeneratedPropertyName(pom) {
|
|
|
3876
3878
|
function buildPomGeneratedActionName(pom) {
|
|
3877
3879
|
return requireStructuredPomName(pom.generatedActionName, "generatedActionName", pom);
|
|
3878
3880
|
}
|
|
3881
|
+
function toPosixSlashes(value) {
|
|
3882
|
+
let out = "";
|
|
3883
|
+
for (let i = 0; i < value.length; i++) {
|
|
3884
|
+
const ch = value[i];
|
|
3885
|
+
out += ch === "\\" ? "/" : ch;
|
|
3886
|
+
}
|
|
3887
|
+
return out;
|
|
3888
|
+
}
|
|
3889
|
+
function safeRealpath(value) {
|
|
3890
|
+
try {
|
|
3891
|
+
if (fs.existsSync(value)) {
|
|
3892
|
+
return fs.realpathSync(value);
|
|
3893
|
+
}
|
|
3894
|
+
} catch {
|
|
3895
|
+
return value;
|
|
3896
|
+
}
|
|
3897
|
+
const parent = path.dirname(value);
|
|
3898
|
+
if (!parent || parent === value) {
|
|
3899
|
+
return value;
|
|
3900
|
+
}
|
|
3901
|
+
const resolvedParent = safeRealpath(parent);
|
|
3902
|
+
return resolvedParent === parent ? value : path.join(resolvedParent, path.basename(value));
|
|
3903
|
+
}
|
|
3904
|
+
function normalizeScopePath(value, pathImpl = path) {
|
|
3905
|
+
return pathImpl.normalize(value);
|
|
3906
|
+
}
|
|
3907
|
+
function isNormalizedPathWithinDir(filePathAbs, dirPathAbs, pathImpl = path) {
|
|
3908
|
+
const normalizedFileAbs = normalizeScopePath(filePathAbs, pathImpl);
|
|
3909
|
+
const normalizedDirAbs = normalizeScopePath(dirPathAbs, pathImpl);
|
|
3910
|
+
return normalizedFileAbs === normalizedDirAbs || normalizedFileAbs.startsWith(`${normalizedDirAbs}${pathImpl.sep}`);
|
|
3911
|
+
}
|
|
3912
|
+
function isPathWithinDir(filePathAbs, dirPathAbs) {
|
|
3913
|
+
const fileAbs = path.resolve(filePathAbs);
|
|
3914
|
+
const dirAbs = path.resolve(dirPathAbs);
|
|
3915
|
+
const rel = path.relative(dirAbs, fileAbs);
|
|
3916
|
+
if (!rel)
|
|
3917
|
+
return true;
|
|
3918
|
+
return !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
3919
|
+
}
|
|
3920
|
+
function resolveComponentNameFromPath(options) {
|
|
3921
|
+
const { projectRoot, viewsDirAbs, sourceDirs, extraRoots = [] } = options;
|
|
3922
|
+
const cleanFilename = options.filename.includes("?") ? options.filename.substring(0, options.filename.indexOf("?")) : options.filename;
|
|
3923
|
+
const absFilename = path.isAbsolute(cleanFilename) ? cleanFilename : path.resolve(projectRoot, cleanFilename);
|
|
3924
|
+
const normalizedAbsFilename = toPosixSlashes(path.normalize(safeRealpath(absFilename)));
|
|
3925
|
+
const rootBases = [projectRoot, ...extraRoots.filter((r) => r !== projectRoot)];
|
|
3926
|
+
const roots = [
|
|
3927
|
+
viewsDirAbs,
|
|
3928
|
+
...sourceDirs.flatMap((dir) => path.isAbsolute(dir) ? [dir] : rootBases.map((base) => path.resolve(base, dir)))
|
|
3929
|
+
];
|
|
3930
|
+
const potentialRoots = Array.from(new Set(roots.map((r) => toPosixSlashes(path.normalize(safeRealpath(r)))))).sort((a, b) => b.length - a.length);
|
|
3931
|
+
for (const root of potentialRoots) {
|
|
3932
|
+
if (normalizedAbsFilename.startsWith(`${root}/`) || normalizedAbsFilename === root) {
|
|
3933
|
+
const rel = path.posix.relative(root, normalizedAbsFilename);
|
|
3934
|
+
const parsed = path.posix.parse(rel);
|
|
3935
|
+
const segments = path.posix.join(parsed.dir, parsed.name);
|
|
3936
|
+
return toPascalCase(segments);
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3939
|
+
return toPascalCase(path.parse(normalizedAbsFilename).name);
|
|
3940
|
+
}
|
|
3941
|
+
function isFileInConfiguredSourceScope(options) {
|
|
3942
|
+
const { filename, projectRoot, viewsDirAbs, sourceDirs, extraRoots = [], pathImpl = path } = options;
|
|
3943
|
+
if (!filename) {
|
|
3944
|
+
return false;
|
|
3945
|
+
}
|
|
3946
|
+
const cleanFilename = filename.includes("?") ? filename.substring(0, filename.indexOf("?")) : filename;
|
|
3947
|
+
const normalizedProjectRoot = normalizeScopePath(projectRoot, pathImpl);
|
|
3948
|
+
const normalizedAbsFilename = normalizeScopePath(
|
|
3949
|
+
pathImpl.isAbsolute(cleanFilename) ? cleanFilename : pathImpl.resolve(normalizedProjectRoot, cleanFilename),
|
|
3950
|
+
pathImpl
|
|
3951
|
+
);
|
|
3952
|
+
if (normalizedAbsFilename.includes(`${pathImpl.sep}node_modules${pathImpl.sep}`) || normalizedAbsFilename.includes("/node_modules/")) {
|
|
3953
|
+
return false;
|
|
3954
|
+
}
|
|
3955
|
+
const normalizedViewsDirAbs = normalizeScopePath(viewsDirAbs, pathImpl);
|
|
3956
|
+
if (isNormalizedPathWithinDir(normalizedAbsFilename, normalizedViewsDirAbs, pathImpl)) {
|
|
3957
|
+
return true;
|
|
3958
|
+
}
|
|
3959
|
+
const rootsToTry = Array.from(/* @__PURE__ */ new Set([
|
|
3960
|
+
normalizedProjectRoot,
|
|
3961
|
+
...extraRoots.map((root) => normalizeScopePath(root, pathImpl))
|
|
3962
|
+
]));
|
|
3963
|
+
return sourceDirs.some((dir) => {
|
|
3964
|
+
return rootsToTry.some((root) => {
|
|
3965
|
+
const normalizedAbsDir = normalizeScopePath(pathImpl.resolve(root, dir), pathImpl);
|
|
3966
|
+
if (isNormalizedPathWithinDir(normalizedAbsFilename, normalizedAbsDir, pathImpl)) {
|
|
3967
|
+
return true;
|
|
3968
|
+
}
|
|
3969
|
+
if (dir.startsWith("app/") && pathImpl.basename(root) === "app") {
|
|
3970
|
+
const relativeDir = dir.substring(4);
|
|
3971
|
+
const normalizedAbsDirAlt = normalizeScopePath(pathImpl.resolve(root, relativeDir), pathImpl);
|
|
3972
|
+
return isNormalizedPathWithinDir(normalizedAbsFilename, normalizedAbsDirAlt, pathImpl);
|
|
3973
|
+
}
|
|
3974
|
+
return false;
|
|
3975
|
+
});
|
|
3976
|
+
});
|
|
3977
|
+
}
|
|
3879
3978
|
function matchesPrimarySelector(extraMethod, pom) {
|
|
3880
3979
|
if (extraMethod.selector.kind !== "testId") {
|
|
3881
3980
|
return false;
|
|
@@ -3944,6 +4043,56 @@ function buildPomManifest(componentHierarchyMap, elementMetadata) {
|
|
|
3944
4043
|
}).filter((entry) => entry !== null);
|
|
3945
4044
|
return Object.fromEntries(manifestEntries);
|
|
3946
4045
|
}
|
|
4046
|
+
function normalizeTrackedComponentRef(value) {
|
|
4047
|
+
return value.endsWith(".vue") ? value.slice(0, -4) : value;
|
|
4048
|
+
}
|
|
4049
|
+
function resolveTrackedComponentRef(value, componentHierarchyMap) {
|
|
4050
|
+
const normalizedValue = normalizeTrackedComponentRef(value);
|
|
4051
|
+
if (componentHierarchyMap.has(value)) {
|
|
4052
|
+
return value;
|
|
4053
|
+
}
|
|
4054
|
+
if (componentHierarchyMap.has(normalizedValue)) {
|
|
4055
|
+
return normalizedValue;
|
|
4056
|
+
}
|
|
4057
|
+
let match = null;
|
|
4058
|
+
for (const [candidateName, candidateDeps] of componentHierarchyMap.entries()) {
|
|
4059
|
+
const normalizedCandidate = normalizeTrackedComponentRef(candidateName);
|
|
4060
|
+
const candidateBaseName = path.parse(candidateDeps.filePath).name;
|
|
4061
|
+
if (normalizedCandidate !== normalizedValue && candidateBaseName !== normalizedValue) {
|
|
4062
|
+
continue;
|
|
4063
|
+
}
|
|
4064
|
+
if (match && match !== candidateName) {
|
|
4065
|
+
return null;
|
|
4066
|
+
}
|
|
4067
|
+
match = candidateName;
|
|
4068
|
+
}
|
|
4069
|
+
return match;
|
|
4070
|
+
}
|
|
4071
|
+
function buildComponentGraph(componentHierarchyMap, routeMetaEntries, projectRoot) {
|
|
4072
|
+
const rootAbs = safeRealpath(path.resolve(projectRoot));
|
|
4073
|
+
const toProjectPath = (filePath) => toPosixSlashes(path.relative(rootAbs, safeRealpath(path.resolve(rootAbs, filePath))));
|
|
4074
|
+
const sortedUnique = (values) => Array.from(new Set(values)).sort((a, b) => a.localeCompare(b));
|
|
4075
|
+
const components = Array.from(componentHierarchyMap.entries(), ([name, dependencies]) => [toProjectPath(dependencies.filePath), {
|
|
4076
|
+
name,
|
|
4077
|
+
// Templates may use kebab-case tags; tags that are not project components (built-ins, libraries) drop out.
|
|
4078
|
+
uses: sortedUnique(Array.from(dependencies.usedComponentSet).flatMap((tag) => {
|
|
4079
|
+
const ref = resolveTrackedComponentRef(toPascalCase(tag), componentHierarchyMap);
|
|
4080
|
+
const used = ref ? componentHierarchyMap.get(ref) : void 0;
|
|
4081
|
+
return used ? [toProjectPath(used.filePath)] : [];
|
|
4082
|
+
}))
|
|
4083
|
+
}]).sort(([a], [b]) => a.localeCompare(b));
|
|
4084
|
+
const routes = routeMetaEntries.map((route) => {
|
|
4085
|
+
if (!route.componentFiles) {
|
|
4086
|
+
throw new Error(`[vue-pom-generator] Route "${route.path}" was introspected without its component files.`);
|
|
4087
|
+
}
|
|
4088
|
+
return { path: route.path, name: route.name, components: Array.from(new Set(route.componentFiles.map(toProjectPath))) };
|
|
4089
|
+
}).sort((a, b) => a.path.localeCompare(b.path) || (a.name ?? "").localeCompare(b.name ?? ""));
|
|
4090
|
+
return { version: 1, components: Object.fromEntries(components), routes };
|
|
4091
|
+
}
|
|
4092
|
+
function generateComponentGraphJson(componentHierarchyMap, routeMetaEntries, projectRoot) {
|
|
4093
|
+
return `${JSON.stringify(buildComponentGraph(componentHierarchyMap, routeMetaEntries, projectRoot), null, 2)}
|
|
4094
|
+
`;
|
|
4095
|
+
}
|
|
3947
4096
|
function buildTestIdManifest(componentHierarchyMap) {
|
|
3948
4097
|
return Object.fromEntries(
|
|
3949
4098
|
Array.from(componentHierarchyMap.entries()).sort((a, b) => a[0].localeCompare(b[0])).map(([componentName, dependencies]) => {
|
|
@@ -4127,103 +4276,6 @@ function writeGeneratedOutputs(outDir, files, sharedFiles, projectRoot = path.di
|
|
|
4127
4276
|
writeFile(manifestPath, `${JSON.stringify(next, null, 2)}
|
|
4128
4277
|
`);
|
|
4129
4278
|
}
|
|
4130
|
-
function toPosixSlashes(value) {
|
|
4131
|
-
let out = "";
|
|
4132
|
-
for (let i = 0; i < value.length; i++) {
|
|
4133
|
-
const ch = value[i];
|
|
4134
|
-
out += ch === "\\" ? "/" : ch;
|
|
4135
|
-
}
|
|
4136
|
-
return out;
|
|
4137
|
-
}
|
|
4138
|
-
function safeRealpath(value) {
|
|
4139
|
-
try {
|
|
4140
|
-
if (fs.existsSync(value)) {
|
|
4141
|
-
return fs.realpathSync(value);
|
|
4142
|
-
}
|
|
4143
|
-
} catch {
|
|
4144
|
-
return value;
|
|
4145
|
-
}
|
|
4146
|
-
const parent = path.dirname(value);
|
|
4147
|
-
if (!parent || parent === value) {
|
|
4148
|
-
return value;
|
|
4149
|
-
}
|
|
4150
|
-
const resolvedParent = safeRealpath(parent);
|
|
4151
|
-
return resolvedParent === parent ? value : path.join(resolvedParent, path.basename(value));
|
|
4152
|
-
}
|
|
4153
|
-
function normalizeScopePath(value, pathImpl = path) {
|
|
4154
|
-
return pathImpl.normalize(value);
|
|
4155
|
-
}
|
|
4156
|
-
function isNormalizedPathWithinDir(filePathAbs, dirPathAbs, pathImpl = path) {
|
|
4157
|
-
const normalizedFileAbs = normalizeScopePath(filePathAbs, pathImpl);
|
|
4158
|
-
const normalizedDirAbs = normalizeScopePath(dirPathAbs, pathImpl);
|
|
4159
|
-
return normalizedFileAbs === normalizedDirAbs || normalizedFileAbs.startsWith(`${normalizedDirAbs}${pathImpl.sep}`);
|
|
4160
|
-
}
|
|
4161
|
-
function isPathWithinDir(filePathAbs, dirPathAbs) {
|
|
4162
|
-
const fileAbs = path.resolve(filePathAbs);
|
|
4163
|
-
const dirAbs = path.resolve(dirPathAbs);
|
|
4164
|
-
const rel = path.relative(dirAbs, fileAbs);
|
|
4165
|
-
if (!rel)
|
|
4166
|
-
return true;
|
|
4167
|
-
return !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
4168
|
-
}
|
|
4169
|
-
function resolveComponentNameFromPath(options) {
|
|
4170
|
-
const { projectRoot, viewsDirAbs, sourceDirs, extraRoots = [] } = options;
|
|
4171
|
-
const cleanFilename = options.filename.includes("?") ? options.filename.substring(0, options.filename.indexOf("?")) : options.filename;
|
|
4172
|
-
const absFilename = path.isAbsolute(cleanFilename) ? cleanFilename : path.resolve(projectRoot, cleanFilename);
|
|
4173
|
-
const normalizedAbsFilename = toPosixSlashes(path.normalize(safeRealpath(absFilename)));
|
|
4174
|
-
const rootBases = [projectRoot, ...extraRoots.filter((r) => r !== projectRoot)];
|
|
4175
|
-
const roots = [
|
|
4176
|
-
viewsDirAbs,
|
|
4177
|
-
...sourceDirs.flatMap((dir) => path.isAbsolute(dir) ? [dir] : rootBases.map((base) => path.resolve(base, dir)))
|
|
4178
|
-
];
|
|
4179
|
-
const potentialRoots = Array.from(new Set(roots.map((r) => toPosixSlashes(path.normalize(safeRealpath(r)))))).sort((a, b) => b.length - a.length);
|
|
4180
|
-
for (const root of potentialRoots) {
|
|
4181
|
-
if (normalizedAbsFilename.startsWith(`${root}/`) || normalizedAbsFilename === root) {
|
|
4182
|
-
const rel = path.posix.relative(root, normalizedAbsFilename);
|
|
4183
|
-
const parsed = path.posix.parse(rel);
|
|
4184
|
-
const segments = path.posix.join(parsed.dir, parsed.name);
|
|
4185
|
-
return toPascalCase(segments);
|
|
4186
|
-
}
|
|
4187
|
-
}
|
|
4188
|
-
return toPascalCase(path.parse(normalizedAbsFilename).name);
|
|
4189
|
-
}
|
|
4190
|
-
function isFileInConfiguredSourceScope(options) {
|
|
4191
|
-
const { filename, projectRoot, viewsDirAbs, sourceDirs, extraRoots = [], pathImpl = path } = options;
|
|
4192
|
-
if (!filename) {
|
|
4193
|
-
return false;
|
|
4194
|
-
}
|
|
4195
|
-
const cleanFilename = filename.includes("?") ? filename.substring(0, filename.indexOf("?")) : filename;
|
|
4196
|
-
const normalizedProjectRoot = normalizeScopePath(projectRoot, pathImpl);
|
|
4197
|
-
const normalizedAbsFilename = normalizeScopePath(
|
|
4198
|
-
pathImpl.isAbsolute(cleanFilename) ? cleanFilename : pathImpl.resolve(normalizedProjectRoot, cleanFilename),
|
|
4199
|
-
pathImpl
|
|
4200
|
-
);
|
|
4201
|
-
if (normalizedAbsFilename.includes(`${pathImpl.sep}node_modules${pathImpl.sep}`) || normalizedAbsFilename.includes("/node_modules/")) {
|
|
4202
|
-
return false;
|
|
4203
|
-
}
|
|
4204
|
-
const normalizedViewsDirAbs = normalizeScopePath(viewsDirAbs, pathImpl);
|
|
4205
|
-
if (isNormalizedPathWithinDir(normalizedAbsFilename, normalizedViewsDirAbs, pathImpl)) {
|
|
4206
|
-
return true;
|
|
4207
|
-
}
|
|
4208
|
-
const rootsToTry = Array.from(/* @__PURE__ */ new Set([
|
|
4209
|
-
normalizedProjectRoot,
|
|
4210
|
-
...extraRoots.map((root) => normalizeScopePath(root, pathImpl))
|
|
4211
|
-
]));
|
|
4212
|
-
return sourceDirs.some((dir) => {
|
|
4213
|
-
return rootsToTry.some((root) => {
|
|
4214
|
-
const normalizedAbsDir = normalizeScopePath(pathImpl.resolve(root, dir), pathImpl);
|
|
4215
|
-
if (isNormalizedPathWithinDir(normalizedAbsFilename, normalizedAbsDir, pathImpl)) {
|
|
4216
|
-
return true;
|
|
4217
|
-
}
|
|
4218
|
-
if (dir.startsWith("app/") && pathImpl.basename(root) === "app") {
|
|
4219
|
-
const relativeDir = dir.substring(4);
|
|
4220
|
-
const normalizedAbsDirAlt = normalizeScopePath(pathImpl.resolve(root, relativeDir), pathImpl);
|
|
4221
|
-
return isNormalizedPathWithinDir(normalizedAbsFilename, normalizedAbsDirAlt, pathImpl);
|
|
4222
|
-
}
|
|
4223
|
-
return false;
|
|
4224
|
-
});
|
|
4225
|
-
});
|
|
4226
|
-
}
|
|
4227
4279
|
let routerIntrospectionQueue = Promise.resolve();
|
|
4228
4280
|
async function runRouterIntrospectionExclusive(fn) {
|
|
4229
4281
|
const prev = routerIntrospectionQueue.catch(() => void 0);
|
|
@@ -4593,8 +4645,8 @@ function getComponentInfoFromVueComponent(comp, options = {}) {
|
|
|
4593
4645
|
filePath
|
|
4594
4646
|
};
|
|
4595
4647
|
}
|
|
4596
|
-
async function
|
|
4597
|
-
const comp =
|
|
4648
|
+
async function getComponentInfoFromRouteComponent(routeComponent, options = {}) {
|
|
4649
|
+
const comp = routeComponent;
|
|
4598
4650
|
if (!comp) {
|
|
4599
4651
|
return {
|
|
4600
4652
|
componentName: null,
|
|
@@ -4620,6 +4672,39 @@ async function getComponentInfoFromRouteRecord(record, options = {}) {
|
|
|
4620
4672
|
}
|
|
4621
4673
|
return getComponentInfoFromVueComponent(comp, options);
|
|
4622
4674
|
}
|
|
4675
|
+
function isRouteParamNameCode(code) {
|
|
4676
|
+
return code === 95 || isAsciiLetterCode$1(code) || isAsciiDigitCode$1(code);
|
|
4677
|
+
}
|
|
4678
|
+
function getPathParamNames(routePath) {
|
|
4679
|
+
const names = [];
|
|
4680
|
+
for (let start = routePath.indexOf(":"); start !== -1; start = routePath.indexOf(":", start + 1)) {
|
|
4681
|
+
let end = start + 1;
|
|
4682
|
+
while (end < routePath.length && isRouteParamNameCode(routePath.charCodeAt(end)))
|
|
4683
|
+
end++;
|
|
4684
|
+
if (end > start + 1)
|
|
4685
|
+
names.push(routePath.slice(start + 1, end));
|
|
4686
|
+
}
|
|
4687
|
+
return names;
|
|
4688
|
+
}
|
|
4689
|
+
function getRenderedRouteRecords(router, record) {
|
|
4690
|
+
const matched = record.name === void 0 ? router.resolve(record.path).matched : router.resolve({ name: record.name, params: Object.fromEntries(getPathParamNames(record.path).map((name) => [name, name])) }).matched;
|
|
4691
|
+
const index = matched.findIndex((candidate) => candidate === record || candidate === record.aliasOf);
|
|
4692
|
+
if (index === -1) {
|
|
4693
|
+
throw new Error(`[vue-pom-generator] Cannot resolve the parent routes of unnamed route "${record.path}". Give it a name so the components it renders can be listed.`);
|
|
4694
|
+
}
|
|
4695
|
+
return matched.slice(0, index + 1);
|
|
4696
|
+
}
|
|
4697
|
+
async function getRenderedComponentFiles(router, record, rootDir) {
|
|
4698
|
+
const files = [];
|
|
4699
|
+
for (const rendered of getRenderedRouteRecords(router, record)) {
|
|
4700
|
+
for (const routeComponent of Object.values(rendered.components ?? {})) {
|
|
4701
|
+
const { filePath } = await getComponentInfoFromRouteComponent(routeComponent, { rootDir });
|
|
4702
|
+
if (filePath && !files.includes(filePath))
|
|
4703
|
+
files.push(filePath);
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
return files;
|
|
4707
|
+
}
|
|
4623
4708
|
function resolveIntrospectedComponentName(componentInfo, componentNaming) {
|
|
4624
4709
|
if (componentInfo.filePath && componentNaming) {
|
|
4625
4710
|
return resolveComponentNameFromPath({
|
|
@@ -5050,9 +5135,11 @@ async function introspectNuxtPages(projectRoot, options = {}) {
|
|
|
5050
5135
|
// Nuxt file-based routes are named by convention, but the static walk does not
|
|
5051
5136
|
// recover those names — leave null so callers fall back to path-template navigation.
|
|
5052
5137
|
name: null,
|
|
5138
|
+
path: pathTemplate,
|
|
5053
5139
|
pathTemplate,
|
|
5054
5140
|
params,
|
|
5055
|
-
query: []
|
|
5141
|
+
query: [],
|
|
5142
|
+
...options.collectComponentFiles ? { componentFiles: [fullPath] } : {}
|
|
5056
5143
|
});
|
|
5057
5144
|
}
|
|
5058
5145
|
};
|
|
@@ -5126,7 +5213,7 @@ async function parseRouterFileFromCwd(routerEntryPath, options = {}) {
|
|
|
5126
5213
|
const routePathMap = /* @__PURE__ */ new Map();
|
|
5127
5214
|
const routeMetaEntries = [];
|
|
5128
5215
|
for (const r of router.getRoutes()) {
|
|
5129
|
-
const componentInfo = await
|
|
5216
|
+
const componentInfo = await getComponentInfoFromRouteComponent(r.components?.default, { rootDir: cwd });
|
|
5130
5217
|
const componentName = resolveIntrospectedComponentName(componentInfo, options.componentNaming);
|
|
5131
5218
|
if (!componentName)
|
|
5132
5219
|
continue;
|
|
@@ -5144,9 +5231,11 @@ async function parseRouterFileFromCwd(routerEntryPath, options = {}) {
|
|
|
5144
5231
|
routeMetaEntries.push({
|
|
5145
5232
|
componentName,
|
|
5146
5233
|
name: typeof r.name === "string" && r.name.length ? r.name : null,
|
|
5234
|
+
path: r.path,
|
|
5147
5235
|
pathTemplate,
|
|
5148
5236
|
params: paramsMeta,
|
|
5149
|
-
query: queryKeys
|
|
5237
|
+
query: queryKeys,
|
|
5238
|
+
...options.collectComponentFiles ? { componentFiles: await getRenderedComponentFiles(router, r, cwd) } : {}
|
|
5150
5239
|
});
|
|
5151
5240
|
}
|
|
5152
5241
|
}
|
|
@@ -5544,7 +5633,7 @@ function resolveVueSourcePath(targetClassName, vueFilesPathMap, projectRoot) {
|
|
|
5544
5633
|
].filter((candidate) => typeof candidate === "string" && candidate.length > 0);
|
|
5545
5634
|
return candidates.find((candidate) => fs.existsSync(candidate));
|
|
5546
5635
|
}
|
|
5547
|
-
async function
|
|
5636
|
+
async function introspectRouteMetaEntries(projectRoot, routerEntry, routerType, options = {}) {
|
|
5548
5637
|
const root = projectRoot ?? process.cwd();
|
|
5549
5638
|
const pageDirs = options.pageDirs?.length ? options.pageDirs : ["src/views"];
|
|
5550
5639
|
const pageDirsAbs = pageDirs.map((dir) => path.isAbsolute(dir) ? dir : path.resolve(root, dir));
|
|
@@ -5555,14 +5644,18 @@ async function getRouteMetaByComponent(projectRoot, routerEntry, routerType, opt
|
|
|
5555
5644
|
...options.layoutDirs?.length ? options.layoutDirs : ["src/layouts"]
|
|
5556
5645
|
];
|
|
5557
5646
|
const extraRoots = process.cwd() !== root ? [process.cwd()] : [];
|
|
5558
|
-
const { routeMetaEntries } = routerType === "nuxt" ? await introspectNuxtPages(root, { pageDirs: pageDirsAbs }) : await parseRouterFileFromCwd(resolveRouterEntry(root, routerEntry), {
|
|
5647
|
+
const { routeMetaEntries } = routerType === "nuxt" ? await introspectNuxtPages(root, { pageDirs: pageDirsAbs, collectComponentFiles: options.collectComponentFiles }) : await parseRouterFileFromCwd(resolveRouterEntry(root, routerEntry), {
|
|
5559
5648
|
componentNaming: {
|
|
5560
5649
|
projectRoot: root,
|
|
5561
5650
|
viewsDirAbs: primaryPageDirAbs,
|
|
5562
5651
|
sourceDirs,
|
|
5563
5652
|
extraRoots
|
|
5564
|
-
}
|
|
5653
|
+
},
|
|
5654
|
+
collectComponentFiles: options.collectComponentFiles
|
|
5565
5655
|
});
|
|
5656
|
+
return routeMetaEntries;
|
|
5657
|
+
}
|
|
5658
|
+
function buildRouteMetaByComponent(routeMetaEntries) {
|
|
5566
5659
|
const map = /* @__PURE__ */ new Map();
|
|
5567
5660
|
for (const entry of routeMetaEntries) {
|
|
5568
5661
|
const list = map.get(entry.componentName) ?? [];
|
|
@@ -5903,6 +5996,8 @@ async function generateFiles(componentHierarchyMap, vueFilesPathMap, basePageCla
|
|
|
5903
5996
|
requireCustomPomDir,
|
|
5904
5997
|
customPomImportAliases,
|
|
5905
5998
|
customPomImportNameCollisionBehavior = "error",
|
|
5999
|
+
customPomFixtures = [],
|
|
6000
|
+
componentGraph = false,
|
|
5906
6001
|
testIdAttribute,
|
|
5907
6002
|
emitLanguages: emitLanguagesOverride,
|
|
5908
6003
|
typescriptOutputStructure = "aggregated",
|
|
@@ -5924,11 +6019,13 @@ async function generateFiles(componentHierarchyMap, vueFilesPathMap, basePageCla
|
|
|
5924
6019
|
if (vueTestUtilsOutDir && path.resolve(vueTestUtilsOutDir) === path.resolve(outDir)) {
|
|
5925
6020
|
throw new Error("[vue-pom-generator] generation.vueTestUtils.outDir must differ from generation.outDir.");
|
|
5926
6021
|
}
|
|
5927
|
-
const
|
|
6022
|
+
const routeMetaEntries = vueRouterFluentChaining && (!routeMetaByComponentOverride || componentGraph) ? await introspectRouteMetaEntries(projectRoot, routerEntry, routerType, {
|
|
5928
6023
|
pageDirs,
|
|
5929
6024
|
componentDirs,
|
|
5930
|
-
layoutDirs
|
|
5931
|
-
|
|
6025
|
+
layoutDirs,
|
|
6026
|
+
collectComponentFiles: componentGraph
|
|
6027
|
+
}) : [];
|
|
6028
|
+
const routeMetaByComponent = routeMetaByComponentOverride ?? (vueRouterFluentChaining ? buildRouteMetaByComponent(routeMetaEntries) : void 0);
|
|
5932
6029
|
const emittableComponentHierarchyMap = componentHierarchyMap;
|
|
5933
6030
|
const generatedFiles = [];
|
|
5934
6031
|
if (emitLanguages.includes("ts")) {
|
|
@@ -5962,6 +6059,8 @@ async function generateFiles(componentHierarchyMap, vueFilesPathMap, basePageCla
|
|
|
5962
6059
|
pomOutDir: outDir,
|
|
5963
6060
|
projectRoot,
|
|
5964
6061
|
customPomDir,
|
|
6062
|
+
customPomFixtures,
|
|
6063
|
+
componentGraphRoutes: componentGraph ? routeMetaEntries : void 0,
|
|
5965
6064
|
elementMetadata,
|
|
5966
6065
|
testIdAttribute
|
|
5967
6066
|
});
|
|
@@ -6674,9 +6773,20 @@ function generateAggregatedCSharpFiles(componentHierarchyMap, outDir, options =
|
|
|
6674
6773
|
return [{ filePath: outputFile, content: chunks.join("\n") }];
|
|
6675
6774
|
}
|
|
6676
6775
|
function maybeGenerateFixtureRegistry(componentHierarchyMap, options) {
|
|
6677
|
-
const { generateFixtures, pomOutDir } = options;
|
|
6678
|
-
if (!generateFixtures)
|
|
6776
|
+
const { generateFixtures, pomOutDir, customPomFixtures, componentGraphRoutes } = options;
|
|
6777
|
+
if (!generateFixtures) {
|
|
6778
|
+
if (customPomFixtures.length > 0) {
|
|
6779
|
+
throw new VuePomGeneratorError(
|
|
6780
|
+
"generation.playwright.customPoms.fixtures requires generation.playwright.fixtures to be enabled."
|
|
6781
|
+
);
|
|
6782
|
+
}
|
|
6783
|
+
if (componentGraphRoutes) {
|
|
6784
|
+
throw new VuePomGeneratorError(
|
|
6785
|
+
"generation.playwright.componentGraph requires generation.playwright.fixtures to be enabled."
|
|
6786
|
+
);
|
|
6787
|
+
}
|
|
6679
6788
|
return [];
|
|
6789
|
+
}
|
|
6680
6790
|
const defaultFixtureOutDirRel = pomOutDir;
|
|
6681
6791
|
const fixtureOutRel = typeof generateFixtures === "string" ? generateFixtures : typeof generateFixtures === "object" && generateFixtures?.outDir ? generateFixtures.outDir : defaultFixtureOutDirRel;
|
|
6682
6792
|
const looksLikeFilePath = fixtureOutRel.endsWith(".ts") || fixtureOutRel.endsWith(".tsx") || fixtureOutRel.endsWith(".mts") || fixtureOutRel.endsWith(".cts");
|
|
@@ -6735,6 +6845,42 @@ function maybeGenerateFixtureRegistry(componentHierarchyMap, options) {
|
|
|
6735
6845
|
fixtureName: lowerFirst(name),
|
|
6736
6846
|
ctorExpression: fixtureCtorExpression(name)
|
|
6737
6847
|
}));
|
|
6848
|
+
const takenFixtureNames = new Map([
|
|
6849
|
+
...[...reservedPlaywrightFixtureNames, "pomSetup", "pomFactory", "pomDiagnosticsSetup"].map((name) => [name, "a built-in Playwright or vue-pom-generator fixture"]),
|
|
6850
|
+
...fixtureClassNames.map((name) => [lowerFirst(name), `the generated fixture for "${name}"`])
|
|
6851
|
+
]);
|
|
6852
|
+
const customCtorEntries = customPomFixtures.map((className, index) => {
|
|
6853
|
+
if (customPomFixtures.indexOf(className) !== index) {
|
|
6854
|
+
throw new VuePomGeneratorError(
|
|
6855
|
+
`Custom POM fixture class "${className}" is listed more than once in generation.playwright.customPoms.fixtures.
|
|
6856
|
+
Remove the duplicate entry.`
|
|
6857
|
+
);
|
|
6858
|
+
}
|
|
6859
|
+
const filePath = path.join(customPomDirAbs, `${className}.ts`);
|
|
6860
|
+
if (!fs.existsSync(filePath)) {
|
|
6861
|
+
throw new VuePomGeneratorError(
|
|
6862
|
+
`Custom POM fixture class "${className}" was not found.
|
|
6863
|
+
Expected file: ${filePath}
|
|
6864
|
+
Add the file or remove "${className}" from generation.playwright.customPoms.fixtures.`
|
|
6865
|
+
);
|
|
6866
|
+
}
|
|
6867
|
+
const fixtureName = lowerFirst(className);
|
|
6868
|
+
const existingOwner = takenFixtureNames.get(fixtureName);
|
|
6869
|
+
if (existingOwner) {
|
|
6870
|
+
throw new VuePomGeneratorError(
|
|
6871
|
+
`Custom POM fixture "${fixtureName}" (from "${className}") collides with ${existingOwner}.
|
|
6872
|
+
Rename the class or remove it from generation.playwright.customPoms.fixtures.`
|
|
6873
|
+
);
|
|
6874
|
+
}
|
|
6875
|
+
takenFixtureNames.set(fixtureName, `the custom POM fixture for "${className}"`);
|
|
6876
|
+
return {
|
|
6877
|
+
className,
|
|
6878
|
+
fixtureName,
|
|
6879
|
+
ctorExpression: `${className}Custom`,
|
|
6880
|
+
importSpecifier: stripExtension(toPosixRelativePath(fixtureOutDirAbs, filePath))
|
|
6881
|
+
};
|
|
6882
|
+
});
|
|
6883
|
+
const hasCustomFixtures = customCtorEntries.length > 0;
|
|
6738
6884
|
const fixturesContent = renderSourceFile(fixtureFileName, (sourceFile) => {
|
|
6739
6885
|
sourceFile.addStatements("/** Generated Playwright fixtures (typed page objects). */");
|
|
6740
6886
|
addNamedImport(sourceFile, {
|
|
@@ -6774,6 +6920,12 @@ function maybeGenerateFixtureRegistry(componentHierarchyMap, options) {
|
|
|
6774
6920
|
namedImports: [{ name: entry.className, alias: entry.localIdentifier }]
|
|
6775
6921
|
});
|
|
6776
6922
|
}
|
|
6923
|
+
for (const entry of customCtorEntries) {
|
|
6924
|
+
addNamedImport(sourceFile, {
|
|
6925
|
+
moduleSpecifier: entry.importSpecifier,
|
|
6926
|
+
namedImports: [{ name: entry.className, alias: entry.ctorExpression }]
|
|
6927
|
+
});
|
|
6928
|
+
}
|
|
6777
6929
|
sourceFile.addInterface({
|
|
6778
6930
|
isExported: true,
|
|
6779
6931
|
name: "PlaywrightOptions",
|
|
@@ -6813,36 +6965,27 @@ function maybeGenerateFixtureRegistry(componentHierarchyMap, options) {
|
|
|
6813
6965
|
name: "PomDiagnosticsSetupFixture",
|
|
6814
6966
|
type: "{ pomDiagnosticsSetup: void }"
|
|
6815
6967
|
});
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
writer
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
writer.indent(() => {
|
|
6838
|
-
for (const entry of componentCtorEntries) {
|
|
6839
|
-
writer.writeLine(`${entry.fixtureName}: ${entry.ctorExpression},`);
|
|
6840
|
-
}
|
|
6841
|
-
});
|
|
6842
|
-
writer.write("} as const");
|
|
6843
|
-
}
|
|
6844
|
-
}]
|
|
6845
|
-
});
|
|
6968
|
+
const addCtorMap = (name, entries) => {
|
|
6969
|
+
sourceFile.addVariableStatement({
|
|
6970
|
+
declarationKind: VariableDeclarationKind.Const,
|
|
6971
|
+
declarations: [{
|
|
6972
|
+
name,
|
|
6973
|
+
initializer: (writer) => {
|
|
6974
|
+
writer.write("{").newLine();
|
|
6975
|
+
writer.indent(() => {
|
|
6976
|
+
for (const entry of entries) {
|
|
6977
|
+
writer.writeLine(`${entry.fixtureName}: ${entry.ctorExpression},`);
|
|
6978
|
+
}
|
|
6979
|
+
});
|
|
6980
|
+
writer.write("} as const");
|
|
6981
|
+
}
|
|
6982
|
+
}]
|
|
6983
|
+
});
|
|
6984
|
+
};
|
|
6985
|
+
addCtorMap("pageCtors", pageCtorEntries);
|
|
6986
|
+
addCtorMap("componentCtors", componentCtorEntries);
|
|
6987
|
+
if (hasCustomFixtures)
|
|
6988
|
+
addCtorMap("customCtors", customCtorEntries);
|
|
6846
6989
|
sourceFile.addTypeAlias({
|
|
6847
6990
|
isExported: true,
|
|
6848
6991
|
name: "GeneratedPageFixtures",
|
|
@@ -6853,13 +6996,20 @@ function maybeGenerateFixtureRegistry(componentHierarchyMap, options) {
|
|
|
6853
6996
|
name: "GeneratedComponentFixtures",
|
|
6854
6997
|
type: "{ [K in keyof typeof componentCtors]: InstanceType<(typeof componentCtors)[K]> }"
|
|
6855
6998
|
});
|
|
6999
|
+
if (hasCustomFixtures) {
|
|
7000
|
+
sourceFile.addTypeAlias({
|
|
7001
|
+
isExported: true,
|
|
7002
|
+
name: "CustomPomFixtures",
|
|
7003
|
+
type: "{ [K in keyof typeof customCtors]: InstanceType<(typeof customCtors)[K]> }"
|
|
7004
|
+
});
|
|
7005
|
+
}
|
|
6856
7006
|
sourceFile.addTypeAlias({
|
|
6857
7007
|
isExported: true,
|
|
6858
7008
|
name: "PomFixtures",
|
|
6859
7009
|
docs: [{
|
|
6860
|
-
description: "Every fixture contributed by the generator: the `animation` option, the internal\n`pomSetup`/`pomFactory` fixtures, and one fixture per generated page/component POM."
|
|
7010
|
+
description: "Every fixture contributed by the generator: the `animation` option, the internal\n`pomSetup`/`pomFactory` fixtures, and one fixture per generated page/component POM" + (hasCustomFixtures ? "\nand per configured custom POM." : ".")
|
|
6861
7011
|
}],
|
|
6862
|
-
type: "PlaywrightOptions & PomSetupFixture & PomFactoryFixture & PomDiagnosticsSetupFixture & GeneratedPageFixtures & GeneratedComponentFixtures"
|
|
7012
|
+
type: "PlaywrightOptions & PomSetupFixture & PomFactoryFixture & PomDiagnosticsSetupFixture & GeneratedPageFixtures & GeneratedComponentFixtures" + (hasCustomFixtures ? " & CustomPomFixtures" : "")
|
|
6863
7013
|
});
|
|
6864
7014
|
sourceFile.addFunction({
|
|
6865
7015
|
name: "makePomFixture",
|
|
@@ -6948,6 +7098,8 @@ function maybeGenerateFixtureRegistry(componentHierarchyMap, options) {
|
|
|
6948
7098
|
writer.writeLine("},");
|
|
6949
7099
|
writer.writeLine("...createPomFixtures(pageCtors),");
|
|
6950
7100
|
writer.writeLine("...createPomFixtures(componentCtors),");
|
|
7101
|
+
if (hasCustomFixtures)
|
|
7102
|
+
writer.writeLine("...createPomFixtures(customCtors),");
|
|
6951
7103
|
});
|
|
6952
7104
|
writer.write(") as TestType<TTestArgs & PomFixtures, TWorkerArgs>;");
|
|
6953
7105
|
}
|
|
@@ -6990,6 +7142,10 @@ function maybeGenerateFixtureRegistry(componentHierarchyMap, options) {
|
|
|
6990
7142
|
filePath: path.resolve(fixtureOutDirAbs, manifestFileName),
|
|
6991
7143
|
content: manifestContent
|
|
6992
7144
|
},
|
|
7145
|
+
...componentGraphRoutes ? [{
|
|
7146
|
+
filePath: path.resolve(fixtureOutDirAbs, "component-graph.json"),
|
|
7147
|
+
content: generateComponentGraphJson(componentHierarchyMap, componentGraphRoutes, root)
|
|
7148
|
+
}] : [],
|
|
6993
7149
|
diagnosticsRuntimeFile
|
|
6994
7150
|
];
|
|
6995
7151
|
}
|
|
@@ -6999,33 +7155,8 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
|
|
|
6999
7155
|
customPomAttachments = [],
|
|
7000
7156
|
testIdAttribute
|
|
7001
7157
|
} = options;
|
|
7002
|
-
const normalizeTrackedComponentRef = (value) => {
|
|
7003
|
-
return value.endsWith(".vue") ? value.slice(0, -4) : value;
|
|
7004
|
-
};
|
|
7005
|
-
const resolveTrackedComponentRef = (value) => {
|
|
7006
|
-
const normalizedValue = normalizeTrackedComponentRef(value);
|
|
7007
|
-
if (componentHierarchyMap.has(value)) {
|
|
7008
|
-
return value;
|
|
7009
|
-
}
|
|
7010
|
-
if (componentHierarchyMap.has(normalizedValue)) {
|
|
7011
|
-
return normalizedValue;
|
|
7012
|
-
}
|
|
7013
|
-
let match = null;
|
|
7014
|
-
for (const [candidateName, candidateDeps] of componentHierarchyMap.entries()) {
|
|
7015
|
-
const normalizedCandidate = normalizeTrackedComponentRef(candidateName);
|
|
7016
|
-
const candidateBaseName = path.parse(candidateDeps.filePath).name;
|
|
7017
|
-
if (normalizedCandidate !== normalizedValue && candidateBaseName !== normalizedValue) {
|
|
7018
|
-
continue;
|
|
7019
|
-
}
|
|
7020
|
-
if (match && match !== candidateName) {
|
|
7021
|
-
return null;
|
|
7022
|
-
}
|
|
7023
|
-
match = candidateName;
|
|
7024
|
-
}
|
|
7025
|
-
return match;
|
|
7026
|
-
};
|
|
7027
7158
|
const hasGeneratedPomSurface = (value, seen = /* @__PURE__ */ new Set()) => {
|
|
7028
|
-
const resolvedRef = resolveTrackedComponentRef(value);
|
|
7159
|
+
const resolvedRef = resolveTrackedComponentRef(value, componentHierarchyMap);
|
|
7029
7160
|
if (!resolvedRef || seen.has(resolvedRef)) {
|
|
7030
7161
|
return false;
|
|
7031
7162
|
}
|
|
@@ -7046,7 +7177,7 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
|
|
|
7046
7177
|
return toPascalCaseLocal(normalizeTrackedComponentRef(ref)) === ownClassName && ownClassName.length > 0;
|
|
7047
7178
|
};
|
|
7048
7179
|
const resolveComponentInstance = (spec) => {
|
|
7049
|
-
const componentRef = resolveTrackedComponentRef(spec.componentName);
|
|
7180
|
+
const componentRef = resolveTrackedComponentRef(spec.componentName, componentHierarchyMap);
|
|
7050
7181
|
if (!componentRef || isSelfReference(componentRef) || !hasGeneratedPomSurface(componentRef, /* @__PURE__ */ new Set([componentName]))) {
|
|
7051
7182
|
return null;
|
|
7052
7183
|
}
|
|
@@ -7155,7 +7286,7 @@ Move the repetition to the receiving component boundary so the generator can exp
|
|
|
7155
7286
|
const hasChildComponent = (needle) => {
|
|
7156
7287
|
const normalizedNeedle = normalizeTrackedComponentRef(needle);
|
|
7157
7288
|
for (const child of rawComponentRefsForInstances) {
|
|
7158
|
-
const resolvedChild = resolveTrackedComponentRef(child);
|
|
7289
|
+
const resolvedChild = resolveTrackedComponentRef(child, componentHierarchyMap);
|
|
7159
7290
|
if (normalizeTrackedComponentRef(child) === normalizedNeedle)
|
|
7160
7291
|
return true;
|
|
7161
7292
|
if (resolvedChild && normalizeTrackedComponentRef(resolvedChild) === normalizedNeedle)
|
|
@@ -8143,6 +8274,8 @@ function createBuildProcessorPlugin(options) {
|
|
|
8143
8274
|
requireCustomPomDir,
|
|
8144
8275
|
customPomImportAliases,
|
|
8145
8276
|
customPomImportNameCollisionBehavior,
|
|
8277
|
+
customPomFixtures,
|
|
8278
|
+
componentGraph,
|
|
8146
8279
|
testIdAttribute,
|
|
8147
8280
|
routerAwarePoms,
|
|
8148
8281
|
routerType,
|
|
@@ -8293,6 +8426,8 @@ function createBuildProcessorPlugin(options) {
|
|
|
8293
8426
|
requireCustomPomDir,
|
|
8294
8427
|
customPomImportAliases,
|
|
8295
8428
|
customPomImportNameCollisionBehavior,
|
|
8429
|
+
customPomFixtures,
|
|
8430
|
+
componentGraph,
|
|
8296
8431
|
testIdAttribute,
|
|
8297
8432
|
vueRouterFluentChaining: routerAwarePoms,
|
|
8298
8433
|
routerEntry: getResolvedRouterEntry(),
|
|
@@ -10673,6 +10808,8 @@ function createDevProcessorPlugin(options) {
|
|
|
10673
10808
|
requireCustomPomDir,
|
|
10674
10809
|
customPomImportAliases,
|
|
10675
10810
|
customPomImportNameCollisionBehavior,
|
|
10811
|
+
customPomFixtures,
|
|
10812
|
+
componentGraph,
|
|
10676
10813
|
nameCollisionBehavior,
|
|
10677
10814
|
missingSemanticNameBehavior,
|
|
10678
10815
|
existingIdBehavior,
|
|
@@ -10935,6 +11072,8 @@ function createDevProcessorPlugin(options) {
|
|
|
10935
11072
|
requireCustomPomDir,
|
|
10936
11073
|
customPomImportAliases,
|
|
10937
11074
|
customPomImportNameCollisionBehavior,
|
|
11075
|
+
customPomFixtures,
|
|
11076
|
+
componentGraph,
|
|
10938
11077
|
pageDirs: getPageDirs(),
|
|
10939
11078
|
componentDirs: getComponentDirs(),
|
|
10940
11079
|
layoutDirs: getLayoutDirs(),
|
|
@@ -11570,7 +11709,8 @@ function createGeneratorPlugins(options, generationOnly, projectRoot = process.c
|
|
|
11570
11709
|
const customPoms = generationOptions?.playwright?.customPoms;
|
|
11571
11710
|
const resolvedCustomPomAttachments = customPoms?.attachments ?? [];
|
|
11572
11711
|
const resolvedCustomPomImportAliases = customPoms?.importAliases;
|
|
11573
|
-
const
|
|
11712
|
+
const resolvedCustomPomFixtures = customPoms?.fixtures ?? [];
|
|
11713
|
+
const requireCustomPomDir = customPoms?.dir !== void 0 || resolvedCustomPomAttachments.length > 0 || resolvedCustomPomFixtures.length > 0 || Object.keys(resolvedCustomPomImportAliases ?? {}).length > 0;
|
|
11574
11714
|
const resolvedGenerationOptions = resolveGenerationSupportOptions({
|
|
11575
11715
|
outDir: generationOptions?.outDir,
|
|
11576
11716
|
emitLanguages: generationOptions?.emit,
|
|
@@ -11583,6 +11723,8 @@ function createGeneratorPlugins(options, generationOnly, projectRoot = process.c
|
|
|
11583
11723
|
requireCustomPomDir,
|
|
11584
11724
|
customPomImportAliases: resolvedCustomPomImportAliases,
|
|
11585
11725
|
customPomImportNameCollisionBehavior: customPoms?.importNameCollisionBehavior,
|
|
11726
|
+
customPomFixtures: resolvedCustomPomFixtures,
|
|
11727
|
+
componentGraph: generationOptions?.playwright?.componentGraph,
|
|
11586
11728
|
nameCollisionBehavior: generationOptions?.nameCollisionBehavior,
|
|
11587
11729
|
missingSemanticNameBehavior: generationOptions?.missingSemanticNameBehavior,
|
|
11588
11730
|
existingIdBehavior: resolvedInjectionOptions.existingIdBehavior,
|