@lynx-js/rspeedy-canary 0.11.3-canary-20250919-f4528d19 → 0.11.3-canary-20250919-8c33d3e1

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/0~src_config_validate_ts.js +40795 -0
  3. package/dist/0~src_plugins_api_plugin_ts.js +33 -0
  4. package/dist/0~src_plugins_rsdoctor_plugin_ts.js +54 -0
  5. package/dist/1~src_plugins_chunkLoading_plugin_ts.js +37 -0
  6. package/dist/1~src_plugins_dev_plugin_ts.js +144 -0
  7. package/dist/1~src_plugins_emitOnErrors_plugin_ts.js +22 -0
  8. package/dist/1~src_plugins_index_ts.js +52 -0
  9. package/dist/1~src_plugins_inspect_plugin_ts.js +49 -0
  10. package/dist/1~src_plugins_minify_plugin_ts.js +86 -0
  11. package/dist/1~src_plugins_optimization_plugin_ts.js +26 -0
  12. package/dist/1~src_plugins_output_plugin_ts.js +47 -0
  13. package/dist/1~src_plugins_resolve_plugin_ts.js +22 -0
  14. package/dist/1~src_plugins_sourcemap_plugin_ts.js +100 -0
  15. package/dist/1~src_plugins_swc_plugin_ts.js +40 -0
  16. package/dist/1~src_plugins_target_plugin_ts.js +46 -0
  17. package/dist/{vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js → 1~vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js} +1 -1
  18. package/dist/1~vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js.js +1068 -0
  19. package/dist/1~vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc.js +417 -0
  20. package/dist/cli/main.js +1 -1
  21. package/dist/index.js +1 -1
  22. package/package.json +1 -1
  23. /package/dist/{src_cli_exit_ts.js → 0~src_cli_exit_ts.js} +0 -0
  24. /package/dist/{src_plugins_chunkLoading_plugin_ts.js → 0~src_plugins_chunkLoading_plugin_ts.js} +0 -0
  25. /package/dist/{src_plugins_dev_plugin_ts.js → 0~src_plugins_dev_plugin_ts.js} +0 -0
  26. /package/dist/{src_plugins_emitOnErrors_plugin_ts.js → 0~src_plugins_emitOnErrors_plugin_ts.js} +0 -0
  27. /package/dist/{src_plugins_index_ts.js → 0~src_plugins_index_ts.js} +0 -0
  28. /package/dist/{src_plugins_inspect_plugin_ts.js → 0~src_plugins_inspect_plugin_ts.js} +0 -0
  29. /package/dist/{src_plugins_minify_plugin_ts.js → 0~src_plugins_minify_plugin_ts.js} +0 -0
  30. /package/dist/{src_plugins_optimization_plugin_ts.js → 0~src_plugins_optimization_plugin_ts.js} +0 -0
  31. /package/dist/{src_plugins_output_plugin_ts.js → 0~src_plugins_output_plugin_ts.js} +0 -0
  32. /package/dist/{src_plugins_resolve_plugin_ts.js → 0~src_plugins_resolve_plugin_ts.js} +0 -0
  33. /package/dist/{src_plugins_sourcemap_plugin_ts.js → 0~src_plugins_sourcemap_plugin_ts.js} +0 -0
  34. /package/dist/{src_plugins_swc_plugin_ts.js → 0~src_plugins_swc_plugin_ts.js} +0 -0
  35. /package/dist/{src_plugins_target_plugin_ts.js → 0~src_plugins_target_plugin_ts.js} +0 -0
  36. /package/dist/{vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js.js → 0~vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js.js} +0 -0
  37. /package/dist/{vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc.js → 0~vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc.js} +0 -0
  38. /package/dist/{events-fs-fs_promises-os-path-stream.js → 1~events-fs-fs_promises-os-path-stream.js} +0 -0
  39. /package/dist/{node_child_process-node_events-node_fs-node_path.js → 1~node_child_process-node_events-node_fs-node_path.js} +0 -0
  40. /package/dist/{src_cli_build_ts.js → 1~src_cli_build_ts.js} +0 -0
  41. /package/dist/{src_cli_commands_ts.js → 1~src_cli_commands_ts.js} +0 -0
  42. /package/dist/{src_cli_dev_ts.js → 1~src_cli_dev_ts.js} +0 -0
  43. /package/dist/{src_cli_inspect_ts.js → 1~src_cli_inspect_ts.js} +0 -0
  44. /package/dist/{src_cli_preview_ts.js → 1~src_cli_preview_ts.js} +0 -0
  45. /package/dist/{src_config_validate_ts.js → 1~src_config_validate_ts.js} +0 -0
  46. /package/dist/{src_plugins_api_plugin_ts.js → 1~src_plugins_api_plugin_ts.js} +0 -0
  47. /package/dist/{src_plugins_rsdoctor_plugin_ts.js → 1~src_plugins_rsdoctor_plugin_ts.js} +0 -0
  48. /package/dist/{src_version_ts.js → 1~src_version_ts.js} +0 -0
  49. /package/dist/{vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt → 1~vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt} +0 -0
  50. /package/dist/{vendors-node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js → 1~vendors-node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js} +0 -0
@@ -0,0 +1,33 @@
1
+ export const __webpack_id__ = "src_plugins_api_plugin_ts";
2
+ export const __webpack_ids__ = [
3
+ "src_plugins_api_plugin_ts"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "./src/plugins/api.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.r(__webpack_exports__);
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ pluginAPI: ()=>pluginAPI
10
+ });
11
+ var _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rsbuild/core");
12
+ var _debug_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/debug.ts");
13
+ var _version_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/version.ts");
14
+ const sAPI = Symbol.for('rspeedy.api');
15
+ function pluginAPI(config) {
16
+ return {
17
+ name: 'lynx:rsbuild:plugin-api',
18
+ setup (api) {
19
+ api.expose(sAPI, {
20
+ config,
21
+ debug: _debug_js__WEBPACK_IMPORTED_MODULE_1__.Yz,
22
+ async exit (code) {
23
+ const { exit } = await __webpack_require__.e("src_cli_exit_ts").then(__webpack_require__.bind(__webpack_require__, "./src/cli/exit.ts"));
24
+ return exit(code);
25
+ },
26
+ logger: _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger,
27
+ version: _version_js__WEBPACK_IMPORTED_MODULE_2__.rE
28
+ });
29
+ }
30
+ };
31
+ }
32
+ }
33
+ };
@@ -0,0 +1,54 @@
1
+ export const __webpack_id__ = "src_plugins_rsdoctor_plugin_ts";
2
+ export const __webpack_ids__ = [
3
+ "src_plugins_rsdoctor_plugin_ts"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "./src/plugins/rsdoctor.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.r(__webpack_exports__);
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ pluginRsdoctor: ()=>pluginRsdoctor
10
+ });
11
+ var core_ = __webpack_require__("@rsbuild/core");
12
+ function isCI() {
13
+ return !!process.env['CI'] && 'false' !== process.env['CI'];
14
+ }
15
+ function pluginRsdoctor(options) {
16
+ return {
17
+ name: 'lynx:rsbuild:rsdoctor',
18
+ remove: [
19
+ 'rsbuild:rsdoctor'
20
+ ],
21
+ setup (api) {
22
+ if ('true' !== process.env['RSDOCTOR']) return;
23
+ api.onBeforeCreateCompiler(async ({ bundlerConfigs })=>{
24
+ const { RsdoctorRspackPlugin } = await import("@rsdoctor/rspack-plugin");
25
+ for (const config of bundlerConfigs){
26
+ const pluginName = 'RsdoctorRspackPlugin';
27
+ const registered = config.plugins?.some((plugin)=>'object' == typeof plugin && plugin?.['isRsdoctorPlugin'] === true || plugin?.constructor?.name === pluginName);
28
+ if (registered) continue;
29
+ config.plugins ??= [];
30
+ const defaultOptions = {
31
+ disableClientServer: isCI(),
32
+ supports: {
33
+ banner: true
34
+ },
35
+ linter: {
36
+ rules: {
37
+ 'ecma-version-check': options?.linter?.rules?.['ecma-version-check'] ?? [
38
+ 'Warn',
39
+ {
40
+ ecmaVersion: 2019
41
+ }
42
+ ]
43
+ }
44
+ }
45
+ };
46
+ config.plugins.push(new RsdoctorRspackPlugin((0, core_.mergeRsbuildConfig)(defaultOptions, options)));
47
+ }
48
+ core_.logger.info("Rsdoctor is enabled.");
49
+ });
50
+ }
51
+ };
52
+ }
53
+ }
54
+ };
@@ -0,0 +1,37 @@
1
+ import { LynxCacheEventsPlugin } from "@lynx-js/cache-events-webpack-plugin";
2
+ import { ChunkLoadingWebpackPlugin } from "@lynx-js/chunk-loading-webpack-plugin";
3
+ export const __webpack_id__ = "src_plugins_chunkLoading_plugin_ts";
4
+ export const __webpack_ids__ = [
5
+ "src_plugins_chunkLoading_plugin_ts"
6
+ ];
7
+ export const __webpack_modules__ = {
8
+ "./src/plugins/chunkLoading.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9
+ __webpack_require__.r(__webpack_exports__);
10
+ __webpack_require__.d(__webpack_exports__, {
11
+ pluginChunkLoading: ()=>pluginChunkLoading
12
+ });
13
+ function isLynx(environment) {
14
+ return 'string' == typeof environment ? 'lynx' === environment : 'lynx' === environment.name;
15
+ }
16
+ var is_web = __webpack_require__("./src/utils/is-web.ts");
17
+ function pluginChunkLoading() {
18
+ return {
19
+ name: 'lynx:rsbuild:chunk-loading',
20
+ setup (api) {
21
+ api.modifyBundlerChain((chain, { environment })=>{
22
+ if ((0, is_web.H)(environment)) return void chain.output.chunkLoading("import-scripts").end();
23
+ if (isLynx(environment)) chain.plugin('lynx:chunk-loading').use(ChunkLoadingWebpackPlugin).end().plugin('lynx:cache-events').use(LynxCacheEventsPlugin).end().output.chunkLoading('lynx').chunkFormat('commonjs').end();
24
+ });
25
+ }
26
+ };
27
+ }
28
+ },
29
+ "./src/utils/is-web.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ H: ()=>isWeb
32
+ });
33
+ function isWeb(environment) {
34
+ return 'string' == typeof environment ? 'web' === environment : 'web' === environment.name;
35
+ }
36
+ }
37
+ };
@@ -0,0 +1,144 @@
1
+ import { createRequire } from "node:module";
2
+ export const __webpack_id__ = "src_plugins_dev_plugin_ts";
3
+ export const __webpack_ids__ = [
4
+ "src_plugins_dev_plugin_ts"
5
+ ];
6
+ export const __webpack_modules__ = {
7
+ "./src/plugins/dev.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8
+ __webpack_require__.r(__webpack_exports__);
9
+ __webpack_require__.d(__webpack_exports__, {
10
+ pluginDev: ()=>pluginDev,
11
+ findIp: ()=>findIp
12
+ });
13
+ var external_node_path_ = __webpack_require__("node:path");
14
+ var core_ = __webpack_require__("@rsbuild/core");
15
+ var picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
16
+ var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
17
+ var debug = __webpack_require__("./src/debug.ts");
18
+ class ProvidePlugin_ProvidePlugin {
19
+ definitions;
20
+ constructor(definitions){
21
+ this.definitions = definitions;
22
+ }
23
+ apply(compiler) {
24
+ const { ProvidePlugin } = compiler.webpack;
25
+ new ProvidePlugin(this.definitions).apply(compiler);
26
+ }
27
+ }
28
+ function pluginDev(options, server) {
29
+ return {
30
+ name: 'lynx:rsbuild:dev',
31
+ apply (config, { action }) {
32
+ return 'dev' === action || 'development' === config.mode;
33
+ },
34
+ async setup (api) {
35
+ const hostname = server?.host ?? await findIp('v4');
36
+ let assetPrefix = options?.assetPrefix;
37
+ switch(typeof assetPrefix){
38
+ case 'string':
39
+ if (server?.port !== void 0) {
40
+ const hasPortPlaceholder = assetPrefix.includes('<port>');
41
+ if (!hasPortPlaceholder) {
42
+ const assetPrefixURL = new URL(assetPrefix);
43
+ if (assetPrefixURL.port !== String(server.port)) {
44
+ core_.logger.warn(`Setting different port values in ${picocolors_default().cyan('server.port')} and ${picocolors_default().cyan('dev.assetPrefix')}. Using server.port(${picocolors_default().cyan(server.port)}) to make HMR work.`);
45
+ assetPrefixURL.port = String(server.port);
46
+ assetPrefix = assetPrefixURL.toString();
47
+ }
48
+ }
49
+ }
50
+ break;
51
+ case 'undefined':
52
+ case 'boolean':
53
+ if (options?.assetPrefix !== false) assetPrefix = `http://${hostname}:<port>/`;
54
+ break;
55
+ }
56
+ if (server?.base) {
57
+ if (assetPrefix.endsWith('/')) assetPrefix = assetPrefix.slice(0, -1);
58
+ assetPrefix = `${assetPrefix}${server.base}/`;
59
+ }
60
+ (0, debug.Yz)(`dev.assetPrefix is normalized to ${assetPrefix}`);
61
+ api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>mergeRsbuildConfig(config, {
62
+ dev: {
63
+ assetPrefix,
64
+ client: {
65
+ host: hostname,
66
+ port: '<port>'
67
+ }
68
+ },
69
+ output: {
70
+ assetPrefix
71
+ }
72
+ }));
73
+ const require = createRequire(import.meta.url);
74
+ api.modifyBundlerChain((chain, { isDev, environment })=>{
75
+ const { action } = api.context;
76
+ if ('dev' !== action && !isDev) return;
77
+ const rsbuildPath = require.resolve('@rsbuild/core');
78
+ const rspeedyDir = external_node_path_["default"].dirname(require.resolve('@lynx-js/rspeedy/package.json'));
79
+ const searchParams = new URLSearchParams({
80
+ hostname,
81
+ port: api.context.devServer?.port?.toString() ?? '',
82
+ pathname: '/rsbuild-hmr',
83
+ hot: options?.hmr ?? true ? 'true' : 'false',
84
+ 'live-reload': options?.liveReload ?? true ? 'true' : 'false',
85
+ protocol: 'ws'
86
+ });
87
+ if (environment.webSocketToken) searchParams.set('token', environment.webSocketToken);
88
+ chain.resolve.alias.set('webpack/hot/log.js', require.resolve('@rspack/core/hot/log', {
89
+ paths: [
90
+ rsbuildPath
91
+ ]
92
+ })).set('webpack/hot/emitter.js', require.resolve('@rspack/core/hot/emitter', {
93
+ paths: [
94
+ rsbuildPath
95
+ ]
96
+ })).set('@lynx-js/webpack-dev-transport/client', `${require.resolve('@lynx-js/webpack-dev-transport/client')}?${searchParams.toString()}`).set('@rspack/core/hot/dev-server', require.resolve('@rspack/core/hot/dev-server', {
97
+ paths: [
98
+ rsbuildPath
99
+ ]
100
+ })).end().end().plugin('lynx.hmr.provide').use(ProvidePlugin_ProvidePlugin, [
101
+ {
102
+ WebSocket: [
103
+ options?.client?.websocketTransport ?? require.resolve('@lynx-js/websocket'),
104
+ 'default'
105
+ ],
106
+ __webpack_dev_server_client__: [
107
+ require.resolve('./client/hmr/WebSocketClient.js', {
108
+ paths: [
109
+ rspeedyDir
110
+ ]
111
+ }),
112
+ 'default'
113
+ ]
114
+ }
115
+ ]).end();
116
+ });
117
+ }
118
+ };
119
+ }
120
+ async function findIp(family, isInternal = false) {
121
+ const [{ default: ipaddr }, os] = await Promise.all([
122
+ __webpack_require__.e("vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js").then(__webpack_require__.t.bind(__webpack_require__, "../../../node_modules/.pnpm/ipaddr.js@2.2.0/node_modules/ipaddr.js/lib/ipaddr.js", 23)),
123
+ import("node:os")
124
+ ]);
125
+ let host;
126
+ const networks = Object.values(os.networkInterfaces()).flatMap((networks)=>networks ?? []).filter((network)=>{
127
+ if (!network || !network.address) return false;
128
+ if (network.family !== `IP${family}`) return false;
129
+ if (network.internal !== isInternal) return false;
130
+ if ('v6' === family) {
131
+ const range = ipaddr.parse(network.address).range();
132
+ if ('ipv4Mapped' !== range && 'uniqueLocal' !== range) return false;
133
+ }
134
+ return network.address;
135
+ });
136
+ if (networks.length > 0) {
137
+ host = networks[0].address;
138
+ if (host.includes(':')) host = `[${host}]`;
139
+ }
140
+ if (!host) throw new Error("No valid IP found");
141
+ return host;
142
+ }
143
+ }
144
+ };
@@ -0,0 +1,22 @@
1
+ export const __webpack_id__ = "src_plugins_emitOnErrors_plugin_ts";
2
+ export const __webpack_ids__ = [
3
+ "src_plugins_emitOnErrors_plugin_ts"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "./src/plugins/emitOnErrors.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.r(__webpack_exports__);
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ pluginEmitOnErrors: ()=>pluginEmitOnErrors
10
+ });
11
+ function pluginEmitOnErrors() {
12
+ return {
13
+ name: 'lynx:rsbuild:emit-on-errors',
14
+ setup (api) {
15
+ api.modifyBundlerChain((chain)=>{
16
+ chain.optimization.emitOnErrors(true);
17
+ });
18
+ }
19
+ };
20
+ }
21
+ }
22
+ };
@@ -0,0 +1,52 @@
1
+ export const __webpack_id__ = "src_plugins_index_ts";
2
+ export const __webpack_ids__ = [
3
+ "src_plugins_index_ts"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "./src/plugins/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.r(__webpack_exports__);
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ applyDefaultPlugins: ()=>applyDefaultPlugins
10
+ });
11
+ var _debug_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/debug.ts");
12
+ async function applyDebugPlugins(rsbuildInstance, config) {
13
+ const debugPlugins = Object.freeze([
14
+ __webpack_require__.e("src_plugins_emitOnErrors_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/emitOnErrors.plugin.ts")).then(({ pluginEmitOnErrors })=>pluginEmitOnErrors()),
15
+ Promise.all([
16
+ __webpack_require__.e("vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc"),
17
+ __webpack_require__.e("src_plugins_inspect_plugin_ts")
18
+ ]).then(__webpack_require__.bind(__webpack_require__, "./src/plugins/inspect.plugin.ts")).then(({ pluginInspect })=>pluginInspect(config))
19
+ ]);
20
+ rsbuildInstance.addPlugins(await Promise.all(debugPlugins));
21
+ }
22
+ async function applyDefaultPlugins(rsbuildInstance, config) {
23
+ const defaultPlugins = Object.freeze([
24
+ __webpack_require__.e("src_plugins_api_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/api.plugin.ts")).then(({ pluginAPI })=>pluginAPI(config)),
25
+ __webpack_require__.e("src_plugins_chunkLoading_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/chunkLoading.plugin.ts")).then(({ pluginChunkLoading })=>pluginChunkLoading()),
26
+ __webpack_require__.e("src_plugins_dev_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/dev.plugin.ts")).then(({ pluginDev })=>pluginDev(config.dev, config.server)),
27
+ __webpack_require__.e("src_plugins_minify_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/minify.plugin.ts")).then(({ pluginMinify })=>pluginMinify(config.output?.minify)),
28
+ __webpack_require__.e("src_plugins_optimization_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/optimization.plugin.ts")).then(({ pluginOptimization })=>pluginOptimization()),
29
+ __webpack_require__.e("src_plugins_output_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/output.plugin.ts")).then(({ pluginOutput })=>pluginOutput(config.output)),
30
+ __webpack_require__.e("src_plugins_resolve_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/resolve.plugin.ts")).then(({ pluginResolve })=>pluginResolve()),
31
+ __webpack_require__.e("src_plugins_rsdoctor_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/rsdoctor.plugin.ts")).then(({ pluginRsdoctor })=>pluginRsdoctor(config.tools?.rsdoctor)),
32
+ __webpack_require__.e("src_plugins_sourcemap_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/sourcemap.plugin.ts")).then(({ pluginSourcemap })=>pluginSourcemap()),
33
+ __webpack_require__.e("src_plugins_swc_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/swc.plugin.ts")).then(({ pluginSwc })=>pluginSwc()),
34
+ __webpack_require__.e("src_plugins_target_plugin_ts").then(__webpack_require__.bind(__webpack_require__, "./src/plugins/target.plugin.ts")).then(({ pluginTarget })=>pluginTarget())
35
+ ]);
36
+ const promises = [
37
+ Promise.all(defaultPlugins).then((plugins)=>{
38
+ rsbuildInstance.addPlugins(plugins);
39
+ })
40
+ ];
41
+ if ((0, _debug_js__WEBPACK_IMPORTED_MODULE_0__._o)()) {
42
+ (0, _debug_js__WEBPACK_IMPORTED_MODULE_0__.Yz)('apply Rspeedy default debug plugins');
43
+ promises.push(applyDebugPlugins(rsbuildInstance, config));
44
+ }
45
+ await Promise.all(promises);
46
+ const { pluginCssMinimizer, PLUGIN_CSS_MINIMIZER_NAME } = await import("@rsbuild/plugin-css-minimizer");
47
+ if (!rsbuildInstance.isPluginExists(PLUGIN_CSS_MINIMIZER_NAME)) rsbuildInstance.addPlugins([
48
+ pluginCssMinimizer()
49
+ ]);
50
+ }
51
+ }
52
+ };
@@ -0,0 +1,49 @@
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ export const __webpack_id__ = "src_plugins_inspect_plugin_ts";
3
+ export const __webpack_ids__ = [
4
+ "src_plugins_inspect_plugin_ts"
5
+ ];
6
+ export const __webpack_modules__ = {
7
+ "./src/config/output/dist-path.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ z: ()=>DEFAULT_DIST_PATH_INTERMEDIATE
10
+ });
11
+ const DEFAULT_DIST_PATH_INTERMEDIATE = '.rspeedy';
12
+ },
13
+ "./src/plugins/inspect.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
14
+ __webpack_require__.r(__webpack_exports__);
15
+ __webpack_require__.d(__webpack_exports__, {
16
+ inspectRspeedyConfig: ()=>inspectRspeedyConfig,
17
+ pluginInspect: ()=>pluginInspect
18
+ });
19
+ var external_node_path_ = __webpack_require__("node:path");
20
+ var core_ = __webpack_require__("@rsbuild/core");
21
+ var dist = __webpack_require__("../../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js");
22
+ var picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
23
+ var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
24
+ var dist_path = __webpack_require__("./src/config/output/dist-path.ts");
25
+ var debug = __webpack_require__("./src/debug.ts");
26
+ function pluginInspect(config) {
27
+ return {
28
+ name: 'lynx:rsbuild:inspect',
29
+ setup (api) {
30
+ api.onBeforeBuild(async ()=>{
31
+ await inspectRspeedyConfig(config, external_node_path_["default"].join(api.context.distPath, dist_path.z, 'rspeedy.config.js'), false);
32
+ });
33
+ }
34
+ };
35
+ }
36
+ async function inspectRspeedyConfig(config, path, verbose) {
37
+ const stringifiedConfig = (0, dist.stringify)(config, (value, _, stringify)=>{
38
+ if ('function' == typeof value && !verbose && value.toString().length > 100) return "function () { /* omitted long function */ }";
39
+ return stringify(value);
40
+ }, 2);
41
+ if (!stringifiedConfig) return void (0, debug.Yz)('No Rspeedy config found, skip inspect config.');
42
+ await mkdir((0, external_node_path_.dirname)(path), {
43
+ recursive: true
44
+ });
45
+ await writeFile(path, `export default ${stringifiedConfig}`);
46
+ core_.logger.success(`Inspect Rspeedy config succeed, open following files to view the content: \n\n - ${picocolors_default().bold(picocolors_default().yellow('Rspeedy'))}: ${picocolors_default().underline(path)}\n`);
47
+ }
48
+ }
49
+ };
@@ -0,0 +1,86 @@
1
+ export const __webpack_id__ = "src_plugins_minify_plugin_ts";
2
+ export const __webpack_ids__ = [
3
+ "src_plugins_minify_plugin_ts"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "./src/plugins/minify.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.r(__webpack_exports__);
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ pluginMinify: ()=>pluginMinify
10
+ });
11
+ var _debug_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/debug.ts");
12
+ function pluginMinify(options) {
13
+ const defaultConfig = Object.freeze({
14
+ output: {
15
+ minify: {
16
+ js: true,
17
+ jsOptions: {
18
+ minimizerOptions: {
19
+ compress: {
20
+ negate_iife: false,
21
+ join_vars: false,
22
+ ecma: 2015,
23
+ inline: 2,
24
+ comparisons: false,
25
+ toplevel: true,
26
+ side_effects: false
27
+ },
28
+ format: {
29
+ keep_quoted_props: true,
30
+ comments: false
31
+ },
32
+ mangle: {
33
+ toplevel: true
34
+ }
35
+ }
36
+ },
37
+ css: true,
38
+ cssOptions: {
39
+ minimizerOptions: {
40
+ targets: '',
41
+ include: {
42
+ nesting: true,
43
+ doublePositionGradients: true,
44
+ spaceSeparatedColorNotation: true
45
+ },
46
+ exclude: {
47
+ vendorPrefixes: true,
48
+ logicalProperties: true,
49
+ hexAlphaColors: true
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ });
56
+ return {
57
+ name: 'lynx:rsbuild:minify',
58
+ setup (api) {
59
+ api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
60
+ if (false === options) {
61
+ (0, _debug_js__WEBPACK_IMPORTED_MODULE_0__.Yz)("minification disabled");
62
+ return mergeRsbuildConfig(config, {
63
+ output: {
64
+ minify: false
65
+ }
66
+ });
67
+ }
68
+ const configs = [
69
+ config,
70
+ defaultConfig
71
+ ];
72
+ if (true !== options && void 0 !== options) {
73
+ (0, _debug_js__WEBPACK_IMPORTED_MODULE_0__.Yz)("merging minification options");
74
+ configs.push({
75
+ output: {
76
+ minify: options
77
+ }
78
+ });
79
+ }
80
+ return mergeRsbuildConfig(...configs);
81
+ });
82
+ }
83
+ };
84
+ }
85
+ }
86
+ };
@@ -0,0 +1,26 @@
1
+ export const __webpack_id__ = "src_plugins_optimization_plugin_ts";
2
+ export const __webpack_ids__ = [
3
+ "src_plugins_optimization_plugin_ts"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "./src/plugins/optimization.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.r(__webpack_exports__);
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ pluginOptimization: ()=>pluginOptimization
10
+ });
11
+ function pluginOptimization() {
12
+ return {
13
+ name: 'lynx:rsbuild:optimization',
14
+ setup (api) {
15
+ api.modifyBundlerChain((chain, { CHAIN_ID, isProd })=>{
16
+ const rule = chain.module.rules.get(CHAIN_ID.RULE.JS);
17
+ chain.module.rule('js-override-strict').type(rule.get('type')).test(rule.get('test')).parser({
18
+ overrideStrict: 'strict'
19
+ }).end();
20
+ if (isProd) chain.optimization.avoidEntryIife(true);
21
+ });
22
+ }
23
+ };
24
+ }
25
+ }
26
+ };
@@ -0,0 +1,47 @@
1
+ export const __webpack_id__ = "src_plugins_output_plugin_ts";
2
+ export const __webpack_ids__ = [
3
+ "src_plugins_output_plugin_ts"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "./src/config/output/dist-path.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.d(__webpack_exports__, {
8
+ z: ()=>DEFAULT_DIST_PATH_INTERMEDIATE
9
+ });
10
+ const DEFAULT_DIST_PATH_INTERMEDIATE = '.rspeedy';
11
+ },
12
+ "./src/plugins/output.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
13
+ __webpack_require__.r(__webpack_exports__);
14
+ __webpack_require__.d(__webpack_exports__, {
15
+ pluginOutput: ()=>pluginOutput
16
+ });
17
+ var _config_output_dist_path_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/config/output/dist-path.ts");
18
+ const defaultFilenameOptions = Object.freeze({
19
+ css: '[name]/[name].css'
20
+ });
21
+ const defaultDistPathOptions = Object.freeze({
22
+ css: _config_output_dist_path_js__WEBPACK_IMPORTED_MODULE_0__.z
23
+ });
24
+ function pluginOutput(options) {
25
+ return {
26
+ name: 'lynx:rsbuild:output',
27
+ setup (api) {
28
+ api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
29
+ if (!options) return mergeRsbuildConfig({
30
+ output: {
31
+ filename: {
32
+ css: defaultFilenameOptions.css
33
+ }
34
+ }
35
+ }, config);
36
+ return mergeRsbuildConfig(config, {
37
+ output: {
38
+ distPath: Object.assign({}, defaultDistPathOptions, options.distPath),
39
+ filename: Object.assign({}, defaultFilenameOptions, options.filename)
40
+ }
41
+ });
42
+ });
43
+ }
44
+ };
45
+ }
46
+ }
47
+ };
@@ -0,0 +1,22 @@
1
+ export const __webpack_id__ = "src_plugins_resolve_plugin_ts";
2
+ export const __webpack_ids__ = [
3
+ "src_plugins_resolve_plugin_ts"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "./src/plugins/resolve.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.r(__webpack_exports__);
8
+ __webpack_require__.d(__webpack_exports__, {
9
+ pluginResolve: ()=>pluginResolve
10
+ });
11
+ function pluginResolve() {
12
+ return {
13
+ name: 'lynx:rsbuild:resolve',
14
+ setup (api) {
15
+ api.modifyBundlerChain((chain)=>{
16
+ chain.resolve.aliasFields.add('browser').end().conditionNames.add('lynx').add('import').add('require').add('browser').end().extensions.add('.cjs').end().mainFields.add('lynx').add('module').add('main').end().mainFiles.add('index.lynx').add('index').end().end().end();
17
+ });
18
+ }
19
+ };
20
+ }
21
+ }
22
+ };