@pnpm/exec.lifecycle 1100.0.11 → 1100.0.12

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.
@@ -1,4 +1,3 @@
1
- import fs from 'node:fs';
2
1
  import path from 'node:path';
3
2
  import { linkBins } from '@pnpm/bins.linker';
4
3
  import { fetchFromDir } from '@pnpm/fetching.directory-fetcher';
@@ -43,42 +42,26 @@ export async function runLifecycleHooksConcurrently(stages, importers, childConc
43
42
  }
44
43
  if (targetDirs == null || targetDirs.length === 0 || !isBuilt)
45
44
  return;
45
+ // Re-import only the freshly-built source — fetchFromDir already
46
+ // excludes the source's node_modules/. `keepModulesDir: true` makes
47
+ // importIndexedDir skip the destructive makeEmptyDir fast path
48
+ // (#11088) and preserve the target's existing node_modules (bin
49
+ // symlinks + transitive deps from the initial install) via its
50
+ // staging/move path. Replaces the old scanDir-into-filesMap
51
+ // workaround (#4299) that the fast path then wiped, causing ENOENT
52
+ // on .bin/<tool>. Stays on storeController.importPackage so source
53
+ // files keep their hardlinks (no copy-loop).
46
54
  const filesResponse = await fetchFromDir(rootDir, { resolveSymlinks: opts.resolveSymlinksInInjectedDirs });
47
- await Promise.all(targetDirs.map(async (targetDir) => {
48
- const targetModulesDir = path.join(targetDir, 'node_modules');
49
- const newFilesMap = new Map(filesResponse.filesMap);
50
- if (fs.existsSync(targetModulesDir)) {
51
- // If the target directory contains a node_modules directory
52
- // (it may happen when the hoisted node linker is used)
53
- // then we need to preserve this node_modules.
54
- // So we scan this node_modules directory and pass it as part of the new package.
55
- await scanDir('node_modules', targetModulesDir, targetModulesDir, newFilesMap);
56
- }
57
- return opts.storeController.importPackage(targetDir, {
58
- filesResponse: {
59
- resolvedFrom: 'local-dir',
60
- ...filesResponse,
61
- filesMap: newFilesMap,
62
- },
63
- force: false,
64
- });
65
- }));
55
+ await Promise.all(targetDirs.map(async (targetDir) => opts.storeController.importPackage(targetDir, {
56
+ filesResponse: {
57
+ resolvedFrom: 'local-dir',
58
+ ...filesResponse,
59
+ },
60
+ force: false,
61
+ keepModulesDir: true,
62
+ })));
66
63
  });
67
64
  });
68
65
  await runGroups(childConcurrency, groups);
69
66
  }
70
- async function scanDir(prefix, rootDir, currentDir, index) {
71
- const files = await fs.promises.readdir(currentDir);
72
- await Promise.all(files.map(async (file) => {
73
- const fullPath = path.join(currentDir, file);
74
- const stat = await fs.promises.stat(fullPath);
75
- if (stat.isDirectory()) {
76
- return scanDir(prefix, rootDir, fullPath, index);
77
- }
78
- if (stat.isFile()) {
79
- const relativePath = path.relative(rootDir, fullPath);
80
- index.set(path.join(prefix, relativePath), fullPath);
81
- }
82
- }));
83
- }
84
67
  //# sourceMappingURL=runLifecycleHooksConcurrently.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/exec.lifecycle",
3
- "version": "1100.0.11",
3
+ "version": "1100.0.12",
4
4
  "description": "Package lifecycle hook runner",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -32,14 +32,14 @@
32
32
  "path-exists": "^5.0.0",
33
33
  "run-groups": "^5.0.0",
34
34
  "shlex": "^3.0.0",
35
- "@pnpm/bins.linker": "1100.0.7",
36
- "@pnpm/core-loggers": "1100.1.0",
37
- "@pnpm/pkg-manifest.reader": "1100.0.3",
38
- "@pnpm/store.cafs-types": "1100.0.1",
39
- "@pnpm/fetching.directory-fetcher": "1100.0.10",
40
- "@pnpm/store.controller-types": "1100.1.0",
35
+ "@pnpm/bins.linker": "1100.0.8",
36
+ "@pnpm/core-loggers": "1100.1.1",
41
37
  "@pnpm/error": "1100.0.0",
42
- "@pnpm/types": "1101.1.0"
38
+ "@pnpm/fetching.directory-fetcher": "1100.0.11",
39
+ "@pnpm/store.cafs-types": "1100.0.1",
40
+ "@pnpm/pkg-manifest.reader": "1100.0.4",
41
+ "@pnpm/store.controller-types": "1100.1.1",
42
+ "@pnpm/types": "1101.1.1"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@pnpm/logger": ">=1001.0.0 <1002.0.0"
@@ -49,9 +49,9 @@
49
49
  "@types/is-windows": "^1.0.2",
50
50
  "@zkochan/rimraf": "^4.0.0",
51
51
  "load-json-file": "^7.0.1",
52
- "@pnpm/prepare": "1100.0.9",
53
- "@pnpm/exec.lifecycle": "1100.0.11",
54
52
  "@pnpm/test-fixtures": "1100.0.0",
53
+ "@pnpm/prepare": "1100.0.10",
54
+ "@pnpm/exec.lifecycle": "1100.0.12",
55
55
  "@pnpm/logger": "1100.0.0",
56
56
  "@pnpm/test-ipc-server": "1100.0.0"
57
57
  },