@pnpm/building.after-install 1000.0.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.
@@ -1,7 +1,7 @@
1
- import { type Config } from '@pnpm/config';
1
+ import type { Config, ConfigContext } from '@pnpm/config.reader';
2
2
  import type { LogBase } from '@pnpm/logger';
3
- import type { StoreController } from '@pnpm/store-controller-types';
4
- import type { Registries } from '@pnpm/types';
3
+ import type { StoreController } from '@pnpm/store.controller-types';
4
+ import type { Registries, RegistryConfig } from '@pnpm/types';
5
5
  export type StrictBuildOptions = {
6
6
  autoInstallPeers: boolean;
7
7
  cacheDir: string;
@@ -29,7 +29,7 @@ export type StrictBuildOptions = {
29
29
  production: boolean;
30
30
  development: boolean;
31
31
  optional: boolean;
32
- rawConfig: object;
32
+ configByUri: Record<string, RegistryConfig>;
33
33
  userConfig: Record<string, string>;
34
34
  userAgent: string;
35
35
  packageManager: {
@@ -40,12 +40,11 @@ export type StrictBuildOptions = {
40
40
  pending: boolean;
41
41
  shamefullyHoist: boolean;
42
42
  deployAllFiles: boolean;
43
- neverBuiltDependencies?: string[];
44
43
  allowBuilds?: Record<string, boolean | string>;
45
44
  virtualStoreDirMaxLength: number;
46
45
  peersSuffixMaxLength: number;
47
46
  strictStorePkgContentCheck: boolean;
48
47
  fetchFullMetadata?: boolean;
49
- } & Pick<Config, 'sslConfigs' | 'allowBuilds'>;
50
- export type BuildOptions = Partial<StrictBuildOptions> & Pick<StrictBuildOptions, 'storeDir' | 'storeController'> & Pick<Config, 'rootProjectManifest' | 'rootProjectManifestDir'>;
48
+ } & Pick<Config, 'allowBuilds'>;
49
+ export type BuildOptions = Partial<StrictBuildOptions> & Pick<StrictBuildOptions, 'storeDir' | 'storeController'> & Pick<ConfigContext, 'rootProjectManifest' | 'rootProjectManifestDir'>;
51
50
  export declare function extendBuildOptions(opts: BuildOptions): Promise<StrictBuildOptions>;
@@ -1,6 +1,5 @@
1
- import path from 'path';
2
- import { getOptionsFromRootManifest } from '@pnpm/config';
3
- import { normalizeRegistries, DEFAULT_REGISTRIES } from '@pnpm/normalize-registries';
1
+ import path from 'node:path';
2
+ import { DEFAULT_REGISTRIES, normalizeRegistries } from '@pnpm/config.normalize-registries';
4
3
  import { loadJsonFile } from 'load-json-file';
5
4
  const defaults = async (opts) => {
6
5
  const packageManager = opts.packageManager ??
@@ -18,7 +17,7 @@ const defaults = async (opts) => {
18
17
  packageManager,
19
18
  pending: false,
20
19
  production: true,
21
- rawConfig: {},
20
+ configByUri: {},
22
21
  registries: DEFAULT_REGISTRIES,
23
22
  scriptsPrependNodePath: false,
24
23
  shamefullyHoist: false,
@@ -46,7 +45,6 @@ export async function extendBuildOptions(opts) {
46
45
  ...defaultOpts,
47
46
  ...opts,
48
47
  storeDir: defaultOpts.storeDir,
49
- ...(opts.rootProjectManifest ? getOptionsFromRootManifest(opts.rootProjectManifestDir, opts.rootProjectManifest) : {}),
50
48
  };
51
49
  extendedOpts.registries = normalizeRegistries(extendedOpts.registries);
52
50
  return extendedOpts;
package/lib/index.js CHANGED
@@ -1,25 +1,25 @@
1
- import assert from 'assert';
2
- import path from 'path';
3
- import util from 'util';
1
+ import assert from 'node:assert';
2
+ import path from 'node:path';
3
+ import util from 'node:util';
4
+ import { linkBins } from '@pnpm/bins.linker';
4
5
  import { pkgRequiresBuild } from '@pnpm/building.pkg-requires-build';
5
6
  import { createAllowBuildFunction } from '@pnpm/building.policy';
6
- import { calcDepState, lockfileToDepGraph } from '@pnpm/calc-dep-state';
7
7
  import { LAYOUT_VERSION, WANTED_LOCKFILE, } from '@pnpm/constants';
8
8
  import { skippedOptionalDependencyLogger } from '@pnpm/core-loggers';
9
- import * as dp from '@pnpm/dependency-path';
9
+ import { calcDepState, lockfileToDepGraph } from '@pnpm/deps.graph-hasher';
10
10
  import { graphSequencer } from '@pnpm/deps.graph-sequencer';
11
+ import * as dp from '@pnpm/deps.path';
11
12
  import { PnpmError } from '@pnpm/error';
12
- import { getContext } from '@pnpm/get-context';
13
- import { runLifecycleHooksConcurrently, runPostinstallHooks, } from '@pnpm/lifecycle';
14
- import { linkBins } from '@pnpm/link-bins';
13
+ import { runLifecycleHooksConcurrently, runPostinstallHooks, } from '@pnpm/exec.lifecycle';
14
+ import { getContext } from '@pnpm/installing.context';
15
+ import { writeModulesManifest } from '@pnpm/installing.modules-yaml';
15
16
  import { nameVerFromPkgSnapshot, packageIsIndependent, } from '@pnpm/lockfile.utils';
16
17
  import { lockfileWalker } from '@pnpm/lockfile.walker';
17
18
  import { logger, streamParser } from '@pnpm/logger';
18
- import { writeModulesManifest } from '@pnpm/modules-yaml';
19
19
  import npa from '@pnpm/npm-package-arg';
20
- import { safeReadPackageJsonFromDir } from '@pnpm/read-package-json';
20
+ import { safeReadPackageJsonFromDir } from '@pnpm/pkg-manifest.reader';
21
+ import { createStoreController } from '@pnpm/store.connection-manager';
21
22
  import { StoreIndex, storeIndexKey } from '@pnpm/store.index';
22
- import { createStoreController } from '@pnpm/store-connection-manager';
23
23
  import { hardLinkDir } from '@pnpm/worker';
24
24
  import pLimit from 'p-limit';
25
25
  import { runGroups } from 'run-groups';
@@ -41,7 +41,7 @@ function findPackages(packages, searched, opts) {
41
41
  return matches(searched, pkgInfo);
42
42
  });
43
43
  }
44
- // TODO: move this logic to separate package as this is also used in dependencies-hierarchy
44
+ // TODO: move this logic to separate package as this is also used in tree-builder
45
45
  function matches(searched, manifest) {
46
46
  return searched.some((searchedPkg) => {
47
47
  if (typeof searchedPkg === 'string') {
@@ -91,16 +91,17 @@ export async function buildSelectedPkgs(projects, pkgSpecs, maybeOpts) {
91
91
  hoistedDependencies: ctx.hoistedDependencies,
92
92
  hoistPattern: ctx.hoistPattern,
93
93
  included: ctx.include,
94
- ignoredBuilds: ignoredPkgs,
94
+ ignoredBuilds: mergeIgnoredBuilds(ctx.modulesFile?.ignoredBuilds, ignoredPkgs, pkgs),
95
95
  layoutVersion: LAYOUT_VERSION,
96
96
  packageManager: `${opts.packageManager.name}@${opts.packageManager.version}`,
97
97
  pendingBuilds: ctx.pendingBuilds,
98
98
  publicHoistPattern: ctx.publicHoistPattern,
99
99
  registries: ctx.registries,
100
100
  skipped: Array.from(ctx.skipped),
101
- storeDir: ctx.storeDir,
102
- virtualStoreDir: ctx.virtualStoreDir,
103
- virtualStoreDirMaxLength: ctx.virtualStoreDirMaxLength,
101
+ storeDir: ctx.modulesFile?.storeDir ?? ctx.storeDir,
102
+ virtualStoreDir: ctx.modulesFile?.virtualStoreDir ?? ctx.virtualStoreDir,
103
+ virtualStoreDirMaxLength: ctx.modulesFile?.virtualStoreDirMaxLength ?? ctx.virtualStoreDirMaxLength,
104
+ allowBuilds: opts.allowBuilds,
104
105
  });
105
106
  return {
106
107
  ignoredBuilds: ignoredPkgs,
@@ -131,12 +132,12 @@ export async function buildProjects(projects, maybeOpts) {
131
132
  extraNodePaths: ctx.extraNodePaths,
132
133
  extraEnv: opts.extraEnv,
133
134
  preferSymlinkedExecutables: opts.preferSymlinkedExecutables,
134
- rawConfig: opts.rawConfig,
135
135
  scriptsPrependNodePath: opts.scriptsPrependNodePath,
136
136
  scriptShell: opts.scriptShell,
137
137
  shellEmulator: opts.shellEmulator,
138
138
  storeController: store.ctrl,
139
139
  unsafePerm: opts.unsafePerm || false,
140
+ userAgent: opts.userAgent,
140
141
  };
141
142
  await runLifecycleHooksConcurrently(['preinstall', 'install', 'postinstall', 'prepublish', 'prepare'], Object.values(ctx.projects), opts.childConcurrency || 5, scriptsOpts);
142
143
  for (const { id, manifest } of Object.values(ctx.projects)) {
@@ -276,11 +277,11 @@ async function _rebuild(ctx, opts) {
276
277
  extraEnv: opts.extraEnv,
277
278
  optional: pkgSnapshot.optional === true,
278
279
  pkgRoot,
279
- rawConfig: opts.rawConfig,
280
280
  rootModulesDir: ctx.rootModulesDir,
281
281
  scriptsPrependNodePath: opts.scriptsPrependNodePath,
282
282
  shellEmulator: opts.shellEmulator,
283
283
  unsafePerm: opts.unsafePerm || false,
284
+ userAgent: opts.userAgent,
284
285
  });
285
286
  if (hasSideEffects && (opts.sideEffectsCacheWrite ?? true) && resolution.integrity) {
286
287
  builtDepPaths.add(depPath);
@@ -366,4 +367,25 @@ function binDirsInAllParentDirs(pkgRoot, lockfileDir) {
366
367
  binDirs.push(path.join(lockfileDir, 'node_modules/.bin'));
367
368
  return binDirs;
368
369
  }
370
+ /**
371
+ * Merge new ignoredBuilds from a selective rebuild with existing ones.
372
+ * Keeps existing entries for packages that weren't part of this rebuild.
373
+ */
374
+ function mergeIgnoredBuilds(existing, newIgnored, rebuiltPkgs) {
375
+ if (!existing?.size && !newIgnored.size)
376
+ return undefined;
377
+ const rebuiltSet = new Set(rebuiltPkgs);
378
+ const merged = new Set();
379
+ if (existing) {
380
+ for (const depPath of existing) {
381
+ if (!rebuiltSet.has(depPath)) {
382
+ merged.add(depPath);
383
+ }
384
+ }
385
+ }
386
+ for (const depPath of newIgnored) {
387
+ merged.add(depPath);
388
+ }
389
+ return merged.size ? merged : undefined;
390
+ }
369
391
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/building.after-install",
3
- "version": "1000.0.0-0",
3
+ "version": "1100.0.0",
4
4
  "description": "Rebuild packages that are already installed by running their lifecycle scripts",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -28,39 +28,39 @@
28
28
  "@pnpm/npm-package-arg": "^2.0.0",
29
29
  "load-json-file": "^7.0.1",
30
30
  "p-limit": "^7.1.0",
31
- "run-groups": "^4.0.0",
31
+ "run-groups": "^5.0.0",
32
32
  "semver": "^7.7.2",
33
- "@pnpm/building.pkg-requires-build": "1000.0.0-0",
34
- "@pnpm/building.policy": "1000.0.0-0",
35
- "@pnpm/calc-dep-state": "1002.0.8",
36
- "@pnpm/config": "1004.4.2",
37
- "@pnpm/core-loggers": "1001.0.4",
38
- "@pnpm/constants": "1001.3.1",
39
- "@pnpm/error": "1000.0.5",
40
- "@pnpm/get-context": "1001.1.8",
41
- "@pnpm/lifecycle": "1001.0.25",
42
- "@pnpm/link-bins": "1000.2.6",
43
- "@pnpm/deps.graph-sequencer": "1000.0.0",
44
- "@pnpm/dependency-path": "1001.1.3",
45
- "@pnpm/lockfile.types": "1002.0.2",
46
- "@pnpm/lockfile.utils": "1003.0.3",
47
- "@pnpm/modules-yaml": "1000.3.6",
48
- "@pnpm/normalize-registries": "1000.1.4",
49
- "@pnpm/store-connection-manager": "1002.2.4",
50
- "@pnpm/read-package-json": "1000.1.2",
51
- "@pnpm/store.cafs": "1000.0.19",
52
- "@pnpm/lockfile.walker": "1001.0.16",
53
- "@pnpm/store.index": "1000.0.0-0",
54
- "@pnpm/store-controller-types": "1004.1.0",
55
- "@pnpm/types": "1000.9.0"
33
+ "@pnpm/building.pkg-requires-build": "1100.0.0",
34
+ "@pnpm/bins.linker": "1100.0.0",
35
+ "@pnpm/building.policy": "1100.0.0",
36
+ "@pnpm/config.normalize-registries": "1100.0.0",
37
+ "@pnpm/config.reader": "1100.0.0",
38
+ "@pnpm/constants": "1100.0.0",
39
+ "@pnpm/deps.graph-hasher": "1100.0.0",
40
+ "@pnpm/error": "1100.0.0",
41
+ "@pnpm/core-loggers": "1100.0.0",
42
+ "@pnpm/deps.graph-sequencer": "1100.0.0",
43
+ "@pnpm/deps.path": "1100.0.0",
44
+ "@pnpm/exec.lifecycle": "1100.0.0",
45
+ "@pnpm/installing.context": "1100.0.0",
46
+ "@pnpm/installing.modules-yaml": "1100.0.0",
47
+ "@pnpm/lockfile.types": "1100.0.0",
48
+ "@pnpm/pkg-manifest.reader": "1100.0.0",
49
+ "@pnpm/store.cafs": "1100.0.0",
50
+ "@pnpm/lockfile.utils": "1100.0.0",
51
+ "@pnpm/lockfile.walker": "1100.0.0",
52
+ "@pnpm/store.connection-manager": "1100.0.0",
53
+ "@pnpm/store.controller-types": "1100.0.0",
54
+ "@pnpm/store.index": "1100.0.0",
55
+ "@pnpm/types": "1100.0.0"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@pnpm/logger": ">=1001.0.0 <1002.0.0",
59
- "@pnpm/worker": "^1000.3.0"
59
+ "@pnpm/worker": "^1100.0.0"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/semver": "7.7.1",
63
- "@pnpm/building.after-install": "1000.0.0-0"
63
+ "@pnpm/building.after-install": "1100.0.0"
64
64
  },
65
65
  "engines": {
66
66
  "node": ">=22.13"
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "scripts": {
72
72
  "lint": "eslint \"src/**/*.ts\"",
73
- "compile": "tsgo --build && pnpm run lint --fix",
74
- "test": "pnpm run compile"
73
+ "compile": "tsgo --build && pn lint --fix",
74
+ "test": "pn compile"
75
75
  }
76
76
  }