From 513640c3109ec5913b306eaced4636eb90d0e15b Mon Sep 17 00:00:00 2001
From: Qingyu Wang <40660121+colinaaa@users.noreply.github.com>
Date: Sun, 28 Sep 2025 16:58:23 +0800
Subject: [PATCH] docs: update lynx-stack docs
Change-Id: I521dc3249f3da75786108b329bf59052704e873d
---
docs/en/api/_meta.json | 21 +++++++
...rspeedy.cssloadermodules.localidentname.md | 14 +++++
.../rspeedy.cssmodules.localidentname.md | 44 +++++++++++++
.../api/rspeedy/rspeedy.resolve.extensions.md | 51 +++++++++++++++
docs/en/api/rspeedy/rspeedy.resolve.md | 1 +
.../en/api/rspeedy/rspeedy.server.compress.md | 63 +++++++++++++++++++
docs/en/api/rspeedy/rspeedy.server.cors.md | 35 +++++++++++
docs/en/api/rspeedy/rspeedy.server.md | 2 +
docs/zh/api/_meta.json | 33 ++++++----
...rspeedy.cssloadermodules.localidentname.md | 14 +++++
.../rspeedy.cssmodules.localidentname.md | 44 +++++++++++++
.../api/rspeedy/rspeedy.resolve.extensions.md | 51 +++++++++++++++
docs/zh/api/rspeedy/rspeedy.resolve.md | 1 +
.../zh/api/rspeedy/rspeedy.server.compress.md | 63 +++++++++++++++++++
docs/zh/api/rspeedy/rspeedy.server.cors.md | 35 +++++++++++
docs/zh/api/rspeedy/rspeedy.server.md | 2 +
16 files changed, 462 insertions(+), 12 deletions(-)
create mode 100644 docs/en/api/rspeedy/rspeedy.resolve.extensions.md
create mode 100644 docs/en/api/rspeedy/rspeedy.server.compress.md
create mode 100644 docs/en/api/rspeedy/rspeedy.server.cors.md
create mode 100644 docs/zh/api/rspeedy/rspeedy.resolve.extensions.md
create mode 100644 docs/zh/api/rspeedy/rspeedy.server.compress.md
create mode 100644 docs/zh/api/rspeedy/rspeedy.server.cors.md
diff --git a/docs/en/api/_meta.json b/docs/en/api/_meta.json
index b9cca4be8..497ee964b 100644
--- a/docs/en/api/_meta.json
+++ b/docs/en/api/_meta.json
@@ -465,6 +465,13 @@
"collapsed": true,
"collapsible": false,
"items": []
+ },
+ {
+ "label": "extensions",
+ "link": "/api/rspeedy/rspeedy.resolve.extensions",
+ "collapsed": true,
+ "collapsible": false,
+ "items": []
}
]
},
@@ -481,6 +488,20 @@
"collapsible": false,
"items": []
},
+ {
+ "label": "compress",
+ "link": "/api/rspeedy/rspeedy.server.compress",
+ "collapsed": true,
+ "collapsible": false,
+ "items": []
+ },
+ {
+ "label": "cors",
+ "link": "/api/rspeedy/rspeedy.server.cors",
+ "collapsed": true,
+ "collapsible": false,
+ "items": []
+ },
{
"label": "headers",
"link": "/api/rspeedy/rspeedy.server.headers",
diff --git a/docs/en/api/rspeedy/rspeedy.cssloadermodules.localidentname.md b/docs/en/api/rspeedy/rspeedy.cssloadermodules.localidentname.md
index 540d4b4ec..a5b21b44d 100644
--- a/docs/en/api/rspeedy/rspeedy.cssloadermodules.localidentname.md
+++ b/docs/en/api/rspeedy/rspeedy.cssloadermodules.localidentname.md
@@ -14,5 +14,19 @@ localIdentName?: string | undefined;
## Remarks
+The default value is `'[local]-[hash:base64:6]'` which combines the original class name with a 6-character hash.
+
+Available placeholders:
+
+- `[local]`: Original class name
+
+- `[hash]`: Hash of the class name
+
+- `[path]`: File path
+
+- `[name]`: File name
+
+- `[ext]`: File extension
+
See [css-loader\#localIdentName](https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#localIdentName) for details.
diff --git a/docs/en/api/rspeedy/rspeedy.cssmodules.localidentname.md b/docs/en/api/rspeedy/rspeedy.cssmodules.localidentname.md
index f0801c446..9f80dd81d 100644
--- a/docs/en/api/rspeedy/rspeedy.cssmodules.localidentname.md
+++ b/docs/en/api/rspeedy/rspeedy.cssmodules.localidentname.md
@@ -14,5 +14,49 @@ localIdentName?: string | undefined;
## Remarks
+The default value is `'[local]-[hash:base64:6]'` which combines the original class name with a 6-character hash.
+
+Available placeholders:
+
+- `[local]`: Original class name
+
+- `[hash]`: Hash of the class name
+
+- `[path]`: File path
+
+- `[name]`: File name
+
+- `[ext]`: File extension
+
See [css-loader\#localIdentName](https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#localIdentName) for details.
+## Example 1
+
+Use only hash for shorter class names:
+
+```js
+import { defineConfig } from '@lynx-js/rspeedy'
+export default defineConfig({
+ output: {
+ cssModules: {
+ localIdentName: '[hash:base64:8]',
+ },
+ },
+})
+```
+
+## Example 2
+
+Include file name for debugging:
+
+```js
+import { defineConfig } from '@lynx-js/rspeedy'
+export default defineConfig({
+ output: {
+ cssModules: {
+ localIdentName: '[name]__[local]--[hash:base64:5]',
+ },
+ },
+})
+```
+
diff --git a/docs/en/api/rspeedy/rspeedy.resolve.extensions.md b/docs/en/api/rspeedy/rspeedy.resolve.extensions.md
new file mode 100644
index 000000000..d5b185eeb
--- /dev/null
+++ b/docs/en/api/rspeedy/rspeedy.resolve.extensions.md
@@ -0,0 +1,51 @@
+
+
+[Home](./index.md) > [@lynx-js/rspeedy](./rspeedy.md) > [Resolve](./rspeedy.resolve.md) > [extensions](./rspeedy.resolve.extensions.md)
+
+## Resolve.extensions property
+
+Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions.
+
+Default: `['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json', '.cjs']`
+
+For example, if importing './index', Rsbuild will try to resolve using the following order:
+
+- `./index.ts`
+
+- `./index.tsx`
+
+- `./index.mjs`
+
+- `./index.js`
+
+- `./index.jsx`
+
+- `./index.json`
+
+- `./index.cjs`
+
+**Signature:**
+
+```typescript
+extensions?: string[] | undefined;
+```
+
+## Remarks
+
+The difference between `resolve.extensions` and `tools.rspack.resolve.extensions`:
+
+`resolve.extensions`: Completely overrides Rspeedy's default resolution.
+
+`tools.rspack.resolve.extensions`: Merges with the default configuration using \[`webpack-merge`\](https://github.com/survivejs/webpack-merge).
+
+## Example
+
+
+```js
+export default {
+ resolve: {
+ extensions: ['.ts', '.tsx', '.js'],
+ },
+}
+```
+
diff --git a/docs/en/api/rspeedy/rspeedy.resolve.md b/docs/en/api/rspeedy/rspeedy.resolve.md
index 84f34401c..7253f1039 100644
--- a/docs/en/api/rspeedy/rspeedy.resolve.md
+++ b/docs/en/api/rspeedy/rspeedy.resolve.md
@@ -19,4 +19,5 @@ export interface Resolve
| [alias?](./rspeedy.resolve.alias.md) | | Record<string, string \| false \| string\[\]> \| undefined | _(Optional)_ Create aliases to import or require certain modules more easily. |
| [aliasStrategy?](./rspeedy.resolve.aliasstrategy.md) | | 'prefer-tsconfig' \| 'prefer-alias' \| undefined | _(Optional)_ Set the strategy for path alias resolution, to control the priority relationship between the paths option in tsconfig.json and the resolve.alias option of Rsbuild. - prefer-tsconfig (default): The paths option in tsconfig.json will take precedence over the resolve.alias option of Rsbuild. - prefer-alias: The resolve.alias option of Rsbuild will take precedence over the paths option in tsconfig.json. |
| [dedupe?](./rspeedy.resolve.dedupe.md) | | string\[\] \| undefined | _(Optional)_ Force to resolve the specified packages from project root, which is useful for deduplicating packages and reducing the bundle size. |
+| [extensions?](./rspeedy.resolve.extensions.md) | | string\[\] \| undefined |
_(Optional)_ Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions.
Default: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json', '.cjs']
For example, if importing './index', Rsbuild will try to resolve using the following order:
- ./index.ts
- ./index.tsx
- ./index.mjs
- ./index.js
- ./index.jsx
- ./index.json
- ./index.cjs
_(Optional)_ Configure whether to enable [gzip compression](https://developer.mozilla.org/en-US/docs/Glossary/gzip_compression) for static assets served by the dev server or preview server.
Default: true
See [Rsbuild - server.compress](https://rsbuild.rs/config/server/compress) for details.
| +| [cors?](./rspeedy.server.cors.md) | | ServerConfig\['cors'\] \| undefined |_(Optional)_ Configure CORS for the dev server or preview server.
- Set to an object to enable CORS with the specified options.
- Set to true to enable CORS with the default options (allows all origins, not recommended).
- Set to false to disable CORS.
See [Rsbuild - server.cors](https://rsbuild.rs/config/server/cors) for details.
| | [headers?](./rspeedy.server.headers.md) | | Record<string, string \| string\[\]> \| undefined | _(Optional)_ Adds headers to all responses. | | [host?](./rspeedy.server.host.md) | | string \| undefined | _(Optional)_ Specify the host that the Rspeedy Server listens to. | | [port?](./rspeedy.server.port.md) | | number \| undefined | _(Optional)_ Specify the port that the Rspeedy Server listens to. | diff --git a/docs/zh/api/_meta.json b/docs/zh/api/_meta.json index 90409407a..497ee964b 100644 --- a/docs/zh/api/_meta.json +++ b/docs/zh/api/_meta.json @@ -465,6 +465,13 @@ "collapsed": true, "collapsible": false, "items": [] + }, + { + "label": "extensions", + "link": "/api/rspeedy/rspeedy.resolve.extensions", + "collapsed": true, + "collapsible": false, + "items": [] } ] }, @@ -481,6 +488,20 @@ "collapsible": false, "items": [] }, + { + "label": "compress", + "link": "/api/rspeedy/rspeedy.server.compress", + "collapsed": true, + "collapsible": false, + "items": [] + }, + { + "label": "cors", + "link": "/api/rspeedy/rspeedy.server.cors", + "collapsed": true, + "collapsible": false, + "items": [] + }, { "label": "headers", "link": "/api/rspeedy/rspeedy.server.headers", @@ -1276,18 +1297,6 @@ "collapsible": true, "collapsed": true }, - { - "type": "file", - "name": "lynx-native-api/lynx-load-meta", - "label": "LynxLoadMeta", - "overviewHeaders": [] - }, - { - "type": "file", - "name": "lynx-native-api/lynx-update-meta", - "label": "LynxUpdateMeta", - "overviewHeaders": [] - }, { "type": "dir", "name": "lynx-native-api/lynx-media-resource-fetcher", diff --git a/docs/zh/api/rspeedy/rspeedy.cssloadermodules.localidentname.md b/docs/zh/api/rspeedy/rspeedy.cssloadermodules.localidentname.md index 540d4b4ec..a5b21b44d 100644 --- a/docs/zh/api/rspeedy/rspeedy.cssloadermodules.localidentname.md +++ b/docs/zh/api/rspeedy/rspeedy.cssloadermodules.localidentname.md @@ -14,5 +14,19 @@ localIdentName?: string | undefined; ## Remarks +The default value is `'[local]-[hash:base64:6]'` which combines the original class name with a 6-character hash. + +Available placeholders: + +- `[local]`: Original class name + +- `[hash]`: Hash of the class name + +- `[path]`: File path + +- `[name]`: File name + +- `[ext]`: File extension + See [css-loader\#localIdentName](https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#localIdentName) for details. diff --git a/docs/zh/api/rspeedy/rspeedy.cssmodules.localidentname.md b/docs/zh/api/rspeedy/rspeedy.cssmodules.localidentname.md index f0801c446..9f80dd81d 100644 --- a/docs/zh/api/rspeedy/rspeedy.cssmodules.localidentname.md +++ b/docs/zh/api/rspeedy/rspeedy.cssmodules.localidentname.md @@ -14,5 +14,49 @@ localIdentName?: string | undefined; ## Remarks +The default value is `'[local]-[hash:base64:6]'` which combines the original class name with a 6-character hash. + +Available placeholders: + +- `[local]`: Original class name + +- `[hash]`: Hash of the class name + +- `[path]`: File path + +- `[name]`: File name + +- `[ext]`: File extension + See [css-loader\#localIdentName](https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#localIdentName) for details. +## Example 1 + +Use only hash for shorter class names: + +```js +import { defineConfig } from '@lynx-js/rspeedy' +export default defineConfig({ + output: { + cssModules: { + localIdentName: '[hash:base64:8]', + }, + }, +}) +``` + +## Example 2 + +Include file name for debugging: + +```js +import { defineConfig } from '@lynx-js/rspeedy' +export default defineConfig({ + output: { + cssModules: { + localIdentName: '[name]__[local]--[hash:base64:5]', + }, + }, +}) +``` + diff --git a/docs/zh/api/rspeedy/rspeedy.resolve.extensions.md b/docs/zh/api/rspeedy/rspeedy.resolve.extensions.md new file mode 100644 index 000000000..d5b185eeb --- /dev/null +++ b/docs/zh/api/rspeedy/rspeedy.resolve.extensions.md @@ -0,0 +1,51 @@ + + +[Home](./index.md) > [@lynx-js/rspeedy](./rspeedy.md) > [Resolve](./rspeedy.resolve.md) > [extensions](./rspeedy.resolve.extensions.md) + +## Resolve.extensions property + +Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions. + +Default: `['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json', '.cjs']` + +For example, if importing './index', Rsbuild will try to resolve using the following order: + +- `./index.ts` + +- `./index.tsx` + +- `./index.mjs` + +- `./index.js` + +- `./index.jsx` + +- `./index.json` + +- `./index.cjs` + +**Signature:** + +```typescript +extensions?: string[] | undefined; +``` + +## Remarks + +The difference between `resolve.extensions` and `tools.rspack.resolve.extensions`: + +`resolve.extensions`: Completely overrides Rspeedy's default resolution. + +`tools.rspack.resolve.extensions`: Merges with the default configuration using \[`webpack-merge`\](https://github.com/survivejs/webpack-merge). + +## Example + + +```js +export default { + resolve: { + extensions: ['.ts', '.tsx', '.js'], + }, +} +``` + diff --git a/docs/zh/api/rspeedy/rspeedy.resolve.md b/docs/zh/api/rspeedy/rspeedy.resolve.md index 84f34401c..7253f1039 100644 --- a/docs/zh/api/rspeedy/rspeedy.resolve.md +++ b/docs/zh/api/rspeedy/rspeedy.resolve.md @@ -19,4 +19,5 @@ export interface Resolve | [alias?](./rspeedy.resolve.alias.md) | | Record<string, string \| false \| string\[\]> \| undefined | _(Optional)_ Create aliases toimport or require certain modules more easily. |
| [aliasStrategy?](./rspeedy.resolve.aliasstrategy.md) | | 'prefer-tsconfig' \| 'prefer-alias' \| undefined | _(Optional)_ Set the strategy for path alias resolution, to control the priority relationship between the paths option in tsconfig.json and the resolve.alias option of Rsbuild. - prefer-tsconfig (default): The paths option in tsconfig.json will take precedence over the resolve.alias option of Rsbuild. - prefer-alias: The resolve.alias option of Rsbuild will take precedence over the paths option in tsconfig.json. |
| [dedupe?](./rspeedy.resolve.dedupe.md) | | string\[\] \| undefined | _(Optional)_ Force to resolve the specified packages from project root, which is useful for deduplicating packages and reducing the bundle size. |
+| [extensions?](./rspeedy.resolve.extensions.md) | | string\[\] \| undefined | _(Optional)_ Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions.
Default: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json', '.cjs']
For example, if importing './index', Rsbuild will try to resolve using the following order:
- ./index.ts
- ./index.tsx
- ./index.mjs
- ./index.js
- ./index.jsx
- ./index.json
- ./index.cjs
_(Optional)_ Configure whether to enable [gzip compression](https://developer.mozilla.org/en-US/docs/Glossary/gzip_compression) for static assets served by the dev server or preview server.
Default: true
See [Rsbuild - server.compress](https://rsbuild.rs/config/server/compress) for details.
| +| [cors?](./rspeedy.server.cors.md) | | ServerConfig\['cors'\] \| undefined |_(Optional)_ Configure CORS for the dev server or preview server.
- Set to an object to enable CORS with the specified options.
- Set to true to enable CORS with the default options (allows all origins, not recommended).
- Set to false to disable CORS.
See [Rsbuild - server.cors](https://rsbuild.rs/config/server/cors) for details.
| | [headers?](./rspeedy.server.headers.md) | | Record<string, string \| string\[\]> \| undefined | _(Optional)_ Adds headers to all responses. | | [host?](./rspeedy.server.host.md) | | string \| undefined | _(Optional)_ Specify the host that the Rspeedy Server listens to. | | [port?](./rspeedy.server.port.md) | | number \| undefined | _(Optional)_ Specify the port that the Rspeedy Server listens to. |