nx 22.4.0-beta.2 → 22.4.0-beta.4
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/bin/init-local.js +1 -1
- package/package.json +12 -12
- package/project.json +2 -2
- 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/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +2 -2
- package/src/native/index.js +48 -8
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- 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/plugins/js/lock-file/yarn-parser.d.ts.map +1 -1
- package/src/plugins/js/lock-file/yarn-parser.js +6 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts.map +1 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -14
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +4 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts.map +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +20 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target-project-locator.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/nx/src/plugins/js/project-graph/build-dependencies/target-project-locator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"target-project-locator.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/nx/src/plugins/js/project-graph/build-dependencies/target-project-locator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;AAO1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAYlE;;;;GAIG;AACH,KAAK,kBAAkB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AACrD,KAAK,0BAA0B,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;AAElE,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAcF,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAGjE;AAED,qBAAa,oBAAoB;IAc7B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAI9B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAnB7C,OAAO,CAAC,mBAAmB,CAAyC;IACpE,OAAO,CAAC,WAAW,CAAkD;IACrE,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,KAAK,CAAgD;IAC7D,OAAO,CAAC,kBAAkB,CAA6B;IACvD,OAAO,CAAC,yBAAyB,CAAoC;IACrE,OAAO,CAAC,gBAAgB,CAItB;gBAGiB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,EAC9C,aAAa,GAAE,MAAM,CACpC,MAAM,EACN,wBAAwB,CACpB,EACW,kBAAkB,GAAE,kBAA8C,EAClE,0BAA0B,GAAE,0BAA8D;IA8B7G;;;;;;OAMG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAsEnE;;;;;;OAMG;IACH,wBAAwB,CACtB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI;IAoEhB;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IAmB7D,iBAAiB,CACf,UAAU,EAAE,MAAM,GACjB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS;IA6B/D,6BAA6B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAehE,iCAAiC,CAC/B,eAAe,EAAE,MAAM,EACvB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,MAAM,GAAG,IAAI;IAgDhB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,UAAU;IAuBlB,OAAO,CAAC,2BAA2B;IAqDnC,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,2BAA2B;IAsBnC,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,wBAAwB;IAKhC;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;CA0DxB"}
|
|
@@ -16,16 +16,18 @@ const typescript_1 = require("../../utils/typescript");
|
|
|
16
16
|
* Use a shared cache to avoid repeated npm package resolution work within the TargetProjectLocator.
|
|
17
17
|
*/
|
|
18
18
|
const defaultNpmResolutionCache = new Map();
|
|
19
|
+
const defaultPackageJsonResolutionCache = new Map();
|
|
19
20
|
const experimentalNodeModules = new Set(['node:sqlite']);
|
|
20
21
|
function isBuiltinModuleImport(importExpr) {
|
|
21
22
|
const packageName = (0, get_package_name_from_import_path_1.getPackageNameFromImportPath)(importExpr);
|
|
22
23
|
return (0, node_module_1.isBuiltin)(packageName) || experimentalNodeModules.has(packageName);
|
|
23
24
|
}
|
|
24
25
|
class TargetProjectLocator {
|
|
25
|
-
constructor(nodes, externalNodes = {}, npmResolutionCache = defaultNpmResolutionCache) {
|
|
26
|
+
constructor(nodes, externalNodes = {}, npmResolutionCache = defaultNpmResolutionCache, packageJsonResolutionCache = defaultPackageJsonResolutionCache) {
|
|
26
27
|
this.nodes = nodes;
|
|
27
28
|
this.externalNodes = externalNodes;
|
|
28
29
|
this.npmResolutionCache = npmResolutionCache;
|
|
30
|
+
this.packageJsonResolutionCache = packageJsonResolutionCache;
|
|
29
31
|
this.projectRootMappings = (0, find_project_for_path_1.createProjectRootMappings)(this.nodes);
|
|
30
32
|
this.tsConfig = this.getRootTsConfig();
|
|
31
33
|
this.paths = this.tsConfig.config?.compilerOptions?.paths;
|
|
@@ -375,10 +377,18 @@ class TargetProjectLocator {
|
|
|
375
377
|
// The package.json is directly resolvable
|
|
376
378
|
const packageJsonPath = (0, resolve_relative_to_dir_1.resolveRelativeToDir)((0, node_path_1.join)(packageName, 'package.json'), relativeToDir);
|
|
377
379
|
if (packageJsonPath) {
|
|
380
|
+
if (this.packageJsonResolutionCache.has(packageJsonPath)) {
|
|
381
|
+
return this.packageJsonResolutionCache.get(packageJsonPath);
|
|
382
|
+
}
|
|
378
383
|
const parsedPackageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
|
|
379
384
|
if (parsedPackageJson.name && parsedPackageJson.version) {
|
|
385
|
+
this.packageJsonResolutionCache.set(packageJsonPath, parsedPackageJson);
|
|
380
386
|
return parsedPackageJson;
|
|
381
387
|
}
|
|
388
|
+
else {
|
|
389
|
+
this.packageJsonResolutionCache.set(packageJsonPath, null);
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
382
392
|
}
|
|
383
393
|
try {
|
|
384
394
|
// Resolve the main entry point of the package
|
|
@@ -386,15 +396,23 @@ class TargetProjectLocator {
|
|
|
386
396
|
let dir = (0, node_path_1.dirname)(pathOfFileInPackage);
|
|
387
397
|
while (dir !== (0, node_path_1.dirname)(dir)) {
|
|
388
398
|
const packageJsonPath = (0, node_path_1.join)(dir, 'package.json');
|
|
399
|
+
if (this.packageJsonResolutionCache.has(packageJsonPath)) {
|
|
400
|
+
return this.packageJsonResolutionCache.get(packageJsonPath);
|
|
401
|
+
}
|
|
389
402
|
try {
|
|
390
403
|
const parsedPackageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
|
|
391
404
|
// Ensure the package.json contains the "name" and "version" fields
|
|
392
405
|
if (parsedPackageJson.name && parsedPackageJson.version) {
|
|
406
|
+
this.packageJsonResolutionCache.set(packageJsonPath, parsedPackageJson);
|
|
393
407
|
return parsedPackageJson;
|
|
394
408
|
}
|
|
409
|
+
else {
|
|
410
|
+
this.packageJsonResolutionCache.set(packageJsonPath, null);
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
395
413
|
}
|
|
396
414
|
catch {
|
|
397
|
-
// Package.json
|
|
415
|
+
// Package.json is invalid, keep traversing
|
|
398
416
|
}
|
|
399
417
|
dir = (0, node_path_1.dirname)(dir);
|
|
400
418
|
}
|