@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.
@@ -2986,9 +2986,12 @@ var Guide = class {
2986
2986
  * remain valid. `methods` resolves a declaration's members through its
2987
2987
  * `extends` chain within the same module scope, keeping the keyword it started
2988
2988
  * from; a base the scope does not declare contributes nothing. One declaration
2989
- * answers for a name: the first file in sorted key order that declares the head
2990
- * supplies its members and its bases, and a second file declaring the same name
2991
- * adds nothing. Every reading derives once per instance from the immutable
2989
+ * answers under each keyword: the first file in sorted key order that declares
2990
+ * the head supplies its members and its bases, and a second file declaring the
2991
+ * same name under that keyword adds nothing. The interface answers for a name,
2992
+ * and the class when no interface declares it; one file declaring the name as
2993
+ * both shapes, a TypeScript declaration merge, answers with both, own members
2994
+ * ahead of inherited ones and the interface's own first. Every reading derives once per instance from the immutable
2992
2995
  * inventory and is reused — the scope's declaration map on the first `methods`
2993
2996
  * or `examples` lookup, then each name's members and each example collection
2994
2997
  * under the name asked for — so a reader asking twice reads the files once and
@@ -3028,6 +3031,7 @@ var Source = class {
3028
3031
  #surface;
3029
3032
  #hidden;
3030
3033
  #declarations;
3034
+ #origins = /* @__PURE__ */ new Map();
3031
3035
  constructor(options) {
3032
3036
  this.#files = options.files;
3033
3037
  this.#directories = normalizeDirectories(options.module);
@@ -3062,10 +3066,18 @@ var Source = class {
3062
3066
  return examples;
3063
3067
  }
3064
3068
  #scanMethods(name) {
3065
- const declared = this.#members("interface", name, /* @__PURE__ */ new Set());
3066
- if (declared !== void 0) return declared;
3067
- const inherited = this.#members("class", name, /* @__PURE__ */ new Set());
3068
- return inherited === void 0 ? [] : inherited.filter((entry) => entry.name !== "constructor");
3069
+ const fromInterface = this.#members("interface", name, /* @__PURE__ */ new Set());
3070
+ const fromClass = this.#members("class", name, /* @__PURE__ */ new Set())?.filter((entry) => entry.name !== "constructor");
3071
+ const origin = this.#origin("interface", name);
3072
+ if (origin === void 0 || origin !== this.#origin("class", name)) return fromInterface ?? fromClass ?? [];
3073
+ const methods = /* @__PURE__ */ new Map();
3074
+ for (const entry of [
3075
+ ...extractMemberMethods(this.#locate("interface", name)?.body ?? []),
3076
+ ...extractMemberMethods(this.#locate("class", name)?.body ?? []),
3077
+ ...fromInterface ?? [],
3078
+ ...fromClass ?? []
3079
+ ]) if (entry.name !== "constructor" && !methods.has(entry.name)) methods.set(entry.name, entry);
3080
+ return Array.from(methods.values()).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1);
3069
3081
  }
3070
3082
  #scanExamples() {
3071
3083
  const examples = [];
@@ -3155,6 +3167,9 @@ var Source = class {
3155
3167
  if (this.#declarations === void 0) this.#declarations = this.#scanDeclarations();
3156
3168
  return this.#declarations.get(`${keyword} ${name}`);
3157
3169
  }
3170
+ #origin(keyword, name) {
3171
+ return this.#locate(keyword, name) === void 0 ? void 0 : this.#origins.get(`${keyword} ${name}`);
3172
+ }
3158
3173
  #scanDeclarations() {
3159
3174
  const declarations = /* @__PURE__ */ new Map();
3160
3175
  for (const key of selectModuleKeys(this.#files, this.#directories)) {
@@ -3164,6 +3179,7 @@ var Source = class {
3164
3179
  if (declarations.has(identity)) continue;
3165
3180
  if (declaration.body.length === 0 && declaration.bases.length === 0) continue;
3166
3181
  declarations.set(identity, declaration);
3182
+ this.#origins.set(identity, key);
3167
3183
  }
3168
3184
  }
3169
3185
  return declarations;
@@ -3437,12 +3453,14 @@ var Parity = class Parity {
3437
3453
  const groups = row.guide.methods();
3438
3454
  const documented = groups.map((group) => group.interface);
3439
3455
  const declared = new Set(row.source.surface().map((symbol) => symbol.name));
3456
+ const classes = new Set(row.source.surface().filter((symbol) => symbol.keyword === "class").map((symbol) => symbol.name));
3440
3457
  for (const group of groups) {
3441
3458
  const finding = compareMembership(row.entry.spec, group.interface, group.methods.map((entry) => entry.name), row.source.methods(group.interface).map((entry) => entry.name));
3442
3459
  if (finding !== void 0) findings.push(finding);
3443
3460
  }
3444
3461
  for (const symbol of row.source.surface()) {
3445
3462
  if (symbol.keyword !== "interface" && symbol.keyword !== "class") continue;
3463
+ if (symbol.keyword === "interface" && classes.has(symbol.name)) continue;
3446
3464
  const members = row.source.methods(symbol.name).map((entry) => entry.name);
3447
3465
  if (members.length === 0) continue;
3448
3466
  const contract = `${symbol.name}Interface`;