@pnpm/installing.deps-restorer 1006.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.
- package/lib/index.d.ts +2 -3
- package/lib/index.js +34 -26
- package/lib/linkHoistedModules.js +1 -1
- package/package.json +49 -49
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { type LockfileObject } from '@pnpm/lockfile.fs';
|
|
|
4
4
|
import { type LogBase } from '@pnpm/logger';
|
|
5
5
|
import type { PatchGroupRecord } from '@pnpm/patching.config';
|
|
6
6
|
import type { StoreController } from '@pnpm/store.controller-types';
|
|
7
|
-
import { type DepPath, type HoistedDependencies, type IgnoredBuilds, type ProjectId, type ProjectManifest, type ProjectRootDir, type Registries, type SupportedArchitectures } from '@pnpm/types';
|
|
7
|
+
import { type DepPath, type HoistedDependencies, type IgnoredBuilds, type ProjectId, type ProjectManifest, type ProjectRootDir, type Registries, type RegistryConfig, type SupportedArchitectures } from '@pnpm/types';
|
|
8
8
|
export { extendProjectsWithTargetDirs } from './extendProjectsWithTargetDirs.js';
|
|
9
9
|
export type { HoistingLimits };
|
|
10
10
|
export type ReporterFunction = (logObj: LogBase) => void;
|
|
@@ -36,7 +36,6 @@ export interface HeadlessOptions {
|
|
|
36
36
|
preferSymlinkedExecutables?: boolean;
|
|
37
37
|
hoistingLimits?: HoistingLimits;
|
|
38
38
|
externalDependencies?: Set<string>;
|
|
39
|
-
ignoreDepScripts: boolean;
|
|
40
39
|
ignoreScripts: boolean;
|
|
41
40
|
ignorePackageManifest?: boolean;
|
|
42
41
|
/**
|
|
@@ -72,7 +71,7 @@ export interface HeadlessOptions {
|
|
|
72
71
|
disableRelinkLocalDirDeps?: boolean;
|
|
73
72
|
force: boolean;
|
|
74
73
|
storeDir: string;
|
|
75
|
-
|
|
74
|
+
configByUri: Record<string, RegistryConfig>;
|
|
76
75
|
unsafePerm: boolean;
|
|
77
76
|
userAgent: string;
|
|
78
77
|
registries: Registries;
|
package/lib/index.js
CHANGED
|
@@ -62,7 +62,7 @@ export async function headlessInstall(opts) {
|
|
|
62
62
|
extraNodePaths: opts.extraNodePaths,
|
|
63
63
|
preferSymlinkedExecutables: opts.preferSymlinkedExecutables,
|
|
64
64
|
extraEnv: opts.extraEnv,
|
|
65
|
-
|
|
65
|
+
configByUri: opts.configByUri,
|
|
66
66
|
resolveSymlinksInInjectedDirs: opts.resolveSymlinksInInjectedDirs,
|
|
67
67
|
scriptsPrependNodePath: opts.scriptsPrependNodePath,
|
|
68
68
|
scriptShell: opts.scriptShell,
|
|
@@ -152,6 +152,9 @@ export async function headlessInstall(opts) {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
+
if (opts.enableGlobalVirtualStore) {
|
|
156
|
+
opts.allowBuilds ??= {};
|
|
157
|
+
}
|
|
155
158
|
const allowBuild = createAllowBuildFunction(opts);
|
|
156
159
|
const lockfileToDepGraphOpts = {
|
|
157
160
|
...opts,
|
|
@@ -182,6 +185,7 @@ export async function headlessInstall(opts) {
|
|
|
182
185
|
}
|
|
183
186
|
const depNodes = Object.values(graph);
|
|
184
187
|
const added = depNodes.filter(({ fetching }) => fetching).length;
|
|
188
|
+
const skipGvsInternalLinking = opts.enableGlobalVirtualStore === true && added === 0;
|
|
185
189
|
statsLogger.debug({
|
|
186
190
|
added,
|
|
187
191
|
prefix: lockfileDir,
|
|
@@ -222,28 +226,30 @@ export async function headlessInstall(opts) {
|
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
else if (opts.enableModulesDir !== false || opts.enableGlobalVirtualStore) {
|
|
225
|
-
if (
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
if (!skipGvsInternalLinking) {
|
|
230
|
+
if (opts.enableModulesDir !== false) {
|
|
231
|
+
await Promise.all(depNodes.map(async (depNode) => fs.mkdir(depNode.modules, { recursive: true })));
|
|
232
|
+
}
|
|
233
|
+
await Promise.all([
|
|
234
|
+
opts.symlink === false || opts.enableModulesDir === false
|
|
235
|
+
? Promise.resolve()
|
|
236
|
+
: linkAllModules(depNodes, {
|
|
237
|
+
optional: opts.include.optionalDependencies,
|
|
238
|
+
}),
|
|
239
|
+
linkAllPkgs(opts.storeController, depNodes, {
|
|
240
|
+
allowBuild,
|
|
241
|
+
force: opts.force,
|
|
242
|
+
disableRelinkLocalDirDeps: opts.disableRelinkLocalDirDeps,
|
|
243
|
+
depGraph: graph,
|
|
244
|
+
depsStateCache,
|
|
245
|
+
enableGlobalVirtualStore: opts.enableGlobalVirtualStore,
|
|
246
|
+
ignoreScripts: opts.ignoreScripts,
|
|
247
|
+
lockfileDir: opts.lockfileDir,
|
|
248
|
+
sideEffectsCacheRead: opts.sideEffectsCacheRead,
|
|
249
|
+
storeDir: opts.storeDir,
|
|
233
250
|
}),
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
force: opts.force,
|
|
237
|
-
disableRelinkLocalDirDeps: opts.disableRelinkLocalDirDeps,
|
|
238
|
-
depGraph: graph,
|
|
239
|
-
depsStateCache,
|
|
240
|
-
enableGlobalVirtualStore: opts.enableGlobalVirtualStore,
|
|
241
|
-
ignoreScripts: opts.ignoreScripts,
|
|
242
|
-
lockfileDir: opts.lockfileDir,
|
|
243
|
-
sideEffectsCacheRead: opts.sideEffectsCacheRead,
|
|
244
|
-
storeDir: opts.storeDir,
|
|
245
|
-
}),
|
|
246
|
-
]);
|
|
251
|
+
]);
|
|
252
|
+
}
|
|
247
253
|
stageLogger.debug({
|
|
248
254
|
prefix: lockfileDir,
|
|
249
255
|
stage: 'importing_done',
|
|
@@ -284,7 +290,7 @@ export async function headlessInstall(opts) {
|
|
|
284
290
|
else {
|
|
285
291
|
newHoistedDependencies = {};
|
|
286
292
|
}
|
|
287
|
-
if (!skipPostImportLinking) {
|
|
293
|
+
if (!skipPostImportLinking && !skipGvsInternalLinking) {
|
|
288
294
|
await linkAllBins(graph, {
|
|
289
295
|
extraNodePaths: opts.extraNodePaths,
|
|
290
296
|
optional: opts.include.optionalDependencies,
|
|
@@ -353,12 +359,11 @@ export async function headlessInstall(opts) {
|
|
|
353
359
|
extraBinPaths,
|
|
354
360
|
extraEnv,
|
|
355
361
|
depsStateCache,
|
|
356
|
-
ignoreScripts: opts.ignoreScripts
|
|
362
|
+
ignoreScripts: opts.ignoreScripts,
|
|
357
363
|
hoistedLocations,
|
|
358
364
|
lockfileDir,
|
|
359
365
|
optional: opts.include.optionalDependencies,
|
|
360
366
|
preferSymlinkedExecutables: opts.preferSymlinkedExecutables,
|
|
361
|
-
rawConfig: opts.rawConfig,
|
|
362
367
|
rootModulesDir: virtualStoreDir,
|
|
363
368
|
scriptsPrependNodePath: opts.scriptsPrependNodePath,
|
|
364
369
|
scriptShell: opts.scriptShell,
|
|
@@ -404,6 +409,9 @@ export async function headlessInstall(opts) {
|
|
|
404
409
|
}
|
|
405
410
|
}
|
|
406
411
|
}
|
|
412
|
+
// Skip packages without bins to avoid unnecessary manifest reads.
|
|
413
|
+
// Dirs not in graph (e.g. link: deps) are kept since they may expose bins.
|
|
414
|
+
directPkgDirs = directPkgDirs.filter((dir) => graph[dir] == null || graph[dir].hasBin);
|
|
407
415
|
await linkBinsOfPackages((await Promise.all(directPkgDirs.map(async (dir) => ({
|
|
408
416
|
location: dir,
|
|
409
417
|
manifest: await safeReadProjectManifestOnly(dir),
|
|
@@ -624,7 +632,7 @@ async function linkAllPkgs(storeController, depNodes, opts) {
|
|
|
624
632
|
depNode.requiresBuild = filesResponse.requiresBuild;
|
|
625
633
|
let sideEffectsCacheKey;
|
|
626
634
|
if (opts.sideEffectsCacheRead && filesResponse.sideEffectsMaps && !isEmpty(filesResponse.sideEffectsMaps)) {
|
|
627
|
-
if (opts
|
|
635
|
+
if (opts.allowBuild?.(depNode.name, depNode.version) === true) {
|
|
628
636
|
sideEffectsCacheKey = calcDepState(opts.depGraph, opts.depsStateCache, depNode.dir, {
|
|
629
637
|
includeDepGraphHash: !opts.ignoreScripts && depNode.requiresBuild, // true when is built
|
|
630
638
|
patchFileHash: depNode.patch?.hash,
|
|
@@ -63,7 +63,7 @@ async function linkAllPkgsInOrder(storeController, graph, hierarchy, parentDir,
|
|
|
63
63
|
depNode.requiresBuild = filesResponse.requiresBuild;
|
|
64
64
|
let sideEffectsCacheKey;
|
|
65
65
|
if (opts.sideEffectsCacheRead && filesResponse.sideEffectsMaps && !isEmpty(filesResponse.sideEffectsMaps)) {
|
|
66
|
-
if (opts
|
|
66
|
+
if (opts.allowBuild?.(depNode.name, depNode.version) === true) {
|
|
67
67
|
sideEffectsCacheKey = _calcDepState(dir, {
|
|
68
68
|
includeDepGraphHash: !opts.ignoreScripts && depNode.requiresBuild, // true when is built
|
|
69
69
|
patchFileHash: depNode.patch?.hash,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/installing.deps-restorer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1100.0.0",
|
|
4
4
|
"description": "Fast installation using only pnpm-lock.yaml",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -35,60 +35,60 @@
|
|
|
35
35
|
"path-exists": "^5.0.0",
|
|
36
36
|
"ramda": "npm:@pnpm/ramda@0.28.1",
|
|
37
37
|
"realpath-missing": "^2.0.0",
|
|
38
|
-
"@pnpm/
|
|
39
|
-
"@pnpm/
|
|
40
|
-
"@pnpm/building.
|
|
41
|
-
"@pnpm/
|
|
42
|
-
"@pnpm/constants": "
|
|
43
|
-
"@pnpm/
|
|
44
|
-
"@pnpm/
|
|
45
|
-
"@pnpm/deps.
|
|
46
|
-
"@pnpm/
|
|
47
|
-
"@pnpm/
|
|
48
|
-
"@pnpm/
|
|
49
|
-
"@pnpm/
|
|
50
|
-
"@pnpm/installing.linking.direct-dep-linker": "
|
|
51
|
-
"@pnpm/installing.linking.hoist": "
|
|
52
|
-
"@pnpm/installing.linking.
|
|
53
|
-
"@pnpm/installing.linking.
|
|
54
|
-
"@pnpm/installing.
|
|
55
|
-
"@pnpm/installing.
|
|
56
|
-
"@pnpm/lockfile.filtering": "
|
|
57
|
-
"@pnpm/lockfile.
|
|
58
|
-
"@pnpm/lockfile.to-pnp": "
|
|
59
|
-
"@pnpm/
|
|
60
|
-
"@pnpm/
|
|
61
|
-
"@pnpm/
|
|
62
|
-
"@pnpm/
|
|
63
|
-
"@pnpm/
|
|
64
|
-
"@pnpm/
|
|
38
|
+
"@pnpm/building.during-install": "1100.0.0",
|
|
39
|
+
"@pnpm/config.package-is-installable": "1100.0.0",
|
|
40
|
+
"@pnpm/building.policy": "1100.0.0",
|
|
41
|
+
"@pnpm/deps.graph-builder": "1100.0.0",
|
|
42
|
+
"@pnpm/constants": "1100.0.0",
|
|
43
|
+
"@pnpm/core-loggers": "1100.0.0",
|
|
44
|
+
"@pnpm/deps.graph-hasher": "1100.0.0",
|
|
45
|
+
"@pnpm/deps.path": "1100.0.0",
|
|
46
|
+
"@pnpm/bins.linker": "1100.0.0",
|
|
47
|
+
"@pnpm/error": "1100.0.0",
|
|
48
|
+
"@pnpm/exec.lifecycle": "1100.0.0",
|
|
49
|
+
"@pnpm/fs.symlink-dependency": "1100.0.0",
|
|
50
|
+
"@pnpm/installing.linking.direct-dep-linker": "1100.0.0",
|
|
51
|
+
"@pnpm/installing.linking.hoist": "1100.0.0",
|
|
52
|
+
"@pnpm/installing.linking.real-hoist": "1100.0.0",
|
|
53
|
+
"@pnpm/installing.linking.modules-cleaner": "1100.0.0",
|
|
54
|
+
"@pnpm/installing.package-requester": "1100.0.0",
|
|
55
|
+
"@pnpm/installing.modules-yaml": "1100.0.0",
|
|
56
|
+
"@pnpm/lockfile.filtering": "1100.0.0",
|
|
57
|
+
"@pnpm/lockfile.fs": "1100.0.0",
|
|
58
|
+
"@pnpm/lockfile.to-pnp": "1100.0.0",
|
|
59
|
+
"@pnpm/lockfile.utils": "1100.0.0",
|
|
60
|
+
"@pnpm/patching.config": "1100.0.0",
|
|
61
|
+
"@pnpm/pkg-manifest.reader": "1100.0.0",
|
|
62
|
+
"@pnpm/store.controller-types": "1100.0.0",
|
|
63
|
+
"@pnpm/workspace.project-manifest-reader": "1100.0.0",
|
|
64
|
+
"@pnpm/types": "1100.0.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@pnpm/logger": ">=1001.0.0 <1002.0.0",
|
|
68
|
-
"@pnpm/worker": "^
|
|
68
|
+
"@pnpm/worker": "^1100.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@jest/globals": "30.0
|
|
72
|
-
"@pnpm/registry-mock": "
|
|
73
|
-
"@types/fs-extra": "^
|
|
74
|
-
"@types/ramda": "0.
|
|
71
|
+
"@jest/globals": "30.3.0",
|
|
72
|
+
"@pnpm/registry-mock": "6.0.0",
|
|
73
|
+
"@types/fs-extra": "^11.0.4",
|
|
74
|
+
"@types/ramda": "0.31.1",
|
|
75
75
|
"concurrently": "9.2.1",
|
|
76
|
-
"isexe": "
|
|
76
|
+
"isexe": "4.0.0",
|
|
77
77
|
"load-json-file": "^7.0.1",
|
|
78
78
|
"tempy": "3.0.0",
|
|
79
79
|
"write-json-file": "^7.0.0",
|
|
80
|
-
"@pnpm/
|
|
81
|
-
"@pnpm/crypto.object-hasher": "
|
|
82
|
-
"@pnpm/installing.
|
|
83
|
-
"@pnpm/
|
|
84
|
-
"@pnpm/
|
|
85
|
-
"@pnpm/
|
|
86
|
-
"@pnpm/
|
|
87
|
-
"@pnpm/store.path": "
|
|
88
|
-
"@pnpm/
|
|
89
|
-
"@pnpm/
|
|
90
|
-
"@pnpm/
|
|
91
|
-
"@pnpm/
|
|
80
|
+
"@pnpm/assert-project": "1100.0.0",
|
|
81
|
+
"@pnpm/crypto.object-hasher": "1100.0.0",
|
|
82
|
+
"@pnpm/installing.deps-restorer": "1100.0.0",
|
|
83
|
+
"@pnpm/prepare": "1100.0.0",
|
|
84
|
+
"@pnpm/store.cafs": "1100.0.0",
|
|
85
|
+
"@pnpm/store.index": "1100.0.0",
|
|
86
|
+
"@pnpm/test-ipc-server": "1100.0.0",
|
|
87
|
+
"@pnpm/store.path": "1100.0.0",
|
|
88
|
+
"@pnpm/test-fixtures": "1100.0.0",
|
|
89
|
+
"@pnpm/logger": "1100.0.0",
|
|
90
|
+
"@pnpm/installing.read-projects-context": "1100.0.0",
|
|
91
|
+
"@pnpm/testing.temp-store": "1100.0.0"
|
|
92
92
|
},
|
|
93
93
|
"engines": {
|
|
94
94
|
"node": ">=22.13"
|
|
@@ -99,10 +99,10 @@
|
|
|
99
99
|
"scripts": {
|
|
100
100
|
"start": "tsgo --watch",
|
|
101
101
|
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
102
|
-
"
|
|
103
|
-
"test": "pnpm run compile && pnpm run _test",
|
|
102
|
+
"test": "pn compile && pn .test",
|
|
104
103
|
"runPrepareFixtures": "node ../../pnpm/bin/pnpm.mjs i -r -C test/fixtures --no-shared-workspace-lockfile --no-link-workspace-packages --lockfile-only --registry http://localhost:4873/ --ignore-scripts --force --no-strict-peer-dependencies",
|
|
105
104
|
"prepareFixtures": "git clean -fdx test/fixtures && rm -rf \"test/fixtures/*/pnpm-lock.yaml\" && registry-mock prepare && concurrently --success=first --kill-others registry-mock \"pnpm run runPrepareFixtures\"",
|
|
106
|
-
"compile": "tsgo --build &&
|
|
105
|
+
"compile": "tsgo --build && pn lint --fix",
|
|
106
|
+
".test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
|
|
107
107
|
}
|
|
108
108
|
}
|