@lovrabet/cli 1.1.26-beta.8 → 1.1.26-beta.9
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/lib/add-page/input-page-router.js +1 -1
- package/lib/add-page/main.js +1 -1
- package/lib/add-page/select-page-template.js +1 -1
- package/lib/api/api-doc-ui.js +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-pull-ui.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/main.js +1 -1
- package/lib/api/pull-silent.js +1 -1
- package/lib/app-menu/app-menu-sync-ui.js +1 -1
- package/lib/app-menu/create-menu.js +1 -1
- package/lib/app-menu/get-local-pages.js +1 -1
- package/lib/app-menu/get-online-menu-list.js +1 -1
- package/lib/app-menu/use-get-online-menu-list.js +1 -1
- package/lib/app-menu/utils.js +1 -1
- package/lib/app-menu/valid-url.js +1 -1
- package/lib/app-menu-cdn-version/app-menu-sync-cdn-version-ui.js +1 -1
- package/lib/app-menu-cdn-version/cdn-url-compare-table.js +1 -1
- package/lib/app-menu-cdn-version/update-menu-cdn-url.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/cmd/build-watch.js +1 -1
- package/lib/cmd/build.js +1 -1
- package/lib/cmd/logs.js +1 -1
- package/lib/cmd/preview.js +1 -1
- package/lib/cmd/start.js +1 -1
- package/lib/config/config-help.js +1 -1
- package/lib/config/main.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/create-app/enhanced-guided-create.js +1 -1
- package/lib/create-app/format-elapsed.js +1 -1
- package/lib/create-app/main.js +1 -1
- package/lib/create-app/task-finished.js +1 -1
- package/lib/create-app/task-loading.js +1 -1
- package/lib/create-app/task-running.js +1 -1
- package/lib/create-app/task-time.js +1 -1
- package/lib/create-app/use-copy-project-template.js +1 -1
- package/lib/create-app/use-format-code.js +1 -1
- package/lib/create-app/use-install-dependencies.js +1 -1
- package/lib/help.js +1 -1
- package/lib/init/main.js +1 -1
- package/lib/mcp/cursor.js +1 -1
- package/lib/mcp/main.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/router-updater.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/package.json +1 -1
package/lib/mcp/cursor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
(function(_0x45d277,_0x12a1a8){const _0x1598e8=a50_0x5ba7,_0x32163c=_0x45d277();while(!![]){try{const _0x170079=-parseInt(_0x1598e8(0x97))/0x1+-parseInt(_0x1598e8(0x9e))/0x2*(parseInt(_0x1598e8(0x84))/0x3)+-parseInt(_0x1598e8(0x7a))/0x4*(-parseInt(_0x1598e8(0x9a))/0x5)+parseInt(_0x1598e8(0x9d))/0x6*(parseInt(_0x1598e8(0x90))/0x7)+parseInt(_0x1598e8(0xa1))/0x8*(-parseInt(_0x1598e8(0x73))/0x9)+-parseInt(_0x1598e8(0x8e))/0xa+parseInt(_0x1598e8(0x7d))/0xb;if(_0x170079===_0x12a1a8)break;else _0x32163c['push'](_0x32163c['shift']());}catch(_0x367fef){_0x32163c['push'](_0x32163c['shift']());}}}(a50_0x456f,0x64588));import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{resolve,dirname}from'node:path';function a50_0x5ba7(_0x34ff9f,_0x281f70){const _0x456f36=a50_0x456f();return a50_0x5ba7=function(_0x5ba7d7,_0x5d0979){_0x5ba7d7=_0x5ba7d7-0x72;let _0xc67d4=_0x456f36[_0x5ba7d7];return _0xc67d4;},a50_0x5ba7(_0x34ff9f,_0x281f70);}import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';function a50_0x456f(){const _0x33f5b5=['npx','utf8','9pPEGKk','message','lovrabet-dataset','✓\x20创建\x20mcp.json\x20配置文件','../../templates/rules/lovrabet_rules.mdc.tpl','info','parse','4ktqrnu','error','warn','4427434JjyHZX','未找到\x20appcode\x20配置','解析现有\x20mcp.json\x20失败','配置\x20Cursor\x20MCP\x20失败','复制\x20Cursor\x20Rules\x20文件','mcp-cursor','创建\x20.cursor/rules\x20目录','21lMlfbY','复制\x20Cursor\x20Rules\x20文件失败','配置\x20Cursor\x20MCP\x20成功','✓\x20更新\x20mcp.json\x20配置','\x0a✓\x20Cursor\x20MCP\x20配置成功!','url','appcode','env','mcp.json','错误:\x20配置失败:\x20','2578030GJcBLF','rules','154lPZcsY','\x20\x20-\x20AppCode:\x20','cwd','\x0a现在您可以在\x20Cursor\x20中使用\x20Lovrabet\x20数据集\x20MCP\x20工具了。','✓\x20创建\x20Cursor\x20Rules\x20文件:\x20.cursor/rules/lovrabet_rules.mdc','创建\x20.cursor\x20目录','!\x20Cursor\x20Rules\x20文件已存在,跳过创建,如需重新创建,请删除\x20.cursor/rules/lovrabet_rules.mdc\x20文件','157920jVFtNl','✓\x20创建\x20.cursor\x20目录:\x20','online','1644795itVJDM','.cursor','log','196446KXONBf','150954JhvxYG','lovrabet_rules.mdc','\x0a配置信息:','773416uOUPhH','请重启\x20Cursor\x20以加载新的\x20MCP\x20配置。','exit','mcpServers'];a50_0x456f=function(){return _0x33f5b5;};return a50_0x456f();}import{logger}from'../utils/logger.js';export async function configureCursorMcp(){const _0x41d4fe=a50_0x5ba7;try{const _0x296c70=process[_0x41d4fe(0x92)](),_0xc94bb5=resolve(_0x296c70,_0x41d4fe(0x9b)),_0x4ac284=resolve(_0xc94bb5,_0x41d4fe(0x8c)),_0x3cf17e=readConfig(),_0x1e7e4b=_0x3cf17e[_0x41d4fe(0x8a)]||_0x3cf17e['app'],_0x439480=_0x3cf17e[_0x41d4fe(0x8b)]||_0x41d4fe(0x99);!_0x1e7e4b&&(console['error']('错误:\x20未找到\x20appcode\x20配置,请先运行\x20\x27lovrabet\x20init\x27\x20初始化项目配置'),logger[_0x41d4fe(0x7b)](_0x41d4fe(0x82),_0x41d4fe(0x7e)),process['exit'](0x1));!existsSync(_0xc94bb5)&&(mkdirSync(_0xc94bb5,{'recursive':!![]}),logger[_0x41d4fe(0x78)](_0x41d4fe(0x82),_0x41d4fe(0x95),{'path':_0xc94bb5}),console['log'](_0x41d4fe(0x98)+_0xc94bb5));const _0xfa794c={'command':_0x41d4fe(0xa5),'args':['-y','@lovrabet/dataset-mcp-server'],'env':{'LOVRABET_APP_CODE':String(_0x1e7e4b),'LOVRABET_ENV':String(_0x439480)}};let _0xd8fa7c;if(existsSync(_0x4ac284))try{const _0x640df7=readFileSync(_0x4ac284,_0x41d4fe(0x72));_0xd8fa7c=JSON[_0x41d4fe(0x79)](_0x640df7),!_0xd8fa7c[_0x41d4fe(0xa4)]&&(_0xd8fa7c[_0x41d4fe(0xa4)]={}),_0xd8fa7c['mcpServers'][_0x41d4fe(0x75)]=_0xfa794c,logger[_0x41d4fe(0x78)]('mcp-cursor','更新现有\x20mcp.json\x20配置',{'path':_0x4ac284,'appcode':_0x1e7e4b,'env':_0x439480}),console['log'](_0x41d4fe(0x87));}catch(_0x248522){logger[_0x41d4fe(0x7b)]('mcp-cursor',_0x41d4fe(0x7f),{'error':_0x248522 instanceof Error?_0x248522['message']:String(_0x248522)}),console[_0x41d4fe(0x7b)]('错误:\x20解析现有\x20mcp.json\x20失败:\x20'+(_0x248522 instanceof Error?_0x248522['message']:String(_0x248522))),process[_0x41d4fe(0xa3)](0x1);}else _0xd8fa7c={'mcpServers':{'lovrabet-dataset':_0xfa794c}},logger[_0x41d4fe(0x78)](_0x41d4fe(0x82),'创建新的\x20mcp.json\x20配置',{'path':_0x4ac284,'appcode':_0x1e7e4b,'env':_0x439480}),console[_0x41d4fe(0x9c)](_0x41d4fe(0x76));writeFileSync(_0x4ac284,JSON['stringify'](_0xd8fa7c,null,0x2),{'encoding':'utf8'});const _0x1f7750=resolve(_0xc94bb5,_0x41d4fe(0x8f)),_0x38d606=resolve(_0x1f7750,_0x41d4fe(0x9f));if(!existsSync(_0x38d606))try{!existsSync(_0x1f7750)&&(mkdirSync(_0x1f7750,{'recursive':!![]}),logger[_0x41d4fe(0x78)](_0x41d4fe(0x82),_0x41d4fe(0x83),{'path':_0x1f7750}));const _0xbccd02=fileURLToPath(import.meta[_0x41d4fe(0x89)]),_0x1e81cb=dirname(_0xbccd02),_0x1decac=resolve(_0x1e81cb,_0x41d4fe(0x77));existsSync(_0x1decac)?(copyFileSync(_0x1decac,_0x38d606),logger[_0x41d4fe(0x78)](_0x41d4fe(0x82),_0x41d4fe(0x81),{'from':_0x1decac,'to':_0x38d606}),console['log'](_0x41d4fe(0x94))):logger[_0x41d4fe(0x7c)](_0x41d4fe(0x82),'Cursor\x20Rules\x20模板文件不存在',{'templatePath':_0x1decac});}catch(_0x4d09d5){logger[_0x41d4fe(0x7b)](_0x41d4fe(0x82),_0x41d4fe(0x85),{'error':_0x4d09d5 instanceof Error?_0x4d09d5[_0x41d4fe(0x74)]:String(_0x4d09d5)}),console[_0x41d4fe(0x7c)]('警告:\x20复制\x20Cursor\x20Rules\x20文件失败:\x20'+(_0x4d09d5 instanceof Error?_0x4d09d5[_0x41d4fe(0x74)]:String(_0x4d09d5)));}else console[_0x41d4fe(0x9c)](_0x41d4fe(0x96)),logger[_0x41d4fe(0x78)]('mcp-cursor','Cursor\x20Rules\x20文件已存在,跳过',{'path':_0x38d606});console[_0x41d4fe(0x9c)](_0x41d4fe(0x88)),console[_0x41d4fe(0x9c)](_0x41d4fe(0xa0)),console[_0x41d4fe(0x9c)](_0x41d4fe(0x91)+_0x1e7e4b),console[_0x41d4fe(0x9c)]('\x20\x20-\x20环境:\x20'+_0x439480),console[_0x41d4fe(0x9c)]('\x20\x20-\x20配置文件:\x20'+_0x4ac284),console[_0x41d4fe(0x9c)](_0x41d4fe(0x93)),console[_0x41d4fe(0x9c)](_0x41d4fe(0xa2)),logger[_0x41d4fe(0x78)]('mcp-cursor',_0x41d4fe(0x86),{'appcode':_0x1e7e4b,'env':_0x439480,'configPath':_0x4ac284}),process['exit'](0x0);}catch(_0x8f3d3c){logger[_0x41d4fe(0x7b)](_0x41d4fe(0x82),_0x41d4fe(0x80),{'error':_0x8f3d3c instanceof Error?_0x8f3d3c[_0x41d4fe(0x74)]:String(_0x8f3d3c)}),console[_0x41d4fe(0x7b)](_0x41d4fe(0x8d)+(_0x8f3d3c instanceof Error?_0x8f3d3c['message']:String(_0x8f3d3c))),process[_0x41d4fe(0xa3)](0x1);}}
|
package/lib/mcp/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a51_0x1df5(){var _0x359eaf=['info','6223008munVAS','log','4410732BohUgQ','\x0a使用方法:','227046bMzGHo','3OjLNcj','\x0a示例:','执行配置\x20Cursor\x20MCP\x20命令','错误:\x20不支持的\x20IDE\x20类型:\x20','2809570viGcbq','cwd','8941572NzNwhw','3WKTmcW','\x0a当前支持的\x20IDE:','未指定\x20IDE\x20类型','\x20\x20lovrabet\x20mcp\x20cursor','mcp','\x20\x20lovrabet\x20mcp\x20cursor\x20\x20\x20\x20配置\x20Cursor\x20的\x20MCP','不支持的\x20IDE\x20类型:\x20','\x20\x20-\x20cursor','36582670uhwAwy','error','setLogPath','错误:\x20请指定\x20IDE\x20类型','exit','8238072UMppdy','7mUNGyc'];a51_0x1df5=function(){return _0x359eaf;};return a51_0x1df5();}(function(_0x1d9e33,_0x189c81){var _0x826eb1=a51_0x4866,_0x44c3a6=_0x1d9e33();while(!![]){try{var _0x3d34d0=parseInt(_0x826eb1(0x135))/0x1*(parseInt(_0x826eb1(0x149))/0x2)+parseInt(_0x826eb1(0x14a))/0x3*(-parseInt(_0x826eb1(0x147))/0x4)+-parseInt(_0x826eb1(0x132))/0x5+-parseInt(_0x826eb1(0x142))/0x6*(parseInt(_0x826eb1(0x143))/0x7)+parseInt(_0x826eb1(0x145))/0x8+-parseInt(_0x826eb1(0x134))/0x9+parseInt(_0x826eb1(0x13d))/0xa;if(_0x3d34d0===_0x189c81)break;else _0x44c3a6['push'](_0x44c3a6['shift']());}catch(_0x432b1c){_0x44c3a6['push'](_0x44c3a6['shift']());}}}(a51_0x1df5,0xb607b));import{configureCursorMcp}from'./cursor.js';import{logger}from'../utils/logger.js';function a51_0x4866(_0x3c1e39,_0x5a21e7){var _0x1df5a5=a51_0x1df5();return a51_0x4866=function(_0x48669d,_0x504468){_0x48669d=_0x48669d-0x132;var _0x4f3ba9=_0x1df5a5[_0x48669d];return _0x4f3ba9;},a51_0x4866(_0x3c1e39,_0x5a21e7);}export async function mcpCommand(_0xc82282){var _0x321367=a51_0x4866;logger[_0x321367(0x13f)](process[_0x321367(0x133)]());if(!_0xc82282){console['error'](_0x321367(0x140)),console[_0x321367(0x146)](_0x321367(0x148)),console[_0x321367(0x146)](_0x321367(0x13a)),console[_0x321367(0x146)](_0x321367(0x14b)),console[_0x321367(0x146)](_0x321367(0x138)),logger[_0x321367(0x13e)](_0x321367(0x139),_0x321367(0x137)),process[_0x321367(0x141)](0x1);return;}switch(_0xc82282['toLowerCase']()){case'cursor':logger[_0x321367(0x144)](_0x321367(0x139),_0x321367(0x14c)),await configureCursorMcp();break;default:console[_0x321367(0x13e)](_0x321367(0x14d)+_0xc82282),console[_0x321367(0x146)](_0x321367(0x136)),console[_0x321367(0x146)](_0x321367(0x13c)),logger['error'](_0x321367(0x139),_0x321367(0x13b)+_0xc82282),process['exit'](0x1);break;}}
|
package/lib/utils/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a52_0x2d8895=a52_0x1e57;function a52_0x1a15(){const _0x159f3c=['string','8lYbNEk','942957ryrAas','279823SlhORo','utf8','242242kXOERr','1347311apLJul','trim','482988QpPRqs','cwd','appcode','.lovrabetrc','app','123130MsMiSz','822984nqwENC','64wXygLQ','parse'];a52_0x1a15=function(){return _0x159f3c;};return a52_0x1a15();}(function(_0x219422,_0x1aa7a8){const _0x5f07b6=a52_0x1e57,_0x229e98=_0x219422();while(!![]){try{const _0x18f5f1=-parseInt(_0x5f07b6(0xbc))/0x1+-parseInt(_0x5f07b6(0xbe))/0x2+-parseInt(_0x5f07b6(0xc1))/0x3+-parseInt(_0x5f07b6(0xba))/0x4*(parseInt(_0x5f07b6(0xc6))/0x5)+parseInt(_0x5f07b6(0xc7))/0x6+-parseInt(_0x5f07b6(0xbf))/0x7+-parseInt(_0x5f07b6(0xc8))/0x8*(-parseInt(_0x5f07b6(0xbb))/0x9);if(_0x18f5f1===_0x1aa7a8)break;else _0x229e98['push'](_0x229e98['shift']());}catch(_0x47aa93){_0x229e98['push'](_0x229e98['shift']());}}}(a52_0x1a15,0x29ea3));import{existsSync,readFileSync}from'node:fs';import{resolve}from'node:path';import{homedir}from'node:os';export const projectConfigPath=resolve(process[a52_0x2d8895(0xc2)](),a52_0x2d8895(0xc4));function a52_0x1e57(_0x1a00a4,_0x131c9c){const _0x1a158a=a52_0x1a15();return a52_0x1e57=function(_0x1e5763,_0x15de03){_0x1e5763=_0x1e5763-0xb9;let _0x2cf158=_0x1a158a[_0x1e5763];return _0x2cf158;},a52_0x1e57(_0x1a00a4,_0x131c9c);}export const globalConfigPath=resolve(homedir(),a52_0x2d8895(0xc4));export function readConfig(){const _0x4d18c8=a52_0x2d8895;let _0x1e77d8={};try{if(existsSync(globalConfigPath)){const _0xe7cb4e=readFileSync(globalConfigPath,{'encoding':_0x4d18c8(0xbd)});_0xe7cb4e&&(_0x1e77d8=JSON[_0x4d18c8(0xc9)](_0xe7cb4e));}}catch(_0x360e78){}try{if(existsSync(projectConfigPath)){const _0x48972c=readFileSync(projectConfigPath,{'encoding':_0x4d18c8(0xbd)});if(_0x48972c){const _0x4a00f2=JSON[_0x4d18c8(0xc9)](_0x48972c);_0x1e77d8={..._0x1e77d8,..._0x4a00f2};}}}catch(_0x3e0762){}return _0x1e77d8;}export function getConfigAppCode(){const _0x246255=a52_0x2d8895;let _0x18961b={},_0x2231a5={};try{if(existsSync(globalConfigPath)){const _0x1cfa58=readFileSync(globalConfigPath,{'encoding':_0x246255(0xbd)});_0x1cfa58&&(_0x2231a5=JSON['parse'](_0x1cfa58));}}catch(_0x1a33dd){}try{if(existsSync(projectConfigPath)){const _0x4db060=readFileSync(projectConfigPath,{'encoding':_0x246255(0xbd)});_0x4db060&&(_0x18961b=JSON[_0x246255(0xc9)](_0x4db060));}}catch(_0x4eedb4){}let _0x99b77c;if(_0x246255(0xc3)in _0x18961b)_0x99b77c=_0x18961b[_0x246255(0xc3)];else{if('app'in _0x18961b)_0x99b77c=_0x18961b[_0x246255(0xc5)];else{if(_0x246255(0xc3)in _0x2231a5)_0x99b77c=_0x2231a5[_0x246255(0xc3)];else _0x246255(0xc5)in _0x2231a5&&(_0x99b77c=_0x2231a5[_0x246255(0xc5)]);}}if(typeof _0x99b77c!==_0x246255(0xb9)||_0x99b77c[_0x246255(0xc0)]()==='')return undefined;return _0x99b77c;}export function isInProject(){return existsSync(projectConfigPath);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x59526f,_0x52f3f9){const _0x32442b=a53_0x3185,_0x23f3d7=_0x59526f();while(!![]){try{const _0x20342e=-parseInt(_0x32442b(0x1fd))/0x1+-parseInt(_0x32442b(0x1f5))/0x2+-parseInt(_0x32442b(0x1f9))/0x3*(-parseInt(_0x32442b(0x1f3))/0x4)+-parseInt(_0x32442b(0x1ef))/0x5*(-parseInt(_0x32442b(0x200))/0x6)+-parseInt(_0x32442b(0x1f4))/0x7+-parseInt(_0x32442b(0x1fa))/0x8*(parseInt(_0x32442b(0x1fb))/0x9)+parseInt(_0x32442b(0x1f8))/0xa*(parseInt(_0x32442b(0x1f0))/0xb);if(_0x20342e===_0x52f3f9)break;else _0x23f3d7['push'](_0x23f3d7['shift']());}catch(_0x4787b5){_0x23f3d7['push'](_0x23f3d7['shift']());}}}(a53_0x33d8,0xcb21e));function a53_0x3185(_0x129f89,_0x477458){const _0x33d8fe=a53_0x33d8();return a53_0x3185=function(_0x318553,_0x87f576){_0x318553=_0x318553-0x1ef;let _0x191f30=_0x33d8fe[_0x318553];return _0x191f30;},a53_0x3185(_0x129f89,_0x477458);}import a53_0x2b36ba from'node:path';function a53_0x33d8(){const _0xd9742f=['213RbaQwW','139256FkUAbb','36wQTRPS','readdirSync','1281571ZUJmgT','copyFileSync','isDirectory','24918izlYZu','error','1400lnRISe','9911JVLMWi','name','mkdirSync','344KSiYer','10862838pgXjBF','2380304mYHRET','复制目录时出错:','join','41690sdDCyL'];a53_0x33d8=function(){return _0xd9742f;};return a53_0x33d8();}import a53_0x1455b7 from'node:fs';export async function copyDirectory(_0xa8f157,_0x3874b6){const _0x2d3ecd=a53_0x3185;try{const _0x50dcc1=a53_0x1455b7[_0x2d3ecd(0x1fc)](_0xa8f157,{'withFileTypes':!![]});a53_0x1455b7[_0x2d3ecd(0x1f2)](_0x3874b6,{'recursive':!![]});for(const _0x424ec6 of _0x50dcc1){const _0x42a5ca=a53_0x2b36ba[_0x2d3ecd(0x1f7)](_0xa8f157,_0x424ec6[_0x2d3ecd(0x1f1)]),_0x54227b=a53_0x2b36ba[_0x2d3ecd(0x1f7)](_0x3874b6,_0x424ec6['name']);_0x424ec6[_0x2d3ecd(0x1ff)]()?await copyDirectory(_0x42a5ca,_0x54227b):a53_0x1455b7[_0x2d3ecd(0x1fe)](_0x42a5ca,_0x54227b);}}catch(_0x54df75){console[_0x2d3ecd(0x201)](_0x2d3ecd(0x1f6),_0x54df75);}}
|
package/lib/utils/http-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3e3e75,_0x5adace){const _0x5dc82c=a54_0x24e0,_0xcbd41=_0x3e3e75();while(!![]){try{const _0x39311c=-parseInt(_0x5dc82c(0xc2))/0x1+parseInt(_0x5dc82c(0xcc))/0x2+parseInt(_0x5dc82c(0xc5))/0x3+-parseInt(_0x5dc82c(0xc1))/0x4*(-parseInt(_0x5dc82c(0xd6))/0x5)+-parseInt(_0x5dc82c(0xc7))/0x6*(-parseInt(_0x5dc82c(0xce))/0x7)+parseInt(_0x5dc82c(0xc3))/0x8+-parseInt(_0x5dc82c(0xcf))/0x9;if(_0x39311c===_0x5adace)break;else _0xcbd41['push'](_0xcbd41['shift']());}catch(_0x5c0add){_0xcbd41['push'](_0xcbd41['shift']());}}}(a54_0x3ca5,0x3547f));function a54_0x3ca5(){const _0x20a1ff=['150702vKHwJL','fetch','name','url','*\x20请求失败,','594882fEpVhC','get','70pAJqEo','8012457bCmWUl','text','abort','headers','AbortError','content-type','TypeError','1031170kIofwh','ENOTFOUND','signal','message','application/json','log','\x20次重试...','includes','4QWUBvb','248580JfYKGl','2085144eOwdHj','json','1024812YmIwva','Request\x20failed'];a54_0x3ca5=function(){return _0x20a1ff;};return a54_0x3ca5();}export async function httpRequest(_0x207c59,_0x155a43={}){const _0x521055=a54_0x24e0,{timeout:timeout=0x7530,retries:retries=0x3,retryDelay:retryDelay=0x3e8,headers:headers={}}=_0x155a43;let _0x40e4fc=null;for(let _0x4d7b77=0x0;_0x4d7b77<=retries;_0x4d7b77++){try{const _0x1e8b06=new AbortController(),_0x275009=setTimeout(()=>_0x1e8b06[_0x521055(0xd1)](),timeout),_0x41a349=await fetch(_0x207c59,{'headers':headers,'signal':_0x1e8b06[_0x521055(0xbb)]});clearTimeout(_0x275009);let _0x1b46db;const _0x479d1e=_0x41a349[_0x521055(0xd2)][_0x521055(0xcd)](_0x521055(0xd4));return _0x479d1e?.['includes'](_0x521055(0xbd))?_0x1b46db=await _0x41a349[_0x521055(0xc4)]():_0x1b46db=await _0x41a349[_0x521055(0xd0)](),{'ok':_0x41a349['ok'],'status':_0x41a349['status'],'statusText':_0x41a349['statusText'],'data':_0x1b46db,'headers':_0x41a349['headers'],'url':_0x41a349[_0x521055(0xca)],'text':()=>_0x41a349[_0x521055(0xd0)]()};}catch(_0x55392b){_0x40e4fc=_0x55392b instanceof Error?_0x55392b:new Error(String(_0x55392b));if(_0x4d7b77===retries)break;if(shouldRetry(_0x55392b)){console[_0x521055(0xbe)](_0x521055(0xcb)+retryDelay+'ms\x20后进行第\x20'+(_0x4d7b77+0x1)+_0x521055(0xbf)),await sleep(retryDelay);continue;}else break;}}throw _0x40e4fc||new Error(_0x521055(0xc6));}function shouldRetry(_0x302331){const _0x133572=a54_0x24e0;if(_0x302331 instanceof Error){if(_0x302331[_0x133572(0xc9)]===_0x133572(0xd3))return![];if(_0x302331[_0x133572(0xc9)]===_0x133572(0xd5)&&_0x302331[_0x133572(0xbc)][_0x133572(0xc0)](_0x133572(0xc8)))return!![];if(_0x302331[_0x133572(0xbc)][_0x133572(0xc0)]('ECONNRESET'))return!![];if(_0x302331[_0x133572(0xbc)]['includes'](_0x133572(0xd7)))return![];}return![];}function sleep(_0x117449){return new Promise(_0x21f3d3=>setTimeout(_0x21f3d3,_0x117449));}function a54_0x24e0(_0x430ee3,_0x199917){const _0x3ca509=a54_0x3ca5();return a54_0x24e0=function(_0x24e039,_0x3adef3){_0x24e039=_0x24e039-0xbb;let _0x23b1bc=_0x3ca509[_0x24e039];return _0x23b1bc;},a54_0x24e0(_0x430ee3,_0x199917);}export function validateUrl(_0x1e3ee8){try{return new URL(_0x1e3ee8),!![];}catch{return![];}}
|
package/lib/utils/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a55_0x5b468f=a55_0x67d9;(function(_0x350aa0,_0x3d6f7b){const _0x52de3b=a55_0x67d9,_0x4d5aaa=_0x350aa0();while(!![]){try{const _0x91bbbc=-parseInt(_0x52de3b(0x1a0))/0x1+-parseInt(_0x52de3b(0x1bb))/0x2+-parseInt(_0x52de3b(0x197))/0x3+-parseInt(_0x52de3b(0x1a2))/0x4+parseInt(_0x52de3b(0x18f))/0x5+parseInt(_0x52de3b(0x19b))/0x6*(-parseInt(_0x52de3b(0x1ac))/0x7)+parseInt(_0x52de3b(0x1c3))/0x8*(parseInt(_0x52de3b(0x18c))/0x9);if(_0x91bbbc===_0x3d6f7b)break;else _0x4d5aaa['push'](_0x4d5aaa['shift']());}catch(_0x4fd68c){_0x4d5aaa['push'](_0x4d5aaa['shift']());}}}(a55_0x1594,0xd24f7));import a55_0xeafb44 from'winston';import a55_0x584492 from'node:fs';import a55_0x1ec65a from'node:path';class Logger{[a55_0x5b468f(0x1ae)];[a55_0x5b468f(0x1a6)];[a55_0x5b468f(0x1b2)]='';constructor(){const _0x427dd3=a55_0x5b468f;this[_0x427dd3(0x1a6)]='';}[a55_0x5b468f(0x191)](_0x28891e){const _0x55f1bf=a55_0x5b468f;this[_0x55f1bf(0x1b2)]=_0x28891e;}[a55_0x5b468f(0x1a5)](){const _0xdd44e0=a55_0x5b468f,_0x5d2303=a55_0x1ec65a['dirname'](this[_0xdd44e0(0x1a6)]);!a55_0x584492['existsSync'](_0x5d2303)&&a55_0x584492[_0xdd44e0(0x198)](_0x5d2303,{'recursive':!![]});const _0x27e85b=a55_0xeafb44[_0xdd44e0(0x1b0)]['combine'](a55_0xeafb44['format'][_0xdd44e0(0x1b4)](),a55_0xeafb44[_0xdd44e0(0x1b0)]['errors']({'stack':!![]}),a55_0xeafb44[_0xdd44e0(0x1b0)][_0xdd44e0(0x19f)](_0x41d7ce=>{const _0x59730f=_0xdd44e0,_0x5d8afc={'timestamp':_0x41d7ce[_0x59730f(0x1b4)]||new Date()[_0x59730f(0x1c1)](),'level':_0x41d7ce[_0x59730f(0x1bd)]||'info','command':_0x41d7ce[_0x59730f(0x195)]||'unknown','rawCommand':_0x41d7ce[_0x59730f(0x1ab)]||this[_0x59730f(0x1b2)]||undefined,'message':_0x41d7ce[_0x59730f(0x19e)]||'','duration':_0x41d7ce['duration']||undefined,'details':_0x41d7ce[_0x59730f(0x1a1)]||undefined};return JSON[_0x59730f(0x19a)](_0x5d8afc);}));this[_0xdd44e0(0x1ae)]=a55_0xeafb44[_0xdd44e0(0x19d)]({'level':_0xdd44e0(0x1b9),'format':_0x27e85b,'transports':[new a55_0xeafb44[(_0xdd44e0(0x1c0))][(_0xdd44e0(0x1a4))]({'filename':this[_0xdd44e0(0x1a6)],'level':_0xdd44e0(0x1b9)})],'silent':![]}),a55_0xeafb44[_0xdd44e0(0x199)]({'success':_0xdd44e0(0x193),'error':_0xdd44e0(0x1b3),'warn':_0xdd44e0(0x1a3),'info':_0xdd44e0(0x18e)});}['setLogPath'](_0x674dc4){const _0x2b02d1=a55_0x5b468f;this[_0x2b02d1(0x1a6)]=a55_0x1ec65a[_0x2b02d1(0x1b5)](_0x674dc4,_0x2b02d1(0x1aa)),this[_0x2b02d1(0x1ae)]&&this[_0x2b02d1(0x1ae)][_0x2b02d1(0x1a8)](),this[_0x2b02d1(0x1a5)]();}[a55_0x5b468f(0x1b9)](_0x33582b,_0x272066,_0x507ce1){const _0x86ffbc=a55_0x5b468f;if(!this[_0x86ffbc(0x1a6)]||!this[_0x86ffbc(0x1ae)])return;this[_0x86ffbc(0x1ae)]['info'](_0x272066,{'command':_0x33582b,'details':_0x507ce1});}[a55_0x5b468f(0x194)](_0x261e89,_0x3c9f5c,_0x2b95e5,_0x15a50b){const _0x5b0f5f=a55_0x5b468f;if(!this[_0x5b0f5f(0x1a6)]||!this[_0x5b0f5f(0x1ae)])return;this[_0x5b0f5f(0x1ae)]['log']('info',_0x3c9f5c,{'level':'success','command':_0x261e89,'duration':_0x2b95e5,'details':_0x15a50b});}[a55_0x5b468f(0x1a9)](_0x58698d,_0x30c17a,_0x2d6903){const _0x8168e1=a55_0x5b468f;if(!this[_0x8168e1(0x1a6)]||!this[_0x8168e1(0x1ae)])return;this[_0x8168e1(0x1ae)][_0x8168e1(0x1a9)](_0x30c17a,{'command':_0x58698d,'details':_0x2d6903});}[a55_0x5b468f(0x1b8)](_0xe1b828,_0x5b1245,_0x2ee204){const _0xfa4b5d=a55_0x5b468f;if(!this['logFilePath']||!this[_0xfa4b5d(0x1ae)])return;this[_0xfa4b5d(0x1ae)][_0xfa4b5d(0x1b8)](_0x5b1245,{'command':_0xe1b828,'details':_0x2ee204});}async[a55_0x5b468f(0x1ba)](_0x26a711,_0x5714c6,_0x357bf0){const _0x1d562d=a55_0x5b468f,_0x46e4d5=Date[_0x1d562d(0x1b6)]();this[_0x1d562d(0x1b9)](_0x26a711,'开始执行:\x20'+_0x5714c6);try{const _0x5725bf=await _0x357bf0(),_0x3dcc44=Date[_0x1d562d(0x1b6)]()-_0x46e4d5;return this[_0x1d562d(0x194)](_0x26a711,_0x1d562d(0x190)+_0x5714c6,_0x3dcc44),_0x5725bf;}catch(_0x4e425f){const _0xb7524=Date[_0x1d562d(0x1b6)]()-_0x46e4d5;this[_0x1d562d(0x1a9)](_0x26a711,'失败:\x20'+_0x5714c6,{'error':_0x4e425f instanceof Error?_0x4e425f[_0x1d562d(0x19e)]:String(_0x4e425f),'duration':_0xb7524});throw _0x4e425f;}}[a55_0x5b468f(0x1b7)](){const _0x361e01=a55_0x5b468f;try{if(!a55_0x584492[_0x361e01(0x192)](this['logFilePath']))return[];const _0x21513a=a55_0x584492[_0x361e01(0x19c)](this['logFilePath'],_0x361e01(0x1a7));return _0x21513a[_0x361e01(0x18d)]('\x0a')[_0x361e01(0x1ad)](_0x4a9940=>_0x4a9940['trim']())[_0x361e01(0x1b1)](_0x2628fc=>JSON[_0x361e01(0x1be)](_0x2628fc));}catch(_0x1be175){return console[_0x361e01(0x1b8)](_0x361e01(0x196),_0x1be175),[];}}[a55_0x5b468f(0x1bc)](){const _0x5bcb63=a55_0x5b468f;try{a55_0x584492[_0x5bcb63(0x192)](this[_0x5bcb63(0x1a6)])&&a55_0x584492[_0x5bcb63(0x1c2)](this[_0x5bcb63(0x1a6)],'',_0x5bcb63(0x1a7));}catch(_0x5ef1e8){console[_0x5bcb63(0x1b8)](_0x5bcb63(0x1af),_0x5ef1e8);}}[a55_0x5b468f(0x1bf)](){return this['winstonLogger'];}}function a55_0x1594(){const _0x57a489=['3962368Vgbkji','yellow','File','initWinstonLogger','logFilePath','utf8','clear','error','.lovrabet.log','rawCommand','49hSWJgh','filter','winstonLogger','Failed\x20to\x20clear\x20logs:','format','map','currentRawCommand','red','timestamp','join','now','readLogs','warn','info','logTask','2396524ojKkTr','clearLogs','level','parse','getWinstonInstance','transports','toISOString','writeFileSync','112wjmQiP','3797487yqYcfa','split','blue','5002735luaOQd','完成:\x20','setRawCommand','existsSync','green','success','command','Failed\x20to\x20read\x20logs:','5015379vtJEhV','mkdirSync','addColors','stringify','449214ebFHTR','readFileSync','createLogger','message','printf','1661588FfABNi','details'];a55_0x1594=function(){return _0x57a489;};return a55_0x1594();}function a55_0x67d9(_0x1c44f4,_0x5f213f){const _0x159434=a55_0x1594();return a55_0x67d9=function(_0x67d973,_0x1c647d){_0x67d973=_0x67d973-0x18c;let _0x5cc295=_0x159434[_0x67d973];return _0x5cc295;},a55_0x67d9(_0x1c44f4,_0x5f213f);}export const logger=new Logger();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a56_0x2ef250=a56_0x3cdd;function a56_0x4b61(){const _0x40a68f=['readFile','530360ttgLOG','promises','6bFKLWQ','22978EAEybN','existsSync','error','addImport','routerFilePath','now','toUpperCase','2pMGAMZ','map','addRoute','toComponentName','toLowerCase','\x20from\x20\x22../pages/','utf8','921305mXhSGl','match','路由配置更新完成','50TTClCv','charAt','split','\x22,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20element:\x20<','addPageRoute','\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x22','import\x20','success','885447lCUrPq','开始更新路由配置','377856rVBGqh','join','路由文件不存在:\x20','slice','路由配置更新失败','previewChanges','length','includes','未找到路由配置的\x20children\x20数组','1045268wpxinM','src','router','index','483606QEYJgq'];a56_0x4b61=function(){return _0x40a68f;};return a56_0x4b61();}(function(_0x4bd976,_0x4512f9){const _0x55ca12=a56_0x3cdd,_0x4c93a5=_0x4bd976();while(!![]){try{const _0x2dd701=-parseInt(_0x55ca12(0x17c))/0x1*(-parseInt(_0x55ca12(0x175))/0x2)+-parseInt(_0x55ca12(0x170))/0x3+parseInt(_0x55ca12(0x172))/0x4+-parseInt(_0x55ca12(0x183))/0x5*(parseInt(_0x55ca12(0x174))/0x6)+-parseInt(_0x55ca12(0x16c))/0x7+-parseInt(_0x55ca12(0x163))/0x8+-parseInt(_0x55ca12(0x161))/0x9*(-parseInt(_0x55ca12(0x186))/0xa);if(_0x2dd701===_0x4512f9)break;else _0x4c93a5['push'](_0x4c93a5['shift']());}catch(_0x49efa2){_0x4c93a5['push'](_0x4c93a5['shift']());}}}(a56_0x4b61,0x19bf8));import a56_0x34d8a5 from'node:fs';import a56_0x3b0fe6 from'node:path';function a56_0x3cdd(_0x32732d,_0x243854){const _0x4b61bd=a56_0x4b61();return a56_0x3cdd=function(_0x3cdd21,_0x27e9c4){_0x3cdd21=_0x3cdd21-0x161;let _0x528e31=_0x4b61bd[_0x3cdd21];return _0x528e31;},a56_0x3cdd(_0x32732d,_0x243854);}import{logger}from'./logger.js';export class RouterUpdater{[a56_0x2ef250(0x179)];constructor(_0x36edfb){const _0x4ba485=a56_0x2ef250;this[_0x4ba485(0x179)]=a56_0x3b0fe6[_0x4ba485(0x164)](_0x36edfb,_0x4ba485(0x16d),_0x4ba485(0x16e),'index.tsx');}async[a56_0x2ef250(0x18a)](_0x5dcd98,_0x1e9edb){const _0x4ca219=a56_0x2ef250;if(!a56_0x34d8a5['existsSync'](this[_0x4ca219(0x179)]))throw new Error(_0x4ca219(0x165)+this[_0x4ca219(0x179)]);const _0x2c5ef6=Date[_0x4ca219(0x17a)]();logger['info'](_0x4ca219(0x16e),_0x4ca219(0x162),{'pageName':_0x5dcd98,'routePath':_0x1e9edb,'file':this[_0x4ca219(0x179)]});try{const _0x1176bb=await a56_0x34d8a5['promises'][_0x4ca219(0x171)](this['routerFilePath'],_0x4ca219(0x182)),_0x15e490=this[_0x4ca219(0x17f)](_0x5dcd98),_0x25e8a1=this[_0x4ca219(0x178)](_0x1176bb,_0x15e490,_0x5dcd98),_0x105a74=this['addRoute'](_0x25e8a1,_0x1e9edb,_0x15e490);await a56_0x34d8a5[_0x4ca219(0x173)]['writeFile'](this[_0x4ca219(0x179)],_0x105a74,_0x4ca219(0x182));const _0xe3b378=Date[_0x4ca219(0x17a)]()-_0x2c5ef6;logger[_0x4ca219(0x18d)]('router',_0x4ca219(0x185),_0xe3b378,{'pageName':_0x5dcd98,'routePath':_0x1e9edb,'componentName':_0x15e490});}catch(_0x585414){const _0x1abd06=Date[_0x4ca219(0x17a)]()-_0x2c5ef6;logger[_0x4ca219(0x177)](_0x4ca219(0x16e),_0x4ca219(0x167),{'pageName':_0x5dcd98,'routePath':_0x1e9edb,'error':_0x585414 instanceof Error?_0x585414['message']:String(_0x585414),'duration':_0x1abd06});throw _0x585414;}}[a56_0x2ef250(0x17f)](_0x32456f){const _0x3480cc=a56_0x2ef250;return _0x32456f[_0x3480cc(0x188)]('-')[_0x3480cc(0x17d)](_0xe7d78e=>_0xe7d78e[_0x3480cc(0x187)](0x0)[_0x3480cc(0x17b)]()+_0xe7d78e[_0x3480cc(0x166)](0x1)[_0x3480cc(0x180)]())[_0x3480cc(0x164)]('');}[a56_0x2ef250(0x178)](_0x271fab,_0x35d8cb,_0x14fe2a){const _0x4b8a9b=a56_0x2ef250,_0x550fb0=/import\s+\w+\s+from\s+["']\.\.\/pages\/\w+["'];?\n/g,_0x110379=_0x271fab[_0x4b8a9b(0x184)](_0x550fb0)||[],_0x484181=_0x4b8a9b(0x18c)+_0x35d8cb+_0x4b8a9b(0x181)+_0x14fe2a+'\x22;';if(_0x271fab[_0x4b8a9b(0x16a)](_0x484181))return _0x271fab;if(_0x110379['length']>0x0){const _0x243cdb=_0x110379[_0x110379['length']-0x1];if(_0x243cdb){const _0x342de3=_0x271fab['lastIndexOf'](_0x243cdb),_0x44c822=_0x342de3+_0x243cdb[_0x4b8a9b(0x169)];return _0x271fab[_0x4b8a9b(0x166)](0x0,_0x44c822)+_0x484181+'\x0a'+_0x271fab['slice'](_0x44c822);}}const _0x371386=_0x271fab['match'](/import\s+\w+\s+from\s+["']\.\.\/layouts\/\w+["'];?\n/);if(_0x371386&&_0x371386[_0x4b8a9b(0x16f)]!==undefined){const _0x9f5b0a=_0x371386[_0x4b8a9b(0x16f)]+_0x371386[0x0][_0x4b8a9b(0x169)];return _0x271fab['slice'](0x0,_0x9f5b0a)+_0x484181+'\x0a'+_0x271fab[_0x4b8a9b(0x166)](_0x9f5b0a);}return _0x271fab;}['addRoute'](_0x1a0206,_0x5ed083,_0xea23b){const _0x32c754=a56_0x2ef250,_0x555e13=_0x32c754(0x18b)+_0x5ed083+_0x32c754(0x189)+_0xea23b+'\x20/>,\x0a\x20\x20\x20\x20\x20\x20\x20\x20},';if(_0x1a0206['includes']('path:\x20\x22'+_0x5ed083+'\x22'))return _0x1a0206;const _0x1c324c=/children:\s*\[([\s\S]*?)\]/,_0x2c91c1=_0x1a0206[_0x32c754(0x184)](_0x1c324c);if(!_0x2c91c1||_0x2c91c1[_0x32c754(0x16f)]===undefined)throw new Error(_0x32c754(0x16b));const _0x1bf9dc=_0x2c91c1[0x1],_0x12b966=_0x2c91c1[_0x32c754(0x16f)]+_0x2c91c1[0x0]['indexOf']('[')+0x1,_0x1a3b8b=_0x1bf9dc?.[_0x32c754(0x184)](/\{[\s\S]*?\},/g)||[];if(_0x1a3b8b['length']>0x0){const _0x277fe6=_0x1a3b8b[_0x1a3b8b[_0x32c754(0x169)]-0x1];if(_0x277fe6){const _0x39b19d=_0x1a0206['lastIndexOf'](_0x277fe6),_0x17365a=_0x39b19d+_0x277fe6[_0x32c754(0x169)];return _0x1a0206[_0x32c754(0x166)](0x0,_0x17365a)+'\x0a'+_0x555e13+_0x1a0206[_0x32c754(0x166)](_0x17365a);}}return _0x1a0206[_0x32c754(0x166)](0x0,_0x12b966)+'\x0a'+_0x555e13+_0x1a0206[_0x32c754(0x166)](_0x12b966);}async[a56_0x2ef250(0x168)](_0x18e045,_0x4c5385){const _0x12a6cf=a56_0x2ef250;if(!a56_0x34d8a5[_0x12a6cf(0x176)](this[_0x12a6cf(0x179)]))throw new Error('路由文件不存在:\x20'+this[_0x12a6cf(0x179)]);const _0xae884e=await a56_0x34d8a5[_0x12a6cf(0x173)][_0x12a6cf(0x171)](this['routerFilePath'],_0x12a6cf(0x182)),_0x74fa0d=this[_0x12a6cf(0x17f)](_0x18e045);let _0x47f4af=this[_0x12a6cf(0x178)](_0xae884e,_0x74fa0d,_0x18e045);return _0x47f4af=this[_0x12a6cf(0x17e)](_0x47f4af,_0x4c5385,_0x74fa0d),_0x47f4af;}}
|
package/lib/utils/sleep.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function sleep(
|
|
1
|
+
export function sleep(_0x5db0ba){return new Promise(_0x57dcc2=>setTimeout(_0x57dcc2,_0x5db0ba));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a58_0x181f98=a58_0x1412;function a58_0xbd26(){const _0x2342d8=['360580kPkiML','3BCeyws','模板内容替换完成','replaceApiContent','toLocaleDateString','78Yaxjer','mkdir','includes','.css','toLowerCase','keys','map','48zWCCJl','toDisplayTitle','6019536OmXJSI','join','4420uEYdwd','processTemplate','extname','.ts','api','2-digit','charAt','14113ZtgpZP','copyFile','readFile','utf8','writeFile','promises','replaceContent','name','toISOString','toLocaleString','196RXeorg','1YTPETR','toComponentName','YourModel','isFile','processDirectory','template','toLocaleTimeString','718442ljyUNF','slice','开始处理模板内容替换','toUpperCase','7488207KuxbWU','.jsx','success','isDirectory','numeric','137024vpOWfD','replace','.scss','endsWith','.json','3362356jiRDhG','split','now','.tpl','default','.tsx'];a58_0xbd26=function(){return _0x2342d8;};return a58_0xbd26();}function a58_0x1412(_0x24690f,_0x51a050){const _0xbd2689=a58_0xbd26();return a58_0x1412=function(_0x1412df,_0x3824a2){_0x1412df=_0x1412df-0xc1;let _0x205ddc=_0xbd2689[_0x1412df];return _0x205ddc;},a58_0x1412(_0x24690f,_0x51a050);}(function(_0x127b7f,_0x33459f){const _0x594653=a58_0x1412,_0x460dc0=_0x127b7f();while(!![]){try{const _0x472312=-parseInt(_0x594653(0xe9))/0x1*(parseInt(_0x594653(0xf0))/0x2)+parseInt(_0x594653(0xc8))/0x3*(-parseInt(_0x594653(0xc1))/0x4)+-parseInt(_0x594653(0xc7))/0x5*(-parseInt(_0x594653(0xd3))/0x6)+-parseInt(_0x594653(0xe8))/0x7*(parseInt(_0x594653(0xf9))/0x8)+-parseInt(_0x594653(0xf4))/0x9+parseInt(_0x594653(0xd7))/0xa*(-parseInt(_0x594653(0xde))/0xb)+-parseInt(_0x594653(0xd5))/0xc*(-parseInt(_0x594653(0xcc))/0xd);if(_0x472312===_0x33459f)break;else _0x460dc0['push'](_0x460dc0['shift']());}catch(_0x4a7790){_0x460dc0['push'](_0x460dc0['shift']());}}}(a58_0xbd26,0x7c121));import a58_0x25dcdd from'node:fs';import a58_0x54732c from'node:path';import{logger}from'./logger.js';export class TemplateReplacer{static[a58_0x181f98(0xea)](_0xb10a98){const _0x84af53=a58_0x181f98,_0x288f22=_0xb10a98[_0x84af53(0xc2)]('/')['pop']()||_0xb10a98;return _0x288f22[_0x84af53(0xc2)]('-')[_0x84af53(0xd2)](_0x3dd413=>_0x3dd413[_0x84af53(0xdd)](0x0)[_0x84af53(0xf3)]()+_0x3dd413['slice'](0x1)['toLowerCase']())['join']('');}static[a58_0x181f98(0xd4)](_0x268320){const _0x23b53c=a58_0x181f98,_0x2fcc75=_0x268320[_0x23b53c(0xc2)]('/')['pop']()||_0x268320;return _0x2fcc75[_0x23b53c(0xc2)]('-')[_0x23b53c(0xd2)](_0x399d05=>_0x399d05[_0x23b53c(0xdd)](0x0)[_0x23b53c(0xf3)]()+_0x399d05[_0x23b53c(0xf1)](0x1)[_0x23b53c(0xd0)]())[_0x23b53c(0xd6)]('\x20');}static[a58_0x181f98(0xe4)](_0x39f6c0,_0x165853,_0x40bcc0){const _0x2c89f6=a58_0x181f98,_0x5eb135=this['toComponentName'](_0x165853),_0x3e2b15=this[_0x2c89f6(0xd4)](_0x165853),_0x1609d3=new Date(),_0x4050b5=_0x1609d3[_0x2c89f6(0xe7)](undefined,{'year':_0x2c89f6(0xf8),'month':_0x2c89f6(0xdc),'day':_0x2c89f6(0xdc),'hour':_0x2c89f6(0xdc),'minute':'2-digit','second':'2-digit','hour12':![]})[_0x2c89f6(0xfa)](/\//g,'-'),_0x2be554=_0x1609d3[_0x2c89f6(0xcb)](undefined,{'year':_0x2c89f6(0xf8),'month':'2-digit','day':_0x2c89f6(0xdc)})[_0x2c89f6(0xfa)](/\//g,'-'),_0x2e404f=_0x1609d3[_0x2c89f6(0xef)](undefined,{'hour12':![]});let _0x53b098=_0x39f6c0[_0x2c89f6(0xfa)](/\{ComponentName\}/g,_0x5eb135)[_0x2c89f6(0xfa)](/\{DisplayTitle\}/g,_0x3e2b15)['replace'](/\{PageName\}/g,_0x165853)[_0x2c89f6(0xfa)](/\{TemplateName\}/g,_0x40bcc0)[_0x2c89f6(0xfa)](/\{CreatedAt\}/g,_0x4050b5)[_0x2c89f6(0xfa)](/\{CreatedDate\}/g,_0x2be554)[_0x2c89f6(0xfa)](/\{CreatedTime\}/g,_0x2e404f);return _0x53b098;}static[a58_0x181f98(0xca)](_0x24ff00,_0x1291a0,_0x141819,_0x3a7002,_0x1fe726,_0x21f7da,_0x5ee31b){const _0x5c038a=a58_0x181f98,_0x36115b=new Date(),_0x2fe14f=_0x36115b[_0x5c038a(0xe6)](),_0x3c1d3e=JSON['stringify'](_0x141819,null,0x2)[_0x5c038a(0xc2)]('\x0a')[_0x5c038a(0xf1)](0x1,-0x1)[_0x5c038a(0xd2)](_0x1f8a03=>_0x1f8a03[_0x5c038a(0xfa)](/^ /,'\x20\x20\x20\x20'))[_0x5c038a(0xd6)]('\x0a'),_0xb6eed9=_0x3a7002||Object[_0x5c038a(0xd1)](_0x141819)[0x0]||_0x5c038a(0xeb);let _0x403b88=_0x24ff00[_0x5c038a(0xfa)](/\{AppCode\}/g,_0x1291a0)[_0x5c038a(0xfa)](/\{ModelConfigs\}/g,_0x3c1d3e)['replace'](/\{ExampleModelName\}/g,_0xb6eed9)[_0x5c038a(0xfa)](/\{ApiFileName\}/g,_0x1fe726||_0x5c038a(0xdb))[_0x5c038a(0xfa)](/\{ConfigName\}/g,_0x21f7da||_0x5c038a(0xc5))[_0x5c038a(0xfa)](/\{ClientConfigParam\}/g,_0x5ee31b||'')['replace'](/\{CreatedAt\}/g,_0x2fe14f);return _0x403b88;}static async[a58_0x181f98(0xd8)](_0x58aa1c,_0x3e8664,_0x8ef161,_0x354e37,_0x515424=!![]){const _0x12fdc7=a58_0x181f98,_0x4742fa=Date[_0x12fdc7(0xc3)]();try{_0x515424&&logger['info'](_0x12fdc7(0xee),_0x12fdc7(0xf2),{'templatePath':_0x58aa1c,'targetPath':_0x3e8664,'pageName':_0x8ef161,'templateName':_0x354e37});await a58_0x25dcdd[_0x12fdc7(0xe3)][_0x12fdc7(0xcd)](_0x3e8664,{'recursive':!![]}),await this['processDirectory'](_0x58aa1c,_0x3e8664,_0x8ef161,_0x354e37);if(_0x515424){const _0x42678e=Date[_0x12fdc7(0xc3)]()-_0x4742fa;logger[_0x12fdc7(0xf6)](_0x12fdc7(0xee),_0x12fdc7(0xc9),_0x42678e,{'pageName':_0x8ef161,'templateName':_0x354e37});}}catch(_0x1d980f){if(_0x515424){const _0x1a1f8e=Date[_0x12fdc7(0xc3)]()-_0x4742fa;logger['error'](_0x12fdc7(0xee),'模板内容替换失败',{'templatePath':_0x58aa1c,'targetPath':_0x3e8664,'pageName':_0x8ef161,'templateName':_0x354e37,'error':_0x1d980f instanceof Error?_0x1d980f['message']:String(_0x1d980f),'duration':_0x1a1f8e});}throw _0x1d980f;}}static async['processDirectory'](_0x5e14be,_0x4f66f6,_0x2de6aa,_0x5c24ec){const _0x39b757=a58_0x181f98,_0x470e41=await a58_0x25dcdd[_0x39b757(0xe3)]['readdir'](_0x5e14be,{'withFileTypes':!![]});for(const _0xa676f6 of _0x470e41){const _0xed0925=a58_0x54732c[_0x39b757(0xd6)](_0x5e14be,_0xa676f6[_0x39b757(0xe5)]);let _0x423ed9=a58_0x54732c['join'](_0x4f66f6,_0xa676f6['name']);_0xa676f6[_0x39b757(0xe5)][_0x39b757(0xfc)](_0x39b757(0xc4))&&(_0x423ed9=a58_0x54732c[_0x39b757(0xd6)](_0x4f66f6,_0xa676f6[_0x39b757(0xe5)][_0x39b757(0xfa)](/\.tpl$/,'')));if(_0xa676f6[_0x39b757(0xf7)]())await a58_0x25dcdd[_0x39b757(0xe3)]['mkdir'](_0x423ed9,{'recursive':!![]}),await this[_0x39b757(0xed)](_0xed0925,_0x423ed9,_0x2de6aa,_0x5c24ec);else _0xa676f6[_0x39b757(0xec)]()&&await this['processFile'](_0xed0925,_0x423ed9,_0x2de6aa,_0x5c24ec);}}static async['processFile'](_0x13a1ea,_0x368a94,_0x432c15,_0x2f4c4f){const _0x4c50c4=a58_0x181f98,_0x31387c=a58_0x54732c[_0x4c50c4(0xd9)](_0x13a1ea)['toLowerCase']();_0x13a1ea[_0x4c50c4(0xfc)](_0x4c50c4(0xc4))&&(_0x368a94=_0x368a94[_0x4c50c4(0xfa)](/\.tpl$/,''));const _0x27af83=[_0x4c50c4(0xc6),_0x4c50c4(0xda),_0x4c50c4(0xf5),'.js',_0x4c50c4(0xfd),'.md',_0x4c50c4(0xcf),_0x4c50c4(0xfb),'.tpl'];if(_0x27af83[_0x4c50c4(0xce)](_0x31387c)||_0x13a1ea['endsWith'](_0x4c50c4(0xc4))){const _0x5e86fe=await a58_0x25dcdd[_0x4c50c4(0xe3)][_0x4c50c4(0xe0)](_0x13a1ea,'utf8'),_0x79540=this[_0x4c50c4(0xe4)](_0x5e86fe,_0x432c15,_0x2f4c4f);await a58_0x25dcdd['promises'][_0x4c50c4(0xe2)](_0x368a94,_0x79540,_0x4c50c4(0xe1));}else await a58_0x25dcdd[_0x4c50c4(0xe3)][_0x4c50c4(0xdf)](_0x13a1ea,_0x368a94);}}
|