@particle-academy/fancy-flow 0.31.0 → 0.33.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/dist/engine.cjs +59 -8
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.cts +59 -9
- package/dist/engine.d.ts +59 -9
- package/dist/engine.js +59 -8
- package/dist/engine.js.map +1 -1
- package/package.json +1 -1
package/dist/engine.cjs
CHANGED
|
@@ -441,6 +441,7 @@ function validateNodeManifest(input) {
|
|
|
441
441
|
);
|
|
442
442
|
}
|
|
443
443
|
validateCapabilities(m.capabilities, problems);
|
|
444
|
+
validateFancyDependencies(m.fancyDependencies, problems);
|
|
444
445
|
if (m.sideEffects !== void 0 && !SIDE_EFFECTS.includes(m.sideEffects)) {
|
|
445
446
|
problems.push(err("sideEffects", `Must be one of: ${SIDE_EFFECTS.join(", ")}.`));
|
|
446
447
|
}
|
|
@@ -477,7 +478,7 @@ function validateAliases(aliases2, problems) {
|
|
|
477
478
|
}
|
|
478
479
|
function validateRuntimes(runtimes, problems) {
|
|
479
480
|
if (typeof runtimes !== "object" || runtimes === null || Array.isArray(runtimes)) {
|
|
480
|
-
problems.push(err("runtimes", "Required \u2014 an object of runtime id to {
|
|
481
|
+
problems.push(err("runtimes", "Required \u2014 an object of runtime id to { files, engine }."));
|
|
481
482
|
return;
|
|
482
483
|
}
|
|
483
484
|
const entries = Object.entries(runtimes);
|
|
@@ -487,17 +488,26 @@ function validateRuntimes(runtimes, problems) {
|
|
|
487
488
|
}
|
|
488
489
|
for (const [runtime, spec] of entries) {
|
|
489
490
|
if (typeof spec !== "object" || spec === null || Array.isArray(spec)) {
|
|
490
|
-
problems.push(err(`runtimes.${runtime}`, "Must be an object of {
|
|
491
|
+
problems.push(err(`runtimes.${runtime}`, "Must be an object of { files, engine }."));
|
|
491
492
|
continue;
|
|
492
493
|
}
|
|
493
494
|
const s = spec;
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
495
|
+
const files = Array.isArray(s.files) ? s.files : null;
|
|
496
|
+
if (!files || files.length === 0 || files.some((f) => typeof f !== "string" || f.trim() === "")) {
|
|
497
|
+
problems.push(
|
|
498
|
+
err(
|
|
499
|
+
`runtimes.${runtime}`,
|
|
500
|
+
"Needs `files` \u2014 the node source directories this runtime's backend lives in, relative to the node."
|
|
501
|
+
)
|
|
502
|
+
);
|
|
498
503
|
}
|
|
499
|
-
if (
|
|
500
|
-
problems.push(
|
|
504
|
+
if (s.entry !== void 0 || s.package !== void 0) {
|
|
505
|
+
problems.push(
|
|
506
|
+
err(
|
|
507
|
+
`runtimes.${runtime}`,
|
|
508
|
+
"`entry` / `package` are gone \u2014 nodes are copied into a project, not installed from a registry. Declare `files` instead."
|
|
509
|
+
)
|
|
510
|
+
);
|
|
501
511
|
}
|
|
502
512
|
if (typeof s.engine !== "string" || s.engine.trim() === "") {
|
|
503
513
|
problems.push(
|
|
@@ -506,6 +516,47 @@ function validateRuntimes(runtimes, problems) {
|
|
|
506
516
|
}
|
|
507
517
|
}
|
|
508
518
|
}
|
|
519
|
+
var VERSIONED = /(?:@|:)\s*[\^~>=<]*\s*\d/;
|
|
520
|
+
function validateFancyDependencies(deps, problems) {
|
|
521
|
+
if (deps === void 0) return;
|
|
522
|
+
if (!Array.isArray(deps)) {
|
|
523
|
+
problems.push(err("fancyDependencies", "Must be an array of { package, npm?, composer?, reason?, requirement? }."));
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
deps.forEach((entry, index) => {
|
|
527
|
+
const at = `fancyDependencies[${index}]`;
|
|
528
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
|
|
529
|
+
problems.push(err(at, "Must be an object naming a suite package, not a bare string \u2014 a slug alone cannot say whether the package exists on npm, on Composer, or both."));
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
const dep = entry;
|
|
533
|
+
if (typeof dep.package !== "string" || dep.package.trim() === "") {
|
|
534
|
+
problems.push(err(`${at}.package`, "Required \u2014 the suite slug, e.g. `fancy-screens`."));
|
|
535
|
+
}
|
|
536
|
+
if (dep.npm === void 0 && dep.composer === void 0) {
|
|
537
|
+
problems.push(
|
|
538
|
+
err(at, "Needs at least one of `npm` or `composer`. Naming neither leaves the CLI with a package it cannot offer any way to install.")
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
for (const field of ["package", "npm", "composer"]) {
|
|
542
|
+
const value = dep[field];
|
|
543
|
+
if (typeof value === "string" && VERSIONED.test(value.replace(/^@[a-z0-9._-]+\//i, ""))) {
|
|
544
|
+
problems.push(
|
|
545
|
+
err(
|
|
546
|
+
`${at}.${field}`,
|
|
547
|
+
"Must not carry a version range \u2014 the suite ships additively and a pin here freezes a consumer on an old surface. Express engine compatibility in `runtimes[].engine` instead."
|
|
548
|
+
)
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if (dep.version !== void 0) {
|
|
553
|
+
problems.push(err(`${at}.version`, "Not a field. Fancy dependencies are unversioned \u2014 see `runtimes[].engine` for the constraint that is actually checked."));
|
|
554
|
+
}
|
|
555
|
+
if (dep.requirement !== void 0 && !REQUIREMENTS.includes(dep.requirement)) {
|
|
556
|
+
problems.push(err(`${at}.requirement`, `Must be "required" or "optional".`));
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
}
|
|
509
560
|
function validateCapabilities(capabilities, problems) {
|
|
510
561
|
if (capabilities === void 0) return;
|
|
511
562
|
if (typeof capabilities !== "object" || capabilities === null || Array.isArray(capabilities)) {
|