nx 19.2.0 → 19.2.1

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.
@@ -19,7 +19,6 @@ const nx_json_1 = require("../../config/nx-json");
19
19
  const daemon_socket_messenger_1 = require("./daemon-socket-messenger");
20
20
  const cache_1 = require("../cache");
21
21
  const error_types_1 = require("../../project-graph/error-types");
22
- const dotenv_1 = require("../../utils/dotenv");
23
22
  const get_nx_workspace_files_1 = require("../message-types/get-nx-workspace-files");
24
23
  const get_context_file_data_1 = require("../message-types/get-context-file-data");
25
24
  const get_files_in_directory_1 = require("../message-types/get-files-in-directory");
@@ -41,7 +40,6 @@ class DaemonClient {
41
40
  this._daemonReady = null;
42
41
  this._out = null;
43
42
  this._err = null;
44
- (0, dotenv_1.loadRootEnvFiles)(workspace_root_1.workspaceRoot);
45
43
  try {
46
44
  this.nxJson = (0, configuration_1.readNxJson)();
47
45
  }
@@ -42,7 +42,7 @@ export interface NormalizedRunCommandsOptions extends RunCommandsOptions {
42
42
  [k: string]: any;
43
43
  };
44
44
  unparsedCommandArgs?: {
45
- [k: string]: string;
45
+ [k: string]: string | string[];
46
46
  };
47
47
  args?: string;
48
48
  }
@@ -29,7 +29,9 @@ const propKeys = [
29
29
  'command',
30
30
  'commands',
31
31
  'color',
32
+ 'no-color',
32
33
  'parallel',
34
+ 'no-parallel',
33
35
  'readyWhen',
34
36
  'cwd',
35
37
  'args',
@@ -131,6 +133,7 @@ function normalizeOptions(options) {
131
133
  'parse-numbers': false,
132
134
  'parse-positional-numbers': false,
133
135
  'dot-notation': false,
136
+ 'camel-case-expansion': false,
134
137
  },
135
138
  });
136
139
  options.unknownOptions = Object.keys(options)
@@ -294,21 +297,25 @@ function interpolateArgsIntoCommand(command, opts, forwardAllArgs) {
294
297
  else if (forwardAllArgs) {
295
298
  let args = '';
296
299
  if (Object.keys(opts.unknownOptions ?? {}).length > 0) {
297
- args +=
298
- ' ' +
299
- Object.keys(opts.unknownOptions)
300
- .filter((k) => typeof opts.unknownOptions[k] !== 'object' &&
301
- opts.parsedArgs[k] === opts.unknownOptions[k])
302
- .map((k) => `--${k}=${opts.unknownOptions[k]}`)
303
- .join(' ');
300
+ const unknownOptionsArgs = Object.keys(opts.unknownOptions)
301
+ .filter((k) => typeof opts.unknownOptions[k] !== 'object' &&
302
+ opts.parsedArgs[k] === opts.unknownOptions[k])
303
+ .map((k) => `--${k}=${opts.unknownOptions[k]}`)
304
+ .map(wrapArgIntoQuotesIfNeeded)
305
+ .join(' ');
306
+ if (unknownOptionsArgs) {
307
+ args += ` ${unknownOptionsArgs}`;
308
+ }
304
309
  }
305
310
  if (opts.args) {
306
311
  args += ` ${opts.args}`;
307
312
  }
308
313
  if (opts.__unparsed__?.length > 0) {
309
- const filterdParsedOptions = filterPropKeysFromUnParsedOptions(opts.__unparsed__, opts.unparsedCommandArgs);
314
+ const filterdParsedOptions = filterPropKeysFromUnParsedOptions(opts.__unparsed__, opts.parsedArgs);
310
315
  if (filterdParsedOptions.length > 0) {
311
- args += ` ${filterdParsedOptions.join(' ')}`;
316
+ args += ` ${filterdParsedOptions
317
+ .map(wrapArgIntoQuotesIfNeeded)
318
+ .join(' ')}`;
312
319
  }
313
320
  }
314
321
  return `${command}${args}`;
@@ -332,13 +339,14 @@ function parseArgs(unparsedCommandArgs, unknownOptions, args) {
332
339
  * @param unparsedCommandArgs e.g. { prop1: 'value1', prop2: 'value2', args: 'test'}
333
340
  * @returns filtered options that are not part of the propKeys array e.g. ['--prop1', 'value1', '--prop2=value2']
334
341
  */
335
- function filterPropKeysFromUnParsedOptions(__unparsed__, unparsedCommandArgs = {}) {
342
+ function filterPropKeysFromUnParsedOptions(__unparsed__, parseArgs = {}) {
336
343
  const parsedOptions = [];
337
344
  for (let index = 0; index < __unparsed__.length; index++) {
338
345
  const element = __unparsed__[index];
339
346
  if (element.startsWith('--')) {
340
347
  const key = element.replace('--', '');
341
348
  if (element.includes('=')) {
349
+ // key can be in the format of --key=value or --key.subkey=value (e.g. env.foo=bar)
342
350
  if (!propKeys.includes(key.split('=')[0].split('.')[0])) {
343
351
  // check if the key is part of the propKeys array
344
352
  parsedOptions.push(element);
@@ -348,7 +356,8 @@ function filterPropKeysFromUnParsedOptions(__unparsed__, unparsedCommandArgs = {
348
356
  // check if the next element is a value for the key
349
357
  if (propKeys.includes(key)) {
350
358
  if (index + 1 < __unparsed__.length &&
351
- __unparsed__[index + 1] === unparsedCommandArgs[key]) {
359
+ parseArgs[key] &&
360
+ __unparsed__[index + 1].toString() === parseArgs[key].toString()) {
352
361
  index++; // skip the next element
353
362
  }
354
363
  }
@@ -417,3 +426,20 @@ function registerProcessListener() {
417
426
  // will store results to the cache and will terminate this process
418
427
  });
419
428
  }
429
+ function wrapArgIntoQuotesIfNeeded(arg) {
430
+ if (arg.includes('=')) {
431
+ const [key, value] = arg.split('=');
432
+ if (key.startsWith('--') &&
433
+ value.includes(' ') &&
434
+ !(value[0] === "'" || value[0] === '"')) {
435
+ return `${key}="${value}"`;
436
+ }
437
+ return arg;
438
+ }
439
+ else if (arg.includes(' ') && !(arg[0] === "'" || arg[0] === '"')) {
440
+ return `"${arg}"`;
441
+ }
442
+ else {
443
+ return arg;
444
+ }
445
+ }
@@ -39,7 +39,7 @@ function loadRemoteNxPlugin(plugin, root) {
39
39
  const exitHandler = createWorkerExitHandler(worker, pendingPromises);
40
40
  const cleanupFunction = () => {
41
41
  worker.off('exit', exitHandler);
42
- shutdownPluginWorker(worker, pendingPromises);
42
+ shutdownPluginWorker(worker);
43
43
  };
44
44
  cleanupFunctions.add(cleanupFunction);
45
45
  return new Promise((res, rej) => {
@@ -48,13 +48,10 @@ function loadRemoteNxPlugin(plugin, root) {
48
48
  });
49
49
  }
50
50
  exports.loadRemoteNxPlugin = loadRemoteNxPlugin;
51
- async function shutdownPluginWorker(worker, pendingPromises) {
51
+ function shutdownPluginWorker(worker) {
52
52
  // Clears the plugin cache so no refs to the workers are held
53
53
  internal_api_1.nxPluginCache.clear();
54
54
  // logger.verbose(`[plugin-pool] starting worker shutdown`);
55
- // Other things may be interacting with the worker.
56
- // Wait for all pending promises to be done before killing the worker
57
- await Promise.all(Array.from(pendingPromises.values()).map(({ promise }) => promise));
58
55
  worker.kill('SIGINT');
59
56
  }
60
57
  /**
@@ -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("../file-utils").FileData[];
12
+ allWorkspaceFiles: import("nx/src/devkit-exports").FileData[];
13
13
  fileMap: {
14
14
  projectFileMap: ProjectFiles;
15
- nonProjectFiles: import("../../native").FileData[];
15
+ nonProjectFiles: import("nx/src/native").FileData[];
16
16
  };
17
- rustReferences: import("../../native").NxWorkspaceFilesExternals;
17
+ rustReferences: import("nx/src/native").NxWorkspaceFilesExternals;
18
18
  }>;
19
19
  /**
20
20
  * Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.