nx 19.4.0 → 19.5.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/package.json +30 -26
  2. package/src/command-line/graph/graph.js +7 -2
  3. package/src/command-line/reset/reset.js +1 -1
  4. package/src/command-line/watch/watch.js +6 -0
  5. package/src/commands-runner/create-command-graph.js +32 -10
  6. package/src/core/graph/main.js +1 -1
  7. package/src/core/graph/styles.css +1 -1
  8. package/src/daemon/client/client.d.ts +1 -0
  9. package/src/daemon/client/client.js +14 -2
  10. package/src/devkit-exports.d.ts +1 -0
  11. package/src/devkit-exports.js +3 -1
  12. package/src/native/browser.js +1 -0
  13. package/src/native/index.d.ts +178 -138
  14. package/src/native/index.js +16 -0
  15. package/src/native/native-bindings.js +352 -238
  16. package/src/native/nx.wasi-browser.js +108 -0
  17. package/src/native/nx.wasi.cjs +139 -0
  18. package/src/native/nx.wasm32-wasi.wasm +0 -0
  19. package/src/native/wasi-worker-browser.mjs +32 -0
  20. package/src/native/wasi-worker.mjs +63 -0
  21. package/src/plugins/js/utils/register.js +29 -13
  22. package/src/project-graph/plugins/internal-api.js +0 -1
  23. package/src/project-graph/plugins/isolation/plugin-pool.js +1 -1
  24. package/src/project-graph/utils/project-configuration-utils.d.ts +8 -6
  25. package/src/project-graph/utils/project-configuration-utils.js +109 -44
  26. package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -3
  27. package/src/tasks-runner/pseudo-terminal.js +3 -0
  28. package/src/tasks-runner/task-graph-utils.d.ts +1 -1
  29. package/src/tasks-runner/task-graph-utils.js +4 -4
  30. package/src/tasks-runner/utils.js +1 -1
  31. package/src/utils/nx-plugin.deprecated.js +0 -2
  32. package/src/plugins/target-defaults/symbols.d.ts +0 -17
  33. package/src/plugins/target-defaults/symbols.js +0 -20
  34. package/src/plugins/target-defaults/target-defaults-plugin.d.ts +0 -121
  35. package/src/plugins/target-defaults/target-defaults-plugin.js +0 -176
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.4.0",
3
+ "version": "19.5.0-beta.0",
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": {
@@ -37,6 +37,7 @@
37
37
  },
38
38
  "homepage": "https://nx.dev",
39
39
  "dependencies": {
40
+ "@napi-rs/wasm-runtime": "0.2.4",
40
41
  "@yarnpkg/lockfile": "^1.1.0",
41
42
  "@yarnpkg/parsers": "3.0.0-rc.46",
42
43
  "@zkochan/js-yaml": "0.0.7",
@@ -70,7 +71,7 @@
70
71
  "yargs-parser": "21.1.1",
71
72
  "node-machine-id": "1.1.12",
72
73
  "ora": "5.3.0",
73
- "@nrwl/tao": "19.4.0"
74
+ "@nrwl/tao": "19.5.0-beta.0"
74
75
  },
75
76
  "peerDependencies": {
76
77
  "@swc-node/register": "^1.8.0",
@@ -85,16 +86,16 @@
85
86
  }
86
87
  },
87
88
  "optionalDependencies": {
88
- "@nx/nx-darwin-x64": "19.4.0",
89
- "@nx/nx-darwin-arm64": "19.4.0",
90
- "@nx/nx-linux-x64-gnu": "19.4.0",
91
- "@nx/nx-linux-x64-musl": "19.4.0",
92
- "@nx/nx-win32-x64-msvc": "19.4.0",
93
- "@nx/nx-linux-arm64-gnu": "19.4.0",
94
- "@nx/nx-linux-arm64-musl": "19.4.0",
95
- "@nx/nx-linux-arm-gnueabihf": "19.4.0",
96
- "@nx/nx-win32-arm64-msvc": "19.4.0",
97
- "@nx/nx-freebsd-x64": "19.4.0"
89
+ "@nx/nx-darwin-x64": "19.5.0-beta.0",
90
+ "@nx/nx-darwin-arm64": "19.5.0-beta.0",
91
+ "@nx/nx-linux-x64-gnu": "19.5.0-beta.0",
92
+ "@nx/nx-linux-x64-musl": "19.5.0-beta.0",
93
+ "@nx/nx-win32-x64-msvc": "19.5.0-beta.0",
94
+ "@nx/nx-linux-arm64-gnu": "19.5.0-beta.0",
95
+ "@nx/nx-linux-arm64-musl": "19.5.0-beta.0",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.5.0-beta.0",
97
+ "@nx/nx-win32-arm64-msvc": "19.5.0-beta.0",
98
+ "@nx/nx-freebsd-x64": "19.5.0-beta.0"
98
99
  },
99
100
  "nx-migrations": {
100
101
  "migrations": "./migrations.json",
@@ -170,21 +171,24 @@
170
171
  "access": "public"
171
172
  },
172
173
  "napi": {
173
- "name": "nx",
174
- "package": {
175
- "name": "@nx/nx"
174
+ "binaryName": "nx",
175
+ "packageName": "@nx/nx",
176
+ "wasm": {
177
+ "initialMemory": 16384,
178
+ "maximumMemory": 32768
176
179
  },
177
- "triples": {
178
- "additional": [
179
- "aarch64-apple-darwin",
180
- "aarch64-unknown-linux-gnu",
181
- "aarch64-unknown-linux-musl",
182
- "aarch64-pc-windows-msvc",
183
- "armv7-unknown-linux-gnueabihf",
184
- "x86_64-unknown-linux-musl",
185
- "x86_64-unknown-freebsd"
186
- ]
187
- }
180
+ "targets": [
181
+ "x86_64-unknown-linux-gnu",
182
+ "x86_64-pc-windows-msvc",
183
+ "x86_64-apple-darwin",
184
+ "aarch64-apple-darwin",
185
+ "aarch64-unknown-linux-gnu",
186
+ "aarch64-unknown-linux-musl",
187
+ "aarch64-pc-windows-msvc",
188
+ "armv7-unknown-linux-gnueabihf",
189
+ "x86_64-unknown-linux-musl",
190
+ "x86_64-unknown-freebsd"
191
+ ]
188
192
  },
189
193
  "main": "./bin/nx.js",
190
194
  "type": "commonjs"
@@ -319,9 +319,14 @@ async function generateGraph(args, affectedProjects) {
319
319
  }
320
320
  }
321
321
  exports.generateGraph = generateGraph;
322
- async function startServer(html, environmentJs, host, port = 4211, watchForchanges = true, affected = [], focus = null, groupByFolder = false, exclude = []) {
322
+ async function startServer(html, environmentJs, host, port = 4211, watchForChanges = true, affected = [], focus = null, groupByFolder = false, exclude = []) {
323
323
  let unregisterFileWatcher;
324
- if (watchForchanges) {
324
+ if (watchForChanges && !client_1.daemonClient.enabled()) {
325
+ output_1.output.warn({
326
+ title: 'Nx Daemon is not enabled. Graph will not refresh on file changes.',
327
+ });
328
+ }
329
+ if (watchForChanges && client_1.daemonClient.enabled()) {
325
330
  unregisterFileWatcher = await createFileWatcher();
326
331
  }
327
332
  const { projectGraphClientResponse, sourceMapResponse } = await createProjectGraphAndSourceMapClientResponse(affected);
@@ -52,7 +52,7 @@ async function resetHandler(args) {
52
52
  await cleanupNativeFileCache();
53
53
  }
54
54
  catch {
55
- errors.push('Failed to clean up the native file cache.');
55
+ // ignore, deleting the native file cache is not critical and can fail if another process is locking the file
56
56
  }
57
57
  try {
58
58
  await cleanupWorkspaceData();
@@ -116,6 +116,12 @@ async function watch(args) {
116
116
  if (args.verbose) {
117
117
  process.env.NX_VERBOSE_LOGGING = 'true';
118
118
  }
119
+ if (client_1.daemonClient.enabled()) {
120
+ output_1.output.error({
121
+ title: 'Daemon is not running. The watch command is not supported without the Nx Daemon.',
122
+ });
123
+ process.exit(1);
124
+ }
119
125
  if (args.includeGlobalWorkspaceFiles &&
120
126
  args.command.match(projectReplacementRegex)) {
121
127
  output_1.output.error({
@@ -3,19 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCommandGraph = void 0;
4
4
  const task_graph_utils_1 = require("../tasks-runner/task-graph-utils");
5
5
  const output_1 = require("../utils/output");
6
+ /**
7
+ * Make structure { lib: [dep], dep: [dep1], dep1: [] } from projectName lib and projectGraph
8
+ * @param projectGraph
9
+ * @param projectName
10
+ * @param resolved reference to an object that will contain resolved dependencies
11
+ * @returns
12
+ */
13
+ const recursiveResolveDeps = (projectGraph, projectName, resolved) => {
14
+ if (projectGraph.dependencies[projectName].length === 0) {
15
+ // no deps - no resolve
16
+ resolved[projectName] = [];
17
+ return;
18
+ }
19
+ // if already resolved - just skip
20
+ if (resolved[projectName]) {
21
+ return resolved[projectName];
22
+ }
23
+ // deps string list
24
+ const projectDeps = [
25
+ ...new Set(projectGraph.dependencies[projectName]
26
+ .map((projectDep) => projectDep.target)
27
+ .filter((projectDep) => projectGraph.nodes[projectDep])).values(),
28
+ ];
29
+ // define
30
+ resolved[projectName] = projectDeps;
31
+ if (projectDeps.length > 0) {
32
+ for (const dep of projectDeps) {
33
+ recursiveResolveDeps(projectGraph, dep, resolved);
34
+ }
35
+ }
36
+ };
6
37
  function createCommandGraph(projectGraph, projectNames, nxArgs) {
7
38
  const dependencies = {};
8
39
  for (const projectName of projectNames) {
9
- if (projectGraph.dependencies[projectName].length >= 1) {
10
- dependencies[projectName] = [
11
- ...new Set(projectGraph.dependencies[projectName]
12
- .map((projectDep) => projectDep.target)
13
- .filter((projectDep) => projectGraph.nodes[projectDep])).values(),
14
- ];
15
- }
16
- else {
17
- dependencies[projectName] = [];
18
- }
40
+ recursiveResolveDeps(projectGraph, projectName, dependencies);
19
41
  }
20
42
  const roots = Object.keys(dependencies).filter((d) => dependencies[d].length === 0);
21
43
  const commandGraph = {