miniprogram-ci 2.1.18 → 2.1.20

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 (35) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +7 -2
  3. package/dist/@types/ci/upload.d.ts +1 -0
  4. package/dist/@types/config/config.d.ts +1 -1
  5. package/dist/@types/index.d.ts +2 -1
  6. package/dist/@types/modules/corecompiler/summerCompiler.d.ts +2 -0
  7. package/dist/@types/schema/@types/appjson.d.ts +1 -1
  8. package/dist/@types/schema/@types/pagejson.d.ts +1 -0
  9. package/dist/@types/utils/miniappJson.d.ts +1 -0
  10. package/dist/ci/android-miniapp-toolkit/dist/index.js +1 -1
  11. package/dist/ci/cos-upload.js +1 -1
  12. package/dist/ci/gamepkg/index.js +1 -1
  13. package/dist/ci/getCompiledResult.js +1 -1
  14. package/dist/ci/miniapp/miniappPlugin.js +1 -1
  15. package/dist/ci/miniapp/upload.js +1 -1
  16. package/dist/ci/upload.js +1 -1
  17. package/dist/common/code-analyse/index.js +1 -1
  18. package/dist/config/config.js +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/modules/corecompiler/summer/plugins/base/wxss.js +1 -1
  21. package/dist/modules/corecompiler/summerCompiler.js +1 -1
  22. package/dist/modules/nativecompiler/ios/index.js +1 -1
  23. package/dist/schema/dist/app.js +2 -1
  24. package/dist/schema/dist/ext.js +4 -1
  25. package/dist/schema/dist/game.js +1 -1
  26. package/dist/schema/dist/page.js +4 -1
  27. package/dist/schema/dist/plugin.js +1 -1
  28. package/dist/schema/dist/pluginpage.js +1 -1
  29. package/dist/schema/dist/projectconfig.js +3 -3
  30. package/dist/schema/dist/projectprivateconfig.js +1 -1
  31. package/dist/schema/dist/sitemap.js +1 -1
  32. package/dist/schema/dist/theme.js +1 -1
  33. package/dist/static/scripts/resignIpa +10 -2
  34. package/dist/utils/miniappJson.js +1 -1
  35. package/package.json +3 -1
@@ -1 +1 @@
1
- "use strict";var COMPILE_TYPE,AstType,EFilterCode;function getDefaultIgnores(e){const _=["node_modules/**/*","**/node_modules/**","**/.git/**",".git/**/*","**/.svn/**",".svn/**/*",".DS_Store","**/.DS_Store"];return"multiPlatform"===e.projectArchitecture&&_.push(exports.multiPlatformRoot+"/**/*"),_}Object.defineProperty(exports,"__esModule",{value:!0}),exports.MAX_CODE_LENGTH=exports.EFilterCode=exports.AstType=exports.compileTypeConfig=exports.getDefaultIgnores=exports.FullPkg=exports.MainPkg=exports.multiPlatformRoot=exports.extendedLibMap=exports.jsonVariablePropertyWhiteList=exports.DefaultProjectAttr=exports.TABBAR_ICON_WHITE_LIST=exports.COMPILE_TYPE=exports.APP_TYPE=exports.MINI_GAME_WORKERS_PACKAGE_ROOT=exports.MINI_GAME_MAIN_PACKAGE_ROOT=exports.MINI_PROGRAM_MAIN_PACKAGE_ROOT=exports.PROJECT_TYPE_ERROR=exports.GET_LATEST_VERSION_CGI_ERR=exports.UPLOAD_JS_SERVER_CGI_ERR=exports.CODE_PROTECT_TRANSLATE_FILENAME=exports.UPLOAD_CGI_ERR=exports.GENERATE_LOCAL_SIGNATURE_ERR=exports.GET_SIGNATURE_RAND_STRING_ERR=exports.APP_JSON_NOT_FOUND=exports.JSON_CONTENT_ERR=exports.FILE_NOT_UTF8=exports.JSON_PARSE_ERR=exports.FILE_NOT_FOUND=exports.PLUGIN_JSON_PARSE_ERR=exports.PLUGIN_JSON_CONTENT_ERR=exports.PLUGIN_JSON_FILE_NOT_FOUND=exports.GAME_PLUGIN_LIB_MD5_NOT_MATCH=exports.SUMMER_PLUGIN_CODE_ERR=exports.SUMMER_PLUGIN_ERR=exports.MINIFY_WXML_ERR=exports.POST_WXSS_ERR=exports.FILE_FLAT_ERR=exports.JS_ES6_ERR=exports.BABILI_JS_ERR=exports.UGLIFY_JS_ERR=exports.BABEL_TRANS_JS_ERR=exports.JS_NOT_FOUND=exports.WXML_NOT_FOUND=exports.PARAM_ERROR=exports.CI_VERSION=void 0,exports.CI_VERSION="2.1.18",exports.PARAM_ERROR=1e4,exports.WXML_NOT_FOUND=10007,exports.JS_NOT_FOUND=10008,exports.BABEL_TRANS_JS_ERR=10032,exports.UGLIFY_JS_ERR=10033,exports.BABILI_JS_ERR=10034,exports.JS_ES6_ERR=10035,exports.FILE_FLAT_ERR=10036,exports.POST_WXSS_ERR=10037,exports.MINIFY_WXML_ERR=10038,exports.SUMMER_PLUGIN_ERR=10045,exports.SUMMER_PLUGIN_CODE_ERR=10046,exports.GAME_PLUGIN_LIB_MD5_NOT_MATCH=10081,exports.PLUGIN_JSON_FILE_NOT_FOUND=10091,exports.PLUGIN_JSON_CONTENT_ERR=10092,exports.PLUGIN_JSON_PARSE_ERR=10093,exports.FILE_NOT_FOUND=10005,exports.JSON_PARSE_ERR=10006,exports.FILE_NOT_UTF8=10031,exports.JSON_CONTENT_ERR=10009,exports.APP_JSON_NOT_FOUND=2e4,exports.GET_SIGNATURE_RAND_STRING_ERR=20001,exports.GENERATE_LOCAL_SIGNATURE_ERR=20002,exports.UPLOAD_CGI_ERR=20003,exports.CODE_PROTECT_TRANSLATE_FILENAME=20004,exports.UPLOAD_JS_SERVER_CGI_ERR=20005,exports.GET_LATEST_VERSION_CGI_ERR=20006,exports.PROJECT_TYPE_ERROR=3e4,exports.MINI_PROGRAM_MAIN_PACKAGE_ROOT="__APP__",exports.MINI_GAME_MAIN_PACKAGE_ROOT="__GAME__",exports.MINI_GAME_WORKERS_PACKAGE_ROOT="workers.js",exports.APP_TYPE={NORMAL:0,PLUGIN:1,SHOP:2,MINISHOP:3,GAME:4,CARD:5,NATIVE:7},function(e){e.miniProgram="miniProgram",e.miniProgramPlugin="miniProgramPlugin",e.miniGame="miniGame",e.miniGamePlugin="miniGamePlugin"}(COMPILE_TYPE=exports.COMPILE_TYPE||(exports.COMPILE_TYPE={})),exports.TABBAR_ICON_WHITE_LIST=[".png",".jpg",".jpeg"],exports.DefaultProjectAttr={platform:!1,appType:0,isSandbox:!1,released:!1,setting:{MaxCodeSize:2,MaxSubpackageSubCodeSize:2,MaxSubpackageFullCodeSize:12,NavigateMiniprogramLimit:10,MaxSubPackageLimit:100,MinTabbarCount:2,MaxTabbarCount:5,MaxCustomTabbarCount:10,MaxTabbarIconSize:40}},exports.jsonVariablePropertyWhiteList={windowPropertWhiteList:["navigationBarBackgroundColor","navigationBarTextStyle","backgroundColor","backgroundTextStyle","backgroundColorTop","backgroundColorBottom","backgroundColorContent"],tabBarPropertyWhiteList:["color","selectedColor","backgroundColor","borderStyle"],tabbarListItemPropertyWhiteList:["iconPath","selectedIconPath"]},exports.extendedLibMap={kbone:{packages:["miniprogram-element","miniprogram-render"]},weui:{packages:["weui-miniprogram"]}},exports.multiPlatformRoot="miniapp",exports.MainPkg="__APP__",exports.FullPkg="__FULL__",exports.getDefaultIgnores=getDefaultIgnores,exports.compileTypeConfig={weapp:"weapp",game:"game",plugin:"plugin",gamePlugin:"gamePlugin"},function(e){e.Babel="babel",e.Acorn="acorn"}(AstType=exports.AstType||(exports.AstType={})),function(e){e[e.Include=0]="Include",e[e.PackOptionsIgnore=1]="PackOptionsIgnore",e[e.AnalyseNoUse=2]="AnalyseNoUse",e[e.PartialCompileNoUse=3]="PartialCompileNoUse"}(EFilterCode=exports.EFilterCode||(exports.EFilterCode={})),exports.MAX_CODE_LENGTH=2048e3;
1
+ "use strict";var COMPILE_TYPE,AstType,EFilterCode;function getDefaultIgnores(e){const _=["node_modules/**/*","**/node_modules/**","**/.git/**",".git/**/*","**/.svn/**",".svn/**/*",".DS_Store","**/.DS_Store"];return"multiPlatform"===e.projectArchitecture&&_.push(exports.multiPlatformRoot+"/**/*"),_}Object.defineProperty(exports,"__esModule",{value:!0}),exports.MAX_CODE_LENGTH=exports.EFilterCode=exports.AstType=exports.compileTypeConfig=exports.getDefaultIgnores=exports.FullPkg=exports.MainPkg=exports.multiPlatformRoot=exports.extendedLibMap=exports.jsonVariablePropertyWhiteList=exports.DefaultProjectAttr=exports.TABBAR_ICON_WHITE_LIST=exports.COMPILE_TYPE=exports.APP_TYPE=exports.MINI_GAME_WORKERS_PACKAGE_ROOT=exports.MINI_GAME_MAIN_PACKAGE_ROOT=exports.MINI_PROGRAM_MAIN_PACKAGE_ROOT=exports.PROJECT_TYPE_ERROR=exports.GET_LATEST_VERSION_CGI_ERR=exports.UPLOAD_JS_SERVER_CGI_ERR=exports.CODE_PROTECT_TRANSLATE_FILENAME=exports.UPLOAD_CGI_ERR=exports.GENERATE_LOCAL_SIGNATURE_ERR=exports.GET_SIGNATURE_RAND_STRING_ERR=exports.APP_JSON_NOT_FOUND=exports.JSON_CONTENT_ERR=exports.FILE_NOT_UTF8=exports.JSON_PARSE_ERR=exports.FILE_NOT_FOUND=exports.PLUGIN_JSON_PARSE_ERR=exports.PLUGIN_JSON_CONTENT_ERR=exports.PLUGIN_JSON_FILE_NOT_FOUND=exports.GAME_PLUGIN_LIB_MD5_NOT_MATCH=exports.SUMMER_PLUGIN_CODE_ERR=exports.SUMMER_PLUGIN_ERR=exports.MINIFY_WXML_ERR=exports.POST_WXSS_ERR=exports.FILE_FLAT_ERR=exports.JS_ES6_ERR=exports.BABILI_JS_ERR=exports.UGLIFY_JS_ERR=exports.BABEL_TRANS_JS_ERR=exports.JS_NOT_FOUND=exports.WXML_NOT_FOUND=exports.PARAM_ERROR=exports.CI_VERSION=void 0,exports.CI_VERSION="2.1.20",exports.PARAM_ERROR=1e4,exports.WXML_NOT_FOUND=10007,exports.JS_NOT_FOUND=10008,exports.BABEL_TRANS_JS_ERR=10032,exports.UGLIFY_JS_ERR=10033,exports.BABILI_JS_ERR=10034,exports.JS_ES6_ERR=10035,exports.FILE_FLAT_ERR=10036,exports.POST_WXSS_ERR=10037,exports.MINIFY_WXML_ERR=10038,exports.SUMMER_PLUGIN_ERR=10045,exports.SUMMER_PLUGIN_CODE_ERR=10046,exports.GAME_PLUGIN_LIB_MD5_NOT_MATCH=10081,exports.PLUGIN_JSON_FILE_NOT_FOUND=10091,exports.PLUGIN_JSON_CONTENT_ERR=10092,exports.PLUGIN_JSON_PARSE_ERR=10093,exports.FILE_NOT_FOUND=10005,exports.JSON_PARSE_ERR=10006,exports.FILE_NOT_UTF8=10031,exports.JSON_CONTENT_ERR=10009,exports.APP_JSON_NOT_FOUND=2e4,exports.GET_SIGNATURE_RAND_STRING_ERR=20001,exports.GENERATE_LOCAL_SIGNATURE_ERR=20002,exports.UPLOAD_CGI_ERR=20003,exports.CODE_PROTECT_TRANSLATE_FILENAME=20004,exports.UPLOAD_JS_SERVER_CGI_ERR=20005,exports.GET_LATEST_VERSION_CGI_ERR=20006,exports.PROJECT_TYPE_ERROR=3e4,exports.MINI_PROGRAM_MAIN_PACKAGE_ROOT="__APP__",exports.MINI_GAME_MAIN_PACKAGE_ROOT="__GAME__",exports.MINI_GAME_WORKERS_PACKAGE_ROOT="workers.js",exports.APP_TYPE={NORMAL:0,PLUGIN:1,SHOP:2,MINISHOP:3,GAME:4,CARD:5,NATIVE:7},function(e){e.miniProgram="miniProgram",e.miniProgramPlugin="miniProgramPlugin",e.miniGame="miniGame",e.miniGamePlugin="miniGamePlugin"}(COMPILE_TYPE=exports.COMPILE_TYPE||(exports.COMPILE_TYPE={})),exports.TABBAR_ICON_WHITE_LIST=[".png",".jpg",".jpeg"],exports.DefaultProjectAttr={platform:!1,appType:0,isSandbox:!1,released:!1,setting:{MaxCodeSize:2,MaxSubpackageSubCodeSize:2,MaxSubpackageFullCodeSize:12,NavigateMiniprogramLimit:10,MaxSubPackageLimit:100,MinTabbarCount:2,MaxTabbarCount:5,MaxCustomTabbarCount:10,MaxTabbarIconSize:40}},exports.jsonVariablePropertyWhiteList={windowPropertWhiteList:["navigationBarBackgroundColor","navigationBarTextStyle","backgroundColor","backgroundTextStyle","backgroundColorTop","backgroundColorBottom","backgroundColorContent"],tabBarPropertyWhiteList:["color","selectedColor","backgroundColor","borderStyle"],tabbarListItemPropertyWhiteList:["iconPath","selectedIconPath"]},exports.extendedLibMap={kbone:{packages:["miniprogram-element","miniprogram-render"]},weui:{packages:["weui-miniprogram"]}},exports.multiPlatformRoot="miniapp",exports.MainPkg="__APP__",exports.FullPkg="__FULL__",exports.getDefaultIgnores=getDefaultIgnores,exports.compileTypeConfig={weapp:"weapp",game:"game",plugin:"plugin",gamePlugin:"gamePlugin"},function(e){e.Babel="babel",e.Acorn="acorn"}(AstType=exports.AstType||(exports.AstType={})),function(e){e[e.Include=0]="Include",e[e.PackOptionsIgnore=1]="PackOptionsIgnore",e[e.AnalyseNoUse=2]="AnalyseNoUse",e[e.PartialCompileNoUse=3]="PartialCompileNoUse"}(EFilterCode=exports.EFilterCode||(exports.EFilterCode={})),exports.MAX_CODE_LENGTH=2048e3;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MiniAppJson=exports.MiniAppI18N=exports.encryptLocalFile=exports.generateFileMD5=exports.miniappBuilder=exports.iosDeviceUtils=exports.adroidDeviceUtils=exports.cosUpload=exports.escapeScript=exports.escapeQuot=exports.checkIsInSubPackage=exports.compareVersion=exports.normalizePath=exports.mkdirSync=exports.generateMD5=exports.compileTypeConfig=exports.JSON_CONTENT_ERR=exports.DefaultProjectAttr=exports.isHexColor=exports.locales=exports.proxy=exports.getWhiteExtList=exports.OriginalCompiler=exports.BaseCoreCompiler=exports.CIProject=exports.Project=exports.PreCompileProject=exports.WebProject=exports.BaseProject=exports.workletVersion=exports.packOptionsHelper=exports.getHelperDeps=exports.getHelperOutputPath=exports.getHelperContent=exports.getHelperName=exports.isValidHelperFunc=exports.getBabelHelperDepMap=exports.getBabelHelperVersion=exports.getSummerPluginConfig=exports.DevtoolsProject=exports.SummerCompiler=exports.Builder=void 0;const tslib_1=require("tslib");tslib_1.__exportStar(require("./ci/index"),exports);const modules_1=require("./modules");Object.defineProperty(exports,"Builder",{enumerable:!0,get:function(){return modules_1.Builder}});const summerCompiler_1=require("./modules/corecompiler/summerCompiler");Object.defineProperty(exports,"SummerCompiler",{enumerable:!0,get:function(){return summerCompiler_1.SummerCompiler}});const devtoolsProject_1=require("./project/devtoolsProject");Object.defineProperty(exports,"DevtoolsProject",{enumerable:!0,get:function(){return devtoolsProject_1.DevtoolsProject}});const pluginconfig_1=require("./modules/corecompiler/summer/pluginconfig");Object.defineProperty(exports,"getSummerPluginConfig",{enumerable:!0,get:function(){return pluginconfig_1.getSummerPluginConfig}});const babel_helper_1=require("./utils/babel_helper");Object.defineProperty(exports,"getBabelHelperVersion",{enumerable:!0,get:function(){return babel_helper_1.getBabelHelperVersion}}),Object.defineProperty(exports,"getBabelHelperDepMap",{enumerable:!0,get:function(){return babel_helper_1.getBabelHelperDepMap}});const helper_util_1=require("./utils/helper_util");Object.defineProperty(exports,"getHelperOutputPath",{enumerable:!0,get:function(){return helper_util_1.getHelperOutputPath}}),Object.defineProperty(exports,"getHelperDeps",{enumerable:!0,get:function(){return helper_util_1.getHelperDeps}}),Object.defineProperty(exports,"isValidHelperFunc",{enumerable:!0,get:function(){return helper_util_1.isValidHelperFunc}}),Object.defineProperty(exports,"getHelperContent",{enumerable:!0,get:function(){return helper_util_1.getHelperContent}}),Object.defineProperty(exports,"getHelperName",{enumerable:!0,get:function(){return helper_util_1.getHelperName}});const packOptionsHelper_1=tslib_1.__importDefault(require("./utils/packOptionsHelper"));exports.packOptionsHelper=packOptionsHelper_1.default;const baseProject_1=require("./project/baseProject");Object.defineProperty(exports,"BaseProject",{enumerable:!0,get:function(){return baseProject_1.BaseProject}});const webProject_1=require("./project/webProject");Object.defineProperty(exports,"WebProject",{enumerable:!0,get:function(){return webProject_1.WebProject}});const precompileProject_1=require("./project/advance/precompileProject");Object.defineProperty(exports,"PreCompileProject",{enumerable:!0,get:function(){return precompileProject_1.PreCompileProject}});const ciProject_1=require("./project/ciProject");Object.defineProperty(exports,"Project",{enumerable:!0,get:function(){return ciProject_1.CIProject}}),Object.defineProperty(exports,"CIProject",{enumerable:!0,get:function(){return ciProject_1.CIProject}});const baseCompiler_1=require("./modules/corecompiler/baseCompiler");Object.defineProperty(exports,"BaseCoreCompiler",{enumerable:!0,get:function(){return baseCompiler_1.BaseCoreCompiler}});const originalCompiler_1=require("./modules/corecompiler/originalCompiler");Object.defineProperty(exports,"OriginalCompiler",{enumerable:!0,get:function(){return originalCompiler_1.OriginalCompiler}});const white_ext_list_1=require("./utils/white_ext_list");Object.defineProperty(exports,"getWhiteExtList",{enumerable:!0,get:function(){return white_ext_list_1.getWhiteExtList}});const request_1=require("./utils/request");Object.defineProperty(exports,"proxy",{enumerable:!0,get:function(){return request_1.setCiProxy}});const locales_1=tslib_1.__importDefault(require("./utils/locales/locales"));exports.locales=locales_1.default;const tools_1=require("./utils/tools");Object.defineProperty(exports,"checkIsInSubPackage",{enumerable:!0,get:function(){return tools_1.checkIsInSubPackage}}),Object.defineProperty(exports,"escapeQuot",{enumerable:!0,get:function(){return tools_1.escapeQuot}}),Object.defineProperty(exports,"escapeScript",{enumerable:!0,get:function(){return tools_1.escapeScript}}),Object.defineProperty(exports,"generateMD5",{enumerable:!0,get:function(){return tools_1.generateMD5}}),Object.defineProperty(exports,"isHexColor",{enumerable:!0,get:function(){return tools_1.isHexColor}}),Object.defineProperty(exports,"mkdirSync",{enumerable:!0,get:function(){return tools_1.mkdirSync}}),Object.defineProperty(exports,"normalizePath",{enumerable:!0,get:function(){return tools_1.normalizePath}}),Object.defineProperty(exports,"compareVersion",{enumerable:!0,get:function(){return tools_1.compareVersion}});const config_1=require("./config/config");Object.defineProperty(exports,"DefaultProjectAttr",{enumerable:!0,get:function(){return config_1.DefaultProjectAttr}}),Object.defineProperty(exports,"JSON_CONTENT_ERR",{enumerable:!0,get:function(){return config_1.JSON_CONTENT_ERR}}),Object.defineProperty(exports,"compileTypeConfig",{enumerable:!0,get:function(){return config_1.compileTypeConfig}});const adroidDeviceUtils=tslib_1.__importStar(require("./modules/nativecompiler/android/device"));exports.adroidDeviceUtils=adroidDeviceUtils;const iosDeviceUtils=tslib_1.__importStar(require("./modules/nativecompiler/ios/device"));exports.iosDeviceUtils=iosDeviceUtils;const miniappBuilder=tslib_1.__importStar(require("./utils/miniapp-builder"));exports.miniappBuilder=miniappBuilder;const miniAppI18N_1=tslib_1.__importDefault(require("./utils/miniAppI18N"));exports.MiniAppI18N=miniAppI18N_1.default;const MiniAppJson=tslib_1.__importStar(require("./utils/miniappJson"));exports.MiniAppJson=MiniAppJson;const cosUpload=tslib_1.__importStar(require("./utils/cosUpload"));exports.cosUpload=cosUpload,exports.workletVersion=require("./utils/common").workletVersion,tslib_1.__exportStar(require("./modules/corecompiler/original"),exports);var tools_2=require("./utils/tools");Object.defineProperty(exports,"generateFileMD5",{enumerable:!0,get:function(){return tools_2.generateFileMD5}});var asyncTask_1=require("./utils/asyncTask");Object.defineProperty(exports,"encryptLocalFile",{enumerable:!0,get:function(){return asyncTask_1.encryptLocalFile}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MiniAppJson=exports.MiniAppI18N=exports.encryptLocalFile=exports.generateFileMD5=exports.miniappBuilder=exports.iosDeviceUtils=exports.adroidDeviceUtils=exports.cosUpload=exports.escapeScript=exports.escapeQuot=exports.checkIsInSubPackage=exports.compareVersion=exports.normalizePath=exports.mkdirSync=exports.generateMD5=exports.compileTypeConfig=exports.JSON_CONTENT_ERR=exports.DefaultProjectAttr=exports.isHexColor=exports.locales=exports.proxy=exports.getWhiteExtList=exports.OriginalCompiler=exports.BaseCoreCompiler=exports.CIProject=exports.Project=exports.PreCompileProject=exports.WebProject=exports.BaseProject=exports.EFilterCode=exports.workletVersion=exports.packOptionsHelper=exports.getHelperDeps=exports.getHelperOutputPath=exports.getHelperContent=exports.getHelperName=exports.isValidHelperFunc=exports.getBabelHelperDepMap=exports.getBabelHelperVersion=exports.getSummerPluginConfig=exports.DevtoolsProject=exports.SummerCompiler=exports.Builder=void 0;const tslib_1=require("tslib");tslib_1.__exportStar(require("./ci/index"),exports);const modules_1=require("./modules");Object.defineProperty(exports,"Builder",{enumerable:!0,get:function(){return modules_1.Builder}});const summerCompiler_1=require("./modules/corecompiler/summerCompiler");Object.defineProperty(exports,"SummerCompiler",{enumerable:!0,get:function(){return summerCompiler_1.SummerCompiler}});const devtoolsProject_1=require("./project/devtoolsProject");Object.defineProperty(exports,"DevtoolsProject",{enumerable:!0,get:function(){return devtoolsProject_1.DevtoolsProject}});const pluginconfig_1=require("./modules/corecompiler/summer/pluginconfig");Object.defineProperty(exports,"getSummerPluginConfig",{enumerable:!0,get:function(){return pluginconfig_1.getSummerPluginConfig}});const babel_helper_1=require("./utils/babel_helper");Object.defineProperty(exports,"getBabelHelperVersion",{enumerable:!0,get:function(){return babel_helper_1.getBabelHelperVersion}}),Object.defineProperty(exports,"getBabelHelperDepMap",{enumerable:!0,get:function(){return babel_helper_1.getBabelHelperDepMap}});const helper_util_1=require("./utils/helper_util");Object.defineProperty(exports,"getHelperOutputPath",{enumerable:!0,get:function(){return helper_util_1.getHelperOutputPath}}),Object.defineProperty(exports,"getHelperDeps",{enumerable:!0,get:function(){return helper_util_1.getHelperDeps}}),Object.defineProperty(exports,"isValidHelperFunc",{enumerable:!0,get:function(){return helper_util_1.isValidHelperFunc}}),Object.defineProperty(exports,"getHelperContent",{enumerable:!0,get:function(){return helper_util_1.getHelperContent}}),Object.defineProperty(exports,"getHelperName",{enumerable:!0,get:function(){return helper_util_1.getHelperName}});const packOptionsHelper_1=tslib_1.__importDefault(require("./utils/packOptionsHelper"));exports.packOptionsHelper=packOptionsHelper_1.default;const baseProject_1=require("./project/baseProject");Object.defineProperty(exports,"BaseProject",{enumerable:!0,get:function(){return baseProject_1.BaseProject}});const webProject_1=require("./project/webProject");Object.defineProperty(exports,"WebProject",{enumerable:!0,get:function(){return webProject_1.WebProject}});const precompileProject_1=require("./project/advance/precompileProject");Object.defineProperty(exports,"PreCompileProject",{enumerable:!0,get:function(){return precompileProject_1.PreCompileProject}});const ciProject_1=require("./project/ciProject");Object.defineProperty(exports,"Project",{enumerable:!0,get:function(){return ciProject_1.CIProject}}),Object.defineProperty(exports,"CIProject",{enumerable:!0,get:function(){return ciProject_1.CIProject}});const baseCompiler_1=require("./modules/corecompiler/baseCompiler");Object.defineProperty(exports,"BaseCoreCompiler",{enumerable:!0,get:function(){return baseCompiler_1.BaseCoreCompiler}});const originalCompiler_1=require("./modules/corecompiler/originalCompiler");Object.defineProperty(exports,"OriginalCompiler",{enumerable:!0,get:function(){return originalCompiler_1.OriginalCompiler}});const white_ext_list_1=require("./utils/white_ext_list");Object.defineProperty(exports,"getWhiteExtList",{enumerable:!0,get:function(){return white_ext_list_1.getWhiteExtList}});const request_1=require("./utils/request");Object.defineProperty(exports,"proxy",{enumerable:!0,get:function(){return request_1.setCiProxy}});const locales_1=tslib_1.__importDefault(require("./utils/locales/locales"));exports.locales=locales_1.default;const tools_1=require("./utils/tools");Object.defineProperty(exports,"checkIsInSubPackage",{enumerable:!0,get:function(){return tools_1.checkIsInSubPackage}}),Object.defineProperty(exports,"escapeQuot",{enumerable:!0,get:function(){return tools_1.escapeQuot}}),Object.defineProperty(exports,"escapeScript",{enumerable:!0,get:function(){return tools_1.escapeScript}}),Object.defineProperty(exports,"generateMD5",{enumerable:!0,get:function(){return tools_1.generateMD5}}),Object.defineProperty(exports,"isHexColor",{enumerable:!0,get:function(){return tools_1.isHexColor}}),Object.defineProperty(exports,"mkdirSync",{enumerable:!0,get:function(){return tools_1.mkdirSync}}),Object.defineProperty(exports,"normalizePath",{enumerable:!0,get:function(){return tools_1.normalizePath}}),Object.defineProperty(exports,"compareVersion",{enumerable:!0,get:function(){return tools_1.compareVersion}});const config_1=require("./config/config");Object.defineProperty(exports,"DefaultProjectAttr",{enumerable:!0,get:function(){return config_1.DefaultProjectAttr}}),Object.defineProperty(exports,"JSON_CONTENT_ERR",{enumerable:!0,get:function(){return config_1.JSON_CONTENT_ERR}}),Object.defineProperty(exports,"compileTypeConfig",{enumerable:!0,get:function(){return config_1.compileTypeConfig}}),Object.defineProperty(exports,"EFilterCode",{enumerable:!0,get:function(){return config_1.EFilterCode}});const adroidDeviceUtils=tslib_1.__importStar(require("./modules/nativecompiler/android/device"));exports.adroidDeviceUtils=adroidDeviceUtils;const iosDeviceUtils=tslib_1.__importStar(require("./modules/nativecompiler/ios/device"));exports.iosDeviceUtils=iosDeviceUtils;const miniappBuilder=tslib_1.__importStar(require("./utils/miniapp-builder"));exports.miniappBuilder=miniappBuilder;const miniAppI18N_1=tslib_1.__importDefault(require("./utils/miniAppI18N"));exports.MiniAppI18N=miniAppI18N_1.default;const MiniAppJson=tslib_1.__importStar(require("./utils/miniappJson"));exports.MiniAppJson=MiniAppJson;const cosUpload=tslib_1.__importStar(require("./utils/cosUpload"));exports.cosUpload=cosUpload,exports.workletVersion=require("./utils/common").workletVersion,tslib_1.__exportStar(require("./modules/corecompiler/original"),exports);var tools_2=require("./utils/tools");Object.defineProperty(exports,"generateFileMD5",{enumerable:!0,get:function(){return tools_2.generateFileMD5}});var asyncTask_1=require("./utils/asyncTask");Object.defineProperty(exports,"encryptLocalFile",{enumerable:!0,get:function(){return asyncTask_1.encryptLocalFile}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),postcss_1=tslib_1.__importDefault(require("postcss")),autoprefixer_1=tslib_1.__importDefault(require("autoprefixer")),cssnano_1=tslib_1.__importDefault(require("cssnano")),tools_1=require("../../../../../utils/tools"),config_1=require("../../../../../config/config"),customError_1=require("../../../../../utils/customError");"undefined"!=typeof process&&process.env&&(process.env.BROWSERSLIST=process.env.BROWSERSLIST||"iOS >= 8, Chrome >= 37");const MAX_LINE_SHOW_LENGTH=45;function shortString(r,e,t=-1){const s=r.length;if(s<=e)return{result:r,marker:t};const o=Math.floor(e/2);return-1===t||t<=o?{result:r.substr(0,e-3)+"...",marker:t}:t+o>=s?{result:"..."+r.substr(s-e+3,e-3),marker:Math.min(e,e-(s-t))}:{result:`...${r.substr(t-o+3,e-6)}...`,marker:o}}function formatPostcssError(r,e){try{const t=e.line-1,s=e.column-1,o=r.replace(/\r\n/g,"\n").split("\n"),n=[],i=Math.max(0,t-1),u=Math.min(t+2,o.length);for(let r=i;r<u;r++){const e=shortString(o[r],45,s);r===t?n.push(`> ${r+1} | ${e.result.substr(0,e.marker)}${e.result.substr(e.marker)}`):n.push(`> ${r+1} | ${e.result}`)}return`${e.message}\n${n.join("\n")}`}catch(r){}return e.message}function default_1(r,e){const{autoPrefix:t=!0,minify:s=!0}=e||{},o=["iOS >= 8","Chrome >= 37"];return{name:"summer-wxss",workerMethods:{async doOptimize(r,e){try{const n=[];t&&n.push((0,autoprefixer_1.default)({overrideBrowserslist:o,remove:!1})),s&&n.push((0,cssnano_1.default)({preset:["default",{reduceTransforms:!1,calc:!1,minifySelectors:!1,normalizeUrl:!1}]}));return{error:null,content:(await(0,postcss_1.default)(n).process(e,{from:(0,tools_1.leading)(r,"/")})).css.replace(/\r\n/g,"\n")}}catch(t){return{error:(0,customError_1.makeCustomError)(formatPostcssError(e,t),config_1.POST_WXSS_ERR,r)}}}},async optimize(r,e){if("dev"===e.resultType||!r.targetPath.endsWith(".wxss")||!t&&!s)return r;const o=Date.now(),n=await this.runWorkerMethod("doOptimize",r.targetPath,r.target.code);if(n.error)throw n.error;return Object.assign(Object.assign({},r),{target:Object.assign(Object.assign({},r.target),{code:n.content}),process:[...r.process,{cost:Date.now()-o,pluginName:"summer-wxss",action:"optimize"}]})}}}exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),postcss_1=tslib_1.__importDefault(require("postcss")),autoprefixer_1=tslib_1.__importDefault(require("autoprefixer")),cssnano_1=tslib_1.__importDefault(require("cssnano")),tools_1=require("../../../../../utils/tools"),config_1=require("../../../../../config/config"),customError_1=require("../../../../../utils/customError");"undefined"!=typeof process&&process.env&&(process.env.BROWSERSLIST=process.env.BROWSERSLIST||"iOS >= 8, Chrome >= 37");const MAX_LINE_SHOW_LENGTH=45;function shortString(r,e,t=-1){const s=r.length;if(s<=e)return{result:r,marker:t};const o=Math.floor(e/2);return-1===t||t<=o?{result:r.substr(0,e-3)+"...",marker:t}:t+o>=s?{result:"..."+r.substr(s-e+3,e-3),marker:Math.min(e,e-(s-t))}:{result:`...${r.substr(t-o+3,e-6)}...`,marker:o}}function formatPostcssError(r,e){try{const t=e.line-1,s=e.column-1,o=r.replace(/\r\n/g,"\n").split("\n"),n=[],i=Math.max(0,t-1),u=Math.min(t+2,o.length);for(let r=i;r<u;r++){const e=shortString(o[r],45,s);r===t?n.push(`> ${r+1} | ${e.result.substr(0,e.marker)}${e.result.substr(e.marker)}`):n.push(`> ${r+1} | ${e.result}`)}return`${e.message}\n${n.join("\n")}`}catch(r){}return e.message}function default_1(r,e){const{autoPrefix:t=!0,minify:s=!0}=e||{},o=["iOS >= 8","Chrome >= 37"];return{name:"summer-wxss",workerMethods:{async doOptimize(r,e){try{const n=[];t&&n.push((0,autoprefixer_1.default)({overrideBrowserslist:o,remove:!1})),s&&n.push((0,cssnano_1.default)({preset:["default",{reduceTransforms:!1,calc:!1,minifySelectors:!1,normalizeUrl:!1}]}));return{error:null,content:(await(0,postcss_1.default)(n).process(e,{from:(0,tools_1.leading)(r,"/")})).css.replace(/\r\n/g,"\n")}}catch(t){throw(0,customError_1.makeCustomError)(formatPostcssError(e,t),config_1.POST_WXSS_ERR,r)}}},async optimize(r,e){if("dev"===e.resultType||!r.targetPath.endsWith(".wxss")||!t&&!s)return r;const o=Date.now(),n=await this.runWorkerMethod("doOptimize",r.targetPath,r.target.code);if(n.error)throw n.error;return Object.assign(Object.assign({},r),{target:Object.assign(Object.assign({},r.target),{code:n.content}),process:[...r.process,{cost:Date.now()-o,pluginName:"summer-wxss",action:"optimize"}]})}}}exports.default=default_1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SummerCompiler=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importDefault(require("lodash")),locales_1=tslib_1.__importDefault(require("../../utils/locales/locales")),request_1=require("../../utils/request"),common_1=require("./original/compile/common"),tools_1=require("../../utils/tools"),white_ext_list_1=require("../../utils/white_ext_list"),config_1=require("../../config/config"),processManager_1=require("../../utils/subprocess/processManager"),messageHub_1=require("../../utils/messageHub"),singletontask_1=require("../../utils/singletontask"),uglifyfilenames_1=require("./original/protect/uglifyfilenames"),baseCompiler_1=require("./baseCompiler"),packOptionsHelper_1=tslib_1.__importDefault(require("../../utils/packOptionsHelper")),miniProgram=config_1.COMPILE_TYPE.miniProgram,miniGame=config_1.COMPILE_TYPE.miniGame,miniProgramPlugin=config_1.COMPILE_TYPE.miniProgramPlugin,miniGamePlugin=config_1.COMPILE_TYPE.miniGamePlugin;function performanceMark(e,t){}class SummerCompiler extends baseCompiler_1.BaseCoreCompiler{constructor(e,t,i,s,o,a,r){super(e),this.project=e,this.cachePath=t,this.projectInfo=i,this.devtoolMessagehub=s,this.analyzer=o,this._filterFactory=a,this.onInitFinished=r,this.isSummer=!0,this.promiseCache=new Map,this._taskCache=new Map,this._status=void 0,this._eventAdded=!1,this._locale="",this.devCodeCacheByPath=new Map,this.onFileChange=(e,t)=>{if("change"!==e||t.endsWith(".json"))for(const e of this.promiseCache.keys())e.startsWith("getConf-")&&this.promiseCache.delete(e);if("change"!==e){for(const e of this.promiseCache.keys())e.startsWith("getPackageFiles-")&&this.promiseCache.delete(e);for(const e of this._taskCache.keys())e.startsWith("getPackageFiles-")&&this._taskCache.delete(e)}this.invalidCodeCache(t),this.subProcessManager.sendEvent("fileChange",{type:e,targetPath:t})},this.onPreCompileOptionsChange=async e=>{await this.clearCache(),this.subProcessManager.sendEvent("precompileOptionsChange",e)},this.onProgressUpdate=(e,t,i)=>{var s;this.messageHub.showBuildLog(""+e,t,i),null===(s=this.progressUpdateFromCompileOptions)||void 0===s||s.call(this,{id:e.toString(),message:i,status:t})},this._getPackageFiles=async(e,t,i="dev")=>{performanceMark("request get getPackageFiles");const s=await this.subProcessManager.runTask("getPackageFiles",{graphId:e,root:t},this.onProgressUpdate);performanceMark("request get getPackageFiles",!0);const o=this.isPluginType(e)?this.project.pluginRoot:this.project.miniprogramRoot,a=await this.filterFactory(i),r={},n=s.filter(t=>{const i=path_1.default.posix.join(o,t.source),s=a(e,i);return s!==config_1.EFilterCode.Include&&(r[s]||(r[s]=[]),r[s].push(i)),s===config_1.EFilterCode.Include}),c={[config_1.EFilterCode.AnalyseNoUse]:locales_1.default.config.UNUSE_FILE_LIST,[config_1.EFilterCode.PackOptionsIgnore]:locales_1.default.config.PACK_OPTIONS_IGNORE_LIST,[config_1.EFilterCode.PartialCompileNoUse]:locales_1.default.config.PARTIAL_COMPILE_IGNORE_LIST};for(const e in r)c[e]?this.onProgressUpdate(e,"warn",c[e].format(r[e].join(","))):this.onProgressUpdate(e,"warn",locales_1.default.config.UNKNOWN_REASON_INGORE_LIST.format(e,r[e].join(",")));return n},performanceMark("create summer compiler"),this.messageHub=new messageHub_1.MessageHub(s),this.ready()}get status(){return this._status}async init(){performanceMark("init summer compiler");const e=path_1.default.posix.join(__dirname,"./summerEntryProcess.js"),t="undefined"!=typeof WEBIDE_WEBPECK_DEFINE_PLUGIN?"./summerentryprocess.js":e;this.subProcessManager=new processManager_1.SubProcessProxy(this.project,t,{cachePath:this.cachePath},this.projectInfo,8891,this.onProgressUpdate),this.addProjectListener();this.loadStatus().then(()=>{var e;null===(e=this.onInitFinished)||void 0===e||e.call(this)},e=>{var t;null===(t=this.onInitFinished)||void 0===t||t.call(this,e)}),performanceMark("init summer compiler",!0)}async loadStatus(){this._status=await this.subProcessManager.runTask("loadStatus")}destroy(){var e;null===(e=this.subProcessManager)||void 0===e||e.destroy(),this.removeProjectListener(),this._checkReadyTask=void 0}async clearCache(){var e;await(null===(e=this.subProcessManager)||void 0===e?void 0:e.runTask("clearCache")),this.promiseCache.clear(),this.devCodeCacheByPath.clear(),this._taskCache.clear()}updateOptions(e){var t;lodash_1.default.isEqual(e,this.projectInfo)||(this.projectInfo=e,this.promiseCache.clear(),this.devCodeCacheByPath.clear(),null===(t=this.subProcessManager)||void 0===t||t.sendEvent("updateOptions",e),this.loadStatus(),this.project.updateOptions(e))}addProjectListener(){var e,t;this._eventAdded&&this.removeProjectListener(),null===(e=this.project.event)||void 0===e||e.on("fileChange",this.onFileChange),null===(t=this.project.event)||void 0===t||t.on("precompileOptionsChange",this.onPreCompileOptionsChange),this._eventAdded=!0}removeProjectListener(){var e,t;null===(e=this.project.event)||void 0===e||e.off("fileChange",this.onFileChange),null===(t=this.project.event)||void 0===t||t.off("precompileOptionsChange",this.onPreCompileOptionsChange),this._eventAdded=!1}invalidCodeCache(e){const t=this.devCodeCacheByPath.get((0,tools_1.sourcePathToTargetPath)(e));t&&(t.isValid=!1)}async getConf(e){const t="getConf-"+e;if(this.promiseCache.has(t))return this.promiseCache.get(t);performanceMark("request get conf");const i={graphId:e},s=this.subProcessManager.runTask("getConf",i,this.onProgressUpdate);return this.promiseCache.set(t,s),performanceMark("request get conf",!0),s}async getPackageFiles(e,t,i="dev",s=!0){const o=`getPackageFiles-${e}-${t}-${i}`;if(this._taskCache.has(o)&&s){const e=this._taskCache.get(o);return null==e?void 0:e.getResult(!0)}const a=new singletontask_1.SingletonTask(this._getPackageFiles.bind(this,e,t,i),o);return this._taskCache.set(o,a),null==a?void 0:a.getResult(!0)}isMiniappPlatformInclude(e){const t=path_1.default.posix.join(this.project.miniprogramRoot,"app.miniapp.json");return(0,tools_1.isMiniappPlatform)(this.project.targetPlatform)&&t===e}async filterFactory(e){packOptionsHelper_1.default.updateState(this.project),this.onProgressUpdate("initUnusedFiles","doing","analyzing codes..."),await packOptionsHelper_1.default.initUnusedFiles(this.project,this.analyzer,"prod"===e),0!==packOptionsHelper_1.default.getUnusedFiles().size&&this.onProgressUpdate("initUnusedFiles","doing","ignoring files: "+Array.from(packOptionsHelper_1.default.getUnusedFiles()).join(",")),this.onProgressUpdate("initUnusedFiles","success","analyzing codes success");const t=this._filterFactory?await this._filterFactory(e):()=>0;return(i,s)=>{const o=packOptionsHelper_1.default.relativePath(s);return this.isMiniappPlatformInclude(s)||packOptionsHelper_1.default.isFileIncluded(o)?config_1.EFilterCode.Include:packOptionsHelper_1.default.isIgnoredByRules(o)?config_1.EFilterCode.PackOptionsIgnore:i===miniProgram&&packOptionsHelper_1.default.isIgnoreByUnusedFiles(s,"prod"===e)?config_1.EFilterCode.AnalyseNoUse:t(i,s)}}async getCodeByFileList(e,t){const i={},s={},o=this.isPluginType(e)?this.project.pluginRoot:this.project.miniprogramRoot,a=[];for(const e of t){const t=this.devCodeCacheByPath.get(path_1.default.posix.join(o,e)),r=null==t?void 0:t.codeFile;let n=!1;t&&t.isValid&&r&&!("error"in r)||(n=!0,a.push(e)),r&&!("error"in r)&&(n&&(i[e]=r.md5),s[e]=r)}if(a.length>0){const t=await this.subProcessManager.runTask("getDevCodeByFileList",{graphId:e,fileList:a,cacheMd5:i},this.onProgressUpdate);for(const e in t){const i=t[e],a=path_1.default.posix.join(o,e);"error"in i||""!==i.md5?this.devCodeCacheByPath.set(a,{isValid:!0,codeFile:i}):this.devCodeCacheByPath.delete(a),s[e]=i}}return s}async getExtJSON(){return(await this.getConf(miniProgram)).ext}async getAppJSON(){return(await this.getConf(miniProgram)).app}async getGameJSON(){return(await this.getConf(miniGame)).app}async getSiteMapJSON(){return(await this.getConf(miniProgram)).sitemap}async getPageJSON(e){const t=await this.getConf(miniProgram),i=t.pages[e]||t.comps[e];if(!i)throw new Error("summer-compiler 收集json配置有遗漏, "+e);return i}async getAllPageAndComponent(){const e=await this.getConf(miniProgram),t=(await this.getPackageFiles(miniProgram,config_1.FullPkg)).map(e=>e.path).filter(e=>e.endsWith(".json"));return Object.keys(e.pages).concat(Object.keys(e.comps)).filter(e=>t.includes(e+".json"))}async getAllSortedJSFiles(){var e,t,i,s;const o=this.isGameType(this.project.type),a=o?miniGame:miniProgram,r=await this.getConf(a),n=Object.keys(null!==(e=r.pages)&&void 0!==e?e:{}),c=Object.keys(null!==(t=r.comps)&&void 0!==t?t:{}),l=await this.getPackageFiles(a,config_1.FullPkg),g=null!==(i=null==l?void 0:l.map(e=>e.path).filter(e=>e.endsWith(".js")))&&void 0!==i?i:[],p=null!==(s=null==n?void 0:n.filter(e=>!c.includes(e)).map(e=>e+".js").filter(e=>g.includes(e)))&&void 0!==s?s:[],h=c.map(e=>e+".js").filter(e=>g.includes(e)),m=g.filter(e=>e.endsWith(".js")&&e!==(o?"game.js":"app.js")&&!p.includes(e)&&!h.includes(e));return{jsPagesFiles:p,components:h,otherJsFiles:m}}async getAllWxmlAndWxsFiles(){const e=(await this.getPackageFiles(miniProgram,config_1.FullPkg)).map(e=>e.path),t=e.filter(e=>e.endsWith(".wxml")),i=e.filter(e=>e.endsWith(".wxs")),s=await this.getCodeByFileList(miniProgram,t.concat(i));return{wxmlFiles:t,wxsFiles:i,content:t.concat(i).reduce((e,t)=>{const i=s[t];if("error"in i)throw i.error;return e[t]=i.code,e["./"+t]=i.code,e},{})}}async getPackageWxmlAndWxsFiles(e){let t=(await this.getPackageFiles(miniProgram,e)).map(e=>e.path);if(e!==config_1.MainPkg&&e!==config_1.FullPkg){const e=(await this.getPackageFiles(miniProgram,config_1.MainPkg)).map(e=>e.path);t=t.concat(e)}const i=t.filter(e=>e.endsWith(".wxml")),s=t.filter(e=>e.endsWith(".wxs")),o=await this.getCodeByFileList(miniProgram,i.concat(s));return{wxmlFiles:i,wxsFiles:s,content:i.concat(s).reduce((e,t)=>{const i=o[t];if(!i)throw`lack of ${t} code`;if("error"in i)throw i.error;return e[t]=i.code,e["./"+t]=i.code,e},{})}}async getPackageWxssFileList(e){let t=(await this.getPackageFiles(miniProgram,e)).map(e=>e.path);if(e!==config_1.MainPkg&&e!==config_1.FullPkg){const e=(await this.getPackageFiles(miniProgram,config_1.MainPkg)).map(e=>e.path);t=t.concat(e)}return t.filter(e=>e.endsWith(".wxss"))}async getPackageWxssFiles(e){const t=await this.getPackageWxssFileList(e),i=await this.getCodeByFileList(miniProgram,t);return{wxssFiles:t,content:t.reduce((e,t)=>{const s=i[t];if(!s)throw`lack of ${t} code`;if("error"in s)throw s.error;return e[t]=s.code,e["./"+t]=s.code,e},{})}}getWxssMap(e,t){t=(0,tools_1.normalizePath)(t),e===miniProgram?t=path_1.default.posix.join(this.project.miniprogramRoot,t):e===miniProgramPlugin&&(t=path_1.default.posix.join(this.project.pluginRoot,t));const i=this.devCodeCacheByPath.get(t),s=null==i?void 0:i.codeFile;if(s&&!("error"in s))return s.map}async getMainPkgSortedJSFiles(){const e=await this.getConf(miniProgram),t=(await this.getPackageFiles(miniProgram,config_1.MainPkg)).map(e=>e.path).filter(e=>e.endsWith(".js")),i=[],s=[],o=[],a=[],r=[];let n=!1;const c={},l=t=>Object.keys(e.packages).find(e=>t.startsWith(e))||config_1.MainPkg;e.app.functionalPages&&t.forEach(e=>{if(e.startsWith("functional-pages/")){const t=e.replace(/\.js$/,"");if(c[t])return;c[t]=!0,r.push(encodeURI(t))}}),e.app.workers&&t.forEach(t=>{if(t.startsWith((0,tools_1.getWorkersPath)(e.app.workers))){const e=t.replace(/\.js$/,"");if(c[e])return;c[e]=!0,a.push(e)}});Object.keys(e.comps).filter(e=>l(e)===config_1.MainPkg).forEach(t=>{if((t.startsWith("miniprogram_npm/weui-miniprogram")||t.startsWith("weui-miniprogram"))&&e.app.useExtendedLib&&e.app.useExtendedLib.weui)return;if(c[t])return;c[t]=!0;const i=encodeURI(t);o.push(""+i)});Object.keys(e.pages).filter(e=>l(e)===config_1.MainPkg).forEach(e=>{if(c[e])return;c[e]=!0;const t=encodeURI(e);i.push(""+t)}),t.forEach(e=>{const t=e.replace(/\.js$/,"");c[t]||(c[t]=!0,"app.js"!==e?s.push(""+encodeURI(t)):n=!0)});const g=[...s,...o,...i];return n&&g.push("app"),{hasAppJS:n,allFiles:g,pageFiles:i,componentFiles:o,workerFiles:a,functionalPageFiles:r,otherFiles:s}}async getSubPkgSortedJSFiles(e){const t=await this.getConf(miniProgram),i=(await this.getPackageFiles(miniProgram,e)).map(e=>e.path).filter(e=>e.endsWith(".js")),s=[],o=[],a=[],r={},n=e=>Object.keys(t.packages).find(t=>e.startsWith(t))||config_1.MainPkg;Object.keys(t.comps).filter(t=>n(t)===e).forEach(e=>{if((e.startsWith("miniprogram_npm/weui-miniprogram")||e.startsWith("weui-miniprogram"))&&t.app.useExtendedLib&&t.app.useExtendedLib.weui)return;if(r[e])return;r[e]=!0;const i=encodeURI(e);a.push(""+i)});Object.keys(t.pages).filter(t=>n(t)===e).forEach(e=>{if(r[e])return;r[e]=!0;const t=encodeURI(e);s.push(""+t)});let c=t.packages[e].entry||"";c&&(c=path_1.default.posix.join(e,c),c=c.replace(/\.js$/,"")),i.forEach(e=>{const t=e.replace(/\.js$/,"");r[t]||(r[t]=!0,t!==c&&o.push(""+encodeURI(t)))});const l=i.map(e=>""+encodeURI(e.replace(/\.js$/,"")));return{entryJS:c,allFiles:l,pageFiles:s,componentFiles:a,otherFiles:o}}async compileJSList(e){const t=this.project.type;let i=config_1.COMPILE_TYPE.miniProgram;i=e.root===this.project.miniprogramRoot?this.isGameType(t)?config_1.COMPILE_TYPE.miniGame:config_1.COMPILE_TYPE.miniProgram:this.isGameType(t)?config_1.COMPILE_TYPE.miniGamePlugin:miniProgramPlugin;const s=await this.getCodeByFileList(i,e.fileList),o=[];for(const e in s){const t=s[e];if("error"in t)throw t.error;o.push(Object.assign({filePath:e,code:t.code,map:t.map,mtime:t.mtime},t.jsTag))}return o}async compileJS(e){const t=this.project.type;let i;if(e.root===this.project.miniprogramRoot){i=(await this.getCodeByFileList(this.isGameType(t)?config_1.COMPILE_TYPE.miniGame:config_1.COMPILE_TYPE.miniProgram,[e.filePath]))[e.filePath]}else{i=(await this.getCodeByFileList(this.isGameType(t)?config_1.COMPILE_TYPE.miniGamePlugin:miniProgramPlugin,[e.filePath]))[e.filePath]}if(!i){const t=new Error(`summer-compiler miss ${e.root} js file, ${e.filePath}`);throw t.code="ENOENT",t}if("error"in i)throw i.error;return Object.assign({filePath:e.filePath,code:i.code,map:i.map,mtime:i.mtime},i.jsTag)}async compile(e){Date.now();this.progressUpdateFromCompileOptions=e.onProgressUpdate;const t=(await this.getPackageFiles(this.isGameType(this.project.type)?miniGame:miniProgram,config_1.FullPkg,e.resultType,e.useCache)).map(e=>e.path),i=await this.subProcessManager.runTask("compileNewLogic",Object.assign(Object.assign({},e),{fileList:t,analyzer:void 0}),this.onProgressUpdate),s=i.app,o=Object.keys(s).filter(e=>e.endsWith(".json")),a=await this.compileOther(this.isGameType(this.project.type)?miniGame:miniProgram,e.resultType||"prod",o);let r={};if(this.isPluginType(this.project.type)){const t=i.plugin,o=Object.keys(t).filter(e=>e.endsWith(".json")),n=await this.compileOther(this.isGameType(this.project.type)?miniGamePlugin:miniProgramPlugin,e.resultType||"prod",o);Object.keys(a).forEach(e=>{r[path_1.default.posix.join("miniprogram",e)]=a[e]}),Object.keys(n).forEach(e=>{r[path_1.default.posix.join("plugin",e)]=n[e]}),Object.keys(s).forEach(e=>{r[path_1.default.posix.join("miniprogram",e)]=s[e]}),Object.keys(t).forEach(e=>{r[path_1.default.posix.join("plugin",e)]=t[e]}),r["project.config.json"]=JSON.stringify({miniprogramRoot:"miniprogram",pluginRoot:"plugin",__compileDebugInfo__:{useSummer:!0}})}else r=Object.assign(Object.assign({},a),s),r["project.config.json"]=JSON.stringify({miniprogramRoot:"",__compileDebugInfo__:{useSummer:!0}});this.onProgressUpdate(111,"success",locales_1.default.config.SUMMER_PACK_FILES_FINISH.format());for(const e of Object.keys(r))"object"==typeof r[e]&&"Buffer"===r[e].type&&(r[e]=Buffer.from(r[e].data));return r}async compileOther(e,t,i){const s=(0,tools_1.getSupportCodeFileExtSet)(this.project);s.delete(".json");const o=await(0,white_ext_list_1.getWhiteExtList)();let a=o.MiniProgramWhiteList;this.isGameType(this.project.type)&&(a=o.GameWhiteList);const r=this.isPluginType(e)?this.project.pluginRoot:this.project.miniprogramRoot,n=await this.filterFactory(t),c=this.project.getFileList(r,"").filter(t=>{const o=path_1.default.posix.extname(t),c=path_1.default.posix.relative(r,t);return!(!a.has(o)||s.has(o)||i.includes(c))&&n(e,t)===config_1.EFilterCode.Include}),l=await(0,common_1.compileOther)(this.project,c,{onProgressUpdate:()=>{}}),g={};for(const e in l){g[path_1.default.posix.relative(r,e)]=l[e]}return g}async compile2(e){const t=await this.subProcessManager.runTask("compile",e,(t,i,s)=>{var o;null===(o=e.onProgressUpdate)||void 0===o||o.call(e,{id:t.toString(),status:i,message:s})});for(const e of Object.keys(t))"object"==typeof t[e]&&"Buffer"===t[e].type&&(t[e]=Buffer.from(t[e].data));return t}async getPluginJSON(e=""){return(await this.getConf(this.isGameType(this.project.type)?miniGamePlugin:miniProgramPlugin)).plugin}async getPluginPageJSON(e){const t=await this.getConf(miniProgramPlugin),i=t.pages[e]||t.comps[e];if(!i)throw new Error("summer-compiler 收集plugin json配置有遗漏, "+e);return i}async getPluginComponents(){const e=await this.getConf(miniProgramPlugin),t=new Set(Object.keys(e.pages).concat(Object.keys(e.comps)));return Array.from(t)}async getPluginJSFiles(){const e=this.isGameType(this.project.type)?miniGamePlugin:miniProgramPlugin,t=(await this.getPackageFiles(e,config_1.FullPkg)).map(e=>e.path).filter(e=>e.endsWith(".js")),i=await this.getCodeByFileList(e,t);return{jsFiles:t,content:t.reduce((e,t)=>{const s=i[t];if(!s)throw`lack of ${t} code`;if("error"in s)throw s.error;return e[t]=s.code,e["./"+t]=s.code,e},{})}}async getPluginWxssFiles(){const e=(await this.getPackageFiles(miniProgramPlugin,config_1.FullPkg)).map(e=>e.path).filter(e=>e.endsWith(".wxss")),t=await this.getCodeByFileList(miniProgramPlugin,e);return{wxssFiles:e,content:e.reduce((e,i)=>{const s=t[i];if(!s)throw`lack of ${i} code`;if("error"in s)throw s.error;return e[i]=s.code,e["./"+i]=s.code,e},{})}}async getPluginWxmlAndWxsFiles(){const e=(await this.getPackageFiles(miniProgramPlugin,config_1.FullPkg)).map(e=>e.path),t=e.filter(e=>e.endsWith(".wxml")),i=e.filter(e=>e.endsWith(".wxs")),s=await this.getCodeByFileList(miniProgramPlugin,t.concat(i));return{wxmlFiles:t,wxsFiles:i,content:t.concat(i).reduce((e,t)=>{const i=s[t];if(!i)throw`lack of ${t} code`;if("error"in i)throw i.error;return e[t]=i.code,e["./"+t]=i.code,e},{})}}async checkThemeJSON(e){return(await this.getConf(miniProgram)).theme}setProxy(e){(0,request_1.setCiProxy)(e)}setLocale(e){this._locale!==e&&(this._locale=e,this.subProcessManager.runTask("setLocale",e))}async uglifyFileNames(e,t,i){return await(0,uglifyfilenames_1.uglifyFileNames)(e,t,i)}async getMPFileInfo(){return this.subProcessManager.runTask("getLocalFileList",miniProgram)}async getPluginFileInfo(){return this.subProcessManager.runTask("getLocalFileList",miniProgramPlugin)}async getCompAndPagesOfConf(){const e=await this.getConf(miniProgram);return{pages:e.pages,comps:e.comps}}async getFiltedFileListReason(e){const t=this.project.getFileList(this.project.miniprogramRoot),i=[],s=await this.filterFactory(e),o=this.isGameType(this.project.type)?miniGame:miniProgram;for(const e of t){const t=s(o,e);t!==config_1.EFilterCode.Include&&i.push({file:e,code:t})}if(this.isPluginType(this.project.type)){const e=this.project.getFileList(this.project.pluginRoot),t=this.isGameType(this.project.type)?miniGamePlugin:miniProgramPlugin;for(const o of e){const e=s(t,o);e!==config_1.EFilterCode.Include&&i.push({file:o,code:e})}}return i}}exports.SummerCompiler=SummerCompiler;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SummerCompiler=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importDefault(require("lodash")),locales_1=tslib_1.__importDefault(require("../../utils/locales/locales")),request_1=require("../../utils/request"),common_1=require("./original/compile/common"),tools_1=require("../../utils/tools"),white_ext_list_1=require("../../utils/white_ext_list"),config_1=require("../../config/config"),processManager_1=require("../../utils/subprocess/processManager"),messageHub_1=require("../../utils/messageHub"),singletontask_1=require("../../utils/singletontask"),uglifyfilenames_1=require("./original/protect/uglifyfilenames"),baseCompiler_1=require("./baseCompiler"),packOptionsHelper_1=tslib_1.__importDefault(require("../../utils/packOptionsHelper")),miniProgram=config_1.COMPILE_TYPE.miniProgram,miniGame=config_1.COMPILE_TYPE.miniGame,miniProgramPlugin=config_1.COMPILE_TYPE.miniProgramPlugin,miniGamePlugin=config_1.COMPILE_TYPE.miniGamePlugin;function performanceMark(e,t){}class SummerCompiler extends baseCompiler_1.BaseCoreCompiler{constructor(e,t,i,s,o,a,r){super(e),this.project=e,this.cachePath=t,this.projectInfo=i,this.devtoolMessagehub=s,this.analyzer=o,this._filterFactory=a,this.onInitFinished=r,this.isSummer=!0,this.promiseCache=new Map,this._taskCache=new Map,this._status=void 0,this._eventAdded=!1,this._locale="",this.devCodeCacheByPath=new Map,this.onFileChange=(e,t)=>{if("change"!==e||t.endsWith(".json"))for(const e of this.promiseCache.keys())e.startsWith("getConf-")&&this.promiseCache.delete(e);if("change"!==e){for(const e of this.promiseCache.keys())e.startsWith("getPackageFiles-")&&this.promiseCache.delete(e);for(const e of this._taskCache.keys())e.startsWith("getPackageFiles-")&&this._taskCache.delete(e)}this.invalidCodeCache(t),this.subProcessManager.sendEvent("fileChange",{type:e,targetPath:t})},this.onPreCompileOptionsChange=async e=>{await this.clearCache(),this.subProcessManager.sendEvent("precompileOptionsChange",e)},this.onProgressUpdate=(e,t,i)=>{var s;this.messageHub.showBuildLog(""+e,t,i),null===(s=this.progressUpdateFromCompileOptions)||void 0===s||s.call(this,{id:e.toString(),message:i,status:t})},this._getPackageFiles=async(e,t,i="dev")=>{performanceMark("request get getPackageFiles");const s=await this.subProcessManager.runTask("getPackageFiles",{graphId:e,root:t},this.onProgressUpdate);performanceMark("request get getPackageFiles",!0);const o=this.isPluginType(e)?this.project.pluginRoot:this.project.miniprogramRoot,a=await this.filterFactory(i),r={},n=s.filter(t=>{const i=path_1.default.posix.join(o,t.source),s=a(e,i);return s!==config_1.EFilterCode.Include&&(r[s]||(r[s]=[]),r[s].push(i)),s===config_1.EFilterCode.Include}),c={[config_1.EFilterCode.AnalyseNoUse]:locales_1.default.config.UNUSE_FILE_LIST,[config_1.EFilterCode.PackOptionsIgnore]:locales_1.default.config.PACK_OPTIONS_IGNORE_LIST,[config_1.EFilterCode.PartialCompileNoUse]:locales_1.default.config.PARTIAL_COMPILE_IGNORE_LIST};for(const e in r)c[e]?this.onProgressUpdate(e,"warn",c[e].format(r[e].join(","))):this.onProgressUpdate(e,"warn",locales_1.default.config.UNKNOWN_REASON_INGORE_LIST.format(e,r[e].join(",")));return n},performanceMark("create summer compiler"),this.messageHub=new messageHub_1.MessageHub(s),this.ready()}get status(){return this._status}async init(){performanceMark("init summer compiler");const e=path_1.default.posix.join(__dirname,"./summerEntryProcess.js"),t="undefined"!=typeof WEBIDE_WEBPECK_DEFINE_PLUGIN?"./summerentryprocess.js":e;this.subProcessManager=new processManager_1.SubProcessProxy(this.project,t,{cachePath:this.cachePath},this.projectInfo,8891,this.onProgressUpdate),this.addProjectListener();this.loadStatus().then(()=>{var e;null===(e=this.onInitFinished)||void 0===e||e.call(this)},e=>{var t;null===(t=this.onInitFinished)||void 0===t||t.call(this,e)}),performanceMark("init summer compiler",!0)}async loadStatus(){this._status=await this.subProcessManager.runTask("loadStatus")}destroy(){var e;null===(e=this.subProcessManager)||void 0===e||e.destroy(),this.removeProjectListener(),this._checkReadyTask=void 0}async clearCache(){var e;await(null===(e=this.subProcessManager)||void 0===e?void 0:e.runTask("clearCache")),this.promiseCache.clear(),this.devCodeCacheByPath.clear(),this._taskCache.clear()}updateOptions(e){var t;lodash_1.default.isEqual(e,this.projectInfo)||(this.projectInfo=e,this.promiseCache.clear(),this.devCodeCacheByPath.clear(),null===(t=this.subProcessManager)||void 0===t||t.sendEvent("updateOptions",e),this.loadStatus(),this.project.updateOptions(e))}addProjectListener(){var e,t;this._eventAdded&&this.removeProjectListener(),null===(e=this.project.event)||void 0===e||e.on("fileChange",this.onFileChange),null===(t=this.project.event)||void 0===t||t.on("precompileOptionsChange",this.onPreCompileOptionsChange),this._eventAdded=!0}removeProjectListener(){var e,t;null===(e=this.project.event)||void 0===e||e.off("fileChange",this.onFileChange),null===(t=this.project.event)||void 0===t||t.off("precompileOptionsChange",this.onPreCompileOptionsChange),this._eventAdded=!1}invalidCodeCache(e){const t=this.devCodeCacheByPath.get((0,tools_1.sourcePathToTargetPath)(e));t&&(t.isValid=!1)}async getConf(e){const t="getConf-"+e;if(this.promiseCache.has(t))return this.promiseCache.get(t);performanceMark("request get conf");const i={graphId:e},s=this.subProcessManager.runTask("getConf",i,this.onProgressUpdate);return this.promiseCache.set(t,s),performanceMark("request get conf",!0),s}async getPackageFiles(e,t,i="dev",s=!0){const o=`getPackageFiles-${e}-${t}-${i}`;if(this._taskCache.has(o)&&s){const e=this._taskCache.get(o);return null==e?void 0:e.getResult(!0)}const a=new singletontask_1.SingletonTask(this._getPackageFiles.bind(this,e,t,i),o);return this._taskCache.set(o,a),null==a?void 0:a.getResult(!0)}isMiniappPlatformInclude(e){const t=path_1.default.posix.join(this.project.miniprogramRoot,"app.miniapp.json");return(0,tools_1.isMiniappPlatform)(this.project.targetPlatform)&&t===e}async filterUnusedFiles(e,t,i){const s=e?"miniGame":"miniProgram";return(await this.filterFactory(i))(s,t)}async filterFactory(e){packOptionsHelper_1.default.updateState(this.project),this.onProgressUpdate("initUnusedFiles","doing","analyzing codes..."),await packOptionsHelper_1.default.initUnusedFiles(this.project,this.analyzer,"prod"===e),0!==packOptionsHelper_1.default.getUnusedFiles().size&&this.onProgressUpdate("initUnusedFiles","doing","ignoring files: "+Array.from(packOptionsHelper_1.default.getUnusedFiles()).join(",")),this.onProgressUpdate("initUnusedFiles","success","analyzing codes success");const t=this._filterFactory?await this._filterFactory(e):()=>0;return(i,s)=>{const o=packOptionsHelper_1.default.relativePath(s);return this.isMiniappPlatformInclude(s)||packOptionsHelper_1.default.isFileIncluded(o)?config_1.EFilterCode.Include:packOptionsHelper_1.default.isIgnoredByRules(o)?config_1.EFilterCode.PackOptionsIgnore:i===miniProgram&&packOptionsHelper_1.default.isIgnoreByUnusedFiles(s,"prod"===e)?config_1.EFilterCode.AnalyseNoUse:t(i,s)}}async getCodeByFileList(e,t){const i={},s={},o=this.isPluginType(e)?this.project.pluginRoot:this.project.miniprogramRoot,a=[];for(const e of t){const t=this.devCodeCacheByPath.get(path_1.default.posix.join(o,e)),r=null==t?void 0:t.codeFile;let n=!1;t&&t.isValid&&r&&!("error"in r)||(n=!0,a.push(e)),r&&!("error"in r)&&(n&&(i[e]=r.md5),s[e]=r)}if(a.length>0){const t=await this.subProcessManager.runTask("getDevCodeByFileList",{graphId:e,fileList:a,cacheMd5:i},this.onProgressUpdate);for(const e in t){const i=t[e],a=path_1.default.posix.join(o,e);"error"in i||""!==i.md5?this.devCodeCacheByPath.set(a,{isValid:!0,codeFile:i}):this.devCodeCacheByPath.delete(a),s[e]=i}}return s}async getExtJSON(){return(await this.getConf(miniProgram)).ext}async getAppJSON(){return(await this.getConf(miniProgram)).app}async getGameJSON(){return(await this.getConf(miniGame)).app}async getSiteMapJSON(){return(await this.getConf(miniProgram)).sitemap}async getPageJSON(e){const t=await this.getConf(miniProgram),i=t.pages[e]||t.comps[e];if(!i)throw new Error("summer-compiler 收集json配置有遗漏, "+e);return i}async getAllPageAndComponent(){const e=await this.getConf(miniProgram),t=(await this.getPackageFiles(miniProgram,config_1.FullPkg)).map(e=>e.path).filter(e=>e.endsWith(".json"));return Object.keys(e.pages).concat(Object.keys(e.comps)).filter(e=>t.includes(e+".json"))}async getAllSortedJSFiles(){var e,t,i,s;const o=this.isGameType(this.project.type),a=o?miniGame:miniProgram,r=await this.getConf(a),n=Object.keys(null!==(e=r.pages)&&void 0!==e?e:{}),c=Object.keys(null!==(t=r.comps)&&void 0!==t?t:{}),l=await this.getPackageFiles(a,config_1.FullPkg),g=null!==(i=null==l?void 0:l.map(e=>e.path).filter(e=>e.endsWith(".js")))&&void 0!==i?i:[],p=null!==(s=null==n?void 0:n.filter(e=>!c.includes(e)).map(e=>e+".js").filter(e=>g.includes(e)))&&void 0!==s?s:[],h=c.map(e=>e+".js").filter(e=>g.includes(e)),m=g.filter(e=>e.endsWith(".js")&&e!==(o?"game.js":"app.js")&&!p.includes(e)&&!h.includes(e));return{jsPagesFiles:p,components:h,otherJsFiles:m}}async getAllWxmlAndWxsFiles(){const e=(await this.getPackageFiles(miniProgram,config_1.FullPkg)).map(e=>e.path),t=e.filter(e=>e.endsWith(".wxml")),i=e.filter(e=>e.endsWith(".wxs")),s=await this.getCodeByFileList(miniProgram,t.concat(i));return{wxmlFiles:t,wxsFiles:i,content:t.concat(i).reduce((e,t)=>{const i=s[t];if("error"in i)throw i.error;return e[t]=i.code,e["./"+t]=i.code,e},{})}}async getPackageWxmlAndWxsFiles(e){let t=(await this.getPackageFiles(miniProgram,e)).map(e=>e.path);if(e!==config_1.MainPkg&&e!==config_1.FullPkg){const e=(await this.getPackageFiles(miniProgram,config_1.MainPkg)).map(e=>e.path);t=t.concat(e)}const i=t.filter(e=>e.endsWith(".wxml")),s=t.filter(e=>e.endsWith(".wxs")),o=await this.getCodeByFileList(miniProgram,i.concat(s));return{wxmlFiles:i,wxsFiles:s,content:i.concat(s).reduce((e,t)=>{const i=o[t];if(!i)throw`lack of ${t} code`;if("error"in i)throw i.error;return e[t]=i.code,e["./"+t]=i.code,e},{})}}async getPackageWxssFileList(e){let t=(await this.getPackageFiles(miniProgram,e)).map(e=>e.path);if(e!==config_1.MainPkg&&e!==config_1.FullPkg){const e=(await this.getPackageFiles(miniProgram,config_1.MainPkg)).map(e=>e.path);t=t.concat(e)}return t.filter(e=>e.endsWith(".wxss"))}async getPackageWxssFiles(e){const t=await this.getPackageWxssFileList(e),i=await this.getCodeByFileList(miniProgram,t);return{wxssFiles:t,content:t.reduce((e,t)=>{const s=i[t];if(!s)throw`lack of ${t} code`;if("error"in s)throw s.error;return e[t]=s.code,e["./"+t]=s.code,e},{})}}getWxssMap(e,t){t=(0,tools_1.normalizePath)(t),e===miniProgram?t=path_1.default.posix.join(this.project.miniprogramRoot,t):e===miniProgramPlugin&&(t=path_1.default.posix.join(this.project.pluginRoot,t));const i=this.devCodeCacheByPath.get(t),s=null==i?void 0:i.codeFile;if(s&&!("error"in s))return s.map}async getMainPkgSortedJSFiles(){const e=await this.getConf(miniProgram),t=(await this.getPackageFiles(miniProgram,config_1.MainPkg)).map(e=>e.path).filter(e=>e.endsWith(".js")),i=[],s=[],o=[],a=[],r=[];let n=!1;const c={},l=t=>Object.keys(e.packages).find(e=>t.startsWith(e))||config_1.MainPkg;e.app.functionalPages&&t.forEach(e=>{if(e.startsWith("functional-pages/")){const t=e.replace(/\.js$/,"");if(c[t])return;c[t]=!0,r.push(encodeURI(t))}}),e.app.workers&&t.forEach(t=>{if(t.startsWith((0,tools_1.getWorkersPath)(e.app.workers))){const e=t.replace(/\.js$/,"");if(c[e])return;c[e]=!0,a.push(e)}});Object.keys(e.comps).filter(e=>l(e)===config_1.MainPkg).forEach(t=>{if((t.startsWith("miniprogram_npm/weui-miniprogram")||t.startsWith("weui-miniprogram"))&&e.app.useExtendedLib&&e.app.useExtendedLib.weui)return;if(c[t])return;c[t]=!0;const i=encodeURI(t);o.push(""+i)});Object.keys(e.pages).filter(e=>l(e)===config_1.MainPkg).forEach(e=>{if(c[e])return;c[e]=!0;const t=encodeURI(e);i.push(""+t)}),t.forEach(e=>{const t=e.replace(/\.js$/,"");c[t]||(c[t]=!0,"app.js"!==e?s.push(""+encodeURI(t)):n=!0)});const g=[...s,...o,...i];return n&&g.push("app"),{hasAppJS:n,allFiles:g,pageFiles:i,componentFiles:o,workerFiles:a,functionalPageFiles:r,otherFiles:s}}async getSubPkgSortedJSFiles(e){const t=await this.getConf(miniProgram),i=(await this.getPackageFiles(miniProgram,e)).map(e=>e.path).filter(e=>e.endsWith(".js")),s=[],o=[],a=[],r={},n=e=>Object.keys(t.packages).find(t=>e.startsWith(t))||config_1.MainPkg;Object.keys(t.comps).filter(t=>n(t)===e).forEach(e=>{if((e.startsWith("miniprogram_npm/weui-miniprogram")||e.startsWith("weui-miniprogram"))&&t.app.useExtendedLib&&t.app.useExtendedLib.weui)return;if(r[e])return;r[e]=!0;const i=encodeURI(e);a.push(""+i)});Object.keys(t.pages).filter(t=>n(t)===e).forEach(e=>{if(r[e])return;r[e]=!0;const t=encodeURI(e);s.push(""+t)});let c=t.packages[e].entry||"";c&&(c=path_1.default.posix.join(e,c),c=c.replace(/\.js$/,"")),i.forEach(e=>{const t=e.replace(/\.js$/,"");r[t]||(r[t]=!0,t!==c&&o.push(""+encodeURI(t)))});const l=i.map(e=>""+encodeURI(e.replace(/\.js$/,"")));return{entryJS:c,allFiles:l,pageFiles:s,componentFiles:a,otherFiles:o}}async compileJSList(e){const t=this.project.type;let i=config_1.COMPILE_TYPE.miniProgram;i=e.root===this.project.miniprogramRoot?this.isGameType(t)?config_1.COMPILE_TYPE.miniGame:config_1.COMPILE_TYPE.miniProgram:this.isGameType(t)?config_1.COMPILE_TYPE.miniGamePlugin:miniProgramPlugin;const s=await this.getCodeByFileList(i,e.fileList),o=[];for(const e in s){const t=s[e];if("error"in t)throw t.error;o.push(Object.assign({filePath:e,code:t.code,map:t.map,mtime:t.mtime},t.jsTag))}return o}async compileJS(e){const t=this.project.type;let i;if(e.root===this.project.miniprogramRoot){i=(await this.getCodeByFileList(this.isGameType(t)?config_1.COMPILE_TYPE.miniGame:config_1.COMPILE_TYPE.miniProgram,[e.filePath]))[e.filePath]}else{i=(await this.getCodeByFileList(this.isGameType(t)?config_1.COMPILE_TYPE.miniGamePlugin:miniProgramPlugin,[e.filePath]))[e.filePath]}if(!i){const t=new Error(`summer-compiler miss ${e.root} js file, ${e.filePath}`);throw t.code="ENOENT",t}if("error"in i)throw i.error;return Object.assign({filePath:e.filePath,code:i.code,map:i.map,mtime:i.mtime},i.jsTag)}async compile(e){Date.now();this.progressUpdateFromCompileOptions=e.onProgressUpdate;const t=(await this.getPackageFiles(this.isGameType(this.project.type)?miniGame:miniProgram,config_1.FullPkg,e.resultType,e.useCache)).map(e=>e.path),i=await this.subProcessManager.runTask("compileNewLogic",Object.assign(Object.assign({},e),{fileList:t,analyzer:void 0}),this.onProgressUpdate),s=i.app,o=Object.keys(s).filter(e=>e.endsWith(".json")),a=await this.compileOther(this.isGameType(this.project.type)?miniGame:miniProgram,e.resultType||"prod",o);let r={};if(this.isPluginType(this.project.type)){const t=i.plugin,o=Object.keys(t).filter(e=>e.endsWith(".json")),n=await this.compileOther(this.isGameType(this.project.type)?miniGamePlugin:miniProgramPlugin,e.resultType||"prod",o);Object.keys(a).forEach(e=>{r[path_1.default.posix.join("miniprogram",e)]=a[e]}),Object.keys(n).forEach(e=>{r[path_1.default.posix.join("plugin",e)]=n[e]}),Object.keys(s).forEach(e=>{r[path_1.default.posix.join("miniprogram",e)]=s[e]}),Object.keys(t).forEach(e=>{r[path_1.default.posix.join("plugin",e)]=t[e]}),r["project.config.json"]=JSON.stringify({miniprogramRoot:"miniprogram",pluginRoot:"plugin",__compileDebugInfo__:{useSummer:!0}})}else r=Object.assign(Object.assign({},a),s),r["project.config.json"]=JSON.stringify({miniprogramRoot:"",__compileDebugInfo__:{useSummer:!0}});this.onProgressUpdate(111,"success",locales_1.default.config.SUMMER_PACK_FILES_FINISH.format());for(const e of Object.keys(r))"object"==typeof r[e]&&"Buffer"===r[e].type&&(r[e]=Buffer.from(r[e].data));return r}async compileOther(e,t,i){const s=(0,tools_1.getSupportCodeFileExtSet)(this.project);s.delete(".json");const o=await(0,white_ext_list_1.getWhiteExtList)();let a=o.MiniProgramWhiteList;this.isGameType(this.project.type)&&(a=o.GameWhiteList);const r=this.isPluginType(e)?this.project.pluginRoot:this.project.miniprogramRoot,n=await this.filterFactory(t),c=this.project.getFileList(r,"").filter(t=>{const o=path_1.default.posix.extname(t),c=path_1.default.posix.relative(r,t);return!(!a.has(o)||s.has(o)||i.includes(c))&&n(e,t)===config_1.EFilterCode.Include}),l=await(0,common_1.compileOther)(this.project,c,{onProgressUpdate:()=>{}}),g={};for(const e in l){g[path_1.default.posix.relative(r,e)]=l[e]}return g}async compile2(e){const t=await this.subProcessManager.runTask("compile",e,(t,i,s)=>{var o;null===(o=e.onProgressUpdate)||void 0===o||o.call(e,{id:t.toString(),status:i,message:s})});for(const e of Object.keys(t))"object"==typeof t[e]&&"Buffer"===t[e].type&&(t[e]=Buffer.from(t[e].data));return t}async getPluginJSON(e=""){return(await this.getConf(this.isGameType(this.project.type)?miniGamePlugin:miniProgramPlugin)).plugin}async getPluginPageJSON(e){const t=await this.getConf(miniProgramPlugin),i=t.pages[e]||t.comps[e];if(!i)throw new Error("summer-compiler 收集plugin json配置有遗漏, "+e);return i}async getPluginComponents(){const e=await this.getConf(miniProgramPlugin),t=new Set(Object.keys(e.pages).concat(Object.keys(e.comps)));return Array.from(t)}async getPluginJSFiles(){const e=this.isGameType(this.project.type)?miniGamePlugin:miniProgramPlugin,t=(await this.getPackageFiles(e,config_1.FullPkg)).map(e=>e.path).filter(e=>e.endsWith(".js")),i=await this.getCodeByFileList(e,t);return{jsFiles:t,content:t.reduce((e,t)=>{const s=i[t];if(!s)throw`lack of ${t} code`;if("error"in s)throw s.error;return e[t]=s.code,e["./"+t]=s.code,e},{})}}async getPluginWxssFiles(){const e=(await this.getPackageFiles(miniProgramPlugin,config_1.FullPkg)).map(e=>e.path).filter(e=>e.endsWith(".wxss")),t=await this.getCodeByFileList(miniProgramPlugin,e);return{wxssFiles:e,content:e.reduce((e,i)=>{const s=t[i];if(!s)throw`lack of ${i} code`;if("error"in s)throw s.error;return e[i]=s.code,e["./"+i]=s.code,e},{})}}async getPluginWxmlAndWxsFiles(){const e=(await this.getPackageFiles(miniProgramPlugin,config_1.FullPkg)).map(e=>e.path),t=e.filter(e=>e.endsWith(".wxml")),i=e.filter(e=>e.endsWith(".wxs")),s=await this.getCodeByFileList(miniProgramPlugin,t.concat(i));return{wxmlFiles:t,wxsFiles:i,content:t.concat(i).reduce((e,t)=>{const i=s[t];if(!i)throw`lack of ${t} code`;if("error"in i)throw i.error;return e[t]=i.code,e["./"+t]=i.code,e},{})}}async checkThemeJSON(e){return(await this.getConf(miniProgram)).theme}setProxy(e){(0,request_1.setCiProxy)(e)}setLocale(e){this._locale!==e&&(this._locale=e,this.subProcessManager.runTask("setLocale",e))}async uglifyFileNames(e,t,i){return await(0,uglifyfilenames_1.uglifyFileNames)(e,t,i)}async getMPFileInfo(){return this.subProcessManager.runTask("getLocalFileList",miniProgram)}async getPluginFileInfo(){return this.subProcessManager.runTask("getLocalFileList",miniProgramPlugin)}async getCompAndPagesOfConf(){const e=await this.getConf(miniProgram);return{pages:e.pages,comps:e.comps}}async getFiltedFileListReason(e){const t=this.project.getFileList(this.project.miniprogramRoot),i=[],s=await this.filterFactory(e),o=this.isGameType(this.project.type)?miniGame:miniProgram;for(const e of t){const t=s(o,e);t!==config_1.EFilterCode.Include&&i.push({file:e,code:t})}if(this.isPluginType(this.project.type)){const e=this.project.getFileList(this.project.pluginRoot),t=this.isGameType(this.project.type)?miniGamePlugin:miniProgramPlugin;for(const o of e){const e=s(t,o);e!==config_1.EFilterCode.Include&&i.push({file:o,code:e})}}return i}}exports.SummerCompiler=SummerCompiler;
@@ -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: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
+ "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,P=(0,miniappJson_1.tryGetIOSMiniappJson)(s);let v=c;if(l.signType===miniapp_builder_1.miniappSinTypes.appleId.type){const{mobileapp_info:e={}}=v;v=Object.assign(Object.assign({},v),{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 y=await buildCloud_1.default.updateIOSInfoPlistInfo(s,v,g,P,i,f);await buildCloud_1.default.updateIOSAppConfigPlistInfo(s,v,g,P,a,b,i,h,f),await buildCloud_1.default.updateIOSAppexInfoPlistInfo(v,g,P,y,i),await buildCloud_1.default.updateIOSIcons(s,g,"",P,!1,i,!1,m),await buildCloud_1.default.updateSplashScreen(s,g,P,i,h,f),await buildCloud_1.default.updateSplashScreenVideo(s,g,P,i,f),await buildCloud_1.default.updateExtendedSdk(v,g,a,d,P,_,i),await buildCloud_1.default.updatePlugin(g,u,s,P,p,!1,y,i);const S=await buildCloud_1.default.getEntitlements(v,g,P,i);if(await buildCloud_1.default.updateIOSAppResource(s,g,P,i),"device"===o){const{mobileapp_info:e={}}=v,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:S,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,n,s=!0){if(!n){if(s)return"";throw new Error(`file cant be empty for cloud build, key: ${t} , fileName: ${n}`)}if(path_1.default.isAbsolute(n)){const e=path_1.default.basename(n);if(!fs_extra_1.default.existsSync(n)){if(s)return"";throw new Error(`file cant be empty for cloud build, key: ${t} , fileName: ${n}`)}const i=(0,tools_1.generateMD5)(n);return l(n,path_1.default.join(a,`${i}_${e}`)),path_1.default.join(r,e)}const c=path_1.default.join(e,n),d=path_1.default.join(i,n);if(!fs_extra_1.default.existsSync(c)){if(s)return"";throw new Error(`file cant be empty for cloud build, key: ${t} , fileName: ${n}`)}return l(c,d),o.progress("prepare material for cloud build: "+n),n}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:P,contentViewImage:v,cancelButtonImage:y,confirmButtonImage:S}=u,w=d("privacy template",P),I=d("privacy contentViewImage",v),x=d("privacy cancelButtonImage",y),j=d("privacy confirmButtonImage",S),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=>{if(!0===e.open&&(e.resourcePath&&d(`mini-plugin ios ${e.pluginId}:${e.resourcePath}`,e.resourcePath),"object"==typeof e.appexProfiles))for(const i in e.appexProfiles){const t=e.appexProfiles[i];!0===t.enable&&("string"==typeof t.profilePath&&t.profilePath.length>0&&d("mini-plugin ios "+t.profilePath,t.profilePath),"string"==typeof t.distributeProfilePath&&t.distributeProfilePath.length>0&&d("mini-plugin ios "+t.distributeProfilePath,t.distributeProfilePath))}});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: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;
@@ -2038,6 +2038,7 @@ module.exports = {
2038
2038
  "enum": [
2039
2039
  "mini-android",
2040
2040
  "mini-ios",
2041
+ "mini-ohos",
2041
2042
  "mini-weixin"
2042
2043
  ],
2043
2044
  "type": "string"
@@ -2317,5 +2318,5 @@ module.exports = {
2317
2318
  }
2318
2319
  },
2319
2320
  "$schema": "http://json-schema.org/draft-07/schema#",
2320
- "$version": 1749547010069
2321
+ "$version": 1754364227507
2321
2322
  }
@@ -318,6 +318,9 @@ module.exports = {
318
318
  "mini-android": {
319
319
  "$ref": "#/definitions/IOriginalPageJSON"
320
320
  },
321
+ "mini-ohos": {
322
+ "$ref": "#/definitions/IOriginalPageJSON"
323
+ },
321
324
  "mini-weixin": {
322
325
  "$ref": "#/definitions/IOriginalPageJSON"
323
326
  },
@@ -1060,5 +1063,5 @@ module.exports = {
1060
1063
  }
1061
1064
  },
1062
1065
  "$schema": "http://json-schema.org/draft-07/schema#",
1063
- "$version": 1734338530625
1066
+ "$version": 1745561918360
1064
1067
  }
@@ -207,5 +207,5 @@ module.exports = {
207
207
  }
208
208
  },
209
209
  "$schema": "http://json-schema.org/draft-07/schema#",
210
- "$version": 1725009241204
210
+ "$version": 1745489647000
211
211
  }
@@ -36,6 +36,9 @@ module.exports = {
36
36
  "mini-android": {
37
37
  "$ref": "#/definitions/IOriginalPageJSON"
38
38
  },
39
+ "mini-ohos": {
40
+ "$ref": "#/definitions/IOriginalPageJSON"
41
+ },
39
42
  "mini-weixin": {
40
43
  "$ref": "#/definitions/IOriginalPageJSON"
41
44
  },
@@ -514,5 +517,5 @@ module.exports = {
514
517
  }
515
518
  },
516
519
  "$schema": "http://json-schema.org/draft-07/schema#",
517
- "$version": 1725009241204
520
+ "$version": 1754363805583
518
521
  }
@@ -49,5 +49,5 @@ module.exports = {
49
49
  },
50
50
  "additionalProperties": false,
51
51
  "$schema": "http://json-schema.org/draft-07/schema#",
52
- "$version": 1725009241204
52
+ "$version": 1745489647000
53
53
  }
@@ -10,5 +10,5 @@ module.exports = {
10
10
  },
11
11
  "additionalProperties": false,
12
12
  "$schema": "http://json-schema.org/draft-07/schema#",
13
- "$version": 1725009241204
13
+ "$version": 1745489647000
14
14
  }
@@ -543,10 +543,10 @@ module.exports = {
543
543
  "properties": {
544
544
  "loading": {
545
545
  "enum": [
546
+ "",
546
547
  "chiaroscuro",
547
548
  "shine",
548
- "spin",
549
- ""
549
+ "spin"
550
550
  ],
551
551
  "type": "string"
552
552
  },
@@ -691,5 +691,5 @@ module.exports = {
691
691
  }
692
692
  },
693
693
  "$schema": "http://json-schema.org/draft-07/schema#",
694
- "$version": 1725009241204
694
+ "$version": 1754364153193
695
695
  }
@@ -370,5 +370,5 @@ module.exports = {
370
370
  }
371
371
  },
372
372
  "$schema": "http://json-schema.org/draft-07/schema#",
373
- "$version": 1725009241204
373
+ "$version": 1745489647000
374
374
  }
@@ -49,5 +49,5 @@ module.exports = {
49
49
  "rules"
50
50
  ],
51
51
  "$schema": "http://json-schema.org/draft-07/schema#",
52
- "$version": 1725009241205
52
+ "$version": 1745489647000
53
53
  }
@@ -16,5 +16,5 @@ module.exports = {
16
16
  },
17
17
  "additionalProperties": false,
18
18
  "$schema": "http://json-schema.org/draft-07/schema#",
19
- "$version": 1725009241205
19
+ "$version": 1745489647000
20
20
  }
@@ -152,7 +152,8 @@ fi
152
152
  function prepareAppexProfiles {
153
153
  profilesMapForShell="$miniappCacheDir/__appexProfilesCacheDir__/profilesMapForShell.txt"
154
154
 
155
- if [ -f "$file" ] && [ "$miniappCacheDir" != '' ]; then
155
+ if [ -f "$profilesMapForShell" ] && [ "$miniappCacheDir" != '' ]; then
156
+ echo "start prepareAppexProfiles" $profilesMapForShell
156
157
  bundleIDs=()
157
158
  profiles=()
158
159
  appexNames=()
@@ -169,6 +170,8 @@ function prepareAppexProfiles {
169
170
  profile=$(echo "$profile" | xargs)
170
171
  appexName=$(echo "$appexName" | xargs)
171
172
 
173
+ echo "start prepareAppexProfiles": $appexName $profile $bundleId
174
+
172
175
  # Store them in the arrays
173
176
  if [ -n "$bundleID" ] && [ -n "$profile" ] && [ -n "$appexName" ]; then
174
177
  bundleIDs+=("$bundleID")
@@ -193,7 +196,9 @@ function prepareAppexProfiles {
193
196
  exit -1
194
197
  fi
195
198
  fi
196
- done < profilesMapForShell # Replace with your actual input file name
199
+ done < "$profilesMapForShell" # Replace with your actual input file name
200
+ else
201
+ echo "prepareAppexProfiles cant find file: " $file
197
202
  fi
198
203
  }
199
204
 
@@ -233,6 +238,7 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
233
238
  echo "doing codesign for "$fileBasename
234
239
  appexProfilePath=entitlements_${fileBasename}.plist
235
240
  if [ -f "$appexProfilePath" ]; then
241
+ echo "doing appex signing " $CERTIFICATENAME $appexProfilePath
236
242
  output=$(/usr/bin/codesign --continue -f -s "$CERTIFICATENAME" --entitlements "$appexProfilePath" "$line" 2>&1)
237
243
  if [ $? -ne 0 ]; then
238
244
  check_if_invalid_cer "$output"
@@ -241,6 +247,8 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
241
247
  else
242
248
  check_if_invalid_cer "$output"
243
249
  fi
250
+ else
251
+ echo "cant find appex profile " $appexProfilePath
244
252
  fi
245
253
  else
246
254
  output=$(/usr/bin/codesign --continue -f -s "$CERTIFICATENAME" --entitlements "$empty_plist" "$line" 2>&1)
@@ -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.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
+ "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 h={};try{h=fse.readJsonSync(g)}catch(i){console.error(i)}return h.miniVersion&&"v1"!==h.miniVersion||((null===(o=h[PLATFORM.ANDROID])||void 0===o?void 0:o.projectPath)&&!path.isAbsolute(null===(t=h[PLATFORM.ANDROID])||void 0===t?void 0:t.projectPath)&&(h[PLATFORM.ANDROID].projectPath=path.posix.join(i,null===(e=h[PLATFORM.ANDROID])||void 0===e?void 0:e.projectPath)),(null===(n=h[PLATFORM.IOS])||void 0===n?void 0:n.projectPath)&&!path.isAbsolute(null===(s=h[PLATFORM.IOS])||void 0===s?void 0:s.projectPath)&&(h[PLATFORM.IOS].projectPath=path.posix.join(i,null===(p=h[PLATFORM.IOS])||void 0===p?void 0:p.projectPath))),(null===(r=h[PLATFORM.ANDROID])||void 0===r?void 0:r.projectPath)&&!path.isAbsolute(null===(a=h[PLATFORM.ANDROID])||void 0===a?void 0:a.projectPath)&&(h[PLATFORM.ANDROID].projectPath=path.posix.join(i,null===(c=h[PLATFORM.ANDROID])||void 0===c?void 0:c.projectPath)),h}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","mini-ohos":"mini-ohos"},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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miniprogram-ci",
3
- "version": "2.1.18",
3
+ "version": "2.1.20",
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",
@@ -94,6 +94,7 @@
94
94
  "gulp-preprocess": "^5.0.0",
95
95
  "gulp-terser": "^1.2.0",
96
96
  "gulp-tsc": "^1.3.2",
97
+ "gulp-typescript": "5.0.1",
97
98
  "jest": "^26.6.3",
98
99
  "mocha": "^6.2.2",
99
100
  "mochawesome": "^4.1.0",
@@ -249,6 +250,7 @@
249
250
  "get-proxy": "^2.1.0",
250
251
  "glob": "7.1.2",
251
252
  "gulp-ignore": "^3.0.0",
253
+ "gulp-plumber": "1.1.0",
252
254
  "html-minifier": "4.0.0",
253
255
  "image-size": "^1.0.2",
254
256
  "jimp": "0.16.1",