miniprogram-ci 1.9.3 → 1.9.5

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 CHANGED
@@ -1,3 +1,5 @@
1
+ ## 1.9.5
2
+ - `new` 新增 getDevSourceMap 接口获取 sourcemap 文件支持流式传输
1
3
  ## 1.9.1
2
4
  - `new` 更新 支持预览和上传时,过滤无依赖文件
3
5
  ## 1.8.60
package/README.md CHANGED
@@ -219,6 +219,7 @@ const ci = require('miniprogram-ci')
219
219
  | project | IProject | 是 | #项目对象 |
220
220
  | robot | number | 是 | 指定使用哪一个 ci 机器人,可选值:1 ~ 30 |
221
221
  | sourceMapSavePath | string | 是 | 保存的路径 |
222
+ | streaming | boolean | 否 | 是否使用流式传输 |
222
223
 
223
224
  ### 获取本地编译后的代码包
224
225
  当怀疑代码大小发生变化,不符合预期时,可以调用这个方法,检查一下最终上传到微信后台服务器时代码包里的文件内容。
@@ -3,5 +3,6 @@ export interface IGetDevSourceMapOption {
3
3
  project: IProject;
4
4
  robot: number;
5
5
  sourceMapSavePath: string;
6
+ streaming?: boolean;
6
7
  }
7
8
  export declare function getDevSourceMap(options: IGetDevSourceMapOption): Promise<any>;
@@ -1,4 +1,4 @@
1
- export declare const CI_VERSION = "1.9.3";
1
+ export declare const CI_VERSION = "1.9.5";
2
2
  export declare const PARAM_ERROR = 10000;
3
3
  export declare const WXML_NOT_FOUND = 10007;
4
4
  export declare const JS_NOT_FOUND = 10008;
@@ -1,3 +1,3 @@
1
1
  !function(require, directRequire){
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDevSourceMap=void 0;const tslib_1=require("tslib"),fs_1=(0,tslib_1.__importDefault)(require("fs")),path_1=(0,tslib_1.__importDefault)(require("path")),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),request_1=require("../utils/request"),url_config_1=require("../utils/url_config"),sign_1=require("../utils/sign"),JsZip=require("jszip"),ERR_MSG_PREFIX="download source map failed:";async function getExtAppId(e){let r,t={};try{r=await e.getFile(e.miniprogramRoot,"ext.json"),t=JSON.parse(r.toString("utf-8"))}catch(e){}if(null==t?void 0:t.extEnable)return t.extAppid}async function getDevSourceMap(e){const{project:r,robot:t}=e;let{sourceMapSavePath:o}=e;if(!r){const e="params project is requried";throw log_1.default.error(e),e}if("number"!=typeof t||Math.round(t)>30||Math.round(t)<=0){const e="params robot is invalid";throw log_1.default.error(e),e}if(!o){const e="params sourceMapSavePath is invalid";throw log_1.default.error(e),e}path_1.default.isAbsolute(o)||(o=path_1.default.join(process.cwd(),o));const a=await(0,sign_1.getSignature)(r.privateKey,r.appid),i=await getExtAppId(r),{body:s}=await(0,request_1.request)({url:url_config_1.GET_DEV_SOURCE_MAP,method:"post",gzip:!0,body:JSON.stringify({appid:r.appid,signature:a,robot:t,extAppId:i}),headers:{"content-type":"application/json"}});let l;try{l=JSON.parse(s)}catch(e){const r=ERR_MSG_PREFIX+" resp body is not a valid json";throw log_1.default.error(r),r}if(0!==l.errCode)throw new Error(`request failed, errCode: ${l.errCode}, errMsg: ${l.errMsg}`);const u=l.data;if(!Array.isArray(u.sourcemap_list)){const e=`${ERR_MSG_PREFIX} respData.sourcemap_list, respData: ${JSON.stringify(u)}`;throw log_1.default.error(e),e}const p=u.sourcemap_list,n=new JsZip;try{p.forEach(e=>{n.folder(path_1.default.dirname(e.fullpath)).file(path_1.default.basename(e.fullpath),e.sourcemap)})}catch(e){const r=ERR_MSG_PREFIX+" source map add folder or add file error";throw log_1.default.error(r),r}let c;try{c=await n.generateAsync({type:"nodebuffer"})}catch(e){const r=ERR_MSG_PREFIX+" source map generate zip error";throw log_1.default.error(r),r}try{fs_1.default.writeFileSync(o,c)}catch(e){const r=`${ERR_MSG_PREFIX} save source map to ${o} failed. Error detail: ${JSON.stringify(e)}`;throw log_1.default.error(r),r}return c}exports.getDevSourceMap=getDevSourceMap;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDevSourceMap=void 0;const tslib_1=require("tslib"),fs_1=(0,tslib_1.__importDefault)(require("fs")),path_1=(0,tslib_1.__importDefault)(require("path")),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),request_1=require("../utils/request"),url_config_1=require("../utils/url_config"),sign_1=require("../utils/sign"),JsZip=require("jszip"),ERR_MSG_PREFIX="download source map failed:";async function getExtAppId(e){let r,t={};try{r=await e.getFile(e.miniprogramRoot,"ext.json"),t=JSON.parse(r.toString("utf-8"))}catch(e){}if(null==t?void 0:t.extEnable)return t.extAppid}async function getDevSourceMap(e){const{project:r,robot:t,streaming:o}=e;let{sourceMapSavePath:a}=e;if(!r){const e="params project is requried";throw log_1.default.error(e),e}if("number"!=typeof t||Math.round(t)>30||Math.round(t)<=0){const e="params robot is invalid";throw log_1.default.error(e),e}if(!a){const e="params sourceMapSavePath is invalid";throw log_1.default.error(e),e}path_1.default.isAbsolute(a)||(a=path_1.default.join(process.cwd(),a));const i=await(0,sign_1.getSignature)(r.privateKey,r.appid),s=await getExtAppId(r),{body:l}=await(0,request_1.request)({url:url_config_1.GET_DEV_SOURCE_MAP,method:"post",gzip:!0,body:JSON.stringify({appid:r.appid,signature:i,robot:t,extAppId:s,streaming:o}),headers:{"content-type":"application/json"}});let u,p;try{u=JSON.parse(l)}catch(e){const r=ERR_MSG_PREFIX+" resp body is not a valid json";throw log_1.default.error(r),r}if(o)p=u.sourcemap_list;else{if(0!==u.errCode)throw new Error(`request failed, errCode: ${u.errCode}, errMsg: ${u.errMsg}`);const e=u.data;if(!Array.isArray(e.sourcemap_list)){const r=`${ERR_MSG_PREFIX} respData.sourcemap_list, respData: ${JSON.stringify(e)}`;throw log_1.default.error(r),r}p=e.sourcemap_list}const n=p,c=new JsZip;try{n.forEach(e=>{c.folder(path_1.default.dirname(e.fullpath)).file(path_1.default.basename(e.fullpath),e.sourcemap)})}catch(e){const r=ERR_MSG_PREFIX+" source map add folder or add file error";throw log_1.default.error(r),r}let _;try{_=await c.generateAsync({type:"nodebuffer"})}catch(e){const r=ERR_MSG_PREFIX+" source map generate zip error";throw log_1.default.error(r),r}try{fs_1.default.writeFileSync(a,_)}catch(e){const r=`${ERR_MSG_PREFIX} save source map to ${a} failed. Error detail: ${JSON.stringify(e)}`;throw log_1.default.error(r),r}return _}exports.getDevSourceMap=getDevSourceMap;
3
3
  }(require("licia/lazyImport")(require), require)
package/dist/config.js CHANGED
@@ -1,3 +1,3 @@
1
1
  !function(require, directRequire){
2
- "use strict";var COMPILE_TYPE;Object.defineProperty(exports,"__esModule",{value:!0}),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="1.9.3",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(_){_.miniProgram="miniProgram",_.miniProgramPlugin="miniProgramPlugin",_.miniGame="miniGame",_.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,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"]}};
2
+ "use strict";var COMPILE_TYPE;Object.defineProperty(exports,"__esModule",{value:!0}),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="1.9.5",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(_){_.miniProgram="miniProgram",_.miniProgramPlugin="miniProgramPlugin",_.miniGame="miniGame",_.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,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"]}};
3
3
  }(require("licia/lazyImport")(require), require)
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "1.9.3",
3
- "buildTime": 1669882818769
2
+ "version": "1.9.5",
3
+ "buildTime": 1672820320381
4
4
  }
@@ -614,5 +614,5 @@ module.exports = {
614
614
  }
615
615
  },
616
616
  "$schema": "http://json-schema.org/draft-07/schema#",
617
- "$version": 1666151367390
617
+ "$version": 1671418174318
618
618
  }
@@ -549,6 +549,7 @@ module.exports = {
549
549
  },
550
550
  "renderer": {
551
551
  "enum": [
552
+ "cover-view",
552
553
  "skyline",
553
554
  "webview",
554
555
  "xr-frame"
@@ -857,5 +858,5 @@ module.exports = {
857
858
  }
858
859
  },
859
860
  "$schema": "http://json-schema.org/draft-07/schema#",
860
- "$version": 1666151169461
861
+ "$version": 1669016223495
861
862
  }
@@ -207,5 +207,5 @@ module.exports = {
207
207
  }
208
208
  },
209
209
  "$schema": "http://json-schema.org/draft-07/schema#",
210
- "$version": 1666151169461
210
+ "$version": 1669016223495
211
211
  }
@@ -257,6 +257,7 @@ module.exports = {
257
257
  },
258
258
  "renderer": {
259
259
  "enum": [
260
+ "cover-view",
260
261
  "skyline",
261
262
  "webview",
262
263
  "xr-frame"
@@ -308,5 +309,5 @@ module.exports = {
308
309
  }
309
310
  },
310
311
  "$schema": "http://json-schema.org/draft-07/schema#",
311
- "$version": 1665373308829
312
+ "$version": 1671418085036
312
313
  }
@@ -37,5 +37,5 @@ module.exports = {
37
37
  },
38
38
  "additionalProperties": false,
39
39
  "$schema": "http://json-schema.org/draft-07/schema#",
40
- "$version": 1665373308829
40
+ "$version": 1656299567866
41
41
  }
@@ -10,5 +10,5 @@ module.exports = {
10
10
  },
11
11
  "additionalProperties": false,
12
12
  "$schema": "http://json-schema.org/draft-07/schema#",
13
- "$version": 1665373308829
13
+ "$version": 1631795974264
14
14
  }
@@ -470,5 +470,5 @@ module.exports = {
470
470
  }
471
471
  },
472
472
  "$schema": "http://json-schema.org/draft-07/schema#",
473
- "$version": 1665373308830
473
+ "$version": 1651127201809
474
474
  }
@@ -354,5 +354,5 @@ module.exports = {
354
354
  }
355
355
  },
356
356
  "$schema": "http://json-schema.org/draft-07/schema#",
357
- "$version": 1665373308830
357
+ "$version": 1654742747172
358
358
  }
@@ -49,5 +49,5 @@ module.exports = {
49
49
  "rules"
50
50
  ],
51
51
  "$schema": "http://json-schema.org/draft-07/schema#",
52
- "$version": 1665373308830
52
+ "$version": 1631795974265
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": 1665373308830
19
+ "$version": 1631795974265
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miniprogram-ci",
3
- "version": "1.9.3",
3
+ "version": "1.9.5",
4
4
  "description": "pre compilation module about the miniProgram / miniGame project extracted from WeChatDevtools.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/@types/index.d.ts",
@@ -135,4 +135,4 @@
135
135
  "wxml-minifier": "0.0.1",
136
136
  "yargs": "^15.0.2"
137
137
  }
138
- }
138
+ }