nx 19.6.0-beta.0 → 19.6.0-beta.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.
Files changed (39) hide show
  1. package/package.json +12 -12
  2. package/release/changelog-renderer/index.js +16 -1
  3. package/src/command-line/init/init-v2.js +1 -1
  4. package/src/command-line/release/changelog.js +80 -42
  5. package/src/command-line/release/config/version-plans.d.ts +5 -0
  6. package/src/command-line/release/config/version-plans.js +9 -5
  7. package/src/command-line/release/plan.js +25 -45
  8. package/src/command-line/release/utils/generate-version-plan-content.js +2 -3
  9. package/src/command-line/release/version.d.ts +5 -0
  10. package/src/core/graph/main.js +1 -1
  11. package/src/core/graph/styles.css +1 -1
  12. package/src/daemon/cache.d.ts +1 -0
  13. package/src/daemon/cache.js +25 -18
  14. package/src/daemon/client/client.js +9 -1
  15. package/src/daemon/message-types/force-shutdown.d.ts +5 -0
  16. package/src/daemon/message-types/force-shutdown.js +11 -0
  17. package/src/daemon/server/handle-force-shutdown.d.ts +5 -0
  18. package/src/daemon/server/handle-force-shutdown.js +18 -0
  19. package/src/daemon/server/handle-request-shutdown.js +2 -0
  20. package/src/daemon/server/server.d.ts +1 -0
  21. package/src/daemon/server/server.js +14 -0
  22. package/src/daemon/server/shutdown-utils.d.ts +2 -1
  23. package/src/daemon/server/shutdown-utils.js +11 -4
  24. package/src/daemon/server/watcher.js +3 -0
  25. package/src/native/nx.wasm32-wasi.wasm +0 -0
  26. package/src/nx-cloud/models/onboarding-status.d.ts +1 -0
  27. package/src/nx-cloud/models/onboarding-status.js +2 -0
  28. package/src/nx-cloud/utilities/is-workspace-claimed.d.ts +1 -0
  29. package/src/nx-cloud/utilities/is-workspace-claimed.js +24 -0
  30. package/src/nx-cloud/utilities/onboarding.d.ts +5 -0
  31. package/src/nx-cloud/utilities/onboarding.js +28 -0
  32. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +7 -2
  33. package/src/project-graph/plugins/internal-api.js +16 -5
  34. package/src/project-graph/plugins/isolation/messaging.d.ts +5 -1
  35. package/src/project-graph/plugins/isolation/messaging.js +1 -0
  36. package/src/project-graph/plugins/isolation/plugin-pool.js +4 -6
  37. package/src/project-graph/plugins/isolation/plugin-worker.js +15 -0
  38. package/src/project-graph/utils/project-configuration-utils.js +5 -2
  39. package/src/utils/package-manager.js +12 -3
@@ -29,8 +29,8 @@ async function loadRemoteNxPlugin(plugin, root) {
29
29
  const exitHandler = createWorkerExitHandler(worker, pendingPromises);
30
30
  const cleanupFunction = () => {
31
31
  worker.off('exit', exitHandler);
32
+ shutdownPluginWorker(socket);
32
33
  socket.destroy();
33
- shutdownPluginWorker(worker);
34
34
  nxPluginWorkerCache.delete(cacheKey);
35
35
  };
36
36
  cleanupFunctions.add(cleanupFunction);
@@ -55,11 +55,8 @@ async function loadRemoteNxPlugin(plugin, root) {
55
55
  nxPluginWorkerCache.set(cacheKey, pluginPromise);
56
56
  return [pluginPromise, cleanupFunction];
57
57
  }
58
- function shutdownPluginWorker(worker) {
59
- // Clears the plugin cache so no refs to the workers are held
60
- internal_api_1.nxPluginCache.clear();
61
- // logger.verbose(`[plugin-pool] starting worker shutdown`);
62
- worker.kill('SIGINT');
58
+ function shutdownPluginWorker(socket) {
59
+ (0, messaging_1.sendMessageOverSocket)(socket, { type: 'shutdown', payload: {} });
63
60
  }
64
61
  /**
65
62
  * Creates a message handler for the given worker.
@@ -200,6 +197,7 @@ function createWorkerExitHandler(worker, pendingPromises) {
200
197
  }
201
198
  let cleanedUp = false;
202
199
  const exitHandler = () => {
200
+ internal_api_1.nxPluginCache.clear();
203
201
  for (const fn of cleanupFunctions) {
204
202
  fn();
205
203
  }
@@ -49,6 +49,21 @@ const server = (0, net_1.createServer)((socket) => {
49
49
  };
50
50
  }
51
51
  },
52
+ shutdown: async () => {
53
+ // Stops accepting new connections, but existing connections are
54
+ // not closed immediately.
55
+ server.close(() => {
56
+ try {
57
+ (0, fs_1.unlinkSync)(socketPath);
58
+ }
59
+ catch (e) { }
60
+ process.exit(0);
61
+ });
62
+ // Closes existing connection.
63
+ socket.end();
64
+ // Destroys the socket once it's fully closed.
65
+ socket.destroySoon();
66
+ },
52
67
  createNodes: async ({ configFiles, context, tx }) => {
53
68
  try {
54
69
  const result = await plugin.createNodes[1](configFiles, context);
@@ -446,7 +446,7 @@ function normalizeTargets(project, sourceMaps, nxJsonConfiguration) {
446
446
  project.targets[targetName] = normalizeTarget(project.targets[targetName], project);
447
447
  const projectSourceMaps = sourceMaps[project.root];
448
448
  const targetConfig = project.targets[targetName];
449
- const targetDefaults = readTargetDefaultsForTarget(targetName, nxJsonConfiguration.targetDefaults, targetConfig.executor);
449
+ const targetDefaults = deepClone(readTargetDefaultsForTarget(targetName, nxJsonConfiguration.targetDefaults, targetConfig.executor));
450
450
  // We only apply defaults if they exist
451
451
  if (targetDefaults && isCompatibleTarget(targetConfig, targetDefaults)) {
452
452
  project.targets[targetName] = mergeTargetDefaultWithTargetDefinition(targetName, project, normalizeTarget(targetDefaults, project), projectSourceMaps);
@@ -499,9 +499,12 @@ function targetDefaultShouldBeApplied(key, sourceMap) {
499
499
  const [, plugin] = sourceInfo;
500
500
  return !plugin?.startsWith('nx/');
501
501
  }
502
+ function deepClone(obj) {
503
+ return JSON.parse(JSON.stringify(obj));
504
+ }
502
505
  function mergeTargetDefaultWithTargetDefinition(targetName, project, targetDefault, sourceMap) {
503
506
  const targetDefinition = project.targets[targetName] ?? {};
504
- const result = JSON.parse(JSON.stringify(targetDefinition));
507
+ const result = deepClone(targetDefinition);
505
508
  for (const key in targetDefault) {
506
509
  switch (key) {
507
510
  case 'options': {
@@ -176,6 +176,7 @@ function getPackageManagerVersion(packageManager = detectPackageManager(), cwd =
176
176
  version = (0, child_process_1.execSync)(`${packageManager} --version`, {
177
177
  cwd,
178
178
  encoding: 'utf-8',
179
+ windowsHide: true,
179
180
  }).trim();
180
181
  }
181
182
  catch {
@@ -349,7 +350,10 @@ async function resolvePackageVersionUsingInstallation(packageName, version) {
349
350
  const { dir, cleanup } = createTempNpmDirectory();
350
351
  try {
351
352
  const pmc = getPackageManagerCommand();
352
- await execAsync(`${pmc.add} ${packageName}@${version}`, { cwd: dir });
353
+ await execAsync(`${pmc.add} ${packageName}@${version}`, {
354
+ cwd: dir,
355
+ windowsHide: true,
356
+ });
353
357
  const { packageJson } = (0, package_json_1.readModulePackageJson)(packageName, [dir]);
354
358
  return packageJson.version;
355
359
  }
@@ -372,7 +376,9 @@ async function packageRegistryView(pkg, version, args) {
372
376
  */
373
377
  pm = 'npm';
374
378
  }
375
- const { stdout } = await execAsync(`${pm} view ${pkg}@${version} ${args}`);
379
+ const { stdout } = await execAsync(`${pm} view ${pkg}@${version} ${args}`, {
380
+ windowsHide: true,
381
+ });
376
382
  return stdout.toString().trim();
377
383
  }
378
384
  async function packageRegistryPack(cwd, pkg, version) {
@@ -389,7 +395,10 @@ async function packageRegistryPack(cwd, pkg, version) {
389
395
  */
390
396
  pm = 'npm';
391
397
  }
392
- const { stdout } = await execAsync(`${pm} pack ${pkg}@${version}`, { cwd });
398
+ const { stdout } = await execAsync(`${pm} pack ${pkg}@${version}`, {
399
+ cwd,
400
+ windowsHide: true,
401
+ });
393
402
  const tarballPath = stdout.trim();
394
403
  return { tarballPath };
395
404
  }