npm-pkgbuild 20.0.0 → 20.1.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 +63 -70
- package/package.json +4 -4
- package/src/extract-from-package.mjs +127 -116
- package/src/output/arch.mjs +10 -8
- package/src/output/debian.mjs +18 -11
- package/src/output/packager.mjs +46 -2
- package/src/util.mjs +19 -16
- package/types/extract-from-package.d.mts +5 -1
- package/types/output/arch.d.mts +191 -7
- package/types/output/debian.d.mts +272 -10
- package/types/output/docker.d.mts +1 -0
- package/types/output/packager.d.mts +42 -2
- package/types/output/rpm.d.mts +1 -0
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
|
-
* [
|
|
102
|
-
* [ContentProvider](#contentprovider)
|
|
101
|
+
* [NPMPackContentProvider](#npmpackcontentprovider)
|
|
103
102
|
* [Parameters](#parameters-2)
|
|
104
103
|
* [Properties](#properties-1)
|
|
105
|
-
* [asyncIterator](#asynciterator)
|
|
106
|
-
* [FileContentProvider](#filecontentprovider)
|
|
107
|
-
* [Parameters](#parameters-3)
|
|
108
|
-
* [asyncIterator](#asynciterator-1)
|
|
109
104
|
* [name](#name)
|
|
110
105
|
* [NodeModulesContentProvider](#nodemodulescontentprovider)
|
|
111
|
-
* [Parameters](#parameters-
|
|
106
|
+
* [Parameters](#parameters-3)
|
|
112
107
|
* [Properties](#properties-2)
|
|
113
|
-
* [asyncIterator](#asynciterator
|
|
108
|
+
* [asyncIterator](#asynciterator)
|
|
114
109
|
* [name](#name-1)
|
|
115
|
-
* [
|
|
116
|
-
* [Parameters](#parameters-
|
|
117
|
-
* [
|
|
110
|
+
* [FileContentProvider](#filecontentprovider)
|
|
111
|
+
* [Parameters](#parameters-4)
|
|
112
|
+
* [asyncIterator](#asynciterator-1)
|
|
118
113
|
* [name](#name-2)
|
|
119
114
|
* [NFTContentProvider](#nftcontentprovider)
|
|
115
|
+
* [Parameters](#parameters-5)
|
|
116
|
+
* [asyncIterator](#asynciterator-2)
|
|
117
|
+
* [name](#name-3)
|
|
118
|
+
* [ContentProvider](#contentprovider)
|
|
120
119
|
* [Parameters](#parameters-6)
|
|
120
|
+
* [Properties](#properties-3)
|
|
121
121
|
* [asyncIterator](#asynciterator-3)
|
|
122
|
-
* [name](#name-3)
|
|
123
122
|
* [DEBIAN](#debian)
|
|
124
123
|
* [hookMapping](#hookmapping)
|
|
125
124
|
* [attributes](#attributes)
|
|
126
125
|
* [prepare](#prepare)
|
|
127
126
|
* [Parameters](#parameters-7)
|
|
127
|
+
* [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
|
|
128
|
+
* [attributes](#attributes-1)
|
|
128
129
|
* [quoteFile](#quotefile)
|
|
129
130
|
* [Parameters](#parameters-8)
|
|
130
131
|
* [RPM](#rpm)
|
|
131
132
|
* [hookMapping](#hookmapping-1)
|
|
132
|
-
* [attributes](#attributes-
|
|
133
|
+
* [attributes](#attributes-2)
|
|
133
134
|
* [prepare](#prepare-1)
|
|
134
135
|
* [Parameters](#parameters-9)
|
|
135
|
-
* [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
|
|
136
|
-
* [attributes](#attributes-2)
|
|
137
136
|
* [OCI](#oci)
|
|
138
137
|
* [DOCKER](#docker)
|
|
139
138
|
* [attributes](#attributes-3)
|
|
140
139
|
* [prepare](#prepare-2)
|
|
141
140
|
* [Parameters](#parameters-10)
|
|
141
|
+
* [BUILDAH](#buildah)
|
|
142
142
|
* [Packager](#packager)
|
|
143
143
|
* [Parameters](#parameters-11)
|
|
144
144
|
* [packageName](#packagename)
|
|
@@ -248,51 +248,21 @@ Extract package definition from package.json.
|
|
|
248
248
|
|
|
249
249
|
Returns **AsyncIterable<[PackageDefinition](#packagedefinition)>** 
|
|
250
250
|
|
|
251
|
-
##
|
|
252
|
-
|
|
253
|
-
**Extends DOCKER**
|
|
254
|
-
|
|
255
|
-
Use buildah @see <https://buildah.io>
|
|
251
|
+
## NPMPackContentProvider
|
|
256
252
|
|
|
257
|
-
|
|
253
|
+
**Extends ContentProvider**
|
|
258
254
|
|
|
259
|
-
|
|
255
|
+
Content from npm pack.
|
|
260
256
|
|
|
261
257
|
### Parameters
|
|
262
258
|
|
|
263
|
-
* `definitions`
|
|
264
|
-
* `entryProperties`
|
|
259
|
+
* `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
260
|
+
* `entryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** to be set for each entry
|
|
265
261
|
* `directoryProperties`  
|
|
266
262
|
|
|
267
263
|
### Properties
|
|
268
264
|
|
|
269
265
|
* `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
270
|
-
* `transformer` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Transformer>** 
|
|
271
|
-
|
|
272
|
-
### asyncIterator
|
|
273
|
-
|
|
274
|
-
List all entries.
|
|
275
|
-
|
|
276
|
-
Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
|
|
277
|
-
|
|
278
|
-
## FileContentProvider
|
|
279
|
-
|
|
280
|
-
**Extends ContentProvider**
|
|
281
|
-
|
|
282
|
-
Content provided form the file system.
|
|
283
|
-
|
|
284
|
-
### Parameters
|
|
285
|
-
|
|
286
|
-
* `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))** 
|
|
287
|
-
|
|
288
|
-
* `definitions.pattern` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>)** 
|
|
289
|
-
* `definitions.base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base directory where to find the files
|
|
290
|
-
* `entryProperties`  
|
|
291
|
-
* `directoryProperties`  
|
|
292
|
-
|
|
293
|
-
### asyncIterator
|
|
294
|
-
|
|
295
|
-
Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
|
|
296
266
|
|
|
297
267
|
### name
|
|
298
268
|
|
|
@@ -325,21 +295,21 @@ Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
|
|
|
325
295
|
|
|
326
296
|
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
|
|
327
297
|
|
|
328
|
-
##
|
|
298
|
+
## FileContentProvider
|
|
329
299
|
|
|
330
300
|
**Extends ContentProvider**
|
|
331
301
|
|
|
332
|
-
Content
|
|
302
|
+
Content provided form the file system.
|
|
333
303
|
|
|
334
304
|
### Parameters
|
|
335
305
|
|
|
336
|
-
* `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
337
|
-
* `entryProperties`
|
|
306
|
+
* `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))** 
|
|
307
|
+
* `entryProperties`  
|
|
338
308
|
* `directoryProperties`  
|
|
339
309
|
|
|
340
|
-
###
|
|
310
|
+
### asyncIterator
|
|
341
311
|
|
|
342
|
-
|
|
312
|
+
Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
|
|
343
313
|
|
|
344
314
|
### name
|
|
345
315
|
|
|
@@ -354,11 +324,8 @@ Content provided form the file system.
|
|
|
354
324
|
### Parameters
|
|
355
325
|
|
|
356
326
|
* `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))** 
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
* `definitions.base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base directory where to find the files
|
|
360
|
-
* `entryProperties`  
|
|
361
|
-
* `directoryProperties`  
|
|
327
|
+
* `entryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
328
|
+
* `directoryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
362
329
|
|
|
363
330
|
### asyncIterator
|
|
364
331
|
|
|
@@ -368,6 +335,26 @@ Returns **AsyncIterable\<ContentEntry>** all entries
|
|
|
368
335
|
|
|
369
336
|
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
|
|
370
337
|
|
|
338
|
+
## ContentProvider
|
|
339
|
+
|
|
340
|
+
Source of package content.
|
|
341
|
+
|
|
342
|
+
### Parameters
|
|
343
|
+
|
|
344
|
+
* `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
345
|
+
* `entryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
346
|
+
* `directoryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
347
|
+
|
|
348
|
+
### Properties
|
|
349
|
+
|
|
350
|
+
* `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
351
|
+
|
|
352
|
+
### asyncIterator
|
|
353
|
+
|
|
354
|
+
List all entries.
|
|
355
|
+
|
|
356
|
+
Returns **AsyncIterable<(ContentEntry | CollectionEntry)>** all entries
|
|
357
|
+
|
|
371
358
|
## DEBIAN
|
|
372
359
|
|
|
373
360
|
**Extends Packager**
|
|
@@ -394,6 +381,15 @@ Map install hook named from default (arch) to deb.
|
|
|
394
381
|
|
|
395
382
|
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)>** 
|
|
396
383
|
|
|
384
|
+
## pkgKeyValuePairOptions
|
|
385
|
+
|
|
386
|
+
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
387
|
+
|
|
388
|
+
## attributes
|
|
389
|
+
|
|
390
|
+
well known package properties
|
|
391
|
+
<https://www.archlinux.org/pacman/PKGBUILD.5.html>
|
|
392
|
+
|
|
397
393
|
## quoteFile
|
|
398
394
|
|
|
399
395
|
### Parameters
|
|
@@ -427,15 +423,6 @@ Check for rpmbuild presence.
|
|
|
427
423
|
|
|
428
424
|
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
|
|
429
425
|
|
|
430
|
-
## pkgKeyValuePairOptions
|
|
431
|
-
|
|
432
|
-
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
433
|
-
|
|
434
|
-
## attributes
|
|
435
|
-
|
|
436
|
-
well known package properties
|
|
437
|
-
<https://www.archlinux.org/pacman/PKGBUILD.5.html>
|
|
438
|
-
|
|
439
426
|
## OCI
|
|
440
427
|
|
|
441
428
|
**Extends Packager**
|
|
@@ -465,6 +452,12 @@ Check for docker presence.
|
|
|
465
452
|
|
|
466
453
|
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
|
|
467
454
|
|
|
455
|
+
## BUILDAH
|
|
456
|
+
|
|
457
|
+
**Extends DOCKER**
|
|
458
|
+
|
|
459
|
+
Use buildah @see <https://buildah.io>
|
|
460
|
+
|
|
468
461
|
## Packager
|
|
469
462
|
|
|
470
463
|
### Parameters
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.1.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.
|
|
62
|
+
"content-entry-transform": "^1.6.0",
|
|
63
63
|
"execa": "^9.6.0",
|
|
64
64
|
"expression-expander": "^7.2.8",
|
|
65
65
|
"ini": "^6.0.0",
|
|
@@ -67,14 +67,14 @@
|
|
|
67
67
|
"key-value-transformer": "^3.3.1",
|
|
68
68
|
"npm-package-walker": "^8.0.11",
|
|
69
69
|
"npm-packlist": "^10.0.3",
|
|
70
|
-
"pacc": "^8.0.
|
|
70
|
+
"pacc": "^8.0.3",
|
|
71
71
|
"package-directory": "^8.1.0",
|
|
72
72
|
"pacote": "^21.0.4",
|
|
73
73
|
"tar-stream": "^3.1.7",
|
|
74
74
|
"uti": "^8.10.3"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@types/node": "^25.0.
|
|
77
|
+
"@types/node": "^25.0.9",
|
|
78
78
|
"ava": "^6.4.1",
|
|
79
79
|
"c8": "^10.1.3",
|
|
80
80
|
"documentation": "^14.0.3",
|
|
@@ -90,9 +90,7 @@ function* content2Sources(content, dir) {
|
|
|
90
90
|
} else {
|
|
91
91
|
switch (typeof definition) {
|
|
92
92
|
case "object":
|
|
93
|
-
definition.dir = definition.dir
|
|
94
|
-
? join(dir, definition.dir)
|
|
95
|
-
: dir;
|
|
93
|
+
definition.dir = definition.dir ? join(dir, definition.dir) : dir;
|
|
96
94
|
break;
|
|
97
95
|
case "string":
|
|
98
96
|
definition = join(dir, definition);
|
|
@@ -110,6 +108,7 @@ function* content2Sources(content, dir) {
|
|
|
110
108
|
* @typedef {Object} PackageDefinition
|
|
111
109
|
* @property {Object} properties values describing the package attributes
|
|
112
110
|
* @property {Object} properties.dependencies
|
|
111
|
+
* @property {Object} properties.replaces
|
|
113
112
|
* @property {ContentProvider[]} sources content providers
|
|
114
113
|
* @property {Object} output package type
|
|
115
114
|
* @property {Object} variant identifier of the variant
|
|
@@ -136,159 +135,166 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
136
135
|
|
|
137
136
|
const packages = new Map();
|
|
138
137
|
|
|
139
|
-
await packageWalker(
|
|
140
|
-
|
|
138
|
+
await packageWalker(
|
|
139
|
+
async (packageContent, dir, modulePath) => {
|
|
140
|
+
let i = 0;
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
packages.set(packageContent.name, packageContent.version);
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
for (const pkgbuild of asArray(packageContent.pkgbuild)) {
|
|
145
|
+
if (modulePath.length > 0 && !pkgbuild.variant) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
let name = `${packageContent.name}[${i++}]`;
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
const fragment = {
|
|
152
|
+
dir,
|
|
153
|
+
name,
|
|
154
|
+
priority: 1,
|
|
155
|
+
dependencies: packageContent.engines || {},
|
|
156
|
+
replaces: {},
|
|
157
|
+
arch: new Set(),
|
|
158
|
+
restrictArch: new Set()
|
|
159
|
+
};
|
|
159
160
|
|
|
160
|
-
|
|
161
|
+
const requires = pkgbuild.requires;
|
|
161
162
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
if (requires) {
|
|
164
|
+
fragment.requires = requires;
|
|
165
|
+
delete pkgbuild.requires;
|
|
165
166
|
|
|
166
|
-
|
|
167
|
+
let fullfilled = true;
|
|
167
168
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
if (requires.properties) {
|
|
170
|
+
for (const [k, v] of Object.entries(requires.properties)) {
|
|
171
|
+
if (root?.properties[k] !== v && options[k] !== v) {
|
|
172
|
+
fullfilled = false;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
174
175
|
|
|
175
|
-
|
|
176
|
+
fragment.priority += 1;
|
|
177
|
+
}
|
|
176
178
|
}
|
|
177
|
-
}
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
if (requires.environment) {
|
|
181
|
+
if (env[requires.environment.has] === undefined) {
|
|
182
|
+
fullfilled = false;
|
|
183
|
+
}
|
|
184
|
+
fragment.priority += 10;
|
|
182
185
|
}
|
|
183
|
-
fragment.priority += 10;
|
|
184
|
-
}
|
|
185
186
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
if (fullfilled) {
|
|
188
|
+
if (options.verbose) {
|
|
189
|
+
console.log(`${name}: requirement fullfilled`, requires);
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
if (options.verbose) {
|
|
193
|
+
console.log(`${name}: requirement not fullfilled`, requires);
|
|
194
|
+
}
|
|
195
|
+
continue;
|
|
189
196
|
}
|
|
190
197
|
} else {
|
|
191
198
|
if (options.verbose) {
|
|
192
|
-
console.log(`${name}:
|
|
199
|
+
console.log(`${name}: load`);
|
|
193
200
|
}
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
if (options.verbose) {
|
|
198
|
-
console.log(`${name}: load`);
|
|
199
201
|
}
|
|
200
|
-
}
|
|
201
202
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
if (packageContent.cpu) {
|
|
204
|
+
for (const a of asArray(packageContent.cpu)) {
|
|
205
|
+
fragment.arch.add(npmArchMapping[a]);
|
|
206
|
+
}
|
|
205
207
|
}
|
|
206
|
-
}
|
|
207
208
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
209
|
+
if (pkgbuild.arch) {
|
|
210
|
+
for (const a of asArray(pkgbuild.arch)) {
|
|
211
|
+
if (modulePath.length === 0) {
|
|
212
|
+
fragment.arch.add(a);
|
|
213
|
+
} else {
|
|
214
|
+
fragment.restrictArch.add(a);
|
|
215
|
+
}
|
|
214
216
|
}
|
|
217
|
+
delete pkgbuild.arch;
|
|
215
218
|
}
|
|
216
|
-
delete pkgbuild.arch;
|
|
217
|
-
}
|
|
218
219
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
for (const k of ["hooks"]) {
|
|
221
|
+
if (pkgbuild[k]) {
|
|
222
|
+
pkgbuild[k] = resolve(dir, pkgbuild[k]);
|
|
223
|
+
}
|
|
222
224
|
}
|
|
223
|
-
}
|
|
224
225
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
for (const k of ["output", "content", "dependencies", "replaces"]) {
|
|
227
|
+
if (pkgbuild[k]) {
|
|
228
|
+
fragment[k] = pkgbuild[k];
|
|
229
|
+
delete pkgbuild[k];
|
|
230
|
+
}
|
|
229
231
|
}
|
|
230
|
-
}
|
|
231
232
|
|
|
232
|
-
|
|
233
|
+
const properties = {};
|
|
233
234
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
Object.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
235
|
+
if (modulePath.length >= 1) {
|
|
236
|
+
fragment.parent =
|
|
237
|
+
modulePath.length === 1
|
|
238
|
+
? parent
|
|
239
|
+
: modulePath[modulePath.length - 2];
|
|
240
|
+
} else {
|
|
241
|
+
properties.access =
|
|
242
|
+
packageContent?.publishConfig?.access || "private";
|
|
243
|
+
|
|
244
|
+
Object.assign(
|
|
245
|
+
properties,
|
|
246
|
+
packageContent.config,
|
|
247
|
+
Object.fromEntries(
|
|
248
|
+
["name", "version", "description", "homepage", "license"]
|
|
249
|
+
.map(key => [key, packageContent[key]])
|
|
250
|
+
.filter(([k, v]) => v !== undefined)
|
|
251
|
+
)
|
|
252
|
+
);
|
|
249
253
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
254
|
+
if (properties.name) {
|
|
255
|
+
properties.name = properties.name.replace(/^\@[^\/]+\//, "");
|
|
256
|
+
}
|
|
253
257
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
258
|
+
if (packageContent.bugs?.url) {
|
|
259
|
+
properties.bugs = packageContent.bugs.url;
|
|
260
|
+
}
|
|
257
261
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
262
|
+
if (packageContent.bin) {
|
|
263
|
+
properties.entrypoints = packageContent.bin;
|
|
264
|
+
}
|
|
261
265
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
266
|
+
if (packageContent.contributors) {
|
|
267
|
+
properties.maintainer = packageContent.contributors.map(
|
|
268
|
+
c => c.name + (c.email ? ` <${c.email}>` : "")
|
|
269
|
+
);
|
|
270
|
+
}
|
|
267
271
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
if (typeof packageContent.repository === "string") {
|
|
273
|
+
properties.source = packageContent.repository;
|
|
274
|
+
} else {
|
|
275
|
+
if (packageContent.repository?.url) {
|
|
276
|
+
properties.source = packageContent.repository.url;
|
|
277
|
+
}
|
|
273
278
|
}
|
|
274
279
|
}
|
|
275
|
-
}
|
|
276
280
|
|
|
277
|
-
|
|
278
|
-
|
|
281
|
+
fragment.properties = Object.assign(properties, pkgbuild);
|
|
282
|
+
fragments[fragment.name] = fragment;
|
|
279
283
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
284
|
+
if (pkgbuild.variant) {
|
|
285
|
+
variants[pkgbuild.variant] = fragment;
|
|
286
|
+
}
|
|
283
287
|
|
|
284
|
-
|
|
285
|
-
|
|
288
|
+
if (modulePath.length === 0) {
|
|
289
|
+
root = fragment;
|
|
290
|
+
}
|
|
291
|
+
parent = fragment.name;
|
|
286
292
|
}
|
|
287
|
-
parent = fragment.name;
|
|
288
|
-
}
|
|
289
293
|
|
|
290
|
-
|
|
291
|
-
|
|
294
|
+
return true;
|
|
295
|
+
},
|
|
296
|
+
await packageDirectory({ cwd: options.dir })
|
|
297
|
+
);
|
|
292
298
|
|
|
293
299
|
if (root && Object.keys(variants).length === 0) {
|
|
294
300
|
// @ts-ignore
|
|
@@ -301,6 +307,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
301
307
|
let arch = variant.arch;
|
|
302
308
|
let properties = {};
|
|
303
309
|
let dependencies = {};
|
|
310
|
+
let replaces = {};
|
|
304
311
|
const output = {};
|
|
305
312
|
const content = [];
|
|
306
313
|
|
|
@@ -332,6 +339,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
332
339
|
arch = new Set([...arch, ...fragment.arch]);
|
|
333
340
|
properties = { ...fragment.properties, ...properties };
|
|
334
341
|
dependencies = mergeDependencies(dependencies, fragment.dependencies);
|
|
342
|
+
replaces = mergeDependencies(replaces, fragment.replaces);
|
|
335
343
|
Object.assign(output, fragment.output);
|
|
336
344
|
for (const def of Object.values(output)) {
|
|
337
345
|
if (def.content && !def.dir) {
|
|
@@ -349,6 +357,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
349
357
|
// @ts-ignore
|
|
350
358
|
Object.assign(properties, root.properties);
|
|
351
359
|
delete properties.dependencies;
|
|
360
|
+
delete properties.replaces;
|
|
352
361
|
|
|
353
362
|
properties.variant = name;
|
|
354
363
|
|
|
@@ -357,6 +366,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
357
366
|
content,
|
|
358
367
|
output,
|
|
359
368
|
dependencies,
|
|
369
|
+
replaces,
|
|
360
370
|
properties
|
|
361
371
|
};
|
|
362
372
|
|
|
@@ -388,7 +398,8 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
388
398
|
dependencies: mergeDependencies(
|
|
389
399
|
result.dependencies,
|
|
390
400
|
output.dependencies
|
|
391
|
-
)
|
|
401
|
+
),
|
|
402
|
+
replaces: mergeDependencies(result.replaces, output.replaces)
|
|
392
403
|
};
|
|
393
404
|
|
|
394
405
|
const context = createContext({ properties });
|
package/src/output/arch.mjs
CHANGED
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
Packager,
|
|
16
16
|
pkgbuild_version_attribute,
|
|
17
17
|
pkgbuild_description_attribute,
|
|
18
|
-
pkgbuild_name_attribute
|
|
18
|
+
pkgbuild_name_attribute,
|
|
19
|
+
dependency_attribute_collection_writable
|
|
19
20
|
} from "./packager.mjs";
|
|
20
21
|
import {
|
|
21
22
|
copyEntries,
|
|
@@ -111,13 +112,13 @@ export class ARCH extends Packager {
|
|
|
111
112
|
groups: string_collection_attribute_writable,
|
|
112
113
|
arch: { ...string_collection_attribute_writable, default: ["any"], mandatory: true },
|
|
113
114
|
backup: string_collection_attribute_writable,
|
|
114
|
-
depends:
|
|
115
|
-
makedepends:
|
|
116
|
-
checkdepends:
|
|
117
|
-
optdepends:
|
|
118
|
-
conflicts:
|
|
119
|
-
provides:
|
|
120
|
-
replaces:
|
|
115
|
+
depends: { ...dependency_attribute_collection_writable /*, alias: "dependencies" */ },
|
|
116
|
+
makedepends: dependency_attribute_collection_writable,
|
|
117
|
+
checkdepends: dependency_attribute_collection_writable,
|
|
118
|
+
optdepends: dependency_attribute_collection_writable,
|
|
119
|
+
conflicts: dependency_attribute_collection_writable,
|
|
120
|
+
provides: dependency_attribute_collection_writable,
|
|
121
|
+
replaces: dependency_attribute_collection_writable,
|
|
121
122
|
options: default_attribute
|
|
122
123
|
};
|
|
123
124
|
|
|
@@ -211,6 +212,7 @@ package() {
|
|
|
211
212
|
properties.backup = properties.backup.replace(/\//, "");
|
|
212
213
|
}
|
|
213
214
|
|
|
215
|
+
console.log(properties);
|
|
214
216
|
const fp = fieldProvider(properties, this.attributes);
|
|
215
217
|
|
|
216
218
|
transformer.push({
|