@pnpm/installing.env-installer 1000.0.19
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/LICENSE +22 -0
- package/README.md +17 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +5 -0
- package/lib/installConfigDeps.d.ts +15 -0
- package/lib/installConfigDeps.js +123 -0
- package/lib/migrateConfigDeps.d.ts +15 -0
- package/lib/migrateConfigDeps.js +80 -0
- package/lib/parseIntegrity.d.ts +11 -0
- package/lib/parseIntegrity.js +18 -0
- package/lib/pruneEnvLockfile.d.ts +12 -0
- package/lib/pruneEnvLockfile.js +34 -0
- package/lib/resolveAndInstallConfigDeps.d.ts +17 -0
- package/lib/resolveAndInstallConfigDeps.js +108 -0
- package/lib/resolveConfigDeps.d.ts +10 -0
- package/lib/resolveConfigDeps.js +82 -0
- package/lib/resolveManifestDependencies.d.ts +17 -0
- package/lib/resolveManifestDependencies.js +61 -0
- package/lib/resolvePackageManagerIntegrities.d.ts +20 -0
- package/lib/resolvePackageManagerIntegrities.js +61 -0
- package/package.json +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
|
|
4
|
+
Copyright (c) 2016-2026 Zoltan Kochan and other contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @pnpm/installing.env-installer
|
|
2
|
+
|
|
3
|
+
> Installer for configurational dependencies
|
|
4
|
+
|
|
5
|
+
<!--@shields('npm')-->
|
|
6
|
+
[](https://www.npmjs.com/package/@pnpm/installing.env-installer)
|
|
7
|
+
<!--/@-->
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @pnpm/installing.env-installer
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
MIT
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { installConfigDeps, type InstallConfigDepsOpts } from './installConfigDeps.js';
|
|
2
|
+
export { resolveAndInstallConfigDeps, type ResolveAndInstallConfigDepsOpts } from './resolveAndInstallConfigDeps.js';
|
|
3
|
+
export { resolveConfigDeps, type ResolveConfigDepsOpts } from './resolveConfigDeps.js';
|
|
4
|
+
export { isPackageManagerResolved, resolvePackageManagerIntegrities, type ResolvePackageManagerIntegritiesOpts } from './resolvePackageManagerIntegrities.js';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { installConfigDeps } from './installConfigDeps.js';
|
|
2
|
+
export { resolveAndInstallConfigDeps } from './resolveAndInstallConfigDeps.js';
|
|
3
|
+
export { resolveConfigDeps } from './resolveConfigDeps.js';
|
|
4
|
+
export { isPackageManagerResolved, resolvePackageManagerIntegrities } from './resolvePackageManagerIntegrities.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type EnvLockfile } from '@pnpm/lockfile.fs';
|
|
2
|
+
import type { StoreController } from '@pnpm/store.controller';
|
|
3
|
+
import type { ConfigDependencies, Registries } from '@pnpm/types';
|
|
4
|
+
export interface InstallConfigDepsOpts {
|
|
5
|
+
registries: Registries;
|
|
6
|
+
rootDir: string;
|
|
7
|
+
store: StoreController;
|
|
8
|
+
storeDir: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Install config dependencies using the env lockfile.
|
|
12
|
+
* Accepts either a EnvLockfile directly (from resolveConfigDeps) or
|
|
13
|
+
* ConfigDependencies from the workspace manifest (legacy/migration).
|
|
14
|
+
*/
|
|
15
|
+
export declare function installConfigDeps(configDepsOrLockfile: ConfigDependencies | EnvLockfile, opts: InstallConfigDepsOpts): Promise<void>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { pickRegistryForPackage } from '@pnpm/config.pick-registry-for-package';
|
|
4
|
+
import { installingConfigDepsLogger } from '@pnpm/core-loggers';
|
|
5
|
+
import { calcLeafGlobalVirtualStorePath } from '@pnpm/deps.graph-hasher';
|
|
6
|
+
import { PnpmError } from '@pnpm/error';
|
|
7
|
+
import { readModulesDir } from '@pnpm/fs.read-modules-dir';
|
|
8
|
+
import { readEnvLockfile } from '@pnpm/lockfile.fs';
|
|
9
|
+
import { safeReadPackageJsonFromDir } from '@pnpm/pkg-manifest.reader';
|
|
10
|
+
import { rimraf } from '@zkochan/rimraf';
|
|
11
|
+
import getNpmTarballUrl from 'get-npm-tarball-url';
|
|
12
|
+
import symlinkDir from 'symlink-dir';
|
|
13
|
+
import { migrateConfigDepsToLockfile } from './migrateConfigDeps.js';
|
|
14
|
+
/**
|
|
15
|
+
* Install config dependencies using the env lockfile.
|
|
16
|
+
* Accepts either a EnvLockfile directly (from resolveConfigDeps) or
|
|
17
|
+
* ConfigDependencies from the workspace manifest (legacy/migration).
|
|
18
|
+
*/
|
|
19
|
+
export async function installConfigDeps(configDepsOrLockfile, opts) {
|
|
20
|
+
const normalizedDeps = await normalizeForInstall(configDepsOrLockfile, opts);
|
|
21
|
+
const globalVirtualStoreDir = path.join(opts.storeDir, 'links');
|
|
22
|
+
const configModulesDir = path.join(opts.rootDir, 'node_modules/.pnpm-config');
|
|
23
|
+
const existingConfigDeps = await readModulesDir(configModulesDir) ?? [];
|
|
24
|
+
await Promise.all(existingConfigDeps.map(async (existingConfigDep) => {
|
|
25
|
+
if (!normalizedDeps[existingConfigDep]) {
|
|
26
|
+
await rimraf(path.join(configModulesDir, existingConfigDep));
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
const installedConfigDeps = [];
|
|
30
|
+
await Promise.all(Object.entries(normalizedDeps).map(async ([pkgName, pkg]) => {
|
|
31
|
+
const configDepPath = path.join(configModulesDir, pkgName);
|
|
32
|
+
const existingPkgJson = existingConfigDeps.includes(pkgName)
|
|
33
|
+
? await safeReadPackageJsonFromDir(configDepPath)
|
|
34
|
+
: null;
|
|
35
|
+
if (existingPkgJson != null && existingPkgJson.name === pkgName && existingPkgJson.version === pkg.version) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
installingConfigDepsLogger.debug({ status: 'started' });
|
|
39
|
+
const fullPkgId = `${pkgName}@${pkg.version}:${pkg.resolution.integrity}`;
|
|
40
|
+
const relPath = calcLeafGlobalVirtualStorePath(fullPkgId, pkgName, pkg.version);
|
|
41
|
+
const pkgDirInGlobalVirtualStore = path.join(globalVirtualStoreDir, relPath, 'node_modules', pkgName);
|
|
42
|
+
if (!fs.existsSync(path.join(pkgDirInGlobalVirtualStore, 'package.json'))) {
|
|
43
|
+
const { fetching } = await opts.store.fetchPackage({
|
|
44
|
+
force: true,
|
|
45
|
+
lockfileDir: opts.rootDir,
|
|
46
|
+
pkg: {
|
|
47
|
+
id: `${pkgName}@${pkg.version}`,
|
|
48
|
+
resolution: pkg.resolution,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const { files: filesResponse } = await fetching();
|
|
52
|
+
await opts.store.importPackage(pkgDirInGlobalVirtualStore, {
|
|
53
|
+
force: true,
|
|
54
|
+
requiresBuild: false,
|
|
55
|
+
filesResponse,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (existingConfigDeps.includes(pkgName)) {
|
|
59
|
+
await rimraf(configDepPath);
|
|
60
|
+
}
|
|
61
|
+
await fs.promises.mkdir(path.dirname(configDepPath), { recursive: true });
|
|
62
|
+
await symlinkDir(pkgDirInGlobalVirtualStore, configDepPath);
|
|
63
|
+
installedConfigDeps.push({
|
|
64
|
+
name: pkgName,
|
|
65
|
+
version: pkg.version,
|
|
66
|
+
});
|
|
67
|
+
}));
|
|
68
|
+
if (installedConfigDeps.length) {
|
|
69
|
+
installingConfigDepsLogger.debug({ status: 'done', deps: installedConfigDeps });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async function normalizeForInstall(configDepsOrLockfile, opts) {
|
|
73
|
+
// If it's a EnvLockfile object (has lockfileVersion), use it directly
|
|
74
|
+
if (isEnvLockfile(configDepsOrLockfile)) {
|
|
75
|
+
return normalizeFromLockfile(configDepsOrLockfile, opts.registries);
|
|
76
|
+
}
|
|
77
|
+
// It's ConfigDependencies from workspace manifest.
|
|
78
|
+
// Try to read the env lockfile first.
|
|
79
|
+
const envLockfile = await readEnvLockfile(opts.rootDir);
|
|
80
|
+
if (envLockfile) {
|
|
81
|
+
return normalizeFromLockfile(envLockfile, opts.registries);
|
|
82
|
+
}
|
|
83
|
+
// No env lockfile yet — migrate from old inline integrity format
|
|
84
|
+
return migrateConfigDepsToLockfile(configDepsOrLockfile, opts);
|
|
85
|
+
}
|
|
86
|
+
function isEnvLockfile(obj) {
|
|
87
|
+
return 'lockfileVersion' in obj &&
|
|
88
|
+
'importers' in obj &&
|
|
89
|
+
obj.importers != null &&
|
|
90
|
+
typeof obj.importers === 'object' &&
|
|
91
|
+
'packages' in obj &&
|
|
92
|
+
obj.packages != null &&
|
|
93
|
+
typeof obj.packages === 'object' &&
|
|
94
|
+
'snapshots' in obj &&
|
|
95
|
+
obj.snapshots != null &&
|
|
96
|
+
typeof obj.snapshots === 'object';
|
|
97
|
+
}
|
|
98
|
+
function normalizeFromLockfile(lockfile, registries) {
|
|
99
|
+
const deps = {};
|
|
100
|
+
const configDeps = lockfile.importers['.']?.configDependencies ?? {};
|
|
101
|
+
for (const [pkgName, { version }] of Object.entries(configDeps)) {
|
|
102
|
+
const pkgKey = `${pkgName}@${version}`;
|
|
103
|
+
const pkgInfo = lockfile.packages[pkgKey];
|
|
104
|
+
if (!pkgInfo) {
|
|
105
|
+
throw new PnpmError('ENV_LOCKFILE_CORRUPTED', `pnpm-lock.yaml is corrupted or incomplete: missing packages entry for "${pkgKey}" ` +
|
|
106
|
+
'referenced from importers[\'.\'].configDependencies');
|
|
107
|
+
}
|
|
108
|
+
const resolution = pkgInfo.resolution;
|
|
109
|
+
if (!resolution.integrity) {
|
|
110
|
+
throw new PnpmError('ENV_LOCKFILE_CORRUPTED', `pnpm-lock.yaml is corrupted or incomplete: missing integrity for "${pkgKey}"`);
|
|
111
|
+
}
|
|
112
|
+
const registry = pickRegistryForPackage(registries, pkgName);
|
|
113
|
+
deps[pkgName] = {
|
|
114
|
+
version,
|
|
115
|
+
resolution: {
|
|
116
|
+
integrity: resolution.integrity,
|
|
117
|
+
tarball: resolution.tarball ?? getNpmTarballUrl(pkgName, version, { registry }),
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return deps;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=installConfigDeps.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ConfigDependencies, Registries } from '@pnpm/types';
|
|
2
|
+
import type { NormalizedConfigDep } from './parseIntegrity.js';
|
|
3
|
+
interface MigrateOpts {
|
|
4
|
+
registries: Registries;
|
|
5
|
+
rootDir: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Migrates old-format configDependencies (with inline integrity in pnpm-workspace.yaml)
|
|
9
|
+
* to the new pnpm-lock.yaml format.
|
|
10
|
+
*
|
|
11
|
+
* Returns normalized deps for immediate installation, and writes the env lockfile
|
|
12
|
+
* and clean specifiers to pnpm-workspace.yaml as a side effect.
|
|
13
|
+
*/
|
|
14
|
+
export declare function migrateConfigDepsToLockfile(configDeps: ConfigDependencies, opts: MigrateOpts): Promise<Record<string, NormalizedConfigDep>>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { pickRegistryForPackage } from '@pnpm/config.pick-registry-for-package';
|
|
2
|
+
import { writeSettings } from '@pnpm/config.writer';
|
|
3
|
+
import { PnpmError } from '@pnpm/error';
|
|
4
|
+
import { createEnvLockfile, writeEnvLockfile } from '@pnpm/lockfile.fs';
|
|
5
|
+
import { toLockfileResolution } from '@pnpm/lockfile.utils';
|
|
6
|
+
import getNpmTarballUrl from 'get-npm-tarball-url';
|
|
7
|
+
import { parseIntegrity } from './parseIntegrity.js';
|
|
8
|
+
/**
|
|
9
|
+
* Migrates old-format configDependencies (with inline integrity in pnpm-workspace.yaml)
|
|
10
|
+
* to the new pnpm-lock.yaml format.
|
|
11
|
+
*
|
|
12
|
+
* Returns normalized deps for immediate installation, and writes the env lockfile
|
|
13
|
+
* and clean specifiers to pnpm-workspace.yaml as a side effect.
|
|
14
|
+
*/
|
|
15
|
+
export async function migrateConfigDepsToLockfile(configDeps, opts) {
|
|
16
|
+
const envLockfile = createEnvLockfile();
|
|
17
|
+
const cleanSpecifiers = {};
|
|
18
|
+
const normalizedDeps = {};
|
|
19
|
+
for (const [pkgName, pkgSpec] of Object.entries(configDeps)) {
|
|
20
|
+
const registry = pickRegistryForPackage(opts.registries, pkgName);
|
|
21
|
+
if (typeof pkgSpec === 'object') {
|
|
22
|
+
const { version, integrity } = parseIntegrity(pkgName, pkgSpec.integrity);
|
|
23
|
+
const tarball = pkgSpec.tarball ?? getNpmTarballUrl(pkgName, version, { registry });
|
|
24
|
+
cleanSpecifiers[pkgName] = version;
|
|
25
|
+
const pkgKey = `${pkgName}@${version}`;
|
|
26
|
+
envLockfile.importers['.'].configDependencies[pkgName] = {
|
|
27
|
+
specifier: version,
|
|
28
|
+
version,
|
|
29
|
+
};
|
|
30
|
+
envLockfile.packages[pkgKey] = {
|
|
31
|
+
resolution: toLockfileResolution({ name: pkgName, version }, { integrity, tarball }, registry),
|
|
32
|
+
};
|
|
33
|
+
envLockfile.snapshots[pkgKey] = {};
|
|
34
|
+
normalizedDeps[pkgName] = {
|
|
35
|
+
version,
|
|
36
|
+
resolution: { integrity, tarball },
|
|
37
|
+
};
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (typeof pkgSpec === 'string') {
|
|
41
|
+
// This branch only handles the legacy inline format (version+integrity).
|
|
42
|
+
// New clean specifiers (just version/range) require an existing pnpm-lock.yaml.
|
|
43
|
+
if (!pkgSpec.includes('+')) {
|
|
44
|
+
throw new PnpmError('CONFIG_DEP_MISSING_LOCKFILE', `Config dependency "${pkgName}" is already in clean-specifier form (${pkgSpec}) ` +
|
|
45
|
+
'but no pnpm-lock.yaml was found to resolve it. ' +
|
|
46
|
+
'Please generate and commit pnpm-lock.yaml (for example by running ' +
|
|
47
|
+
'`pnpm install` in the workspace root) before attempting to migrate configDependencies.');
|
|
48
|
+
}
|
|
49
|
+
const { version, integrity } = parseIntegrity(pkgName, pkgSpec);
|
|
50
|
+
const tarball = getNpmTarballUrl(pkgName, version, { registry });
|
|
51
|
+
cleanSpecifiers[pkgName] = version;
|
|
52
|
+
const pkgKey = `${pkgName}@${version}`;
|
|
53
|
+
envLockfile.importers['.'].configDependencies[pkgName] = {
|
|
54
|
+
specifier: version,
|
|
55
|
+
version,
|
|
56
|
+
};
|
|
57
|
+
envLockfile.packages[pkgKey] = {
|
|
58
|
+
resolution: { integrity },
|
|
59
|
+
};
|
|
60
|
+
envLockfile.snapshots[pkgKey] = {};
|
|
61
|
+
normalizedDeps[pkgName] = {
|
|
62
|
+
version,
|
|
63
|
+
resolution: { integrity, tarball },
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Write the new env lockfile and clean up workspace manifest
|
|
68
|
+
await Promise.all([
|
|
69
|
+
writeEnvLockfile(opts.rootDir, envLockfile),
|
|
70
|
+
writeSettings({
|
|
71
|
+
rootProjectManifestDir: opts.rootDir,
|
|
72
|
+
workspaceDir: opts.rootDir,
|
|
73
|
+
updatedSettings: {
|
|
74
|
+
configDependencies: cleanSpecifiers,
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
]);
|
|
78
|
+
return normalizedDeps;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=migrateConfigDeps.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PnpmError } from '@pnpm/error';
|
|
2
|
+
export function parseIntegrity(pkgName, pkgSpec) {
|
|
3
|
+
const sepIndex = pkgSpec.indexOf('+');
|
|
4
|
+
if (sepIndex === -1) {
|
|
5
|
+
throw new PnpmError('CONFIG_DEP_NO_INTEGRITY', `Your config dependency called "${pkgName}" doesn't have an integrity checksum`, {
|
|
6
|
+
hint: `Integrity checksum should be inlined in the version specifier. For example:
|
|
7
|
+
|
|
8
|
+
pnpm-workspace.yaml:
|
|
9
|
+
configDependencies:
|
|
10
|
+
my-config: "1.0.0+sha512-Xg0tn4HcfTijTwfDwYlvVCl43V6h4KyVVX2aEm4qdO/PC6L2YvzLHFdmxhoeSA3eslcE6+ZVXHgWwopXYLNq4Q=="
|
|
11
|
+
`,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
const version = pkgSpec.substring(0, sepIndex);
|
|
15
|
+
const integrity = pkgSpec.substring(sepIndex + 1);
|
|
16
|
+
return { version, integrity };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=parseIntegrity.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EnvLockfile, LockfileObject } from '@pnpm/lockfile.types';
|
|
2
|
+
/**
|
|
3
|
+
* Converts an env lockfile to a standard LockfileObject by merging
|
|
4
|
+
* configDependencies and packageManagerDependencies into a single
|
|
5
|
+
* importers['.'].dependencies map.
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertToLockfileEnvObject(envLockfile: EnvLockfile): LockfileObject;
|
|
8
|
+
/**
|
|
9
|
+
* Prunes stale packages and snapshots from an env lockfile by converting to
|
|
10
|
+
* a standard lockfile object, pruning unreferenced entries, and converting back.
|
|
11
|
+
*/
|
|
12
|
+
export declare function pruneEnvLockfile(envLockfile: EnvLockfile): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { convertToLockfileFile, convertToLockfileObject } from '@pnpm/lockfile.fs';
|
|
2
|
+
import { pruneSharedLockfile } from '@pnpm/lockfile.pruner';
|
|
3
|
+
/**
|
|
4
|
+
* Converts an env lockfile to a standard LockfileObject by merging
|
|
5
|
+
* configDependencies and packageManagerDependencies into a single
|
|
6
|
+
* importers['.'].dependencies map.
|
|
7
|
+
*/
|
|
8
|
+
export function convertToLockfileEnvObject(envLockfile) {
|
|
9
|
+
return convertToLockfileObject({
|
|
10
|
+
lockfileVersion: envLockfile.lockfileVersion,
|
|
11
|
+
importers: {
|
|
12
|
+
'.': {
|
|
13
|
+
dependencies: {
|
|
14
|
+
...envLockfile.importers['.'].configDependencies,
|
|
15
|
+
...(envLockfile.importers['.'].packageManagerDependencies ?? {}),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
packages: envLockfile.packages,
|
|
20
|
+
snapshots: envLockfile.snapshots,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Prunes stale packages and snapshots from an env lockfile by converting to
|
|
25
|
+
* a standard lockfile object, pruning unreferenced entries, and converting back.
|
|
26
|
+
*/
|
|
27
|
+
export function pruneEnvLockfile(envLockfile) {
|
|
28
|
+
const lockfileObject = convertToLockfileEnvObject(envLockfile);
|
|
29
|
+
const pruned = pruneSharedLockfile(lockfileObject);
|
|
30
|
+
const prunedFile = convertToLockfileFile(pruned);
|
|
31
|
+
envLockfile.packages = prunedFile.packages ?? {};
|
|
32
|
+
envLockfile.snapshots = prunedFile.snapshots ?? {};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=pruneEnvLockfile.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CreateFetchFromRegistryOptions } from '@pnpm/network.fetch';
|
|
2
|
+
import { type ResolverFactoryOptions } from '@pnpm/resolving.npm-resolver';
|
|
3
|
+
import type { ConfigDependencies } from '@pnpm/types';
|
|
4
|
+
import { type InstallConfigDepsOpts } from './installConfigDeps.js';
|
|
5
|
+
export type ResolveAndInstallConfigDepsOpts = CreateFetchFromRegistryOptions & ResolverFactoryOptions & InstallConfigDepsOpts & {
|
|
6
|
+
rootDir: string;
|
|
7
|
+
userConfig?: Record<string, string>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Resolves any config dependencies that are missing from the env lockfile,
|
|
11
|
+
* then installs all config dependencies.
|
|
12
|
+
*
|
|
13
|
+
* This handles two scenarios:
|
|
14
|
+
* 1. User manually added config deps to pnpm-workspace.yaml
|
|
15
|
+
* 2. User deleted pnpm-lock.yaml after installing config deps
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveAndInstallConfigDeps(configDeps: ConfigDependencies, opts: ResolveAndInstallConfigDepsOpts): Promise<void>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { pickRegistryForPackage } from '@pnpm/config.pick-registry-for-package';
|
|
2
|
+
import { PnpmError } from '@pnpm/error';
|
|
3
|
+
import { createEnvLockfile, readEnvLockfile, writeEnvLockfile, } from '@pnpm/lockfile.fs';
|
|
4
|
+
import { toLockfileResolution } from '@pnpm/lockfile.utils';
|
|
5
|
+
import { createGetAuthHeaderByURI } from '@pnpm/network.auth-header';
|
|
6
|
+
import { createFetchFromRegistry } from '@pnpm/network.fetch';
|
|
7
|
+
import { createNpmResolver } from '@pnpm/resolving.npm-resolver';
|
|
8
|
+
import getNpmTarballUrl from 'get-npm-tarball-url';
|
|
9
|
+
import { installConfigDeps } from './installConfigDeps.js';
|
|
10
|
+
import { parseIntegrity } from './parseIntegrity.js';
|
|
11
|
+
import { pruneEnvLockfile } from './pruneEnvLockfile.js';
|
|
12
|
+
/**
|
|
13
|
+
* Resolves any config dependencies that are missing from the env lockfile,
|
|
14
|
+
* then installs all config dependencies.
|
|
15
|
+
*
|
|
16
|
+
* This handles two scenarios:
|
|
17
|
+
* 1. User manually added config deps to pnpm-workspace.yaml
|
|
18
|
+
* 2. User deleted pnpm-lock.yaml after installing config deps
|
|
19
|
+
*/
|
|
20
|
+
export async function resolveAndInstallConfigDeps(configDeps, opts) {
|
|
21
|
+
const envLockfile = (await readEnvLockfile(opts.rootDir)) ?? createEnvLockfile();
|
|
22
|
+
const lockfileConfigDeps = envLockfile.importers['.'].configDependencies;
|
|
23
|
+
const depsToResolve = [];
|
|
24
|
+
let lockfileChanged = false;
|
|
25
|
+
for (const [name, value] of Object.entries(configDeps)) {
|
|
26
|
+
if (typeof value === 'object') {
|
|
27
|
+
// Old object format — migrate inline into lockfile
|
|
28
|
+
if (!lockfileConfigDeps[name]) {
|
|
29
|
+
const registry = pickRegistryForPackage(opts.registries, name);
|
|
30
|
+
const { version, integrity } = parseIntegrity(name, value.integrity);
|
|
31
|
+
const tarball = value.tarball ?? getNpmTarballUrl(name, version, { registry });
|
|
32
|
+
const pkgKey = `${name}@${version}`;
|
|
33
|
+
lockfileConfigDeps[name] = { specifier: version, version };
|
|
34
|
+
envLockfile.packages[pkgKey] = {
|
|
35
|
+
resolution: toLockfileResolution({ name, version }, { integrity, tarball }, registry),
|
|
36
|
+
};
|
|
37
|
+
envLockfile.snapshots[pkgKey] = {};
|
|
38
|
+
lockfileChanged = true;
|
|
39
|
+
}
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (value.includes('+')) {
|
|
43
|
+
// Old string format with inline integrity — migrate into lockfile
|
|
44
|
+
if (!lockfileConfigDeps[name]) {
|
|
45
|
+
const registry = pickRegistryForPackage(opts.registries, name);
|
|
46
|
+
const { version, integrity } = parseIntegrity(name, value);
|
|
47
|
+
const tarball = getNpmTarballUrl(name, version, { registry });
|
|
48
|
+
const pkgKey = `${name}@${version}`;
|
|
49
|
+
lockfileConfigDeps[name] = { specifier: version, version };
|
|
50
|
+
envLockfile.packages[pkgKey] = {
|
|
51
|
+
resolution: toLockfileResolution({ name, version }, { integrity, tarball }, registry),
|
|
52
|
+
};
|
|
53
|
+
envLockfile.snapshots[pkgKey] = {};
|
|
54
|
+
lockfileChanged = true;
|
|
55
|
+
}
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
// New format (clean specifier like "1.2.0" or "^1.0.0")
|
|
59
|
+
const specifier = value;
|
|
60
|
+
const existing = lockfileConfigDeps[name];
|
|
61
|
+
if (existing && existing.specifier === specifier) {
|
|
62
|
+
const pkgKey = `${name}@${existing.version}`;
|
|
63
|
+
if (envLockfile.packages[pkgKey])
|
|
64
|
+
continue; // fully resolved
|
|
65
|
+
}
|
|
66
|
+
depsToResolve.push({ name, specifier });
|
|
67
|
+
}
|
|
68
|
+
if (depsToResolve.length === 0) {
|
|
69
|
+
if (lockfileChanged) {
|
|
70
|
+
await writeEnvLockfile(opts.rootDir, envLockfile);
|
|
71
|
+
}
|
|
72
|
+
await installConfigDeps(envLockfile, opts);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// Resolve missing deps
|
|
76
|
+
const userConfig = opts.userConfig ?? {};
|
|
77
|
+
const fetch = createFetchFromRegistry(opts);
|
|
78
|
+
const getAuthHeader = createGetAuthHeaderByURI({ allSettings: userConfig, userSettings: userConfig });
|
|
79
|
+
const { resolveFromNpm } = createNpmResolver(fetch, getAuthHeader, opts);
|
|
80
|
+
await Promise.all(depsToResolve.map(async ({ name, specifier }) => {
|
|
81
|
+
const resolution = await resolveFromNpm({ alias: name, bareSpecifier: specifier }, {
|
|
82
|
+
lockfileDir: opts.rootDir,
|
|
83
|
+
preferredVersions: {},
|
|
84
|
+
projectDir: opts.rootDir,
|
|
85
|
+
});
|
|
86
|
+
if (resolution?.resolution == null ||
|
|
87
|
+
!('integrity' in resolution.resolution) ||
|
|
88
|
+
typeof resolution.resolution.integrity !== 'string' ||
|
|
89
|
+
!resolution.resolution.integrity) {
|
|
90
|
+
throw new PnpmError('BAD_CONFIG_DEP', `Cannot resolve ${name}@${specifier} as a configuration dependency because it has no integrity`);
|
|
91
|
+
}
|
|
92
|
+
const version = resolution.manifest.version;
|
|
93
|
+
const registry = pickRegistryForPackage(opts.registries, name);
|
|
94
|
+
const pkgKey = `${name}@${version}`;
|
|
95
|
+
lockfileConfigDeps[name] = {
|
|
96
|
+
specifier,
|
|
97
|
+
version,
|
|
98
|
+
};
|
|
99
|
+
envLockfile.packages[pkgKey] = {
|
|
100
|
+
resolution: toLockfileResolution({ name, version }, resolution.resolution, registry),
|
|
101
|
+
};
|
|
102
|
+
envLockfile.snapshots[pkgKey] = {};
|
|
103
|
+
}));
|
|
104
|
+
pruneEnvLockfile(envLockfile);
|
|
105
|
+
await writeEnvLockfile(opts.rootDir, envLockfile);
|
|
106
|
+
await installConfigDeps(envLockfile, opts);
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=resolveAndInstallConfigDeps.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CreateFetchFromRegistryOptions } from '@pnpm/network.fetch';
|
|
2
|
+
import { type ResolverFactoryOptions } from '@pnpm/resolving.npm-resolver';
|
|
3
|
+
import type { ConfigDependencies } from '@pnpm/types';
|
|
4
|
+
import { type InstallConfigDepsOpts } from './installConfigDeps.js';
|
|
5
|
+
export type ResolveConfigDepsOpts = CreateFetchFromRegistryOptions & ResolverFactoryOptions & InstallConfigDepsOpts & {
|
|
6
|
+
configDependencies?: ConfigDependencies;
|
|
7
|
+
rootDir: string;
|
|
8
|
+
userConfig?: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolveConfigDeps(configDeps: string[], opts: ResolveConfigDepsOpts): Promise<void>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { pickRegistryForPackage } from '@pnpm/config.pick-registry-for-package';
|
|
2
|
+
import { writeSettings } from '@pnpm/config.writer';
|
|
3
|
+
import { PnpmError } from '@pnpm/error';
|
|
4
|
+
import { createEnvLockfile, readEnvLockfile, writeEnvLockfile, } from '@pnpm/lockfile.fs';
|
|
5
|
+
import { toLockfileResolution } from '@pnpm/lockfile.utils';
|
|
6
|
+
import { createGetAuthHeaderByURI } from '@pnpm/network.auth-header';
|
|
7
|
+
import { createFetchFromRegistry } from '@pnpm/network.fetch';
|
|
8
|
+
import { createNpmResolver } from '@pnpm/resolving.npm-resolver';
|
|
9
|
+
import { parseWantedDependency } from '@pnpm/resolving.parse-wanted-dependency';
|
|
10
|
+
import { installConfigDeps } from './installConfigDeps.js';
|
|
11
|
+
export async function resolveConfigDeps(configDeps, opts) {
|
|
12
|
+
const fetch = createFetchFromRegistry(opts);
|
|
13
|
+
const getAuthHeader = createGetAuthHeaderByURI({ allSettings: opts.userConfig, userSettings: opts.userConfig });
|
|
14
|
+
const { resolveFromNpm } = createNpmResolver(fetch, getAuthHeader, opts);
|
|
15
|
+
// Extract existing specifiers from configDependencies (handles both old and new formats)
|
|
16
|
+
const configDependencySpecifiers = extractSpecifiers(opts.configDependencies);
|
|
17
|
+
const envLockfile = (await readEnvLockfile(opts.rootDir)) ?? createEnvLockfile();
|
|
18
|
+
await Promise.all(configDeps.map(async (configDep) => {
|
|
19
|
+
const wantedDep = parseWantedDependency(configDep);
|
|
20
|
+
if (!wantedDep.alias) {
|
|
21
|
+
throw new PnpmError('BAD_CONFIG_DEP', `Cannot install ${configDep} as configuration dependency`);
|
|
22
|
+
}
|
|
23
|
+
const resolution = await resolveFromNpm(wantedDep, {
|
|
24
|
+
lockfileDir: opts.rootDir,
|
|
25
|
+
preferredVersions: {},
|
|
26
|
+
projectDir: opts.rootDir,
|
|
27
|
+
});
|
|
28
|
+
if (resolution?.resolution == null || !('integrity' in resolution.resolution) || typeof resolution.resolution.integrity !== 'string' || !resolution.resolution.integrity) {
|
|
29
|
+
throw new PnpmError('BAD_CONFIG_DEP', `Cannot install ${configDep} as configuration dependency because it has no integrity`);
|
|
30
|
+
}
|
|
31
|
+
const pkgName = wantedDep.alias;
|
|
32
|
+
const version = resolution.manifest.version;
|
|
33
|
+
const registry = pickRegistryForPackage(opts.registries, pkgName);
|
|
34
|
+
// Write clean specifier to workspace manifest
|
|
35
|
+
configDependencySpecifiers[pkgName] = wantedDep.bareSpecifier ?? version;
|
|
36
|
+
// Write resolved info to env lockfile
|
|
37
|
+
const pkgKey = `${pkgName}@${version}`;
|
|
38
|
+
envLockfile.importers['.'].configDependencies[pkgName] = {
|
|
39
|
+
specifier: configDependencySpecifiers[pkgName],
|
|
40
|
+
version,
|
|
41
|
+
};
|
|
42
|
+
envLockfile.packages[pkgKey] = {
|
|
43
|
+
resolution: toLockfileResolution({ name: pkgName, version }, resolution.resolution, registry),
|
|
44
|
+
};
|
|
45
|
+
envLockfile.snapshots[pkgKey] = {};
|
|
46
|
+
}));
|
|
47
|
+
await Promise.all([
|
|
48
|
+
writeSettings({
|
|
49
|
+
...opts,
|
|
50
|
+
rootProjectManifestDir: opts.rootDir,
|
|
51
|
+
workspaceDir: opts.rootDir,
|
|
52
|
+
updatedSettings: {
|
|
53
|
+
configDependencies: configDependencySpecifiers,
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
writeEnvLockfile(opts.rootDir, envLockfile),
|
|
57
|
+
]);
|
|
58
|
+
await installConfigDeps(envLockfile, opts);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Extracts plain specifiers from configDependencies, handling both old format
|
|
62
|
+
* ("version+integrity") and new format (plain specifiers).
|
|
63
|
+
*/
|
|
64
|
+
function extractSpecifiers(configDependencies) {
|
|
65
|
+
if (!configDependencies)
|
|
66
|
+
return {};
|
|
67
|
+
const specifiers = {};
|
|
68
|
+
for (const [name, value] of Object.entries(configDependencies)) {
|
|
69
|
+
if (typeof value === 'object') {
|
|
70
|
+
// Old format with tarball: extract version from integrity string
|
|
71
|
+
const sepIndex = value.integrity.indexOf('+');
|
|
72
|
+
specifiers[name] = sepIndex !== -1 ? value.integrity.substring(0, sepIndex) : value.integrity;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
// Could be old "version+integrity" or new plain specifier
|
|
76
|
+
const sepIndex = value.indexOf('+');
|
|
77
|
+
specifiers[name] = sepIndex !== -1 ? value.substring(0, sepIndex) : value;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return specifiers;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=resolveConfigDeps.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LockfileObject } from '@pnpm/lockfile.types';
|
|
2
|
+
import type { StoreController } from '@pnpm/store.controller-types';
|
|
3
|
+
import type { ProjectManifest, Registries } from '@pnpm/types';
|
|
4
|
+
export interface ResolveManifestDependenciesOpts {
|
|
5
|
+
dir: string;
|
|
6
|
+
registries: Registries;
|
|
7
|
+
storeController: StoreController;
|
|
8
|
+
storeDir: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Resolves the dependencies of a manifest and returns the resulting lockfile
|
|
12
|
+
* without writing anything to disk.
|
|
13
|
+
*
|
|
14
|
+
* This is a lightweight wrapper around resolveDependencies for cases where
|
|
15
|
+
* you only need the lockfile output (e.g., resolving package manager integrities).
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveManifestDependencies(manifest: ProjectManifest, opts: ResolveManifestDependenciesOpts): Promise<LockfileObject>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { LOCKFILE_VERSION } from '@pnpm/constants';
|
|
3
|
+
import { getWantedDependencies, resolveDependencies, } from '@pnpm/installing.deps-resolver';
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the dependencies of a manifest and returns the resulting lockfile
|
|
6
|
+
* without writing anything to disk.
|
|
7
|
+
*
|
|
8
|
+
* This is a lightweight wrapper around resolveDependencies for cases where
|
|
9
|
+
* you only need the lockfile output (e.g., resolving package manager integrities).
|
|
10
|
+
*/
|
|
11
|
+
export async function resolveManifestDependencies(manifest, opts) {
|
|
12
|
+
const dir = opts.dir;
|
|
13
|
+
const emptyLockfile = {
|
|
14
|
+
lockfileVersion: LOCKFILE_VERSION,
|
|
15
|
+
importers: {
|
|
16
|
+
['.']: { specifiers: {} },
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const wantedDependencies = getWantedDependencies(manifest)
|
|
20
|
+
.map((dep) => ({ ...dep, updateSpec: true }));
|
|
21
|
+
const { newLockfile, waitTillAllFetchingsFinish } = await resolveDependencies([
|
|
22
|
+
{
|
|
23
|
+
id: '.',
|
|
24
|
+
manifest,
|
|
25
|
+
modulesDir: path.join(opts.dir, 'node_modules'),
|
|
26
|
+
rootDir: dir,
|
|
27
|
+
wantedDependencies,
|
|
28
|
+
binsDir: path.join(opts.dir, 'node_modules', '.bin'),
|
|
29
|
+
updatePackageManifest: false,
|
|
30
|
+
},
|
|
31
|
+
], {
|
|
32
|
+
allowedDeprecatedVersions: {},
|
|
33
|
+
allowUnusedPatches: true,
|
|
34
|
+
currentLockfile: emptyLockfile,
|
|
35
|
+
defaultUpdateDepth: 0,
|
|
36
|
+
dryRun: true,
|
|
37
|
+
engineStrict: false,
|
|
38
|
+
force: false,
|
|
39
|
+
forceFullResolution: true,
|
|
40
|
+
hooks: {},
|
|
41
|
+
lockfileDir: opts.dir,
|
|
42
|
+
nodeVersion: process.version,
|
|
43
|
+
pnpmVersion: '',
|
|
44
|
+
preferWorkspacePackages: false,
|
|
45
|
+
preserveWorkspaceProtocol: false,
|
|
46
|
+
registries: opts.registries,
|
|
47
|
+
saveWorkspaceProtocol: false,
|
|
48
|
+
storeController: opts.storeController,
|
|
49
|
+
tag: 'latest',
|
|
50
|
+
virtualStoreDir: path.join(opts.dir, 'node_modules', '.pnpm'),
|
|
51
|
+
globalVirtualStoreDir: path.join(opts.storeDir, 'links'),
|
|
52
|
+
virtualStoreDirMaxLength: 120,
|
|
53
|
+
wantedLockfile: emptyLockfile,
|
|
54
|
+
workspacePackages: new Map(),
|
|
55
|
+
peersSuffixMaxLength: 1000,
|
|
56
|
+
allProjectIds: ['.'],
|
|
57
|
+
});
|
|
58
|
+
await waitTillAllFetchingsFinish();
|
|
59
|
+
return newLockfile;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=resolveManifestDependencies.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EnvLockfile } from '@pnpm/lockfile.types';
|
|
2
|
+
import type { StoreController } from '@pnpm/store.controller';
|
|
3
|
+
import type { Registries } from '@pnpm/types';
|
|
4
|
+
export interface ResolvePackageManagerIntegritiesOpts {
|
|
5
|
+
envLockfile?: EnvLockfile;
|
|
6
|
+
registries: Registries;
|
|
7
|
+
rootDir: string;
|
|
8
|
+
storeController: StoreController;
|
|
9
|
+
storeDir: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Checks if the wanted pnpm version integrities are already fully resolved in the env lockfile.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isPackageManagerResolved(envLockfile: EnvLockfile | undefined, pnpmVersion: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves integrity checksums for `pnpm`, `@pnpm/exe`, and their dependencies
|
|
17
|
+
* by calling resolveManifestDependencies.
|
|
18
|
+
* Writes the results to the `packageManagerDependencies` section of pnpm-lock.yaml.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolvePackageManagerIntegrities(pnpmVersion: string, opts: ResolvePackageManagerIntegritiesOpts): Promise<EnvLockfile>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { convertToLockfileFile, createEnvLockfile, readEnvLockfile, writeEnvLockfile } from '@pnpm/lockfile.fs';
|
|
2
|
+
import { pruneSharedLockfile } from '@pnpm/lockfile.pruner';
|
|
3
|
+
import { convertToLockfileEnvObject } from './pruneEnvLockfile.js';
|
|
4
|
+
import { resolveManifestDependencies } from './resolveManifestDependencies.js';
|
|
5
|
+
/**
|
|
6
|
+
* Checks if the wanted pnpm version integrities are already fully resolved in the env lockfile.
|
|
7
|
+
*/
|
|
8
|
+
export function isPackageManagerResolved(envLockfile, pnpmVersion) {
|
|
9
|
+
if (!envLockfile)
|
|
10
|
+
return false;
|
|
11
|
+
const pmDeps = envLockfile.importers['.'].packageManagerDependencies;
|
|
12
|
+
return pmDeps != null &&
|
|
13
|
+
pmDeps['pnpm']?.version === pnpmVersion &&
|
|
14
|
+
pmDeps['@pnpm/exe']?.version === pnpmVersion;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves integrity checksums for `pnpm`, `@pnpm/exe`, and their dependencies
|
|
18
|
+
* by calling resolveManifestDependencies.
|
|
19
|
+
* Writes the results to the `packageManagerDependencies` section of pnpm-lock.yaml.
|
|
20
|
+
*/
|
|
21
|
+
export async function resolvePackageManagerIntegrities(pnpmVersion, opts) {
|
|
22
|
+
const envLockfile = opts.envLockfile ?? (await readEnvLockfile(opts.rootDir)) ?? createEnvLockfile();
|
|
23
|
+
if (isPackageManagerResolved(envLockfile, pnpmVersion)) {
|
|
24
|
+
return envLockfile;
|
|
25
|
+
}
|
|
26
|
+
const lockfile = await resolveManifestDependencies({
|
|
27
|
+
dependencies: {
|
|
28
|
+
'pnpm': pnpmVersion,
|
|
29
|
+
'@pnpm/exe': pnpmVersion,
|
|
30
|
+
},
|
|
31
|
+
}, {
|
|
32
|
+
dir: opts.rootDir,
|
|
33
|
+
registries: opts.registries,
|
|
34
|
+
storeController: opts.storeController,
|
|
35
|
+
storeDir: opts.storeDir,
|
|
36
|
+
});
|
|
37
|
+
if (lockfile.packages) {
|
|
38
|
+
// Build packageManagerDependencies from the resolved lockfile importers
|
|
39
|
+
const importer = lockfile.importers['.'];
|
|
40
|
+
const packageManagerDependencies = {};
|
|
41
|
+
for (const [name, version] of Object.entries(importer.dependencies ?? {})) {
|
|
42
|
+
packageManagerDependencies[name] = {
|
|
43
|
+
specifier: importer.specifiers[name],
|
|
44
|
+
version,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
envLockfile.importers['.'].packageManagerDependencies = packageManagerDependencies;
|
|
48
|
+
// Merge new packages into the env lockfile object, then prune stale entries
|
|
49
|
+
const merged = convertToLockfileEnvObject(envLockfile);
|
|
50
|
+
for (const [depPath, pkg] of Object.entries(lockfile.packages)) {
|
|
51
|
+
merged.packages[depPath] = pkg;
|
|
52
|
+
}
|
|
53
|
+
const pruned = pruneSharedLockfile(merged);
|
|
54
|
+
const prunedFile = convertToLockfileFile(pruned);
|
|
55
|
+
envLockfile.packages = prunedFile.packages ?? {};
|
|
56
|
+
envLockfile.snapshots = prunedFile.snapshots ?? {};
|
|
57
|
+
await writeEnvLockfile(opts.rootDir, envLockfile);
|
|
58
|
+
}
|
|
59
|
+
return envLockfile;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=resolvePackageManagerIntegrities.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pnpm/installing.env-installer",
|
|
3
|
+
"version": "1000.0.19",
|
|
4
|
+
"description": "Installer for configurational dependencies",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pnpm",
|
|
7
|
+
"pnpm11",
|
|
8
|
+
"config"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"funding": "https://opencollective.com/pnpm",
|
|
12
|
+
"repository": "https://github.com/pnpm/pnpm/tree/main/installing/env-installer",
|
|
13
|
+
"homepage": "https://github.com/pnpm/pnpm/tree/main/installing/env-installer#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/pnpm/pnpm/issues"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "lib/index.js",
|
|
19
|
+
"types": "lib/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./lib/index.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib",
|
|
25
|
+
"!*.map"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@zkochan/rimraf": "^4.0.0",
|
|
29
|
+
"get-npm-tarball-url": "^2.1.0",
|
|
30
|
+
"symlink-dir": "^7.0.0",
|
|
31
|
+
"@pnpm/config.writer": "1000.0.14",
|
|
32
|
+
"@pnpm/config.pick-registry-for-package": "1000.0.11",
|
|
33
|
+
"@pnpm/constants": "1001.3.1",
|
|
34
|
+
"@pnpm/core-loggers": "1001.0.4",
|
|
35
|
+
"@pnpm/error": "1000.0.5",
|
|
36
|
+
"@pnpm/installing.deps-resolver": "1008.3.1",
|
|
37
|
+
"@pnpm/deps.graph-hasher": "1002.0.8",
|
|
38
|
+
"@pnpm/fs.read-modules-dir": "1000.0.0",
|
|
39
|
+
"@pnpm/lockfile.fs": "1001.1.21",
|
|
40
|
+
"@pnpm/lockfile.pruner": "1001.0.17",
|
|
41
|
+
"@pnpm/lockfile.types": "1002.0.2",
|
|
42
|
+
"@pnpm/network.auth-header": "1000.0.6",
|
|
43
|
+
"@pnpm/lockfile.utils": "1003.0.3",
|
|
44
|
+
"@pnpm/network.fetch": "1000.2.6",
|
|
45
|
+
"@pnpm/pkg-manifest.reader": "1000.1.2",
|
|
46
|
+
"@pnpm/resolving.npm-resolver": "1004.4.1",
|
|
47
|
+
"@pnpm/resolving.parse-wanted-dependency": "1001.0.0",
|
|
48
|
+
"@pnpm/store.controller-types": "1004.1.0",
|
|
49
|
+
"@pnpm/store.controller": "1004.0.0",
|
|
50
|
+
"@pnpm/types": "1000.9.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@pnpm/logger": ">=1001.0.0 <1002.0.0",
|
|
54
|
+
"@pnpm/worker": "^1000.3.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@pnpm/registry-mock": "5.2.4",
|
|
58
|
+
"load-json-file": "^7.0.1",
|
|
59
|
+
"read-yaml-file": "^3.0.0",
|
|
60
|
+
"@pnpm/installing.env-installer": "1000.0.19",
|
|
61
|
+
"@pnpm/testing.temp-store": "1000.0.23",
|
|
62
|
+
"@pnpm/prepare": "1000.0.4"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">=22.13"
|
|
66
|
+
},
|
|
67
|
+
"jest": {
|
|
68
|
+
"preset": "@pnpm/jest-config/with-registry"
|
|
69
|
+
},
|
|
70
|
+
"scripts": {
|
|
71
|
+
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
72
|
+
"_test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest",
|
|
73
|
+
"test": "pnpm run compile && pnpm run _test",
|
|
74
|
+
"start": "tsgo --watch",
|
|
75
|
+
"compile": "tsgo --build && pnpm run lint --fix"
|
|
76
|
+
}
|
|
77
|
+
}
|