npm-pkgbuild 15.3.34 → 15.3.35
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 +1 -1
- package/src/extract-from-package.mjs +46 -54
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
|
|
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
|
|