rspress 2.0.0-beta.1 → 2.0.0-beta.11

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/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # Rspress
2
2
 
3
3
  <picture>
4
- <img alt="Rspress Banner" src="https://assets.rspack.dev/rspress/rspress-banner.png">
4
+ <img alt="Rspress Banner" src="https://assets.rspack.rs/rspress/rspress-banner.png">
5
5
  </picture>
6
6
 
7
7
  <h2 align="center">A fast Rsbuild-based static site generator.</h2>
8
8
 
9
9
  ## Getting started
10
10
 
11
- Go to the [Quick start](https://rspress.dev/guide/start/getting-started.html) to get started.
11
+ Go to the [Quick start](https://rspress.rs/guide/start/getting-started.html) to get started.
12
12
 
13
13
  ### License
14
14
 
package/dist/index.js CHANGED
@@ -6,9 +6,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_chokidar__ from "chokidar";
6
6
  import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
7
7
  import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
8
8
  import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__ from "@rspress/shared/constants";
9
- import * as __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__ from "node:child_process";
10
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
11
- var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.1"}');
9
+ var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.11"}');
12
10
  const findConfig = (basePath)=>__WEBPACK_EXTERNAL_MODULE__rspress_shared_constants_70084e62__.DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync);
13
11
  async function loadConfigFile(customConfigFile) {
14
12
  const baseDir = process.cwd();
@@ -30,68 +28,13 @@ function resolveDocRoot(cwd, cliRoot, configRoot) {
30
28
  if (configRoot) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(configRoot) ? configRoot : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(cwd, configRoot);
31
29
  return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(cwd, 'docs');
32
30
  }
33
- async function pathExists(path) {
34
- try {
35
- await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].access(path);
36
- return true;
37
- } catch {
38
- return false;
39
- }
40
- }
41
- const lockfileMap = {
42
- 'package-lock.json': 'npm',
43
- 'yarn.lock': 'yarn',
44
- 'pnpm-lock.yaml': 'pnpm',
45
- 'bun.lockb': 'bun'
46
- };
47
- async function getPackageManager(rootPath) {
48
- let packageManager = 'npm';
49
- for (const file of Object.keys(lockfileMap))if (await pathExists(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(rootPath, file))) {
50
- packageManager = lockfileMap[file];
51
- break;
52
- }
53
- return packageManager;
54
- }
55
- async function getRspressDependencies(rootPath) {
56
- const packageJson = JSON.parse(await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].readFile(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(rootPath, 'package.json'), {
57
- encoding: 'utf-8'
58
- }));
59
- const dependencies = packageJson?.dependencies ? Object.keys(packageJson.dependencies) : [];
60
- const devDependencies = packageJson?.devDependencies ? Object.keys(packageJson.devDependencies) : [];
61
- return dependencies.concat(devDependencies).filter((item)=>item.startsWith('@rspress') || item.startsWith('rspress'));
62
- }
63
- async function update() {
64
- const cwd = process.cwd();
65
- const packageManager = await getPackageManager(cwd);
66
- const rspressDependencies = await getRspressDependencies(cwd);
67
- __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.greet(`Using ${packageManager} to update ${rspressDependencies.join(' ')}`);
68
- if ('npm' === packageManager || 'bun' === packageManager) {
69
- const dependencies = rspressDependencies.map((item)=>`${item}@latest`);
70
- (0, __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__.spawn)(packageManager, [
71
- 'install',
72
- '--save',
73
- ...dependencies
74
- ], {
75
- stdio: 'inherit'
76
- });
77
- } else {
78
- const subCommand = 'yarn' === packageManager ? 'upgrade' : 'update';
79
- (0, __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__.spawn)(packageManager, [
80
- subCommand,
81
- '--latest',
82
- ...rspressDependencies
83
- ], {
84
- stdio: 'inherit'
85
- });
86
- }
87
- }
88
31
  const CONFIG_FILES = [
89
32
  'rspress.config.ts',
90
33
  'rspress.config.js'
91
34
  ];
92
35
  const META_FILE = '_meta.json';
93
36
  const cli = (0, __WEBPACK_EXTERNAL_MODULE_cac__.cac)('rspress').version(package_namespaceObject.i8).help();
94
- const landingMessage = `šŸ”„ Rspress v${package_namespaceObject.i8}\n`;
37
+ const landingMessage = `\u{1F525} Rspress v${package_namespaceObject.i8}\n`;
95
38
  __WEBPACK_EXTERNAL_MODULE__rspress_shared_logger_4374e44a__.logger.greet(landingMessage);
96
39
  const setNodeEnv = (env)=>{
97
40
  process.env.NODE_ENV = env;
@@ -134,7 +77,8 @@ cli.command('[root]', 'start dev server').alias('dev').option('--port [port]', '
134
77
  if ('add' === eventName || 'unlink' === eventName || 'change' === eventName && (CONFIG_FILES.includes(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filepath)) || __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filepath) === META_FILE)) {
135
78
  if (isRestarting) return;
136
79
  isRestarting = true;
137
- console.log(`\n✨ ${eventName} ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].green(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(cwd, filepath))}, dev server will restart...\n`);
80
+ console.log(`
81
+ \u{2728} ${eventName} ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].green(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(cwd, filepath))}, dev server will restart...\n`);
138
82
  await devServer.close();
139
83
  await cliWatcher.close();
140
84
  await startDevServer();
@@ -182,5 +126,4 @@ cli.command('preview [root]').alias('serve').option('--port [port]', 'port numbe
182
126
  port
183
127
  });
184
128
  });
185
- cli.command('update', 'update relevant packages about rspress').action(update);
186
129
  cli.parse();
@@ -0,0 +1,268 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$ref": "#/definitions/MetaJson",
4
+ "definitions": {
5
+ "MetaJson": {
6
+ "anyOf": [
7
+ {
8
+ "type": "array",
9
+ "items": {
10
+ "$ref": "#/definitions/SideMetaItem"
11
+ }
12
+ },
13
+ {
14
+ "type": "array",
15
+ "items": {
16
+ "$ref": "#/definitions/NavItem"
17
+ }
18
+ }
19
+ ]
20
+ },
21
+ "SideMetaItem": {
22
+ "anyOf": [
23
+ {
24
+ "type": "object",
25
+ "properties": {
26
+ "type": {
27
+ "type": "string",
28
+ "const": "file"
29
+ },
30
+ "name": {
31
+ "type": "string"
32
+ },
33
+ "label": {
34
+ "type": "string"
35
+ },
36
+ "tag": {
37
+ "type": "string"
38
+ },
39
+ "overviewHeaders": {
40
+ "type": "array",
41
+ "items": {
42
+ "type": "number"
43
+ }
44
+ },
45
+ "context": {
46
+ "type": "string"
47
+ }
48
+ },
49
+ "required": [
50
+ "type",
51
+ "name"
52
+ ],
53
+ "additionalProperties": false
54
+ },
55
+ {
56
+ "type": "object",
57
+ "properties": {
58
+ "type": {
59
+ "type": "string",
60
+ "const": "dir"
61
+ },
62
+ "name": {
63
+ "type": "string"
64
+ },
65
+ "label": {
66
+ "type": "string"
67
+ },
68
+ "collapsible": {
69
+ "type": "boolean"
70
+ },
71
+ "collapsed": {
72
+ "type": "boolean"
73
+ },
74
+ "tag": {
75
+ "type": "string"
76
+ },
77
+ "overviewHeaders": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "number"
81
+ }
82
+ },
83
+ "context": {
84
+ "type": "string"
85
+ }
86
+ },
87
+ "required": [
88
+ "type",
89
+ "name"
90
+ ],
91
+ "additionalProperties": false
92
+ },
93
+ {
94
+ "type": "object",
95
+ "properties": {
96
+ "type": {
97
+ "type": "string",
98
+ "const": "divider"
99
+ },
100
+ "dashed": {
101
+ "type": "boolean"
102
+ }
103
+ },
104
+ "required": [
105
+ "type"
106
+ ],
107
+ "additionalProperties": false
108
+ },
109
+ {
110
+ "type": "object",
111
+ "properties": {
112
+ "type": {
113
+ "type": "string",
114
+ "const": "section-header"
115
+ },
116
+ "label": {
117
+ "type": "string"
118
+ },
119
+ "tag": {
120
+ "type": "string"
121
+ }
122
+ },
123
+ "required": [
124
+ "type",
125
+ "label"
126
+ ],
127
+ "additionalProperties": false
128
+ },
129
+ {
130
+ "type": "object",
131
+ "properties": {
132
+ "type": {
133
+ "type": "string",
134
+ "const": "custom-link"
135
+ },
136
+ "label": {
137
+ "type": "string"
138
+ },
139
+ "link": {
140
+ "type": "string"
141
+ },
142
+ "context": {
143
+ "type": "string"
144
+ },
145
+ "tag": {
146
+ "type": "string"
147
+ }
148
+ },
149
+ "required": [
150
+ "type",
151
+ "label",
152
+ "link"
153
+ ],
154
+ "additionalProperties": false
155
+ },
156
+ {
157
+ "type": "string"
158
+ }
159
+ ]
160
+ },
161
+ "NavItem": {
162
+ "anyOf": [
163
+ {
164
+ "$ref": "#/definitions/NavItemWithLink"
165
+ },
166
+ {
167
+ "$ref": "#/definitions/NavItemWithChildren"
168
+ },
169
+ {
170
+ "$ref": "#/definitions/NavItemWithLinkAndChildren"
171
+ }
172
+ ]
173
+ },
174
+ "NavItemWithLink": {
175
+ "type": "object",
176
+ "properties": {
177
+ "text": {
178
+ "type": "string"
179
+ },
180
+ "link": {
181
+ "type": "string"
182
+ },
183
+ "tag": {
184
+ "type": "string"
185
+ },
186
+ "activeMatch": {
187
+ "type": "string"
188
+ },
189
+ "position": {
190
+ "type": "string",
191
+ "enum": [
192
+ "left",
193
+ "right"
194
+ ]
195
+ }
196
+ },
197
+ "required": [
198
+ "text",
199
+ "link"
200
+ ],
201
+ "additionalProperties": false
202
+ },
203
+ "NavItemWithChildren": {
204
+ "type": "object",
205
+ "properties": {
206
+ "text": {
207
+ "type": "string"
208
+ },
209
+ "tag": {
210
+ "type": "string"
211
+ },
212
+ "items": {
213
+ "type": "array",
214
+ "items": {
215
+ "$ref": "#/definitions/NavItemWithLink"
216
+ }
217
+ },
218
+ "position": {
219
+ "type": "string",
220
+ "enum": [
221
+ "left",
222
+ "right"
223
+ ]
224
+ }
225
+ },
226
+ "required": [
227
+ "items"
228
+ ],
229
+ "additionalProperties": false
230
+ },
231
+ "NavItemWithLinkAndChildren": {
232
+ "type": "object",
233
+ "properties": {
234
+ "text": {
235
+ "type": "string"
236
+ },
237
+ "link": {
238
+ "type": "string"
239
+ },
240
+ "items": {
241
+ "type": "array",
242
+ "items": {
243
+ "$ref": "#/definitions/NavItemWithLink"
244
+ }
245
+ },
246
+ "tag": {
247
+ "type": "string"
248
+ },
249
+ "activeMatch": {
250
+ "type": "string"
251
+ },
252
+ "position": {
253
+ "type": "string",
254
+ "enum": [
255
+ "left",
256
+ "right"
257
+ ]
258
+ }
259
+ },
260
+ "required": [
261
+ "text",
262
+ "link",
263
+ "items"
264
+ ],
265
+ "additionalProperties": false
266
+ }
267
+ }
268
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rspress",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0-beta.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/web-infra-dev/rspress.git",
@@ -33,24 +33,26 @@
33
33
  "dist",
34
34
  "runtime.ts",
35
35
  "theme.ts",
36
- "config.ts"
36
+ "config.ts",
37
+ "meta-json-schema.json"
37
38
  ],
38
39
  "dependencies": {
39
- "@rsbuild/core": "1.3.9",
40
+ "@rsbuild/core": "~1.3.21",
40
41
  "cac": "^6.7.14",
41
42
  "chokidar": "^3.6.0",
42
43
  "picocolors": "^1.1.1",
43
- "@rspress/core": "2.0.0-beta.1",
44
- "@rspress/shared": "2.0.0-beta.1"
44
+ "@rspress/core": "2.0.0-beta.11",
45
+ "@rspress/shared": "2.0.0-beta.11"
45
46
  },
46
47
  "devDependencies": {
47
- "@microsoft/api-extractor": "^7.52.4",
48
- "@rslib/core": "0.6.5",
48
+ "@microsoft/api-extractor": "^7.52.8",
49
+ "@rslib/core": "0.8.0",
49
50
  "@types/jest": "~29.5.14",
50
- "@types/node": "^18.11.17",
51
- "@types/react": "^18.3.20",
51
+ "@types/node": "^22.8.1",
52
+ "@types/react": "^19.1.6",
52
53
  "rimraf": "^6.0.1",
53
- "rsbuild-plugin-publint": "^0.3.0",
54
+ "rsbuild-plugin-publint": "^0.3.2",
55
+ "ts-json-schema-generator": "^2.4.0",
54
56
  "typescript": "^5.8.2"
55
57
  },
56
58
  "publishConfig": {