@rslib/core 0.18.2 → 0.18.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/compiled/rslog/index.js +12 -9
- package/compiled/rslog/package.json +1 -1
- package/dist/index.js +30 -19
- 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
|
@@ -1445,10 +1445,9 @@ function composePrintFileSizeConfig(bundle, target) {
|
|
|
1445
1445
|
performance: {
|
|
1446
1446
|
printFileSize: {
|
|
1447
1447
|
total: ({ environmentName, distPath, assets, totalSize, totalGzipSize })=>{
|
|
1448
|
-
let log = `${picocolors.yellow(assets.length)} files generated in ${picocolors.
|
|
1449
|
-
log += '\n';
|
|
1450
|
-
log += `${picocolors.magenta('Total size:')} ${(totalSize / 1000).toFixed(1)} kB`;
|
|
1448
|
+
let log = `${picocolors.yellow(assets.length)} files generated in ${picocolors.cyan(distPath)}, ${picocolors.magenta('total:')} ${(totalSize / 1000).toFixed(1)} kB`;
|
|
1451
1449
|
if ('web' === target) log += ` ${picocolors.green(`(${(totalGzipSize / 1000).toFixed(1)} kB gzipped)`)}`;
|
|
1450
|
+
log += ` ${picocolors.dim(`(${environmentName})`)}`;
|
|
1452
1451
|
return log;
|
|
1453
1452
|
},
|
|
1454
1453
|
detail: false
|
|
@@ -1644,9 +1643,7 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
|
|
|
1644
1643
|
},
|
|
1645
1644
|
optimization: {
|
|
1646
1645
|
nodeEnv: process.env.NODE_ENV,
|
|
1647
|
-
splitChunks:
|
|
1648
|
-
chunks: 'async'
|
|
1649
|
-
}
|
|
1646
|
+
splitChunks: false
|
|
1650
1647
|
},
|
|
1651
1648
|
plugins
|
|
1652
1649
|
}
|
|
@@ -1685,7 +1682,8 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
|
|
|
1685
1682
|
}
|
|
1686
1683
|
},
|
|
1687
1684
|
optimization: {
|
|
1688
|
-
nodeEnv: process.env.NODE_ENV
|
|
1685
|
+
nodeEnv: process.env.NODE_ENV,
|
|
1686
|
+
splitChunks: false
|
|
1689
1687
|
},
|
|
1690
1688
|
plugins
|
|
1691
1689
|
}
|
|
@@ -2012,7 +2010,11 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOu
|
|
|
2012
2010
|
const globEntryFiles = await glob(entryFiles, {
|
|
2013
2011
|
cwd: root,
|
|
2014
2012
|
absolute: true,
|
|
2015
|
-
dot: true
|
|
2013
|
+
dot: true,
|
|
2014
|
+
ignore: [
|
|
2015
|
+
'**/.DS_Store',
|
|
2016
|
+
'**/Thumbs.db'
|
|
2017
|
+
]
|
|
2016
2018
|
});
|
|
2017
2019
|
const resolvedEntryFiles = globEntryFiles.filter((i)=>!DTS_EXTENSIONS_PATTERN.test(i));
|
|
2018
2020
|
if (0 === resolvedEntryFiles.length) {
|
|
@@ -2084,6 +2086,7 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
|
|
|
2084
2086
|
const { request, getResolve, context, contextInfo } = data;
|
|
2085
2087
|
if (!request || !getResolve || !context || !contextInfo) return void callback();
|
|
2086
2088
|
const { issuer } = contextInfo;
|
|
2089
|
+
const originExtension = extname(request);
|
|
2087
2090
|
if (!resolver) resolver = getResolve();
|
|
2088
2091
|
async function redirectPath(request) {
|
|
2089
2092
|
try {
|
|
@@ -2094,26 +2097,34 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
|
|
|
2094
2097
|
if (isSubpath) {
|
|
2095
2098
|
resolvedRequest = normalizeSlash(node_path.relative(node_path.dirname(issuer), resolvedRequest));
|
|
2096
2099
|
if (!resolvedRequest.startsWith('./') && !resolvedRequest.startsWith('../')) resolvedRequest = `./${resolvedRequest}`;
|
|
2097
|
-
return
|
|
2100
|
+
return {
|
|
2101
|
+
path: resolvedRequest,
|
|
2102
|
+
isResolved: true
|
|
2103
|
+
};
|
|
2098
2104
|
}
|
|
2099
|
-
return
|
|
2105
|
+
return {
|
|
2106
|
+
path: void 0,
|
|
2107
|
+
isResolved: true
|
|
2108
|
+
};
|
|
2100
2109
|
} catch (_e) {
|
|
2101
2110
|
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
|
|
2111
|
+
return {
|
|
2112
|
+
path: request,
|
|
2113
|
+
isResolved: false
|
|
2114
|
+
};
|
|
2103
2115
|
}
|
|
2104
2116
|
}
|
|
2105
2117
|
if (issuer) {
|
|
2106
2118
|
let resolvedRequest = request;
|
|
2107
|
-
const redirectedPath = await redirectPath(resolvedRequest);
|
|
2119
|
+
const { path: redirectedPath, isResolved } = await redirectPath(resolvedRequest);
|
|
2108
2120
|
const cssExternal = await cssExternalHandler(resolvedRequest, callback, jsExtension, cssModulesAuto, styleRedirectPath, styleRedirectExtension, redirectedPath, issuer);
|
|
2109
2121
|
if (false !== cssExternal) return cssExternal;
|
|
2110
2122
|
if (void 0 === redirectedPath) return void callback(void 0, request);
|
|
2111
2123
|
if (jsRedirectPath) resolvedRequest = redirectedPath;
|
|
2112
|
-
if (resolvedRequest.startsWith('.')) {
|
|
2124
|
+
if (resolvedRequest.startsWith('.') && isResolved) {
|
|
2113
2125
|
const ext = extname(resolvedRequest);
|
|
2114
|
-
if (ext) if (JS_EXTENSIONS_PATTERN.test(resolvedRequest))
|
|
2115
|
-
|
|
2116
|
-
} else {
|
|
2126
|
+
if (ext) if (JS_EXTENSIONS_PATTERN.test(resolvedRequest)) resolvedRequest = resolvedRequest.replace(/\.[^.]+$/, jsRedirectExtension ? jsExtension : JS_EXTENSIONS_PATTERN.test(originExtension) ? originExtension : '');
|
|
2127
|
+
else {
|
|
2117
2128
|
resolvedRequest = assetRedirectPath ? redirectedPath : request;
|
|
2118
2129
|
if (assetRedirectExtension) resolvedRequest = resolvedRequest.replace(/\.[^.]+$/, jsExtension);
|
|
2119
2130
|
}
|
|
@@ -3079,7 +3090,7 @@ const applyCommonOptions = (cli)=>{
|
|
|
3079
3090
|
};
|
|
3080
3091
|
function runCli() {
|
|
3081
3092
|
const cli = dist('rslib');
|
|
3082
|
-
cli.version("0.18.
|
|
3093
|
+
cli.version("0.18.4");
|
|
3083
3094
|
applyCommonOptions(cli);
|
|
3084
3095
|
const buildDescription = `build the library for production ${picocolors.dim('(default if no command is given)')}`;
|
|
3085
3096
|
const buildCommand = cli.command('', buildDescription).alias('build');
|
|
@@ -3195,9 +3206,9 @@ function prepareCli() {
|
|
|
3195
3206
|
setupLogLevel();
|
|
3196
3207
|
const { npm_execpath } = process.env;
|
|
3197
3208
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger.log();
|
|
3198
|
-
logger.greet(` Rslib v0.18.
|
|
3209
|
+
logger.greet(` Rslib v0.18.4\n`);
|
|
3199
3210
|
}
|
|
3200
|
-
const src_version = "0.18.
|
|
3211
|
+
const src_version = "0.18.4";
|
|
3201
3212
|
export * as rsbuild from "@rsbuild/core";
|
|
3202
3213
|
export { logger } from "../compiled/rslog/index.js";
|
|
3203
3214
|
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.4",
|
|
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.14",
|
|
40
|
+
"rsbuild-plugin-dts": "0.18.4"
|
|
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.3",
|
|
54
|
+
"rslog": "^1.3.2",
|
|
55
55
|
"tinyglobby": "0.2.14",
|
|
56
56
|
"tsconfck": "3.1.6",
|
|
57
57
|
"typescript": "^5.9.3",
|