shelving 1.206.0 → 1.206.1

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.
@@ -4,7 +4,8 @@ import { Extractor } from "./Extractor.js";
4
4
  /**
5
5
  * Base extractor for a file in a tree.
6
6
  * - Reads the file's content as text and stores it in `content`.
7
- * - Sets `key` to the slugified basename (without extension).
7
+ * - Sets `key` to the slugified basename without extension.
8
+ * - Sets `name` to the display-ready basename without extension (e.g. `"OptionalSchema"`, not `"OptionalSchema.ts"`).
8
9
  * - Does NOT set `title` — `title` is only set by subclasses that have a confident source for one
9
10
  * (e.g. `MarkdownExtractor` uses the first `<h1>`). Renderers fall back to `name` when missing.
10
11
  * - Subclasses (e.g. `MarkdownExtractor`, `TypescriptExtractor`) override `extractProps()` to parse the content into richer elements.
@@ -13,8 +14,7 @@ export declare class FileExtractor extends Extractor<BunFile, FileElement> {
13
14
  extract(file: BunFile): Promise<FileElement>;
14
15
  /**
15
16
  * Build the file element props from the extracted content.
16
- * - `name` is the basename including extension (e.g. `"array.ts"`).
17
- * - `base` is the basename without extension (e.g. `"array"`) — useful as a title fallback.
17
+ * - `name` is the basename without extension (e.g. `"array"`) — display-ready, used by menus and cards.
18
18
  * - Override to parse `text` into richer elements (content/children/description) and to set
19
19
  * `title` if a confident title is available.
20
20
  */
@@ -5,7 +5,8 @@ import { Extractor } from "./Extractor.js";
5
5
  /**
6
6
  * Base extractor for a file in a tree.
7
7
  * - Reads the file's content as text and stores it in `content`.
8
- * - Sets `key` to the slugified basename (without extension).
8
+ * - Sets `key` to the slugified basename without extension.
9
+ * - Sets `name` to the display-ready basename without extension (e.g. `"OptionalSchema"`, not `"OptionalSchema.ts"`).
9
10
  * - Does NOT set `title` — `title` is only set by subclasses that have a confident source for one
10
11
  * (e.g. `MarkdownExtractor` uses the first `<h1>`). Renderers fall back to `name` when missing.
11
12
  * - Subclasses (e.g. `MarkdownExtractor`, `TypescriptExtractor`) override `extractProps()` to parse the content into richer elements.
@@ -13,18 +14,17 @@ import { Extractor } from "./Extractor.js";
13
14
  export class FileExtractor extends Extractor {
14
15
  async extract(file) {
15
16
  const path = file.name ?? "unnamed";
16
- const name = isAbsolutePath(path) ? (splitAbsolutePath(path).at(-1) ?? "unnamed") : path;
17
- const [base = name] = splitFileExtension(name);
17
+ const filename = isAbsolutePath(path) ? (splitAbsolutePath(path).at(-1) ?? "unnamed") : path;
18
+ const [base = filename] = splitFileExtension(filename);
18
19
  return {
19
20
  type: "tree-file",
20
21
  key: requireSlug(base),
21
- props: this.extractProps(name, await file.text()),
22
+ props: this.extractProps(base, await file.text()),
22
23
  };
23
24
  }
24
25
  /**
25
26
  * Build the file element props from the extracted content.
26
- * - `name` is the basename including extension (e.g. `"array.ts"`).
27
- * - `base` is the basename without extension (e.g. `"array"`) — useful as a title fallback.
27
+ * - `name` is the basename without extension (e.g. `"array"`) — display-ready, used by menus and cards.
28
28
  * - Override to parse `text` into richer elements (content/children/description) and to set
29
29
  * `title` if a confident title is available.
30
30
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelving",
3
- "version": "1.206.0",
3
+ "version": "1.206.1",
4
4
  "author": "Dave Houlbrooke <dave@shax.com>",
5
5
  "repository": {
6
6
  "type": "git",