UNPKG

fa-toolkit

Version:

a devtool for fast app

1 lines 15.8 kB
"use strict";var _0x211b11=_0x2cb8;function _regeneratorRuntime(){var f=_0x2cb8;_regeneratorRuntime=function(){return u};var u={},r=Object[f(475)],s=r[f(492)],l=Object.defineProperty||function(r,e,t){r[e]=t.value},e=f(507)==typeof Symbol?Symbol:{},o=e[f(535)]||f(541),t=e.asyncIterator||f(436),n=e[f(502)]||f(427);function i(r,e,t){return Object[f(474)](r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{i({},"")}catch(r){i=function(r,e,t){return r[e]=t}}function c(r,e,t,n){var o,a,u,c,s,i=f,e=e&&e[i(475)]instanceof v?e:v,e=Object[i(518)](e[i(475)]),n=new w(n||[]);return l(e,i(532),{value:(o=r,a=t,u=n,s=(c=f)(449),function(r,e){var t=c;if(t(417)===s)throw new Error(t(454));if(t(487)===s){if(t(488)===r)throw e;return O()}for(u[t(521)]=r,u.arg=e;;){var n=u[t(520)];if(n){var i=function r(e,t){var n=f,i=t[n(521)],o=e[n(535)][i];if(void 0===o)return t[n(520)]=null,"throw"===i&&e[n(535)].return&&(t[n(521)]=n(459),t[n(424)]=void 0,r(e,t),n(488)===t[n(521)])||"return"!==i&&(t[n(521)]="throw",t[n(424)]=new TypeError(n(472)+i+n(486))),h;o=p(o,e[n(535)],t[n(424)]);if("throw"===o[n(465)])return t[n(521)]=n(488),t[n(424)]=o[n(424)],t.delegate=null,h;var o=o[n(424)];return o?o[n(446)]?(t[e[n(542)]]=o[n(534)],t[n(496)]=e[n(524)],"return"!==t[n(521)]&&(t[n(521)]=n(496),t.arg=void 0),t[n(520)]=null,h):o:(t[n(521)]=n(488),t[n(424)]=new TypeError(n(419)),t.delegate=null,h)}(n,u);if(i){if(i===h)continue;return i}}if(t(496)===u[t(521)])u[t(464)]=u[t(426)]=u[t(424)];else if(t(488)===u[t(521)]){if(t(449)===s)throw s="completed",u[t(424)];u[t(455)](u[t(424)])}else t(459)===u[t(521)]&&u[t(420)](t(459),u[t(424)]);s="executing";i=p(o,a,u);if(t(514)===i[t(465)]){if(s=u[t(446)]?t(487):"suspendedYield",i[t(424)]===h)continue;return{value:i[t(424)],done:u[t(446)]}}"throw"===i[t(465)]&&(s=t(487),u[t(521)]="throw",u[t(424)]=i.arg)}})}),e}function p(r,e,t){var n=f;try{return{type:"normal",arg:r[n(506)](e,t)}}catch(r){return{type:n(488),arg:r}}}u[f(544)]=c;var h={};function v(){}function a(){}function y(){}var b={};i(b,o,function(){return this});e=Object[f(469)],e=e&&e(e(k([])));e&&e!==r&&s[f(506)](e,o)&&(b=e);var d=y[f(475)]=v[f(475)]=Object[f(518)](b);function g(r){var e=f;[e(496),e(488),e(459)][e(438)](function(e){i(r,e,function(r){return this[_0x2cb8(532)](e,r)})})}function _(u,c){var e,i=f;l(this,i(532),{value:function(t,n){function r(){return new c(function(r,e){!function e(r,t,n,i){var o=_0x2cb8,r=p(u[r],u,t);if(o(488)!==r[o(465)]){var a=r[o(424)],t=a[o(534)];return t&&o(437)==_typeof(t)&&s[o(506)](t,o(481))?c[o(553)](t[o(481)])[o(556)](function(r){e(o(496),r,n,i)},function(r){e("throw",r,n,i)}):c[o(553)](t)[o(556)](function(r){a[o(534)]=r,n(a)},function(r){return e(o(488),r,n,i)})}i(r[o(424)])}(t,n,r,e)})}return e=e?e[i(556)](r,r):r()}})}function m(r){var e=f,t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t[e(491)]=r[2],t[e(477)]=r[3]),this[e(466)][e(460)](t)}function x(r){var e=f,t=r[e(480)]||{};t[e(465)]="normal",delete t[e(424)],r[e(480)]=t}function w(r){var e=f;this[e(466)]=[{tryLoc:e(510)}],r[e(438)](m,this),this[e(512)](!0)}function k(t){var n=f;if(t){var r=t[o];if(r)return r[n(506)](t);if(n(507)==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function r(){for(var e=n;++i<t[e(529)];)if(s.call(t,i))return r[e(534)]=t[i],r.done=!1,r;return r[e(534)]=void 0,r.done=!0,r};return r[n(496)]=r}}return{next:O}}function O(){return{value:void 0,done:!0}}return a[f(475)]=y,l(d,f(479),{value:y,configurable:!0}),l(y,f(479),{value:a,configurable:!0}),a[f(439)]=i(y,n,f(540)),u[f(425)]=function(r){var e=f,r=e(507)==typeof r&&r[e(479)];return!!r&&(r===a||e(540)===(r[e(439)]||r[e(519)]))},u[f(552)]=function(r){var e=f;return Object[e(431)]?Object.setPrototypeOf(r,y):(r.__proto__=y,i(r,n,"GeneratorFunction")),r[e(475)]=Object[e(518)](d),r},u[f(484)]=function(r){return{__await:r}},g(_[f(475)]),i(_[f(475)],t,function(){return this}),u[f(421)]=_,u[f(543)]=function(r,e,t,n,i){var o=f;void 0===i&&(i=Promise);var a=new _(c(r,e,t,n),i);return u[o(425)](e)?a:a[o(496)]()[o(556)](function(r){var e=o;return r[e(446)]?r[e(534)]:a[e(496)]()})},g(d),i(d,n,f(527)),i(d,o,function(){return this}),i(d,f(525),function(){return"[object Generator]"}),u[f(413)]=function(r){var e,n=f,i=Object(r),o=[];for(e in i)o[n(460)](e);return o[n(445)](),function r(){for(var e=n;o[e(529)];){var t=o.pop();if(t in i)return r.value=t,r[e(446)]=!1,r}return r[e(446)]=!0,r}},u[f(485)]=k,w[f(475)]={constructor:w,reset:function(r){var e=f;if(this.prev=0,this.next=0,this[e(464)]=this[e(426)]=void 0,this.done=!1,this.delegate=null,this[e(521)]=e(496),this.arg=void 0,this.tryEntries[e(438)](x),!r)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t[e(494)](1))&&(this[t]=void 0)},stop:function(){var r=f;this[r(446)]=!0;var e=this[r(466)][0][r(480)];if(r(488)===e[r(465)])throw e[r(424)];return this[r(457)]},dispatchException:function(n){var i=f;if(this[i(446)])throw n;var o=this;function r(r,e){var t=i;return a.type="throw",a[t(424)]=n,o[t(496)]=r,e&&(o.method="next",o.arg=void 0),!!e}for(var e=this[i(466)][i(529)]-1;0<=e;--e){var t=this[i(466)][e],a=t[i(480)];if("root"===t[i(551)])return r(i(554));if(t[i(551)]<=this[i(422)]){var u=s[i(506)](t,i(435)),c=s.call(t,i(491));if(u&&c){if(this[i(422)]<t.catchLoc)return r(t[i(435)],!0);if(this[i(422)]<t.finallyLoc)return r(t.finallyLoc)}else if(u){if(this[i(422)]<t[i(435)])return r(t[i(435)],!0)}else{if(!c)throw new Error(i(550));if(this[i(422)]<t[i(491)])return r(t[i(491)])}}}},abrupt:function(r,e){for(var t=f,n=this.tryEntries[t(529)]-1;0<=n;--n){var i=this.tryEntries[n];if(i[t(551)]<=this.prev&&s[t(506)](i,"finallyLoc")&&this[t(422)]<i[t(491)]){var o=i;break}}var a=(o=o&&("break"===r||t(526)===r)&&o[t(551)]<=e&&e<=o[t(491)]?null:o)?o[t(480)]:{};return a[t(465)]=r,a[t(424)]=e,o?(this.method=t(496),this[t(496)]=o[t(491)],h):this.complete(a)},complete:function(r,e){var t=f;if("throw"===r[t(465)])throw r[t(424)];return"break"===r[t(465)]||"continue"===r[t(465)]?this[t(496)]=r[t(424)]:t(459)===r[t(465)]?(this[t(457)]=this[t(424)]=r[t(424)],this[t(521)]=t(459),this[t(496)]=t(554)):"normal"===r.type&&e&&(this.next=e),h},finish:function(r){for(var e=f,t=this[e(466)][e(529)]-1;0<=t;--t){var n=this.tryEntries[t];if(n[e(491)]===r)return this[e(536)](n[e(480)],n[e(477)]),x(n),h}},catch:function(r){for(var e=f,t=this[e(466)][e(529)]-1;0<=t;--t){var n=this[e(466)][t];if(n.tryLoc===r){var i,o=n.completion;return"throw"===o[e(465)]&&(i=o[e(424)],x(n)),i}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,t){var n=f;return this[n(520)]={iterator:k(r),resultName:e,nextLoc:t},n(496)===this[n(521)]&&(this.arg=void 0),h}},u}function _defineProperty(r,e,t){return(e=_toPropertyKey(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _toPropertyKey(r){var e=_0x2cb8,r=_toPrimitive(r,"string");return _typeof(r)===e(537)?r:String(r)}function _toPrimitive(r,e){var t=_0x2cb8;if("object"!==_typeof(r)||null===r)return r;var n=r[Symbol.toPrimitive];if(void 0===n)return(e===t(440)?String:Number)(r);e=n[t(506)](r,e||t(434));if(_typeof(e)!==t(437))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}function _typeof(r){var t=_0x2cb8;return(_typeof=t(507)==typeof Symbol&&t(537)==typeof Symbol[t(535)]?function(r){return typeof r}:function(r){var e=t;return r&&e(507)==typeof Symbol&&r[e(479)]===Symbol&&r!==Symbol.prototype?e(537):typeof r})(r)}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError(_0x2cb8(482))}function _unsupportedIterableToArray(r,e){var t=_0x2cb8;if(r){if(typeof r===t(440))return _arrayLikeToArray(r,e);var n=Object[t(475)][t(525)][t(506)](r)[t(494)](8,-1);return(n=n===t(478)&&r[t(479)]?r[t(479)][t(519)]:n)===t(499)||n===t(528)?Array.from(r):n===t(462)||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(r,e):void 0}}function _0x2cb8(r,e){var t=_0x51eb();return(_0x2cb8=function(r,e){return t[r-=413]})(r,e)}function _arrayLikeToArray(r,e){(null==e||e>r.length)&&(e=r[_0x2cb8(529)]);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function _iterableToArrayLimit(r,e){var t=_0x2cb8,n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol[t(535)]]||r["@@iterator"];if(null!=n){var i,o,a,u,c=[],s=!0,f=!1;try{if(a=(n=n[t(506)](r))[t(496)],0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(i=a.call(n))[t(446)])&&(c[t(460)](i[t(534)]),c[t(529)]!==e);s=!0);}catch(r){f=!0,o=r}finally{try{if(!s&&null!=n[t(459)]&&(u=n[t(459)](),Object(u)!==u))return}finally{if(f)throw o}}return c}}function _arrayWithHoles(r){if(Array[_0x2cb8(508)](r))return r}function asyncGeneratorStep(r,e,t,n,i,o,a){var u=_0x2cb8;try{var c=r[o](a),s=c[u(534)]}catch(r){return void t(r)}c[u(446)]?e(s):Promise[u(553)](s)[u(556)](n,i)}function _asyncToGenerator(c){return function(){var r=this,u=arguments;return new Promise(function(e,t){var n=_0x2cb8,i=c[n(504)](r,u);function o(r){asyncGeneratorStep(i,e,t,o,a,n(496),r)}function a(r){asyncGeneratorStep(i,e,t,o,a,n(488),r)}o(void 0)})}}!function(){for(var r=_0x2cb8,e=_0x51eb();;)try{if(215513==-parseInt(r(538))+-parseInt(r(548))/2+parseInt(r(547))/3+parseInt(r(429))/4+parseInt(r(470))/5*(parseInt(r(432))/6)+-parseInt(r(433))/7+-parseInt(r(509))/8)break;e.push(e.shift())}catch(r){e.push(e.shift())}}();var path=require(_0x211b11(461)),fs=require("fs"),signUtils=require("../../sign-tools/rpk-sign-utils"),checkExtJson=require(_0x211b11(441)),_require=require("./repack-template-beta"),betaRpkHandler=_require.betaRpkHandler,rpkOutPath="",distPath="",replaceName=[_0x211b11(495),"name",_0x211b11(498),_0x211b11(497),_0x211b11(555),"global","tabBar",_0x211b11(505),_0x211b11(463)];function repackTemplate(r,e,t){var n=_0x211b11;if(void 0!==t&&t!==n(444)&&t!==n(530))throw new Error(n(493));var i=path.join(r,"ext.json"),o=path[n(515)](r,"build",n(415)),a=path[n(515)](r,"build","ext.json");if(distPath=path.join(r,n(483)),!fs.existsSync(i)||!fs[n(513)](o))throw n(467);var u,c=JSON.parse(fs.readFileSync(o)[n(525)]()),s=JSON[n(490)](fs[n(448)](i)[n(525)]()),f=s[n(545)];if(!s||!0!==s[n(416)])throw n(533);checkExtJson([f,i]),u=f[n(423)]||{},handleDeprecated(r,c,c=replaceManifest(f,c)),fs.writeFileSync(a,JSON.stringify(u,null,"\t")),fs.writeFileSync(o,JSON.stringify(c,null,"\t")),repackRpk(r,e,c,t)}function deleteResourceRecursive(r,t){var n=_0x211b11;[n(473),n(531)][n(438)](function(r){var e=n,r=""[e(418)](t,".")[e(418)](r);fs[e(513)](r)&&fs.unlinkSync(r)}),fs[n(513)](r)&&0==fs[n(450)](r)[n(529)]&&fs[n(414)](r)}function handleDeprecated(r,e,t){var n,i=_0x211b11,e=e[i(442)][i(430)],o=t[i(442)][i(430)],a=[];for(n in e)Object[i(475)].hasOwnProperty[i(506)](o,n)||a[i(460)](n);var u=path.join(r,i(471));a[i(438)](function(r){var e=i,t=path[e(515)](u,r);deleteResourceRecursive(path[e(515)](u,r[e(453)](/\/[^\/]*$/,"")),t)})}function repackRpk(r,e,t,n){return _repackRpk[_0x211b11(504)](this,arguments)}function _repackRpk(){var e=_0x211b11;return(_repackRpk=_asyncToGenerator(_regeneratorRuntime()[e(552)](function r(t,n,i,o){var a,u,c,s,f,l,p=e;return _regeneratorRuntime()[p(544)](function(r){for(var e=p;;)switch(r[e(422)]=r.next){case 0:return a=path.join(t,"build"),f=n,r[e(496)]=4,signUtils[e(452)](null,null,null,f);case 4:return u=r[e(464)],c=i[e(495)],i.versionName,s=signUtils[e(458)](a),l=signUtils.generatePkgDef([]),f=l[e(447)],l=l.subPkgs,signUtils.addResourceToPkg(s,a,f,l),r[e(496)]=11,signUtils[e(539)](c,u,f,l);case 11:l=r[e(464)],l=l[e(428)],fs.existsSync(distPath)||fs[e(523)](distPath),rpkOutPath=path.join(distPath,""[e(418)](c,e(516))),fs[e(451)](rpkOutPath,l),o==e(530)&&betaRpkHandler(distPath,i,u);case 17:case e(554):return r[e(517)]()}},r)})))[e(504)](this,arguments)}function replaceManifest(r,e){var t=_0x211b11,n=JSON[t(490)](JSON[t(546)](e)),e=JSON[t(490)](JSON.stringify(r));return n[t(522)]="release",n=createPages(e,n),Object[t(456)](e,{global:{window:r[t(463)]||{}}}),n=mergeDeep(n,e=Object.fromEntries(Object[t(443)](e)[t(489)](function(r){var e=t,r=_slicedToArray(r,1)[0];return-1<replaceName[e(503)](r)})))}function _0x51eb(){var r=["path","Arguments","window","sent","type","tryEntries","The ext.json file does not exist in the rootpath directory.","subpackages","getPrototypeOf","5Bkerhp","build","The iterator does not provide a '","html","defineProperty","prototype","independentList","afterLoc","Object","constructor","completion","__await","Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.","dist","awrap","values","' method","completed","throw","filter","parse","finallyLoc","hasOwnProperty","Invalid argument.","slice","package","next","versionCode","versionName","Map","key of 'pages' cannot contain empty value in ext.json.","pkg","toStringTag","indexOf","apply","permission","call","function","isArray","2600760OZrGfz","root","independent","reset","existsSync","normal","join",".rpk","stop","create","name","delegate","method","versionType","mkdirSync","nextLoc","toString","continue","Generator","Set","length","beta","pack.js","_invoke","The extEnable value is invalid. Only Boolean values are supported.","value","iterator","complete","symbol","50940JZiAjU","signPkgs","GeneratorFunction","@@iterator","resultName","async","wrap","appConfig","stringify","744678TJqTXX","604670wIoHxC","argv","try statement without catch or finally","tryLoc","mark","resolve","end","minPlatformVersion","then","keys","rmdirSync","manifest.json","extEnable","executing","concat","iterator result is not an object","abrupt","AsyncIterator","prev","ext","arg","isGeneratorFunction","_sent","@@toStringTag","rpkBuffer","1533680Siuvml","pages","setPrototypeOf","2437428QBXFxc","1008007XYwnKe","default","catchLoc","@@asyncIterator","object","forEach","displayName","string","../web-compiler/common/extjson-validator","router","entries","release","reverse","done","mainPkg","readFileSync","suspendedStart","readdirSync","writeFileSync","getSignInfo","replace","Generator is already running","dispatchException","assign","rval","getResources","return","push"];return(_0x51eb=function(){return r})()}function mergeDeep(r,e){var t,n,i=_0x211b11;if(_typeof(r)===i(437)&&_typeof(e)===i(437))for(var o in e)Object[i(475)].hasOwnProperty[i(506)](e,o)&&(t=e[o],(n=r[o])&&_typeof(t)===i(437)&&-1<replaceName[i(503)](o)?mergeDeep(n,t):Object[i(456)](r,_defineProperty({},o,t)));return r}function createPages(r,e){var n=_0x211b11,t=JSON.parse(JSON.stringify(e)),i=[],o=r.pages,e=getSubPackages(r),a=r.extPages||{};if(!o)return extPageIsEmpty(t,a);if(o&&0===o.length)throw new Error(n(500));var i=o[n(418)](e),u=[],c={},s=0,f=[];return i.forEach(function(r){var e=n;if(typeof r===e(440))c[r]=addInfoList(a[r]);else for(var t in r[e(430)])Object.prototype[e(492)].call(r[e(430)],t)&&(s++,t=""[e(418)](r.root,"/")[e(418)](r.pages[t]),c[t]=addInfoList(a[t]),!0===r[e(511)]&&f[e(460)](t),u[e(460)]({resource:r[e(510)],name:r[e(519)]||e(501)[e(418)](s)}))}),t[n(442)][n(430)]=c,0<u.length?t.subpackages=u:delete t[n(468)],0<f[n(529)]?t[n(476)]=f:delete t[n(476)],t}function addInfoList(r){var e={component:""};return e.info=r||{},e}function extPageIsEmpty(r,e){var t,n=_0x211b11,i=JSON[n(490)](JSON[n(546)](r))[n(442)][n(430)],o={},a=Object[n(413)](i);for(t in e)Object[n(475)][n(492)][n(506)](e,t)&&-1<a.indexOf(t)&&Object[n(456)](o,_defineProperty({},t,{info:e[t]}));i=mergeDeep(i,o);return r[n(442)][n(430)]=i,r}function getSubPackages(r){var e=_0x211b11;return r.subPackages||(r[e(468)]?r[e(468)]:[])}var rootPath=process.argv[2],signConfig=JSON[_0x211b11(490)](process[_0x211b11(549)][3]),versionType=process[_0x211b11(549)][4];repackTemplate(rootPath,signConfig,versionType);