jd-minigame-ci 0.4.0 → 0.4.2
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/README.md +11 -3
- package/dist/index.js +1 -1
- package/dist/jgc.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ jgc config
|
|
|
56
56
|
|
|
57
57
|
```js
|
|
58
58
|
module.exports = {
|
|
59
|
-
"type": "game", // 包类型,
|
|
59
|
+
"type": "game", // 包类型, 有两种类型可选:game(小游戏), plugin(插件)
|
|
60
60
|
"appId": "133D26A41FB623****", // 游戏的appId
|
|
61
61
|
"requestToken": "1c0f081c18a248adbff9f****", // 游戏上传秘钥
|
|
62
62
|
"entry": "./build/source", // 需要被打包的小游戏的路径
|
|
@@ -65,7 +65,7 @@ module.exports = {
|
|
|
65
65
|
}
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
###
|
|
68
|
+
### 小游戏-预览功能
|
|
69
69
|
预览功能主要用于开发过程中,对小游戏进行真机预览及调试。
|
|
70
70
|
|
|
71
71
|
在生成 jgc.config.js 的同级目录执行以下命令:
|
|
@@ -77,7 +77,7 @@ jgc preview
|
|
|
77
77
|
|
|
78
78
|

|
|
79
79
|
|
|
80
|
-
###
|
|
80
|
+
### 小游戏-上传功能
|
|
81
81
|
|
|
82
82
|
上传功能用于开发者通过命令行快速将本地代码包上传至开发版本,并自动设置为体验版,返回体验版二维码。
|
|
83
83
|
|
|
@@ -88,6 +88,14 @@ jgc upload
|
|
|
88
88
|
```
|
|
89
89
|

|
|
90
90
|
|
|
91
|
+
### 插件-上传功能
|
|
92
|
+
小游戏插件的开发也可以通过命令行工具进行快速发布。插件只支持快速上传,无法进行预览。
|
|
93
|
+
在生成 jgc.config.js 的同级目录执行以下命令
|
|
94
|
+
|
|
95
|
+
```Shell
|
|
96
|
+
jgc publish
|
|
97
|
+
```
|
|
98
|
+
|
|
91
99
|
## 客户端调试
|
|
92
100
|
在非线上小游戏,iOS/Android均支持打开调试模式,支持vConsole查看调试日志。
|
|
93
101
|
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(global,(()=>{return t={85:t=>{t.exports={FAIL_CODE:-1,SUCCEED_CODE:0}},538:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new q(n||[]);return a(i,"_invoke",{value:P(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(N([])));L&&L!==r&&i.call(L,u)&&(k=L);var _=x.prototype=b.prototype=Object.create(k);function j(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,a,c,u){var s=h(t[o],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function P(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?g:y,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=g,n.method="throw",n.arg=s.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function q(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(_,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},j(O.prototype),p(O.prototype,s,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(_),p(_,f,"Generator"),p(_,u,(function(){return this})),p(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,q.prototype={constructor:q,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function i(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var a=r(652),c=r(928),u=r(172),s=r(410).globSync;function f(t){try{if(a.pathExistsSync(t))return!0;if(f(c.dirname(t)))return a.mkdirsSync(t),!0}catch(t){console.log("make dir error,",t)}}e.writeFile=function(){var t,e=(t=o().mark((function t(e,r){var n,i=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=i.length>2&&void 0!==i[2]?i[2]:"utf8",f(c.posix.parse(e).dir)&&a.writeFileSync(e,r,n);case 4:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))});return function(t,r){return e.apply(this,arguments)}}(),e.verifyGameRequiredFilesExist=function(t,e){return a.pathExistsSync(t)?"game"===e?p(t):"plugin"===e?l(t):{code:0,err_msg:"ok"}:{code:-1,err_msg:"当前入口文件目录不存在!"}};var p=function(t){var e=s("game.json",{cwd:t,ignore:"node_modules/**"}),r=s("game.js",{cwd:t,ignore:"node_modules/**"});return 0===e.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.json!"}:0===r.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.js!"}:{code:0,err_msg:"ok"}},l=function(t){return 0===s("plugin.json",{cwd:t,ignore:"node_modules/**"}).length?{code:-1,err_msg:"被打包的插件的目录下不存在plugin.json!"}:{code:0,err_msg:"ok"}};e.hasJgcConfigFile=function(t){try{return a.accessSync(t,a.constants.F_OK),!0}catch(t){return console.log("文件不存在"),!1}},e.compressDirectory=function(t,e){return new Promise((function(r,n){var o=a.createWriteStream(e),i=u("zip",{zlib:{level:9}});o.on("close",(function(){return r(i.pointer())})),i.on("warning",(function(t){return"ENOENT"!==t.code&&n(t)})),i.on("error",n),i.pipe(o),i.glob("**/*",{cwd:t,ignore:["**/.*","**/*.js.map"]}),i.finalize()}))},e.deleteFile=function(t){a.existsSync(t)&&a.unlink(t,(function(t){t&&console.log("删除zip文件失败: ",t)}))}},954:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new q(n||[]);return a(i,"_invoke",{value:P(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(N([])));L&&L!==r&&i.call(L,u)&&(k=L);var _=x.prototype=b.prototype=Object.create(k);function j(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,a,c,u){var s=h(t[o],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function P(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?g:y,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=g,n.method="throw",n.arg=s.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function q(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(_,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},j(O.prototype),p(O.prototype,s,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(_),p(_,f,"Generator"),p(_,u,(function(){return this})),p(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,q.prototype={constructor:q,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function i(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var a=r(928),c=r(857),u=r(538),s=r(60),f=r(425),p=r(85).SUCCEED_CODE,l=new f("prod");function h(t,e){return d.apply(this,arguments)}function d(){var t;return t=o().mark((function t(e,r){var n,i,f,h,d,y,v,g,m,b,w,x,k,E,L,_,j,O,P,S,I;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=s.checkConfigOptions(e,r),i=n.code,f=n.err_msg,0===i){t.next=4;break}return t.abrupt("return",{code:i,errMsg:f});case 4:if(h=e.appId,d=e.requestToken,y=e.entry,v=e.versionName,g=e.description,0===(m=u.verifyGameRequiredFilesExist(y)).code){t.next=8;break}return t.abrupt("return",{code:m.code,errMsg:m.err_msg});case 8:return b=a.join(c.tmpdir(),"jd_game_temp.zip"),t.prev=9,u.deleteFile(b),t.next=13,u.compressDirectory(y,b);case 13:t.next=18;break;case 15:throw t.prev=15,t.t0=t.catch(9),new Error("压缩失效:",t.t0);case 18:return t.next=20,l.uploadProject({sourceFile:b,appId:h,requestToken:d});case 20:if((w=t.sent).code===p){t.next=23;break}return t.abrupt("return",w);case 23:if(x=w.packId,1!==r){t.next=34;break}return t.next=27,l.generateQrCode({packId:x,appId:h,requestToken:d});case 27:if((k=t.sent).code===p){t.next=30;break}return t.abrupt("return",k);case 30:return E=k.imgUrl,L=k.expiredTime,t.abrupt("return",{code:p,url:E,expiredTime:L});case 34:if(2!==r){t.next=53;break}return t.next=37,l.commitDevVersion({appId:h,requestToken:d,versionName:v,description:g},x);case 37:if((_=t.sent).code===p){t.next=40;break}return t.abrupt("return",_);case 40:return j=_.devId,t.next=43,l.setDevExperience({appId:h,requestToken:d},j);case 43:if((O=t.sent).code===p){t.next=46;break}return t.abrupt("return",O);case 46:return t.next=48,l.queryExperienceQrcodeByPackId({appId:h,requestToken:d});case 48:if((P=t.sent).code===p){t.next=51;break}return t.abrupt("return",P);case 51:return S=P.imgUrl,I=P.expiredTime,t.abrupt("return",{url:S,expiredTime:I});case 53:case"end":return t.stop()}}),t,null,[[9,15]])})),d=function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))},d.apply(this,arguments)}t.exports={preview:function(t){return h(t,1)},upload:function(t){return h(t,2)}}},425:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function a(t,e,r){return(e=p(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */c=function(){return e};var t,e={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),c=new q(n||[]);return i(a,"_invoke",{value:P(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(N([])));L&&L!==r&&o.call(L,u)&&(k=L);var _=x.prototype=b.prototype=Object.create(k);function j(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(i,a,c,u){var s=h(t[i],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&o.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var a;i(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function P(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?g:y,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=g,n.method="throw",n.arg=s.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function q(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(o.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,i(_,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},j(O.prototype),p(O.prototype,s,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(_),p(_,f,"Generator"),p(_,u,(function(){return this})),p(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,q.prototype={constructor:q,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function u(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){u(i,n,o,a,c,"next",t)}function c(t){u(i,n,o,a,c,"throw",t)}a(void 0)}))}}function f(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,p(n.key),n)}}function p(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var l=r(938),h=r(305),d=r(652),y=r(85),v=y.FAIL_CODE,g=y.SUCCEED_CODE,m=(r(60).checkConfigOptions,{dev:"http://beta-vapp-ide.jd.com",prod:"https://vapp-ide-pack.jd.com",test:"http://test-vapp-ide.jdtest.net"}),b=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"prod";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.URL=m[e]},e=[{key:"uploadProject",value:(L=s(c().mark((function t(e){var r,n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.pack(e);case 3:if((r=t.sent).code===g){t.next=6;break}return t.abrupt("return",r);case 6:return n=r.data.result,t.next=9,this.loopQuery(e,n);case 9:if((o=t.sent).code===g){t.next=12;break}return t.abrupt("return",o);case 12:return t.abrupt("return",{code:g,packId:o.data});case 15:return t.prev=15,t.t0=t.catch(0),t.abrupt("return",{code:v,err_msg:t.t0 instanceof Error?t.t0.message:"上传失败"});case 18:case"end":return t.stop()}}),t,this,[[0,15]])}))),function(t){return L.apply(this,arguments)})},{key:"sendPostRequest",value:(E=s(c().mark((function t(e,r){var n,o,a,u,s=arguments;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(a in n=s.length>2&&void 0!==s[2]?s[2]:"请求失败",o=new h,r)o.append(a,r[a]);return t.prev=3,t.next=6,l.post(e,o,{headers:i({},o.getHeaders())});case 6:if((u=t.sent).data.code!==g){t.next=9;break}return t.abrupt("return",{code:g,data:u.data});case 9:return t.abrupt("return",{code:v,err_msg:"".concat(n,": ").concat(u.data.errorMessage)});case 12:return t.prev=12,t.t0=t.catch(3),t.abrupt("return",{code:v,err_msg:"".concat(n,": ").concat(t.t0)});case 15:case"end":return t.stop()}}),t,null,[[3,12]])}))),function(t,e){return E.apply(this,arguments)})},{key:"pluginPublishRequest",value:(k=s(c().mark((function t(e,r,n,o){var i,a,u,s,f=arguments;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=f.length>4&&void 0!==f[4]?f[4]:"请求失败",a=JSON.stringify(r),u={method:"post",maxBodyLength:1/0,url:"".concat(e,"?appId=").concat(n,"&requestToken=").concat(o),headers:{"Content-Type":"application/json"},data:a},t.prev=3,t.next=6,l.request(u);case 6:if((s=t.sent).data.code!==g){t.next=9;break}return t.abrupt("return",{code:g,data:s.data});case 9:return t.abrupt("return",{code:v,err_msg:"".concat(i,": ").concat(s.data.errorMessage)});case 12:return t.prev=12,t.t0=t.catch(3),t.abrupt("return",{code:v,err_msg:"".concat(i,": ").concat(t.t0)});case 15:case"end":return t.stop()}}),t,null,[[3,12]])}))),function(t,e,r,n){return k.apply(this,arguments)})},{key:"pack",value:(x=s(c().mark((function t(e){var r,n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.sourceFile,n=e.appId,o=e.requestToken,i="".concat(this.URL,"/v1/devops/pack"),a={appId:n,requestToken:o,sourceFile:d.createReadStream(r)},t.abrupt("return",this.sendPostRequest(i,a,"文件上传报错"));case 5:case"end":return t.stop()}}),t,this)}))),function(t){return x.apply(this,arguments)})},{key:"loopQuery",value:(w=s(c().mark((function t(e,r){var n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Date.now(),o=2e6,i=3e3;case 3:if(!(Date.now()-n<o)){t.next=15;break}return t.next=6,new Promise((function(t){return setTimeout(t,i)}));case 6:return t.next=8,this.queryPkgId(e,r);case 8:if((a=t.sent).code===g){t.next=11;break}return t.abrupt("return",{code:v,err_msg:a.err_msg});case 11:if(!a.data.result){t.next=13;break}return t.abrupt("return",{code:g,data:a.data.result});case 13:t.next=3;break;case 15:return t.abrupt("return",{code:v,err_msg:"查询超时"});case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return w.apply(this,arguments)})},{key:"queryPkgId",value:(b=s(c().mark((function t(e,r){var n,o,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i={appId:n,requestToken:o,uuid:r},t.abrupt("return",this.sendPostRequest("".concat(this.URL,"/v1/ci/queryPackIdByUuid"),i,"获取构建包id失效"));case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return b.apply(this,arguments)})},{key:"generateQrCode",value:(y=s(c().mark((function t(e){var r,n,o,i,a,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.appId,n=e.requestToken,o=e.packId,i={appId:r,requestToken:n,packId:o},t.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryQrcodeByPackId"),i,"获取二维码失效");case 4:if((a=t.sent).code===g){t.next=7;break}return t.abrupt("return",{code:v,err_msg:a.err_msg});case 7:if(!a.data.result){t.next=13;break}return(u=new Date).setMinutes(u.getMinutes()+25),t.abrupt("return",{code:g,imgUrl:a.data.result,expiredTime:"".concat(this.addZeroForShort(u.getHours()),":").concat(this.addZeroForShort(u.getMinutes()))});case 13:return t.abrupt("return",{code:v,err_msg:"二维码生成完成请求返回为空"});case 14:case"end":return t.stop()}}),t,this)}))),function(t){return y.apply(this,arguments)})},{key:"addZeroForShort",value:function(t){return String(t).length<2?"0".concat(String(t)):String(t)}},{key:"commitDevVersion",value:(p=s(c().mark((function t(e,r){var n,o,i,a,u,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i=e.versionName,a=e.description,u={packId:r,appId:n,requestToken:o,versionName:i,description:a},t.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/commitDevVersion"),u,"设置为开发版失效");case 4:if((s=t.sent).code===g){t.next=7;break}return t.abrupt("return",s);case 7:return t.abrupt("return",{code:g,devId:s.data.result});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return p.apply(this,arguments)})},{key:"setDevExperience",value:(u=s(c().mark((function t(e,r){var n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i={appId:n,requestToken:o,devId:r},t.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/devExperience"),i,"设置为体验版失效");case 4:if((a=t.sent).code===g){t.next=7;break}return t.abrupt("return",a);case 7:return t.abrupt("return",{code:g});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"queryExperienceQrcodeByPackId",value:(a=s(c().mark((function t(e){var r,n,o,i,a,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.appId,n=e.requestToken,o={appId:r,requestToken:n},t.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryExperienceQrcode"),o,"获取体验二维码失效");case 4:if((i=t.sent).code===g){t.next=7;break}return t.abrupt("return",{code:v,err_msg:i.err_msg});case 7:return a=i.data.result,(u=new Date).setMinutes(u.getMinutes()+25),t.abrupt("return",{code:g,imgUrl:a,expiredTime:"".concat(this.addZeroForShort(u.getHours()),":").concat(this.addZeroForShort(u.getMinutes()))});case 11:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"uploadPlugin",value:(o=s(c().mark((function t(e){var r,n,o,i,a,u,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.sourceFile,n=e.appId,o=e.requestToken,i=e.versionName,a="".concat(this.URL,"/v1/ci/pluginPack"),u={appId:n,requestToken:o,versionName:i,sourceFile:d.createReadStream(r)},console.log("上传插件",a),t.next=7,this.sendPostRequest(a,u,"插件构建报错");case 7:if((s=t.sent).code===g){t.next=10;break}return t.abrupt("return",{code:v,err_msg:s.err_msg});case 10:return t.abrupt("return",{code:g,result:s.data.result});case 11:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"publishPlugin",value:(n=s(c().mark((function t(e){var r,n,o,i,a,u,s,f,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.versionName,n=e.versionFeature,o=e.useGuide,i=e.packId,a=e.appId,u=e.requestToken,s="".concat(this.URL,"/v1/ci/plugin-dev"),f={versionName:r,versionFeature:n,useGuide:o,packId:i},t.next=6,this.pluginPublishRequest(s,f,a,u,"插件上传报错");case 6:if((p=t.sent).code===g){t.next=9;break}return t.abrupt("return",{code:v,err_msg:p.err_msg});case 9:return t.abrupt("return",{code:g});case 10:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})}],e&&f(t.prototype,e),r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o,a,u,p,y,b,w,x,k,E,L}();t.exports=b},60:(t,e)=>{function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function o(t){return"string"==typeof t&&!!t.trim()}e.checkConfigOptions=function(t,e){var n=t||{},i=n.type,a=n.appId,c=n.requestToken,u=n.entry,s=n.versionName,f=n.description;if("game"!==i)return{code:-1,err_msg:"请选择项目构建类型为小游戏"};for(var p=1===e?{appId:a,requestToken:c,entry:u}:{appId:a,requestToken:c,entry:u,versionName:s,description:f},l=0,h=Object.entries(p);l<h.length;l++){var d=r(h[l],2),y=d[0];if(!o(d[1]))return{code:-1,err_msg:"".concat(y," 不能为空")}}return{code:0,err_msg:"ok"}},e.checkPluginConfig=function(t){var e=t||{},n=e.type,i=e.appId,a=e.requestToken,c=e.entry,u=e.versionName;if("plugin"!==n)return{code:-1,err_msg:"请选择项目构建类型为插件"};for(var s={appId:i,requestToken:a,entry:c,versionName:u},f=0,p=Object.entries(s);f<p.length;f++){var l=r(p[f],2),h=l[0];if(!o(l[1]))return{code:-1,err_msg:"".concat(h," 不能为空")}}return{code:0,err_msg:"ok"}}},172:t=>{"use strict";t.exports=require("archiver")},938:t=>{"use strict";t.exports=require("axios")},305:t=>{"use strict";t.exports=require("form-data")},652:t=>{"use strict";t.exports=require("fs-extra")},410:t=>{"use strict";t.exports=require("glob")},857:t=>{"use strict";t.exports=require("os")},928:t=>{"use strict";t.exports=require("path")}},e={},function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(954);var t,e}));
|
|
2
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(global,(()=>{return t={85:t=>{t.exports={FAIL_CODE:-1,SUCCEED_CODE:0}},538:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new q(n||[]);return a(i,"_invoke",{value:P(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(N([])));L&&L!==r&&i.call(L,u)&&(k=L);var _=x.prototype=b.prototype=Object.create(k);function j(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,a,c,u){var s=h(t[o],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function P(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?g:y,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=g,n.method="throw",n.arg=s.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function q(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(_,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},j(O.prototype),p(O.prototype,s,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(_),p(_,f,"Generator"),p(_,u,(function(){return this})),p(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,q.prototype={constructor:q,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function i(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var a=r(652),c=r(928),u=r(172),s=r(410).globSync;function f(t){try{if(a.pathExistsSync(t))return!0;if(f(c.dirname(t)))return a.mkdirsSync(t),!0}catch(t){console.log("make dir error,",t)}}e.writeFile=function(){var t,e=(t=o().mark((function t(e,r){var n,i=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=i.length>2&&void 0!==i[2]?i[2]:"utf8",f(c.posix.parse(e).dir)&&a.writeFileSync(e,r,n);case 4:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))});return function(t,r){return e.apply(this,arguments)}}(),e.verifyGameRequiredFilesExist=function(t,e){return a.pathExistsSync(t)?"game"===e?p(t):"plugin"===e?l(t):{code:0,err_msg:"ok"}:{code:-1,err_msg:"当前入口文件目录不存在!"}};var p=function(t){var e=s("game.json",{cwd:t,ignore:"node_modules/**"}),r=s("game.js",{cwd:t,ignore:"node_modules/**"});return 0===e.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.json!"}:0===r.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.js!"}:{code:0,err_msg:"ok"}},l=function(t){return 0===s("plugin.json",{cwd:t,ignore:"node_modules/**"}).length?{code:-1,err_msg:"被打包的插件的目录下不存在plugin.json!"}:{code:0,err_msg:"ok"}};e.hasJgcConfigFile=function(t){try{return a.accessSync(t,a.constants.F_OK),!0}catch(t){return console.log("文件不存在"),!1}},e.compressDirectory=function(t,e){return new Promise((function(r,n){var o=a.createWriteStream(e),i=u("zip",{zlib:{level:9}});o.on("close",(function(){return r(i.pointer())})),i.on("warning",(function(t){return"ENOENT"!==t.code&&n(t)})),i.on("error",n),i.pipe(o),i.glob("**/*",{cwd:t,ignore:["**/.*","**/*.js.map"]}),i.finalize()}))},e.deleteFile=function(t){a.existsSync(t)&&a.unlink(t,(function(t){t&&console.log("删除zip文件失败: ",t)}))}},954:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new q(n||[]);return a(i,"_invoke",{value:P(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(N([])));L&&L!==r&&i.call(L,u)&&(k=L);var _=x.prototype=b.prototype=Object.create(k);function j(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,a,c,u){var s=h(t[o],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function P(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?g:y,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=g,n.method="throw",n.arg=s.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function q(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(_,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},j(O.prototype),p(O.prototype,s,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(_),p(_,f,"Generator"),p(_,u,(function(){return this})),p(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,q.prototype={constructor:q,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function i(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var a=r(928),c=r(857),u=r(538),s=r(60),f=r(425),p=r(85).SUCCEED_CODE,l=new f("prod");function h(t,e){return d.apply(this,arguments)}function d(){var t;return t=o().mark((function t(e,r){var n,i,f,h,d,y,v,g,m,b,w,x,k,E,L,_,j,O,P,S,I;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=s.checkConfigOptions(e,r),i=n.code,f=n.err_msg,0===i){t.next=4;break}return t.abrupt("return",{code:i,errMsg:f});case 4:if(h=e.appId,d=e.requestToken,y=e.entry,v=e.versionName,g=e.description,0===(m=u.verifyGameRequiredFilesExist(y)).code){t.next=8;break}return t.abrupt("return",{code:m.code,errMsg:m.err_msg});case 8:return b=a.join(c.tmpdir(),"jd_game_temp.zip"),t.prev=9,u.deleteFile(b),t.next=13,u.compressDirectory(y,b);case 13:t.next=18;break;case 15:throw t.prev=15,t.t0=t.catch(9),new Error("压缩失效:",t.t0);case 18:return t.next=20,l.uploadProject({sourceFile:b,appId:h,requestToken:d});case 20:if((w=t.sent).code===p){t.next=23;break}return t.abrupt("return",w);case 23:if(x=w.packId,1!==r){t.next=34;break}return t.next=27,l.generateQrCode({packId:x,appId:h,requestToken:d});case 27:if((k=t.sent).code===p){t.next=30;break}return t.abrupt("return",k);case 30:return E=k.imgUrl,L=k.expiredTime,t.abrupt("return",{code:p,url:E,expiredTime:L});case 34:if(2!==r){t.next=53;break}return t.next=37,l.commitDevVersion({appId:h,requestToken:d,versionName:v,description:g},x);case 37:if((_=t.sent).code===p){t.next=40;break}return t.abrupt("return",_);case 40:return j=_.devId,t.next=43,l.setDevExperience({appId:h,requestToken:d},j);case 43:if((O=t.sent).code===p){t.next=46;break}return t.abrupt("return",O);case 46:return t.next=48,l.queryExperienceQrcodeByPackId({appId:h,requestToken:d});case 48:if((P=t.sent).code===p){t.next=51;break}return t.abrupt("return",P);case 51:return S=P.imgUrl,I=P.expiredTime,t.abrupt("return",{url:S,expiredTime:I});case 53:case"end":return t.stop()}}),t,null,[[9,15]])})),d=function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))},d.apply(this,arguments)}t.exports={preview:function(t){return h(t,1)},upload:function(t){return h(t,2)}}},425:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function a(t,e,r){return(e=p(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */c=function(){return e};var t,e={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),c=new q(n||[]);return i(a,"_invoke",{value:P(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(N([])));L&&L!==r&&o.call(L,u)&&(k=L);var _=x.prototype=b.prototype=Object.create(k);function j(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(i,a,c,u){var s=h(t[i],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&o.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var a;i(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function P(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?g:y,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=g,n.method="throw",n.arg=s.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function q(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(o.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,i(_,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},j(O.prototype),p(O.prototype,s,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(_),p(_,f,"Generator"),p(_,u,(function(){return this})),p(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,q.prototype={constructor:q,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function u(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){u(i,n,o,a,c,"next",t)}function c(t){u(i,n,o,a,c,"throw",t)}a(void 0)}))}}function f(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,p(n.key),n)}}function p(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var l=r(938),h=r(305),d=r(652),y=r(85),v=y.FAIL_CODE,g=y.SUCCEED_CODE,m=(r(60).checkConfigOptions,{dev:"http://beta-vapp-ide.jd.com",prod:"https://vapp-ide-pack.jd.com",test:"http://test-vapp-ide.jdtest.net"}),b=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"prod";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.URL=m[e]},e=[{key:"uploadProject",value:(L=s(c().mark((function t(e){var r,n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.pack(e);case 3:if((r=t.sent).code===g){t.next=6;break}return t.abrupt("return",r);case 6:return n=r.data.result,t.next=9,this.loopQuery(e,n);case 9:if((o=t.sent).code===g){t.next=12;break}return t.abrupt("return",o);case 12:return t.abrupt("return",{code:g,packId:o.data});case 15:return t.prev=15,t.t0=t.catch(0),t.abrupt("return",{code:v,err_msg:t.t0 instanceof Error?t.t0.message:"上传失败"});case 18:case"end":return t.stop()}}),t,this,[[0,15]])}))),function(t){return L.apply(this,arguments)})},{key:"sendPostRequest",value:(E=s(c().mark((function t(e,r){var n,o,a,u,s=arguments;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(a in n=s.length>2&&void 0!==s[2]?s[2]:"请求失败",o=new h,r)o.append(a,r[a]);return t.prev=3,t.next=6,l.post(e,o,{headers:i({},o.getHeaders())});case 6:if((u=t.sent).data.code!==g){t.next=9;break}return t.abrupt("return",{code:g,data:u.data});case 9:return t.abrupt("return",{code:v,err_msg:"".concat(n,": ").concat(u.data.errorMessage)});case 12:return t.prev=12,t.t0=t.catch(3),t.abrupt("return",{code:v,err_msg:"".concat(n,": ").concat(t.t0)});case 15:case"end":return t.stop()}}),t,null,[[3,12]])}))),function(t,e){return E.apply(this,arguments)})},{key:"pluginPublishRequest",value:(k=s(c().mark((function t(e,r,n,o){var i,a,u,s,f=arguments;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=f.length>4&&void 0!==f[4]?f[4]:"请求失败",a=JSON.stringify(r),u={method:"post",maxBodyLength:1/0,url:"".concat(e,"?appId=").concat(n,"&requestToken=").concat(o),headers:{"Content-Type":"application/json"},data:a},t.prev=3,t.next=6,l.request(u);case 6:if((s=t.sent).data.code!==g){t.next=9;break}return t.abrupt("return",{code:g,data:s.data});case 9:return t.abrupt("return",{code:v,err_msg:"".concat(i,": ").concat(s.data.errorMessage)});case 12:return t.prev=12,t.t0=t.catch(3),t.abrupt("return",{code:v,err_msg:"".concat(i,": ").concat(t.t0)});case 15:case"end":return t.stop()}}),t,null,[[3,12]])}))),function(t,e,r,n){return k.apply(this,arguments)})},{key:"pack",value:(x=s(c().mark((function t(e){var r,n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.sourceFile,n=e.appId,o=e.requestToken,i="".concat(this.URL,"/v1/devops/pack"),a={appId:n,requestToken:o,sourceFile:d.createReadStream(r)},t.abrupt("return",this.sendPostRequest(i,a,"文件上传报错"));case 5:case"end":return t.stop()}}),t,this)}))),function(t){return x.apply(this,arguments)})},{key:"loopQuery",value:(w=s(c().mark((function t(e,r){var n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Date.now(),o=2e6,i=3e3;case 3:if(!(Date.now()-n<o)){t.next=15;break}return t.next=6,new Promise((function(t){return setTimeout(t,i)}));case 6:return t.next=8,this.queryPkgId(e,r);case 8:if((a=t.sent).code===g){t.next=11;break}return t.abrupt("return",{code:v,err_msg:a.err_msg});case 11:if(!a.data.result){t.next=13;break}return t.abrupt("return",{code:g,data:a.data.result});case 13:t.next=3;break;case 15:return t.abrupt("return",{code:v,err_msg:"查询超时"});case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return w.apply(this,arguments)})},{key:"queryPkgId",value:(b=s(c().mark((function t(e,r){var n,o,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i={appId:n,requestToken:o,uuid:r},t.abrupt("return",this.sendPostRequest("".concat(this.URL,"/v1/ci/queryPackIdByUuid"),i,"获取构建包id失效"));case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return b.apply(this,arguments)})},{key:"generateQrCode",value:(y=s(c().mark((function t(e){var r,n,o,i,a,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.appId,n=e.requestToken,o=e.packId,i={appId:r,requestToken:n,packId:o},t.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryQrcodeByPackId"),i,"获取二维码失效");case 4:if((a=t.sent).code===g){t.next=7;break}return t.abrupt("return",{code:v,err_msg:a.err_msg});case 7:if(!a.data.result){t.next=13;break}return(u=new Date).setMinutes(u.getMinutes()+25),t.abrupt("return",{code:g,imgUrl:a.data.result,expiredTime:"".concat(this.addZeroForShort(u.getHours()),":").concat(this.addZeroForShort(u.getMinutes()))});case 13:return t.abrupt("return",{code:v,err_msg:"二维码生成完成请求返回为空"});case 14:case"end":return t.stop()}}),t,this)}))),function(t){return y.apply(this,arguments)})},{key:"addZeroForShort",value:function(t){return String(t).length<2?"0".concat(String(t)):String(t)}},{key:"commitDevVersion",value:(p=s(c().mark((function t(e,r){var n,o,i,a,u,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i=e.versionName,a=e.description,u={packId:r,appId:n,requestToken:o,versionName:i,description:a},t.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/commitDevVersion"),u,"设置为开发版失效");case 4:if((s=t.sent).code===g){t.next=7;break}return t.abrupt("return",s);case 7:return t.abrupt("return",{code:g,devId:s.data.result});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return p.apply(this,arguments)})},{key:"setDevExperience",value:(u=s(c().mark((function t(e,r){var n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i={appId:n,requestToken:o,devId:r},t.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/devExperience"),i,"设置为体验版失效");case 4:if((a=t.sent).code===g){t.next=7;break}return t.abrupt("return",a);case 7:return t.abrupt("return",{code:g});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"queryExperienceQrcodeByPackId",value:(a=s(c().mark((function t(e){var r,n,o,i,a,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.appId,n=e.requestToken,o={appId:r,requestToken:n},t.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryExperienceQrcode"),o,"获取体验二维码失效");case 4:if((i=t.sent).code===g){t.next=7;break}return t.abrupt("return",{code:v,err_msg:i.err_msg});case 7:return a=i.data.result,(u=new Date).setMinutes(u.getMinutes()+25),t.abrupt("return",{code:g,imgUrl:a,expiredTime:"".concat(this.addZeroForShort(u.getHours()),":").concat(this.addZeroForShort(u.getMinutes()))});case 11:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"uploadPlugin",value:(o=s(c().mark((function t(e){var r,n,o,i,a,u,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.sourceFile,n=e.appId,o=e.requestToken,i=e.versionName,a="".concat(this.URL,"/v1/ci/pluginPack"),u={appId:n,requestToken:o,versionName:i,sourceFile:d.createReadStream(r)},t.next=6,this.sendPostRequest(a,u,"插件构建报错");case 6:if((s=t.sent).code===g){t.next=9;break}return t.abrupt("return",{code:v,err_msg:s.err_msg});case 9:return t.abrupt("return",{code:g,result:s.data.result});case 10:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"publishPlugin",value:(n=s(c().mark((function t(e){var r,n,o,i,a,u,s,f,p;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.versionName,n=e.versionFeature,o=e.useGuide,i=e.packId,a=e.appId,u=e.requestToken,s="".concat(this.URL,"/v1/ci/plugin-dev"),f={versionName:r,versionFeature:n,useGuide:o,packId:i},t.next=6,this.pluginPublishRequest(s,f,a,u,"插件上传报错");case 6:if((p=t.sent).code===g){t.next=9;break}return t.abrupt("return",{code:v,err_msg:p.err_msg});case 9:return t.abrupt("return",{code:g});case 10:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})}],e&&f(t.prototype,e),r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o,a,u,p,y,b,w,x,k,E,L}();t.exports=b},60:(t,e)=>{function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function o(t){return"string"==typeof t&&!!t.trim()}e.checkConfigOptions=function(t,e){var n=t||{},i=n.type,a=n.appId,c=n.requestToken,u=n.entry,s=n.versionName,f=n.description;if("game"!==i)return{code:-1,err_msg:"请选择项目构建类型为小游戏"};for(var p=1===e?{appId:a,requestToken:c,entry:u}:{appId:a,requestToken:c,entry:u,versionName:s,description:f},l=0,h=Object.entries(p);l<h.length;l++){var d=r(h[l],2),y=d[0];if(!o(d[1]))return{code:-1,err_msg:"".concat(y," 不能为空")}}return{code:0,err_msg:"ok"}},e.checkPluginConfig=function(t){var e=t||{},n=e.type,i=e.appId,a=e.requestToken,c=e.entry,u=e.versionName;if("plugin"!==n)return{code:-1,err_msg:"请选择项目构建类型为插件"};for(var s={appId:i,requestToken:a,entry:c,versionName:u},f=0,p=Object.entries(s);f<p.length;f++){var l=r(p[f],2),h=l[0];if(!o(l[1]))return{code:-1,err_msg:"".concat(h," 不能为空")}}return{code:0,err_msg:"ok"}}},172:t=>{"use strict";t.exports=require("archiver")},938:t=>{"use strict";t.exports=require("axios")},305:t=>{"use strict";t.exports=require("form-data")},652:t=>{"use strict";t.exports=require("fs-extra")},410:t=>{"use strict";t.exports=require("glob")},857:t=>{"use strict";t.exports=require("os")},928:t=>{"use strict";t.exports=require("path")}},e={},function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(954);var t,e}));
|
package/dist/jgc.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(global,(()=>(()=>{var e={85:e=>{e.exports={FAIL_CODE:-1,SUCCEED_CODE:0}},538:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",p=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),c=new T(n||[]);return a(i,"_invoke",{value:P(e,r,c)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var d="suspendedStart",v="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,u,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(N([])));E&&E!==r&&i.call(E,u)&&(k=E);var _=x.prototype=b.prototype=Object.create(k);function L(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function r(o,a,c,u){var s=h(e[o],e,a);if("throw"!==s.type){var p=s.arg,f=p.value;return f&&"object"==n(f)&&i.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,u)}),(function(e){r("throw",e,c,u)})):t.resolve(f).then((function(e){p.value=e,c(p)}),(function(e){return r("throw",e,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function P(t,r,n){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(t,r,n);if("normal"===s.type){if(o=n.done?m:v,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function q(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(q,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(i.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,a(_,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,p,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,p,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},L(O.prototype),f(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},L(_),f(_,p,"Generator"),f(_,u,(function(){return this})),f(_,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function i(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}var a=r(652),c=r(928),u=r(172),s=r(410).globSync;function p(e){try{if(a.pathExistsSync(e))return!0;if(p(c.dirname(e)))return a.mkdirsSync(e),!0}catch(e){console.log("make dir error,",e)}}t.writeFile=function(){var e,t=(e=o().mark((function e(t,r){var n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=i.length>2&&void 0!==i[2]?i[2]:"utf8",p(c.posix.parse(t).dir)&&a.writeFileSync(t,r,n);case 4:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function c(e){i(a,n,o,c,u,"next",e)}function u(e){i(a,n,o,c,u,"throw",e)}c(void 0)}))});return function(e,r){return t.apply(this,arguments)}}(),t.verifyGameRequiredFilesExist=function(e,t){return a.pathExistsSync(e)?"game"===t?f(e):"plugin"===t?l(e):{code:0,err_msg:"ok"}:{code:-1,err_msg:"当前入口文件目录不存在!"}};var f=function(e){var t=s("game.json",{cwd:e,ignore:"node_modules/**"}),r=s("game.js",{cwd:e,ignore:"node_modules/**"});return 0===t.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.json!"}:0===r.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.js!"}:{code:0,err_msg:"ok"}},l=function(e){return 0===s("plugin.json",{cwd:e,ignore:"node_modules/**"}).length?{code:-1,err_msg:"被打包的插件的目录下不存在plugin.json!"}:{code:0,err_msg:"ok"}};t.hasJgcConfigFile=function(e){try{return a.accessSync(e,a.constants.F_OK),!0}catch(e){return console.log("文件不存在"),!1}},t.compressDirectory=function(e,t){return new Promise((function(r,n){var o=a.createWriteStream(t),i=u("zip",{zlib:{level:9}});o.on("close",(function(){return r(i.pointer())})),i.on("warning",(function(e){return"ENOENT"!==e.code&&n(e)})),i.on("error",n),i.pipe(o),i.glob("**/*",{cwd:e,ignore:["**/.*","**/*.js.map"]}),i.finalize()}))},t.deleteFile=function(e){a.existsSync(e)&&a.unlink(e,(function(e){e&&console.log("删除zip文件失败: ",e)}))}},522:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function n(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configPrompts=[{name:"type",type:"list",message:"请选择项目类型:",choices:[{name:"游戏",value:"game"},{name:"插件",value:"plugin"}],default:"game"},{name:"appId",type:"input",message:"请输入appId:",validate:function(e){return!!e||"appId不能为空"}},{name:"requestToken",type:"input",message:"请输入代码上传秘钥:",validate:function(e){return!!e||"代码上传秘钥不能为空"}},{name:"entry",type:"input",message:"请输入需要被打包的游戏(或者插件)的路径:",default:"./"},{name:"versionName",type:"input",message:"请输入需要被打包的游戏(或者插件)的版本号:",when:function(e){return"game"===e.type},default:"1.0.0"},{name:"description",type:"input",message:"请输入需要被打包的游戏的备注:",when:function(e){return"game"===e.type},default:""}]},(t=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=o},593:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function n(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configPrompts=[{name:"versionName",type:"input",message:"版本号:",default:"1.0.0"},{name:"versionFeature",type:"input",message:"版本特性(长度为10~30个字符):",default:""},{name:"useGuide",type:"input",message:"使用指南(仅限文字和代码,长度为20~1000个字符):",default:"插件使用指南不建议在这里填写,建议到小游戏插件MP控制台提审时修改,这里是占位文本"}]},(t=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=o},890:(e,t,r)=>{var n=r(420),o=r(241),i=r(268);t.showQrCode=function(e){return new Promise((function(t,r){n.read(e).then((function(e){var r=e.bitmap,n=r.width,a=r.height,c=r.data,u=new Uint8ClampedArray(c),s=i(u,n,a);o.generate(s.data,{small:!1}),t(!0)})).catch((function(e){r(!1)}))}))},t.getBase64=function(e){return n.read(e).then((function(e){return e.getBase64Async("image/png")})).catch((function(){throw new Error("获取二维码base64失败")}))}},425:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return(t=f(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */c=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",p=a.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new T(n||[]);return i(a,"_invoke",{value:P(e,r,c)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var d="suspendedStart",v="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,u,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(N([])));E&&E!==r&&o.call(E,u)&&(k=E);var _=x.prototype=b.prototype=Object.create(k);function L(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function r(i,a,c,u){var s=h(e[i],e,a);if("throw"!==s.type){var p=s.arg,f=p.value;return f&&"object"==n(f)&&o.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,u)}),(function(e){r("throw",e,c,u)})):t.resolve(f).then((function(e){p.value=e,c(p)}),(function(e){return r("throw",e,c,u)}))}u(s.arg)}var a;i(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function P(t,r,n){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(t,r,n);if("normal"===s.type){if(o=n.done?m:v,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function q(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(q,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(o.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,i(_,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,p,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,p,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},L(O.prototype),f(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},L(_),f(_,p,"Generator"),f(_,u,(function(){return this})),f(_,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function u(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){u(i,n,o,a,c,"next",e)}function c(e){u(i,n,o,a,c,"throw",e)}a(void 0)}))}}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function f(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var l=r(938),h=r(305),d=r(652),v=r(85),y=v.FAIL_CODE,m=v.SUCCEED_CODE,g=(r(60).checkConfigOptions,{dev:"http://beta-vapp-ide.jd.com",prod:"https://vapp-ide-pack.jd.com",test:"http://test-vapp-ide.jdtest.net"}),b=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"prod";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.URL=g[t]},t=[{key:"uploadProject",value:(E=s(c().mark((function e(t){var r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.pack(t);case 3:if((r=e.sent).code===m){e.next=6;break}return e.abrupt("return",r);case 6:return n=r.data.result,e.next=9,this.loopQuery(t,n);case 9:if((o=e.sent).code===m){e.next=12;break}return e.abrupt("return",o);case 12:return e.abrupt("return",{code:m,packId:o.data});case 15:return e.prev=15,e.t0=e.catch(0),e.abrupt("return",{code:y,err_msg:e.t0 instanceof Error?e.t0.message:"上传失败"});case 18:case"end":return e.stop()}}),e,this,[[0,15]])}))),function(e){return E.apply(this,arguments)})},{key:"sendPostRequest",value:(j=s(c().mark((function e(t,r){var n,o,a,u,s=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(a in n=s.length>2&&void 0!==s[2]?s[2]:"请求失败",o=new h,r)o.append(a,r[a]);return e.prev=3,e.next=6,l.post(t,o,{headers:i({},o.getHeaders())});case 6:if((u=e.sent).data.code!==m){e.next=9;break}return e.abrupt("return",{code:m,data:u.data});case 9:return e.abrupt("return",{code:y,err_msg:"".concat(n,": ").concat(u.data.errorMessage)});case 12:return e.prev=12,e.t0=e.catch(3),e.abrupt("return",{code:y,err_msg:"".concat(n,": ").concat(e.t0)});case 15:case"end":return e.stop()}}),e,null,[[3,12]])}))),function(e,t){return j.apply(this,arguments)})},{key:"pluginPublishRequest",value:(k=s(c().mark((function e(t,r,n,o){var i,a,u,s,p=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=p.length>4&&void 0!==p[4]?p[4]:"请求失败",a=JSON.stringify(r),u={method:"post",maxBodyLength:1/0,url:"".concat(t,"?appId=").concat(n,"&requestToken=").concat(o),headers:{"Content-Type":"application/json"},data:a},e.prev=3,e.next=6,l.request(u);case 6:if((s=e.sent).data.code!==m){e.next=9;break}return e.abrupt("return",{code:m,data:s.data});case 9:return e.abrupt("return",{code:y,err_msg:"".concat(i,": ").concat(s.data.errorMessage)});case 12:return e.prev=12,e.t0=e.catch(3),e.abrupt("return",{code:y,err_msg:"".concat(i,": ").concat(e.t0)});case 15:case"end":return e.stop()}}),e,null,[[3,12]])}))),function(e,t,r,n){return k.apply(this,arguments)})},{key:"pack",value:(x=s(c().mark((function e(t){var r,n,o,i,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sourceFile,n=t.appId,o=t.requestToken,i="".concat(this.URL,"/v1/devops/pack"),a={appId:n,requestToken:o,sourceFile:d.createReadStream(r)},e.abrupt("return",this.sendPostRequest(i,a,"文件上传报错"));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"loopQuery",value:(w=s(c().mark((function e(t,r){var n,o,i,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Date.now(),o=2e6,i=3e3;case 3:if(!(Date.now()-n<o)){e.next=15;break}return e.next=6,new Promise((function(e){return setTimeout(e,i)}));case 6:return e.next=8,this.queryPkgId(t,r);case 8:if((a=e.sent).code===m){e.next=11;break}return e.abrupt("return",{code:y,err_msg:a.err_msg});case 11:if(!a.data.result){e.next=13;break}return e.abrupt("return",{code:m,data:a.data.result});case 13:e.next=3;break;case 15:return e.abrupt("return",{code:y,err_msg:"查询超时"});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"queryPkgId",value:(b=s(c().mark((function e(t,r){var n,o,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,i={appId:n,requestToken:o,uuid:r},e.abrupt("return",this.sendPostRequest("".concat(this.URL,"/v1/ci/queryPackIdByUuid"),i,"获取构建包id失效"));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"generateQrCode",value:(v=s(c().mark((function e(t){var r,n,o,i,a,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.packId,i={appId:r,requestToken:n,packId:o},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryQrcodeByPackId"),i,"获取二维码失效");case 4:if((a=e.sent).code===m){e.next=7;break}return e.abrupt("return",{code:y,err_msg:a.err_msg});case 7:if(!a.data.result){e.next=13;break}return(u=new Date).setMinutes(u.getMinutes()+25),e.abrupt("return",{code:m,imgUrl:a.data.result,expiredTime:"".concat(this.addZeroForShort(u.getHours()),":").concat(this.addZeroForShort(u.getMinutes()))});case 13:return e.abrupt("return",{code:y,err_msg:"二维码生成完成请求返回为空"});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"addZeroForShort",value:function(e){return String(e).length<2?"0".concat(String(e)):String(e)}},{key:"commitDevVersion",value:(f=s(c().mark((function e(t,r){var n,o,i,a,u,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,i=t.versionName,a=t.description,u={packId:r,appId:n,requestToken:o,versionName:i,description:a},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/commitDevVersion"),u,"设置为开发版失效");case 4:if((s=e.sent).code===m){e.next=7;break}return e.abrupt("return",s);case 7:return e.abrupt("return",{code:m,devId:s.data.result});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"setDevExperience",value:(u=s(c().mark((function e(t,r){var n,o,i,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,i={appId:n,requestToken:o,devId:r},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/devExperience"),i,"设置为体验版失效");case 4:if((a=e.sent).code===m){e.next=7;break}return e.abrupt("return",a);case 7:return e.abrupt("return",{code:m});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"queryExperienceQrcodeByPackId",value:(a=s(c().mark((function e(t){var r,n,o,i,a,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o={appId:r,requestToken:n},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryExperienceQrcode"),o,"获取体验二维码失效");case 4:if((i=e.sent).code===m){e.next=7;break}return e.abrupt("return",{code:y,err_msg:i.err_msg});case 7:return a=i.data.result,(u=new Date).setMinutes(u.getMinutes()+25),e.abrupt("return",{code:m,imgUrl:a,expiredTime:"".concat(this.addZeroForShort(u.getHours()),":").concat(this.addZeroForShort(u.getMinutes()))});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"uploadPlugin",value:(o=s(c().mark((function e(t){var r,n,o,i,a,u,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sourceFile,n=t.appId,o=t.requestToken,i=t.versionName,a="".concat(this.URL,"/v1/ci/pluginPack"),u={appId:n,requestToken:o,versionName:i,sourceFile:d.createReadStream(r)},console.log("上传插件",a),e.next=7,this.sendPostRequest(a,u,"插件构建报错");case 7:if((s=e.sent).code===m){e.next=10;break}return e.abrupt("return",{code:y,err_msg:s.err_msg});case 10:return e.abrupt("return",{code:m,result:s.data.result});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"publishPlugin",value:(n=s(c().mark((function e(t){var r,n,o,i,a,u,s,p,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.versionName,n=t.versionFeature,o=t.useGuide,i=t.packId,a=t.appId,u=t.requestToken,s="".concat(this.URL,"/v1/ci/plugin-dev"),p={versionName:r,versionFeature:n,useGuide:o,packId:i},e.next=6,this.pluginPublishRequest(s,p,a,u,"插件上传报错");case 6:if((f=e.sent).code===m){e.next=9;break}return e.abrupt("return",{code:y,err_msg:f.err_msg});case 9:return e.abrupt("return",{code:m});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})}],t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,n,o,a,u,f,v,b,w,x,k,j,E}();e.exports=b},60:(e,t)=>{function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e){return"string"==typeof e&&!!e.trim()}t.checkConfigOptions=function(e,t){var n=e||{},i=n.type,a=n.appId,c=n.requestToken,u=n.entry,s=n.versionName,p=n.description;if("game"!==i)return{code:-1,err_msg:"请选择项目构建类型为小游戏"};for(var f=1===t?{appId:a,requestToken:c,entry:u}:{appId:a,requestToken:c,entry:u,versionName:s,description:p},l=0,h=Object.entries(f);l<h.length;l++){var d=r(h[l],2),v=d[0];if(!o(d[1]))return{code:-1,err_msg:"".concat(v," 不能为空")}}return{code:0,err_msg:"ok"}},t.checkPluginConfig=function(e){var t=e||{},n=t.type,i=t.appId,a=t.requestToken,c=t.entry,u=t.versionName;if("plugin"!==n)return{code:-1,err_msg:"请选择项目构建类型为插件"};for(var s={appId:i,requestToken:a,entry:c,versionName:u},p=0,f=Object.entries(s);p<f.length;p++){var l=r(f[p],2),h=l[0];if(!o(l[1]))return{code:-1,err_msg:"".concat(h," 不能为空")}}return{code:0,err_msg:"ok"}}},589:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=589,e.exports=t},172:e=>{"use strict";e.exports=require("archiver")},938:e=>{"use strict";e.exports=require("axios")},858:e=>{"use strict";e.exports=require("commander")},305:e=>{"use strict";e.exports=require("form-data")},652:e=>{"use strict";e.exports=require("fs-extra")},410:e=>{"use strict";e.exports=require("glob")},937:e=>{"use strict";e.exports=require("inquirer")},420:e=>{"use strict";e.exports=require("jimp")},268:e=>{"use strict";e.exports=require("jsqr")},720:e=>{"use strict";e.exports=require("ora")},205:e=>{"use strict";e.exports=require("picocolors")},241:e=>{"use strict";e.exports=require("qrcode-terminal")},857:e=>{"use strict";e.exports=require("os")},928:e=>{"use strict";e.exports=require("path")},330:e=>{"use strict";e.exports=JSON.parse('{"name":"jd-minigame-ci","version":"0.4.0","description":"The jd-minigame-ci is a toolkit provided for developers of JD Mini Games. Developers can complete code upload and preview operations for JD Mini Games without the need to open the developer tools, simply by using this toolkit.","author":"chenlong328","license":"ISC","main":"dist/index.js","bin":{"jgc":"./dist/jgc.js"},"scripts":{"config":"NODE_ENV=development node ./dist/jgc.js config","preview":"NODE_ENV=development node ./dist/jgc.js preview","dev:config":"NODE_ENV=development node ./src/jgc.js config","dev:preview":"NODE_ENV=development node ./src/jgc.js preview","dev:upload":"NODE_ENV=development node ./src/jgc.js upload","dev:publish":"NODE_ENV=development node ./src/jgc.js publish","build":"webpack --mode production --progress --config webpack.config.js && chmod 777 ./dist/index.js && chmod 777 ./dist/jgc.js"},"dependencies":{"@babel/cli":"^7.23.9","@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","archiver":"^6.0.1","axios":"^1.7.3","commander":"^11.1.0","fs-extra":"^11.2.0","glob":"^10.3.10","inquirer":"8.2.6","jimp":"^0.22.12","jsqr":"1.4.0","minimist":"^1.2.8","ora":"5.4.1","qrcode":"^1.5.3","qrcode-terminal":"^0.12.0","string-width":"4.2.3","strip-ansi":"6.0.1"},"devDependencies":{"babel-loader":"^9.1.3","babel-minify-webpack-plugin":"^0.3.1","clean-webpack-plugin":"^4.0.0","terser-webpack-plugin":"^5.3.10","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"files":["dist","package.json","README.md"]}')}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",p=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),c=new T(n||[]);return a(i,"_invoke",{value:P(e,r,c)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var d="suspendedStart",v="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,u,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(N([])));E&&E!==r&&i.call(E,u)&&(k=E);var _=x.prototype=b.prototype=Object.create(k);function L(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function r(o,a,c,u){var s=h(e[o],e,a);if("throw"!==s.type){var p=s.arg,f=p.value;return f&&"object"==n(f)&&i.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,u)}),(function(e){r("throw",e,c,u)})):t.resolve(f).then((function(e){p.value=e,c(p)}),(function(e){return r("throw",e,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function P(t,r,n){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(t,r,n);if("normal"===s.type){if(o=n.done?m:v,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function q(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(q,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(i.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,a(_,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,p,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,p,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},L(O.prototype),f(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},L(_),f(_,p,"Generator"),f(_,u,(function(){return this})),f(_,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function i(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function c(e){i(a,n,o,c,u,"next",e)}function u(e){i(a,n,o,c,u,"throw",e)}c(void 0)}))}}var c=r(928),u=r(857),s=r(720),p=r(205),f=new(0,r(858).Command),l=r(937),h=r(938),d=r(522),v=r(593),y=r(538),m=r(60),g=r(425),b=r(890),w=r(85).SUCCEED_CODE,x=r(330);function k(e){return j.apply(this,arguments)}function j(){return j=a(o().mark((function e(t){var n,i,a,f,l,h,d,v,x,k,j,E,_,L,O,P,S,q,I,T,N,D,F,C,G,R,U,A,M,Q,V,B,J=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(J.length>1&&void 0!==J[1])||J[1],i=Date.now(),a=1===t?"preview":"upload",f=c.posix.resolve("","./jgc.config.js"),y.hasJgcConfigFile(f)){e.next=7;break}return e.abrupt("return",console.log("".concat(p.red("请先创建配置文件!"))));case 7:if(l="function"==typeof require?require:r(589),h=l(f),(d=m.checkConfigOptions(h,t)).code===w){e.next=12;break}return e.abrupt("return",console.log(d.err_msg));case 12:if(v=h.appId,x=h.requestToken,k=h.versionName,j=h.entry,E=h.description,(_=y.verifyGameRequiredFilesExist(j)).code===w){e.next=16;break}return e.abrupt("return",console.log(_.err_msg));case 16:return L=u.tmpdir()+c.sep+"jd_game_temp.zip",y.deleteFile(L),O=s("文件压缩").start(),e.prev=19,e.next=22,y.compressDirectory(j,L);case 22:P=e.sent,O.succeed("压缩完成,共"+P/1e3+"KB"),e.next=30;break;case 26:e.prev=26,e.t0=e.catch(19),O.fail("压缩失败:",e.t0),process.exit(1);case 30:return O.start(),O.text="上传中",S=new g(n?"prod":"dev"),e.prev=34,e.next=37,S.uploadProject({sourceFile:L,appId:v,requestToken:x,isProd:n});case 37:if((q=e.sent).code!==w&&(O.fail(q.err_msg),process.exit(1)),I=q.packId,O.succeed("上传完成,packId:".concat(I)),"preview"!==a){e.next=57;break}return e.next=44,S.generateQrCode({packId:I,appId:v,requestToken:x});case 44:return(T=e.sent).code!==w&&(O.fail(T.err_msg),process.exit(1)),N=T.imgUrl,D=T.expiredTime,e.next=49,b.showQrCode(N);case 49:O.succeed("二维码生成完成,将于".concat(D,"过期")),O.info("二维码imgUrl(如二维码不清晰,浏览器打开): ".concat(N)),O.info("二维码仅支持协作成员访问"),F=Date.now(),C=(F-i)/1e3,O.info("本次耗费时长:".concat(C,"s")),e.next=82;break;case 57:if("upload"!==a){e.next=82;break}return O.start(),e.next=61,S.commitDevVersion({appId:v,requestToken:x,versionName:k,description:E},I);case 61:return(G=e.sent).code!==w&&(O.fail(G.err_msg),process.exit(1)),R=G.devId,O.succeed("开发版设置完成, devId:"+R),e.next=67,S.setDevExperience({appId:v,requestToken:x},R);case 67:return(U=e.sent).code!==w&&(O.fail(U.err_msg),process.exit(1)),O.succeed("体验版设置完成"),e.next=72,S.queryExperienceQrcodeByPackId({appId:v,requestToken:x});case 72:return(A=e.sent).code!==w&&(O.fail(A.err_msg),process.exit(1)),M=A.imgUrl,Q=A.expiredTime,e.next=77,b.showQrCode(M);case 77:O.info("二维码仅支持协作成员访问"),O.succeed("二维码生成完成,将于".concat(Q,"过期")),V=Date.now(),B=(V-i)/1e3,O.info("本次耗费时长:".concat(B,"s"));case 82:e.next=88;break;case 84:e.prev=84,e.t1=e.catch(34),O.fail("CLI执行报错 --\x3e".concat(e.t1)),process.exit(1);case 88:case"end":return e.stop()}}),e,null,[[19,26],[34,84]])}))),j.apply(this,arguments)}function E(e){return _.apply(this,arguments)}function _(){return(_=a(o().mark((function e(t){var n,i,a,f,h,d,b,x,k,j,E,_,L,O,P,S,q,I,T;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new v).getPrompts(),e.next=3,l.prompt(n);case 3:if(i=e.sent,a=Date.now(),f=c.posix.resolve("","./jgc.config.js"),y.hasJgcConfigFile(f)){e.next=9;break}return e.abrupt("return",console.log("".concat(p.red("请先创建配置文件!"))));case 9:if(h="function"==typeof require?require:r(589),d=h(f),(b=m.checkPluginConfig(d)).code===w){e.next=14;break}return e.abrupt("return",console.log(b.err_msg));case 14:return x=d.appId,k=d.requestToken,j=d.versionName,E=d.entry,_=u.tmpdir()+c.sep+"jd_game_temp.zip",y.deleteFile(_),L=s("文件压缩").start(),e.prev=18,e.next=21,y.compressDirectory(E,_);case 21:O=e.sent,L.succeed("压缩完成,共"+O/1e3+"KB"),e.next=29;break;case 25:e.prev=25,e.t0=e.catch(18),L.fail("压缩失败:",e.t0),process.exit(1);case 29:return P=new g(t),e.prev=30,e.next=33,P.uploadPlugin({sourceFile:_,appId:x,requestToken:k,versionName:j});case 33:if((S=e.sent).code===w){e.next=39;break}L.fail(S.err_msg),process.exit(1),e.next=48;break;case 39:return L.succeed("插件构建成功"),e.next=42,P.publishPlugin({versionName:i.versionName,versionFeature:i.versionFeature,useGuide:i.useGuide,packId:S.result.packId,appId:x,requestToken:k});case 42:(q=e.sent).code!==w&&(L.fail(q.err_msg),process.exit(1)),L.succeed("插件发布成功"),I=Date.now(),T=(I-a)/1e3,L.info("本次耗费时长:".concat(T,"s"));case 48:e.next=54;break;case 50:e.prev=50,e.t1=e.catch(30),L.fail("CLI执行报错 --\x3e".concat(e.t1)),process.exit(1);case 54:case"end":return e.stop()}}),e,null,[[18,25],[30,50]])})))).apply(this,arguments)}return f.command("config").description("小游戏配置").action(a(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=(new d).getPrompts(),e.next=3,l.prompt(t);case 3:if(r=e.sent,(n=y.verifyGameRequiredFilesExist(r.entry,r.type)).code===w){e.next=7;break}return e.abrupt("return",console.log("".concat(p.red(n.err_msg))));case 7:return e.prev=7,y.writeFile("./".concat("jgc.config.js"),"module.exports = ".concat(JSON.stringify(r,null,2)),"utf-8"),e.abrupt("return",console.log("✨ ".concat(p.green("创建小游戏配置文件成功"))));case 13:e.prev=13,e.t0=e.catch(7),console.log("创建小游戏配置文件失败:",e.t0);case 16:case"end":return e.stop()}}),e,null,[[7,13]])})))),f.command("preview").description("小游戏真机预览").option("-D","预发环境").action(function(){var e=a(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=3;break}return console.log("小游戏真机预览-预发环境"),e.abrupt("return",k(1,!1));case 3:return e.abrupt("return",k(1,!0));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("upload").description("小游戏发布").option("-D, --staging","预发环境").action(function(){var e=a(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=3;break}return console.log("小游戏发布-预发环境"),e.abrupt("return",k(2,!1));case 3:return e.abrupt("return",k(2,!0));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("publish").description("插件发布").option("-D, --staging","预发环境").option("-T, --test","测试环境").action(function(){var e=a(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=5;break}return console.log("插件发布-预发环境"),e.abrupt("return",E("dev"));case 5:if(!t.T){e.next=10;break}return console.log("插件发布-测试环境"),e.abrupt("return",E("test"));case 10:return console.log("插件发布-生产环境"),e.abrupt("return",E("prod"));case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.version(x.version,"-v, -V").description("获取本地京东小游戏CLI工具版本"),f.command("latest").description("获取并对比京东小游戏CLI工具最新版本").action(a(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=s("npm最新版本获取中……").start(),e.next=4,h.get("https://registry.npmjs.org/jd-minigame-ci/latest");case 4:r=e.sent,n=r.data.version,i=x.version,t.succeed("最新版本: ".concat(n)),n===i?t.info("当前版本 (".concat(i,") 已是最新版本。")):(t.info("本地版本: ".concat(i)),t.info("请更新到最新版本以获取最新功能和修复。")),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),spinner.fail("获取最新版本信息失败: ".concat(e.t0));case 14:case"end":return e.stop()}}),e,null,[[0,11]])})))),f.parse(process.argv),{}})()));
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(global,(()=>(()=>{var e={85:e=>{e.exports={FAIL_CODE:-1,SUCCEED_CODE:0}},538:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",p=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),c=new T(n||[]);return a(i,"_invoke",{value:P(e,r,c)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var d="suspendedStart",v="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,u,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(N([])));E&&E!==r&&i.call(E,u)&&(k=E);var _=x.prototype=b.prototype=Object.create(k);function L(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function r(o,a,c,u){var s=h(e[o],e,a);if("throw"!==s.type){var p=s.arg,f=p.value;return f&&"object"==n(f)&&i.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,u)}),(function(e){r("throw",e,c,u)})):t.resolve(f).then((function(e){p.value=e,c(p)}),(function(e){return r("throw",e,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function P(t,r,n){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(t,r,n);if("normal"===s.type){if(o=n.done?m:v,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function q(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(q,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(i.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,a(_,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,p,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,p,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},L(O.prototype),f(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},L(_),f(_,p,"Generator"),f(_,u,(function(){return this})),f(_,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function i(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}var a=r(652),c=r(928),u=r(172),s=r(410).globSync;function p(e){try{if(a.pathExistsSync(e))return!0;if(p(c.dirname(e)))return a.mkdirsSync(e),!0}catch(e){console.log("make dir error,",e)}}t.writeFile=function(){var e,t=(e=o().mark((function e(t,r){var n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=i.length>2&&void 0!==i[2]?i[2]:"utf8",p(c.posix.parse(t).dir)&&a.writeFileSync(t,r,n);case 4:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function c(e){i(a,n,o,c,u,"next",e)}function u(e){i(a,n,o,c,u,"throw",e)}c(void 0)}))});return function(e,r){return t.apply(this,arguments)}}(),t.verifyGameRequiredFilesExist=function(e,t){return a.pathExistsSync(e)?"game"===t?f(e):"plugin"===t?l(e):{code:0,err_msg:"ok"}:{code:-1,err_msg:"当前入口文件目录不存在!"}};var f=function(e){var t=s("game.json",{cwd:e,ignore:"node_modules/**"}),r=s("game.js",{cwd:e,ignore:"node_modules/**"});return 0===t.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.json!"}:0===r.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.js!"}:{code:0,err_msg:"ok"}},l=function(e){return 0===s("plugin.json",{cwd:e,ignore:"node_modules/**"}).length?{code:-1,err_msg:"被打包的插件的目录下不存在plugin.json!"}:{code:0,err_msg:"ok"}};t.hasJgcConfigFile=function(e){try{return a.accessSync(e,a.constants.F_OK),!0}catch(e){return console.log("文件不存在"),!1}},t.compressDirectory=function(e,t){return new Promise((function(r,n){var o=a.createWriteStream(t),i=u("zip",{zlib:{level:9}});o.on("close",(function(){return r(i.pointer())})),i.on("warning",(function(e){return"ENOENT"!==e.code&&n(e)})),i.on("error",n),i.pipe(o),i.glob("**/*",{cwd:e,ignore:["**/.*","**/*.js.map"]}),i.finalize()}))},t.deleteFile=function(e){a.existsSync(e)&&a.unlink(e,(function(e){e&&console.log("删除zip文件失败: ",e)}))}},522:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function n(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configPrompts=[{name:"type",type:"list",message:"请选择项目类型:",choices:[{name:"游戏",value:"game"},{name:"插件",value:"plugin"}],default:"game"},{name:"appId",type:"input",message:"请输入appId:",validate:function(e){return!!e||"appId不能为空"}},{name:"requestToken",type:"input",message:"请输入代码上传秘钥:",validate:function(e){return!!e||"代码上传秘钥不能为空"}},{name:"entry",type:"input",message:"请输入需要被打包的游戏(或者插件)的路径:",default:"./"},{name:"versionName",type:"input",message:"请输入需要被打包的游戏(或者插件)的版本号:",when:function(e){return"game"===e.type},default:"1.0.0"},{name:"description",type:"input",message:"请输入需要被打包的游戏的备注:",when:function(e){return"game"===e.type},default:""}]},(t=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=o},593:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function n(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configPrompts=[{name:"versionName",type:"input",message:"版本号:",default:"1.0.0"},{name:"versionFeature",type:"input",message:"版本特性(长度为10~30个字符):",default:""},{name:"useGuide",type:"input",message:"使用指南(仅限文字和代码,长度为20~1000个字符):",default:"插件使用指南不建议在这里填写,建议到小游戏插件MP控制台提审时修改,这里是占位文本"}]},(t=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=o},890:(e,t,r)=>{var n=r(420),o=r(241),i=r(268);t.showQrCode=function(e){return new Promise((function(t,r){n.read(e).then((function(e){var r=e.bitmap,n=r.width,a=r.height,c=r.data,u=new Uint8ClampedArray(c),s=i(u,n,a);o.generate(s.data,{small:!1}),t(!0)})).catch((function(e){r(!1)}))}))},t.getBase64=function(e){return n.read(e).then((function(e){return e.getBase64Async("image/png")})).catch((function(){throw new Error("获取二维码base64失败")}))}},425:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return(t=f(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */c=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",p=a.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new T(n||[]);return i(a,"_invoke",{value:P(e,r,c)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var d="suspendedStart",v="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,u,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(N([])));E&&E!==r&&o.call(E,u)&&(k=E);var _=x.prototype=b.prototype=Object.create(k);function L(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function r(i,a,c,u){var s=h(e[i],e,a);if("throw"!==s.type){var p=s.arg,f=p.value;return f&&"object"==n(f)&&o.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,u)}),(function(e){r("throw",e,c,u)})):t.resolve(f).then((function(e){p.value=e,c(p)}),(function(e){return r("throw",e,c,u)}))}u(s.arg)}var a;i(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function P(t,r,n){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(t,r,n);if("normal"===s.type){if(o=n.done?m:v,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function q(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(q,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(o.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,i(_,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,p,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,p,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},L(O.prototype),f(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},L(_),f(_,p,"Generator"),f(_,u,(function(){return this})),f(_,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function u(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){u(i,n,o,a,c,"next",e)}function c(e){u(i,n,o,a,c,"throw",e)}a(void 0)}))}}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function f(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var l=r(938),h=r(305),d=r(652),v=r(85),y=v.FAIL_CODE,m=v.SUCCEED_CODE,g=(r(60).checkConfigOptions,{dev:"http://beta-vapp-ide.jd.com",prod:"https://vapp-ide-pack.jd.com",test:"http://test-vapp-ide.jdtest.net"}),b=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"prod";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.URL=g[t]},t=[{key:"uploadProject",value:(E=s(c().mark((function e(t){var r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.pack(t);case 3:if((r=e.sent).code===m){e.next=6;break}return e.abrupt("return",r);case 6:return n=r.data.result,e.next=9,this.loopQuery(t,n);case 9:if((o=e.sent).code===m){e.next=12;break}return e.abrupt("return",o);case 12:return e.abrupt("return",{code:m,packId:o.data});case 15:return e.prev=15,e.t0=e.catch(0),e.abrupt("return",{code:y,err_msg:e.t0 instanceof Error?e.t0.message:"上传失败"});case 18:case"end":return e.stop()}}),e,this,[[0,15]])}))),function(e){return E.apply(this,arguments)})},{key:"sendPostRequest",value:(j=s(c().mark((function e(t,r){var n,o,a,u,s=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(a in n=s.length>2&&void 0!==s[2]?s[2]:"请求失败",o=new h,r)o.append(a,r[a]);return e.prev=3,e.next=6,l.post(t,o,{headers:i({},o.getHeaders())});case 6:if((u=e.sent).data.code!==m){e.next=9;break}return e.abrupt("return",{code:m,data:u.data});case 9:return e.abrupt("return",{code:y,err_msg:"".concat(n,": ").concat(u.data.errorMessage)});case 12:return e.prev=12,e.t0=e.catch(3),e.abrupt("return",{code:y,err_msg:"".concat(n,": ").concat(e.t0)});case 15:case"end":return e.stop()}}),e,null,[[3,12]])}))),function(e,t){return j.apply(this,arguments)})},{key:"pluginPublishRequest",value:(k=s(c().mark((function e(t,r,n,o){var i,a,u,s,p=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=p.length>4&&void 0!==p[4]?p[4]:"请求失败",a=JSON.stringify(r),u={method:"post",maxBodyLength:1/0,url:"".concat(t,"?appId=").concat(n,"&requestToken=").concat(o),headers:{"Content-Type":"application/json"},data:a},e.prev=3,e.next=6,l.request(u);case 6:if((s=e.sent).data.code!==m){e.next=9;break}return e.abrupt("return",{code:m,data:s.data});case 9:return e.abrupt("return",{code:y,err_msg:"".concat(i,": ").concat(s.data.errorMessage)});case 12:return e.prev=12,e.t0=e.catch(3),e.abrupt("return",{code:y,err_msg:"".concat(i,": ").concat(e.t0)});case 15:case"end":return e.stop()}}),e,null,[[3,12]])}))),function(e,t,r,n){return k.apply(this,arguments)})},{key:"pack",value:(x=s(c().mark((function e(t){var r,n,o,i,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sourceFile,n=t.appId,o=t.requestToken,i="".concat(this.URL,"/v1/devops/pack"),a={appId:n,requestToken:o,sourceFile:d.createReadStream(r)},e.abrupt("return",this.sendPostRequest(i,a,"文件上传报错"));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"loopQuery",value:(w=s(c().mark((function e(t,r){var n,o,i,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Date.now(),o=2e6,i=3e3;case 3:if(!(Date.now()-n<o)){e.next=15;break}return e.next=6,new Promise((function(e){return setTimeout(e,i)}));case 6:return e.next=8,this.queryPkgId(t,r);case 8:if((a=e.sent).code===m){e.next=11;break}return e.abrupt("return",{code:y,err_msg:a.err_msg});case 11:if(!a.data.result){e.next=13;break}return e.abrupt("return",{code:m,data:a.data.result});case 13:e.next=3;break;case 15:return e.abrupt("return",{code:y,err_msg:"查询超时"});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"queryPkgId",value:(b=s(c().mark((function e(t,r){var n,o,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,i={appId:n,requestToken:o,uuid:r},e.abrupt("return",this.sendPostRequest("".concat(this.URL,"/v1/ci/queryPackIdByUuid"),i,"获取构建包id失效"));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"generateQrCode",value:(v=s(c().mark((function e(t){var r,n,o,i,a,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.packId,i={appId:r,requestToken:n,packId:o},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryQrcodeByPackId"),i,"获取二维码失效");case 4:if((a=e.sent).code===m){e.next=7;break}return e.abrupt("return",{code:y,err_msg:a.err_msg});case 7:if(!a.data.result){e.next=13;break}return(u=new Date).setMinutes(u.getMinutes()+25),e.abrupt("return",{code:m,imgUrl:a.data.result,expiredTime:"".concat(this.addZeroForShort(u.getHours()),":").concat(this.addZeroForShort(u.getMinutes()))});case 13:return e.abrupt("return",{code:y,err_msg:"二维码生成完成请求返回为空"});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"addZeroForShort",value:function(e){return String(e).length<2?"0".concat(String(e)):String(e)}},{key:"commitDevVersion",value:(f=s(c().mark((function e(t,r){var n,o,i,a,u,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,i=t.versionName,a=t.description,u={packId:r,appId:n,requestToken:o,versionName:i,description:a},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/commitDevVersion"),u,"设置为开发版失效");case 4:if((s=e.sent).code===m){e.next=7;break}return e.abrupt("return",s);case 7:return e.abrupt("return",{code:m,devId:s.data.result});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"setDevExperience",value:(u=s(c().mark((function e(t,r){var n,o,i,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,i={appId:n,requestToken:o,devId:r},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/devExperience"),i,"设置为体验版失效");case 4:if((a=e.sent).code===m){e.next=7;break}return e.abrupt("return",a);case 7:return e.abrupt("return",{code:m});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"queryExperienceQrcodeByPackId",value:(a=s(c().mark((function e(t){var r,n,o,i,a,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o={appId:r,requestToken:n},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryExperienceQrcode"),o,"获取体验二维码失效");case 4:if((i=e.sent).code===m){e.next=7;break}return e.abrupt("return",{code:y,err_msg:i.err_msg});case 7:return a=i.data.result,(u=new Date).setMinutes(u.getMinutes()+25),e.abrupt("return",{code:m,imgUrl:a,expiredTime:"".concat(this.addZeroForShort(u.getHours()),":").concat(this.addZeroForShort(u.getMinutes()))});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"uploadPlugin",value:(o=s(c().mark((function e(t){var r,n,o,i,a,u,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sourceFile,n=t.appId,o=t.requestToken,i=t.versionName,a="".concat(this.URL,"/v1/ci/pluginPack"),u={appId:n,requestToken:o,versionName:i,sourceFile:d.createReadStream(r)},e.next=6,this.sendPostRequest(a,u,"插件构建报错");case 6:if((s=e.sent).code===m){e.next=9;break}return e.abrupt("return",{code:y,err_msg:s.err_msg});case 9:return e.abrupt("return",{code:m,result:s.data.result});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"publishPlugin",value:(n=s(c().mark((function e(t){var r,n,o,i,a,u,s,p,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.versionName,n=t.versionFeature,o=t.useGuide,i=t.packId,a=t.appId,u=t.requestToken,s="".concat(this.URL,"/v1/ci/plugin-dev"),p={versionName:r,versionFeature:n,useGuide:o,packId:i},e.next=6,this.pluginPublishRequest(s,p,a,u,"插件上传报错");case 6:if((f=e.sent).code===m){e.next=9;break}return e.abrupt("return",{code:y,err_msg:f.err_msg});case 9:return e.abrupt("return",{code:m});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})}],t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,n,o,a,u,f,v,b,w,x,k,j,E}();e.exports=b},60:(e,t)=>{function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e){return"string"==typeof e&&!!e.trim()}t.checkConfigOptions=function(e,t){var n=e||{},i=n.type,a=n.appId,c=n.requestToken,u=n.entry,s=n.versionName,p=n.description;if("game"!==i)return{code:-1,err_msg:"请选择项目构建类型为小游戏"};for(var f=1===t?{appId:a,requestToken:c,entry:u}:{appId:a,requestToken:c,entry:u,versionName:s,description:p},l=0,h=Object.entries(f);l<h.length;l++){var d=r(h[l],2),v=d[0];if(!o(d[1]))return{code:-1,err_msg:"".concat(v," 不能为空")}}return{code:0,err_msg:"ok"}},t.checkPluginConfig=function(e){var t=e||{},n=t.type,i=t.appId,a=t.requestToken,c=t.entry,u=t.versionName;if("plugin"!==n)return{code:-1,err_msg:"请选择项目构建类型为插件"};for(var s={appId:i,requestToken:a,entry:c,versionName:u},p=0,f=Object.entries(s);p<f.length;p++){var l=r(f[p],2),h=l[0];if(!o(l[1]))return{code:-1,err_msg:"".concat(h," 不能为空")}}return{code:0,err_msg:"ok"}}},589:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=589,e.exports=t},172:e=>{"use strict";e.exports=require("archiver")},938:e=>{"use strict";e.exports=require("axios")},858:e=>{"use strict";e.exports=require("commander")},305:e=>{"use strict";e.exports=require("form-data")},652:e=>{"use strict";e.exports=require("fs-extra")},410:e=>{"use strict";e.exports=require("glob")},937:e=>{"use strict";e.exports=require("inquirer")},420:e=>{"use strict";e.exports=require("jimp")},268:e=>{"use strict";e.exports=require("jsqr")},720:e=>{"use strict";e.exports=require("ora")},205:e=>{"use strict";e.exports=require("picocolors")},241:e=>{"use strict";e.exports=require("qrcode-terminal")},857:e=>{"use strict";e.exports=require("os")},928:e=>{"use strict";e.exports=require("path")},330:e=>{"use strict";e.exports=JSON.parse('{"name":"jd-minigame-ci","version":"0.4.2","description":"The jd-minigame-ci is a toolkit provided for developers of JD Mini Games. Developers can complete code upload and preview operations for JD Mini Games without the need to open the developer tools, simply by using this toolkit.","author":"chenlong328","license":"ISC","main":"dist/index.js","bin":{"jgc":"./dist/jgc.js"},"scripts":{"config":"NODE_ENV=development node ./dist/jgc.js config","preview":"NODE_ENV=development node ./dist/jgc.js preview","dev:config":"NODE_ENV=development node ./src/jgc.js config","dev:preview":"NODE_ENV=development node ./src/jgc.js preview","dev:upload":"NODE_ENV=development node ./src/jgc.js upload","dev:publish":"NODE_ENV=development node ./src/jgc.js publish","build":"webpack --mode production --progress --config webpack.config.js && chmod 777 ./dist/index.js && chmod 777 ./dist/jgc.js"},"dependencies":{"@babel/cli":"^7.23.9","@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","archiver":"^6.0.1","axios":"^1.7.3","commander":"^11.1.0","fs-extra":"^11.2.0","glob":"^10.3.10","inquirer":"8.2.6","jimp":"^0.22.12","jsqr":"1.4.0","minimist":"^1.2.8","ora":"5.4.1","qrcode":"^1.5.3","qrcode-terminal":"^0.12.0","string-width":"4.2.3","strip-ansi":"6.0.1"},"devDependencies":{"babel-loader":"^9.1.3","babel-minify-webpack-plugin":"^0.3.1","clean-webpack-plugin":"^4.0.0","terser-webpack-plugin":"^5.3.10","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"files":["dist","package.json","README.md"]}')}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",p=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),c=new T(n||[]);return a(i,"_invoke",{value:P(e,r,c)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var d="suspendedStart",v="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,u,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(N([])));E&&E!==r&&i.call(E,u)&&(k=E);var _=x.prototype=b.prototype=Object.create(k);function L(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function r(o,a,c,u){var s=h(e[o],e,a);if("throw"!==s.type){var p=s.arg,f=p.value;return f&&"object"==n(f)&&i.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,u)}),(function(e){r("throw",e,c,u)})):t.resolve(f).then((function(e){p.value=e,c(p)}),(function(e){return r("throw",e,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function P(t,r,n){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(t,r,n);if("normal"===s.type){if(o=n.done?m:v,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function q(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(q,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(i.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,a(_,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,p,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,p,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},L(O.prototype),f(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},L(_),f(_,p,"Generator"),f(_,u,(function(){return this})),f(_,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function i(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function c(e){i(a,n,o,c,u,"next",e)}function u(e){i(a,n,o,c,u,"throw",e)}c(void 0)}))}}var c=r(928),u=r(857),s=r(720),p=r(205),f=new(0,r(858).Command),l=r(937),h=r(938),d=r(522),v=r(593),y=r(538),m=r(60),g=r(425),b=r(890),w=r(85).SUCCEED_CODE,x=r(330);function k(e){return j.apply(this,arguments)}function j(){return j=a(o().mark((function e(t){var n,i,a,f,l,h,d,v,x,k,j,E,_,L,O,P,S,q,I,T,N,D,F,C,G,R,U,A,M,Q,V,B,J=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(J.length>1&&void 0!==J[1])||J[1],i=Date.now(),a=1===t?"preview":"upload",f=c.posix.resolve("","./jgc.config.js"),y.hasJgcConfigFile(f)){e.next=7;break}return e.abrupt("return",console.log("".concat(p.red("请先创建配置文件!"))));case 7:if(l="function"==typeof require?require:r(589),h=l(f),(d=m.checkConfigOptions(h,t)).code===w){e.next=12;break}return e.abrupt("return",console.log(d.err_msg));case 12:if(v=h.appId,x=h.requestToken,k=h.versionName,j=h.entry,E=h.description,(_=y.verifyGameRequiredFilesExist(j)).code===w){e.next=16;break}return e.abrupt("return",console.log(_.err_msg));case 16:return L=u.tmpdir()+c.sep+"jd_game_temp.zip",y.deleteFile(L),O=s("文件压缩").start(),e.prev=19,e.next=22,y.compressDirectory(j,L);case 22:P=e.sent,O.succeed("压缩完成,共"+P/1e3+"KB"),e.next=30;break;case 26:e.prev=26,e.t0=e.catch(19),O.fail("压缩失败:",e.t0),process.exit(1);case 30:return O.start(),O.text="上传中",S=new g(n?"prod":"dev"),e.prev=34,e.next=37,S.uploadProject({sourceFile:L,appId:v,requestToken:x,isProd:n});case 37:if((q=e.sent).code!==w&&(O.fail(q.err_msg),process.exit(1)),I=q.packId,O.succeed("上传完成,packId:".concat(I)),"preview"!==a){e.next=57;break}return e.next=44,S.generateQrCode({packId:I,appId:v,requestToken:x});case 44:return(T=e.sent).code!==w&&(O.fail(T.err_msg),process.exit(1)),N=T.imgUrl,D=T.expiredTime,e.next=49,b.showQrCode(N);case 49:O.succeed("二维码生成完成,将于".concat(D,"过期")),O.info("二维码imgUrl(如二维码不清晰,浏览器打开): ".concat(N)),O.info("二维码仅支持协作成员访问"),F=Date.now(),C=(F-i)/1e3,O.info("本次耗费时长:".concat(C,"s")),e.next=82;break;case 57:if("upload"!==a){e.next=82;break}return O.start(),e.next=61,S.commitDevVersion({appId:v,requestToken:x,versionName:k,description:E},I);case 61:return(G=e.sent).code!==w&&(O.fail(G.err_msg),process.exit(1)),R=G.devId,O.succeed("开发版设置完成, devId:"+R),e.next=67,S.setDevExperience({appId:v,requestToken:x},R);case 67:return(U=e.sent).code!==w&&(O.fail(U.err_msg),process.exit(1)),O.succeed("体验版设置完成"),e.next=72,S.queryExperienceQrcodeByPackId({appId:v,requestToken:x});case 72:return(A=e.sent).code!==w&&(O.fail(A.err_msg),process.exit(1)),M=A.imgUrl,Q=A.expiredTime,e.next=77,b.showQrCode(M);case 77:O.info("二维码仅支持协作成员访问"),O.succeed("二维码生成完成,将于".concat(Q,"过期")),V=Date.now(),B=(V-i)/1e3,O.info("本次耗费时长:".concat(B,"s"));case 82:e.next=88;break;case 84:e.prev=84,e.t1=e.catch(34),O.fail("CLI执行报错 --\x3e".concat(e.t1)),process.exit(1);case 88:case"end":return e.stop()}}),e,null,[[19,26],[34,84]])}))),j.apply(this,arguments)}function E(e){return _.apply(this,arguments)}function _(){return(_=a(o().mark((function e(t){var n,i,a,f,h,d,b,x,k,j,E,_,L,O,P,S,q,I,T;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new v).getPrompts(),e.next=3,l.prompt(n);case 3:if(i=e.sent,a=Date.now(),f=c.posix.resolve("","./jgc.config.js"),y.hasJgcConfigFile(f)){e.next=9;break}return e.abrupt("return",console.log("".concat(p.red("请先创建配置文件!"))));case 9:if(h="function"==typeof require?require:r(589),d=h(f),(b=m.checkPluginConfig(d)).code===w){e.next=14;break}return e.abrupt("return",console.log(b.err_msg));case 14:return x=d.appId,k=d.requestToken,j=d.versionName,E=d.entry,_=u.tmpdir()+c.sep+"jd_game_temp.zip",y.deleteFile(_),L=s("文件压缩").start(),e.prev=18,e.next=21,y.compressDirectory(E,_);case 21:O=e.sent,L.succeed("压缩完成,共"+O/1e3+"KB"),e.next=29;break;case 25:e.prev=25,e.t0=e.catch(18),L.fail("压缩失败:",e.t0),process.exit(1);case 29:return P=new g(t),e.prev=30,e.next=33,P.uploadPlugin({sourceFile:_,appId:x,requestToken:k,versionName:j});case 33:if((S=e.sent).code===w){e.next=39;break}L.fail(S.err_msg),process.exit(1),e.next=48;break;case 39:return L.succeed("插件构建成功"),e.next=42,P.publishPlugin({versionName:i.versionName,versionFeature:i.versionFeature,useGuide:i.useGuide,packId:S.result.packId,appId:x,requestToken:k});case 42:(q=e.sent).code!==w&&(L.fail(q.err_msg),process.exit(1)),L.succeed("插件发布成功"),I=Date.now(),T=(I-a)/1e3,L.info("本次耗费时长:".concat(T,"s"));case 48:e.next=54;break;case 50:e.prev=50,e.t1=e.catch(30),L.fail("CLI执行报错 --\x3e".concat(e.t1)),process.exit(1);case 54:case"end":return e.stop()}}),e,null,[[18,25],[30,50]])})))).apply(this,arguments)}return f.command("config").description("小游戏配置").action(a(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=(new d).getPrompts(),e.next=3,l.prompt(t);case 3:if(r=e.sent,(n=y.verifyGameRequiredFilesExist(r.entry,r.type)).code===w){e.next=7;break}return e.abrupt("return",console.log("".concat(p.red(n.err_msg))));case 7:return e.prev=7,y.writeFile("./".concat("jgc.config.js"),"module.exports = ".concat(JSON.stringify(r,null,2)),"utf-8"),e.abrupt("return",console.log("✨ ".concat(p.green("创建小游戏配置文件成功"))));case 13:e.prev=13,e.t0=e.catch(7),console.log("创建小游戏配置文件失败:",e.t0);case 16:case"end":return e.stop()}}),e,null,[[7,13]])})))),f.command("preview").description("小游戏真机预览").option("-D","预发环境").action(function(){var e=a(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=3;break}return console.log("小游戏真机预览-预发环境"),e.abrupt("return",k(1,!1));case 3:return e.abrupt("return",k(1,!0));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("upload").description("小游戏发布").option("-D, --staging","预发环境").action(function(){var e=a(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=3;break}return console.log("小游戏发布-预发环境"),e.abrupt("return",k(2,!1));case 3:return e.abrupt("return",k(2,!0));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("publish").description("插件发布").option("-D, --staging","预发环境").option("-T, --test","测试环境").action(function(){var e=a(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=5;break}return console.log("插件发布-预发环境"),e.abrupt("return",E("dev"));case 5:if(!t.T){e.next=10;break}return console.log("插件发布-测试环境"),e.abrupt("return",E("test"));case 10:return console.log("插件发布-生产环境"),e.abrupt("return",E("prod"));case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.version(x.version,"-v, -V").description("获取本地京东小游戏CLI工具版本"),f.command("latest").description("获取并对比京东小游戏CLI工具最新版本").action(a(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=s("npm最新版本获取中……").start(),e.next=4,h.get("https://registry.npmjs.org/jd-minigame-ci/latest");case 4:r=e.sent,n=r.data.version,i=x.version,t.succeed("最新版本: ".concat(n)),n===i?t.info("当前版本 (".concat(i,") 已是最新版本。")):(t.info("本地版本: ".concat(i)),t.info("请更新到最新版本以获取最新功能和修复。")),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),spinner.fail("获取最新版本信息失败: ".concat(e.t0));case 14:case"end":return e.stop()}}),e,null,[[0,11]])})))),f.parse(process.argv),{}})()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jd-minigame-ci",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "The jd-minigame-ci is a toolkit provided for developers of JD Mini Games. Developers can complete code upload and preview operations for JD Mini Games without the need to open the developer tools, simply by using this toolkit.",
|
|
5
5
|
"author": "chenlong328",
|
|
6
6
|
"license": "ISC",
|