npm-pkgbuild 18.1.3 → 18.2.2
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/package.json +13 -13
- package/src/content/file-content-provider.mjs +11 -16
- package/src/content/nft-content-provider.mjs +4 -5
- package/src/content/node-modules-content-provider.mjs +11 -14
- package/src/output/arch.mjs +6 -5
- package/src/output/debian.mjs +5 -4
- package/src/output/docker.mjs +6 -4
- package/src/output/oci.mjs +1 -1
- package/src/output/packager.mjs +2 -0
- package/src/output/rpm.mjs +6 -5
- package/src/util.mjs +5 -3
- package/types/content/node-modules-content-provider.d.mts +4 -1
- package/src/content/collection-entry-with-permissions.mjs +0 -18
- package/src/content/file-system-entry-with-permissions.mjs +0 -18
- package/types/content/collection-entry-with-permissions.d.mts +0 -7
- package/types/content/file-system-entry-with-permissions.d.mts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.2.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": false
|
|
@@ -51,20 +51,20 @@
|
|
|
51
51
|
"tsc:types": "tsc -d --allowJs --declarationDir dist --emitDeclarationOnly ./src/extract-from-package.mjs"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@npmcli/arborist": "^9.0
|
|
55
|
-
"@vercel/nft": "^0.29.
|
|
56
|
-
"aggregate-async-iterator": "^1.2.
|
|
57
|
-
"commander": "^
|
|
54
|
+
"@npmcli/arborist": "^9.1.0",
|
|
55
|
+
"@vercel/nft": "^0.29.3",
|
|
56
|
+
"aggregate-async-iterator": "^1.2.2",
|
|
57
|
+
"commander": "^14.0.0",
|
|
58
58
|
"compare-versions": "^6.1.1",
|
|
59
|
-
"content-entry": "^
|
|
60
|
-
"content-entry-filesystem": "^
|
|
61
|
-
"content-entry-transform": "^1.
|
|
62
|
-
"execa": "^9.5.
|
|
59
|
+
"content-entry": "^14.2.2",
|
|
60
|
+
"content-entry-filesystem": "^9.0.9",
|
|
61
|
+
"content-entry-transform": "^1.5.5",
|
|
62
|
+
"execa": "^9.5.3",
|
|
63
63
|
"expression-expander": "^7.2.7",
|
|
64
64
|
"ini": "^5.0.0",
|
|
65
65
|
"iterable-string-interceptor": "^3.0.2",
|
|
66
|
-
"key-value-transformer": "^3.
|
|
67
|
-
"npm-package-walker": "^8.0.
|
|
66
|
+
"key-value-transformer": "^3.3.0",
|
|
67
|
+
"npm-package-walker": "^8.0.9",
|
|
68
68
|
"npm-packlist": "^10.0.0",
|
|
69
69
|
"pacote": "^21.0.0",
|
|
70
70
|
"pkg-dir": "^8.0.0",
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"uti": "^8.7.4"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@types/node": "^22.15.
|
|
75
|
+
"@types/node": "^22.15.18",
|
|
76
76
|
"ava": "^6.3.0",
|
|
77
77
|
"c8": "^10.1.3",
|
|
78
78
|
"documentation": "^14.0.3",
|
|
79
|
-
"semantic-release": "^24.2.
|
|
79
|
+
"semantic-release": "^24.2.4",
|
|
80
80
|
"stream-buffers": "^3.0.3",
|
|
81
81
|
"typescript": "^5.8.3"
|
|
82
82
|
},
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { dirname, join, resolve } from "node:path";
|
|
2
2
|
import { cwd } from "node:process";
|
|
3
3
|
import { glob } from "node:fs/promises";
|
|
4
|
-
import { ContentEntry } from "content-entry";
|
|
5
|
-
import {
|
|
6
|
-
import { CollectionEntryWithPermissions } from "./collection-entry-with-permissions.mjs";
|
|
4
|
+
import { ContentEntry, CollectionEntry } from "content-entry";
|
|
5
|
+
import { FileSystemEntry } from "content-entry-filesystem";
|
|
7
6
|
import { asArray } from "../util.mjs";
|
|
8
7
|
import { ContentProvider } from "./content-provider.mjs";
|
|
9
8
|
|
|
@@ -64,34 +63,30 @@ export class FileContentProvider extends ContentProvider {
|
|
|
64
63
|
*/
|
|
65
64
|
async *[Symbol.asyncIterator]() {
|
|
66
65
|
const definitions = this.definitions;
|
|
67
|
-
const
|
|
68
|
-
const startPos =
|
|
66
|
+
const baseDir = definitions.base;
|
|
67
|
+
const startPos = baseDir.length + 1;
|
|
69
68
|
|
|
70
69
|
let count = 0;
|
|
71
70
|
for await (const entry of glob(definitions.pattern, {
|
|
72
|
-
cwd:
|
|
71
|
+
cwd: baseDir,
|
|
73
72
|
withFileTypes: true
|
|
74
73
|
})) {
|
|
75
74
|
const name = join(entry.parentPath, entry.name).substring(startPos);
|
|
76
75
|
|
|
77
76
|
if (entry.isFile()) {
|
|
78
|
-
yield new
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
);
|
|
77
|
+
yield new FileSystemEntry(name, {
|
|
78
|
+
...this.entryProperties,
|
|
79
|
+
baseDir
|
|
80
|
+
});
|
|
83
81
|
count++;
|
|
84
82
|
} else if (entry.isDirectory()) {
|
|
85
|
-
yield new
|
|
86
|
-
name,
|
|
87
|
-
this.directoryProperties
|
|
88
|
-
);
|
|
83
|
+
yield new CollectionEntry(name, this.directoryProperties);
|
|
89
84
|
count++;
|
|
90
85
|
}
|
|
91
86
|
}
|
|
92
87
|
|
|
93
88
|
if (!this.isPatternMatch && count < 1) {
|
|
94
|
-
const file = join(
|
|
89
|
+
const file = join(baseDir, this.definitions.pattern[0]);
|
|
95
90
|
const error = new Error(`File not found ${file}`);
|
|
96
91
|
error.file = file;
|
|
97
92
|
throw error;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { nodeFileTrace } from "@vercel/nft";
|
|
2
2
|
import { ContentEntry } from "content-entry";
|
|
3
|
-
import {
|
|
3
|
+
import { FileSystemEntry } from "content-entry-filesystem";
|
|
4
4
|
import { asArray } from "../util.mjs";
|
|
5
5
|
import { ContentProvider } from "./content-provider.mjs";
|
|
6
6
|
|
|
@@ -42,15 +42,14 @@ export class NFTContentProvider extends ContentProvider {
|
|
|
42
42
|
*/
|
|
43
43
|
async *[Symbol.asyncIterator]() {
|
|
44
44
|
const definitions = this.definitions;
|
|
45
|
-
const
|
|
45
|
+
const baseDir = definitions.base || process.cwd();
|
|
46
46
|
|
|
47
47
|
const { fileList } = await nodeFileTrace(definitions.start);
|
|
48
48
|
|
|
49
49
|
for (const name of fileList) {
|
|
50
|
-
yield new
|
|
50
|
+
yield new FileSystemEntry(
|
|
51
51
|
name,
|
|
52
|
-
|
|
53
|
-
this.entryProperties
|
|
52
|
+
{ ...this.entryProperties, baseDir }
|
|
54
53
|
);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
@@ -4,9 +4,8 @@ import { mkdtemp, readFile, writeFile } from "node:fs/promises";
|
|
|
4
4
|
import { glob } from "node:fs/promises";
|
|
5
5
|
import Arborist from "@npmcli/arborist";
|
|
6
6
|
import { parse } from "ini";
|
|
7
|
-
import { StringContentEntry } from "content-entry";
|
|
8
|
-
import {
|
|
9
|
-
import { CollectionEntryWithPermissions } from "./collection-entry-with-permissions.mjs";
|
|
7
|
+
import { StringContentEntry, CollectionEntry } from "content-entry";
|
|
8
|
+
import { FileSystemEntry } from "content-entry-filesystem";
|
|
10
9
|
import { ContentProvider } from "./content-provider.mjs";
|
|
11
10
|
import { utf8StreamOptions } from "../util.mjs";
|
|
12
11
|
import { shrinkNPM } from "../npm-shrink.mjs";
|
|
@@ -120,26 +119,24 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
120
119
|
);
|
|
121
120
|
|
|
122
121
|
if (json) {
|
|
123
|
-
yield
|
|
124
|
-
|
|
125
|
-
this.entryProperties
|
|
122
|
+
yield new StringContentEntry(
|
|
123
|
+
name,
|
|
124
|
+
this.entryProperties,
|
|
125
|
+
JSON.stringify(json)
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
continue;
|
|
130
128
|
} catch (e) {
|
|
131
129
|
console.error(e, entry.name);
|
|
132
130
|
}
|
|
133
131
|
}
|
|
134
132
|
|
|
135
133
|
if (entry.isFile()) {
|
|
136
|
-
yield new
|
|
137
|
-
|
|
138
|
-
nodeModulesDir
|
|
139
|
-
|
|
140
|
-
);
|
|
134
|
+
yield new FileSystemEntry(name, {
|
|
135
|
+
...this.entryProperties,
|
|
136
|
+
baseDir: nodeModulesDir
|
|
137
|
+
});
|
|
141
138
|
} else if (entry.isDirectory()) {
|
|
142
|
-
|
|
139
|
+
yield new CollectionEntry(name, this.directoryProperties);
|
|
143
140
|
}
|
|
144
141
|
}
|
|
145
142
|
}
|
package/src/output/arch.mjs
CHANGED
|
@@ -2,11 +2,12 @@ import { join } from "node:path";
|
|
|
2
2
|
import { createWriteStream } from "node:fs";
|
|
3
3
|
import { readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import { execa } from "execa";
|
|
5
|
-
import { ContentEntry,
|
|
5
|
+
import { ContentEntry, IteratorContentEntry } from "content-entry";
|
|
6
6
|
import { transform } from "content-entry-transform";
|
|
7
7
|
import {
|
|
8
8
|
keyValueTransformer,
|
|
9
|
-
equalSeparatedKeyValuePairOptions
|
|
9
|
+
equalSeparatedKeyValuePairOptions,
|
|
10
|
+
Uint8ArraysToLines
|
|
10
11
|
} from "key-value-transformer";
|
|
11
12
|
import { aggregateFifo } from "aggregate-async-iterator";
|
|
12
13
|
import {
|
|
@@ -145,7 +146,6 @@ export class ARCH extends Packager {
|
|
|
145
146
|
|
|
146
147
|
const self = this;
|
|
147
148
|
async function* trailingLines() {
|
|
148
|
-
console.log();
|
|
149
149
|
yield `
|
|
150
150
|
package() {
|
|
151
151
|
depends=(${self.makeDepends(properties.dependencies).join(" ")})
|
|
@@ -170,9 +170,10 @@ package() {
|
|
|
170
170
|
name: PKGBUILD,
|
|
171
171
|
match: entry => entry.name === PKGBUILD,
|
|
172
172
|
transform: async entry =>
|
|
173
|
-
new
|
|
173
|
+
new IteratorContentEntry(
|
|
174
174
|
"../" + entry.name,
|
|
175
|
-
|
|
175
|
+
undefined,
|
|
176
|
+
keyValueTransformer(Uint8ArraysToLines(await entry.stream), fp, {
|
|
176
177
|
...pkgKeyValuePairOptions,
|
|
177
178
|
trailingLines
|
|
178
179
|
})
|
package/src/output/debian.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { execa } from "execa";
|
|
4
|
-
import { ContentEntry,
|
|
4
|
+
import { ContentEntry, IteratorContentEntry } from "content-entry";
|
|
5
5
|
import {
|
|
6
6
|
transform,
|
|
7
7
|
createPropertiesTransformer
|
|
8
8
|
} from "content-entry-transform";
|
|
9
9
|
import { aggregateFifo } from "aggregate-async-iterator";
|
|
10
|
-
import { keyValueTransformer } from "key-value-transformer";
|
|
10
|
+
import { keyValueTransformer, Uint8ArraysToLines } from "key-value-transformer";
|
|
11
11
|
import {
|
|
12
12
|
Packager,
|
|
13
13
|
VERSION_FIELD,
|
|
@@ -102,9 +102,10 @@ export class DEBIAN extends Packager {
|
|
|
102
102
|
transformer.push({
|
|
103
103
|
match: entry => entry.name === debianControlName,
|
|
104
104
|
transform: async entry =>
|
|
105
|
-
new
|
|
105
|
+
new IteratorContentEntry(
|
|
106
106
|
entry.name,
|
|
107
|
-
|
|
107
|
+
undefined,
|
|
108
|
+
keyValueTransformer(Uint8ArraysToLines(await entry.readStream), fp)
|
|
108
109
|
),
|
|
109
110
|
createEntryWhenMissing: () => new ContentEntry(debianControlName)
|
|
110
111
|
});
|
package/src/output/docker.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { execa } from "execa";
|
|
4
|
-
import { ContentEntry,
|
|
4
|
+
import { ContentEntry, IteratorContentEntry } from "content-entry";
|
|
5
5
|
import { transform } from "content-entry-transform";
|
|
6
6
|
import { aggregateFifo } from "aggregate-async-iterator";
|
|
7
7
|
import {
|
|
8
8
|
keyValueTransformer,
|
|
9
|
-
equalSeparatedKeyValuePairOptions
|
|
9
|
+
equalSeparatedKeyValuePairOptions,
|
|
10
|
+
Uint8ArraysToLines
|
|
10
11
|
} from "key-value-transformer";
|
|
11
12
|
import {
|
|
12
13
|
Packager,
|
|
@@ -117,9 +118,10 @@ export class DOCKER extends Packager {
|
|
|
117
118
|
name: DOCKERFILE,
|
|
118
119
|
match: entry => entry.name === DOCKERFILE,
|
|
119
120
|
transform: async entry =>
|
|
120
|
-
new
|
|
121
|
+
new IteratorContentEntry(
|
|
121
122
|
entry.name,
|
|
122
|
-
|
|
123
|
+
undefined,
|
|
124
|
+
keyValueTransformer(Uint8ArraysToLines(await entry.stream), fp, {
|
|
123
125
|
...labelKeyValuePairs,
|
|
124
126
|
headLines,
|
|
125
127
|
trailingLines
|
package/src/output/oci.mjs
CHANGED
|
@@ -135,7 +135,7 @@ export class OCI extends Packager {
|
|
|
135
135
|
).replace(/^\//, "");
|
|
136
136
|
|
|
137
137
|
into(header, 0, 100, name);
|
|
138
|
-
intoOctal(header, 100, 8, entry.mode);
|
|
138
|
+
intoOctal(header, 100, 8, await entry.mode);
|
|
139
139
|
into(header, 124, 12, encodeOctal(size, 12));
|
|
140
140
|
into(header, 136, 12, encodeOctal((await entry.mtime).getTime() / 1000, 12));
|
|
141
141
|
// into(header, 148, 8, encodeOctal(chksum(header), 8));
|
package/src/output/packager.mjs
CHANGED
|
@@ -91,6 +91,7 @@ export class Packager {
|
|
|
91
91
|
if (name) {
|
|
92
92
|
yield new StringContentEntry(
|
|
93
93
|
name,
|
|
94
|
+
undefined,
|
|
94
95
|
f.body.replaceAll(
|
|
95
96
|
/\{\{(\w+)\}\}/gm,
|
|
96
97
|
(match, key, offset, string) =>
|
|
@@ -105,6 +106,7 @@ export class Packager {
|
|
|
105
106
|
for (const [name, content] of Object.entries(properties.hooks)) {
|
|
106
107
|
yield new StringContentEntry(
|
|
107
108
|
name,
|
|
109
|
+
undefined,
|
|
108
110
|
content.replaceAll(
|
|
109
111
|
/\{\{(\w+)\}\}/gm,
|
|
110
112
|
(match, key, offset, string) =>
|
package/src/output/rpm.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { createReadStream } from "node:fs";
|
|
3
2
|
import { readFile } from "node:fs/promises";
|
|
4
3
|
import { cp } from "node:fs/promises";
|
|
5
4
|
import { execa } from "execa";
|
|
6
|
-
import { ContentEntry,
|
|
5
|
+
import { ContentEntry, IteratorContentEntry } from "content-entry";
|
|
7
6
|
import { transform } from "content-entry-transform";
|
|
8
7
|
import {
|
|
9
8
|
keyValueTransformer,
|
|
10
|
-
colonSeparatedKeyValuePairOptionsDoublingKeys
|
|
9
|
+
colonSeparatedKeyValuePairOptionsDoublingKeys,
|
|
10
|
+
Uint8ArraysToLines
|
|
11
11
|
} from "key-value-transformer";
|
|
12
12
|
import { aggregateFifo } from "aggregate-async-iterator";
|
|
13
13
|
import {
|
|
@@ -160,9 +160,10 @@ export class RPM extends Packager {
|
|
|
160
160
|
{
|
|
161
161
|
match: entry => entry.name === specFileName,
|
|
162
162
|
transform: async entry =>
|
|
163
|
-
new
|
|
163
|
+
new IteratorContentEntry(
|
|
164
164
|
entry.name,
|
|
165
|
-
|
|
165
|
+
undefined,
|
|
166
|
+
keyValueTransformer(Uint8ArraysToLines(await entry.stream), fp, {
|
|
166
167
|
...colonSeparatedKeyValuePairOptionsDoublingKeys,
|
|
167
168
|
trailingLines
|
|
168
169
|
})
|
package/src/util.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { join, dirname } from "node:path";
|
|
2
2
|
import { mkdir } from "node:fs/promises";
|
|
3
3
|
import { pipeline } from "node:stream/promises";
|
|
4
|
+
import { Readable} from "node:stream";
|
|
5
|
+
|
|
4
6
|
import { createWriteStream } from "node:fs";
|
|
5
7
|
import { ContentEntry } from "content-entry";
|
|
6
8
|
|
|
@@ -223,15 +225,15 @@ export async function* copyEntries(
|
|
|
223
225
|
const destination = join(destinationDirectory, name);
|
|
224
226
|
|
|
225
227
|
if (entry.isCollection) {
|
|
226
|
-
await mkdir(destination, { recursive: true, mode: entry.mode });
|
|
228
|
+
await mkdir(destination, { recursive: true, mode: await entry.mode });
|
|
227
229
|
} else {
|
|
228
230
|
await mkdir(dirname(destination), { recursive: true });
|
|
229
231
|
|
|
230
232
|
await pipeline(
|
|
231
|
-
await entry.
|
|
233
|
+
Readable.fromWeb(await entry.stream),
|
|
232
234
|
createWriteStream(
|
|
233
235
|
destination,
|
|
234
|
-
entry.mode ? { mode: entry.mode } : undefined
|
|
236
|
+
entry.mode ? { mode: await entry.mode } : undefined
|
|
235
237
|
)
|
|
236
238
|
);
|
|
237
239
|
}
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
export class NodeModulesContentProvider extends ContentProvider {
|
|
7
7
|
static get description(): string;
|
|
8
8
|
withoutDevelpmentDependencies: boolean;
|
|
9
|
-
[Symbol.asyncIterator](): AsyncGenerator<
|
|
9
|
+
[Symbol.asyncIterator](): AsyncGenerator<CollectionEntry | StringContentEntry | FileSystemEntry, void, unknown>;
|
|
10
10
|
}
|
|
11
11
|
import { ContentProvider } from "./content-provider.mjs";
|
|
12
|
+
import { CollectionEntry } from "content-entry";
|
|
13
|
+
import { StringContentEntry } from "content-entry";
|
|
14
|
+
import { FileSystemEntry } from "content-entry-filesystem";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CollectionEntry } from "content-entry";
|
|
2
|
-
|
|
3
|
-
export class CollectionEntryWithPermissions extends CollectionEntry {
|
|
4
|
-
constructor(name, properties) {
|
|
5
|
-
super(name);
|
|
6
|
-
Object.assign(this, properties);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
#mode;
|
|
10
|
-
|
|
11
|
-
set mode(value) {
|
|
12
|
-
this.#mode = value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get mode() {
|
|
16
|
-
return this.#mode || super.mode;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FileSystemEntry } from "content-entry-filesystem";
|
|
2
|
-
|
|
3
|
-
export class FileSystemEntryWithPermissions extends FileSystemEntry {
|
|
4
|
-
constructor(name, baseDir, properties) {
|
|
5
|
-
super(name, baseDir);
|
|
6
|
-
Object.assign(this, properties);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
#mode;
|
|
10
|
-
|
|
11
|
-
set mode(value) {
|
|
12
|
-
this.#mode = value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get mode() {
|
|
16
|
-
return this.#mode || super.mode;
|
|
17
|
-
}
|
|
18
|
-
}
|