miniprogram-ci 2.1.12 → 2.1.14

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.
@@ -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.12",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.14",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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPageJSONWithDisableSpreading=exports.getPageJSON=exports.originGetPageJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),extJSON_1=require("../app/extJSON"),app_1=require("../app"),tools_1=require("../../../../../utils/tools"),common_1=require("../common"),common_2=require("../../../../../utils/common"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),reactiveCache_1=require("../reactiveCache"),checkPageJSON_1=require("./checkPageJSON"),spreadUsingComponent=e=>{const{project:o,pagePath:t,inputJSON:n}=e;if(t.includes("miniprogram_npm"))return;const a=(0,app_1.getAppJSON)(o);if((0,common_1.checkPagePathIsInIndependentSubpackage)(a,t))return;if(a.componentPlaceholder){n.componentPlaceholder=n.componentPlaceholder||{};for(const e in a.componentPlaceholder)n.componentPlaceholder[e]=n.componentPlaceholder[e]||a.componentPlaceholder[e]}const i=Object.assign({},a.usingComponents);if(0!==Object.keys(i).length){n.usingComponents||(n.usingComponents={});for(const e in i){if(n.usingComponents[e])continue;const o=i[e]||"";if(o.startsWith("/")||o.startsWith("plugin://")){n.usingComponents[e]=o;continue}const a=(0,tools_1.normalizePath)(path_1.default.posix.relative(path_1.default.posix.dirname(t),o));n.usingComponents[e]=a.startsWith(".")?a:"./"+a}}},mergeExtJSON=e=>{var o;const{project:t,inputJSON:n,pagePath:a}=e,i=(0,extJSON_1.getExtJSON)(t);(null===(o=null==i?void 0:i.extPages)||void 0===o?void 0:o[a])&&Object.assign(n,i.extPages[a])},checkComponentPath=e=>{const{project:o,miniprogramRoot:t,pagePath:n,inputJSON:a}=e;(0,common_1.checkComponentPath)({project:o,root:t,relativePath:n+".json",inputJSON:a})},checkComponentGenerics=e=>{const{pagePath:o,inputJSON:t}=e,n=o+".json";if(!t.componentGenerics)return;const a=[];for(const e in t.componentGenerics){const o=t.componentGenerics[e],n=(0,tools_1.getType)(o);"boolean"===n||"object"===n?"object"===n&&"string"!==(0,tools_1.getType)(o.default)&&a.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`["componentGenerics"]["${e}"]["default"]`,"string"])):a.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`["componentGenerics"]["${e}"]`,"boolean/object"]))}a.length>0&&(0,common_2.throwError)({msg:a.join("\n"),filePath:n})};function checkRenderer(e){var o,t,n;const{filePath:a,inputJSON:i}=e,{renderer:r}=i,c=(0,app_1.getAppJSON)(e.project);if((0,common_2.getAllPages)(c).includes(e.pagePath)&&("skyline"===r&&("requiredComponents"!==c.lazyCodeLoading&&(0,common_2.throwError)({msg:locales_1.default.config.APP_JSON_SHOULD_SET_LAZYCODELOADING.format(a),filePath:a}),(null===(o=c.rendererOptions)||void 0===o?void 0:o.skyline)||(0,common_2.throwError)({msg:locales_1.default.config.APP_JSON_SHOULD_SET_RENDEREROPTIONS.format(a),filePath:a})),"skyline"===r||"skyline"===c.renderer&&void 0===r)){"default"===i.navigationStyle&&(0,common_2.throwError)({msg:locales_1.default.config.PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM.format(a),filePath:a});!(i.navigationStyle?"custom"===i.navigationStyle:"custom"===(null===(t=c.window)||void 0===t?void 0:t.navigationStyle))&&(i.navigationBarTitleText||i.navigationBarTextStyle||i.navigationBarBackgroundColor)&&(0,common_2.throwError)({msg:locales_1.default.config.PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM.format(a),filePath:a}),i.disableScroll=null===(n=i.disableScroll)||void 0===n||n,i.navigationStyle="custom"}}function checkComponentFramework(e){const{filePath:o,inputJSON:t}=e,{renderer:n,componentFramework:a}=t,i=(0,app_1.getAppJSON)(e.project);if(!(0,common_2.getAllPages)(i).includes(e.pagePath))return;const r="skyline"===n||"skyline"===i.renderer&&void 0===n,c="glass-easel"===a||"glass-easel"===i.componentFramework&&void 0===a;r&&(c||(0,common_2.throwError)({msg:locales_1.default.config.JSON_SHOULD_SET_COMPONENTFRAMEWORK_SKYLINE.format(o),filePath:o}))}const compilePageJSON=(e,o=!1)=>{mergeExtJSON(e),checkComponentGenerics(e),checkComponentPath(e),o||spreadUsingComponent(e),checkRenderer(e),checkComponentFramework(e)};function originGetPageJSON(e,o){const{pagePath:t,miniprogramRoot:n=""}=o,a=(0,tools_1.normalizePath)(path_1.default.posix.join(n,t+".json")),i=(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(e),r=(0,lodash_1.cloneDeep)(i.getPageJSON("checked",o));return compilePageJSON({project:e,miniprogramRoot:n,inputJSON:r,filePath:a,pagePath:t}),r.usingComponents||(r.usingComponents={}),r}async function getPageJSON(e,o){const t=(0,reactiveCache_1.tryToGetReactiveProject)(e);return(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(t).getPageJSON("compiled",o)}function getPageJSONWithDisableSpreading(e,o){const t=(0,reactiveCache_1.tryToGetReactiveProject)(e),n=(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(t),{pagePath:a,miniprogramRoot:i=""}=o,r=(0,tools_1.normalizePath)(path_1.default.posix.join(i,a+".json")),c=(0,lodash_1.cloneDeep)(n.getPageJSON("checked",o));return compilePageJSON({project:t,miniprogramRoot:i,inputJSON:c,filePath:r,pagePath:a},!0),c.usingComponents||(c.usingComponents={}),c}exports.originGetPageJSON=originGetPageJSON,reactiveCache_1.ReactiveJSONCompiler.setOriginCheckPageJSON(checkPageJSON_1.checkPageJSON),reactiveCache_1.ReactiveJSONCompiler.setOriginGetPageJSON(originGetPageJSON),exports.getPageJSON=getPageJSON,exports.getPageJSONWithDisableSpreading=getPageJSONWithDisableSpreading;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPageJSONWithDisableSpreading=exports.getPageJSON=exports.originGetPageJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),extJSON_1=require("../app/extJSON"),app_1=require("../app"),tools_1=require("../../../../../utils/tools"),common_1=require("../common"),common_2=require("../../../../../utils/common"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),reactiveCache_1=require("../reactiveCache"),checkPageJSON_1=require("./checkPageJSON"),spreadUsingComponent=e=>{const{project:o,pagePath:t,inputJSON:n}=e;if(t.includes("miniprogram_npm"))return;const a=(0,app_1.getAppJSON)(o);if((0,common_1.checkPagePathIsInIndependentSubpackage)(a,t))return;if(a.componentPlaceholder){n.componentPlaceholder=n.componentPlaceholder||{};for(const e in a.componentPlaceholder)n.componentPlaceholder[e]=n.componentPlaceholder[e]||a.componentPlaceholder[e]}const i=Object.assign({},a.usingComponents);if(0!==Object.keys(i).length){n.usingComponents||(n.usingComponents={});for(const e in i){if(n.usingComponents[e])continue;const o=i[e]||"";if(o.startsWith("/")||o.startsWith("plugin://")){n.usingComponents[e]=o;continue}const a=(0,tools_1.normalizePath)(path_1.default.posix.relative(path_1.default.posix.dirname(t),o));n.usingComponents[e]=a.startsWith(".")?a:"./"+a}}},mergeExtJSON=e=>{var o;const{project:t,inputJSON:n,pagePath:a}=e,i=(0,extJSON_1.getExtJSON)(t);(null===(o=null==i?void 0:i.extPages)||void 0===o?void 0:o[a])&&Object.assign(n,i.extPages[a])},checkComponentPath=e=>{const{project:o,miniprogramRoot:t,pagePath:n,inputJSON:a}=e;(0,common_1.checkComponentPath)({project:o,root:t,relativePath:n+".json",inputJSON:a})},checkComponentGenerics=e=>{const{pagePath:o,inputJSON:t}=e,n=o+".json";if(!t.componentGenerics)return;const a=[];for(const e in t.componentGenerics){const o=t.componentGenerics[e],n=(0,tools_1.getType)(o);"boolean"===n||"object"===n?"object"===n&&"string"!==(0,tools_1.getType)(o.default)&&a.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`["componentGenerics"]["${e}"]["default"]`,"string"])):a.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`["componentGenerics"]["${e}"]`,"boolean/object"]))}a.length>0&&(0,common_2.throwError)({msg:a.join("\n"),filePath:n})};function checkRenderer(e){var o,t;const{filePath:n,inputJSON:a}=e,{renderer:i}=a,r=(0,app_1.getAppJSON)(e.project);if((0,common_2.getAllPages)(r).includes(e.pagePath)&&("skyline"===i&&"requiredComponents"!==r.lazyCodeLoading&&(0,common_2.throwError)({msg:locales_1.default.config.APP_JSON_SHOULD_SET_LAZYCODELOADING.format(n),filePath:n}),"skyline"===i||"skyline"===r.renderer&&void 0===i)){"default"===a.navigationStyle&&(0,common_2.throwError)({msg:locales_1.default.config.PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM.format(n),filePath:n});!(a.navigationStyle?"custom"===a.navigationStyle:"custom"===(null===(o=r.window)||void 0===o?void 0:o.navigationStyle))&&(a.navigationBarTitleText||a.navigationBarTextStyle||a.navigationBarBackgroundColor)&&(0,common_2.throwError)({msg:locales_1.default.config.PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM.format(n),filePath:n}),a.disableScroll=null===(t=a.disableScroll)||void 0===t||t,a.navigationStyle="custom"}}function checkComponentFramework(e){const{filePath:o,inputJSON:t}=e,{renderer:n,componentFramework:a}=t,i=(0,app_1.getAppJSON)(e.project);if(!(0,common_2.getAllPages)(i).includes(e.pagePath))return;const r="skyline"===n||"skyline"===i.renderer&&void 0===n,c="glass-easel"===a||"glass-easel"===i.componentFramework&&void 0===a;r&&(c||(0,common_2.throwError)({msg:locales_1.default.config.JSON_SHOULD_SET_COMPONENTFRAMEWORK_SKYLINE.format(o),filePath:o}))}const compilePageJSON=(e,o=!1)=>{mergeExtJSON(e),checkComponentGenerics(e),checkComponentPath(e),o||spreadUsingComponent(e),checkRenderer(e),checkComponentFramework(e)};function originGetPageJSON(e,o){const{pagePath:t,miniprogramRoot:n=""}=o,a=(0,tools_1.normalizePath)(path_1.default.posix.join(n,t+".json")),i=(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(e),r=(0,lodash_1.cloneDeep)(i.getPageJSON("checked",o));return compilePageJSON({project:e,miniprogramRoot:n,inputJSON:r,filePath:a,pagePath:t}),r.usingComponents||(r.usingComponents={}),r}async function getPageJSON(e,o){const t=(0,reactiveCache_1.tryToGetReactiveProject)(e);return(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(t).getPageJSON("compiled",o)}function getPageJSONWithDisableSpreading(e,o){const t=(0,reactiveCache_1.tryToGetReactiveProject)(e),n=(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(t),{pagePath:a,miniprogramRoot:i=""}=o,r=(0,tools_1.normalizePath)(path_1.default.posix.join(i,a+".json")),c=(0,lodash_1.cloneDeep)(n.getPageJSON("checked",o));return compilePageJSON({project:t,miniprogramRoot:i,inputJSON:c,filePath:r,pagePath:a},!0),c.usingComponents||(c.usingComponents={}),c}exports.originGetPageJSON=originGetPageJSON,reactiveCache_1.ReactiveJSONCompiler.setOriginCheckPageJSON(checkPageJSON_1.checkPageJSON),reactiveCache_1.ReactiveJSONCompiler.setOriginGetPageJSON(originGetPageJSON),exports.getPageJSON=getPageJSON,exports.getPageJSONWithDisableSpreading=getPageJSONWithDisableSpreading;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.remoteBuildProjectMaterialAbsoluteCacheDir=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")),glob_1=tslib_1.__importDefault(require("glob")),env_1=require("../../../utils/env"),miniapp_builder_1=require("../../../utils/miniapp-builder"),codesign_1=require("../../../utils/codesign"),miniappJson_1=require("../../../utils/miniappJson"),lodash_1=require("lodash"),tools_1=require("../../../utils/tools"),uuidv4=require("uuid/v4"),sizeOf=require("image-size"),plist=require("simple-plist"),errorIOSSdkVersions=["1.0.19"],APPEX_PROFILES_MAPS_FILE="__appexProfilesCacheDir__/profilesMap.json",APPEX_PROFILES_MAPS_FOR_SHELL_FILE="__appexProfilesCacheDir__/profilesMapForShell.txt",defaultIconDirPath=path_1.default.join(__dirname,"../../../static/images/"),getDepReg=e=>new RegExp(`s.subspec '${e}'.*\n(?:.*\n)*?(?:.*sp.vendored_frameworks = \\[\n)((?:.*'.*?'.*\n)*?)(?:.*\\]\n)`,"m"),allowTheme=["Light","LightSpecial","Dark","DarkSpecial","Default"];exports.remoteBuildProjectMaterialAbsoluteCacheDir="__absoluteFile";const iconInfoMap={appStore1024:{size:[1024,1024],scale:1,idiom:"ios-marketing",required:!0},appStore1024Other:{size:[1024,1024],scale:1,idiom:"ios-marketing-other"},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"}};class buildCloudManager{generateTempDemoIpaPath(e){const i=path_1.default.join(e,"../.."),t=path_1.default.basename(i),n=path_1.default.dirname(i),a=path_1.default.join(n,t+"-operateDir");fs_extra_1.default.existsSync(a)&&fs_extra_1.default.removeSync(a),fs_extra_1.default.ensureDirSync(a);const s=path_1.default.join(a,"Payload/demo.app");return fs_extra_1.default.copySync(e,s),s}generateInfoPlistCFBundleURLTypesItem(e){const i={};return e.CFBundleURLName&&(i.CFBundleURLName=e.CFBundleURLName),e.CFBundleURLSchemes&&(i.CFBundleURLSchemes=[e.CFBundleURLSchemes]),e.CFBundleTypeRole&&(i.CFBundleTypeRole=e.CFBundleTypeRole),i}updatePrivacyBackgroundImage(e,i,t,n,a){t.message("doing","updatePrivacyBackgroundImage "+n);if(fs_extra_1.default.readdirSync(i).forEach(e=>{"privacy_"+n===path_1.default.basename(e,path_1.default.extname(e))&&fs_extra_1.default.removeSync(path_1.default.join(i,e))}),!a)return;path_1.default.isAbsolute(a)||(a=path_1.default.join(e,a)),a=this.getMaterialFilePath(e,a);const s=path_1.default.extname(a),o=path_1.default.join(i,`privacy_${n}${s}`);try{fs_extra_1.default.copyFileSync(a,o)}catch(e){throw t.message("error",`copy privacy image failed: ${n}, ${a} to ${o}`),e}}async updateIOSInfoPlistInfo(e,i,t,n,a,s){var o,r,l,p,d,u,c,f,_,h,y;a.progress("update app base info...");const{mobileapp_info:g={}}=i,m=g.mobileapp_id,S=path_1.default.join(t,"Info.plist"),I={},v=(e,i)=>{var t,n;if((null==i?void 0:i.startsWith("%"))&&(null==i?void 0:i.endsWith("%"))){const o=i.slice(1,-1);I[e]=o;const r=(null===(n=null===(t=null==s?void 0:s.base)||void 0===t?void 0:t.ios)||void 0===n?void 0:n[o])||"";return r||a.message("error",`未在国际化配置 base.json 中找到字段 ${o},请检查`),r}return i};v("UISplashScreenImageName",null===(o=null==n?void 0:n.splashscreen)||void 0===o?void 0:o.customImage),v("UILaunchStoryboardName",null===(r=null==n?void 0:n.splashscreen)||void 0===r?void 0:r.customImage);const x=plist.readFileSync(S);if("object"==typeof n.customInfoPlist&&!Array.isArray(n.customInfoPlist)){a.progress("initiating user custom info.plist config");const e=n.customInfoPlist;for(const i in e)x[i]=e[i]}if(x.CFBundleName=v("CFBundleName",n.name),x.CFBundleDisplayName=v("CFBundleDisplayName",n.name),x.CFBundleShortVersionString=n.version,"number"==typeof n.versionCode?x.CFBundleVersion=parseInt(n.versionCode.toString(),10).toString():x.CFBundleVersion=(parseInt(x.CFBundleVersion,10)+1).toString(),x.CFBundleIdentifier=this.getBundleIdentifier(g),Array.isArray(null==n?void 0:n.openMimeTypes)&&this.validateCFBundleDocumentTypes(n.openMimeTypes,a)&&(x.CFBundleDocumentTypes=n.openMimeTypes,a.message("doing","openMimeTypes 应用成功")),Array.isArray(x.CFBundleURLTypes)||(x.CFBundleURLTypes=[]),(null===(p=null===(l=x.CFBundleURLTypes)||void 0===l?void 0:l[0])||void 0===p?void 0:p.CFBundleURLSchemes)&&(x.CFBundleURLTypes[0].CFBundleURLSchemes=[m]),x.CFBundleURLTypes[0]&&(x.CFBundleURLTypes=[x.CFBundleURLTypes[0]]),Object.keys(miniappJson_1.iosPrivacyDescObj).forEach(e=>{var i,t;(null===(i=null==n?void 0:n.privateDescriptions)||void 0===i?void 0:i[e])?x[e]=v(e,null===(t=n.privateDescriptions)||void 0===t?void 0:t[e]):delete x[e]}),!0===(null===(d=null==n?void 0:n.infoPlist)||void 0===d?void 0:d.DisableAppUsesNonExemptEncryption)?x.ITSAppUsesNonExemptEncryption=!1:delete x.ITSAppUsesNonExemptEncryption,x.UIBackgroundModes=[],!0===(null===(u=null==n?void 0:n.infoPlist)||void 0===u?void 0:u.AudioInBackgroundMode)&&x.UIBackgroundModes.push("audio"),!0===(null===(c=null==n?void 0:n.infoPlist)||void 0===c?void 0:c.LocationInBackgroundMode)&&x.UIBackgroundModes.push("location"),!0===(null===(f=null==n?void 0:n.infoPlist)||void 0===f?void 0:f.requiresFullScreen)?x.UIRequiresFullScreen=!0:delete x.UIRequiresFullScreen,"object"==typeof(null===(_=null==n?void 0:n.infoPlist)||void 0===_?void 0:_.CFBundleURLTypes)){const e=this.generateInfoPlistCFBundleURLTypesItem(n.infoPlist.CFBundleURLTypes);x.CFBundleURLTypes.push(e);const{additionalCFBundleURLTypes:i}=n.infoPlist.CFBundleURLTypes;Array.isArray(i)&&i.forEach(e=>{if("object"==typeof e){const i=this.generateInfoPlistCFBundleURLTypesItem(e);x.CFBundleURLTypes.push(i)}})}if(null===(h=null==n?void 0:n.useExtendedSdk)||void 0===h?void 0:h.WeAppGoogleLogin){if(!(null==n?void 0:n.googleLoginClientID)||!(null==n?void 0:n.googleLoginBundleUrlType))throw new Error("勾选了 Google Login 拓展模块但未填写 googleLoginClientID 或 googleLoginBundleUrlType 将导致拓展模块无法使用");x.GIDClientID=n.googleLoginClientID,Array.isArray(x.CFBundleURLTypes)?x.CFBundleURLTypes.push({CFBundleURLSchemes:[n.googleLoginBundleUrlType]}):x.CFBundleURLTypes=[{CFBundleURLSchemes:[n.googleLoginBundleUrlType]}]}if(!0===n.enableIpad&&((0,miniappJson_1.iOSAppJsonIsUsingIPadResizable)(e)?(x["UISupportedInterfaceOrientations~ipad"]=["UIInterfaceOrientationPortrait","UIInterfaceOrientationPortraitUpsideDown","UIInterfaceOrientationLandscapeLeft","UIInterfaceOrientationLandscapeRight"],a.progress("ipad is support Landscape")):(x["UISupportedInterfaceOrientations~ipad"]=["UIInterfaceOrientationPortrait","UIInterfaceOrientationPortraitUpsideDown"],a.progress("ipad is not support Landscape"))),null===(y=n.infoPlist)||void 0===y?void 0:y.LSApplicationQueriesSchemes){const e=n.infoPlist.LSApplicationQueriesSchemes.split(",");e.length&&x.LSApplicationQueriesSchemes.push(...e.filter(e=>e))}try{plist.writeFileSync(S,x)}catch(e){throw new Error("write info.plist failed!!"+e.messenge)}return await this.writeI18NInfoFile(t,s,I),x.CFBundleVersion}getBundleIdentifier(e){return e.ios_flag&&e.bundle_id||e.debug_ios_bundle_id}validateCFBundleDocumentTypes(e,i){const t=["Owner","Default"," Alternate","None"],n=["Editor","Viewer"," Shell","None"],a=new Set;for(const s of e){if(a.has(s.CFBundleTypeName))return i.message("error","openMimeTypes 应用失败,存在重复定义的 CFBundleTypeName: "+s.CFBundleTypeName),!1;if(a.add(s.CFBundleTypeName),!t.includes(s.LSHandlerRank))return i.message("error","openMimeTypes 应用失败,存在不合法的 LSHandlerRank: "+s.LSHandlerRank),!1;if(!n.includes(s.CFBundleTypeRole))return i.message("error","openMimeTypes 应用失败,存在不合法的 CFBundleTypeRole: "+s.CFBundleTypeRole),!1;if(!Array.isArray(s.LSItemContentTypes))return i.message("error","openMimeTypes 应用失败,LSItemContentTypes 类型不合法"),!1}return!0}useGDT(e){return(0,miniappJson_1.iOSMiniAppJsonIsUsingGDT)(e)}async updateIOSAppConfigPlistInfo(e,i,t,n,a,s,o,r="Dark",l){var p,d,u,c,f,_,h;o.progress("update app module info...");const{module_info:y={},cpa_info:g={},cpa_package_info:m={enable_remove_watermark:!1}}=i;if(!g.sdk_key||!g.sdk_key_secret)throw new Error("sdkKey and sdkSecret not found");const S=path_1.default.join(t,"MiniApp.bundle"),I=path_1.default.join(S,"AppConfig.plist"),v=plist.readFileSync(I);m.enable_remove_watermark?v.enableRemoveWatermark=!0:v.splashscreenTheme=r,v.miniModuleId=y.module_id,v.sdkKey=g.sdk_key,v.sdkSecret=g.sdk_key_secret;const{privacy:x={}}=n;v.privacy||(v.privacy={}),v.privacy.enable=!!x.enable,v.privacy.enableViewOnly=!!x.enableViewOnly;const b=path_1.default.posix.join(S,"configs/privacy.json"),{contentViewImage:F,cancelButtonImage:P,confirmButtonImage:j,template:B}=x;if(x.enable){let i=B||"";if(fs_extra_1.default.ensureDirSync(path_1.default.posix.join(S,"configs")),i.startsWith("%")&&i.endsWith("%")){const t=B.slice(1,-1);i=(null===(d=null===(p=null==l?void 0:l.base)||void 0===p?void 0:p.ios)||void 0===d?void 0:d[t])||"",i||o.message("error",`未在国际化配置 base.json 中找到字段 ${t},请检查`),Object.keys(l).forEach(i=>{var n,a;if("base"===i)return;let s=null===(a=null===(n=l[i])||void 0===n?void 0:n.ios)||void 0===a?void 0:a[t];if(s){s=this.getMaterialFilePath(e,s);const t=`configs/privacy-${i}.json`,n=path_1.default.posix.join(S,t);fs_extra_1.default.existsSync(s)?fs_extra_1.default.copyFileSync(s,n):o.message("error",`未找到隐私协议在国际化配置 ${i}.json 中配置的文件 ${s},请检查`)}})}i?(i=this.getMaterialFilePath(e,i),fs_extra_1.default.existsSync(i)?(fs_extra_1.default.copyFileSync(i,b),v.privacy.template="configs/privacy.json"):(o.message("error",`未找到隐私协议中配置的文件 ${i},请检查`),v.privacy.template="configs/defaultPrivacy.json")):v.privacy.template="configs/defaultPrivacy.json",!0===x.enableNativePlugin&&"string"==typeof x.nativePluginId&&x.nativePluginId.length>2&&(v.privacy.plugin={pluginId:x.nativePluginId,enable:!0})}else v.privacy.template="",fs_extra_1.default.removeSync(b);this.updatePrivacyBackgroundImage(e,t,o,"contentViewImage",F),this.updatePrivacyBackgroundImage(e,t,o,"confirmButtonImage",j),this.updatePrivacyBackgroundImage(e,t,o,"cancelButtonImage",P);const{appMenuEnable:C=!0}=n;v.appMenuEnable=C;const{enableVConsole:L="undefined"}=n;if(v.enableVConsole=L,null===(u=n.useExtendedSdk)||void 0===u?void 0:u.WeAppLive){const{weAppLiveLicenseUrl:e,weAppLiveLicenseKey:i}=n.liveInfo||{};if(!e||!i)throw new Error("You need to provide the weAppLiveLicenseUrl and weAppLiveLicenseKey when using Live SDK.");v.weAppLiveLicenseUrl=e,v.weAppLiveLicenseKey=i}const{tpush:w}=n;let A=!1;if("object"==typeof w){const e=path_1.default.posix.join(t,"PlugIns/TPNSService.appex"),i=path_1.default.posix.join(e,"AppConfig.plist");if(this.useTpush(n)){v.TPNSAccessID=w.accessID,v.TPNSAccessKey=w.accessKey,w.clusterDomainName?v.clusterDomainName=w.clusterDomainName:delete v.clusterDomainName;const t=s?"x86_64":"arm64",n=path_1.default.join(a,`appex/${t}/TPNSService.appex`);if(!fs_extra_1.default.existsSync(n))throw new Error("can not found extendsdk: "+n);try{fs_extra_1.default.copySync(n,e),plist.writeFileSync(i,v),A=!0}catch(e){throw new Error("copy TPNSService.appex to app failed: "+e)}}}if(!A)try{const e=path_1.default.posix.join(t,"PlugIns");fs_extra_1.default.existsSync(e)?(fs_extra_1.default.removeSync(e),o.progress("removed PlugIns folder...")):o.progress("no PlugIns folder...")}catch(e){throw new Error("remove TPNSService.appex from app failed: "+e)}if(null===(c=n.useExtendedSdk)||void 0===c?void 0:c.WeAppLBS){if(!n.qmapAPIKey)throw new Error("You need to provide the Tencent Location Service API Key when using LBS SDK.");v.qmapAPIKey=n.qmapAPIKey}const{gdt:D}=n,E=this.useGDT(n);if(v.GDTAd=E?{appid:D.appid,enable:!0,SplashAd:{placementId:D.splashAd_placementId,fetchDelay:D.splashAd_fetchDelay||3,defaultEnable:null===(f=D.splashAd_defaultEnable)||void 0===f||f}}:{appid:"",enable:!1,SplashAd:{placementId:"",fetchDelay:3}},n["mini-plugin"]&&Array.isArray(n["mini-plugin"].ios)){const e=n["mini-plugin"].ios,i=e.filter(e=>!!(e.open&&e.pluginId&&e.loadWhenStart)).map(e=>e.pluginId),t=e.map(e=>e.open?{pluginId:e.pluginId,version:e.isFromLocal?"dev":e.pluginVersion}:void 0).filter(e=>e);v.plugins={loadWhenStart:i,pluginInfoList:t}}const{enableDebugLog:$=!1}=n;v.enableDebugLog=$;const{debugLogSizeLimit:U=10}=n;isNaN(Number(U))?o.message("error",`ios debugLogSizeLimit ${U} is NaN`):v.debugLogSizeLimit=Number(U);const{enableOpenUrlNavigate:T=!1}=n;v.enableOpenUrlNavigate=T;const k=path_1.default.posix.join(S,"configs/locales");if(fs_extra_1.default.ensureDirSync(k),null===(h=null===(_=null==l?void 0:l.base)||void 0===_?void 0:_.ios)||void 0===h?void 0:h.LOCALES){const i=this.getMaterialFilePath(e,l.base.ios.LOCALES);fs_extra_1.default.existsSync(i)?(fs_extra_1.default.copyFileSync(i,path_1.default.posix.join(k,"common-base.json")),o.progress("复制基础语言 locales 配置成功")):o.message("error","未找到基础语言 locales 配置文件: "+i)}Object.keys(l).forEach(i=>{var t,n;if("base"===i)return;const a=null===(n=null===(t=l[i])||void 0===t?void 0:t.ios)||void 0===n?void 0:n.LOCALES;if(a){const t=this.getMaterialFilePath(e,a);fs_extra_1.default.existsSync(t)?(fs_extra_1.default.copyFileSync(t,path_1.default.posix.join(k,`common-${i}.json`)),o.progress(`复制 ${i} 语言 locales 配置成功`)):o.message("error",`未找到 ${i} 语言 locales 配置文件: ${t}`)}}),plist.writeFileSync(I,v)}async updateIOSAppexInfoPlistInfo(e,i,t,n,a){if(this.useTpush(t)){a.progress("update appex for notification base info...");const{mobileapp_info:s={}}=e,o=path_1.default.join(i,"PlugIns/TPNSService.appex"),r=path_1.default.join(o,"Info.plist"),l=plist.readFileSync(r);l.CFBundleShortVersionString=t.version,a.progress("update appex for CFBundleVersion: "+n),l.CFBundleVersion=n;const p=s.ios_flag&&s.bundle_id||s.debug_ios_bundle_id;l.CFBundleIdentifier=t.tpush.serviceBundleId||p+".service",a.progress("update appex bundle identifier for infoPlist : "+l.CFBundleIdentifier),plist.writeFileSync(r,l)}else a.progress("not using tpush...")}updateBundleIcons(e,i,t,n,a){const s=[],o=[],r=[];for(const l in t){if(!t[l])continue;const p=this.getMaterialFilePath(e,t[l]);if(!p)return void a.message("error","getMatrialFailed: "+t[l]);const d=iconInfoMap[l];try{const e=sizeOf(p),i=d.size[0]*d.scale,n=d.size[1]*d.scale;if(e.width!==i||e.height!==n){a.progress(`check ${l} size failed, require [${i}, ${n}] but [${e.width}, ${e.height}] ingore ${t[l]} `);continue}}catch(e){a.progress(`get ${l} info failed, ingore ${t[l]}(e: ${e.message})`);continue}const u=path_1.default.extname(p),c=1===d.scale?"":`@${d.scale}x`,f=`${d.size[0]}x${d.size[1]}`,_=l.startsWith("ipad"),h="appStore1024"===l||"appStore1024Other"===l,y="appStore1024Other"===l?n+"Other":n,g=path_1.default.join(i,`${y}${f}${c}${_?"~ipad":""}${u}`),m={from:p,to:g,filename:path_1.default.basename(g),size:f,scale:d.scale+"x",idiom:d.idiom,key:l};s.push(m),h||(_?r.includes(`${y}${f}`)||r.push(`${y}${f}${c}`):o.includes(`${y}${f}`)||o.push(`${y}${f}${c}`))}return{iphoneBundleIconFiles:o,ipadBundleIconFiles:r,addFiles:s}}async updateIOSIcons(e,i,t,n,a,s,o=!1,r=""){s.progress("update app icons...");const{icons:l={}}=n,p=(o||a)&&!!t;s.progress("genAssetCar: "+p);const d=glob_1.default.sync("AppIcon*.+(png|jpg|jpeg|webp)",{nodir:!0,cwd:i}).map(e=>path_1.default.join(i,e)),u="AppIcon-"+uuidv4().slice(0,8),c=this.updateBundleIcons(e,i,l,u,s);if(!c)throw new Error("updateBundleIcons failed");const{iphoneBundleIconFiles:f=[],ipadBundleIconFiles:_=[],addFiles:h=[]}=c,y={};for(const e in iconInfoMap){if(!iconInfoMap[e].required||l[e])continue;const i=iconInfoMap[e].size[0]*iconInfoMap[e].scale,t=iconInfoMap[e].size[1]*iconInfoMap[e].scale;if(y[e]=path_1.default.join(defaultIconDirPath,`donut-icon${i}x${t}.png`),s.progress(`using default app icons when ${e} is not config...`),!fs_extra_1.default.existsSync(y[e]))throw new Error(`required ${e} but not default or set`)}const g=this.updateBundleIcons(e,i,y,u,s);if(!g)throw new Error("updateBundleIcons WithDefaultIcon failed");const{iphoneBundleIconFiles:m,ipadBundleIconFiles:S,addFiles:I}=g;if(f.push(...m),_.push(...S),h.push(...I),!f.length&&!_.length)return;d.forEach(e=>{fs_extra_1.default.existsSync(e)&&fs_extra_1.default.removeSync(e)});const v=path_1.default.join(t,"__assetCarOperateDir/assetsCar/"),x=path_1.default.join(v,`Assets.xcassets/${u}.appiconset/`);p&&(fs_extra_1.default.ensureDirSync(x),fs_extra_1.default.emptyDirSync(x));const b=[];let F=!1;if(h.forEach(e=>{fs_extra_1.default.existsSync(e.to)&&fs_extra_1.default.removeSync(e.to),fs_extra_1.default.copyFileSync(e.from,e.to),p&&(fs_extra_1.default.copySync(e.from,path_1.default.join(x,e.filename)),"ios-marketing-other"===e.idiom&&(F=!0),b.push({filename:e.filename,size:e.size,scale:e.scale,idiom:e.idiom}))}),p&&fs_extra_1.default.writeJsonSync(path_1.default.join(x,"Contents.json"),{images:b,info:{author:"xcode",version:1}},{spaces:"\t"}),p){const e=path_1.default.join(__dirname,"../../../static/scripts/assetsCar/"),t=path_1.default.join(v,"createAssetsCar");fs_extra_1.default.copySync(e,v);try{await(0,codesign_1.checkXcodeEnv)(s),child_process.execSync(`"${t}" ${u}`,{env:(0,env_1.getProcessEnv)()})}catch(e){throw new Error("createAssetsCar failed "+(e.message||""))}const n=path_1.default.join(v,"build/Assets.car"),a=path_1.default.join(i,"Assets.car");fs_extra_1.default.copyFileSync(n,a)}else if(r&&fs_extra_1.default.existsSync(r))s.message("success","命中缓存,正在使用缓存的 AssetCar"),fs_extra_1.default.copyFileSync(r,path_1.default.join(i,"Assets.car"));else{const e=path_1.default.join(i,"Assets.car");fs_extra_1.default.removeSync(e),s.message("warn","更新 App 图标可能不生效,可使用远程构建验证图标设置;工具将会缓存图标构建结果")}const P=path_1.default.join(i,"Info.plist"),j=plist.readFileSync(P);if(!j.CFBundleIcons){const e={CFBundlePrimaryIcon:{}};j.CFBundleIcons=e}F&&(j.CFBundleIcons.CFBundleAlternateIcons={OtherAppStoreIcon:{CFBundleIconFiles:[u+"Other"],CFBundleIconName:"OtherAppStoreIcon"}}),j.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconName=u,j.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles=f,j["CFBundleIcons~ipad"]||(j["CFBundleIcons~ipad"]={CFBundlePrimaryIcon:{}}),j["CFBundleIcons~ipad"].CFBundlePrimaryIcon.CFBundleIconName=u,j["CFBundleIcons~ipad"].CFBundlePrimaryIcon.CFBundleIconFiles=_,j.NSAppTransportSecurity={NSAllowsArbitraryLoads:!0},plist.writeFileSync(P,j)}replaceLaunchScreenImage(e,i,t,n,a,s){const o=path_1.default.join(e,"01J-lp-oVM-view-Ze5-6b-2t3.nib");let r=fs_extra_1.default.readFileSync(o).toString("hex");if(!i.endsWith(".png"))return void n.message("error","IOS 启动页图片配置格式错误,必须为 PNG 格式, 错误配置:"+i);const l=this.getMaterialFilePath(a,i),p=t+".png",d="LaunchScreen-"+uuidv4().slice(0,12),u=d+".png",c=path_1.default.join(s,u);fs_extra_1.default.copyFileSync(l,c);const f=Buffer.from(p,"utf-8").toString("hex"),_=Buffer.from(u,"utf-8").toString("hex");return-1!==r.indexOf(f)?(r=r.replace(f,_),console.log("replace storyboard customImage success")):console.log("replace storyboard customImage fail"),fs_extra_1.default.writeFileSync(o,Buffer.from(r,"hex")),d}async updateSplashScreen(e,i,t,n,a="Dark",s){var o,r,l;let p;n.progress("update splashscreen image..."),allowTheme.includes(a)&&(p=path_1.default.join(i,`/Base.lproj/LaunchScreen${a}.storyboardc`)),p&&fs_extra_1.default.existsSync(p)&&fs_extra_1.default.copySync(p,path_1.default.join(i,"/Base.lproj/LaunchScreen.storyboardc")),allowTheme.forEach(e=>{const t=path_1.default.join(i,`/Base.lproj/LaunchScreen${e}.storyboardc`);fs_extra_1.default.existsSync(t)&&fs_extra_1.default.removeSync(t)});let d=null===(o=null==t?void 0:t.splashscreen)||void 0===o?void 0:o.customImage;if(!d)return;const u=path_1.default.join(i,"Info.plist"),c=plist.readFileSync(u),f=c.UISplashScreenImageName;if(glob_1.default.sync("LaunchScreen-*.+(png|jpg|jpeg|webp)",{nodir:!0,cwd:i}).forEach(e=>{const t=path_1.default.join(i,e);fs_extra_1.default.removeSync(t)}),d.startsWith("%")&&(null==d?void 0:d.endsWith("%"))){const t=d.slice(1,-1),a=(null===(l=null===(r=null==s?void 0:s.base)||void 0===r?void 0:r.ios)||void 0===l?void 0:l[t])||"";if(!a)return void n.message("error",`未在国际化配置 base.json 中找到字段 ${t},请检查,启动页国际化配置失败`);d=a,Object.keys(s).forEach(a=>{var o,r;if("base"===a)return;const l=null===(r=null===(o=s[a])||void 0===o?void 0:o.ios)||void 0===r?void 0:r[t];if(l){const t=path_1.default.join(i,`/${a}.lproj/LaunchScreen_${a}.storyboardc`);fs_extra_1.default.ensureDirSync(path_1.default.join(t,"..")),fs_extra_1.default.copySync(path_1.default.join(i,"/Base.lproj/LaunchScreen.storyboardc"),t);const s=this.replaceLaunchScreenImage(t,this.getMaterialFilePath(e,l),f,n,e,i);n.progress(`update ${a} splashscreen image...`);const o=fs_extra_1.default.readFileSync(path_1.default.join(i,a+".lproj/InfoPlist.strings"),"utf8");let r="";r=s?o.replace("__UISplashScreenImageName__",`UISplashScreenImageName = "${s}";\n`).replace("__UILaunchStoryboardName__",`UILaunchStoryboardName = "LaunchScreen_${a}";\n`):o.replace("__UISplashScreenImageName__","").replace("__UILaunchStoryboardName__",""),fs_extra_1.default.writeFileSync(path_1.default.join(i,a+".lproj/InfoPlist.strings"),r),n.progress(`update ${a} splashscreen image success`)}})}n.progress("update base splashscreen image...");const _=this.replaceLaunchScreenImage(path_1.default.join(i,"/Base.lproj/LaunchScreen.storyboardc"),this.getMaterialFilePath(e,d),f,n,e,i);n.progress("update base splashscreen image success"),_&&(c.UISplashScreenImageName=_,c.UILaunchStoryboardName="LaunchScreen",plist.writeFileSync(u,c))}genUseExtendedSdk(e,i){const t=Object.assign({},e.useExtendedSdk||{});for(const i in e)if("object"==typeof e[i])for(const n in e[i])if(n.startsWith("useExtendedLib_WeApp")&&!0===e[i][n]){t[n.slice("useExtendedLib_".length)]=!0}return!t.WeAppLBS||t.WeAppOpenFuns||t.WeAppOpenFuns_HasPay||(t.WeAppOpenFuns=!0),"RemoteDebug"===(null==i?void 0:i.debugType)&&(t.WeAppUSB=!0),t}async updateExtendedSdk(e,i,t,n,a,s,o){const r=path_1.default.join(i,"Frameworks");fs_extra_1.default.ensureDirSync(r),o.progress("update extendsdk...");const l=path_1.default.join(t,"WeAppSDK.podspec"),p=fs_extra_1.default.readFileSync(l,"utf-8"),d=this.genUseExtendedSdk(a,s);o.progress("useExtendedSdks: "+JSON.stringify(d));const{mobileapp_info:u={}}=e,c=this.getBundleIdentifier(u);if(d.WeAppOpenFuns&&d.WeAppOpenFuns_HasPay)throw new Error("OpenFuncs SDK 只可勾选使用一个,请按需勾选使用");const f={},_=["WeAppUSB"];for(const e in d){if(!d[e])continue;const i=getDepReg(e),a=p.match(i);if(!(null==a?void 0:a[1])){if(_.includes(e))continue;throw new Error(`拓展模块 ${e} 不存在或已被移除,请检查 project.miniapp.json -> 对应平台 -> useExtendedSdk 删除配置 ${e},版本配置差异请参考更新日志或 https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/miniapp/changelog/difflog.html`)}const s=[];if(a[1].split("\n").forEach(e=>{const i=e.match(/.*'(.*?)',/);if(null==i?void 0:i[1]){const e=i[1].split("/").pop(),a=path_1.default.join(t,"Libs",n,e);if(!fs_extra_1.default.existsSync(a)){if(_.includes(e+".framework"))return;throw new Error(`拓展模块 ${e} 不存在或已被移除,请检查 project.miniapp.json -> 对应平台 -> useExtendedSdk 删除配置 ${e},版本配置差异请参考更新日志或 https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/miniapp/changelog/difflog.html`)}const o=path_1.default.join(r,e);fs_extra_1.default.copySync(a,o),s.push(path_1.default.basename(e));const l=path_1.default.join(o,"info.plist");if(!fs_extra_1.default.existsSync(l))throw new Error("can not found extendsdk info.plist: "+e);this.changeExtendSDKInfoplistBundleId(l,c,e)}}),s.length){f[s.shift()]=s}}const h=path_1.default.join(i,"DyFrameworks.plist");fs_extra_1.default.existsSync(h)&&fs_extra_1.default.removeSync(h),plist.writeFileSync(h,f)}async updatePrivacyInfo(e,i,t){var n;const a=null===(n=null==i?void 0:i.privacy)||void 0===n?void 0:n.privacyInfo;a&&(a.endsWith("PrivacyInfo.xcprivacy")?fs_extra_1.default.existsSync(a)?(fs_extra_1.default.copySync(a,path_1.default.join(e,"/PrivacyInfo.xcprivacy")),t.progress("隐私清单文件替换成功")):t.message("error","隐私清单文件替换失败,文件不存在,将使用默认文件"):t.message("error","隐私清单文件替换失败,文件名必须为 PrivacyInfo.xcprivacy,将使用默认文件"))}async updatePlugin(e,i,t,n,a,s,o,r){const l={},p={},d=[];if(n["mini-plugin"]&&Array.isArray(n["mini-plugin"].ios)){n["mini-plugin"].ios.forEach(e=>{e.open&&e.pluginId?("string"==typeof e.resourcePath&&e.resourcePath.length>0&&(l[e.pluginId]=e.resourcePath),"object"==typeof e.resourceObjects&&Object.keys(e.resourceObjects).length>0&&(p[e.pluginId]=e.resourceObjects)):d.push(e.pluginId)})}if(d.length>0&&r.message("warn","下列插件未启用,请确认project.miniapp.json中的配置:"+d.join(", ")),!i.length)return;const u=path_1.default.join(e,"Frameworks"),c=path_1.default.join(e,"PlugIns");fs_extra_1.default.ensureDirSync(u),r.progress("update plugin...");const f=this.prepareAppexProfileConfig(i,n,t,a,s,o,n.version,r);if(!f)throw new Error("依赖的多端插件需要配置对应的profile");i.forEach(i=>{const{pluginId:n}=i,a=i.dir,s=n+".framework",o=path_1.default.join(u,s);if(-1!==a.indexOf("local-miniapp-plugin")){const e=fs_extra_1.default.statSync(a),{mtime:i}=e;r.progress(`${n}.framework 正在使用本地版本,修改时间为 ${i}`)}fs_extra_1.default.existsSync(o)&&fs_extra_1.default.removeSync(o);const d=path_1.default.join(a,s);if(fs_extra_1.default.existsSync(d)){fs_extra_1.default.copySync(d,o),this.copyResourcesToMainBundle(d,e),this.copyUserResourcePathIntoPlugins(n,t,l[n],p[n],path_1.default.join(o,"MiniPlugin.bundle"),r);fs_extra_1.default.readdirSync(a).forEach(i=>{if(i.endsWith(".appex")){const s=path_1.default.parse(i).name,o=f[s],d=path_1.default.join(c,i);if(!o||!0!==o.enable)return;r.progress(`${n} 插件使用 appex 中 : ${i}`),fs_extra_1.default.existsSync(d)&&fs_extra_1.default.removeSync(d),fs_extra_1.default.ensureDirSync(d);const u=path_1.default.join(a,i);fs_extra_1.default.copySync(u,d),(null==o?void 0:o.profilePath)&&fs_extra_1.default.copySync(o.profilePath,path_1.default.join(d,"embedded.mobileprovision")),this.copyResourcesToMainBundle(u,e),this.copyUserResourcePathIntoPlugins(n,t,l[n],p[n],path_1.default.join(d,"MiniPlugin.bundle"),r)}else if(i.endsWith("framework")&&i!==s){const e=path_1.default.join(u,i),t=path_1.default.join(a,i);fs_extra_1.default.existsSync(e)&&fs_extra_1.default.removeSync(e),fs_extra_1.default.copySync(t,e)}})}else fs_extra_1.default.copySync(a,o),this.copyResourcesToMainBundle(a,e),this.copyUserResourcePathIntoPlugins(n,t,l[n],p[n],path_1.default.join(o,"MiniPlugin.bundle"),r)})}copyUserResourcePathIntoPlugins(e,i,t,n,a,s){const o=a;if(t){const n=path_1.default.basename(t),a=this.getMaterialFilePath(i,t);if(a){s.progress(`${e}.framework 正在拷贝配置的资源:${t}`);const i=fs_extra_1.default.lstatSync(a);fs_extra_1.default.ensureDirSync(o),i.isDirectory()?fs_extra_1.default.copySync(a,o):i.isFile()&&fs_extra_1.default.copyFileSync(a,path_1.default.join(o,n))}}if(n){s.progress(e+".framework 正在写入配置的资源"),fs_extra_1.default.ensureDirSync(o);for(const e in n){const i=n[e],t=path_1.default.join(o,e);fs_extra_1.default.ensureDirSync(o),fs_extra_1.default.ensureFileSync(t),fs_extra_1.default.writeFileSync(t,i)}}}copyResourcesToMainBundle(e,i){const t=path_1.default.join(e,"MiniPlugin.bundle"),n=path_1.default.join(t,"PluginConfig.plist");if(fs_extra_1.default.existsSync(n)){const e=plist.readFileSync(n).CopyResourcesToMainBundle;(null==e?void 0:e.length)&&e.forEach(e=>{const n=path_1.default.join(t,e);fs_extra_1.default.existsSync(n)&&fs_extra_1.default.copySync(n,path_1.default.join(i,e))})}}prepareAppexProfileConfig(e,i,t,n,a,s,o,r){if(!n)return void r.message("doing","miniappCacheDirPath is missing");let l=!1;const p={};if(i["mini-plugin"]&&Array.isArray(i["mini-plugin"].ios)){i["mini-plugin"].ios.forEach(e=>{if(e.open&&e.pluginId&&"object"==typeof e.appexProfiles)for(const i in e.appexProfiles){r.message("doing",`检查插件 ${e.pluginId} ${i} appex 配置中 ...`);const n=e.appexProfiles[i];if(!0===n.enable){const s=`${e.pluginId}_${i}`;p[s]={enable:!0};let o=n.profilePath;if(a&&(o=n.distributeProfilePath),n.bundleID&&o){const a=path_1.default.join(t,o);fs_extra_1.default.existsSync(a)?(p[s].bundleID=n.bundleID,p[s].profilePath=path_1.default.join(t,o)):(l=!0,r.message("error",`${e.pluginId} 中 ${i} 的 profilePath 无法找到对应的文件:${a}(需要在小程序项目路径下,填入相对于项目根目录的路径)`))}else l=!0,r.message("error",`${e.pluginId}中${i} 是 无效的appexProfiles配置。需要配置 bundleID,profilePath,distributeProfilePath。profile 文件需要放置在小程序项目内,然后配置相对于小程序项目根目录的相对路径。分发证书构建的情况下, 一定需要配置distributeProfilePath。查看文档了解详情。`)}}})}if(e.forEach(e=>{fs_extra_1.default.readdirSync(e.dir).forEach(i=>{if(i.endsWith(".appex")){const t=path_1.default.parse(i).name,n=p[t];if(n&&!0===n.enable)if(n.bundleID&&n.profilePath){if(n.bundleID&&n.profilePath){const t=path_1.default.join(e.dir,i,"info.plist"),a=n.bundleID;this.changeInfoplistBundleId(t,a),this.changeInfoplistBundleVersion(t,s,o),r.message("doing",`${e.pluginId} ${i} ${a} ${t} 处理 appex bundle ID 中`)}}else l=!0,r.message("error",`${e.pluginId} 的 多端插件包含了${t.slice(e.pluginId.length+1)} 的 appex。开发者需要在project.miniapp.json 中 mini-plugin 配置下对应合理的 profile 文件。查看文档了解详情。`)}})}),l)return!1;if(!(0,lodash_1.isEmpty)(p)){const e=path_1.default.join(n,APPEX_PROFILES_MAPS_FILE);fs_extra_1.default.existsSync(e)&&fs_extra_1.default.removeSync(e),fs_extra_1.default.ensureFileSync(e);const i={};for(const e in p)i[e]={bundleID:p[e].bundleID,profilePath:p[e].profilePath};fs_extra_1.default.writeFileSync(e,JSON.stringify(i));const t=path_1.default.join(n,APPEX_PROFILES_MAPS_FOR_SHELL_FILE);fs_extra_1.default.existsSync(t)&&fs_extra_1.default.removeSync(t),fs_extra_1.default.ensureFileSync(t);const a=Object.keys(p).map(e=>{const i=p[e];return`pluginAppexName:${e};_;_;bundleID:${i.bundleID};_;_;profile:${i.profilePath}\n\n`}).join("");fs_extra_1.default.writeFileSync(t,a)}return p}changeExtendSDKInfoplistBundleId(e,i,t){const n=`${i}.${path_1.default.parse(t).name.replace(/_/g,"")}`;return this.changeInfoplistBundleId(e,n)}changeInfoplistBundleId(e,i){const t=plist.readFileSync(e);return t.CFBundleIdentifier=i,plist.writeFileSync(e,t),t.CFBundleIdentifier}changeInfoplistBundleVersion(e,i,t){const n=plist.readFileSync(e);return n.CFBundleVersion=i,n.CFBundleShortVersionString=t,plist.writeFileSync(e,n),n.CFBundleIdentifier}async getEntitlements(e,i,t,n){const{mobileapp_info:a={}}=e;let s=a.ios_universal_link||a.debug_ios_universal_link;if((s.startsWith("https://")||s.startsWith("http://"))&&(s=s.replace(/^http(s)?:\/\//g,"applinks:")),Array.isArray(t.__customAssociatedDomains)){const e=t.__customAssociatedDomains.filter(e=>"string"==typeof e&&e.length>0);if(e.length>0){e.splice(0,0,s);return{"com.apple.developer.associated-domains":e.join("_$_ULinK_$_")}}}return{"com.apple.developer.associated-domains":s}}useTpush(e){return(0,miniappJson_1.iOSMiniAppJsonIsUsingTpush)(e)}async buildCloud(e,i){const{projectPath:t,demoIpaPath:n,sdkPath:a,arch:s="arm64",bindingInfo:o,certificateInfo:r,output:l,miniappCacheDirPath:p,pluginDirList:d,inLandun:u,theme:c,i18nInfo:f,debugInfo:_,CILocalBuild:h,cacheAssetCarPath:y}=e,g=this.generateTempDemoIpaPath(n),{selfCertificate:m={}}=r,S=(null==m?void 0:m.isPublish)||!1,I=(0,miniappJson_1.tryGetIOSMiniappJson)(t),v=this.useTpush(I);if((0,lodash_1.isEmpty)(I))throw new Error("获取project.miniapp.json失败");if(errorIOSSdkVersions.includes(I.sdkVersion))throw new Error("当前 mini-ios.sdkVersion 存在缺陷,请参考更新日志进行修改");let x=o;if(r.signType===miniapp_builder_1.miniappSinTypes.appleId.type){const{mobileapp_info:e={}}=x;x=Object.assign(Object.assign({},x),{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 b=await this.updateIOSInfoPlistInfo(t,x,g,I,i,f);await this.updateIOSAppConfigPlistInfo(t,x,g,I,a,!1,i,c,f),await this.updateIOSAppexInfoPlistInfo(x,g,I,b,i),await this.updateIOSIcons(t,g,p,I,S,i,!0===u,y),await this.updateSplashScreen(t,g,I,i,c,f),await this.updateExtendedSdk(x,g,a,s,I,_,i),await this.updatePlugin(g,d,t,I,p,S,b,i),await this.updatePrivacyInfo(g,I,i),await this.updateIOSAppResource(t,g,I,i);const F=await this.getEntitlements(x,g,I,i),{mobileapp_info:P={}}=x;let j;j=r.signType===miniapp_builder_1.miniappSinTypes.appleId.type?miniapp_builder_1.DEFAULT_BUNDLE_ID:P.ios_flag&&P.bundle_id||P.debug_ios_bundle_id;const B={bundleId:j,output:l,entitlements:F,isPublish:m.isPublish};if(I.buildCloud&&(I.buildCloud.certificate&&"string"==typeof I.buildCloud.certificate&&(B.certificate=I.buildCloud.certificate),I.buildCloud.profile&&"string"==typeof I.buildCloud.profile&&(B.profile=path_1.default.join(t,I.buildCloud.profile)),v&&I.buildCloud.tpnsProfile&&"string"==typeof I.buildCloud.tpnsProfile&&(B.tpnsProfile=path_1.default.join(t,I.buildCloud.tpnsProfile))),h&&(B.profile=m.profilePath,B.certificate=m.certificateName),m.isPublish||h){const e=await(0,codesign_1.codesignAndExport)(t,g,p||"",B,i,v,!0===u);if(!0!==e.success)throw new Error("Build ipa failed:"+(e.errMsg||"codesignAndExport failed"))}return{projectPath:t,demoIpaPath:g,opts:B,iosMiniappJson:I,isPublish:S}}async writeI18NInfoFile(e,i,t){Object.keys(i).forEach(n=>{if("base"===n)return;let a="";Object.keys(t).forEach(e=>{var s,o,r,l;"UISplashScreenImageName"!==e?"UILaunchStoryboardName"!==e?(null===(o=null===(s=i[n])||void 0===s?void 0:s.ios)||void 0===o?void 0:o[t[e]])&&(a+=`${e} = "${null===(l=null===(r=i[n])||void 0===r?void 0:r.ios)||void 0===l?void 0:l[t[e]]}";\n`):a+="__UILaunchStoryboardName__\n":a+="__UISplashScreenImageName__\n"}),a&&(fs_extra_1.default.ensureDirSync(path_1.default.join(e,n+".lproj")),fs_extra_1.default.writeFileSync(path_1.default.join(e,n+".lproj/InfoPlist.strings"),a))})}getMaterialFilePath(e,i){if(!i)return"";let t=i;if(path_1.default.isAbsolute(i)||(t=path_1.default.join(e,i)),fs_extra_1.default.existsSync(t))return t;const n=(0,tools_1.generateMD5)(i),a=path_1.default.basename(i),s=path_1.default.join(e,exports.remoteBuildProjectMaterialAbsoluteCacheDir,`${n}_${a}`);return fs_extra_1.default.existsSync(s)?s:""}updateIOSAppResource(e,i,t,n){const a=t.resourcePath;if(!a)return;const s=this.getMaterialFilePath(e,a);if(s){n.progress("正在拷贝资源至主包:"+s);const e=fs_extra_1.default.lstatSync(s);if(e.isDirectory())this.copyDirectory(s,i,!1);else if(e.isFile()){const e=path_1.default.basename(a),t=path_1.default.join(i,e);if(fs_extra_1.default.existsSync(t))throw new Error(`fail to copy ${s}, overwrite is not allowed`);fs_extra_1.default.copyFileSync(s,t)}}}copyDirectory(e,i,t=!0){if(fs_extra_1.default.ensureDirSync(i),t)fs_extra_1.default.copySync(e,i);else{fs_extra_1.default.readdirSync(e).forEach(n=>{const a=path_1.default.join(e,n),s=path_1.default.join(i,n);if(fs_extra_1.default.statSync(a).isDirectory())this.copyDirectory(a,s,t);else{if(fs_extra_1.default.existsSync(s))throw new Error(`fail to copy ${a}, overwrite is not allowed`);fs_extra_1.default.copyFileSync(a,s)}})}}}exports.default=new buildCloudManager;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.remoteBuildProjectMaterialAbsoluteCacheDir=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")),glob_1=tslib_1.__importDefault(require("glob")),env_1=require("../../../utils/env"),miniapp_builder_1=require("../../../utils/miniapp-builder"),codesign_1=require("../../../utils/codesign"),miniappJson_1=require("../../../utils/miniappJson"),lodash_1=require("lodash"),tools_1=require("../../../utils/tools"),uuidv4=require("uuid/v4"),sizeOf=require("image-size"),plist=require("simple-plist"),errorIOSSdkVersions=["1.0.19"],APPEX_PROFILES_MAPS_FILE="__appexProfilesCacheDir__/profilesMap.json",APPEX_PROFILES_MAPS_FOR_SHELL_FILE="__appexProfilesCacheDir__/profilesMapForShell.txt",defaultIconDirPath=path_1.default.join(__dirname,"../../../static/images/"),getDepReg=e=>new RegExp(`s.subspec '${e}'.*\n(?:.*\n)*?(?:.*sp.vendored_frameworks = \\[\n)((?:.*'.*?'.*\n)*?)(?:.*\\]\n)`,"m"),allowTheme=["Light","LightSpecial","Dark","DarkSpecial","Default"];exports.remoteBuildProjectMaterialAbsoluteCacheDir="__absoluteFile";const iconInfoMap={appStore1024:{size:[1024,1024],scale:1,idiom:"ios-marketing",required:!0},appStore1024Other:{size:[1024,1024],scale:1,idiom:"ios-marketing-other"},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"}};class buildCloudManager{generateTempDemoIpaPath(e){const i=path_1.default.join(e,"../.."),t=path_1.default.basename(i),n=path_1.default.dirname(i),a=path_1.default.join(n,t+"-operateDir");fs_extra_1.default.existsSync(a)&&fs_extra_1.default.removeSync(a),fs_extra_1.default.ensureDirSync(a);const s=path_1.default.join(a,"Payload/demo.app");return fs_extra_1.default.copySync(e,s),s}generateInfoPlistCFBundleURLTypesItem(e){const i={};return e.CFBundleURLName&&(i.CFBundleURLName=e.CFBundleURLName),e.CFBundleURLSchemes&&(i.CFBundleURLSchemes=[e.CFBundleURLSchemes]),e.CFBundleTypeRole&&(i.CFBundleTypeRole=e.CFBundleTypeRole),i}updatePrivacyBackgroundImage(e,i,t,n,a){t.message("doing","updatePrivacyBackgroundImage "+n);if(fs_extra_1.default.readdirSync(i).forEach(e=>{"privacy_"+n===path_1.default.basename(e,path_1.default.extname(e))&&fs_extra_1.default.removeSync(path_1.default.join(i,e))}),!a)return;path_1.default.isAbsolute(a)||(a=path_1.default.join(e,a)),a=this.getMaterialFilePath(e,a);const s=path_1.default.extname(a),o=path_1.default.join(i,`privacy_${n}${s}`);try{fs_extra_1.default.copyFileSync(a,o)}catch(e){throw t.message("error",`copy privacy image failed: ${n}, ${a} to ${o}`),e}}async updateIOSInfoPlistInfo(e,i,t,n,a,s){var o,r,l,p,d,c,u,f,_,h,y;a.progress("update app base info...");const{mobileapp_info:g={}}=i,m=g.mobileapp_id,I=path_1.default.join(t,"Info.plist"),S={},v=(e,i)=>{var t,n;if((null==i?void 0:i.startsWith("%"))&&(null==i?void 0:i.endsWith("%"))){const o=i.slice(1,-1);S[e]=o;const r=(null===(n=null===(t=null==s?void 0:s.base)||void 0===t?void 0:t.ios)||void 0===n?void 0:n[o])||"";return r||a.message("error",`未在国际化配置 base.json 中找到字段 ${o},请检查`),r}return i};v("UISplashScreenImageName",null===(o=null==n?void 0:n.splashscreen)||void 0===o?void 0:o.customImage),v("UILaunchStoryboardName",null===(r=null==n?void 0:n.splashscreen)||void 0===r?void 0:r.customImage);const x=plist.readFileSync(I);if("object"==typeof n.customInfoPlist&&!Array.isArray(n.customInfoPlist)){a.progress("initiating user custom info.plist config");const e=n.customInfoPlist;for(const i in e)x[i]=e[i]}if(x.CFBundleName=v("CFBundleName",n.name),x.CFBundleDisplayName=v("CFBundleDisplayName",n.name),x.CFBundleShortVersionString=n.version,"number"==typeof n.versionCode?x.CFBundleVersion=parseInt(n.versionCode.toString(),10).toString():x.CFBundleVersion=(parseInt(x.CFBundleVersion,10)+1).toString(),x.CFBundleIdentifier=this.getBundleIdentifier(g),Array.isArray(null==n?void 0:n.openMimeTypes)&&this.validateCFBundleDocumentTypes(n.openMimeTypes,a)&&(x.CFBundleDocumentTypes=n.openMimeTypes,a.message("doing","openMimeTypes 应用成功")),Array.isArray(x.CFBundleURLTypes)||(x.CFBundleURLTypes=[]),(null===(p=null===(l=x.CFBundleURLTypes)||void 0===l?void 0:l[0])||void 0===p?void 0:p.CFBundleURLSchemes)&&(x.CFBundleURLTypes[0].CFBundleURLSchemes=[m]),x.CFBundleURLTypes[0]&&(x.CFBundleURLTypes=[x.CFBundleURLTypes[0]]),Object.keys(miniappJson_1.iosPrivacyDescObj).forEach(e=>{var i,t;(null===(i=null==n?void 0:n.privateDescriptions)||void 0===i?void 0:i[e])?x[e]=v(e,null===(t=n.privateDescriptions)||void 0===t?void 0:t[e]):delete x[e]}),!0===(null===(d=null==n?void 0:n.infoPlist)||void 0===d?void 0:d.DisableAppUsesNonExemptEncryption)?x.ITSAppUsesNonExemptEncryption=!1:delete x.ITSAppUsesNonExemptEncryption,x.UIBackgroundModes=[],!0===(null===(c=null==n?void 0:n.infoPlist)||void 0===c?void 0:c.AudioInBackgroundMode)&&x.UIBackgroundModes.push("audio"),!0===(null===(u=null==n?void 0:n.infoPlist)||void 0===u?void 0:u.LocationInBackgroundMode)&&x.UIBackgroundModes.push("location"),!0===(null===(f=null==n?void 0:n.infoPlist)||void 0===f?void 0:f.requiresFullScreen)?x.UIRequiresFullScreen=!0:delete x.UIRequiresFullScreen,"object"==typeof(null===(_=null==n?void 0:n.infoPlist)||void 0===_?void 0:_.CFBundleURLTypes)){const e=this.generateInfoPlistCFBundleURLTypesItem(n.infoPlist.CFBundleURLTypes);x.CFBundleURLTypes.push(e);const{additionalCFBundleURLTypes:i}=n.infoPlist.CFBundleURLTypes;Array.isArray(i)&&i.forEach(e=>{if("object"==typeof e){const i=this.generateInfoPlistCFBundleURLTypesItem(e);x.CFBundleURLTypes.push(i)}})}if(null===(h=null==n?void 0:n.useExtendedSdk)||void 0===h?void 0:h.WeAppGoogleLogin){if(!(null==n?void 0:n.googleLoginClientID)||!(null==n?void 0:n.googleLoginBundleUrlType))throw new Error("勾选了 Google Login 拓展模块但未填写 googleLoginClientID 或 googleLoginBundleUrlType 将导致拓展模块无法使用");x.GIDClientID=n.googleLoginClientID,Array.isArray(x.CFBundleURLTypes)?x.CFBundleURLTypes.push({CFBundleURLSchemes:[n.googleLoginBundleUrlType]}):x.CFBundleURLTypes=[{CFBundleURLSchemes:[n.googleLoginBundleUrlType]}]}if(!0===n.enableIpad)if(Array.isArray(n.iPadUISupportedInterfaceOrientations)){const e={Portrait:"UIInterfaceOrientationPortrait",PortraitUpsideDown:"UIInterfaceOrientationPortraitUpsideDown",LandscapeLeft:"UIInterfaceOrientationLandscapeLeft",LandscapeRight:"UIInterfaceOrientationLandscapeRight"},i=n.iPadUISupportedInterfaceOrientations.map(i=>e[i]).filter(e=>!!e);x["UISupportedInterfaceOrientations~ipad"]=i}else(0,miniappJson_1.iOSAppJsonIsUsingIPadResizable)(e)?(x["UISupportedInterfaceOrientations~ipad"]=["UIInterfaceOrientationPortrait","UIInterfaceOrientationPortraitUpsideDown","UIInterfaceOrientationLandscapeLeft","UIInterfaceOrientationLandscapeRight"],a.progress("ipad is support Landscape")):(x["UISupportedInterfaceOrientations~ipad"]=["UIInterfaceOrientationPortrait","UIInterfaceOrientationPortraitUpsideDown"],a.progress("ipad is not support Landscape"));if(null===(y=n.infoPlist)||void 0===y?void 0:y.LSApplicationQueriesSchemes){const e=n.infoPlist.LSApplicationQueriesSchemes.split(",");e.length&&x.LSApplicationQueriesSchemes.push(...e.filter(e=>e))}try{plist.writeFileSync(I,x)}catch(e){throw new Error("write info.plist failed!!"+e.messenge)}return await this.writeI18NInfoFile(t,s,S),x.CFBundleVersion}getBundleIdentifier(e){return e.ios_flag&&e.bundle_id||e.debug_ios_bundle_id}validateCFBundleDocumentTypes(e,i){const t=["Owner","Default"," Alternate","None"],n=["Editor","Viewer"," Shell","None"],a=new Set;for(const s of e){if(a.has(s.CFBundleTypeName))return i.message("error","openMimeTypes 应用失败,存在重复定义的 CFBundleTypeName: "+s.CFBundleTypeName),!1;if(a.add(s.CFBundleTypeName),!t.includes(s.LSHandlerRank))return i.message("error","openMimeTypes 应用失败,存在不合法的 LSHandlerRank: "+s.LSHandlerRank),!1;if(!n.includes(s.CFBundleTypeRole))return i.message("error","openMimeTypes 应用失败,存在不合法的 CFBundleTypeRole: "+s.CFBundleTypeRole),!1;if(!Array.isArray(s.LSItemContentTypes))return i.message("error","openMimeTypes 应用失败,LSItemContentTypes 类型不合法"),!1}return!0}useGDT(e){return(0,miniappJson_1.iOSMiniAppJsonIsUsingGDT)(e)}async updateIOSAppConfigPlistInfo(e,i,t,n,a,s,o,r="Dark",l){var p,d,c,u,f,_,h;o.progress("update app module info...");const{module_info:y={},cpa_info:g={},cpa_package_info:m={enable_remove_watermark:!1}}=i;if(!g.sdk_key||!g.sdk_key_secret)throw new Error("sdkKey and sdkSecret not found");const I=path_1.default.join(t,"MiniApp.bundle"),S=path_1.default.join(I,"AppConfig.plist"),v=plist.readFileSync(S);m.enable_remove_watermark?v.enableRemoveWatermark=!0:v.splashscreenTheme=r,v.miniModuleId=y.module_id,v.sdkKey=g.sdk_key,v.sdkSecret=g.sdk_key_secret;const{privacy:x={}}=n;v.privacy||(v.privacy={}),v.privacy.enable=!!x.enable,v.privacy.enableViewOnly=!!x.enableViewOnly;const b=path_1.default.posix.join(I,"configs/privacy.json"),{contentViewImage:F,cancelButtonImage:P,confirmButtonImage:j,template:B}=x;if(x.enable){let i=B||"";if(fs_extra_1.default.ensureDirSync(path_1.default.posix.join(I,"configs")),i.startsWith("%")&&i.endsWith("%")){const t=B.slice(1,-1);i=(null===(d=null===(p=null==l?void 0:l.base)||void 0===p?void 0:p.ios)||void 0===d?void 0:d[t])||"",i||o.message("error",`未在国际化配置 base.json 中找到字段 ${t},请检查`),Object.keys(l).forEach(i=>{var n,a;if("base"===i)return;let s=null===(a=null===(n=l[i])||void 0===n?void 0:n.ios)||void 0===a?void 0:a[t];if(s){s=this.getMaterialFilePath(e,s);const t=`configs/privacy-${i}.json`,n=path_1.default.posix.join(I,t);fs_extra_1.default.existsSync(s)?fs_extra_1.default.copyFileSync(s,n):o.message("error",`未找到隐私协议在国际化配置 ${i}.json 中配置的文件 ${s},请检查`)}})}i?(i=this.getMaterialFilePath(e,i),fs_extra_1.default.existsSync(i)?(fs_extra_1.default.copyFileSync(i,b),v.privacy.template="configs/privacy.json"):(o.message("error",`未找到隐私协议中配置的文件 ${i},请检查`),v.privacy.template="configs/defaultPrivacy.json")):v.privacy.template="configs/defaultPrivacy.json",!0===x.enableNativePlugin&&"string"==typeof x.nativePluginId&&x.nativePluginId.length>2&&(v.privacy.plugin={pluginId:x.nativePluginId,enable:!0})}else v.privacy.template="",fs_extra_1.default.removeSync(b);this.updatePrivacyBackgroundImage(e,t,o,"contentViewImage",F),this.updatePrivacyBackgroundImage(e,t,o,"confirmButtonImage",j),this.updatePrivacyBackgroundImage(e,t,o,"cancelButtonImage",P);const{appMenuEnable:L=!0}=n;v.appMenuEnable=L;const{enableVConsole:C="undefined"}=n;if(v.enableVConsole=C,null===(c=n.useExtendedSdk)||void 0===c?void 0:c.WeAppLive){const{weAppLiveLicenseUrl:e,weAppLiveLicenseKey:i}=n.liveInfo||{};if(!e||!i)throw new Error("You need to provide the weAppLiveLicenseUrl and weAppLiveLicenseKey when using Live SDK.");v.weAppLiveLicenseUrl=e,v.weAppLiveLicenseKey=i}const{tpush:w}=n;let A=!1;if("object"==typeof w){const e=path_1.default.posix.join(t,"PlugIns/TPNSService.appex"),i=path_1.default.posix.join(e,"AppConfig.plist");if(this.useTpush(n)){v.TPNSAccessID=w.accessID,v.TPNSAccessKey=w.accessKey,w.clusterDomainName?v.clusterDomainName=w.clusterDomainName:delete v.clusterDomainName;const t=s?"x86_64":"arm64",n=path_1.default.join(a,`appex/${t}/TPNSService.appex`);if(!fs_extra_1.default.existsSync(n))throw new Error("can not found extendsdk: "+n);try{fs_extra_1.default.copySync(n,e),plist.writeFileSync(i,v),A=!0}catch(e){throw new Error("copy TPNSService.appex to app failed: "+e)}}}if(!A)try{const e=path_1.default.posix.join(t,"PlugIns");fs_extra_1.default.existsSync(e)?(fs_extra_1.default.removeSync(e),o.progress("removed PlugIns folder...")):o.progress("no PlugIns folder...")}catch(e){throw new Error("remove TPNSService.appex from app failed: "+e)}if(null===(u=n.useExtendedSdk)||void 0===u?void 0:u.WeAppLBS){if(!n.qmapAPIKey)throw new Error("You need to provide the Tencent Location Service API Key when using LBS SDK.");v.qmapAPIKey=n.qmapAPIKey}const{gdt:D}=n,E=this.useGDT(n);if(v.GDTAd=E?{appid:D.appid,enable:!0,SplashAd:{placementId:D.splashAd_placementId,fetchDelay:D.splashAd_fetchDelay||3,defaultEnable:null===(f=D.splashAd_defaultEnable)||void 0===f||f}}:{appid:"",enable:!1,SplashAd:{placementId:"",fetchDelay:3}},n["mini-plugin"]&&Array.isArray(n["mini-plugin"].ios)){const e=n["mini-plugin"].ios,i=e.filter(e=>!!(e.open&&e.pluginId&&e.loadWhenStart)).map(e=>e.pluginId),t=e.map(e=>e.open?{pluginId:e.pluginId,version:e.isFromLocal?"dev":e.pluginVersion}:void 0).filter(e=>e);v.plugins={loadWhenStart:i,pluginInfoList:t}}const{enableDebugLog:$=!1}=n;v.enableDebugLog=$;const{debugLogSizeLimit:U=10}=n;isNaN(Number(U))?o.message("error",`ios debugLogSizeLimit ${U} is NaN`):v.debugLogSizeLimit=Number(U);const{enableOpenUrlNavigate:T=!1}=n;v.enableOpenUrlNavigate=T;const O=path_1.default.posix.join(I,"configs/locales");if(fs_extra_1.default.ensureDirSync(O),null===(h=null===(_=null==l?void 0:l.base)||void 0===_?void 0:_.ios)||void 0===h?void 0:h.LOCALES){const i=this.getMaterialFilePath(e,l.base.ios.LOCALES);fs_extra_1.default.existsSync(i)?(fs_extra_1.default.copyFileSync(i,path_1.default.posix.join(O,"common-base.json")),o.progress("复制基础语言 locales 配置成功")):o.message("error","未找到基础语言 locales 配置文件: "+i)}Object.keys(l).forEach(i=>{var t,n;if("base"===i)return;const a=null===(n=null===(t=l[i])||void 0===t?void 0:t.ios)||void 0===n?void 0:n.LOCALES;if(a){const t=this.getMaterialFilePath(e,a);fs_extra_1.default.existsSync(t)?(fs_extra_1.default.copyFileSync(t,path_1.default.posix.join(O,`common-${i}.json`)),o.progress(`复制 ${i} 语言 locales 配置成功`)):o.message("error",`未找到 ${i} 语言 locales 配置文件: ${t}`)}}),plist.writeFileSync(S,v)}async updateIOSAppexInfoPlistInfo(e,i,t,n,a){if(this.useTpush(t)){a.progress("update appex for notification base info...");const{mobileapp_info:s={}}=e,o=path_1.default.join(i,"PlugIns/TPNSService.appex"),r=path_1.default.join(o,"Info.plist"),l=plist.readFileSync(r);l.CFBundleShortVersionString=t.version,a.progress("update appex for CFBundleVersion: "+n),l.CFBundleVersion=n;const p=s.ios_flag&&s.bundle_id||s.debug_ios_bundle_id;l.CFBundleIdentifier=t.tpush.serviceBundleId||p+".service",a.progress("update appex bundle identifier for infoPlist : "+l.CFBundleIdentifier),plist.writeFileSync(r,l)}else a.progress("not using tpush...")}updateBundleIcons(e,i,t,n,a){const s=[],o=[],r=[];for(const l in t){if(!t[l])continue;const p=this.getMaterialFilePath(e,t[l]);if(!p)return void a.message("error","getMatrialFailed: "+t[l]);const d=iconInfoMap[l];try{const e=sizeOf(p),i=d.size[0]*d.scale,n=d.size[1]*d.scale;if(e.width!==i||e.height!==n){a.progress(`check ${l} size failed, require [${i}, ${n}] but [${e.width}, ${e.height}] ingore ${t[l]} `);continue}}catch(e){a.progress(`get ${l} info failed, ingore ${t[l]}(e: ${e.message})`);continue}const c=path_1.default.extname(p),u=1===d.scale?"":`@${d.scale}x`,f=`${d.size[0]}x${d.size[1]}`,_=l.startsWith("ipad"),h="appStore1024"===l||"appStore1024Other"===l,y="appStore1024Other"===l?n+"Other":n,g=path_1.default.join(i,`${y}${f}${u}${_?"~ipad":""}${c}`),m={from:p,to:g,filename:path_1.default.basename(g),size:f,scale:d.scale+"x",idiom:d.idiom,key:l};s.push(m),h||(_?r.includes(`${y}${f}`)||r.push(`${y}${f}${u}`):o.includes(`${y}${f}`)||o.push(`${y}${f}${u}`))}return{iphoneBundleIconFiles:o,ipadBundleIconFiles:r,addFiles:s}}async updateIOSIcons(e,i,t,n,a,s,o=!1,r=""){s.progress("update app icons...");const{icons:l={}}=n,p=(o||a)&&!!t;s.progress("genAssetCar: "+p);const d=glob_1.default.sync("AppIcon*.+(png|jpg|jpeg|webp)",{nodir:!0,cwd:i}).map(e=>path_1.default.join(i,e)),c="AppIcon-"+uuidv4().slice(0,8),u=this.updateBundleIcons(e,i,l,c,s);if(!u)throw new Error("updateBundleIcons failed");const{iphoneBundleIconFiles:f=[],ipadBundleIconFiles:_=[],addFiles:h=[]}=u,y={};for(const e in iconInfoMap){if(!iconInfoMap[e].required||l[e])continue;const i=iconInfoMap[e].size[0]*iconInfoMap[e].scale,t=iconInfoMap[e].size[1]*iconInfoMap[e].scale;if(y[e]=path_1.default.join(defaultIconDirPath,`donut-icon${i}x${t}.png`),s.progress(`using default app icons when ${e} is not config...`),!fs_extra_1.default.existsSync(y[e]))throw new Error(`required ${e} but not default or set`)}const g=this.updateBundleIcons(e,i,y,c,s);if(!g)throw new Error("updateBundleIcons WithDefaultIcon failed");const{iphoneBundleIconFiles:m,ipadBundleIconFiles:I,addFiles:S}=g;if(f.push(...m),_.push(...I),h.push(...S),!f.length&&!_.length)return;d.forEach(e=>{fs_extra_1.default.existsSync(e)&&fs_extra_1.default.removeSync(e)});const v=path_1.default.join(t,"__assetCarOperateDir/assetsCar/"),x=path_1.default.join(v,`Assets.xcassets/${c}.appiconset/`);p&&(fs_extra_1.default.ensureDirSync(x),fs_extra_1.default.emptyDirSync(x));const b=[];let F=!1;if(h.forEach(e=>{fs_extra_1.default.existsSync(e.to)&&fs_extra_1.default.removeSync(e.to),fs_extra_1.default.copyFileSync(e.from,e.to),p&&(fs_extra_1.default.copySync(e.from,path_1.default.join(x,e.filename)),"ios-marketing-other"===e.idiom&&(F=!0),b.push({filename:e.filename,size:e.size,scale:e.scale,idiom:e.idiom}))}),p&&fs_extra_1.default.writeJsonSync(path_1.default.join(x,"Contents.json"),{images:b,info:{author:"xcode",version:1}},{spaces:"\t"}),p){const e=path_1.default.join(__dirname,"../../../static/scripts/assetsCar/"),t=path_1.default.join(v,"createAssetsCar");fs_extra_1.default.copySync(e,v);try{await(0,codesign_1.checkXcodeEnv)(s),child_process.execSync(`"${t}" ${c}`,{env:(0,env_1.getProcessEnv)()})}catch(e){throw new Error("createAssetsCar failed "+(e.message||""))}const n=path_1.default.join(v,"build/Assets.car"),a=path_1.default.join(i,"Assets.car");fs_extra_1.default.copyFileSync(n,a)}else if(r&&fs_extra_1.default.existsSync(r))s.message("success","命中缓存,正在使用缓存的 AssetCar"),fs_extra_1.default.copyFileSync(r,path_1.default.join(i,"Assets.car"));else{const e=path_1.default.join(i,"Assets.car");fs_extra_1.default.removeSync(e),s.message("warn","更新 App 图标可能不生效,可使用远程构建验证图标设置;工具将会缓存图标构建结果")}const P=path_1.default.join(i,"Info.plist"),j=plist.readFileSync(P);if(!j.CFBundleIcons){const e={CFBundlePrimaryIcon:{}};j.CFBundleIcons=e}F&&(j.CFBundleIcons.CFBundleAlternateIcons={OtherAppStoreIcon:{CFBundleIconFiles:[c+"Other"],CFBundleIconName:"OtherAppStoreIcon"}}),j.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconName=c,j.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles=f,j["CFBundleIcons~ipad"]||(j["CFBundleIcons~ipad"]={CFBundlePrimaryIcon:{}}),j["CFBundleIcons~ipad"].CFBundlePrimaryIcon.CFBundleIconName=c,j["CFBundleIcons~ipad"].CFBundlePrimaryIcon.CFBundleIconFiles=_,j.NSAppTransportSecurity={NSAllowsArbitraryLoads:!0},plist.writeFileSync(P,j)}replaceLaunchScreenImage(e,i,t,n,a,s){const o=path_1.default.join(e,"01J-lp-oVM-view-Ze5-6b-2t3.nib");let r=fs_extra_1.default.readFileSync(o).toString("hex");if(!i.endsWith(".png"))return void n.message("error","IOS 启动页图片配置格式错误,必须为 PNG 格式, 错误配置:"+i);const l=this.getMaterialFilePath(a,i),p=t+".png",d="LaunchScreen-"+uuidv4().slice(0,12),c=d+".png",u=path_1.default.join(s,c);fs_extra_1.default.copyFileSync(l,u);const f=Buffer.from(p,"utf-8").toString("hex"),_=Buffer.from(c,"utf-8").toString("hex");return-1!==r.indexOf(f)?(r=r.replace(f,_),console.log("replace storyboard customImage success")):console.log("replace storyboard customImage fail"),fs_extra_1.default.writeFileSync(o,Buffer.from(r,"hex")),d}async updateSplashScreen(e,i,t,n,a="Dark",s){var o,r,l;let p;n.progress("update splashscreen image..."),allowTheme.includes(a)&&(p=path_1.default.join(i,`/Base.lproj/LaunchScreen${a}.storyboardc`)),p&&fs_extra_1.default.existsSync(p)&&fs_extra_1.default.copySync(p,path_1.default.join(i,"/Base.lproj/LaunchScreen.storyboardc")),allowTheme.forEach(e=>{const t=path_1.default.join(i,`/Base.lproj/LaunchScreen${e}.storyboardc`);fs_extra_1.default.existsSync(t)&&fs_extra_1.default.removeSync(t)});let d=null===(o=null==t?void 0:t.splashscreen)||void 0===o?void 0:o.customImage;if(!d)return;const c=path_1.default.join(i,"Info.plist"),u=plist.readFileSync(c),f=u.UISplashScreenImageName;if(glob_1.default.sync("LaunchScreen-*.+(png|jpg|jpeg|webp)",{nodir:!0,cwd:i}).forEach(e=>{const t=path_1.default.join(i,e);fs_extra_1.default.removeSync(t)}),d.startsWith("%")&&(null==d?void 0:d.endsWith("%"))){const t=d.slice(1,-1),a=(null===(l=null===(r=null==s?void 0:s.base)||void 0===r?void 0:r.ios)||void 0===l?void 0:l[t])||"";if(!a)return void n.message("error",`未在国际化配置 base.json 中找到字段 ${t},请检查,启动页国际化配置失败`);d=a,Object.keys(s).forEach(a=>{var o,r;if("base"===a)return;const l=null===(r=null===(o=s[a])||void 0===o?void 0:o.ios)||void 0===r?void 0:r[t];if(l){const t=path_1.default.join(i,`/${a}.lproj/LaunchScreen_${a}.storyboardc`);fs_extra_1.default.ensureDirSync(path_1.default.join(t,"..")),fs_extra_1.default.copySync(path_1.default.join(i,"/Base.lproj/LaunchScreen.storyboardc"),t);const s=this.replaceLaunchScreenImage(t,this.getMaterialFilePath(e,l),f,n,e,i);n.progress(`update ${a} splashscreen image...`);const o=fs_extra_1.default.readFileSync(path_1.default.join(i,a+".lproj/InfoPlist.strings"),"utf8");let r="";r=s?o.replace("__UISplashScreenImageName__",`UISplashScreenImageName = "${s}";\n`).replace("__UILaunchStoryboardName__",`UILaunchStoryboardName = "LaunchScreen_${a}";\n`):o.replace("__UISplashScreenImageName__","").replace("__UILaunchStoryboardName__",""),fs_extra_1.default.writeFileSync(path_1.default.join(i,a+".lproj/InfoPlist.strings"),r),n.progress(`update ${a} splashscreen image success`)}})}n.progress("update base splashscreen image...");const _=this.replaceLaunchScreenImage(path_1.default.join(i,"/Base.lproj/LaunchScreen.storyboardc"),this.getMaterialFilePath(e,d),f,n,e,i);n.progress("update base splashscreen image success"),_&&(u.UISplashScreenImageName=_,u.UILaunchStoryboardName="LaunchScreen",plist.writeFileSync(c,u))}genUseExtendedSdk(e,i){const t=Object.assign({},e.useExtendedSdk||{});for(const i in e)if("object"==typeof e[i])for(const n in e[i])if(n.startsWith("useExtendedLib_WeApp")&&!0===e[i][n]){t[n.slice("useExtendedLib_".length)]=!0}return!t.WeAppLBS||t.WeAppOpenFuns||t.WeAppOpenFuns_HasPay||(t.WeAppOpenFuns=!0),"RemoteDebug"===(null==i?void 0:i.debugType)&&(t.WeAppUSB=!0),t}async updateExtendedSdk(e,i,t,n,a,s,o){const r=path_1.default.join(i,"Frameworks");fs_extra_1.default.ensureDirSync(r),o.progress("update extendsdk...");const l=path_1.default.join(t,"WeAppSDK.podspec"),p=fs_extra_1.default.readFileSync(l,"utf-8"),d=this.genUseExtendedSdk(a,s);o.progress("useExtendedSdks: "+JSON.stringify(d));const{mobileapp_info:c={}}=e,u=this.getBundleIdentifier(c);if(d.WeAppOpenFuns&&d.WeAppOpenFuns_HasPay)throw new Error("OpenFuncs SDK 只可勾选使用一个,请按需勾选使用");const f={},_=["WeAppUSB"];for(const e in d){if(!d[e])continue;const i=getDepReg(e),a=p.match(i);if(!(null==a?void 0:a[1])){if(_.includes(e))continue;throw new Error(`拓展模块 ${e} 不存在或已被移除,请检查 project.miniapp.json -> 对应平台 -> useExtendedSdk 删除配置 ${e},版本配置差异请参考更新日志或 https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/miniapp/changelog/difflog.html`)}const s=[];if(a[1].split("\n").forEach(e=>{const i=e.match(/.*'(.*?)',/);if(null==i?void 0:i[1]){const e=i[1].split("/").pop(),a=path_1.default.join(t,"Libs",n,e);if(!fs_extra_1.default.existsSync(a)){if(_.includes(e+".framework"))return;throw new Error(`拓展模块 ${e} 不存在或已被移除,请检查 project.miniapp.json -> 对应平台 -> useExtendedSdk 删除配置 ${e},版本配置差异请参考更新日志或 https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/miniapp/changelog/difflog.html`)}const o=path_1.default.join(r,e);fs_extra_1.default.copySync(a,o),s.push(path_1.default.basename(e));const l=path_1.default.join(o,"info.plist");if(!fs_extra_1.default.existsSync(l))throw new Error("can not found extendsdk info.plist: "+e);this.changeExtendSDKInfoplistBundleId(l,u,e)}}),s.length){f[s.shift()]=s}}const h=path_1.default.join(i,"DyFrameworks.plist");fs_extra_1.default.existsSync(h)&&fs_extra_1.default.removeSync(h),plist.writeFileSync(h,f)}async updatePrivacyInfo(e,i,t){var n;const a=null===(n=null==i?void 0:i.privacy)||void 0===n?void 0:n.privacyInfo;a&&(a.endsWith("PrivacyInfo.xcprivacy")?fs_extra_1.default.existsSync(a)?(fs_extra_1.default.copySync(a,path_1.default.join(e,"/PrivacyInfo.xcprivacy")),t.progress("隐私清单文件替换成功")):t.message("error","隐私清单文件替换失败,文件不存在,将使用默认文件"):t.message("error","隐私清单文件替换失败,文件名必须为 PrivacyInfo.xcprivacy,将使用默认文件"))}async updatePlugin(e,i,t,n,a,s,o,r){const l={},p={},d=[];if(n["mini-plugin"]&&Array.isArray(n["mini-plugin"].ios)){n["mini-plugin"].ios.forEach(e=>{e.open&&e.pluginId?("string"==typeof e.resourcePath&&e.resourcePath.length>0&&(l[e.pluginId]=e.resourcePath),"object"==typeof e.resourceObjects&&Object.keys(e.resourceObjects).length>0&&(p[e.pluginId]=e.resourceObjects)):d.push(e.pluginId)})}if(d.length>0&&r.message("warn","下列插件未启用,请确认project.miniapp.json中的配置:"+d.join(", ")),!i.length)return;const c=path_1.default.join(e,"Frameworks"),u=path_1.default.join(e,"PlugIns");fs_extra_1.default.ensureDirSync(c),r.progress("update plugin...");const f=this.prepareAppexProfileConfig(i,n,t,a,s,o,n.version,r);if(!f)throw new Error("依赖的多端插件需要配置对应的profile");i.forEach(i=>{const{pluginId:n}=i,a=i.dir,s=n+".framework",o=path_1.default.join(c,s);if(-1!==a.indexOf("local-miniapp-plugin")){const e=fs_extra_1.default.statSync(a),{mtime:i}=e;r.progress(`${n}.framework 正在使用本地版本,修改时间为 ${i}`)}fs_extra_1.default.existsSync(o)&&fs_extra_1.default.removeSync(o);const d=path_1.default.join(a,s);if(fs_extra_1.default.existsSync(d)){fs_extra_1.default.copySync(d,o),this.copyResourcesToMainBundle(d,e),this.copyUserResourcePathIntoPlugins(n,t,l[n],p[n],path_1.default.join(o,"MiniPlugin.bundle"),r);fs_extra_1.default.readdirSync(a).forEach(i=>{if(i.endsWith(".appex")){const s=path_1.default.parse(i).name,o=f[s],d=path_1.default.join(u,i);if(!o||!0!==o.enable)return;r.progress(`${n} 插件使用 appex 中 : ${i}`),fs_extra_1.default.existsSync(d)&&fs_extra_1.default.removeSync(d),fs_extra_1.default.ensureDirSync(d);const c=path_1.default.join(a,i);fs_extra_1.default.copySync(c,d),(null==o?void 0:o.profilePath)&&fs_extra_1.default.copySync(o.profilePath,path_1.default.join(d,"embedded.mobileprovision")),this.copyResourcesToMainBundle(c,e),this.copyUserResourcePathIntoPlugins(n,t,l[n],p[n],path_1.default.join(d,"MiniPlugin.bundle"),r)}else if(i.endsWith("framework")&&i!==s){const e=path_1.default.join(c,i),t=path_1.default.join(a,i);fs_extra_1.default.existsSync(e)&&fs_extra_1.default.removeSync(e),fs_extra_1.default.copySync(t,e)}})}else fs_extra_1.default.copySync(a,o),this.copyResourcesToMainBundle(a,e),this.copyUserResourcePathIntoPlugins(n,t,l[n],p[n],path_1.default.join(o,"MiniPlugin.bundle"),r)})}copyUserResourcePathIntoPlugins(e,i,t,n,a,s){const o=a;if(t){const n=path_1.default.basename(t),a=this.getMaterialFilePath(i,t);if(a){s.progress(`${e}.framework 正在拷贝配置的资源:${t}`);const i=fs_extra_1.default.lstatSync(a);fs_extra_1.default.ensureDirSync(o),i.isDirectory()?fs_extra_1.default.copySync(a,o):i.isFile()&&fs_extra_1.default.copyFileSync(a,path_1.default.join(o,n))}}if(n){s.progress(e+".framework 正在写入配置的资源"),fs_extra_1.default.ensureDirSync(o);for(const e in n){const i=n[e],t=path_1.default.join(o,e);fs_extra_1.default.ensureDirSync(o),fs_extra_1.default.ensureFileSync(t),fs_extra_1.default.writeFileSync(t,i)}}}copyResourcesToMainBundle(e,i){const t=path_1.default.join(e,"MiniPlugin.bundle"),n=path_1.default.join(t,"PluginConfig.plist");if(fs_extra_1.default.existsSync(n)){const e=plist.readFileSync(n).CopyResourcesToMainBundle;(null==e?void 0:e.length)&&e.forEach(e=>{const n=path_1.default.join(t,e);fs_extra_1.default.existsSync(n)&&fs_extra_1.default.copySync(n,path_1.default.join(i,e))})}}prepareAppexProfileConfig(e,i,t,n,a,s,o,r){if(!n)return void r.message("doing","miniappCacheDirPath is missing");let l=!1;const p={};if(i["mini-plugin"]&&Array.isArray(i["mini-plugin"].ios)){i["mini-plugin"].ios.forEach(e=>{if(e.open&&e.pluginId&&"object"==typeof e.appexProfiles)for(const i in e.appexProfiles){r.message("doing",`检查插件 ${e.pluginId} ${i} appex 配置中 ...`);const n=e.appexProfiles[i];if(!0===n.enable){const s=`${e.pluginId}_${i}`;p[s]={enable:!0};let o=n.profilePath;if(a&&(o=n.distributeProfilePath),n.bundleID&&o){const a=path_1.default.join(t,o);fs_extra_1.default.existsSync(a)?(p[s].bundleID=n.bundleID,p[s].profilePath=path_1.default.join(t,o)):(l=!0,r.message("error",`${e.pluginId} 中 ${i} 的 profilePath 无法找到对应的文件:${a}(需要在小程序项目路径下,填入相对于项目根目录的路径)`))}else l=!0,r.message("error",`${e.pluginId}中${i} 是 无效的appexProfiles配置。需要配置 bundleID,profilePath,distributeProfilePath。profile 文件需要放置在小程序项目内,然后配置相对于小程序项目根目录的相对路径。分发证书构建的情况下, 一定需要配置distributeProfilePath。查看文档了解详情。`)}}})}if(e.forEach(e=>{fs_extra_1.default.readdirSync(e.dir).forEach(i=>{if(i.endsWith(".appex")){const t=path_1.default.parse(i).name,n=p[t];if(n&&!0===n.enable)if(n.bundleID&&n.profilePath){if(n.bundleID&&n.profilePath){const t=path_1.default.join(e.dir,i,"info.plist"),a=n.bundleID;this.changeInfoplistBundleId(t,a),this.changeInfoplistBundleVersion(t,s,o),r.message("doing",`${e.pluginId} ${i} ${a} ${t} 处理 appex bundle ID 中`)}}else l=!0,r.message("error",`${e.pluginId} 的 多端插件包含了${t.slice(e.pluginId.length+1)} 的 appex。开发者需要在project.miniapp.json 中 mini-plugin 配置下对应合理的 profile 文件。查看文档了解详情。`)}})}),l)return!1;if(!(0,lodash_1.isEmpty)(p)){const e=path_1.default.join(n,APPEX_PROFILES_MAPS_FILE);fs_extra_1.default.existsSync(e)&&fs_extra_1.default.removeSync(e),fs_extra_1.default.ensureFileSync(e);const i={};for(const e in p)i[e]={bundleID:p[e].bundleID,profilePath:p[e].profilePath};fs_extra_1.default.writeFileSync(e,JSON.stringify(i));const t=path_1.default.join(n,APPEX_PROFILES_MAPS_FOR_SHELL_FILE);fs_extra_1.default.existsSync(t)&&fs_extra_1.default.removeSync(t),fs_extra_1.default.ensureFileSync(t);const a=Object.keys(p).map(e=>{const i=p[e];return`pluginAppexName:${e};_;_;bundleID:${i.bundleID};_;_;profile:${i.profilePath}\n\n`}).join("");fs_extra_1.default.writeFileSync(t,a)}return p}changeExtendSDKInfoplistBundleId(e,i,t){const n=`${i}.${path_1.default.parse(t).name.replace(/_/g,"")}`;return this.changeInfoplistBundleId(e,n)}changeInfoplistBundleId(e,i){const t=plist.readFileSync(e);return t.CFBundleIdentifier=i,plist.writeFileSync(e,t),t.CFBundleIdentifier}changeInfoplistBundleVersion(e,i,t){const n=plist.readFileSync(e);return n.CFBundleVersion=i,n.CFBundleShortVersionString=t,plist.writeFileSync(e,n),n.CFBundleIdentifier}async getEntitlements(e,i,t,n){const{mobileapp_info:a={}}=e;let s=a.ios_universal_link||a.debug_ios_universal_link;if((s.startsWith("https://")||s.startsWith("http://"))&&(s=s.replace(/^http(s)?:\/\//g,"applinks:")),Array.isArray(t.__customAssociatedDomains)){const e=t.__customAssociatedDomains.filter(e=>"string"==typeof e&&e.length>0);if(e.length>0){e.splice(0,0,s);return{"com.apple.developer.associated-domains":e.join("_$_ULinK_$_")}}}return{"com.apple.developer.associated-domains":s}}useTpush(e){return(0,miniappJson_1.iOSMiniAppJsonIsUsingTpush)(e)}async buildCloud(e,i){const{projectPath:t,demoIpaPath:n,sdkPath:a,arch:s="arm64",bindingInfo:o,certificateInfo:r,output:l,miniappCacheDirPath:p,pluginDirList:d,inLandun:c,theme:u,i18nInfo:f,debugInfo:_,CILocalBuild:h,cacheAssetCarPath:y}=e,g=this.generateTempDemoIpaPath(n),{selfCertificate:m={}}=r,I=(null==m?void 0:m.isPublish)||!1,S=(0,miniappJson_1.tryGetIOSMiniappJson)(t),v=this.useTpush(S);if((0,lodash_1.isEmpty)(S))throw new Error("获取project.miniapp.json失败");if(errorIOSSdkVersions.includes(S.sdkVersion))throw new Error("当前 mini-ios.sdkVersion 存在缺陷,请参考更新日志进行修改");let x=o;if(r.signType===miniapp_builder_1.miniappSinTypes.appleId.type){const{mobileapp_info:e={}}=x;x=Object.assign(Object.assign({},x),{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 b=await this.updateIOSInfoPlistInfo(t,x,g,S,i,f);await this.updateIOSAppConfigPlistInfo(t,x,g,S,a,!1,i,u,f),await this.updateIOSAppexInfoPlistInfo(x,g,S,b,i),await this.updateIOSIcons(t,g,p,S,I,i,!0===c,y),await this.updateSplashScreen(t,g,S,i,u,f),await this.updateExtendedSdk(x,g,a,s,S,_,i),await this.updatePlugin(g,d,t,S,p,I,b,i),await this.updatePrivacyInfo(g,S,i),await this.updateIOSAppResource(t,g,S,i);const F=await this.getEntitlements(x,g,S,i),{mobileapp_info:P={}}=x;let j;j=r.signType===miniapp_builder_1.miniappSinTypes.appleId.type?miniapp_builder_1.DEFAULT_BUNDLE_ID:P.ios_flag&&P.bundle_id||P.debug_ios_bundle_id;const B={bundleId:j,output:l,entitlements:F,isPublish:m.isPublish};if(S.buildCloud&&(S.buildCloud.certificate&&"string"==typeof S.buildCloud.certificate&&(B.certificate=S.buildCloud.certificate),S.buildCloud.profile&&"string"==typeof S.buildCloud.profile&&(B.profile=path_1.default.join(t,S.buildCloud.profile)),v&&S.buildCloud.tpnsProfile&&"string"==typeof S.buildCloud.tpnsProfile&&(B.tpnsProfile=path_1.default.join(t,S.buildCloud.tpnsProfile))),h&&(B.profile=m.profilePath,B.certificate=m.certificateName),m.isPublish||h){const e=await(0,codesign_1.codesignAndExport)(t,g,p||"",B,i,v,!0===c);if(!0!==e.success)throw new Error("Build ipa failed:"+(e.errMsg||"codesignAndExport failed"))}return{projectPath:t,demoIpaPath:g,opts:B,iosMiniappJson:S,isPublish:I}}async writeI18NInfoFile(e,i,t){Object.keys(i).forEach(n=>{if("base"===n)return;let a="";Object.keys(t).forEach(e=>{var s,o,r,l;"UISplashScreenImageName"!==e?"UILaunchStoryboardName"!==e?(null===(o=null===(s=i[n])||void 0===s?void 0:s.ios)||void 0===o?void 0:o[t[e]])&&(a+=`${e} = "${null===(l=null===(r=i[n])||void 0===r?void 0:r.ios)||void 0===l?void 0:l[t[e]]}";\n`):a+="__UILaunchStoryboardName__\n":a+="__UISplashScreenImageName__\n"}),a&&(fs_extra_1.default.ensureDirSync(path_1.default.join(e,n+".lproj")),fs_extra_1.default.writeFileSync(path_1.default.join(e,n+".lproj/InfoPlist.strings"),a))})}getMaterialFilePath(e,i){if(!i)return"";let t=i;if(path_1.default.isAbsolute(i)||(t=path_1.default.join(e,i)),fs_extra_1.default.existsSync(t))return t;const n=(0,tools_1.generateMD5)(i),a=path_1.default.basename(i),s=path_1.default.join(e,exports.remoteBuildProjectMaterialAbsoluteCacheDir,`${n}_${a}`);return fs_extra_1.default.existsSync(s)?s:""}updateIOSAppResource(e,i,t,n){const a=t.resourcePath;if(!a)return;const s=this.getMaterialFilePath(e,a);if(s){n.progress("正在拷贝资源至主包:"+s);const e=fs_extra_1.default.lstatSync(s);if(e.isDirectory())this.copyDirectory(s,i,!1);else if(e.isFile()){const e=path_1.default.basename(a),t=path_1.default.join(i,e);if(fs_extra_1.default.existsSync(t))throw new Error(`fail to copy ${s}, overwrite is not allowed`);fs_extra_1.default.copyFileSync(s,t)}}}copyDirectory(e,i,t=!0){if(fs_extra_1.default.ensureDirSync(i),t)fs_extra_1.default.copySync(e,i);else{fs_extra_1.default.readdirSync(e).forEach(n=>{const a=path_1.default.join(e,n),s=path_1.default.join(i,n);if(fs_extra_1.default.statSync(a).isDirectory())this.copyDirectory(a,s,t);else{if(fs_extra_1.default.existsSync(s))throw new Error(`fail to copy ${a}, overwrite is not allowed`);fs_extra_1.default.copyFileSync(a,s)}})}}}exports.default=new buildCloudManager;
@@ -97,6 +97,35 @@ module.exports = {
97
97
  "$ref": "#/definitions/ISubPackageItem"
98
98
  }
99
99
  },
100
+ "chatTools": {
101
+ "type": "array",
102
+ "items": {
103
+ "type": "object",
104
+ "properties": {
105
+ "root": {
106
+ "type": "string"
107
+ },
108
+ "entryPagePath": {
109
+ "type": "string"
110
+ },
111
+ "desc": {
112
+ "type": "string"
113
+ },
114
+ "scopes": {
115
+ "type": "array",
116
+ "items": {
117
+ "type": "string"
118
+ }
119
+ }
120
+ },
121
+ "additionalProperties": false,
122
+ "required": [
123
+ "desc",
124
+ "entryPagePath",
125
+ "root"
126
+ ]
127
+ }
128
+ },
100
129
  "preloadRule": {
101
130
  "type": "object",
102
131
  "additionalProperties": {
@@ -312,12 +341,6 @@ module.exports = {
312
341
  }
313
342
  ]
314
343
  },
315
- "supportedMaterials": {
316
- "type": "array",
317
- "items": {
318
- "$ref": "#/definitions/ISupportMaterial"
319
- }
320
- },
321
344
  "requireBackgroundModes": {
322
345
  "type": "array",
323
346
  "items": {
@@ -569,6 +592,35 @@ module.exports = {
569
592
  "$ref": "#/definitions/ISubPackageItem"
570
593
  }
571
594
  },
595
+ "chatTools": {
596
+ "type": "array",
597
+ "items": {
598
+ "type": "object",
599
+ "properties": {
600
+ "root": {
601
+ "type": "string"
602
+ },
603
+ "entryPagePath": {
604
+ "type": "string"
605
+ },
606
+ "desc": {
607
+ "type": "string"
608
+ },
609
+ "scopes": {
610
+ "type": "array",
611
+ "items": {
612
+ "type": "string"
613
+ }
614
+ }
615
+ },
616
+ "additionalProperties": false,
617
+ "required": [
618
+ "desc",
619
+ "entryPagePath",
620
+ "root"
621
+ ]
622
+ }
623
+ },
572
624
  "preloadRule": {
573
625
  "type": "object",
574
626
  "additionalProperties": {
@@ -784,12 +836,6 @@ module.exports = {
784
836
  }
785
837
  ]
786
838
  },
787
- "supportedMaterials": {
788
- "type": "array",
789
- "items": {
790
- "$ref": "#/definitions/ISupportMaterial"
791
- }
792
- },
793
839
  "requireBackgroundModes": {
794
840
  "type": "array",
795
841
  "items": {
@@ -1041,6 +1087,35 @@ module.exports = {
1041
1087
  "$ref": "#/definitions/ISubPackageItem"
1042
1088
  }
1043
1089
  },
1090
+ "chatTools": {
1091
+ "type": "array",
1092
+ "items": {
1093
+ "type": "object",
1094
+ "properties": {
1095
+ "root": {
1096
+ "type": "string"
1097
+ },
1098
+ "entryPagePath": {
1099
+ "type": "string"
1100
+ },
1101
+ "desc": {
1102
+ "type": "string"
1103
+ },
1104
+ "scopes": {
1105
+ "type": "array",
1106
+ "items": {
1107
+ "type": "string"
1108
+ }
1109
+ }
1110
+ },
1111
+ "additionalProperties": false,
1112
+ "required": [
1113
+ "desc",
1114
+ "entryPagePath",
1115
+ "root"
1116
+ ]
1117
+ }
1118
+ },
1044
1119
  "preloadRule": {
1045
1120
  "type": "object",
1046
1121
  "additionalProperties": {
@@ -1256,12 +1331,6 @@ module.exports = {
1256
1331
  }
1257
1332
  ]
1258
1333
  },
1259
- "supportedMaterials": {
1260
- "type": "array",
1261
- "items": {
1262
- "$ref": "#/definitions/ISupportMaterial"
1263
- }
1264
- },
1265
1334
  "requireBackgroundModes": {
1266
1335
  "type": "array",
1267
1336
  "items": {
@@ -1509,6 +1578,35 @@ module.exports = {
1509
1578
  "$ref": "#/definitions/ISubPackageItem"
1510
1579
  }
1511
1580
  },
1581
+ "chatTools": {
1582
+ "type": "array",
1583
+ "items": {
1584
+ "type": "object",
1585
+ "properties": {
1586
+ "root": {
1587
+ "type": "string"
1588
+ },
1589
+ "entryPagePath": {
1590
+ "type": "string"
1591
+ },
1592
+ "desc": {
1593
+ "type": "string"
1594
+ },
1595
+ "scopes": {
1596
+ "type": "array",
1597
+ "items": {
1598
+ "type": "string"
1599
+ }
1600
+ }
1601
+ },
1602
+ "additionalProperties": false,
1603
+ "required": [
1604
+ "desc",
1605
+ "entryPagePath",
1606
+ "root"
1607
+ ]
1608
+ }
1609
+ },
1512
1610
  "preloadRule": {
1513
1611
  "type": "object",
1514
1612
  "additionalProperties": {
@@ -1724,12 +1822,6 @@ module.exports = {
1724
1822
  }
1725
1823
  ]
1726
1824
  },
1727
- "supportedMaterials": {
1728
- "type": "array",
1729
- "items": {
1730
- "$ref": "#/definitions/ISupportMaterial"
1731
- }
1732
- },
1733
1825
  "requireBackgroundModes": {
1734
1826
  "type": "array",
1735
1827
  "items": {
@@ -2194,32 +2286,8 @@ module.exports = {
2194
2286
  }
2195
2287
  },
2196
2288
  "additionalProperties": false
2197
- },
2198
- "ISupportMaterial": {
2199
- "type": "object",
2200
- "properties": {
2201
- "materialType": {
2202
- "type": "string"
2203
- },
2204
- "name": {
2205
- "type": "string"
2206
- },
2207
- "desc": {
2208
- "type": "string"
2209
- },
2210
- "path": {
2211
- "type": "string"
2212
- }
2213
- },
2214
- "additionalProperties": false,
2215
- "required": [
2216
- "desc",
2217
- "materialType",
2218
- "name",
2219
- "path"
2220
- ]
2221
2289
  }
2222
2290
  },
2223
2291
  "$schema": "http://json-schema.org/draft-07/schema#",
2224
- "$version": 1732792700523
2292
+ "$version": 1734338530629
2225
2293
  }
@@ -254,12 +254,6 @@ module.exports = {
254
254
  }
255
255
  ]
256
256
  },
257
- "supportedMaterials": {
258
- "type": "array",
259
- "items": {
260
- "$ref": "#/definitions/ISupportMaterial"
261
- }
262
- },
263
257
  "lazyCodeLoading": {
264
258
  "const": "requiredComponents",
265
259
  "type": "string"
@@ -1063,32 +1057,8 @@ module.exports = {
1063
1057
  "required": [
1064
1058
  "list"
1065
1059
  ]
1066
- },
1067
- "ISupportMaterial": {
1068
- "type": "object",
1069
- "properties": {
1070
- "materialType": {
1071
- "type": "string"
1072
- },
1073
- "name": {
1074
- "type": "string"
1075
- },
1076
- "desc": {
1077
- "type": "string"
1078
- },
1079
- "path": {
1080
- "type": "string"
1081
- }
1082
- },
1083
- "additionalProperties": false,
1084
- "required": [
1085
- "desc",
1086
- "materialType",
1087
- "name",
1088
- "path"
1089
- ]
1090
1060
  }
1091
1061
  },
1092
1062
  "$schema": "http://json-schema.org/draft-07/schema#",
1093
- "$version": 1724989414780
1063
+ "$version": 1734338530625
1094
1064
  }
@@ -207,5 +207,5 @@ module.exports = {
207
207
  }
208
208
  },
209
209
  "$schema": "http://json-schema.org/draft-07/schema#",
210
- "$version": 1724989414780
210
+ "$version": 1725009241204
211
211
  }
@@ -514,5 +514,5 @@ module.exports = {
514
514
  }
515
515
  },
516
516
  "$schema": "http://json-schema.org/draft-07/schema#",
517
- "$version": 1724989414780
517
+ "$version": 1725009241204
518
518
  }
@@ -49,5 +49,5 @@ module.exports = {
49
49
  },
50
50
  "additionalProperties": false,
51
51
  "$schema": "http://json-schema.org/draft-07/schema#",
52
- "$version": 1724989414780
52
+ "$version": 1725009241204
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": 1724989414780
13
+ "$version": 1725009241204
14
14
  }
@@ -690,5 +690,5 @@ module.exports = {
690
690
  }
691
691
  },
692
692
  "$schema": "http://json-schema.org/draft-07/schema#",
693
- "$version": 1724989414780
693
+ "$version": 1725009241204
694
694
  }
@@ -370,5 +370,5 @@ module.exports = {
370
370
  }
371
371
  },
372
372
  "$schema": "http://json-schema.org/draft-07/schema#",
373
- "$version": 1724989414781
373
+ "$version": 1725009241204
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": 1724989414781
52
+ "$version": 1725009241205
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": 1724989414781
19
+ "$version": 1725009241205
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miniprogram-ci",
3
- "version": "2.1.12",
3
+ "version": "2.1.14",
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",
@@ -24,7 +24,7 @@
24
24
  "jest": "jest",
25
25
  "report": "nyc --reporter=html npm run mocha && npm run jest",
26
26
  "mocha": "mocha --reporter mochawesome --exit --timeout 5000 || true",
27
- "build-json-schema": "node ./schema/task/build.js && gulp copy-schema",
27
+ "build-json-schema": "node ./src/schema/task/build.js && gulp copy-schema",
28
28
  "eslint": "eslint --ext .ts,.tsx,.js,.jsx ./src",
29
29
  "mochawin": "mocha --reporter mochawesome --reporter-options reportFilename=result_win --exit || exit /b 0",
30
30
  "mochamac": "mocha --reporter mochawesome --reporter-options reportFilename=result_mac --exit || true",
@@ -269,6 +269,7 @@
269
269
  "string-hash-64": "1.0.3",
270
270
  "terminal-kit": "^2.4.0",
271
271
  "terser": "4.8.0",
272
+ "tmp": "0.0.28",
272
273
  "tslib": "^2.4.0",
273
274
  "uglify-js": "3.0.27",
274
275
  "uuid": "^3.1.0",