nx 18.2.0-beta.0 → 18.2.0-beta.2
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/LICENSE +1 -1
- package/package.json +12 -12
- package/schemas/nx-schema.json +32 -6
- package/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +3 -1
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +5 -0
- package/src/command-line/init/implementation/add-nx-to-nest.js +1 -1
- package/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +3 -1
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +7 -1
- package/src/command-line/init/implementation/utils.d.ts +2 -1
- package/src/command-line/init/implementation/utils.js +17 -3
- package/src/command-line/init/init-v1.js +2 -2
- package/src/config/nx-json.d.ts +2 -0
- package/src/core/graph/3rdpartylicenses.txt +1 -52
- package/src/core/graph/index.html +1 -1
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.js +3 -0
- package/src/plugins/js/index.js +1 -1
- package/src/project-graph/utils/project-configuration-utils.js +19 -2
- package/src/tasks-runner/cache.js +6 -3
- package/src/tasks-runner/task-orchestrator.js +7 -1
- package/src/utils/ignore.js +8 -1
- package/src/utils/nx-plugin.d.ts +2 -0
- package/src/utils/nx-plugin.js +18 -2
- package/src/utils/params.js +1 -1
- package/src/core/graph/polyfills.js +0 -1
@@ -1 +1 @@
|
|
1
|
-
(()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={id:e,loaded:!1,exports:{}};return r[e].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=r,e=[],o.O=(r,t,n,i)=>{if(!t){var l=1/0;for(f=0;f<e.length;f++){for(var[t,n,i]=e[f],a=!0,u=0;u<t.length;u++)(!1&i||l>=i)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(a=!1,i<l&&(l=i));if(a){e.splice(f--,1);var d=n();void 0!==d&&(r=d)}}return r}i=i||0;for(var f=e.length;f>0&&e[f-1][2]>i;f--)e[f]=e[f-1];e[f]=[t,n,i]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e={
|
1
|
+
(()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={id:e,loaded:!1,exports:{}};return r[e].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=r,e=[],o.O=(r,t,n,i)=>{if(!t){var l=1/0;for(f=0;f<e.length;f++){for(var[t,n,i]=e[f],a=!0,u=0;u<t.length;u++)(!1&i||l>=i)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(a=!1,i<l&&(l=i));if(a){e.splice(f--,1);var d=n();void 0!==d&&(r=d)}}return r}i=i||0;for(var f=e.length;f>0&&e[f-1][2]>i;f--)e[f]=e[f-1];e[f]=[t,n,i]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e={666:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var n,i,[l,a,u]=t,d=0;if(l.some((r=>0!==e[r]))){for(n in a)o.o(a,n)&&(o.m[n]=a[n]);if(u)var f=u(o)}for(r&&r(t);d<l.length;d++)i=l[d],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(f)},t=self.webpackChunk=self.webpackChunk||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();
|
package/src/core/graph/styles.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[
|
1
|
+
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[532],{22232:()=>{}},s=>{var e;e=22232,s(s.s=e)}]);
|
@@ -152,6 +152,9 @@ async function processFilesAndCreateAndSerializeProjectGraph() {
|
|
152
152
|
graphNodes = e.partialProjectConfigurationsResult;
|
153
153
|
projectConfigurationsError = e;
|
154
154
|
}
|
155
|
+
else {
|
156
|
+
throw e;
|
157
|
+
}
|
155
158
|
}
|
156
159
|
await processCollectedUpdatedAndDeletedFiles(graphNodes, updatedFileHashes, deletedFiles);
|
157
160
|
const g = await createAndSerializeProjectGraph(graphNodes);
|
package/src/plugins/js/index.js
CHANGED
@@ -53,7 +53,7 @@ const createDependencies = (_, ctx) => {
|
|
53
53
|
// lockfile may not exist yet
|
54
54
|
if (pluginConfig.analyzeLockfile &&
|
55
55
|
(0, lock_file_1.lockFileExists)(packageManager) &&
|
56
|
-
parsedLockFile) {
|
56
|
+
parsedLockFile.externalNodes) {
|
57
57
|
const lockFilePath = (0, path_1.join)(workspace_root_1.workspaceRoot, (0, lock_file_1.getLockFileName)(packageManager));
|
58
58
|
const lockFileContents = (0, fs_1.readFileSync)(lockFilePath).toString();
|
59
59
|
const lockFileHash = getLockFileHash(lockFileContents);
|
@@ -220,14 +220,31 @@ plugins) {
|
|
220
220
|
const results = [];
|
221
221
|
const errors = [];
|
222
222
|
// We iterate over plugins first - this ensures that plugins specified first take precedence.
|
223
|
-
for (const { plugin, options } of plugins) {
|
223
|
+
for (const { plugin, options, include, exclude } of plugins) {
|
224
224
|
const [pattern, createNodes] = plugin.createNodes ?? [];
|
225
225
|
const pluginResults = [];
|
226
226
|
perf_hooks_1.performance.mark(`${plugin.name}:createNodes - start`);
|
227
227
|
if (!pattern) {
|
228
228
|
continue;
|
229
229
|
}
|
230
|
-
const matchingConfigFiles =
|
230
|
+
const matchingConfigFiles = [];
|
231
|
+
for (const file of workspaceFiles) {
|
232
|
+
if ((0, minimatch_1.minimatch)(file, pattern, { dot: true })) {
|
233
|
+
if (include) {
|
234
|
+
const included = include.some((includedPattern) => (0, minimatch_1.minimatch)(file, includedPattern, { dot: true }));
|
235
|
+
if (!included) {
|
236
|
+
continue;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
if (exclude) {
|
240
|
+
const excluded = include.some((excludedPattern) => (0, minimatch_1.minimatch)(file, excludedPattern, { dot: true }));
|
241
|
+
if (excluded) {
|
242
|
+
continue;
|
243
|
+
}
|
244
|
+
}
|
245
|
+
matchingConfigFiles.push(file);
|
246
|
+
}
|
247
|
+
}
|
231
248
|
for (const file of matchingConfigFiles) {
|
232
249
|
perf_hooks_1.performance.mark(`${plugin.name}:createNodes:${file} - start`);
|
233
250
|
try {
|
@@ -215,18 +215,21 @@ class Cache {
|
|
215
215
|
}
|
216
216
|
tryAndRetry(fn) {
|
217
217
|
let attempts = 0;
|
218
|
-
const baseTimeout =
|
218
|
+
const baseTimeout = 5;
|
219
|
+
// Generate a random number between 2 and 4 to raise to the power of attempts
|
220
|
+
const baseExponent = Math.random() * 2 + 2;
|
219
221
|
const _try = async () => {
|
220
222
|
try {
|
221
223
|
attempts++;
|
222
224
|
return await fn();
|
223
225
|
}
|
224
226
|
catch (e) {
|
225
|
-
|
227
|
+
// Max time is 5 * 4^3 = 20480ms
|
228
|
+
if (attempts === 6) {
|
226
229
|
// After enough attempts, throw the error
|
227
230
|
throw e;
|
228
231
|
}
|
229
|
-
await new Promise((res) => setTimeout(res,
|
232
|
+
await new Promise((res) => setTimeout(res, baseExponent ** attempts));
|
230
233
|
return await _try();
|
231
234
|
}
|
232
235
|
};
|
@@ -200,7 +200,7 @@ class TaskOrchestrator {
|
|
200
200
|
// obtain metadata
|
201
201
|
const temporaryOutputPath = this.cache.temporaryOutputPath(task);
|
202
202
|
const streamOutput = (0, utils_1.shouldStreamOutput)(task, this.initiatingProject);
|
203
|
-
|
203
|
+
let env = pipeOutput
|
204
204
|
? (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, process.env.FORCE_COLOR === undefined
|
205
205
|
? 'true'
|
206
206
|
: process.env.FORCE_COLOR, this.options.skipNxCache, this.options.captureStderr, null, null)
|
@@ -216,6 +216,12 @@ class TaskOrchestrator {
|
|
216
216
|
const { schema } = (0, utils_1.getExecutorForTask)(task, this.projectGraph);
|
217
217
|
const isRunOne = this.initiatingProject != null;
|
218
218
|
const combinedOptions = (0, params_1.combineOptionsForExecutor)(task.overrides, task.target.configuration ?? targetConfiguration.defaultConfiguration, targetConfiguration, schema, task.target.project, (0, path_1.relative)(task.projectRoot ?? workspace_root_1.workspaceRoot, process.cwd()), process.env.NX_VERBOSE_LOGGING === 'true');
|
219
|
+
if (combinedOptions.env) {
|
220
|
+
env = {
|
221
|
+
...env,
|
222
|
+
...combinedOptions.env,
|
223
|
+
};
|
224
|
+
}
|
219
225
|
if (streamOutput) {
|
220
226
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
221
227
|
output_1.output.logCommand(args.join(' '));
|
package/src/utils/ignore.js
CHANGED
@@ -27,7 +27,14 @@ function getIgnoredGlobs(root = workspace_root_1.workspaceRoot, prependRoot = tr
|
|
27
27
|
}
|
28
28
|
exports.getIgnoredGlobs = getIgnoredGlobs;
|
29
29
|
function getAlwaysIgnore(root) {
|
30
|
-
const paths = [
|
30
|
+
const paths = [
|
31
|
+
'node_modules',
|
32
|
+
'**/node_modules',
|
33
|
+
'.git',
|
34
|
+
'.nx',
|
35
|
+
'.vscode',
|
36
|
+
'.yarn/cache',
|
37
|
+
];
|
31
38
|
return root ? paths.map((x) => (0, path_1.joinPathFragments)(root, x)) : paths;
|
32
39
|
}
|
33
40
|
exports.getAlwaysIgnore = getAlwaysIgnore;
|
package/src/utils/nx-plugin.d.ts
CHANGED
@@ -91,6 +91,8 @@ export type NxPlugin = NxPluginV1 | NxPluginV2;
|
|
91
91
|
export type LoadedNxPlugin = {
|
92
92
|
plugin: NxPluginV2 & Pick<NxPluginV1, 'processProjectGraph'>;
|
93
93
|
options?: unknown;
|
94
|
+
include?: string[];
|
95
|
+
exclude?: string[];
|
94
96
|
};
|
95
97
|
export declare const nxPluginCache: Map<string, LoadedNxPlugin['plugin']>;
|
96
98
|
export declare function getPluginPathAndName(moduleName: string, paths: string[], projects: Record<string, ProjectConfiguration>, root: string): {
|
package/src/utils/nx-plugin.js
CHANGED
@@ -71,8 +71,19 @@ async function loadNxPluginAsync(pluginConfiguration, paths, projects, root) {
|
|
71
71
|
? pluginConfiguration
|
72
72
|
: { plugin: pluginConfiguration, options: undefined };
|
73
73
|
let pluginModule = exports.nxPluginCache.get(moduleName);
|
74
|
+
const include = typeof pluginConfiguration === 'object'
|
75
|
+
? pluginConfiguration.include
|
76
|
+
: undefined;
|
77
|
+
const exclude = typeof pluginConfiguration === 'object'
|
78
|
+
? pluginConfiguration.exclude
|
79
|
+
: undefined;
|
74
80
|
if (pluginModule) {
|
75
|
-
return {
|
81
|
+
return {
|
82
|
+
plugin: pluginModule,
|
83
|
+
options,
|
84
|
+
include,
|
85
|
+
exclude,
|
86
|
+
};
|
76
87
|
}
|
77
88
|
performance.mark(`Load Nx Plugin: ${moduleName} - start`);
|
78
89
|
let { pluginPath, name } = await getPluginPathAndName(moduleName, paths, projects, root);
|
@@ -81,7 +92,12 @@ async function loadNxPluginAsync(pluginConfiguration, paths, projects, root) {
|
|
81
92
|
exports.nxPluginCache.set(moduleName, plugin);
|
82
93
|
performance.mark(`Load Nx Plugin: ${moduleName} - end`);
|
83
94
|
performance.measure(`Load Nx Plugin: ${moduleName}`, `Load Nx Plugin: ${moduleName} - start`, `Load Nx Plugin: ${moduleName} - end`);
|
84
|
-
return {
|
95
|
+
return {
|
96
|
+
plugin,
|
97
|
+
options,
|
98
|
+
include,
|
99
|
+
exclude,
|
100
|
+
};
|
85
101
|
}
|
86
102
|
exports.loadNxPluginAsync = loadNxPluginAsync;
|
87
103
|
async function loadNxPlugins(plugins, paths = (0, installation_directory_1.getNxRequirePaths)(), root = workspace_root_1.workspaceRoot, projects) {
|
package/src/utils/params.js
CHANGED
@@ -205,7 +205,7 @@ function validateObject(opts, schema, definitions) {
|
|
205
205
|
if (schema.additionalProperties !== undefined &&
|
206
206
|
schema.additionalProperties !== true) {
|
207
207
|
Object.keys(opts).find((p) => {
|
208
|
-
if (Object.keys(schema.properties).indexOf(p) === -1 &&
|
208
|
+
if (Object.keys(schema.properties ?? {}).indexOf(p) === -1 &&
|
209
209
|
(!schema.patternProperties ||
|
210
210
|
!Object.keys(schema.patternProperties).some((pattern) => new RegExp(pattern).test(p)))) {
|
211
211
|
if (p === '_') {
|