@pnpm/installing.read-projects-context 1100.0.3 → 1100.0.4

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.
Files changed (2) hide show
  1. package/lib/index.js +9 -4
  2. package/package.json +6 -5
package/lib/index.js CHANGED
@@ -4,10 +4,15 @@ import util from 'node:util';
4
4
  import { normalizeRegistries } from '@pnpm/config.normalize-registries';
5
5
  import { readModulesManifest } from '@pnpm/installing.modules-yaml';
6
6
  import { getLockfileImporterId } from '@pnpm/lockfile.fs';
7
+ import { pathAbsolute } from 'path-absolute';
7
8
  import { realpathMissing } from 'realpath-missing';
8
9
  export async function readProjectsContext(projects, opts) {
9
- const relativeModulesDir = opts.modulesDir ?? 'node_modules';
10
- const rootModulesDir = await realpathMissing(path.join(opts.lockfileDir, relativeModulesDir));
10
+ // `modulesDir` is conventionally a path relative to `lockfileDir`, but
11
+ // some callers pass it as an absolute path. Resolve via `pathAbsolute`
12
+ // so both forms work — `path.join` on Windows would otherwise produce a
13
+ // doubled prefix when the second argument is also absolute.
14
+ const modulesDirOpt = opts.modulesDir ?? 'node_modules';
15
+ const rootModulesDir = await realpathMissing(pathAbsolute(modulesDirOpt, opts.lockfileDir));
11
16
  const modules = await readModulesManifest(rootModulesDir);
12
17
  return {
13
18
  currentHoistPattern: modules?.hoistPattern,
@@ -18,11 +23,11 @@ export async function readProjectsContext(projects, opts) {
18
23
  modules,
19
24
  pendingBuilds: modules?.pendingBuilds ?? [],
20
25
  projects: await Promise.all(projects.map(async (project) => {
21
- const modulesDir = await realpathMissing(path.join(project.rootDir, project.modulesDir ?? relativeModulesDir));
26
+ const modulesDir = await realpathMissing(pathAbsolute(project.modulesDir ?? modulesDirOpt, project.rootDir));
22
27
  const importerId = getLockfileImporterId(opts.lockfileDir, project.rootDir);
23
28
  return {
24
29
  ...project,
25
- binsDir: project.binsDir ?? path.join(project.rootDir, relativeModulesDir, '.bin'),
30
+ binsDir: project.binsDir ?? path.join(modulesDir, '.bin'),
26
31
  id: importerId,
27
32
  modulesDir,
28
33
  rootDirRealPath: project.rootDirRealPath ?? await realpath(project.rootDir),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/installing.read-projects-context",
3
- "version": "1100.0.3",
3
+ "version": "1100.0.4",
4
4
  "description": "Reads the current state of projects from modules manifest",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -24,18 +24,19 @@
24
24
  "!*.map"
25
25
  ],
26
26
  "dependencies": {
27
+ "path-absolute": "^2.0.0",
27
28
  "realpath-missing": "^2.0.0",
28
29
  "@pnpm/config.normalize-registries": "1100.0.1",
29
30
  "@pnpm/installing.modules-yaml": "1100.0.1",
30
- "@pnpm/lockfile.fs": "1100.0.3",
31
- "@pnpm/types": "1101.0.0"
31
+ "@pnpm/types": "1101.0.0",
32
+ "@pnpm/lockfile.fs": "1100.0.3"
32
33
  },
33
34
  "peerDependencies": {
34
35
  "@pnpm/logger": ">=1001.0.0 <1002.0.0"
35
36
  },
36
37
  "devDependencies": {
37
- "@pnpm/logger": "1100.0.0",
38
- "@pnpm/installing.read-projects-context": "1100.0.3"
38
+ "@pnpm/installing.read-projects-context": "1100.0.4",
39
+ "@pnpm/logger": "1100.0.0"
39
40
  },
40
41
  "engines": {
41
42
  "node": ">=22.13"