rspress-plugin-api-extractor 0.9.0 → 0.9.2
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/env.d.ts +0 -1
- package/frontmatter.js +36 -9
- package/package.json +10 -8
package/env.d.ts
CHANGED
|
@@ -99,7 +99,6 @@ interface ImportMetaEnv {
|
|
|
99
99
|
readonly DEV: boolean;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
// biome-ignore lint/correctness/noUnusedVariables: ImportMeta is used by TypeScript but may appear unused to the linter
|
|
103
102
|
interface ImportMeta {
|
|
104
103
|
/**
|
|
105
104
|
* The `import.meta` object contains metadata about the current module. It is a standard
|
package/frontmatter.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
+
import { FrontmatterSource, FrontmatterSourceBlock, FrontmatterSourceSplit } from "@effected/markdown";
|
|
2
3
|
import { Yaml, YamlStringifyOptions } from "@effected/yaml";
|
|
3
4
|
|
|
4
5
|
//#region src/frontmatter.ts
|
|
@@ -6,16 +7,20 @@ import { Yaml, YamlStringifyOptions } from "@effected/yaml";
|
|
|
6
7
|
* Stringify options shared by both emit sites.
|
|
7
8
|
*
|
|
8
9
|
* `lineWidth: 0` disables wrapping so long titles/descriptions/URLs stay on
|
|
9
|
-
* one line
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* one line. The quoting matters for downstream consumers: RSPress parses the
|
|
11
|
+
* emitted frontmatter with js-yaml (YAML 1.1-flavored), where an unquoted
|
|
12
|
+
* ISO timestamp such as `2024-01-15T12:00:00.000Z` decodes to a `Date`
|
|
13
|
+
* object instead of a string. `quoteCompat: "yaml-1.1"` quotes exactly the
|
|
14
|
+
* plain scalars a YAML 1.1 resolver would coerce (timestamps, `yes`/`no`/
|
|
15
|
+
* `on`/`off` booleans, legacy octal/sexagesimal numbers), keeping the
|
|
16
|
+
* decoded representation identical across YAML 1.1 and 1.2 parsers without
|
|
17
|
+
* quoting every value; `quoteStyle: "double"` makes the quotes that do
|
|
18
|
+
* appear double quotes.
|
|
15
19
|
*/
|
|
16
20
|
const STRINGIFY_OPTIONS = YamlStringifyOptions.make({
|
|
17
21
|
lineWidth: 0,
|
|
18
|
-
|
|
22
|
+
quoteCompat: "yaml-1.1",
|
|
23
|
+
quoteStyle: "double"
|
|
19
24
|
});
|
|
20
25
|
const OPEN_DELIMITER = "---";
|
|
21
26
|
const CLOSE_SEARCH = "\n---";
|
|
@@ -48,6 +53,14 @@ const CLOSE_SEARCH = "\n---";
|
|
|
48
53
|
* split treats such input as "no frontmatter" instead. The plugin never emits
|
|
49
54
|
* or consumes language-tagged frontmatter.
|
|
50
55
|
*
|
|
56
|
+
* `@effected/markdown`'s `FrontmatterSource.split` was evaluated for this
|
|
57
|
+
* path and deliberately NOT adopted: its grammar is strict by design (a
|
|
58
|
+
* fence line is exactly `---`, an unterminated block is not frontmatter),
|
|
59
|
+
* while this contract pins gray-matter's `indexOf`-based quirks (`\n----`
|
|
60
|
+
* closes, trailing-space close lines close, a missing close means
|
|
61
|
+
* all-frontmatter). The emission half (`stringifyFrontmatter` /
|
|
62
|
+
* `emitFrontmatterBlock`) does use `FrontmatterSource.join`.
|
|
63
|
+
*
|
|
51
64
|
* Representation parity with js-yaml is verified by characterization tests
|
|
52
65
|
* (`__test__/frontmatter.test.ts`) pinning hashes captured under gray-matter.
|
|
53
66
|
* The one input where the engines disagree — an *unquoted* ISO timestamp
|
|
@@ -123,7 +136,14 @@ function parseFrontmatter(source) {
|
|
|
123
136
|
function stringifyFrontmatter(content, data) {
|
|
124
137
|
const body = content.endsWith("\n") ? content : `${content}\n`;
|
|
125
138
|
if (Object.keys(data).length === 0) return body;
|
|
126
|
-
|
|
139
|
+
const yaml = Effect.runSync(Yaml.stringify(data, STRINGIFY_OPTIONS));
|
|
140
|
+
return FrontmatterSource.join(FrontmatterSourceSplit.make({
|
|
141
|
+
frontmatter: FrontmatterSourceBlock.make({
|
|
142
|
+
format: "yaml",
|
|
143
|
+
value: yaml
|
|
144
|
+
}),
|
|
145
|
+
body
|
|
146
|
+
}));
|
|
127
147
|
}
|
|
128
148
|
/**
|
|
129
149
|
* Serialize a data object to a YAML frontmatter block (fences included, plus
|
|
@@ -142,7 +162,14 @@ function stringifyFrontmatter(content, data) {
|
|
|
142
162
|
* @public
|
|
143
163
|
*/
|
|
144
164
|
function emitFrontmatterBlock(data) {
|
|
145
|
-
|
|
165
|
+
const yaml = Effect.runSync(Yaml.stringify(data, STRINGIFY_OPTIONS));
|
|
166
|
+
return FrontmatterSource.join(FrontmatterSourceSplit.make({
|
|
167
|
+
frontmatter: FrontmatterSourceBlock.make({
|
|
168
|
+
format: "yaml",
|
|
169
|
+
value: yaml
|
|
170
|
+
}),
|
|
171
|
+
body: "\n"
|
|
172
|
+
}));
|
|
146
173
|
}
|
|
147
174
|
|
|
148
175
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rspress-plugin-api-extractor",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "RSPress plugin for generating API documentation from TypeScript API Extractor models",
|
|
6
6
|
"keywords": [
|
|
@@ -40,20 +40,22 @@
|
|
|
40
40
|
"@effect/platform-node": "4.0.0-rc.109",
|
|
41
41
|
"@effected/github": "^0.8.0",
|
|
42
42
|
"@effected/glob": "^0.4.0",
|
|
43
|
+
"@effected/jsonc": "^0.8.0",
|
|
44
|
+
"@effected/markdown": "^0.7.0",
|
|
43
45
|
"@effected/npm": "^0.12.0",
|
|
44
|
-
"@effected/package-json": "^0.
|
|
46
|
+
"@effected/package-json": "^0.12.0",
|
|
45
47
|
"@effected/semver": "^0.5.0",
|
|
46
|
-
"@effected/store": "^0.
|
|
47
|
-
"@effected/tsconfig-json": "^0.6.
|
|
48
|
+
"@effected/store": "^0.5.0",
|
|
49
|
+
"@effected/tsconfig-json": "^0.6.1",
|
|
48
50
|
"@effected/walker": "^0.5.0",
|
|
49
51
|
"@effected/xdg": "^0.3.0",
|
|
50
|
-
"@effected/yaml": "^0.
|
|
52
|
+
"@effected/yaml": "^0.12.0",
|
|
51
53
|
"@microsoft/api-extractor-model": "^7.33.11",
|
|
52
54
|
"@shikijs/twoslash": "^4.4.3",
|
|
53
|
-
"@tsdoctor/bundle": "0.
|
|
54
|
-
"@tsdoctor/model": "0.2.
|
|
55
|
+
"@tsdoctor/bundle": "0.2.0",
|
|
56
|
+
"@tsdoctor/model": "0.2.2",
|
|
55
57
|
"@tsdoctor/registry": "0.2.0",
|
|
56
|
-
"@tsdoctor/snapshot": "0.1.
|
|
58
|
+
"@tsdoctor/snapshot": "0.1.1",
|
|
57
59
|
"@typescript/vfs": "^1.6.4",
|
|
58
60
|
"clsx": "^2.1.1",
|
|
59
61
|
"effect": "4.0.0-rc.109",
|