@pnpm/fs.packlist 900.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/LICENSE +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +48 -18
- package/package.json +22 -20
- package/lib/index.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
|
|
4
|
-
Copyright (c) 2016-
|
|
4
|
+
Copyright (c) 2016-2026 Zoltan Kochan and other contributors
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,20 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import util from 'node:util';
|
|
4
|
+
import npmPacklist from 'npm-packlist';
|
|
5
|
+
export async function packlist(pkgDir, opts) {
|
|
6
|
+
const pkg = opts?.manifest ?? await readPackageJson(pkgDir);
|
|
7
|
+
const tree = {
|
|
8
|
+
path: pkgDir,
|
|
9
|
+
package: normalizePackage(pkg),
|
|
10
|
+
isProjectRoot: true,
|
|
11
|
+
edgesOut: new Map(),
|
|
12
|
+
};
|
|
13
|
+
const files = await npmPacklist(tree);
|
|
14
|
+
return files.map((file) => file.replace(/^\.[/\\]/, ''));
|
|
15
|
+
}
|
|
16
|
+
async function readPackageJson(dir) {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(await fs.readFile(path.join(dir, 'package.json'), 'utf8'));
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (util.types.isNativeError(err) && 'code' in err && err.code === 'ENOENT') {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
throw err;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function stripDotSlash(p) {
|
|
28
|
+
return p.replace(/^\.[/\\]/, '');
|
|
29
|
+
}
|
|
30
|
+
function normalizePackage(pkg) {
|
|
31
|
+
const normalized = { ...pkg };
|
|
32
|
+
if (typeof normalized.main === 'string') {
|
|
33
|
+
normalized.main = stripDotSlash(normalized.main);
|
|
34
|
+
}
|
|
35
|
+
if (typeof normalized.browser === 'string') {
|
|
36
|
+
normalized.browser = stripDotSlash(normalized.browser);
|
|
37
|
+
}
|
|
38
|
+
if (typeof normalized.bin === 'string') {
|
|
39
|
+
normalized.bin = stripDotSlash(normalized.bin);
|
|
40
|
+
}
|
|
41
|
+
else if (normalized.bin != null && typeof normalized.bin === 'object') {
|
|
42
|
+
const bin = {};
|
|
43
|
+
for (const [key, value] of Object.entries(normalized.bin)) {
|
|
44
|
+
bin[key] = stripDotSlash(value);
|
|
45
|
+
}
|
|
46
|
+
normalized.bin = bin;
|
|
47
|
+
}
|
|
48
|
+
return normalized;
|
|
19
49
|
}
|
|
20
50
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/fs.packlist",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1100.0.0",
|
|
4
4
|
"description": "Get a list of the files to add from a directory into an npm package",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"files": [
|
|
7
|
-
"lib",
|
|
8
|
-
"!*.map"
|
|
9
|
-
],
|
|
10
|
-
"types": "lib/index.d.ts",
|
|
11
|
-
"repository": "https://github.com/pnpm/pnpm/blob/main/fs/packlist",
|
|
12
5
|
"keywords": [
|
|
13
|
-
"
|
|
6
|
+
"pnpm",
|
|
7
|
+
"pnpm11"
|
|
14
8
|
],
|
|
15
|
-
"engines": {
|
|
16
|
-
"node": ">=18.12"
|
|
17
|
-
},
|
|
18
9
|
"license": "MIT",
|
|
10
|
+
"funding": "https://opencollective.com/pnpm",
|
|
11
|
+
"repository": "https://github.com/pnpm/pnpm/tree/main/fs/packlist",
|
|
12
|
+
"homepage": "https://github.com/pnpm/pnpm/tree/main/fs/packlist#readme",
|
|
19
13
|
"bugs": {
|
|
20
14
|
"url": "https://github.com/pnpm/pnpm/issues"
|
|
21
15
|
},
|
|
22
|
-
"
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "lib/index.js",
|
|
18
|
+
"types": "lib/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./lib/index.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"lib",
|
|
24
|
+
"!*.map"
|
|
25
|
+
],
|
|
23
26
|
"dependencies": {
|
|
24
|
-
"npm-packlist": "
|
|
27
|
+
"npm-packlist": "10.0.4"
|
|
25
28
|
},
|
|
26
|
-
"funding": "https://opencollective.com/pnpm",
|
|
27
29
|
"devDependencies": {
|
|
28
|
-
"@pnpm/fs.packlist": "
|
|
30
|
+
"@pnpm/fs.packlist": "1100.0.0"
|
|
29
31
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=22.13"
|
|
32
34
|
},
|
|
33
35
|
"jest": {
|
|
34
36
|
"preset": "@pnpm/jest-config"
|
|
35
37
|
},
|
|
36
38
|
"scripts": {
|
|
37
39
|
"lint": "eslint \"src/**/*.ts\"",
|
|
38
|
-
"compile": "
|
|
39
|
-
"test": "
|
|
40
|
+
"compile": "tsgo --build && pn lint --fix",
|
|
41
|
+
"test": "pn compile"
|
|
40
42
|
}
|
|
41
43
|
}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAEA,4BAaC;AAfD,gEAAsC;AAE/B,KAAK,UAAU,QAAQ,CAAE,MAAc,EAAE,IAE/C;IACC,MAAM,mBAAmB,GAAG,IAAI,EAAE,gBAAgB;QAChD,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAChD,CAAC,CAAC,SAAS,CAAA;IACb,MAAM,KAAK,GAAG,MAAM,IAAA,sBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAC,CAAA;IACxF,yDAAyD;IACzD,mCAAmC;IACnC,0DAA0D;IAC1D,+CAA+C;IAC/C,gDAAgD;IAChD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/E,CAAC"}
|