nx 16.8.0-beta.3 → 16.8.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/package.json +13 -13
- package/src/command-line/generate/generate.js +1 -1
- package/src/command-line/watch/watch.d.ts +12 -0
- package/src/command-line/watch/watch.js +38 -24
- package/src/config/nx-json.d.ts +1 -0
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/polyfills.js +1 -1
- package/src/hasher/file-hasher.d.ts +1 -0
- package/src/hasher/file-hasher.js +11 -1
- package/src/hasher/task-hasher.js +1 -1
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +3 -0
- package/src/plugins/js/index.d.ts +4 -2
- package/src/plugins/js/index.js +68 -69
- package/src/plugins/js/lock-file/lock-file.d.ts +9 -10
- package/src/plugins/js/lock-file/lock-file.js +45 -59
- package/src/plugins/js/lock-file/npm-parser.d.ts +4 -3
- package/src/plugins/js/lock-file/npm-parser.js +63 -25
- package/src/plugins/js/lock-file/pnpm-parser.d.ts +4 -3
- package/src/plugins/js/lock-file/pnpm-parser.js +43 -14
- package/src/plugins/js/lock-file/yarn-parser.d.ts +4 -3
- package/src/plugins/js/lock-file/yarn-parser.js +43 -12
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +3 -3
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +5 -14
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +3 -4
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +18 -13
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +3 -8
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +16 -27
- package/src/plugins/js/utils/config.d.ts +2 -0
- package/src/plugins/js/utils/config.js +58 -0
- package/src/project-graph/utils/project-configuration-utils.js +1 -5
- package/src/project-graph/utils/retrieve-workspace-files.js +5 -1
- package/src/utils/nx-plugin.d.ts +1 -1
- package/src/utils/nx-plugin.js +33 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "16.8.0-beta.
|
|
3
|
+
"version": "16.8.0-beta.4",
|
|
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": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://nx.dev",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nrwl/tao": "16.8.0-beta.
|
|
35
|
+
"@nrwl/tao": "16.8.0-beta.4",
|
|
36
36
|
"@parcel/watcher": "2.0.4",
|
|
37
37
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
38
38
|
"@yarnpkg/parsers": "3.0.0-rc.46",
|
|
@@ -82,16 +82,16 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"optionalDependencies": {
|
|
85
|
-
"@nx/nx-darwin-arm64": "16.8.0-beta.
|
|
86
|
-
"@nx/nx-darwin-x64": "16.8.0-beta.
|
|
87
|
-
"@nx/nx-freebsd-x64": "16.8.0-beta.
|
|
88
|
-
"@nx/nx-linux-arm-gnueabihf": "16.8.0-beta.
|
|
89
|
-
"@nx/nx-linux-arm64-gnu": "16.8.0-beta.
|
|
90
|
-
"@nx/nx-linux-arm64-musl": "16.8.0-beta.
|
|
91
|
-
"@nx/nx-linux-x64-gnu": "16.8.0-beta.
|
|
92
|
-
"@nx/nx-linux-x64-musl": "16.8.0-beta.
|
|
93
|
-
"@nx/nx-win32-arm64-msvc": "16.8.0-beta.
|
|
94
|
-
"@nx/nx-win32-x64-msvc": "16.8.0-beta.
|
|
85
|
+
"@nx/nx-darwin-arm64": "16.8.0-beta.4",
|
|
86
|
+
"@nx/nx-darwin-x64": "16.8.0-beta.4",
|
|
87
|
+
"@nx/nx-freebsd-x64": "16.8.0-beta.4",
|
|
88
|
+
"@nx/nx-linux-arm-gnueabihf": "16.8.0-beta.4",
|
|
89
|
+
"@nx/nx-linux-arm64-gnu": "16.8.0-beta.4",
|
|
90
|
+
"@nx/nx-linux-arm64-musl": "16.8.0-beta.4",
|
|
91
|
+
"@nx/nx-linux-x64-gnu": "16.8.0-beta.4",
|
|
92
|
+
"@nx/nx-linux-x64-musl": "16.8.0-beta.4",
|
|
93
|
+
"@nx/nx-win32-arm64-msvc": "16.8.0-beta.4",
|
|
94
|
+
"@nx/nx-win32-x64-msvc": "16.8.0-beta.4"
|
|
95
95
|
},
|
|
96
96
|
"nx-migrations": {
|
|
97
97
|
"migrations": "./migrations.json",
|
|
@@ -178,5 +178,5 @@
|
|
|
178
178
|
},
|
|
179
179
|
"main": "./bin/nx.js",
|
|
180
180
|
"type": "commonjs",
|
|
181
|
-
"gitHead": "
|
|
181
|
+
"gitHead": "c9aad2dc8c2b34531cf61549bff872e68c481e4e"
|
|
182
182
|
}
|
|
@@ -230,7 +230,7 @@ function generate(cwd, args) {
|
|
|
230
230
|
logger_1.logger.warn([
|
|
231
231
|
`${logger_1.NX_PREFIX}: ${opts.collectionName}:${normalizedGeneratorName} is deprecated`,
|
|
232
232
|
`${deprecated}`,
|
|
233
|
-
].join('
|
|
233
|
+
].join('\n'));
|
|
234
234
|
}
|
|
235
235
|
if (!opts.quiet && !opts.help) {
|
|
236
236
|
logger_1.logger.info(`NX Generating ${opts.collectionName}:${normalizedGeneratorName}`);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChangedFile } from '../../daemon/client/client';
|
|
1
2
|
export interface WatchArguments {
|
|
2
3
|
projects?: string[];
|
|
3
4
|
all?: boolean;
|
|
@@ -8,4 +9,15 @@ export interface WatchArguments {
|
|
|
8
9
|
projectNameEnvName?: string;
|
|
9
10
|
fileChangesEnvName?: string;
|
|
10
11
|
}
|
|
12
|
+
export declare class BatchFunctionRunner {
|
|
13
|
+
private callback;
|
|
14
|
+
private running;
|
|
15
|
+
private pendingProjects;
|
|
16
|
+
private pendingFiles;
|
|
17
|
+
protected get _verbose(): boolean;
|
|
18
|
+
private get hasPending();
|
|
19
|
+
constructor(callback: (projects: Set<string>, files: Set<string>) => Promise<unknown>);
|
|
20
|
+
enqueue(projectNames: string[], fileChanges: ChangedFile[]): Promise<void>;
|
|
21
|
+
private process;
|
|
22
|
+
}
|
|
11
23
|
export declare function watch(args: WatchArguments): Promise<void>;
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.watch = void 0;
|
|
3
|
+
exports.watch = exports.BatchFunctionRunner = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
const client_1 = require("../../daemon/client/client");
|
|
7
7
|
const output_1 = require("../../utils/output");
|
|
8
8
|
const DEFAULT_PROJECT_NAME_ENV = 'NX_PROJECT_NAME';
|
|
9
9
|
const DEFAULT_FILE_CHANGES_ENV = 'NX_FILE_CHANGES';
|
|
10
|
-
class
|
|
10
|
+
class BatchFunctionRunner {
|
|
11
11
|
get _verbose() {
|
|
12
12
|
return process.env.NX_VERBOSE_LOGGING === 'true';
|
|
13
13
|
}
|
|
14
14
|
get hasPending() {
|
|
15
15
|
return this.pendingProjects.size > 0 || this.pendingFiles.size > 0;
|
|
16
16
|
}
|
|
17
|
-
constructor(
|
|
18
|
-
this.
|
|
19
|
-
this.projectNameEnv = projectNameEnv;
|
|
20
|
-
this.fileChangesEnv = fileChangesEnv;
|
|
17
|
+
constructor(callback) {
|
|
18
|
+
this.callback = callback;
|
|
21
19
|
this.running = false;
|
|
22
20
|
this.pendingProjects = new Set();
|
|
23
21
|
this.pendingFiles = new Set();
|
|
@@ -35,50 +33,62 @@ class BatchCommandRunner {
|
|
|
35
33
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
34
|
if (!this.running && this.hasPending) {
|
|
37
35
|
this.running = true;
|
|
38
|
-
//
|
|
39
|
-
const
|
|
40
|
-
this.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
// Clone the pending projects and files before clearing
|
|
37
|
+
const projects = new Set(this.pendingProjects);
|
|
38
|
+
const files = new Set(this.pendingFiles);
|
|
39
|
+
// Clear the pending projects and files
|
|
40
|
+
this.pendingProjects.clear();
|
|
41
|
+
this.pendingFiles.clear();
|
|
42
|
+
return this.callback(projects, files).then(() => {
|
|
44
43
|
this.running = false;
|
|
45
|
-
this._verbose &&
|
|
46
|
-
output_1.output.logSingleLine('running complete, processing the next batch');
|
|
47
44
|
this.process();
|
|
48
45
|
});
|
|
49
46
|
}
|
|
50
47
|
else {
|
|
51
48
|
this._verbose &&
|
|
52
49
|
this.running &&
|
|
53
|
-
output_1.output.logSingleLine('waiting for
|
|
50
|
+
output_1.output.logSingleLine('waiting for function to finish executing');
|
|
54
51
|
this._verbose &&
|
|
55
52
|
!this.hasPending &&
|
|
56
|
-
output_1.output.logSingleLine('no more
|
|
53
|
+
output_1.output.logSingleLine('no more function to process');
|
|
57
54
|
}
|
|
58
55
|
});
|
|
59
56
|
}
|
|
60
|
-
|
|
57
|
+
}
|
|
58
|
+
exports.BatchFunctionRunner = BatchFunctionRunner;
|
|
59
|
+
class BatchCommandRunner extends BatchFunctionRunner {
|
|
60
|
+
constructor(command, projectNameEnv = DEFAULT_PROJECT_NAME_ENV, fileChangesEnv = DEFAULT_FILE_CHANGES_ENV) {
|
|
61
|
+
super((projects, files) => {
|
|
62
|
+
// process all pending commands together
|
|
63
|
+
const envs = this.createCommandEnvironments(projects, files);
|
|
64
|
+
return this.run(envs);
|
|
65
|
+
});
|
|
66
|
+
this.command = command;
|
|
67
|
+
this.projectNameEnv = projectNameEnv;
|
|
68
|
+
this.fileChangesEnv = fileChangesEnv;
|
|
69
|
+
}
|
|
70
|
+
createCommandEnvironments(projects, files) {
|
|
61
71
|
const commandsToRun = [];
|
|
62
|
-
if (
|
|
63
|
-
|
|
72
|
+
if (projects.size > 0) {
|
|
73
|
+
projects.forEach((projectName) => {
|
|
64
74
|
commandsToRun.push({
|
|
65
75
|
[this.projectNameEnv]: projectName,
|
|
66
|
-
[this.fileChangesEnv]: Array.from(
|
|
76
|
+
[this.fileChangesEnv]: Array.from(files).join(' '),
|
|
67
77
|
});
|
|
68
78
|
});
|
|
69
79
|
}
|
|
70
80
|
else {
|
|
71
81
|
commandsToRun.push({
|
|
72
82
|
[this.projectNameEnv]: '',
|
|
73
|
-
[this.fileChangesEnv]: Array.from(
|
|
83
|
+
[this.fileChangesEnv]: Array.from(files).join(' '),
|
|
74
84
|
});
|
|
75
85
|
}
|
|
76
|
-
this.pendingProjects.clear();
|
|
77
|
-
this.pendingFiles.clear();
|
|
78
86
|
return commandsToRun;
|
|
79
87
|
}
|
|
80
88
|
run(envs) {
|
|
81
89
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
this._verbose &&
|
|
91
|
+
output_1.output.logSingleLine('about to run commands with these environments: ' + JSON.stringify(envs));
|
|
82
92
|
return Promise.all(envs.map((env) => {
|
|
83
93
|
return new Promise((resolve, reject) => {
|
|
84
94
|
const commandExec = (0, child_process_1.spawn)(this.command, {
|
|
@@ -94,7 +104,11 @@ class BatchCommandRunner {
|
|
|
94
104
|
resolve();
|
|
95
105
|
});
|
|
96
106
|
});
|
|
97
|
-
}))
|
|
107
|
+
})).then((r) => {
|
|
108
|
+
this._verbose &&
|
|
109
|
+
output_1.output.logSingleLine('running complete, processing the next batch');
|
|
110
|
+
return r;
|
|
111
|
+
});
|
|
98
112
|
});
|
|
99
113
|
}
|
|
100
114
|
}
|
package/src/config/nx-json.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type TargetDependencies = Record<string, (TargetDependencyConfig | string
|
|
|
17
17
|
export interface NrwlJsPluginConfig {
|
|
18
18
|
analyzeSourceFiles?: boolean;
|
|
19
19
|
analyzePackageJson?: boolean;
|
|
20
|
+
analyzeLockfile?: boolean;
|
|
20
21
|
}
|
|
21
22
|
interface NxInstallationConfiguration {
|
|
22
23
|
/**
|