@rslib/core 0.1.5 → 0.2.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/compiled/chokidar/index.d.ts +24 -6
- package/compiled/chokidar/index.js +16 -13
- package/compiled/chokidar/package.json +1 -1
- package/dist/index.js +228 -180
- package/dist/libCssExtractLoader.js +25 -9
- package/dist-types/asset/assetConfig.d.ts +2 -2
- package/dist-types/cli/build.d.ts +1 -1
- package/dist-types/cli/mf.d.ts +2 -1
- package/dist-types/config.d.ts +12 -9
- package/dist-types/css/LibCssExtractPlugin.d.ts +9 -0
- package/dist-types/css/cssConfig.d.ts +2 -2
- package/dist-types/css/libCssExtractLoader.d.ts +6 -0
- package/dist-types/css/utils.d.ts +7 -0
- package/dist-types/plugins/EntryChunkPlugin.d.ts +2 -2
- package/dist-types/types/config.d.ts +6 -6
- package/dist-types/types/utils.d.ts +3 -0
- package/dist-types/utils/syntax.d.ts +2 -2
- package/package.json +8 -7
- package/dist-types/css/RemoveCssExtractAssetPlugin.d.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__ from "../compiled/rslog/index.js";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__ from "../compiled/picocolors/index.js";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__ from "../compiled/commander/index.js";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE_tinyglobby__ from "tinyglobby";
|
|
9
|
-
import * as
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE_module__ from "module";
|
|
11
11
|
const nodeBuiltInModules = [
|
|
12
12
|
'assert',
|
|
@@ -68,7 +68,7 @@ const nodeBuiltInModules = [
|
|
|
68
68
|
];
|
|
69
69
|
async function calcLongestCommonPath(absPaths) {
|
|
70
70
|
if (0 === absPaths.length) return null;
|
|
71
|
-
const sep =
|
|
71
|
+
const sep = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep;
|
|
72
72
|
const splitPaths = absPaths.map((p)=>p.split(sep));
|
|
73
73
|
let lcaFragments = splitPaths[0];
|
|
74
74
|
for(let i = 1; i < splitPaths.length; i++){
|
|
@@ -79,23 +79,23 @@ async function calcLongestCommonPath(absPaths) {
|
|
|
79
79
|
lcaFragments = lcaFragments.slice(0, j);
|
|
80
80
|
}
|
|
81
81
|
let lca = lcaFragments.length > 0 ? lcaFragments.join(sep) : sep;
|
|
82
|
-
const stats = await
|
|
83
|
-
if (stats?.isFile()) lca =
|
|
82
|
+
const stats = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].stat(lca);
|
|
83
|
+
if (stats?.isFile()) lca = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(lca);
|
|
84
84
|
return lca;
|
|
85
85
|
}
|
|
86
86
|
function getAbsolutePath(base, filepath) {
|
|
87
|
-
return (0,
|
|
87
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(filepath) ? filepath : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(base, filepath);
|
|
88
88
|
}
|
|
89
89
|
const readPackageJson = (rootPath)=>{
|
|
90
|
-
const pkgJsonPath =
|
|
91
|
-
if (!
|
|
92
|
-
|
|
90
|
+
const pkgJsonPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(rootPath, './package.json');
|
|
91
|
+
if (!__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(pkgJsonPath)) {
|
|
92
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`package.json does not exist in the ${rootPath} directory`);
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
try {
|
|
96
|
-
return JSON.parse(
|
|
96
|
+
return JSON.parse(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(pkgJsonPath, 'utf8'));
|
|
97
97
|
} catch (err) {
|
|
98
|
-
|
|
98
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`Failed to parse ${pkgJsonPath}, it might not be valid JSON`);
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
};
|
|
@@ -127,7 +127,7 @@ function checkMFPlugin(config, sharedPlugins) {
|
|
|
127
127
|
...config.plugins || []
|
|
128
128
|
]);
|
|
129
129
|
if (!added) {
|
|
130
|
-
|
|
130
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('format: "mf"')} should be used with ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].blue('@module-federation/rsbuild-plugin')}", consider installing and adding it to plugins. Check the documentation (https://module-federation.io/guide/basic/rsbuild.html#rslib-module) to get started with "mf" output.`);
|
|
131
131
|
process.exit(1);
|
|
132
132
|
}
|
|
133
133
|
return added;
|
|
@@ -147,7 +147,7 @@ const windowsSlashRegex = /\\/g;
|
|
|
147
147
|
function normalizeSlash(p) {
|
|
148
148
|
return p.replace(windowsSlashRegex, '/');
|
|
149
149
|
}
|
|
150
|
-
if (process.env.DEBUG)
|
|
150
|
+
if (process.env.DEBUG) __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.level = 'verbose';
|
|
151
151
|
function initNodeEnv() {
|
|
152
152
|
if (!process.env.NODE_ENV) {
|
|
153
153
|
const command = process.argv[2] ?? '';
|
|
@@ -160,11 +160,11 @@ function prepareCli() {
|
|
|
160
160
|
initNodeEnv();
|
|
161
161
|
const { npm_execpath } = process.env;
|
|
162
162
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
163
|
-
|
|
163
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.2.1\n`);
|
|
164
164
|
}
|
|
165
165
|
const composeAssetConfig = (bundle, format)=>{
|
|
166
166
|
if ('esm' === format || 'cjs' === format) {
|
|
167
|
-
|
|
167
|
+
return {
|
|
168
168
|
output: {
|
|
169
169
|
dataUriLimit: 0
|
|
170
170
|
}
|
|
@@ -213,26 +213,67 @@ const ENTRY_EXTENSIONS = [
|
|
|
213
213
|
const JS_EXTENSIONS_PATTERN = new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
|
|
214
214
|
const CSS_EXTENSIONS_PATTERN = new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
|
|
215
215
|
const ENTRY_EXTENSIONS_PATTERN = new RegExp(`\\.(${ENTRY_EXTENSIONS.join('|')})$`);
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
const BASE_URI = 'webpack://';
|
|
217
|
+
const AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
|
|
218
|
+
const ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
|
|
219
|
+
const SINGLE_DOT_PATH_SEGMENT = '__mini_css_extract_plugin_single_dot_path_segment__';
|
|
220
|
+
function getUndoPath(filename, outputPathArg, enforceRelative) {
|
|
221
|
+
let depth = -1;
|
|
222
|
+
let append = '';
|
|
223
|
+
let outputPath = outputPathArg.replace(/[\\/]$/, '');
|
|
224
|
+
for (const part of filename.split(/[/\\]+/))if ('..' === part) {
|
|
225
|
+
if (depth > -1) depth--;
|
|
226
|
+
else {
|
|
227
|
+
const i = outputPath.lastIndexOf('/');
|
|
228
|
+
const j = outputPath.lastIndexOf('\\');
|
|
229
|
+
const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
|
|
230
|
+
if (pos < 0) return `${outputPath}/`;
|
|
231
|
+
append = `${outputPath.slice(pos + 1)}/${append}`;
|
|
232
|
+
outputPath = outputPath.slice(0, pos);
|
|
233
|
+
}
|
|
234
|
+
} else if ('.' !== part) depth++;
|
|
235
|
+
return depth > 0 ? `${'../'.repeat(depth)}${append}` : enforceRelative ? `./${append}` : append;
|
|
236
|
+
}
|
|
237
|
+
const LibCssExtractPlugin_pluginName = 'LIB_CSS_EXTRACT_PLUGIN';
|
|
238
|
+
class LibCssExtractPlugin {
|
|
239
|
+
name = LibCssExtractPlugin_pluginName;
|
|
219
240
|
options;
|
|
220
241
|
constructor(options){
|
|
221
|
-
this.options = options;
|
|
242
|
+
this.options = options ?? {};
|
|
222
243
|
}
|
|
223
244
|
apply(compiler) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
compilation.hooks.chunkAsset.tap(RemoveCssExtractAssetPlugin_pluginName, (_chunk, filename)=>{
|
|
245
|
+
compiler.hooks.thisCompilation.tap(LibCssExtractPlugin_pluginName, (compilation)=>{
|
|
246
|
+
compilation.hooks.chunkAsset.tap(LibCssExtractPlugin_pluginName, (_chunk, filename)=>{
|
|
227
247
|
const asset = compilation.getAsset(filename);
|
|
228
248
|
if (!asset) return;
|
|
229
|
-
const needRemove = Boolean(asset.name.match(
|
|
249
|
+
const needRemove = Boolean(asset.name.match(RSLIB_CSS_ENTRY_FLAG));
|
|
230
250
|
if (needRemove) compilation.deleteAsset(filename);
|
|
231
251
|
});
|
|
232
252
|
});
|
|
253
|
+
compiler.hooks.make.tap(LibCssExtractPlugin_pluginName, (compilation)=>{
|
|
254
|
+
compilation.hooks.processAssets.tap(LibCssExtractPlugin_pluginName, (assets)=>{
|
|
255
|
+
const chunkAsset = Object.keys(assets).filter((name)=>/\.css/.test(name));
|
|
256
|
+
for (const name of chunkAsset)compilation.updateAsset(name, (old)=>{
|
|
257
|
+
const oldSource = old.source().toString();
|
|
258
|
+
const replaceSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
|
|
259
|
+
function replace(searchValue, replaceValue) {
|
|
260
|
+
let start = oldSource.indexOf(searchValue);
|
|
261
|
+
while(-1 !== start){
|
|
262
|
+
replaceSource.replace(start, start + searchValue.length - 1, replaceValue);
|
|
263
|
+
start = oldSource.indexOf(searchValue, start + 1);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
replace(ABSOLUTE_PUBLIC_PATH, '');
|
|
267
|
+
replace(SINGLE_DOT_PATH_SEGMENT, '.');
|
|
268
|
+
const undoPath = getUndoPath(name, compilation.outputOptions.path, false);
|
|
269
|
+
replace(AUTO_PUBLIC_PATH, undoPath);
|
|
270
|
+
return replaceSource;
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
});
|
|
233
274
|
}
|
|
234
275
|
}
|
|
235
|
-
const cssConfig_require = (0,
|
|
276
|
+
const cssConfig_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
|
|
236
277
|
const RSLIB_CSS_ENTRY_FLAG = '__rslib_css__';
|
|
237
278
|
function isCssFile(filepath) {
|
|
238
279
|
return CSS_EXTENSIONS_PATTERN.test(filepath);
|
|
@@ -248,7 +289,7 @@ function parsePathQueryFragment(str) {
|
|
|
248
289
|
};
|
|
249
290
|
}
|
|
250
291
|
function isCssModulesFile(filepath, auto) {
|
|
251
|
-
const filename =
|
|
292
|
+
const filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filepath);
|
|
252
293
|
if (true === auto) return CSS_MODULE_REG.test(filename);
|
|
253
294
|
if (auto instanceof RegExp) return auto.test(filepath);
|
|
254
295
|
if ('function' == typeof auto) {
|
|
@@ -296,11 +337,7 @@ const pluginLibCss = (rootDir)=>({
|
|
|
296
337
|
if (isUsingCssExtract) {
|
|
297
338
|
const cssExtract = CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT;
|
|
298
339
|
config.plugins.delete(cssExtract);
|
|
299
|
-
config.plugin(
|
|
300
|
-
{
|
|
301
|
-
include: new RegExp(`^${RSLIB_CSS_ENTRY_FLAG}`)
|
|
302
|
-
}
|
|
303
|
-
]);
|
|
340
|
+
config.plugin(LibCssExtractPlugin.name).use(LibCssExtractPlugin);
|
|
304
341
|
}
|
|
305
342
|
});
|
|
306
343
|
}
|
|
@@ -345,18 +382,18 @@ const pluginEsmRequireShim = ()=>({
|
|
|
345
382
|
setup (api) {
|
|
346
383
|
api.modifyRspackConfig((config)=>{
|
|
347
384
|
config.plugins ??= [];
|
|
348
|
-
config.plugins.push(new
|
|
385
|
+
config.plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
|
|
349
386
|
banner: requireShim,
|
|
350
|
-
stage:
|
|
387
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE - 1,
|
|
351
388
|
raw: true,
|
|
352
389
|
include: /\.(js|cjs)$/
|
|
353
390
|
}));
|
|
354
391
|
});
|
|
355
392
|
}
|
|
356
393
|
});
|
|
357
|
-
const EntryChunkPlugin_require = (0,
|
|
394
|
+
const EntryChunkPlugin_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
|
|
358
395
|
const EntryChunkPlugin_PLUGIN_NAME = 'rsbuild:lib-entry-chunk';
|
|
359
|
-
const
|
|
396
|
+
const EntryChunkPlugin_LOADER_NAME = 'rsbuild:lib-entry-module';
|
|
360
397
|
const matchFirstLine = (source, regex)=>{
|
|
361
398
|
const lineBreakPos = source.match(/(\r\n|\n)/);
|
|
362
399
|
const firstLineContent = source.slice(0, lineBreakPos?.index);
|
|
@@ -415,7 +452,7 @@ class EntryChunkPlugin {
|
|
|
415
452
|
const chunkAsset = Object.keys(assets).filter((name)=>JS_EXTENSIONS_PATTERN.test(name));
|
|
416
453
|
for (const name of chunkAsset)compilation.updateAsset(name, (old)=>{
|
|
417
454
|
const oldSource = old.source().toString();
|
|
418
|
-
const replaceSource = new
|
|
455
|
+
const replaceSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
|
|
419
456
|
if (oldSource.startsWith('use strict;') || oldSource.startsWith('"use strict";')) replaceSource.replace(0, 11, `"use strict";\n${importMetaUrlShim}`);
|
|
420
457
|
else replaceSource.insert(0, importMetaUrlShim);
|
|
421
458
|
return replaceSource;
|
|
@@ -423,14 +460,14 @@ class EntryChunkPlugin {
|
|
|
423
460
|
});
|
|
424
461
|
compilation.hooks.processAssets.tap({
|
|
425
462
|
name: EntryChunkPlugin_PLUGIN_NAME,
|
|
426
|
-
stage:
|
|
463
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING - 1
|
|
427
464
|
}, (assets)=>{
|
|
428
465
|
const chunkAsset = Object.keys(assets);
|
|
429
466
|
for (const name of chunkAsset){
|
|
430
467
|
const shebangValue = this.shebangEntries[name];
|
|
431
468
|
const reactDirectiveValue = this.reactDirectives[name];
|
|
432
469
|
if (shebangValue || reactDirectiveValue) compilation.updateAsset(name, (old)=>{
|
|
433
|
-
const replaceSource = new
|
|
470
|
+
const replaceSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
|
|
434
471
|
if (shebangValue) {
|
|
435
472
|
replaceSource.insert(0, `${shebangValue}\n`);
|
|
436
473
|
this.shebangInjectedAssets.add(name);
|
|
@@ -442,7 +479,7 @@ class EntryChunkPlugin {
|
|
|
442
479
|
});
|
|
443
480
|
});
|
|
444
481
|
compiler.hooks.assetEmitted.tap(EntryChunkPlugin_PLUGIN_NAME, (file, { targetPath })=>{
|
|
445
|
-
if (this.shebangInjectedAssets.has(file)) (0,
|
|
482
|
+
if (this.shebangInjectedAssets.has(file)) (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.chmodSync)(targetPath, this.shebangChmod);
|
|
446
483
|
});
|
|
447
484
|
}
|
|
448
485
|
}
|
|
@@ -450,7 +487,7 @@ const entryModuleLoaderRsbuildPlugin = ()=>({
|
|
|
450
487
|
name: EntryChunkPlugin_PLUGIN_NAME,
|
|
451
488
|
setup (api) {
|
|
452
489
|
api.modifyBundlerChain((config, { CHAIN_ID })=>{
|
|
453
|
-
config.module.rule(CHAIN_ID.RULE.JS).use(
|
|
490
|
+
config.module.rule(CHAIN_ID.RULE.JS).use(EntryChunkPlugin_LOADER_NAME).loader(EntryChunkPlugin_require.resolve('./entryModuleLoader.js'));
|
|
454
491
|
});
|
|
455
492
|
}
|
|
456
493
|
});
|
|
@@ -477,7 +514,7 @@ const getDefaultExtension = (options)=>{
|
|
|
477
514
|
dtsExtension
|
|
478
515
|
};
|
|
479
516
|
if (!pkgJson) {
|
|
480
|
-
|
|
517
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn('autoExtension configuration will not be applied due to read package.json failed');
|
|
481
518
|
return {
|
|
482
519
|
jsExtension,
|
|
483
520
|
dtsExtension
|
|
@@ -662,8 +699,8 @@ function transformSyntaxToBrowserslist(syntax, target) {
|
|
|
662
699
|
if (Array.isArray(syntax)) return syntax.flatMap(handleSyntaxItem);
|
|
663
700
|
return handleSyntaxItem(syntax);
|
|
664
701
|
}
|
|
665
|
-
const POSIX_SEP_RE = new RegExp('\\' +
|
|
666
|
-
const NATIVE_SEP_RE = new RegExp('\\' +
|
|
702
|
+
const POSIX_SEP_RE = new RegExp('\\' + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep, 'g');
|
|
703
|
+
const NATIVE_SEP_RE = new RegExp('\\' + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep, 'g');
|
|
667
704
|
const PATTERN_REGEX_CACHE = new Map();
|
|
668
705
|
const GLOB_ALL_PATTERN = "**/*";
|
|
669
706
|
const TS_EXTENSIONS = [
|
|
@@ -681,7 +718,7 @@ const util_JS_EXTENSIONS = [
|
|
|
681
718
|
const TSJS_EXTENSIONS = TS_EXTENSIONS.concat(util_JS_EXTENSIONS);
|
|
682
719
|
const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext)=>ext.substring(1)).join('|')})`;
|
|
683
720
|
const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext)=>ext.substring(1)).join('|')})`;
|
|
684
|
-
const IS_POSIX =
|
|
721
|
+
const IS_POSIX = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep;
|
|
685
722
|
function util_makePromise() {
|
|
686
723
|
let resolve, reject;
|
|
687
724
|
const promise = new Promise((res, rej)=>{
|
|
@@ -695,22 +732,22 @@ function util_makePromise() {
|
|
|
695
732
|
};
|
|
696
733
|
}
|
|
697
734
|
async function util_resolveTSConfigJson(filename, cache) {
|
|
698
|
-
if ('.json' !==
|
|
699
|
-
const tsconfig =
|
|
735
|
+
if ('.json' !== __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(filename)) return;
|
|
736
|
+
const tsconfig = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(filename);
|
|
700
737
|
if (cache && (cache.hasParseResult(tsconfig) || cache.hasParseResult(filename))) return tsconfig;
|
|
701
|
-
return
|
|
738
|
+
return __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.promises.stat(tsconfig).then((stat)=>{
|
|
702
739
|
if (stat.isFile() || stat.isFIFO()) return tsconfig;
|
|
703
740
|
throw new Error(`${filename} exists but is not a regular file.`);
|
|
704
741
|
});
|
|
705
742
|
}
|
|
706
743
|
const util_isInNodeModules = IS_POSIX ? (dir)=>dir.includes('/node_modules/') : (dir)=>dir.match(/[/\\]node_modules[/\\]/);
|
|
707
|
-
const posix2native = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(POSIX_SEP_RE,
|
|
708
|
-
const util_native2posix = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(NATIVE_SEP_RE,
|
|
709
|
-
const resolve2posix = IS_POSIX ? (dir, filename)=>dir ?
|
|
744
|
+
const posix2native = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(POSIX_SEP_RE, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep);
|
|
745
|
+
const util_native2posix = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(NATIVE_SEP_RE, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep);
|
|
746
|
+
const resolve2posix = IS_POSIX ? (dir, filename)=>dir ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(dir, filename) : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(filename) : (dir, filename)=>util_native2posix(dir ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(posix2native(dir), posix2native(filename)) : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(posix2native(filename)));
|
|
710
747
|
function util_resolveReferencedTSConfigFiles(result, options) {
|
|
711
|
-
const dir =
|
|
748
|
+
const dir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(result.tsconfigFile);
|
|
712
749
|
return result.tsconfig.references.map((ref)=>{
|
|
713
|
-
const refPath = ref.path.endsWith('.json') ? ref.path :
|
|
750
|
+
const refPath = ref.path.endsWith('.json') ? ref.path : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(ref.path, options?.configName ?? 'tsconfig.json');
|
|
714
751
|
return resolve2posix(dir, refPath);
|
|
715
752
|
});
|
|
716
753
|
}
|
|
@@ -724,7 +761,7 @@ function util_resolveSolutionTSConfig(filename, result) {
|
|
|
724
761
|
return result;
|
|
725
762
|
}
|
|
726
763
|
function util_isIncluded(filename, result) {
|
|
727
|
-
const dir = util_native2posix(
|
|
764
|
+
const dir = util_native2posix(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(result.tsconfigFile));
|
|
728
765
|
const files = (result.tsconfig.files || []).map((file)=>resolve2posix(dir, file));
|
|
729
766
|
const absoluteFilename = resolve2posix(null, filename);
|
|
730
767
|
if (files.includes(filename)) return true;
|
|
@@ -815,13 +852,13 @@ function util_replaceTokens(tsconfig, configDir) {
|
|
|
815
852
|
return JSON.parse(JSON.stringify(tsconfig).replaceAll(/"\${configDir}/g, `"${util_native2posix(configDir)}`));
|
|
816
853
|
}
|
|
817
854
|
async function find(filename, options) {
|
|
818
|
-
let dir =
|
|
855
|
+
let dir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(filename));
|
|
819
856
|
if (options?.ignoreNodeModules && util_isInNodeModules(dir)) return null;
|
|
820
857
|
const cache = options?.cache;
|
|
821
858
|
const configName = options?.configName ?? 'tsconfig.json';
|
|
822
859
|
if (cache?.hasConfigPath(dir, configName)) return cache.getConfigPath(dir, configName);
|
|
823
860
|
const { promise, resolve, reject } = util_makePromise();
|
|
824
|
-
if (options?.root && !
|
|
861
|
+
if (options?.root && !__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(options.root)) options.root = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(options.root);
|
|
825
862
|
findUp(dir, {
|
|
826
863
|
promise,
|
|
827
864
|
resolve,
|
|
@@ -844,13 +881,13 @@ function findUp(dir, { resolve, reject, promise }, options) {
|
|
|
844
881
|
else resolve(cached);
|
|
845
882
|
} else cache.setConfigPath(dir, promise, configName);
|
|
846
883
|
}
|
|
847
|
-
const tsconfig =
|
|
848
|
-
|
|
884
|
+
const tsconfig = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dir, options?.configName ?? 'tsconfig.json');
|
|
885
|
+
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].stat(tsconfig, (err, stats)=>{
|
|
849
886
|
if (stats && (stats.isFile() || stats.isFIFO())) resolve(tsconfig);
|
|
850
887
|
else if (err?.code !== 'ENOENT') reject(err);
|
|
851
888
|
else {
|
|
852
889
|
let parent;
|
|
853
|
-
if (root === dir || (parent =
|
|
890
|
+
if (root === dir || (parent = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(dir)) === dir) resolve(null);
|
|
854
891
|
else findUp(parent, {
|
|
855
892
|
promise,
|
|
856
893
|
resolve,
|
|
@@ -859,7 +896,7 @@ function findUp(dir, { resolve, reject, promise }, options) {
|
|
|
859
896
|
}
|
|
860
897
|
});
|
|
861
898
|
}
|
|
862
|
-
|
|
899
|
+
__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep;
|
|
863
900
|
function toJson(tsconfigJson) {
|
|
864
901
|
const stripped = stripDanglingComma(stripJsonComments(stripBom(tsconfigJson)));
|
|
865
902
|
if ('' === stripped.trim()) return '{}';
|
|
@@ -980,7 +1017,7 @@ async function parse(filename, options) {
|
|
|
980
1017
|
parseReferences(result, options)
|
|
981
1018
|
]);
|
|
982
1019
|
}
|
|
983
|
-
result.tsconfig = util_replaceTokens(result.tsconfig,
|
|
1020
|
+
result.tsconfig = util_replaceTokens(result.tsconfig, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(tsconfigFile));
|
|
984
1021
|
resolve(util_resolveSolutionTSConfig(filename, result));
|
|
985
1022
|
} catch (e) {
|
|
986
1023
|
reject(e);
|
|
@@ -1001,12 +1038,12 @@ async function getParsedDeep(filename, cache, options) {
|
|
|
1001
1038
|
}
|
|
1002
1039
|
async function parseFile(tsconfigFile, cache, skipCache) {
|
|
1003
1040
|
if (!skipCache && cache?.hasParseResult(tsconfigFile) && !cache.getParseResult(tsconfigFile)._isRootFile_) return cache.getParseResult(tsconfigFile);
|
|
1004
|
-
const promise =
|
|
1041
|
+
const promise = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.promises.readFile(tsconfigFile, 'utf-8').then(toJson).then((json)=>{
|
|
1005
1042
|
const parsed = JSON.parse(json);
|
|
1006
1043
|
applyDefaults(parsed, tsconfigFile);
|
|
1007
1044
|
return {
|
|
1008
1045
|
tsconfigFile,
|
|
1009
|
-
tsconfig: normalizeTSConfig(parsed,
|
|
1046
|
+
tsconfig: normalizeTSConfig(parsed, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(tsconfigFile))
|
|
1010
1047
|
};
|
|
1011
1048
|
}).catch((e)=>{
|
|
1012
1049
|
throw new TSConfckParseError(`parsing ${tsconfigFile} failed: ${e}`, 'PARSE_FILE', tsconfigFile, e);
|
|
@@ -1016,7 +1053,7 @@ async function parseFile(tsconfigFile, cache, skipCache) {
|
|
|
1016
1053
|
}
|
|
1017
1054
|
function normalizeTSConfig(tsconfig, dir) {
|
|
1018
1055
|
const baseUrl = tsconfig.compilerOptions?.baseUrl;
|
|
1019
|
-
if (baseUrl && !baseUrl.startsWith('${') && !
|
|
1056
|
+
if (baseUrl && !baseUrl.startsWith('${') && !__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(baseUrl)) tsconfig.compilerOptions.baseUrl = resolve2posix(dir, baseUrl);
|
|
1020
1057
|
return tsconfig;
|
|
1021
1058
|
}
|
|
1022
1059
|
async function parseReferences(result, options) {
|
|
@@ -1075,7 +1112,7 @@ function resolveExtends(extended, from) {
|
|
|
1075
1112
|
} catch (e) {
|
|
1076
1113
|
error = e;
|
|
1077
1114
|
}
|
|
1078
|
-
if ('.' !== extended[0] && !
|
|
1115
|
+
if ('.' !== extended[0] && !__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(extended)) try {
|
|
1079
1116
|
return req.resolve(`${extended}/tsconfig.json`);
|
|
1080
1117
|
} catch (e) {
|
|
1081
1118
|
error = e;
|
|
@@ -1095,7 +1132,7 @@ const EXTENDABLE_KEYS = [
|
|
|
1095
1132
|
function extendTSConfig(extending, extended) {
|
|
1096
1133
|
const extendingConfig = extending.tsconfig;
|
|
1097
1134
|
const extendedConfig = extended.tsconfig;
|
|
1098
|
-
const relativePath = util_native2posix(
|
|
1135
|
+
const relativePath = util_native2posix(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(extending.tsconfigFile), __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(extended.tsconfigFile)));
|
|
1099
1136
|
for (const key of Object.keys(extendedConfig).filter((key)=>EXTENDABLE_KEYS.includes(key)))if ('compilerOptions' === key) {
|
|
1100
1137
|
if (!extendingConfig.compilerOptions) extendingConfig.compilerOptions = {};
|
|
1101
1138
|
for (const option of Object.keys(extendedConfig.compilerOptions)){
|
|
@@ -1128,8 +1165,8 @@ function rebaseRelative(key, value, prependPath) {
|
|
|
1128
1165
|
return rebasePath(value, prependPath);
|
|
1129
1166
|
}
|
|
1130
1167
|
function rebasePath(value, prependPath) {
|
|
1131
|
-
if (
|
|
1132
|
-
return
|
|
1168
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(value) || value.startsWith('${configDir}')) return value;
|
|
1169
|
+
return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.normalize(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(prependPath, value));
|
|
1133
1170
|
}
|
|
1134
1171
|
class TSConfckParseError extends Error {
|
|
1135
1172
|
code;
|
|
@@ -1158,12 +1195,12 @@ const DEFAULT_JSCONFIG_COMPILER_OPTIONS = {
|
|
|
1158
1195
|
noEmit: true
|
|
1159
1196
|
};
|
|
1160
1197
|
function isJSConfig(configFileName) {
|
|
1161
|
-
return 'jsconfig.json' ===
|
|
1198
|
+
return 'jsconfig.json' === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(configFileName);
|
|
1162
1199
|
}
|
|
1163
1200
|
async function loadTsconfig(root, tsconfigPath = 'tsconfig.json') {
|
|
1164
|
-
const tsconfigFileName = await find((0,
|
|
1201
|
+
const tsconfigFileName = await find((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, tsconfigPath), {
|
|
1165
1202
|
root,
|
|
1166
|
-
configName: (0,
|
|
1203
|
+
configName: (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.basename)(tsconfigPath)
|
|
1167
1204
|
});
|
|
1168
1205
|
if (tsconfigFileName) {
|
|
1169
1206
|
const { tsconfig } = await parse(tsconfigFileName);
|
|
@@ -1174,21 +1211,21 @@ async function loadTsconfig(root, tsconfigPath = 'tsconfig.json') {
|
|
|
1174
1211
|
function defineConfig(config) {
|
|
1175
1212
|
return config;
|
|
1176
1213
|
}
|
|
1177
|
-
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(
|
|
1214
|
+
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync);
|
|
1178
1215
|
const resolveConfigPath = (root, customConfig)=>{
|
|
1179
1216
|
if (customConfig) {
|
|
1180
|
-
const customConfigPath = (0,
|
|
1181
|
-
if (
|
|
1182
|
-
|
|
1217
|
+
const customConfigPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(customConfig) ? customConfig : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, customConfig);
|
|
1218
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(customConfigPath)) return customConfigPath;
|
|
1219
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`Cannot find config file: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].dim(customConfigPath)}\n`);
|
|
1183
1220
|
}
|
|
1184
|
-
const configFilePath = findConfig((0,
|
|
1221
|
+
const configFilePath = findConfig((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, DEFAULT_CONFIG_NAME));
|
|
1185
1222
|
if (configFilePath) return configFilePath;
|
|
1186
1223
|
throw new Error(`${DEFAULT_CONFIG_NAME} not found in ${root}`);
|
|
1187
1224
|
};
|
|
1188
1225
|
async function loadConfig({ cwd = process.cwd(), path, envMode }) {
|
|
1189
1226
|
const configFilePath = resolveConfigPath(cwd, path);
|
|
1190
|
-
const { content } = await (0,
|
|
1191
|
-
cwd: (0,
|
|
1227
|
+
const { content } = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.loadConfig)({
|
|
1228
|
+
cwd: (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)(configFilePath),
|
|
1192
1229
|
path: configFilePath,
|
|
1193
1230
|
envMode
|
|
1194
1231
|
});
|
|
@@ -1255,7 +1292,7 @@ const composeExternalsWarnConfig = (format, ...externalsArray)=>{
|
|
|
1255
1292
|
};
|
|
1256
1293
|
if (contextInfo.issuer && 'commonjs' === dependencyType) {
|
|
1257
1294
|
matchUserExternals(externals, request, _callback);
|
|
1258
|
-
if (externalized)
|
|
1295
|
+
if (externalized) __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(composeModuleImportWarn(request));
|
|
1259
1296
|
}
|
|
1260
1297
|
callback();
|
|
1261
1298
|
}
|
|
@@ -1269,7 +1306,7 @@ const composeAutoExternalConfig = (options)=>{
|
|
|
1269
1306
|
const autoExternal = getAutoExternalDefaultValue(format, options.autoExternal);
|
|
1270
1307
|
if (false === autoExternal) return {};
|
|
1271
1308
|
if (!pkgJson) {
|
|
1272
|
-
|
|
1309
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn('autoExternal configuration will not be applied due to read package.json failed');
|
|
1273
1310
|
return {};
|
|
1274
1311
|
}
|
|
1275
1312
|
const userExternalKeys = userExternals && isObject(userExternals) ? Object.keys(userExternals) : [];
|
|
@@ -1340,30 +1377,30 @@ function composeBannerFooterConfig(banner, footer) {
|
|
|
1340
1377
|
if (isEmptyObject(bannerConfig) && isEmptyObject(footerConfig)) return {};
|
|
1341
1378
|
const plugins = [];
|
|
1342
1379
|
if (!isEmptyObject(bannerConfig)) {
|
|
1343
|
-
if (bannerConfig.js) plugins.push(new
|
|
1380
|
+
if (bannerConfig.js) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
|
|
1344
1381
|
banner: bannerConfig.js,
|
|
1345
|
-
stage:
|
|
1382
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
1346
1383
|
raw: true,
|
|
1347
1384
|
include: /\.(js|mjs|cjs)$/
|
|
1348
1385
|
}));
|
|
1349
|
-
if (bannerConfig.css) plugins.push(new
|
|
1386
|
+
if (bannerConfig.css) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
|
|
1350
1387
|
banner: bannerConfig.css,
|
|
1351
|
-
stage:
|
|
1388
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
1352
1389
|
raw: true,
|
|
1353
1390
|
include: /\.(css)$/
|
|
1354
1391
|
}));
|
|
1355
1392
|
}
|
|
1356
1393
|
if (!isEmptyObject(footerConfig)) {
|
|
1357
|
-
if (footerConfig.js) plugins.push(new
|
|
1394
|
+
if (footerConfig.js) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
|
|
1358
1395
|
banner: footerConfig.js,
|
|
1359
|
-
stage:
|
|
1396
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
1360
1397
|
raw: true,
|
|
1361
1398
|
footer: true,
|
|
1362
1399
|
include: /\.(js|mjs|cjs)$/
|
|
1363
1400
|
}));
|
|
1364
|
-
if (footerConfig.css) plugins.push(new
|
|
1401
|
+
if (footerConfig.css) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
|
|
1365
1402
|
banner: footerConfig.css,
|
|
1366
|
-
stage:
|
|
1403
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
1367
1404
|
raw: true,
|
|
1368
1405
|
footer: true,
|
|
1369
1406
|
include: /\.(css)$/
|
|
@@ -1388,8 +1425,7 @@ function composeDecoratorsConfig(compilerOptions, version) {
|
|
|
1388
1425
|
};
|
|
1389
1426
|
}
|
|
1390
1427
|
async function createConstantRsbuildConfig() {
|
|
1391
|
-
return (0,
|
|
1392
|
-
mode: 'production',
|
|
1428
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.defineConfig)({
|
|
1393
1429
|
dev: {
|
|
1394
1430
|
progressBar: false
|
|
1395
1431
|
},
|
|
@@ -1478,7 +1514,8 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
|
|
|
1478
1514
|
},
|
|
1479
1515
|
optimization: {
|
|
1480
1516
|
concatenateModules: true,
|
|
1481
|
-
sideEffects: 'flag'
|
|
1517
|
+
sideEffects: 'flag',
|
|
1518
|
+
avoidEntryIife: true
|
|
1482
1519
|
},
|
|
1483
1520
|
output: {
|
|
1484
1521
|
module: true,
|
|
@@ -1553,15 +1590,20 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
|
|
|
1553
1590
|
}
|
|
1554
1591
|
case 'mf':
|
|
1555
1592
|
return {
|
|
1593
|
+
dev: {
|
|
1594
|
+
writeToDisk: true
|
|
1595
|
+
},
|
|
1556
1596
|
tools: {
|
|
1557
|
-
rspack: {
|
|
1558
|
-
output
|
|
1597
|
+
rspack: (config, { env })=>{
|
|
1598
|
+
config.output = {
|
|
1599
|
+
...config.output,
|
|
1559
1600
|
uniqueName: pkgJson.name
|
|
1560
|
-
}
|
|
1561
|
-
optimization
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1601
|
+
};
|
|
1602
|
+
config.optimization = {
|
|
1603
|
+
...config.optimization,
|
|
1604
|
+
nodeEnv: 'development' === env ? 'development' : 'production',
|
|
1605
|
+
moduleIds: 'development' === env ? 'named' : 'deterministic'
|
|
1606
|
+
};
|
|
1565
1607
|
}
|
|
1566
1608
|
},
|
|
1567
1609
|
output: {
|
|
@@ -1639,7 +1681,7 @@ const composeShimsConfig = (format, shims)=>{
|
|
|
1639
1681
|
enabledShims
|
|
1640
1682
|
};
|
|
1641
1683
|
};
|
|
1642
|
-
const composeModuleImportWarn = (request)=>`The externalized commonjs request ${
|
|
1684
|
+
const composeModuleImportWarn = (request)=>`The externalized commonjs request ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green(`"${request}"`)} will use ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].blue('"module"')} external type in ESM format. If you want to specify other external type, consider setting the request and type with ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].blue('"output.externals"')}.`;
|
|
1643
1685
|
const composeExternalsConfig = (format, externals)=>{
|
|
1644
1686
|
const externalsTypeMap = {
|
|
1645
1687
|
esm: 'module-import',
|
|
@@ -1680,7 +1722,7 @@ const composeAutoExtensionConfig = (config, autoExtension, pkgJson)=>{
|
|
|
1680
1722
|
}
|
|
1681
1723
|
}
|
|
1682
1724
|
};
|
|
1683
|
-
const updatedJsExtension = 'string' == typeof updatedConfig.output?.filename?.js && updatedConfig.output?.filename?.js ? (0,
|
|
1725
|
+
const updatedJsExtension = 'string' == typeof updatedConfig.output?.filename?.js && updatedConfig.output?.filename?.js ? (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(updatedConfig.output.filename.js) : jsExtension;
|
|
1684
1726
|
return {
|
|
1685
1727
|
config: updatedConfig,
|
|
1686
1728
|
jsExtension: updatedJsExtension,
|
|
@@ -1753,14 +1795,14 @@ const composeEntryConfig = async (entries, bundle, root, cssModulesAuto)=>{
|
|
|
1753
1795
|
const lcp = await calcLongestCommonPath(resolvedEntryFiles);
|
|
1754
1796
|
const outBase = null === lcp ? root : lcp;
|
|
1755
1797
|
function getEntryName(file) {
|
|
1756
|
-
const { dir, name } =
|
|
1757
|
-
const entryFileName =
|
|
1798
|
+
const { dir, name } = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].parse(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(outBase, file));
|
|
1799
|
+
const entryFileName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dir, name);
|
|
1758
1800
|
if (isCssGlobalFile(file, cssModulesAuto)) return `${RSLIB_CSS_ENTRY_FLAG}/${entryFileName}`;
|
|
1759
1801
|
return entryFileName;
|
|
1760
1802
|
}
|
|
1761
1803
|
for (const file of resolvedEntryFiles){
|
|
1762
1804
|
const entryName = getEntryName(file);
|
|
1763
|
-
if (resolvedEntries[entryName])
|
|
1805
|
+
if (resolvedEntries[entryName]) __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`duplicate entry: ${entryName}, this may lead to the incorrect output, please rename the file`);
|
|
1764
1806
|
resolvedEntries[entryName] = file;
|
|
1765
1807
|
}
|
|
1766
1808
|
}
|
|
@@ -1799,17 +1841,15 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
|
|
|
1799
1841
|
let resolvedRequest = request;
|
|
1800
1842
|
const cssExternal = cssExternalHandler(resolvedRequest, callback, jsExtension, cssModulesAuto, isStyleRedirected);
|
|
1801
1843
|
if (false !== cssExternal) return cssExternal;
|
|
1802
|
-
if (jsRedirectPath) {
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
} catch (e) {
|
|
1806
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.debug(`Failed to resolve ${resolvedRequest} with resolver`);
|
|
1807
|
-
}
|
|
1808
|
-
resolvedRequest = normalizeSlash(__WEBPACK_EXTERNAL_MODULE_node_path__["default"].relative(__WEBPACK_EXTERNAL_MODULE_node_path__["default"].dirname(contextInfo.issuer), resolvedRequest));
|
|
1844
|
+
if (jsRedirectPath) try {
|
|
1845
|
+
resolvedRequest = await resolver(context, resolvedRequest);
|
|
1846
|
+
resolvedRequest = normalizeSlash(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(contextInfo.issuer), resolvedRequest));
|
|
1809
1847
|
if ('.' !== resolvedRequest[0]) resolvedRequest = `./${resolvedRequest}`;
|
|
1848
|
+
} catch (e) {
|
|
1849
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`Failed to resolve module ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green(`"${resolvedRequest}"`)} from ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green(contextInfo.issuer)}. If it's an npm package, consider adding it to dependencies or peerDependencies in package.json to make it externalized.`);
|
|
1810
1850
|
}
|
|
1811
|
-
if (jsRedirectExtension) {
|
|
1812
|
-
const ext = (0,
|
|
1851
|
+
if (jsRedirectExtension && resolvedRequest.startsWith('.')) {
|
|
1852
|
+
const ext = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(resolvedRequest);
|
|
1813
1853
|
if (ext) {
|
|
1814
1854
|
if (!JS_EXTENSIONS_PATTERN.test(resolvedRequest)) return callback();
|
|
1815
1855
|
resolvedRequest = resolvedRequest.replace(/\.[^.]+$/, jsExtension);
|
|
@@ -1905,7 +1945,7 @@ const composeExternalHelpersConfig = (externalHelpers, pkgJson)=>{
|
|
|
1905
1945
|
...Object.keys(pkgJson?.devDependencies ?? [])
|
|
1906
1946
|
];
|
|
1907
1947
|
if (!deps.includes(SWC_HELPERS)) {
|
|
1908
|
-
|
|
1948
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(`${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('externalHelpers')} is enabled, but the ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].blue(SWC_HELPERS)} dependency declaration was not found in package.json.`);
|
|
1909
1949
|
process.exit(1);
|
|
1910
1950
|
}
|
|
1911
1951
|
defaultConfig = Object.assign(defaultConfig, {
|
|
@@ -1917,9 +1957,9 @@ const composeExternalHelpersConfig = (externalHelpers, pkgJson)=>{
|
|
|
1917
1957
|
}
|
|
1918
1958
|
return defaultConfig;
|
|
1919
1959
|
};
|
|
1920
|
-
async function composeLibRsbuildConfig(config, sharedPlugins) {
|
|
1960
|
+
async function composeLibRsbuildConfig(config, root, sharedPlugins) {
|
|
1921
1961
|
checkMFPlugin(config, sharedPlugins);
|
|
1922
|
-
const rootPath =
|
|
1962
|
+
const rootPath = root ? getAbsolutePath(process.cwd(), root) : process.cwd();
|
|
1923
1963
|
const pkgJson = readPackageJson(rootPath);
|
|
1924
1964
|
const { compilerOptions } = await loadTsconfig(rootPath, config.source?.tsconfigPath);
|
|
1925
1965
|
const cssModulesAuto = config.output?.cssModules?.auto ?? true;
|
|
@@ -1954,22 +1994,22 @@ async function composeLibRsbuildConfig(config, sharedPlugins) {
|
|
|
1954
1994
|
const minifyConfig = composeMinifyConfig(config);
|
|
1955
1995
|
const bannerFooterConfig = composeBannerFooterConfig(banner, footer);
|
|
1956
1996
|
const decoratorsConfig = composeDecoratorsConfig(compilerOptions, config.source?.decorators?.version);
|
|
1957
|
-
return (0,
|
|
1997
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(formatConfig, shimsConfig, syntaxConfig, externalHelpersConfig, autoExtensionConfig, targetConfig, externalsWarnConfig, autoExternalConfig, targetExternalsConfig, userExternalsConfig, bundlelessExternalConfig, entryConfig, cssConfig, assetConfig, entryChunkConfig, minifyConfig, dtsConfig, bannerFooterConfig, decoratorsConfig);
|
|
1958
1998
|
}
|
|
1959
1999
|
async function composeCreateRsbuildConfig(rslibConfig) {
|
|
1960
2000
|
const constantRsbuildConfig = await createConstantRsbuildConfig();
|
|
1961
|
-
const { lib: libConfigsArray, plugins: sharedPlugins, ...sharedRsbuildConfig } = rslibConfig;
|
|
2001
|
+
const { lib: libConfigsArray, mode, root, plugins: sharedPlugins, dev, server, ...sharedRsbuildConfig } = rslibConfig;
|
|
1962
2002
|
if (!libConfigsArray) throw new Error(`Expect lib field to be an array, but got ${libConfigsArray}.`);
|
|
1963
2003
|
const libConfigPromises = libConfigsArray.map(async (libConfig)=>{
|
|
1964
|
-
const userConfig = (0,
|
|
1965
|
-
const libRsbuildConfig = await composeLibRsbuildConfig(userConfig, sharedPlugins);
|
|
2004
|
+
const userConfig = (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(sharedRsbuildConfig, libConfig);
|
|
2005
|
+
const libRsbuildConfig = await composeLibRsbuildConfig(userConfig, root, sharedPlugins);
|
|
1966
2006
|
userConfig.source ??= {};
|
|
1967
2007
|
userConfig.source.entry = {};
|
|
1968
2008
|
userConfig.output ??= {};
|
|
1969
2009
|
delete userConfig.output.externals;
|
|
1970
2010
|
const config = {
|
|
1971
2011
|
format: libConfig.format,
|
|
1972
|
-
config: (0,
|
|
2012
|
+
config: (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(constantRsbuildConfig, libRsbuildConfig, omit(userConfig, {
|
|
1973
2013
|
id: true,
|
|
1974
2014
|
bundle: true,
|
|
1975
2015
|
format: true,
|
|
@@ -1993,6 +2033,7 @@ async function composeCreateRsbuildConfig(rslibConfig) {
|
|
|
1993
2033
|
}
|
|
1994
2034
|
async function composeRsbuildEnvironments(rslibConfig) {
|
|
1995
2035
|
const rsbuildConfigWithLibInfo = await composeCreateRsbuildConfig(rslibConfig);
|
|
2036
|
+
const environmentWithInfos = [];
|
|
1996
2037
|
const usedIds = rsbuildConfigWithLibInfo.map(({ id })=>id).filter(Boolean);
|
|
1997
2038
|
const environments = {};
|
|
1998
2039
|
const formatCount = rsbuildConfigWithLibInfo.reduce((acc, { format })=>{
|
|
@@ -2010,10 +2051,18 @@ async function composeRsbuildEnvironments(rslibConfig) {
|
|
|
2010
2051
|
for (const { format, id, config } of rsbuildConfigWithLibInfo){
|
|
2011
2052
|
const libId = 'string' == typeof id ? id : composeDefaultId(format);
|
|
2012
2053
|
environments[libId] = config;
|
|
2054
|
+
environmentWithInfos.push({
|
|
2055
|
+
id: libId,
|
|
2056
|
+
format,
|
|
2057
|
+
config
|
|
2058
|
+
});
|
|
2013
2059
|
}
|
|
2014
2060
|
const conflictIds = usedIds.filter((id, index)=>usedIds.indexOf(id) !== index);
|
|
2015
2061
|
if (conflictIds.length) throw new Error(`The following ids are duplicated: ${conflictIds.map((id)=>`"${id}"`).join(', ')}. Please change the "lib.id" to be unique.`);
|
|
2016
|
-
return
|
|
2062
|
+
return {
|
|
2063
|
+
environments,
|
|
2064
|
+
environmentWithInfos
|
|
2065
|
+
};
|
|
2017
2066
|
}
|
|
2018
2067
|
const pruneEnvironments = (environments, libs)=>{
|
|
2019
2068
|
if (!libs) return environments;
|
|
@@ -2047,17 +2096,21 @@ const clearConsole = ()=>{
|
|
|
2047
2096
|
const beforeRestart = async ({ filePath, clear = true } = {})=>{
|
|
2048
2097
|
if (clear) clearConsole();
|
|
2049
2098
|
if (filePath) {
|
|
2050
|
-
const filename =
|
|
2051
|
-
|
|
2052
|
-
} else
|
|
2099
|
+
const filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filePath);
|
|
2100
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`Restart because ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].yellow(filename)} is changed.\n`);
|
|
2101
|
+
} else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info('Restarting...\n');
|
|
2053
2102
|
for (const cleaner of cleaners)await cleaner();
|
|
2054
2103
|
cleaners = [];
|
|
2055
2104
|
};
|
|
2056
2105
|
async function build(config, options = {}) {
|
|
2057
|
-
const environments = await composeRsbuildEnvironments(config);
|
|
2058
|
-
const rsbuildInstance = await (0,
|
|
2106
|
+
const { environments } = await composeRsbuildEnvironments(config);
|
|
2107
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
|
|
2059
2108
|
rsbuildConfig: {
|
|
2109
|
+
mode: 'production',
|
|
2110
|
+
root: config.root,
|
|
2060
2111
|
plugins: config.plugins,
|
|
2112
|
+
dev: config.dev,
|
|
2113
|
+
server: config.server,
|
|
2061
2114
|
environments: pruneEnvironments(environments, options.lib)
|
|
2062
2115
|
}
|
|
2063
2116
|
});
|
|
@@ -2069,13 +2122,13 @@ async function build(config, options = {}) {
|
|
|
2069
2122
|
return rsbuildInstance;
|
|
2070
2123
|
}
|
|
2071
2124
|
const getEnvDir = (cwd, envDir)=>{
|
|
2072
|
-
if (envDir) return
|
|
2125
|
+
if (envDir) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(envDir) ? envDir : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(cwd, envDir);
|
|
2073
2126
|
return cwd;
|
|
2074
2127
|
};
|
|
2075
2128
|
async function init(options) {
|
|
2076
2129
|
const cwd = process.cwd();
|
|
2077
2130
|
const root = options.root ? getAbsolutePath(cwd, options.root) : cwd;
|
|
2078
|
-
const envs = (0,
|
|
2131
|
+
const envs = (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.loadEnv)({
|
|
2079
2132
|
cwd: getEnvDir(root, options.envDir),
|
|
2080
2133
|
mode: options.envMode
|
|
2081
2134
|
});
|
|
@@ -2101,10 +2154,14 @@ async function init(options) {
|
|
|
2101
2154
|
};
|
|
2102
2155
|
}
|
|
2103
2156
|
async function inspect(config, options = {}) {
|
|
2104
|
-
const environments = await composeRsbuildEnvironments(config);
|
|
2105
|
-
const rsbuildInstance = await (0,
|
|
2157
|
+
const { environments } = await composeRsbuildEnvironments(config);
|
|
2158
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
|
|
2106
2159
|
rsbuildConfig: {
|
|
2160
|
+
mode: 'production',
|
|
2161
|
+
root: config.root,
|
|
2107
2162
|
plugins: config.plugins,
|
|
2163
|
+
dev: config.dev,
|
|
2164
|
+
server: config.server,
|
|
2108
2165
|
environments: pruneEnvironments(environments, options.lib)
|
|
2109
2166
|
}
|
|
2110
2167
|
});
|
|
@@ -2116,61 +2173,50 @@ async function inspect(config, options = {}) {
|
|
|
2116
2173
|
});
|
|
2117
2174
|
return rsbuildInstance;
|
|
2118
2175
|
}
|
|
2119
|
-
async function startMFDevServer(config) {
|
|
2120
|
-
const rsbuildInstance = await initMFRsbuild(config);
|
|
2176
|
+
async function startMFDevServer(config, options = {}) {
|
|
2177
|
+
const rsbuildInstance = await initMFRsbuild(config, options);
|
|
2121
2178
|
return rsbuildInstance;
|
|
2122
2179
|
}
|
|
2123
|
-
async function initMFRsbuild(
|
|
2124
|
-
const
|
|
2125
|
-
const
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2180
|
+
async function initMFRsbuild(config, options = {}) {
|
|
2181
|
+
const { environments, environmentWithInfos } = await composeRsbuildEnvironments(config);
|
|
2182
|
+
const selectedEnvironmentIds = environmentWithInfos.filter((env)=>{
|
|
2183
|
+
const isMf = 'mf' === env.format;
|
|
2184
|
+
if (!options?.lib) return isMf;
|
|
2185
|
+
return env.id && options.lib.includes(env.id);
|
|
2186
|
+
}).map((env)=>env.id);
|
|
2187
|
+
if (!selectedEnvironmentIds.length) throw new Error('No mf format found, please check your config.');
|
|
2188
|
+
const selectedEnvironments = pruneEnvironments(environments, selectedEnvironmentIds);
|
|
2189
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
|
|
2129
2190
|
rsbuildConfig: {
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2191
|
+
mode: 'development',
|
|
2192
|
+
root: config.root,
|
|
2193
|
+
plugins: config.plugins,
|
|
2194
|
+
dev: config.dev,
|
|
2195
|
+
server: config.server,
|
|
2196
|
+
environments: selectedEnvironments
|
|
2135
2197
|
}
|
|
2136
2198
|
});
|
|
2137
2199
|
const devServer = await rsbuildInstance.startDevServer();
|
|
2138
2200
|
onBeforeRestart(devServer.server.close);
|
|
2139
2201
|
return rsbuildInstance;
|
|
2140
2202
|
}
|
|
2141
|
-
function changeEnvToDev(rsbuildConfig) {
|
|
2142
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core__.mergeRsbuildConfig)(rsbuildConfig, {
|
|
2143
|
-
mode: 'development',
|
|
2144
|
-
dev: {
|
|
2145
|
-
writeToDisk: true
|
|
2146
|
-
},
|
|
2147
|
-
tools: {
|
|
2148
|
-
rspack: {
|
|
2149
|
-
optimization: {
|
|
2150
|
-
nodeEnv: 'development',
|
|
2151
|
-
moduleIds: 'named'
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
});
|
|
2156
|
-
}
|
|
2157
2203
|
const applyCommonOptions = (command)=>{
|
|
2158
|
-
command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path').option('-r --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--env-dir <dir>', 'specify the directory to load `.env` files');
|
|
2204
|
+
command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path').option('-r --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--env-dir <dir>', 'specify the directory to load `.env` files').option('--lib <id>', 'specify the library (repeatable, e.g. --lib esm --lib cjs)', repeatableOption);
|
|
2159
2205
|
};
|
|
2160
2206
|
const repeatableOption = (value, previous)=>(previous ?? []).concat([
|
|
2161
2207
|
value
|
|
2162
2208
|
]);
|
|
2163
2209
|
function runCli() {
|
|
2164
|
-
|
|
2165
|
-
const buildCommand =
|
|
2166
|
-
const inspectCommand =
|
|
2167
|
-
const mfDevCommand =
|
|
2210
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.2.1");
|
|
2211
|
+
const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('build');
|
|
2212
|
+
const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('inspect');
|
|
2213
|
+
const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('mf-dev');
|
|
2168
2214
|
[
|
|
2169
2215
|
buildCommand,
|
|
2170
2216
|
inspectCommand,
|
|
2171
2217
|
mfDevCommand
|
|
2172
2218
|
].forEach(applyCommonOptions);
|
|
2173
|
-
buildCommand.option('
|
|
2219
|
+
buildCommand.option('-w --watch', 'turn on watch mode, watch for changes and rebuild').description('build the library for production').action(async (options)=>{
|
|
2174
2220
|
try {
|
|
2175
2221
|
const cliBuild = async ()=>{
|
|
2176
2222
|
const { config, watchFiles } = await init(options);
|
|
@@ -2181,12 +2227,12 @@ function runCli() {
|
|
|
2181
2227
|
};
|
|
2182
2228
|
await cliBuild();
|
|
2183
2229
|
} catch (err) {
|
|
2184
|
-
|
|
2185
|
-
|
|
2230
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to build.');
|
|
2231
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
2186
2232
|
process.exit(1);
|
|
2187
2233
|
}
|
|
2188
2234
|
});
|
|
2189
|
-
inspectCommand.description('inspect the Rsbuild / Rspack configs of Rslib projects').option('--
|
|
2235
|
+
inspectCommand.description('inspect the Rsbuild / Rspack configs of Rslib projects').option('--output <output>', 'specify inspect content output path', '.rsbuild').option('--verbose', 'show full function definitions in output').action(async (options)=>{
|
|
2190
2236
|
try {
|
|
2191
2237
|
const { config } = await init(options);
|
|
2192
2238
|
await inspect(config, {
|
|
@@ -2196,8 +2242,8 @@ function runCli() {
|
|
|
2196
2242
|
verbose: options.verbose
|
|
2197
2243
|
});
|
|
2198
2244
|
} catch (err) {
|
|
2199
|
-
|
|
2200
|
-
|
|
2245
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to inspect config.');
|
|
2246
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
2201
2247
|
process.exit(1);
|
|
2202
2248
|
}
|
|
2203
2249
|
});
|
|
@@ -2205,20 +2251,22 @@ function runCli() {
|
|
|
2205
2251
|
try {
|
|
2206
2252
|
const cliMfDev = async ()=>{
|
|
2207
2253
|
const { config, watchFiles } = await init(options);
|
|
2208
|
-
await startMFDevServer(config
|
|
2254
|
+
await startMFDevServer(config, {
|
|
2255
|
+
lib: options.lib
|
|
2256
|
+
});
|
|
2209
2257
|
watchFilesForRestart(watchFiles, async ()=>{
|
|
2210
2258
|
await cliMfDev();
|
|
2211
2259
|
});
|
|
2212
2260
|
};
|
|
2213
2261
|
await cliMfDev();
|
|
2214
2262
|
} catch (err) {
|
|
2215
|
-
|
|
2216
|
-
|
|
2263
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start mf-dev.');
|
|
2264
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
2217
2265
|
process.exit(1);
|
|
2218
2266
|
}
|
|
2219
2267
|
});
|
|
2220
|
-
|
|
2268
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.parse();
|
|
2221
2269
|
}
|
|
2222
|
-
const src_rslib_entry_version = "0.1
|
|
2223
|
-
var __webpack_exports__logger =
|
|
2270
|
+
const src_rslib_entry_version = "0.2.1";
|
|
2271
|
+
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger;
|
|
2224
2272
|
export { build, defineConfig, inspect, loadConfig, prepareCli, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_rslib_entry_version as version, __webpack_exports__logger as logger };
|