@rspress/core 2.0.0-beta.20 → 2.0.0-beta.22

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.
@@ -0,0 +1,382 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$ref": "#/definitions/MetaJson",
4
+ "definitions": {
5
+ "MetaJson": {
6
+ "$ref": "#/definitions/SideMeta"
7
+ },
8
+ "SideMeta": {
9
+ "type": "array",
10
+ "items": {
11
+ "$ref": "#/definitions/SideMetaItem"
12
+ }
13
+ },
14
+ "SideMetaItem": {
15
+ "anyOf": [
16
+ {
17
+ "$ref": "#/definitions/FileSideMeta"
18
+ },
19
+ {
20
+ "$ref": "#/definitions/DirSideMeta"
21
+ },
22
+ {
23
+ "$ref": "#/definitions/DividerSideMeta"
24
+ },
25
+ {
26
+ "$ref": "#/definitions/SectionHeaderMeta"
27
+ },
28
+ {
29
+ "$ref": "#/definitions/CustomLinkMeta"
30
+ },
31
+ {
32
+ "type": "string"
33
+ }
34
+ ]
35
+ },
36
+ "FileSideMeta": {
37
+ "type": "object",
38
+ "properties": {
39
+ "type": {
40
+ "type": "string",
41
+ "const": "file"
42
+ },
43
+ "name": {
44
+ "type": "string"
45
+ },
46
+ "label": {
47
+ "type": "string"
48
+ },
49
+ "tag": {
50
+ "type": "string"
51
+ },
52
+ "overviewHeaders": {
53
+ "type": "array",
54
+ "items": {
55
+ "type": "number"
56
+ }
57
+ },
58
+ "context": {
59
+ "type": "string"
60
+ }
61
+ },
62
+ "required": [
63
+ "type",
64
+ "name"
65
+ ],
66
+ "additionalProperties": false
67
+ },
68
+ "DirSideMeta": {
69
+ "type": "object",
70
+ "properties": {
71
+ "type": {
72
+ "type": "string",
73
+ "const": "dir"
74
+ },
75
+ "name": {
76
+ "type": "string"
77
+ },
78
+ "label": {
79
+ "type": "string"
80
+ },
81
+ "tag": {
82
+ "type": "string"
83
+ },
84
+ "overviewHeaders": {
85
+ "type": "array",
86
+ "items": {
87
+ "type": "number"
88
+ }
89
+ },
90
+ "context": {
91
+ "type": "string"
92
+ },
93
+ "collapsible": {
94
+ "type": "boolean"
95
+ },
96
+ "collapsed": {
97
+ "type": "boolean"
98
+ }
99
+ },
100
+ "required": [
101
+ "type",
102
+ "name"
103
+ ],
104
+ "additionalProperties": false
105
+ },
106
+ "DividerSideMeta": {
107
+ "type": "object",
108
+ "properties": {
109
+ "type": {
110
+ "type": "string",
111
+ "const": "divider"
112
+ },
113
+ "dashed": {
114
+ "type": "boolean"
115
+ }
116
+ },
117
+ "required": [
118
+ "type"
119
+ ],
120
+ "additionalProperties": false
121
+ },
122
+ "SectionHeaderMeta": {
123
+ "type": "object",
124
+ "properties": {
125
+ "type": {
126
+ "type": "string",
127
+ "const": "section-header"
128
+ },
129
+ "label": {
130
+ "type": "string"
131
+ },
132
+ "tag": {
133
+ "type": "string"
134
+ }
135
+ },
136
+ "required": [
137
+ "type",
138
+ "label"
139
+ ],
140
+ "additionalProperties": false
141
+ },
142
+ "CustomLinkMeta": {
143
+ "anyOf": [
144
+ {
145
+ "type": "object",
146
+ "properties": {
147
+ "type": {
148
+ "type": "string",
149
+ "const": "custom-link"
150
+ },
151
+ "label": {
152
+ "type": "string"
153
+ },
154
+ "tag": {
155
+ "type": "string"
156
+ },
157
+ "overviewHeaders": {
158
+ "type": "array",
159
+ "items": {
160
+ "type": "number"
161
+ }
162
+ },
163
+ "context": {
164
+ "type": "string"
165
+ },
166
+ "link": {
167
+ "type": "string"
168
+ }
169
+ },
170
+ "required": [
171
+ "type",
172
+ "label",
173
+ "link"
174
+ ],
175
+ "additionalProperties": false
176
+ },
177
+ {
178
+ "type": "object",
179
+ "properties": {
180
+ "type": {
181
+ "type": "string",
182
+ "const": "custom-link"
183
+ },
184
+ "label": {
185
+ "type": "string"
186
+ },
187
+ "tag": {
188
+ "type": "string"
189
+ },
190
+ "overviewHeaders": {
191
+ "type": "array",
192
+ "items": {
193
+ "type": "number"
194
+ }
195
+ },
196
+ "context": {
197
+ "type": "string"
198
+ },
199
+ "link": {
200
+ "type": "string"
201
+ },
202
+ "collapsible": {
203
+ "type": "boolean"
204
+ },
205
+ "collapsed": {
206
+ "type": "boolean"
207
+ },
208
+ "items": {
209
+ "type": "array",
210
+ "items": {
211
+ "anyOf": [
212
+ {
213
+ "type": "object",
214
+ "properties": {
215
+ "type": {
216
+ "type": "string",
217
+ "const": "custom-link"
218
+ },
219
+ "label": {
220
+ "type": "string"
221
+ },
222
+ "tag": {
223
+ "type": "string"
224
+ },
225
+ "overviewHeaders": {
226
+ "type": "array",
227
+ "items": {
228
+ "type": "number"
229
+ }
230
+ },
231
+ "context": {
232
+ "type": "string"
233
+ },
234
+ "link": {
235
+ "type": "string"
236
+ }
237
+ },
238
+ "required": [
239
+ "label",
240
+ "link"
241
+ ],
242
+ "additionalProperties": false
243
+ },
244
+ {
245
+ "type": "object",
246
+ "properties": {
247
+ "type": {
248
+ "type": "string",
249
+ "const": "custom-link"
250
+ },
251
+ "label": {
252
+ "type": "string"
253
+ },
254
+ "tag": {
255
+ "type": "string"
256
+ },
257
+ "overviewHeaders": {
258
+ "type": "array",
259
+ "items": {
260
+ "type": "number"
261
+ }
262
+ },
263
+ "context": {
264
+ "type": "string"
265
+ },
266
+ "link": {
267
+ "type": "string"
268
+ },
269
+ "collapsible": {
270
+ "type": "boolean"
271
+ },
272
+ "collapsed": {
273
+ "type": "boolean"
274
+ },
275
+ "items": {
276
+ "type": "array",
277
+ "items": {
278
+ "$ref": "#/definitions/alias-926151818-564-1152-926151818-0-1986"
279
+ }
280
+ }
281
+ },
282
+ "required": [
283
+ "label",
284
+ "items"
285
+ ],
286
+ "additionalProperties": false
287
+ }
288
+ ]
289
+ }
290
+ }
291
+ },
292
+ "required": [
293
+ "type",
294
+ "label",
295
+ "items"
296
+ ],
297
+ "additionalProperties": false
298
+ }
299
+ ]
300
+ },
301
+ "alias-926151818-564-1152-926151818-0-1986": {
302
+ "anyOf": [
303
+ {
304
+ "type": "object",
305
+ "properties": {
306
+ "type": {
307
+ "type": "string",
308
+ "const": "custom-link"
309
+ },
310
+ "label": {
311
+ "type": "string"
312
+ },
313
+ "tag": {
314
+ "type": "string"
315
+ },
316
+ "overviewHeaders": {
317
+ "type": "array",
318
+ "items": {
319
+ "type": "number"
320
+ }
321
+ },
322
+ "context": {
323
+ "type": "string"
324
+ },
325
+ "link": {
326
+ "type": "string"
327
+ }
328
+ },
329
+ "required": [
330
+ "label",
331
+ "link"
332
+ ],
333
+ "additionalProperties": false
334
+ },
335
+ {
336
+ "type": "object",
337
+ "properties": {
338
+ "type": {
339
+ "type": "string",
340
+ "const": "custom-link"
341
+ },
342
+ "label": {
343
+ "type": "string"
344
+ },
345
+ "tag": {
346
+ "type": "string"
347
+ },
348
+ "overviewHeaders": {
349
+ "type": "array",
350
+ "items": {
351
+ "type": "number"
352
+ }
353
+ },
354
+ "context": {
355
+ "type": "string"
356
+ },
357
+ "link": {
358
+ "type": "string"
359
+ },
360
+ "collapsible": {
361
+ "type": "boolean"
362
+ },
363
+ "collapsed": {
364
+ "type": "boolean"
365
+ },
366
+ "items": {
367
+ "type": "array",
368
+ "items": {
369
+ "$ref": "#/definitions/alias-926151818-564-1152-926151818-0-1986"
370
+ }
371
+ }
372
+ },
373
+ "required": [
374
+ "label",
375
+ "items"
376
+ ],
377
+ "additionalProperties": false
378
+ }
379
+ ]
380
+ }
381
+ }
382
+ }
@@ -0,0 +1,118 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$ref": "#/definitions/NavJson",
4
+ "definitions": {
5
+ "NavJson": {
6
+ "type": "array",
7
+ "items": {
8
+ "$ref": "#/definitions/NavItem"
9
+ }
10
+ },
11
+ "NavItem": {
12
+ "anyOf": [
13
+ {
14
+ "$ref": "#/definitions/NavItemWithLink"
15
+ },
16
+ {
17
+ "$ref": "#/definitions/NavItemWithChildren"
18
+ },
19
+ {
20
+ "$ref": "#/definitions/NavItemWithLinkAndChildren"
21
+ }
22
+ ]
23
+ },
24
+ "NavItemWithLink": {
25
+ "type": "object",
26
+ "properties": {
27
+ "text": {
28
+ "type": "string"
29
+ },
30
+ "link": {
31
+ "type": "string"
32
+ },
33
+ "tag": {
34
+ "type": "string"
35
+ },
36
+ "activeMatch": {
37
+ "type": "string"
38
+ },
39
+ "position": {
40
+ "type": "string",
41
+ "enum": [
42
+ "left",
43
+ "right"
44
+ ]
45
+ }
46
+ },
47
+ "required": [
48
+ "text",
49
+ "link"
50
+ ],
51
+ "additionalProperties": false
52
+ },
53
+ "NavItemWithChildren": {
54
+ "type": "object",
55
+ "properties": {
56
+ "text": {
57
+ "type": "string"
58
+ },
59
+ "tag": {
60
+ "type": "string"
61
+ },
62
+ "items": {
63
+ "type": "array",
64
+ "items": {
65
+ "$ref": "#/definitions/NavItemWithLink"
66
+ }
67
+ },
68
+ "position": {
69
+ "type": "string",
70
+ "enum": [
71
+ "left",
72
+ "right"
73
+ ]
74
+ }
75
+ },
76
+ "required": [
77
+ "items"
78
+ ],
79
+ "additionalProperties": false
80
+ },
81
+ "NavItemWithLinkAndChildren": {
82
+ "type": "object",
83
+ "properties": {
84
+ "text": {
85
+ "type": "string"
86
+ },
87
+ "link": {
88
+ "type": "string"
89
+ },
90
+ "items": {
91
+ "type": "array",
92
+ "items": {
93
+ "$ref": "#/definitions/NavItemWithLink"
94
+ }
95
+ },
96
+ "tag": {
97
+ "type": "string"
98
+ },
99
+ "activeMatch": {
100
+ "type": "string"
101
+ },
102
+ "position": {
103
+ "type": "string",
104
+ "enum": [
105
+ "left",
106
+ "right"
107
+ ]
108
+ }
109
+ },
110
+ "required": [
111
+ "text",
112
+ "link",
113
+ "items"
114
+ ],
115
+ "additionalProperties": false
116
+ }
117
+ }
118
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.0.0-beta.20",
3
+ "version": "2.0.0-beta.22",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -24,35 +24,44 @@
24
24
  "./dist/*": "./dist/*",
25
25
  "./package.json": "./package.json",
26
26
  "./theme": {
27
- "default": "./theme.ts"
27
+ "types": "./dist/theme.d.ts",
28
+ "default": "./dist/theme.js"
29
+ },
30
+ "./runtime": {
31
+ "types": "./dist/runtime.d.ts",
32
+ "default": "./dist/runtime.js"
28
33
  },
29
34
  "./shiki-transformers": {
30
35
  "types": "./dist/shiki-transformers.d.ts",
31
36
  "default": "./dist/shiki-transformers.js"
32
- },
33
- "./runtime": {
34
- "default": "./runtime.ts"
35
37
  }
36
38
  },
37
39
  "main": "./dist/index.js",
38
40
  "module": "./dist/index.js",
39
41
  "types": "./dist/index.d.ts",
42
+ "bin": {
43
+ "rspress": "./bin/rspress.js"
44
+ },
40
45
  "files": [
46
+ "bin",
41
47
  "dist",
42
- "index.html",
43
- "runtime.ts",
44
- "theme.ts"
48
+ "meta-json-schema.json",
49
+ "nav-json-schema.json",
50
+ "static",
51
+ "index.html"
45
52
  ],
46
53
  "dependencies": {
47
54
  "@mdx-js/loader": "^3.1.0",
48
55
  "@mdx-js/mdx": "^3.1.0",
49
56
  "@mdx-js/react": "^3.1.0",
50
- "@rsbuild/core": "~1.4.3",
51
- "@rsbuild/plugin-react": "~1.3.3",
57
+ "@rsbuild/core": "~1.4.8",
58
+ "@rsbuild/plugin-react": "~1.3.4",
52
59
  "@rspress/mdx-rs": "0.6.6",
53
- "@shikijs/rehype": "^3.4.2",
60
+ "@shikijs/rehype": "^3.8.1",
54
61
  "@types/unist": "^3.0.3",
55
62
  "@unhead/react": "^2.0.12",
63
+ "cac": "^6.7.14",
64
+ "chokidar": "^3.6.0",
56
65
  "enhanced-resolve": "5.18.2",
57
66
  "github-slugger": "^2.0.0",
58
67
  "hast-util-from-html": "^2.0.3",
@@ -60,6 +69,7 @@
60
69
  "html-to-text": "^9.0.5",
61
70
  "lodash-es": "^4.17.21",
62
71
  "mdast-util-mdxjs-esm": "^2.0.1",
72
+ "medium-zoom": "1.1.0",
63
73
  "picocolors": "^1.1.1",
64
74
  "react": "^19.1.0",
65
75
  "react-dom": "^19.1.0",
@@ -70,20 +80,19 @@
70
80
  "remark": "^15.0.1",
71
81
  "remark-gfm": "^4.0.1",
72
82
  "rspack-plugin-virtual-module": "1.0.1",
73
- "shiki": "^3.4.2",
83
+ "shiki": "^3.8.1",
74
84
  "tinyglobby": "^0.2.14",
85
+ "tinypool": "^1.1.1",
75
86
  "unified": "^11.0.5",
76
87
  "unist-util-visit": "^5.0.0",
77
88
  "unist-util-visit-children": "^3.0.0",
78
- "@rspress/plugin-last-updated": "2.0.0-beta.20",
79
- "@rspress/plugin-medium-zoom": "2.0.0-beta.20",
80
- "@rspress/runtime": "2.0.0-beta.20",
81
- "@rspress/shared": "2.0.0-beta.20",
82
- "@rspress/theme-default": "2.0.0-beta.20"
89
+ "@rspress/runtime": "2.0.0-beta.22",
90
+ "@rspress/shared": "2.0.0-beta.22",
91
+ "@rspress/theme-default": "2.0.0-beta.22"
83
92
  },
84
93
  "devDependencies": {
85
94
  "@microsoft/api-extractor": "^7.52.8",
86
- "@rslib/core": "0.10.4",
95
+ "@rslib/core": "0.10.6",
87
96
  "@rspress-dev/plugin-preview": "link:../plugin-preview",
88
97
  "@types/hast": "^3.0.4",
89
98
  "@types/html-to-text": "^9.0.4",
@@ -93,6 +102,8 @@
93
102
  "@types/node": "^22.8.1",
94
103
  "@types/react": "^19.1.8",
95
104
  "@types/react-dom": "^19.1.6",
105
+ "execa": "8.0.1",
106
+ "mdast-util-directive": "^3.1.0",
96
107
  "mdast-util-mdx-expression": "^2.0.1",
97
108
  "memfs": "^4.17.2",
98
109
  "p-map": "^7.0.3",
@@ -107,6 +118,7 @@
107
118
  "rsbuild-plugin-publint": "^0.3.2",
108
119
  "rsbuild-plugin-virtual-module": "0.3.0",
109
120
  "tailwindcss": "^3.4.17",
121
+ "ts-json-schema-generator": "^2.4.0",
110
122
  "typescript": "^5.8.2",
111
123
  "vfile": "^6.0.3",
112
124
  "@rspress/config": "1.0.0"
@@ -0,0 +1,5 @@
1
+ /* https://github.com/francoischalifour/medium-zoom#debugging */
2
+ .medium-zoom-overlay,
3
+ .medium-zoom-image--opened {
4
+ z-index: 999;
5
+ }
@@ -0,0 +1,29 @@
1
+ import { useLocation } from '@rspress/runtime';
2
+ import mediumZoom, { type Zoom, type ZoomOptions } from 'medium-zoom';
3
+ import { useEffect } from 'react';
4
+ import './MediumZoom.css';
5
+
6
+ interface Props {
7
+ selector?: string;
8
+ options?: ZoomOptions;
9
+ }
10
+
11
+ export default function MediumZoom(props: Props) {
12
+ const { pathname } = useLocation();
13
+ const { selector = '.rspress-doc img', options = {} } = props;
14
+
15
+ useEffect(() => {
16
+ let zoom: Zoom | undefined;
17
+ const timeout = setTimeout(() => {
18
+ const images = document.querySelectorAll(selector);
19
+ zoom = mediumZoom(images, { ...options, background: 'var(--rp-c-bg)' });
20
+ }, 100);
21
+ return () => {
22
+ clearTimeout(timeout);
23
+ zoom?.detach();
24
+ zoom?.close();
25
+ };
26
+ }, [pathname]);
27
+
28
+ return null;
29
+ }
package/runtime.ts DELETED
@@ -1 +0,0 @@
1
- export * from '@rspress/runtime';
package/theme.ts DELETED
@@ -1 +0,0 @@
1
- export * from '@rspress/theme-default';