pnpm 7.16.0 → 7.16.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.
@@ -7,11 +7,11 @@ included:
7
7
  injectedDeps: {}
8
8
  layoutVersion: 5
9
9
  nodeLinker: hoisted
10
- packageManager: pnpm@7.15.0
10
+ packageManager: pnpm@7.16.0
11
11
  pendingBuilds:
12
12
  - /node-gyp/9.3.0
13
13
  - /encoding/0.1.13
14
- prunedAt: Mon, 14 Nov 2022 13:32:56 GMT
14
+ prunedAt: Wed, 16 Nov 2022 12:42:34 GMT
15
15
  publicHoistPattern:
16
16
  - '*eslint*'
17
17
  - '*prettier*'
package/dist/pnpm.cjs CHANGED
@@ -3207,7 +3207,7 @@ var require_lib4 = __commonJS({
3207
3207
  var load_json_file_1 = __importDefault(require_load_json_file());
3208
3208
  var defaultManifest = {
3209
3209
  name: "pnpm" != null && true ? "pnpm" : "pnpm",
3210
- version: "7.16.0" != null && true ? "7.16.0" : "0.0.0"
3210
+ version: "7.16.1" != null && true ? "7.16.1" : "0.0.0"
3211
3211
  };
3212
3212
  var pkgJson;
3213
3213
  if (require.main == null) {
@@ -91920,7 +91920,8 @@ var require_lib59 = __commonJS({
91920
91920
  var npm_packlist_1 = __importDefault(require_lib58());
91921
91921
  var directoryFetcherLogger = (0, logger_1.logger)("directory-fetcher");
91922
91922
  function createDirectoryFetcher(opts) {
91923
- const fetchFromDir2 = opts?.includeOnlyPackageFiles ? fetchPackageFilesFromDir : fetchAllFilesFromDir;
91923
+ const readFileStat = opts?.resolveSymlinks === true ? realFileStat : fileStat;
91924
+ const fetchFromDir2 = opts?.includeOnlyPackageFiles ? fetchPackageFilesFromDir : fetchAllFilesFromDir.bind(null, readFileStat);
91924
91925
  const directoryFetcher = (cafs, resolution, opts2) => {
91925
91926
  const dir = path_1.default.join(opts2.lockfileDir, resolution.directory);
91926
91927
  return fetchFromDir2(dir, opts2);
@@ -91934,11 +91935,12 @@ var require_lib59 = __commonJS({
91934
91935
  if (opts.includeOnlyPackageFiles) {
91935
91936
  return fetchPackageFilesFromDir(dir, opts);
91936
91937
  }
91937
- return fetchAllFilesFromDir(dir, opts);
91938
+ const readFileStat = opts?.resolveSymlinks === true ? realFileStat : fileStat;
91939
+ return fetchAllFilesFromDir(readFileStat, dir, opts);
91938
91940
  }
91939
91941
  exports2.fetchFromDir = fetchFromDir;
91940
- async function fetchAllFilesFromDir(dir, opts) {
91941
- const filesIndex = await _fetchAllFilesFromDir(dir);
91942
+ async function fetchAllFilesFromDir(readFileStat, dir, opts) {
91943
+ const filesIndex = await _fetchAllFilesFromDir(readFileStat, dir);
91942
91944
  if (opts.manifest) {
91943
91945
  const manifest = await (0, read_project_manifest_1.safeReadProjectManifestOnly)(dir) ?? {};
91944
91946
  opts.manifest.resolve(manifest);
@@ -91949,24 +91951,16 @@ var require_lib59 = __commonJS({
91949
91951
  packageImportMethod: "hardlink"
91950
91952
  };
91951
91953
  }
91952
- async function _fetchAllFilesFromDir(dir, relativeDir = "") {
91954
+ async function _fetchAllFilesFromDir(readFileStat, dir, relativeDir = "") {
91953
91955
  const filesIndex = {};
91954
91956
  const files = await fs_1.promises.readdir(dir);
91955
91957
  await Promise.all(files.filter((file) => file !== "node_modules").map(async (file) => {
91956
- const filePath = path_1.default.join(dir, file);
91957
- let stat;
91958
- try {
91959
- stat = await fs_1.promises.stat(filePath);
91960
- } catch (err) {
91961
- if (err.code === "ENOENT") {
91962
- directoryFetcherLogger.debug({ brokenSymlink: filePath });
91963
- return;
91964
- }
91965
- throw err;
91966
- }
91958
+ const { filePath, stat } = await readFileStat(path_1.default.join(dir, file));
91959
+ if (!filePath)
91960
+ return;
91967
91961
  const relativeSubdir = `${relativeDir}${relativeDir ? "/" : ""}${file}`;
91968
91962
  if (stat.isDirectory()) {
91969
- const subFilesIndex = await _fetchAllFilesFromDir(filePath, relativeSubdir);
91963
+ const subFilesIndex = await _fetchAllFilesFromDir(readFileStat, filePath, relativeSubdir);
91970
91964
  Object.assign(filesIndex, subFilesIndex);
91971
91965
  } else {
91972
91966
  filesIndex[relativeSubdir] = filePath;
@@ -91974,6 +91968,37 @@ var require_lib59 = __commonJS({
91974
91968
  }));
91975
91969
  return filesIndex;
91976
91970
  }
91971
+ async function realFileStat(filePath) {
91972
+ let stat = await fs_1.promises.lstat(filePath);
91973
+ if (!stat.isSymbolicLink()) {
91974
+ return { filePath, stat };
91975
+ }
91976
+ try {
91977
+ filePath = await fs_1.promises.realpath(filePath);
91978
+ stat = await fs_1.promises.stat(filePath);
91979
+ return { filePath, stat };
91980
+ } catch (err) {
91981
+ if (err.code === "ENOENT") {
91982
+ directoryFetcherLogger.debug({ brokenSymlink: filePath });
91983
+ return { filePath: null, stat: null };
91984
+ }
91985
+ throw err;
91986
+ }
91987
+ }
91988
+ async function fileStat(filePath) {
91989
+ try {
91990
+ return {
91991
+ filePath,
91992
+ stat: await fs_1.promises.stat(filePath)
91993
+ };
91994
+ } catch (err) {
91995
+ if (err.code === "ENOENT") {
91996
+ directoryFetcherLogger.debug({ brokenSymlink: filePath });
91997
+ return { filePath: null, stat: null };
91998
+ }
91999
+ throw err;
92000
+ }
92001
+ }
91977
92002
  async function fetchPackageFilesFromDir(dir, opts) {
91978
92003
  const files = await (0, npm_packlist_1.default)({ path: dir });
91979
92004
  const filesIndex = (0, fromPairs_1.default)(files.map((file) => [file, path_1.default.join(dir, file)]));
@@ -92208,7 +92233,7 @@ var require_lib62 = __commonJS({
92208
92233
  const defaultFetchers = {
92209
92234
  ...(0, tarball_fetcher_1.createTarballFetcher)(fetchFromRegistry, getAuthHeader, opts),
92210
92235
  ...(0, git_fetcher_1.createGitFetcher)(opts),
92211
- ...(0, directory_fetcher_1.createDirectoryFetcher)()
92236
+ ...(0, directory_fetcher_1.createDirectoryFetcher)({ resolveSymlinks: opts.resolveSymlinksInInjectedDirs })
92212
92237
  };
92213
92238
  const overwrites = Object.entries(customFetchers ?? {}).reduce((acc, [fetcherName, factory]) => {
92214
92239
  acc[fetcherName] = factory({ defaultFetchers });
@@ -92639,7 +92664,7 @@ var require_extendProjectsWithTargetDirs = __commonJS({
92639
92664
  var dependency_path_1 = require_lib66();
92640
92665
  var fromPairs_1 = __importDefault(require_fromPairs());
92641
92666
  function extendProjectsWithTargetDirs(projects, lockfile, ctx) {
92642
- const getLocalLocation = ctx.pkgLocationByDepPath != null ? (depPath) => ctx.pkgLocationByDepPath[depPath] : (depPath, pkgName) => path_1.default.join(ctx.virtualStoreDir, (0, dependency_path_1.depPathToFilename)(depPath), "node_modules", pkgName);
92667
+ const getLocalLocations = ctx.pkgLocationsByDepPath != null ? (depPath) => ctx.pkgLocationsByDepPath[depPath] : (depPath, pkgName) => [path_1.default.join(ctx.virtualStoreDir, (0, dependency_path_1.depPathToFilename)(depPath), "node_modules", pkgName)];
92643
92668
  const projectsById = (0, fromPairs_1.default)(projects.map((project) => [project.id, { ...project, targetDirs: [] }]));
92644
92669
  Object.entries(lockfile.packages ?? {}).forEach(([depPath, pkg]) => {
92645
92670
  if (pkg.resolution?.["type"] !== "directory")
@@ -92648,8 +92673,8 @@ var require_extendProjectsWithTargetDirs = __commonJS({
92648
92673
  const importerId = pkgId.replace(/^file:/, "");
92649
92674
  if (projectsById[importerId] == null)
92650
92675
  return;
92651
- const localLocation = getLocalLocation(depPath, pkg.name);
92652
- projectsById[importerId].targetDirs.push(localLocation);
92676
+ const localLocations = getLocalLocations(depPath, pkg.name);
92677
+ projectsById[importerId].targetDirs.push(...localLocations);
92653
92678
  projectsById[importerId].stages = ["preinstall", "install", "postinstall", "prepare", "prepublishOnly"];
92654
92679
  });
92655
92680
  return Object.values(projectsById);
@@ -107529,7 +107554,8 @@ var require_createNewStoreController = __commonJS({
107529
107554
  timeout: opts.fetchTimeout,
107530
107555
  userAgent: opts.userAgent,
107531
107556
  maxSockets: opts.maxSockets ?? (opts.networkConcurrency != null ? opts.networkConcurrency * 3 : void 0),
107532
- gitShallowHosts: opts.gitShallowHosts
107557
+ gitShallowHosts: opts.gitShallowHosts,
107558
+ resolveSymlinksInInjectedDirs: opts.resolveSymlinksInInjectedDirs
107533
107559
  });
107534
107560
  await fs_1.promises.mkdir(opts.storeDir, { recursive: true });
107535
107561
  return {
@@ -171285,7 +171311,7 @@ var require_lockfileToHoistedDepGraph = __commonJS({
171285
171311
  ...opts,
171286
171312
  lockfile,
171287
171313
  graph,
171288
- pkgLocationByDepPath: {}
171314
+ pkgLocationsByDepPath: {}
171289
171315
  };
171290
171316
  const hierarchy = {
171291
171317
  [opts.lockfileDir]: await fetchDeps(fetchDepsOpts, modulesDir, tree.dependencies)
@@ -171312,7 +171338,7 @@ var require_lockfileToHoistedDepGraph = __commonJS({
171312
171338
  directDependenciesByImporterId,
171313
171339
  graph,
171314
171340
  hierarchy,
171315
- pkgLocationByDepPath: fetchDepsOpts.pkgLocationByDepPath,
171341
+ pkgLocationsByDepPath: fetchDepsOpts.pkgLocationsByDepPath,
171316
171342
  symlinkedDirectDependenciesByImporterId
171317
171343
  };
171318
171344
  }
@@ -171408,13 +171434,16 @@ var require_lockfileToHoistedDepGraph = __commonJS({
171408
171434
  requiresBuild: pkgSnapshot.requiresBuild === true,
171409
171435
  patchFile: opts.patchedDependencies?.[`${pkgName}@${pkgVersion}`]
171410
171436
  };
171411
- opts.pkgLocationByDepPath[depPath] = dir;
171437
+ if (!opts.pkgLocationsByDepPath[depPath]) {
171438
+ opts.pkgLocationsByDepPath[depPath] = [];
171439
+ }
171440
+ opts.pkgLocationsByDepPath[depPath].push(dir);
171412
171441
  depHierarchy[dir] = await fetchDeps(opts, path_1.default.join(dir, "node_modules"), dep.dependencies);
171413
- opts.graph[dir].children = getChildren(pkgSnapshot, opts.pkgLocationByDepPath, opts);
171442
+ opts.graph[dir].children = getChildren(pkgSnapshot, opts.pkgLocationsByDepPath, opts);
171414
171443
  }));
171415
171444
  return depHierarchy;
171416
171445
  }
171417
- function getChildren(pkgSnapshot, pkgLocationByDepPath, opts) {
171446
+ function getChildren(pkgSnapshot, pkgLocationsByDepPath, opts) {
171418
171447
  const allDeps = {
171419
171448
  ...pkgSnapshot.dependencies,
171420
171449
  ...opts.include.optionalDependencies ? pkgSnapshot.optionalDependencies : {}
@@ -171422,8 +171451,8 @@ var require_lockfileToHoistedDepGraph = __commonJS({
171422
171451
  const children = {};
171423
171452
  for (const [childName, childRef] of Object.entries(allDeps)) {
171424
171453
  const childDepPath = dp.refToRelative(childRef, childName);
171425
- if (childDepPath && pkgLocationByDepPath[childDepPath]) {
171426
- children[childName] = pkgLocationByDepPath[childDepPath];
171454
+ if (childDepPath && pkgLocationsByDepPath[childDepPath]) {
171455
+ children[childName] = pkgLocationsByDepPath[childDepPath][0];
171427
171456
  }
171428
171457
  }
171429
171458
  return children;
@@ -171611,7 +171640,7 @@ var require_lib116 = __commonJS({
171611
171640
  nodeVersion: opts.currentEngine.nodeVersion,
171612
171641
  pnpmVersion: opts.currentEngine.pnpmVersion
171613
171642
  };
171614
- const { directDependenciesByImporterId, graph, hierarchy, pkgLocationByDepPath, prevGraph, symlinkedDirectDependenciesByImporterId } = await (opts.nodeLinker === "hoisted" ? (0, lockfileToHoistedDepGraph_1.lockfileToHoistedDepGraph)(filteredLockfile, currentLockfile, lockfileToDepGraphOpts) : (0, lockfileToDepGraph_1.lockfileToDepGraph)(filteredLockfile, opts.force ? null : currentLockfile, lockfileToDepGraphOpts));
171643
+ const { directDependenciesByImporterId, graph, hierarchy, pkgLocationsByDepPath, prevGraph, symlinkedDirectDependenciesByImporterId } = await (opts.nodeLinker === "hoisted" ? (0, lockfileToHoistedDepGraph_1.lockfileToHoistedDepGraph)(filteredLockfile, currentLockfile, lockfileToDepGraphOpts) : (0, lockfileToDepGraph_1.lockfileToDepGraph)(filteredLockfile, opts.force ? null : currentLockfile, lockfileToDepGraphOpts));
171615
171644
  if (opts.enablePnp) {
171616
171645
  const importerNames = (0, fromPairs_1.default)(selectedProjects.map(({ manifest, id }) => [id, manifest.name ?? id]));
171617
171646
  await (0, lockfile_to_pnp_1.writePnpFile)(filteredLockfile, {
@@ -171760,7 +171789,7 @@ var require_lib116 = __commonJS({
171760
171789
  });
171761
171790
  }
171762
171791
  const projectsToBeBuilt = (0, lockfile_utils_1.extendProjectsWithTargetDirs)(selectedProjects, wantedLockfile, {
171763
- pkgLocationByDepPath,
171792
+ pkgLocationsByDepPath,
171764
171793
  virtualStoreDir
171765
171794
  });
171766
171795
  if (opts.enableModulesDir !== false) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pnpm",
3
3
  "description": "Fast, disk space efficient package manager",
4
- "version": "7.16.0",
4
+ "version": "7.16.1",
5
5
  "bin": {
6
6
  "pnpm": "bin/pnpm.cjs",
7
7
  "pnpx": "bin/pnpx.cjs"