UNPKG

@quick-game/cli

Version:

Command line interface for rapid qg development

1 lines 24.9 kB
global.GameGlobal=window.global=window,global.wx={};const defineReadOnlyProperty=(e,o,a)=>{try{Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:()=>a,set(e){if(e!==a){if(!e||"onShow"===o||"onHide"===o)return void console.warn(`can not rewrite the property: ${o}`);console.warn(`rewrite the property: ${o}`)}a=e}})}catch(e){console.error(e)}},defineReadOnlyPropertyContain=(e,o,a)=>{try{if(e[o])return;Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:()=>a,set(e){e!==a&&console.warn(`rewrite the property: ${o}`),a=e}})}catch(e){console.error(e)}},typeOf=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),isFunction=e=>"function"===typeOf(e),failCallback=(e={})=>{null===e&&(e={}),isFunction(e.fail)&&e.fail(),isFunction(e.complete)&&e.complete()},successCallback=(e={},o)=>{null===e&&(e={}),isFunction(e.success)&&e.success(o),isFunction(e.complete)&&e.complete()},failList=["openSystemBluetoothSetting","openAppAuthorizeSetting","updateWeChatApp","preDownloadSubpackage","setEnableDebug","restartMiniProgram","navigateToMiniProgram","updateShareMenu","startHandoff","showShareMenu","showShareImageMenu","getShareInfo","checkHandoffEnabled","authPrivateMessage","setMenuStyle","setStatusBarStyle","setWindowSize","setInnerAudioOption","getAvailableAudioSources","previewMedia","chooseMessageFile","saveFileToDisk"];failList.forEach((e=>{defineReadOnlyProperty(global.wx,e,(o=>(console.warn(`-----wx----- 当前不支持该接口 ${e},调用后会回调失败.`),failCallback(o))))}));const nullProp=()=>{},nullList=["onUnhandledRejection","offUnhandledRejection","reportPerformance","getUserCryptoManager","shareAppMessage","setMessageToFriendQuery","setHandoffQuery","onShareTimeline","onShareMessageToFriend","onShareAppMessage","onHandoff","onCopyUrl","onAddToFavorites","offShareTimeline","offShareAppMessage","offHandoff","offCopyUrl","offAddToFavorites","hideShareMenu","createUDPSocket","revokeBufferURL","createBufferURL","reportUserBehaviorBranchAnalytics","reportScene","reportMonitor","reportEvent","getExptInfoSync","setCursor","getRecorderManager","chooseMedia","createCamera","createVideoDecoder","updateVoIPChatMuteConfig","onVoIPChatStateChanged","onVoIPChatSpeakersChanged","onVoIPChatMembersChanged","onVoIPChatInterrupted","offVoIPChatStateChanged","offVoIPChatSpeakersChanged","offVoIPChatMembersChanged","offVoIPChatInterrupted","joinVoIPChat","exitVoIPChat","createUserInfoButton","checkSession","authorize","shareMessageToFriend","setUserCloudStorage","removeUserCloudStorage","onInteractiveStorageModified","offInteractiveStorageModified","modifyFriendInteractiveStorage","getUserInteractiveStorage","getUserCloudStorageKeys","getUserCloudStorage","getSharedCanvas","getPotentialFriendList","getGroupInfo","getGroupCloudStorage","getFriendCloudStorage","onMessage","getOpenDataContext","createFeedbackButton","openSetting","createOpenSettingButton","getGameClubData","createGameClubButton","openCustomerServiceConversation","getWeRunData","openCard","addCard","checkIsAddedToMyMiniProgram","reserveChannelsLive","openChannelsUserProfile","openChannelsLive","openChannelsEvent","openChannelsActivity","getChannelsLiveNoticeInfo","getChannelsLiveInfo","getGroupEnterInfo","requestSubscribeSystemMessage","requestSubscribeMessage","updateKeyboard","onKeyUp","onKeyDown","onKeyboardHeightChange","offKeyUp","offKeyDown","offKeyboardHeightChange","onMouseUp","onMouseMove","onMouseDown","offMouseUp","offMouseMove","offMouseDown","onWheel","offWheel","stopBeaconDiscovery","startBeaconDiscovery","onBeaconUpdate","onBeaconServiceChange","offBeaconUpdate","offBeaconServiceChange","getBeacons","onBLEPeripheralConnectionStateChanged","offBLEPeripheralConnectionStateChanged","createBLEPeripheralServer","writeBLECharacteristicValue","setBLEMTU","readBLECharacteristicValue","onBLEMTUChange","onBLEConnectionStateChange","onBLECharacteristicValueChange","offBLEMTUChange","offBLEConnectionStateChange","offBLECharacteristicValueChange","notifyBLECharacteristicValueChange","getBLEMTU","getBLEDeviceServices","getBLEDeviceRSSI","getBLEDeviceCharacteristics","createBLEConnection","closeBLEConnection","stopBluetoothDevicesDiscovery","startBluetoothDevicesDiscovery","openBluetoothAdapter","onBluetoothDeviceFound","onBluetoothAdapterStateChange","offBluetoothDeviceFound","offBluetoothAdapterStateChange","makeBluetoothPair","isBluetoothDevicePaired","getConnectedBluetoothDevices","getBluetoothDevices","getBluetoothAdapterState","closeBluetoothAdapter","getLocalIPAddress","onNetworkWeakChange","offNetworkWeakChange","onUserCaptureScreen","stopDeviceMotionListening","startDeviceMotionListening","onDeviceMotionChange","offDeviceMotionChange","setDeviceOrientation","onDeviceOrientationChange","offDeviceOrientationChange","onMemoryWarning","offMemoryWarning","stopGyroscope","startGyroscope","onGyroscopeChange","scanCode","getInferenceEnvInfo","createInferenceSession","stopFaceDetect","initFaceDetect","faceDetect","createWorker","operateGameRecorderVideo","createGameIcon","getGameRecorder","createGameRecorderShareButton","getGameServerManager","getExtConfigSync","getExtConfig","encode","decode","createImageData","offAccelerometerChange","addNativeDownloadTask","addToDesktop","addWeRunData","bindGroup","calRqt","captureScreen","checkGameLiveEnabled","checkIsSupportMidasFriendPayment","checkIsUserAdvisedToRest","cloud","createCpsAd","createGameComponent","createIncentiveVideoAd","createLivePlayer","createLivePusher","createOffScreenCanvas","createPath2D","createSharedArrayBuffer","createUserGameData","createVKReference","createVKSession","createWebView","dumpGameLivePanelUI","error","gameLoginReport","gameLogoutReport","getAd","getAdsSkipCardQuestInfo","getAdsSkipCardSharePresentQuota","getBox2D","getChannelsLiveReservation","getChannelsLiveState","getDebuggerMessager","getExptInfo","getGameLiveState","getGroupMsgTicket","getPrivacySetting","getRealNameVerifyMethod","getSavedFileInfo","getUserCurrentGameliveInfo","getUserGameLabel","getUserGameLiveDetails","getUserRecentGameLiveInfo","getWhatsNewSubscriptionsSetting","hideSplashScreen","isPointerLocked","isSDKError","isSystemError","isThirdError","isVKSupport","joinGroup","lanDebug","launchApp","markScene","navigateToUserCenter","notifyBLECharacteristicValueChanged","offGameLiveStateChange","offLaunch","offPointerLockChange","offPointerLockError","offShareInvitationToLiveRoom","offVerifyNotify","offVoIPVideoMembersChanged","onGameLiveStateChange","onLaunch","onNeedPrivacyAuthorization","onPointerLockChange","onPointerLockError","onShareInvitationToLiveRoom","onVerifyNotify","openChannelsLiveCollection","openCustomerServiceChat","openDocument","openPage","openPrivacyContract","openRedPacket","openTencentAccountCancelContract","openTencentBoardGameContract","openTencentChildrenGuideContract","openTencentGameContract","openTencentPrivacyContract","openUrl","operateWXData","parseXML","postMessage","previewPlayableView","protobuf","publishWeChatState","removeSavedFile","reportAnalytics","requestConsumeAdsSkipCard","requestMidasPaymentGameItem","requestPointerLock","requestSubscribeLiveActivity","requestSubscribeWhatsNew","requirePrivacyAuthorize","saveFile","sendBizRedPacket","sendRedPacket","serviceMarket","setTopBarText","shareInvitationToLiveRoom","showRedPackage","startCPUProfiling","startGameLive","stopCPUProfiling","subscribeVoIPVideoMembers","testApiCallTime","updateGameLivePanelMenu","updateUserGameData","uploadWeRunData","offLocalServiceDiscoveryStop","offLocalServiceFound","offLocalServiceLost","offLocalServiceResolveFail","onLocalServiceDiscoveryStop","onLocalServiceFound","onLocalServiceLost","onLocalServiceResolveFail","startLocalServiceDiscovery","stopLocalServiceDiscovery","createWebAudioContext","createMediaAudioPlayer"];nullList.forEach((e=>{defineReadOnlyProperty(global.wx,e,(o=>(console.warn(`-----wx----- 当前不支持该接口 ${e},调用后无响应.`),nullProp())))})),defineReadOnlyProperty(global.wx,"createSignal",(e=>(console.warn("-----wx----- 当前不支持该接口 createSignal,调用后返回null"),null)));const qgList=["getUpdateManager","onHide","offShow","offHide","onError","onAudioInterruptionEnd","onAudioInterruptionBegin","offError","offAudioInterruptionEnd","offAudioInterruptionBegin","triggerGC","getPerformance","showModal","showActionSheet","hideToast","hideLoading","getMenuButtonBoundingClientRect","clearStorage","clearStorageSync","getStorageInfoSync","getStorageInfo","setPreferredFramesPerSecond","cancelAnimationFrame","requestAnimationFrame","getTextLineHeight","createImage","createInnerAudioContext","saveImageToPhotosAlbum","previewImage","chooseImage","getLocation","showKeyboard","onKeyboardInput","onKeyboardConfirm","onKeyboardComplete","offKeyboardInput","offKeyboardConfirm","offKeyboardComplete","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel","offTouchStart","offTouchMove","offTouchEnd","offTouchCancel","stopAccelerometer","startAccelerometer","onAccelerometerChange","stopCompass","startCompass","onCompassChange","getNetworkType","setScreenBrightness","setKeepScreenOn","getScreenBrightness","vibrateShort","vibrateLong","onNetworkStatusChange","offNetworkStatusChange","createCanvas","env","getProvider","saveImageTemp","saveImageTempSync","getDeviceId","setTextBaseLine","exitApplication"];qgList.forEach((e=>{global.qg[e]?defineReadOnlyProperty(global.wx,e,global.qg[e]):defineReadOnlyProperty(global.wx,e,(o=>(console.warn(`-----wx----- 当前不支持该接口 ${e},调用后无响应.`),nullProp())))}));const info=global.qg.getSystemInfoSync(),fs=global.qg.getFileSystemManager(),qgAllianceList=["showToast","showLoading","onWindowResize","offWindowResize","request","downloadFile","uploadFile","setStorageSync","setStorage","removeStorageSync","removeStorage","getStorageSync","getStorage","loadFont","getFileSystemManager","getBatteryInfoSync","getBatteryInfo","setClipboardData","getClipboardData","createVideo"];qgAllianceList.forEach((e=>{global.qg[e]?defineReadOnlyProperty(global.wx,e,global.qg[e]):console.error(`${e} has not in qg`)})),defineReadOnlyPropertyContain(global.wx,"connectSocket",((e={})=>{const o=global.qg.connectSocket(e);return global._ws=o,o})),defineReadOnlyPropertyContain(global.wx,"sendSocketMessage",((e={})=>{global.qg.sendSocketMessage?global.qg.sendSocketMessage(e):global._ws&&global._ws.send(e)})),defineReadOnlyPropertyContain(global.wx,"onSocketOpen",(e=>{global.qg.onSocketOpen?global.qg.onSocketOpen(e):global._ws&&global._ws.onOpen(e)})),defineReadOnlyPropertyContain(global.wx,"onSocketMessage",(e=>{global.qg.onSocketMessage?global.qg.onSocketMessage(e):global._ws&&global._ws.onMessage(e)})),defineReadOnlyPropertyContain(global.wx,"onSocketError",(e=>{global.qg.onSocketError?global.qg.onSocketError(e):global._ws&&global._ws.onError(e)})),defineReadOnlyPropertyContain(global.wx,"onSocketClose",(e=>{global.qg.onSocketClose?global.qg.onSocketClose(e):global._ws&&global._ws.onClose(e)})),defineReadOnlyPropertyContain(global.wx,"closeSocket",((e={})=>{global.qg.closeSocket?global.qg.closeSocket(e):global._ws&&global._ws.close(e)})),defineReadOnlyPropertyContain(global.wx,"onWindowResize",(e=>{if(global.qg.onWindowResize)return global.qg.onWindowResize(e);null===e&&(e={}),isFunction(e)&&(global.qg.onWindowResize=e)})),defineReadOnlyPropertyContain(global.wx,"offWindowResize",(e=>{if(global.qg.offWindowResize)return global.qg.offWindowResize(e);null===e&&(e={}),global.qg.onWindowResize&&global.qg.onWindowResize===e&&(global.qg.onWindowResize=nullProp)}));const writeFileSyncInject=fs.writeFileSync;defineReadOnlyPropertyContain(fs,"writeFileSync",((e,o,a)=>((ArrayBuffer.isView(o)||o instanceof ArrayBuffer)&&(a="binary"),writeFileSyncInject.bind(fs)(e,o,a))));const readFileInject=fs.readFile;if(defineReadOnlyPropertyContain(fs,"readFile",((e={})=>(e.encoding||(e.encoding="binary"),readFileInject.bind(fs)(e)))),defineReadOnlyProperty(global.wx,"getWindowInfo",((e={})=>({pixelRatio:info.pixelRatio,screenWidth:info.screenWidth,screenHeight:info.screenHeight,windowWidth:info.screenWidth,windowHeight:info.screenHeight,statusBarHeight:info.statusBarHeight,safeArea:info.safeArea,screenTop:0}))),defineReadOnlyProperty(global.wx,"getSystemSetting",((e={})=>({bluetoothEnabled:!1,locationEnabled:!1,wifiEnabled:!1,deviceOrientation:info.screenWidth>info.screenHeight?"landscape":"portrait"}))),defineReadOnlyProperty(global.wx,"getSystemInfoSync",((e={})=>{const o=global.qg.getSystemInfoSync();return o.version="8.0.29",o.platform="android",o.fontSizeSetting=0,o.SDKVersion="2.28.0",o.benchmarkLevel=30,o.albumAuthorized=!1,o.cameraAuthorized=!0,o.locationAuthorized=!0,o.microphoneAuthorized=!0,o.notificationAuthorized=!1,o.notificationAlertAuthorized=!1,o.notificationBadgeAuthorized=!1,o.notificationSoundAuthorized=!1,o.phoneCalendarAuthorized=!1,o.bluetoothEnabled=!1,o.locationEnabled=!1,o.wifiEnabled=!1,o.locationReducedAccuracy=!1,o.theme="light",o.pixelRatio=1,o.host={appId:o.miniGame&&o.miniGame.package},o.enableDebug=!1,o.deviceOrientation=o.screenWidth>o.screenHeight?"landscape":"portrait",o})),defineReadOnlyProperty(global.wx,"getSystemInfoAsync",((e={})=>{const o=e.success;return e.success=e=>{const a=e;a.version="8.0.29",a.platform="android",a.fontSizeSetting=0,a.SDKVersion="2.28.0",a.benchmarkLevel=30,a.albumAuthorized=!1,a.cameraAuthorized=!0,a.locationAuthorized=!0,a.microphoneAuthorized=!0,a.notificationAuthorized=!1,a.notificationAlertAuthorized=!1,a.notificationBadgeAuthorized=!1,a.notificationSoundAuthorized=!1,a.phoneCalendarAuthorized=!1,a.bluetoothEnabled=!1,a.locationEnabled=!1,a.wifiEnabled=!1,a.locationReducedAccuracy=!1,a.theme="light",a.pixelRatio=1,a.host={appId:a.miniGame&&a.miniGame.package},a.enableDebug=!1,a.deviceOrientation=a.screenWidth>a.screenHeight?"landscape":"portrait",o(a)},global.qg.getSystemInfo(e)})),defineReadOnlyProperty(global.wx,"getSystemInfo",((e={})=>{const o=e.success;if(isFunction(o)){o(global.wx.getSystemInfoSync())}})),defineReadOnlyProperty(global.wx,"getDeviceInfo",((e={})=>{const o={abi:"",deviceAbi:"",benchmarkLevel:-1,brand:info.brand,model:info.model,system:info.system,platform:"android",CPUType:"",memorySize:""};return console.warn("-----wx----- qg未有getDeviceInfo接口,返回数据为构造的数据,建议换其他方式"),o})),defineReadOnlyProperty(global.wx,"getAppBaseInfo",((e={})=>{const o={SDKVersion:"2.28.0",enableDebug:!1,host:{appId:info.miniGame&&info.miniGame.package},language:"zh",version:"8.0.29",theme:"light"};return console.warn("-----wx----- qg未有getAppBaseInfo接口,返回数据为构造的数据,建议换其他方式"),o})),defineReadOnlyProperty(global.wx,"getAppAuthorizeSetting",((e={})=>(console.warn("-----wx----- qg未有 getAppAuthorizeSetting 接口,返回数据为构造的数据,建议换其他方式"),{albumAuthorized:!1,bluetoothAuthorized:!1,cameraAuthorized:!0,locationAuthorized:!0,locationReducedAccuracy:!1,microphoneAuthorized:!0,notificationAuthorized:!1,notificationAlertAuthorized:!1,notificationBadgeAuthorized:!1,notificationSoundAuthorized:!1,phoneCalendarAuthorized:!1}))),defineReadOnlyProperty(global.wx,"getLaunchOptionsSync",((e={})=>{const o=global.qg.getLaunchOptionsSync(),a={scene:1001,query:o.query,shareTicket:"",referrerInfo:o.referrerInfo,chatType:1,apiCategory:"default"},n=Object.assign({},o,a);return n.query&&!n.query.channel&&(n.query.channel=n.query.internal&&n.query.internal.channel?n.query.internal.channel:""),console.warn("-----wx----- vivo小游戏getLaunchOptionsSync与微信不一致, getLaunchOptionsSync:",n),n})),defineReadOnlyProperty(global.wx,"getEnterOptionsSync",((e={})=>{const o=global.qg.getEnterOptionsSync?global.qg.getEnterOptionsSync():global.qg.getLaunchOptionsSync(),a={scene:1001,query:o.query,shareTicket:"",referrerInfo:o.referrerInfo,chatType:1,apiCategory:"default"},n=Object.assign({},o,a);return n.query&&!n.query.channel&&(n.query.channel=n.query.internal&&n.query.internal.channel?n.query.internal.channel:""),console.warn("-----wx----- vivo小游戏getEnterOptionsSync与微信不一致, getEnterOptionsSync:",n),n})),defineReadOnlyProperty(global.wx,"onShow",(e=>{var o=function(){null===e&&(e={}),isFunction(e)&&e(global.wx.getEnterOptionsSync())};return setTimeout(o,0),global.qg.onShow(o)})),defineReadOnlyProperty(global.wx,"loadSubpackage",((e={})=>{const o=e.name;"main"===e.name&&global._main_sub_name_&&(e.name=global._main_sub_name_,console.warn(`-----wx----- loadSubpackage name: ${o}, realname:${e.name}`));try{if(!global.qg.manifest){const e=fs.readFileSync("manifest.json","utf8");global.qg.manifest=JSON.parse(e),console.warn("-----wx----- manifest:",global.qg.manifest)}if(global.qg.manifest&&global.qg.manifest.subpackages){const o=global.qg.manifest.subpackages;for(let a=0;a<o.length&&o[a].name!==e.name;a++)o[a].root===e.name&&(e.name=o[a].name),e.name.endsWith("/")||o[a].root!==e.name+"/"||(e.name=o[a].name)}}catch(e){}console.warn(`-----wx----- loadSubpackage name: ${o} loadName: ${e.name}`);var a=global.qg.loadSubpackage(e);return a.await=()=>{},a})),defineReadOnlyProperty(global.wx,"exitMiniProgram",(e=>(console.warn("-----wx----- 微信小游戏的exitMiniProgram和vivo小游戏的exitApplication稍有区别,请确认是否需要手动修改"),global.qg.exitApplication()))),defineReadOnlyProperty(global.wx,"requestMidasPayment",((e={})=>{console.error("-----wx----- 请使用vivo平台的支付接口进行适配")})),defineReadOnlyProperty(global.wx,"requestMidasFriendPayment",global.wx.requestMidasPayment),defineReadOnlyProperty(global.wx,"getFuzzyLocation",global.qg.getLocation),global.wx.hideKeyboard=function(e){global.qg.hideKeyboard(),e&&"function"==typeof e.success&&e.success({errMsg:"hideKeyboard:ok"}),e&&"function"==typeof e.complete&&e.complete({errMsg:"hideKeyboard:ok"})},defineReadOnlyProperty(global.wx,"getAccountInfoSync",((e={})=>({miniProgram:{appId:"wxa89a52c508f18788",envVersion:"release",version:""}}))),defineReadOnlyProperty(global.wx,"getLogManager",((e={})=>{const o={info:()=>{},debug:()=>{},log:()=>{},warn:()=>{},error:()=>{}};return o})),defineReadOnlyProperty(global.wx,"getRealtimeLogManager",((e={})=>{const o=console;return o.setFilterMsg=()=>{},o.addFilterMsg=()=>{},o})),defineReadOnlyProperty(global.wx,"getUserInfo",((e={})=>{global.qg.getUserInfo()&&global.qg.getUserInfo().then((o=>{if(o.data){console.log("-----wx----- 当前用户信息: "+JSON.stringify(o.data));const a={userInfo:{nickName:o.data.nickName,avatarUrl:o.data.smallAvatar,gender:o.data.gender,language:"zh_CN"},rawData:o.data,signature:"",encryptedData:"",iv:"",cloudID:""};successCallback(e,a)}}),(e=>{console.log("-----wx----- 获取用户信息失败"+JSON.stringify(e))}))})),defineReadOnlyProperty(global.wx,"login",((e={})=>{console.error("-----wx----- 需要接入vivo平台的login接口"),successCallback(e,{code:"0b18Dwml2rLD8b4XBTol26l5tu28DwmP",errMsg:"login:ok"})})),defineReadOnlyProperty(global.wx,"getSetting",((e={})=>{successCallback(e,{authSetting:{"scope.userInfo":!0,"scope.userLocation":!0,"scope.werun":!1,"scope.writePhotosAlbum":!0,"scope.WxFriendInteraction":!1},subscriptionsSetting:{mainSwitch:!1},miniprogramAuthSetting:{"scope.userInfo":!0,"scope.userLocation":!0,"scope.werun":!1,"scope.writePhotosAlbum":!0,"scope.WxFriendInteraction":!1}})})),defineReadOnlyProperty(global.wx,"createGamePortal",((e={})=>(console.warn("-----wx----- 广告位ID配置到manifest的gamePortal,调用时会自动获取,与盒子九宫格广告一致"),global.qg.manifest&&global.qg.manifest.ad_config&&global.qg.manifest.ad_config.gamePortal&&(e.adUnitId=global.qg.manifest.ad_config.gamePortal),global.qg.createBoxPortalAd(e)))),defineReadOnlyProperty(global.wx,"createGameBanner",((e={})=>(console.warn("-----wx----- 广告位ID配置到manifest的gridAd,调用时会自动获取,与盒子Banner广告一致"),global.qg.manifest&&global.qg.manifest.ad_config&&global.qg.manifest.ad_config.gridAd&&(e.adUnitId=global.qg.manifest.ad_config.gridAd),global.qg.createBoxBannerAd(e)))),defineReadOnlyProperty(global.wx,"createGridAd",global.wx.createGameBanner),defineReadOnlyProperty(global.wx,"createRewardedVideoAd",((e={})=>(console.warn("-----wx----- 广告位ID配置到manifest的rewardedVideoAd,调用时会自动获取,与激励视频广告一致"),global.qg.manifest&&global.qg.manifest.ad_config&&global.qg.manifest.ad_config.rewardedVideoAd&&(e.adUnitId=global.qg.manifest.ad_config.rewardedVideoAd),global.qg.createRewardedVideoAd(e)))),defineReadOnlyProperty(global.wx,"createInterstitialAd",((e={})=>(console.warn("-----wx----- 广告位ID配置到manifest的interstitialAd,调用时会自动获取,与插屏广告一致"),global.qg.manifest&&global.qg.manifest.ad_config&&global.qg.manifest.ad_config.interstitialAd&&(e.adUnitId=global.qg.manifest.ad_config.interstitialAd),global.qg.createInterstitialAd(e)))),defineReadOnlyProperty(global.wx,"createCustomAd",((e={})=>(console.warn("-----wx----- 广告位ID配置到manifest的customAd,调用时会自动获取,与模板广告一致"),global.qg.manifest&&global.qg.manifest.ad_config&&global.qg.manifest.ad_config.customAd&&(e.adUnitId=global.qg.manifest.ad_config.customAd),global.qg.createCustomAd(e)))),defineReadOnlyProperty(global.wx,"createBannerAd",((e={})=>(console.warn("-----wx----- 广告位ID配置到manifest的bannerAd,调用时会自动获取,与bannerAd广告一致"),global.qg.manifest&&global.qg.manifest.ad_config&&global.qg.manifest.ad_config.bannerAd&&(e.adUnitId=global.qg.manifest.ad_config.bannerAd),global.qg.createBannerAd(e)))),global.WebAssembly){const e=global.WebAssembly;let o=0;function startWasmTask(){o++,global.qg&&global.qg.setWasmTaskCompile&&global.qg.setWasmTaskCompile(!0)}function endWasmTask(){o--,o<=0?(o=0,global.qg&&global.qg.setWasmTaskCompile&&global.qg.setWasmTaskCompile(!1)):global.qg&&global.qg.setWasmTaskCompile&&global.qg.setWasmTaskCompile(!0)}global.WXWebAssembly=new Proxy(global.WebAssembly,{construct(o,a){if(o===e.Instance){const e=a[0];console.log("-----wx----- path:",e),startWasmTask();try{if(-1!==e.indexOf(".br")&&global.fs&&global.fs.readCompressedFileSync){const o=global.fs.readCompressedFileSync({filePath:e,compressionAlgorithm:"br"});a[0]=o.data?o.data:o,console.warn(`WXWebAssembly readCompressedFileSync ${e} read data: `,a[0])}else if(global.fs&&global.fs.readFileSync){const o=global.fs.readFileSync(e);a[0]=o,console.warn(`WXWebAssembly readFileSync ${e} read data: `,a[0])}}catch(o){console.error(`WXWebAssembly ${e} read error. `,o)}const n=Reflect.construct(o,a);return Promise.resolve(n).then((e=>(console.log("wx wasm then..."),endWasmTask(),e))).catch((e=>{throw console.log("wx wasm catch..."),endWasmTask(),e}))}return Reflect.construct(o,a)},get:(e,o)=>{const a=e[o];return"instantiate"!==o&&"Instance"!==o?a:function(...e){const o=e[0];console.log("-----wx----- path:",o),startWasmTask();try{if(-1!==o.indexOf(".br")&&fs.readCompressedFileSync){const a=fs.readCompressedFileSync({filePath:o,compressionAlgorithm:"br"});e[0]=a.data?a.data:a,console.warn(`WXWebAssembly readCompressedFileSync ${o} read data: `,e[0])}else{const a=fs.readFileSync(o);e[0]=a,console.warn(`WXWebAssembly readFileSync ${o} read data: `,e[0])}}catch(e){console.error(`WXWebAssembly ${o} read error. `,e)}return a.apply(this,e).then((e=>(console.log("wx wasm then..."),endWasmTask(),e))).catch((e=>{throw console.log("wx wasm then..."),endWasmTask(),e}))}}})}else global.qg&&global.qg.setWasmTaskCompile&&global.qg.setWasmTaskCompile(!0);defineReadOnlyProperty(window,"WXWebAssembly",global.WXWebAssembly),window.__wxConfig={envVersion:"release"};var qgKeys=Object.keys(global.qg);function assign(e,...o){try{return global.assign(e,...o)}catch(e){}}qgKeys.forEach((e=>{-1!==Object.keys(global.wx).indexOf(e)||e.includes("requirePlugin")||defineReadOnlyProperty(global.wx,e,global.qg[e])})),global.assign=Object.assign,Object.assign=assign;try{window.qg.reportGameInfo&&window.qg.reportGameInfo(JSON.stringify({wxEngine:"2"}))}catch(a){}if(!global.webpack_use_moudle)try{var res=fs.accessSync("webpack_use_moudle.json");if(res){console.log("-----wx----- webpack_use_moudle.json 文件存在,将绑定到global上用于动态加载.");const n=fs.readFileSync("webpack_use_moudle.json","utf8");try{global.webpack_use_moudle=JSON.parse(n)}catch(t){}}}catch(r){}try{const i=String.prototype,l=Object.getOwnPropertyDescriptor(i,"replaceAll");l&&l.writable&&l.configurable&&Object.defineProperty(i,"replaceAll",{value:function(e,o){return this.split(e).join(o)},writable:!0,configurable:!0,enumerable:!1}),global.qg.manifest||(global.qg.getManifestInfoSync?global.qg.manifest=global.qg.getManifestInfoSync():fs.readFile({filePath:"manifest.json",encoding:"utf8",success:function(e){try{console.log("-----wx----- manifest解析到global中"),global.qg.manifest=JSON.parse(e.data)}catch(e){}}}))}catch(s){}