npm-pkgbuild 20.4.2 → 20.5.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 CHANGED
@@ -98,47 +98,47 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
98
98
  * [Properties](#properties)
99
99
  * [extractFromPackage](#extractfrompackage)
100
100
  * [Parameters](#parameters-1)
101
- * [NPMPackContentProvider](#npmpackcontentprovider)
101
+ * [BUILDAH](#buildah)
102
+ * [ContentProvider](#contentprovider)
102
103
  * [Parameters](#parameters-2)
103
104
  * [Properties](#properties-1)
105
+ * [asyncIterator](#asynciterator)
106
+ * [FileContentProvider](#filecontentprovider)
107
+ * [Parameters](#parameters-3)
108
+ * [asyncIterator](#asynciterator-1)
104
109
  * [name](#name)
105
110
  * [NodeModulesContentProvider](#nodemodulescontentprovider)
106
- * [Parameters](#parameters-3)
111
+ * [Parameters](#parameters-4)
107
112
  * [Properties](#properties-2)
108
- * [asyncIterator](#asynciterator)
113
+ * [asyncIterator](#asynciterator-2)
109
114
  * [name](#name-1)
110
- * [FileContentProvider](#filecontentprovider)
111
- * [Parameters](#parameters-4)
112
- * [asyncIterator](#asynciterator-1)
115
+ * [NPMPackContentProvider](#npmpackcontentprovider)
116
+ * [Parameters](#parameters-5)
117
+ * [Properties](#properties-3)
113
118
  * [name](#name-2)
114
119
  * [NFTContentProvider](#nftcontentprovider)
115
- * [Parameters](#parameters-5)
116
- * [asyncIterator](#asynciterator-2)
117
- * [name](#name-3)
118
- * [ContentProvider](#contentprovider)
119
120
  * [Parameters](#parameters-6)
120
- * [Properties](#properties-3)
121
121
  * [asyncIterator](#asynciterator-3)
122
+ * [name](#name-3)
122
123
  * [DEBIAN](#debian)
123
124
  * [hookMapping](#hookmapping)
124
125
  * [attributes](#attributes)
125
126
  * [prepare](#prepare)
126
127
  * [Parameters](#parameters-7)
127
- * [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
128
- * [attributes](#attributes-1)
129
128
  * [quoteFile](#quotefile)
130
129
  * [Parameters](#parameters-8)
131
130
  * [RPM](#rpm)
132
131
  * [hookMapping](#hookmapping-1)
133
- * [attributes](#attributes-2)
132
+ * [attributes](#attributes-1)
134
133
  * [prepare](#prepare-1)
135
134
  * [Parameters](#parameters-9)
135
+ * [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
136
+ * [attributes](#attributes-2)
136
137
  * [OCI](#oci)
137
138
  * [DOCKER](#docker)
138
139
  * [attributes](#attributes-3)
139
140
  * [prepare](#prepare-2)
140
141
  * [Parameters](#parameters-10)
141
- * [BUILDAH](#buildah)
142
142
  * [Packager](#packager)
143
143
  * [Parameters](#parameters-11)
144
144
  * [packageName](#packagename)
@@ -256,22 +256,48 @@ Extract package definition from package.json.
256
256
 
257
257
  Returns **AsyncIterable<[PackageDefinition](#packagedefinition)>**&#x20;
258
258
 
259
- ## NPMPackContentProvider
259
+ ## BUILDAH
260
260
 
261
- **Extends ContentProvider**
261
+ **Extends DOCKER**
262
262
 
263
- Content from npm pack.
263
+ Use buildah @see <https://buildah.io>
264
+
265
+ ## ContentProvider
266
+
267
+ Source of package content.
264
268
 
265
269
  ### Parameters
266
270
 
267
271
  * `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
268
- * `entryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** to be set for each entry
269
- * `directoryProperties` &#x20;
272
+ * `entryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
273
+ * `directoryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
270
274
 
271
275
  ### Properties
272
276
 
273
277
  * `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
274
278
 
279
+ ### asyncIterator
280
+
281
+ List all entries.
282
+
283
+ Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
284
+
285
+ ## FileContentProvider
286
+
287
+ **Extends ContentProvider**
288
+
289
+ Content provided form the file system.
290
+
291
+ ### Parameters
292
+
293
+ * `definitions` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))**&#x20;
294
+ * `entryProperties` &#x20;
295
+ * `directoryProperties` &#x20;
296
+
297
+ ### asyncIterator
298
+
299
+ Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
300
+
275
301
  ### name
276
302
 
277
303
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
@@ -303,21 +329,21 @@ Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
303
329
 
304
330
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
305
331
 
306
- ## FileContentProvider
332
+ ## NPMPackContentProvider
307
333
 
308
334
  **Extends ContentProvider**
309
335
 
310
- Content provided form the file system.
336
+ Content from npm pack.
311
337
 
312
338
  ### Parameters
313
339
 
314
- * `definitions` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))**&#x20;
315
- * `entryProperties` &#x20;
340
+ * `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
341
+ * `entryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** to be set for each entry
316
342
  * `directoryProperties` &#x20;
317
343
 
318
- ### asyncIterator
344
+ ### Properties
319
345
 
320
- Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
346
+ * `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
321
347
 
322
348
  ### name
323
349
 
@@ -343,26 +369,6 @@ Returns **AsyncIterable\<ContentEntry>** all entries
343
369
 
344
370
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
345
371
 
346
- ## ContentProvider
347
-
348
- Source of package content.
349
-
350
- ### Parameters
351
-
352
- * `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
353
- * `entryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
354
- * `directoryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20;
355
-
356
- ### Properties
357
-
358
- * `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
359
-
360
- ### asyncIterator
361
-
362
- List all entries.
363
-
364
- Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
365
-
366
372
  ## DEBIAN
367
373
 
368
374
  **Extends Packager**
@@ -389,15 +395,6 @@ Map install hook named from default (arch) to deb.
389
395
 
390
396
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>**&#x20;
391
397
 
392
- ## pkgKeyValuePairOptions
393
-
394
- Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
395
-
396
- ## attributes
397
-
398
- well known package properties
399
- <https://www.archlinux.org/pacman/PKGBUILD.5.html>
400
-
401
398
  ## quoteFile
402
399
 
403
400
  ### Parameters
@@ -431,6 +428,15 @@ Check for rpmbuild presence.
431
428
 
432
429
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** true when rpmbuild executable is present
433
430
 
431
+ ## pkgKeyValuePairOptions
432
+
433
+ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
434
+
435
+ ## attributes
436
+
437
+ well known package properties
438
+ <https://www.archlinux.org/pacman/PKGBUILD.5.html>
439
+
434
440
  ## OCI
435
441
 
436
442
  **Extends Packager**
@@ -460,12 +466,6 @@ Check for docker presence.
460
466
 
461
467
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** true when docker executable is present
462
468
 
463
- ## BUILDAH
464
-
465
- **Extends DOCKER**
466
-
467
- Use buildah @see <https://buildah.io>
468
-
469
469
  ## Packager
470
470
 
471
471
  ### Parameters
@@ -486,7 +486,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
486
486
 
487
487
  Generate hook content entries
488
488
 
489
- Returns **AsyncIterable\<ContentEntry>**&#x20;
489
+ Returns **AsyncIterable\<StringContentEntry>**&#x20;
490
490
 
491
491
  ### dependencyExpression
492
492
 
@@ -569,7 +569,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
569
569
 
570
570
  Generate hook content entries
571
571
 
572
- Returns **AsyncIterable\<ContentEntry>**&#x20;
572
+ Returns **AsyncIterable\<StringContentEntry>**&#x20;
573
573
 
574
574
  ### dependencyExpression
575
575
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "20.4.2",
3
+ "version": "20.5.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": false
@@ -59,7 +59,7 @@
59
59
  "compare-versions": "^6.1.1",
60
60
  "content-entry": "^14.2.7",
61
61
  "content-entry-filesystem": "^9.0.14",
62
- "content-entry-transform": "^1.6.3",
62
+ "content-entry-transform": "^1.6.4",
63
63
  "execa": "^9.6.0",
64
64
  "ini": "^6.0.0",
65
65
  "iterable-string-interceptor": "^3.0.6",
@@ -68,12 +68,12 @@
68
68
  "npm-packlist": "^10.0.3",
69
69
  "pacc": "^8.7.0",
70
70
  "package-directory": "^8.2.0",
71
- "pacote": "^21.1.0",
71
+ "pacote": "^21.2.0",
72
72
  "tar-stream": "^3.1.7",
73
- "uti": "^8.10.5"
73
+ "uti": "^8.10.6"
74
74
  },
75
75
  "devDependencies": {
76
- "@types/node": "^25.2.0",
76
+ "@types/node": "^25.2.1",
77
77
  "ava": "^6.4.1",
78
78
  "c8": "^10.1.3",
79
79
  "documentation": "^14.0.3",
@@ -18,8 +18,8 @@ import pkg from "../package.json" with { type: "json" };
18
18
  program.description(pkg.description).version(pkg.version);
19
19
 
20
20
  allOutputs.forEach(o => {
21
- for(const name of [o.name,o.alias]) {
22
- if(name) {
21
+ for (const name of [o.name, o.alias]) {
22
+ if (name) {
23
23
  program.option(`--${name}`, o.description);
24
24
  program.option(`--no-${name}`, `do not ${o.description} output`);
25
25
  }
@@ -33,7 +33,7 @@ allInputs.forEach(i => {
33
33
  program
34
34
  .option("--verbose", "be more verbose", false)
35
35
  .option("--dry", "do not execute, only print definitions", false)
36
- .option("--staging <dir>","directory where to start packaging process")
36
+ .option("--staging <dir>", "directory where to start packaging process")
37
37
  .option("-D --define <a=b>", "define property", (str, former = {}) =>
38
38
  Object.assign(former, Object.fromEntries([str.split(/=/)]))
39
39
  )
@@ -61,7 +61,7 @@ program
61
61
  properties,
62
62
  sources,
63
63
  output,
64
- variant,
64
+ variant
65
65
  } of extractFromPackage(options, process.env)) {
66
66
  for (const inputFactory of allInputs.filter(
67
67
  inputFactory => options[inputFactory.name] === true
@@ -111,35 +111,50 @@ program
111
111
 
112
112
  const o = new outputFactory(expand(properties, context));
113
113
  const transformer = [
114
- { name: "skip-bare-modules",
115
- match: entry => entry.isBlob && uc.fileNameConformsTo(entry.name, "public.bare-dynamic-link-library"),
114
+ {
115
+ name: "skip-bare-modules",
116
+ match: entry =>
117
+ entry.isBlob &&
118
+ uc.fileNameConformsTo(
119
+ entry.name,
120
+ "public.bare-dynamic-link-library"
121
+ ),
116
122
  async transform(entry) {}
117
123
  },
118
124
  {
119
- name: "skip-architecutes",
120
- match: (entry) => entry.name.endsWith(".node") && entry.filename,
121
- async transform(entry) {
122
- const proc = await execa("file", ["-b", entry.filename], {
123
- cwd: options.dir
124
- });
125
- const parts = proc.stdout.split(/\s*,\s*/);
126
-
127
- if(parts.length < 4 || (parts.length > 4 && !parts[4].match(/Android/i))) {
128
- let arch = parts[1];
129
-
130
- const archs = { "ARM aarch64" : "aarch64" };
131
- arch = archs[arch] || arch;
132
-
133
- if(properties.arch.indexOf(arch) >= 0) {
134
- return entry;
125
+ name: "skip-architectures",
126
+ match: entry => entry.name.endsWith(".node") && entry.filename,
127
+ async transform(entry) {
128
+ if (properties.arch) {
129
+ const proc = await execa("file", ["-b", entry.filename], {
130
+ cwd: options.dir
131
+ });
132
+ const parts = proc.stdout.split(/\s*,\s*/);
133
+
134
+ if (
135
+ parts.length < 4 ||
136
+ (parts.length > 4 && !parts[4].match(/Android/i))
137
+ ) {
138
+ let arch = parts[1];
139
+
140
+ const archs = { "ARM aarch64": "aarch64" };
141
+ arch = archs[arch] || arch;
142
+
143
+ if (properties.arch.indexOf(arch) >= 0) {
144
+ return entry;
145
+ }
135
146
  }
136
147
  }
137
-
148
+
138
149
  //console.log("skip", entry.filename);
139
150
  }
140
151
  },
141
152
  createExpressionTransformer(
142
- entry => entry.isBlob && uc.fileNameConformsTo(entry.name, "public.text") && !uc.fileNameConformsTo(entry.name, "com.netscape.javascript-source"),
153
+ entry =>
154
+ entry.isBlob &&
155
+ uc.fileNameConformsTo(entry.name, "public.text") &&
156
+ (!uc.fileNameConformsTo(entry.name, "public.source-code") ||
157
+ uc.fileNameConformsTo(entry.name, "public.configuration")),
143
158
  properties
144
159
  )
145
160
  ];
@@ -156,7 +171,10 @@ program
156
171
  console.log(" " + sources.join("\n "));
157
172
  console.log("dependencies:");
158
173
  console.log(kv(properties.dependencies, " "));
159
- console.log("publish:", publishingDetails.map(pd=>pd.url));
174
+ console.log(
175
+ "publish:",
176
+ publishingDetails.map(pd => pd.url)
177
+ );
160
178
  }
161
179
 
162
180
  const artifact = await o.create(
@@ -164,7 +182,7 @@ program
164
182
  transformer,
165
183
  publishingDetails,
166
184
  options,
167
- (object) => expand(object, context)
185
+ object => expand(object, context)
168
186
  );
169
187
 
170
188
  if (!options.dry) {
@@ -255,7 +255,7 @@ package() {
255
255
  ownership
256
256
  .map(
257
257
  f =>
258
- ` chown ${[f.owner || "", f.group || ""].join(
258
+ ` chown ${[f.owner ?? "", f.group ?? ""].join(
259
259
  ":"
260
260
  )} \"$pkgdir/${f.destination}\"`
261
261
  )