@rslib/core 0.6.1 → 0.6.2
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 +2 -1
- package/compiled/commander/index.d.ts +2 -1
- package/compiled/rslog/index.d.ts +2 -1
- package/dist/entryModuleLoader.js +4 -7
- package/dist/index.js +14 -15
- package/dist/libCssExtractLoader.js +69 -15
- package/dist-types/config.d.ts +0 -1
- package/dist-types/constant.d.ts +0 -1
- package/dist-types/css/cssConfig.d.ts +1 -1
- package/dist-types/css/libCssExtractLoader.d.ts +2 -0
- package/package.json +7 -7
|
@@ -342,4 +342,5 @@ declare const _default: {
|
|
|
342
342
|
FSWatcher: typeof FSWatcher;
|
|
343
343
|
};
|
|
344
344
|
|
|
345
|
-
export {
|
|
345
|
+
export { FSWatcher, WatchHelper, _default as default, watch };
|
|
346
|
+
export type { ChokidarOptions, EmitArgs, EmitArgsWithName, EmitErrorArgs, FSWInstanceOptions, FSWatcherEventMap, FSWatcherKnownEventMap, MatchFunction, Matcher, MatcherObject, ThrottleType, Throttler };
|
|
@@ -1044,4 +1044,5 @@ declare function createArgument(name: string, description?: string): Argument;
|
|
|
1044
1044
|
|
|
1045
1045
|
declare const program: Command;
|
|
1046
1046
|
|
|
1047
|
-
export {
|
|
1047
|
+
export { Argument, Command, CommanderError, Help, InvalidArgumentError, InvalidArgumentError as InvalidOptionArgumentError, Option, createArgument, createCommand, createOption, program };
|
|
1048
|
+
export type { AddHelpTextContext, AddHelpTextPosition, CommandOptions, ErrorOptions, ExecutableCommandOptions, HelpConfiguration, HelpContext, HookEvent, OptionValueSource, OptionValues, OutputConfiguration, ParseOptions, ParseOptionsResult };
|
|
@@ -63,4 +63,5 @@ declare let createLogger: (options?: Options) => Logger;
|
|
|
63
63
|
|
|
64
64
|
declare let logger: Logger;
|
|
65
65
|
|
|
66
|
-
export {
|
|
66
|
+
export { createLogger, logger };
|
|
67
|
+
export type { LogFunction, LogLevel, LogMessage, LogType, Logger, Options };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const RSLIB_ENTRY_QUERY = '__rslib_entry__';
|
|
2
1
|
const SHEBANG_REGEX = /#!.*[\s\n\r]*$/;
|
|
3
2
|
const REACT_DIRECTIVE_REGEX = /^['"]use (client|server)['"](;?)[\s\n\r]*$/;
|
|
4
3
|
const DTS_EXTENSIONS = [
|
|
@@ -44,12 +43,10 @@ function splitFromFirstLine(text) {
|
|
|
44
43
|
}
|
|
45
44
|
const entryModuleLoader_rslib_entry_loader = function(source) {
|
|
46
45
|
let result = source;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (REACT_DIRECTIVE_REGEX.test(firstLine2)) result = rest2;
|
|
52
|
-
}
|
|
46
|
+
const [firstLine1, rest] = splitFromFirstLine(result);
|
|
47
|
+
if (SHEBANG_REGEX.test(firstLine1)) result = rest;
|
|
48
|
+
const [firstLine2, rest2] = splitFromFirstLine(result);
|
|
49
|
+
if (REACT_DIRECTIVE_REGEX.test(firstLine2)) result = rest2;
|
|
53
50
|
return result;
|
|
54
51
|
};
|
|
55
52
|
const entryModuleLoader_rslib_entry_ = entryModuleLoader_rslib_entry_loader;
|
package/dist/index.js
CHANGED
|
@@ -184,7 +184,7 @@ function prepareCli() {
|
|
|
184
184
|
initNodeEnv();
|
|
185
185
|
const { npm_execpath } = process.env;
|
|
186
186
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
187
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.6.
|
|
187
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.6.2\n`);
|
|
188
188
|
}
|
|
189
189
|
const DEFAULT_CONFIG_NAME = 'rslib.config';
|
|
190
190
|
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
@@ -196,7 +196,6 @@ const DEFAULT_CONFIG_EXTENSIONS = [
|
|
|
196
196
|
'.cts'
|
|
197
197
|
];
|
|
198
198
|
const SWC_HELPERS = '@swc/helpers';
|
|
199
|
-
const RSLIB_ENTRY_QUERY = '__rslib_entry__';
|
|
200
199
|
const SHEBANG_PREFIX = '#!';
|
|
201
200
|
const SHEBANG_REGEX = /#!.*[\s\n\r]*$/;
|
|
202
201
|
const REACT_DIRECTIVE_REGEX = /^['"]use (client|server)['"](;?)[\s\n\r]*$/;
|
|
@@ -437,7 +436,7 @@ function parsePathQueryFragment(str) {
|
|
|
437
436
|
fragment: match?.[3] || ''
|
|
438
437
|
};
|
|
439
438
|
}
|
|
440
|
-
function
|
|
439
|
+
function cssConfig_isCssModulesFile(filepath, auto) {
|
|
441
440
|
const filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filepath);
|
|
442
441
|
if (true === auto) return CSS_MODULE_REG.test(filename);
|
|
443
442
|
if (auto instanceof RegExp) return auto.test(filepath);
|
|
@@ -450,7 +449,7 @@ function isCssModulesFile(filepath, auto) {
|
|
|
450
449
|
function isCssGlobalFile(filepath, auto) {
|
|
451
450
|
const isCss = isCssFile(filepath);
|
|
452
451
|
if (!isCss) return false;
|
|
453
|
-
const isCssModules =
|
|
452
|
+
const isCssModules = cssConfig_isCssModulesFile(filepath, auto);
|
|
454
453
|
return !isCssModules;
|
|
455
454
|
}
|
|
456
455
|
async function cssExternalHandler(request, callback, jsExtension, auto, styleRedirectPath, styleRedirectExtension, redirectPath, issuer) {
|
|
@@ -465,14 +464,14 @@ async function cssExternalHandler(request, callback, jsExtension, auto, styleRed
|
|
|
465
464
|
return false;
|
|
466
465
|
}
|
|
467
466
|
if (styleRedirectExtension) {
|
|
468
|
-
const isCssModulesRequest =
|
|
467
|
+
const isCssModulesRequest = cssConfig_isCssModulesFile(resolvedRequest, auto);
|
|
469
468
|
if (isCssModulesRequest) return callback(void 0, resolvedRequest.replace(/\.[^.]+$/, jsExtension));
|
|
470
469
|
return callback(void 0, resolvedRequest.replace(/\.[^.]+$/, '.css'));
|
|
471
470
|
}
|
|
472
471
|
return callback(void 0, resolvedRequest);
|
|
473
472
|
}
|
|
474
473
|
const cssConfig_PLUGIN_NAME = 'rsbuild:lib-css';
|
|
475
|
-
const pluginLibCss = (rootDir, banner, footer)=>({
|
|
474
|
+
const pluginLibCss = (rootDir, auto, banner, footer)=>({
|
|
476
475
|
name: cssConfig_PLUGIN_NAME,
|
|
477
476
|
setup (api) {
|
|
478
477
|
api.processAssets({
|
|
@@ -493,6 +492,7 @@ const pluginLibCss = (rootDir, banner, footer)=>({
|
|
|
493
492
|
isUsingCssExtract = true;
|
|
494
493
|
rule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(cssConfig_require.resolve('./libCssExtractLoader.js')).options({
|
|
495
494
|
rootDir,
|
|
495
|
+
auto,
|
|
496
496
|
banner,
|
|
497
497
|
footer
|
|
498
498
|
});
|
|
@@ -506,11 +506,11 @@ const pluginLibCss = (rootDir, banner, footer)=>({
|
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
508
|
});
|
|
509
|
-
const composeCssConfig = (rootDir, bundle = true, banner, footer)=>{
|
|
509
|
+
const composeCssConfig = (rootDir, auto, bundle = true, banner, footer)=>{
|
|
510
510
|
if (bundle || null === rootDir) return {};
|
|
511
511
|
return {
|
|
512
512
|
plugins: [
|
|
513
|
-
pluginLibCss(rootDir, banner, footer)
|
|
513
|
+
pluginLibCss(rootDir, auto, banner, footer)
|
|
514
514
|
],
|
|
515
515
|
tools: {
|
|
516
516
|
cssLoader: {
|
|
@@ -631,7 +631,7 @@ const entryModuleLoaderRsbuildPlugin = ()=>({
|
|
|
631
631
|
name: EntryChunkPlugin_PLUGIN_NAME,
|
|
632
632
|
setup (api) {
|
|
633
633
|
api.modifyBundlerChain((config, { CHAIN_ID })=>{
|
|
634
|
-
config.module.rule(CHAIN_ID.RULE.JS).use(EntryChunkPlugin_LOADER_NAME).loader(EntryChunkPlugin_require.resolve('./entryModuleLoader.js'));
|
|
634
|
+
config.module.rule(`Rslib:${CHAIN_ID.RULE.JS}-entry-loader`).test(config.module.rule(CHAIN_ID.RULE.JS).get('test')).issuer(/^$/).use(EntryChunkPlugin_LOADER_NAME).loader(EntryChunkPlugin_require.resolve('./entryModuleLoader.js'));
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
637
|
});
|
|
@@ -1955,7 +1955,6 @@ const traverseEntryQuery = (entry, callback)=>{
|
|
|
1955
1955
|
}
|
|
1956
1956
|
return newEntry;
|
|
1957
1957
|
};
|
|
1958
|
-
const appendEntryQuery = (entries)=>traverseEntryQuery(entries, (item)=>`${item}?${RSLIB_ENTRY_QUERY}`);
|
|
1959
1958
|
const resolveEntryPath = (entries, root)=>traverseEntryQuery(entries, (item)=>__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(root, item));
|
|
1960
1959
|
const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOutBase)=>{
|
|
1961
1960
|
let entries = rawEntry;
|
|
@@ -1986,7 +1985,7 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOu
|
|
|
1986
1985
|
return {
|
|
1987
1986
|
entryConfig: {
|
|
1988
1987
|
source: {
|
|
1989
|
-
entry:
|
|
1988
|
+
entry: resolveEntryPath(entries, root)
|
|
1990
1989
|
}
|
|
1991
1990
|
},
|
|
1992
1991
|
outBase: null
|
|
@@ -2042,7 +2041,7 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOu
|
|
|
2042
2041
|
rspack: {
|
|
2043
2042
|
entry: async ()=>{
|
|
2044
2043
|
const { resolvedEntries } = await scanGlobEntries(false);
|
|
2045
|
-
return
|
|
2044
|
+
return resolvedEntries;
|
|
2046
2045
|
}
|
|
2047
2046
|
}
|
|
2048
2047
|
}
|
|
@@ -2240,7 +2239,7 @@ async function composeLibRsbuildConfig(config, root, sharedPlugins) {
|
|
|
2240
2239
|
pkgJson,
|
|
2241
2240
|
userExternals: config.output?.externals
|
|
2242
2241
|
});
|
|
2243
|
-
const cssConfig = composeCssConfig(outBase, config.bundle, banner?.css, footer?.css);
|
|
2242
|
+
const cssConfig = composeCssConfig(outBase, cssModulesAuto, config.bundle, banner?.css, footer?.css);
|
|
2244
2243
|
const assetConfig = composeAssetConfig(bundle, format);
|
|
2245
2244
|
const entryChunkConfig = composeEntryChunkConfig({
|
|
2246
2245
|
enabledImportMetaUrlShim: enabledShims.cjs['import.meta.url'],
|
|
@@ -2467,7 +2466,7 @@ const repeatableOption = (value, previous)=>(previous ?? []).concat([
|
|
|
2467
2466
|
value
|
|
2468
2467
|
]);
|
|
2469
2468
|
function runCli() {
|
|
2470
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.6.
|
|
2469
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.6.2");
|
|
2471
2470
|
const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('build');
|
|
2472
2471
|
const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('inspect');
|
|
2473
2472
|
const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('mf-dev');
|
|
@@ -2528,7 +2527,7 @@ function runCli() {
|
|
|
2528
2527
|
});
|
|
2529
2528
|
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.parse();
|
|
2530
2529
|
}
|
|
2531
|
-
const src_rslib_entry_version = "0.6.
|
|
2530
|
+
const src_rslib_entry_version = "0.6.2";
|
|
2532
2531
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger;
|
|
2533
2532
|
var __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack;
|
|
2534
2533
|
export { build, defineConfig, inspect, loadConfig, prepareCli, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ as rsbuild, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_rslib_entry_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
|
|
@@ -1,17 +1,70 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
3
|
+
import "@rsbuild/core";
|
|
4
|
+
const DTS_EXTENSIONS = [
|
|
5
|
+
'd.ts',
|
|
6
|
+
'd.mts',
|
|
7
|
+
'd.cts'
|
|
8
|
+
];
|
|
9
|
+
const JS_EXTENSIONS = [
|
|
10
|
+
'js',
|
|
11
|
+
'mjs',
|
|
12
|
+
'jsx',
|
|
13
|
+
'(?<!\\.d\\.)ts',
|
|
14
|
+
'(?<!\\.d\\.)mts',
|
|
15
|
+
'(?<!\\.d\\.)cts',
|
|
16
|
+
'tsx',
|
|
17
|
+
'cjs',
|
|
18
|
+
'cjsx',
|
|
19
|
+
'mjsx',
|
|
20
|
+
'mtsx',
|
|
21
|
+
'ctsx'
|
|
22
|
+
];
|
|
23
|
+
const CSS_EXTENSIONS = [
|
|
24
|
+
'css',
|
|
25
|
+
'sass',
|
|
26
|
+
'scss',
|
|
27
|
+
'less',
|
|
28
|
+
'styl',
|
|
29
|
+
'stylus'
|
|
30
|
+
];
|
|
31
|
+
new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
|
|
32
|
+
new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
|
|
33
|
+
new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
|
|
34
|
+
(0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
|
|
35
|
+
const CSS_MODULE_REG = /\.module\.\w+$/i;
|
|
36
|
+
const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
|
|
37
|
+
function parsePathQueryFragment(str) {
|
|
38
|
+
const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
|
|
39
|
+
return {
|
|
40
|
+
path: match?.[1]?.replace(/\u200b(.)/g, '$1') || '',
|
|
41
|
+
query: match?.[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
|
|
42
|
+
fragment: match?.[3] || ''
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function cssConfig_isCssModulesFile(filepath, auto) {
|
|
46
|
+
const filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filepath);
|
|
47
|
+
if (true === auto) return CSS_MODULE_REG.test(filename);
|
|
48
|
+
if (auto instanceof RegExp) return auto.test(filepath);
|
|
49
|
+
if ('function' == typeof auto) {
|
|
50
|
+
const { path, query, fragment } = parsePathQueryFragment(filepath);
|
|
51
|
+
return auto(path, query, fragment);
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const libCssExtractLoader_rslib_entry_BASE_URI = 'webpack://';
|
|
56
|
+
const libCssExtractLoader_rslib_entry_MODULE_TYPE = 'css/mini-extract';
|
|
57
|
+
const libCssExtractLoader_rslib_entry_AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
|
|
58
|
+
const libCssExtractLoader_rslib_entry_ABSOLUTE_PUBLIC_PATH = `${libCssExtractLoader_rslib_entry_BASE_URI}/mini-css-extract-plugin/`;
|
|
59
|
+
const libCssExtractLoader_rslib_entry_SINGLE_DOT_PATH_SEGMENT = '__mini_css_extract_plugin_single_dot_path_segment__';
|
|
60
|
+
const libCssExtractLoader_rslib_entry_LOADER_NAME = 'LIB_CSS_EXTRACT_LOADER';
|
|
61
|
+
function libCssExtractLoader_rslib_entry_stringifyLocal(value) {
|
|
9
62
|
return 'function' == typeof value ? value.toString() : JSON.stringify(value);
|
|
10
63
|
}
|
|
11
64
|
const libCssExtractLoader_rslib_entry_loader = function(content) {
|
|
12
65
|
if (this._compiler?.options?.experiments?.css && this._module && ('css' === this._module.type || 'css/auto' === this._module.type || 'css/global' === this._module.type || 'css/module' === this._module.type)) return content;
|
|
13
66
|
};
|
|
14
|
-
const
|
|
67
|
+
const libCssExtractLoader_rslib_entry_pitch = function(request, _, _data) {
|
|
15
68
|
if (this._compiler?.options?.experiments?.css && this._module && ('css' === this._module.type || 'css/auto' === this._module.type || 'css/global' === this._module.type || 'css/module' === this._module.type)) {
|
|
16
69
|
const e = new Error("use type 'css' and `CssExtractRspackPlugin` together, please set `experiments.css` to `false` or set `{ type: \"javascript/auto\" }` for rules with `CssExtractRspackPlugin` in your rspack config (now `CssExtractRspackPlugin` does nothing).");
|
|
17
70
|
e.stack = void 0;
|
|
@@ -23,16 +76,17 @@ const pitch = function(request, _, _data) {
|
|
|
23
76
|
const callback = this.async();
|
|
24
77
|
const filepath = this.resourcePath;
|
|
25
78
|
const rootDir = options.rootDir ?? this.rootContext;
|
|
79
|
+
const auto = options.auto;
|
|
26
80
|
const banner = options.banner;
|
|
27
81
|
const footer = options.footer;
|
|
28
82
|
let { publicPath } = this._compilation.outputOptions;
|
|
29
83
|
if ('string' == typeof options.publicPath) publicPath = options.publicPath;
|
|
30
84
|
else if ('function' == typeof options.publicPath) publicPath = options.publicPath(this.resourcePath, this.rootContext);
|
|
31
|
-
if ('auto' === publicPath) publicPath =
|
|
85
|
+
if ('auto' === publicPath) publicPath = libCssExtractLoader_rslib_entry_AUTO_PUBLIC_PATH;
|
|
32
86
|
let publicPathForExtract;
|
|
33
87
|
if ('string' == typeof publicPath) {
|
|
34
88
|
const isAbsolutePublicPath = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath);
|
|
35
|
-
publicPathForExtract = isAbsolutePublicPath ? publicPath : `${
|
|
89
|
+
publicPathForExtract = isAbsolutePublicPath ? publicPath : `${libCssExtractLoader_rslib_entry_ABSOLUTE_PUBLIC_PATH}${publicPath.replace(/\./g, libCssExtractLoader_rslib_entry_SINGLE_DOT_PATH_SEGMENT)}`;
|
|
36
90
|
} else publicPathForExtract = publicPath;
|
|
37
91
|
const handleExports = (originalExports)=>{
|
|
38
92
|
let locals;
|
|
@@ -85,7 +139,7 @@ const pitch = function(request, _, _data) {
|
|
|
85
139
|
];
|
|
86
140
|
}
|
|
87
141
|
}());
|
|
88
|
-
const localsString = identifiers.map(([id, key])=>`\nvar ${id} = ${
|
|
142
|
+
const localsString = identifiers.map(([id, key])=>`\nvar ${id} = ${libCssExtractLoader_rslib_entry_stringifyLocal(locals[key])};`).join('');
|
|
89
143
|
const exportsString = `export { ${identifiers.map(([id, key])=>`${id} as ${JSON.stringify(key)}`).join(', ')} }`;
|
|
90
144
|
const defaultExport = void 0 !== options.defaultExport ? options.defaultExport : false;
|
|
91
145
|
return defaultExport ? `${localsString}\n${exportsString}\nexport default { ${identifiers.map(([id, key])=>`${JSON.stringify(key)}: ${id}`).join(', ')} }\n` : `${localsString}\n${exportsString}\n`;
|
|
@@ -95,7 +149,7 @@ const pitch = function(request, _, _data) {
|
|
|
95
149
|
if (esModule) return '\nexport {};';
|
|
96
150
|
return '';
|
|
97
151
|
}();
|
|
98
|
-
let resultSource = `// extracted by ${
|
|
152
|
+
let resultSource = `// extracted by ${libCssExtractLoader_rslib_entry_LOADER_NAME}`;
|
|
99
153
|
let importCssFiles = '';
|
|
100
154
|
function getRelativePath(from, to) {
|
|
101
155
|
let relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(from, to);
|
|
@@ -107,7 +161,7 @@ const pitch = function(request, _, _data) {
|
|
|
107
161
|
let distFilepath = getRelativePath(rootDir, filepath);
|
|
108
162
|
const ext = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(distFilepath);
|
|
109
163
|
if ('css' !== ext) distFilepath = distFilepath.replace(ext, '.css');
|
|
110
|
-
distFilepath = distFilepath.replace(/\.module\.css/, '_module.css');
|
|
164
|
+
if (cssConfig_isCssModulesFile(filepath, auto)) distFilepath = distFilepath.replace(/\.module\.css/, '_module.css');
|
|
111
165
|
const cssFilename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(distFilepath);
|
|
112
166
|
if (content.trim()) {
|
|
113
167
|
m.get(distFilepath) ? m.set(distFilepath, `${m.get(distFilepath) + content}\n`) : m.set(distFilepath, `${content}\n`);
|
|
@@ -133,7 +187,7 @@ const pitch = function(request, _, _data) {
|
|
|
133
187
|
this.importModule(`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, {
|
|
134
188
|
layer: options.layer,
|
|
135
189
|
publicPath: publicPathForExtract,
|
|
136
|
-
baseUri: `${
|
|
190
|
+
baseUri: `${libCssExtractLoader_rslib_entry_BASE_URI}/`
|
|
137
191
|
}, (error, exports)=>{
|
|
138
192
|
if (error) {
|
|
139
193
|
callback(error);
|
|
@@ -143,4 +197,4 @@ const pitch = function(request, _, _data) {
|
|
|
143
197
|
});
|
|
144
198
|
};
|
|
145
199
|
const libCssExtractLoader_rslib_entry_ = libCssExtractLoader_rslib_entry_loader;
|
|
146
|
-
export { ABSOLUTE_PUBLIC_PATH, AUTO_PUBLIC_PATH, BASE_URI, MODULE_TYPE, SINGLE_DOT_PATH_SEGMENT, libCssExtractLoader_rslib_entry_ as default, pitch };
|
|
200
|
+
export { libCssExtractLoader_rslib_entry_ABSOLUTE_PUBLIC_PATH as ABSOLUTE_PUBLIC_PATH, libCssExtractLoader_rslib_entry_AUTO_PUBLIC_PATH as AUTO_PUBLIC_PATH, libCssExtractLoader_rslib_entry_BASE_URI as BASE_URI, libCssExtractLoader_rslib_entry_MODULE_TYPE as MODULE_TYPE, libCssExtractLoader_rslib_entry_SINGLE_DOT_PATH_SEGMENT as SINGLE_DOT_PATH_SEGMENT, libCssExtractLoader_rslib_entry_ as default, libCssExtractLoader_rslib_entry_pitch as pitch };
|
package/dist-types/config.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ export declare function composeBannerFooterConfig(banner: BannerAndFooter, foote
|
|
|
28
28
|
export declare function composeDecoratorsConfig(compilerOptions?: Record<string, any>, version?: NonNullable<NonNullable<EnvironmentConfig['source']>['decorators']>['version']): EnvironmentConfig;
|
|
29
29
|
export declare function createConstantRsbuildConfig(): Promise<EnvironmentConfig>;
|
|
30
30
|
export declare const composeModuleImportWarn: (request: string, issuer: string) => string;
|
|
31
|
-
export declare const appendEntryQuery: (entries: RsbuildConfigEntry) => RsbuildEntry;
|
|
32
31
|
export declare const resolveEntryPath: (entries: RsbuildConfigEntry, root: string) => RsbuildEntry;
|
|
33
32
|
export declare function composeCreateRsbuildConfig(rslibConfig: RslibConfig): Promise<RsbuildConfigWithLibInfo[]>;
|
|
34
33
|
export declare function composeRsbuildEnvironments(rslibConfig: RslibConfig): Promise<{
|
package/dist-types/constant.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare const DEFAULT_CONFIG_NAME = "rslib.config";
|
|
2
2
|
export declare const DEFAULT_CONFIG_EXTENSIONS: readonly [".js", ".ts", ".mjs", ".mts", ".cjs", ".cts"];
|
|
3
3
|
export declare const SWC_HELPERS = "@swc/helpers";
|
|
4
|
-
export declare const RSLIB_ENTRY_QUERY = "__rslib_entry__";
|
|
5
4
|
export declare const SHEBANG_PREFIX = "#!";
|
|
6
5
|
export declare const SHEBANG_REGEX: RegExp;
|
|
7
6
|
export declare const REACT_DIRECTIVE_REGEX: RegExp;
|
|
@@ -13,5 +13,5 @@ export declare function isCssModulesFile(filepath: string, auto: CssLoaderOption
|
|
|
13
13
|
export declare function isCssGlobalFile(filepath: string, auto: CssLoaderOptionsAuto): boolean;
|
|
14
14
|
type ExternalCallback = (arg0?: undefined, arg1?: string) => void;
|
|
15
15
|
export declare function cssExternalHandler(request: string, callback: ExternalCallback, jsExtension: string, auto: CssLoaderOptionsAuto, styleRedirectPath: boolean, styleRedirectExtension: boolean, redirectPath: (request: string) => Promise<string | undefined>, issuer: string): Promise<false | void>;
|
|
16
|
-
export declare const composeCssConfig: (rootDir: string | null, bundle?: boolean, banner?: string, footer?: string) => EnvironmentConfig;
|
|
16
|
+
export declare const composeCssConfig: (rootDir: string | null, auto: CssLoaderOptionsAuto, bundle?: boolean, banner?: string, footer?: string) => EnvironmentConfig;
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Rspack } from '@rsbuild/core';
|
|
2
|
+
import { type CssLoaderOptionsAuto } from './cssConfig';
|
|
2
3
|
export declare const BASE_URI = "webpack://";
|
|
3
4
|
export declare const MODULE_TYPE = "css/mini-extract";
|
|
4
5
|
export declare const AUTO_PUBLIC_PATH = "__mini_css_extract_plugin_public_path_auto__";
|
|
@@ -11,6 +12,7 @@ export interface CssExtractRspackLoaderOptions {
|
|
|
11
12
|
layer?: string;
|
|
12
13
|
defaultExport?: boolean;
|
|
13
14
|
rootDir?: string;
|
|
15
|
+
auto?: CssLoaderOptionsAuto;
|
|
14
16
|
banner?: string;
|
|
15
17
|
footer?: string;
|
|
16
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://lib.rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -36,24 +36,24 @@
|
|
|
36
36
|
"types.d.ts"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@rsbuild/core": "1.3.
|
|
39
|
+
"@rsbuild/core": "1.3.5",
|
|
40
40
|
"tinyglobby": "^0.2.12",
|
|
41
|
-
"rsbuild-plugin-dts": "0.6.
|
|
41
|
+
"rsbuild-plugin-dts": "0.6.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@module-federation/rsbuild-plugin": "^0.11.
|
|
44
|
+
"@module-federation/rsbuild-plugin": "^0.11.4",
|
|
45
45
|
"@types/fs-extra": "^11.0.4",
|
|
46
46
|
"chokidar": "^4.0.3",
|
|
47
47
|
"commander": "^13.1.0",
|
|
48
48
|
"fs-extra": "^11.3.0",
|
|
49
49
|
"memfs": "^4.17.0",
|
|
50
50
|
"picocolors": "1.1.1",
|
|
51
|
-
"prebundle": "1.
|
|
51
|
+
"prebundle": "1.3.3",
|
|
52
52
|
"rsbuild-plugin-publint": "^0.3.0",
|
|
53
|
-
"rslib": "npm:@rslib/core@0.6.
|
|
53
|
+
"rslib": "npm:@rslib/core@0.6.1",
|
|
54
54
|
"rslog": "^1.2.3",
|
|
55
55
|
"tsconfck": "3.1.5",
|
|
56
|
-
"typescript": "^5.8.
|
|
56
|
+
"typescript": "^5.8.3",
|
|
57
57
|
"@rslib/tsconfig": "0.0.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|