mgexcli 1.0.10 → 1.0.11
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/dist/bin/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
package/dist/bin/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";function
|
|
2
|
+
"use strict";function n(n,r){return n-=275,t()[n]}function t(){var n=["5992QutKic","2369750nInhaZ","7mRpCYj","7758970WPxyTh","20835paQKuv","291AVdFoN","1259565gGtMPB","1046628NMBfqn","10058820zYvQJx","1232bRNXWq"];return(t=function(){return n})()}require("../index.js"),function(){for(var r=n,e=t();;)try{if(957849===parseInt(r(282))/1*(parseInt(r(277))/2)+-parseInt(r(283))/3+parseInt(r(284))/4+-parseInt(r(280))/5+-parseInt(r(275))/6*(-parseInt(r(279))/7)+-parseInt(r(276))/8*(-parseInt(r(281))/9)+-parseInt(r(278))/10)break;e.push(e.shift())}catch(n){e.push(e.shift())}}();
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var e=require("tslib"),n=require("commander"),t=require("fs-extra"),o=require("node:path"),r=require("./utils.js");function i(e,n){e-=147;return a()[e]}const s=i;function a(){const e=["149172avWNDH","cleanupTmpDir","27ZeFNxf","parse","--path <path>","1EaVTqO","892899VfsuEj","4116130RsAdqF","SIGINT","readJsonSync","335712FrRLah","version","login","mgexcli","Manage Words CLI","getAppList","../package.json","resolve","8GzSOwr","1871735PtqHmj","1636gNiYND","option","name","deploy","command","authToken","exit","action","SIGTERM","path","download","--authToken <authToken>","56rgtunc","10065418GNuZHu","description"];return(a=function(){return e})()}!function(){const e=i,n=a();for(;;)try{if(260040===-parseInt(e(147))/1*(parseInt(e(177))/2)+parseInt(e(179))/3*(parseInt(e(162))/4)+parseInt(e(161))/5+-parseInt(e(152))/6*(parseInt(e(174))/7)+parseInt(e(160))/8*(-parseInt(e(148))/9)+-parseInt(e(149))/10+parseInt(e(175))/11)break;n.push(n.shift())}catch(e){n.push(n.shift())}}();const c=t[s(151)](o[s(159)](__dirname,s(158))),p=new n.Command;p[s(164)](s(155))[s(176)](s(156))[s(153)](c.version),p[s(166)](s(154))[s(176)](s(154))[s(169)](n=>e.__awaiter(void 0,void 0,void 0,function*(){try{yield r.login(),process.exit(0)}catch(e){process.exit(1)}})),p[s(166)](s(165))[s(176)]("deploy")[s(163)](s(173),s(167))[s(169)](n=>e.__awaiter(void 0,void 0,void 0,function*(){const e=s;yield r[e(157)](n)})),p[s(166)](s(172))[s(176)](s(172))[s(163)](s(181),s(171)).action(n=>e.__awaiter(void 0,void 0,void 0,function*(){const e=s;yield r[e(157)](n,!0)})),p[s(180)](),process.on(s(150),()=>{r[s(178)](),process.exit(0)}),process.on(s(170),()=>{const e=s;r[e(178)](),process[e(168)](0)}),process.on("exit",()=>{r.cleanupTmpDir()});
|
package/dist/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var n=require("tslib"),e=require("node:os"),t=require("node:path"),o=require("fs-extra"),s=require("ora"),r=require("node:http"),i=require("inquirer"),c=require("execa"),a=require("chalk"),l=require("semver");const u=j;var d;!function(){const n=j,e=T();for(;;)try{if(320162===-parseInt(n(373))/1+-parseInt(n(362))/2+-parseInt(n(457))/3*(parseInt(n(427))/4)+parseInt(n(385))/5+parseInt(n(443))/6+parseInt(n(413))/7*(parseInt(n(465))/8)+-parseInt(n(381))/9)break;e.push(e.shift())}catch(n){e.push(e.shift())}}();const p={success:"✔",error:"✖",warning:"⚠",info:"ℹ"},y="1.0.0",g=t[u(450)](e.tmpdir(),u(456)),f=new a.Chalk,h=s(),v="https://ex.roxmotor.top",m=t[u(450)](e.homedir(),u(394)),x=t[u(450)](m,"session.json"),w=null!==(d=process.env.MGEXCLI_COOKIE_NAME)&&void 0!==d?d:u(464);function k(){const n=u;g&&o.pathExistsSync(g)&&o[n(438)](g)}function K(n){const e=u;return n[e(369)](/([a-z])([A-Z])/g,e(446))[e(369)](/([A-Z]+)([A-Z][a-z])/g,"$1 $2")[e(369)](/[-_]/g," ")[e(392)]()[e(369)](/\s+/g," ").trim()}function I(e){return n.__awaiter(this,arguments,void 0,function*({options:n,key:e,defaultValue:t}){const o=j;let s=(null==n?void 0:n[e])||"";if(!s){return s=(yield i[o(395)]([{type:o(409),name:e,default:null!=t?t:".",message:p[o(426)]+" "+f.green(K(e))+f[o(474)](":"),validate:n=>{const t=o;return!(!(null==n?void 0:n.trim())||"."===n)||p.error+" "+f[t(451)](t(364)+e+t(359)+e+t(384))}}]))[e],null==s?void 0:s[o(442)]()}return null==s?void 0:s[o(442)]()})}function _(){const n=u;try{if(!o[n(433)](x))return null;const e=o[n(347)](x);return"string"==typeof(null==e?void 0:e[n(402)])?w+"="+e[n(402)]:null}catch(n){return null}}function b(){return n.__awaiter(this,void 0,void 0,function*(){const t=j,s=yield function(){return n.__awaiter(this,void 0,void 0,function*(){const n=j;var e;try{const t=_();if(!t)return!1;const o=yield fetch(v+n(407),{headers:{cookie:t},credentials:"include"});if(!o.ok)return!1;const s=yield o[n(406)]();return!!(null===(e=null==s?void 0:s.session)||void 0===e?void 0:e[n(452)])&&t}catch(n){return!1}})}();if(s)return s;const i=r[t(400)](),a=yield new Promise(n=>{const e=t;i.listen(0,e(471),()=>{const t=e,o=i[t(441)]();n(typeof o===t(372)&&o?o[t(361)]:0)})}),l=t(404)+a+t(422);try{h[t(360)](f[t(382)][t(474)]("login..."));const s=yield fetch(v+t(434),{method:t(345),headers:{"Content-Type":"application/json"},body:JSON[t(353)]({provider:"github",callbackURL:l,disableRedirect:!0})}),r=yield s.json()[t(475)](()=>({}));if(!s.ok||!(null==r?void 0:r.url))throw new Error((null==r?void 0:r[t(336)])||"HTTP "+s[t(387)]);yield function(t){return n.__awaiter(this,void 0,void 0,function*(){const n=j,o=e[n(431)]();try{o===n(454)?yield c.execa(n(343),[t],{stdio:n(411)}):o===n(351)?yield c.execa("cmd",["/c",n(360),"",t],{stdio:n(411)}):yield c.execa(n(349),[t],{stdio:n(411)})}catch(n){}})}(r.url);const w=yield(d=i,y=a,g=3e5,new Promise(n=>{const e=j;let t,o=!1;const s=e=>{o||(o=!0,t&&clearTimeout(t),n(e))};t=setTimeout(()=>s(null),g),d.on(e(401),(n,t)=>{const o=e;var r;const i=(null!==(r=n[o(473)])&&void 0!==r?r:"/")[o(344)]("?")[0];if(i===o(422)){const n=new URL(o(375),v);return n.searchParams[o(449)]("return","http://localhost:"+y+o(379)),t[o(352)](302,{Location:n.toString()}),void t[o(429)]()}if(i===o(379)){h[o(389)]();let e="";return n.on(o(374),n=>e+=n),void n.on(o(429),()=>{const n=o,r=e[n(442)]()||null;t[n(352)](200,{"Content-Type":"text/plain; charset=utf-8","Access-Control-Allow-Origin":"*"}),t[n(429)](r?"OK":n(412)),s(r)})}t[o(352)](404)[o(429)]("not found")})}));if(!w)throw new Error(t(338));const k=function(n){const e=u,t=n;return o[e(380)](m),o[e(466)](x,{cookie:t,createdAt:(new Date).toISOString()},{spaces:4}),t}(w);return console.log(p[t(421)],f[t(474)](t(435))),k}catch(n){throw h[t(389)](),console[t(472)](p[t(447)],f[t(451)](n[t(336)])),n}finally{i[t(342)]&&i.close()}var d,y,g})}function S(e){return n.__awaiter(this,void 0,void 0,function*(){const n=j;try{const t=_();if(!t){if(yield b())return S(e)}const o=yield fetch(""+v+e,{method:n(332),headers:{cookie:t}});if(!o.ok)throw new Error(n(346)+o[n(387)]);const s=yield o[n(406)]()[n(475)](()=>({}));if(!(null==s?void 0:s.status))throw new Error((null==s?void 0:s[n(336)])||n(419));return null==s?void 0:s[n(374)]}catch(t){if(t[n(336)].includes("Unauthorized"))return function(){const n=u;o[n(433)](x)&&o[n(438)](x)}(),S(e);throw t}})}function j(n,e){n-=330;return T()[n]}function T(){const n=["message","push","login fail.","\n\n> Auto generated i18n language package.\n\n## Installation\n\n```bash\nnpm install ","cwd","path","listening","open","split","POST","HTTP ","readJsonSync","publish version:","xdg-open","version","win32","writeHead","stringify","您还没有创建应用,请先创建应用","MIT","*.json","请选择一个应用","cyan"," option is missing and cannot be empty. please add --","start","port","61562LuSIhH","export { default as ","the ","package name:","publish","./i18n"," i18n language package","replace","package.json","export declare const ","object","242287qVfQaL","data","/api/auth/cli-export","writeFileSync","words","languages.json","/token","ensureDirSync","4023306TnqpMG","bold","*.js"," value.","1289020Orxdch","entries","status","请选择一个应用:","stop","|(string & {});","registry=https://registry.npmjs.org/","toLowerCase","list",".mgexcli","prompt","translation","exit","valid","pkg","createServer","request","cookie","join","http://localhost:",'";\n```\n\nOr use all languages.\n\n```ts\nimport { languages } from "',"json","/api/auth/get-session","name","input","public","ignore","EMPTY","7QDQjCo","never","length","map","inc","|(string & {}), string>;","请求失败",'";\n\nconsole.log(zh.hello);\nconsole.log(en.hello);\n\nconsole.log(languages.zh.hello);\nconsole.log(languages.en.hello);\n```\n\n## Export\n\nEach language exports a JSON object.\n\n```ts\nimport { zh } from "',"success","/callback",'.json";',".json","invalid version number","info","12viXAoo","README.md","end","declare module \"vue-i18n\" {\n type _KnownExKeys = Exclude<I18nKey, string & {}>;\n interface DefineLocaleMessage extends Partial<Record<_KnownExKeys, string>>, Record<string, Record<I18nKey, string>> {}\n interface ComposerTranslation {\n (key: I18nKey, ...args: any[]): string;\n }\n interface Composer {\n tm<Key extends string = I18nKey>(key: Key | I18nKey): any;\n te<Key extends string = I18nKey>(key: Key | I18nKey, locale?: string): boolean;\n }\n interface VueI18n {\n t(key: I18nKey, ...args: any[]): string;\n tm<Key extends string = I18nKey>(key: Key | I18nKey): any;\n te<Key extends string = I18nKey>(key: Key | I18nKey, locale?: string): boolean;\n }\n}\n \ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $t(key: I18nKey, ...args: any[]): string;\n $tm<Key extends string = I18nKey>(key: Key | I18nKey): any;\n $te<Key extends string = I18nKey>(key: Key | I18nKey, locale?: string): boolean;\n }\n}","platform","export declare const languages: Record<","pathExistsSync","/api/auth/sign-in/social","login success.","next version:",' } from "./',"removeSync","view",": Record<I18nKey, string>;","address","trim","3533088GXoZQQ","./index.js","正在获取应用列表...","$1 $2","error","ensureFileSync","set","resolve","red","token",'\n```\n\n## Usage\n\n```ts\nimport { zh, en, languages } from "',"darwin","...",".mgexcli_tmp","218463BQYVHM","npm","index.js","index.d.ts","--access","./index.d.ts","utf-8","__Secure-ex-lang-auth.session_token","3296600CRzOho","writeJsonSync","export type I18nAllLanguageKey = ",'";\n```\n\n## TypeScript\n\nThis package contains complete TypeScript declarations.\n\n---\n\nGenerated automatically.\n',"language","deploy success.","127.0.0.1","log","url","green","catch","export type I18nKey = ","gray","isArray","forEach","GET",".npmrc","inherit","authToken"];return(T=function(){return n})()}function E(n,e="",t=[]){const o=u;for(const[s,r]of Object[o(386)](n)){const n=e?e+"."+s:s;r&&typeof r===o(372)&&!Array[o(330)](r)?E(r,n,t):t.push(n)}return t}exports.chalk=f,exports.cleanupTmpDir=k,exports.defaultBaseUrl=v,exports.defaultPkgVersion=y,exports.getAppList=function(e,s){return n.__awaiter(this,void 0,void 0,function*(){const r=j;h[r(360)](f[r(382)][r(474)](r(445)));try{const r=yield S("/api/punish");yield function(e,s,r){return n.__awaiter(this,void 0,void 0,function*(){const a=j;if(!e[a(415)])return void console.log(p[a(447)],f[a(451)](a(354)));h.stop();const{id:d}=yield i[a(395)]([{type:a(393),name:"id",message:f[a(382)][a(474)](a(388)),choices:e.map(n=>({name:n[a(408)],value:n.id}))}]);if(!d)return void console[a(472)](p[a(447)],f[a(451)](a(357)));const v=yield function(e){return n.__awaiter(this,void 0,void 0,function*(){const n=j;h[n(360)](f[n(382)][n(474)](n(455)));try{return yield S("/api/punish/"+e)}catch(e){console.log(p[n(447)],f[n(451)](e[n(336)]))}finally{h[n(389)]()}})}(d);if(v){if(k(),r){const n=yield I({options:s,key:a(341),defaultValue:a(367)});let e;e=t.isAbsolute(n)?t[a(450)](n):t[a(450)](process[a(340)](),n),o.ensureDirSync(e);for(const n in v[a(377)]){const s=v.words[n];o.writeJsonSync(t[a(450)](e,n+a(424)),s,{spaces:4})}console[a(472)](p[a(421)]+" "+f[a(474)]("download success."))}else try{const e=yield I({options:s,key:a(335)});!function(n,e){const s=u,r=t[s(450)](n,s(333));o[s(448)](r);const i=[s(391),"//registry.npmjs.org/:_authToken="+e].join("\n");o[s(376)](r,i,"utf-8")}(g,(null==e?void 0:e.trim())||"");const r=yield function(e){return n.__awaiter(this,void 0,void 0,function*(){const n=j;var t,o;let s="",r=y;h.start();try{const{stdout:o}=yield c.execa("npm",[n(439),e,"version"],{cwd:g});s=o[n(442)](),r=null!==(t=l[n(417)](s,"patch"))&&void 0!==t?t:"unknown"}catch(n){}h[n(389)](),console[n(472)](p[n(426)]+" "+f[n(477)](n(365))+" "+f[n(358)](e));let a=n(348);s&&(a=n(436),console.log(p[n(426)]+" "+f[n(474)]("current version: "+s)));return null===(o=(yield i[n(395)]([{type:n(409),name:n(350),message:p[n(426)]+" "+f[n(474)](a),default:r,validate:e=>{const t=n;return!!l[t(398)](e)||p[t(447)]+" "+f.red(t(425))}}]))[n(350)])||void 0===o?void 0:o[n(442)]()})}(v[a(399)]);(function(n,e,s){const r=u,i=t[r(450)](n,r(370));o[r(448)](i);const c={name:e,version:s,description:e+r(368),license:r(355),keywords:[e,"i18n",r(396),r(469)],main:r(444),types:r(462),files:[r(356),r(383),"*.d.ts",r(428)],publishConfig:{access:r(410)}};o[r(466)](i,c,{spaces:4})})(g,v[a(399)],r),function(n,e){const s=u,r=t.resolve(n,s(428));o[s(448)](r);const i="# "+e+s(339)+e+s(453)+e+s(420)+e+s(405)+e+s(468);o.writeFileSync(r,i,s(463))}(g,v[a(399)]),function(n,e){const s=u;o.writeJsonSync(t[s(450)](n,s(378)),e,{spaces:4});let r=s(414);const i=[],c=[],a=E(e),l=0===a[s(415)]?s(414):a[s(416)](n=>'"'+n+'"')[s(403)]("|"),d=Object.keys(e),p=0===d[s(415)]?s(414):d[s(416)](n=>'"'+n+'"')[s(403)]("|");for(const c in e){const a=e[c];i[s(337)](s(363)+c+s(437)+c+s(423)),o[s(466)](t[s(450)](n,c+s(424)),a,{spaces:4});const l=E(a);r===s(414)&&(r=0===l[s(415)]?s(414):l.map(n=>'"'+n+'"')[s(403)]("|"))}i[s(337)]('export { default as languages } from "./languages.json";'),c[s(337)](s(476)+r+s(390)),c[s(337)](s(467)+l+"|(string & {});"),d[s(331)](n=>{const e=s;c[e(337)](e(371)+n+e(440))}),c[s(337)](s(432)+p+s(418)),c.push(s(430)),o[s(376)](t[s(450)](n,s(459)),i[s(403)]("\n")),o[s(376)](t[s(450)](n,s(460)),c.join("\n"))}(g,v.words),yield function(){return n.__awaiter(this,void 0,void 0,function*(){const n=j;h[n(360)]();try{yield c.execa(n(458),[n(366),n(461),n(410)],{cwd:g,stdio:n(334)}),console[n(472)](p.success+" "+f[n(474)](n(470)))}catch(e){throw h[n(389)](),e}h[n(389)]()})}()}finally{k()}process[a(397)](0)}})}(r,e,s)}catch(n){console[r(472)](p.error,f[r(451)](n.message))}finally{h.stop()}})},exports.logSymbols=p,exports.login=b,exports.sessionDir=m,exports.sessionFile=x,exports.spinner=h,exports.tmpDir=g;
|
|
2
|
+
"use strict";var e=require("tslib"),n=require("node:os"),t=require("node:path"),o=require("fs-extra"),r=require("ora"),s=require("node:http"),i=require("inquirer"),c=require("execa"),a=require("chalk"),l=require("semver");const u=j;var d;function p(){const e=["xdg-open","package name:","...","/api/auth/sign-in/social","version","https://ex.roxmotor.top","push","homedir"," i18n language package","message","close","cwd","EMPTY","/callback","5oTyUQw","list","trim","darwin","/api/auth/get-session","entries","writeHead","|(string & {});","$1 $2","listen","prompt","translation","string","cookie","README.md","info","index.d.ts","468505FpEdin","bold"," value.","toISOString","address","writeFileSync","error","data","./index.js","请求失败","pathExistsSync","replace","./index.d.ts","npm","session","removeSync","end","token","请选择一个应用:","您还没有创建应用,请先创建应用","the ","success","start","url","*.d.ts","15004848uegzRp","path","ensureFileSync","gray","map","login fail.","export type I18nKey = ","请选择一个应用","writeJsonSync","registry=https://registry.npmjs.org/","includes","object","Unauthorized","stop","336846XbzGkl","authToken","/api/auth/cli-export","*.js","application/json",'.json";',"|(string & {}), Record<I18nKey, string>>;","package.json","login success.","input","1020606iyYfZc",": Record<I18nKey, string>;","inherit","language","github","patch","never","catch","http://localhost:","tmpdir","declare module \"vue-i18n\" {\n type _KnownExKeys = Exclude<I18nKey, string & {}>;\n interface DefineLocaleMessage extends Partial<Record<_KnownExKeys, string>>, Record<string, string> {}\n interface ComposerTranslation {\n (key: I18nKey, ...args: any[]): string;\n }\n interface Composer {\n tm<Key extends string = I18nKey>(key: Key | I18nKey): any;\n te<Key extends string = I18nKey>(key: Key | I18nKey, locale?: string): boolean;\n }\n interface VueI18n {\n t(key: I18nKey, ...args: any[]): string;\n tm<Key extends string = I18nKey>(key: Key | I18nKey): any;\n te<Key extends string = I18nKey>(key: Key | I18nKey, locale?: string): boolean;\n }\n}\n \ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $t(key: I18nKey, ...args: any[]): string;\n $tm<Key extends string = I18nKey>(key: Key | I18nKey): any;\n $te<Key extends string = I18nKey>(key: Key | I18nKey, locale?: string): boolean;\n }\n}","return","MIT","ignore","export type I18nAllLanguageKey = ",'";\n```\n\n## TypeScript\n\nThis package contains complete TypeScript declarations.\n\n---\n\nGenerated automatically.\n',"log","set","forEach","join","2463664veQiNG","open",'export { default as languages } from "./languages.json";',"publish","export declare const ","keys","next version:","inc","isAbsolute","ensureDirSync","green",".json","current version: ","split","toString","*.json","/token","/api/punish","1452813JGIhTk","red","status",' } from "./',"resolve","utf-8","createServer","\n\n> Auto generated i18n language package.\n\n## Installation\n\n```bash\nnpm install ","words","1141656xmnXkS","--access","request","i18n","export declare const languages: Record<","exit","pkg",".mgexcli","publish version:","public","正在获取应用列表...","not found",'";\n```\n\nOr use all languages.\n\n```ts\nimport { languages } from "',"name","deploy success.","readJsonSync","json","length","cmd","127.0.0.1","__Secure-ex-lang-auth.session_token","HTTP ","POST","port","isArray"];return(p=function(){return e})()}!function(){const e=j,n=p();for(;;)try{if(402130===-parseInt(e(336))/1+-parseInt(e(385))/2+-parseInt(e(423))/3+parseInt(e(432))/4+parseInt(e(471))/5*(parseInt(e(375))/6)+-parseInt(e(405))/7+parseInt(e(361))/8)break;n.push(n.shift())}catch(e){n.push(n.shift())}}();const y={success:"✔",error:"✖",warning:"⚠",info:"ℹ"},g="1.0.0",f=t[u(427)](n[u(394)](),".mgexcli_tmp"),h=new a.Chalk,v=r(),m=u(462),x=t.resolve(n[u(464)](),u(439)),w=t.resolve(x,"session.json"),k=null!==(d=process.env.MGEXCLI_COOKIE_NAME)&&void 0!==d?d:u(452);function K(){const e=u;f&&o[e(346)](f)&&o[e(351)](f)}function I(e){const n=u;return e[n(347)](/([a-z])([A-Z])/g,n(327))[n(347)](/([A-Z]+)([A-Z][a-z])/g,n(327))[n(347)](/[-_]/g," ").toLowerCase()[n(347)](/\s+/g," ")[n(473)]()}function _(n){return e.__awaiter(this,arguments,void 0,function*({options:e,key:n,defaultValue:t}){const o=j;let r=(null==e?void 0:e[n])||"";if(!r){return r=(yield i[o(329)]([{type:o(384),name:n,default:null!=t?t:".",message:y.info+" "+h[o(415)](I(n))+h[o(415)](":"),validate:e=>{const t=o;return!(!(null==e?void 0:e[t(473)]())||"."===e)||y[t(342)]+" "+h[t(424)](t(356)+n+" option is missing and cannot be empty. please add --"+n+t(338))}}]))[n],null==r?void 0:r[o(473)]()}return null==r?void 0:r[o(473)]()})}function b(){const e=u;try{if(!o[e(346)](w))return null;const n=o[e(447)](w);return typeof(null==n?void 0:n[e(332)])===e(331)?k+"="+n.cookie:null}catch(e){return null}}function S(){return e.__awaiter(this,void 0,void 0,function*(){const t=j,r=yield function(){return e.__awaiter(this,void 0,void 0,function*(){const e=j;var n;try{const t=b();if(!t)return!1;const o=yield fetch(m+e(475),{headers:{cookie:t},credentials:"include"});if(!o.ok)return!1;const r=yield o[e(448)]();return!!(null===(n=null==r?void 0:r[e(350)])||void 0===n?void 0:n[e(353)])&&t}catch(e){return!1}})}();if(r)return r;const i=s[t(429)](),a=yield new Promise(e=>{const n=t;i[n(328)](0,n(451),()=>{const t=n,o=i[t(340)]();e(typeof o===t(372)&&o?o[t(455)]:0)})}),l=t(393)+a+t(470);try{v[t(358)](h[t(337)][t(415)]("login..."));const r=yield fetch(m+t(460),{method:t(454),headers:{"Content-Type":t(379)},body:JSON.stringify({provider:t(389),callbackURL:l,disableRedirect:!0})}),s=yield r[t(448)]()[t(392)](()=>({}));if(!r.ok||!(null==s?void 0:s[t(359)]))throw new Error((null==s?void 0:s[t(466)])||"HTTP "+r[t(425)]);yield function(t){return e.__awaiter(this,void 0,void 0,function*(){const e=j,o=n.platform();try{o===e(474)?yield c.execa(e(406),[t],{stdio:e(398)}):"win32"===o?yield c.execa(e(450),["/c",e(358),"",t],{stdio:e(398)}):yield c.execa(e(457),[t],{stdio:"ignore"})}catch(e){}})}(s[t(359)]);const f=yield(d=i,p=a,g=3e5,new Promise(e=>{const n=j;let t,o=!1;const r=n=>{o||(o=!0,t&&clearTimeout(t),e(n))};t=setTimeout(()=>r(null),g),d.on(n(434),(e,t)=>{const o=n;var s;const i=(null!==(s=e.url)&&void 0!==s?s:"/")[o(418)]("?")[0];if(i===o(470)){const e=new URL(o(377),m);return e.searchParams[o(402)](o(396),o(393)+p+o(421)),t[o(325)](302,{Location:e[o(419)]()}),void t[o(352)]()}if("/token"===i){v.stop();let n="";return e.on(o(343),e=>n+=e),void e.on("end",()=>{const e=o,s=n.trim()||null;t.writeHead(200,{"Content-Type":"text/plain; charset=utf-8","Access-Control-Allow-Origin":"*"}),t[e(352)](s?"OK":e(469)),r(s)})}t.writeHead(404)[o(352)](o(443))})}));if(!f)throw new Error(t(366));const k=function(e){const n=u,t=e;return o[n(414)](x),o[n(369)](w,{cookie:t,createdAt:(new Date)[n(339)]()},{spaces:4}),t}(f);return console[t(401)](y.success,h[t(415)](t(383))),k}catch(e){throw v.stop(),console.log(y[t(342)],h.red(e[t(466)])),e}finally{i.listening&&i[t(467)]()}var d,p,g})}function T(n){return e.__awaiter(this,void 0,void 0,function*(){const e=j;try{const t=b();if(!t){if(yield S())return T(n)}const o=yield fetch(""+m+n,{method:"GET",headers:{cookie:t}});if(!o.ok)throw new Error(e(453)+o[e(425)]);const r=yield o[e(448)]()[e(392)](()=>({}));if(!(null==r?void 0:r[e(425)]))throw new Error((null==r?void 0:r[e(466)])||e(345));return null==r?void 0:r[e(343)]}catch(t){if(t[e(466)][e(371)](e(373)))return function(){const e=u;o[e(346)](w)&&o[e(351)](w)}(),T(n);throw t}})}function j(e,n){e-=324;return p()[e]}function E(e,n="",t=[]){const o=u;for(const[r,s]of Object[o(324)](e)){const e=n?n+"."+r:r;s&&typeof s===o(372)&&!Array[o(456)](s)?E(s,e,t):t[o(463)](e)}return t}exports.chalk=h,exports.cleanupTmpDir=K,exports.defaultBaseUrl=m,exports.defaultPkgVersion=g,exports.getAppList=function(n,r){return e.__awaiter(this,void 0,void 0,function*(){const s=j;v[s(358)](h[s(337)].green(s(442)));try{const a=yield T(s(422));yield function(n,r,s){return e.__awaiter(this,void 0,void 0,function*(){const a=j;if(!n[a(449)])return void console.log(y[a(342)],h[a(424)](a(355)));v[a(374)]();const{id:d}=yield i.prompt([{type:a(472),name:"id",message:h[a(337)].green(a(354)),choices:n[a(365)](e=>({name:e[a(445)],value:e.id}))}]);if(!d)return void console[a(401)](y[a(342)],h[a(424)](a(368)));const p=yield function(n){return e.__awaiter(this,void 0,void 0,function*(){const e=j;v[e(358)](h[e(337)][e(415)](e(459)));try{return yield T("/api/punish/"+n)}catch(n){console[e(401)](y.error,h[e(424)](n[e(466)]))}finally{v.stop()}})}(d);if(p){if(K(),s){const e=yield _({options:r,key:a(362),defaultValue:"./i18n"});let n;n=t[a(413)](e)?t[a(427)](e):t[a(427)](process[a(468)](),e),o[a(414)](n);for(const e in p.words){const r=p[a(431)][e];o[a(369)](t[a(427)](n,e+".json"),r,{spaces:4})}console[a(401)](y.success+" "+h.green("download success."))}else try{const n=yield _({options:r,key:a(376)});!function(e,n){const r=u,s=t[r(427)](e,".npmrc");o[r(363)](s);const i=[r(370),"//registry.npmjs.org/:_authToken="+n][r(404)]("\n");o.writeFileSync(s,i,"utf-8")}(f,(null==n?void 0:n.trim())||"");const s=yield function(n){return e.__awaiter(this,void 0,void 0,function*(){const e=j;var t,o;let r="",s=g;v[e(358)]();try{const{stdout:o}=yield c.execa(e(349),["view",n,e(461)],{cwd:f});r=o[e(473)](),s=null!==(t=l[e(412)](r,e(390)))&&void 0!==t?t:"unknown"}catch(e){}v[e(374)](),console[e(401)](y[e(334)]+" "+h[e(364)](e(458))+" "+h.cyan(n));let a=e(440);r&&(a=e(411),console.log(y[e(334)]+" "+h[e(415)](e(417)+r)));return null===(o=(yield i.prompt([{type:e(384),name:e(461),message:y[e(334)]+" "+h[e(415)](a),default:s,validate:e=>!!l.valid(e)||y.error+" "+h.red("invalid version number")}])).version)||void 0===o?void 0:o[e(473)]()})}(p[a(438)]);(function(e,n,r){const s=u,i=t.resolve(e,s(382));o[s(363)](i);const c={name:n,version:r,description:n+s(465),license:s(397),keywords:[n,s(435),s(330),s(388)],main:s(344),types:s(348),files:[s(420),s(378),s(360),s(333)],publishConfig:{access:s(441)}};o[s(369)](i,c,{spaces:4})})(f,p[a(438)],s),function(e,n){const r=u,s=t[r(427)](e,r(333));o[r(363)](s);const i="# "+n+r(430)+n+'\n```\n\n## Usage\n\n```ts\nimport { zh, en, languages } from "'+n+'";\n\nconsole.log(zh.hello);\nconsole.log(en.hello);\n\nconsole.log(languages.zh.hello);\nconsole.log(languages.en.hello);\n```\n\n## Export\n\nEach language exports a JSON object.\n\n```ts\nimport { zh } from "'+n+r(444)+n+r(400);o[r(341)](s,i,r(428))}(f,p[a(438)]),function(e,n){const r=u;o[r(369)](t[r(427)](e,"languages.json"),n,{spaces:4});let s="never";const i=[],c=[],a=E(n),l=0===a[r(449)]?r(391):a[r(365)](e=>'"'+e+'"')[r(404)]("|"),d=Object[r(410)](n),p=0===d[r(449)]?r(391):d.map(e=>'"'+e+'"')[r(404)]("|");for(const c in n){const a=n[c];i[r(463)]("export { default as "+c+r(426)+c+r(380)),o[r(369)](t[r(427)](e,c+r(416)),a,{spaces:4});const l=E(a);s===r(391)&&(s=0===l.length?r(391):l.map(e=>'"'+e+'"')[r(404)]("|"))}i[r(463)](r(407)),c[r(463)](r(367)+s+r(326)),c[r(463)](r(399)+l+r(326)),d[r(403)](e=>{const n=r;c[n(463)](n(409)+e+n(386))}),c.push(r(436)+p+r(381)),c[r(463)](r(395)),o.writeFileSync(t.resolve(e,"index.js"),i[r(404)]("\n")),o.writeFileSync(t[r(427)](e,r(335)),c[r(404)]("\n"))}(f,p[a(431)]),yield function(){return e.__awaiter(this,void 0,void 0,function*(){const e=j;v[e(358)]();try{yield c.execa(e(349),[e(408),e(433),e(441)],{cwd:f,stdio:e(387)}),console[e(401)](y[e(357)]+" "+h[e(415)](e(446)))}catch(n){throw v[e(374)](),n}v[e(374)]()})}()}finally{K()}process[a(437)](0)}})}(a,n,r)}catch(e){console[s(401)](y[s(342)],h.red(e[s(466)]))}finally{v[s(374)]()}})},exports.logSymbols=y,exports.login=S,exports.sessionDir=x,exports.sessionFile=w,exports.spinner=v,exports.tmpDir=f;
|