miniprogram-ci 2.0.3 → 2.0.4
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.
- package/CHANGELOG.md +2 -0
- package/README.md +2 -0
- package/dist/@types/config/config.d.ts +1 -1
- package/dist/@types/modules/corecompiler/baseCompiler.d.ts +1 -1
- package/dist/@types/modules/corecompiler/originalCompiler.d.ts +1 -1
- package/dist/ci/getCompiledResult.js +1 -1
- package/dist/ci/upload.js +1 -1
- package/dist/config/config.js +1 -1
- package/dist/modules/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCompiledResult=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),fs_extra_1=tslib_1.__importDefault(require("fs-extra")),config_1=require("../config/config"),error_1=require("../utils/error"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),cache_1=require("../utils/cache"),jszip_1=tslib_1.__importDefault(require("jszip")),path_1=tslib_1.__importDefault(require("path")),filterUnusedFile_1=require("./utils/filterUnusedFile"),getcompiler_1=require("./getcompiler"),tools_1=require("./utils/tools");async function getCompiledResult(e,t){const{test:r,project:i,setting:o={},onProgressUpdate:s=function(e){console.log(""+e)},threads:l=0,includedMap:a=!1,allowIgnoreUnusedFiles:n=!0}=e;if(process.env.COMPILE_THREADS=l.toString(),!i)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","project"),config_1.PARAM_ERROR);cache_1.cacheManager.clean();const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCompiledResult=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),fs_extra_1=tslib_1.__importDefault(require("fs-extra")),config_1=require("../config/config"),error_1=require("../utils/error"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),cache_1=require("../utils/cache"),jszip_1=tslib_1.__importDefault(require("jszip")),path_1=tslib_1.__importDefault(require("path")),filterUnusedFile_1=require("./utils/filterUnusedFile"),getcompiler_1=require("./getcompiler"),tools_1=require("./utils/tools");async function getCompiledResult(e,t){const{test:r,project:i,setting:o={},onProgressUpdate:s=function(e){console.log(""+e)},threads:l=0,includedMap:a=!1,allowIgnoreUnusedFiles:n=!0}=e;if(process.env.COMPILE_THREADS=l.toString(),!i)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","project"),config_1.PARAM_ERROR);cache_1.cacheManager.clean();const u=await(0,getcompiler_1.getCompiler)(i,o);let _=await u.compile({setting:(0,tools_1.formatCISetting)(i,o),onProgressUpdate:s,resultType:"prod"});!1!==n&&(_=await(0,filterUnusedFile_1.filterUnusedFile)(!!r,i,_));const c={};if(Object.keys(_).sort().forEach(e=>{e.endsWith("js.map")&&!a||(c[e]=_[e])}),t){const e=new jszip_1.default;Object.keys(c).forEach(t=>{e.folder(path_1.default.dirname(t)).file(path_1.default.basename(t),c[t])});const r=await e.generateAsync({type:"nodebuffer"});fs_extra_1.default.ensureDirSync(path_1.default.dirname(t)),fs_extra_1.default.writeFileSync(t,r)}return c}exports.SIGNATURE_FILE_NAME="ci.signature",exports.getCompiledResult=getCompiledResult;
|
package/dist/ci/upload.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.innerUpload=exports.upload=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),log=tslib_1.__importStar(require("../utils/log")),request_1=require("../utils/request"),pack_1=require("./utils/pack"),zlib_1=tslib_1.__importDefault(require("zlib")),sign_1=require("../utils/sign"),tools_1=require("../utils/tools"),config_1=require("../config/config"),taskstatus_1=require("../utils/taskstatus"),error_1=require("../utils/error"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),querystring_1=tslib_1.__importDefault(require("querystring")),url_config_1=require("../config/url.config"),jsonParse_1=require("../utils/jsonParse"),cache_1=require("../utils/cache"),cos_upload_1=require("./cos-upload"),filterUnusedFile_1=require("./utils/filterUnusedFile"),getcompiler_1=require("./getcompiler"),tools_2=require("./utils/tools");exports.SIGNATURE_FILE_NAME="ci.signature";const MIN_COS_UPLOAD_SIZE=5242880;async function upload(e){var o;const t=await innerUpload(e);return(null===(o=t.respBody)||void 0===o?void 0:o.dev_plugin_id)&&(log.log("Development Version Plugin ID: "+t.respBody.dev_plugin_id),t.devPluginId=t.respBody.dev_plugin_id),{subPackageInfo:t.subPackageInfo,pluginInfo:t.pluginInfo,devPluginId:t.devPluginId}}async function innerUpload(e){const{project:o,setting:t={useProjectConfig:!1},desc:r=`robot ${e.robot||"1"} use miniprogram-ci to upload at ${(0,tools_1.formatTime)(new Date)}`,version:i="",robot:s="1",onProgressUpdate:n=function(e){console.log(""+e)},test:a,pagePath:l,searchQuery:u,threads:p=0,bigPackageSizeSupport:c,allowIgnoreUnusedFiles:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.innerUpload=exports.upload=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),log=tslib_1.__importStar(require("../utils/log")),request_1=require("../utils/request"),pack_1=require("./utils/pack"),zlib_1=tslib_1.__importDefault(require("zlib")),sign_1=require("../utils/sign"),tools_1=require("../utils/tools"),config_1=require("../config/config"),taskstatus_1=require("../utils/taskstatus"),error_1=require("../utils/error"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),querystring_1=tslib_1.__importDefault(require("querystring")),url_config_1=require("../config/url.config"),jsonParse_1=require("../utils/jsonParse"),cache_1=require("../utils/cache"),cos_upload_1=require("./cos-upload"),filterUnusedFile_1=require("./utils/filterUnusedFile"),getcompiler_1=require("./getcompiler"),tools_2=require("./utils/tools");exports.SIGNATURE_FILE_NAME="ci.signature";const MIN_COS_UPLOAD_SIZE=5242880;async function upload(e){var o;const t=await innerUpload(e);return(null===(o=t.respBody)||void 0===o?void 0:o.dev_plugin_id)&&(log.log("Development Version Plugin ID: "+t.respBody.dev_plugin_id),t.devPluginId=t.respBody.dev_plugin_id),{subPackageInfo:t.subPackageInfo,pluginInfo:t.pluginInfo,devPluginId:t.devPluginId}}async function innerUpload(e){const{project:o,setting:t={useProjectConfig:!1},desc:r=`robot ${e.robot||"1"} use miniprogram-ci to upload at ${(0,tools_1.formatTime)(new Date)}`,version:i="",robot:s="1",onProgressUpdate:n=function(e){console.log(""+e)},test:a,pagePath:l,searchQuery:u,threads:p=0,bigPackageSizeSupport:c,allowIgnoreUnusedFiles:d=!0}=e;let{useCOS:_}=e;if(process.env.COMPILE_THREADS=p.toString(),!i)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","version"),config_1.PARAM_ERROR);if(!o)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","project"),config_1.PARAM_ERROR);cache_1.cacheManager.clean();const g=await(0,getcompiler_1.getCompiler)(o,t),f=(0,tools_2.formatCISetting)(o,t);let b=await g.compile({setting:f,onProgressUpdate:n,resultType:"prod"});!1!==d&&(b=await(0,filterUnusedFile_1.filterUnusedFile)(!!a,o,b));const y=config_1.CI_VERSION,S={codeprotect:t.codeProtect?1:0,type:o.type,appid:o.appid,version:i,desc:r,robot:s},q={scene:e.scene||1011};let P;l&&(q.path=l,S.path=l),u&&(q.query=querystring_1.default.parse(u)),S.debugLaunchInfo=JSON.stringify(q),l&&u&&(S.path+="?"+u),a&&c&&(S.bigPackageSizeSupport=1);let R={};try{P=await o.getFile(o.miniprogramRoot,"ext.json"),R=JSON.parse(P.toString("utf-8"))}catch(e){}if(R&&(R.extEnable&&(S.extAppId=R.extAppid),R.directCommit)){let e="";e=R.extEnable?"The code will be uploaded into the waiting list of extAppid.":"The code will be uploaded into the draft box of the third-party platform.",log.warn(e)}try{const e=new taskstatus_1.TaskStatus(locales_1.default.config.UPLOAD.toString());n(e);const t=`${a?url_config_1.TEST_SOURCE_URL:url_config_1.UPLOAD_URL}?${querystring_1.default.stringify(S)}`;let r,i=!1,l=0;const u=(0,pack_1.pack)(b),p=zlib_1.default.gzipSync(u.buffer);if(log.info("useCOS parameter: ",_),log.info("upload zip buffer size: ",p.length),void 0===_&&(_=p.length>5242880),_){log.info("upload by COS: ",_);const e=await(0,cos_upload_1.uploadByCos)(p,t,o,s);e.fallback?(i=e.fallback,log.info("upload by COS failed, fallback to http way")):(r={body:e.body},l=e.uploadCOSCostTime)}if(!_||i){const e=await(0,sign_1.getSignature)(o.privateKey,o.appid);b[exports.SIGNATURE_FILE_NAME]=JSON.stringify({signature:e,version:y});const i=(0,pack_1.pack)(b),s=zlib_1.default.gzipSync(i.buffer);log.info("request url:",t);const n=(await(0,request_1.request)({url:t,method:"post",body:s})).body.toString();if(r=(0,jsonParse_1.jsonRespParse)(n,t),0!==r.errCode)throw new Error(n)}e.done(),n(e);const c={respBody:r.body};if(Array.isArray(r.body.subpackage_info)){const e=r.body.subpackage_info;c.subPackageInfo=e}if(Array.isArray(r.body.ext_plugin_info)){const e=r.body.ext_plugin_info;c.pluginInfo=e.map(e=>({pluginProviderAppid:e.provider,version:e.version,size:e.size}))}return c}catch(e){throw new error_1.CodeError(e.toString(),config_1.UPLOAD_CGI_ERR)}}exports.upload=upload,exports.innerUpload=innerUpload;
|
package/dist/config/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var COMPILE_TYPE,AstType;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.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.0.
|
|
1
|
+
"use strict";var COMPILE_TYPE,AstType;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.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.0.4",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={}));
|
package/dist/modules/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Builder=void 0;const index_1=require("./precompiler/index"),nativecompiler_1=require("./nativecompiler"),originalCompiler_1=require("./corecompiler/originalCompiler"),createSummer_1=require("./createSummer"),singletontask_1=require("../utils/singletontask"),tools_1=require("../utils/tools");class Builder{constructor(e,i){this.originProject=e,this._options=i}async getCompiler(){if((0,tools_1.checkIsUseCompilerPlugins)(this.originProject))return this.getSummerCompiler();if(!this._originalCompiler){const e=await this.getPreCompileProject();this._originalCompiler=new originalCompiler_1.OriginalCompiler(e),await this._originalCompiler.ready()}return this._originalCompiler}async getPreCompileProject(){if(!this._precompileProject){const{targetPlatform:e,targetPlatformDefines:i}=this._options,t=await this.getPreCompiler();this._precompileProject=await t.getPreCompileProject({targetPlatform:e,targetPlatformDefines:i,runEnv:"main process"}),await this._precompileProject.ready()}return this._precompileProject}async getPreCompiler(){if(!this._preCompiler){const{devtoolMessagehub:e}=this._options;this._preCompiler=new index_1.PreCompiler(this.originProject,e)}return this._preCompiler}async getSummerCompiler(){if(!this._summerCompiler){const{summerCompilerClass:e,projectInfo:i,cachePath:t="",devtoolMessagehub:r}=this._options,o=await this.getPreCompileProject();e?(this._summerCompiler=new e(o,t,i,r),await this._summerCompiler.ready()):this._summerCompiler=await(0,createSummer_1.getSummerCompiler)(o)}return this._summerCompiler}async ready(){return this._checkReadyTask||(this._checkReadyTask=new singletontask_1.SingletonTask(this.init.bind(this,this._options))),await this._checkReadyTask.getResult()}async init(){}async getNativeCompiler(){return this._nativeCompiler||await this.initNativeCompiler(this._options),this._nativeCompiler}async initNativeCompiler(e){if("multiPlatform"!==this.originProject.projectArchitecture)return;const{miniappDirPath:i,devtoolsVersion:t,devtoolMessagehub:r}=e;this._nativeCompiler=new nativecompiler_1.NativeCompiler({project:this._precompileProject,devtoolMessagehub:r,devtoolsVersion:t,miniappDirPath:i}),await this._nativeCompiler.ready()}getPreCompileOptions(){var e,i;return{targetPlatform:null===(e=this._precompileProject)||void 0===e?void 0:e.targetPlatform,targetPlatformDefines:null===(i=this._precompileProject)||void 0===i?void 0:i.targetPlatformDefines}}async changePreCompileOptions(e){var i;(null===(i=this._precompileProject)||void 0===i?void 0:i.targetPlatform)!==e.targetPlatform&&(this._precompileProject.updateConditionCompileOptions(e),await new Promise(e=>setTimeout(e,500)))}async setLocale(e){(await this.getSummerCompiler()).setLocale(e)}destroy(){var e,i;(null===(e=this._summerCompiler)||void 0===e?void 0:e.isSummer)&&this._summerCompiler.destroy(),null===(i=this._nativeCompiler)||void 0===i||i.destroy()}}exports.Builder=Builder;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Builder=void 0;const index_1=require("./precompiler/index"),nativecompiler_1=require("./nativecompiler"),originalCompiler_1=require("./corecompiler/originalCompiler"),createSummer_1=require("./createSummer"),singletontask_1=require("../utils/singletontask"),tools_1=require("../utils/tools");class Builder{constructor(e,i){this.originProject=e,this._options=i}async getCompiler(){if((0,tools_1.checkIsUseCompilerPlugins)(this.originProject))return this.getSummerCompiler();if(!this._originalCompiler){const e=await this.getPreCompileProject();this._originalCompiler=new originalCompiler_1.OriginalCompiler(e),await this._originalCompiler.ready()}return this._originalCompiler}async getPreCompileProject(){if(!this._precompileProject){const{targetPlatform:e,targetPlatformDefines:i}=this._options,t=await this.getPreCompiler();this._precompileProject=await t.getPreCompileProject({targetPlatform:e,targetPlatformDefines:i,runEnv:"main process"}),await this._precompileProject.ready()}return this._precompileProject}async getPreCompiler(){if(!this._preCompiler){const{devtoolMessagehub:e}=this._options;this._preCompiler=new index_1.PreCompiler(this.originProject,e)}return this._preCompiler}async getSummerCompiler(){if(!this._summerCompiler){const{summerCompilerClass:e,projectInfo:i,cachePath:t="",devtoolMessagehub:r}=this._options,o=await this.getPreCompileProject();e?(this._summerCompiler=new e(o,t,i,r),await this._summerCompiler.ready()):this._summerCompiler=await(0,createSummer_1.getSummerCompiler)(o)}return this._summerCompiler}async ready(){return this._checkReadyTask||(this._checkReadyTask=new singletontask_1.SingletonTask(this.init.bind(this,this._options))),await this._checkReadyTask.getResult()}async init(){}async getNativeCompiler(){return this._nativeCompiler||await this.initNativeCompiler(this._options),this._nativeCompiler}async initNativeCompiler(e){if("multiPlatform"!==this.originProject.projectArchitecture)return;const{miniappDirPath:i,devtoolsVersion:t,devtoolMessagehub:r}=e;this._nativeCompiler=new nativecompiler_1.NativeCompiler({project:this._precompileProject,devtoolMessagehub:r,devtoolsVersion:t,miniappDirPath:i}),await this._nativeCompiler.ready()}getPreCompileOptions(){var e,i;return{targetPlatform:null===(e=this._precompileProject)||void 0===e?void 0:e.targetPlatform,targetPlatformDefines:null===(i=this._precompileProject)||void 0===i?void 0:i.targetPlatformDefines}}async changePreCompileOptions(e){var i;await this.getPreCompileProject(),(null===(i=this._precompileProject)||void 0===i?void 0:i.targetPlatform)!==e.targetPlatform&&(this._precompileProject.updateConditionCompileOptions(e),await new Promise(e=>setTimeout(e,500)))}async setLocale(e){(await this.getSummerCompiler()).setLocale(e)}destroy(){var e,i;(null===(e=this._summerCompiler)||void 0===e?void 0:e.isSummer)&&this._summerCompiler.destroy(),null===(i=this._nativeCompiler)||void 0===i||i.destroy()}}exports.Builder=Builder;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miniprogram-ci",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
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",
|