hooks.js 8.2 KB

1
  1. const _0x451b=['throwError','defineProperty','cocos_uid','find','Building\x20Time','packageName','enable','pUseType','sdkhUbServiceIntegrationSuccess','test','readServiceList','huaweiServiceIntegrationFailed','onBeforeCompressSettings','csFile','updateConfigInfos','getUserData','client','网络异常,您的服务将不会被集成,请检查后重试','cocos-service','huaweiServiceIntegrationSuccess','sdkhub$$','__esModule','onAfterInit','warn','onAfterCompressSettings','settings/agconnect-services.json','push','has','clear','length','service-sdkhub','csAnalytics','sdkhUbServiceIntegrationFailed','onBeforeBuild','isLogin','checkCocosService','service_component_name','sdkHubConfig','csUtil','use\x20strict','builder','processCommonNativeModule','fs-extra','serviceIntegrationFailed','getPlatformID','substr','onAfterBuild','get','message','services','csConfig','set','app_id','sort','service_id','path','packages','../../utils'];(function(_0x12268e,_0x57e60a){const _0x451bfa=function(_0x407c09){while(--_0x407c09){_0x12268e['push'](_0x12268e['shift']());}};_0x451bfa(++_0x57e60a);}(_0x451b,0x1b8));const _0x407c=function(_0x12268e,_0x57e60a){_0x12268e=_0x12268e-0xdc;let _0x451bfa=_0x451b[_0x12268e];return _0x451bfa;};const _0x36cb3=_0x407c,_0x51b4=[_0x36cb3(0x100),_0x36cb3(0x109),_0x36cb3(0xf9),_0x36cb3(0xf3),_0x36cb3(0x113),_0x36cb3(0xe8),_0x36cb3(0x102),'getProjectPath',_0x36cb3(0x10d),_0x36cb3(0xfa),'csEditor',_0x36cb3(0x104),_0x36cb3(0xe5),_0x36cb3(0xf5),_0x36cb3(0xef),_0x36cb3(0x115),_0x36cb3(0xf6),'readBindGame',_0x36cb3(0xff),_0x36cb3(0xf8),_0x36cb3(0xed),'stringify',_0x36cb3(0xf2),_0x36cb3(0x114),_0x36cb3(0xf0),'require','onAfterCompressSettings',_0x36cb3(0xfc),_0x36cb3(0x10a),_0x36cb3(0xdd),'readJson','plugins',_0x36cb3(0xfb),_0x36cb3(0xea),'./common','csConfig','join','csLogger',_0x36cb3(0xe2),_0x36cb3(0xdf),_0x36cb3(0x110),_0x36cb3(0x112),_0x36cb3(0xe0),'serviceIntegrationSuccess','existsSync',_0x36cb3(0xe6),_0x36cb3(0xdc),_0x36cb3(0xee),_0x36cb3(0xf7),_0x36cb3(0x107),_0x36cb3(0xde),_0x36cb3(0x103),_0x36cb3(0x111),_0x36cb3(0xfe),_0x36cb3(0x108),_0x36cb3(0xe7),_0x36cb3(0xf4)];(function(_0x533ea4,_0x4b7040){const _0x411f9a=function(_0x492620){const _0x3c064f=_0x407c;while(--_0x492620){_0x533ea4[_0x3c064f(0x10e)](_0x533ea4['shift']());}};_0x411f9a(++_0x4b7040);}(_0x51b4,0x16f));const _0xb5f6=function(_0x1c21ee,_0x22d5d4){_0x1c21ee=_0x1c21ee-0x1df;let _0x6aeb4=_0x51b4[_0x1c21ee];return _0x6aeb4;},_0xb86d15=_0xb5f6;_0x36cb3(0xe1),(Object[_0xb86d15(0x20c)](exports,_0xb86d15(0x200),{'value':!0x0}),exports[_0xb86d15(0x204)]=exports[_0xb86d15(0x1e0)]=exports[_0xb86d15(0x1ff)]=exports[_0xb86d15(0x1e2)]=exports[_0x36cb3(0x115)]=exports[_0x36cb3(0xf4)]=void 0x0);const fs_extra_1=require(_0x36cb3(0xe4)),path_1=require(_0x36cb3(0xf1)),utils_1=require(_0xb86d15(0x202)),common_1=require(_0xb86d15(0x1e8));exports[_0xb86d15(0x1fe)]=!0x0;let buildCache=new Map();function compareService(_0xef3afb,_0x211114){const _0x5e1311=_0x36cb3,_0xee44c8=_0xb86d15;return _0xef3afb[_0xee44c8(0x208)]===_0x211114[_0x5e1311(0xfa)]?0x0:_0x211114[_0xee44c8(0x208)]?-0x1:0x1;}let processServiceHooks=async(_0x1be2ef,_0x4b8348,_0x218ed5)=>{const _0x354aca=_0x36cb3,_0x58ef1a=_0xb86d15;try{if(!await utils_1[_0x58ef1a(0x209)][_0x58ef1a(0x1f4)]())return;}catch(_0x5c4f20){return void utils_1[_0x58ef1a(0x1eb)][_0x354aca(0x10b)](_0x354aca(0x105));}let _0xa88d87=_0x1be2ef[_0x58ef1a(0x215)][_0x354aca(0x106)],_0x589539=common_1[_0x58ef1a(0x1f3)](_0x1be2ef);if(void 0x0===_0xa88d87||0x0===_0xa88d87[_0x354aca(0xeb)][_0x58ef1a(0x1fa)])return;_0x58ef1a(0x20e)===_0x218ed5&&buildCache[_0x58ef1a(0x1ee)]();const _0x1c9a2b=_0xa88d87[_0x354aca(0xeb)][_0x58ef1a(0x20d)](compareService);for(const _0x363e67 of _0x1c9a2b){if(!fs_extra_1[_0x58ef1a(0x1f2)](_0x363e67[_0x58ef1a(0x1ec)]))break;let _0x4ab81e=(await utils_1[_0x354aca(0xec)][_0x58ef1a(0x1fb)]())[_0x58ef1a(0x1f6)](_0x24e1df=>_0x24e1df[_0x58ef1a(0x217)]===_0x363e67[_0x58ef1a(0x217)]);buildCache[_0x354aca(0x10f)](_0x363e67[_0x58ef1a(0x1f8)])||buildCache[_0x58ef1a(0x213)](_0x363e67['service_component_name'],utils_1[_0x58ef1a(0x1f0)][_0x58ef1a(0x1df)](_0x363e67[_0x58ef1a(0x1ec)]));let _0x1846f8=buildCache[_0x354aca(0xe9)](_0x363e67[_0x58ef1a(0x1f8)]);if(void 0x0===_0x1846f8)break;try{switch(_0x218ed5){case _0x58ef1a(0x1e2):_0x1846f8[_0x354aca(0x10a)]&&await _0x1846f8[_0x58ef1a(0x1e2)](_0x1be2ef,_0x4b8348);break;case _0x354aca(0x115):_0x1846f8[_0x58ef1a(0x20e)]&&await _0x1846f8[_0x58ef1a(0x20e)](_0x1be2ef,_0x4b8348);break;case _0x354aca(0x100):_0x1846f8[_0x58ef1a(0x1ff)]&&await _0x1846f8[_0x354aca(0x100)](_0x1be2ef,_0x4b8348);break;case _0x58ef1a(0x1e0):_0x1846f8[_0x58ef1a(0x1e0)]&&await _0x1846f8[_0x354aca(0x10c)](_0x1be2ef,_0x4b8348);break;case _0x58ef1a(0x204):_0x1846f8['onAfterBuild']&&await _0x1846f8[_0x58ef1a(0x204)](_0x1be2ef,_0x4b8348),_0x4ab81e&&processServiceIntegration(_0x589539,_0x4ab81e,_0x1be2ef);}}catch(_0x25acf2){throw _0x4ab81e&&processServiceIntegration(_0x589539,_0x4ab81e,_0x1be2ef,(_0x25acf2 instanceof Error?_0x25acf2[_0x58ef1a(0x1e7)]:JSON[_0x58ef1a(0x214)](_0x25acf2))||''),_0x25acf2;}}};async function onBeforeBuild(_0x52feab,_0x28ac84){const _0x4161de=_0xb86d15;await common_1[_0x4161de(0x1e3)](_0x52feab)&&(await common_1[_0x4161de(0x205)](_0x52feab),await processServiceHooks(_0x52feab,_0x28ac84,_0x4161de(0x20e)));}async function onAfterInit(_0x30070b,_0x3056c8){const _0x34d41f=_0xb86d15;await common_1[_0x34d41f(0x1e3)](_0x30070b)&&await processServiceHooks(_0x30070b,_0x3056c8,_0x34d41f(0x1e2));}async function onBeforeCompressSettings(_0x132907,_0x1247e5){const _0x1d5ab7=_0xb86d15;await common_1[_0x1d5ab7(0x1e3)](_0x132907)&&await processServiceHooks(_0x132907,_0x1247e5,'onBeforeCompressSettings');}async function onAfterCompressSettings(_0x965924,_0x43b1e9){const _0x4a1409=_0x36cb3,_0x4e1d04=_0xb86d15;await common_1[_0x4e1d04(0x1e3)](_0x965924)&&(common_1[_0x4a1409(0xe3)](_0x43b1e9),await processServiceHooks(_0x965924,_0x43b1e9,_0x4e1d04(0x1e0)));}async function onAfterBuild(_0x5d2963,_0x19f868){const _0x38f0b1=_0x36cb3,_0x2a7d78=_0xb86d15;await common_1[_0x2a7d78(0x1e3)](_0x5d2963)&&await processServiceHooks(_0x5d2963,_0x19f868,_0x38f0b1(0xe8));}async function processServiceIntegration(_0x4f7076,_0xc33857,_0x325313,_0x4f71da){const _0x7ead77=_0x36cb3,_0x234f63=_0xb86d15;let _0x5945bb=(await utils_1[_0x234f63(0x209)][_0x234f63(0x1f9)]())[_0x234f63(0x20f)],_0x45170f=await utils_1[_0x234f63(0x1e9)][_0x234f63(0x210)](),_0x3a405c='',_0x23f825=path_1[_0x234f63(0x1ea)](utils_1[_0x234f63(0x209)][_0x234f63(0x206)](),_0x234f63(0x207));/^service-(agc|hms|sdkhub)/[_0x7ead77(0xfd)](_0xc33857[_0x234f63(0x1f8)])&&fs_extra_1[_0x234f63(0x1f2)](_0x23f825)&&(_0x3a405c=utils_1[_0x7ead77(0x101)][_0x234f63(0x1e4)](_0x23f825)[_0x234f63(0x20a)][_0x234f63(0x1f5)]);let _0x5626de='';if(_0x234f63(0x1ef)===_0xc33857['service_component_name']){let _0x145f59=_0x325313[_0x7ead77(0xf2)][_0x7ead77(0x106)][_0x234f63(0x1ed)];if(_0x145f59&&'{}'!==JSON['stringify'](_0x145f59))for(let _0xabab3e of _0x145f59[_0x234f63(0x1e5)])_0x5626de+=','+_0xabab3e[_0x234f63(0x201)]+':'+_0xabab3e[_0x234f63(0x1e6)];}void 0x0===_0x4f71da?/^service-(agc|hms)/[_0x7ead77(0xfd)](_0xc33857[_0x7ead77(0xde)])?utils_1[_0x234f63(0x203)][_0x234f63(0x1f7)](_0x5945bb,_0x45170f,_0xc33857,_0x4f7076,_0x3a405c,_0x234f63(0x212)):_0x234f63(0x1ef)===_0xc33857[_0x234f63(0x1f8)]?utils_1[_0x234f63(0x203)][_0x234f63(0x1e1)](_0x5945bb,_0x45170f,_0xc33857,_0x4f7076,_0x3a405c,_0x234f63(0x212),_0x234f63(0x1fc)+_0x5626de[_0x234f63(0x1fd)](0x1)):utils_1[_0x234f63(0x203)][_0x234f63(0x1f1)](_0x5945bb,_0x45170f,_0xc33857,_0x4f7076,_0x234f63(0x212)):/^service-(agc|hms)/[_0x7ead77(0xfd)](_0xc33857[_0x7ead77(0xde)])?utils_1[_0x7ead77(0x113)][_0x234f63(0x211)](_0x5945bb,_0x45170f,_0xc33857,_0x4f7076,_0x3a405c,_0x234f63(0x212),_0x4f71da):_0x234f63(0x1ef)===_0xc33857[_0x234f63(0x1f8)]?utils_1[_0x234f63(0x203)][_0x234f63(0x216)](_0x5945bb,_0x45170f,_0xc33857,_0x4f7076,_0x3a405c,_0x7ead77(0xf8),_0x7ead77(0x108)+_0x5626de['substr'](0x1),_0x4f71da):utils_1[_0x234f63(0x203)][_0x234f63(0x20b)](_0x5945bb,_0x45170f,_0xc33857,_0x4f7076,_0x234f63(0x212),_0x4f71da);}exports[_0xb86d15(0x20e)]=onBeforeBuild,exports[_0xb86d15(0x1e2)]=onAfterInit,exports['onBeforeCompressSettings']=onBeforeCompressSettings,exports[_0x36cb3(0x10c)]=onAfterCompressSettings,exports[_0xb86d15(0x204)]=onAfterBuild;