Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/en/api/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,13 @@
"collapsed": true,
"collapsible": false,
"items": []
},
{
"label": "extensions",
"link": "/api/rspeedy/rspeedy.resolve.extensions",
"collapsed": true,
"collapsible": false,
"items": []
}
]
},
Expand All @@ -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",
Expand Down
14 changes: 14 additions & 0 deletions docs/en/api/rspeedy/rspeedy.cssloadermodules.localidentname.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

44 changes: 44 additions & 0 deletions docs/en/api/rspeedy/rspeedy.cssmodules.localidentname.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]',
},
},
})
```

51 changes: 51 additions & 0 deletions docs/en/api/rspeedy/rspeedy.resolve.extensions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@lynx-js/rspeedy](./rspeedy.md) &gt; [Resolve](./rspeedy.resolve.md) &gt; [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'],
},
}
```

1 change: 1 addition & 0 deletions docs/en/api/rspeedy/rspeedy.resolve.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export interface Resolve
| [alias?](./rspeedy.resolve.alias.md) | | Record&lt;string, string \| false \| string\[\]&gt; \| undefined | _(Optional)_ Create aliases to <code>import</code> or <code>require</code> 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 <code>paths</code> option in <code>tsconfig.json</code> and the <code>resolve.alias</code> option of Rsbuild. - <code>prefer-tsconfig</code> (default): The <code>paths</code> option in <code>tsconfig.json</code> will take precedence over the <code>resolve.alias</code> option of Rsbuild. - <code>prefer-alias</code>: The <code>resolve.alias</code> option of Rsbuild will take precedence over the <code>paths</code> option in <code>tsconfig.json</code>. |
| [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 | <p>_(Optional)_ Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions.</p><p>Default: <code>['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json', '.cjs']</code></p><p>For example, if importing './index', Rsbuild will try to resolve using the following order:</p><p>- <code>./index.ts</code></p><p>- <code>./index.tsx</code></p><p>- <code>./index.mjs</code></p><p>- <code>./index.js</code></p><p>- <code>./index.jsx</code></p><p>- <code>./index.json</code></p><p>- <code>./index.cjs</code></p> |

63 changes: 63 additions & 0 deletions docs/en/api/rspeedy/rspeedy.server.compress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@lynx-js/rspeedy](./rspeedy.md) &gt; [Server](./rspeedy.server.md) &gt; [compress](./rspeedy.server.compress.md)

## Server.compress property

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.

**Signature:**

```typescript
compress?: boolean | CompressOptions | undefined;
```

## Example 1

To disable the gzip compression, set compress to false:

```js
export default {
server: {
compress: false,
},
}
```

## Example 2

Compress if it starts with /foo

```js
export default {
server: {
compress: {
filter: (req) => {
if (req.url?.includes('/foo')) {
return false;
}
return true;
},
},
},
}
```

## Example 3

set level of zlib compression

```js
export default {
server: {
compress: {
level: 6,
},
},
}
```

35 changes: 35 additions & 0 deletions docs/en/api/rspeedy/rspeedy.server.cors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@lynx-js/rspeedy](./rspeedy.md) &gt; [Server](./rspeedy.server.md) &gt; [cors](./rspeedy.server.cors.md)

## Server.cors property

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.

**Signature:**

```typescript
cors?: ServerConfig['cors'] | undefined;
```

## Example


```js
export default {
server: {
cors: {
origin: 'https://example.com',
},
},
}
```

2 changes: 2 additions & 0 deletions docs/en/api/rspeedy/rspeedy.server.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface Server
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [base?](./rspeedy.server.base.md) | | string \| undefined | _(Optional)_ Configure the base path of the server. |
| [compress?](./rspeedy.server.compress.md) | | boolean \| CompressOptions \| undefined | <p>_(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.</p><p>Default: true</p><p>See [Rsbuild - server.compress](https://rsbuild.rs/config/server/compress) for details.</p> |
| [cors?](./rspeedy.server.cors.md) | | ServerConfig\['cors'\] \| undefined | <p>_(Optional)_ Configure CORS for the dev server or preview server.</p><p>- Set to an object to enable CORS with the specified options.</p><p>- Set to <code>true</code> to enable CORS with the default options (allows all origins, not recommended).</p><p>- Set to <code>false</code> to disable CORS.</p><p>See [Rsbuild - server.cors](https://rsbuild.rs/config/server/cors) for details.</p> |
| [headers?](./rspeedy.server.headers.md) | | Record&lt;string, string \| string\[\]&gt; \| 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. |
Expand Down
33 changes: 21 additions & 12 deletions docs/zh/api/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,13 @@
"collapsed": true,
"collapsible": false,
"items": []
},
{
"label": "extensions",
"link": "/api/rspeedy/rspeedy.resolve.extensions",
"collapsed": true,
"collapsible": false,
"items": []
}
]
},
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
14 changes: 14 additions & 0 deletions docs/zh/api/rspeedy/rspeedy.cssloadermodules.localidentname.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

44 changes: 44 additions & 0 deletions docs/zh/api/rspeedy/rspeedy.cssmodules.localidentname.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]',
},
},
})
```

Loading