@orkestrel/guide 0.0.18 → 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);
@@ -2068,7 +2067,8 @@ function extractBodyLines(lines) {
2068
2067
  * and {@link locateComment} matches a caller's key against the whole map. A change to the head
2069
2068
  * shape or to the member shape reaches every one of them at once.
2070
2069
  *
2071
- * An owner opens at a column-zero `export class` or `export interface` head and closes at the
2070
+ * An owner opens at a column-zero `export class`, `export abstract class`, or `export interface`
2071
+ * head and closes at the
2072
2072
  * first column-zero `}`, so a member declared past that brace keys nothing. A column-zero `export` declaration carrying any other keyword closes the owner it follows,
2073
2073
  * because a member belongs to the head enclosing it. Reading runs over {@link extractSourceLines}'s
2074
2074
  * projection, so a head or
@@ -2087,7 +2087,7 @@ function collectKeys(lines) {
2087
2087
  const keys = /* @__PURE__ */ new Map();
2088
2088
  let owner;
2089
2089
  for (const line of lines) {
2090
- const head = /^export (?:async )?(function\*?|class|const|interface|type) (\w+)/.exec(line.code);
2090
+ const head = /^export (?:async )?(?:abstract )?(function\*?|class|const|interface|type) (\w+)/.exec(line.code);
2091
2091
  const keyword = head?.[1]?.replace(/\*$/, "");
2092
2092
  const name = head?.[2];
2093
2093
  if ((0, _orkestrel_contract.isNonEmptyString)(keyword) && (0, _orkestrel_contract.isNonEmptyString)(name) && isExportKeyword(keyword)) {
@@ -3735,7 +3735,7 @@ var GuideCommand = class {
3735
3735
  try {
3736
3736
  await this.#executeNative();
3737
3737
  } catch (error) {
3738
- 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`);
3739
3739
  this.#raise(1);
3740
3740
  }
3741
3741
  }
@@ -3847,8 +3847,8 @@ var GuideCommand = class {
3847
3847
  }
3848
3848
  #raise(code) {
3849
3849
  const current = node_process.default.exitCode;
3850
- const numeric = typeof current === "string" ? Number.parseInt(current, 10) : current;
3851
- 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;
3852
3852
  }
3853
3853
  };
3854
3854
  //#endregion