@rslib/core 0.18.2 → 0.18.3
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/rslog/index.js +12 -9
- package/compiled/rslog/package.json +1 -1
- package/dist/index.js +20 -11
- package/package.json +6 -6
package/compiled/rslog/index.js
CHANGED
|
@@ -24,8 +24,8 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
createLogger: ()=>createLogger,
|
|
28
|
+
logger: ()=>src_logger
|
|
29
29
|
});
|
|
30
30
|
const external_node_process_namespaceObject = require("node:process");
|
|
31
31
|
const external_node_os_namespaceObject = require("node:os");
|
|
@@ -132,9 +132,10 @@ const supportsColor = {
|
|
|
132
132
|
};
|
|
133
133
|
const supports_color = supportsColor;
|
|
134
134
|
const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
|
|
135
|
-
let errorStackRegExp = /at\
|
|
136
|
-
let anonymousErrorStackRegExp = /at\
|
|
137
|
-
let
|
|
135
|
+
let errorStackRegExp = /at [^\r\n]{0,200}:\d+:\d+[\s\)]*$/;
|
|
136
|
+
let anonymousErrorStackRegExp = /at [^\r\n]{0,200}\(<anonymous>\)$/;
|
|
137
|
+
let indexErrorStackRegExp = /at [^\r\n]{0,200}\(index\s\d+\)$/;
|
|
138
|
+
let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message) || indexErrorStackRegExp.test(message);
|
|
138
139
|
let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
139
140
|
let string = '' + input;
|
|
140
141
|
let index = string.indexOf(close, open.length);
|
|
@@ -246,9 +247,10 @@ const normalizeErrorMessage = (err)=>{
|
|
|
246
247
|
let createLogger = (options = {})=>{
|
|
247
248
|
let maxLevel = options.level || 'info';
|
|
248
249
|
let log = (type, message, ...args)=>{
|
|
249
|
-
if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
|
|
250
|
-
if (null == message) return console.log();
|
|
251
250
|
let logType = LOG_TYPES[type];
|
|
251
|
+
const { level } = logType;
|
|
252
|
+
if (LOG_LEVEL[level] > LOG_LEVEL[maxLevel]) return;
|
|
253
|
+
if (null == message) return console.log();
|
|
252
254
|
let label = '';
|
|
253
255
|
let text = '';
|
|
254
256
|
if ('label' in logType) {
|
|
@@ -262,11 +264,12 @@ let createLogger = (options = {})=>{
|
|
|
262
264
|
text += yellow('\n [cause]: ');
|
|
263
265
|
text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause);
|
|
264
266
|
}
|
|
265
|
-
} else if ('error' ===
|
|
267
|
+
} else if ('error' === level && 'string' == typeof message) {
|
|
266
268
|
let lines = message.split('\n');
|
|
267
269
|
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
268
270
|
} else text = `${message}`;
|
|
269
|
-
|
|
271
|
+
const method = 'error' === level || 'warn' === level ? level : 'log';
|
|
272
|
+
console[method](label.length ? `${label} ${text}` : text, ...args);
|
|
270
273
|
};
|
|
271
274
|
let logger = {
|
|
272
275
|
greet: (message)=>log('log', gradient(message))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"rslog","version":"1.3.
|
|
1
|
+
{"name":"rslog","version":"1.3.2","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
package/dist/index.js
CHANGED
|
@@ -2084,6 +2084,7 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
|
|
|
2084
2084
|
const { request, getResolve, context, contextInfo } = data;
|
|
2085
2085
|
if (!request || !getResolve || !context || !contextInfo) return void callback();
|
|
2086
2086
|
const { issuer } = contextInfo;
|
|
2087
|
+
const originExtension = extname(request);
|
|
2087
2088
|
if (!resolver) resolver = getResolve();
|
|
2088
2089
|
async function redirectPath(request) {
|
|
2089
2090
|
try {
|
|
@@ -2094,26 +2095,34 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
|
|
|
2094
2095
|
if (isSubpath) {
|
|
2095
2096
|
resolvedRequest = normalizeSlash(node_path.relative(node_path.dirname(issuer), resolvedRequest));
|
|
2096
2097
|
if (!resolvedRequest.startsWith('./') && !resolvedRequest.startsWith('../')) resolvedRequest = `./${resolvedRequest}`;
|
|
2097
|
-
return
|
|
2098
|
+
return {
|
|
2099
|
+
path: resolvedRequest,
|
|
2100
|
+
isResolved: true
|
|
2101
|
+
};
|
|
2098
2102
|
}
|
|
2099
|
-
return
|
|
2103
|
+
return {
|
|
2104
|
+
path: void 0,
|
|
2105
|
+
isResolved: true
|
|
2106
|
+
};
|
|
2100
2107
|
} catch (_e) {
|
|
2101
2108
|
logger.debug(`Failed to resolve module ${picocolors.green(`"${request}"`)} from ${picocolors.green(issuer)}. If it's an npm package, consider adding it to dependencies or peerDependencies in package.json to make it externalized.`);
|
|
2102
|
-
return
|
|
2109
|
+
return {
|
|
2110
|
+
path: request,
|
|
2111
|
+
isResolved: false
|
|
2112
|
+
};
|
|
2103
2113
|
}
|
|
2104
2114
|
}
|
|
2105
2115
|
if (issuer) {
|
|
2106
2116
|
let resolvedRequest = request;
|
|
2107
|
-
const redirectedPath = await redirectPath(resolvedRequest);
|
|
2117
|
+
const { path: redirectedPath, isResolved } = await redirectPath(resolvedRequest);
|
|
2108
2118
|
const cssExternal = await cssExternalHandler(resolvedRequest, callback, jsExtension, cssModulesAuto, styleRedirectPath, styleRedirectExtension, redirectedPath, issuer);
|
|
2109
2119
|
if (false !== cssExternal) return cssExternal;
|
|
2110
2120
|
if (void 0 === redirectedPath) return void callback(void 0, request);
|
|
2111
2121
|
if (jsRedirectPath) resolvedRequest = redirectedPath;
|
|
2112
|
-
if (resolvedRequest.startsWith('.')) {
|
|
2122
|
+
if (resolvedRequest.startsWith('.') && isResolved) {
|
|
2113
2123
|
const ext = extname(resolvedRequest);
|
|
2114
|
-
if (ext) if (JS_EXTENSIONS_PATTERN.test(resolvedRequest))
|
|
2115
|
-
|
|
2116
|
-
} else {
|
|
2124
|
+
if (ext) if (JS_EXTENSIONS_PATTERN.test(resolvedRequest)) resolvedRequest = resolvedRequest.replace(/\.[^.]+$/, jsRedirectExtension ? jsExtension : JS_EXTENSIONS_PATTERN.test(originExtension) ? originExtension : '');
|
|
2125
|
+
else {
|
|
2117
2126
|
resolvedRequest = assetRedirectPath ? redirectedPath : request;
|
|
2118
2127
|
if (assetRedirectExtension) resolvedRequest = resolvedRequest.replace(/\.[^.]+$/, jsExtension);
|
|
2119
2128
|
}
|
|
@@ -3079,7 +3088,7 @@ const applyCommonOptions = (cli)=>{
|
|
|
3079
3088
|
};
|
|
3080
3089
|
function runCli() {
|
|
3081
3090
|
const cli = dist('rslib');
|
|
3082
|
-
cli.version("0.18.
|
|
3091
|
+
cli.version("0.18.3");
|
|
3083
3092
|
applyCommonOptions(cli);
|
|
3084
3093
|
const buildDescription = `build the library for production ${picocolors.dim('(default if no command is given)')}`;
|
|
3085
3094
|
const buildCommand = cli.command('', buildDescription).alias('build');
|
|
@@ -3195,9 +3204,9 @@ function prepareCli() {
|
|
|
3195
3204
|
setupLogLevel();
|
|
3196
3205
|
const { npm_execpath } = process.env;
|
|
3197
3206
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger.log();
|
|
3198
|
-
logger.greet(` Rslib v0.18.
|
|
3207
|
+
logger.greet(` Rslib v0.18.3\n`);
|
|
3199
3208
|
}
|
|
3200
|
-
const src_version = "0.18.
|
|
3209
|
+
const src_version = "0.18.3";
|
|
3201
3210
|
export * as rsbuild from "@rsbuild/core";
|
|
3202
3211
|
export { logger } from "../compiled/rslog/index.js";
|
|
3203
3212
|
export { rspack } from "@rsbuild/core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://rslib.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"types.d.ts"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@rsbuild/core": "~1.6.
|
|
40
|
-
"rsbuild-plugin-dts": "0.18.
|
|
39
|
+
"@rsbuild/core": "~1.6.12",
|
|
40
|
+
"rsbuild-plugin-dts": "0.18.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@module-federation/rsbuild-plugin": "^0.21.6",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"cac": "^6.7.14",
|
|
46
46
|
"chokidar": "^4.0.3",
|
|
47
47
|
"fs-extra": "^11.3.2",
|
|
48
|
-
"memfs": "^4.51.
|
|
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.
|
|
54
|
-
"rslog": "^1.3.
|
|
53
|
+
"rslib": "npm:@rslib/core@0.18.2",
|
|
54
|
+
"rslog": "^1.3.2",
|
|
55
55
|
"tinyglobby": "0.2.14",
|
|
56
56
|
"tsconfck": "3.1.6",
|
|
57
57
|
"typescript": "^5.9.3",
|