@pnpm/building.after-install 1000.0.0-0 → 1100.0.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/extendBuildOptions.d.ts +6 -7
- package/lib/extendBuildOptions.js +3 -5
- package/lib/index.js +40 -18
- package/package.json +29 -29
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Config, ConfigContext } from '@pnpm/config.reader';
|
|
2
2
|
import type { LogBase } from '@pnpm/logger';
|
|
3
|
-
import type { StoreController } from '@pnpm/store
|
|
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
|
-
|
|
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, '
|
|
50
|
-
export type BuildOptions = Partial<StrictBuildOptions> & Pick<StrictBuildOptions, 'storeDir' | 'storeController'> & Pick<
|
|
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 {
|
|
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
|
-
|
|
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
|
|
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 {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
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/
|
|
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
|
|
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": "
|
|
3
|
+
"version": "1100.0.1",
|
|
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": "^
|
|
31
|
+
"run-groups": "^5.0.0",
|
|
32
32
|
"semver": "^7.7.2",
|
|
33
|
-
"@pnpm/building.
|
|
34
|
-
"@pnpm/
|
|
35
|
-
"@pnpm/
|
|
36
|
-
"@pnpm/
|
|
37
|
-
"@pnpm/
|
|
38
|
-
"@pnpm/
|
|
39
|
-
"@pnpm/
|
|
40
|
-
"@pnpm/
|
|
41
|
-
"@pnpm/
|
|
42
|
-
"@pnpm/
|
|
43
|
-
"@pnpm/
|
|
44
|
-
"@pnpm/
|
|
45
|
-
"@pnpm/
|
|
46
|
-
"@pnpm/
|
|
47
|
-
"@pnpm/
|
|
48
|
-
"@pnpm/
|
|
49
|
-
"@pnpm/
|
|
50
|
-
"@pnpm/
|
|
51
|
-
"@pnpm/
|
|
52
|
-
"@pnpm/
|
|
53
|
-
"@pnpm/
|
|
54
|
-
"@pnpm/store
|
|
55
|
-
"@pnpm/
|
|
33
|
+
"@pnpm/building.policy": "1100.0.1",
|
|
34
|
+
"@pnpm/config.normalize-registries": "1100.0.1",
|
|
35
|
+
"@pnpm/bins.linker": "1100.0.1",
|
|
36
|
+
"@pnpm/building.pkg-requires-build": "1100.0.1",
|
|
37
|
+
"@pnpm/config.reader": "1100.0.1",
|
|
38
|
+
"@pnpm/deps.graph-sequencer": "1100.0.0",
|
|
39
|
+
"@pnpm/deps.path": "1100.0.1",
|
|
40
|
+
"@pnpm/error": "1100.0.0",
|
|
41
|
+
"@pnpm/core-loggers": "1100.0.1",
|
|
42
|
+
"@pnpm/exec.lifecycle": "1100.0.1",
|
|
43
|
+
"@pnpm/constants": "1100.0.0",
|
|
44
|
+
"@pnpm/deps.graph-hasher": "1100.0.1",
|
|
45
|
+
"@pnpm/installing.context": "1100.0.1",
|
|
46
|
+
"@pnpm/installing.modules-yaml": "1100.0.1",
|
|
47
|
+
"@pnpm/lockfile.utils": "1100.0.1",
|
|
48
|
+
"@pnpm/lockfile.walker": "1100.0.1",
|
|
49
|
+
"@pnpm/pkg-manifest.reader": "1100.0.1",
|
|
50
|
+
"@pnpm/store.connection-manager": "1100.0.1",
|
|
51
|
+
"@pnpm/lockfile.types": "1100.0.1",
|
|
52
|
+
"@pnpm/store.index": "1100.0.0",
|
|
53
|
+
"@pnpm/types": "1101.0.0",
|
|
54
|
+
"@pnpm/store.controller-types": "1100.0.1",
|
|
55
|
+
"@pnpm/store.cafs": "1100.0.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@pnpm/logger": ">=1001.0.0 <1002.0.0",
|
|
59
|
-
"@pnpm/worker": "^
|
|
59
|
+
"@pnpm/worker": "^1100.0.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/semver": "7.7.1",
|
|
63
|
-
"@pnpm/building.after-install": "
|
|
63
|
+
"@pnpm/building.after-install": "1100.0.1"
|
|
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 &&
|
|
74
|
-
"test": "
|
|
73
|
+
"compile": "tsgo --build && pn lint --fix",
|
|
74
|
+
"test": "pn compile"
|
|
75
75
|
}
|
|
76
76
|
}
|