miniprogram-ci 2.1.16 → 2.1.18

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +4 -0
  3. package/dist/@types/config/config.d.ts +1 -1
  4. package/dist/@types/config/define.d.ts +1 -0
  5. package/dist/@types/modules/corecompiler/original/workerThread/config.d.ts +1 -0
  6. package/dist/@types/modules/corecompiler/summerCompiler.d.ts +2 -1
  7. package/dist/@types/modules/index.d.ts +2 -0
  8. package/dist/@types/modules/nativecompiler/ios/buildCloud.d.ts +2 -0
  9. package/dist/@types/modules/nativecompiler/ios/index.d.ts +1 -0
  10. package/dist/@types/project/ciProject.d.ts +7 -3
  11. package/dist/@types/schema/@types/appjson.d.ts +2 -0
  12. package/dist/@types/schema/@types/projectconfigjson.d.ts +1 -1
  13. package/dist/@types/types/core.d.ts +1 -1
  14. package/dist/@types/utils/debug.d.ts +3 -3
  15. package/dist/@types/utils/miniappJson.d.ts +3 -1
  16. package/dist/@types/utils/packOptionsHelper.d.ts +2 -1
  17. package/dist/ci/android-miniapp-toolkit/dist/index.js +1 -1
  18. package/dist/ci/build-apk.js +1 -1
  19. package/dist/ci/build-ipa.js +1 -1
  20. package/dist/config/config.js +1 -1
  21. package/dist/config/define.js +1 -1
  22. package/dist/modules/corecompiler/original/workerThread/config.js +1 -1
  23. package/dist/modules/corecompiler/original/workerThread/index.js +1 -1
  24. package/dist/modules/corecompiler/original/workerThread/workerManager.js +1 -1
  25. package/dist/modules/corecompiler/processHandler.js +1 -1
  26. package/dist/modules/corecompiler/summer/pluginDriver.js +1 -1
  27. package/dist/modules/corecompiler/summer/plugins/sass.js +1 -1
  28. package/dist/modules/corecompiler/summerCompiler.js +1 -1
  29. package/dist/modules/createSummer.js +1 -1
  30. package/dist/modules/index.js +1 -1
  31. package/dist/modules/nativecompiler/ios/buildCloud.js +1 -1
  32. package/dist/modules/nativecompiler/ios/index.js +1 -1
  33. package/dist/modules/precompiler/conditioncompile/define.js +1 -1
  34. package/dist/modules/precompiler/conditioncompile/index.js +1 -1
  35. package/dist/project/ciProject.js +1 -1
  36. package/dist/schema/dist/app.js +29 -1
  37. package/dist/schema/dist/projectconfig.js +2 -1
  38. package/dist/static/scripts/resignIpa +1 -1
  39. package/dist/utils/debug.js +1 -1
  40. package/dist/utils/miniappJson.js +1 -1
  41. package/dist/utils/packOptionsHelper.js +1 -1
  42. package/dist/utils/subprocess/processManager.js +1 -1
  43. package/dist/utils/subprocess/processService.js +1 -1
  44. package/package.json +1 -1
  45. package/dist/@types/modules/corecompiler/original/webWorker/WebWorkerInstance.d.ts +0 -1
  46. package/dist/@types/modules/corecompiler/original/webWorker/childWebWorker.d.ts +0 -1
  47. package/dist/modules/corecompiler/original/webWorker/WebWorkerInstance.js +0 -1
  48. package/dist/modules/corecompiler/original/webWorker/childWebWorker.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.IOSUtils=void 0;const tslib_1=require("tslib"),child_process=tslib_1.__importStar(require("child_process")),path_1=tslib_1.__importDefault(require("path")),fs_extra_1=tslib_1.__importDefault(require("fs-extra")),env_1=require("../../../utils/env"),deviceUtils=tslib_1.__importStar(require("./device")),projectConfigUtils=tslib_1.__importStar(require("./projectconfig")),cp_1=require("../../../utils/cp"),miniapp_builder_1=require("../../../utils/miniapp-builder"),usbProcess_1=require("../../../utils/usbProcess"),miniappJson_1=require("../../../utils/miniappJson"),singletontask_1=require("../../../utils/singletontask"),buildCloud_1=tslib_1.__importStar(require("./buildCloud")),tools_1=require("../../../utils/tools"),codesign_1=require("../../../utils/codesign"),ProjectMiniappJsonSplashScreenThemeKey="__splashscreenTheme",_iconInfoMap={appStore1024:{size:[1024,1024],scale:1,idiom:"ios-marketing",required:!0},mainIcon120:{size:[60,60],scale:2,idiom:"iphone",required:!0},mainIcon180:{size:[60,60],scale:3,idiom:"iphone"},spotlightIcon80:{size:[40,40],scale:2,idiom:"iphone"},spotlightIcon120:{size:[40,40],scale:3,idiom:"iphone"},settingsIcon58:{size:[29,29],scale:2,idiom:"iphone"},settingsIcon87:{size:[29,29],scale:3,idiom:"iphone"},notificationIcon40:{size:[20,20],scale:2,idiom:"iphone"},notificationIcon60:{size:[20,20],scale:3,idiom:"iphone"},ipadMainIcon152:{size:[76,76],scale:2,idiom:"ipad"},ipadMainIcon167:{size:[83.5,83.5],scale:2,idiom:"ipad"},ipadSpotlightIcon40:{size:[40,40],scale:1,idiom:"ipad"},ipadSpotlightIcon80:{size:[40,40],scale:2,idiom:"ipad"},ipadSettingsIcon29:{size:[29,29],scale:1,idiom:"ipad"},ipadSpotlightIcon58:{size:[29,29],scale:2,idiom:"ipad"},ipadNotificationIcon20:{size:[20,20],scale:1,idiom:"ipad"},ipadNotificationIcon40:{size:[20,20],scale:2,idiom:"ipad"}},_allowTheme=["Light","LightSpecial","Dark","DarkSpecial","Default"],_getDepReg=e=>new RegExp(`s.subspec '${e}'.*\n(?:.*\n)*?(?:.*sp.vendored_frameworks = \\[\n)((?:.*'.*?'.*\n)*?)(?:.*\\]\n)`,"m"),buildIOSPluginTask={};class IOSUtils{constructor(e,i={},t,o){this.root=e,this.userConfig=i,this.miniappDirPath=t,this.devtoolsVersion=o}getProjectConfig(){const e=projectConfigUtils.getProjectConfig(this.root,this.userConfig);if(!e)throw new Error("iOS project folder not found. Are you sure this is a miniapp project?");return e}getBundleId(e){return child_process.execFileSync("/usr/libexec/PlistBuddy",["-c","Print:CFBundleIdentifier",path_1.default.join(e,"Info.plist")],{encoding:"utf8",env:(0,env_1.getProcessEnv)()}).trim()}tryInstallPod(e,i){const t=this.getProjectConfig(),{sourceDir:o}=t,n={cwd:o,env:(0,env_1.getProcessEnv)()};i.progress("export LANG=en_US.UTF-8 && pod install"),child_process.execSync("export LANG=en_US.UTF-8 && pod install",n)}async runLocal(e,i){const t=this.getProjectConfig(),{sourceDir:o}=t;process.chdir(o),this.tryInstallPod(e,i);const n=path_1.default.basename(t.name,path_1.default.extname(t.name)),s=e.scheme||n;if(i.progress(`Found Xcode ${t.isWorkspace?"workspace":"project"} "${t.name}"`),e.device||e.udid){if(e.udid||e.device){const o=await deviceUtils.getDevices({recorder:i}),n=o.find(i=>i.udid===e.udid||i.name===e.device);if(!n)throw new Error(`Could not find a device with udid(${e.udid}) or device(${e.device}). ${deviceUtils.printFoundDevices(o)}`);if("simulator"===n.type)return void await this.runOnSimulatorLocal(t,s,e,i);await this.runOnDeviceLocal(t,s,n,i)}}else await this.runOnSimulatorLocal(t,s,e,i)}async runCloud(e,i){var t;try{const{deviceType:o,udid:n,projectPath:s,demoIpaPath:r,sdkPath:a,bindingInfo:c,certificateInfo:l,arch:d="arm64",pluginDirList:u,miniappCacheDirPath:p,theme:h,i18nInfo:f,debugInfo:_,cacheAssetCarPath:m}=e,g=buildCloud_1.default.generateTempDemoIpaPath(r),b="simulator"===o,v=(0,miniappJson_1.tryGetIOSMiniappJson)(s);let y=c;if(l.signType===miniapp_builder_1.miniappSinTypes.appleId.type){const{mobileapp_info:e={}}=y;y=Object.assign(Object.assign({},y),{mobileapp_info:Object.assign(Object.assign({},e),{bundle_id:miniapp_builder_1.DEFAULT_BUNDLE_ID,debug_ios_bundle_id:miniapp_builder_1.DEFAULT_BUNDLE_ID})})}const S=await buildCloud_1.default.updateIOSInfoPlistInfo(s,y,g,v,i,f);await buildCloud_1.default.updateIOSAppConfigPlistInfo(s,y,g,v,a,b,i,h,f),await buildCloud_1.default.updateIOSAppexInfoPlistInfo(y,g,v,S,i),await buildCloud_1.default.updateIOSIcons(s,g,"",v,!1,i,!1,m),await buildCloud_1.default.updateSplashScreen(s,g,v,i,h,f),await buildCloud_1.default.updateExtendedSdk(y,g,a,d,v,_,i),await buildCloud_1.default.updatePlugin(g,u,s,v,p,!1,S,i);const P=await buildCloud_1.default.getEntitlements(y,g,v,i);if(await buildCloud_1.default.updateIOSAppResource(s,g,v,i),"device"===o){const{mobileapp_info:e={}}=y,o=e.ios_flag&&e.bundle_id||e.debug_ios_bundle_id;await(0,miniapp_builder_1.signAndInstallOrExport)(s,g,p,l,{bundleId:o,install:!0,deviceId:n,entitlements:P,isPublish:!!(null===(t=null==l?void 0:l.selfCertificate)||void 0===t?void 0:t.isPublish)},{recorder:i,miniappDirPath:this.miniappDirPath,devtoolsVersion:this.devtoolsVersion})}else await this.runOnSimulatorCloud(g,{udid:n},i)}catch(e){throw new Error(e.message)}}async buildLocal(e,i){const t=this.getProjectConfig();process.chdir(t.sourceDir);const o=path_1.default.basename(t.name,path_1.default.extname(t.name)),n=e.scheme||o;this.tryInstallPod(e,i),i.progress("start build ipa...");const s=await this.buildProjectArchive(t,{output:e.output,scheme:n},i),r=await this.exportArchive(t,s,e,i);return console.log("Successfully build ipa: "+r),r}async buildCloud(e,i){try{const{projectPath:t,certificateInfo:o,miniappCacheDirPath:n}=e,s=await buildCloud_1.default.buildCloud(e,i),{demoIpaPath:r,opts:a}=s,c={recorder:i,miniappDirPath:this.miniappDirPath,devtoolsVersion:this.devtoolsVersion};s.isPublish||e.CILocalBuild||await(0,miniapp_builder_1.signAndInstallOrExport)(t,r,n,o,a,c)}catch(e){throw new Error(e.message)}}async genProjectMaterialMap(e,i,t,o){var n,s;const r=buildCloud_1.remoteBuildProjectMaterialAbsoluteCacheDir,a=path_1.default.join(i,r),c=(0,miniappJson_1.tryGetIOSMiniappJson)(e);function l(e,i){const t=fs_extra_1.default.lstatSync(e);fs_extra_1.default.ensureDirSync(path_1.default.dirname(i)),t.isDirectory()?fs_extra_1.default.copySync(e,i):fs_extra_1.default.copyFileSync(e,i)}function d(t,o,n=!0){if(!o){if(n)return"";throw new Error(`file cant be empty for cloud build, key: ${t} , fileName: ${o}`)}if(path_1.default.isAbsolute(o)){const e=path_1.default.basename(o);if(!fs_extra_1.default.existsSync(o)){if(n)return"";throw new Error(`file cant be empty for cloud build, key: ${t} , fileName: ${o}`)}const i=(0,tools_1.generateMD5)(o);return l(o,path_1.default.join(a,`${i}_${e}`)),path_1.default.join(r,e)}const s=path_1.default.join(e,o),c=path_1.default.join(i,o);if(!fs_extra_1.default.existsSync(s)){if(n)return"";throw new Error(`file cant be empty for cloud build, key: ${t} , fileName: ${o}`)}return l(s,c),o}fs_extra_1.default.ensureDirSync(a);const{privacy:u={},icons:p={},splashscreen:h={},buildCloud:f={}}=c,_=d("project.miniapp.json","project.miniapp.json",!1),m=d("project.config.json","project.config.json",!1),g=(0,miniappJson_1.getMiniprogramRoot)(e),b=d("app.json",path_1.default.join(g,"app.json"),!1),{template:v,contentViewImage:y,cancelButtonImage:S,confirmButtonImage:P}=u,w=d("privacy template",v),I=d("privacy contentViewImage",y),x=d("privacy cancelButtonImage",S),j=d("privacy confirmButtonImage",P),E=[];for(const e in p)if(p[e]){const i=d("icons."+e,p[e],!1);i&&E.push(i)}const O=d("splashscreen.customImage",h.customImage),{p12:D,profile:C,tpnsProfile:A}=f,$=d("p12 Path",D,!1),T=d("profile Path",C,!1);let k=void 0;!0===(null===(n=null==c?void 0:c.tpush)||void 0===n?void 0:n.useExtendedLib_WeAppTPNS)&&(k=d("tpns profile Path",A,!0!==(null===(s=null==c?void 0:c.tpush)||void 0===s?void 0:s.useExtendedLib_WeAppTPNS)));const B="miniapp/ios/i18nInfo.json",U=path_1.default.join(e,B),F=d("i18n",B,!0);if(fs_extra_1.default.existsSync(U)){const i=function(e,i){function t(i,t,o){if(t[o]&&"object"==typeof t[o][i])for(const n in t[o][i])if("object"==typeof t[o][i]){const s=t[o][i][n];if("string"==typeof s&&s.length>0){fs_extra_1.default.existsSync(path_1.default.isAbsolute(s)?s:path_1.default.join(e,s))&&d(`i18nFiles.${o}.${n}`,s,!0)}}}try{const o=fs_extra_1.default.readJSONSync(path_1.default.join(e,i));for(const e in o)t("ios",o,e),t("android",o,e)}catch(e){return e.message}}(e,B);if(i)throw o.message("error",i),new Error("copyi18NFiles error "+i)}const L=path_1.default.join(i,"project.miniapp.json");try{const e=fs_extra_1.default.readJsonSync(L);let{theme:i}=t;t.theme||(i="Dark"),e.__splashscreenTheme=i,fs_extra_1.default.writeJSONSync(L,e)}catch(e){throw new Error(`ReadWriteJsonFailed projectMiniappJsonCacheFilePath: ${L},error ${e.message}`)}const M=c["mini-plugin"];M&&Array.isArray(M.ios)&&M.ios.forEach(e=>{!0===e.open&&e.resourcePath&&d(`mini-plugin ios ${e.pluginId}:${e.resourcePath}`,e.resourcePath)});return{projectMiniappJson:_,projectConfigJson:m,appJson:b,privacyJson:w,privacyContentViewImage:I,privacyCancelButtonImage:x,privacyConfirmButtonImage:j,icons:E,splashScreen:O,p12:$,profile:T,tpnsProfile:k,i18nJson:F,resourcePath:d("ios resourcePath",c.resourcePath,!0)}}async codesignIOSApp(e,i){const{projectPath:t,demoIpaPath:o,opts:n}=e,s=await(0,codesign_1.codesignAndExport)(t,o,e.miniappCacheDir||"",n,i,e.isUsingTpush,!1,!0);if(!0!==s.success)throw new Error("Build ipa failed:"+(s.errMsg||"codesignAndExport failed"))}async packIOSCloudBuildMaterial(e,i){i.progress("start uploadProjectAllMaterial");const{projectPath:t,matrialDistPath:o,theme:n}=e;await this.genProjectMaterialMap(t,o,e,i);i.progress("packIOSCloudBuildMaterial done")}async initUSBConnectionProcess(e,i){await(0,usbProcess_1.startUSBManagerProcess)(e,i)&&i.progress("Init USB Process Successfully")}launchSimulator(e,i){let t;try{t=JSON.parse(child_process.execFileSync("xcrun",["simctl","list","--json","devices"],{encoding:"utf8",env:(0,env_1.getProcessEnv)()}))}catch(e){throw new Error("Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues."+e.message)}const o=["iPhone 13","iPhone 12","iPhone 11"].reduce((e,i)=>e||deviceUtils.findMatchingSimulator(t,{device:i}),deviceUtils.findMatchingSimulator(t,e));if(!o)throw new Error("No simulator available with "+(e.device?`name "${e.device}"`:`udid "${e.udid}"`));const n=child_process.execFileSync("xcode-select",["-p"],{encoding:"utf8",env:(0,env_1.getProcessEnv)()}).trim();if(child_process.execFileSync("open",[n+"/Applications/Simulator.app","--args","-CurrentDeviceUDID",o.udid],{env:(0,env_1.getProcessEnv)()}),!o.booted){const e=deviceUtils.formattedDeviceName(o);i.progress("Launching "+e),child_process.spawnSync("xcrun",["simctl","boot",o.udid],{env:(0,env_1.getProcessEnv)()})}return o}async runOnSimulatorCloud(e,i,t){const{udid:o}=i,n=this.launchSimulator({udid:o},t);await this.installAppOnSimulator(n,e,t),await this.launchAppOnSimulator(n,e,t)}async runOnSimulatorLocal(e,i,t,o){const n=this.launchSimulator(t,o),{appPath:s}=await this.buildProjectApp(e,{udid:n.udid,scheme:i},o);await this.installAppOnSimulator(n,s,o),await this.launchAppOnSimulator(n,s,o)}async runOnDeviceLocal(e,i,t,o){const{appPath:n}=await this.buildProjectApp(e,{udid:t.udid,scheme:i},o);if("catalyst"===t.type){child_process.spawn(`${n}/${i}`,[],{detached:!0,stdio:"ignore",env:(0,env_1.getProcessEnv)()}).unref()}else{const e=["--bundle",n,"--id",t.udid,"--justlaunch"];o.progress("Installing and launching your app on "+t.name);const i=path_1.default.join(__dirname,"../../../vendor/ios-deploy/ios-deploy");await(0,cp_1.spawnSync)(i,e,{},o)}return o.progress("Install successfully the app to the device.")}buildProjectApp(e,i,t){return new Promise((o,n)=>{const{scheme:s,udid:r}=i,a=[e.isWorkspace?"-workspace":"-project",e.name,"-scheme",s];let c;r&&a.push("-destination","id="+r),t.progress(`Building (using "xcodebuild ${a.join(" ")}")`),this.xcbeautifyAvailable()?c=child_process.spawn("xcbeautify",[],{stdio:["pipe",process.stdout,process.stderr],env:(0,env_1.getProcessEnv)()}):this.xcprettyAvailable()&&(c=child_process.spawn("xcpretty",[],{stdio:["pipe",process.stdout,process.stderr],env:(0,env_1.getProcessEnv)()}));const l=child_process.spawn("xcodebuild",a,{env:(0,env_1.getProcessEnv)()});let d="",u="";l.stdout.on("data",e=>{const i=e.toString();t.progress(i),d+=i,c&&c.stdin.write(e)}),l.stderr.on("data",e=>{const i=e.toString();u+=i,t.progress(i)}),l.on("close",i=>{if(c&&c.stdin.end(),0!==i)return void n(new Error(` Failed to build iOS project.\n We ran "xcodebuild" command but it exited with error code ${i}. To debug build\n logs further, consider building your app with Xcode.app, by opening\n ${e.name}.\n ${c?void 0:`${d}\n${u}`}\n `));let r;try{r=this.getBuildInfo(e,d,s)}catch(e){n(e)}t.progress("Successfully built the app"),o(r)})})}async installAppOnSimulator(e,i,t){const o=["simctl","install",e.udid,i];await(0,cp_1.spawnSync)("xcrun",o,{},t)}async launchAppOnSimulator(e,i,t){const o=this.getBundleId(i),n=["simctl","launch",e.udid,o];await(0,cp_1.spawnSync)("xcrun",n,{},t),t.progress("Successfully launched the app on the simulator")}async buildProjectArchive(e,i,t){const{output:o,scheme:n,udid:s}=i,r=path_1.default.join(o,"./app"),{sourceDir:a}=e;fs_extra_1.default.ensureDirSync(path_1.default.dirname(r));const c=["archive",e.isWorkspace?"-workspace":"-project",e.name,"-scheme",n,"-archivePath",r];s&&c.push("-destination","id="+s);try{if(await(0,cp_1.spawnSync)("xcodebuild",c,{cwd:a},t),!fs_extra_1.default.existsSync(r+".xcarchive"))throw new Error(`Failed to build iOS project.\n ${r+".xcarchive"} does not found\n `);return t.progress(`Successfully archive the app: ${r}.xcarchive`),r+".xcarchive"}catch(i){throw new Error(`Failed to build iOS project. To debug build\n logs further, consider building your app with Xcode.app, by opening\n ${e.name}.\n `)}}async exportArchive(e,i,t,o){const n=path_1.default.join(t.output,"ipa");fs_extra_1.default.ensureDirSync(n),fs_extra_1.default.emptyDirSync(n);const{exportOptionPlistPath:s}=t;if(!s)throw new Error("build ios ipa require exportOptionPlistPath in project.miniapp.json");let r="";r=path_1.default.isAbsolute(s)?s:path_1.default.join(t.projectPath,s);const a=["-exportArchive","-archivePath",i,"-exportOptionsPlist",r,"-exportPath",n];try{await(0,cp_1.spawnSync)("xcodebuild",a,{cwd:e.sourceDir},o)}catch(i){throw new Error(`To debug build\n logs further, consider building your app with Xcode.app, by opening\n ${e.name}.\n `)}return fs_extra_1.default.removeSync(i),n}getTargetPaths(e){const i=JSON.parse(e);for(const e in i){if("app"===i[e].buildSettings.WRAPPER_EXTENSION)return{targetBuildDir:i[e].buildSettings.TARGET_BUILD_DIR,executableFolderPath:i[e].buildSettings.EXECUTABLE_FOLDER_PATH}}return{}}getBuildInfo(e,i,t){const o=this.getPlatformName(i),n=[e.isWorkspace?"-workspace":"-project",e.name,"-scheme",t,"-sdk",o,"-showBuildSettings","-json"].join(" "),s=child_process.execSync("xcodebuild "+n,{encoding:"utf8",cwd:e.sourceDir,env:(0,env_1.getProcessEnv)()}),r=this.getBuildProductDir(i),{executableFolderPath:a}=this.getTargetPaths(s);if(!a)throw new Error("Failed to get the app name.");return{sdk:o,appPath:`${r}/${a}`}}getPlatformName(e){const i=/export PLATFORM_NAME\\?="?(\w+)"?$/m.exec(e);if(!i)throw new Error("Couldn't find PLATFORM_NAME in xcodebuild output.");return i[1]}getBuildProductDir(e){const i=/export BUILT_PRODUCTS_DIR\\?="?(.+)"?$/m.exec(e);if(!i)throw new Error("Couldn't find BUILT_PRODUCTS_DIR in xcodebuild output.");return i[1]}xcbeautifyAvailable(){try{child_process.execSync("xcbeautify --version",{stdio:[0,"pipe","ignore"],env:(0,env_1.getProcessEnv)()})}catch(e){return!1}return!0}xcprettyAvailable(){try{child_process.execSync("xcpretty --version",{stdio:[0,"pipe","ignore"],env:(0,env_1.getProcessEnv)()})}catch(e){return!1}return!0}async buildPlugin(e,i){const{pluginId:t,projectPath:o,buildShellPath:n}=e;i.progress("start build native plugin...");try{const e=[o,t];fs_extra_1.default.chmodSync(n,"777"),buildIOSPluginTask[t]?(i.message("error","存在未结束的插件构建任务,需等待构建结束..."),await buildIOSPluginTask[t].getResult(!0)):(buildIOSPluginTask[t]=new singletontask_1.SingletonTask(cp_1.spawnSyncExecShell.bind(null,n,e,{},i)),await buildIOSPluginTask[t].getResult(!0),buildIOSPluginTask[t]=void 0)}catch(e){throw buildIOSPluginTask[t]=void 0,new Error("build plugin failed: "+e)}}async writeI18NInfoFile(e,i,t){Object.keys(i).forEach(o=>{if("base"===o)return;let n="";Object.keys(t).forEach(e=>{var s,r,a,c;(null===(r=null===(s=i[o])||void 0===s?void 0:s.ios)||void 0===r?void 0:r[t[e]])&&(n+=`${e} = "${null===(c=null===(a=i[o])||void 0===a?void 0:a.ios)||void 0===c?void 0:c[t[e]]}";\n`)}),n&&(fs_extra_1.default.ensureDirSync(path_1.default.join(e,o+".lproj")),fs_extra_1.default.writeFileSync(path_1.default.join(e,o+".lproj/InfoPlist.strings"),n))})}}exports.IOSUtils=IOSUtils;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.IOSUtils=void 0;const tslib_1=require("tslib"),child_process=tslib_1.__importStar(require("child_process")),path_1=tslib_1.__importDefault(require("path")),fs_extra_1=tslib_1.__importDefault(require("fs-extra")),env_1=require("../../../utils/env"),deviceUtils=tslib_1.__importStar(require("./device")),projectConfigUtils=tslib_1.__importStar(require("./projectconfig")),cp_1=require("../../../utils/cp"),miniapp_builder_1=require("../../../utils/miniapp-builder"),usbProcess_1=require("../../../utils/usbProcess"),miniappJson_1=require("../../../utils/miniappJson"),singletontask_1=require("../../../utils/singletontask"),buildCloud_1=tslib_1.__importStar(require("./buildCloud")),tools_1=require("../../../utils/tools"),codesign_1=require("../../../utils/codesign"),ProjectMiniappJsonSplashScreenThemeKey="__splashscreenTheme",_iconInfoMap={appStore1024:{size:[1024,1024],scale:1,idiom:"ios-marketing",required:!0},mainIcon120:{size:[60,60],scale:2,idiom:"iphone",required:!0},mainIcon180:{size:[60,60],scale:3,idiom:"iphone"},spotlightIcon80:{size:[40,40],scale:2,idiom:"iphone"},spotlightIcon120:{size:[40,40],scale:3,idiom:"iphone"},settingsIcon58:{size:[29,29],scale:2,idiom:"iphone"},settingsIcon87:{size:[29,29],scale:3,idiom:"iphone"},notificationIcon40:{size:[20,20],scale:2,idiom:"iphone"},notificationIcon60:{size:[20,20],scale:3,idiom:"iphone"},ipadMainIcon152:{size:[76,76],scale:2,idiom:"ipad"},ipadMainIcon167:{size:[83.5,83.5],scale:2,idiom:"ipad"},ipadSpotlightIcon40:{size:[40,40],scale:1,idiom:"ipad"},ipadSpotlightIcon80:{size:[40,40],scale:2,idiom:"ipad"},ipadSettingsIcon29:{size:[29,29],scale:1,idiom:"ipad"},ipadSpotlightIcon58:{size:[29,29],scale:2,idiom:"ipad"},ipadNotificationIcon20:{size:[20,20],scale:1,idiom:"ipad"},ipadNotificationIcon40:{size:[20,20],scale:2,idiom:"ipad"}},_allowTheme=["Light","LightSpecial","Dark","DarkSpecial","Default"],_getDepReg=e=>new RegExp(`s.subspec '${e}'.*\n(?:.*\n)*?(?:.*sp.vendored_frameworks = \\[\n)((?:.*'.*?'.*\n)*?)(?:.*\\]\n)`,"m"),buildIOSPluginTask={};class IOSUtils{constructor(e,i={},t,o){this.root=e,this.userConfig=i,this.miniappDirPath=t,this.devtoolsVersion=o}getProjectConfig(){const e=projectConfigUtils.getProjectConfig(this.root,this.userConfig);if(!e)throw new Error("iOS project folder not found. Are you sure this is a miniapp project?");return e}getBundleId(e){return child_process.execFileSync("/usr/libexec/PlistBuddy",["-c","Print:CFBundleIdentifier",path_1.default.join(e,"Info.plist")],{encoding:"utf8",env:(0,env_1.getProcessEnv)()}).trim()}tryInstallPod(e,i){const t=this.getProjectConfig(),{sourceDir:o}=t,n={cwd:o,env:(0,env_1.getProcessEnv)()};i.progress("export LANG=en_US.UTF-8 && pod install"),child_process.execSync("export LANG=en_US.UTF-8 && pod install",n)}async runLocal(e,i){const t=this.getProjectConfig(),{sourceDir:o}=t;process.chdir(o),this.tryInstallPod(e,i);const n=path_1.default.basename(t.name,path_1.default.extname(t.name)),s=e.scheme||n;if(i.progress(`Found Xcode ${t.isWorkspace?"workspace":"project"} "${t.name}"`),e.device||e.udid){if(e.udid||e.device){const o=await deviceUtils.getDevices({recorder:i}),n=o.find(i=>i.udid===e.udid||i.name===e.device);if(!n)throw new Error(`Could not find a device with udid(${e.udid}) or device(${e.device}). ${deviceUtils.printFoundDevices(o)}`);if("simulator"===n.type)return void await this.runOnSimulatorLocal(t,s,e,i);await this.runOnDeviceLocal(t,s,n,i)}}else await this.runOnSimulatorLocal(t,s,e,i)}async runCloud(e,i){var t;try{const{deviceType:o,udid:n,projectPath:s,demoIpaPath:a,sdkPath:r,bindingInfo:c,certificateInfo:l,arch:d="arm64",pluginDirList:u,miniappCacheDirPath:p,theme:h,i18nInfo:f,debugInfo:_,cacheAssetCarPath:m}=e,g=buildCloud_1.default.generateTempDemoIpaPath(a),b="simulator"===o,v=(0,miniappJson_1.tryGetIOSMiniappJson)(s);let y=c;if(l.signType===miniapp_builder_1.miniappSinTypes.appleId.type){const{mobileapp_info:e={}}=y;y=Object.assign(Object.assign({},y),{mobileapp_info:Object.assign(Object.assign({},e),{bundle_id:miniapp_builder_1.DEFAULT_BUNDLE_ID,debug_ios_bundle_id:miniapp_builder_1.DEFAULT_BUNDLE_ID})})}const S=await buildCloud_1.default.updateIOSInfoPlistInfo(s,y,g,v,i,f);await buildCloud_1.default.updateIOSAppConfigPlistInfo(s,y,g,v,r,b,i,h,f),await buildCloud_1.default.updateIOSAppexInfoPlistInfo(y,g,v,S,i),await buildCloud_1.default.updateIOSIcons(s,g,"",v,!1,i,!1,m),await buildCloud_1.default.updateSplashScreen(s,g,v,i,h,f),await buildCloud_1.default.updateSplashScreenVideo(s,g,v,i,f),await buildCloud_1.default.updateExtendedSdk(y,g,r,d,v,_,i),await buildCloud_1.default.updatePlugin(g,u,s,v,p,!1,S,i);const P=await buildCloud_1.default.getEntitlements(y,g,v,i);if(await buildCloud_1.default.updateIOSAppResource(s,g,v,i),"device"===o){const{mobileapp_info:e={}}=y,o=e.ios_flag&&e.bundle_id||e.debug_ios_bundle_id;await(0,miniapp_builder_1.signAndInstallOrExport)(s,g,p,l,{bundleId:o,install:!0,deviceId:n,entitlements:P,isPublish:!!(null===(t=null==l?void 0:l.selfCertificate)||void 0===t?void 0:t.isPublish)},{recorder:i,miniappDirPath:this.miniappDirPath,devtoolsVersion:this.devtoolsVersion})}else await this.runOnSimulatorCloud(g,{udid:n},i)}catch(e){throw new Error(e.message)}}async buildLocal(e,i){const t=this.getProjectConfig();process.chdir(t.sourceDir);const o=path_1.default.basename(t.name,path_1.default.extname(t.name)),n=e.scheme||o;this.tryInstallPod(e,i),i.progress("start build ipa...");const s=await this.buildProjectArchive(t,{output:e.output,scheme:n},i),a=await this.exportArchive(t,s,e,i);return console.log("Successfully build ipa: "+a),a}async buildCloud(e,i){try{const{projectPath:t,certificateInfo:o,miniappCacheDirPath:n}=e,s=await buildCloud_1.default.buildCloud(e,i),{demoIpaPath:a,opts:r}=s,c={recorder:i,miniappDirPath:this.miniappDirPath,devtoolsVersion:this.devtoolsVersion};s.isPublish||e.CILocalBuild||await(0,miniapp_builder_1.signAndInstallOrExport)(t,a,n,o,r,c)}catch(e){throw new Error(e.message)}}async genProjectMaterialMap(e,i,t,o){var n,s;const a=buildCloud_1.remoteBuildProjectMaterialAbsoluteCacheDir,r=path_1.default.join(i,a),c=(0,miniappJson_1.tryGetIOSMiniappJson)(e);function l(e,i){const t=fs_extra_1.default.lstatSync(e);fs_extra_1.default.ensureDirSync(path_1.default.dirname(i)),t.isDirectory()?fs_extra_1.default.copySync(e,i):fs_extra_1.default.copyFileSync(e,i)}function d(t,o,n=!0){if(!o){if(n)return"";throw new Error(`file cant be empty for cloud build, key: ${t} , fileName: ${o}`)}if(path_1.default.isAbsolute(o)){const e=path_1.default.basename(o);if(!fs_extra_1.default.existsSync(o)){if(n)return"";throw new Error(`file cant be empty for cloud build, key: ${t} , fileName: ${o}`)}const i=(0,tools_1.generateMD5)(o);return l(o,path_1.default.join(r,`${i}_${e}`)),path_1.default.join(a,e)}const s=path_1.default.join(e,o),c=path_1.default.join(i,o);if(!fs_extra_1.default.existsSync(s)){if(n)return"";throw new Error(`file cant be empty for cloud build, key: ${t} , fileName: ${o}`)}return l(s,c),o}fs_extra_1.default.ensureDirSync(r);const{privacy:u={},icons:p={},splashscreen:h={},buildCloud:f={}}=c,_=d("project.miniapp.json","project.miniapp.json",!1),m=d("project.config.json","project.config.json",!1),g=(0,miniappJson_1.getMiniprogramRoot)(e),b=d("app.json",path_1.default.join(g,"app.json"),!1),{template:v,contentViewImage:y,cancelButtonImage:S,confirmButtonImage:P}=u,w=d("privacy template",v),I=d("privacy contentViewImage",y),x=d("privacy cancelButtonImage",S),j=d("privacy confirmButtonImage",P),E=[];for(const e in p)if(p[e]){const i=d("icons."+e,p[e],!1);i&&E.push(i)}const O=d("splashscreen.customImage",h.customImage),D=d("splashscreen.customVideo",h.customVideo),{p12:C,profile:A,tpnsProfile:$}=f,T=d("p12 Path",C,!1),k=d("profile Path",A,!1);let B=void 0;!0===(null===(n=null==c?void 0:c.tpush)||void 0===n?void 0:n.useExtendedLib_WeAppTPNS)&&(B=d("tpns profile Path",$,!0!==(null===(s=null==c?void 0:c.tpush)||void 0===s?void 0:s.useExtendedLib_WeAppTPNS)));const U="miniapp/ios/i18nInfo.json",F=path_1.default.join(e,U),L=d("i18n",U,!0);if(fs_extra_1.default.existsSync(F)){const i=function(e,i){function t(i,t,o){if(t[o]&&"object"==typeof t[o][i])for(const n in t[o][i])if("object"==typeof t[o][i]){const s=t[o][i][n];if("string"==typeof s&&s.length>0){fs_extra_1.default.existsSync(path_1.default.isAbsolute(s)?s:path_1.default.join(e,s))&&d(`i18nFiles.${o}.${n}`,s,!0)}}}try{const o=fs_extra_1.default.readJSONSync(path_1.default.join(e,i));for(const e in o)t("ios",o,e),t("android",o,e)}catch(e){return e.message}}(e,U);if(i)throw o.message("error",i),new Error("copyi18NFiles error "+i)}const M=path_1.default.join(i,"project.miniapp.json");try{const e=fs_extra_1.default.readJsonSync(M);let{theme:i}=t;t.theme||(i="Dark"),e.__splashscreenTheme=i,fs_extra_1.default.writeJSONSync(M,e)}catch(e){throw new Error(`ReadWriteJsonFailed projectMiniappJsonCacheFilePath: ${M},error ${e.message}`)}const N=c["mini-plugin"];N&&Array.isArray(N.ios)&&N.ios.forEach(e=>{!0===e.open&&e.resourcePath&&d(`mini-plugin ios ${e.pluginId}:${e.resourcePath}`,e.resourcePath)});return{projectMiniappJson:_,projectConfigJson:m,appJson:b,privacyJson:w,privacyContentViewImage:I,privacyCancelButtonImage:x,privacyConfirmButtonImage:j,icons:E,splashScreen:O,splashScreenVideo:D,p12:T,profile:k,tpnsProfile:B,i18nJson:L,resourcePath:d("ios resourcePath",c.resourcePath,!0)}}async codesignIOSApp(e,i){const{projectPath:t,demoIpaPath:o,opts:n}=e,s=await(0,codesign_1.codesignAndExport)(t,o,e.miniappCacheDir||"",n,i,e.isUsingTpush,!1,!0);if(!0!==s.success)throw new Error("Build ipa failed:"+(s.errMsg||"codesignAndExport failed"))}async packIOSCloudBuildMaterial(e,i){i.progress("start uploadProjectAllMaterial");const{projectPath:t,matrialDistPath:o,theme:n}=e;await this.genProjectMaterialMap(t,o,e,i);i.progress("packIOSCloudBuildMaterial done")}async initUSBConnectionProcess(e,i){await(0,usbProcess_1.startUSBManagerProcess)(e,i)&&i.progress("Init USB Process Successfully")}launchSimulator(e,i){let t;try{t=JSON.parse(child_process.execFileSync("xcrun",["simctl","list","--json","devices"],{encoding:"utf8",env:(0,env_1.getProcessEnv)()}))}catch(e){throw new Error("Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues."+e.message)}const o=["iPhone 13","iPhone 12","iPhone 11"].reduce((e,i)=>e||deviceUtils.findMatchingSimulator(t,{device:i}),deviceUtils.findMatchingSimulator(t,e));if(!o)throw new Error("No simulator available with "+(e.device?`name "${e.device}"`:`udid "${e.udid}"`));const n=child_process.execFileSync("xcode-select",["-p"],{encoding:"utf8",env:(0,env_1.getProcessEnv)()}).trim();if(child_process.execFileSync("open",[n+"/Applications/Simulator.app","--args","-CurrentDeviceUDID",o.udid],{env:(0,env_1.getProcessEnv)()}),!o.booted){const e=deviceUtils.formattedDeviceName(o);i.progress("Launching "+e),child_process.spawnSync("xcrun",["simctl","boot",o.udid],{env:(0,env_1.getProcessEnv)()})}return o}async runOnSimulatorCloud(e,i,t){const{udid:o}=i,n=this.launchSimulator({udid:o},t);await this.installAppOnSimulator(n,e,t),await this.launchAppOnSimulator(n,e,t)}async runOnSimulatorLocal(e,i,t,o){const n=this.launchSimulator(t,o),{appPath:s}=await this.buildProjectApp(e,{udid:n.udid,scheme:i},o);await this.installAppOnSimulator(n,s,o),await this.launchAppOnSimulator(n,s,o)}async runOnDeviceLocal(e,i,t,o){const{appPath:n}=await this.buildProjectApp(e,{udid:t.udid,scheme:i},o);if("catalyst"===t.type){child_process.spawn(`${n}/${i}`,[],{detached:!0,stdio:"ignore",env:(0,env_1.getProcessEnv)()}).unref()}else{const e=["--bundle",n,"--id",t.udid,"--justlaunch"];o.progress("Installing and launching your app on "+t.name);const i=path_1.default.join(__dirname,"../../../vendor/ios-deploy/ios-deploy");await(0,cp_1.spawnSync)(i,e,{},o)}return o.progress("Install successfully the app to the device.")}buildProjectApp(e,i,t){return new Promise((o,n)=>{const{scheme:s,udid:a}=i,r=[e.isWorkspace?"-workspace":"-project",e.name,"-scheme",s];let c;a&&r.push("-destination","id="+a),t.progress(`Building (using "xcodebuild ${r.join(" ")}")`),this.xcbeautifyAvailable()?c=child_process.spawn("xcbeautify",[],{stdio:["pipe",process.stdout,process.stderr],env:(0,env_1.getProcessEnv)()}):this.xcprettyAvailable()&&(c=child_process.spawn("xcpretty",[],{stdio:["pipe",process.stdout,process.stderr],env:(0,env_1.getProcessEnv)()}));const l=child_process.spawn("xcodebuild",r,{env:(0,env_1.getProcessEnv)()});let d="",u="";l.stdout.on("data",e=>{const i=e.toString();t.progress(i),d+=i,c&&c.stdin.write(e)}),l.stderr.on("data",e=>{const i=e.toString();u+=i,t.progress(i)}),l.on("close",i=>{if(c&&c.stdin.end(),0!==i)return void n(new Error(` Failed to build iOS project.\n We ran "xcodebuild" command but it exited with error code ${i}. To debug build\n logs further, consider building your app with Xcode.app, by opening\n ${e.name}.\n ${c?void 0:`${d}\n${u}`}\n `));let a;try{a=this.getBuildInfo(e,d,s)}catch(e){n(e)}t.progress("Successfully built the app"),o(a)})})}async installAppOnSimulator(e,i,t){const o=["simctl","install",e.udid,i];await(0,cp_1.spawnSync)("xcrun",o,{},t)}async launchAppOnSimulator(e,i,t){const o=this.getBundleId(i),n=["simctl","launch",e.udid,o];await(0,cp_1.spawnSync)("xcrun",n,{},t),t.progress("Successfully launched the app on the simulator")}async buildProjectArchive(e,i,t){const{output:o,scheme:n,udid:s}=i,a=path_1.default.join(o,"./app"),{sourceDir:r}=e;fs_extra_1.default.ensureDirSync(path_1.default.dirname(a));const c=["archive",e.isWorkspace?"-workspace":"-project",e.name,"-scheme",n,"-archivePath",a];s&&c.push("-destination","id="+s);try{if(await(0,cp_1.spawnSync)("xcodebuild",c,{cwd:r},t),!fs_extra_1.default.existsSync(a+".xcarchive"))throw new Error(`Failed to build iOS project.\n ${a+".xcarchive"} does not found\n `);return t.progress(`Successfully archive the app: ${a}.xcarchive`),a+".xcarchive"}catch(i){throw new Error(`Failed to build iOS project. To debug build\n logs further, consider building your app with Xcode.app, by opening\n ${e.name}.\n `)}}async exportArchive(e,i,t,o){const n=path_1.default.join(t.output,"ipa");fs_extra_1.default.ensureDirSync(n),fs_extra_1.default.emptyDirSync(n);const{exportOptionPlistPath:s}=t;if(!s)throw new Error("build ios ipa require exportOptionPlistPath in project.miniapp.json");let a="";a=path_1.default.isAbsolute(s)?s:path_1.default.join(t.projectPath,s);const r=["-exportArchive","-archivePath",i,"-exportOptionsPlist",a,"-exportPath",n];try{await(0,cp_1.spawnSync)("xcodebuild",r,{cwd:e.sourceDir},o)}catch(i){throw new Error(`To debug build\n logs further, consider building your app with Xcode.app, by opening\n ${e.name}.\n `)}return fs_extra_1.default.removeSync(i),n}getTargetPaths(e){const i=JSON.parse(e);for(const e in i){if("app"===i[e].buildSettings.WRAPPER_EXTENSION)return{targetBuildDir:i[e].buildSettings.TARGET_BUILD_DIR,executableFolderPath:i[e].buildSettings.EXECUTABLE_FOLDER_PATH}}return{}}getBuildInfo(e,i,t){const o=this.getPlatformName(i),n=[e.isWorkspace?"-workspace":"-project",e.name,"-scheme",t,"-sdk",o,"-showBuildSettings","-json"].join(" "),s=child_process.execSync("xcodebuild "+n,{encoding:"utf8",cwd:e.sourceDir,env:(0,env_1.getProcessEnv)()}),a=this.getBuildProductDir(i),{executableFolderPath:r}=this.getTargetPaths(s);if(!r)throw new Error("Failed to get the app name.");return{sdk:o,appPath:`${a}/${r}`}}getPlatformName(e){const i=/export PLATFORM_NAME\\?="?(\w+)"?$/m.exec(e);if(!i)throw new Error("Couldn't find PLATFORM_NAME in xcodebuild output.");return i[1]}getBuildProductDir(e){const i=/export BUILT_PRODUCTS_DIR\\?="?(.+)"?$/m.exec(e);if(!i)throw new Error("Couldn't find BUILT_PRODUCTS_DIR in xcodebuild output.");return i[1]}xcbeautifyAvailable(){try{child_process.execSync("xcbeautify --version",{stdio:[0,"pipe","ignore"],env:(0,env_1.getProcessEnv)()})}catch(e){return!1}return!0}xcprettyAvailable(){try{child_process.execSync("xcpretty --version",{stdio:[0,"pipe","ignore"],env:(0,env_1.getProcessEnv)()})}catch(e){return!1}return!0}async buildPlugin(e,i){const{pluginId:t,projectPath:o,buildShellPath:n}=e;i.progress("start build native plugin...");try{const e=[o,t];fs_extra_1.default.chmodSync(n,"777"),buildIOSPluginTask[t]?(i.message("error","存在未结束的插件构建任务,需等待构建结束..."),await buildIOSPluginTask[t].getResult(!0)):(buildIOSPluginTask[t]=new singletontask_1.SingletonTask(cp_1.spawnSyncExecShell.bind(null,n,e,{},i)),await buildIOSPluginTask[t].getResult(!0),buildIOSPluginTask[t]=void 0)}catch(e){throw buildIOSPluginTask[t]=void 0,new Error("build plugin failed: "+e)}}async writeI18NInfoFile(e,i,t){Object.keys(i).forEach(o=>{if("base"===o)return;let n="";Object.keys(t).forEach(e=>{var s,a,r,c;(null===(a=null===(s=i[o])||void 0===s?void 0:s.ios)||void 0===a?void 0:a[t[e]])&&(n+=`${e} = "${null===(c=null===(r=i[o])||void 0===r?void 0:r.ios)||void 0===c?void 0:c[t[e]]}";\n`)}),n&&(fs_extra_1.default.ensureDirSync(path_1.default.join(e,o+".lproj")),fs_extra_1.default.writeFileSync(path_1.default.join(e,o+".lproj/InfoPlist.strings"),n))})}}exports.IOSUtils=IOSUtils;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MacroDefine=void 0;const define_1=require("../../../config/define"),defaultDefine={};class MacroDefine{constructor({filePath:t,targetPlatform:e,targetPlatformDefines:s={}}){this.defaultConstants=defaultDefine,this.customConstants={},this.defaultConstants.FILE=t,this.defaultConstants.PLATFORM=e,this.defaultConstants.MP=e===define_1.PLATFORM["mini-weixin"],this.defaultConstants.ANDROID=e===define_1.PLATFORM["mini-android"],this.defaultConstants.IOS=e===define_1.PLATFORM["mini-ios"],this.defaultConstants.NATIVE=e===define_1.PLATFORM["mini-android"]||e===define_1.PLATFORM["mini-ios"],this.defines(s)}defines(t){for(const e in t)this.define(e,t[e])}define(t,e){if(this.defaultConstants[t])throw new Error(`macro ${t} is forbidden`);this.customConstants[t]=e}isDefined(t){return!!this.defaultConstants[t]||!!this.customConstants[t]}getDefines(){return Object.assign(Object.assign({},this.defaultConstants),this.customConstants)}}exports.MacroDefine=MacroDefine;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MacroDefine=void 0;const define_1=require("../../../config/define"),defaultDefine={};class MacroDefine{constructor({filePath:t,targetPlatform:e,targetPlatformDefines:s={}}){this.defaultConstants=defaultDefine,this.customConstants={},this.defaultConstants.FILE=t,this.defaultConstants.PLATFORM=e,this.defaultConstants.MP=e===define_1.PLATFORM["mini-weixin"],this.defaultConstants.ANDROID=e===define_1.PLATFORM["mini-android"],this.defaultConstants.IOS=e===define_1.PLATFORM["mini-ios"],this.defaultConstants.OHOS=e===define_1.PLATFORM["mini-ohos"],this.defaultConstants.NATIVE=e===define_1.PLATFORM["mini-android"]||e===define_1.PLATFORM["mini-ios"]||e===define_1.PLATFORM["mini-ohos"],this.defines(s)}defines(t){for(const e in t)this.define(e,t[e])}define(t,e){if(this.defaultConstants[t])throw new Error(`macro ${t} is forbidden`);this.customConstants[t]=e}isDefined(t){return!!this.defaultConstants[t]||!!this.customConstants[t]}getDefines(){return Object.assign(Object.assign({},this.defaultConstants),this.customConstants)}}exports.MacroDefine=MacroDefine;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConditionCompiler=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_1=tslib_1.__importDefault(require("fs")),define_1=require("../../../config/define"),plant_1=require("./compiler/plant"),json_1=require("./compiler/json"),macro_1=require("./compiler/macro"),minimatch_1=tslib_1.__importDefault(require("minimatch")),tools_1=require("../../../utils/tools"),defaultCompileSetting={targetPlatform:define_1.PLATFORM["mini-weixin"],targetPlatformDefines:{}};class ConditionCompiler{constructor(t,e,o){this.extToCompiler={},this.project=t,this.devtoolMessagehub=e,this.consoleDisplay=o}getCompiler(t,e){const{targetPlatform:o,targetPlatformDefines:i={}}=e;if(!Object.values(define_1.PLATFORM).includes(o))throw new Error(`platform ${o} is not supported`);if(!this.extToCompiler[t]){let e=null;const r={targetPlatform:o,targetPlatformDefines:i,type:t};e=[".wxml",".wxss",".less",".scss",".wxs",".ts",".js"].includes(t)?new macro_1.MacroConditionCompiler(r):".json"===t?new json_1.JSONConditionCompiler(r):new plant_1.PlantConditionCompiler(r),this.extToCompiler[t]=e}return this.extToCompiler[t].targetPlatform=e.targetPlatform,this.extToCompiler[t].targetPlatformDefines=e.targetPlatformDefines||{},this.extToCompiler[t]}shouldCompile(t){return!this.project.miniprogramRoot||this.project.miniprogramRoot&&t.startsWith(this.project.miniprogramRoot)||"project.config.json"===t||"project.private.config.json"===t}compileFile(t,e=defaultCompileSetting){var o,i;try{const o=path_1.default.join(this.project.projectPath,t);if(!fs_1.default.existsSync(o))throw Error("no such file or direactory: "+o);const i=path_1.default.extname(o),r=this.getCompiler(i,e).compile(o,this.project.getFile("",t));return Buffer.isBuffer(r)?r:Buffer.from(r)}catch(t){throw null===(o=this.devtoolMessagehub)||void 0===o||o.showBuildLog("compileFile","error",t.message),null===(i=this.consoleDisplay)||void 0===i||i.display({command:"DISPLAY_ERROR",data:{error:{message:t.message}}}),t}}compileProject(t=defaultCompileSetting){var e;if(!Object.values(define_1.PLATFORM).includes(t.targetPlatform))throw new Error(`platform ${t.targetPlatform} is not supported`);try{const e={},{targetPlatform:o,targetPlatformDefines:i={}}=t,r=this.project.getFileList();for(const t of r){if(!this.shouldCompile(t))continue;const r=this.compileFile(t,{targetPlatform:o,targetPlatformDefines:i});e[t]=r}}catch(t){throw null===(e=this.devtoolMessagehub)||void 0===e||e.showBuildLog("compileProject","error",t.message),t}return{}}filterResourceByPlatfrom(t=defaultCompileSetting){const{targetPlatform:e=define_1.PLATFORM["mini-weixin"]}=t;let o=this.project.getFileList();const i=(0,tools_1.getAppJson)(this.project,e).static||[];for(const t of i){const{pattern:i="",platforms:r=[]}=t,s=path_1.default.join(this.project.miniprogramRoot||"",i);if(!r.includes(e)){const t=o.filter(t=>(0,minimatch_1.default)(t,s));o=o.filter(e=>!t.includes(e)&&e!==s&&!(0,tools_1.normalizePath)(e).startsWith((0,tools_1.normalizePath)(s)))}}return o}}exports.ConditionCompiler=ConditionCompiler;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConditionCompiler=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_1=tslib_1.__importDefault(require("fs")),define_1=require("../../../config/define"),plant_1=require("./compiler/plant"),json_1=require("./compiler/json"),macro_1=require("./compiler/macro"),minimatch_1=tslib_1.__importDefault(require("minimatch")),tools_1=require("../../../utils/tools"),defaultCompileSetting={targetPlatform:define_1.PLATFORM["mini-weixin"],targetPlatformDefines:{}};class ConditionCompiler{constructor(t,e,o){this.extToCompiler={},this.project=t,this.devtoolMessagehub=e,this.consoleDisplay=o}getCompiler(t,e){const{targetPlatform:o,targetPlatformDefines:i={}}=e;if(!Object.values(define_1.PLATFORM).includes(o))throw new Error(`platform ${o} is not supported`);if(!this.extToCompiler[t]){let e=null;const r={targetPlatform:o,targetPlatformDefines:i,type:t};e=[".wxml",".wxss",".less",".scss",".wxs",".ts",".js"].includes(t)?new macro_1.MacroConditionCompiler(r):".json"===t?new json_1.JSONConditionCompiler(r):new plant_1.PlantConditionCompiler(r),this.extToCompiler[t]=e}return this.extToCompiler[t].targetPlatform=e.targetPlatform,this.extToCompiler[t].targetPlatformDefines=e.targetPlatformDefines||{},this.extToCompiler[t]}shouldCompile(t){return!this.project.miniprogramRoot||this.project.miniprogramRoot&&t.startsWith(this.project.miniprogramRoot)||"project.config.json"===t||"project.private.config.json"===t}compileFile(t,e=defaultCompileSetting){var o,i;try{const o=path_1.default.join(this.project.projectPath,t);if(!fs_1.default.existsSync(o))throw Error("no such file or direactory: "+o);const i=path_1.default.extname(o),r=this.getCompiler(i,e),s=this.project.getFile("",t),l=r.compile(o,s);return Buffer.isBuffer(l)?l:Buffer.from(l)}catch(t){throw null===(o=this.devtoolMessagehub)||void 0===o||o.showBuildLog("compileFile","error",t.message),null===(i=this.consoleDisplay)||void 0===i||i.display({command:"DISPLAY_ERROR",data:{error:{message:t.message}}}),t}}compileProject(t=defaultCompileSetting){var e;if(!Object.values(define_1.PLATFORM).includes(t.targetPlatform))throw new Error(`platform ${t.targetPlatform} is not supported`);try{const e={},{targetPlatform:o,targetPlatformDefines:i={}}=t,r=this.project.getFileList();for(const t of r){if(!this.shouldCompile(t))continue;const r=this.compileFile(t,{targetPlatform:o,targetPlatformDefines:i});e[t]=r}}catch(t){throw null===(e=this.devtoolMessagehub)||void 0===e||e.showBuildLog("compileProject","error",t.message),t}return{}}filterResourceByPlatfrom(t=defaultCompileSetting){const{targetPlatform:e=define_1.PLATFORM["mini-weixin"]}=t;let o=this.project.getFileList();const i=(0,tools_1.getAppJson)(this.project,e).static||[];for(const t of i){const{pattern:i="",platforms:r=[]}=t,s=path_1.default.join(this.project.miniprogramRoot||"",i);if(!r.includes(e)){const t=o.filter(t=>(0,minimatch_1.default)(t,s));o=o.filter(e=>!t.includes(e)&&e!==s&&!(0,tools_1.normalizePath)(e).startsWith((0,tools_1.normalizePath)(s)))}}return o}}exports.ConditionCompiler=ConditionCompiler;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CIProject=exports.getProjectAttr=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_1=tslib_1.__importDefault(require("fs")),glob_1=tslib_1.__importDefault(require("glob")),config_1=require("../config/config"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),error_1=require("../utils/error"),request_1=require("../utils/request"),types_1=require("../types"),tools_1=require("../utils/tools"),baseProject_1=require("./baseProject"),projectattr_1=require("../ci/projectattr"),miniappattr_1=require("../ci/miniappattr");var projectattr_2=require("../ci/projectattr");Object.defineProperty(exports,"getProjectAttr",{enumerable:!0,get:function(){return projectattr_2.getProjectAttr}});class CIProject extends baseProject_1.BaseProject{constructor(t){super();const{type:e,projectPath:r,ignores:i,privateKey:o="",privateKeyPath:s=""}=t;let a=t.appid;if(!r)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("projectPath"),config_1.PARAM_ERROR);this._projectPath=path_1.default.isAbsolute(r)?(0,tools_1.normalizePath)(r):(0,tools_1.normalizePath)(path_1.default.join(process.cwd(),r));const p=this.getProjectConfig();if(!a){if(!p.appid)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("appid"),config_1.PARAM_ERROR);a=p.appid}if(o)this._privateKey=o;else{if(!s)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("privateKeyPath"),config_1.PARAM_ERROR);try{this._privateKey=fs_1.default.readFileSync(s).toString("utf8")}catch(t){throw new error_1.CodeError(t.toString(),config_1.PARAM_ERROR)}}this._projectArchitecture=p.projectArchitecture||"miniProgram",this._miniprogramRoot=p.miniprogramRoot||"",this._pluginRoot=p.pluginRoot||"",this._appid=a,this._type=e||types_1.EProjectType.miniProgram,this.ignores=i||[],this.setting=p.setting||{},this._project=t,this._targetPlatform=t.targetPlatform||"mini-weixin","object"==typeof p.packOptions&&(this.packOptions={ignore:Array.isArray(p.packOptions.ignore)?p.packOptions.ignore:[],include:Array.isArray(p.packOptions.include)?p.packOptions.include:[]}),this.init()}get project(){return this._project}async init(){(0,request_1.initGlobalProxy)(),this.updateFileAndDirs()}updateFileAndDirs(){const t=glob_1.default.sync("**",{nodir:!1,ignore:[...(0,config_1.getDefaultIgnores)(this),...this.ignores],nosort:!0,strict:!1,silent:!0,cwd:this.projectPath,absolute:!1,mark:!0,dot:!0});for(const e of t){const t=e.replace(/\\/g,path_1.default.posix.sep),r=fs_1.default.statSync(path_1.default.posix.join(this.projectPath,e));r.isDirectory()&&this.cacheDirName(this._dirSet,t.replace(/\/$/,"")),r.isFile()&&(this._fileSet.add(t),this.cacheDirName(this._dirSet,path_1.default.posix.dirname(t)))}}async attr(){return"function"==typeof this._project.attr?await this._project.attr():(this._attr||(this._attr=await(0,projectattr_1.getProjectAttr)(this._privateKey,this._appid)),this._attr)}async getExtAppid(){if(this._extAppid)return this._extAppid;if(null!==this._extAppid)try{const t=await this.getProjectConfig(),{miniprogramRoot:e=""}=t,r=this.getFile(e,"ext.json"),i=JSON.parse(r.toString("utf-8"));return i.extEnable&&i.extAppid?this._extAppid=i.extAppid:this._extAppid=null,this._extAppid}catch(t){this._extAppid=null}}isMiniappProject(){return"multiPlatform"===this._projectArchitecture}async miniappAttr(){return this.isMiniappProject()?this._miniappAttr?Promise.resolve(this._miniappAttr):(this._miniappAttr=await(0,miniappattr_1.getMiniappAttr)(this._privateKey,this._appid),this._miniappAttr):Promise.resolve({})}async serialize(){return Object.assign(Object.assign({},await super.serialize()),{targetPlatform:this._targetPlatform,targetPlatformDefines:{}})}}exports.CIProject=CIProject;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CIProject=exports.getProjectAttr=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_1=tslib_1.__importDefault(require("fs")),glob_1=tslib_1.__importDefault(require("glob")),config_1=require("../config/config"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),error_1=require("../utils/error"),request_1=require("../utils/request"),types_1=require("../types"),tools_1=require("../utils/tools"),baseProject_1=require("./baseProject"),projectattr_1=require("../ci/projectattr"),miniappattr_1=require("../ci/miniappattr");var projectattr_2=require("../ci/projectattr");Object.defineProperty(exports,"getProjectAttr",{enumerable:!0,get:function(){return projectattr_2.getProjectAttr}});class CIProject extends baseProject_1.BaseProject{constructor(t){super();const{type:e,projectPath:i,ignores:r,privateKey:o="",privateKeyPath:s=""}=t;let a=t.appid;if(!i)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("projectPath"),config_1.PARAM_ERROR);this._projectPath=path_1.default.isAbsolute(i)?(0,tools_1.normalizePath)(i):(0,tools_1.normalizePath)(path_1.default.join(process.cwd(),i));const p=this.getProjectConfig();if(!a){if(!p.appid)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("appid"),config_1.PARAM_ERROR);a=p.appid}if(o)this._privateKey=o;else{if(!s)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("privateKeyPath"),config_1.PARAM_ERROR);try{this._privateKey=fs_1.default.readFileSync(s).toString("utf8")}catch(t){throw new error_1.CodeError(t.toString(),config_1.PARAM_ERROR)}}this._projectArchitecture=p.projectArchitecture||"miniProgram",this._miniprogramRoot=p.miniprogramRoot||"",this._pluginRoot=p.pluginRoot||"",this._appid=a,this._type=e||types_1.EProjectType.miniProgram,this.ignores=r||[],this.setting=p.setting||{},this._project=t,this.targetPlatform=t.targetPlatform||(this.isMiniappProject()?"mini-android":"mini-weixin"),this.packOptions=t.packOptions||{ignore:[],include:[]},void 0===t.packOptions&&"object"==typeof p.packOptions&&(this.packOptions={ignore:Array.isArray(p.packOptions.ignore)?p.packOptions.ignore:[],include:Array.isArray(p.packOptions.include)?p.packOptions.include:[]}),this.init()}get project(){return this._project}async init(){(0,request_1.initGlobalProxy)(),this.updateFileAndDirs()}updateFileAndDirs(){const t=glob_1.default.sync("**",{nodir:!1,ignore:[...(0,config_1.getDefaultIgnores)(this),...this.ignores],nosort:!0,strict:!1,silent:!0,cwd:this.projectPath,absolute:!1,mark:!0,dot:!0});for(const e of t){const t=e.replace(/\\/g,path_1.default.posix.sep),i=fs_1.default.statSync(path_1.default.posix.join(this.projectPath,e));i.isDirectory()&&this.cacheDirName(this._dirSet,t.replace(/\/$/,"")),i.isFile()&&(this._fileSet.add(t),this.cacheDirName(this._dirSet,path_1.default.posix.dirname(t)))}}async attr(){return"function"==typeof this._project.attr?await this._project.attr():(this._attr||(this._attr=await(0,projectattr_1.getProjectAttr)(this._privateKey,this._appid)),this._attr)}async getExtAppid(){if(this._extAppid)return this._extAppid;if(null!==this._extAppid)try{const t=await this.getProjectConfig(),{miniprogramRoot:e=""}=t,i=this.getFile(e,"ext.json"),r=JSON.parse(i.toString("utf-8"));return r.extEnable&&r.extAppid?this._extAppid=r.extAppid:this._extAppid=null,this._extAppid}catch(t){this._extAppid=null}}isMiniappProject(){return"multiPlatform"===this._projectArchitecture}async miniappAttr(){return this.isMiniappProject()?this._miniappAttr?Promise.resolve(this._miniappAttr):(this._miniappAttr=await(0,miniappattr_1.getMiniappAttr)(this._privateKey,this._appid),this._miniappAttr):Promise.resolve({})}async serialize(){return console.warn("serialize",this.targetPlatform),Object.assign(Object.assign({},await super.serialize()),{targetPlatform:this.targetPlatform,targetPlatformDefines:{}})}}exports.CIProject=CIProject;
@@ -325,9 +325,13 @@ module.exports = {
325
325
  "additionalProperties": false
326
326
  },
327
327
  "lazyCodeLoading": {
328
+ "description": "小程序按需注入\n\nhttps://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html",
328
329
  "const": "requiredComponents",
329
330
  "type": "string"
330
331
  },
332
+ "lazyCodeLoadingLegacy": {
333
+ "type": "boolean"
334
+ },
331
335
  "enablePassiveEvent": {
332
336
  "anyOf": [
333
337
  {
@@ -500,6 +504,9 @@ module.exports = {
500
504
  "__usePrivacyCheck__": {
501
505
  "type": "boolean"
502
506
  },
507
+ "keepContextPageInCycleJump": {
508
+ "type": "boolean"
509
+ },
503
510
  "pages": {
504
511
  "type": "array",
505
512
  "items": {
@@ -820,9 +827,13 @@ module.exports = {
820
827
  "additionalProperties": false
821
828
  },
822
829
  "lazyCodeLoading": {
830
+ "description": "小程序按需注入\n\nhttps://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html",
823
831
  "const": "requiredComponents",
824
832
  "type": "string"
825
833
  },
834
+ "lazyCodeLoadingLegacy": {
835
+ "type": "boolean"
836
+ },
826
837
  "enablePassiveEvent": {
827
838
  "anyOf": [
828
839
  {
@@ -995,6 +1006,9 @@ module.exports = {
995
1006
  "__usePrivacyCheck__": {
996
1007
  "type": "boolean"
997
1008
  },
1009
+ "keepContextPageInCycleJump": {
1010
+ "type": "boolean"
1011
+ },
998
1012
  "pages": {
999
1013
  "type": "array",
1000
1014
  "items": {
@@ -1315,9 +1329,13 @@ module.exports = {
1315
1329
  "additionalProperties": false
1316
1330
  },
1317
1331
  "lazyCodeLoading": {
1332
+ "description": "小程序按需注入\n\nhttps://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html",
1318
1333
  "const": "requiredComponents",
1319
1334
  "type": "string"
1320
1335
  },
1336
+ "lazyCodeLoadingLegacy": {
1337
+ "type": "boolean"
1338
+ },
1321
1339
  "enablePassiveEvent": {
1322
1340
  "anyOf": [
1323
1341
  {
@@ -1490,6 +1508,9 @@ module.exports = {
1490
1508
  "__usePrivacyCheck__": {
1491
1509
  "type": "boolean"
1492
1510
  },
1511
+ "keepContextPageInCycleJump": {
1512
+ "type": "boolean"
1513
+ },
1493
1514
  "pages": {
1494
1515
  "type": "array",
1495
1516
  "items": {
@@ -1806,9 +1827,13 @@ module.exports = {
1806
1827
  "additionalProperties": false
1807
1828
  },
1808
1829
  "lazyCodeLoading": {
1830
+ "description": "小程序按需注入\n\nhttps://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html",
1809
1831
  "const": "requiredComponents",
1810
1832
  "type": "string"
1811
1833
  },
1834
+ "lazyCodeLoadingLegacy": {
1835
+ "type": "boolean"
1836
+ },
1812
1837
  "enablePassiveEvent": {
1813
1838
  "anyOf": [
1814
1839
  {
@@ -1980,6 +2005,9 @@ module.exports = {
1980
2005
  },
1981
2006
  "__usePrivacyCheck__": {
1982
2007
  "type": "boolean"
2008
+ },
2009
+ "keepContextPageInCycleJump": {
2010
+ "type": "boolean"
1983
2011
  }
1984
2012
  },
1985
2013
  "additionalProperties": false,
@@ -2289,5 +2317,5 @@ module.exports = {
2289
2317
  }
2290
2318
  },
2291
2319
  "$schema": "http://json-schema.org/draft-07/schema#",
2292
- "$version": 1734338530629
2320
+ "$version": 1749547010069
2293
2321
  }
@@ -545,7 +545,8 @@ module.exports = {
545
545
  "enum": [
546
546
  "chiaroscuro",
547
547
  "shine",
548
- "spin"
548
+ "spin",
549
+ ""
549
550
  ],
550
551
  "type": "string"
551
552
  },
@@ -1,4 +1,4 @@
1
- # !/bin/bash
1
+ #!/bin/bash
2
2
 
3
3
  SOURCEIPA="$1"
4
4
  OUTPUT="$2"
@@ -1 +1 @@
1
- "use strict";function shouldInspectCompiler(){var o;return!!global.__MINIPROGRAM_CI_TEST__||!!(null===(o=global.localStorage)||void 0===o?void 0:o.getItem("inspectCompiler"))}function shouldRunInMainProcess(){var o;return!!(null===(o=global.localStorage)||void 0===o?void 0:o.getItem("compilerInMainProcess"))}function shouldNotRunInWorker(){var o;return!!(null===(o=global.localStorage)||void 0===o?void 0:o.getItem("compilerNotInWorker"))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.shouldNotRunInWorker=exports.shouldRunInMainProcess=exports.shouldInspectCompiler=void 0,exports.shouldInspectCompiler=shouldInspectCompiler,exports.shouldRunInMainProcess=shouldRunInMainProcess,exports.shouldNotRunInWorker=shouldNotRunInWorker;
1
+ "use strict";async function shouldInspectCompiler(){var o,l,e,n;if(global.__MINIPROGRAM_CI_TEST__)return!0;if(null===(o=global.localStorage)||void 0===o?void 0:o.getItemAsync){if(await(null===(e=null===(l=global.localStorage)||void 0===l?void 0:l.getItemAsync)||void 0===e?void 0:e.call(l,"inspectCompiler")))return!0}else if(null===(n=global.localStorage)||void 0===n?void 0:n.getItem("inspectCompiler"))return!0;return!1}async function shouldRunInMainProcess(){var o,l,e,n;if(null===(o=global.localStorage)||void 0===o?void 0:o.getItemAsync){if(await(null===(e=null===(l=global.localStorage)||void 0===l?void 0:l.getItemAsync)||void 0===e?void 0:e.call(l,"compilerInMainProcess")))return!0}else if(null===(n=global.localStorage)||void 0===n?void 0:n.getItem("compilerInMainProcess"))return!0;return!1}async function shouldNotRunInWorker(){var o,l,e,n;if(null===(o=global.localStorage)||void 0===o?void 0:o.getItemAsync){if(await(null===(e=null===(l=global.localStorage)||void 0===l?void 0:l.getItemAsync)||void 0===e?void 0:e.call(l,"compilerNotInWorker")))return!0}else if(null===(n=global.localStorage)||void 0===n?void 0:n.getItem("compilerNotInWorker"))return!0;return!1}Object.defineProperty(exports,"__esModule",{value:!0}),exports.shouldNotRunInWorker=exports.shouldRunInMainProcess=exports.shouldInspectCompiler=void 0,exports.shouldInspectCompiler=shouldInspectCompiler,exports.shouldRunInMainProcess=shouldRunInMainProcess,exports.shouldNotRunInWorker=shouldNotRunInWorker;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.autoCompleteIOSPrivacyDesc=exports.isAndroidNeedClientJsExtInfo=exports.iosPrivacyDescObj=exports.getTargetMiniprogramArg=exports.getMiniprogramRoot=exports.getRawAppJSON=exports.iOSAppJsonIsUsingIPadResizable=exports.iOSMiniAppJsonIsUsingGDT=exports.iOSMiniAppJsonIsUsingTpush=exports.writeMiniAppJsonWithProjectPath=exports.isNewMiniAppProjectWithProjectPath=exports.isMiniAppProjectWithProjectPath=exports.tryGetPluginMiniappJson=exports.tryGetIOSMiniappJson=exports.tryGetAndroidMiniappJson=exports.getMiniappJson=exports.getRawMiniappJson=exports.identityServiceConfigToMiniAppJSON=exports.PLATFORM=exports.miniAppPlatformMap=void 0;const tools_1=require("./tools"),officialDonutPlugin_1=require("./officialDonutPlugin"),tools_2=require("../utils/tools"),each=require("licia/each"),safeSet=require("licia/safeSet"),path=require("path"),fse=require("fs-extra"),_=require("lodash");var PLATFORM;function identityServiceConfigToMiniAppJSON(i,e={}){return e.identityServiceConfig=Object.assign(Object.assign({},e.identityServiceConfig),{authorizeMiniprogramType:1,miniprogramLoginPath:i}),e}function getRawMiniappJson(i){var e,o,t,n,s,p,r,a,c;i=(0,tools_1.unifyPath)(i);const g=path.posix.join(i,"project.miniapp.json");if(!fse.existsSync(g))return{};let P={};try{P=fse.readJsonSync(g)}catch(i){console.error(i)}return P.miniVersion&&"v1"!==P.miniVersion||((null===(e=P[PLATFORM.ANDROID])||void 0===e?void 0:e.projectPath)&&!path.isAbsolute(null===(o=P[PLATFORM.ANDROID])||void 0===o?void 0:o.projectPath)&&(P[PLATFORM.ANDROID].projectPath=path.posix.join(i,null===(t=P[PLATFORM.ANDROID])||void 0===t?void 0:t.projectPath)),(null===(n=P[PLATFORM.IOS])||void 0===n?void 0:n.projectPath)&&!path.isAbsolute(null===(s=P[PLATFORM.IOS])||void 0===s?void 0:s.projectPath)&&(P[PLATFORM.IOS].projectPath=path.posix.join(i,null===(p=P[PLATFORM.IOS])||void 0===p?void 0:p.projectPath))),(null===(r=P[PLATFORM.ANDROID])||void 0===r?void 0:r.projectPath)&&!path.isAbsolute(null===(a=P[PLATFORM.ANDROID])||void 0===a?void 0:a.projectPath)&&(P[PLATFORM.ANDROID].projectPath=path.posix.join(i,null===(c=P[PLATFORM.ANDROID])||void 0===c?void 0:c.projectPath)),P}function getMiniappJson(i,e="mini-weixin"){const o=Object.values(exports.miniAppPlatformMap),t=getRawMiniappJson(i),n=_.omit(t,o);return _.merge(n,t[e]||("mini-weixin"===e?t["mini-wechat"]:{}))}function tryGetAndroidMiniappJson(i){let e;try{e=getMiniappJson(i,PLATFORM.ANDROID);const o=tryGetPluginMiniappJson(i);e&&(e["mini-plugin"]=o)}catch(i){}return e||{}}function tryGetIOSMiniappJson(i){let e;try{e=getMiniappJson(i,PLATFORM.IOS);const o=tryGetPluginMiniappJson(i);e&&(e["mini-plugin"]=o)}catch(i){}return e}function tryGetPluginMiniappJson(i){let e={};try{const o=getMiniappJson(i,PLATFORM.PLUGIN),t=getRawMiniappJson(i);e=(0,officialDonutPlugin_1.preprocessDonutPluginConfig)(o,t)}catch(i){}return e}function isMiniAppProjectWithProjectPath(i){const e=path.posix.join(i,"project.miniapp.json");return"multiPlatform"===fse.readJsonSync(e).projectArchitecture}function isNewMiniAppProjectWithProjectPath(i){const e=getRawMiniappJson(i);return isMiniAppProjectWithProjectPath(i)&&"v2"===e.miniVersion}function writeMiniAppJsonWithProjectPath(i,e){const o=path.posix.join(i,"project.miniapp.json");let t={};try{t=fse.readJsonSync(o)}catch(i){return}each(e,(i,e)=>{safeSet(t,e,i)}),fse.writeJSONSync(o,t,{spaces:2})}function iOSMiniAppJsonIsUsingTpush(i){const e=i.tpush&&!0===i.tpush.useExtendedLib_WeAppTPNS&&"number"==typeof i.tpush.accessID&&"string"==typeof i.tpush.accessKey&&"string"==typeof i.tpush.serviceBundleId;if(e&&(0,tools_1.compareVersion)(i.sdkVersion,"1.0.7")<=0)throw new Error(`can not use TPNS(消息推送) extendsdk in sdk version ${i.sdkVersion}, TPNS is supported in 1.0.8.`);return e}function iOSMiniAppJsonIsUsingGDT(i){const e=i.gdt&&!0===i.gdt.useExtendedLib_WeAppGDT&&"string"==typeof i.gdt.appid&&"string"==typeof i.gdt.splashAd_placementId;if(e&&(0,tools_1.compareVersion)(i.sdkVersion,"1.0.19")<=0)throw new Error(`can not use GDT(广告) extendsdk in sdk version ${i.sdkVersion}, GDT is supported in 1.0.20.`);return e}function iOSAppJsonIsUsingIPadResizable(i){return!0===getRawAppJSON(i).resizable}function getRawAppJSON(i){let e,o;const t=getMiniprogramRoot(i);e=t?path.posix.join(i,t,"app.json"):path.posix.join(i,"app.json");try{o=fse.readJsonSync(e)}catch(i){throw console.error(i),i}return o}function getMiniprogramRoot(i){const e=(0,tools_1.normalizePath)(path.posix.join(i,"project.config.json"));let o;try{o=fse.readJsonSync(e)}catch(i){throw console.error(i),i}return o.miniprogramRoot?o.miniprogramRoot:""}function getTargetMiniprogramArg(i,e){const o=(0,tools_1.normalizePath)(path.posix.join(i,"project.config.json"));let t;try{t=fse.readJsonSync(o)}catch(i){throw console.error(i),i}return t[e]||""}function isAndroidNeedClientJsExtInfo(i){const e=tryGetAndroidMiniappJson(i).sdkVersion;return(0,tools_2.compareSemVer)(e,"1.3.25")>0?1:0}exports.miniAppPlatformMap={"mini-android":"mini-android","mini-ios":"mini-ios","mini-weixin":"mini-weixin"},function(i){i.ANDROID="mini-android",i.IOS="mini-ios",i.PLUGIN="mini-plugin"}(PLATFORM=exports.PLATFORM||(exports.PLATFORM={})),exports.identityServiceConfigToMiniAppJSON=identityServiceConfigToMiniAppJSON,exports.getRawMiniappJson=getRawMiniappJson,exports.getMiniappJson=getMiniappJson,exports.tryGetAndroidMiniappJson=tryGetAndroidMiniappJson,exports.tryGetIOSMiniappJson=tryGetIOSMiniappJson,exports.tryGetPluginMiniappJson=tryGetPluginMiniappJson,exports.isMiniAppProjectWithProjectPath=isMiniAppProjectWithProjectPath,exports.isNewMiniAppProjectWithProjectPath=isNewMiniAppProjectWithProjectPath,exports.writeMiniAppJsonWithProjectPath=writeMiniAppJsonWithProjectPath,exports.iOSMiniAppJsonIsUsingTpush=iOSMiniAppJsonIsUsingTpush,exports.iOSMiniAppJsonIsUsingGDT=iOSMiniAppJsonIsUsingGDT,exports.iOSAppJsonIsUsingIPadResizable=iOSAppJsonIsUsingIPadResizable,exports.getRawAppJSON=getRawAppJSON,exports.getMiniprogramRoot=getMiniprogramRoot,exports.getTargetMiniprogramArg=getTargetMiniprogramArg,exports.iosPrivacyDescObj={NSPhotoLibraryUsageDescription:"当前应用程序需要访问用户的相册,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSCameraUsageDescription:"当前应用程序需要访问用户的相机,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSMicrophoneUsageDescription:"当前应用程序需要访问用户的麦克风,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSLocationWhenInUseUsageDescription:"当前应用程序需要在使用时访问用户的位置,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSLocationAlwaysUsageDescription:"当前应用程序需要始终访问用户的位置,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSLocationAlwaysAndWhenInUseUsageDescription:"当前应用程序需要始终和在使用时访问用户的位置,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSContactsUsageDescription:"当前应用程序需要访问用户的联系人,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSCalendarsUsageDescription:"当前应用程序需要访问用户的日历,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSRemindersUsageDescription:"当前应用程序需要访问用户的提醒事项,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSHealthShareUsageDescription:"",NSHealthUpdateUsageDescription:"",NSBluetoothPeripheralUsageDescription:"当前应用程序需要访问用户的蓝牙,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSBluetoothAlwaysUsageDescription:"当前应用程序需要始终访问用户的蓝牙,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSMotionUsageDescription:"",NSHomeKitUsageDescription:"",NSSiriUsageDescription:"",NSSpeechRecognitionUsageDescription:"当前应用程序需要使用语音识别,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSVideoSubscriberAccountUsageDescription:"",NSAppleMusicUsageDescription:"",NSFaceIDUsageDescription:"",NSNFCReaderUsageDescription:"",NSUserTrackingUsageDescription:"",NSLocalNetworkUsageDescription:"当前应用程序需要访问本地网络,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSSystemAdministrationUsageDescription:"当前应用程序需要进行系统管理操作,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NFCReaderUsageDescription:"",NSHealthClinicalHealthRecordsShareUsageDescription:"",NSPhotoLibraryAddUsageDescription:"应用程序在请求访问照片库,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可"},exports.isAndroidNeedClientJsExtInfo=isAndroidNeedClientJsExtInfo;const autoCompleteIOSPrivacyDesc=i=>{const e=getRawMiniappJson(i);return!(!e["mini-ios"]||!e["mini-ios"].enableAutoCompletePrivacyDesc&&void 0!==e["mini-ios"].enableAutoCompletePrivacyDesc)&&(e["mini-ios"].privateDescriptions||(e["mini-ios"].privateDescriptions={}),Object.keys(exports.iosPrivacyDescObj).forEach(i=>{!e["mini-ios"].privateDescriptions[i]&&exports.iosPrivacyDescObj[i]&&(e["mini-ios"].privateDescriptions[i]=exports.iosPrivacyDescObj[i])}),writeMiniAppJsonWithProjectPath(i,e),!0)};exports.autoCompleteIOSPrivacyDesc=autoCompleteIOSPrivacyDesc;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.autoCompleteIOSPrivacyDesc=exports.isAndroidNeedClientJsExtInfo=exports.iosPrivacyDescObj=exports.getTargetMiniprogramArg=exports.getMiniprogramRoot=exports.getRawAppJSON=exports.iOSAppJsonIsUsingIPadResizable=exports.iOSMiniAppJsonIsUsingGDT=exports.iOSMiniAppJsonIsUsingTpush=exports.writeMiniAppJsonWithProjectPath=exports.isNewMiniAppProjectWithProjectPath=exports.isMiniAppProjectWithProjectPath=exports.tryGetPluginMiniappJson=exports.tryGetIOSMiniappJson=exports.tryGetAndroidMiniappJson=exports.tryGetOhosMiniappJson=exports.getMiniappJson=exports.getRawMiniappJson=exports.identityServiceConfigToMiniAppJSON=exports.PLATFORM=exports.miniAppPlatformMap=void 0;const tools_1=require("./tools"),officialDonutPlugin_1=require("./officialDonutPlugin"),tools_2=require("../utils/tools"),each=require("licia/each"),safeSet=require("licia/safeSet"),path=require("path"),fse=require("fs-extra"),_=require("lodash");var PLATFORM;function identityServiceConfigToMiniAppJSON(i,o={}){return o.identityServiceConfig=Object.assign(Object.assign({},o.identityServiceConfig),{authorizeMiniprogramType:1,miniprogramLoginPath:i}),o}function getRawMiniappJson(i){var o,t,e,n,s,p,r,a,c;i=(0,tools_1.unifyPath)(i);const g=path.posix.join(i,"project.miniapp.json");if(!fse.existsSync(g))return{};let u={};try{u=fse.readJsonSync(g)}catch(i){console.error(i)}return u.miniVersion&&"v1"!==u.miniVersion||((null===(o=u[PLATFORM.ANDROID])||void 0===o?void 0:o.projectPath)&&!path.isAbsolute(null===(t=u[PLATFORM.ANDROID])||void 0===t?void 0:t.projectPath)&&(u[PLATFORM.ANDROID].projectPath=path.posix.join(i,null===(e=u[PLATFORM.ANDROID])||void 0===e?void 0:e.projectPath)),(null===(n=u[PLATFORM.IOS])||void 0===n?void 0:n.projectPath)&&!path.isAbsolute(null===(s=u[PLATFORM.IOS])||void 0===s?void 0:s.projectPath)&&(u[PLATFORM.IOS].projectPath=path.posix.join(i,null===(p=u[PLATFORM.IOS])||void 0===p?void 0:p.projectPath))),(null===(r=u[PLATFORM.ANDROID])||void 0===r?void 0:r.projectPath)&&!path.isAbsolute(null===(a=u[PLATFORM.ANDROID])||void 0===a?void 0:a.projectPath)&&(u[PLATFORM.ANDROID].projectPath=path.posix.join(i,null===(c=u[PLATFORM.ANDROID])||void 0===c?void 0:c.projectPath)),u}function getMiniappJson(i,o="mini-weixin"){const t=Object.values(exports.miniAppPlatformMap),e=getRawMiniappJson(i),n=_.omit(e,t);return _.merge(n,e[o]||("mini-weixin"===o?e["mini-wechat"]:{}))}function tryGetOhosMiniappJson(i){let o;try{o=getMiniappJson(i,PLATFORM.OHOS);const t=tryGetPluginMiniappJson(i);o&&(o["mini-plugin"]=t)}catch(i){}return o||{}}function tryGetAndroidMiniappJson(i){let o;try{o=getMiniappJson(i,PLATFORM.ANDROID);const t=tryGetPluginMiniappJson(i);o&&(o["mini-plugin"]=t)}catch(i){}return o||{}}function tryGetIOSMiniappJson(i){let o;try{o=getMiniappJson(i,PLATFORM.IOS);const t=tryGetPluginMiniappJson(i);o&&(o["mini-plugin"]=t)}catch(i){}return o}function tryGetPluginMiniappJson(i){let o={};try{const t=getMiniappJson(i,PLATFORM.PLUGIN),e=getRawMiniappJson(i);o=(0,officialDonutPlugin_1.preprocessDonutPluginConfig)(t,e)}catch(i){}return o}function isMiniAppProjectWithProjectPath(i){const o=path.posix.join(i,"project.miniapp.json");return"multiPlatform"===fse.readJsonSync(o).projectArchitecture}function isNewMiniAppProjectWithProjectPath(i){const o=getRawMiniappJson(i);return isMiniAppProjectWithProjectPath(i)&&"v2"===o.miniVersion}function writeMiniAppJsonWithProjectPath(i,o){const t=path.posix.join(i,"project.miniapp.json");let e={};try{e=fse.readJsonSync(t)}catch(i){return}each(o,(i,o)=>{safeSet(e,o,i)}),fse.writeJSONSync(t,e,{spaces:2})}function iOSMiniAppJsonIsUsingTpush(i){const o=i.tpush&&!0===i.tpush.useExtendedLib_WeAppTPNS&&"number"==typeof i.tpush.accessID&&"string"==typeof i.tpush.accessKey&&"string"==typeof i.tpush.serviceBundleId;if(o&&(0,tools_1.compareVersion)(i.sdkVersion,"1.0.7")<=0)throw new Error(`can not use TPNS(消息推送) extendsdk in sdk version ${i.sdkVersion}, TPNS is supported in 1.0.8.`);return o}function iOSMiniAppJsonIsUsingGDT(i){const o=i.gdt&&!0===i.gdt.useExtendedLib_WeAppGDT&&"string"==typeof i.gdt.appid&&"string"==typeof i.gdt.splashAd_placementId;if(o&&(0,tools_1.compareVersion)(i.sdkVersion,"1.0.19")<=0)throw new Error(`can not use GDT(广告) extendsdk in sdk version ${i.sdkVersion}, GDT is supported in 1.0.20.`);return o}function iOSAppJsonIsUsingIPadResizable(i){return!0===getRawAppJSON(i).resizable}function getRawAppJSON(i){let o,t;const e=getMiniprogramRoot(i);o=e?path.posix.join(i,e,"app.json"):path.posix.join(i,"app.json");try{t=fse.readJsonSync(o)}catch(i){throw console.error(i),i}return t}function getMiniprogramRoot(i){const o=(0,tools_1.normalizePath)(path.posix.join(i,"project.config.json"));let t;try{t=fse.readJsonSync(o)}catch(i){throw console.error(i),i}return t.miniprogramRoot?t.miniprogramRoot:""}function getTargetMiniprogramArg(i,o){const t=(0,tools_1.normalizePath)(path.posix.join(i,"project.config.json"));let e;try{e=fse.readJsonSync(t)}catch(i){throw console.error(i),i}return e[o]||""}function isAndroidNeedClientJsExtInfo(i){const o=tryGetAndroidMiniappJson(i).sdkVersion;return(0,tools_2.compareSemVer)(o,"1.3.25")>0?1:0}exports.miniAppPlatformMap={"mini-android":"mini-android","mini-ios":"mini-ios","mini-weixin":"mini-weixin"},function(i){i.ANDROID="mini-android",i.IOS="mini-ios",i.PLUGIN="mini-plugin",i.OHOS="mini-ohos"}(PLATFORM=exports.PLATFORM||(exports.PLATFORM={})),exports.identityServiceConfigToMiniAppJSON=identityServiceConfigToMiniAppJSON,exports.getRawMiniappJson=getRawMiniappJson,exports.getMiniappJson=getMiniappJson,exports.tryGetOhosMiniappJson=tryGetOhosMiniappJson,exports.tryGetAndroidMiniappJson=tryGetAndroidMiniappJson,exports.tryGetIOSMiniappJson=tryGetIOSMiniappJson,exports.tryGetPluginMiniappJson=tryGetPluginMiniappJson,exports.isMiniAppProjectWithProjectPath=isMiniAppProjectWithProjectPath,exports.isNewMiniAppProjectWithProjectPath=isNewMiniAppProjectWithProjectPath,exports.writeMiniAppJsonWithProjectPath=writeMiniAppJsonWithProjectPath,exports.iOSMiniAppJsonIsUsingTpush=iOSMiniAppJsonIsUsingTpush,exports.iOSMiniAppJsonIsUsingGDT=iOSMiniAppJsonIsUsingGDT,exports.iOSAppJsonIsUsingIPadResizable=iOSAppJsonIsUsingIPadResizable,exports.getRawAppJSON=getRawAppJSON,exports.getMiniprogramRoot=getMiniprogramRoot,exports.getTargetMiniprogramArg=getTargetMiniprogramArg,exports.iosPrivacyDescObj={NSPhotoLibraryUsageDescription:"当前应用程序需要访问用户的相册,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSCameraUsageDescription:"当前应用程序需要访问用户的相机,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSMicrophoneUsageDescription:"当前应用程序需要访问用户的麦克风,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSLocationWhenInUseUsageDescription:"当前应用程序需要在使用时访问用户的位置,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSLocationAlwaysUsageDescription:"当前应用程序需要始终访问用户的位置,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSLocationAlwaysAndWhenInUseUsageDescription:"当前应用程序需要始终和在使用时访问用户的位置,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSContactsUsageDescription:"当前应用程序需要访问用户的联系人,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSCalendarsUsageDescription:"当前应用程序需要访问用户的日历,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSRemindersUsageDescription:"当前应用程序需要访问用户的提醒事项,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSHealthShareUsageDescription:"",NSHealthUpdateUsageDescription:"",NSBluetoothPeripheralUsageDescription:"当前应用程序需要访问用户的蓝牙,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSBluetoothAlwaysUsageDescription:"当前应用程序需要始终访问用户的蓝牙,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSMotionUsageDescription:"",NSHomeKitUsageDescription:"",NSSiriUsageDescription:"",NSSpeechRecognitionUsageDescription:"当前应用程序需要使用语音识别,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSVideoSubscriberAccountUsageDescription:"",NSAppleMusicUsageDescription:"",NSFaceIDUsageDescription:"",NSNFCReaderUsageDescription:"",NSUserTrackingUsageDescription:"",NSLocalNetworkUsageDescription:"当前应用程序需要访问本地网络,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NSSystemAdministrationUsageDescription:"当前应用程序需要进行系统管理操作,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可」",NFCReaderUsageDescription:"",NSHealthClinicalHealthRecordsShareUsageDescription:"",NSPhotoLibraryAddUsageDescription:"应用程序在请求访问照片库,如需修改描述请前往「project.miniapp.json - 隐私信息访问许可描述」修改,并且关闭「自动使用默认描述补全默认隐私信息访问许可"},exports.isAndroidNeedClientJsExtInfo=isAndroidNeedClientJsExtInfo;const autoCompleteIOSPrivacyDesc=i=>{const o=getRawMiniappJson(i);return!(!o["mini-ios"]||!o["mini-ios"].enableAutoCompletePrivacyDesc&&void 0!==o["mini-ios"].enableAutoCompletePrivacyDesc)&&(o["mini-ios"].privateDescriptions||(o["mini-ios"].privateDescriptions={}),Object.keys(exports.iosPrivacyDescObj).forEach(i=>{!o["mini-ios"].privateDescriptions[i]&&exports.iosPrivacyDescObj[i]&&(o["mini-ios"].privateDescriptions[i]=exports.iosPrivacyDescObj[i])}),writeMiniAppJsonWithProjectPath(i,o),!0)};exports.autoCompleteIOSPrivacyDesc=autoCompleteIOSPrivacyDesc;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),path=tslib_1.__importStar(require("path")),filerules_1=tslib_1.__importDefault(require("../utils/filerules")),tools_1=require("./tools"),config_1=require("../config/config");class PackOptionsHelper{constructor(){this.packOptionIgnores=[],this.packOptionIncludes=[],this.ignoreUploadUnusedFiles=!1,this.ignoreDevUnusedFiles=!1,this.unusedFiles=new Set,this.projectRoot="",this.extOpts={include:[],ignore:[]}}setExtOpts(e={}){this.extOpts.include=e.include||[],this.extOpts.ignore=e.ignore||[]}updateState(e){var i,s;this.packOptionIgnores=(null===(i=e.packOptions)||void 0===i?void 0:i.ignore)||[],this.packOptionIncludes=(null===(s=e.packOptions)||void 0===s?void 0:s.include)||[],this.projectRoot=e.miniprogramRoot||"",this.ignoreUploadUnusedFiles=!1,this.ignoreDevUnusedFiles=!1,e.type===config_1.COMPILE_TYPE.miniProgram&&(this.ignoreUploadUnusedFiles=Boolean(e.setting.ignoreUploadUnusedFiles),this.ignoreDevUnusedFiles=Boolean(e.setting.ignoreDevUnusedFiles)),(0,tools_1.isPluginType)(e)&&(this.projectRoot=e.pluginRoot||"")}isUnuserFilesEnable(e=!1){return e?!1!==this.ignoreUploadUnusedFiles:!0===this.ignoreDevUnusedFiles||!1!==this.ignoreDevUnusedFiles}filter(e,i=!1){return e.filter(e=>this.isNotIgnored(e,i))}isIgnored(e,i=!1){return this.isIgnoredByRules(e)||this.isIgnoreByUnusedFiles(e,i)}isNotIgnored(e,i=!1){return!this.isIgnored(e,i)}isIgnoredByRules(e,i={}){return!this.isFileIncluded(e,i.include)&&this.isFileIgnored(e,i.ignore)}relativePath(e){return path.posix.relative(this.projectRoot,e)}isFileIgnored(e,i){return i||(i=[...this.packOptionIgnores,...this.extOpts.ignore]),filerules_1.default.isFileIgnored(e,i)}isFileIncluded(e,i){return i||(i=[...this.packOptionIncludes,...this.extOpts.include]),filerules_1.default.isFileIncluded(e,i)}isIgnoreByUnusedFiles(e,i=!1){return!!this.isUnuserFilesEnable(i)&&(!this.isFileIncluded(e)&&this.unusedFiles.has((0,tools_1.sourcePathToTargetPath)(e)))}getUnusedFiles(){return this.unusedFiles}async initUnusedFiles(e,i,s=!1){if(this.updateState(e),this.isUnuserFilesEnable(s)&&i)try{await i.analyse();const s=i.fileHelper.getFileList("").filter(e=>(0,tools_1.isCodeFile)(path.posix.extname(e))),t=new Set;i.graph.modules.forEach(e=>{const i=s.find(i=>i===e.path);i&&t.add((0,tools_1.sourcePathToTargetPath)(i))});const o=new Set;s.forEach(i=>{const s=(0,tools_1.sourcePathToTargetPath)(i);t.has(s)||o.add(path.posix.join(e.miniprogramRoot,s))}),this.unusedFiles=o,console.error(this.unusedFiles)}catch(e){console.error("initUnusedFiles error",e)}}}exports.default=new PackOptionsHelper;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),path=tslib_1.__importStar(require("path")),filerules_1=tslib_1.__importDefault(require("../utils/filerules")),tools_1=require("./tools"),config_1=require("../config/config");class PackOptionsHelper{constructor(){this.packOptionIgnores=[],this.packOptionIncludes=[],this.ignoreUploadUnusedFiles=!1,this.ignoreDevUnusedFiles=!1,this.unusedFiles=new Set,this.projectRoot="",this.extOpts={include:[],ignore:[]}}setExtOpts(e={}){this.extOpts.include=e.include||[],this.extOpts.ignore=e.ignore||[]}updateState(e){var s,i;this.packOptionIgnores=(null===(s=e.packOptions)||void 0===s?void 0:s.ignore)||[],this.packOptionIncludes=(null===(i=e.packOptions)||void 0===i?void 0:i.include)||[],this.projectRoot=e.miniprogramRoot||"",this.ignoreUploadUnusedFiles=!1,this.ignoreDevUnusedFiles=!1,e.type===config_1.COMPILE_TYPE.miniProgram&&(this.ignoreUploadUnusedFiles=Boolean(e.setting.ignoreUploadUnusedFiles),this.ignoreDevUnusedFiles=Boolean(e.setting.ignoreDevUnusedFiles)),(0,tools_1.isPluginType)(e)&&(this.projectRoot=e.pluginRoot||"")}isUnuserFilesEnable(e=!1){return e?!1!==this.ignoreUploadUnusedFiles:!0===this.ignoreDevUnusedFiles||!1!==this.ignoreDevUnusedFiles}filter(e,s=!1){return e.filter(e=>this.isNotIgnored(e,s))}isIgnored(e,s=!1){return this.isIgnoredByRules(e)||this.isIgnoreByUnusedFiles(e,s)}isNotIgnored(e,s=!1){return!this.isIgnored(e,s)}isIgnoredByRules(e,s={}){return!this.isFileIncluded(e,s.include)&&this.isFileIgnored(e,s.ignore)}relativePath(e){return path.posix.relative(this.projectRoot,e)}isFileIgnored(e,s){return s||(s=[...this.packOptionIgnores,...this.extOpts.ignore]),filerules_1.default.isFileIgnored(e,s)}isFileIncluded(e,s){return s||(s=[...this.packOptionIncludes,...this.extOpts.include]),filerules_1.default.isFileIncluded(e,s)}isIgnoreByUnusedFiles(e,s=!1){return!!this.isUnuserFilesEnable(s)&&(!this.isFileIncluded(e)&&this.unusedFiles.has((0,tools_1.sourcePathToTargetPath)(e)))}getUnusedFiles(){return this.unusedFiles}isScssOnlyImportedByFile(e){const s=path.extname(e.path);if("Wxss"===e.type&&[".scss",".sass",".less"].includes(s)&&e.parentDeps){let s=!0;return e.parentDeps.forEach(e=>{"file"!==e.from&&(s=!1)}),s}return!1}async initUnusedFiles(e,s,i=!1){if(this.updateState(e),this.isUnuserFilesEnable(i)&&s)try{await s.analyse();const i=s.fileHelper.getFileList("").filter(e=>(0,tools_1.isCodeFile)(path.posix.extname(e))),t=new Set;s.graph.modules.forEach(e=>{const s=i.find(s=>s===e.path);if(s){if(this.isScssOnlyImportedByFile(e))return;t.add((0,tools_1.sourcePathToTargetPath)(s))}});const n=new Set;i.forEach(s=>{const i=(0,tools_1.sourcePathToTargetPath)(s);t.has(i)||n.add(path.posix.join(e.miniprogramRoot,i))}),this.unusedFiles=n,console.error(this.unusedFiles)}catch(e){console.error("initUnusedFiles error",e)}}}exports.default=new PackOptionsHelper;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubProcessProxy=void 0;const processService_1=require("./processService"),customError_1=require("../customError"),singletontask_1=require("../singletontask"),debug_1=require("../debug");class SubProcessProxy{constructor(s,e,t,r,o=8891,i){this.project=s,this.entryPath=e,this.passData=t,this.initOptions=r,this.inspectPort=o,this.progressUpdate=i,this.taskMap=new Map,this.taskId=0,this.init=async()=>{this.process=await this.forkProcess()},this.onMessage=s=>{var e,t;if(this._cpPromise&&("ready"===s.type&&(clearTimeout(this._cpPromise.timer),null===(e=this._cpPromise)||void 0===e||e.resolve()),"noReady"===s.type&&this._cpPromise.reject(new Error(s.error.message))),"progress"===s.type){const e=this.taskMap.get(s.taskId);(null==e?void 0:e.progressUpdate)&&e.progressUpdate(s.id,s.status,s.message)}if("log"===s.type&&(null===(t=this.progressUpdate)||void 0===t||t.call(this,s.id||"",s.status,s.text)),"response"===s.type){const{id:e,data:t,error:r}=s;r?this.onResponse(e,void 0,r):this.onResponse(e,t,void 0)}}}async ready(){var s;return this._checkReadyTask||(this._checkReadyTask=new singletontask_1.SingletonTask(this.init)),await(null===(s=this._checkReadyTask)||void 0===s?void 0:s.getResult(!0))}async sendProcessMessage(s){await this.ready(),this.process.send(s)}destroy(){var s;null===(s=this.process)||void 0===s||s.kill("SIGTERM"),this.process=void 0,this._checkReadyTask=void 0}async forkProcess(){const s=await this.project.serialize(),e={type:"init",data:{passData:this.passData,projectInfo:s,options:this.initOptions}};if((0,debug_1.shouldRunInMainProcess)()){const s=require("../../modules/corecompiler/processHandler");return await s.initHandler(e),s.onMessage(this.onMessage),{send:e=>{(0,debug_1.shouldRunInMainProcess)()&&s.messageHandler(e)},kill:e=>(s.destroy(),!0)}}return await(0,processService_1.forkProcess)(this,this.entryPath,this.project.projectPath,e,this.inspectPort)}onResponse(s,e,t){const r=this.taskMap.get(s);this.taskMap.delete(s),r?t?(t=new customError_1.CustomError(t),r.reject(t)):r.resolve(e):console.error(`child process task: ${s} not found`)}async sendEvent(s,e){this.sendProcessMessage({type:"event",name:s,data:e})}async runTask(s,e,t){return new Promise((r,o)=>{const i={name:s,data:e,resolve:r,reject:o,progressUpdate:t};this.taskId+=1,this.taskMap.set(this.taskId,i),this.sendProcessMessage({type:"request",id:this.taskId,name:s,data:e})})}}exports.SubProcessProxy=SubProcessProxy;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubProcessProxy=void 0;const processService_1=require("./processService"),customError_1=require("../customError"),singletontask_1=require("../singletontask"),debug_1=require("../debug");class SubProcessProxy{constructor(s,e,t,r,o=8891,i){this.project=s,this.entryPath=e,this.passData=t,this.initOptions=r,this.inspectPort=o,this.progressUpdate=i,this.taskMap=new Map,this.taskId=0,this.init=async()=>{this.process=await this.forkProcess()},this.onMessage=s=>{var e,t;if(this._cpPromise&&("ready"===s.type&&(clearTimeout(this._cpPromise.timer),null===(e=this._cpPromise)||void 0===e||e.resolve()),"noReady"===s.type&&this._cpPromise.reject(new Error(s.error.message))),"progress"===s.type){const e=this.taskMap.get(s.taskId);(null==e?void 0:e.progressUpdate)&&e.progressUpdate(s.id,s.status,s.message)}if("log"===s.type&&(null===(t=this.progressUpdate)||void 0===t||t.call(this,s.id||"",s.status,s.text)),"response"===s.type){const{id:e,data:t,error:r}=s;r?this.onResponse(e,void 0,r):this.onResponse(e,t,void 0)}}}async ready(){var s;return this._checkReadyTask||(this._checkReadyTask=new singletontask_1.SingletonTask(this.init)),await(null===(s=this._checkReadyTask)||void 0===s?void 0:s.getResult(!0))}async sendProcessMessage(s){await this.ready(),this.process.send(s)}destroy(){var s;null===(s=this.process)||void 0===s||s.kill("SIGTERM"),this.process=void 0,this._checkReadyTask=void 0}async forkProcess(){const s=await this.project.serialize(),e={type:"init",data:{passData:this.passData,projectInfo:s,options:this.initOptions}},t=await(0,debug_1.shouldRunInMainProcess)();if(t){const s=require("../../modules/corecompiler/processHandler");return await s.initHandler(e),s.onMessage(this.onMessage),{send:e=>{t&&s.messageHandler(e)},kill:e=>(s.destroy(),!0)}}return await(0,processService_1.forkProcess)(this,this.entryPath,this.project.projectPath,e,this.inspectPort)}onResponse(s,e,t){const r=this.taskMap.get(s);this.taskMap.delete(s),r?t?(t=new customError_1.CustomError(t),r.reject(t)):r.resolve(e):console.error(`child process task: ${s} not found`)}async sendEvent(s,e){this.sendProcessMessage({type:"event",name:s,data:e})}async runTask(s,e,t){return new Promise((r,o)=>{const i={name:s,data:e,resolve:r,reject:o,progressUpdate:t};this.taskId+=1,this.taskMap.set(this.taskId,i);this.sendProcessMessage({type:"request",id:this.taskId,name:s,data:e}).catch(s=>{o(s)})})}}exports.SubProcessProxy=SubProcessProxy;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.forkProcess=void 0;const tslib_1=require("tslib"),child_process_1=require("child_process"),debug_1=require("../debug"),path_1=tslib_1.__importDefault(require("path")),env_1=require("../env"),PROCESS_READY_TIMEOUT=2e4;async function forkProcess(e,s,o,r,t=8891){const c=s,i={stdio:["pipe","pipe","pipe","ipc"],cwd:o,env:Object.assign(Object.assign({},process.env),{cpprocessEnv:"childprocess",nativeProcess:"1",timeout:global.TEST_COMPILER_PROCESS_TIMEOUT})};if((0,debug_1.shouldInspectCompiler)()&&(i.execArgv=["--inspect-brk="+t],i.env.__MINIPROGRAM_CI_TEST__="true"),i.env.isDevtools=env_1.isDevtools,env_1.isDevtools){let e=path_1.default.join(path_1.default.dirname(process.execPath),"node");"darwin"!==process.platform&&(e+=".exe"),i.execPath=e}return new Promise((s,o)=>{const t=(0,child_process_1.fork)(c,["--expose-gc"],i),n=setTimeout(()=>{e.destroy(),o(new Error("fork process timeout"))},2e4);return e._cpPromise={timer:n,resolve:()=>{s(t)},reject:o},t.stdout.setEncoding("utf8"),t.stdout.on("data",e=>{console.log("child process stdout: "+e)}),t.stderr.on("data",e=>{console.error("child process stderr: "+e)}),t.on("exit",(s,r)=>{e.process=void 0,e._checkReadyTask=void 0,env_1.isDevtools&&console.error(`child process exit: code(${s}), signal(${r})`),0!==s&&o(new Error(`native child process exit: code(${s}), signal(${r})`))}),t.on("message",e.onMessage),t.unref(),e.taskId+=1,t.send(r),t})}exports.forkProcess=forkProcess;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.forkProcess=void 0;const tslib_1=require("tslib"),child_process_1=require("child_process"),debug_1=require("../debug"),path_1=tslib_1.__importDefault(require("path")),env_1=require("../env"),PROCESS_READY_TIMEOUT=2e4;async function forkProcess(e,s,o,r,t=8891){const c=s,i={stdio:["pipe","pipe","pipe","ipc"],cwd:o,env:Object.assign(Object.assign({},process.env),{cpprocessEnv:"childprocess",nativeProcess:"1",timeout:global.TEST_COMPILER_PROCESS_TIMEOUT})};if(await(0,debug_1.shouldInspectCompiler)()&&(i.execArgv=["--inspect-brk="+t],i.env.__MINIPROGRAM_CI_TEST__="true"),i.env.isDevtools=env_1.isDevtools,env_1.isDevtools){let e=path_1.default.join(path_1.default.dirname(process.execPath),"node");"darwin"!==process.platform&&(e+=".exe"),i.execPath=e}return new Promise((s,o)=>{const t=(0,child_process_1.fork)(c,["--expose-gc"],i),n=setTimeout(()=>{e.destroy(),o(new Error("fork process timeout"))},2e4);return e._cpPromise={timer:n,resolve:()=>{s(t)},reject:o},t.stdout.setEncoding("utf8"),t.stdout.on("data",e=>{console.log("child process stdout: "+e)}),t.stderr.on("data",e=>{console.error("child process stderr: "+e)}),t.on("exit",(s,r)=>{e.process=void 0,e._checkReadyTask=void 0,env_1.isDevtools&&console.error(`child process exit: code(${s}), signal(${r})`),0!==s&&o(new Error(`native child process exit: code(${s}), signal(${r})`))}),t.on("message",e.onMessage),t.unref(),e.taskId+=1,t.send(r),t})}exports.forkProcess=forkProcess;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miniprogram-ci",
3
- "version": "2.1.16",
3
+ "version": "2.1.18",
4
4
  "description": "Module that build miniprogram project for web or app extracted from WeChatDevtools.",
5
5
  "homepage": "https://developers.weixin.qq.com/community/homepage",
6
6
  "main": "dist/index.js",