npm-pkgbuild 15.5.4 → 15.6.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/README.md +6 -0
- package/package.json +6 -6
- package/src/content/content-provider.mjs +8 -0
- package/src/content/node-modules-content-provider.mjs +15 -6
- package/src/npm-pkgbuild-cli.mjs +1 -1
- package/src/util.mjs +3 -1
- package/types/content/content-provider.d.mts +4 -0
- package/types/content/node-modules-content-provider.d.mts +2 -0
package/README.md
CHANGED
|
@@ -93,6 +93,7 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
|
|
|
93
93
|
* [ContentProvider](#contentprovider)
|
|
94
94
|
* [Parameters](#parameters)
|
|
95
95
|
* [Properties](#properties)
|
|
96
|
+
* [destinationPrefix](#destinationprefix)
|
|
96
97
|
* [asyncIterator](#asynciterator)
|
|
97
98
|
* [FileContentProvider](#filecontentprovider)
|
|
98
99
|
* [Parameters](#parameters-1)
|
|
@@ -189,6 +190,10 @@ Source of package content.
|
|
|
189
190
|
* `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
190
191
|
* `transformer` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Transformer>** 
|
|
191
192
|
|
|
193
|
+
### destinationPrefix
|
|
194
|
+
|
|
195
|
+
Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** 
|
|
196
|
+
|
|
192
197
|
### asyncIterator
|
|
193
198
|
|
|
194
199
|
List all entries.
|
|
@@ -313,6 +318,7 @@ Requires .npmrc or NPM\_TOKEN environment
|
|
|
313
318
|
### Properties
|
|
314
319
|
|
|
315
320
|
* `withoutDevelpmentDependencies` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
|
|
321
|
+
* `destinationPrefix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base name out output
|
|
316
322
|
|
|
317
323
|
### name
|
|
318
324
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.6.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"tsc:types": "tsc -d --allowJs --declarationDir dist --emitDeclarationOnly ./src/extract-from-package.mjs"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@npmcli/arborist": "^
|
|
54
|
+
"@npmcli/arborist": "^8.0.0",
|
|
55
55
|
"@vercel/nft": "^0.27.4",
|
|
56
56
|
"aggregate-async-iterator": "^1.2.1",
|
|
57
57
|
"commander": "^12.1.0",
|
|
@@ -65,19 +65,19 @@
|
|
|
65
65
|
"ini": "^5.0.0",
|
|
66
66
|
"iterable-string-interceptor": "^3.0.0",
|
|
67
67
|
"key-value-transformer": "^3.2.3",
|
|
68
|
-
"npm-package-walker": "^7.0.
|
|
68
|
+
"npm-package-walker": "^7.0.7",
|
|
69
69
|
"npm-packlist": "^9.0.0",
|
|
70
|
-
"pacote": "^
|
|
70
|
+
"pacote": "^19.0.0",
|
|
71
71
|
"pkg-dir": "^8.0.0",
|
|
72
72
|
"tar-stream": "^3.1.7",
|
|
73
73
|
"uti": "^8.7.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@types/node": "^22.7.
|
|
76
|
+
"@types/node": "^22.7.4",
|
|
77
77
|
"ava": "^6.1.3",
|
|
78
78
|
"c8": "^10.1.2",
|
|
79
79
|
"documentation": "^14.0.3",
|
|
80
|
-
"semantic-release": "^24.1.
|
|
80
|
+
"semantic-release": "^24.1.2",
|
|
81
81
|
"stream-buffers": "^3.0.3",
|
|
82
82
|
"typescript": "^5.6.2"
|
|
83
83
|
},
|
|
@@ -14,6 +14,7 @@ import { shrinkNPM } from "../npm-shrink.mjs";
|
|
|
14
14
|
* Content from node_modules.
|
|
15
15
|
* Requires .npmrc or NPM_TOKEN environment
|
|
16
16
|
* @property {boolean} withoutDevelpmentDependencies
|
|
17
|
+
* @property {string} destinationPrefix base name out output
|
|
17
18
|
*/
|
|
18
19
|
export class NodeModulesContentProvider extends ContentProvider {
|
|
19
20
|
/**
|
|
@@ -28,6 +29,7 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
withoutDevelpmentDependencies = true;
|
|
32
|
+
destinationPrefix = "node_modules";
|
|
31
33
|
|
|
32
34
|
constructor(definitions, entryProperties) {
|
|
33
35
|
super(definitions, entryProperties);
|
|
@@ -43,7 +45,7 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
43
45
|
let pkgSourceDir = this.dir;
|
|
44
46
|
|
|
45
47
|
if (this.withoutDevelpmentDependencies) {
|
|
46
|
-
pkgSourceDir = await mkdtemp(join(tmpdir(), "
|
|
48
|
+
pkgSourceDir = await mkdtemp(join(tmpdir(), "modules"));
|
|
47
49
|
|
|
48
50
|
const json = JSON.parse(
|
|
49
51
|
//@ts-ignore
|
|
@@ -90,8 +92,10 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
90
92
|
await arb.reify({ save: true });
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
const nodeModulesDir = join(pkgSourceDir, "node_modules");
|
|
96
|
+
|
|
97
|
+
for (const name of await globby("**/*", {
|
|
98
|
+
cwd: nodeModulesDir
|
|
95
99
|
})) {
|
|
96
100
|
if (!toBeSkipped.test(name)) {
|
|
97
101
|
if (name.endsWith("package.json")) {
|
|
@@ -99,7 +103,7 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
99
103
|
const json = shrinkNPM(
|
|
100
104
|
JSON.parse(
|
|
101
105
|
//@ts-ignore
|
|
102
|
-
await readFile(join(
|
|
106
|
+
await readFile(join(nodeModulesDir, name), utf8StreamOptions)
|
|
103
107
|
)
|
|
104
108
|
);
|
|
105
109
|
|
|
@@ -116,7 +120,7 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
yield Object.assign(
|
|
119
|
-
new FileSystemEntry(name,
|
|
123
|
+
new FileSystemEntry(name, nodeModulesDir),
|
|
120
124
|
this.entryProperties
|
|
121
125
|
);
|
|
122
126
|
}
|
|
@@ -251,14 +255,19 @@ const toBeSkipped = new RegExp(
|
|
|
251
255
|
"SECURITY\\.md",
|
|
252
256
|
"SFTPStream\\.md",
|
|
253
257
|
"LIMITS\\.md",
|
|
258
|
+
"[\\d\\-]+\\.md",
|
|
254
259
|
"DEPS",
|
|
255
260
|
"__tests__",
|
|
261
|
+
"\\.test\\.js",
|
|
262
|
+
"__snapshots__",
|
|
256
263
|
"Porting-Buffer\\.md",
|
|
257
264
|
"chains and topics\\.md",
|
|
258
265
|
"build_detect_platform",
|
|
266
|
+
"\\.snap",
|
|
259
267
|
"install_daemon_node.node",
|
|
260
268
|
"tsconfig.build.json",
|
|
261
|
-
"typedoc.json"
|
|
269
|
+
"typedoc.json",
|
|
270
|
+
"webpack.config.js"
|
|
262
271
|
].join("|") +
|
|
263
272
|
")$|(node_modules/(npm-pkgbuild|@types|node-addon-api|mf-hosting|node-gyp$)|(win32|android|darwin)-(ia32|x64|arm|arm64))",
|
|
264
273
|
"i"
|
package/src/npm-pkgbuild-cli.mjs
CHANGED
package/src/util.mjs
CHANGED
|
@@ -193,7 +193,9 @@ export async function* copyEntries(
|
|
|
193
193
|
|
|
194
194
|
// @ts-ignore
|
|
195
195
|
entry.destination = name;
|
|
196
|
-
const destination =
|
|
196
|
+
const destination = entry.destinationPrefix
|
|
197
|
+
? join(destinationDirectory, entry.destinationPrefix, name)
|
|
198
|
+
: join(destinationDirectory, name);
|
|
197
199
|
await mkdir(dirname(destination), { recursive: true });
|
|
198
200
|
|
|
199
201
|
const options = { mode: entry.mode };
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* Content from node_modules.
|
|
3
3
|
* Requires .npmrc or NPM_TOKEN environment
|
|
4
4
|
* @property {boolean} withoutDevelpmentDependencies
|
|
5
|
+
* @property {string} destinationPrefix base name out output
|
|
5
6
|
*/
|
|
6
7
|
export class NodeModulesContentProvider extends ContentProvider {
|
|
7
8
|
static get description(): string;
|
|
8
9
|
withoutDevelpmentDependencies: boolean;
|
|
10
|
+
destinationPrefix: string;
|
|
9
11
|
[Symbol.asyncIterator](): AsyncGenerator<any, void, unknown>;
|
|
10
12
|
}
|
|
11
13
|
import { ContentProvider } from "./content-provider.mjs";
|