nx 19.5.0-canary.20240705-653cad2 → 19.5.0-canary.20240709-92e09d9

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.
Files changed (32) hide show
  1. package/package.json +30 -26
  2. package/src/command-line/graph/graph.js +7 -2
  3. package/src/command-line/watch/watch.js +6 -0
  4. package/src/commands-runner/create-command-graph.js +32 -10
  5. package/src/core/graph/main.js +1 -1
  6. package/src/daemon/client/client.d.ts +1 -0
  7. package/src/daemon/client/client.js +14 -2
  8. package/src/devkit-exports.d.ts +1 -0
  9. package/src/devkit-exports.js +3 -1
  10. package/src/native/browser.js +1 -0
  11. package/src/native/index.d.ts +178 -138
  12. package/src/native/index.js +16 -0
  13. package/src/native/native-bindings.js +352 -238
  14. package/src/native/nx.wasi-browser.js +108 -0
  15. package/src/native/nx.wasi.cjs +139 -0
  16. package/src/native/nx.wasm32-wasi.wasm +0 -0
  17. package/src/native/wasi-worker-browser.mjs +32 -0
  18. package/src/native/wasi-worker.mjs +63 -0
  19. package/src/project-graph/plugins/isolation/messaging.d.ts +1 -1
  20. package/src/project-graph/plugins/isolation/plugin-worker.js +5 -1
  21. package/src/project-graph/utils/project-configuration-utils.js +3 -1
  22. package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -3
  23. package/src/tasks-runner/create-task-graph.d.ts +2 -1
  24. package/src/tasks-runner/create-task-graph.js +14 -30
  25. package/src/tasks-runner/pseudo-terminal.js +3 -0
  26. package/src/tasks-runner/task-graph-utils.d.ts +1 -1
  27. package/src/tasks-runner/task-graph-utils.js +4 -4
  28. package/src/tasks-runner/utils.d.ts +15 -2
  29. package/src/tasks-runner/utils.js +88 -24
  30. package/src/utils/find-matching-projects.d.ts +4 -0
  31. package/src/utils/find-matching-projects.js +7 -4
  32. package/src/utils/serializable-error.js +6 -0
@@ -0,0 +1,108 @@
1
+ import {
2
+ instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync,
3
+ getDefaultContext as __emnapiGetDefaultContext,
4
+ WASI as __WASI,
5
+ createOnMessage as __wasmCreateOnMessageForFsProxy,
6
+ } from '@napi-rs/wasm-runtime'
7
+
8
+ import __wasmUrl from './nx.wasm32-wasi.wasm?url'
9
+
10
+ const __wasi = new __WASI({
11
+ version: 'preview1',
12
+ })
13
+
14
+ const __emnapiContext = __emnapiGetDefaultContext()
15
+
16
+ const __sharedMemory = new WebAssembly.Memory({
17
+ initial: 16384,
18
+ maximum: 32768,
19
+ shared: true,
20
+ })
21
+
22
+ const __wasmFile = await fetch(__wasmUrl).then((res) => res.arrayBuffer())
23
+
24
+ const {
25
+ instance: __napiInstance,
26
+ module: __wasiModule,
27
+ napiModule: __napiModule,
28
+ } = __emnapiInstantiateNapiModuleSync(__wasmFile, {
29
+ context: __emnapiContext,
30
+ asyncWorkPoolSize: 4,
31
+ wasi: __wasi,
32
+ onCreateWorker() {
33
+ const worker = new Worker(new URL('./wasi-worker-browser.mjs', import.meta.url), {
34
+ type: 'module',
35
+ })
36
+
37
+ return worker
38
+ },
39
+ overwriteImports(importObject) {
40
+ importObject.env = {
41
+ ...importObject.env,
42
+ ...importObject.napi,
43
+ ...importObject.emnapi,
44
+ memory: __sharedMemory,
45
+ }
46
+ return importObject
47
+ },
48
+ beforeInit({ instance }) {
49
+ __napi_rs_initialize_modules(instance)
50
+ },
51
+ })
52
+
53
+ function __napi_rs_initialize_modules(__napiInstance) {
54
+ __napiInstance.exports['__napi_register__expand_outputs_0']?.()
55
+ __napiInstance.exports['__napi_register__get_files_for_outputs_1']?.()
56
+ __napiInstance.exports['__napi_register__remove_2']?.()
57
+ __napiInstance.exports['__napi_register__copy_3']?.()
58
+ __napiInstance.exports['__napi_register__hash_array_4']?.()
59
+ __napiInstance.exports['__napi_register__hash_file_5']?.()
60
+ __napiInstance.exports['__napi_register__ImportResult_struct_6']?.()
61
+ __napiInstance.exports['__napi_register__find_imports_7']?.()
62
+ __napiInstance.exports['__napi_register__transfer_project_graph_8']?.()
63
+ __napiInstance.exports['__napi_register__ExternalNode_struct_9']?.()
64
+ __napiInstance.exports['__napi_register__Target_struct_10']?.()
65
+ __napiInstance.exports['__napi_register__Project_struct_11']?.()
66
+ __napiInstance.exports['__napi_register__ProjectGraph_struct_12']?.()
67
+ __napiInstance.exports['__napi_register__HashPlanner_struct_13']?.()
68
+ __napiInstance.exports['__napi_register__HashPlanner_impl_17']?.()
69
+ __napiInstance.exports['__napi_register__HashDetails_struct_18']?.()
70
+ __napiInstance.exports['__napi_register__HasherOptions_struct_19']?.()
71
+ __napiInstance.exports['__napi_register__TaskHasher_struct_20']?.()
72
+ __napiInstance.exports['__napi_register__TaskHasher_impl_23']?.()
73
+ __napiInstance.exports['__napi_register__Task_struct_24']?.()
74
+ __napiInstance.exports['__napi_register__TaskTarget_struct_25']?.()
75
+ __napiInstance.exports['__napi_register__TaskGraph_struct_26']?.()
76
+ __napiInstance.exports['__napi_register__FileData_struct_27']?.()
77
+ __napiInstance.exports['__napi_register__InputsInput_struct_28']?.()
78
+ __napiInstance.exports['__napi_register__FileSetInput_struct_29']?.()
79
+ __napiInstance.exports['__napi_register__RuntimeInput_struct_30']?.()
80
+ __napiInstance.exports['__napi_register__EnvironmentInput_struct_31']?.()
81
+ __napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_32']?.()
82
+ __napiInstance.exports['__napi_register__DepsOutputsInput_struct_33']?.()
83
+ __napiInstance.exports['__napi_register__NxJson_struct_34']?.()
84
+ __napiInstance.exports['__napi_register__WorkspaceContext_struct_35']?.()
85
+ __napiInstance.exports['__napi_register__WorkspaceContext_impl_44']?.()
86
+ __napiInstance.exports['__napi_register__WorkspaceErrors_45']?.()
87
+ __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_46']?.()
88
+ __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_47']?.()
89
+ __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_48']?.()
90
+ __napiInstance.exports['__napi_register__FileMap_struct_49']?.()
91
+ __napiInstance.exports['__napi_register____test_only_transfer_file_map_50']?.()
92
+ __napiInstance.exports['__napi_register__IS_WASM_51']?.()
93
+ }
94
+ export const HashPlanner = __napiModule.exports.HashPlanner
95
+ export const ImportResult = __napiModule.exports.ImportResult
96
+ export const TaskHasher = __napiModule.exports.TaskHasher
97
+ export const WorkspaceContext = __napiModule.exports.WorkspaceContext
98
+ export const copy = __napiModule.exports.copy
99
+ export const expandOutputs = __napiModule.exports.expandOutputs
100
+ export const findImports = __napiModule.exports.findImports
101
+ export const getFilesForOutputs = __napiModule.exports.getFilesForOutputs
102
+ export const hashArray = __napiModule.exports.hashArray
103
+ export const hashFile = __napiModule.exports.hashFile
104
+ export const IS_WASM = __napiModule.exports.IS_WASM
105
+ export const remove = __napiModule.exports.remove
106
+ export const testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
107
+ export const transferProjectGraph = __napiModule.exports.transferProjectGraph
108
+ export const WorkspaceErrors = __napiModule.exports.WorkspaceErrors
@@ -0,0 +1,139 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ const __nodeFs = require('node:fs')
7
+ const __nodePath = require('node:path')
8
+ const { WASI: __nodeWASI } = require('node:wasi')
9
+ const { Worker } = require('node:worker_threads')
10
+
11
+ const {
12
+ instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
13
+ getDefaultContext: __emnapiGetDefaultContext,
14
+ createOnMessage: __wasmCreateOnMessageForFsProxy,
15
+ } = require('@napi-rs/wasm-runtime')
16
+
17
+ const __rootDir = __nodePath.parse(process.cwd()).root
18
+
19
+ const __wasi = new __nodeWASI({
20
+ version: 'preview1',
21
+ env: process.env,
22
+ preopens: {
23
+ [__rootDir]: __rootDir,
24
+ }
25
+ })
26
+
27
+ const __emnapiContext = __emnapiGetDefaultContext()
28
+
29
+ const __sharedMemory = new WebAssembly.Memory({
30
+ initial: 16384,
31
+ maximum: 32768,
32
+ shared: true,
33
+ })
34
+
35
+ let __wasmFilePath = __nodePath.join(__dirname, 'nx.wasm32-wasi.wasm')
36
+ const __wasmDebugFilePath = __nodePath.join(__dirname, 'nx.wasm32-wasi.debug.wasm')
37
+
38
+ if (__nodeFs.existsSync(__wasmDebugFilePath)) {
39
+ __wasmFilePath = __wasmDebugFilePath
40
+ } else if (!__nodeFs.existsSync(__wasmFilePath)) {
41
+ try {
42
+ __wasmFilePath = __nodePath.resolve('@nx/nx-wasm32-wasi')
43
+ } catch {
44
+ throw new Error('Cannot find nx.wasm32-wasi.wasm file, and @nx/nx-wasm32-wasi package is not installed.')
45
+ }
46
+ }
47
+
48
+ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule } = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__wasmFilePath), {
49
+ context: __emnapiContext,
50
+ asyncWorkPoolSize: (function() {
51
+ const threadsSizeFromEnv = Number(process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process.env.UV_THREADPOOL_SIZE)
52
+ // NaN > 0 is false
53
+ if (threadsSizeFromEnv > 0) {
54
+ return threadsSizeFromEnv
55
+ } else {
56
+ return 4
57
+ }
58
+ })(),
59
+ wasi: __wasi,
60
+ onCreateWorker() {
61
+ const worker = new Worker(__nodePath.join(__dirname, 'wasi-worker.mjs'), {
62
+ env: process.env,
63
+ execArgv: ['--experimental-wasi-unstable-preview1'],
64
+ })
65
+ worker.onmessage = ({ data }) => {
66
+ __wasmCreateOnMessageForFsProxy(__nodeFs)(data)
67
+ }
68
+ return worker
69
+ },
70
+ overwriteImports(importObject) {
71
+ importObject.env = {
72
+ ...importObject.env,
73
+ ...importObject.napi,
74
+ ...importObject.emnapi,
75
+ memory: __sharedMemory,
76
+ }
77
+ return importObject
78
+ },
79
+ beforeInit({ instance }) {
80
+ __napi_rs_initialize_modules(instance)
81
+ }
82
+ })
83
+
84
+ function __napi_rs_initialize_modules(__napiInstance) {
85
+ __napiInstance.exports['__napi_register__expand_outputs_0']?.()
86
+ __napiInstance.exports['__napi_register__get_files_for_outputs_1']?.()
87
+ __napiInstance.exports['__napi_register__remove_2']?.()
88
+ __napiInstance.exports['__napi_register__copy_3']?.()
89
+ __napiInstance.exports['__napi_register__hash_array_4']?.()
90
+ __napiInstance.exports['__napi_register__hash_file_5']?.()
91
+ __napiInstance.exports['__napi_register__ImportResult_struct_6']?.()
92
+ __napiInstance.exports['__napi_register__find_imports_7']?.()
93
+ __napiInstance.exports['__napi_register__transfer_project_graph_8']?.()
94
+ __napiInstance.exports['__napi_register__ExternalNode_struct_9']?.()
95
+ __napiInstance.exports['__napi_register__Target_struct_10']?.()
96
+ __napiInstance.exports['__napi_register__Project_struct_11']?.()
97
+ __napiInstance.exports['__napi_register__ProjectGraph_struct_12']?.()
98
+ __napiInstance.exports['__napi_register__HashPlanner_struct_13']?.()
99
+ __napiInstance.exports['__napi_register__HashPlanner_impl_17']?.()
100
+ __napiInstance.exports['__napi_register__HashDetails_struct_18']?.()
101
+ __napiInstance.exports['__napi_register__HasherOptions_struct_19']?.()
102
+ __napiInstance.exports['__napi_register__TaskHasher_struct_20']?.()
103
+ __napiInstance.exports['__napi_register__TaskHasher_impl_23']?.()
104
+ __napiInstance.exports['__napi_register__Task_struct_24']?.()
105
+ __napiInstance.exports['__napi_register__TaskTarget_struct_25']?.()
106
+ __napiInstance.exports['__napi_register__TaskGraph_struct_26']?.()
107
+ __napiInstance.exports['__napi_register__FileData_struct_27']?.()
108
+ __napiInstance.exports['__napi_register__InputsInput_struct_28']?.()
109
+ __napiInstance.exports['__napi_register__FileSetInput_struct_29']?.()
110
+ __napiInstance.exports['__napi_register__RuntimeInput_struct_30']?.()
111
+ __napiInstance.exports['__napi_register__EnvironmentInput_struct_31']?.()
112
+ __napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_32']?.()
113
+ __napiInstance.exports['__napi_register__DepsOutputsInput_struct_33']?.()
114
+ __napiInstance.exports['__napi_register__NxJson_struct_34']?.()
115
+ __napiInstance.exports['__napi_register__WorkspaceContext_struct_35']?.()
116
+ __napiInstance.exports['__napi_register__WorkspaceContext_impl_44']?.()
117
+ __napiInstance.exports['__napi_register__WorkspaceErrors_45']?.()
118
+ __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_46']?.()
119
+ __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_47']?.()
120
+ __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_48']?.()
121
+ __napiInstance.exports['__napi_register__FileMap_struct_49']?.()
122
+ __napiInstance.exports['__napi_register____test_only_transfer_file_map_50']?.()
123
+ __napiInstance.exports['__napi_register__IS_WASM_51']?.()
124
+ }
125
+ module.exports.HashPlanner = __napiModule.exports.HashPlanner
126
+ module.exports.ImportResult = __napiModule.exports.ImportResult
127
+ module.exports.TaskHasher = __napiModule.exports.TaskHasher
128
+ module.exports.WorkspaceContext = __napiModule.exports.WorkspaceContext
129
+ module.exports.copy = __napiModule.exports.copy
130
+ module.exports.expandOutputs = __napiModule.exports.expandOutputs
131
+ module.exports.findImports = __napiModule.exports.findImports
132
+ module.exports.getFilesForOutputs = __napiModule.exports.getFilesForOutputs
133
+ module.exports.hashArray = __napiModule.exports.hashArray
134
+ module.exports.hashFile = __napiModule.exports.hashFile
135
+ module.exports.IS_WASM = __napiModule.exports.IS_WASM
136
+ module.exports.remove = __napiModule.exports.remove
137
+ module.exports.testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
138
+ module.exports.transferProjectGraph = __napiModule.exports.transferProjectGraph
139
+ module.exports.WorkspaceErrors = __napiModule.exports.WorkspaceErrors
Binary file
@@ -0,0 +1,32 @@
1
+ import { instantiateNapiModuleSync, MessageHandler, WASI } from '@napi-rs/wasm-runtime'
2
+
3
+ const handler = new MessageHandler({
4
+ onLoad({ wasmModule, wasmMemory }) {
5
+ const wasi = new WASI({
6
+ print: function () {
7
+ // eslint-disable-next-line no-console
8
+ console.log.apply(console, arguments)
9
+ },
10
+ printErr: function() {
11
+ // eslint-disable-next-line no-console
12
+ console.error.apply(console, arguments)
13
+ },
14
+ })
15
+ return instantiateNapiModuleSync(wasmModule, {
16
+ childThread: true,
17
+ wasi,
18
+ overwriteImports(importObject) {
19
+ importObject.env = {
20
+ ...importObject.env,
21
+ ...importObject.napi,
22
+ ...importObject.emnapi,
23
+ memory: wasmMemory,
24
+ }
25
+ },
26
+ })
27
+ },
28
+ })
29
+
30
+ globalThis.onmessage = function (e) {
31
+ handler.handle(e)
32
+ }
@@ -0,0 +1,63 @@
1
+ import fs from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { parse } from "node:path";
4
+ import { WASI } from "node:wasi";
5
+ import { parentPort, Worker } from "node:worker_threads";
6
+
7
+ const require = createRequire(import.meta.url);
8
+
9
+ const { instantiateNapiModuleSync, MessageHandler, getDefaultContext } = require("@napi-rs/wasm-runtime");
10
+
11
+ if (parentPort) {
12
+ parentPort.on("message", (data) => {
13
+ globalThis.onmessage({ data });
14
+ });
15
+ }
16
+
17
+ Object.assign(globalThis, {
18
+ self: globalThis,
19
+ require,
20
+ Worker,
21
+ importScripts: function (f) {
22
+ ;(0, eval)(fs.readFileSync(f, "utf8") + "//# sourceURL=" + f);
23
+ },
24
+ postMessage: function (msg) {
25
+ if (parentPort) {
26
+ parentPort.postMessage(msg);
27
+ }
28
+ },
29
+ });
30
+
31
+ const emnapiContext = getDefaultContext();
32
+
33
+ const __rootDir = parse(process.cwd()).root;
34
+
35
+ const handler = new MessageHandler({
36
+ onLoad({ wasmModule, wasmMemory }) {
37
+ const wasi = new WASI({
38
+ version: 'preview1',
39
+ env: process.env,
40
+ preopens: {
41
+ [__rootDir]: __rootDir,
42
+ },
43
+ });
44
+
45
+ return instantiateNapiModuleSync(wasmModule, {
46
+ childThread: true,
47
+ wasi,
48
+ context: emnapiContext,
49
+ overwriteImports(importObject) {
50
+ importObject.env = {
51
+ ...importObject.env,
52
+ ...importObject.napi,
53
+ ...importObject.emnapi,
54
+ memory: wasmMemory
55
+ };
56
+ },
57
+ });
58
+ },
59
+ });
60
+
61
+ globalThis.onmessage = function (e) {
62
+ handler.handle(e);
63
+ };
@@ -84,7 +84,7 @@ export interface PluginCreateMetadataResult {
84
84
  tx: string;
85
85
  } | {
86
86
  success: false;
87
- error: string;
87
+ error: Error;
88
88
  tx: string;
89
89
  };
90
90
  }
@@ -117,7 +117,11 @@ const server = (0, net_1.createServer)((socket) => {
117
117
  catch (e) {
118
118
  return {
119
119
  type: 'createMetadataResult',
120
- payload: { success: false, error: e.stack, tx },
120
+ payload: {
121
+ success: false,
122
+ error: (0, serializable_error_1.createSerializableError)(e),
123
+ tx,
124
+ },
121
125
  };
122
126
  }
123
127
  },
@@ -243,8 +243,10 @@ plugins) {
243
243
  else {
244
244
  errorBodyLines.push(` - ${e.message}`);
245
245
  }
246
+ const innerStackTrace = ' ' + e.stack.split('\n').join('\n ');
247
+ errorBodyLines.push(innerStackTrace);
246
248
  }
247
- error.message = errorBodyLines.join('\n');
249
+ error.stack = errorBodyLines.join('\n');
248
250
  // This represents a single plugin erroring out with a hard error.
249
251
  errors.push(error);
250
252
  // The plugin didn't return partial results, so we return an empty array.
@@ -9,12 +9,12 @@ import { LoadedNxPlugin } from '../plugins/internal-api';
9
9
  * @param nxJson
10
10
  */
11
11
  export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
12
- allWorkspaceFiles: import("nx/src/devkit-exports").FileData[];
12
+ allWorkspaceFiles: import("../file-utils").FileData[];
13
13
  fileMap: {
14
14
  projectFileMap: ProjectFiles;
15
- nonProjectFiles: import("nx/src/native").FileData[];
15
+ nonProjectFiles: import("../../native").FileData[];
16
16
  };
17
- rustReferences: import("nx/src/native").NxWorkspaceFilesExternals;
17
+ rustReferences: import("../../native").NxWorkspaceFilesExternals;
18
18
  }>;
19
19
  /**
20
20
  * Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
@@ -11,10 +11,11 @@ export declare class ProcessTasks {
11
11
  readonly dependencies: {
12
12
  [k: string]: string[];
13
13
  };
14
+ private readonly allTargetNames;
14
15
  constructor(extraTargetDependencies: TargetDependencies, projectGraph: ProjectGraph);
15
16
  processTasks(projectNames: string[], targets: string[], configuration: string, overrides: Object, excludeTaskDependencies: boolean): string[];
16
17
  processTask(task: Task, projectUsedToDeriveDependencies: string, configuration: string, overrides: Object): void;
17
- private processTasksForMatchingProjects;
18
+ private processTasksForMultipleProjects;
18
19
  private processTasksForSingleProject;
19
20
  private processTasksForDependencies;
20
21
  createTask(id: string, project: ProjectGraphProjectNode, target: string, resolvedConfiguration: string | undefined, overrides: Object): Task;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mapTargetDefaultsToDependencies = exports.createTaskGraph = exports.ProcessTasks = void 0;
4
4
  const utils_1 = require("./utils");
5
5
  const project_graph_utils_1 = require("../utils/project-graph-utils");
6
- const find_matching_projects_1 = require("../utils/find-matching-projects");
7
6
  const output_1 = require("../utils/output");
8
7
  class ProcessTasks {
9
8
  constructor(extraTargetDependencies, projectGraph) {
@@ -12,6 +11,14 @@ class ProcessTasks {
12
11
  this.seen = new Set();
13
12
  this.tasks = {};
14
13
  this.dependencies = {};
14
+ const allTargetNames = new Set();
15
+ for (const projectName in projectGraph.nodes) {
16
+ const project = projectGraph.nodes[projectName];
17
+ for (const targetName in project.data.targets ?? {}) {
18
+ allTargetNames.add(targetName);
19
+ }
20
+ }
21
+ this.allTargetNames = Array.from(allTargetNames);
15
22
  }
16
23
  processTasks(projectNames, targets, configuration, overrides, excludeTaskDependencies) {
17
24
  for (const projectName of projectNames) {
@@ -58,32 +65,13 @@ class ProcessTasks {
58
65
  return;
59
66
  }
60
67
  this.seen.add(seenKey);
61
- const dependencyConfigs = (0, utils_1.getDependencyConfigs)({ project: task.target.project, target: task.target.target }, this.extraTargetDependencies, this.projectGraph);
68
+ const dependencyConfigs = (0, utils_1.getDependencyConfigs)({ project: task.target.project, target: task.target.target }, this.extraTargetDependencies, this.projectGraph, this.allTargetNames);
62
69
  for (const dependencyConfig of dependencyConfigs) {
63
70
  const taskOverrides = dependencyConfig.params === 'forward'
64
71
  ? overrides
65
72
  : { __overrides_unparsed__: [] };
66
73
  if (dependencyConfig.projects) {
67
- /** LERNA SUPPORT START - Remove in v20 */
68
- // Lerna uses `dependencies` in `prepNxOptions`, so we need to maintain
69
- // support for it until lerna can be updated to use the syntax.
70
- //
71
- // This should have been removed in v17, but the updates to lerna had not
72
- // been made yet.
73
- //
74
- // TODO(@agentender): Remove this part in v20
75
- if (typeof dependencyConfig.projects === 'string') {
76
- if (dependencyConfig.projects === 'self') {
77
- this.processTasksForSingleProject(task, task.target.project, dependencyConfig, configuration, taskOverrides, overrides);
78
- continue;
79
- }
80
- else if (dependencyConfig.projects === 'dependencies') {
81
- this.processTasksForDependencies(projectUsedToDeriveDependencies, dependencyConfig, configuration, task, taskOverrides, overrides);
82
- continue;
83
- }
84
- }
85
- /** LERNA SUPPORT END - Remove in v17 */
86
- this.processTasksForMatchingProjects(dependencyConfig, configuration, task, taskOverrides, overrides);
74
+ this.processTasksForMultipleProjects(dependencyConfig, configuration, task, taskOverrides, overrides);
87
75
  }
88
76
  else if (dependencyConfig.dependencies) {
89
77
  this.processTasksForDependencies(projectUsedToDeriveDependencies, dependencyConfig, configuration, task, taskOverrides, overrides);
@@ -93,20 +81,16 @@ class ProcessTasks {
93
81
  }
94
82
  }
95
83
  }
96
- processTasksForMatchingProjects(dependencyConfig, configuration, task, taskOverrides, overrides) {
97
- const targetProjectSpecifiers = typeof dependencyConfig.projects === 'string'
98
- ? [dependencyConfig.projects]
99
- : dependencyConfig.projects;
100
- const matchingProjects = (0, find_matching_projects_1.findMatchingProjects)(targetProjectSpecifiers, this.projectGraph.nodes);
101
- if (matchingProjects.length === 0) {
84
+ processTasksForMultipleProjects(dependencyConfig, configuration, task, taskOverrides, overrides) {
85
+ if (dependencyConfig.projects.length === 0) {
102
86
  output_1.output.warn({
103
87
  title: `\`dependsOn\` is misconfigured for ${task.target.project}:${task.target.target}`,
104
88
  bodyLines: [
105
- `Project patterns "${targetProjectSpecifiers}" does not match any projects.`,
89
+ `Project patterns "${dependencyConfig.projects}" does not match any projects.`,
106
90
  ],
107
91
  });
108
92
  }
109
- for (const projectName of matchingProjects) {
93
+ for (const projectName of dependencyConfig.projects) {
110
94
  this.processTasksForSingleProject(task, projectName, dependencyConfig, configuration, taskOverrides, overrides);
111
95
  }
112
96
  }
@@ -139,6 +139,9 @@ function messageToCode(message) {
139
139
  }
140
140
  }
141
141
  function supportedPtyPlatform() {
142
+ if (native_1.IS_WASM) {
143
+ return false;
144
+ }
142
145
  if (process.platform !== 'win32') {
143
146
  return true;
144
147
  }
@@ -1,4 +1,4 @@
1
- export declare function findCycle(taskGraph: {
1
+ export declare function findCycle(graph: {
2
2
  dependencies: Record<string, string[]>;
3
3
  }): string[] | null;
4
4
  export declare function makeAcyclic(graph: {
@@ -14,13 +14,13 @@ function _findCycle(graph, id, visited, path) {
14
14
  }
15
15
  return null;
16
16
  }
17
- function findCycle(taskGraph) {
17
+ function findCycle(graph) {
18
18
  const visited = {};
19
- for (const t of Object.keys(taskGraph.dependencies)) {
19
+ for (const t of Object.keys(graph.dependencies)) {
20
20
  visited[t] = false;
21
21
  }
22
- for (const t of Object.keys(taskGraph.dependencies)) {
23
- const cycle = _findCycle(taskGraph, t, visited, [t]);
22
+ for (const t of Object.keys(graph.dependencies)) {
23
+ const cycle = _findCycle(graph, t, visited, [t]);
24
24
  if (cycle)
25
25
  return cycle;
26
26
  }
@@ -2,12 +2,25 @@ import { Task, TaskGraph } from '../config/task-graph';
2
2
  import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
3
3
  import { TargetConfiguration, TargetDependencyConfig } from '../config/workspace-json-project-json';
4
4
  import { CustomHasher, ExecutorConfig } from '../config/misc-interfaces';
5
+ export type NormalizedTargetDependencyConfig = TargetDependencyConfig & {
6
+ projects: string[];
7
+ };
5
8
  export declare function getDependencyConfigs({ project, target }: {
6
9
  project: string;
7
10
  target: string;
8
- }, extraTargetDependencies: Record<string, (TargetDependencyConfig | string)[]>, projectGraph: ProjectGraph): TargetDependencyConfig[] | undefined;
9
- export declare function expandDependencyConfigSyntaxSugar(dependencyConfigString: string, graph: ProjectGraph): TargetDependencyConfig;
11
+ }, extraTargetDependencies: Record<string, (TargetDependencyConfig | string)[]>, projectGraph: ProjectGraph, allTargetNames: string[]): NormalizedTargetDependencyConfig[] | undefined;
12
+ export declare function normalizeDependencyConfigDefinition(definition: string | TargetDependencyConfig, currentProject: string, graph: ProjectGraph, allTargetNames: string[]): NormalizedTargetDependencyConfig[];
13
+ export declare function normalizeDependencyConfigProjects(dependencyConfig: TargetDependencyConfig, currentProject: string, graph: ProjectGraph): NormalizedTargetDependencyConfig;
14
+ export declare function expandDependencyConfigSyntaxSugar(dependencyConfigString: string | TargetDependencyConfig, graph: ProjectGraph): TargetDependencyConfig;
15
+ export declare function expandWildcardTargetConfiguration(dependencyConfig: NormalizedTargetDependencyConfig, allTargetNames: string[]): NormalizedTargetDependencyConfig[];
16
+ export declare function readProjectAndTargetFromTargetString(targetString: string, projects: Record<string, ProjectGraphProjectNode>): {
17
+ projects?: string[];
18
+ target: string;
19
+ };
10
20
  export declare function getOutputs(p: Record<string, ProjectGraphProjectNode>, target: Task['target'], overrides: Task['overrides']): string[];
21
+ export declare function normalizeTargetDependencyWithStringProjects(dependencyConfig: TargetDependencyConfig): Omit<TargetDependencyConfig, 'projects'> & {
22
+ projects: string[];
23
+ };
11
24
  declare class InvalidOutputsError extends Error {
12
25
  outputs: string[];
13
26
  invalidOutputs: Set<string>;