@fast-china/utils 1.0.27 → 1.0.29
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.global.js +32 -47
- package/dist/index.global.js.map +1 -1
- package/dist/index.global.min.js +5 -5
- package/dist/index.global.min.js.map +1 -1
- package/es/console/index.d.ts +6 -0
- package/es/console/index.mjs +35 -49
- package/es/console/index.mjs.map +1 -1
- package/es/index.mjs +2 -1
- package/lib/console/index.d.ts +6 -0
- package/lib/console/index.js +1 -1
- package/lib/console/index.js.map +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -6348,54 +6348,47 @@ var FastUtils = function(exports, vue) {
|
|
|
6348
6348
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
6349
6349
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
6350
6350
|
*/
|
|
6351
|
-
const
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6351
|
+
const state$2 = vue.reactive({
|
|
6352
|
+
/** @description Uni-App 在 APP-PLUS 下是否拆分输出 @default false */
|
|
6353
|
+
uniAppPlusSplit: false
|
|
6354
|
+
});
|
|
6355
|
+
const useConsole = () => {
|
|
6356
|
+
return {
|
|
6357
|
+
/**
|
|
6358
|
+
* 设置 Uni-App 在 APP-PLUS 下是否拆分输出
|
|
6359
|
+
*/
|
|
6360
|
+
setUniAppPlusSplit(value) {
|
|
6361
|
+
state$2.uniAppPlusSplit = value;
|
|
6362
6362
|
}
|
|
6363
|
-
}
|
|
6364
|
-
console.log(`[Fast-Log-${name}]${message ? ` ${message}` : ""}`);
|
|
6365
|
-
}
|
|
6363
|
+
};
|
|
6366
6364
|
};
|
|
6367
|
-
const
|
|
6368
|
-
if (
|
|
6365
|
+
const vConsole = (level, ...args) => {
|
|
6366
|
+
if (state$2.uniAppPlusSplit) {
|
|
6369
6367
|
if (typeof uni !== "undefined") {
|
|
6370
6368
|
if (typeof plus !== "undefined") {
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6369
|
+
args.forEach((item) => {
|
|
6370
|
+
if (isNil(item)) return;
|
|
6371
|
+
console[level.toLowerCase()](isString(item) ? item : JSON.stringify(item, null, 2));
|
|
6372
|
+
});
|
|
6373
|
+
return;
|
|
6375
6374
|
}
|
|
6376
|
-
} else {
|
|
6377
|
-
console.warn(`[Fast-Log-${name}]${message ? ` ${message}` : ""}`, error);
|
|
6378
6375
|
}
|
|
6379
|
-
} else {
|
|
6380
|
-
console.warn(`[Fast-Log-${name}]${message ? ` ${message}` : ""}`);
|
|
6381
6376
|
}
|
|
6377
|
+
console[level.toLowerCase()](...args);
|
|
6382
6378
|
};
|
|
6383
|
-
const
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
console.debug(isString(error) ? error : JSON.stringify(error, null, 2));
|
|
6389
|
-
} else {
|
|
6390
|
-
console.debug(`[Fast-Log-${name}]${message ? ` ${message}` : ""}`, error);
|
|
6391
|
-
}
|
|
6379
|
+
const makeConsole = (level) => {
|
|
6380
|
+
return (name, message, error) => {
|
|
6381
|
+
const prefix = `[Fast-${level}-${name}]`;
|
|
6382
|
+
if (error) {
|
|
6383
|
+
vConsole(level, `${prefix}${message ?? ""}`, error);
|
|
6392
6384
|
} else {
|
|
6393
|
-
|
|
6385
|
+
vConsole(level, `${prefix}${message ?? ""}`);
|
|
6394
6386
|
}
|
|
6395
|
-
}
|
|
6396
|
-
console.debug(`[Fast-Log-${name}]${message ? ` ${message}` : ""}`);
|
|
6397
|
-
}
|
|
6387
|
+
};
|
|
6398
6388
|
};
|
|
6389
|
+
const consoleLog = makeConsole("Log");
|
|
6390
|
+
const consoleWarn = makeConsole("Warn");
|
|
6391
|
+
const consoleDebug = makeConsole("Debug");
|
|
6399
6392
|
const consoleError = (name, message) => {
|
|
6400
6393
|
if (isNil(message)) {
|
|
6401
6394
|
return;
|
|
@@ -6403,16 +6396,7 @@ var FastUtils = function(exports, vue) {
|
|
|
6403
6396
|
if (isString(message)) {
|
|
6404
6397
|
console.error(new FastError(`[Fast-${name}] ${message}`));
|
|
6405
6398
|
} else {
|
|
6406
|
-
|
|
6407
|
-
if (typeof plus !== "undefined") {
|
|
6408
|
-
console.error(`[Fast-Error-${name}]`);
|
|
6409
|
-
console.error(JSON.stringify(message, null, 2));
|
|
6410
|
-
} else {
|
|
6411
|
-
console.error(`[Fast-Error-${name}]`, message);
|
|
6412
|
-
}
|
|
6413
|
-
} else {
|
|
6414
|
-
console.error(`[Fast-Error-${name}]`, message);
|
|
6415
|
-
}
|
|
6399
|
+
vConsole("Error", `[Fast-Error-${name}]`, message);
|
|
6416
6400
|
}
|
|
6417
6401
|
};
|
|
6418
6402
|
const throwError = (name, message) => {
|
|
@@ -14389,6 +14373,7 @@ var FastUtils = function(exports, vue) {
|
|
|
14389
14373
|
exports.stringUtil = stringUtil;
|
|
14390
14374
|
exports.styleToString = styleToString;
|
|
14391
14375
|
exports.throwError = throwError;
|
|
14376
|
+
exports.useConsole = useConsole;
|
|
14392
14377
|
exports.useExpose = useExpose;
|
|
14393
14378
|
exports.useIdentity = useIdentity;
|
|
14394
14379
|
exports.useProps = useProps;
|