nx 22.7.0-beta.13 → 22.7.0-beta.14

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.
@@ -741,7 +741,37 @@ async function downloadPackageMigrationsFromRegistry(packageName, packageVersion
741
741
  }
742
742
  return result;
743
743
  }
744
+ function createConcurrencyLimiter(concurrency) {
745
+ const queue = [];
746
+ let active = 0;
747
+ function next() {
748
+ while (queue.length > 0 && active < concurrency) {
749
+ active++;
750
+ queue.shift()();
751
+ }
752
+ }
753
+ return function limit(fn) {
754
+ return new Promise((resolve, reject) => {
755
+ queue.push(() => {
756
+ fn()
757
+ .then(resolve, reject)
758
+ .finally(() => {
759
+ active--;
760
+ next();
761
+ });
762
+ });
763
+ next();
764
+ });
765
+ };
766
+ }
767
+ const installConcurrencyLimit = process.env.NX_MIGRATE_INSTALL_CONCURRENCY
768
+ ? createConcurrencyLimiter(Math.max(1, Math.floor(Number(process.env.NX_MIGRATE_INSTALL_CONCURRENCY)) || 1))
769
+ : null;
744
770
  async function getPackageMigrationsUsingInstall(packageName, packageVersion) {
771
+ const run = () => getPackageMigrationsUsingInstallImpl(packageName, packageVersion);
772
+ return installConcurrencyLimit ? installConcurrencyLimit(run) : run();
773
+ }
774
+ async function getPackageMigrationsUsingInstallImpl(packageName, packageVersion) {
745
775
  const { dir, cleanup } = (0, package_manager_1.createTempNpmDirectory)();
746
776
  let result;
747
777
  if ((0, provenance_1.getNxPackageGroup)().includes(packageName)) {
Binary file
@@ -45,7 +45,25 @@ function loadPnpmHoistedDepsDefinition() {
45
45
  */
46
46
  function parseAndNormalizePnpmLockfile(content) {
47
47
  const { load } = require('@zkochan/js-yaml');
48
- return convertToLockfileObject(load(content));
48
+ return convertToLockfileObject(load(extractMainLockfileDocument(content)));
49
+ }
50
+ // https://github.com/pnpm/pnpm/blob/main/lockfile/fs/src/yamlDocuments.ts
51
+ const YAML_DOCUMENT_START = '---\n';
52
+ const YAML_DOCUMENT_SEPARATOR = '\n---\n';
53
+ // pnpm 11 writes a two-document lockfile when `managePackageManagerVersions` is
54
+ // enabled: the first document holds package-manager metadata, and the second
55
+ // holds the workspace lockfile. Mirror pnpm's own positional extraction so we
56
+ // always read the workspace document.
57
+ // https://github.com/pnpm/pnpm/blob/main/lockfile/fs/src/yamlDocuments.ts
58
+ function extractMainLockfileDocument(content) {
59
+ if (!content.startsWith(YAML_DOCUMENT_START)) {
60
+ return content;
61
+ }
62
+ const separatorIndex = content.indexOf(YAML_DOCUMENT_SEPARATOR, YAML_DOCUMENT_START.length);
63
+ if (separatorIndex === -1) {
64
+ return '';
65
+ }
66
+ return content.slice(separatorIndex + YAML_DOCUMENT_SEPARATOR.length);
49
67
  }
50
68
  // https://github.com/pnpm/pnpm/blob/50e37072f42bcca6d393a74bed29f7f0e029805d/lockfile/lockfile-file/src/write.ts#L22
51
69
  const LOCKFILE_YAML_FORMAT = {
@@ -159,7 +159,7 @@ class TaskOrchestrator {
159
159
  .map((id) => this.taskGraph.tasks[id])
160
160
  .filter((t) => !t.hash &&
161
161
  this.taskGraph.dependencies[t.id].every((depId) => this.completedTasks.has(depId)));
162
- if (unhashed.length > 1) {
162
+ if (unhashed.length > 0) {
163
163
  const perTaskEnvs = {};
164
164
  for (const task of unhashed) {
165
165
  perTaskEnvs[task.id] = (0, task_env_1.getTaskSpecificEnv)(task, this.projectGraph);
@@ -561,6 +561,9 @@ class TaskOrchestrator {
561
561
  const cacheableTasks = tasks.filter((t) => (0, utils_1.isCacheableTask)(t, this.options));
562
562
  if (cacheableTasks.length === 0)
563
563
  return [];
564
+ // Wait for any queued processTask promises to settle so task.hash is
565
+ // populated before cache.getBatch maps it into a Rust String.
566
+ await Promise.all(cacheableTasks.map((t) => this.processedTasks.get(t.id)));
564
567
  const cacheHits = await this.fetchCacheHits(cacheableTasks);
565
568
  if (cacheHits.length === 0)
566
569
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "22.7.0-beta.13",
3
+ "version": "22.7.0-beta.14",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
@@ -171,16 +171,16 @@
171
171
  }
172
172
  },
173
173
  "optionalDependencies": {
174
- "@nx/nx-darwin-arm64": "22.7.0-beta.13",
175
- "@nx/nx-darwin-x64": "22.7.0-beta.13",
176
- "@nx/nx-freebsd-x64": "22.7.0-beta.13",
177
- "@nx/nx-linux-arm-gnueabihf": "22.7.0-beta.13",
178
- "@nx/nx-linux-arm64-gnu": "22.7.0-beta.13",
179
- "@nx/nx-linux-arm64-musl": "22.7.0-beta.13",
180
- "@nx/nx-linux-x64-gnu": "22.7.0-beta.13",
181
- "@nx/nx-linux-x64-musl": "22.7.0-beta.13",
182
- "@nx/nx-win32-arm64-msvc": "22.7.0-beta.13",
183
- "@nx/nx-win32-x64-msvc": "22.7.0-beta.13"
174
+ "@nx/nx-darwin-arm64": "22.7.0-beta.14",
175
+ "@nx/nx-darwin-x64": "22.7.0-beta.14",
176
+ "@nx/nx-freebsd-x64": "22.7.0-beta.14",
177
+ "@nx/nx-linux-arm-gnueabihf": "22.7.0-beta.14",
178
+ "@nx/nx-linux-arm64-gnu": "22.7.0-beta.14",
179
+ "@nx/nx-linux-arm64-musl": "22.7.0-beta.14",
180
+ "@nx/nx-linux-x64-gnu": "22.7.0-beta.14",
181
+ "@nx/nx-linux-x64-musl": "22.7.0-beta.14",
182
+ "@nx/nx-win32-arm64-msvc": "22.7.0-beta.14",
183
+ "@nx/nx-win32-x64-msvc": "22.7.0-beta.14"
184
184
  },
185
185
  "nx-migrations": {
186
186
  "migrations": "./migrations.json",