@pnpm/installing.deps-restorer 1006.0.0 → 1100.0.0

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.
package/lib/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { type LockfileObject } from '@pnpm/lockfile.fs';
4
4
  import { type LogBase } from '@pnpm/logger';
5
5
  import type { PatchGroupRecord } from '@pnpm/patching.config';
6
6
  import type { StoreController } from '@pnpm/store.controller-types';
7
- import { type DepPath, type HoistedDependencies, type IgnoredBuilds, type ProjectId, type ProjectManifest, type ProjectRootDir, type Registries, type SupportedArchitectures } from '@pnpm/types';
7
+ import { type DepPath, type HoistedDependencies, type IgnoredBuilds, type ProjectId, type ProjectManifest, type ProjectRootDir, type Registries, type RegistryConfig, type SupportedArchitectures } from '@pnpm/types';
8
8
  export { extendProjectsWithTargetDirs } from './extendProjectsWithTargetDirs.js';
9
9
  export type { HoistingLimits };
10
10
  export type ReporterFunction = (logObj: LogBase) => void;
@@ -36,7 +36,6 @@ export interface HeadlessOptions {
36
36
  preferSymlinkedExecutables?: boolean;
37
37
  hoistingLimits?: HoistingLimits;
38
38
  externalDependencies?: Set<string>;
39
- ignoreDepScripts: boolean;
40
39
  ignoreScripts: boolean;
41
40
  ignorePackageManifest?: boolean;
42
41
  /**
@@ -72,7 +71,7 @@ export interface HeadlessOptions {
72
71
  disableRelinkLocalDirDeps?: boolean;
73
72
  force: boolean;
74
73
  storeDir: string;
75
- rawConfig: object;
74
+ configByUri: Record<string, RegistryConfig>;
76
75
  unsafePerm: boolean;
77
76
  userAgent: string;
78
77
  registries: Registries;
package/lib/index.js CHANGED
@@ -62,7 +62,7 @@ export async function headlessInstall(opts) {
62
62
  extraNodePaths: opts.extraNodePaths,
63
63
  preferSymlinkedExecutables: opts.preferSymlinkedExecutables,
64
64
  extraEnv: opts.extraEnv,
65
- rawConfig: opts.rawConfig,
65
+ configByUri: opts.configByUri,
66
66
  resolveSymlinksInInjectedDirs: opts.resolveSymlinksInInjectedDirs,
67
67
  scriptsPrependNodePath: opts.scriptsPrependNodePath,
68
68
  scriptShell: opts.scriptShell,
@@ -152,6 +152,9 @@ export async function headlessInstall(opts) {
152
152
  }
153
153
  }
154
154
  }
155
+ if (opts.enableGlobalVirtualStore) {
156
+ opts.allowBuilds ??= {};
157
+ }
155
158
  const allowBuild = createAllowBuildFunction(opts);
156
159
  const lockfileToDepGraphOpts = {
157
160
  ...opts,
@@ -182,6 +185,7 @@ export async function headlessInstall(opts) {
182
185
  }
183
186
  const depNodes = Object.values(graph);
184
187
  const added = depNodes.filter(({ fetching }) => fetching).length;
188
+ const skipGvsInternalLinking = opts.enableGlobalVirtualStore === true && added === 0;
185
189
  statsLogger.debug({
186
190
  added,
187
191
  prefix: lockfileDir,
@@ -222,28 +226,30 @@ export async function headlessInstall(opts) {
222
226
  }
223
227
  }
224
228
  else if (opts.enableModulesDir !== false || opts.enableGlobalVirtualStore) {
225
- if (opts.enableModulesDir !== false) {
226
- await Promise.all(depNodes.map(async (depNode) => fs.mkdir(depNode.modules, { recursive: true })));
227
- }
228
- await Promise.all([
229
- opts.symlink === false || opts.enableModulesDir === false
230
- ? Promise.resolve()
231
- : linkAllModules(depNodes, {
232
- optional: opts.include.optionalDependencies,
229
+ if (!skipGvsInternalLinking) {
230
+ if (opts.enableModulesDir !== false) {
231
+ await Promise.all(depNodes.map(async (depNode) => fs.mkdir(depNode.modules, { recursive: true })));
232
+ }
233
+ await Promise.all([
234
+ opts.symlink === false || opts.enableModulesDir === false
235
+ ? Promise.resolve()
236
+ : linkAllModules(depNodes, {
237
+ optional: opts.include.optionalDependencies,
238
+ }),
239
+ linkAllPkgs(opts.storeController, depNodes, {
240
+ allowBuild,
241
+ force: opts.force,
242
+ disableRelinkLocalDirDeps: opts.disableRelinkLocalDirDeps,
243
+ depGraph: graph,
244
+ depsStateCache,
245
+ enableGlobalVirtualStore: opts.enableGlobalVirtualStore,
246
+ ignoreScripts: opts.ignoreScripts,
247
+ lockfileDir: opts.lockfileDir,
248
+ sideEffectsCacheRead: opts.sideEffectsCacheRead,
249
+ storeDir: opts.storeDir,
233
250
  }),
234
- linkAllPkgs(opts.storeController, depNodes, {
235
- allowBuild,
236
- force: opts.force,
237
- disableRelinkLocalDirDeps: opts.disableRelinkLocalDirDeps,
238
- depGraph: graph,
239
- depsStateCache,
240
- enableGlobalVirtualStore: opts.enableGlobalVirtualStore,
241
- ignoreScripts: opts.ignoreScripts,
242
- lockfileDir: opts.lockfileDir,
243
- sideEffectsCacheRead: opts.sideEffectsCacheRead,
244
- storeDir: opts.storeDir,
245
- }),
246
- ]);
251
+ ]);
252
+ }
247
253
  stageLogger.debug({
248
254
  prefix: lockfileDir,
249
255
  stage: 'importing_done',
@@ -284,7 +290,7 @@ export async function headlessInstall(opts) {
284
290
  else {
285
291
  newHoistedDependencies = {};
286
292
  }
287
- if (!skipPostImportLinking) {
293
+ if (!skipPostImportLinking && !skipGvsInternalLinking) {
288
294
  await linkAllBins(graph, {
289
295
  extraNodePaths: opts.extraNodePaths,
290
296
  optional: opts.include.optionalDependencies,
@@ -353,12 +359,11 @@ export async function headlessInstall(opts) {
353
359
  extraBinPaths,
354
360
  extraEnv,
355
361
  depsStateCache,
356
- ignoreScripts: opts.ignoreScripts || opts.ignoreDepScripts,
362
+ ignoreScripts: opts.ignoreScripts,
357
363
  hoistedLocations,
358
364
  lockfileDir,
359
365
  optional: opts.include.optionalDependencies,
360
366
  preferSymlinkedExecutables: opts.preferSymlinkedExecutables,
361
- rawConfig: opts.rawConfig,
362
367
  rootModulesDir: virtualStoreDir,
363
368
  scriptsPrependNodePath: opts.scriptsPrependNodePath,
364
369
  scriptShell: opts.scriptShell,
@@ -404,6 +409,9 @@ export async function headlessInstall(opts) {
404
409
  }
405
410
  }
406
411
  }
412
+ // Skip packages without bins to avoid unnecessary manifest reads.
413
+ // Dirs not in graph (e.g. link: deps) are kept since they may expose bins.
414
+ directPkgDirs = directPkgDirs.filter((dir) => graph[dir] == null || graph[dir].hasBin);
407
415
  await linkBinsOfPackages((await Promise.all(directPkgDirs.map(async (dir) => ({
408
416
  location: dir,
409
417
  manifest: await safeReadProjectManifestOnly(dir),
@@ -624,7 +632,7 @@ async function linkAllPkgs(storeController, depNodes, opts) {
624
632
  depNode.requiresBuild = filesResponse.requiresBuild;
625
633
  let sideEffectsCacheKey;
626
634
  if (opts.sideEffectsCacheRead && filesResponse.sideEffectsMaps && !isEmpty(filesResponse.sideEffectsMaps)) {
627
- if (opts?.allowBuild?.(depNode.name, depNode.version) !== false) {
635
+ if (opts.allowBuild?.(depNode.name, depNode.version) === true) {
628
636
  sideEffectsCacheKey = calcDepState(opts.depGraph, opts.depsStateCache, depNode.dir, {
629
637
  includeDepGraphHash: !opts.ignoreScripts && depNode.requiresBuild, // true when is built
630
638
  patchFileHash: depNode.patch?.hash,
@@ -63,7 +63,7 @@ async function linkAllPkgsInOrder(storeController, graph, hierarchy, parentDir,
63
63
  depNode.requiresBuild = filesResponse.requiresBuild;
64
64
  let sideEffectsCacheKey;
65
65
  if (opts.sideEffectsCacheRead && filesResponse.sideEffectsMaps && !isEmpty(filesResponse.sideEffectsMaps)) {
66
- if (opts?.allowBuild?.(depNode.name, depNode.version) !== false) {
66
+ if (opts.allowBuild?.(depNode.name, depNode.version) === true) {
67
67
  sideEffectsCacheKey = _calcDepState(dir, {
68
68
  includeDepGraphHash: !opts.ignoreScripts && depNode.requiresBuild, // true when is built
69
69
  patchFileHash: depNode.patch?.hash,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/installing.deps-restorer",
3
- "version": "1006.0.0",
3
+ "version": "1100.0.0",
4
4
  "description": "Fast installation using only pnpm-lock.yaml",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -35,60 +35,60 @@
35
35
  "path-exists": "^5.0.0",
36
36
  "ramda": "npm:@pnpm/ramda@0.28.1",
37
37
  "realpath-missing": "^2.0.0",
38
- "@pnpm/bins.linker": "1000.2.6",
39
- "@pnpm/building.policy": "1000.0.0-0",
40
- "@pnpm/building.during-install": "1000.0.0-0",
41
- "@pnpm/config.package-is-installable": "1000.0.15",
42
- "@pnpm/constants": "1001.3.1",
43
- "@pnpm/deps.graph-builder": "1002.3.0",
44
- "@pnpm/core-loggers": "1001.0.4",
45
- "@pnpm/deps.graph-hasher": "1002.0.8",
46
- "@pnpm/error": "1000.0.5",
47
- "@pnpm/exec.lifecycle": "1001.0.25",
48
- "@pnpm/fs.symlink-dependency": "1000.0.12",
49
- "@pnpm/deps.path": "1001.1.3",
50
- "@pnpm/installing.linking.direct-dep-linker": "1000.0.12",
51
- "@pnpm/installing.linking.hoist": "1002.0.8",
52
- "@pnpm/installing.linking.modules-cleaner": "1001.0.23",
53
- "@pnpm/installing.linking.real-hoist": "1001.0.20",
54
- "@pnpm/installing.modules-yaml": "1000.3.6",
55
- "@pnpm/installing.package-requester": "1008.0.0",
56
- "@pnpm/lockfile.filtering": "1001.0.21",
57
- "@pnpm/lockfile.utils": "1003.0.3",
58
- "@pnpm/lockfile.to-pnp": "1001.0.23",
59
- "@pnpm/pkg-manifest.reader": "1000.1.2",
60
- "@pnpm/lockfile.fs": "1001.1.21",
61
- "@pnpm/store.controller-types": "1004.1.0",
62
- "@pnpm/patching.config": "1001.0.11",
63
- "@pnpm/types": "1000.9.0",
64
- "@pnpm/workspace.project-manifest-reader": "1001.1.4"
38
+ "@pnpm/building.during-install": "1100.0.0",
39
+ "@pnpm/config.package-is-installable": "1100.0.0",
40
+ "@pnpm/building.policy": "1100.0.0",
41
+ "@pnpm/deps.graph-builder": "1100.0.0",
42
+ "@pnpm/constants": "1100.0.0",
43
+ "@pnpm/core-loggers": "1100.0.0",
44
+ "@pnpm/deps.graph-hasher": "1100.0.0",
45
+ "@pnpm/deps.path": "1100.0.0",
46
+ "@pnpm/bins.linker": "1100.0.0",
47
+ "@pnpm/error": "1100.0.0",
48
+ "@pnpm/exec.lifecycle": "1100.0.0",
49
+ "@pnpm/fs.symlink-dependency": "1100.0.0",
50
+ "@pnpm/installing.linking.direct-dep-linker": "1100.0.0",
51
+ "@pnpm/installing.linking.hoist": "1100.0.0",
52
+ "@pnpm/installing.linking.real-hoist": "1100.0.0",
53
+ "@pnpm/installing.linking.modules-cleaner": "1100.0.0",
54
+ "@pnpm/installing.package-requester": "1100.0.0",
55
+ "@pnpm/installing.modules-yaml": "1100.0.0",
56
+ "@pnpm/lockfile.filtering": "1100.0.0",
57
+ "@pnpm/lockfile.fs": "1100.0.0",
58
+ "@pnpm/lockfile.to-pnp": "1100.0.0",
59
+ "@pnpm/lockfile.utils": "1100.0.0",
60
+ "@pnpm/patching.config": "1100.0.0",
61
+ "@pnpm/pkg-manifest.reader": "1100.0.0",
62
+ "@pnpm/store.controller-types": "1100.0.0",
63
+ "@pnpm/workspace.project-manifest-reader": "1100.0.0",
64
+ "@pnpm/types": "1100.0.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@pnpm/logger": ">=1001.0.0 <1002.0.0",
68
- "@pnpm/worker": "^1000.3.0"
68
+ "@pnpm/worker": "^1100.0.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@jest/globals": "30.0.5",
72
- "@pnpm/registry-mock": "5.2.4",
73
- "@types/fs-extra": "^9.0.13",
74
- "@types/ramda": "0.29.12",
71
+ "@jest/globals": "30.3.0",
72
+ "@pnpm/registry-mock": "6.0.0",
73
+ "@types/fs-extra": "^11.0.4",
74
+ "@types/ramda": "0.31.1",
75
75
  "concurrently": "9.2.1",
76
- "isexe": "2.0.0",
76
+ "isexe": "4.0.0",
77
77
  "load-json-file": "^7.0.1",
78
78
  "tempy": "3.0.0",
79
79
  "write-json-file": "^7.0.0",
80
- "@pnpm/installing.deps-restorer": "1006.0.0",
81
- "@pnpm/crypto.object-hasher": "1000.1.0",
82
- "@pnpm/installing.read-projects-context": "1000.0.24",
83
- "@pnpm/assert-project": "1000.0.4",
84
- "@pnpm/logger": "1001.0.1",
85
- "@pnpm/prepare": "1000.0.4",
86
- "@pnpm/store.cafs": "1000.0.19",
87
- "@pnpm/store.path": "1000.0.5",
88
- "@pnpm/store.index": "1000.0.0-0",
89
- "@pnpm/test-fixtures": "1000.0.0",
90
- "@pnpm/testing.temp-store": "1000.0.23",
91
- "@pnpm/test-ipc-server": "1000.0.0"
80
+ "@pnpm/assert-project": "1100.0.0",
81
+ "@pnpm/crypto.object-hasher": "1100.0.0",
82
+ "@pnpm/installing.deps-restorer": "1100.0.0",
83
+ "@pnpm/prepare": "1100.0.0",
84
+ "@pnpm/store.cafs": "1100.0.0",
85
+ "@pnpm/store.index": "1100.0.0",
86
+ "@pnpm/test-ipc-server": "1100.0.0",
87
+ "@pnpm/store.path": "1100.0.0",
88
+ "@pnpm/test-fixtures": "1100.0.0",
89
+ "@pnpm/logger": "1100.0.0",
90
+ "@pnpm/installing.read-projects-context": "1100.0.0",
91
+ "@pnpm/testing.temp-store": "1100.0.0"
92
92
  },
93
93
  "engines": {
94
94
  "node": ">=22.13"
@@ -99,10 +99,10 @@
99
99
  "scripts": {
100
100
  "start": "tsgo --watch",
101
101
  "lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
102
- "_test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest",
103
- "test": "pnpm run compile && pnpm run _test",
102
+ "test": "pn compile && pn .test",
104
103
  "runPrepareFixtures": "node ../../pnpm/bin/pnpm.mjs i -r -C test/fixtures --no-shared-workspace-lockfile --no-link-workspace-packages --lockfile-only --registry http://localhost:4873/ --ignore-scripts --force --no-strict-peer-dependencies",
105
104
  "prepareFixtures": "git clean -fdx test/fixtures && rm -rf \"test/fixtures/*/pnpm-lock.yaml\" && registry-mock prepare && concurrently --success=first --kill-others registry-mock \"pnpm run runPrepareFixtures\"",
106
- "compile": "tsgo --build && pnpm run lint --fix"
105
+ "compile": "tsgo --build && pn lint --fix",
106
+ ".test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
107
107
  }
108
108
  }