@orkestrel/guide 0.0.23 → 0.0.24

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.
@@ -3270,9 +3270,12 @@ var Guide = class {
3270
3270
  * remain valid. `methods` resolves a declaration's members through its
3271
3271
  * `extends` chain within the same module scope, keeping the keyword it started
3272
3272
  * from; a base the scope does not declare contributes nothing. One declaration
3273
- * answers for a name: the first file in sorted key order that declares the head
3274
- * supplies its members and its bases, and a second file declaring the same name
3275
- * adds nothing. Every reading derives once per instance from the immutable
3273
+ * answers under each keyword: the first file in sorted key order that declares
3274
+ * the head supplies its members and its bases, and a second file declaring the
3275
+ * same name under that keyword adds nothing. The interface answers for a name,
3276
+ * and the class when no interface declares it; one file declaring the name as
3277
+ * both shapes, a TypeScript declaration merge, answers with both, own members
3278
+ * ahead of inherited ones and the interface's own first. Every reading derives once per instance from the immutable
3276
3279
  * inventory and is reused — the scope's declaration map on the first `methods`
3277
3280
  * or `examples` lookup, then each name's members and each example collection
3278
3281
  * under the name asked for — so a reader asking twice reads the files once and
@@ -3312,6 +3315,7 @@ var Source = class {
3312
3315
  #surface;
3313
3316
  #hidden;
3314
3317
  #declarations;
3318
+ #origins = /* @__PURE__ */ new Map();
3315
3319
  constructor(options) {
3316
3320
  this.#files = options.files;
3317
3321
  this.#directories = normalizeDirectories(options.module);
@@ -3346,10 +3350,18 @@ var Source = class {
3346
3350
  return examples;
3347
3351
  }
3348
3352
  #scanMethods(name) {
3349
- const declared = this.#members("interface", name, /* @__PURE__ */ new Set());
3350
- if (declared !== void 0) return declared;
3351
- const inherited = this.#members("class", name, /* @__PURE__ */ new Set());
3352
- return inherited === void 0 ? [] : inherited.filter((entry) => entry.name !== "constructor");
3353
+ const fromInterface = this.#members("interface", name, /* @__PURE__ */ new Set());
3354
+ const fromClass = this.#members("class", name, /* @__PURE__ */ new Set())?.filter((entry) => entry.name !== "constructor");
3355
+ const origin = this.#origin("interface", name);
3356
+ if (origin === void 0 || origin !== this.#origin("class", name)) return fromInterface ?? fromClass ?? [];
3357
+ const methods = /* @__PURE__ */ new Map();
3358
+ for (const entry of [
3359
+ ...extractMemberMethods(this.#locate("interface", name)?.body ?? []),
3360
+ ...extractMemberMethods(this.#locate("class", name)?.body ?? []),
3361
+ ...fromInterface ?? [],
3362
+ ...fromClass ?? []
3363
+ ]) if (entry.name !== "constructor" && !methods.has(entry.name)) methods.set(entry.name, entry);
3364
+ return Array.from(methods.values()).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1);
3353
3365
  }
3354
3366
  #scanExamples() {
3355
3367
  const examples = [];
@@ -3439,6 +3451,9 @@ var Source = class {
3439
3451
  if (this.#declarations === void 0) this.#declarations = this.#scanDeclarations();
3440
3452
  return this.#declarations.get(`${keyword} ${name}`);
3441
3453
  }
3454
+ #origin(keyword, name) {
3455
+ return this.#locate(keyword, name) === void 0 ? void 0 : this.#origins.get(`${keyword} ${name}`);
3456
+ }
3442
3457
  #scanDeclarations() {
3443
3458
  const declarations = /* @__PURE__ */ new Map();
3444
3459
  for (const key of selectModuleKeys(this.#files, this.#directories)) {
@@ -3448,6 +3463,7 @@ var Source = class {
3448
3463
  if (declarations.has(identity)) continue;
3449
3464
  if (declaration.body.length === 0 && declaration.bases.length === 0) continue;
3450
3465
  declarations.set(identity, declaration);
3466
+ this.#origins.set(identity, key);
3451
3467
  }
3452
3468
  }
3453
3469
  return declarations;
@@ -3721,12 +3737,14 @@ var Parity = class Parity {
3721
3737
  const groups = row.guide.methods();
3722
3738
  const documented = groups.map((group) => group.interface);
3723
3739
  const declared = new Set(row.source.surface().map((symbol) => symbol.name));
3740
+ const classes = new Set(row.source.surface().filter((symbol) => symbol.keyword === "class").map((symbol) => symbol.name));
3724
3741
  for (const group of groups) {
3725
3742
  const finding = compareMembership(row.entry.spec, group.interface, group.methods.map((entry) => entry.name), row.source.methods(group.interface).map((entry) => entry.name));
3726
3743
  if (finding !== void 0) findings.push(finding);
3727
3744
  }
3728
3745
  for (const symbol of row.source.surface()) {
3729
3746
  if (symbol.keyword !== "interface" && symbol.keyword !== "class") continue;
3747
+ if (symbol.keyword === "interface" && classes.has(symbol.name)) continue;
3730
3748
  const members = row.source.methods(symbol.name).map((entry) => entry.name);
3731
3749
  if (members.length === 0) continue;
3732
3750
  const contract = `${symbol.name}Interface`;