@pnpm/installing.env-installer 1101.1.0 → 1101.1.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.
@@ -21,8 +21,16 @@ export async function installConfigDeps(configDepsOrLockfile, opts) {
21
21
  const globalVirtualStoreDir = path.join(opts.storeDir, 'links');
22
22
  const configModulesDir = path.join(opts.rootDir, 'node_modules/.pnpm-config');
23
23
  const existingConfigDeps = await readModulesDir(configModulesDir) ?? [];
24
+ let startedEmitted = false;
25
+ const reportStarted = () => {
26
+ if (startedEmitted)
27
+ return;
28
+ startedEmitted = true;
29
+ installingConfigDepsLogger.debug({ status: 'started' });
30
+ };
24
31
  await Promise.all(existingConfigDeps.map(async (existingConfigDep) => {
25
32
  if (!normalizedDeps[existingConfigDep]) {
33
+ reportStarted();
26
34
  await rimraf(path.join(configModulesDir, existingConfigDep));
27
35
  }
28
36
  }));
@@ -49,8 +57,8 @@ export async function installConfigDeps(configDepsOrLockfile, opts) {
49
57
  // get pruned and relinked.
50
58
  const parentSymlinkAlreadyCorrect = existingConfigDeps.includes(pkgName) &&
51
59
  await symlinkPointsTo(configDepPath, pkgDirInGlobalVirtualStore);
52
- installingConfigDepsLogger.debug({ status: 'started' });
53
60
  if (!fs.existsSync(path.join(pkgDirInGlobalVirtualStore, 'package.json'))) {
61
+ reportStarted();
54
62
  const { fetching } = await opts.store.fetchPackage({
55
63
  force: true,
56
64
  lockfileDir: opts.rootDir,
@@ -77,11 +85,13 @@ export async function installConfigDeps(configDepsOrLockfile, opts) {
77
85
  globalVirtualStoreDir,
78
86
  rootDir: opts.rootDir,
79
87
  store: opts.store,
88
+ reportStarted,
80
89
  });
81
90
  }
82
91
  if (parentSymlinkAlreadyCorrect) {
83
92
  return;
84
93
  }
94
+ reportStarted();
85
95
  if (existingConfigDeps.includes(pkgName)) {
86
96
  await rimraf(configDepPath);
87
97
  }
@@ -206,14 +216,17 @@ async function installOptionalSubdeps(opts) {
206
216
  });
207
217
  const expectedSiblings = new Set([opts.parentName, ...compatibleSubdeps.map((s) => s.name)]);
208
218
  const existingSiblings = await readModulesDir(opts.parentNodeModulesDir) ?? [];
209
- await Promise.all(existingSiblings
210
- .filter((name) => !expectedSiblings.has(name))
211
- .map((name) => rimraf(path.join(opts.parentNodeModulesDir, name))));
219
+ const orphanSiblings = existingSiblings.filter((name) => !expectedSiblings.has(name));
220
+ if (orphanSiblings.length > 0) {
221
+ opts.reportStarted();
222
+ }
223
+ await Promise.all(orphanSiblings.map((name) => rimraf(path.join(opts.parentNodeModulesDir, name))));
212
224
  await Promise.all(compatibleSubdeps.map(async (subdep) => {
213
225
  const subdepFullPkgId = `${subdep.name}@${subdep.version}:${subdep.resolution.integrity}`;
214
226
  const subdepRelPath = calcLeafGlobalVirtualStorePath(subdepFullPkgId, subdep.name, subdep.version);
215
227
  const subdepDirInGlobalVirtualStore = path.join(opts.globalVirtualStoreDir, subdepRelPath, 'node_modules', subdep.name);
216
228
  if (!fs.existsSync(path.join(subdepDirInGlobalVirtualStore, 'package.json'))) {
229
+ opts.reportStarted();
217
230
  const { fetching } = await opts.store.fetchPackage({
218
231
  force: true,
219
232
  lockfileDir: opts.rootDir,
@@ -230,6 +243,10 @@ async function installOptionalSubdeps(opts) {
230
243
  });
231
244
  }
232
245
  const linkPath = path.join(opts.parentNodeModulesDir, subdep.name);
246
+ if (await symlinkPointsTo(linkPath, subdepDirInGlobalVirtualStore)) {
247
+ return;
248
+ }
249
+ opts.reportStarted();
233
250
  await fs.promises.mkdir(path.dirname(linkPath), { recursive: true });
234
251
  await symlinkDir(subdepDirInGlobalVirtualStore, linkPath);
235
252
  }));
@@ -8,6 +8,7 @@ import { createFetchFromRegistry } from '@pnpm/network.fetch';
8
8
  import { createNpmResolver } from '@pnpm/resolving.npm-resolver';
9
9
  import { parseWantedDependency } from '@pnpm/resolving.parse-wanted-dependency';
10
10
  import { installConfigDeps } from './installConfigDeps.js';
11
+ import { pruneEnvLockfile } from './pruneEnvLockfile.js';
11
12
  import { resolveOptionalSubdeps } from './resolveOptionalSubdeps.js';
12
13
  export async function resolveConfigDeps(configDeps, opts) {
13
14
  if (opts.frozenLockfile) {
@@ -54,6 +55,7 @@ export async function resolveConfigDeps(configDeps, opts) {
54
55
  });
55
56
  envLockfile.snapshots[pkgKey] = optionalSubdeps ? { optionalDependencies: optionalSubdeps } : {};
56
57
  }));
58
+ pruneEnvLockfile(envLockfile);
57
59
  await Promise.all([
58
60
  writeSettings({
59
61
  ...opts,
@@ -65,7 +65,7 @@ export async function resolveOptionalSubdeps(parentName, parentManifest, opts) {
65
65
  ...pickPlatformFields(resolution.manifest),
66
66
  };
67
67
  if (opts.envLockfile.snapshots[subdepKey] == null) {
68
- opts.envLockfile.snapshots[subdepKey] = {};
68
+ opts.envLockfile.snapshots[subdepKey] = { optional: true };
69
69
  }
70
70
  resolved[subdepName] = subdepVersion;
71
71
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/installing.env-installer",
3
- "version": "1101.1.0",
3
+ "version": "1101.1.2",
4
4
  "description": "Installer for configurational dependencies",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -30,26 +30,26 @@
30
30
  "semver": "^7.7.2",
31
31
  "symlink-dir": "^10.0.1",
32
32
  "@pnpm/config.package-is-installable": "1100.0.6",
33
+ "@pnpm/config.pick-registry-for-package": "1100.0.5",
33
34
  "@pnpm/config.writer": "1100.0.9",
34
- "@pnpm/config.pick-registry-for-package": "1100.0.4",
35
35
  "@pnpm/constants": "1100.0.0",
36
+ "@pnpm/core-loggers": "1100.1.1",
36
37
  "@pnpm/deps.graph-hasher": "1100.2.1",
37
38
  "@pnpm/error": "1100.0.0",
38
- "@pnpm/installing.deps-resolver": "1100.1.1",
39
39
  "@pnpm/fs.read-modules-dir": "1100.0.1",
40
40
  "@pnpm/lockfile.fs": "1100.1.1",
41
- "@pnpm/lockfile.utils": "1100.0.9",
42
- "@pnpm/lockfile.types": "1100.0.7",
41
+ "@pnpm/installing.deps-resolver": "1100.1.3",
43
42
  "@pnpm/lockfile.pruner": "1100.0.7",
44
- "@pnpm/network.auth-header": "1100.0.3",
43
+ "@pnpm/lockfile.types": "1100.0.7",
44
+ "@pnpm/lockfile.utils": "1100.0.9",
45
45
  "@pnpm/network.fetch": "1100.0.6",
46
46
  "@pnpm/pkg-manifest.reader": "1100.0.4",
47
+ "@pnpm/resolving.npm-resolver": "1101.3.2",
47
48
  "@pnpm/resolving.parse-wanted-dependency": "1100.0.1",
48
- "@pnpm/store.controller-types": "1100.1.1",
49
49
  "@pnpm/store.controller": "1101.0.8",
50
+ "@pnpm/store.controller-types": "1100.1.1",
50
51
  "@pnpm/types": "1101.1.1",
51
- "@pnpm/resolving.npm-resolver": "1101.3.0",
52
- "@pnpm/core-loggers": "1100.1.1"
52
+ "@pnpm/network.auth-header": "1100.0.3"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@pnpm/logger": ">=1001.0.0 <1002.0.0",
@@ -61,9 +61,9 @@
61
61
  "@types/semver": "7.7.1",
62
62
  "load-json-file": "^7.0.1",
63
63
  "read-yaml-file": "^3.0.0",
64
- "@pnpm/installing.env-installer": "1101.1.0",
64
+ "@pnpm/installing.env-installer": "1101.1.2",
65
65
  "@pnpm/prepare": "1100.0.10",
66
- "@pnpm/testing.temp-store": "1100.1.1"
66
+ "@pnpm/testing.temp-store": "1100.1.3"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=22.13"