nx 22.1.0-beta.1 → 22.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/client/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAC;AAoBpD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAUpE,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAKhG,OAAO,EAAW,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoC9E,OAAO,KAAK,EACV,+BAA+B,EAC/B,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AAcrC,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,wCAAwC,CAAC;AAmBhD,MAAM,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC;AAC5C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACtC,CAAC;AAQF,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;;IAWpD,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,eAAe,CAAwB;IAE/C,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,aAAa,CAAC;IAEtB,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,aAAa,CAA2C;IAChE,OAAO,CAAC,mBAAmB,CAA8B;IACzD,OAAO,CAA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B;IAiCjC,OAAO,CAAC,gCAAgC;IAyBxC,OAAO,CAAC,aAAa;IAkDf,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAwDjD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAkB5B;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC;AAE/C,wBAAgB,eAAe,YAE9B"}
@@ -220,7 +220,9 @@ class DaemonClient {
220
220
  type: 'PROCESS_IN_BACKGROUND',
221
221
  requirePath,
222
222
  data,
223
- });
223
+ // This method is sometimes passed data that cannot be serialized with v8
224
+ // so we force JSON serialization here
225
+ }, 'json');
224
226
  }
225
227
  recordOutputsHash(outputs, hash) {
226
228
  return this.sendToDaemonViaQueue({
@@ -371,8 +373,8 @@ class DaemonClient {
371
373
  }
372
374
  });
373
375
  }
374
- async sendToDaemonViaQueue(messageToDaemon) {
375
- return this.queue.sendToQueue(() => this.sendMessageToDaemon(messageToDaemon));
376
+ async sendToDaemonViaQueue(messageToDaemon, force) {
377
+ return this.queue.sendToQueue(() => this.sendMessageToDaemon(messageToDaemon, force));
376
378
  }
377
379
  setUpConnection() {
378
380
  this.socketMessenger = new daemon_socket_messenger_1.DaemonSocketMessenger((0, net_1.connect)((0, socket_utils_1.getFullOsSocketPath)())).listen((message) => this.handleMessage(message), () => {
@@ -397,12 +399,6 @@ class DaemonClient {
397
399
  if (!err.message) {
398
400
  return this.currentReject(daemonProcessException(err.toString()));
399
401
  }
400
- if (err.message.startsWith('LOCK-FILES-CHANGED')) {
401
- // retry the current message
402
- // we cannot send it via the queue because we are in the middle of processing
403
- // a message from the queue
404
- return this.sendMessageToDaemon(this.currentMessage).then(this.currentResolve, this.currentReject);
405
- }
406
402
  let error;
407
403
  if (err.message.startsWith('connect ENOENT')) {
408
404
  error = daemonProcessException('The Daemon Server is not running');
@@ -420,7 +416,7 @@ class DaemonClient {
420
416
  return this.currentReject(error);
421
417
  });
422
418
  }
423
- async sendMessageToDaemon(message) {
419
+ async sendMessageToDaemon(message, force) {
424
420
  if (this._daemonStatus == DaemonStatus.DISCONNECTED) {
425
421
  this._daemonStatus = DaemonStatus.CONNECTING;
426
422
  if (!(await this.isServerAvailable())) {
@@ -442,7 +438,7 @@ class DaemonClient {
442
438
  this.currentMessage = message;
443
439
  this.currentResolve = resolve;
444
440
  this.currentReject = reject;
445
- this.socketMessenger.sendMessage(message);
441
+ this.socketMessenger.sendMessage(message, force);
446
442
  }).finally(() => {
447
443
  clearTimeout(keepAlive);
448
444
  });
@@ -6,7 +6,7 @@ export interface Message extends Record<string, any> {
6
6
  export declare class DaemonSocketMessenger {
7
7
  private socket;
8
8
  constructor(socket: Socket);
9
- sendMessage(messageToDaemon: Message): Promise<void>;
9
+ sendMessage(messageToDaemon: Message, force?: 'v8' | 'json'): Promise<void>;
10
10
  listen(onData: (message: string) => void, onClose?: () => void, onError?: (err: Error) => void): this;
11
11
  close(): void;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"daemon-socket-messenger.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/client/daemon-socket-messenger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAQ7B,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,qBAAa,qBAAqB;IACpB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE5B,WAAW,CAAC,eAAe,EAAE,OAAO;IAW1C,MAAM,CACJ,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EACjC,OAAO,GAAE,MAAM,IAAe,EAC9B,OAAO,GAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAkB;IAe7C,KAAK;CAGN"}
1
+ {"version":3,"file":"daemon-socket-messenger.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/client/daemon-socket-messenger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAQ7B,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,qBAAa,qBAAqB;IACpB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE5B,WAAW,CAAC,eAAe,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM;IAOjE,MAAM,CACJ,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EACjC,OAAO,GAAE,MAAM,IAAe,EAC9B,OAAO,GAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAkB;IAe7C,KAAK;CAGN"}
@@ -1,21 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DaemonSocketMessenger = void 0;
4
- const v8_1 = require("v8");
5
4
  const consume_messages_from_socket_1 = require("../../utils/consume-messages-from-socket");
6
- const is_v8_serializer_enabled_1 = require("../is-v8-serializer-enabled");
5
+ const socket_utils_1 = require("../socket-utils");
7
6
  class DaemonSocketMessenger {
8
7
  constructor(socket) {
9
8
  this.socket = socket;
10
9
  }
11
- async sendMessage(messageToDaemon) {
12
- if ((0, is_v8_serializer_enabled_1.isV8SerializerEnabled)()) {
13
- const serialized = (0, v8_1.serialize)(messageToDaemon);
14
- this.socket.write(serialized.toString('binary'));
15
- }
16
- else {
17
- this.socket.write(JSON.stringify(messageToDaemon));
18
- }
10
+ async sendMessage(messageToDaemon, force) {
11
+ const serialized = (0, socket_utils_1.serialize)(messageToDaemon, force);
12
+ this.socket.write(serialized);
19
13
  // send EOT to indicate that the message has been fully written
20
14
  this.socket.write(consume_messages_from_socket_1.MESSAGE_END_SEQ);
21
15
  }
@@ -6,5 +6,5 @@ exports.isV8SerializerEnabled = isV8SerializerEnabled;
6
6
  * V8 serializer is enabled by default unless explicitly disabled.
7
7
  */
8
8
  function isV8SerializerEnabled() {
9
- return process.env.NX_USE_V8_SERIALIZER !== 'false';
9
+ return process.env.NX_USE_V8_SERIALIZER === 'true';
10
10
  }
@@ -10,4 +10,15 @@ export declare const getForkedProcessOsSocketPath: (id: string) => string;
10
10
  export declare const getPluginOsSocketPath: (id: string) => string;
11
11
  export declare function killSocketOrPath(): void;
12
12
  export declare function serializeResult(error: Error | null, serializedProjectGraph: string | null, serializedSourceMaps: string | null): string | null;
13
+ /**
14
+ * Helper to serialize data either using v8 serialization or JSON serialization, based on
15
+ * the user's preference and the success of each method. Should only be used by "client" side
16
+ * connections, daemon or other servers should respond based on the type of serialization used
17
+ * by the client it is communicating with.
18
+ *
19
+ * @param data Data to serialize
20
+ * @param force Forces one serialization method over the other
21
+ * @returns Serialized data as a string
22
+ */
23
+ export declare function serialize(data: any, force?: 'v8' | 'json'): string;
13
24
  //# sourceMappingURL=socket-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"socket-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/daemon/socket-utils.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS,SAAyB,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,cAM/B,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,IAAI,MAAM,WAMtD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,IAAI,MAAM,WAM/C,CAAC;AAgBF,wBAAgB,gBAAgB,IAAI,IAAI,CAIvC;AAGD,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,GAAG,IAAI,EACnB,sBAAsB,EAAE,MAAM,GAAG,IAAI,EACrC,oBAAoB,EAAE,MAAM,GAAG,IAAI,GAClC,MAAM,GAAG,IAAI,CAKf"}
1
+ {"version":3,"file":"socket-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/daemon/socket-utils.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS,SAAyB,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,cAM/B,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,IAAI,MAAM,WAMtD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,IAAI,MAAM,WAM/C,CAAC;AAgBF,wBAAgB,gBAAgB,IAAI,IAAI,CAIvC;AAGD,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,GAAG,IAAI,EACnB,sBAAsB,EAAE,MAAM,GAAG,IAAI,EACrC,oBAAoB,EAAE,MAAM,GAAG,IAAI,GAClC,MAAM,GAAG,IAAI,CAKf;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CA4BlE"}
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPluginOsSocketPath = exports.getForkedProcessOsSocketPath = exports.getFullOsSocketPath = exports.isWindows = void 0;
4
4
  exports.killSocketOrPath = killSocketOrPath;
5
5
  exports.serializeResult = serializeResult;
6
+ exports.serialize = serialize;
6
7
  const fs_1 = require("fs");
7
8
  const os_1 = require("os");
8
9
  const path_1 = require("path");
9
10
  const tmp_dir_1 = require("./tmp-dir");
10
11
  const serializable_error_1 = require("../utils/serializable-error");
12
+ const is_v8_serializer_enabled_1 = require("./is-v8-serializer-enabled");
13
+ const v8_1 = require("v8");
11
14
  exports.isWindows = (0, os_1.platform)() === 'win32';
12
15
  /**
13
16
  * For IPC with the daemon server we use unix sockets or windows named pipes, depending on the user's operating system.
@@ -53,3 +56,41 @@ function serializeResult(error, serializedProjectGraph, serializedSourceMaps) {
53
56
  // We do not want to repeat work `JSON.stringify`ing an object containing the potentially large project graph so merge as strings
54
57
  return `{ "error": ${JSON.stringify(error ? (0, serializable_error_1.createSerializableError)(error) : error)}, "projectGraph": ${serializedProjectGraph}, "sourceMaps": ${serializedSourceMaps} }`;
55
58
  }
59
+ /**
60
+ * Helper to serialize data either using v8 serialization or JSON serialization, based on
61
+ * the user's preference and the success of each method. Should only be used by "client" side
62
+ * connections, daemon or other servers should respond based on the type of serialization used
63
+ * by the client it is communicating with.
64
+ *
65
+ * @param data Data to serialize
66
+ * @param force Forces one serialization method over the other
67
+ * @returns Serialized data as a string
68
+ */
69
+ function serialize(data, force) {
70
+ if (force === 'v8' || (0, is_v8_serializer_enabled_1.isV8SerializerEnabled)()) {
71
+ try {
72
+ return (0, v8_1.serialize)(data).toString('binary');
73
+ }
74
+ catch (e) {
75
+ if (force !== 'v8') {
76
+ console.warn(`Data could not be serialized using v8 serialization: ${e}. Falling back to JSON serialization.`);
77
+ // Fall back to JSON serialization
78
+ return JSON.stringify(data);
79
+ }
80
+ throw e;
81
+ }
82
+ }
83
+ else {
84
+ try {
85
+ return JSON.stringify(data);
86
+ }
87
+ catch (e) {
88
+ if (force !== 'json') {
89
+ // Fall back to v8 serialization
90
+ console.warn(`Data could not be serialized using JSON.stringify: ${e}. Falling back to v8 serialization.`);
91
+ return (0, v8_1.serialize)(data).toString('binary');
92
+ }
93
+ throw e;
94
+ }
95
+ }
96
+ }
Binary file
@@ -15,7 +15,7 @@ function execAsync(command, execOptions) {
15
15
  if (err) {
16
16
  return rej(err);
17
17
  }
18
- res(stdout);
18
+ res(stdout.toString());
19
19
  });
20
20
  });
21
21
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Helper that tries to derive the name of the CI group, based on the related target name.
3
+ *
4
+ * This will work well when the CI target name follows the documented naming convention or similar (for e.g `test-ci`, `e2e-ci`, `ny-e2e-ci`, etc).
5
+ *
6
+ * For example, `test-ci` => `TEST (CI)`, `e2e-ci` => `E2E (CI)`, `my-e2e-ci` => `MY E2E (CI)`
7
+ *
8
+ * @param ciTargetName name of the CI target
9
+ * @returns the derived group name or `${ciTargetName.toUpperCase()} (CI)` if cannot be derived automatically
10
+ */
11
+ export declare function deriveGroupNameFromTarget(ciTargetName: string | undefined): string;
12
+ //# sourceMappingURL=atomizer-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atomizer-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/utils/plugins/atomizer-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,UAYzE"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deriveGroupNameFromTarget = deriveGroupNameFromTarget;
4
+ /**
5
+ * Helper that tries to derive the name of the CI group, based on the related target name.
6
+ *
7
+ * This will work well when the CI target name follows the documented naming convention or similar (for e.g `test-ci`, `e2e-ci`, `ny-e2e-ci`, etc).
8
+ *
9
+ * For example, `test-ci` => `TEST (CI)`, `e2e-ci` => `E2E (CI)`, `my-e2e-ci` => `MY E2E (CI)`
10
+ *
11
+ * @param ciTargetName name of the CI target
12
+ * @returns the derived group name or `${ciTargetName.toUpperCase()} (CI)` if cannot be derived automatically
13
+ */
14
+ function deriveGroupNameFromTarget(ciTargetName) {
15
+ if (!ciTargetName) {
16
+ return null;
17
+ }
18
+ const parts = ciTargetName.split('-').map((v) => v.toUpperCase());
19
+ if (parts.length > 1) {
20
+ return `${parts.slice(0, -1).join(' ')} (${parts[parts.length - 1]})`;
21
+ }
22
+ return `${parts[0]} (CI)`; // default group name when there is a single segment
23
+ }
@@ -2,4 +2,5 @@ export { getInstalledPluginsAndCapabilities } from './installed-plugins';
2
2
  export { getLocalWorkspacePlugins } from './local-plugins';
3
3
  export { listPlugins, listAlsoAvailableCorePlugins, listPluginCapabilities, } from './output';
4
4
  export { getPluginCapabilities } from './plugin-capabilities';
5
+ export { deriveGroupNameFromTarget } from './atomizer-utils';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/utils/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EACL,WAAW,EACX,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/utils/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EACL,WAAW,EACX,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPluginCapabilities = exports.listPluginCapabilities = exports.listAlsoAvailableCorePlugins = exports.listPlugins = exports.getLocalWorkspacePlugins = exports.getInstalledPluginsAndCapabilities = void 0;
3
+ exports.deriveGroupNameFromTarget = exports.getPluginCapabilities = exports.listPluginCapabilities = exports.listAlsoAvailableCorePlugins = exports.listPlugins = exports.getLocalWorkspacePlugins = exports.getInstalledPluginsAndCapabilities = void 0;
4
4
  var installed_plugins_1 = require("./installed-plugins");
5
5
  Object.defineProperty(exports, "getInstalledPluginsAndCapabilities", { enumerable: true, get: function () { return installed_plugins_1.getInstalledPluginsAndCapabilities; } });
6
6
  var local_plugins_1 = require("./local-plugins");
@@ -11,3 +11,5 @@ Object.defineProperty(exports, "listAlsoAvailableCorePlugins", { enumerable: tru
11
11
  Object.defineProperty(exports, "listPluginCapabilities", { enumerable: true, get: function () { return output_1.listPluginCapabilities; } });
12
12
  var plugin_capabilities_1 = require("./plugin-capabilities");
13
13
  Object.defineProperty(exports, "getPluginCapabilities", { enumerable: true, get: function () { return plugin_capabilities_1.getPluginCapabilities; } });
14
+ var atomizer_utils_1 = require("./atomizer-utils");
15
+ Object.defineProperty(exports, "deriveGroupNameFromTarget", { enumerable: true, get: function () { return atomizer_utils_1.deriveGroupNameFromTarget; } });