@orkestrel/guide 0.0.19 → 0.0.20

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.
@@ -92,7 +92,7 @@ function matchesGuideResult(result) {
92
92
  * ```
93
93
  */
94
94
  function resolveGuideRoot(root) {
95
- return (0, node_path.resolve)(root instanceof URL ? (0, node_url.fileURLToPath)(root) : root);
95
+ return (0, node_path.resolve)((0, _orkestrel_contract.isInstance)(root, URL) ? (0, node_url.fileURLToPath)(root) : root);
96
96
  }
97
97
  /**
98
98
  * Selects the indexed guide matching a package's bare name.
@@ -126,8 +126,7 @@ function selectGuidePitch(entries, name) {
126
126
  */
127
127
  function parseGuideDirection(args) {
128
128
  if (args.length !== 2 || args[0] !== "--to") return void 0;
129
- const direction = args[1];
130
- return direction === "guide" || direction === "source" ? direction : void 0;
129
+ return (0, _orkestrel_contract.parseEnum)(args[1], ["guide", "source"]);
131
130
  }
132
131
  /**
133
132
  * Reads the bare package name from package manifest JSON.
@@ -141,10 +140,10 @@ function parseGuideDirection(args) {
141
140
  * ```
142
141
  */
143
142
  function parsePackageName(manifest) {
144
- const parsed = (0, _orkestrel_contract.parseJSON)(manifest);
145
- if (!(0, _orkestrel_contract.isRecord)(parsed)) return void 0;
143
+ const parsed = (0, _orkestrel_contract.parseJSONAs)(manifest, _orkestrel_contract.isRecord);
144
+ if (parsed === void 0) return void 0;
146
145
  const name = parsed.name;
147
- if (typeof name !== "string" || name.length === 0) return void 0;
146
+ if (!(0, _orkestrel_contract.isNonEmptyString)(name)) return void 0;
148
147
  return name.slice(name.lastIndexOf("/") + 1);
149
148
  }
150
149
  //#endregion
@@ -797,7 +796,7 @@ function hasCanonicalSegments(key) {
797
796
  function normalizeDirectories(module) {
798
797
  const directories = [];
799
798
  const seen = /* @__PURE__ */ new Set();
800
- for (const value of typeof module === "string" ? [module] : module) {
799
+ for (const value of (0, _orkestrel_contract.isString)(module) ? [module] : module) {
801
800
  const directory = resolvePath(".", value);
802
801
  if (seen.has(directory)) continue;
803
802
  seen.add(directory);
@@ -3736,7 +3735,7 @@ var GuideCommand = class {
3736
3735
  try {
3737
3736
  await this.#executeNative();
3738
3737
  } catch (error) {
3739
- node_process.default.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
3738
+ node_process.default.stderr.write(`${(0, _orkestrel_contract.isError)(error) ? error.message : String(error)}\n`);
3740
3739
  this.#raise(1);
3741
3740
  }
3742
3741
  }
@@ -3848,8 +3847,8 @@ var GuideCommand = class {
3848
3847
  }
3849
3848
  #raise(code) {
3850
3849
  const current = node_process.default.exitCode;
3851
- const numeric = typeof current === "string" ? Number.parseInt(current, 10) : current;
3852
- if (typeof numeric !== "number" || !Number.isFinite(numeric) || numeric < code) node_process.default.exitCode = code;
3850
+ const numeric = (0, _orkestrel_contract.isString)(current) ? Number.parseInt(current, 10) : current;
3851
+ if (!(0, _orkestrel_contract.isFiniteNumber)(numeric) || numeric < code) node_process.default.exitCode = code;
3853
3852
  }
3854
3853
  };
3855
3854
  //#endregion