@pnpm/installing.deps-restorer 1102.0.0 → 1102.1.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.
package/lib/index.d.ts CHANGED
@@ -90,6 +90,8 @@ export interface HeadlessOptions {
90
90
  skipRuntimes?: boolean;
91
91
  enableModulesDir?: boolean;
92
92
  virtualStoreOnly?: boolean;
93
+ nodeExperimentalPackageMap?: boolean;
94
+ nodePackageMapType?: 'standard' | 'loose';
93
95
  nodeLinker?: 'isolated' | 'hoisted' | 'pnp';
94
96
  useGitBranchLockfile?: boolean;
95
97
  useLockfile?: boolean;
package/lib/index.js CHANGED
@@ -9,7 +9,7 @@ import { lockfileToDepGraph, } from '@pnpm/deps.graph-builder';
9
9
  import { calcDepState, findRuntimeNodeVersion } from '@pnpm/deps.graph-hasher';
10
10
  import * as dp from '@pnpm/deps.path';
11
11
  import { PnpmError } from '@pnpm/error';
12
- import { makeNodeRequireOption, runLifecycleHooksConcurrently, } from '@pnpm/exec.lifecycle';
12
+ import { makeNodePackageMapOption, makeNodeRequireOption, runLifecycleHooksConcurrently, } from '@pnpm/exec.lifecycle';
13
13
  import { symlinkDependency } from '@pnpm/fs.symlink-dependency';
14
14
  import { linkDirectDeps } from '@pnpm/installing.linking.direct-dep-linker';
15
15
  import { hoist } from '@pnpm/installing.linking.hoist';
@@ -17,7 +17,7 @@ import { prune } from '@pnpm/installing.linking.modules-cleaner';
17
17
  import { writeModulesManifest, } from '@pnpm/installing.modules-yaml';
18
18
  import { filterLockfileByEngine, filterLockfileByImportersAndEngine, } from '@pnpm/lockfile.filtering';
19
19
  import { getLockfileImporterId, readCurrentLockfile, readWantedLockfile, writeCurrentLockfile, writeLockfiles, } from '@pnpm/lockfile.fs';
20
- import { writePnpFile } from '@pnpm/lockfile.to-pnp';
20
+ import { PACKAGE_MAP_FILENAME, writePackageMap, writePackageMapFromDependenciesGraph, writePnpFile } from '@pnpm/lockfile.to-pnp';
21
21
  import { nameVerFromPkgSnapshot, } from '@pnpm/lockfile.utils';
22
22
  import { logger, streamParser, } from '@pnpm/logger';
23
23
  import { readPackageJsonFromDir } from '@pnpm/pkg-manifest.reader';
@@ -322,6 +322,36 @@ export async function headlessInstall(opts) {
322
322
  });
323
323
  }
324
324
  }
325
+ const shouldWritePackageMap = opts.enableModulesDir !== false && opts.nodeLinker !== 'pnp' && !opts.virtualStoreOnly;
326
+ if (shouldWritePackageMap) {
327
+ // Omit the importer self-mapping when a project has no name: the map keys
328
+ // dependencies by package name, so falling back to the importer id (`.` or
329
+ // a path) would emit a non-package-name key. Matches pacquet.
330
+ const importerNames = Object.fromEntries(selectedProjects.map(({ manifest, id }) => [id, manifest.name]));
331
+ if (opts.nodeLinker === 'hoisted') {
332
+ await writePackageMapFromDependenciesGraph({
333
+ directDependenciesByImporterId,
334
+ graph,
335
+ importerNames,
336
+ lockfile: filteredLockfile,
337
+ lockfileDir,
338
+ packageMapType: opts.nodePackageMapType,
339
+ packageIdStrategy: 'path',
340
+ rootModulesDir,
341
+ });
342
+ }
343
+ else {
344
+ await writePackageMap(filteredLockfile, {
345
+ importerNames,
346
+ lockfileDir,
347
+ locationByDepPath: Object.fromEntries(Object.values(graph).map((node) => [node.depPath, node.dir])),
348
+ packageMapType: opts.nodePackageMapType,
349
+ rootModulesDir,
350
+ virtualStoreDir,
351
+ virtualStoreDirMaxLength: opts.virtualStoreDirMaxLength,
352
+ });
353
+ }
354
+ }
325
355
  if (opts.ignoreScripts) {
326
356
  for (const { id, manifest } of selectedProjects) {
327
357
  if (opts.ignoreScripts && ((manifest?.scripts) != null) &&
@@ -358,7 +388,13 @@ export async function headlessInstall(opts) {
358
388
  if (opts.enablePnp) {
359
389
  extraEnv = {
360
390
  ...extraEnv,
361
- ...makeNodeRequireOption(path.join(opts.lockfileDir, '.pnp.cjs')),
391
+ ...makeNodeRequireOption(path.join(opts.lockfileDir, '.pnp.cjs'), extraEnv),
392
+ };
393
+ }
394
+ if (opts.nodeExperimentalPackageMap && shouldWritePackageMap) {
395
+ extraEnv = {
396
+ ...extraEnv,
397
+ ...makeNodePackageMapOption(path.join(rootModulesDir, PACKAGE_MAP_FILENAME), extraEnv),
362
398
  };
363
399
  }
364
400
  // Dependency lifecycle scripts must not run on an unverified lockfile.
@@ -487,6 +523,12 @@ export async function headlessInstall(opts) {
487
523
  }));
488
524
  summaryLogger.debug({ prefix: lockfileDir });
489
525
  if (!opts.ignoreScripts && !opts.ignorePackageManifest && !skipPostImportLinking) {
526
+ if (opts.nodeExperimentalPackageMap && shouldWritePackageMap) {
527
+ scriptsOpts.extraEnv = {
528
+ ...scriptsOpts.extraEnv,
529
+ ...makeNodePackageMapOption(path.join(rootModulesDir, PACKAGE_MAP_FILENAME), scriptsOpts.extraEnv),
530
+ };
531
+ }
490
532
  // The projects' own lifecycle scripts import dependency code linked from
491
533
  // the lockfile, so they are held to the same gate as dependency builds —
492
534
  // also on the `enableModulesDir: false` path that skips buildModules.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/installing.deps-restorer",
3
- "version": "1102.0.0",
3
+ "version": "1102.1.1",
4
4
  "description": "Fast installation using only pnpm-lock.yaml",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -12,9 +12,9 @@
12
12
  "funding": "https://opencollective.com/pnpm",
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/pnpm/pnpm/tree/main/installing/deps-restorer"
15
+ "url": "https://github.com/pnpm/pnpm/tree/main/pnpm11/installing/deps-restorer"
16
16
  },
17
- "homepage": "https://github.com/pnpm/pnpm/tree/main/installing/deps-restorer#readme",
17
+ "homepage": "https://github.com/pnpm/pnpm/tree/main/pnpm11/installing/deps-restorer#readme",
18
18
  "bugs": {
19
19
  "url": "https://github.com/pnpm/pnpm/issues"
20
20
  },
@@ -38,37 +38,37 @@
38
38
  "path-exists": "^5.0.0",
39
39
  "ramda": "npm:@pnpm/ramda@0.28.1",
40
40
  "realpath-missing": "^2.0.0",
41
- "@pnpm/building.during-install": "1102.0.0",
42
- "@pnpm/building.policy": "1100.0.10",
43
- "@pnpm/config.package-is-installable": "1100.0.11",
44
- "@pnpm/core-loggers": "1100.2.1",
45
- "@pnpm/deps.graph-hasher": "1100.2.5",
41
+ "@pnpm/bins.linker": "1100.0.16",
42
+ "@pnpm/building.during-install": "1102.0.2",
43
+ "@pnpm/building.policy": "1100.0.11",
44
+ "@pnpm/config.package-is-installable": "1100.0.12",
46
45
  "@pnpm/constants": "1100.0.0",
47
- "@pnpm/deps.graph-builder": "1100.0.16",
48
- "@pnpm/bins.linker": "1100.0.14",
49
- "@pnpm/error": "1100.0.0",
46
+ "@pnpm/core-loggers": "1100.2.1",
47
+ "@pnpm/deps.graph-hasher": "1100.2.6",
50
48
  "@pnpm/deps.path": "1100.0.8",
51
- "@pnpm/exec.lifecycle": "1100.0.18",
49
+ "@pnpm/deps.graph-builder": "1100.0.18",
52
50
  "@pnpm/fs.symlink-dependency": "1100.0.10",
51
+ "@pnpm/installing.linking.hoist": "1100.0.16",
52
+ "@pnpm/error": "1100.0.1",
53
53
  "@pnpm/installing.linking.direct-dep-linker": "1100.0.10",
54
- "@pnpm/installing.linking.hoist": "1100.0.14",
55
- "@pnpm/installing.linking.modules-cleaner": "1100.1.8",
56
- "@pnpm/installing.linking.real-hoist": "1100.1.3",
54
+ "@pnpm/installing.linking.modules-cleaner": "1100.1.9",
55
+ "@pnpm/exec.lifecycle": "1100.1.1",
57
56
  "@pnpm/installing.modules-yaml": "1100.0.9",
58
- "@pnpm/installing.package-requester": "1102.0.0",
59
- "@pnpm/lockfile.to-pnp": "1100.0.14",
60
- "@pnpm/lockfile.fs": "1100.1.5",
61
- "@pnpm/lockfile.utils": "1100.0.13",
62
- "@pnpm/patching.config": "1100.0.8",
63
- "@pnpm/pkg-manifest.reader": "1100.0.8",
64
- "@pnpm/store.controller-types": "1100.1.5",
57
+ "@pnpm/lockfile.filtering": "1100.1.8",
58
+ "@pnpm/installing.linking.real-hoist": "1100.1.4",
59
+ "@pnpm/installing.package-requester": "1102.1.0",
60
+ "@pnpm/lockfile.fs": "1100.1.7",
61
+ "@pnpm/lockfile.utils": "1100.1.0",
62
+ "@pnpm/store.controller-types": "1100.1.6",
63
+ "@pnpm/patching.config": "1100.0.9",
65
64
  "@pnpm/types": "1101.3.2",
66
- "@pnpm/workspace.project-manifest-reader": "1100.0.13",
67
- "@pnpm/lockfile.filtering": "1100.1.7"
65
+ "@pnpm/workspace.project-manifest-reader": "1100.0.14",
66
+ "@pnpm/lockfile.to-pnp": "1100.1.1",
67
+ "@pnpm/pkg-manifest.reader": "1100.0.9"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@pnpm/logger": "^1100.0.0",
71
- "@pnpm/worker": "^1100.2.0"
71
+ "@pnpm/worker": "^1100.2.2"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@jest/globals": "30.4.1",
@@ -79,19 +79,19 @@
79
79
  "load-json-file": "^7.0.1",
80
80
  "tempy": "3.0.0",
81
81
  "write-json-file": "^7.0.0",
82
- "@pnpm/installing.deps-restorer": "1102.0.0",
83
- "@pnpm/assert-project": "1100.0.16",
84
82
  "@pnpm/crypto.object-hasher": "1100.0.0",
85
- "@pnpm/installing.read-projects-context": "1100.0.15",
86
- "@pnpm/prepare": "1100.0.16",
83
+ "@pnpm/assert-project": "1100.0.17",
87
84
  "@pnpm/logger": "1100.0.0",
88
- "@pnpm/store.cafs": "1100.1.10",
89
- "@pnpm/store.index": "1100.2.0",
90
- "@pnpm/store.path": "1100.0.1",
85
+ "@pnpm/prepare": "1100.0.17",
86
+ "@pnpm/installing.read-projects-context": "1100.0.17",
87
+ "@pnpm/store.cafs": "1100.1.11",
88
+ "@pnpm/installing.deps-restorer": "1102.1.1",
89
+ "@pnpm/store.path": "1100.0.2",
90
+ "@pnpm/store.index": "1100.2.1",
91
91
  "@pnpm/test-fixtures": "1100.0.0",
92
92
  "@pnpm/test-ipc-server": "1100.0.0",
93
- "@pnpm/testing.temp-store": "1100.1.9",
94
- "@pnpm/testing.registry-mock": "1100.0.6"
93
+ "@pnpm/testing.registry-mock": "1100.0.7",
94
+ "@pnpm/testing.temp-store": "1100.1.11"
95
95
  },
96
96
  "engines": {
97
97
  "node": ">=22.13"