@rslib/core 0.6.2 → 0.6.4
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 +15 -26
- package/dist/libCssExtractLoader.js +17 -20
- package/package.json +5 -5
|
@@ -41,7 +41,7 @@ function splitFromFirstLine(text) {
|
|
|
41
41
|
text.slice(match.index)
|
|
42
42
|
];
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const entryModuleLoader_loader = function(source) {
|
|
45
45
|
let result = source;
|
|
46
46
|
const [firstLine1, rest] = splitFromFirstLine(result);
|
|
47
47
|
if (SHEBANG_REGEX.test(firstLine1)) result = rest;
|
|
@@ -49,5 +49,5 @@ const entryModuleLoader_rslib_entry_loader = function(source) {
|
|
|
49
49
|
if (REACT_DIRECTIVE_REGEX.test(firstLine2)) result = rest2;
|
|
50
50
|
return result;
|
|
51
51
|
};
|
|
52
|
-
const
|
|
53
|
-
export {
|
|
52
|
+
const entryModuleLoader = entryModuleLoader_loader;
|
|
53
|
+
export { entryModuleLoader as default };
|
package/dist/index.js
CHANGED
|
@@ -88,10 +88,7 @@ function getAbsolutePath(base, filepath) {
|
|
|
88
88
|
}
|
|
89
89
|
const readPackageJson = (rootPath)=>{
|
|
90
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(`The \`package.json\` file does not exist in the ${rootPath} directory`);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
91
|
+
if (!__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(pkgJsonPath)) return void __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`The \`package.json\` file does not exist in the ${rootPath} directory`);
|
|
95
92
|
try {
|
|
96
93
|
return JSON.parse(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(pkgJsonPath, 'utf8'));
|
|
97
94
|
} catch (err) {
|
|
@@ -184,7 +181,7 @@ function prepareCli() {
|
|
|
184
181
|
initNodeEnv();
|
|
185
182
|
const { npm_execpath } = process.env;
|
|
186
183
|
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.
|
|
184
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.6.4\n`);
|
|
188
185
|
}
|
|
189
186
|
const DEFAULT_CONFIG_NAME = 'rslib.config';
|
|
190
187
|
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
@@ -1421,10 +1418,7 @@ const composeExternalsWarnConfig = (format, ...externalsArray)=>{
|
|
|
1421
1418
|
else externals.push(e);
|
|
1422
1419
|
const matchUserExternals = (externals, request, callback)=>{
|
|
1423
1420
|
if ('string' == typeof externals) {
|
|
1424
|
-
if (handleMatchedExternal(externals, request))
|
|
1425
|
-
callback(true, true);
|
|
1426
|
-
return;
|
|
1427
|
-
}
|
|
1421
|
+
if (handleMatchedExternal(externals, request)) return void callback(true, true);
|
|
1428
1422
|
}
|
|
1429
1423
|
if (Array.isArray(externals)) {
|
|
1430
1424
|
let i = 0;
|
|
@@ -1451,16 +1445,10 @@ const composeExternalsWarnConfig = (format, ...externalsArray)=>{
|
|
|
1451
1445
|
return;
|
|
1452
1446
|
}
|
|
1453
1447
|
if (externals instanceof RegExp) {
|
|
1454
|
-
if (externals.test(request))
|
|
1455
|
-
callback(true, true);
|
|
1456
|
-
return;
|
|
1457
|
-
}
|
|
1448
|
+
if (externals.test(request)) return void callback(true, true);
|
|
1458
1449
|
} else if ('function' == typeof externals) ;
|
|
1459
1450
|
else if ('object' == typeof externals) {
|
|
1460
|
-
if (Object.prototype.hasOwnProperty.call(externals, request))
|
|
1461
|
-
handleMatchedExternal(externals[request], request) ? callback(true, true) : callback(true);
|
|
1462
|
-
return;
|
|
1463
|
-
}
|
|
1451
|
+
if (Object.prototype.hasOwnProperty.call(externals, request)) return void (handleMatchedExternal(externals[request], request) ? callback(true, true) : callback(true));
|
|
1464
1452
|
}
|
|
1465
1453
|
callback(false);
|
|
1466
1454
|
};
|
|
@@ -1903,18 +1891,19 @@ const composeAutoExtensionConfig = (config, autoExtension, pkgJson)=>{
|
|
|
1903
1891
|
return filenameHash ? '.[contenthash:8]' : '';
|
|
1904
1892
|
};
|
|
1905
1893
|
const hash = getHash();
|
|
1906
|
-
const
|
|
1894
|
+
const defaultJsFilename = `[name]${hash}${jsExtension}`;
|
|
1895
|
+
const userJsFilename = config.output?.filename?.js;
|
|
1896
|
+
const finalJsExtension = 'string' == typeof userJsFilename && userJsFilename ? (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(userJsFilename) : jsExtension;
|
|
1897
|
+
const finalConfig = userJsFilename ? {} : {
|
|
1907
1898
|
output: {
|
|
1908
1899
|
filename: {
|
|
1909
|
-
js:
|
|
1910
|
-
...config.output?.filename
|
|
1900
|
+
js: defaultJsFilename
|
|
1911
1901
|
}
|
|
1912
1902
|
}
|
|
1913
1903
|
};
|
|
1914
|
-
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;
|
|
1915
1904
|
return {
|
|
1916
|
-
config:
|
|
1917
|
-
jsExtension:
|
|
1905
|
+
config: finalConfig,
|
|
1906
|
+
jsExtension: finalJsExtension,
|
|
1918
1907
|
dtsExtension
|
|
1919
1908
|
};
|
|
1920
1909
|
};
|
|
@@ -2466,7 +2455,7 @@ const repeatableOption = (value, previous)=>(previous ?? []).concat([
|
|
|
2466
2455
|
value
|
|
2467
2456
|
]);
|
|
2468
2457
|
function runCli() {
|
|
2469
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.6.
|
|
2458
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.6.4");
|
|
2470
2459
|
const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('build');
|
|
2471
2460
|
const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('inspect');
|
|
2472
2461
|
const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('mf-dev');
|
|
@@ -2527,7 +2516,7 @@ function runCli() {
|
|
|
2527
2516
|
});
|
|
2528
2517
|
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.parse();
|
|
2529
2518
|
}
|
|
2530
|
-
const
|
|
2519
|
+
const src_version = "0.6.4";
|
|
2531
2520
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger;
|
|
2532
2521
|
var __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack;
|
|
2533
|
-
export { build, defineConfig, inspect, loadConfig, prepareCli, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ as rsbuild, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig,
|
|
2522
|
+
export { build, defineConfig, inspect, loadConfig, prepareCli, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ as rsbuild, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
|
|
@@ -52,19 +52,19 @@ function cssConfig_isCssModulesFile(filepath, auto) {
|
|
|
52
52
|
}
|
|
53
53
|
return false;
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
function
|
|
55
|
+
const css_libCssExtractLoader_BASE_URI = 'webpack://';
|
|
56
|
+
const libCssExtractLoader_MODULE_TYPE = 'css/mini-extract';
|
|
57
|
+
const css_libCssExtractLoader_AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
|
|
58
|
+
const css_libCssExtractLoader_ABSOLUTE_PUBLIC_PATH = `${css_libCssExtractLoader_BASE_URI}/mini-css-extract-plugin/`;
|
|
59
|
+
const css_libCssExtractLoader_SINGLE_DOT_PATH_SEGMENT = '__mini_css_extract_plugin_single_dot_path_segment__';
|
|
60
|
+
const libCssExtractLoader_LOADER_NAME = 'LIB_CSS_EXTRACT_LOADER';
|
|
61
|
+
function libCssExtractLoader_stringifyLocal(value) {
|
|
62
62
|
return 'function' == typeof value ? value.toString() : JSON.stringify(value);
|
|
63
63
|
}
|
|
64
|
-
const
|
|
64
|
+
const css_libCssExtractLoader_loader = function(content) {
|
|
65
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;
|
|
66
66
|
};
|
|
67
|
-
const
|
|
67
|
+
const libCssExtractLoader_pitch = function(request, _, _data) {
|
|
68
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)) {
|
|
69
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).");
|
|
70
70
|
e.stack = void 0;
|
|
@@ -82,11 +82,11 @@ const libCssExtractLoader_rslib_entry_pitch = function(request, _, _data) {
|
|
|
82
82
|
let { publicPath } = this._compilation.outputOptions;
|
|
83
83
|
if ('string' == typeof options.publicPath) publicPath = options.publicPath;
|
|
84
84
|
else if ('function' == typeof options.publicPath) publicPath = options.publicPath(this.resourcePath, this.rootContext);
|
|
85
|
-
if ('auto' === publicPath) publicPath =
|
|
85
|
+
if ('auto' === publicPath) publicPath = css_libCssExtractLoader_AUTO_PUBLIC_PATH;
|
|
86
86
|
let publicPathForExtract;
|
|
87
87
|
if ('string' == typeof publicPath) {
|
|
88
88
|
const isAbsolutePublicPath = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath);
|
|
89
|
-
publicPathForExtract = isAbsolutePublicPath ? publicPath : `${
|
|
89
|
+
publicPathForExtract = isAbsolutePublicPath ? publicPath : `${css_libCssExtractLoader_ABSOLUTE_PUBLIC_PATH}${publicPath.replace(/\./g, css_libCssExtractLoader_SINGLE_DOT_PATH_SEGMENT)}`;
|
|
90
90
|
} else publicPathForExtract = publicPath;
|
|
91
91
|
const handleExports = (originalExports)=>{
|
|
92
92
|
let locals;
|
|
@@ -139,7 +139,7 @@ const libCssExtractLoader_rslib_entry_pitch = function(request, _, _data) {
|
|
|
139
139
|
];
|
|
140
140
|
}
|
|
141
141
|
}());
|
|
142
|
-
const localsString = identifiers.map(([id, key])=>`\nvar ${id} = ${
|
|
142
|
+
const localsString = identifiers.map(([id, key])=>`\nvar ${id} = ${libCssExtractLoader_stringifyLocal(locals[key])};`).join('');
|
|
143
143
|
const exportsString = `export { ${identifiers.map(([id, key])=>`${id} as ${JSON.stringify(key)}`).join(', ')} }`;
|
|
144
144
|
const defaultExport = void 0 !== options.defaultExport ? options.defaultExport : false;
|
|
145
145
|
return defaultExport ? `${localsString}\n${exportsString}\nexport default { ${identifiers.map(([id, key])=>`${JSON.stringify(key)}: ${id}`).join(', ')} }\n` : `${localsString}\n${exportsString}\n`;
|
|
@@ -149,7 +149,7 @@ const libCssExtractLoader_rslib_entry_pitch = function(request, _, _data) {
|
|
|
149
149
|
if (esModule) return '\nexport {};';
|
|
150
150
|
return '';
|
|
151
151
|
}();
|
|
152
|
-
let resultSource = `// extracted by ${
|
|
152
|
+
let resultSource = `// extracted by ${libCssExtractLoader_LOADER_NAME}`;
|
|
153
153
|
let importCssFiles = '';
|
|
154
154
|
function getRelativePath(from, to) {
|
|
155
155
|
let relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(from, to);
|
|
@@ -187,14 +187,11 @@ const libCssExtractLoader_rslib_entry_pitch = function(request, _, _data) {
|
|
|
187
187
|
this.importModule(`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, {
|
|
188
188
|
layer: options.layer,
|
|
189
189
|
publicPath: publicPathForExtract,
|
|
190
|
-
baseUri: `${
|
|
190
|
+
baseUri: `${css_libCssExtractLoader_BASE_URI}/`
|
|
191
191
|
}, (error, exports)=>{
|
|
192
|
-
if (error)
|
|
193
|
-
callback(error);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
192
|
+
if (error) return void callback(error);
|
|
196
193
|
handleExports(exports);
|
|
197
194
|
});
|
|
198
195
|
};
|
|
199
|
-
const
|
|
200
|
-
export {
|
|
196
|
+
const css_libCssExtractLoader = css_libCssExtractLoader_loader;
|
|
197
|
+
export { css_libCssExtractLoader_ABSOLUTE_PUBLIC_PATH as ABSOLUTE_PUBLIC_PATH, css_libCssExtractLoader_AUTO_PUBLIC_PATH as AUTO_PUBLIC_PATH, css_libCssExtractLoader_BASE_URI as BASE_URI, libCssExtractLoader_MODULE_TYPE as MODULE_TYPE, css_libCssExtractLoader_SINGLE_DOT_PATH_SEGMENT as SINGLE_DOT_PATH_SEGMENT, css_libCssExtractLoader as default, libCssExtractLoader_pitch as pitch };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://lib.rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"types.d.ts"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@rsbuild/core": "1.3.
|
|
39
|
+
"@rsbuild/core": "1.3.8",
|
|
40
40
|
"tinyglobby": "^0.2.12",
|
|
41
|
-
"rsbuild-plugin-dts": "0.6.
|
|
41
|
+
"rsbuild-plugin-dts": "0.6.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@module-federation/rsbuild-plugin": "^0.
|
|
44
|
+
"@module-federation/rsbuild-plugin": "^0.12.0",
|
|
45
45
|
"@types/fs-extra": "^11.0.4",
|
|
46
46
|
"chokidar": "^4.0.3",
|
|
47
47
|
"commander": "^13.1.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"picocolors": "1.1.1",
|
|
51
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.3",
|
|
54
54
|
"rslog": "^1.2.3",
|
|
55
55
|
"tsconfck": "3.1.5",
|
|
56
56
|
"typescript": "^5.8.3",
|