@rslib/core 0.18.5 → 0.18.6
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 +19 -12
- package/dist-types/cli/commands.d.ts +1 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1216,7 +1216,7 @@ const resolveConfigPath = (root, customConfig)=>{
|
|
|
1216
1216
|
if (customConfig) {
|
|
1217
1217
|
const customConfigPath = isAbsolute(customConfig) ? customConfig : join(root, customConfig);
|
|
1218
1218
|
if (node_fs.existsSync(customConfigPath)) return customConfigPath;
|
|
1219
|
-
|
|
1219
|
+
throw new Error(`${picocolors.dim('[rslib:loadConfig]')} Cannot find config file: ${picocolors.dim(customConfigPath)}`);
|
|
1220
1220
|
}
|
|
1221
1221
|
const configFilePath = findConfig(join(root, DEFAULT_CONFIG_NAME));
|
|
1222
1222
|
if (configFilePath) return configFilePath;
|
|
@@ -3078,6 +3078,7 @@ async function initMFRsbuild(config, options = {}) {
|
|
|
3078
3078
|
onBeforeRestart(devServer.server.close);
|
|
3079
3079
|
return rsbuildInstance;
|
|
3080
3080
|
}
|
|
3081
|
+
const RSPACK_BUILD_ERROR = 'Rspack build failed.';
|
|
3081
3082
|
const applyCommonOptions = (cli)=>{
|
|
3082
3083
|
cli.option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
|
|
3083
3084
|
default: 'auto'
|
|
@@ -3090,7 +3091,7 @@ const applyCommonOptions = (cli)=>{
|
|
|
3090
3091
|
};
|
|
3091
3092
|
function runCli() {
|
|
3092
3093
|
const cli = dist('rslib');
|
|
3093
|
-
cli.version("0.18.
|
|
3094
|
+
cli.version("0.18.6");
|
|
3094
3095
|
applyCommonOptions(cli);
|
|
3095
3096
|
const buildDescription = `build the library for production ${picocolors.dim('(default if no command is given)')}`;
|
|
3096
3097
|
const buildCommand = cli.command('', buildDescription).alias('build');
|
|
@@ -3128,7 +3129,8 @@ function runCli() {
|
|
|
3128
3129
|
};
|
|
3129
3130
|
await cliBuild();
|
|
3130
3131
|
} catch (err) {
|
|
3131
|
-
|
|
3132
|
+
const isRspackError = err instanceof Error && err.message === RSPACK_BUILD_ERROR;
|
|
3133
|
+
if (!isRspackError) logger.error('Failed to build.');
|
|
3132
3134
|
if (err instanceof AggregateError) for (const error of err.errors)logger.error(error);
|
|
3133
3135
|
else logger.error(err);
|
|
3134
3136
|
process.exit(1);
|
|
@@ -3190,6 +3192,14 @@ function initNodeEnv() {
|
|
|
3190
3192
|
].includes(command) ? 'production' : 'development';
|
|
3191
3193
|
}
|
|
3192
3194
|
}
|
|
3195
|
+
function showGreeting() {
|
|
3196
|
+
const { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env;
|
|
3197
|
+
const isNpx = 'npx' === npm_lifecycle_event;
|
|
3198
|
+
const isBun = npm_execpath?.includes('.bun');
|
|
3199
|
+
const isNodeRun = Boolean(NODE_RUN_SCRIPT_NAME);
|
|
3200
|
+
const prefix = isNpx || isBun || isNodeRun ? '\n' : '';
|
|
3201
|
+
logger.greet(`${prefix}Rslib v0.18.6\n`);
|
|
3202
|
+
}
|
|
3193
3203
|
function setupLogLevel() {
|
|
3194
3204
|
const logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
3195
3205
|
if (-1 !== logLevelIndex) {
|
|
@@ -3202,14 +3212,11 @@ function setupLogLevel() {
|
|
|
3202
3212
|
}
|
|
3203
3213
|
}
|
|
3204
3214
|
function prepareCli() {
|
|
3215
|
+
process.title = 'rslib-node';
|
|
3205
3216
|
initNodeEnv();
|
|
3206
3217
|
setupLogLevel();
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
export * as rsbuild from "@rsbuild/core";
|
|
3213
|
-
export { logger } from "../compiled/rslog/index.js";
|
|
3214
|
-
export { rspack } from "@rsbuild/core";
|
|
3215
|
-
export { build, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, defineConfig, inspect, loadConfig, prepareCli, runCli, src_version as version, startMFDevServer };
|
|
3218
|
+
showGreeting();
|
|
3219
|
+
}
|
|
3220
|
+
const src_version = "0.18.6";
|
|
3221
|
+
var rspack = __rspack_external__rsbuild_core_1b356efc.rspack;
|
|
3222
|
+
export { __rspack_external__rsbuild_core_1b356efc as rsbuild, build, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, defineConfig, inspect, loadConfig, logger, prepareCli, rspack, runCli, src_version as version, startMFDevServer };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { LogLevel, RsbuildMode } from '@rsbuild/core';
|
|
2
2
|
import type { ConfigLoader } from '../config';
|
|
3
3
|
import type { Format, Syntax } from '../types/config';
|
|
4
|
+
export declare const RSPACK_BUILD_ERROR = "Rspack build failed.";
|
|
4
5
|
export type CommonOptions = {
|
|
5
6
|
root?: string;
|
|
6
7
|
config?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.6",
|
|
4
4
|
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://rslib.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -36,21 +36,21 @@
|
|
|
36
36
|
"types.d.ts"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@rsbuild/core": "~1.7.0-beta.
|
|
40
|
-
"rsbuild-plugin-dts": "0.18.
|
|
39
|
+
"@rsbuild/core": "~1.7.0-beta.1",
|
|
40
|
+
"rsbuild-plugin-dts": "0.18.6"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@module-federation/rsbuild-plugin": "^0.21.6",
|
|
44
44
|
"@types/fs-extra": "^11.0.4",
|
|
45
45
|
"cac": "^6.7.14",
|
|
46
46
|
"chokidar": "^4.0.3",
|
|
47
|
-
"fs-extra": "^11.3.
|
|
47
|
+
"fs-extra": "^11.3.3",
|
|
48
48
|
"memfs": "^4.51.1",
|
|
49
49
|
"path-serializer": "0.5.1",
|
|
50
50
|
"picocolors": "1.1.1",
|
|
51
51
|
"prebundle": "1.6.0",
|
|
52
52
|
"rsbuild-plugin-publint": "^0.3.3",
|
|
53
|
-
"rslib": "npm:@rslib/core@0.18.
|
|
53
|
+
"rslib": "npm:@rslib/core@0.18.5",
|
|
54
54
|
"rslog": "^1.3.2",
|
|
55
55
|
"tinyglobby": "0.2.14",
|
|
56
56
|
"tsconfck": "3.1.6",
|