@particle-academy/fancy-flow 0.32.0 → 0.33.1

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 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
  }
@@ -515,6 +516,47 @@ function validateRuntimes(runtimes, problems) {
515
516
  }
516
517
  }
517
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
+ }
518
560
  function validateCapabilities(capabilities, problems) {
519
561
  if (capabilities === void 0) return;
520
562
  if (typeof capabilities !== "object" || capabilities === null || Array.isArray(capabilities)) {