@rslib/core 0.6.0 → 0.6.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/index.js +66 -75
- package/dist-types/index.d.ts +2 -0
- package/package.json +4 -4
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.1\n`);
|
|
188
188
|
}
|
|
189
189
|
const DEFAULT_CONFIG_NAME = 'rslib.config';
|
|
190
190
|
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
@@ -234,17 +234,16 @@ function getUndoPath(filename, outputPathArg, enforceRelative) {
|
|
|
234
234
|
let depth = -1;
|
|
235
235
|
let append = '';
|
|
236
236
|
let outputPath = outputPathArg.replace(/[\\/]$/, '');
|
|
237
|
-
for (const part of filename.split(/[/\\]+/))if ('..' === part)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
} else if ('.' !== part) depth++;
|
|
237
|
+
for (const part of filename.split(/[/\\]+/))if ('..' === part) if (depth > -1) depth--;
|
|
238
|
+
else {
|
|
239
|
+
const i = outputPath.lastIndexOf('/');
|
|
240
|
+
const j = outputPath.lastIndexOf('\\');
|
|
241
|
+
const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
|
|
242
|
+
if (pos < 0) return `${outputPath}/`;
|
|
243
|
+
append = `${outputPath.slice(pos + 1)}/${append}`;
|
|
244
|
+
outputPath = outputPath.slice(0, pos);
|
|
245
|
+
}
|
|
246
|
+
else if ('.' !== part) depth++;
|
|
248
247
|
return depth > 0 ? `${'../'.repeat(depth)}${append}` : enforceRelative ? `./${append}` : append;
|
|
249
248
|
}
|
|
250
249
|
const LibSvgrPatchPlugin_pluginName = 'LIB_SVGR_PATCH_PLUGIN';
|
|
@@ -339,19 +338,17 @@ const pluginLibAsset = ({ bundle })=>({
|
|
|
339
338
|
});
|
|
340
339
|
config.plugin(LibSvgrPatchPlugin.name).use(LibSvgrPatchPlugin, []);
|
|
341
340
|
}
|
|
342
|
-
if (isUsingSvgr) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
rule.issuer([]);
|
|
354
|
-
}
|
|
341
|
+
if (isUsingSvgr) if (bundle) {
|
|
342
|
+
const rule = config.module.rule(CHAIN_ID.RULE.SVG).oneOf(CHAIN_ID.ONE_OF.SVG_URL);
|
|
343
|
+
const originalGeneratorOptions = rule.get('generator');
|
|
344
|
+
const generatorOptions = isUserSetPublicPath ? originalGeneratorOptions : {
|
|
345
|
+
...originalGeneratorOptions,
|
|
346
|
+
importMode: 'preserve'
|
|
347
|
+
};
|
|
348
|
+
rule.generator(generatorOptions);
|
|
349
|
+
} else {
|
|
350
|
+
const rule = config.module.rule(CHAIN_ID.RULE.SVG).oneOf(CHAIN_ID.ONE_OF.SVG);
|
|
351
|
+
rule.issuer([]);
|
|
355
352
|
}
|
|
356
353
|
if (bundle) config.plugins.get(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT)?.tap((options)=>[
|
|
357
354
|
{
|
|
@@ -1045,19 +1042,17 @@ async function find(filename, options) {
|
|
|
1045
1042
|
}
|
|
1046
1043
|
function findUp(dir, { resolve, reject, promise }, options) {
|
|
1047
1044
|
const { cache, root, configName } = options ?? {};
|
|
1048
|
-
if (cache) {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
} else cache.setConfigPath(dir, promise, configName);
|
|
1060
|
-
}
|
|
1045
|
+
if (cache) if (cache.hasConfigPath(dir, configName)) {
|
|
1046
|
+
let cached;
|
|
1047
|
+
try {
|
|
1048
|
+
cached = cache.getConfigPath(dir, configName);
|
|
1049
|
+
} catch (e) {
|
|
1050
|
+
reject(e);
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
if (cached?.then) cached.then(resolve).catch(reject);
|
|
1054
|
+
else resolve(cached);
|
|
1055
|
+
} else cache.setConfigPath(dir, promise, configName);
|
|
1061
1056
|
const tsconfig = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dir, options?.configName ?? 'tsconfig.json');
|
|
1062
1057
|
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].stat(tsconfig, (err, stats)=>{
|
|
1063
1058
|
if (stats && (stats.isFile() || stats.isFIFO())) resolve(tsconfig);
|
|
@@ -1134,36 +1129,33 @@ function stripJsonComments(jsonString) {
|
|
|
1134
1129
|
const escaped = isEscaped(jsonString, index);
|
|
1135
1130
|
if (!escaped) isInsideString = !isInsideString;
|
|
1136
1131
|
}
|
|
1137
|
-
if (!isInsideString) {
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
} else if (isInsideComment || currentCharacter + nextCharacter !== '/*') {
|
|
1149
|
-
if (isInsideComment === multiComment && currentCharacter + nextCharacter === '*/') {
|
|
1150
|
-
index++;
|
|
1151
|
-
isInsideComment = false;
|
|
1152
|
-
result += strip(jsonString, offset, index + 1);
|
|
1153
|
-
offset = index + 1;
|
|
1154
|
-
}
|
|
1155
|
-
} else {
|
|
1156
|
-
result += jsonString.slice(offset, index);
|
|
1157
|
-
offset = index;
|
|
1158
|
-
isInsideComment = multiComment;
|
|
1159
|
-
index++;
|
|
1160
|
-
}
|
|
1161
|
-
} else {
|
|
1162
|
-
result += jsonString.slice(offset, index);
|
|
1163
|
-
offset = index;
|
|
1164
|
-
isInsideComment = singleComment;
|
|
1132
|
+
if (!isInsideString) if (isInsideComment || currentCharacter + nextCharacter !== '//') if (isInsideComment === singleComment && currentCharacter + nextCharacter === '\r\n') {
|
|
1133
|
+
index++;
|
|
1134
|
+
isInsideComment = false;
|
|
1135
|
+
result += strip(jsonString, offset, index);
|
|
1136
|
+
offset = index;
|
|
1137
|
+
} else if (isInsideComment === singleComment && '\n' === currentCharacter) {
|
|
1138
|
+
isInsideComment = false;
|
|
1139
|
+
result += strip(jsonString, offset, index);
|
|
1140
|
+
offset = index;
|
|
1141
|
+
} else if (isInsideComment || currentCharacter + nextCharacter !== '/*') {
|
|
1142
|
+
if (isInsideComment === multiComment && currentCharacter + nextCharacter === '*/') {
|
|
1165
1143
|
index++;
|
|
1144
|
+
isInsideComment = false;
|
|
1145
|
+
result += strip(jsonString, offset, index + 1);
|
|
1146
|
+
offset = index + 1;
|
|
1166
1147
|
}
|
|
1148
|
+
} else {
|
|
1149
|
+
result += jsonString.slice(offset, index);
|
|
1150
|
+
offset = index;
|
|
1151
|
+
isInsideComment = multiComment;
|
|
1152
|
+
index++;
|
|
1153
|
+
}
|
|
1154
|
+
else {
|
|
1155
|
+
result += jsonString.slice(offset, index);
|
|
1156
|
+
offset = index;
|
|
1157
|
+
isInsideComment = singleComment;
|
|
1158
|
+
index++;
|
|
1167
1159
|
}
|
|
1168
1160
|
}
|
|
1169
1161
|
return result + (isInsideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
|
|
@@ -1316,12 +1308,10 @@ function extendTSConfig(extending, extended) {
|
|
|
1316
1308
|
for (const key of Object.keys(extendedConfig).filter((key)=>EXTENDABLE_KEYS.includes(key)))if ('compilerOptions' === key) {
|
|
1317
1309
|
if (!extendingConfig.compilerOptions) extendingConfig.compilerOptions = {};
|
|
1318
1310
|
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);
|
|
1319
|
-
} else if (void 0 === extendingConfig[key]) {
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
} else extendingConfig[key] = rebaseRelative(key, extendedConfig[key], relativePath);
|
|
1324
|
-
}
|
|
1311
|
+
} else if (void 0 === extendingConfig[key]) if ('watchOptions' === key) {
|
|
1312
|
+
extendingConfig.watchOptions = {};
|
|
1313
|
+
for (const option of Object.keys(extendedConfig.watchOptions))extendingConfig.watchOptions[option] = rebaseRelative(option, extendedConfig.watchOptions[option], relativePath);
|
|
1314
|
+
} else extendingConfig[key] = rebaseRelative(key, extendedConfig[key], relativePath);
|
|
1325
1315
|
}
|
|
1326
1316
|
const REBASE_KEYS = [
|
|
1327
1317
|
'files',
|
|
@@ -2477,7 +2467,7 @@ const repeatableOption = (value, previous)=>(previous ?? []).concat([
|
|
|
2477
2467
|
value
|
|
2478
2468
|
]);
|
|
2479
2469
|
function runCli() {
|
|
2480
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.6.
|
|
2470
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.6.1");
|
|
2481
2471
|
const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('build');
|
|
2482
2472
|
const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('inspect');
|
|
2483
2473
|
const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('mf-dev');
|
|
@@ -2538,6 +2528,7 @@ function runCli() {
|
|
|
2538
2528
|
});
|
|
2539
2529
|
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.parse();
|
|
2540
2530
|
}
|
|
2541
|
-
const src_rslib_entry_version = "0.6.
|
|
2531
|
+
const src_rslib_entry_version = "0.6.1";
|
|
2542
2532
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger;
|
|
2543
|
-
|
|
2533
|
+
var __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack;
|
|
2534
|
+
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 };
|
package/dist-types/index.d.ts
CHANGED
|
@@ -7,3 +7,5 @@ export { defineConfig, loadConfig, composeCreateRsbuildConfig as unstable_compos
|
|
|
7
7
|
export { logger } from './utils/logger';
|
|
8
8
|
export type * from './types';
|
|
9
9
|
export declare const version: string;
|
|
10
|
+
export { rspack, type Rspack } from '@rsbuild/core';
|
|
11
|
+
export * as rsbuild from '@rsbuild/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://lib.rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"types.d.ts"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@rsbuild/core": "1.3.
|
|
39
|
+
"@rsbuild/core": "1.3.1",
|
|
40
40
|
"tinyglobby": "^0.2.12",
|
|
41
|
-
"rsbuild-plugin-dts": "0.6.
|
|
41
|
+
"rsbuild-plugin-dts": "0.6.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@module-federation/rsbuild-plugin": "^0.11.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"picocolors": "1.1.1",
|
|
51
51
|
"prebundle": "1.2.7",
|
|
52
52
|
"rsbuild-plugin-publint": "^0.3.0",
|
|
53
|
-
"rslib": "npm:@rslib/core@0.
|
|
53
|
+
"rslib": "npm:@rslib/core@0.6.0",
|
|
54
54
|
"rslog": "^1.2.3",
|
|
55
55
|
"tsconfck": "3.1.5",
|
|
56
56
|
"typescript": "^5.8.2",
|