@lynx-js/rspeedy-canary 0.13.0-canary-20260105-ec1caf1a → 0.13.0-canary-20260105-03ea61ec
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 +1 -1
- package/dist/{0~vendors-node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js → 0~node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js} +3 -6
- package/dist/0~src_cli_exit_ts.js +98 -108
- package/dist/0~src_config_output_dist-path_ts.js +2 -0
- package/dist/0~src_config_validate_ts.js +41917 -41925
- package/dist/0~src_plugins_api_plugin_ts.js +21 -31
- package/dist/0~src_plugins_chunkLoading_plugin_ts.js +10 -20
- package/dist/0~src_plugins_dev_plugin_ts.js +168 -179
- package/dist/0~src_plugins_emitOnErrors_plugin_ts.js +10 -20
- package/dist/0~src_plugins_index_ts.js +63 -51
- package/dist/0~src_plugins_inspect_plugin_ts.js +434 -39
- package/dist/0~src_plugins_minify_plugin_ts.js +66 -76
- package/dist/0~src_plugins_optimization_plugin_ts.js +14 -24
- package/dist/0~src_plugins_output_plugin_ts.js +29 -45
- package/dist/0~src_plugins_resolve_plugin_ts.js +10 -20
- package/dist/0~src_plugins_rsdoctor_plugin_ts.js +39 -49
- package/dist/0~src_plugins_sourcemap_plugin_ts.js +86 -96
- package/dist/0~src_plugins_swc_plugin_ts.js +20 -38
- package/dist/0~src_plugins_target_plugin_ts.js +21 -39
- package/dist/0~src_utils_getESVersionTarget_ts.js +4 -0
- package/dist/1~node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js +1422 -0
- package/dist/{1~vendors-node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js → 1~node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js} +17 -24
- package/dist/{1~vendors-node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js → 1~node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js} +3 -6
- package/dist/1~src_cli_build_ts.js +35 -424
- package/dist/1~src_cli_commands_ts.js +56 -74
- package/dist/1~src_cli_dev_ts.js +29 -410
- package/dist/1~src_cli_init_ts-src_create-rspeedy_ts.js +318 -0
- package/dist/1~src_cli_inspect_ts.js +18 -356
- package/dist/1~src_cli_preview_ts.js +23 -359
- package/dist/1~src_cli_watch_ts.js +39 -0
- package/dist/1~src_config_output_dist-path_ts.js +2 -0
- package/dist/1~src_config_validate_ts.js +41917 -41925
- package/dist/1~src_plugins_api_plugin_ts.js +22 -31
- package/dist/1~src_plugins_chunkLoading_plugin_ts.js +10 -20
- package/dist/1~src_plugins_dev_plugin_ts.js +170 -179
- package/dist/1~src_plugins_emitOnErrors_plugin_ts.js +10 -20
- package/dist/1~src_plugins_index_ts.js +63 -51
- package/dist/1~src_plugins_inspect_plugin_ts.js +436 -39
- package/dist/1~src_plugins_minify_plugin_ts.js +66 -76
- package/dist/1~src_plugins_optimization_plugin_ts.js +14 -24
- package/dist/1~src_plugins_output_plugin_ts.js +29 -45
- package/dist/1~src_plugins_resolve_plugin_ts.js +10 -20
- package/dist/1~src_plugins_rsdoctor_plugin_ts.js +37 -55
- package/dist/1~src_plugins_sourcemap_plugin_ts.js +86 -96
- package/dist/1~src_plugins_swc_plugin_ts.js +20 -38
- package/dist/1~src_plugins_target_plugin_ts.js +21 -39
- package/dist/1~src_utils_getESVersionTarget_ts.js +4 -0
- package/dist/1~src_utils_is-ci_ts.js +4 -0
- package/dist/1~src_version_ts.js +6 -18
- package/dist/cli/main.js +1 -357
- package/dist/cli/start.js +16 -130
- package/dist/index.js +1 -524
- package/dist/node_fs.js +7 -0
- package/dist/node_path.js +7 -0
- package/dist/node_url.js +1 -0
- package/dist/rslib-runtime.js +75 -0
- package/dist/src_cli_main_ts.js +149 -0
- package/dist/src_debug_ts.js +93 -0
- package/dist/src_index_ts.js +381 -0
- package/package.json +1 -1
- package/dist/0~vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc.js +0 -417
- package/dist/1~events-fs-fs_promises-os-path-stream.js +0 -30
- package/dist/1~node_child_process-node_events-node_fs-node_path.js +0 -22
- package/dist/1~vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js +0 -1432
- package/dist/1~vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc.js +0 -417
- /package/dist/{1~vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt → 1~node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt} +0 -0
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
name: 'lynx:rsbuild:optimization',
|
|
13
|
-
setup (api) {
|
|
14
|
-
api.modifyBundlerChain((chain, { CHAIN_ID, isProd })=>{
|
|
15
|
-
const rule = chain.module.rules.get(CHAIN_ID.RULE.JS);
|
|
16
|
-
chain.module.rule('js-override-strict').type(rule.get('type')).test(rule.get('test')).parser({
|
|
17
|
-
overrideStrict: 'strict'
|
|
18
|
-
}).end();
|
|
19
|
-
if (isProd) chain.optimization.avoidEntryIife(true);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
};
|
|
1
|
+
function pluginOptimization() {
|
|
2
|
+
return {
|
|
3
|
+
name: 'lynx:rsbuild:optimization',
|
|
4
|
+
setup (api) {
|
|
5
|
+
api.modifyBundlerChain((chain, { CHAIN_ID, isProd })=>{
|
|
6
|
+
const rule = chain.module.rules.get(CHAIN_ID.RULE.JS);
|
|
7
|
+
chain.module.rule('js-override-strict').type(rule.get('type')).test(rule.get('test')).parser({
|
|
8
|
+
overrideStrict: 'strict'
|
|
9
|
+
}).end();
|
|
10
|
+
if (isProd) chain.optimization.avoidEntryIife(true);
|
|
11
|
+
});
|
|
23
12
|
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export { pluginOptimization };
|
|
@@ -1,46 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
|
|
28
|
-
if (!options) return mergeRsbuildConfig({
|
|
29
|
-
output: {
|
|
30
|
-
filename: {
|
|
31
|
-
css: defaultFilenameOptions.css
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}, config);
|
|
35
|
-
return mergeRsbuildConfig(config, {
|
|
36
|
-
output: {
|
|
37
|
-
distPath: Object.assign({}, defaultDistPathOptions, options.distPath),
|
|
38
|
-
filename: Object.assign({}, defaultFilenameOptions, options.filename)
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
};
|
|
1
|
+
import { DEFAULT_DIST_PATH_INTERMEDIATE } from "./1~src_config_output_dist-path_ts.js";
|
|
2
|
+
const defaultFilenameOptions = Object.freeze({
|
|
3
|
+
css: '[name]/[name].css'
|
|
4
|
+
});
|
|
5
|
+
const defaultDistPathOptions = Object.freeze({
|
|
6
|
+
css: DEFAULT_DIST_PATH_INTERMEDIATE
|
|
7
|
+
});
|
|
8
|
+
function pluginOutput(options) {
|
|
9
|
+
return {
|
|
10
|
+
name: 'lynx:rsbuild:output',
|
|
11
|
+
setup (api) {
|
|
12
|
+
api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
|
|
13
|
+
if (!options) return mergeRsbuildConfig({
|
|
14
|
+
output: {
|
|
15
|
+
filename: {
|
|
16
|
+
css: defaultFilenameOptions.css
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}, config);
|
|
20
|
+
return mergeRsbuildConfig(config, {
|
|
21
|
+
output: {
|
|
22
|
+
distPath: Object.assign({}, defaultDistPathOptions, options.distPath),
|
|
23
|
+
filename: Object.assign({}, defaultFilenameOptions, options.filename)
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
44
27
|
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export { pluginOutput };
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
pluginResolve: ()=>pluginResolve
|
|
9
|
-
});
|
|
10
|
-
function pluginResolve() {
|
|
11
|
-
return {
|
|
12
|
-
name: 'lynx:rsbuild:resolve',
|
|
13
|
-
setup (api) {
|
|
14
|
-
api.modifyBundlerChain((chain)=>{
|
|
15
|
-
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();
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
};
|
|
1
|
+
function pluginResolve() {
|
|
2
|
+
return {
|
|
3
|
+
name: 'lynx:rsbuild:resolve',
|
|
4
|
+
setup (api) {
|
|
5
|
+
api.modifyBundlerChain((chain)=>{
|
|
6
|
+
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();
|
|
7
|
+
});
|
|
19
8
|
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export { pluginResolve };
|
|
@@ -1,59 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
supports: {
|
|
30
|
-
banner: true
|
|
31
|
-
},
|
|
32
|
-
linter: {
|
|
33
|
-
rules: {
|
|
34
|
-
'ecma-version-check': options?.linter?.rules?.['ecma-version-check'] ?? [
|
|
35
|
-
'Warn',
|
|
36
|
-
{
|
|
37
|
-
ecmaVersion: 2019
|
|
38
|
-
}
|
|
39
|
-
]
|
|
1
|
+
import { mergeRsbuildConfig, logger } from "./src_debug_ts.js";
|
|
2
|
+
import { isCI } from "./1~src_utils_is-ci_ts.js";
|
|
3
|
+
function pluginRsdoctor(options) {
|
|
4
|
+
return {
|
|
5
|
+
name: 'lynx:rsbuild:rsdoctor',
|
|
6
|
+
remove: [
|
|
7
|
+
'rsbuild:rsdoctor'
|
|
8
|
+
],
|
|
9
|
+
setup (api) {
|
|
10
|
+
if ('true' !== process.env['RSDOCTOR']) return;
|
|
11
|
+
api.onBeforeCreateCompiler(async ({ bundlerConfigs })=>{
|
|
12
|
+
const { RsdoctorRspackPlugin } = await import("@rsdoctor/rspack-plugin");
|
|
13
|
+
for (const config of bundlerConfigs){
|
|
14
|
+
const pluginName = 'RsdoctorRspackPlugin';
|
|
15
|
+
const registered = config.plugins?.some((plugin)=>'object' == typeof plugin && plugin?.['isRsdoctorPlugin'] === true || plugin?.constructor?.name === pluginName);
|
|
16
|
+
if (registered) continue;
|
|
17
|
+
config.plugins ??= [];
|
|
18
|
+
const defaultOptions = {
|
|
19
|
+
disableClientServer: isCI(),
|
|
20
|
+
supports: {
|
|
21
|
+
banner: true
|
|
22
|
+
},
|
|
23
|
+
linter: {
|
|
24
|
+
rules: {
|
|
25
|
+
'ecma-version-check': options?.linter?.rules?.['ecma-version-check'] ?? [
|
|
26
|
+
'Warn',
|
|
27
|
+
{
|
|
28
|
+
ecmaVersion: 2019
|
|
40
29
|
}
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
config.plugins.push(new RsdoctorRspackPlugin((0, _rsbuild_core__rspack_import_0.mergeRsbuildConfig)(defaultOptions, options)));
|
|
30
|
+
]
|
|
31
|
+
}
|
|
44
32
|
}
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
};
|
|
34
|
+
config.plugins.push(new RsdoctorRspackPlugin(mergeRsbuildConfig(defaultOptions, options)));
|
|
47
35
|
}
|
|
48
|
-
|
|
36
|
+
logger.info("Rsdoctor is enabled.");
|
|
37
|
+
});
|
|
49
38
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
J: ()=>isCI
|
|
54
|
-
});
|
|
55
|
-
function isCI() {
|
|
56
|
-
return !!process.env['CI'] && 'false' !== process.env['CI'];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export { pluginRsdoctor };
|
|
@@ -1,99 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const DEFAULT_DEV_DEVTOOL = 'cheap-module-source-map';
|
|
54
|
-
switch(typeof output?.sourceMap){
|
|
55
|
-
case 'boolean':
|
|
56
|
-
if (output.sourceMap) return isDev ? DEFAULT_DEV_DEVTOOL : 'source-map';
|
|
57
|
-
return false;
|
|
58
|
-
case 'undefined':
|
|
59
|
-
case 'object':
|
|
60
|
-
return output?.sourceMap?.js ?? (isDev ? DEFAULT_DEV_DEVTOOL : false);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
1
|
+
var isProduction = 'production' === process.env.NODE_ENV;
|
|
2
|
+
var prefix = 'Invariant failed';
|
|
3
|
+
function invariant(condition, message) {
|
|
4
|
+
if (condition) return;
|
|
5
|
+
if (isProduction) throw new Error(prefix);
|
|
6
|
+
var provided = 'function' == typeof message ? message() : message;
|
|
7
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
8
|
+
throw new Error(value);
|
|
9
|
+
}
|
|
10
|
+
class EvalSourceMapDevToolPlugin_EvalSourceMapDevToolPlugin {
|
|
11
|
+
options;
|
|
12
|
+
constructor(options){
|
|
13
|
+
this.options = options;
|
|
14
|
+
}
|
|
15
|
+
apply(compiler) {
|
|
16
|
+
const { EvalSourceMapDevToolPlugin } = compiler.webpack;
|
|
17
|
+
new EvalSourceMapDevToolPlugin(this.options).apply(compiler);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
class SourceMapDevToolPlugin_SourceMapDevToolPlugin {
|
|
21
|
+
options;
|
|
22
|
+
constructor(options){
|
|
23
|
+
this.options = options;
|
|
24
|
+
}
|
|
25
|
+
apply(compiler) {
|
|
26
|
+
const { SourceMapDevToolPlugin } = compiler.webpack;
|
|
27
|
+
new SourceMapDevToolPlugin(this.options).apply(compiler);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function pluginSourcemap() {
|
|
31
|
+
return {
|
|
32
|
+
name: 'lynx:rsbuild:sourcemap',
|
|
33
|
+
pre: [
|
|
34
|
+
'lynx:rsbuild:dev'
|
|
35
|
+
],
|
|
36
|
+
setup (api) {
|
|
37
|
+
api.modifyBundlerChain((chain, { isDev })=>{
|
|
38
|
+
const { dev, output, server } = api.getRsbuildConfig('current');
|
|
39
|
+
const publicPath = isDev ? dev?.assetPrefix : output?.assetPrefix;
|
|
40
|
+
if (false === publicPath) return;
|
|
41
|
+
invariant('string' == typeof publicPath || void 0 === publicPath, `dev.assetPrefix should be normalized to string, got ${dev?.assetPrefix}`);
|
|
42
|
+
applySourceMapPlugin(chain, getDevtoolFromSourceMap(), publicPath?.replaceAll('<port>', String(api.context.devServer?.port ?? server?.port)));
|
|
43
|
+
function getDevtoolFromSourceMap() {
|
|
44
|
+
const DEFAULT_DEV_DEVTOOL = 'cheap-module-source-map';
|
|
45
|
+
switch(typeof output?.sourceMap){
|
|
46
|
+
case 'boolean':
|
|
47
|
+
if (output.sourceMap) return isDev ? DEFAULT_DEV_DEVTOOL : 'source-map';
|
|
48
|
+
return false;
|
|
49
|
+
case 'undefined':
|
|
50
|
+
case 'object':
|
|
51
|
+
return output?.sourceMap?.js ?? (isDev ? DEFAULT_DEV_DEVTOOL : false);
|
|
52
|
+
}
|
|
64
53
|
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function applySourceMapPlugin(chain, devtool, publicPath) {
|
|
68
|
-
if (false === devtool) return;
|
|
69
|
-
const CHAIN_ID_DEV_SOURCEMAP = 'lynx:sourcemap';
|
|
70
|
-
const output = chain.get('output');
|
|
71
|
-
if (devtool.includes('source-map')) {
|
|
72
|
-
const hidden = devtool.includes('hidden');
|
|
73
|
-
const inline = devtool.includes('inline');
|
|
74
|
-
const evalWrapped = devtool.includes('eval');
|
|
75
|
-
const cheap = devtool.includes('cheap');
|
|
76
|
-
const moduleMaps = devtool.includes('module');
|
|
77
|
-
const noSources = devtool.includes('nosources');
|
|
78
|
-
const debugIds = devtool.includes('debugids');
|
|
79
|
-
const options = {
|
|
80
|
-
filename: inline ? null : output?.sourceMapFilename ?? '[file].map[query]',
|
|
81
|
-
moduleFilenameTemplate: output?.devtoolModuleFilenameTemplate ?? 'file://[absolute-resource-path]',
|
|
82
|
-
fallbackModuleFilenameTemplate: output?.devtoolFallbackModuleFilenameTemplate ?? 'file://[absolute-resource-path]?[hash]',
|
|
83
|
-
append: hidden ? false : void 0,
|
|
84
|
-
module: moduleMaps ? true : !cheap,
|
|
85
|
-
columns: !cheap,
|
|
86
|
-
noSources,
|
|
87
|
-
namespace: output?.devtoolNamespace,
|
|
88
|
-
publicPath,
|
|
89
|
-
debugIds
|
|
90
|
-
};
|
|
91
|
-
chain.devtool(false).plugin(CHAIN_ID_DEV_SOURCEMAP).when(evalWrapped, (plugin)=>plugin.use(EvalSourceMapDevToolPlugin_EvalSourceMapDevToolPlugin, [
|
|
92
|
-
options
|
|
93
|
-
]), (plugin)=>plugin.use(SourceMapDevToolPlugin_SourceMapDevToolPlugin, [
|
|
94
|
-
options
|
|
95
|
-
]));
|
|
96
|
-
}
|
|
54
|
+
});
|
|
97
55
|
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function applySourceMapPlugin(chain, devtool, publicPath) {
|
|
59
|
+
if (false === devtool) return;
|
|
60
|
+
const CHAIN_ID_DEV_SOURCEMAP = 'lynx:sourcemap';
|
|
61
|
+
const output = chain.get('output');
|
|
62
|
+
if (devtool.includes('source-map')) {
|
|
63
|
+
const hidden = devtool.includes('hidden');
|
|
64
|
+
const inline = devtool.includes('inline');
|
|
65
|
+
const evalWrapped = devtool.includes('eval');
|
|
66
|
+
const cheap = devtool.includes('cheap');
|
|
67
|
+
const moduleMaps = devtool.includes('module');
|
|
68
|
+
const noSources = devtool.includes('nosources');
|
|
69
|
+
const debugIds = devtool.includes('debugids');
|
|
70
|
+
const options = {
|
|
71
|
+
filename: inline ? null : output?.sourceMapFilename ?? '[file].map[query]',
|
|
72
|
+
moduleFilenameTemplate: output?.devtoolModuleFilenameTemplate ?? 'file://[absolute-resource-path]',
|
|
73
|
+
fallbackModuleFilenameTemplate: output?.devtoolFallbackModuleFilenameTemplate ?? 'file://[absolute-resource-path]?[hash]',
|
|
74
|
+
append: hidden ? false : void 0,
|
|
75
|
+
module: moduleMaps ? true : !cheap,
|
|
76
|
+
columns: !cheap,
|
|
77
|
+
noSources,
|
|
78
|
+
namespace: output?.devtoolNamespace,
|
|
79
|
+
publicPath,
|
|
80
|
+
debugIds
|
|
81
|
+
};
|
|
82
|
+
chain.devtool(false).plugin(CHAIN_ID_DEV_SOURCEMAP).when(evalWrapped, (plugin)=>plugin.use(EvalSourceMapDevToolPlugin_EvalSourceMapDevToolPlugin, [
|
|
83
|
+
options
|
|
84
|
+
]), (plugin)=>plugin.use(SourceMapDevToolPlugin_SourceMapDevToolPlugin, [
|
|
85
|
+
options
|
|
86
|
+
]));
|
|
98
87
|
}
|
|
99
|
-
}
|
|
88
|
+
}
|
|
89
|
+
export { pluginSourcemap };
|
|
@@ -1,39 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
tools: {
|
|
19
|
-
swc (config) {
|
|
20
|
-
delete config.env;
|
|
21
|
-
config.jsc ??= {};
|
|
22
|
-
config.jsc.target = (0, _utils_getESVersionTarget_js__rspack_import_0.y)(isProd);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
};
|
|
1
|
+
import { getESVersionTarget } from "./1~src_utils_getESVersionTarget_ts.js";
|
|
2
|
+
function pluginSwc() {
|
|
3
|
+
return {
|
|
4
|
+
name: 'lynx:rsbuild:swc',
|
|
5
|
+
setup (api) {
|
|
6
|
+
api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
|
|
7
|
+
const isProd = 'production' === config.mode;
|
|
8
|
+
return mergeRsbuildConfig(config, {
|
|
9
|
+
tools: {
|
|
10
|
+
swc (config) {
|
|
11
|
+
delete config.env;
|
|
12
|
+
config.jsc ??= {};
|
|
13
|
+
config.jsc.target = getESVersionTarget(isProd);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
29
18
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
y: ()=>getESVersionTarget
|
|
34
|
-
});
|
|
35
|
-
function getESVersionTarget(isProd) {
|
|
36
|
-
return isProd ? 'es2015' : 'es2019';
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export { pluginSwc };
|
|
@@ -1,40 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { getESVersionTarget } from "./1~src_utils_getESVersionTarget_ts.js";
|
|
2
|
+
function isWeb(environment) {
|
|
3
|
+
const environmentName = 'string' == typeof environment ? environment : environment.name;
|
|
4
|
+
return 'web' === environmentName || environmentName.startsWith('web-');
|
|
5
|
+
}
|
|
6
|
+
function pluginTarget() {
|
|
7
|
+
return {
|
|
8
|
+
name: 'lynx:rsbuild:target',
|
|
9
|
+
setup (api) {
|
|
10
|
+
api.modifyBundlerChain((options, { environment, isProd })=>{
|
|
11
|
+
if (isWeb(environment)) options.target([
|
|
12
|
+
getESVersionTarget(isProd),
|
|
13
|
+
'web'
|
|
14
|
+
]);
|
|
15
|
+
else options.target([
|
|
16
|
+
getESVersionTarget(isProd)
|
|
17
|
+
]);
|
|
18
|
+
});
|
|
14
19
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
setup (api) {
|
|
19
|
-
api.modifyBundlerChain((options, { environment, isProd })=>{
|
|
20
|
-
if (isWeb(environment)) options.target([
|
|
21
|
-
(0, getESVersionTarget.y)(isProd),
|
|
22
|
-
'web'
|
|
23
|
-
]);
|
|
24
|
-
else options.target([
|
|
25
|
-
(0, getESVersionTarget.y)(isProd)
|
|
26
|
-
]);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"./src/utils/getESVersionTarget.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
33
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
34
|
-
y: ()=>getESVersionTarget
|
|
35
|
-
});
|
|
36
|
-
function getESVersionTarget(isProd) {
|
|
37
|
-
return isProd ? 'es2015' : 'es2019';
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export { pluginTarget };
|
package/dist/1~src_version_ts.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"
|
|
4
|
-
];
|
|
5
|
-
export const __webpack_modules__ = {
|
|
6
|
-
"./src/version.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
8
|
-
version: ()=>version,
|
|
9
|
-
rspackVersion: ()=>rspackVersion,
|
|
10
|
-
rsbuildVersion: ()=>core_.version
|
|
11
|
-
});
|
|
12
|
-
var core_ = __webpack_require__("@rsbuild/core");
|
|
13
|
-
var package_namespaceObject = {
|
|
14
|
-
rE: "0.12.5"
|
|
15
|
-
};
|
|
16
|
-
const version = package_namespaceObject.rE;
|
|
17
|
-
const rspackVersion = core_.rspack.rspackVersion;
|
|
18
|
-
}
|
|
1
|
+
import { rspack } from "./src_debug_ts.js";
|
|
2
|
+
var package_namespaceObject = {
|
|
3
|
+
rE: "0.12.5"
|
|
19
4
|
};
|
|
5
|
+
const version = package_namespaceObject.rE;
|
|
6
|
+
const rspackVersion = rspack.rspackVersion;
|
|
7
|
+
export { rspackVersion, version };
|