npm-pkgbuild 15.3.34 → 15.3.36
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 +25 -25
- package/package.json +1 -1
- package/src/extract-from-package.mjs +46 -54
package/README.md
CHANGED
|
@@ -97,24 +97,24 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
|
|
|
97
97
|
* [FileContentProvider](#filecontentprovider)
|
|
98
98
|
* [Parameters](#parameters-1)
|
|
99
99
|
* [name](#name)
|
|
100
|
+
* [NFTContentProvider](#nftcontentprovider)
|
|
101
|
+
* [Parameters](#parameters-2)
|
|
102
|
+
* [name](#name-1)
|
|
100
103
|
* [utf8StreamOptions](#utf8streamoptions)
|
|
101
104
|
* [Properties](#properties-1)
|
|
102
105
|
* [packageNameMapping](#packagenamemapping)
|
|
103
106
|
* [decodePassword](#decodepassword)
|
|
104
|
-
* [Parameters](#parameters-
|
|
107
|
+
* [Parameters](#parameters-3)
|
|
105
108
|
* [FunctionDecl](#functiondecl)
|
|
106
109
|
* [Properties](#properties-2)
|
|
107
110
|
* [extractFunctions](#extractfunctions)
|
|
108
|
-
* [Parameters](#parameters-3)
|
|
109
|
-
* [fieldProvider](#fieldprovider)
|
|
110
111
|
* [Parameters](#parameters-4)
|
|
111
|
-
* [
|
|
112
|
+
* [fieldProvider](#fieldprovider)
|
|
112
113
|
* [Parameters](#parameters-5)
|
|
113
|
-
* [
|
|
114
|
+
* [Expander](#expander)
|
|
114
115
|
* [Parameters](#parameters-6)
|
|
115
|
-
* [
|
|
116
|
+
* [copyEntries](#copyentries)
|
|
116
117
|
* [Parameters](#parameters-7)
|
|
117
|
-
* [name](#name-1)
|
|
118
118
|
* [NodeModulesContentProvider](#nodemodulescontentprovider)
|
|
119
119
|
* [Parameters](#parameters-8)
|
|
120
120
|
* [Properties](#properties-3)
|
|
@@ -210,6 +210,24 @@ Content provided form the file system.
|
|
|
210
210
|
|
|
211
211
|
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
|
|
212
212
|
|
|
213
|
+
## NFTContentProvider
|
|
214
|
+
|
|
215
|
+
**Extends ContentProvider**
|
|
216
|
+
|
|
217
|
+
Content provided form the file system.
|
|
218
|
+
|
|
219
|
+
### Parameters
|
|
220
|
+
|
|
221
|
+
* `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))** 
|
|
222
|
+
|
|
223
|
+
* `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)>)** 
|
|
224
|
+
* `definitions.base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base directory where to find the files
|
|
225
|
+
* `entryProperties`  
|
|
226
|
+
|
|
227
|
+
### name
|
|
228
|
+
|
|
229
|
+
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
|
|
230
|
+
|
|
213
231
|
## utf8StreamOptions
|
|
214
232
|
|
|
215
233
|
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
@@ -281,24 +299,6 @@ Destination paths a generated without leading '/' (as for entry names too).
|
|
|
281
299
|
* `destinationDirectory` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
282
300
|
* `expander` **[Expander](#expander)** (optional, default `v=>v`)
|
|
283
301
|
|
|
284
|
-
## NFTContentProvider
|
|
285
|
-
|
|
286
|
-
**Extends ContentProvider**
|
|
287
|
-
|
|
288
|
-
Content provided form the file system.
|
|
289
|
-
|
|
290
|
-
### Parameters
|
|
291
|
-
|
|
292
|
-
* `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))** 
|
|
293
|
-
|
|
294
|
-
* `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)>)** 
|
|
295
|
-
* `definitions.base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base directory where to find the files
|
|
296
|
-
* `entryProperties`  
|
|
297
|
-
|
|
298
|
-
### name
|
|
299
|
-
|
|
300
|
-
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
|
|
301
|
-
|
|
302
302
|
## NodeModulesContentProvider
|
|
303
303
|
|
|
304
304
|
**Extends ContentProvider**
|
package/package.json
CHANGED
|
@@ -146,13 +146,23 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
146
146
|
continue;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
const requires = pkgbuild.requires;
|
|
150
|
-
delete pkgbuild.requires;
|
|
151
|
-
|
|
152
149
|
let name = `${packageContent.name}[${i++}]`;
|
|
153
|
-
|
|
150
|
+
|
|
151
|
+
const fragment = {
|
|
152
|
+
dir,
|
|
153
|
+
name,
|
|
154
|
+
priority: 1,
|
|
155
|
+
dependencies: packageContent.engines || {},
|
|
156
|
+
arch: new Set(),
|
|
157
|
+
restrictArch: new Set()
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const requires = pkgbuild.requires;
|
|
154
161
|
|
|
155
162
|
if (requires) {
|
|
163
|
+
fragment.requires = requires;
|
|
164
|
+
delete pkgbuild.requires;
|
|
165
|
+
|
|
156
166
|
let fullfilled = true;
|
|
157
167
|
|
|
158
168
|
if (requires.properties) {
|
|
@@ -162,7 +172,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
162
172
|
break;
|
|
163
173
|
}
|
|
164
174
|
|
|
165
|
-
priority += 1;
|
|
175
|
+
fragment.priority += 1;
|
|
166
176
|
}
|
|
167
177
|
}
|
|
168
178
|
|
|
@@ -170,7 +180,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
170
180
|
if (env[requires.environment.has] === undefined) {
|
|
171
181
|
fullfilled = false;
|
|
172
182
|
}
|
|
173
|
-
priority += 10;
|
|
183
|
+
fragment.priority += 10;
|
|
174
184
|
}
|
|
175
185
|
|
|
176
186
|
if (fullfilled) {
|
|
@@ -189,16 +199,6 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
189
199
|
}
|
|
190
200
|
}
|
|
191
201
|
|
|
192
|
-
const fragment = {
|
|
193
|
-
dir,
|
|
194
|
-
name,
|
|
195
|
-
requires,
|
|
196
|
-
priority,
|
|
197
|
-
dependencies: packageContent.engines || {},
|
|
198
|
-
arch: new Set(),
|
|
199
|
-
restrictArch: new Set()
|
|
200
|
-
};
|
|
201
|
-
|
|
202
202
|
if (packageContent.cpu) {
|
|
203
203
|
for (const a of asArray(packageContent.cpu)) {
|
|
204
204
|
fragment.arch.add(npmArchMapping[a]);
|
|
@@ -333,8 +333,13 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
333
333
|
properties = { ...fragment.properties, ...properties };
|
|
334
334
|
dependencies = mergeDependencies(dependencies, fragment.dependencies);
|
|
335
335
|
Object.assign(output, fragment.output);
|
|
336
|
+
for (const def of Object.values(output)) {
|
|
337
|
+
if (def.content) {
|
|
338
|
+
def.dir = fragment.dir;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
336
341
|
if (fragment.content) {
|
|
337
|
-
content.push(
|
|
342
|
+
content.push(fragment);
|
|
338
343
|
}
|
|
339
344
|
} else {
|
|
340
345
|
console.log("requirements not met", fragment.name, missedRequirements);
|
|
@@ -347,27 +352,23 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
347
352
|
|
|
348
353
|
properties.variant = name;
|
|
349
354
|
|
|
350
|
-
const context = createContext({ properties });
|
|
351
|
-
const sources = context.expand(content).reduce((a, c) => {
|
|
352
|
-
a.push(...content2Sources(c[0], c[1]));
|
|
353
|
-
return a;
|
|
354
|
-
}, []);
|
|
355
|
-
|
|
356
355
|
const result = {
|
|
357
|
-
context,
|
|
358
356
|
variant: { name, priority: variant.priority },
|
|
359
|
-
|
|
357
|
+
content,
|
|
360
358
|
output,
|
|
361
359
|
dependencies,
|
|
362
|
-
properties
|
|
360
|
+
properties
|
|
363
361
|
};
|
|
364
362
|
|
|
365
|
-
function* forEachOutput(result) {
|
|
363
|
+
function* forEachOutput(result) {
|
|
366
364
|
if (Object.entries(result.output).length === 0) {
|
|
365
|
+
result.context = createContext({ properties: result.properties });
|
|
366
|
+
result.sources = [];
|
|
367
367
|
yield result;
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
for (const [name, output] of Object.entries(result.output)) {
|
|
371
|
+
const content = [...result.content];
|
|
371
372
|
const arch = mergeArchs(
|
|
372
373
|
result.properties.arch,
|
|
373
374
|
output.properties?.arch
|
|
@@ -376,43 +377,34 @@ export async function* extractFromPackage(options = {}, env = {}) {
|
|
|
376
377
|
result.properties.arch = arch;
|
|
377
378
|
}
|
|
378
379
|
|
|
379
|
-
let sources = [];
|
|
380
|
-
|
|
381
380
|
if (output.content) {
|
|
382
|
-
|
|
383
|
-
.expand([[output.content, variant.dir]])
|
|
384
|
-
.reduce((a, c) => {
|
|
385
|
-
a.push(...content2Sources(c[0], c[1]));
|
|
386
|
-
return a;
|
|
387
|
-
}, []);
|
|
381
|
+
content.push(output);
|
|
388
382
|
}
|
|
389
383
|
|
|
390
|
-
const
|
|
391
|
-
|
|
384
|
+
const properties = {
|
|
385
|
+
type: name,
|
|
386
|
+
...result.properties,
|
|
387
|
+
...output.properties
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
const context = createContext({ properties });
|
|
391
|
+
const sources = [];
|
|
392
|
+
context.expand(content).reduce((a, { content, dir }) => {
|
|
393
|
+
a.push(...content2Sources(content, dir));
|
|
394
|
+
return a;
|
|
395
|
+
}, sources);
|
|
396
|
+
|
|
397
|
+
yield {
|
|
398
|
+
context,
|
|
392
399
|
variant: { ...result.variant, output: name },
|
|
393
400
|
output: { [name]: output },
|
|
394
|
-
sources
|
|
401
|
+
sources,
|
|
395
402
|
dependencies: mergeDependencies(
|
|
396
403
|
result.dependencies,
|
|
397
404
|
output.dependencies
|
|
398
405
|
),
|
|
399
|
-
properties:
|
|
400
|
-
type: name,
|
|
401
|
-
...result.properties,
|
|
402
|
-
...output.properties
|
|
403
|
-
}
|
|
406
|
+
properties : context.expand(properties)
|
|
404
407
|
};
|
|
405
|
-
|
|
406
|
-
/*
|
|
407
|
-
console.log(
|
|
408
|
-
"RESULT",
|
|
409
|
-
outputResult.variant,
|
|
410
|
-
outputResult.properties,
|
|
411
|
-
sources.map(s => s.toString()).join("\n"),
|
|
412
|
-
outputResult.output
|
|
413
|
-
);*/
|
|
414
|
-
|
|
415
|
-
yield outputResult;
|
|
416
408
|
}
|
|
417
409
|
}
|
|
418
410
|
|