@nx/devkit 18.3.2 → 18.3.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/devkit",
|
|
3
|
-
"version": "18.3.
|
|
3
|
+
"version": "18.3.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
|
|
6
6
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"tslib": "^2.3.0",
|
|
36
36
|
"semver": "^7.5.3",
|
|
37
37
|
"yargs-parser": "21.1.1",
|
|
38
|
-
"@nrwl/devkit": "18.3.
|
|
38
|
+
"@nrwl/devkit": "18.3.4"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"nx": ">= 16 <= 19"
|
|
@@ -2,3 +2,4 @@ export declare let dynamicImport: Function;
|
|
|
2
2
|
export declare function loadConfigFile<T extends object = any>(configFilePath: string): Promise<T>;
|
|
3
3
|
export declare function getRootTsConfigPath(): string | null;
|
|
4
4
|
export declare function getRootTsConfigFileName(): string | null;
|
|
5
|
+
export declare function clearRequireCache(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRootTsConfigFileName = exports.getRootTsConfigPath = exports.loadConfigFile = exports.dynamicImport = void 0;
|
|
3
|
+
exports.clearRequireCache = exports.getRootTsConfigFileName = exports.getRootTsConfigPath = exports.loadConfigFile = exports.dynamicImport = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const nx_1 = require("../../nx");
|
|
@@ -50,15 +50,25 @@ function getRootTsConfigFileName() {
|
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
52
|
exports.getRootTsConfigFileName = getRootTsConfigFileName;
|
|
53
|
+
const packageInstallationDirectories = [
|
|
54
|
+
`${path_1.sep}node_modules${path_1.sep}`,
|
|
55
|
+
`${path_1.sep}.yarn${path_1.sep}`,
|
|
56
|
+
];
|
|
57
|
+
function clearRequireCache() {
|
|
58
|
+
for (const k of Object.keys(require.cache)) {
|
|
59
|
+
if (!packageInstallationDirectories.some((dir) => k.includes(dir))) {
|
|
60
|
+
delete require.cache[k];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.clearRequireCache = clearRequireCache;
|
|
53
65
|
/**
|
|
54
66
|
* Load the module after ensuring that the require cache is cleared.
|
|
55
67
|
*/
|
|
56
68
|
async function load(path) {
|
|
57
69
|
// Clear cache if the path is in the cache
|
|
58
70
|
if (require.cache[path]) {
|
|
59
|
-
|
|
60
|
-
delete require.cache[k];
|
|
61
|
-
}
|
|
71
|
+
clearRequireCache();
|
|
62
72
|
}
|
|
63
73
|
try {
|
|
64
74
|
// Try using `require` first, which works for CJS modules.
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertNxExecutor = void 0;
|
|
4
4
|
const nx_1 = require("../../nx");
|
|
5
|
-
const
|
|
5
|
+
const package_json_1 = require("./package-json");
|
|
6
|
+
const semver_1 = require("semver");
|
|
7
|
+
const { Workspaces, readNxJsonFromDisk, retrieveProjectConfigurationsWithAngularProjects, readProjectConfigurationsFromRootMap, } = (0, nx_1.requireNx)();
|
|
6
8
|
/**
|
|
7
9
|
* Convert an Nx Executor into an Angular Devkit Builder
|
|
8
10
|
*
|
|
@@ -20,7 +22,20 @@ function convertNxExecutor(executor) {
|
|
|
20
22
|
const projectsConfigurations = retrieveProjectConfigurationsWithAngularProjects
|
|
21
23
|
? {
|
|
22
24
|
version: 2,
|
|
23
|
-
projects: await retrieveProjectConfigurationsWithAngularProjects(builderContext.workspaceRoot, nxJsonConfiguration).then((p) =>
|
|
25
|
+
projects: await retrieveProjectConfigurationsWithAngularProjects(builderContext.workspaceRoot, nxJsonConfiguration).then((p) => {
|
|
26
|
+
if (p.projectNodes) {
|
|
27
|
+
return p.projectNodes;
|
|
28
|
+
}
|
|
29
|
+
// v18.3.4 changed projects to be keyed by root
|
|
30
|
+
// rather than project name
|
|
31
|
+
if ((0, semver_1.lt)(package_json_1.NX_VERSION, '18.3.4')) {
|
|
32
|
+
return p.projects;
|
|
33
|
+
}
|
|
34
|
+
if (readProjectConfigurationsFromRootMap) {
|
|
35
|
+
return readProjectConfigurationsFromRootMap(p.projects);
|
|
36
|
+
}
|
|
37
|
+
throw new Error('Unable to successfully map Nx executor -> Angular Builder');
|
|
38
|
+
}),
|
|
24
39
|
}
|
|
25
40
|
: // TODO(v19): remove retrieveProjectConfigurations. This is to be backwards compatible with Nx 16.5 and below.
|
|
26
41
|
workspaces.readProjectsConfigurations({
|