nx 22.4.0-canary.20260112-6cca28c → 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/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
|
-
}
|