@nx/nuxt 23.0.0-beta.17 → 23.0.0-beta.19
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/package.json +8 -8
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +50 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/nuxt",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nuxt plugin for Nx contains executors and generators for managing Nuxt applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -45,16 +45,16 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"tslib": "^2.3.0",
|
|
47
47
|
"@nuxt/kit": "^3.10.0 || ^4.0.0",
|
|
48
|
-
"@nx/devkit": "23.0.0-beta.
|
|
49
|
-
"@nx/js": "23.0.0-beta.
|
|
50
|
-
"@nx/eslint": "23.0.0-beta.
|
|
51
|
-
"@nx/vue": "23.0.0-beta.
|
|
52
|
-
"@nx/vite": "23.0.0-beta.
|
|
53
|
-
"@nx/vitest": "23.0.0-beta.
|
|
48
|
+
"@nx/devkit": "23.0.0-beta.19",
|
|
49
|
+
"@nx/js": "23.0.0-beta.19",
|
|
50
|
+
"@nx/eslint": "23.0.0-beta.19",
|
|
51
|
+
"@nx/vue": "23.0.0-beta.19",
|
|
52
|
+
"@nx/vite": "23.0.0-beta.19",
|
|
53
|
+
"@nx/vitest": "23.0.0-beta.19",
|
|
54
54
|
"semver": "^7.6.3"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"nx": "23.0.0-beta.
|
|
57
|
+
"nx": "23.0.0-beta.19"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@nuxt/schema": "^3.10.0 || ^4.0.0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/nuxt/src/plugins/plugin.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/nuxt/src/plugins/plugin.ts"],"names":[],"mappings":"AAOA,OAAO,EAML,aAAa,EAMd,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,iBAAiB,CAoDxD,CAAC;AAEF,eAAO,MAAM,aAAa,kCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -14,26 +14,41 @@ const targetsCache = new internal_1.PluginCache(cachePath);
|
|
|
14
14
|
exports.createNodes = [
|
|
15
15
|
'**/nuxt.config.{js,ts,mjs,mts,cjs,cts}',
|
|
16
16
|
async (files, options, context) => {
|
|
17
|
-
//TODO(@nrwl/nx-vue-reviewers): This should batch hashing like our other plugins.
|
|
18
17
|
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
19
18
|
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
20
19
|
const lockFileName = (0, js_1.getLockFileName)(packageManager);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const normalizedOptions = normalizeOptions(options);
|
|
21
|
+
try {
|
|
22
|
+
const { entries, preErrors } = await filterNuxtConfigs(files, context);
|
|
23
|
+
const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), normalizedOptions, context, entries.map(() => [lockFileName]));
|
|
24
|
+
let results = [];
|
|
25
|
+
let nodeErrors = [];
|
|
26
|
+
try {
|
|
27
|
+
results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, pmc, projectHashes[idx]), entries.map((e) => e.configFile), options, context);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
if (e instanceof devkit_1.AggregateCreateNodesError) {
|
|
31
|
+
results = e.partialResults ?? [];
|
|
32
|
+
nodeErrors = e.errors;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const allErrors = [...preErrors, ...nodeErrors];
|
|
39
|
+
if (allErrors.length > 0) {
|
|
40
|
+
throw new devkit_1.AggregateCreateNodesError(allErrors, results);
|
|
41
|
+
}
|
|
42
|
+
return results;
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
targetsCache.writeToDisk();
|
|
46
|
+
}
|
|
24
47
|
},
|
|
25
48
|
];
|
|
26
49
|
exports.createNodesV2 = exports.createNodes;
|
|
27
|
-
async function createNodesInternal(configFilePath, options, context, pmc,
|
|
50
|
+
async function createNodesInternal(configFilePath, options, context, pmc, hash) {
|
|
28
51
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
29
|
-
// Do not create a project if package.json and project.json isn't there.
|
|
30
|
-
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
31
|
-
if (!siblingFiles.includes('package.json') &&
|
|
32
|
-
!siblingFiles.includes('project.json')) {
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
options = normalizeOptions(options);
|
|
36
|
-
const hash = await (0, internal_1.calculateHashForCreateNodes)(projectRoot, options, context, [lockFileName]);
|
|
37
52
|
if (!targetsCache.has(hash)) {
|
|
38
53
|
targetsCache.set(hash, await buildNuxtTargets(configFilePath, projectRoot, options, context, pmc));
|
|
39
54
|
}
|
|
@@ -164,6 +179,28 @@ function normalizeOutputPath(outputPath, projectRoot) {
|
|
|
164
179
|
}
|
|
165
180
|
}
|
|
166
181
|
}
|
|
182
|
+
async function filterNuxtConfigs(configFiles, context) {
|
|
183
|
+
const preErrors = [];
|
|
184
|
+
const candidates = await Promise.all(configFiles.map(async (configFile) => {
|
|
185
|
+
try {
|
|
186
|
+
const projectRoot = (0, path_1.dirname)(configFile);
|
|
187
|
+
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
188
|
+
if (!siblingFiles.includes('package.json') &&
|
|
189
|
+
!siblingFiles.includes('project.json')) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
return { configFile, projectRoot };
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
preErrors.push([configFile, e]);
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
}));
|
|
199
|
+
return {
|
|
200
|
+
entries: candidates.filter((c) => c !== null),
|
|
201
|
+
preErrors,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
167
204
|
function normalizeOptions(options) {
|
|
168
205
|
options ??= {};
|
|
169
206
|
options.buildTargetName ??= 'build';
|