@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.
- package/dist/src/core/index.cjs +25 -7
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +17 -10
- package/dist/src/core/index.d.ts +17 -10
- package/dist/src/core/index.js +25 -7
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +25 -7
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +11 -7
- package/dist/src/server/index.d.ts +11 -7
- package/dist/src/server/index.js +25 -7
- package/dist/src/server/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -575,13 +575,17 @@ declare interface SourceInterface {
|
|
|
575
575
|
* block's description paragraph. The first file declaring the name answers for it.
|
|
576
576
|
*
|
|
577
577
|
* @remarks
|
|
578
|
-
* One declaration answers
|
|
579
|
-
* sorted key order and the first one whose located head has a body
|
|
580
|
-
* bases supplies both the members and the bases, so a second file
|
|
581
|
-
* declaring the same name adds nothing; a head with
|
|
582
|
-
* bases does not count as declared, so an empty
|
|
583
|
-
* is skipped and resolution continues to a later
|
|
584
|
-
*
|
|
578
|
+
* One declaration answers under each keyword: the module scope's files are
|
|
579
|
+
* read in sorted key order and the first one whose located head has a body
|
|
580
|
+
* or has bases supplies both the members and the bases, so a second file
|
|
581
|
+
* declaring the same name under that keyword adds nothing; a head with
|
|
582
|
+
* neither a body nor bases does not count as declared, so an empty
|
|
583
|
+
* `export interface X {}` is skipped and resolution continues to a later
|
|
584
|
+
* file. The interface answers for `name`, and the class answers when no
|
|
585
|
+
* interface declares it. Where one file declares `name` as both an
|
|
586
|
+
* interface and a class, which TypeScript merges into one type, both
|
|
587
|
+
* answer: each shape's own members come ahead of inherited ones, the
|
|
588
|
+
* interface's own first. Resolution reads each head's `extends` clause and follows it
|
|
585
589
|
* through this same module scope, keeping the keyword it started from: an
|
|
586
590
|
* `interface` chain resolves through interfaces and a `class` chain through
|
|
587
591
|
* classes, so a class's `implements` clause is outside the walk. A base the
|
|
@@ -575,13 +575,17 @@ declare interface SourceInterface {
|
|
|
575
575
|
* block's description paragraph. The first file declaring the name answers for it.
|
|
576
576
|
*
|
|
577
577
|
* @remarks
|
|
578
|
-
* One declaration answers
|
|
579
|
-
* sorted key order and the first one whose located head has a body
|
|
580
|
-
* bases supplies both the members and the bases, so a second file
|
|
581
|
-
* declaring the same name adds nothing; a head with
|
|
582
|
-
* bases does not count as declared, so an empty
|
|
583
|
-
* is skipped and resolution continues to a later
|
|
584
|
-
*
|
|
578
|
+
* One declaration answers under each keyword: the module scope's files are
|
|
579
|
+
* read in sorted key order and the first one whose located head has a body
|
|
580
|
+
* or has bases supplies both the members and the bases, so a second file
|
|
581
|
+
* declaring the same name under that keyword adds nothing; a head with
|
|
582
|
+
* neither a body nor bases does not count as declared, so an empty
|
|
583
|
+
* `export interface X {}` is skipped and resolution continues to a later
|
|
584
|
+
* file. The interface answers for `name`, and the class answers when no
|
|
585
|
+
* interface declares it. Where one file declares `name` as both an
|
|
586
|
+
* interface and a class, which TypeScript merges into one type, both
|
|
587
|
+
* answer: each shape's own members come ahead of inherited ones, the
|
|
588
|
+
* interface's own first. Resolution reads each head's `extends` clause and follows it
|
|
585
589
|
* through this same module scope, keeping the keyword it started from: an
|
|
586
590
|
* `interface` chain resolves through interfaces and a `class` chain through
|
|
587
591
|
* classes, so a class's `implements` clause is outside the walk. A base the
|
package/dist/src/server/index.js
CHANGED
|
@@ -2962,9 +2962,12 @@ var Guide = class {
|
|
|
2962
2962
|
* remain valid. `methods` resolves a declaration's members through its
|
|
2963
2963
|
* `extends` chain within the same module scope, keeping the keyword it started
|
|
2964
2964
|
* from; a base the scope does not declare contributes nothing. One declaration
|
|
2965
|
-
* answers
|
|
2966
|
-
* supplies its members and its bases, and a second file declaring the
|
|
2967
|
-
* adds nothing.
|
|
2965
|
+
* answers under each keyword: the first file in sorted key order that declares
|
|
2966
|
+
* the head supplies its members and its bases, and a second file declaring the
|
|
2967
|
+
* same name under that keyword adds nothing. The interface answers for a name,
|
|
2968
|
+
* and the class when no interface declares it; one file declaring the name as
|
|
2969
|
+
* both shapes, a TypeScript declaration merge, answers with both, own members
|
|
2970
|
+
* ahead of inherited ones and the interface's own first. Every reading derives once per instance from the immutable
|
|
2968
2971
|
* inventory and is reused — the scope's declaration map on the first `methods`
|
|
2969
2972
|
* or `examples` lookup, then each name's members and each example collection
|
|
2970
2973
|
* under the name asked for — so a reader asking twice reads the files once and
|
|
@@ -3004,6 +3007,7 @@ var Source = class {
|
|
|
3004
3007
|
#surface;
|
|
3005
3008
|
#hidden;
|
|
3006
3009
|
#declarations;
|
|
3010
|
+
#origins = /* @__PURE__ */ new Map();
|
|
3007
3011
|
constructor(options) {
|
|
3008
3012
|
this.#files = options.files;
|
|
3009
3013
|
this.#directories = normalizeDirectories(options.module);
|
|
@@ -3038,10 +3042,18 @@ var Source = class {
|
|
|
3038
3042
|
return examples;
|
|
3039
3043
|
}
|
|
3040
3044
|
#scanMethods(name) {
|
|
3041
|
-
const
|
|
3042
|
-
|
|
3043
|
-
const
|
|
3044
|
-
|
|
3045
|
+
const fromInterface = this.#members("interface", name, /* @__PURE__ */ new Set());
|
|
3046
|
+
const fromClass = this.#members("class", name, /* @__PURE__ */ new Set())?.filter((entry) => entry.name !== "constructor");
|
|
3047
|
+
const origin = this.#origin("interface", name);
|
|
3048
|
+
if (origin === void 0 || origin !== this.#origin("class", name)) return fromInterface ?? fromClass ?? [];
|
|
3049
|
+
const methods = /* @__PURE__ */ new Map();
|
|
3050
|
+
for (const entry of [
|
|
3051
|
+
...extractMemberMethods(this.#locate("interface", name)?.body ?? []),
|
|
3052
|
+
...extractMemberMethods(this.#locate("class", name)?.body ?? []),
|
|
3053
|
+
...fromInterface ?? [],
|
|
3054
|
+
...fromClass ?? []
|
|
3055
|
+
]) if (entry.name !== "constructor" && !methods.has(entry.name)) methods.set(entry.name, entry);
|
|
3056
|
+
return Array.from(methods.values()).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1);
|
|
3045
3057
|
}
|
|
3046
3058
|
#scanExamples() {
|
|
3047
3059
|
const examples = [];
|
|
@@ -3131,6 +3143,9 @@ var Source = class {
|
|
|
3131
3143
|
if (this.#declarations === void 0) this.#declarations = this.#scanDeclarations();
|
|
3132
3144
|
return this.#declarations.get(`${keyword} ${name}`);
|
|
3133
3145
|
}
|
|
3146
|
+
#origin(keyword, name) {
|
|
3147
|
+
return this.#locate(keyword, name) === void 0 ? void 0 : this.#origins.get(`${keyword} ${name}`);
|
|
3148
|
+
}
|
|
3134
3149
|
#scanDeclarations() {
|
|
3135
3150
|
const declarations = /* @__PURE__ */ new Map();
|
|
3136
3151
|
for (const key of selectModuleKeys(this.#files, this.#directories)) {
|
|
@@ -3140,6 +3155,7 @@ var Source = class {
|
|
|
3140
3155
|
if (declarations.has(identity)) continue;
|
|
3141
3156
|
if (declaration.body.length === 0 && declaration.bases.length === 0) continue;
|
|
3142
3157
|
declarations.set(identity, declaration);
|
|
3158
|
+
this.#origins.set(identity, key);
|
|
3143
3159
|
}
|
|
3144
3160
|
}
|
|
3145
3161
|
return declarations;
|
|
@@ -3413,12 +3429,14 @@ var Parity = class Parity {
|
|
|
3413
3429
|
const groups = row.guide.methods();
|
|
3414
3430
|
const documented = groups.map((group) => group.interface);
|
|
3415
3431
|
const declared = new Set(row.source.surface().map((symbol) => symbol.name));
|
|
3432
|
+
const classes = new Set(row.source.surface().filter((symbol) => symbol.keyword === "class").map((symbol) => symbol.name));
|
|
3416
3433
|
for (const group of groups) {
|
|
3417
3434
|
const finding = compareMembership(row.entry.spec, group.interface, group.methods.map((entry) => entry.name), row.source.methods(group.interface).map((entry) => entry.name));
|
|
3418
3435
|
if (finding !== void 0) findings.push(finding);
|
|
3419
3436
|
}
|
|
3420
3437
|
for (const symbol of row.source.surface()) {
|
|
3421
3438
|
if (symbol.keyword !== "interface" && symbol.keyword !== "class") continue;
|
|
3439
|
+
if (symbol.keyword === "interface" && classes.has(symbol.name)) continue;
|
|
3422
3440
|
const members = row.source.methods(symbol.name).map((entry) => entry.name);
|
|
3423
3441
|
if (members.length === 0) continue;
|
|
3424
3442
|
const contract = `${symbol.name}Interface`;
|