@next-core/brick-kit 2.206.2 → 2.208.0
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.bundle.js +182 -0
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +182 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/types/internal/bindListeners.d.ts.map +1 -1
- package/dist/types/internal/debugManager.d.ts +17 -0
- package/dist/types/internal/debugManager.d.ts.map +1 -0
- package/dist/types/internal/evaluate.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1419,6 +1419,10 @@ function getIndividualGlobal(variableName, _ref) {
|
|
|
1419
1419
|
return collectCoverage ? identity : widgetId ? widgetI18nFactory(widgetId) : getFixedT(null, [appendI18nNamespace, getI18nNamespace("app", app.id)].filter(Boolean));
|
|
1420
1420
|
case "I18N_TEXT":
|
|
1421
1421
|
return collectCoverage ? fakeI18nText : i18nText;
|
|
1422
|
+
case "LANGUAGE":
|
|
1423
|
+
{
|
|
1424
|
+
return collectCoverage ? "zh" : i18next.language || "zh";
|
|
1425
|
+
}
|
|
1422
1426
|
case "PERMISSIONS":
|
|
1423
1427
|
return {
|
|
1424
1428
|
check: collectCoverage ? fakeCheckPermissions : checkPermissions
|
|
@@ -6328,6 +6332,177 @@ class FlowApiNotFoundError extends Error {
|
|
|
6328
6332
|
}
|
|
6329
6333
|
}
|
|
6330
6334
|
|
|
6335
|
+
class DebugManager {
|
|
6336
|
+
static getInstance() {
|
|
6337
|
+
if (!DebugManager.instance) {
|
|
6338
|
+
DebugManager.instance = new DebugManager();
|
|
6339
|
+
}
|
|
6340
|
+
return DebugManager.instance;
|
|
6341
|
+
}
|
|
6342
|
+
constructor() {
|
|
6343
|
+
_defineProperty$1(this, "debugMode", false);
|
|
6344
|
+
_defineProperty$1(this, "debugType", "none");
|
|
6345
|
+
this.initDebugMode();
|
|
6346
|
+
this.setupWindowAPI();
|
|
6347
|
+
}
|
|
6348
|
+
initDebugMode() {
|
|
6349
|
+
// 1. 首先检查URL参数
|
|
6350
|
+
var urlParams = new URLSearchParams(window.location.search);
|
|
6351
|
+
var debugFromUrl = urlParams.get("debugConsole");
|
|
6352
|
+
if (debugFromUrl === "true") {
|
|
6353
|
+
this.activateSessionDebug();
|
|
6354
|
+
return;
|
|
6355
|
+
}
|
|
6356
|
+
|
|
6357
|
+
// 2. 检查localStorage(内部人员长期调试)
|
|
6358
|
+
var persistentDebug = localStorage.getItem("debugConsole");
|
|
6359
|
+
if (persistentDebug === "true") {
|
|
6360
|
+
this.debugMode = true;
|
|
6361
|
+
this.debugType = "persistent";
|
|
6362
|
+
// eslint-disable-next-line no-console
|
|
6363
|
+
console.log("🔧 调试模式已开启(持久模式 - 内部调试)");
|
|
6364
|
+
return;
|
|
6365
|
+
}
|
|
6366
|
+
|
|
6367
|
+
// 3. 检查sessionStorage(客户临时调试)
|
|
6368
|
+
var sessionDebug = sessionStorage.getItem("debugConsole");
|
|
6369
|
+
if (sessionDebug === "true") {
|
|
6370
|
+
this.debugMode = true;
|
|
6371
|
+
this.debugType = "session";
|
|
6372
|
+
// eslint-disable-next-line no-console
|
|
6373
|
+
console.log("🔧 调试模式已开启(会话模式 - 关闭标签页后失效)");
|
|
6374
|
+
return;
|
|
6375
|
+
}
|
|
6376
|
+
|
|
6377
|
+
// 4. 检查日志级别设置
|
|
6378
|
+
}
|
|
6379
|
+
|
|
6380
|
+
activateSessionDebug() {
|
|
6381
|
+
this.debugMode = true;
|
|
6382
|
+
this.debugType = "session";
|
|
6383
|
+
sessionStorage.setItem("debugConsole", "true");
|
|
6384
|
+
// eslint-disable-next-line no-console
|
|
6385
|
+
console.log("🔧 调试模式已通过URL参数激活(会话模式)");
|
|
6386
|
+
}
|
|
6387
|
+
setupWindowAPI() {
|
|
6388
|
+
window.debugConsole = {
|
|
6389
|
+
// 开启会话调试模式(客户现场使用)
|
|
6390
|
+
enable: () => {
|
|
6391
|
+
this.debugMode = true;
|
|
6392
|
+
this.debugType = "session";
|
|
6393
|
+
sessionStorage.setItem("debugConsole", "true");
|
|
6394
|
+
// eslint-disable-next-line no-console
|
|
6395
|
+
console.log("🔧 调试模式已开启(会话模式 - 关闭标签页后失效)");
|
|
6396
|
+
return this.debugMode;
|
|
6397
|
+
},
|
|
6398
|
+
// 开启持久调试模式(内部人员使用)
|
|
6399
|
+
enablePersistent: () => {
|
|
6400
|
+
this.debugMode = true;
|
|
6401
|
+
this.debugType = "persistent";
|
|
6402
|
+
localStorage.setItem("debugConsole", "true");
|
|
6403
|
+
// eslint-disable-next-line no-console
|
|
6404
|
+
console.log("🔧 调试模式已开启(持久模式 - 内部调试)");
|
|
6405
|
+
return this.debugMode;
|
|
6406
|
+
},
|
|
6407
|
+
// 关闭调试模式
|
|
6408
|
+
disable: () => {
|
|
6409
|
+
this.debugMode = false;
|
|
6410
|
+
this.debugType = "none";
|
|
6411
|
+
sessionStorage.removeItem("debugConsole");
|
|
6412
|
+
localStorage.removeItem("debugConsole");
|
|
6413
|
+
// eslint-disable-next-line no-console
|
|
6414
|
+
console.log("🔧 调试模式已关闭");
|
|
6415
|
+
return this.debugMode;
|
|
6416
|
+
},
|
|
6417
|
+
// 切换调试模式
|
|
6418
|
+
toggle: () => {
|
|
6419
|
+
if (this.debugMode) {
|
|
6420
|
+
this.debugMode = false;
|
|
6421
|
+
this.debugType = "none";
|
|
6422
|
+
sessionStorage.removeItem("debugConsole");
|
|
6423
|
+
localStorage.removeItem("debugConsole");
|
|
6424
|
+
// eslint-disable-next-line no-console
|
|
6425
|
+
console.log("🔧 调试模式已关闭");
|
|
6426
|
+
} else {
|
|
6427
|
+
this.debugMode = true;
|
|
6428
|
+
this.debugType = "session";
|
|
6429
|
+
sessionStorage.setItem("debugConsole", "true");
|
|
6430
|
+
// eslint-disable-next-line no-console
|
|
6431
|
+
console.log("🔧 调试模式已开启(会话模式 - 关闭标签页后失效)");
|
|
6432
|
+
}
|
|
6433
|
+
return this.debugMode;
|
|
6434
|
+
},
|
|
6435
|
+
// 切换持久调试模式
|
|
6436
|
+
togglePersistent: () => {
|
|
6437
|
+
if (this.debugMode && this.debugType === "persistent") {
|
|
6438
|
+
this.debugMode = false;
|
|
6439
|
+
this.debugType = "none";
|
|
6440
|
+
sessionStorage.removeItem("debugConsole");
|
|
6441
|
+
localStorage.removeItem("debugConsole");
|
|
6442
|
+
// eslint-disable-next-line no-console
|
|
6443
|
+
console.log("🔧 调试模式已关闭");
|
|
6444
|
+
} else {
|
|
6445
|
+
this.debugMode = true;
|
|
6446
|
+
this.debugType = "persistent";
|
|
6447
|
+
localStorage.setItem("debugConsole", "true");
|
|
6448
|
+
// eslint-disable-next-line no-console
|
|
6449
|
+
console.log("🔧 调试模式已开启(持久模式 - 内部调试)");
|
|
6450
|
+
}
|
|
6451
|
+
return this.debugMode;
|
|
6452
|
+
},
|
|
6453
|
+
// 获取当前状态
|
|
6454
|
+
status: () => {
|
|
6455
|
+
var status = {
|
|
6456
|
+
debugMode: this.debugMode,
|
|
6457
|
+
debugType: this.debugType,
|
|
6458
|
+
description: this.getStatusDescription()
|
|
6459
|
+
};
|
|
6460
|
+
// eslint-disable-next-line no-console
|
|
6461
|
+
console.log("🔧 调试状态:", status);
|
|
6462
|
+
return status;
|
|
6463
|
+
},
|
|
6464
|
+
// 帮助信息
|
|
6465
|
+
help: () => {
|
|
6466
|
+
// eslint-disable-next-line no-console
|
|
6467
|
+
console.log("\n\uD83D\uDD27 \u6DF7\u5408\u8C03\u8BD5\u63A7\u5236\u53F0\u4F7F\u7528\u8BF4\u660E\uFF1A\n\n\uD83D\uDC65 \u751F\u4EA7\u73AF\u5883\u4F7F\u7528\uFF08\u4E34\u65F6\u8C03\u8BD5\uFF09\uFF1A\n window.debugConsole.enable() - \u5F00\u542F\u4F1A\u8BDD\u8C03\u8BD5\uFF08\u5173\u95ED\u6807\u7B7E\u9875\u540E\u5931\u6548\uFF09\n window.debugConsole.disable() - \u5173\u95ED\u8C03\u8BD5\u6A21\u5F0F\n window.debugConsole.toggle() - \u5207\u6362\u4F1A\u8BDD\u8C03\u8BD5\u6A21\u5F0F\n\n\uD83D\uDC68\u200D\uD83D\uDCBB \u5F00\u53D1\u4EBA\u5458\u4F7F\u7528\uFF08\u957F\u671F\u8C03\u8BD5\uFF09\uFF1A\n window.debugConsole.enablePersistent() - \u5F00\u542F\u6301\u4E45\u8C03\u8BD5\uFF08\u957F\u671F\u6709\u6548\uFF09\n window.debugConsole.togglePersistent() - \u5207\u6362\u6301\u4E45\u8C03\u8BD5\u6A21\u5F0F\n window.debugConsole.disable() - \u5173\u95ED\u8C03\u8BD5\u6A21\u5F0F\n\n\uD83D\uDD0D \u5176\u4ED6\u529F\u80FD\uFF1A\n window.debugConsole.status() - \u67E5\u770B\u5F53\u524D\u72B6\u6001\n window.debugConsole.help() - \u663E\u793A\u6B64\u5E2E\u52A9\u4FE1\u606F\n\n\uD83C\uDF10 URL\u53C2\u6570\uFF1A\n ?debugConsole=true - \u901A\u8FC7URL\u6FC0\u6D3B\u4F1A\u8BDD\u8C03\u8BD5\u6A21\u5F0F\n\n\uD83D\uDCDD \u8BF4\u660E\uFF1A\n - \u4F1A\u8BDD\u6A21\u5F0F\uFF1A\u5237\u65B0\u9875\u9762\u540E\u4ECD\u7136\u6709\u6548\uFF0C\u5173\u95ED\u6807\u7B7E\u9875\u540E\u5931\u6548\n - \u6301\u4E45\u6A21\u5F0F\uFF1A\u957F\u671F\u6709\u6548\uFF0C\u9664\u975E\u624B\u52A8\u5173\u95ED\n ");
|
|
6468
|
+
}
|
|
6469
|
+
};
|
|
6470
|
+
|
|
6471
|
+
// 显示初始状态
|
|
6472
|
+
if (this.debugMode) {
|
|
6473
|
+
// eslint-disable-next-line no-console
|
|
6474
|
+
console.log("\uD83D\uDD27 \u8C03\u8BD5\u6A21\u5F0F\u5DF2\u5F00\u542F\uFF08".concat(this.debugType === "persistent" ? "持久模式" : "会话模式", "\uFF09"));
|
|
6475
|
+
} else {
|
|
6476
|
+
// eslint-disable-next-line no-console
|
|
6477
|
+
console.log("💡 提示:使用 window.debugConsole.help() 查看使用说明");
|
|
6478
|
+
}
|
|
6479
|
+
}
|
|
6480
|
+
getStatusDescription() {
|
|
6481
|
+
if (!this.debugMode) {
|
|
6482
|
+
return "调试模式已关闭";
|
|
6483
|
+
}
|
|
6484
|
+
switch (this.debugType) {
|
|
6485
|
+
case "persistent":
|
|
6486
|
+
return "持久模式 - 内部调试(长期有效)";
|
|
6487
|
+
case "session":
|
|
6488
|
+
return "会话模式 - 临时调试(关闭标签页后失效)";
|
|
6489
|
+
default:
|
|
6490
|
+
return "未知模式";
|
|
6491
|
+
}
|
|
6492
|
+
}
|
|
6493
|
+
isDebugMode() {
|
|
6494
|
+
return this.debugMode;
|
|
6495
|
+
}
|
|
6496
|
+
getDebugType() {
|
|
6497
|
+
return this.debugType;
|
|
6498
|
+
}
|
|
6499
|
+
shouldLog(method) {
|
|
6500
|
+
return method === "error" ? true : this.debugMode;
|
|
6501
|
+
}
|
|
6502
|
+
}
|
|
6503
|
+
_defineProperty$1(DebugManager, "instance", void 0);
|
|
6504
|
+
var debugManager = DebugManager.getInstance();
|
|
6505
|
+
|
|
6331
6506
|
function bindListeners(brick, eventsMap, context) {
|
|
6332
6507
|
Object.entries(eventsMap).forEach(_ref => {
|
|
6333
6508
|
var [eventType, handlers] = _ref;
|
|
@@ -6993,6 +7168,13 @@ function builtinConsoleListenerFactory(method, args, ifContainer, context, runti
|
|
|
6993
7168
|
}), runtimeBrick)) {
|
|
6994
7169
|
return;
|
|
6995
7170
|
}
|
|
7171
|
+
var isProduction = process.env.NODE_ENV === "production";
|
|
7172
|
+
|
|
7173
|
+
// 生产环境下,只有调试模式开启且符合日志级别才输出
|
|
7174
|
+
if (isProduction && !debugManager.shouldLog(method)) {
|
|
7175
|
+
return;
|
|
7176
|
+
}
|
|
7177
|
+
|
|
6996
7178
|
// eslint-disable-next-line no-console
|
|
6997
7179
|
console[method](...argsFactory(args, context, event, {
|
|
6998
7180
|
useEventAsDefault: true
|