@lynx-js/rspeedy 0.8.7 → 0.9.1
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/CHANGELOG.md +51 -0
- package/bin/rspeedy.js +2 -2
- package/dist/cli/main.js +414 -0
- package/dist/cli/start.js +171 -0
- package/dist/index.d.ts +2971 -0
- package/dist/index.js +39556 -0
- package/dist/register/hooks.js +552 -0
- package/dist/register/index.js +22 -0
- package/dist/src_cli_build_ts.js +47 -0
- package/dist/src_cli_commands_ts.js +60 -0
- package/dist/src_cli_dev_ts.js +87 -0
- package/dist/src_cli_exit_ts.js +111 -0
- package/dist/src_cli_inspect_ts.js +42 -0
- package/dist/src_cli_preview_ts.js +49 -0
- package/dist/src_config_loadConfig_ts-src_create-rspeedy_ts.js +39311 -0
- package/dist/src_plugins_api_plugin_ts.js +32 -0
- package/dist/src_plugins_chunkLoading_plugin_ts.js +35 -0
- package/dist/src_plugins_dev_plugin_ts.js +141 -0
- package/dist/src_plugins_index_ts.js +60 -0
- package/dist/src_plugins_inspect_plugin_ts.js +48 -0
- package/dist/src_plugins_minify_plugin_ts.js +85 -0
- package/dist/src_plugins_optimization_plugin_ts.js +25 -0
- package/dist/src_plugins_output_plugin_ts.js +46 -0
- package/dist/src_plugins_resolve_plugin_ts.js +21 -0
- package/dist/src_plugins_rsdoctor_plugin_ts.js +59 -0
- package/dist/src_plugins_sourcemap_plugin_ts.js +99 -0
- package/dist/src_plugins_stats_plugin_ts.js +26 -0
- package/dist/src_plugins_swc_plugin_ts.js +36 -0
- package/dist/src_plugins_target_plugin_ts.js +45 -0
- package/dist/src_version_ts.js +18 -0
- package/dist/vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js +1435 -0
- package/dist/vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt +1 -0
- package/dist/vendors-node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js +1761 -0
- package/dist/vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js.js +1067 -0
- package/dist/vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-b558be.js +416 -0
- package/package.json +36 -23
- package/LICENSE +0 -202
- package/lib/api.d.ts +0 -46
- package/lib/api.js +0 -2
- package/lib/cli/build.d.ts +0 -4
- package/lib/cli/build.js +0 -32
- package/lib/cli/commands.d.ts +0 -5
- package/lib/cli/commands.js +0 -45
- package/lib/cli/dev.d.ts +0 -4
- package/lib/cli/dev.js +0 -75
- package/lib/cli/exit.d.ts +0 -1
- package/lib/cli/exit.js +0 -51
- package/lib/cli/inspect.d.ts +0 -8
- package/lib/cli/inspect.js +0 -30
- package/lib/cli/main.d.ts +0 -1
- package/lib/cli/main.js +0 -39
- package/lib/cli/preview.d.ts +0 -4
- package/lib/cli/preview.js +0 -31
- package/lib/cli/start.d.ts +0 -6
- package/lib/cli/start.js +0 -88
- package/lib/config/defaults.d.ts +0 -2
- package/lib/config/defaults.js +0 -32
- package/lib/config/defineConfig.d.ts +0 -22
- package/lib/config/defineConfig.js +0 -24
- package/lib/config/dev/client.d.ts +0 -15
- package/lib/config/dev/client.js +0 -2
- package/lib/config/dev/index.d.ts +0 -173
- package/lib/config/dev/index.js +0 -2
- package/lib/config/index.d.ts +0 -172
- package/lib/config/index.js +0 -2
- package/lib/config/loadConfig.d.ts +0 -50
- package/lib/config/loadConfig.js +0 -98
- package/lib/config/mergeRspeedyConfig.d.ts +0 -36
- package/lib/config/mergeRspeedyConfig.js +0 -42
- package/lib/config/output/css-modules.d.ts +0 -84
- package/lib/config/output/css-modules.js +0 -2
- package/lib/config/output/dist-path.d.ts +0 -19
- package/lib/config/output/dist-path.js +0 -2
- package/lib/config/output/filename.d.ts +0 -167
- package/lib/config/output/filename.js +0 -2
- package/lib/config/output/index.d.ts +0 -324
- package/lib/config/output/index.js +0 -2
- package/lib/config/output/minify.d.ts +0 -80
- package/lib/config/output/minify.js +0 -2
- package/lib/config/output/source-map.d.ts +0 -68
- package/lib/config/output/source-map.js +0 -2
- package/lib/config/performance/chunk-split.d.ts +0 -192
- package/lib/config/performance/chunk-split.js +0 -2
- package/lib/config/performance/index.d.ts +0 -165
- package/lib/config/performance/index.js +0 -2
- package/lib/config/rsbuild/entry.d.ts +0 -3
- package/lib/config/rsbuild/entry.js +0 -31
- package/lib/config/rsbuild/index.d.ts +0 -4
- package/lib/config/rsbuild/index.js +0 -75
- package/lib/config/server/index.d.ts +0 -91
- package/lib/config/server/index.js +0 -2
- package/lib/config/source/decorators.d.ts +0 -43
- package/lib/config/source/decorators.js +0 -2
- package/lib/config/source/entry.d.ts +0 -84
- package/lib/config/source/entry.js +0 -2
- package/lib/config/source/index.d.ts +0 -474
- package/lib/config/source/index.js +0 -2
- package/lib/config/source/transformImport.d.ts +0 -106
- package/lib/config/source/transformImport.js +0 -2
- package/lib/config/tools/css-extract.d.ts +0 -72
- package/lib/config/tools/css-extract.js +0 -2
- package/lib/config/tools/css-loader.d.ts +0 -130
- package/lib/config/tools/css-loader.js +0 -2
- package/lib/config/tools/index.d.ts +0 -170
- package/lib/config/tools/index.js +0 -2
- package/lib/config/validate.d.ts +0 -4
- package/lib/config/validate.js +0 -28877
- package/lib/create-rspeedy.d.ts +0 -52
- package/lib/create-rspeedy.js +0 -49
- package/lib/debug.d.ts +0 -3
- package/lib/debug.js +0 -25
- package/lib/index.d.ts +0 -46
- package/lib/index.js +0 -11
- package/lib/plugins/api.plugin.d.ts +0 -3
- package/lib/plugins/api.plugin.js +0 -25
- package/lib/plugins/chunkLoading.plugin.d.ts +0 -2
- package/lib/plugins/chunkLoading.plugin.js +0 -43
- package/lib/plugins/dev.plugin.d.ts +0 -5
- package/lib/plugins/dev.plugin.js +0 -137
- package/lib/plugins/index.d.ts +0 -3
- package/lib/plugins/index.js +0 -49
- package/lib/plugins/inspect.plugin.d.ts +0 -4
- package/lib/plugins/inspect.plugin.js +0 -39
- package/lib/plugins/minify.plugin.d.ts +0 -3
- package/lib/plugins/minify.plugin.js +0 -89
- package/lib/plugins/optimization.plugin.d.ts +0 -2
- package/lib/plugins/optimization.plugin.js +0 -31
- package/lib/plugins/output.plugin.d.ts +0 -3
- package/lib/plugins/output.plugin.js +0 -34
- package/lib/plugins/resolve.plugin.d.ts +0 -2
- package/lib/plugins/resolve.plugin.js +0 -38
- package/lib/plugins/rsdoctor.plugin.d.ts +0 -3
- package/lib/plugins/rsdoctor.plugin.js +0 -48
- package/lib/plugins/sourcemap.plugin.d.ts +0 -2
- package/lib/plugins/sourcemap.plugin.js +0 -86
- package/lib/plugins/stats.plugin.d.ts +0 -2
- package/lib/plugins/stats.plugin.js +0 -20
- package/lib/plugins/swc.plugin.d.ts +0 -2
- package/lib/plugins/swc.plugin.js +0 -21
- package/lib/plugins/target.plugin.d.ts +0 -2
- package/lib/plugins/target.plugin.js +0 -22
- package/lib/utils/getESVersionTarget.d.ts +0 -1
- package/lib/utils/getESVersionTarget.js +0 -7
- package/lib/utils/is-ci.d.ts +0 -1
- package/lib/utils/is-ci.js +0 -7
- package/lib/utils/is-lynx.d.ts +0 -2
- package/lib/utils/is-lynx.js +0 -6
- package/lib/utils/is-web.d.ts +0 -2
- package/lib/utils/is-web.js +0 -6
- package/lib/version.d.ts +0 -4
- package/lib/version.js +0 -15
- package/lib/webpack/CompilationIdPlugin.d.ts +0 -4
- package/lib/webpack/CompilationIdPlugin.js +0 -20
- package/lib/webpack/EvalSourceMapDevToolPlugin.d.ts +0 -9
- package/lib/webpack/EvalSourceMapDevToolPlugin.js +0 -15
- package/lib/webpack/ProvidePlugin.d.ts +0 -9
- package/lib/webpack/ProvidePlugin.js +0 -15
- package/lib/webpack/SourceMapDevToolPlugin.d.ts +0 -9
- package/lib/webpack/SourceMapDevToolPlugin.js +0 -15
- package/register/data.d.ts +0 -9
- package/register/hooks.js +0 -146
- package/register/index.js +0 -47
- /package/{register → dist/register}/index.d.ts +0 -0
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import type { PerformanceConfig } from '@rsbuild/core';
|
|
2
|
-
import type { ChunkSplit, ChunkSplitBySize, ChunkSplitCustom } from './chunk-split.js';
|
|
3
|
-
/**
|
|
4
|
-
* The type of the console method.
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export type ConsoleType = 'log' | 'warn' | 'error' | 'info' | 'debug' | 'profile' | 'profileEnd' | (string & Record<never, never>);
|
|
9
|
-
/**
|
|
10
|
-
* {@inheritdoc Config.performance}
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export interface Performance {
|
|
15
|
-
/**
|
|
16
|
-
* {@link Performance.chunkSplit} is used to configure the chunk splitting strategy.
|
|
17
|
-
*/
|
|
18
|
-
chunkSplit?: ChunkSplit | ChunkSplitBySize | ChunkSplitCustom | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Whether to remove `console.[methodName]` in production build.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
*
|
|
24
|
-
* - Remove all `console` methods
|
|
25
|
-
*
|
|
26
|
-
* ```ts
|
|
27
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
28
|
-
*
|
|
29
|
-
* export default defineConfig({
|
|
30
|
-
* performance: {
|
|
31
|
-
* removeConsole: true,
|
|
32
|
-
* },
|
|
33
|
-
* })
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
*
|
|
38
|
-
* - Remove specific `console` methods
|
|
39
|
-
*
|
|
40
|
-
* ```ts
|
|
41
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
42
|
-
*
|
|
43
|
-
* export default defineConfig({
|
|
44
|
-
* performance: {
|
|
45
|
-
* removeConsole: ['log', 'warn']
|
|
46
|
-
* },
|
|
47
|
-
* })
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
removeConsole?: boolean | ConsoleType[] | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* Whether to print the file sizes after production build.
|
|
53
|
-
*
|
|
54
|
-
* {@link Performance.printFileSize}
|
|
55
|
-
*
|
|
56
|
-
* See {@link https://rsbuild.dev/config/performance/print-file-size | Rsbuild - performance.printFileSize} for details.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
*
|
|
60
|
-
* If you don't want to print any information, you can disable it by setting printFileSize to false:
|
|
61
|
-
*
|
|
62
|
-
* ```ts
|
|
63
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
64
|
-
*
|
|
65
|
-
* export default defineConfig({
|
|
66
|
-
* performance: {
|
|
67
|
-
* printFileSize: false
|
|
68
|
-
* },
|
|
69
|
-
* })
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
*
|
|
74
|
-
* Set total to false to disable total size output.
|
|
75
|
-
*
|
|
76
|
-
* ```ts
|
|
77
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
78
|
-
*
|
|
79
|
-
* export default defineConfig({
|
|
80
|
-
* performance: {
|
|
81
|
-
* printFileSize: {
|
|
82
|
-
* total: false,
|
|
83
|
-
* },
|
|
84
|
-
* },
|
|
85
|
-
* })
|
|
86
|
-
* ```
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
*
|
|
90
|
-
* Set detail to false to disable per-asset size output.
|
|
91
|
-
*
|
|
92
|
-
* If you don't need to view the size of each static asset, you can set detail to false. In this case, only the total size will be output:
|
|
93
|
-
*
|
|
94
|
-
* ```ts
|
|
95
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
96
|
-
*
|
|
97
|
-
* export default defineConfig({
|
|
98
|
-
* performance: {
|
|
99
|
-
* printFileSize: {
|
|
100
|
-
* detail: false,
|
|
101
|
-
* },
|
|
102
|
-
* },
|
|
103
|
-
* })
|
|
104
|
-
* ```
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
*
|
|
108
|
-
* If you don't need to view the gzipped size, you can set compressed to false. This can save some gzip computation time for large projects:
|
|
109
|
-
*
|
|
110
|
-
* ```ts
|
|
111
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
112
|
-
*
|
|
113
|
-
* export default defineConfig({
|
|
114
|
-
* performance: {
|
|
115
|
-
* printFileSize: {
|
|
116
|
-
* compressed: false,
|
|
117
|
-
* },
|
|
118
|
-
* },
|
|
119
|
-
* })
|
|
120
|
-
* ```
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
*
|
|
124
|
-
* To include only static assets that meet certain criteria, use a filter function with include.
|
|
125
|
-
*
|
|
126
|
-
* If returned false, the static asset will be excluded and not included in the total size or detailed size.
|
|
127
|
-
*
|
|
128
|
-
* only output static assets larger than 10kB:
|
|
129
|
-
*
|
|
130
|
-
* ```ts
|
|
131
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
132
|
-
*
|
|
133
|
-
* export default defineConfig({
|
|
134
|
-
* performance: {
|
|
135
|
-
* printFileSize: {
|
|
136
|
-
* include: (asset) => asset.size > 10 * 1000,
|
|
137
|
-
* }
|
|
138
|
-
* },
|
|
139
|
-
* })
|
|
140
|
-
* ```
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
*
|
|
144
|
-
* To exclude static assets that meet certain criteria, use a filter function with exclude. If both include and exclude are set, exclude will take precedence.
|
|
145
|
-
*
|
|
146
|
-
* Rspeedy defaults to excluding source map, license files, and .d.ts type files, as these files do not affect page load performance.
|
|
147
|
-
*
|
|
148
|
-
* exclude .html files in addition to the default:
|
|
149
|
-
*
|
|
150
|
-
* ```ts
|
|
151
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
152
|
-
*
|
|
153
|
-
* export default defineConfig({
|
|
154
|
-
* performance: {
|
|
155
|
-
* printFileSize: {
|
|
156
|
-
* exclude: (asset) =>
|
|
157
|
-
* /\.(?:map|LICENSE\.txt)$/.test(asset.name) ||
|
|
158
|
-
* /\.html$/.test(asset.name),
|
|
159
|
-
* }
|
|
160
|
-
* },
|
|
161
|
-
* })
|
|
162
|
-
* ```
|
|
163
|
-
*/
|
|
164
|
-
printFileSize?: PerformanceConfig['printFileSize'] | undefined;
|
|
165
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { debug, debugList } from '../../debug.js';
|
|
2
|
-
const DEFAULT_ENTRY = './src/index.js';
|
|
3
|
-
export function toRsbuildEntry(entry) {
|
|
4
|
-
// Default value
|
|
5
|
-
if (entry === undefined) {
|
|
6
|
-
debug(`Using default entry ${DEFAULT_ENTRY}`);
|
|
7
|
-
return {
|
|
8
|
-
main: DEFAULT_ENTRY,
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
// Single entry
|
|
12
|
-
if (Array.isArray(entry) || typeof entry === 'string') {
|
|
13
|
-
debug(() => `Using single entry ${[''].concat(entry).join('\n - ')}`);
|
|
14
|
-
return { main: entry };
|
|
15
|
-
}
|
|
16
|
-
return Object.fromEntries(Object.entries(entry).map(([key, value]) => {
|
|
17
|
-
if (Array.isArray(value) || typeof value === 'string') {
|
|
18
|
-
debugList(`Using multiple entries - ${key}`, value);
|
|
19
|
-
return [key, { import: value }];
|
|
20
|
-
}
|
|
21
|
-
debugList(`Using multiple entries - ${key}`, value.import ?? DEFAULT_ENTRY);
|
|
22
|
-
if (value.import === undefined) {
|
|
23
|
-
return [
|
|
24
|
-
key,
|
|
25
|
-
{ ...value, import: DEFAULT_ENTRY },
|
|
26
|
-
];
|
|
27
|
-
}
|
|
28
|
-
return [key, value];
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=entry.js.map
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { toRsbuildEntry } from './entry.js';
|
|
2
|
-
// This is the default value from lynx-speedy.
|
|
3
|
-
// We may change it based on new benchmarks.
|
|
4
|
-
const defaultDataUriLimit = 2 * 1024;
|
|
5
|
-
export function toRsbuildConfig(config) {
|
|
6
|
-
return {
|
|
7
|
-
provider: config.provider,
|
|
8
|
-
dev: {
|
|
9
|
-
watchFiles: config.dev?.watchFiles,
|
|
10
|
-
// We expect to use different default writeToDisk with Rsbuild
|
|
11
|
-
writeToDisk: config.dev?.writeToDisk ?? true,
|
|
12
|
-
progressBar: config.dev?.progressBar ?? true,
|
|
13
|
-
},
|
|
14
|
-
environments: config.environments ?? { lynx: {} },
|
|
15
|
-
mode: config.mode,
|
|
16
|
-
output: {
|
|
17
|
-
assetPrefix: config.output?.assetPrefix,
|
|
18
|
-
charset: 'utf8',
|
|
19
|
-
cleanDistPath: config.output?.cleanDistPath,
|
|
20
|
-
copy: config.output?.copy,
|
|
21
|
-
cssModules: config.output?.cssModules,
|
|
22
|
-
// We expect to use different default dataUriLimit with Rsbuild
|
|
23
|
-
dataUriLimit: config.output?.dataUriLimit ?? defaultDataUriLimit,
|
|
24
|
-
distPath: config.output?.distPath,
|
|
25
|
-
filenameHash: config.output?.filenameHash,
|
|
26
|
-
// TODO(OSS): change the default value to `linked`(or `undefined`) when OSS.
|
|
27
|
-
// We expect to use different default legalComments with Rsbuild
|
|
28
|
-
legalComments: config.output?.legalComments ?? 'none',
|
|
29
|
-
polyfill: 'off',
|
|
30
|
-
// TODO: update the Rsbuild type to allow `sourceMap.js` to be `*-debugids`
|
|
31
|
-
sourceMap: config.output?.sourceMap,
|
|
32
|
-
},
|
|
33
|
-
source: {
|
|
34
|
-
alias: config.source?.alias,
|
|
35
|
-
assetsInclude: config.source?.assetsInclude,
|
|
36
|
-
decorators: config.source?.decorators,
|
|
37
|
-
define: config.source?.define,
|
|
38
|
-
entry: toRsbuildEntry(config.source?.entry),
|
|
39
|
-
exclude: config.source?.exclude,
|
|
40
|
-
include: config.source?.include,
|
|
41
|
-
transformImport: config.source?.transformImport,
|
|
42
|
-
tsconfigPath: config.source?.tsconfigPath,
|
|
43
|
-
},
|
|
44
|
-
server: {
|
|
45
|
-
base: config.server?.base,
|
|
46
|
-
headers: config.server?.headers,
|
|
47
|
-
host: config.server?.host,
|
|
48
|
-
port: config.server?.port,
|
|
49
|
-
strictPort: config.server?.strictPort,
|
|
50
|
-
},
|
|
51
|
-
plugins: config.plugins,
|
|
52
|
-
performance: {
|
|
53
|
-
chunkSplit: config.performance?.chunkSplit,
|
|
54
|
-
removeConsole: toRsbuildRemoveConsole(config),
|
|
55
|
-
printFileSize: config.performance?.printFileSize ?? true,
|
|
56
|
-
},
|
|
57
|
-
tools: {
|
|
58
|
-
bundlerChain: config.tools?.bundlerChain,
|
|
59
|
-
cssExtract: config.tools?.cssExtract,
|
|
60
|
-
cssLoader: config.tools?.cssLoader,
|
|
61
|
-
htmlPlugin: false,
|
|
62
|
-
rspack: config.tools?.rspack,
|
|
63
|
-
swc: config.tools?.swc,
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function toRsbuildRemoveConsole(config) {
|
|
68
|
-
if (config.performance?.removeConsole === true) {
|
|
69
|
-
// Lynx use console as a parameter in the runtime-wrapper
|
|
70
|
-
// So we need to use all the console methods instead of `true` to make sure Rsbuild can remove all the console methods
|
|
71
|
-
return ['log', 'warn', 'error', 'info', 'debug', 'profile', 'profileEnd'];
|
|
72
|
-
}
|
|
73
|
-
return config.performance?.removeConsole;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* {@inheritdoc Config.server}
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
|
-
export interface Server {
|
|
6
|
-
/**
|
|
7
|
-
* Configure the base path of the server.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* By default, the base path of the server is `/`, and users can access lynx bundle through `http://<host>:<port>/main.lynx.bundle`
|
|
11
|
-
*
|
|
12
|
-
* If you want to access lynx bundle through `http://<host>:<port>/foo/main.lynx.bundle`, you can change `server.base` to `/foo`
|
|
13
|
-
*
|
|
14
|
-
* you can refer to {@link https://rsbuild.dev/config/server/base | server.base } for more information.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* ```js
|
|
19
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
20
|
-
* export default defineConfig({
|
|
21
|
-
* server: {
|
|
22
|
-
* base: '/dist'
|
|
23
|
-
* },
|
|
24
|
-
* })
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
base?: string | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Adds headers to all responses.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
*
|
|
33
|
-
* ```js
|
|
34
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
35
|
-
* export default defineConfig({
|
|
36
|
-
* server: {
|
|
37
|
-
* headers: {
|
|
38
|
-
* 'Access-Control-Allow-Origin': '**',
|
|
39
|
-
* },
|
|
40
|
-
* },
|
|
41
|
-
* })
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
headers?: Record<string, string | string[]> | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Specify the host that the Rspeedy Server listens to.
|
|
47
|
-
*
|
|
48
|
-
* @remarks
|
|
49
|
-
* By default, the server listens on local network IP, for example, `192.168.1.50`, verify your local net IP by the command `ifconfig` on your system for (en0 for MacOS and eth0 for LinuxOS users). In case you have multiple local network IP(s) particularly when you are running dockers on the host machine, then you can specify your desired host IP.
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
*
|
|
53
|
-
* Set the host to a custom value:
|
|
54
|
-
*
|
|
55
|
-
* ```js
|
|
56
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
57
|
-
* export default defineConfig({
|
|
58
|
-
* server: {
|
|
59
|
-
* host: "192.168.1.50",
|
|
60
|
-
* },
|
|
61
|
-
* })
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
host?: string | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* Specify the port that the Rspeedy Server listens to.
|
|
67
|
-
*
|
|
68
|
-
* @remarks
|
|
69
|
-
* By default, the server listens on port `3000` and automatically increments the port number when the port is occupied.
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
*
|
|
73
|
-
* Set the port to a custom value:
|
|
74
|
-
*
|
|
75
|
-
* ```js
|
|
76
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
77
|
-
* export default defineConfig({
|
|
78
|
-
* server: {
|
|
79
|
-
* port: 3470,
|
|
80
|
-
* },
|
|
81
|
-
* })
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
port?: number | undefined;
|
|
85
|
-
/**
|
|
86
|
-
* When a port is occupied, Rspeedy will automatically increment the port number until an available port is found.
|
|
87
|
-
*
|
|
88
|
-
* Set strictPort to true and Rspeedy will throw an exception when the port is occupied.
|
|
89
|
-
*/
|
|
90
|
-
strictPort?: boolean | undefined;
|
|
91
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* {@inheritdoc Source.decorators}
|
|
3
|
-
*
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export interface Decorators {
|
|
7
|
-
/**
|
|
8
|
-
* Specify the decorator syntax version to be used.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
*
|
|
12
|
-
* If you want to know the differences between different decorators versions, you can refer to: {@link https://github.com/tc39/proposal-decorators?tab=readme-ov-file#how-does-this-proposal-compare-to-other-versions-of-decorators | How does this proposal compare to other versions of decorators?}
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* `'2022-03'` corresponds to the Stage 3 decorator proposal, equivalent to the decorator syntax supported by TypeScript 5.0 by default.
|
|
17
|
-
*
|
|
18
|
-
* ```js
|
|
19
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
20
|
-
*
|
|
21
|
-
* export default defineConfig({
|
|
22
|
-
* source: {
|
|
23
|
-
* decorators: { version: '2022-03' },
|
|
24
|
-
* },
|
|
25
|
-
* })
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
*
|
|
30
|
-
* `'legacy'` corresponds to TypeScript's `experimentalDecorators: true`.
|
|
31
|
-
*
|
|
32
|
-
* ```js
|
|
33
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
34
|
-
*
|
|
35
|
-
* export default defineConfig({
|
|
36
|
-
* source: {
|
|
37
|
-
* decorators: { version: 'legacy' },
|
|
38
|
-
* },
|
|
39
|
-
* })
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
version?: 'legacy' | '2022-03';
|
|
43
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `EntryDescription` describes a entry. It is useful when the project has multiple entries with different configuration.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* It is similar with the {@link https://www.rspack.dev/config/entry#entry-description-object | Entry Description Object} of Rspack.
|
|
6
|
-
* But only a few properties that Lynx supports is allowed.
|
|
7
|
-
*
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export interface EntryDescription {
|
|
11
|
-
/**
|
|
12
|
-
* The path to the entry module(s).
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
*
|
|
16
|
-
* If no value is provided, the default value `src/index.js` will be used.
|
|
17
|
-
*
|
|
18
|
-
* @defaultValue `'./src/index.js'`
|
|
19
|
-
*/
|
|
20
|
-
import?: string | string[] | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* This is an important option when using on-demand-loading or loading external resources like images, files, etc. If an incorrect value is specified you'll receive 404 errors while loading these resources.
|
|
23
|
-
*
|
|
24
|
-
* @see https://webpack.js.org/configuration/output/#outputpublicpath
|
|
25
|
-
*/
|
|
26
|
-
publicPath?: string | undefined;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* {@inheritdoc Source.entry}
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
*
|
|
33
|
-
* - Use a single entry:
|
|
34
|
-
*
|
|
35
|
-
* ```js
|
|
36
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
37
|
-
* export default defineConfig({
|
|
38
|
-
* entry: './src/pages/main/index.js',
|
|
39
|
-
* })
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
*
|
|
44
|
-
* - Use a single entry with multiple entry modules:
|
|
45
|
-
*
|
|
46
|
-
* ```js
|
|
47
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
48
|
-
* export default defineConfig({
|
|
49
|
-
* entry: ['./src/prefetch.js', './src/pages/main/index.js'],
|
|
50
|
-
* })
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
*
|
|
55
|
-
* - Use multiple entries(with multiple entry modules):
|
|
56
|
-
*
|
|
57
|
-
* ```js
|
|
58
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
59
|
-
* export default defineConfig({
|
|
60
|
-
* entry: {
|
|
61
|
-
* foo: './src/pages/foo/index.js',
|
|
62
|
-
* bar: ['./src/pages/bar/index.js', './src/post.js'], // multiple entry modules is allowed
|
|
63
|
-
* },
|
|
64
|
-
* })
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
*
|
|
69
|
-
* - Use multiple entries with {@link EntryDescription}:
|
|
70
|
-
*
|
|
71
|
-
* ```js
|
|
72
|
-
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
73
|
-
* export default defineConfig({
|
|
74
|
-
* entry: {
|
|
75
|
-
* foo: './src/pages/foo/index.js',
|
|
76
|
-
* bar: {
|
|
77
|
-
* import: ['./src/prefetch.js', './src/pages/bar'],
|
|
78
|
-
* },
|
|
79
|
-
* },
|
|
80
|
-
* })
|
|
81
|
-
* ```
|
|
82
|
-
* @public
|
|
83
|
-
*/
|
|
84
|
-
export type Entry = string | string[] | Record<string, string | string[] | EntryDescription>;
|