@pnpm/store.controller 1004.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.
|
@@ -8,7 +8,7 @@ export {};
|
|
|
8
8
|
export function createPackageStore(resolve, fetchers, initOpts) {
|
|
9
9
|
const storeDir = initOpts.storeDir;
|
|
10
10
|
if (!fs.existsSync(path.join(storeDir, 'files'))) {
|
|
11
|
-
initStoreDir(storeDir).catch();
|
|
11
|
+
initStoreDir(storeDir).catch(() => { });
|
|
12
12
|
}
|
|
13
13
|
const cafs = createCafsStore(storeDir, {
|
|
14
14
|
cafsLocker: initOpts.cafsLocker,
|
|
@@ -5,7 +5,7 @@ import { createShortHash } from '@pnpm/crypto.hash';
|
|
|
5
5
|
import { PnpmError } from '@pnpm/error';
|
|
6
6
|
import { globalInfo } from '@pnpm/logger';
|
|
7
7
|
import { isSubdir } from 'is-subdir';
|
|
8
|
-
import symlinkDir from 'symlink-dir';
|
|
8
|
+
import { symlinkDir } from 'symlink-dir';
|
|
9
9
|
const PROJECTS_DIR = 'projects';
|
|
10
10
|
export function getProjectsRegistryDir(storeDir) {
|
|
11
11
|
return path.join(storeDir, PROJECTS_DIR);
|
|
@@ -3,6 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import util from 'node:util';
|
|
4
4
|
import { globalInfo, globalWarn } from '@pnpm/logger';
|
|
5
5
|
import { rimraf } from '@zkochan/rimraf';
|
|
6
|
+
import prettyBytes from 'pretty-bytes';
|
|
6
7
|
import { pruneGlobalVirtualStore } from './pruneGlobalVirtualStore.js';
|
|
7
8
|
const BIG_ONE = BigInt(1);
|
|
8
9
|
export async function prune({ cacheDir, storeDir, storeIndex }, removeAlienFiles) {
|
|
@@ -11,9 +12,10 @@ export async function prune({ cacheDir, storeDir, storeIndex }, removeAlienFiles
|
|
|
11
12
|
// the virtual store will reduce hard link counts on files in the CAS
|
|
12
13
|
await pruneGlobalVirtualStore(storeDir);
|
|
13
14
|
// 2. Clean up metadata cache
|
|
15
|
+
// Metadata dirs may be at top level (legacy metadata-*) or under a version prefix (v11/metadata*)
|
|
14
16
|
const metadataDirs = await getSubdirsSafely(cacheDir);
|
|
15
17
|
await Promise.all(metadataDirs.map(async (metadataDir) => {
|
|
16
|
-
if (!metadataDir.startsWith('metadata'))
|
|
18
|
+
if (!metadataDir.startsWith('metadata') && !/^v\d+$/.test(metadataDir))
|
|
17
19
|
return;
|
|
18
20
|
try {
|
|
19
21
|
await rimraf(path.join(cacheDir, metadataDir));
|
|
@@ -31,6 +33,7 @@ export async function prune({ cacheDir, storeDir, storeIndex }, removeAlienFiles
|
|
|
31
33
|
const removedHashes = new Set();
|
|
32
34
|
const dirs = await getSubdirsSafely(cafsDir);
|
|
33
35
|
let fileCounter = 0;
|
|
36
|
+
let totalSize = 0;
|
|
34
37
|
await Promise.all(dirs.map(async (dir) => {
|
|
35
38
|
const subdir = path.join(cafsDir, dir);
|
|
36
39
|
await Promise.all((await fs.readdir(subdir)).map(async (fileName) => {
|
|
@@ -49,6 +52,7 @@ export async function prune({ cacheDir, storeDir, storeIndex }, removeAlienFiles
|
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
if (stat.nlink === 1 || stat.nlink === BIG_ONE) {
|
|
55
|
+
totalSize += stat.size;
|
|
52
56
|
await fs.unlink(filePath);
|
|
53
57
|
fileCounter++;
|
|
54
58
|
// Store the hex digest, which matches the format stored in PackageFileInfo.digest
|
|
@@ -57,7 +61,7 @@ export async function prune({ cacheDir, storeDir, storeIndex }, removeAlienFiles
|
|
|
57
61
|
}
|
|
58
62
|
}));
|
|
59
63
|
}));
|
|
60
|
-
globalInfo(`Removed ${fileCounter} file${fileCounter === 1 ? '' : 's'}`);
|
|
64
|
+
globalInfo(`Removed ${fileCounter} file${fileCounter === 1 ? '' : 's'} (${prettyBytes(totalSize)})`);
|
|
61
65
|
// 4. Clean up orphaned package index entries
|
|
62
66
|
let pkgCounter = 0;
|
|
63
67
|
const toDelete = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/store.controller",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1100.0.1",
|
|
4
4
|
"description": "A storage for packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -36,33 +36,34 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@zkochan/rimraf": "^4.0.0",
|
|
38
38
|
"is-subdir": "^2.0.0",
|
|
39
|
+
"pretty-bytes": "^7.1.0",
|
|
39
40
|
"ramda": "npm:@pnpm/ramda@0.28.1",
|
|
40
|
-
"ssri": "13.0.
|
|
41
|
-
"symlink-dir": "^
|
|
42
|
-
"@pnpm/
|
|
43
|
-
"@pnpm/
|
|
44
|
-
"@pnpm/
|
|
45
|
-
"@pnpm/
|
|
46
|
-
"@pnpm/
|
|
47
|
-
"@pnpm/store.cafs": "
|
|
48
|
-
"@pnpm/
|
|
49
|
-
"@pnpm/store.
|
|
50
|
-
"@pnpm/
|
|
51
|
-
"@pnpm/
|
|
52
|
-
"@pnpm/
|
|
41
|
+
"ssri": "13.0.1",
|
|
42
|
+
"symlink-dir": "^10.0.1",
|
|
43
|
+
"@pnpm/crypto.hash": "1100.0.0",
|
|
44
|
+
"@pnpm/installing.package-requester": "1100.0.1",
|
|
45
|
+
"@pnpm/error": "1100.0.0",
|
|
46
|
+
"@pnpm/resolving.resolver-base": "1100.0.1",
|
|
47
|
+
"@pnpm/hooks.types": "1100.0.1",
|
|
48
|
+
"@pnpm/store.cafs": "1100.0.1",
|
|
49
|
+
"@pnpm/fetching.fetcher-base": "1100.0.1",
|
|
50
|
+
"@pnpm/store.controller-types": "1100.0.1",
|
|
51
|
+
"@pnpm/types": "1101.0.0",
|
|
52
|
+
"@pnpm/store.index": "1100.0.0",
|
|
53
|
+
"@pnpm/store.create-cafs-store": "1100.0.1"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
55
56
|
"@pnpm/logger": ">=1001.0.0 <1002.0.0",
|
|
56
|
-
"@pnpm/worker": "^
|
|
57
|
+
"@pnpm/worker": "^1100.0.1"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@types/ramda": "0.
|
|
60
|
+
"@types/ramda": "0.31.1",
|
|
60
61
|
"@types/ssri": "^7.1.5",
|
|
61
62
|
"tempy": "3.0.0",
|
|
62
|
-
"@pnpm/installing.client": "
|
|
63
|
-
"@pnpm/logger": "
|
|
64
|
-
"@pnpm/
|
|
65
|
-
"@pnpm/
|
|
63
|
+
"@pnpm/installing.client": "1100.0.1",
|
|
64
|
+
"@pnpm/logger": "1100.0.0",
|
|
65
|
+
"@pnpm/prepare": "1100.0.1",
|
|
66
|
+
"@pnpm/store.controller": "1100.0.1"
|
|
66
67
|
},
|
|
67
68
|
"engines": {
|
|
68
69
|
"node": ">=22.13"
|
|
@@ -75,8 +76,8 @@
|
|
|
75
76
|
"fix": "tslint -c tslint.json src/**/*.ts test/**/*.ts --fix",
|
|
76
77
|
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
77
78
|
"pretest": "rimraf .tmp",
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
79
|
+
"test": "pn compile && pn .test",
|
|
80
|
+
"compile": "tsgo --build && pn lint --fix",
|
|
81
|
+
".test": "pn pretest && cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
|
|
81
82
|
}
|
|
82
83
|
}
|