@waveso/docs 0.2.0 → 0.3.0

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README.md +490 -75
  3. package/dist/code-frame.d.ts +29 -0
  4. package/dist/code-frame.js +41 -0
  5. package/dist/code-meta.d.ts +48 -0
  6. package/dist/code-meta.js +72 -0
  7. package/dist/docs-content-id.d.ts +19 -0
  8. package/dist/docs-content-id.js +19 -0
  9. package/dist/docs-error.d.ts +2 -57
  10. package/dist/docs-error.js +3 -15
  11. package/dist/errors.d.ts +94 -0
  12. package/dist/errors.js +45 -0
  13. package/dist/next.d.ts +153 -28
  14. package/dist/next.js +65 -33
  15. package/dist/plugins/rehype-capture-toc.js +26 -5
  16. package/dist/plugins/rehype-code-frame.d.ts +10 -0
  17. package/dist/plugins/rehype-code-frame.js +88 -0
  18. package/dist/plugins/rehype-code-language.js +7 -1
  19. package/dist/react/code-runtime.d.ts +14 -0
  20. package/dist/react/code-runtime.js +161 -0
  21. package/dist/react/doc-content.d.ts +39 -2
  22. package/dist/react/doc-content.js +42 -10
  23. package/dist/react/layout.d.ts +44 -0
  24. package/dist/react/layout.js +65 -0
  25. package/dist/react/nav.d.ts +28 -0
  26. package/dist/react/nav.js +70 -0
  27. package/dist/react/nearest-scroll-top.d.ts +45 -0
  28. package/dist/react/nearest-scroll-top.js +44 -0
  29. package/dist/react/next-link.d.ts +34 -0
  30. package/dist/react/next-link.js +30 -0
  31. package/dist/react/next-nav.d.ts +11 -0
  32. package/dist/react/next-nav.js +32 -0
  33. package/dist/react/next-search.d.ts +22 -0
  34. package/dist/react/next-search.js +52 -0
  35. package/dist/react/search-dialog.d.ts +20 -8
  36. package/dist/react/search-dialog.js +15 -10
  37. package/dist/react/shell-labels.d.ts +43 -0
  38. package/dist/react/shell-labels.js +27 -0
  39. package/dist/react/sidebar.d.ts +38 -3
  40. package/dist/react/sidebar.js +104 -12
  41. package/dist/react/skip-link.d.ts +1 -9
  42. package/dist/react/skip-link.js +6 -5
  43. package/dist/react/toc.d.ts +12 -4
  44. package/dist/react/toc.js +18 -7
  45. package/dist/react/youtube.d.ts +31 -5
  46. package/dist/react/youtube.js +76 -54
  47. package/dist/render.d.ts +35 -1
  48. package/dist/render.js +35 -14
  49. package/dist/route-path.d.ts +46 -0
  50. package/dist/route-path.js +51 -0
  51. package/dist/search-index.d.ts +6 -23
  52. package/dist/search-index.js +6 -51
  53. package/dist/sitemap-limit.d.ts +34 -0
  54. package/dist/sitemap-limit.js +37 -0
  55. package/dist/source.d.ts +1 -23
  56. package/dist/source.js +40 -43
  57. package/dist/styles.css +939 -93
  58. package/dist/types.d.ts +11 -2
  59. package/package.json +58 -23
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { StandardSchemaV1 } from "@standard-schema/spec";
2
1
  import { Root } from "hast";
2
+ import { StandardSchemaV1 } from "@standard-schema/spec";
3
3
  //#region src/types.d.ts
4
4
  /**
5
5
  * The frontmatter fields the package itself understands.
@@ -133,7 +133,16 @@ interface DocsMeta {
133
133
  interface TocEntry {
134
134
  id: string;
135
135
  text: string;
136
- /** Heading level, 2–6. `h1` is the page title and is never in the TOC. */
136
+ /**
137
+ * Heading level. `h1` is the page title and is never in the TOC.
138
+ *
139
+ * In practice **2 or 3**: the capture stops at `h3`, measured on a synthetic
140
+ * API reference where taking `h2`–`h6` gave 104 entries against 32. Deeper
141
+ * headings keep their ids and permalinks, so they stay deep-linkable and
142
+ * still open their own sections in search — only the rail entry is dropped.
143
+ * `number` rather than `2 | 3` because `rehypePlugins` is the escape hatch
144
+ * for putting them back, and a literal union would make that a type error.
145
+ */
137
146
  depth: number;
138
147
  children: TocEntry[];
139
148
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@waveso/docs",
3
- "version": "0.2.0",
4
- "description": "Markdown documentation for Next.js parsed to hast in Node at build time, rendered as your own React components, zero parser bytes in the browser",
3
+ "version": "0.3.0",
4
+ "description": "Zero parser bytes in the browser: markdown docs for Next.js, built to hast in Node and rendered as your components",
5
5
  "type": "module",
6
6
  "sideEffects": [
7
7
  "*.css"
@@ -9,15 +9,11 @@
9
9
  "license": "MIT",
10
10
  "author": "Wave (https://github.com/wavedotso)",
11
11
  "keywords": [
12
+ "nextjs",
12
13
  "documentation",
13
- "docs",
14
14
  "markdown",
15
- "remark",
16
- "rehype",
17
- "shiki",
18
- "nextjs",
19
15
  "react-server-components",
20
- "static-site"
16
+ "shiki"
21
17
  ],
22
18
  "repository": {
23
19
  "type": "git",
@@ -35,6 +31,10 @@
35
31
  "types": "./dist/types.d.ts",
36
32
  "default": "./dist/types.js"
37
33
  },
34
+ "./errors": {
35
+ "types": "./dist/errors.d.ts",
36
+ "default": "./dist/errors.js"
37
+ },
38
38
  "./frontmatter": {
39
39
  "types": "./dist/frontmatter.d.ts",
40
40
  "default": "./dist/frontmatter.js"
@@ -59,22 +59,46 @@
59
59
  "browser": null,
60
60
  "default": "./dist/search-index.js"
61
61
  },
62
- "./search-options": {
63
- "types": "./dist/search-options.d.ts",
64
- "default": "./dist/search-options.js"
65
- },
66
- "./markdown-links": {
67
- "types": "./dist/plugins/remark-doc-links.d.ts",
68
- "default": "./dist/plugins/remark-doc-links.js"
69
- },
70
62
  "./next": {
71
63
  "types": "./dist/next.d.ts",
72
64
  "browser": null,
73
65
  "default": "./dist/next.js"
74
66
  },
75
- "./react/*": {
76
- "types": "./dist/react/*.d.ts",
77
- "default": "./dist/react/*.js"
67
+ "./react/callout": {
68
+ "types": "./dist/react/callout.d.ts",
69
+ "default": "./dist/react/callout.js"
70
+ },
71
+ "./react/doc-content": {
72
+ "types": "./dist/react/doc-content.d.ts",
73
+ "default": "./dist/react/doc-content.js"
74
+ },
75
+ "./react/markdown-components": {
76
+ "types": "./dist/react/markdown-components.d.ts",
77
+ "default": "./dist/react/markdown-components.js"
78
+ },
79
+ "./react/next-search": {
80
+ "types": "./dist/react/next-search.d.ts",
81
+ "default": "./dist/react/next-search.js"
82
+ },
83
+ "./react/search-dialog": {
84
+ "types": "./dist/react/search-dialog.d.ts",
85
+ "default": "./dist/react/search-dialog.js"
86
+ },
87
+ "./react/sidebar": {
88
+ "types": "./dist/react/sidebar.d.ts",
89
+ "default": "./dist/react/sidebar.js"
90
+ },
91
+ "./react/skip-link": {
92
+ "types": "./dist/react/skip-link.d.ts",
93
+ "default": "./dist/react/skip-link.js"
94
+ },
95
+ "./react/toc": {
96
+ "types": "./dist/react/toc.d.ts",
97
+ "default": "./dist/react/toc.js"
98
+ },
99
+ "./react/youtube": {
100
+ "types": "./dist/react/youtube.d.ts",
101
+ "default": "./dist/react/youtube.js"
78
102
  }
79
103
  },
80
104
  "files": [
@@ -95,7 +119,6 @@
95
119
  "@standard-schema/spec": "^1.1.0",
96
120
  "@types/hast": "^3.0.5",
97
121
  "@types/mdast": "^4.0.4",
98
- "gray-matter": "^4.0.3",
99
122
  "hast-util-to-jsx-runtime": "^2.3.6",
100
123
  "hast-util-to-string": "^3.0.1",
101
124
  "minisearch": "^7.2.0",
@@ -109,6 +132,7 @@
109
132
  "unified": "^11.0.5",
110
133
  "unist-util-visit": "^5.1.0",
111
134
  "vfile": "^6.0.3",
135
+ "vfile-matter": "^5.0.1",
112
136
  "zod": "^4.4.3"
113
137
  },
114
138
  "peerDependencies": {
@@ -131,15 +155,19 @@
131
155
  "@types/node": "^24.0.0",
132
156
  "@types/react": "^19.2.18",
133
157
  "@types/react-dom": "^19.2.4",
158
+ "@vitest/browser": "4.1.10",
159
+ "@vitest/browser-playwright": "^4.1.10",
160
+ "hast-util-to-html": "^9.0.5",
134
161
  "image-size": "^2.0.2",
135
162
  "jsdom": "^30.0.1",
136
163
  "next": "^16.3.0",
164
+ "playwright": "^1.62.1",
137
165
  "publint": "^0.3.23",
138
166
  "react": "^19.2.3",
139
167
  "react-dom": "^19.2.3",
168
+ "rolldown": "^1.2.4",
140
169
  "tsdown": "^0.22.14",
141
170
  "typescript": "^5.9.3",
142
- "unrun": "^0.3.1",
143
171
  "vitest": "^4.1.10"
144
172
  },
145
173
  "devEngines": {
@@ -156,12 +184,19 @@
156
184
  "lint": "biome check",
157
185
  "lint:fix": "biome check --write",
158
186
  "format": "biome format --write",
159
- "test": "vitest run",
187
+ "test": "vitest run --project node --project dom",
160
188
  "test:watch": "vitest",
161
189
  "check:package": "publint && attw --pack . --ignore-rules no-resolution cjs-resolves-to-esm",
190
+ "check:readme": "node scripts/check-readme.ts",
162
191
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
163
192
  "changeset": "changeset",
164
193
  "version": "changeset version",
165
- "release": "pnpm run build && changeset publish"
194
+ "release": "pnpm run build && changeset publish",
195
+ "test:browser": "vitest run --project browser",
196
+ "test:smoke": "node smoke/check.ts",
197
+ "size": "node scripts/size.ts",
198
+ "build:site": "next build site",
199
+ "dev:site": "next dev site",
200
+ "shoot": "node scripts/shoot.ts"
166
201
  }
167
202
  }