@rslib/core 0.3.0 → 0.3.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/dist/entryModuleLoader.js +3 -3
- package/dist/index.js +153 -151
- package/dist/libCssExtractLoader.js +5 -5
- package/dist-types/types/config.d.ts +83 -7
- package/package.json +6 -6
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,16 +160,14 @@ 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.3.1\n`);
|
|
164
164
|
}
|
|
165
165
|
const composeAssetConfig = (bundle, format)=>{
|
|
166
|
-
if ('esm' === format || 'cjs' === format) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
};
|
|
172
|
-
}
|
|
166
|
+
if ('esm' === format || 'cjs' === format) return {
|
|
167
|
+
output: {
|
|
168
|
+
dataUriLimit: 0
|
|
169
|
+
}
|
|
170
|
+
};
|
|
173
171
|
return {};
|
|
174
172
|
};
|
|
175
173
|
const DEFAULT_CONFIG_NAME = 'rslib.config';
|
|
@@ -190,9 +188,9 @@ const JS_EXTENSIONS = [
|
|
|
190
188
|
'js',
|
|
191
189
|
'mjs',
|
|
192
190
|
'jsx',
|
|
193
|
-
'(
|
|
194
|
-
'(
|
|
195
|
-
'(
|
|
191
|
+
'(?<!\\.d\\.)ts',
|
|
192
|
+
'(?<!\\.d\\.)mts',
|
|
193
|
+
'(?<!\\.d\\.)cts',
|
|
196
194
|
'tsx',
|
|
197
195
|
'cjs',
|
|
198
196
|
'cjsx',
|
|
@@ -255,7 +253,7 @@ class LibCssExtractPlugin {
|
|
|
255
253
|
const chunkAsset = Object.keys(assets).filter((name)=>/\.css/.test(name));
|
|
256
254
|
for (const name of chunkAsset)compilation.updateAsset(name, (old)=>{
|
|
257
255
|
const oldSource = old.source().toString();
|
|
258
|
-
const replaceSource = new
|
|
256
|
+
const replaceSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
|
|
259
257
|
function replace(searchValue, replaceValue) {
|
|
260
258
|
let start = oldSource.indexOf(searchValue);
|
|
261
259
|
while(-1 !== start){
|
|
@@ -273,7 +271,7 @@ class LibCssExtractPlugin {
|
|
|
273
271
|
});
|
|
274
272
|
}
|
|
275
273
|
}
|
|
276
|
-
const cssConfig_require = (0,
|
|
274
|
+
const cssConfig_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
|
|
277
275
|
const RSLIB_CSS_ENTRY_FLAG = '__rslib_css__';
|
|
278
276
|
function isCssFile(filepath) {
|
|
279
277
|
return CSS_EXTENSIONS_PATTERN.test(filepath);
|
|
@@ -289,7 +287,7 @@ function parsePathQueryFragment(str) {
|
|
|
289
287
|
};
|
|
290
288
|
}
|
|
291
289
|
function isCssModulesFile(filepath, auto) {
|
|
292
|
-
const filename =
|
|
290
|
+
const filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filepath);
|
|
293
291
|
if (true === auto) return CSS_MODULE_REG.test(filename);
|
|
294
292
|
if (auto instanceof RegExp) return auto.test(filepath);
|
|
295
293
|
if ('function' == typeof auto) {
|
|
@@ -387,16 +385,16 @@ const pluginEsmRequireShim = ()=>({
|
|
|
387
385
|
setup (api) {
|
|
388
386
|
api.modifyRspackConfig((config)=>{
|
|
389
387
|
config.plugins ??= [];
|
|
390
|
-
config.plugins.push(new
|
|
388
|
+
config.plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
|
|
391
389
|
banner: requireShim,
|
|
392
|
-
stage:
|
|
390
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE - 1,
|
|
393
391
|
raw: true,
|
|
394
392
|
include: /\.(js|cjs)$/
|
|
395
393
|
}));
|
|
396
394
|
});
|
|
397
395
|
}
|
|
398
396
|
});
|
|
399
|
-
const EntryChunkPlugin_require = (0,
|
|
397
|
+
const EntryChunkPlugin_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
|
|
400
398
|
const EntryChunkPlugin_PLUGIN_NAME = 'rsbuild:lib-entry-chunk';
|
|
401
399
|
const EntryChunkPlugin_LOADER_NAME = 'rsbuild:lib-entry-module';
|
|
402
400
|
const matchFirstLine = (source, regex)=>{
|
|
@@ -466,7 +464,7 @@ class EntryChunkPlugin {
|
|
|
466
464
|
const chunkAsset = Object.keys(assets).filter((name)=>JS_EXTENSIONS_PATTERN.test(name));
|
|
467
465
|
for (const name of chunkAsset)compilation.updateAsset(name, (old)=>{
|
|
468
466
|
const oldSource = old.source().toString();
|
|
469
|
-
const replaceSource = new
|
|
467
|
+
const replaceSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
|
|
470
468
|
if (oldSource.startsWith('use strict;') || oldSource.startsWith('"use strict";')) replaceSource.replace(0, 11, `"use strict";\n${importMetaUrlShim}`);
|
|
471
469
|
else replaceSource.insert(0, importMetaUrlShim);
|
|
472
470
|
return replaceSource;
|
|
@@ -474,14 +472,14 @@ class EntryChunkPlugin {
|
|
|
474
472
|
});
|
|
475
473
|
compilation.hooks.processAssets.tap({
|
|
476
474
|
name: EntryChunkPlugin_PLUGIN_NAME,
|
|
477
|
-
stage:
|
|
475
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING - 1
|
|
478
476
|
}, (assets)=>{
|
|
479
477
|
const chunkAsset = Object.keys(assets);
|
|
480
478
|
for (const name of chunkAsset){
|
|
481
479
|
const shebangValue = this.shebangEntries[name];
|
|
482
480
|
const reactDirectiveValue = this.reactDirectives[name];
|
|
483
481
|
if (shebangValue || reactDirectiveValue) compilation.updateAsset(name, (old)=>{
|
|
484
|
-
const replaceSource = new
|
|
482
|
+
const replaceSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
|
|
485
483
|
if (shebangValue) {
|
|
486
484
|
replaceSource.insert(0, `${shebangValue}\n`);
|
|
487
485
|
this.shebangInjectedAssets.add(name);
|
|
@@ -493,7 +491,7 @@ class EntryChunkPlugin {
|
|
|
493
491
|
});
|
|
494
492
|
});
|
|
495
493
|
compiler.hooks.assetEmitted.tap(EntryChunkPlugin_PLUGIN_NAME, (file, { targetPath })=>{
|
|
496
|
-
if (this.shebangInjectedAssets.has(file)) (0,
|
|
494
|
+
if (this.shebangInjectedAssets.has(file)) (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.chmodSync)(targetPath, this.shebangChmod);
|
|
497
495
|
});
|
|
498
496
|
}
|
|
499
497
|
}
|
|
@@ -529,7 +527,7 @@ const getDefaultExtension = (options)=>{
|
|
|
529
527
|
dtsExtension
|
|
530
528
|
};
|
|
531
529
|
if (!pkgJson) {
|
|
532
|
-
|
|
530
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn('autoExtension configuration will not be applied due to read package.json failed');
|
|
533
531
|
return {
|
|
534
532
|
jsExtension,
|
|
535
533
|
dtsExtension
|
|
@@ -714,8 +712,8 @@ function transformSyntaxToBrowserslist(syntax, target) {
|
|
|
714
712
|
if (Array.isArray(syntax)) return syntax.flatMap(handleSyntaxItem);
|
|
715
713
|
return handleSyntaxItem(syntax);
|
|
716
714
|
}
|
|
717
|
-
const POSIX_SEP_RE = new RegExp('\\' +
|
|
718
|
-
const NATIVE_SEP_RE = new RegExp('\\' +
|
|
715
|
+
const POSIX_SEP_RE = new RegExp('\\' + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep, 'g');
|
|
716
|
+
const NATIVE_SEP_RE = new RegExp('\\' + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep, 'g');
|
|
719
717
|
const PATTERN_REGEX_CACHE = new Map();
|
|
720
718
|
const GLOB_ALL_PATTERN = "**/*";
|
|
721
719
|
const TS_EXTENSIONS = [
|
|
@@ -733,7 +731,7 @@ const util_JS_EXTENSIONS = [
|
|
|
733
731
|
const TSJS_EXTENSIONS = TS_EXTENSIONS.concat(util_JS_EXTENSIONS);
|
|
734
732
|
const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext)=>ext.substring(1)).join('|')})`;
|
|
735
733
|
const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext)=>ext.substring(1)).join('|')})`;
|
|
736
|
-
const IS_POSIX =
|
|
734
|
+
const IS_POSIX = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep;
|
|
737
735
|
function util_makePromise() {
|
|
738
736
|
let resolve, reject;
|
|
739
737
|
const promise = new Promise((res, rej)=>{
|
|
@@ -747,22 +745,22 @@ function util_makePromise() {
|
|
|
747
745
|
};
|
|
748
746
|
}
|
|
749
747
|
async function util_resolveTSConfigJson(filename, cache) {
|
|
750
|
-
if ('.json' !==
|
|
751
|
-
const tsconfig =
|
|
748
|
+
if ('.json' !== __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(filename)) return;
|
|
749
|
+
const tsconfig = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(filename);
|
|
752
750
|
if (cache && (cache.hasParseResult(tsconfig) || cache.hasParseResult(filename))) return tsconfig;
|
|
753
|
-
return
|
|
751
|
+
return __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.promises.stat(tsconfig).then((stat)=>{
|
|
754
752
|
if (stat.isFile() || stat.isFIFO()) return tsconfig;
|
|
755
753
|
throw new Error(`${filename} exists but is not a regular file.`);
|
|
756
754
|
});
|
|
757
755
|
}
|
|
758
756
|
const util_isInNodeModules = IS_POSIX ? (dir)=>dir.includes('/node_modules/') : (dir)=>dir.match(/[/\\]node_modules[/\\]/);
|
|
759
|
-
const posix2native = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(POSIX_SEP_RE,
|
|
760
|
-
const util_native2posix = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(NATIVE_SEP_RE,
|
|
761
|
-
const resolve2posix = IS_POSIX ? (dir, filename)=>dir ?
|
|
757
|
+
const posix2native = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(POSIX_SEP_RE, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep);
|
|
758
|
+
const util_native2posix = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(NATIVE_SEP_RE, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep);
|
|
759
|
+
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)));
|
|
762
760
|
function util_resolveReferencedTSConfigFiles(result, options) {
|
|
763
|
-
const dir =
|
|
761
|
+
const dir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(result.tsconfigFile);
|
|
764
762
|
return result.tsconfig.references.map((ref)=>{
|
|
765
|
-
const refPath = ref.path.endsWith('.json') ? ref.path :
|
|
763
|
+
const refPath = ref.path.endsWith('.json') ? ref.path : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(ref.path, options?.configName ?? 'tsconfig.json');
|
|
766
764
|
return resolve2posix(dir, refPath);
|
|
767
765
|
});
|
|
768
766
|
}
|
|
@@ -776,7 +774,7 @@ function util_resolveSolutionTSConfig(filename, result) {
|
|
|
776
774
|
return result;
|
|
777
775
|
}
|
|
778
776
|
function util_isIncluded(filename, result) {
|
|
779
|
-
const dir = util_native2posix(
|
|
777
|
+
const dir = util_native2posix(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(result.tsconfigFile));
|
|
780
778
|
const files = (result.tsconfig.files || []).map((file)=>resolve2posix(dir, file));
|
|
781
779
|
const absoluteFilename = resolve2posix(null, filename);
|
|
782
780
|
if (files.includes(filename)) return true;
|
|
@@ -867,13 +865,13 @@ function util_replaceTokens(tsconfig, configDir) {
|
|
|
867
865
|
return JSON.parse(JSON.stringify(tsconfig).replaceAll(/"\${configDir}/g, `"${util_native2posix(configDir)}`));
|
|
868
866
|
}
|
|
869
867
|
async function find(filename, options) {
|
|
870
|
-
let dir =
|
|
868
|
+
let dir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(filename));
|
|
871
869
|
if (options?.ignoreNodeModules && util_isInNodeModules(dir)) return null;
|
|
872
870
|
const cache = options?.cache;
|
|
873
871
|
const configName = options?.configName ?? 'tsconfig.json';
|
|
874
872
|
if (cache?.hasConfigPath(dir, configName)) return cache.getConfigPath(dir, configName);
|
|
875
873
|
const { promise, resolve, reject } = util_makePromise();
|
|
876
|
-
if (options?.root && !
|
|
874
|
+
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);
|
|
877
875
|
findUp(dir, {
|
|
878
876
|
promise,
|
|
879
877
|
resolve,
|
|
@@ -896,13 +894,13 @@ function findUp(dir, { resolve, reject, promise }, options) {
|
|
|
896
894
|
else resolve(cached);
|
|
897
895
|
} else cache.setConfigPath(dir, promise, configName);
|
|
898
896
|
}
|
|
899
|
-
const tsconfig =
|
|
900
|
-
|
|
897
|
+
const tsconfig = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dir, options?.configName ?? 'tsconfig.json');
|
|
898
|
+
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].stat(tsconfig, (err, stats)=>{
|
|
901
899
|
if (stats && (stats.isFile() || stats.isFIFO())) resolve(tsconfig);
|
|
902
900
|
else if (err?.code !== 'ENOENT') reject(err);
|
|
903
901
|
else {
|
|
904
902
|
let parent;
|
|
905
|
-
if (root === dir || (parent =
|
|
903
|
+
if (root === dir || (parent = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(dir)) === dir) resolve(null);
|
|
906
904
|
else findUp(parent, {
|
|
907
905
|
promise,
|
|
908
906
|
resolve,
|
|
@@ -911,7 +909,7 @@ function findUp(dir, { resolve, reject, promise }, options) {
|
|
|
911
909
|
}
|
|
912
910
|
});
|
|
913
911
|
}
|
|
914
|
-
|
|
912
|
+
__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep;
|
|
915
913
|
function toJson(tsconfigJson) {
|
|
916
914
|
const stripped = stripDanglingComma(stripJsonComments(stripBom(tsconfigJson)));
|
|
917
915
|
if ('' === stripped.trim()) return '{}';
|
|
@@ -972,34 +970,36 @@ function stripJsonComments(jsonString) {
|
|
|
972
970
|
const escaped = isEscaped(jsonString, index);
|
|
973
971
|
if (!escaped) isInsideString = !isInsideString;
|
|
974
972
|
}
|
|
975
|
-
if (!isInsideString)
|
|
976
|
-
if (isInsideComment
|
|
977
|
-
|
|
978
|
-
isInsideComment = false;
|
|
979
|
-
result += strip(jsonString, offset, index);
|
|
980
|
-
offset = index;
|
|
981
|
-
} else if (isInsideComment === singleComment && '\n' === currentCharacter) {
|
|
982
|
-
isInsideComment = false;
|
|
983
|
-
result += strip(jsonString, offset, index);
|
|
984
|
-
offset = index;
|
|
985
|
-
} else if (isInsideComment || currentCharacter + nextCharacter !== '/*') {
|
|
986
|
-
if (isInsideComment === multiComment && currentCharacter + nextCharacter === '*/') {
|
|
973
|
+
if (!isInsideString) {
|
|
974
|
+
if (isInsideComment || currentCharacter + nextCharacter !== '//') {
|
|
975
|
+
if (isInsideComment === singleComment && currentCharacter + nextCharacter === '\r\n') {
|
|
987
976
|
index++;
|
|
988
977
|
isInsideComment = false;
|
|
989
|
-
result += strip(jsonString, offset, index
|
|
990
|
-
offset = index
|
|
978
|
+
result += strip(jsonString, offset, index);
|
|
979
|
+
offset = index;
|
|
980
|
+
} else if (isInsideComment === singleComment && '\n' === currentCharacter) {
|
|
981
|
+
isInsideComment = false;
|
|
982
|
+
result += strip(jsonString, offset, index);
|
|
983
|
+
offset = index;
|
|
984
|
+
} else if (isInsideComment || currentCharacter + nextCharacter !== '/*') {
|
|
985
|
+
if (isInsideComment === multiComment && currentCharacter + nextCharacter === '*/') {
|
|
986
|
+
index++;
|
|
987
|
+
isInsideComment = false;
|
|
988
|
+
result += strip(jsonString, offset, index + 1);
|
|
989
|
+
offset = index + 1;
|
|
990
|
+
}
|
|
991
|
+
} else {
|
|
992
|
+
result += jsonString.slice(offset, index);
|
|
993
|
+
offset = index;
|
|
994
|
+
isInsideComment = multiComment;
|
|
995
|
+
index++;
|
|
991
996
|
}
|
|
992
997
|
} else {
|
|
993
998
|
result += jsonString.slice(offset, index);
|
|
994
999
|
offset = index;
|
|
995
|
-
isInsideComment =
|
|
1000
|
+
isInsideComment = singleComment;
|
|
996
1001
|
index++;
|
|
997
1002
|
}
|
|
998
|
-
} else {
|
|
999
|
-
result += jsonString.slice(offset, index);
|
|
1000
|
-
offset = index;
|
|
1001
|
-
isInsideComment = singleComment;
|
|
1002
|
-
index++;
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
1005
|
return result + (isInsideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
|
|
@@ -1032,7 +1032,7 @@ async function parse(filename, options) {
|
|
|
1032
1032
|
parseReferences(result, options)
|
|
1033
1033
|
]);
|
|
1034
1034
|
}
|
|
1035
|
-
result.tsconfig = util_replaceTokens(result.tsconfig,
|
|
1035
|
+
result.tsconfig = util_replaceTokens(result.tsconfig, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(tsconfigFile));
|
|
1036
1036
|
resolve(util_resolveSolutionTSConfig(filename, result));
|
|
1037
1037
|
} catch (e) {
|
|
1038
1038
|
reject(e);
|
|
@@ -1053,12 +1053,12 @@ async function getParsedDeep(filename, cache, options) {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
async function parseFile(tsconfigFile, cache, skipCache) {
|
|
1055
1055
|
if (!skipCache && cache?.hasParseResult(tsconfigFile) && !cache.getParseResult(tsconfigFile)._isRootFile_) return cache.getParseResult(tsconfigFile);
|
|
1056
|
-
const promise =
|
|
1056
|
+
const promise = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.promises.readFile(tsconfigFile, 'utf-8').then(toJson).then((json)=>{
|
|
1057
1057
|
const parsed = JSON.parse(json);
|
|
1058
1058
|
applyDefaults(parsed, tsconfigFile);
|
|
1059
1059
|
return {
|
|
1060
1060
|
tsconfigFile,
|
|
1061
|
-
tsconfig: normalizeTSConfig(parsed,
|
|
1061
|
+
tsconfig: normalizeTSConfig(parsed, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(tsconfigFile))
|
|
1062
1062
|
};
|
|
1063
1063
|
}).catch((e)=>{
|
|
1064
1064
|
throw new TSConfckParseError(`parsing ${tsconfigFile} failed: ${e}`, 'PARSE_FILE', tsconfigFile, e);
|
|
@@ -1068,7 +1068,7 @@ async function parseFile(tsconfigFile, cache, skipCache) {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
function normalizeTSConfig(tsconfig, dir) {
|
|
1070
1070
|
const baseUrl = tsconfig.compilerOptions?.baseUrl;
|
|
1071
|
-
if (baseUrl && !baseUrl.startsWith('${') && !
|
|
1071
|
+
if (baseUrl && !baseUrl.startsWith('${') && !__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(baseUrl)) tsconfig.compilerOptions.baseUrl = resolve2posix(dir, baseUrl);
|
|
1072
1072
|
return tsconfig;
|
|
1073
1073
|
}
|
|
1074
1074
|
async function parseReferences(result, options) {
|
|
@@ -1127,7 +1127,7 @@ function resolveExtends(extended, from) {
|
|
|
1127
1127
|
} catch (e) {
|
|
1128
1128
|
error = e;
|
|
1129
1129
|
}
|
|
1130
|
-
if ('.' !== extended[0] && !
|
|
1130
|
+
if ('.' !== extended[0] && !__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(extended)) try {
|
|
1131
1131
|
return req.resolve(`${extended}/tsconfig.json`);
|
|
1132
1132
|
} catch (e) {
|
|
1133
1133
|
error = e;
|
|
@@ -1147,12 +1147,10 @@ const EXTENDABLE_KEYS = [
|
|
|
1147
1147
|
function extendTSConfig(extending, extended) {
|
|
1148
1148
|
const extendingConfig = extending.tsconfig;
|
|
1149
1149
|
const extendedConfig = extended.tsconfig;
|
|
1150
|
-
const relativePath = util_native2posix(
|
|
1150
|
+
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)));
|
|
1151
1151
|
for (const key of Object.keys(extendedConfig).filter((key)=>EXTENDABLE_KEYS.includes(key)))if ('compilerOptions' === key) {
|
|
1152
1152
|
if (!extendingConfig.compilerOptions) extendingConfig.compilerOptions = {};
|
|
1153
|
-
for (const option of Object.keys(extendedConfig.compilerOptions))
|
|
1154
|
-
if (!Object.prototype.hasOwnProperty.call(extendingConfig.compilerOptions, option)) extendingConfig.compilerOptions[option] = rebaseRelative(option, extendedConfig.compilerOptions[option], relativePath);
|
|
1155
|
-
}
|
|
1153
|
+
for (const option of Object.keys(extendedConfig.compilerOptions))if (!Object.prototype.hasOwnProperty.call(extendingConfig.compilerOptions, option)) extendingConfig.compilerOptions[option] = rebaseRelative(option, extendedConfig.compilerOptions[option], relativePath);
|
|
1156
1154
|
} else if (void 0 === extendingConfig[key]) {
|
|
1157
1155
|
if ('watchOptions' === key) {
|
|
1158
1156
|
extendingConfig.watchOptions = {};
|
|
@@ -1180,8 +1178,8 @@ function rebaseRelative(key, value, prependPath) {
|
|
|
1180
1178
|
return rebasePath(value, prependPath);
|
|
1181
1179
|
}
|
|
1182
1180
|
function rebasePath(value, prependPath) {
|
|
1183
|
-
if (
|
|
1184
|
-
return
|
|
1181
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(value) || value.startsWith('${configDir}')) return value;
|
|
1182
|
+
return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.normalize(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(prependPath, value));
|
|
1185
1183
|
}
|
|
1186
1184
|
class TSConfckParseError extends Error {
|
|
1187
1185
|
code;
|
|
@@ -1210,12 +1208,12 @@ const DEFAULT_JSCONFIG_COMPILER_OPTIONS = {
|
|
|
1210
1208
|
noEmit: true
|
|
1211
1209
|
};
|
|
1212
1210
|
function isJSConfig(configFileName) {
|
|
1213
|
-
return 'jsconfig.json' ===
|
|
1211
|
+
return 'jsconfig.json' === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(configFileName);
|
|
1214
1212
|
}
|
|
1215
1213
|
async function loadTsconfig(root, tsconfigPath = 'tsconfig.json') {
|
|
1216
|
-
const tsconfigFileName = await find((0,
|
|
1214
|
+
const tsconfigFileName = await find((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, tsconfigPath), {
|
|
1217
1215
|
root,
|
|
1218
|
-
configName: (0,
|
|
1216
|
+
configName: (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.basename)(tsconfigPath)
|
|
1219
1217
|
});
|
|
1220
1218
|
if (tsconfigFileName) {
|
|
1221
1219
|
const { tsconfig } = await parse(tsconfigFileName);
|
|
@@ -1226,21 +1224,21 @@ async function loadTsconfig(root, tsconfigPath = 'tsconfig.json') {
|
|
|
1226
1224
|
function defineConfig(config) {
|
|
1227
1225
|
return config;
|
|
1228
1226
|
}
|
|
1229
|
-
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(
|
|
1227
|
+
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync);
|
|
1230
1228
|
const resolveConfigPath = (root, customConfig)=>{
|
|
1231
1229
|
if (customConfig) {
|
|
1232
|
-
const customConfigPath = (0,
|
|
1233
|
-
if (
|
|
1234
|
-
|
|
1230
|
+
const customConfigPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(customConfig) ? customConfig : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, customConfig);
|
|
1231
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(customConfigPath)) return customConfigPath;
|
|
1232
|
+
__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`);
|
|
1235
1233
|
}
|
|
1236
|
-
const configFilePath = findConfig((0,
|
|
1234
|
+
const configFilePath = findConfig((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, DEFAULT_CONFIG_NAME));
|
|
1237
1235
|
if (configFilePath) return configFilePath;
|
|
1238
1236
|
throw new Error(`${DEFAULT_CONFIG_NAME} not found in ${root}`);
|
|
1239
1237
|
};
|
|
1240
1238
|
async function loadConfig({ cwd = process.cwd(), path, envMode }) {
|
|
1241
1239
|
const configFilePath = resolveConfigPath(cwd, path);
|
|
1242
|
-
const { content } = await (0,
|
|
1243
|
-
cwd: (0,
|
|
1240
|
+
const { content } = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.loadConfig)({
|
|
1241
|
+
cwd: (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)(configFilePath),
|
|
1244
1242
|
path: configFilePath,
|
|
1245
1243
|
envMode
|
|
1246
1244
|
});
|
|
@@ -1307,7 +1305,7 @@ const composeExternalsWarnConfig = (format, ...externalsArray)=>{
|
|
|
1307
1305
|
};
|
|
1308
1306
|
if (contextInfo.issuer && 'commonjs' === dependencyType) {
|
|
1309
1307
|
matchUserExternals(externals, request, _callback);
|
|
1310
|
-
if (externalized)
|
|
1308
|
+
if (externalized) __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(composeModuleImportWarn(request));
|
|
1311
1309
|
}
|
|
1312
1310
|
callback();
|
|
1313
1311
|
}
|
|
@@ -1322,7 +1320,7 @@ const composeAutoExternalConfig = (options)=>{
|
|
|
1322
1320
|
const autoExternal = getAutoExternalDefaultValue(format, options.autoExternal);
|
|
1323
1321
|
if (false === autoExternal) return {};
|
|
1324
1322
|
if (!pkgJson) {
|
|
1325
|
-
|
|
1323
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn('autoExternal configuration will not be applied due to read package.json failed');
|
|
1326
1324
|
return {};
|
|
1327
1325
|
}
|
|
1328
1326
|
const userExternalKeys = userExternals && isObject(userExternals) ? Object.keys(userExternals) : [];
|
|
@@ -1393,30 +1391,30 @@ function composeBannerFooterConfig(banner, footer) {
|
|
|
1393
1391
|
if (isEmptyObject(bannerConfig) && isEmptyObject(footerConfig)) return {};
|
|
1394
1392
|
const plugins = [];
|
|
1395
1393
|
if (!isEmptyObject(bannerConfig)) {
|
|
1396
|
-
if (bannerConfig.js) plugins.push(new
|
|
1394
|
+
if (bannerConfig.js) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
|
|
1397
1395
|
banner: bannerConfig.js,
|
|
1398
|
-
stage:
|
|
1396
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
1399
1397
|
raw: true,
|
|
1400
1398
|
include: /\.(js|mjs|cjs)$/
|
|
1401
1399
|
}));
|
|
1402
|
-
if (bannerConfig.css) plugins.push(new
|
|
1400
|
+
if (bannerConfig.css) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
|
|
1403
1401
|
banner: bannerConfig.css,
|
|
1404
|
-
stage:
|
|
1402
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
1405
1403
|
raw: true,
|
|
1406
1404
|
include: /\.(css)$/
|
|
1407
1405
|
}));
|
|
1408
1406
|
}
|
|
1409
1407
|
if (!isEmptyObject(footerConfig)) {
|
|
1410
|
-
if (footerConfig.js) plugins.push(new
|
|
1408
|
+
if (footerConfig.js) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
|
|
1411
1409
|
banner: footerConfig.js,
|
|
1412
|
-
stage:
|
|
1410
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
1413
1411
|
raw: true,
|
|
1414
1412
|
footer: true,
|
|
1415
1413
|
include: /\.(js|mjs|cjs)$/
|
|
1416
1414
|
}));
|
|
1417
|
-
if (footerConfig.css) plugins.push(new
|
|
1415
|
+
if (footerConfig.css) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
|
|
1418
1416
|
banner: footerConfig.css,
|
|
1419
|
-
stage:
|
|
1417
|
+
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
1420
1418
|
raw: true,
|
|
1421
1419
|
footer: true,
|
|
1422
1420
|
include: /\.(css)$/
|
|
@@ -1441,7 +1439,7 @@ function composeDecoratorsConfig(compilerOptions, version) {
|
|
|
1441
1439
|
};
|
|
1442
1440
|
}
|
|
1443
1441
|
async function createConstantRsbuildConfig() {
|
|
1444
|
-
return (0,
|
|
1442
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.defineConfig)({
|
|
1445
1443
|
dev: {
|
|
1446
1444
|
progressBar: false
|
|
1447
1445
|
},
|
|
@@ -1697,7 +1695,7 @@ const composeShimsConfig = (format, shims)=>{
|
|
|
1697
1695
|
enabledShims
|
|
1698
1696
|
};
|
|
1699
1697
|
};
|
|
1700
|
-
const composeModuleImportWarn = (request)=>`The externalized commonjs request ${
|
|
1698
|
+
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"')}.`;
|
|
1701
1699
|
const composeExternalsConfig = (format, externals)=>{
|
|
1702
1700
|
const externalsTypeMap = {
|
|
1703
1701
|
esm: 'module-import',
|
|
@@ -1738,7 +1736,7 @@ const composeAutoExtensionConfig = (config, autoExtension, pkgJson)=>{
|
|
|
1738
1736
|
}
|
|
1739
1737
|
}
|
|
1740
1738
|
};
|
|
1741
|
-
const updatedJsExtension = 'string' == typeof updatedConfig.output?.filename?.js && updatedConfig.output?.filename?.js ? (0,
|
|
1739
|
+
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;
|
|
1742
1740
|
return {
|
|
1743
1741
|
config: updatedConfig,
|
|
1744
1742
|
jsExtension: updatedJsExtension,
|
|
@@ -1795,16 +1793,19 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto)=>{
|
|
|
1795
1793
|
};
|
|
1796
1794
|
}
|
|
1797
1795
|
if (false !== bundle) {
|
|
1798
|
-
|
|
1796
|
+
const entryErrorReasons = [];
|
|
1799
1797
|
traverseEntryQuery(entries, (entry)=>{
|
|
1800
|
-
const entryAbsPath =
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1798
|
+
const entryAbsPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(entry) ? entry : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(root, entry);
|
|
1799
|
+
const isDirLike = '' === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(entryAbsPath);
|
|
1800
|
+
const dirError = `Glob pattern ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(`"${entry}"`)} is not supported when "bundle" is "true", considering "bundle" to "false" to use bundleless mode, or specify a file entry to bundle. See ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('https://lib.rsbuild.dev/guide/basic/output-structure')} for more details.`;
|
|
1801
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(entryAbsPath)) {
|
|
1802
|
+
const stats = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].statSync(entryAbsPath);
|
|
1803
|
+
if (!stats.isFile()) entryErrorReasons.push(dirError);
|
|
1804
|
+
} else if (isDirLike) entryErrorReasons.push(dirError);
|
|
1805
|
+
else entryErrorReasons.push(`Can't resolve the entry ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(`"${entry}"`)} at the location ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(`${entryAbsPath}`)}. Please ensure that the file exists.`);
|
|
1805
1806
|
return entry;
|
|
1806
1807
|
});
|
|
1807
|
-
if (
|
|
1808
|
+
if (entryErrorReasons.length) throw new AggregateError(entryErrorReasons.map((reason)=>new Error(reason)));
|
|
1808
1809
|
return {
|
|
1809
1810
|
entryConfig: {
|
|
1810
1811
|
source: {
|
|
@@ -1831,14 +1832,14 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto)=>{
|
|
|
1831
1832
|
const lcp = await calcLongestCommonPath(resolvedEntryFiles);
|
|
1832
1833
|
const outBase = null === lcp ? root : lcp;
|
|
1833
1834
|
function getEntryName(file) {
|
|
1834
|
-
const { dir, name } =
|
|
1835
|
-
const entryFileName =
|
|
1835
|
+
const { dir, name } = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].parse(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(outBase, file));
|
|
1836
|
+
const entryFileName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dir, name);
|
|
1836
1837
|
if (isCssGlobalFile(file, cssModulesAuto)) return `${RSLIB_CSS_ENTRY_FLAG}/${entryFileName}`;
|
|
1837
1838
|
return entryFileName;
|
|
1838
1839
|
}
|
|
1839
1840
|
for (const file of resolvedEntryFiles){
|
|
1840
1841
|
const entryName = getEntryName(file);
|
|
1841
|
-
if (resolvedEntries[entryName])
|
|
1842
|
+
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`);
|
|
1842
1843
|
resolvedEntries[entryName] = file;
|
|
1843
1844
|
}
|
|
1844
1845
|
}
|
|
@@ -1897,13 +1898,13 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
|
|
|
1897
1898
|
let resolvedRequest = request;
|
|
1898
1899
|
resolvedRequest = await resolver(context, resolvedRequest);
|
|
1899
1900
|
if (!resolvedRequest.includes('node_modules')) {
|
|
1900
|
-
resolvedRequest = normalizeSlash(
|
|
1901
|
+
resolvedRequest = normalizeSlash(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(issuer), resolvedRequest));
|
|
1901
1902
|
if ('.' !== resolvedRequest[0]) resolvedRequest = `./${resolvedRequest}`;
|
|
1902
1903
|
return resolvedRequest;
|
|
1903
1904
|
}
|
|
1904
1905
|
return;
|
|
1905
1906
|
} catch (e) {
|
|
1906
|
-
|
|
1907
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`Failed to resolve module ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green(`"${request}"`)} from ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green(issuer)}. If it's an npm package, consider adding it to dependencies or peerDependencies in package.json to make it externalized.`);
|
|
1907
1908
|
return request;
|
|
1908
1909
|
}
|
|
1909
1910
|
}
|
|
@@ -1917,7 +1918,7 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
|
|
|
1917
1918
|
resolvedRequest = redirectedPath;
|
|
1918
1919
|
}
|
|
1919
1920
|
if (jsRedirectExtension && resolvedRequest.startsWith('.')) {
|
|
1920
|
-
const ext = (0,
|
|
1921
|
+
const ext = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(resolvedRequest);
|
|
1921
1922
|
if (ext) {
|
|
1922
1923
|
if (!JS_EXTENSIONS_PATTERN.test(resolvedRequest)) return callback();
|
|
1923
1924
|
resolvedRequest = resolvedRequest.replace(/\.[^.]+$/, jsExtension);
|
|
@@ -2013,7 +2014,7 @@ const composeExternalHelpersConfig = (externalHelpers, pkgJson)=>{
|
|
|
2013
2014
|
...Object.keys(pkgJson?.devDependencies ?? [])
|
|
2014
2015
|
];
|
|
2015
2016
|
if (!deps.includes(SWC_HELPERS)) {
|
|
2016
|
-
|
|
2017
|
+
__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.`);
|
|
2017
2018
|
process.exit(1);
|
|
2018
2019
|
}
|
|
2019
2020
|
defaultConfig = Object.assign(defaultConfig, {
|
|
@@ -2064,14 +2065,14 @@ async function composeLibRsbuildConfig(config, root, sharedPlugins) {
|
|
|
2064
2065
|
const minifyConfig = composeMinifyConfig(config);
|
|
2065
2066
|
const bannerFooterConfig = composeBannerFooterConfig(banner, footer);
|
|
2066
2067
|
const decoratorsConfig = composeDecoratorsConfig(compilerOptions, config.source?.decorators?.version);
|
|
2067
|
-
return (0,
|
|
2068
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(formatConfig, shimsConfig, syntaxConfig, externalHelpersConfig, autoExtensionConfig, targetConfig, externalsWarnConfig, userExternalsConfig, autoExternalConfig, targetExternalsConfig, bundlelessExternalConfig, entryConfig, cssConfig, assetConfig, entryChunkConfig, minifyConfig, dtsConfig, bannerFooterConfig, decoratorsConfig);
|
|
2068
2069
|
}
|
|
2069
2070
|
async function composeCreateRsbuildConfig(rslibConfig) {
|
|
2070
2071
|
const constantRsbuildConfig = await createConstantRsbuildConfig();
|
|
2071
2072
|
const { lib: libConfigsArray, mode, root, plugins: sharedPlugins, dev, server, ...sharedRsbuildConfig } = rslibConfig;
|
|
2072
2073
|
if (!libConfigsArray) throw new Error(`Expect lib field to be an array, but got ${libConfigsArray}.`);
|
|
2073
2074
|
const libConfigPromises = libConfigsArray.map(async (libConfig)=>{
|
|
2074
|
-
const userConfig = (0,
|
|
2075
|
+
const userConfig = (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(sharedRsbuildConfig, libConfig);
|
|
2075
2076
|
const libRsbuildConfig = await composeLibRsbuildConfig(userConfig, root, sharedPlugins);
|
|
2076
2077
|
userConfig.source ??= {};
|
|
2077
2078
|
userConfig.source.entry = {};
|
|
@@ -2079,7 +2080,7 @@ async function composeCreateRsbuildConfig(rslibConfig) {
|
|
|
2079
2080
|
delete userConfig.output.externals;
|
|
2080
2081
|
const config = {
|
|
2081
2082
|
format: libConfig.format,
|
|
2082
|
-
config: (0,
|
|
2083
|
+
config: (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(constantRsbuildConfig, libRsbuildConfig, omit(userConfig, {
|
|
2083
2084
|
id: true,
|
|
2084
2085
|
bundle: true,
|
|
2085
2086
|
format: true,
|
|
@@ -2168,15 +2169,15 @@ const clearConsole = ()=>{
|
|
|
2168
2169
|
const beforeRestart = async ({ filePath, clear = true } = {})=>{
|
|
2169
2170
|
if (clear) clearConsole();
|
|
2170
2171
|
if (filePath) {
|
|
2171
|
-
const filename =
|
|
2172
|
-
|
|
2173
|
-
} else
|
|
2172
|
+
const filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filePath);
|
|
2173
|
+
__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`);
|
|
2174
|
+
} else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info('Restarting...\n');
|
|
2174
2175
|
for (const cleaner of cleaners)await cleaner();
|
|
2175
2176
|
cleaners = [];
|
|
2176
2177
|
};
|
|
2177
2178
|
async function build(config, options = {}) {
|
|
2178
2179
|
const { environments } = await composeRsbuildEnvironments(config);
|
|
2179
|
-
const rsbuildInstance = await (0,
|
|
2180
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
|
|
2180
2181
|
rsbuildConfig: {
|
|
2181
2182
|
mode: 'production',
|
|
2182
2183
|
root: config.root,
|
|
@@ -2194,13 +2195,13 @@ async function build(config, options = {}) {
|
|
|
2194
2195
|
return rsbuildInstance;
|
|
2195
2196
|
}
|
|
2196
2197
|
const getEnvDir = (cwd, envDir)=>{
|
|
2197
|
-
if (envDir) return
|
|
2198
|
+
if (envDir) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(envDir) ? envDir : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(cwd, envDir);
|
|
2198
2199
|
return cwd;
|
|
2199
2200
|
};
|
|
2200
2201
|
async function init(options) {
|
|
2201
2202
|
const cwd = process.cwd();
|
|
2202
2203
|
const root = options.root ? getAbsolutePath(cwd, options.root) : cwd;
|
|
2203
|
-
const envs = (0,
|
|
2204
|
+
const envs = (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.loadEnv)({
|
|
2204
2205
|
cwd: getEnvDir(root, options.envDir),
|
|
2205
2206
|
mode: options.envMode
|
|
2206
2207
|
});
|
|
@@ -2227,7 +2228,7 @@ async function init(options) {
|
|
|
2227
2228
|
}
|
|
2228
2229
|
async function inspect(config, options = {}) {
|
|
2229
2230
|
const { environments } = await composeRsbuildEnvironments(config);
|
|
2230
|
-
const rsbuildInstance = await (0,
|
|
2231
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
|
|
2231
2232
|
rsbuildConfig: {
|
|
2232
2233
|
mode: 'production',
|
|
2233
2234
|
root: config.root,
|
|
@@ -2258,7 +2259,7 @@ async function initMFRsbuild(config, options = {}) {
|
|
|
2258
2259
|
}).map((env)=>env.id);
|
|
2259
2260
|
if (!selectedEnvironmentIds.length) throw new Error(`No mf format found in ${options.lib ? `libs ${options.lib.map((lib)=>`"${lib}"`).join(', ')}` : 'your config'}, please check your config to ensure that the mf format is enabled correctly.`);
|
|
2260
2261
|
const selectedEnvironments = pruneEnvironments(environments, selectedEnvironmentIds);
|
|
2261
|
-
const rsbuildInstance = await (0,
|
|
2262
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
|
|
2262
2263
|
rsbuildConfig: {
|
|
2263
2264
|
mode: 'development',
|
|
2264
2265
|
root: config.root,
|
|
@@ -2279,10 +2280,10 @@ const repeatableOption = (value, previous)=>(previous ?? []).concat([
|
|
|
2279
2280
|
value
|
|
2280
2281
|
]);
|
|
2281
2282
|
function runCli() {
|
|
2282
|
-
|
|
2283
|
-
const buildCommand =
|
|
2284
|
-
const inspectCommand =
|
|
2285
|
-
const mfDevCommand =
|
|
2283
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.3.1");
|
|
2284
|
+
const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('build');
|
|
2285
|
+
const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('inspect');
|
|
2286
|
+
const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('mf-dev');
|
|
2286
2287
|
[
|
|
2287
2288
|
buildCommand,
|
|
2288
2289
|
inspectCommand,
|
|
@@ -2299,8 +2300,9 @@ function runCli() {
|
|
|
2299
2300
|
};
|
|
2300
2301
|
await cliBuild();
|
|
2301
2302
|
} catch (err) {
|
|
2302
|
-
|
|
2303
|
-
|
|
2303
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to build.');
|
|
2304
|
+
if (err instanceof AggregateError) for (const error of err.errors)__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(error);
|
|
2305
|
+
else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
2304
2306
|
process.exit(1);
|
|
2305
2307
|
}
|
|
2306
2308
|
});
|
|
@@ -2314,8 +2316,8 @@ function runCli() {
|
|
|
2314
2316
|
verbose: options.verbose
|
|
2315
2317
|
});
|
|
2316
2318
|
} catch (err) {
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to inspect config.');
|
|
2320
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
2319
2321
|
process.exit(1);
|
|
2320
2322
|
}
|
|
2321
2323
|
});
|
|
@@ -2332,13 +2334,13 @@ function runCli() {
|
|
|
2332
2334
|
};
|
|
2333
2335
|
await cliMfDev();
|
|
2334
2336
|
} catch (err) {
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start mf-dev.');
|
|
2338
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
2337
2339
|
process.exit(1);
|
|
2338
2340
|
}
|
|
2339
2341
|
});
|
|
2340
|
-
|
|
2342
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.parse();
|
|
2341
2343
|
}
|
|
2342
|
-
const src_rslib_entry_version = "0.3.
|
|
2343
|
-
var __webpack_exports__logger =
|
|
2344
|
+
const src_rslib_entry_version = "0.3.1";
|
|
2345
|
+
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger;
|
|
2344
2346
|
export { build, defineConfig, inspect, loadConfig, prepareCli, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_rslib_entry_version as version, __webpack_exports__logger as logger };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
2
2
|
const BASE_URI = 'webpack://';
|
|
3
3
|
const MODULE_TYPE = 'css/mini-extract';
|
|
4
4
|
const AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
|
|
@@ -96,17 +96,17 @@ const pitch = function(request, _, _data) {
|
|
|
96
96
|
let resultSource = `// extracted by ${LOADER_NAME}`;
|
|
97
97
|
let importCssFiles = '';
|
|
98
98
|
function getRelativePath(from, to) {
|
|
99
|
-
let relativePath =
|
|
100
|
-
if (!relativePath.startsWith('./') && !relativePath.startsWith('../') && !
|
|
99
|
+
let relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(from, to);
|
|
100
|
+
if (!relativePath.startsWith('./') && !relativePath.startsWith('../') && !__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(relativePath)) relativePath = `./${relativePath}`;
|
|
101
101
|
return relativePath;
|
|
102
102
|
}
|
|
103
103
|
const m = new Map();
|
|
104
104
|
for (const { content, filepath } of dependencies){
|
|
105
105
|
let distFilepath = getRelativePath(rootDir, filepath);
|
|
106
|
-
const ext = (0,
|
|
106
|
+
const ext = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(distFilepath);
|
|
107
107
|
if ('css' !== ext) distFilepath = distFilepath.replace(ext, '.css');
|
|
108
108
|
distFilepath = distFilepath.replace(/\.module\.css/, '_module.css');
|
|
109
|
-
const cssFilename =
|
|
109
|
+
const cssFilename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(distFilepath);
|
|
110
110
|
if (content.trim()) {
|
|
111
111
|
m.get(distFilepath) ? m.set(distFilepath, `${m.get(distFilepath) + content}\n`) : m.set(distFilepath, `${content}\n`);
|
|
112
112
|
importCssFiles += '\n';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { EnvironmentConfig, RsbuildConfig, Rspack } from '@rsbuild/core';
|
|
2
|
-
import type { PluginDtsOptions } from 'rsbuild-plugin-dts';
|
|
3
2
|
import type { GetAsyncFunctionFromUnion } from './utils';
|
|
4
3
|
export type Format = 'esm' | 'cjs' | 'umd' | 'mf';
|
|
5
4
|
export type FixedEcmaVersions = 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023';
|
|
@@ -15,14 +14,63 @@ export type RsbuildConfigEntryItem = RsbuildConfigEntry[string];
|
|
|
15
14
|
export type RspackResolver = GetAsyncFunctionFromUnion<ReturnType<NonNullable<Rspack.ExternalItemFunctionData['getResolve']>>>;
|
|
16
15
|
export type RsbuildConfigOutputTarget = NonNullable<EnvironmentConfig['output']>['target'];
|
|
17
16
|
export type Syntax = EcmaScriptVersion | string[];
|
|
18
|
-
export type Dts =
|
|
17
|
+
export type Dts = {
|
|
18
|
+
/**
|
|
19
|
+
* Whether to bundle the DTS files.
|
|
20
|
+
* @defaultValue `false`
|
|
21
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/dts#dtsbundle}
|
|
22
|
+
*/
|
|
23
|
+
bundle?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The output directory of DTS files.
|
|
26
|
+
* @defaultValue {@link https://lib.rsbuild.dev/config/lib/dts#default-value}
|
|
27
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/dts#dtsdistpath}
|
|
28
|
+
*/
|
|
29
|
+
distPath?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether to generate DTS files with building the project references.
|
|
32
|
+
* @defaultValue `false`
|
|
33
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/dts#dtsbuild}
|
|
34
|
+
*/
|
|
35
|
+
build?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to abort the build process when an error occurs during DTS generation.
|
|
38
|
+
* @defaultValue `true`
|
|
39
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/dts#dtsabortonerror}
|
|
40
|
+
*/
|
|
41
|
+
abortOnError?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to automatically set the DTS file extension based on the {@link format} option.
|
|
44
|
+
* @defaultValue `false`
|
|
45
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/dts#dtsautoextension}
|
|
46
|
+
*/
|
|
19
47
|
autoExtension?: boolean;
|
|
20
|
-
}
|
|
48
|
+
} | boolean;
|
|
21
49
|
export type AutoExternal = boolean | {
|
|
50
|
+
/**
|
|
51
|
+
* Whether to automatically externalize dependencies of type `dependencies`.
|
|
52
|
+
* @defaultValue `true`
|
|
53
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/auto-external#autoexternaldependencies}
|
|
54
|
+
*/
|
|
22
55
|
dependencies?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether to automatically externalize dependencies of type `optionalDependencies`.
|
|
58
|
+
* @defaultValue `true`
|
|
59
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/auto-external#autoexternaloptionaldependencies}
|
|
60
|
+
*/
|
|
23
61
|
optionalDependencies?: boolean;
|
|
24
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Whether to automatically externalize dependencies of type `peerDependencies`.
|
|
64
|
+
* @defaultValue `true`
|
|
65
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/auto-external#autoexternalpeerdependencies}
|
|
66
|
+
*/
|
|
25
67
|
peerDependencies?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Whether to automatically externalize dependencies of type `devDependencies`.
|
|
70
|
+
* @defaultValue `false`
|
|
71
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/auto-external#autoexternaldevdependencies}
|
|
72
|
+
*/
|
|
73
|
+
devDependencies?: boolean;
|
|
26
74
|
};
|
|
27
75
|
export type BannerAndFooter = {
|
|
28
76
|
js?: string;
|
|
@@ -30,12 +78,40 @@ export type BannerAndFooter = {
|
|
|
30
78
|
dts?: string;
|
|
31
79
|
};
|
|
32
80
|
export type Shims = {
|
|
81
|
+
/**
|
|
82
|
+
* Configure the shims for CommonJS output.
|
|
83
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/shims#shimscjs}
|
|
84
|
+
*/
|
|
33
85
|
cjs?: {
|
|
86
|
+
/**
|
|
87
|
+
* Whether to inject shims for the `import.meta.url` in CommonJS output.
|
|
88
|
+
* @defaultValue `true`
|
|
89
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/shims#shimscjsimportmetaurl}
|
|
90
|
+
*/
|
|
34
91
|
'import.meta.url'?: boolean;
|
|
35
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* Configure the shims for ESM output.
|
|
95
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/shims#shimsesm}
|
|
96
|
+
*/
|
|
36
97
|
esm?: {
|
|
98
|
+
/**
|
|
99
|
+
* Whether to inject shims for the global `__filename` of CommonJS in ESM output.
|
|
100
|
+
* @defaultValue `false`
|
|
101
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/shims#shimsesm__filename}
|
|
102
|
+
*/
|
|
37
103
|
__filename?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether to inject shims for the global `__dirname` of CommonJS in ESM output.
|
|
106
|
+
* @defaultValue `false`
|
|
107
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/shims#shimsesm__dirname}
|
|
108
|
+
*/
|
|
38
109
|
__dirname?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Whether to inject shims for the global `require` of CommonJS in ESM output.
|
|
112
|
+
* @defaultValue `false`
|
|
113
|
+
* @see {@link https://lib.rsbuild.dev/config/lib/shims#shimsesmrequire}
|
|
114
|
+
*/
|
|
39
115
|
require?: boolean;
|
|
40
116
|
};
|
|
41
117
|
};
|
|
@@ -46,7 +122,7 @@ export type JsRedirect = {
|
|
|
46
122
|
*/
|
|
47
123
|
path?: boolean;
|
|
48
124
|
/**
|
|
49
|
-
* Whether to automatically
|
|
125
|
+
* Whether to automatically redirect the file extension to import paths based on the JavaScript output files.
|
|
50
126
|
* @defaultValue `true`
|
|
51
127
|
*/
|
|
52
128
|
extension?: boolean;
|
|
@@ -58,7 +134,7 @@ export type StyleRedirect = {
|
|
|
58
134
|
*/
|
|
59
135
|
path?: boolean;
|
|
60
136
|
/**
|
|
61
|
-
* Whether to automatically
|
|
137
|
+
* Whether to automatically redirect the file extension to import paths based on the style output files.
|
|
62
138
|
* @defaultValue `true`
|
|
63
139
|
*/
|
|
64
140
|
extension?: boolean;
|
|
@@ -66,7 +142,7 @@ export type StyleRedirect = {
|
|
|
66
142
|
export type Redirect = {
|
|
67
143
|
/** Controls the redirect of the import paths of output JavaScript files. */
|
|
68
144
|
js?: JsRedirect;
|
|
69
|
-
/**
|
|
145
|
+
/** Controls the redirect of the import paths of output style files. */
|
|
70
146
|
style?: StyleRedirect;
|
|
71
147
|
};
|
|
72
148
|
export interface LibConfig extends EnvironmentConfig {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://lib.rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"compiled"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@rsbuild/core": "1.2.0-
|
|
35
|
+
"@rsbuild/core": "1.2.0-beta.0",
|
|
36
36
|
"tinyglobby": "^0.2.10",
|
|
37
|
-
"rsbuild-plugin-dts": "0.3.
|
|
37
|
+
"rsbuild-plugin-dts": "0.3.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@module-federation/rsbuild-plugin": "^0.8.
|
|
40
|
+
"@module-federation/rsbuild-plugin": "^0.8.8",
|
|
41
41
|
"@types/fs-extra": "^11.0.4",
|
|
42
42
|
"chokidar": "^4.0.3",
|
|
43
43
|
"commander": "^13.0.0",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"picocolors": "1.1.1",
|
|
47
47
|
"prebundle": "1.2.5",
|
|
48
48
|
"rsbuild-plugin-publint": "^0.2.1",
|
|
49
|
-
"rslib": "npm:@rslib/core@0.
|
|
49
|
+
"rslib": "npm:@rslib/core@0.3.0",
|
|
50
50
|
"rslog": "^1.2.3",
|
|
51
51
|
"tsconfck": "3.1.4",
|
|
52
|
-
"typescript": "^5.7.
|
|
52
|
+
"typescript": "^5.7.3",
|
|
53
53
|
"@rslib/tsconfig": "0.0.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|