npm-pkgbuild 10.14.3 → 10.14.4
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 +69 -69
- package/package.json +2 -2
- package/src/extract-from-package.mjs +8 -6
- package/src/output/oci.mjs +26 -15
- package/src/util.mjs +0 -1
package/README.md
CHANGED
|
@@ -98,19 +98,8 @@ see [mf-hoting](https://www.npmjs.com/package/mf-hosting) module as an example.
|
|
|
98
98
|
* [NodeModulesContentProvider](#nodemodulescontentprovider)
|
|
99
99
|
* [Parameters](#parameters-2)
|
|
100
100
|
* [name](#name-2)
|
|
101
|
-
* [packageNameMapping](#packagenamemapping)
|
|
102
|
-
* [decodePassword](#decodepassword)
|
|
103
|
-
* [Parameters](#parameters-3)
|
|
104
|
-
* [extractFunctions](#extractfunctions)
|
|
105
|
-
* [Parameters](#parameters-4)
|
|
106
|
-
* [fieldProvider](#fieldprovider)
|
|
107
|
-
* [Parameters](#parameters-5)
|
|
108
|
-
* [Expander](#expander)
|
|
109
|
-
* [Parameters](#parameters-6)
|
|
110
|
-
* [copyEntries](#copyentries)
|
|
111
|
-
* [Parameters](#parameters-7)
|
|
112
101
|
* [NPMPackContentProvider](#npmpackcontentprovider)
|
|
113
|
-
* [Parameters](#parameters-
|
|
102
|
+
* [Parameters](#parameters-3)
|
|
114
103
|
* [name](#name-3)
|
|
115
104
|
* [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
|
|
116
105
|
* [fields](#fields)
|
|
@@ -121,11 +110,22 @@ see [mf-hoting](https://www.npmjs.com/package/mf-hosting) module as an example.
|
|
|
121
110
|
* [Field](#field)
|
|
122
111
|
* [Properties](#properties)
|
|
123
112
|
* [Packager](#packager)
|
|
124
|
-
* [Parameters](#parameters-
|
|
113
|
+
* [Parameters](#parameters-4)
|
|
125
114
|
* [tmpdir](#tmpdir)
|
|
126
115
|
* [execute](#execute)
|
|
127
|
-
* [Parameters](#parameters-
|
|
116
|
+
* [Parameters](#parameters-5)
|
|
128
117
|
* [available](#available)
|
|
118
|
+
* [packageNameMapping](#packagenamemapping)
|
|
119
|
+
* [decodePassword](#decodepassword)
|
|
120
|
+
* [Parameters](#parameters-6)
|
|
121
|
+
* [extractFunctions](#extractfunctions)
|
|
122
|
+
* [Parameters](#parameters-7)
|
|
123
|
+
* [fieldProvider](#fieldprovider)
|
|
124
|
+
* [Parameters](#parameters-8)
|
|
125
|
+
* [Expander](#expander)
|
|
126
|
+
* [Parameters](#parameters-9)
|
|
127
|
+
* [copyEntries](#copyentries)
|
|
128
|
+
* [Parameters](#parameters-10)
|
|
129
129
|
|
|
130
130
|
## ContentProvider
|
|
131
131
|
|
|
@@ -188,61 +188,6 @@ Content from node_modules
|
|
|
188
188
|
|
|
189
189
|
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
|
|
190
190
|
|
|
191
|
-
## packageNameMapping
|
|
192
|
-
|
|
193
|
-
What is the node name in the package eco-system
|
|
194
|
-
|
|
195
|
-
## decodePassword
|
|
196
|
-
|
|
197
|
-
Decode a password
|
|
198
|
-
|
|
199
|
-
### Parameters
|
|
200
|
-
|
|
201
|
-
* `password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
202
|
-
|
|
203
|
-
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** plaintext password
|
|
204
|
-
|
|
205
|
-
## extractFunctions
|
|
206
|
-
|
|
207
|
-
Extract shell functions from a given text.
|
|
208
|
-
|
|
209
|
-
### Parameters
|
|
210
|
-
|
|
211
|
-
* `source` **AsyncIterator<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**
|
|
212
|
-
|
|
213
|
-
Returns **AsyncIterator\<FunctionDecl>**
|
|
214
|
-
|
|
215
|
-
## fieldProvider
|
|
216
|
-
|
|
217
|
-
### Parameters
|
|
218
|
-
|
|
219
|
-
* `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
|
220
|
-
* `fields` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
|
221
|
-
|
|
222
|
-
Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
|
223
|
-
|
|
224
|
-
## Expander
|
|
225
|
-
|
|
226
|
-
Type: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)
|
|
227
|
-
|
|
228
|
-
### Parameters
|
|
229
|
-
|
|
230
|
-
* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
231
|
-
|
|
232
|
-
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
233
|
-
|
|
234
|
-
## copyEntries
|
|
235
|
-
|
|
236
|
-
Copy content from source into destinationDirectory.
|
|
237
|
-
Destination paths a generated without leading '/' (as for entry names too).
|
|
238
|
-
|
|
239
|
-
### Parameters
|
|
240
|
-
|
|
241
|
-
* `source` **AsyncIterator\<ContentEntry>**
|
|
242
|
-
* `destinationDirectory` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
243
|
-
* `expander` **[Expander](#expander)** (optional, default `v=>v`)
|
|
244
|
-
* `attributes` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<ContentEntryAttribute>**
|
|
245
|
-
|
|
246
191
|
## NPMPackContentProvider
|
|
247
192
|
|
|
248
193
|
**Extends ContentProvider**
|
|
@@ -323,6 +268,61 @@ Check for rpmbuild presence.
|
|
|
323
268
|
|
|
324
269
|
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true when rpmbuild is present
|
|
325
270
|
|
|
271
|
+
## packageNameMapping
|
|
272
|
+
|
|
273
|
+
What is the node name in the package eco-system
|
|
274
|
+
|
|
275
|
+
## decodePassword
|
|
276
|
+
|
|
277
|
+
Decode a password
|
|
278
|
+
|
|
279
|
+
### Parameters
|
|
280
|
+
|
|
281
|
+
* `password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
282
|
+
|
|
283
|
+
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** plaintext password
|
|
284
|
+
|
|
285
|
+
## extractFunctions
|
|
286
|
+
|
|
287
|
+
Extract shell functions from a given text.
|
|
288
|
+
|
|
289
|
+
### Parameters
|
|
290
|
+
|
|
291
|
+
* `source` **AsyncIterator<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**
|
|
292
|
+
|
|
293
|
+
Returns **AsyncIterator\<FunctionDecl>**
|
|
294
|
+
|
|
295
|
+
## fieldProvider
|
|
296
|
+
|
|
297
|
+
### Parameters
|
|
298
|
+
|
|
299
|
+
* `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
|
300
|
+
* `fields` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
|
301
|
+
|
|
302
|
+
Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
|
|
303
|
+
|
|
304
|
+
## Expander
|
|
305
|
+
|
|
306
|
+
Type: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)
|
|
307
|
+
|
|
308
|
+
### Parameters
|
|
309
|
+
|
|
310
|
+
* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
311
|
+
|
|
312
|
+
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
313
|
+
|
|
314
|
+
## copyEntries
|
|
315
|
+
|
|
316
|
+
Copy content from source into destinationDirectory.
|
|
317
|
+
Destination paths a generated without leading '/' (as for entry names too).
|
|
318
|
+
|
|
319
|
+
### Parameters
|
|
320
|
+
|
|
321
|
+
* `source` **AsyncIterator\<ContentEntry>**
|
|
322
|
+
* `destinationDirectory` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
323
|
+
* `expander` **[Expander](#expander)** (optional, default `v=>v`)
|
|
324
|
+
* `attributes` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<ContentEntryAttribute>**
|
|
325
|
+
|
|
326
326
|
# install
|
|
327
327
|
|
|
328
328
|
With [npm](http://npmjs.org) do:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "10.14.
|
|
3
|
+
"version": "10.14.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"commander": "^9.4.0",
|
|
47
47
|
"content-entry": "^5.1.1",
|
|
48
48
|
"content-entry-filesystem": "^5.2.1",
|
|
49
|
-
"content-entry-transform": "^1.4.
|
|
49
|
+
"content-entry-transform": "^1.4.12",
|
|
50
50
|
"execa": "^6.1.0",
|
|
51
51
|
"expression-expander": "^7.0.19",
|
|
52
52
|
"globby": "^13.1.2",
|
|
@@ -60,10 +60,8 @@ function extractFromRootPackage(json) {
|
|
|
60
60
|
properties.name = properties.name.replace(/^\@[^\/]+\//, "");
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
if (json.bugs) {
|
|
64
|
-
|
|
65
|
-
properties.bugs = json.bugs.url;
|
|
66
|
-
}
|
|
63
|
+
if (json.bugs?.url) {
|
|
64
|
+
properties.bugs = json.bugs.url;
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
properties.access = json.publishConfig
|
|
@@ -167,7 +165,7 @@ export async function* extractFromPackage(options = {}) {
|
|
|
167
165
|
if (pkgbuild) {
|
|
168
166
|
if (modulePath) {
|
|
169
167
|
if (!pkgbuild.abstract) {
|
|
170
|
-
if(pkgbuild.groups === groups) {
|
|
168
|
+
if (pkgbuild.groups === groups) {
|
|
171
169
|
dependencies[pkgbuild.name || json.name] = ">=" + json.version;
|
|
172
170
|
}
|
|
173
171
|
}
|
|
@@ -257,7 +255,11 @@ export async function* extractFromPackage(options = {}) {
|
|
|
257
255
|
}
|
|
258
256
|
}
|
|
259
257
|
if (numberOfArchs === 0) {
|
|
260
|
-
console.warn(
|
|
258
|
+
console.warn(
|
|
259
|
+
`No matching arch remaining, ${[...arch]} : ${[...arch]} : ${
|
|
260
|
+
process.arch
|
|
261
|
+
}`
|
|
262
|
+
);
|
|
261
263
|
}
|
|
262
264
|
} else {
|
|
263
265
|
// or one set if no arch is given
|
package/src/output/oci.mjs
CHANGED
|
@@ -78,12 +78,6 @@ export class OCI extends Packager {
|
|
|
78
78
|
"sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7"
|
|
79
79
|
},
|
|
80
80
|
layers: [
|
|
81
|
-
{
|
|
82
|
-
mediaType: MEDI_TYPE_IMAGE_LAYER,
|
|
83
|
-
size: 73109,
|
|
84
|
-
digest:
|
|
85
|
-
"sha256:ec4b8955958665577945c89419d1af06b5f7636b4ac3da7f12184802ad867736"
|
|
86
|
-
}
|
|
87
81
|
],
|
|
88
82
|
annotations: {
|
|
89
83
|
description: properties.description,
|
|
@@ -92,14 +86,11 @@ export class OCI extends Packager {
|
|
|
92
86
|
};
|
|
93
87
|
|
|
94
88
|
const out = createGzip();
|
|
95
|
-
const hash = createHash("sha256");
|
|
96
|
-
|
|
97
|
-
console.log(packageFile);
|
|
98
89
|
|
|
99
90
|
const header = new Uint8Array(512);
|
|
100
91
|
into(header, 257, 6, "ustar");
|
|
101
|
-
header[263] = 48; // 0;
|
|
102
|
-
header[264] = 48; // 0;
|
|
92
|
+
header[263] = 48; // '0';
|
|
93
|
+
header[264] = 48; // '0';
|
|
103
94
|
|
|
104
95
|
intoOctal(header, 108, 8, 0 /* root */);
|
|
105
96
|
intoOctal(header, 116, 8, 3 /* sys */);
|
|
@@ -107,19 +98,22 @@ export class OCI extends Packager {
|
|
|
107
98
|
into(header, 265, 32, "root");
|
|
108
99
|
into(header, 297, 32, "sys");
|
|
109
100
|
|
|
110
|
-
header[156] = 48; // 0
|
|
101
|
+
header[156] = 48; // '0'
|
|
111
102
|
|
|
112
103
|
for await (const entry of aggregateFifo(sources)) {
|
|
113
104
|
// const size = await entry.size;
|
|
114
105
|
const buffer = await entry.buffer;
|
|
115
106
|
const size = buffer.length;
|
|
116
107
|
|
|
117
|
-
into(header, 0,100, entry.name);
|
|
108
|
+
into(header, 0, 100, entry.name);
|
|
118
109
|
intoOctal(header, 100, 8, entry.mode);
|
|
119
110
|
intoOctal(header, 124, 12, size);
|
|
120
111
|
|
|
121
112
|
const mtime = await entry.mtime;
|
|
122
|
-
|
|
113
|
+
if (!mtime) {
|
|
114
|
+
console.warn("no mtime", entry.name);
|
|
115
|
+
}
|
|
116
|
+
intoOctal(header, 136, 12, mtime ? mtime.getTime() / 1000 : 0);
|
|
123
117
|
intoOctal(header, 148, 8, chksum(header));
|
|
124
118
|
|
|
125
119
|
out.write(header);
|
|
@@ -141,12 +135,29 @@ export class OCI extends Packager {
|
|
|
141
135
|
}
|
|
142
136
|
}
|
|
143
137
|
|
|
138
|
+
const hash = createHash("sha256");
|
|
139
|
+
let size = 0;
|
|
140
|
+
out.on("data", chunk => {
|
|
141
|
+
hash.update(chunk);
|
|
142
|
+
size += chunk.length;
|
|
143
|
+
});
|
|
144
|
+
|
|
144
145
|
const filler = new Uint8Array(1024 * 8);
|
|
145
146
|
out.end(filler);
|
|
146
147
|
|
|
147
148
|
await pipeline(out, createWriteStream(packageFile));
|
|
148
149
|
|
|
149
|
-
|
|
150
|
+
const layer = {
|
|
151
|
+
mediaType: MEDI_TYPE_IMAGE_LAYER,
|
|
152
|
+
size,
|
|
153
|
+
digest: "sha256:" + hash.digest("hex")
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
console.log(layer);
|
|
157
|
+
|
|
158
|
+
meta.layers.push(layer);
|
|
159
|
+
|
|
160
|
+
console.log(packageFile);
|
|
150
161
|
|
|
151
162
|
return packageFile;
|
|
152
163
|
}
|