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
14 changes: 14 additions & 0 deletions api-reports/rspeedy.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@
}
]
},
{
"text": "hmr",
"link": "api/rspeedy/rspeedy.dev.hmr",
"collapsed": true,
"collapsible": false,
"items": []
},
{
"text": "liveReload",
"link": "api/rspeedy/rspeedy.dev.livereload",
"collapsed": true,
"collapsible": false,
"items": []
},
{
"text": "progressBar",
"link": "api/rspeedy/rspeedy.dev.progressbar",
Expand Down
4 changes: 2 additions & 2 deletions docs/en/api/rspeedy/rspeedy.createrspeedy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ The `createRspeedy` method can let you create a Rspeedy instance and you can cus
**Signature:**

```typescript
export declare function createRspeedy({ cwd, rspeedyConfig, loadEnv }: CreateRspeedyOptions): Promise<RspeedyInstance>;
export declare function createRspeedy({ cwd, rspeedyConfig, loadEnv, environment }: CreateRspeedyOptions): Promise<RspeedyInstance>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| { cwd, rspeedyConfig, loadEnv } | [CreateRspeedyOptions](./rspeedy.createrspeedyoptions.md) | |
| { cwd, rspeedyConfig, loadEnv, environment } | [CreateRspeedyOptions](./rspeedy.createrspeedyoptions.md) | |

**Returns:**

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

[Home](./index.md) &gt; [@lynx-js/rspeedy](./rspeedy.md) &gt; [CreateRspeedyOptions](./rspeedy.createrspeedyoptions.md) &gt; [environment](./rspeedy.createrspeedyoptions.environment.md)

## CreateRspeedyOptions.environment property

Only build specified environments. For example, passing `['lynx']` will only build the `lynx` environment. If not specified or passing an empty array, all environments will be built.

**Signature:**

```typescript
environment?: CreateRsbuildOptions['environment'];
```
1 change: 1 addition & 0 deletions docs/en/api/rspeedy/rspeedy.createrspeedyoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface CreateRspeedyOptions
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [cwd?](./rspeedy.createrspeedyoptions.cwd.md) | | string | _(Optional)_ The root path of the current build. |
| [environment?](./rspeedy.createrspeedyoptions.environment.md) | | CreateRsbuildOptions\['environment'\] | _(Optional)_ Only build specified environments. For example, passing <code>['lynx']</code> will only build the <code>lynx</code> environment. If not specified or passing an empty array, all environments will be built. |
| [loadEnv?](./rspeedy.createrspeedyoptions.loadenv.md) | | CreateRsbuildOptions\['loadEnv'\] | _(Optional)_ Rspeedy automatically loads the .env file by default, utilizing the \[Rsbuild API\](https://rsbuild.dev/api/javascript-api/core\#load-env-variables). You can use the environment variables defined in the .env file within your code by accessing them via <code>import.meta.env.FOO</code> or <code>process.env.Foo</code>. |
| [rspeedyConfig?](./rspeedy.createrspeedyoptions.rspeedyconfig.md) | | [Config](./rspeedy.config.md) | _(Optional)_ The config of Rspeedy. |

51 changes: 51 additions & 0 deletions docs/en/api/rspeedy/rspeedy.dev.hmr.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; [Dev](./rspeedy.dev.md) &gt; [hmr](./rspeedy.dev.hmr.md)

## Dev.hmr property

Whether to enable Hot Module Replacement (HMR).

**Signature:**

```typescript
hmr?: boolean | undefined;
```

## Remarks

Defaults to `true`<!-- -->.

By default, Rspeedy uses HMR as the preferred method to update modules. If HMR is disabled or cannot be used in certain scenarios, it will automatically fallback to [Dev.liveReload](./rspeedy.dev.livereload.md)<!-- -->.

To completely disable both HMR and live reload, set both `dev.hmr` and `dev.liveReload` to `false`<!-- -->. Then, no WebSocket requests will be made to the dev server on the page, and the page will not automatically refresh when file changes.

## Example 1

Disable HMR:

```js
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
dev: {
hmr: false,
},
})
```

## Example 2

Disable both HMR and live reload:

```js
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
dev: {
hmr: false,
liveReload: false,
},
})
```

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

[Home](./index.md) &gt; [@lynx-js/rspeedy](./rspeedy.md) &gt; [Dev](./rspeedy.dev.md) &gt; [liveReload](./rspeedy.dev.livereload.md)

## Dev.liveReload property

Whether to enable live reload functionality.

Defaults to `true`<!-- -->.

Live reload is used as a fallback when [Dev.hmr](./rspeedy.dev.hmr.md) is disabled or cannot be used in certain scenarios. When enabled, the page will automatically refresh when source files are changed.

To completely disable both HMR and live reload, set both `dev.hmr` and `dev.liveReload` to `false`<!-- -->. Then, no WebSocket requests will be made to the dev server on the page, and the page will not automatically refresh when file changes.

**Signature:**

```typescript
liveReload?: boolean | undefined;
```

## Example 1

Disable live reload:

```js
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
dev: {
liveReload: false,
},
})
```

## Example 2

Disable both HMR and live reload:

```js
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
dev: {
hmr: false,
liveReload: false,
},
})
```

2 changes: 2 additions & 0 deletions docs/en/api/rspeedy/rspeedy.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export interface Dev
| --- | --- | --- | --- |
| [assetPrefix?](./rspeedy.dev.assetprefix.md) | | string \| boolean \| undefined | _(Optional)_ The [Dev.assetPrefix](./rspeedy.dev.assetprefix.md) is used to set the URL prefix for static assets during development. |
| [client?](./rspeedy.dev.client.md) | | [Client](./rspeedy.devclient.md) \| undefined | _(Optional)_ Configuration of the development client. |
| [hmr?](./rspeedy.dev.hmr.md) | | boolean \| undefined | _(Optional)_ Whether to enable Hot Module Replacement (HMR). |
| [liveReload?](./rspeedy.dev.livereload.md) | | boolean \| undefined | <p>_(Optional)_ Whether to enable live reload functionality.</p><p>Defaults to <code>true</code>.</p><p>Live reload is used as a fallback when [Dev.hmr](./rspeedy.dev.hmr.md) is disabled or cannot be used in certain scenarios. When enabled, the page will automatically refresh when source files are changed.</p><p>To completely disable both HMR and live reload, set both <code>dev.hmr</code> and <code>dev.liveReload</code> to <code>false</code>. Then, no WebSocket requests will be made to the dev server on the page, and the page will not automatically refresh when file changes.</p> |
| [progressBar?](./rspeedy.dev.progressbar.md) | | boolean \| { id?: string; } \| undefined | <p>_(Optional)_ Whether to display progress bar during compilation.</p><p>Defaults to <code>true</code>.</p> |
| [watchFiles?](./rspeedy.dev.watchfiles.md) | | WatchFiles \| WatchFiles\[\] \| undefined | _(Optional)_ Watch specified files and directories for changes. When a file change is detected, it can trigger a page reload or restart the dev server. |
| [writeToDisk?](./rspeedy.dev.writetodisk.md) | | boolean \| ((filename: string) =&gt; boolean) \| undefined | _(Optional)_ Used to control whether the build artifacts of the development environment are written to the disk. |
Expand Down
2 changes: 1 addition & 1 deletion docs/en/api/rspeedy/rspeedy.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default defineConfig({

| Function | Description |
| --- | --- |
| [createRspeedy({ cwd, rspeedyConfig, loadEnv })](./rspeedy.createrspeedy.md) | The <code>createRspeedy</code> method can let you create a Rspeedy instance and you can customize the build or development process in Node.js Runtime. |
| [createRspeedy({ cwd, rspeedyConfig, loadEnv, environment })](./rspeedy.createrspeedy.md) | The <code>createRspeedy</code> method can let you create a Rspeedy instance and you can customize the build or development process in Node.js Runtime. |
| [defineConfig(config)](./rspeedy.defineconfig.md) | The <code>defineConfig</code> method is a helper function used to get TypeScript intellisense. |
| [loadConfig(loadConfigOptions)](./rspeedy.loadconfig.md) | Load the build config by the config path. |
| [mergeRspeedyConfig(configs)](./rspeedy.mergerspeedyconfig.md) | Merge multiple Rspeedy configuration objects. |
Expand Down
26 changes: 21 additions & 5 deletions docs/en/rspeedy/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@ Just like [Rush](https://rushstack.io/), Rspeedy implements a "version selector"

## Using Node.js TypeScript support

If the version of Node.js you are using supports the [--experimental-transform-types](https://nodejs.org/api/cli.html#--experimental-transform-types)(v22.7.0) or [--experimental-strip-types](https://nodejs.org/api/cli.html#--experimental-strip-types)(v22.6.0) flag, you can use the built-in TS transformation of Node.js.
If the version of Node.js you are using supports TypeScript:

1. Node.js >= v23.6
1. Node.js >= v22.6 with [--experimental-strip-types](https://nodejs.org/api/cli.html#--experimental-strip-types)
1. Node.js >= v22.7 with [--experimental-transform-types](https://nodejs.org/api/cli.html#--experimental-transform-types)

you can use the built-in TS transformation of Node.js.

```json title="package.json"
{
"build": "NODE_OPTIONS=--experimental-transform-types rspeedy build"
}
```

See [Node.js - TypeScript](https://nodejs.org/api/typescript.html) for more details.

## rspeedy -h

To view all available CLI commands, run the following command in the project directory:
Expand Down Expand Up @@ -64,8 +72,11 @@ The `rspeedy dev` command is used to start a local dev server and compile the so
Usage: rspeedy dev [options]

Options:
-c --config <config> specify the configuration file, can be a relative or absolute path
-h, --help display help for command
-b --base <base> specify the base path of the server
-c --config <config> specify the configuration file, can be a relative or absolute path
--env-mode <mode> specify the env mode to load the .env.[mode] file
--environment <name...> specify the name of environment to build
-h, --help display help for command
```

The dev server will restart automatically when the content of the configuration file is modified.
Expand All @@ -80,8 +91,10 @@ The `rspeedy build` command will build the outputs for production in the `dist/`
Usage: rspeedy build [options]

Options:
-c --config <config> specify the configuration file, can be a relative or absolute path
-h, --help display help for command
-c --config <config> specify the configuration file, can be a relative or absolute path
--env-mode <mode> specify the env mode to load the .env.[mode] file
--environment <name...> specify the name of environment to build
-h, --help display help for command
```

## rspeedy preview
Expand All @@ -94,7 +107,9 @@ The `rspeedy preview` command is used to preview the production build outputs lo
Usage: rspeedy preview [options]

Options:
-b --base <base> specify the base path of the server
-c --config <config> specify the configuration file, can be a relative or absolute path
--env-mode <mode> specify the env mode to load the .env.[mode] file
-h, --help display help for command
```

Expand All @@ -118,6 +133,7 @@ Options:
--output <output> specify inspect content output path
--verbose show full function definitions in output
-c --config <config> specify the configuration file, can be a relative or absolute path
--env-mode <mode> specify the env mode to load the .env.[mode] file
-h, --help display help for command
```

Expand Down
4 changes: 2 additions & 2 deletions docs/zh/api/rspeedy/rspeedy.createrspeedy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ The `createRspeedy` method can let you create a Rspeedy instance and you can cus
**Signature:**

```typescript
export declare function createRspeedy({ cwd, rspeedyConfig, loadEnv }: CreateRspeedyOptions): Promise<RspeedyInstance>;
export declare function createRspeedy({ cwd, rspeedyConfig, loadEnv, environment }: CreateRspeedyOptions): Promise<RspeedyInstance>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| { cwd, rspeedyConfig, loadEnv } | [CreateRspeedyOptions](./rspeedy.createrspeedyoptions.md) | |
| { cwd, rspeedyConfig, loadEnv, environment } | [CreateRspeedyOptions](./rspeedy.createrspeedyoptions.md) | |

**Returns:**

Expand Down
13 changes: 13 additions & 0 deletions docs/zh/api/rspeedy/rspeedy.createrspeedyoptions.environment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@lynx-js/rspeedy](./rspeedy.md) &gt; [CreateRspeedyOptions](./rspeedy.createrspeedyoptions.md) &gt; [environment](./rspeedy.createrspeedyoptions.environment.md)

## CreateRspeedyOptions.environment property

Only build specified environments. For example, passing `['lynx']` will only build the `lynx` environment. If not specified or passing an empty array, all environments will be built.

**Signature:**

```typescript
environment?: CreateRsbuildOptions['environment'];
```
1 change: 1 addition & 0 deletions docs/zh/api/rspeedy/rspeedy.createrspeedyoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface CreateRspeedyOptions
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [cwd?](./rspeedy.createrspeedyoptions.cwd.md) | | string | _(Optional)_ The root path of the current build. |
| [environment?](./rspeedy.createrspeedyoptions.environment.md) | | CreateRsbuildOptions\['environment'\] | _(Optional)_ Only build specified environments. For example, passing <code>['lynx']</code> will only build the <code>lynx</code> environment. If not specified or passing an empty array, all environments will be built. |
| [loadEnv?](./rspeedy.createrspeedyoptions.loadenv.md) | | CreateRsbuildOptions\['loadEnv'\] | _(Optional)_ Rspeedy automatically loads the .env file by default, utilizing the \[Rsbuild API\](https://rsbuild.dev/api/javascript-api/core\#load-env-variables). You can use the environment variables defined in the .env file within your code by accessing them via <code>import.meta.env.FOO</code> or <code>process.env.Foo</code>. |
| [rspeedyConfig?](./rspeedy.createrspeedyoptions.rspeedyconfig.md) | | [Config](./rspeedy.config.md) | _(Optional)_ The config of Rspeedy. |

51 changes: 51 additions & 0 deletions docs/zh/api/rspeedy/rspeedy.dev.hmr.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; [Dev](./rspeedy.dev.md) &gt; [hmr](./rspeedy.dev.hmr.md)

## Dev.hmr property

Whether to enable Hot Module Replacement (HMR).

**Signature:**

```typescript
hmr?: boolean | undefined;
```

## Remarks

Defaults to `true`<!-- -->.

By default, Rspeedy uses HMR as the preferred method to update modules. If HMR is disabled or cannot be used in certain scenarios, it will automatically fallback to [Dev.liveReload](./rspeedy.dev.livereload.md)<!-- -->.

To completely disable both HMR and live reload, set both `dev.hmr` and `dev.liveReload` to `false`<!-- -->. Then, no WebSocket requests will be made to the dev server on the page, and the page will not automatically refresh when file changes.

## Example 1

Disable HMR:

```js
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
dev: {
hmr: false,
},
})
```

## Example 2

Disable both HMR and live reload:

```js
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
dev: {
hmr: false,
liveReload: false,
},
})
```

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

[Home](./index.md) &gt; [@lynx-js/rspeedy](./rspeedy.md) &gt; [Dev](./rspeedy.dev.md) &gt; [liveReload](./rspeedy.dev.livereload.md)

## Dev.liveReload property

Whether to enable live reload functionality.

Defaults to `true`<!-- -->.

Live reload is used as a fallback when [Dev.hmr](./rspeedy.dev.hmr.md) is disabled or cannot be used in certain scenarios. When enabled, the page will automatically refresh when source files are changed.

To completely disable both HMR and live reload, set both `dev.hmr` and `dev.liveReload` to `false`<!-- -->. Then, no WebSocket requests will be made to the dev server on the page, and the page will not automatically refresh when file changes.

**Signature:**

```typescript
liveReload?: boolean | undefined;
```

## Example 1

Disable live reload:

```js
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
dev: {
liveReload: false,
},
})
```

## Example 2

Disable both HMR and live reload:

```js
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
dev: {
hmr: false,
liveReload: false,
},
})
```

2 changes: 2 additions & 0 deletions docs/zh/api/rspeedy/rspeedy.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export interface Dev
| --- | --- | --- | --- |
| [assetPrefix?](./rspeedy.dev.assetprefix.md) | | string \| boolean \| undefined | _(Optional)_ The [Dev.assetPrefix](./rspeedy.dev.assetprefix.md) is used to set the URL prefix for static assets during development. |
| [client?](./rspeedy.dev.client.md) | | [Client](./rspeedy.devclient.md) \| undefined | _(Optional)_ Configuration of the development client. |
| [hmr?](./rspeedy.dev.hmr.md) | | boolean \| undefined | _(Optional)_ Whether to enable Hot Module Replacement (HMR). |
| [liveReload?](./rspeedy.dev.livereload.md) | | boolean \| undefined | <p>_(Optional)_ Whether to enable live reload functionality.</p><p>Defaults to <code>true</code>.</p><p>Live reload is used as a fallback when [Dev.hmr](./rspeedy.dev.hmr.md) is disabled or cannot be used in certain scenarios. When enabled, the page will automatically refresh when source files are changed.</p><p>To completely disable both HMR and live reload, set both <code>dev.hmr</code> and <code>dev.liveReload</code> to <code>false</code>. Then, no WebSocket requests will be made to the dev server on the page, and the page will not automatically refresh when file changes.</p> |
| [progressBar?](./rspeedy.dev.progressbar.md) | | boolean \| { id?: string; } \| undefined | <p>_(Optional)_ Whether to display progress bar during compilation.</p><p>Defaults to <code>true</code>.</p> |
| [watchFiles?](./rspeedy.dev.watchfiles.md) | | WatchFiles \| WatchFiles\[\] \| undefined | _(Optional)_ Watch specified files and directories for changes. When a file change is detected, it can trigger a page reload or restart the dev server. |
| [writeToDisk?](./rspeedy.dev.writetodisk.md) | | boolean \| ((filename: string) =&gt; boolean) \| undefined | _(Optional)_ Used to control whether the build artifacts of the development environment are written to the disk. |
Expand Down
Loading