nx 22.4.0-canary.20260109-0fe39b2 → 22.4.0-canary.20260113-246d4fd
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 +11 -11
- package/src/command-line/format/format.js +7 -7
- package/src/command-line/report/report.d.ts +6 -0
- package/src/command-line/report/report.d.ts.map +1 -1
- package/src/command-line/report/report.js +28 -1
- package/src/command-line/show/command-object.d.ts +1 -1
- package/src/command-line/show/command-object.d.ts.map +1 -1
- package/src/command-line/show/command-object.js +5 -4
- package/src/command-line/show/project.d.ts.map +1 -1
- package/src/command-line/show/project.js +26 -5
- package/src/plugins/js/lock-file/pnpm-parser.d.ts.map +1 -1
- package/src/plugins/js/lock-file/pnpm-parser.js +22 -8
- package/src/plugins/js/lock-file/utils/package-json.d.ts +0 -1
- package/src/plugins/js/lock-file/utils/package-json.d.ts.map +1 -1
- package/src/plugins/js/lock-file/utils/package-json.js +0 -8
- package/src/project-graph/plugins/isolation/plugin-pool.d.ts.map +1 -1
- package/src/project-graph/plugins/isolation/plugin-pool.js +77 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "22.4.0-canary.
|
|
3
|
+
"version": "22.4.0-canary.20260113-246d4fd",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
|
6
6
|
"repository": {
|
|
@@ -83,16 +83,16 @@
|
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
"optionalDependencies": {
|
|
86
|
-
"@nx/nx-darwin-arm64": "22.4.0-canary.
|
|
87
|
-
"@nx/nx-darwin-x64": "22.4.0-canary.
|
|
88
|
-
"@nx/nx-freebsd-x64": "22.4.0-canary.
|
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "22.4.0-canary.
|
|
90
|
-
"@nx/nx-linux-arm64-gnu": "22.4.0-canary.
|
|
91
|
-
"@nx/nx-linux-arm64-musl": "22.4.0-canary.
|
|
92
|
-
"@nx/nx-linux-x64-gnu": "22.4.0-canary.
|
|
93
|
-
"@nx/nx-linux-x64-musl": "22.4.0-canary.
|
|
94
|
-
"@nx/nx-win32-arm64-msvc": "22.4.0-canary.
|
|
95
|
-
"@nx/nx-win32-x64-msvc": "22.4.0-canary.
|
|
86
|
+
"@nx/nx-darwin-arm64": "22.4.0-canary.20260113-246d4fd",
|
|
87
|
+
"@nx/nx-darwin-x64": "22.4.0-canary.20260113-246d4fd",
|
|
88
|
+
"@nx/nx-freebsd-x64": "22.4.0-canary.20260113-246d4fd",
|
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "22.4.0-canary.20260113-246d4fd",
|
|
90
|
+
"@nx/nx-linux-arm64-gnu": "22.4.0-canary.20260113-246d4fd",
|
|
91
|
+
"@nx/nx-linux-arm64-musl": "22.4.0-canary.20260113-246d4fd",
|
|
92
|
+
"@nx/nx-linux-x64-gnu": "22.4.0-canary.20260113-246d4fd",
|
|
93
|
+
"@nx/nx-linux-x64-musl": "22.4.0-canary.20260113-246d4fd",
|
|
94
|
+
"@nx/nx-win32-arm64-msvc": "22.4.0-canary.20260113-246d4fd",
|
|
95
|
+
"@nx/nx-win32-x64-msvc": "22.4.0-canary.20260113-246d4fd"
|
|
96
96
|
},
|
|
97
97
|
"nx-migrations": {
|
|
98
98
|
"migrations": "./migrations.json",
|
|
@@ -45,7 +45,7 @@ async function format(command, args) {
|
|
|
45
45
|
sortTsConfig();
|
|
46
46
|
}
|
|
47
47
|
addRootConfigFiles(chunkList, nxArgs);
|
|
48
|
-
chunkList.forEach((chunk) => write(chunk));
|
|
48
|
+
chunkList.forEach((chunk) => write(prettier, chunk));
|
|
49
49
|
break;
|
|
50
50
|
case 'check': {
|
|
51
51
|
const filesWithDifferentFormatting = [];
|
|
@@ -140,14 +140,14 @@ function addRootConfigFiles(chunkList, nxArgs) {
|
|
|
140
140
|
function getPatternsFromProjects(projects, projectGraph) {
|
|
141
141
|
return (0, command_line_utils_1.getProjectRoots)(projects, projectGraph);
|
|
142
142
|
}
|
|
143
|
-
function write(patterns) {
|
|
143
|
+
function write(prettier, patterns) {
|
|
144
144
|
if (patterns.length > 0) {
|
|
145
145
|
const [swcrcPatterns, regularPatterns] = patterns.reduce((result, pattern) => {
|
|
146
146
|
result[pattern.includes('.swcrc') ? 0 : 1].push(pattern);
|
|
147
147
|
return result;
|
|
148
148
|
}, [[], []]);
|
|
149
149
|
const prettierPath = getPrettierPath();
|
|
150
|
-
const listDifferentArg = shouldUseListDifferent()
|
|
150
|
+
const listDifferentArg = shouldUseListDifferent(prettier.version)
|
|
151
151
|
? '--list-different '
|
|
152
152
|
: '';
|
|
153
153
|
(0, node_child_process_1.execSync)(`node "${prettierPath}" --write ${listDifferentArg}${regularPatterns.join(' ')}`, {
|
|
@@ -201,8 +201,8 @@ function getPrettierPath() {
|
|
|
201
201
|
if (prettierPath) {
|
|
202
202
|
return prettierPath;
|
|
203
203
|
}
|
|
204
|
-
const {
|
|
205
|
-
prettierPath =
|
|
204
|
+
const { packageJson, path: packageJsonPath } = (0, package_json_1.readModulePackageJson)('prettier');
|
|
205
|
+
prettierPath = path.resolve(path.dirname(packageJsonPath), packageJson.bin);
|
|
206
206
|
return prettierPath;
|
|
207
207
|
}
|
|
208
208
|
let useListDifferent;
|
|
@@ -210,11 +210,11 @@ let useListDifferent;
|
|
|
210
210
|
* Determines if --list-different should be used with --write.
|
|
211
211
|
* Prettier 4+ and 3.6.x with experimental CLI don't support combining these flags.
|
|
212
212
|
*/
|
|
213
|
-
function shouldUseListDifferent() {
|
|
213
|
+
function shouldUseListDifferent(prettierVersion) {
|
|
214
214
|
if (useListDifferent !== undefined) {
|
|
215
215
|
return useListDifferent;
|
|
216
216
|
}
|
|
217
|
-
const prettierMajor = (0, semver_1.major)(
|
|
217
|
+
const prettierMajor = (0, semver_1.major)(prettierVersion);
|
|
218
218
|
const isExperimentalCli = process.env.PRETTIER_EXPERIMENTAL_CLI === '1';
|
|
219
219
|
useListDifferent = prettierMajor < 4 && !isExperimentalCli;
|
|
220
220
|
return useListDifferent;
|
|
@@ -22,6 +22,12 @@ export interface ReportData {
|
|
|
22
22
|
localPlugins: string[];
|
|
23
23
|
communityPlugins: PackageJson[];
|
|
24
24
|
registeredPlugins: string[];
|
|
25
|
+
daemon: {
|
|
26
|
+
available: boolean;
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
} | {
|
|
29
|
+
error: unknown;
|
|
30
|
+
};
|
|
25
31
|
packageVersionsWeCareAbout: {
|
|
26
32
|
package: string;
|
|
27
33
|
version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/report/report.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,cAAc,EACf,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,WAAW,EAGZ,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,mBAAmB,EAAc,MAAM,sBAAsB,CAAC;AAUvE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/report/report.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,cAAc,EACf,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,WAAW,EAGZ,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,mBAAmB,EAAc,MAAM,sBAAsB,CAAC;AAUvE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAarC,eAAO,MAAM,mBAAmB,UAO/B,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAMpE,CAAC;AAIF;;;;;;;GAOG;AACH,wBAAsB,aAAa,kBA2MlC;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,cAAc,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,KAAK,GAAG,IAAI,CAAC;IACzB,gBAAgB,EAAE,WAAW,EAAE,CAAC;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,WAAW,EAAE,CAAC;IAChC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,MAAM,EACF;QACE,SAAS,EAAE,OAAO,CAAC;QACnB,QAAQ,EAAE,OAAO,CAAC;KACnB,GACD;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACvB,0BAA0B,EAAE;QAC1B,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,qBAAqB,CAAC,EAAE;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,kBAAkB,EAAE;YAClB,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;SACjB,EAAE,CAAC;QACJ,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,oBAAoB,CAAC,EAAE,KAAK,CAAC;QAC3B,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC,CAAC;IACH,iBAAiB,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACjC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI,CAAC;CACV;AAmED,wBAAsB,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,CAgEzD;AA4DD,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,WAAW,GAChB,SAAS,GAAG,qBAAqB,CAgCnC;AAED,wBAAgB,6BAA6B,IAAI,WAAW,EAAE,CAO7D;AAED,wBAAgB,6BAA6B,IAAI,WAAW,EAAE,CAW7D;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,mBAAmB,YAQzE;AAED,wBAAgB,gCAAgC;;;IAe/C"}
|
|
@@ -25,6 +25,7 @@ const operators_1 = require("../../project-graph/operators");
|
|
|
25
25
|
const versions_1 = require("../../utils/versions");
|
|
26
26
|
const nx_key_1 = require("../../utils/nx-key");
|
|
27
27
|
const cache_1 = require("../../tasks-runner/cache");
|
|
28
|
+
const client_1 = require("../../daemon/client/client");
|
|
28
29
|
const nxPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(__dirname, '../../../package.json'));
|
|
29
30
|
exports.packagesWeCareAbout = [
|
|
30
31
|
'lerna',
|
|
@@ -49,12 +50,22 @@ const LINE_SEPARATOR = '---------------------------------------';
|
|
|
49
50
|
*
|
|
50
51
|
*/
|
|
51
52
|
async function reportHandler() {
|
|
52
|
-
const { pm, pmVersion, nxKey, nxKeyError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, mismatchedNxVersions, projectGraphError, nativeTarget, cache, } = await getReportData();
|
|
53
|
+
const { pm, pmVersion, nxKey, nxKeyError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, mismatchedNxVersions, projectGraphError, nativeTarget, cache, daemon, } = await getReportData();
|
|
53
54
|
const fields = [
|
|
54
55
|
['Node', process.versions.node],
|
|
55
56
|
['OS', `${process.platform}-${process.arch}`],
|
|
56
57
|
['Native Target', nativeTarget ?? 'Unavailable'],
|
|
57
58
|
[pm, pmVersion],
|
|
59
|
+
[
|
|
60
|
+
'daemon',
|
|
61
|
+
'error' in daemon
|
|
62
|
+
? `Error: ${daemon.error}`
|
|
63
|
+
: daemon.disabled
|
|
64
|
+
? 'Disabled'
|
|
65
|
+
: daemon.available
|
|
66
|
+
? 'Available'
|
|
67
|
+
: 'Unavailable',
|
|
68
|
+
],
|
|
58
69
|
];
|
|
59
70
|
let padding = Math.max(...fields.map((f) => f[0].length));
|
|
60
71
|
const bodyLines = fields.map(([field, value]) => `${field.padEnd(padding)} : ${value}`);
|
|
@@ -271,8 +282,24 @@ async function getReportData() {
|
|
|
271
282
|
projectGraphError,
|
|
272
283
|
nativeTarget: native ? native.getBinaryTarget() : null,
|
|
273
284
|
cache,
|
|
285
|
+
daemon: await getDaemonStatus(),
|
|
274
286
|
};
|
|
275
287
|
}
|
|
288
|
+
async function getDaemonStatus() {
|
|
289
|
+
try {
|
|
290
|
+
const enabled = client_1.daemonClient.enabled();
|
|
291
|
+
const available = enabled && (await client_1.daemonClient.isServerAvailable());
|
|
292
|
+
return {
|
|
293
|
+
available,
|
|
294
|
+
disabled: !enabled,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
catch (e) {
|
|
298
|
+
return {
|
|
299
|
+
error: e,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
}
|
|
276
303
|
async function tryGetProjectGraph() {
|
|
277
304
|
try {
|
|
278
305
|
return { graph: await (0, project_graph_1.createProjectGraphAsync)() };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/show/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAQhD,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG;IAC7C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG;IAC5C,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/show/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAQhD,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG;IAC7C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,UAAU,CA6BX,CAAC"}
|
|
@@ -73,13 +73,13 @@ const showProjectsCommand = {
|
|
|
73
73
|
},
|
|
74
74
|
};
|
|
75
75
|
const showProjectCommand = {
|
|
76
|
-
command: 'project
|
|
77
|
-
describe: 'Shows resolved project configuration for a given project.',
|
|
76
|
+
command: 'project [projectName]',
|
|
77
|
+
describe: 'Shows resolved project configuration for a given project. If run within a project directory and no project name is provided, the project is inferred from the current working directory.',
|
|
78
78
|
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
|
79
79
|
.positional('projectName', {
|
|
80
80
|
type: 'string',
|
|
81
81
|
alias: 'p',
|
|
82
|
-
description: '
|
|
82
|
+
description: 'The project to show. If not provided, infers the project from the current working directory.',
|
|
83
83
|
})
|
|
84
84
|
.option('web', {
|
|
85
85
|
type: 'boolean',
|
|
@@ -104,7 +104,8 @@ const showProjectCommand = {
|
|
|
104
104
|
return true;
|
|
105
105
|
})
|
|
106
106
|
.example('$0 show project my-app', 'View project information for my-app in JSON format')
|
|
107
|
-
.example('$0 show project my-app --web', 'View project information for my-app in the browser')
|
|
107
|
+
.example('$0 show project my-app --web', 'View project information for my-app in the browser')
|
|
108
|
+
.example('$0 show project', 'View project information for the project in the current working directory'),
|
|
108
109
|
handler: async (args) => {
|
|
109
110
|
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose, async () => {
|
|
110
111
|
const { showProjectHandler } = await Promise.resolve().then(() => require('./project'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/show/project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/show/project.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAOtD,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,IAAI,CAAC,CAqHf"}
|
|
@@ -5,16 +5,37 @@ const output_1 = require("../../utils/output");
|
|
|
5
5
|
const project_graph_1 = require("../../project-graph/project-graph");
|
|
6
6
|
const graph_1 = require("../graph/graph");
|
|
7
7
|
const find_matching_projects_1 = require("../../utils/find-matching-projects");
|
|
8
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
|
9
|
+
const configuration_1 = require("../../config/configuration");
|
|
10
|
+
const calculate_default_project_name_1 = require("../../config/calculate-default-project-name");
|
|
8
11
|
async function showProjectHandler(args) {
|
|
9
12
|
performance.mark('code-loading:end');
|
|
10
13
|
performance.measure('code-loading', 'init-local', 'code-loading:end');
|
|
11
14
|
const graph = await (0, project_graph_1.createProjectGraphAsync)();
|
|
12
|
-
let
|
|
15
|
+
let projectName = args.projectName;
|
|
16
|
+
// If no project name is provided, try to infer from cwd
|
|
17
|
+
if (!projectName) {
|
|
18
|
+
const nxJson = (0, configuration_1.readNxJson)();
|
|
19
|
+
projectName = (0, calculate_default_project_name_1.calculateDefaultProjectName)(process.cwd(), workspace_root_1.workspaceRoot, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(graph), nxJson);
|
|
20
|
+
if (!projectName) {
|
|
21
|
+
output_1.output.error({
|
|
22
|
+
title: 'Could not find a project in the current working directory.',
|
|
23
|
+
bodyLines: [
|
|
24
|
+
`Please specify a project name using:`,
|
|
25
|
+
` nx show project <project-name>`,
|
|
26
|
+
``,
|
|
27
|
+
`Or run this command from within a project directory.`,
|
|
28
|
+
],
|
|
29
|
+
});
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let node = graph.nodes[projectName];
|
|
13
34
|
if (!node) {
|
|
14
|
-
const projects = (0, find_matching_projects_1.findMatchingProjects)([
|
|
35
|
+
const projects = (0, find_matching_projects_1.findMatchingProjects)([projectName], graph.nodes);
|
|
15
36
|
if (projects.length === 1) {
|
|
16
|
-
const
|
|
17
|
-
node = graph.nodes[
|
|
37
|
+
const matchedProjectName = projects[0];
|
|
38
|
+
node = graph.nodes[matchedProjectName];
|
|
18
39
|
}
|
|
19
40
|
else if (projects.length > 1) {
|
|
20
41
|
output_1.output.error({
|
|
@@ -27,7 +48,7 @@ async function showProjectHandler(args) {
|
|
|
27
48
|
process.exit(1);
|
|
28
49
|
}
|
|
29
50
|
else {
|
|
30
|
-
console.log(`Could not find project ${
|
|
51
|
+
console.log(`Could not find project ${projectName}`);
|
|
31
52
|
process.exit(1);
|
|
32
53
|
}
|
|
33
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pnpm-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/pnpm-parser.ts"],"names":[],"mappings":"AAYA,OAAO,
|
|
1
|
+
{"version":3,"file":"pnpm-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/pnpm-parser.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,yBAAyB,EAE1B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAwB3E,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAChD,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC;CACpD,CASA;AAED,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,yBAAyB,EAC9B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,wBAAwB,CAAC,CAAC,+BAUnD;AAqeD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,EACnB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,qBAAqB,EAClC,aAAa,EAAE,MAAM,GACpB,MAAM,CAuCR"}
|
|
@@ -41,13 +41,25 @@ function getPnpmLockfileDependencies(lockFileContent, lockFileHash, ctx, keyMap)
|
|
|
41
41
|
const isV5 = (0, pnpm_normalizer_1.isV5Syntax)(data);
|
|
42
42
|
return getDependencies(data, keyMap, isV5, ctx);
|
|
43
43
|
}
|
|
44
|
+
function invertRecordWithoutAliases(record) {
|
|
45
|
+
const result = {};
|
|
46
|
+
for (const [depName, depVersion] of Object.entries(record)) {
|
|
47
|
+
if (isAliasVersion(depVersion)) {
|
|
48
|
+
// Ignore alias specifiers so aliases do not replace actual package names
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
result[depVersion] = depName;
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
44
55
|
const cachedInvertedRecords = new Map();
|
|
45
56
|
function matchPropValue(record, key, originalPackageName, recordName) {
|
|
46
57
|
if (!record) {
|
|
47
58
|
return undefined;
|
|
48
59
|
}
|
|
49
60
|
if (!cachedInvertedRecords.has(recordName)) {
|
|
50
|
-
|
|
61
|
+
// Inversion is only for non-alias specs to avoid alias -> target mislabeling.
|
|
62
|
+
cachedInvertedRecords.set(recordName, invertRecordWithoutAliases(record));
|
|
51
63
|
}
|
|
52
64
|
const packageName = cachedInvertedRecords.get(recordName)[key];
|
|
53
65
|
if (packageName) {
|
|
@@ -117,6 +129,7 @@ function findPatchHash(patchEntriesByPackage, packageName, version) {
|
|
|
117
129
|
return nameOnlyMatch?.hash;
|
|
118
130
|
}
|
|
119
131
|
function getNodes(data, isV5) {
|
|
132
|
+
cachedInvertedRecords.clear();
|
|
120
133
|
const keyMap = new Map();
|
|
121
134
|
const nodes = new Map();
|
|
122
135
|
// Extract and pre-parse patch information from patchedDependencies section
|
|
@@ -160,8 +173,8 @@ function getNodes(data, isV5) {
|
|
|
160
173
|
}
|
|
161
174
|
}
|
|
162
175
|
const packageNames = new Set();
|
|
163
|
-
let packageNameObj;
|
|
164
176
|
for (const [key, snapshot] of Object.entries(data.packages)) {
|
|
177
|
+
let packageNameObj;
|
|
165
178
|
const originalPackageName = extractNameFromKey(key, isV5);
|
|
166
179
|
if (!originalPackageName) {
|
|
167
180
|
continue;
|
|
@@ -222,25 +235,26 @@ function getNodes(data, isV5) {
|
|
|
222
235
|
}
|
|
223
236
|
}
|
|
224
237
|
}
|
|
238
|
+
if (packageNameObj) {
|
|
239
|
+
packageNames.add(packageNameObj);
|
|
240
|
+
}
|
|
225
241
|
const aliasedDep = maybeAliasedPackageVersions.get(`/${key}`);
|
|
226
242
|
if (aliasedDep) {
|
|
227
|
-
|
|
243
|
+
packageNames.add({
|
|
228
244
|
key,
|
|
229
245
|
packageName: aliasedDep,
|
|
230
246
|
hash,
|
|
231
247
|
alias: true,
|
|
232
|
-
};
|
|
248
|
+
});
|
|
233
249
|
}
|
|
234
|
-
packageNames.add(packageNameObj);
|
|
235
250
|
const localAlias = maybeAliasedPackageVersions.get(key);
|
|
236
251
|
if (localAlias) {
|
|
237
|
-
|
|
252
|
+
packageNames.add({
|
|
238
253
|
key,
|
|
239
254
|
packageName: localAlias,
|
|
240
255
|
hash,
|
|
241
256
|
alias: true,
|
|
242
|
-
};
|
|
243
|
-
packageNames.add(packageNameObj);
|
|
257
|
+
});
|
|
244
258
|
}
|
|
245
259
|
}
|
|
246
260
|
for (const { key, packageName, hash, alias } of packageNames) {
|
|
@@ -8,5 +8,4 @@ export type NormalizedPackageJson = Pick<PackageJson, 'name' | 'version' | 'lice
|
|
|
8
8
|
* Strip off non-pruning related fields from package.json
|
|
9
9
|
*/
|
|
10
10
|
export declare function normalizePackageJson(packageJson: PackageJson): NormalizedPackageJson;
|
|
11
|
-
export declare function invertObject(record: Record<string, string>): Record<string, string>;
|
|
12
11
|
//# sourceMappingURL=package-json.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/nx/src/plugins/js/lock-file/utils/package-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAQpE;AAED,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,WAAW,EACT,MAAM,GACN,SAAS,GACT,SAAS,GACT,cAAc,GACd,iBAAiB,GACjB,kBAAkB,GAClB,sBAAsB,GACtB,sBAAsB,GACtB,gBAAgB,GAChB,aAAa,CAChB,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,GACvB,qBAAqB,CA0BvB
|
|
1
|
+
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/nx/src/plugins/js/lock-file/utils/package-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAQpE;AAED,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,WAAW,EACT,MAAM,GACN,SAAS,GACT,SAAS,GACT,cAAc,GACd,iBAAiB,GACjB,kBAAkB,GAClB,sBAAsB,GACtB,sBAAsB,GACtB,gBAAgB,GAChB,aAAa,CAChB,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,GACvB,qBAAqB,CA0BvB"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getHoistedPackageVersion = getHoistedPackageVersion;
|
|
4
4
|
exports.normalizePackageJson = normalizePackageJson;
|
|
5
|
-
exports.invertObject = invertObject;
|
|
6
5
|
const workspace_root_1 = require("../../../../utils/workspace-root");
|
|
7
6
|
const fileutils_1 = require("../../../../utils/fileutils");
|
|
8
7
|
/**
|
|
@@ -35,10 +34,3 @@ function normalizePackageJson(packageJson) {
|
|
|
35
34
|
resolutions,
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
|
-
function invertObject(record) {
|
|
39
|
-
const result = {};
|
|
40
|
-
Object.keys(record).forEach((key) => {
|
|
41
|
-
result[record[key]] = key;
|
|
42
|
-
});
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-pool.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/project-graph/plugins/isolation/plugin-pool.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-pool.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/project-graph/plugins/isolation/plugin-pool.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAO9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA4C1D,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,CAmGhD"}
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadRemoteNxPlugin = loadRemoteNxPlugin;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
|
-
const path = require("path");
|
|
6
5
|
const net_1 = require("net");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
// TODO (@AgentEnder): After scoped verbose logging is implemented, re-add verbose logs here.
|
|
8
|
+
// import { logger } from '../../utils/logger';
|
|
7
9
|
const socket_utils_1 = require("../../../daemon/socket-utils");
|
|
8
10
|
const consume_messages_from_socket_1 = require("../../../utils/consume-messages-from-socket");
|
|
9
|
-
const messaging_1 = require("./messaging");
|
|
10
11
|
const installation_directory_1 = require("../../../utils/installation-directory");
|
|
11
12
|
const resolve_plugin_1 = require("../resolve-plugin");
|
|
13
|
+
const messaging_1 = require("./messaging");
|
|
12
14
|
const cleanupFunctions = new Set();
|
|
13
15
|
const pluginNames = new Map();
|
|
14
16
|
const PLUGIN_TIMEOUT_HINT_TEXT = 'As a last resort, you can set NX_PLUGIN_NO_TIMEOUTS=true to bypass this timeout.';
|
|
@@ -60,6 +62,15 @@ async function loadRemoteNxPlugin(plugin, root, index) {
|
|
|
60
62
|
const exitHandler = createWorkerExitHandler(worker, pendingPromises);
|
|
61
63
|
const cleanupFunction = () => {
|
|
62
64
|
worker.off('exit', exitHandler);
|
|
65
|
+
// Unpipe streams to prevent hanging processes and release references
|
|
66
|
+
if (worker.stdout) {
|
|
67
|
+
worker.stdout.unpipe(process.stdout);
|
|
68
|
+
worker.stdout.destroy();
|
|
69
|
+
}
|
|
70
|
+
if (worker.stderr) {
|
|
71
|
+
worker.stderr.unpipe(process.stderr);
|
|
72
|
+
worker.stderr.destroy();
|
|
73
|
+
}
|
|
63
74
|
socket.destroy();
|
|
64
75
|
nxPluginWorkerCache.delete(cacheKey);
|
|
65
76
|
};
|
|
@@ -238,6 +249,13 @@ function createWorkerHandler(worker, pending, onload, onloadError, socket) {
|
|
|
238
249
|
}
|
|
239
250
|
function createWorkerExitHandler(worker, pendingPromises) {
|
|
240
251
|
return () => {
|
|
252
|
+
// Clean up piped streams when worker exits to prevent hanging
|
|
253
|
+
if (worker.stdout) {
|
|
254
|
+
worker.stdout.unpipe(process.stdout);
|
|
255
|
+
}
|
|
256
|
+
if (worker.stderr) {
|
|
257
|
+
worker.stderr.unpipe(process.stderr);
|
|
258
|
+
}
|
|
241
259
|
for (const [_, pendingPromise] of pendingPromises) {
|
|
242
260
|
pendingPromise.rejector(new Error(`Plugin worker ${pluginNames.get(worker) ?? worker.pid} exited unexpectedly with code ${worker.exitCode}`));
|
|
243
261
|
}
|
|
@@ -301,13 +319,56 @@ async function startPluginWorker(name) {
|
|
|
301
319
|
ipcPath,
|
|
302
320
|
name,
|
|
303
321
|
], {
|
|
304
|
-
stdio: '
|
|
322
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
305
323
|
env,
|
|
306
324
|
detached: true,
|
|
307
325
|
shell: false,
|
|
308
326
|
windowsHide: true,
|
|
309
327
|
});
|
|
328
|
+
// To make debugging easier and allow plugins to communicate things
|
|
329
|
+
// like performance metrics, we pipe the stdout/stderr of the worker
|
|
330
|
+
// to the main process.
|
|
331
|
+
// This adds one listener per plugin to a few events on process.stdout/stderr,
|
|
332
|
+
// so we need to increase the max listener count to avoid warnings.
|
|
333
|
+
//
|
|
334
|
+
// We originally used `inherit` for stdio, but that caused issues with
|
|
335
|
+
// some environments where the terminal was left in an inconsistent state
|
|
336
|
+
// that prevented `↑`/`↓` arrow keys from working correctly after Nx finished execution.
|
|
337
|
+
// Instead, they would print things like `^[[A`/`^[[B` to the terminal.
|
|
338
|
+
const stdoutMaxListeners = process.stdout.getMaxListeners();
|
|
339
|
+
const stderrMaxListeners = process.stderr.getMaxListeners();
|
|
340
|
+
if (stdoutMaxListeners !== 0) {
|
|
341
|
+
process.stdout.setMaxListeners(stdoutMaxListeners + 1);
|
|
342
|
+
}
|
|
343
|
+
if (stderrMaxListeners !== 0) {
|
|
344
|
+
process.stderr.setMaxListeners(stderrMaxListeners + 1);
|
|
345
|
+
}
|
|
346
|
+
worker.stdout.pipe(process.stdout);
|
|
347
|
+
worker.stderr.pipe(process.stderr);
|
|
348
|
+
// Unref the worker process so it doesn't prevent the parent from exiting.
|
|
349
|
+
// IMPORTANT: We must also unref the stdout/stderr streams. When streams are
|
|
350
|
+
// piped, they maintain internal references in Node's event loop. Without
|
|
351
|
+
// unreferencing them, the parent process will wait for the worker to exit
|
|
352
|
+
// even after worker.unref() is called. This causes e2e tests to hang on CI
|
|
353
|
+
// where test frameworks wait for all handles to be released.
|
|
354
|
+
//
|
|
355
|
+
// Although TypeScript types these as Readable/Writable, they are actually
|
|
356
|
+
// net.Socket instances at runtime. Node.js internally creates sockets for
|
|
357
|
+
// stdio pipes (see lib/internal/child_process.js createSocket function).
|
|
358
|
+
// Socket.unref() allows the event loop to exit if these are the only handles.
|
|
310
359
|
worker.unref();
|
|
360
|
+
if (worker.stdout instanceof net_1.Socket) {
|
|
361
|
+
worker.stdout.unref();
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
throw new Error(`Expected worker.stdout to be an instance of Socket, but got ${getTypeName(worker.stdout)}`);
|
|
365
|
+
}
|
|
366
|
+
if (worker.stderr instanceof net_1.Socket) {
|
|
367
|
+
worker.stderr.unref();
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
throw new Error(`Expected worker.stderr to be an instance of Socket, but got ${getTypeName(worker.stderr)}`);
|
|
371
|
+
}
|
|
311
372
|
let attempts = 0;
|
|
312
373
|
return new Promise((resolve, reject) => {
|
|
313
374
|
const id = setInterval(async () => {
|
|
@@ -346,3 +407,16 @@ function isServerAvailable(ipcPath) {
|
|
|
346
407
|
}
|
|
347
408
|
});
|
|
348
409
|
}
|
|
410
|
+
function getTypeName(u) {
|
|
411
|
+
if (u === null)
|
|
412
|
+
return 'null';
|
|
413
|
+
if (u === undefined)
|
|
414
|
+
return 'undefined';
|
|
415
|
+
if (typeof u !== 'object')
|
|
416
|
+
return typeof u;
|
|
417
|
+
if (Array.isArray(u)) {
|
|
418
|
+
const innerTypes = u.map((el) => getTypeName(el));
|
|
419
|
+
return `Array<${Array.from(new Set(innerTypes)).join('|')}>`;
|
|
420
|
+
}
|
|
421
|
+
return u.constructor?.name ?? 'unknown object';
|
|
422
|
+
}
|