jinrai 1.0.7 → 1.0.9
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/lib/bin/bin.js +297 -11
- package/lib/config/config.js +5 -1
- package/lib/index.js +6 -2
- package/lib/src/bin/bin.d.ts +1 -0
- package/lib/src/bin/build/build.d.ts +6 -0
- package/lib/src/bin/config/defaultIndexHtml.d.ts +1 -0
- package/lib/src/bin/content/normalizeContent.d.ts +1 -0
- package/lib/src/bin/playwright/pageCollector.d.ts +5 -0
- package/lib/src/bin/playwright/templates.d.ts +13 -0
- package/lib/src/bin/routes/Parser.d.ts +40 -0
- package/lib/src/bin/routes/getRoutes.d.ts +13 -0
- package/lib/src/bin/routes/replaceDevScripts.d.ts +1 -0
- package/lib/src/bin/server/vitePreview.d.ts +1 -0
- package/lib/src/bin/ui/task.d.ts +9 -0
- package/lib/src/front/url/adapter/rrd6.js +4 -2
- package/lib/src/front/url/adapter/rrd7.js +4 -1
- package/lib/vite/plugin.d.ts +2 -0
- package/lib/vite/plugin.js +209 -1
- package/package.json +6 -12
- package/rollup.config.mjs +144 -0
- package/src/bin/bin.ts +0 -2
- package/src/front/url/adapter/rrd6.tsx +5 -2
- package/src/front/url/adapter/rrd7.tsx +5 -2
- package/tsconfig.base.json +14 -0
- package/tsconfig.types.json +32 -0
- package/rollup.front.config.mjs +0 -57
- /package/lib/{config/config.d.ts → config.d.ts} +0 -0
- /package/lib/{config/src → src}/bin/config/define.d.ts +0 -0
- /package/lib/{config/src → src}/bin/config/userConfig.d.ts +0 -0
package/lib/bin/bin.js
CHANGED
|
@@ -1,12 +1,298 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
${e}`,ge=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),_e=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Fe=(t,e,r)=>{let i=r===""?"":`with ${r.trim()}() `,s=de.bind(null,i,e.toString());Object.defineProperty(s,"name",_e);let{writable:n,enumerable:o,configurable:l}=ge;Object.defineProperty(t,"toString",{value:s,writable:n,enumerable:o,configurable:l})};function V(t,e,{ignoreNonConfigurable:r=!1}={}){let{name:i}=t;for(let s of Reflect.ownKeys(e))me(t,e,s,r);return pe(t,e),Fe(t,e,i),t}var D=new WeakMap,vt=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let r,i=0,s=t.displayName||t.name||"<anonymous>",n=function(...o){if(D.set(n,++i),i===1)r=t.apply(this,o),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return r};return V(n,t),D.set(n,i),n};vt.callCount=t=>{if(!D.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return D.get(t)};var Tt=vt;var x=[];x.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&x.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&x.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var P=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",q=Symbol.for("signal-exit emitter"),z=globalThis,xe=Object.defineProperty.bind(Object),K=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(z[q])return z[q];xe(z,q,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let i=this.listeners[e],s=i.indexOf(r);s!==-1&&(s===0&&i.length===1?i.length=0:i.splice(s,1))}emit(e,r,i){if(this.emitted[e])return!1;this.emitted[e]=!0;let s=!1;for(let n of this.listeners[e])s=n(r,i)===!0||s;return e==="exit"&&(s=this.emit("afterExit",r,i)||s),s}},N=class{},be=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),J=class extends N{onExit(){return()=>{}}load(){}unload(){}},X=class extends N{#n=Z.platform==="win32"?"SIGINT":"SIGHUP";#i=new K;#t;#s;#h;#u={};#e=!1;constructor(e){super(),this.#t=e,this.#u={};for(let r of x)this.#u[r]=()=>{let i=this.#t.listeners(r),{count:s}=this.#i,n=e;if(typeof n.__signal_exit_emitter__=="object"&&typeof n.__signal_exit_emitter__.count=="number"&&(s+=n.__signal_exit_emitter__.count),i.length===s){this.unload();let o=this.#i.emit("exit",null,r),l=r==="SIGHUP"?this.#n:r;o||e.kill(e.pid,l)}};this.#h=e.reallyExit,this.#s=e.emit}onExit(e,r){if(!P(this.#t))return()=>{};this.#e===!1&&this.load();let i=r?.alwaysLast?"afterExit":"exit";return this.#i.on(i,e),()=>{this.#i.removeListener(i,e),this.#i.listeners.exit.length===0&&this.#i.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#e){this.#e=!0,this.#i.count+=1;for(let e of x)try{let r=this.#u[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#r(e,...r),this.#t.reallyExit=e=>this.#o(e)}}unload(){this.#e&&(this.#e=!1,x.forEach(e=>{let r=this.#u[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#s,this.#t.reallyExit=this.#h,this.#i.count-=1)}#o(e){return P(this.#t)?(this.#t.exitCode=e||0,this.#i.emit("exit",this.#t.exitCode,null),this.#h.call(this.#t,this.#t.exitCode)):0}#r(e,...r){let i=this.#s;if(e==="exit"&&P(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let s=i.call(this.#t,e,...r);return this.#i.emit("exit",this.#t.exitCode,null),s}else return i.call(this.#t,e,...r)}},Z=globalThis.process,{onExit:wt,load:vr,unload:Tr}=be(P(Z)?new X(Z):new J);var At=M.stderr.isTTY?M.stderr:M.stdout.isTTY?M.stdout:void 0,Ee=At?Tt(()=>{wt(()=>{At.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Bt=Ee;var j=!1,v={};v.show=(t=Ot.stderr)=>{t.isTTY&&(j=!1,t.write("\x1B[?25h"))};v.hide=(t=Ot.stderr)=>{t.isTTY&&(Bt(),j=!0,t.write("\x1B[?25l"))};v.toggle=(t,e)=>{t!==void 0&&(j=t),j?v.show(e):v.hide(e)};var Q=v;var tt={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots14:{interval:80,frames:["\u2809\u2809","\u2808\u2819","\u2800\u2839","\u2800\u28B8","\u2800\u28F0","\u2880\u28E0","\u28C0\u28C0","\u28C4\u2840","\u28C6\u2800","\u2847\u2800","\u280F\u2800","\u280B\u2801"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},dotsCircle:{interval:80,frames:["\u288E ","\u280E\u2801","\u280A\u2811","\u2808\u2831"," \u2871","\u2880\u2870","\u2884\u2860","\u2886\u2840"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},rollingLine:{interval:80,frames:["/ "," - "," \\ "," |"," |"," \\ "," - ","/ "]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u{1F497} "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}};var _=tt,Mr=Object.keys(tt);var b={};Vt(b,{error:()=>Be,info:()=>Te,success:()=>we,warning:()=>Ae});import ye from"node:tty";var ve=ye?.WriteStream?.prototype?.hasColors?.()??!1,a=(t,e)=>{if(!ve)return s=>s;let r=`\x1B[${t}m`,i=`\x1B[${e}m`;return s=>{let n=s+"",o=n.indexOf(i);if(o===-1)return r+n+i;let l=r,u=0,h=(e===22?i:"")+r;for(;o!==-1;)l+=n.slice(u,o)+h,u=o+i.length,o=n.indexOf(i,u);return l+=n.slice(u)+i,l}},Lr=a(0,0),Gr=a(1,22),Wr=a(2,22),Ur=a(3,23),$r=a(4,24),Yr=a(53,55),Hr=a(7,27),Vr=a(8,28),qr=a(9,29),zr=a(30,39),St=a(31,39),Rt=a(32,39),It=a(33,39),Dt=a(34,39),Kr=a(35,39),Jr=a(36,39),Xr=a(37,39),Zr=a(90,39),Qr=a(40,49),ti=a(41,49),ei=a(42,49),ri=a(43,49),ii=a(44,49),si=a(45,49),ni=a(46,49),oi=a(47,49),ai=a(100,49),li=a(91,39),ci=a(92,39),fi=a(93,39),ui=a(94,39),mi=a(95,39),hi=a(96,39),pi=a(97,39),di=a(101,49),gi=a(102,49),_i=a(103,49),Fi=a(104,49),xi=a(105,49),bi=a(106,49),Ei=a(107,49);import Pt from"node:process";function A(){let{env:t}=Pt,{TERM:e,TERM_PROGRAM:r}=t;return Pt.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var k=A(),Te=Dt(k?"\u2139":"i"),we=Rt(k?"\u2714":"\u221A"),Ae=It(k?"\u26A0":"\u203C"),Be=St(k?"\u2716":"\xD7");function et({onlyFirst:t=!1}={}){let s="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(s,t?void 0:"g")}var Oe=et();function B(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Oe,"")}function Nt(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function Mt(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function jt(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t>=94192&&t<=94198||t>=94208&&t<=101589||t>=101631&&t<=101662||t>=101760&&t<=101874||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128728||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129674||t>=129678&&t<=129734||t===129736||t>=129741&&t<=129756||t>=129759&&t<=129770||t>=129775&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function Se(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function rt(t,{ambiguousAsWide:e=!1}={}){return Se(t),Mt(t)||jt(t)||e&&Nt(t)?2:1}var Re=new Intl.Segmenter,Ie=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v,De=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,Pe=/^\p{RGI_Emoji}$/v;function Ne(t){return t.replace(De,"")}function Me(t){return Ie.test(t)}function je(t,e){let r=0;if(t.length>1)for(let i of t.slice(1))i>="\uFF00"&&i<="\uFFEF"&&(r+=rt(i.codePointAt(0),e));return r}function it(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:i=!1}=e,s=t;if(i||(s=B(s)),s.length===0)return 0;let n=0,o={ambiguousAsWide:!r};for(let{segment:l}of Re.segment(s)){if(Me(l))continue;if(Pe.test(l)){n+=2;continue}let u=Ne(l).codePointAt(0);n+=rt(u,o),n+=je(l,o)}return n}function st({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import d from"node:process";var ke=3,nt=class{#n=0;start(){this.#n++,this.#n===1&&this.#i()}stop(){if(this.#n<=0)throw new Error("`stop` called more times than `start`");this.#n--,this.#n===0&&this.#t()}#i(){d.platform==="win32"||!d.stdin.isTTY||(d.stdin.setRawMode(!0),d.stdin.on("data",this.#s),d.stdin.resume())}#t(){d.stdin.isTTY&&(d.stdin.off("data",this.#s),d.stdin.pause(),d.stdin.setRawMode(!1))}#s(e){e[0]===ke&&d.emit("SIGINT")}},Le=new nt,ot=Le;var at=class{#n=0;#i=!1;#t=0;#s=-1;#h=0;#u=0;#e;#o;#r;#p;#_;#a;#m;#l;#d;#c;#f;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#e={color:"cyan",stream:L.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#e.color,this.spinner=this.#e.spinner,this.#_=this.#e.interval,this.#r=this.#e.stream,this.#a=typeof this.#e.isEnabled=="boolean"?this.#e.isEnabled:st({stream:this.#r}),this.#m=typeof this.#e.isSilent=="boolean"?this.#e.isSilent:!1,this.text=this.#e.text,this.prefixText=this.#e.prefixText,this.suffixText=this.#e.suffixText,this.indent=this.#e.indent,L.env.NODE_ENV==="test"&&(this._stream=this.#r,this._isEnabled=this.#a,Object.defineProperty(this,"_linesToClear",{get(){return this.#n},set(r){this.#n=r}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#s}}),Object.defineProperty(this,"_lineCount",{get(){return this.#t}}))}get indent(){return this.#l}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#l=e,this.#g()}get interval(){return this.#_??this.#o.interval??100}get spinner(){return this.#o}set spinner(e){if(this.#s=-1,this.#_=void 0,typeof e=="object"){if(!Array.isArray(e.frames)||e.frames.length===0||e.frames.some(r=>typeof r!="string"))throw new Error("The given spinner must have a non-empty `frames` array of strings");if(e.interval!==void 0&&!(Number.isInteger(e.interval)&&e.interval>0))throw new Error("`spinner.interval` must be a positive integer if provided");this.#o=e}else if(!A())this.#o=_.line;else if(e===void 0)this.#o=_.dots;else if(e!=="default"&&_[e])this.#o=_[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#d}set text(e=""){this.#d=e,this.#g()}get prefixText(){return this.#c}set prefixText(e=""){this.#c=e,this.#g()}get suffixText(){return this.#f}set suffixText(e=""){this.#f=e,this.#g()}get isSpinning(){return this.#p!==void 0}#E(e,r,i=!1){let s=typeof e=="function"?e():e;return typeof s=="string"&&s!==""?i?r+s:s+r:""}#F(e=this.#c,r=" "){return this.#E(e,r,!1)}#x(e=this.#f,r=" "){return this.#E(e,r,!0)}#b(e,r){let i=0;for(let s of B(e).split(`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { createJiti } from 'jiti';
|
|
4
|
+
import { pathToFileURL } from 'url';
|
|
5
|
+
import { resolve } from 'path';
|
|
6
|
+
import { createHash } from 'node:crypto';
|
|
7
|
+
import { chromium } from 'playwright';
|
|
8
|
+
import ora, { spinners } from 'ora';
|
|
9
|
+
import { stdout, stdin } from 'node:process';
|
|
10
|
+
import readline from 'node:readline/promises';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { preview } from 'vite';
|
|
13
|
+
|
|
14
|
+
const getUserConfig = async (configName) => {
|
|
15
|
+
const jiti = createJiti(import.meta.url, {
|
|
16
|
+
debug: false,
|
|
17
|
+
});
|
|
18
|
+
const configPath = pathToFileURL(resolve(process.cwd(), configName)).href;
|
|
19
|
+
const configModule = (await jiti.import(configPath));
|
|
20
|
+
return configModule.default;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const normalizeHtmlWhitespace = (html) => {
|
|
24
|
+
return html
|
|
25
|
+
.replace(/\r?\n|\r/g, " ")
|
|
26
|
+
.replace(/\s+/g, " ")
|
|
27
|
+
.replace(/>\s+</g, "><")
|
|
28
|
+
.trim();
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
class Parser {
|
|
32
|
+
options;
|
|
33
|
+
openVar = "{{";
|
|
34
|
+
createVar = "}}";
|
|
35
|
+
createArray = "</loopwrapper";
|
|
36
|
+
createCustom = "</custom";
|
|
37
|
+
deepUp = "<loopwrapper";
|
|
38
|
+
deepUp2 = "<custom";
|
|
39
|
+
templates = {};
|
|
40
|
+
constructor(options) {
|
|
41
|
+
this.options = options;
|
|
42
|
+
}
|
|
43
|
+
parse(content) {
|
|
44
|
+
const tree = [];
|
|
45
|
+
this.handle(this.options?.normalize ? normalizeHtmlWhitespace(content) : content, tree);
|
|
46
|
+
return tree;
|
|
47
|
+
}
|
|
48
|
+
handle(content, tree) {
|
|
49
|
+
let match;
|
|
50
|
+
let deep = 0;
|
|
51
|
+
let lastIndex = 0;
|
|
52
|
+
const tagPattern = new RegExp(`(<loopwrapper(\\s+[^>]*)?>|</loopwrapper>|\{\{|\}\}|<custom(\\s+[^>]*)?>|</custom>)`, "gi");
|
|
53
|
+
while ((match = tagPattern.exec(content)) !== null) {
|
|
54
|
+
const currentTag = match[0];
|
|
55
|
+
const value = content.substring(lastIndex, match.index);
|
|
56
|
+
if (currentTag.startsWith(this.createArray)) {
|
|
57
|
+
deep--;
|
|
58
|
+
if (deep > 0)
|
|
59
|
+
continue;
|
|
60
|
+
this.createElement(tree, value);
|
|
61
|
+
}
|
|
62
|
+
else if (currentTag.startsWith(this.deepUp)) {
|
|
63
|
+
deep++;
|
|
64
|
+
if (deep > 1)
|
|
65
|
+
continue;
|
|
66
|
+
this.createElement(tree, value);
|
|
67
|
+
}
|
|
68
|
+
else if (currentTag.startsWith(this.createCustom)) {
|
|
69
|
+
deep--;
|
|
70
|
+
if (deep != 0)
|
|
71
|
+
continue;
|
|
72
|
+
this.createCustomElement(tree, value);
|
|
73
|
+
}
|
|
74
|
+
else if (currentTag.startsWith(this.deepUp2)) {
|
|
75
|
+
deep++;
|
|
76
|
+
if (deep > 1)
|
|
77
|
+
continue;
|
|
78
|
+
this.createElement(tree, value);
|
|
79
|
+
}
|
|
80
|
+
else if (currentTag == this.createVar) {
|
|
81
|
+
if (deep != 0)
|
|
82
|
+
continue;
|
|
83
|
+
this.createElement(tree, value, true);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
if (deep != 0)
|
|
87
|
+
continue;
|
|
88
|
+
this.createElement(tree, value);
|
|
89
|
+
}
|
|
90
|
+
lastIndex = match.index + currentTag.length;
|
|
91
|
+
}
|
|
92
|
+
if (lastIndex < content.length) {
|
|
93
|
+
const value = content.substring(lastIndex);
|
|
94
|
+
this.createElement(tree, value);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
createCustomElement(parent, value) {
|
|
98
|
+
const [name, ...props] = value.trimStart().split("|");
|
|
99
|
+
value = props.join("|");
|
|
100
|
+
parent.push({
|
|
101
|
+
type: "custom",
|
|
102
|
+
name,
|
|
103
|
+
props: value,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
createElement(parent, value, isVarible) {
|
|
107
|
+
if (isVarible)
|
|
108
|
+
return parent.push({
|
|
109
|
+
type: "value",
|
|
110
|
+
key: value,
|
|
111
|
+
});
|
|
112
|
+
if (value.trimStart().startsWith("ArrayDataKey=")) {
|
|
113
|
+
const [key, ...val] = value.trimStart().substring(13).split("|");
|
|
114
|
+
value = val.join("|");
|
|
115
|
+
const children = [];
|
|
116
|
+
this.handle(value, children);
|
|
117
|
+
return parent.push({
|
|
118
|
+
type: "array",
|
|
119
|
+
data: children,
|
|
120
|
+
key,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (value)
|
|
124
|
+
parent.push({
|
|
125
|
+
type: "html",
|
|
126
|
+
content: this.options?.templates ? this.createTemplate(value) : value,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
createTemplate(html) {
|
|
130
|
+
if (!(html in this.templates)) {
|
|
131
|
+
this.templates[html] = createHash("md5").update(Object.keys(this.templates).length.toString()).digest("hex");
|
|
132
|
+
}
|
|
133
|
+
return this.templates[html];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const getRoutesAndTemplates = (pages, normalize = true, templates = true) => {
|
|
138
|
+
const routes = [];
|
|
139
|
+
const parser = new Parser({ normalize, templates });
|
|
140
|
+
for (const [id, template] of pages.entries()) {
|
|
141
|
+
const content = parser.parse(template.root);
|
|
142
|
+
const mask = template.mask.replaceAll("/", "\\/").replace(/{(.*?)}/, ".+?");
|
|
143
|
+
routes.push({
|
|
144
|
+
id,
|
|
145
|
+
content,
|
|
146
|
+
mask,
|
|
147
|
+
requests: template.input,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
routes,
|
|
152
|
+
templates: parser.templates,
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
class Task {
|
|
157
|
+
spiner = undefined;
|
|
158
|
+
do(task, color, spinner, prefix) {
|
|
159
|
+
this.spiner = ora({
|
|
160
|
+
text: task,
|
|
161
|
+
color,
|
|
162
|
+
spinner: spinner,
|
|
163
|
+
prefixText: prefix,
|
|
164
|
+
}).start();
|
|
165
|
+
}
|
|
166
|
+
next(task, color, spinner, level = 0) {
|
|
167
|
+
this.success();
|
|
168
|
+
this.do(task, color, spinner, level ? " ".repeat(level) + "└─" : undefined);
|
|
169
|
+
}
|
|
170
|
+
success() {
|
|
171
|
+
if (this.spiner)
|
|
172
|
+
this.spiner.succeed();
|
|
173
|
+
}
|
|
174
|
+
fail() {
|
|
175
|
+
if (this.spiner)
|
|
176
|
+
this.spiner.fail();
|
|
177
|
+
}
|
|
178
|
+
async ask(question, defaultAnswer = "") {
|
|
179
|
+
if (this.spiner) {
|
|
180
|
+
// this.spiner.text = `${question}: `
|
|
181
|
+
this.spiner.spinner = {
|
|
182
|
+
interval: 100,
|
|
183
|
+
frames: [
|
|
184
|
+
"?", ".", " ", "."
|
|
185
|
+
]
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const rl = readline.createInterface({ input: stdin, output: stdout });
|
|
189
|
+
const answer = (await rl.question("")).trim();
|
|
190
|
+
rl.close();
|
|
191
|
+
return answer ? answer : defaultAnswer;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const pageCollector = async (page) => {
|
|
196
|
+
const state = await page.evaluate(() => {
|
|
197
|
+
return window.__page_requests;
|
|
198
|
+
});
|
|
199
|
+
const root = await page.locator("#root").innerHTML();
|
|
200
|
+
return { state, root };
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const getRawPageData = async (url, pages, test = false, debug = false) => {
|
|
204
|
+
const task = new Task();
|
|
205
|
+
task.next("Router analysis", "yellow", spinners.dotsCircle);
|
|
206
|
+
const result = [];
|
|
207
|
+
const browser = await chromium.launch({ headless: !debug, devtools: true, channel: "chrome" });
|
|
208
|
+
// const test_browser = await chromium.launch({ headless: true, channel: "chrome" })
|
|
209
|
+
const context = await browser.newContext({
|
|
210
|
+
userAgent: "____JINRAI_CLIENT____",
|
|
211
|
+
locale: "ru-RU",
|
|
212
|
+
});
|
|
213
|
+
for await (const [id, mask] of pages.entries()) {
|
|
214
|
+
task.next(mask, "yellow", spinners.dotsCircle, 1);
|
|
215
|
+
const page = await context.newPage();
|
|
216
|
+
const path = mask.replaceAll("{", "").replaceAll("}", "");
|
|
217
|
+
await page.goto(url + path);
|
|
218
|
+
await page.waitForLoadState("networkidle");
|
|
219
|
+
await page.waitForTimeout(1000);
|
|
220
|
+
const { state, root } = await pageCollector(page);
|
|
221
|
+
// if (debug) console.log({ input })
|
|
222
|
+
let testRoot = undefined;
|
|
223
|
+
// if (test) {
|
|
224
|
+
// const testPage = await test_browser.newPage()
|
|
225
|
+
// await testPage.goto(url + path)
|
|
226
|
+
// await testPage.waitForLoadState("networkidle")
|
|
227
|
+
// await testPage.waitForTimeout(1000)
|
|
228
|
+
// testRoot = await page.locator("#root").innerHTML()
|
|
229
|
+
// }
|
|
230
|
+
if (debug) {
|
|
231
|
+
await task.ask("continue?");
|
|
232
|
+
}
|
|
233
|
+
page.close();
|
|
234
|
+
result.push({
|
|
235
|
+
id,
|
|
236
|
+
input: state,
|
|
237
|
+
mask,
|
|
238
|
+
root,
|
|
239
|
+
test: testRoot,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
await browser.close();
|
|
243
|
+
// await test_browser.close()
|
|
244
|
+
task.success();
|
|
245
|
+
return result;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const vitePreview = async () => {
|
|
249
|
+
const previewServer = await preview({
|
|
250
|
+
preview: {
|
|
251
|
+
port: 8084,
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
if (!previewServer.resolvedUrls?.local?.length)
|
|
255
|
+
throw new Error("vite is not defined");
|
|
256
|
+
return [previewServer.resolvedUrls?.local[0].slice(0, -1), () => previewServer.close()];
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
const runBuild = async (options) => {
|
|
260
|
+
const task = new Task();
|
|
261
|
+
const configName = options.customConfig ?? "jinrai.config";
|
|
262
|
+
task.do("Init");
|
|
263
|
+
const config = await getUserConfig(configName);
|
|
264
|
+
task.success();
|
|
265
|
+
const [serverUrl, close] = await vitePreview();
|
|
266
|
+
const pages = await getRawPageData(serverUrl, config.pages, config.test, options.debug);
|
|
267
|
+
close();
|
|
268
|
+
const outputcashe = path.join(config.dist ?? "dist", ".cached");
|
|
269
|
+
task.do("Format");
|
|
270
|
+
const { routes, templates } = getRoutesAndTemplates(pages);
|
|
271
|
+
task.next(`Export: (${templates.length})`);
|
|
272
|
+
await mkdir(outputcashe, { recursive: true });
|
|
273
|
+
console.log("dev");
|
|
274
|
+
const exportConfig = { routes, proxy: config.proxy, meta: config.meta };
|
|
275
|
+
await writeFile(path.join(outputcashe, "config.json"), JSON.stringify(exportConfig, null, 2));
|
|
276
|
+
// await writeFile(
|
|
277
|
+
// path.join(outputcashe, "index.html"),
|
|
278
|
+
// config.index ? config.index(indexProps) : removeDevScripts(data.indexHtml ?? defaultIndexHtml),
|
|
279
|
+
// )
|
|
280
|
+
for await (const [template, name] of Object.entries(templates)) {
|
|
281
|
+
await writeFile(path.join(outputcashe, `${name}.html`), template);
|
|
282
|
+
}
|
|
283
|
+
if (config.test) {
|
|
284
|
+
task.next(`Tests`);
|
|
285
|
+
for await (const page of pages) {
|
|
286
|
+
if (!page.test) {
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
await writeFile(path.join(outputcashe, `test_${page.id}.html`), normalizeHtmlWhitespace(page.test));
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
task.success();
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const args = process.argv.slice(2);
|
|
296
|
+
const debug = args.includes("--debug");
|
|
297
|
+
const customConfig = args.find(itm => itm.startsWith("--config="))?.substring(9);
|
|
298
|
+
runBuild({ debug, customConfig });
|
package/lib/config/config.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
See https://nuqs.dev/NUQS-${e}`}var T=Je({useAdapter(){throw new Error(N(404))}});T.displayName="NuqsAdapterContext";Z&&typeof window<"u"&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==T&&console.error(N(303)),window.__NuqsAdapterContext=T);function Se(e){let t=Y(T);if(!("useAdapter"in t))throw new Error(N(404));return t.useAdapter(e)}var ye=()=>Y(T).defaultOptions,be=()=>Y(T).processUrlSearchParams;import{useCallback as we,useRef as ke,useSyncExternalStore as Ke}from"react";function We(){if(typeof window>"u"||!window.GestureEvent)return 50;try{let e=navigator.userAgent?.match(/version\/([\d\.]+) safari/i);return parseFloat(e[1])>=17?120:320}catch{return 320}}function qe(e){return{method:"throttle",timeMs:e}}var L=qe(We());function ve(e){return e===null||Array.isArray(e)&&e.length===0}function Oe(e,t,r){if(typeof e=="string")r.set(t,e);else{r.delete(t);for(let n of e)r.append(t,n);r.has(t)||r.set(t,"")}return r}function ne(){let e=new Map;return{on(t,r){let n=e.get(t)||[];return n.push(r),e.set(t,n),()=>this.off(t,r)},off(t,r){let n=e.get(t);n&&e.set(t,n.filter(s=>s!==r))},emit(t,r){e.get(t)?.forEach(n=>n(r))}}}function ee(e,t,r){function n(){e(),r.removeEventListener("abort",o)}let s=setTimeout(n,t);function o(){clearTimeout(s),r.removeEventListener("abort",o)}r.addEventListener("abort",o)}function te(){let e=Promise;if(Promise.hasOwnProperty("withResolvers"))return Promise.withResolvers();let t=()=>{},r=()=>{};return{promise:new e((n,s)=>{t=n,r=s}),resolve:t,reject:r}}function Be(e,t){let r=t;for(let n=e.length-1;n>=0;n--){let s=e[n];if(!s)continue;let o=r;r=()=>s(o)}r()}function re(){return new URLSearchParams(location.search)}var Ae=class{updateMap=new Map;options={history:"replace",scroll:!1,shallow:!0};timeMs=L.timeMs;transitions=new Set;resolvers=null;controller=null;lastFlushedAt=0;resetQueueOnNextPush=!1;push({key:e,query:t,options:r},n=L.timeMs){this.resetQueueOnNextPush&&(this.reset(),this.resetQueueOnNextPush=!1),l("[nuqs gtq] Enqueueing %s=%s %O",e,t,r),this.updateMap.set(e,t),r.history==="push"&&(this.options.history="push"),r.scroll&&(this.options.scroll=!0),r.shallow===!1&&(this.options.shallow=!1),r.startTransition&&this.transitions.add(r.startTransition),(!Number.isFinite(this.timeMs)||n>this.timeMs)&&(this.timeMs=n)}getQueuedQuery(e){return this.updateMap.get(e)}getPendingPromise({getSearchParamsSnapshot:e=re}){return this.resolvers?.promise??Promise.resolve(e())}flush({getSearchParamsSnapshot:e=re,rateLimitFactor:t=1,...r},n){if(this.controller??=new AbortController,!Number.isFinite(this.timeMs))return l("[nuqs gtq] Skipping flush due to throttleMs=Infinity"),Promise.resolve(e());if(this.resolvers)return this.resolvers.promise;this.resolvers=te();let s=()=>{this.lastFlushedAt=performance.now();let[i,h]=this.applyPendingUpdates({...r,autoResetQueueOnUpdate:r.autoResetQueueOnUpdate??!0,getSearchParamsSnapshot:e},n);h===null?(this.resolvers.resolve(i),this.resetQueueOnNextPush=!0):this.resolvers.reject(i),this.resolvers=null};return ee(()=>{let i=performance.now()-this.lastFlushedAt,h=this.timeMs,a=t*Math.max(0,h-i);l("[nuqs gtq] Scheduling flush in %f ms. Throttled at %f ms (x%f)",a,h,t),a===0?s():ee(s,a,this.controller.signal)},0,this.controller.signal),this.resolvers.promise}abort(){return this.controller?.abort(),this.controller=new AbortController,this.resolvers?.resolve(new URLSearchParams),this.resolvers=null,this.reset()}reset(){let e=Array.from(this.updateMap.keys());return l("[nuqs gtq] Resetting queue %s",JSON.stringify(Object.fromEntries(this.updateMap))),this.updateMap.clear(),this.transitions.clear(),this.options={history:"replace",scroll:!1,shallow:!0},this.timeMs=L.timeMs,e}applyPendingUpdates(e,t){let{updateUrl:r,getSearchParamsSnapshot:n}=e,s=n();if(l("[nuqs gtq] Applying %d pending update(s) on top of %s",this.updateMap.size,s.toString()),this.updateMap.size===0)return[s,null];let o=Array.from(this.updateMap.entries()),i={...this.options},h=Array.from(this.transitions);e.autoResetQueueOnUpdate&&this.reset(),l("[nuqs gtq] Flushing queue %O with options %O",o,i);for(let[a,c]of o)c===null?s.delete(a):s=Oe(c,a,s);t&&(s=t(s));try{return Be(h,()=>{r(s,i)}),[s,null]}catch(a){return console.error(N(429),o.map(([c])=>c).join(),a),[s,a]}}},I=new Ae;function He(e,t,r){let n=we(()=>{let o=Object.fromEntries(e.map(i=>[i,r(i)]));return[JSON.stringify(o),o]},[e.join(","),r]),s=ke(null);return s.current===null&&(s.current=n()),Ke(we(o=>{let i=e.map(h=>t(h,o));return()=>i.forEach(h=>h())},[e.join(","),t]),()=>{let[o,i]=n();return s.current[0]===o?s.current[1]:(s.current=[o,i],i)},()=>s.current[1])}var Ge=class{callback;resolvers=te();controller=new AbortController;queuedValue=void 0;constructor(e){this.callback=e}abort(){this.controller.abort(),this.queuedValue=void 0}push(e,t){return this.queuedValue=e,this.controller.abort(),this.controller=new AbortController,ee(()=>{let r=this.resolvers;try{l("[nuqs dq] Flushing debounce queue",e);let n=this.callback(e);l("[nuqs dq] Reset debounce queue %O",this.queuedValue),this.queuedValue=void 0,this.resolvers=te(),n.then(s=>r.resolve(s)).catch(s=>r.reject(s))}catch(n){this.queuedValue=void 0,r.reject(n)}},t,this.controller.signal),this.resolvers.promise}},Xe=class{throttleQueue;queues=new Map;queuedQuerySync=ne();constructor(e=new Ae){this.throttleQueue=e}useQueuedQueries(e){return He(e,(t,r)=>this.queuedQuerySync.on(t,r),t=>this.getQueuedQuery(t))}push(e,t,r){if(!Number.isFinite(t)){let o=r.getSearchParamsSnapshot??re;return Promise.resolve(o())}let n=e.key;if(!this.queues.has(n)){l("[nuqs dqc] Creating debounce queue for `%s`",n);let o=new Ge(i=>(this.throttleQueue.push(i),this.throttleQueue.flush(r).finally(()=>{this.queues.get(i.key)?.queuedValue===void 0&&(l("[nuqs dqc] Cleaning up empty queue for `%s`",i.key),this.queues.delete(i.key)),this.queuedQuerySync.emit(i.key)})));this.queues.set(n,o)}l("[nuqs dqc] Enqueueing debounce update %O",e);let s=this.queues.get(n).push(e,t);return this.queuedQuerySync.emit(n),s}abort(e){let t=this.queues.get(e);return t?(l("[nuqs dqc] Aborting debounce queue %s=%s",e,t.queuedValue?.query),this.queues.delete(e),t.abort(),this.queuedQuerySync.emit(e),r=>(r.then(t.resolvers.resolve,t.resolvers.reject),r)):r=>r}abortAll(){for(let[e,t]of this.queues.entries())l("[nuqs dqc] Aborting debounce queue %s=%s",e,t.queuedValue?.query),t.abort(),t.resolvers.resolve(new URLSearchParams),this.queuedQuerySync.emit(e);this.queues.clear()}getQueuedQuery(e){let t=this.queues.get(e)?.queuedValue?.query;return t!==void 0?t:this.throttleQueue.getQueuedQuery(e)}},z=new Xe(I);function xe(e,t){return e===t?!0:e===null||t===null||typeof e=="string"||typeof t=="string"||e.length!==t.length?!1:e.every((r,n)=>r===t[n])}import{useCallback as je,useEffect as Pe,useId as Ye,useMemo as se,useRef as Re,useState as Ze}from"react";function ue(e,t,r){try{return e(t)}catch(n){return ge("[nuqs] Error while parsing value `%s`: %O"+(r?" (for key `%s`)":""),t,n,r),null}}function O(e){function t(r){if(typeof r>"u")return null;let n="";if(Array.isArray(r)){if(r[0]===void 0)return null;n=r[0]}return typeof r=="string"&&(n=r),ue(e.parse,n)}return{type:"single",eq:(r,n)=>r===n,...e,parseServerSide:t,withDefault(r){return{...this,defaultValue:r,parseServerSide(n){return t(n)??r}}},withOptions(r){return{...this,...r}}}}var Ve=O({parse:e=>e,serialize:String}),zt=O({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)}),Ft=O({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)}),kt=O({parse:e=>{let t=parseInt(e,16);return t==t?t:null},serialize:e=>{let t=Math.round(e).toString(16);return(t.length&1?"0":"")+t}}),Kt=O({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String}),Wt=O({parse:e=>e.toLowerCase()==="true",serialize:String});function ae(e,t){return e.valueOf()===t.valueOf()}var Bt=O({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:ae}),Ht=O({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:ae}),Gt=O({parse:e=>{let t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:ae});function Ne(e,t=","){let r=e.eq??((s,o)=>s===o),n=encodeURIComponent(t);return O({parse:s=>s===""?[]:s.split(t).map((o,i)=>ue(e.parse,o.replaceAll(n,t),`[${i}]`)).filter(o=>o!=null),serialize:s=>s.map(o=>(e.serialize?e.serialize(o):String(o)).replaceAll(t,n)).join(t),eq(s,o){return s===o?!0:s.length!==o.length?!1:s.every((i,h)=>r(i,o[h]))}})}var oe=ne(),et={};function tt(e,t={}){let r=Ye(),n=ye(),s=be(),{history:o="replace",scroll:i=n?.scroll??!1,shallow:h=n?.shallow??!0,throttleMs:a=L.timeMs,limitUrlUpdates:c=n?.limitUrlUpdates,clearOnDefault:y=n?.clearOnDefault??!0,startTransition:S,urlKeys:w=et}=t,d=Object.keys(e).join(","),m=se(()=>Object.fromEntries(Object.keys(e).map(u=>[u,w[u]??u])),[d,JSON.stringify(w)]),R=Se(Object.values(m)),A=R.searchParams,U=Re({}),D=se(()=>Object.fromEntries(Object.keys(e).map(u=>[u,e[u].defaultValue??null])),[Object.values(e).map(({defaultValue:u})=>u).join(",")]),E=z.useQueuedQueries(Object.values(m)),[_,k]=Ze(()=>ie(e,w,A??new URLSearchParams,E).state),q=Re(_);if(l("[nuq+ %s `%s`] render - state: %O, iSP: %s",r,d,_,A),Object.keys(U.current).join("&")!==Object.values(m).join("&")){let{state:u,hasChanged:f}=ie(e,w,A,E,U.current,q.current);f&&(l("[nuq+ %s `%s`] State changed: %O",r,d,{state:u,initialSearchParams:A,queuedQueries:E,queryRef:U.current,stateRef:q.current}),q.current=u,k(u)),U.current=Object.fromEntries(Object.entries(m).map(([g,v])=>[v,e[g]?.type==="multi"?A?.getAll(v):A?.get(v)??null]))}Pe(()=>{let{state:u,hasChanged:f}=ie(e,w,A,E,U.current,q.current);f&&(l("[nuq+ %s `%s`] State changed: %O",r,d,{state:u,initialSearchParams:A,queuedQueries:E,queryRef:U.current,stateRef:q.current}),q.current=u,k(u))},[Object.values(m).map(u=>`${u}=${A?.getAll(u)}`).join("&"),JSON.stringify(E)]),Pe(()=>{let u=Object.keys(e).reduce((f,g)=>(f[g]=({state:v,query:J})=>{k(C=>{let{defaultValue:j}=e[g],Q=m[g],$=v??j??null,x=C[g]??j??null;return Object.is(x,$)?(l("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",r,d,Q,v,j,q.current),C):(q.current={...q.current,[g]:$},U.current[Q]=J,l("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",r,d,Q,v,j,q.current),q.current)})},f),{});for(let f of Object.keys(e)){let g=m[f];l("[nuq+ %s `%s`] Subscribing to sync for `%s`",r,g,d),oe.on(g,u[f])}return()=>{for(let f of Object.keys(e)){let g=m[f];l("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",r,g,d),oe.off(g,u[f])}}},[d,m]);let Le=je((u,f={})=>{let g=Object.fromEntries(Object.keys(e).map(x=>[x,null])),v=typeof u=="function"?u(Ue(q.current,D))??g:u??g;l("[nuq+ %s `%s`] setState: %O",r,d,v);let J,C=0,j=!1,Q=[];for(let[x,P]of Object.entries(v)){let b=e[x],K=m[x];if(!b)continue;(f.clearOnDefault??b.clearOnDefault??y)&&P!==null&&b.defaultValue!==void 0&&(b.eq??((V,B)=>V===B))(P,b.defaultValue)&&(P=null);let fe=P===null?null:(b.serialize??String)(P);oe.emit(K,{state:P,query:fe});let W={key:K,query:fe,options:{history:f.history??b.history??o,shallow:f.shallow??b.shallow??h,scroll:f.scroll??b.scroll??i,startTransition:f.startTransition??b.startTransition??S}};if(f?.limitUrlUpdates?.method==="debounce"||c?.method==="debounce"||b.limitUrlUpdates?.method==="debounce"){W.options.shallow===!0&&console.warn(N(422));let V=f?.limitUrlUpdates?.timeMs??c?.timeMs??b.limitUrlUpdates?.timeMs??L.timeMs,B=z.push(W,V,R);C<V&&(J=B,C=V)}else{let V=f?.limitUrlUpdates?.timeMs??b?.limitUrlUpdates?.timeMs??c?.timeMs??f.throttleMs??b.throttleMs??a;Q.push(z.abort(K)),I.push(W,V),j=!0}}let $=Q.reduce((x,P)=>P(x),j?I.flush(R,s):I.getPendingPromise(R));return J??$},[d,o,h,i,a,c?.method,c?.timeMs,S,m,R.updateUrl,R.getSearchParamsSnapshot,R.rateLimitFactor,s,D]);return[se(()=>Ue(_,D),[_,D]),Le]}function ie(e,t,r,n,s,o){let i=!1,h=Object.entries(e).reduce((a,[c,y])=>{let S=t?.[c]??c,w=n[S],d=y.type==="multi"?[]:null,m=w===void 0?(y.type==="multi"?r?.getAll(S):r?.get(S))??d:w;return s&&o&&xe(s[S]??d,m)?(a[c]=o[c]??null,a):(i=!0,a[c]=(ve(m)?null:ue(y.parse,m,S))??null,s&&(s[S]=m),a)},{});if(!i){let a=Object.keys(e),c=Object.keys(o??{});i=a.length!==c.length||a.some(y=>!c.includes(y))}return{state:h,hasChanged:i}}function Ue(e,t){return Object.fromEntries(Object.keys(e).map(r=>[r,e[r]??t[r]??null]))}function ce(e,t={}){let{parse:r,type:n,serialize:s,eq:o,defaultValue:i,...h}=t,[{[e]:a},c]=tt({[e]:{parse:r??(y=>y),type:n,serialize:s,eq:o,defaultValue:i}},h);return[a,je((y,S={})=>c(w=>({[e]:typeof y=="function"?y(w[e]):y}),S),[e,c])]}import{useMemo as le}from"react";function Ee(){return p.exportParams?this.source:this}String.prototype.source=void 0,String.prototype.toJSON=Ee,String.prototype.bindSource=function(e){let t=new String(this);return t.source=e,t},Array.prototype.toJSON||(Array.prototype.toJSON=Ee),Array.prototype.bindSource||(Array.prototype.bindSource=function(e){return this.source=e,this});var rt=(e,t)=>{let[r,n]=ce(e,{defaultValue:t});return[le(()=>p.current?r.bindSource(M(e,"searchString","",t)):r,[e,r]),n]},nt=(e,t=[],r=",")=>{let n=le(()=>t,[]),[s,o]=ce(e,Ne(Ve,r).withDefault(n));return[le(()=>p.current?s.bindSource(M(e,"searchArray",r,t)):s,[e,s]),o]},M=(e,t,r,n)=>`@JV[[${JSON.stringify({key:e,type:t,separator:r,def:n})}]]`;import{createContext as st}from"react";var F=st({deps:[],children:void 0});var it=(e,t="")=>{let{deps:r}=ot(F),n=Qe(()=>location.pathname.split("/")[e+1]??t,r||[]);return Qe(()=>p.current?n.bindSource(M(e.toString(),"paramsIndex","",t)):n,[n])};import{useContext as ut,useMemo as Te}from"react";var at=()=>{let{deps:e}=ut(F),t=Te(()=>location.search.substring(1),e||[]);return Te(()=>p.current?t.bindSource(M("","search","","")):t,[t])};var ct=({name:e,props:t,children:r})=>p.current?`<custom>${JSON.stringify({name:e,props:t})}<custom>`:r;export{ct as Custom,De as real,it as useParamsIndex,at as useSearch,nt as useSearchArray,rt as useSearchValue,Ie as useServerState};
|
|
1
|
+
export { useServerState } from './src/front/server-state/useServerState.js';
|
|
2
|
+
export { real } from './src/front/server-state/real.js';
|
|
3
|
+
export { useParamsIndex } from './src/front/url/params/useParamsIndex.js';
|
|
4
|
+
export { useSearchArray, useSearchValue } from './src/front/url/search/useSearchValue.js';
|
|
5
|
+
export { useSearch } from './src/front/url/search/useSearch.js';
|
|
6
|
+
export { Custom } from './src/front/wrapper/Custom.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultIndexHtml = "\n<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <link rel=\"icon\" type=\"image/svg+xml\" href=\"/images/favicon.svg\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>App</title>\n <!--app-head-->\n </head>\n <body>\n <div id=\"root\"><!--app-html--></div>\n </body>\n</html>\n\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const normalizeHtmlWhitespace: (html: string) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type input = {
|
|
2
|
+
method: string;
|
|
3
|
+
url: string;
|
|
4
|
+
input: object;
|
|
5
|
+
};
|
|
6
|
+
export interface PageData {
|
|
7
|
+
id: number;
|
|
8
|
+
mask: string;
|
|
9
|
+
root: string;
|
|
10
|
+
input: input[];
|
|
11
|
+
test?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const getRawPageData: (url: string, pages: string[], test?: boolean, debug?: boolean) => Promise<PageData[]>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
interface ParserOptions {
|
|
2
|
+
templates?: boolean;
|
|
3
|
+
normalize?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export type Element = ArrayElement | HtmlElement | ValueElement | CustomElement;
|
|
6
|
+
interface ArrayElement {
|
|
7
|
+
type: "array";
|
|
8
|
+
key: string;
|
|
9
|
+
data: Element[];
|
|
10
|
+
}
|
|
11
|
+
interface HtmlElement {
|
|
12
|
+
type: "html";
|
|
13
|
+
content: string;
|
|
14
|
+
}
|
|
15
|
+
interface ValueElement {
|
|
16
|
+
type: "value";
|
|
17
|
+
key: string;
|
|
18
|
+
}
|
|
19
|
+
interface CustomElement {
|
|
20
|
+
type: "custom";
|
|
21
|
+
name: string;
|
|
22
|
+
props: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class Parser {
|
|
25
|
+
options?: ParserOptions;
|
|
26
|
+
openVar: string;
|
|
27
|
+
createVar: string;
|
|
28
|
+
createArray: string;
|
|
29
|
+
createCustom: string;
|
|
30
|
+
deepUp: string;
|
|
31
|
+
deepUp2: string;
|
|
32
|
+
templates: Record<string, string>;
|
|
33
|
+
constructor(options?: ParserOptions);
|
|
34
|
+
parse(content: string): Element[];
|
|
35
|
+
handle(content: string, tree: Element[]): void;
|
|
36
|
+
createCustomElement(parent: Element[], value: string): void;
|
|
37
|
+
createElement(parent: Element[], value: string, isVarible?: boolean): number;
|
|
38
|
+
createTemplate(html: string): string;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { input, PageData } from "../playwright/templates";
|
|
2
|
+
import { Element } from "./Parser";
|
|
3
|
+
interface Route {
|
|
4
|
+
id: number;
|
|
5
|
+
mask: string;
|
|
6
|
+
requests: input[];
|
|
7
|
+
content: Element[];
|
|
8
|
+
}
|
|
9
|
+
export declare const getRoutesAndTemplates: (pages: PageData[], normalize?: boolean, templates?: boolean) => {
|
|
10
|
+
routes: Route[];
|
|
11
|
+
templates: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const removeDevScripts: (indexHtml: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const vitePreview: () => Promise<[string, () => void]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Color, Ora, Spinner } from "ora";
|
|
2
|
+
export default class Task {
|
|
3
|
+
spiner: Ora | undefined;
|
|
4
|
+
do(task: string, color?: Color, spinner?: Spinner, prefix?: string): void;
|
|
5
|
+
next(task: string, color?: Color, spinner?: Spinner, level?: number): void;
|
|
6
|
+
success(): void;
|
|
7
|
+
fail(): void;
|
|
8
|
+
ask(question: string, defaultAnswer?: string): Promise<string>;
|
|
9
|
+
}
|
|
@@ -4,9 +4,11 @@ import { useLocation } from 'react-router-dom';
|
|
|
4
4
|
import { JinraiContext } from '../JinraiContext.js';
|
|
5
5
|
|
|
6
6
|
const Adapter = (props) => {
|
|
7
|
-
|
|
7
|
+
// useLocation требует, чтобы компонент был внутри RouterProvider
|
|
8
|
+
// NuqsAdapter должен быть установлен на верхнем уровне, но может работать внутри роутера
|
|
9
|
+
// для React Router v6 адаптера
|
|
8
10
|
const { pathname } = useLocation();
|
|
9
|
-
return (jsx(NuqsAdapter, { children: jsx(JinraiContext.Provider, { value: { deps: [...(props.deps ?? [],
|
|
11
|
+
return (jsx(NuqsAdapter, { children: jsx(JinraiContext.Provider, { value: { deps: [...(props.deps ?? []), pathname] }, ...props }) }));
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export { Adapter };
|
|
@@ -4,8 +4,11 @@ import { useLocation } from 'react-router-dom';
|
|
|
4
4
|
import { JinraiContext } from '../JinraiContext.js';
|
|
5
5
|
|
|
6
6
|
const Adapter = (props) => {
|
|
7
|
+
// useLocation требует, чтобы компонент был внутри RouterProvider
|
|
8
|
+
// NuqsAdapter должен быть установлен на верхнем уровне, но может работать внутри роутера
|
|
9
|
+
// для React Router v7 адаптера
|
|
7
10
|
const { pathname } = useLocation();
|
|
8
|
-
return (jsx(NuqsAdapter, { children: jsx(JinraiContext.Provider, { value: { deps: [...(props.deps ?? [],
|
|
11
|
+
return (jsx(NuqsAdapter, { children: jsx(JinraiContext.Provider, { value: { deps: [...(props.deps ?? []), pathname] }, ...props }) }));
|
|
9
12
|
};
|
|
10
13
|
|
|
11
14
|
export { Adapter };
|
package/lib/vite/plugin.js
CHANGED
|
@@ -1 +1,209 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createServer } from 'vite';
|
|
2
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
3
|
+
import { chromium } from 'playwright';
|
|
4
|
+
import { createHash } from 'node:crypto';
|
|
5
|
+
import { writeFile } from 'fs/promises';
|
|
6
|
+
|
|
7
|
+
const pageCollector = async (page) => {
|
|
8
|
+
const state = await page.evaluate(() => {
|
|
9
|
+
return window.__page_requests;
|
|
10
|
+
});
|
|
11
|
+
const root = await page.locator("#root").innerHTML();
|
|
12
|
+
return { state, root };
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const normalizeHtmlWhitespace = (html) => {
|
|
16
|
+
return html
|
|
17
|
+
.replace(/\r?\n|\r/g, " ")
|
|
18
|
+
.replace(/\s+/g, " ")
|
|
19
|
+
.replace(/>\s+</g, "><")
|
|
20
|
+
.trim();
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
class Parser {
|
|
24
|
+
options;
|
|
25
|
+
openVar = "{{";
|
|
26
|
+
createVar = "}}";
|
|
27
|
+
createArray = "</loopwrapper";
|
|
28
|
+
createCustom = "</custom";
|
|
29
|
+
deepUp = "<loopwrapper";
|
|
30
|
+
deepUp2 = "<custom";
|
|
31
|
+
templates = {};
|
|
32
|
+
constructor(options) {
|
|
33
|
+
this.options = options;
|
|
34
|
+
}
|
|
35
|
+
parse(content) {
|
|
36
|
+
const tree = [];
|
|
37
|
+
this.handle(this.options?.normalize ? normalizeHtmlWhitespace(content) : content, tree);
|
|
38
|
+
return tree;
|
|
39
|
+
}
|
|
40
|
+
handle(content, tree) {
|
|
41
|
+
let match;
|
|
42
|
+
let deep = 0;
|
|
43
|
+
let lastIndex = 0;
|
|
44
|
+
const tagPattern = new RegExp(`(<loopwrapper(\\s+[^>]*)?>|</loopwrapper>|\{\{|\}\}|<custom(\\s+[^>]*)?>|</custom>)`, "gi");
|
|
45
|
+
while ((match = tagPattern.exec(content)) !== null) {
|
|
46
|
+
const currentTag = match[0];
|
|
47
|
+
const value = content.substring(lastIndex, match.index);
|
|
48
|
+
if (currentTag.startsWith(this.createArray)) {
|
|
49
|
+
deep--;
|
|
50
|
+
if (deep > 0)
|
|
51
|
+
continue;
|
|
52
|
+
this.createElement(tree, value);
|
|
53
|
+
}
|
|
54
|
+
else if (currentTag.startsWith(this.deepUp)) {
|
|
55
|
+
deep++;
|
|
56
|
+
if (deep > 1)
|
|
57
|
+
continue;
|
|
58
|
+
this.createElement(tree, value);
|
|
59
|
+
}
|
|
60
|
+
else if (currentTag.startsWith(this.createCustom)) {
|
|
61
|
+
deep--;
|
|
62
|
+
if (deep != 0)
|
|
63
|
+
continue;
|
|
64
|
+
this.createCustomElement(tree, value);
|
|
65
|
+
}
|
|
66
|
+
else if (currentTag.startsWith(this.deepUp2)) {
|
|
67
|
+
deep++;
|
|
68
|
+
if (deep > 1)
|
|
69
|
+
continue;
|
|
70
|
+
this.createElement(tree, value);
|
|
71
|
+
}
|
|
72
|
+
else if (currentTag == this.createVar) {
|
|
73
|
+
if (deep != 0)
|
|
74
|
+
continue;
|
|
75
|
+
this.createElement(tree, value, true);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
if (deep != 0)
|
|
79
|
+
continue;
|
|
80
|
+
this.createElement(tree, value);
|
|
81
|
+
}
|
|
82
|
+
lastIndex = match.index + currentTag.length;
|
|
83
|
+
}
|
|
84
|
+
if (lastIndex < content.length) {
|
|
85
|
+
const value = content.substring(lastIndex);
|
|
86
|
+
this.createElement(tree, value);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
createCustomElement(parent, value) {
|
|
90
|
+
const [name, ...props] = value.trimStart().split("|");
|
|
91
|
+
value = props.join("|");
|
|
92
|
+
parent.push({
|
|
93
|
+
type: "custom",
|
|
94
|
+
name,
|
|
95
|
+
props: value,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
createElement(parent, value, isVarible) {
|
|
99
|
+
if (isVarible)
|
|
100
|
+
return parent.push({
|
|
101
|
+
type: "value",
|
|
102
|
+
key: value,
|
|
103
|
+
});
|
|
104
|
+
if (value.trimStart().startsWith("ArrayDataKey=")) {
|
|
105
|
+
const [key, ...val] = value.trimStart().substring(13).split("|");
|
|
106
|
+
value = val.join("|");
|
|
107
|
+
const children = [];
|
|
108
|
+
this.handle(value, children);
|
|
109
|
+
return parent.push({
|
|
110
|
+
type: "array",
|
|
111
|
+
data: children,
|
|
112
|
+
key,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (value)
|
|
116
|
+
parent.push({
|
|
117
|
+
type: "html",
|
|
118
|
+
content: this.options?.templates ? this.createTemplate(value) : value,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
createTemplate(html) {
|
|
122
|
+
if (!(html in this.templates)) {
|
|
123
|
+
this.templates[html] = createHash("md5").update(Object.keys(this.templates).length.toString()).digest("hex");
|
|
124
|
+
}
|
|
125
|
+
return this.templates[html];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const getRoutesAndTemplates = (pages, normalize = true, templates = true) => {
|
|
130
|
+
const routes = [];
|
|
131
|
+
const parser = new Parser({ normalize, templates });
|
|
132
|
+
for (const [id, template] of pages.entries()) {
|
|
133
|
+
const content = parser.parse(template.root);
|
|
134
|
+
const mask = template.mask.replaceAll("/", "\\/").replace(/{(.*?)}/, ".+?");
|
|
135
|
+
routes.push({
|
|
136
|
+
id,
|
|
137
|
+
content,
|
|
138
|
+
mask,
|
|
139
|
+
requests: template.input,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
routes,
|
|
144
|
+
templates: parser.templates,
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const urlStorage = new AsyncLocalStorage();
|
|
149
|
+
function hydration() {
|
|
150
|
+
if (process.env.CHILD_JINRAI_DEV_SERVER) {
|
|
151
|
+
return { name: "vite-jinrai-dummy" };
|
|
152
|
+
}
|
|
153
|
+
process.env.CHILD_JINRAI_DEV_SERVER = "true";
|
|
154
|
+
console.log("create mirror");
|
|
155
|
+
let mirrorServer = undefined;
|
|
156
|
+
let context = undefined;
|
|
157
|
+
let debugUrl = undefined;
|
|
158
|
+
createServer({
|
|
159
|
+
server: {
|
|
160
|
+
port: 3012,
|
|
161
|
+
},
|
|
162
|
+
}).then(async (server) => {
|
|
163
|
+
mirrorServer = server;
|
|
164
|
+
await mirrorServer.listen();
|
|
165
|
+
debugUrl = mirrorServer.resolvedUrls?.local[0].slice(0, -1);
|
|
166
|
+
chromium.launch({ headless: true, devtools: false }).then(async (browser) => {
|
|
167
|
+
console.log("create context");
|
|
168
|
+
context = await browser.newContext({
|
|
169
|
+
userAgent: "____fast-ssr-tool___",
|
|
170
|
+
locale: "ru-RU",
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
return {
|
|
175
|
+
name: "vite-jinrai",
|
|
176
|
+
configureServer(server) {
|
|
177
|
+
server.middlewares.use((req, _res, next) => {
|
|
178
|
+
if (req.url?.startsWith("/@")) {
|
|
179
|
+
return next();
|
|
180
|
+
}
|
|
181
|
+
urlStorage.run(req.url, () => {
|
|
182
|
+
next();
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
async transformIndexHtml(html) {
|
|
187
|
+
const currentUrl = urlStorage.getStore();
|
|
188
|
+
if (currentUrl && context) {
|
|
189
|
+
const page = await context.newPage();
|
|
190
|
+
await page.goto(debugUrl + currentUrl);
|
|
191
|
+
await page.waitForLoadState("networkidle");
|
|
192
|
+
const { root } = await pageCollector(page);
|
|
193
|
+
const { routes } = getRoutesAndTemplates([{ id: 1, input: [], mask: currentUrl, root }], true, false);
|
|
194
|
+
console.log({ routes });
|
|
195
|
+
writeFile("./routs.json", JSON.stringify(routes, null, 2));
|
|
196
|
+
const result = html.replace("<!--app-html-->", root);
|
|
197
|
+
page.close();
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
return html;
|
|
201
|
+
},
|
|
202
|
+
closeWatcher() {
|
|
203
|
+
console.log("Stop server");
|
|
204
|
+
// mirrorServer?.close()
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export { hydration };
|
package/package.json
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jinrai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "A powerful library that analyzes your modern web application and automatically generates a perfectly rendered, static snapshot of its pages. Experience unparalleled loading speed and SEO clarity without the complexity of traditional SSR setups. Simply point Jinrai at your SPA and witness divine speed.",
|
|
5
5
|
"main": "lib/index.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "vitest",
|
|
8
8
|
"dev": "nodemon --watch './src' --watch './vite' --ext 'ts' --exec \"npm run build\"",
|
|
9
|
-
"build": "npm run build
|
|
10
|
-
"build:
|
|
11
|
-
"build
|
|
12
|
-
"build-plugin-config": "npx esbuild config.ts --bundle --platform=node --format=esm --outfile=lib/config/config.js --external:jiti --external:node:* --external:playwright --external:react --minify",
|
|
13
|
-
"build-config": "npx esbuild src/bin/bin.ts --bundle --platform=node --format=esm --outfile=lib/bin/bin.js --external:jiti --external:node:* --external:playwright --external:prettier --external:vite --external:react --minify",
|
|
14
|
-
"build-plugin": "npx esbuild vite/plugin.ts --bundle --platform=node --format=esm --outfile=lib/vite/plugin.js --external:jiti --external:node:* --external:playwright --external:prettier --external:vite --external:react --minify",
|
|
15
|
-
"build-front": "rollup -c rollup.front.config.mjs && tsc -p front.config.json --emitDeclarationOnly"
|
|
9
|
+
"build": "npm run build:js && npm run build:types",
|
|
10
|
+
"build:js": "rollup -c rollup.config.mjs",
|
|
11
|
+
"build:types": "tsc -p tsconfig.types.json"
|
|
16
12
|
},
|
|
17
13
|
"keywords": [],
|
|
18
14
|
"author": "",
|
|
@@ -37,17 +33,15 @@
|
|
|
37
33
|
"dependencies": {
|
|
38
34
|
"@types/prettier": "^2.7.3",
|
|
39
35
|
"jiti": "^2.6.0",
|
|
40
|
-
"nuqs": "^2.0.0",
|
|
41
36
|
"ora": "^9.0.0",
|
|
42
37
|
"playwright": "^1.55.1",
|
|
43
38
|
"prettier": "^3.6.2"
|
|
44
39
|
},
|
|
45
40
|
"peerDependencies": {
|
|
46
|
-
"@types/react": "^18.0.0 || ^19.0.0",
|
|
47
|
-
"nuqs": "^2.0.0",
|
|
48
41
|
"react": "^18.0.0 || ^19.0.0",
|
|
49
42
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
50
|
-
"react-router-dom": "^6.0.0"
|
|
43
|
+
"react-router-dom": "^6.0.0",
|
|
44
|
+
"nuqs": "^2.0.0"
|
|
51
45
|
},
|
|
52
46
|
"exports": {
|
|
53
47
|
".": {
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import path from "node:path"
|
|
2
|
+
import { fileURLToPath } from "node:url"
|
|
3
|
+
import { createRequire } from "node:module"
|
|
4
|
+
|
|
5
|
+
import typescript from "@rollup/plugin-typescript"
|
|
6
|
+
import { defineConfig } from "rollup"
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
9
|
+
const __dirname = path.dirname(__filename)
|
|
10
|
+
|
|
11
|
+
const require = createRequire(import.meta.url)
|
|
12
|
+
const pkg = require("./package.json")
|
|
13
|
+
|
|
14
|
+
// Базовые external зависимости для всех сборок
|
|
15
|
+
const baseExternal = [
|
|
16
|
+
"jiti",
|
|
17
|
+
"node:*",
|
|
18
|
+
"playwright",
|
|
19
|
+
"react",
|
|
20
|
+
"react-dom",
|
|
21
|
+
"react-router-dom",
|
|
22
|
+
"nuqs",
|
|
23
|
+
"prettier",
|
|
24
|
+
"vite"
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
// Функция для проверки external зависимостей
|
|
28
|
+
const createIsExternal = (additionalExternals = []) => {
|
|
29
|
+
const allExternals = [...baseExternal, ...additionalExternals]
|
|
30
|
+
const externalSet = new Set([
|
|
31
|
+
...allExternals,
|
|
32
|
+
...Object.keys(pkg.dependencies ?? {}),
|
|
33
|
+
...Object.keys(pkg.peerDependencies ?? {})
|
|
34
|
+
])
|
|
35
|
+
|
|
36
|
+
return (id) => {
|
|
37
|
+
// Важно: nuqs всегда должен оставаться внешним
|
|
38
|
+
if (id === "nuqs" || id.startsWith("nuqs/")) {
|
|
39
|
+
return true
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Проверка на node: протокол и встроенные модули Node.js
|
|
43
|
+
if (id.startsWith("node:") ||
|
|
44
|
+
["url", "path", "fs", "fs/promises", "async_hooks", "child_process"].includes(id)) {
|
|
45
|
+
return true
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Локальные импорты не external
|
|
49
|
+
if (id.startsWith(".") || path.isAbsolute(id)) {
|
|
50
|
+
return false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Проверка по списку external
|
|
54
|
+
for (const ext of externalSet) {
|
|
55
|
+
if (id === ext || id.startsWith(`${ext}/`)) {
|
|
56
|
+
return true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return false
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default defineConfig([
|
|
65
|
+
// 1. Frontend часть (index.ts + адаптеры)
|
|
66
|
+
{
|
|
67
|
+
input: {
|
|
68
|
+
index: path.resolve(__dirname, "index.ts"),
|
|
69
|
+
"src/front/url/adapter/rrd6": path.resolve(__dirname, "src/front/url/adapter/rrd6.tsx"),
|
|
70
|
+
"src/front/url/adapter/rrd7": path.resolve(__dirname, "src/front/url/adapter/rrd7.tsx"),
|
|
71
|
+
"src/front/url/adapter/def": path.resolve(__dirname, "src/front/url/adapter/def.tsx")
|
|
72
|
+
},
|
|
73
|
+
output: {
|
|
74
|
+
dir: path.resolve(__dirname, "lib"),
|
|
75
|
+
format: "esm",
|
|
76
|
+
preserveModules: true,
|
|
77
|
+
preserveModulesRoot: "."
|
|
78
|
+
},
|
|
79
|
+
external: createIsExternal(),
|
|
80
|
+
plugins: [
|
|
81
|
+
typescript({
|
|
82
|
+
tsconfig: path.resolve(__dirname, "front.config.json"),
|
|
83
|
+
declaration: false,
|
|
84
|
+
sourceMap: false
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
// 2. Главный index.ts (уже включен выше, но для ясности оставляем)
|
|
89
|
+
// На самом деле он уже в первой конфигурации, так что можно убрать
|
|
90
|
+
|
|
91
|
+
// 3. config.ts
|
|
92
|
+
{
|
|
93
|
+
input: path.resolve(__dirname, "config.ts"),
|
|
94
|
+
output: {
|
|
95
|
+
file: path.resolve(__dirname, "lib/config/config.js"),
|
|
96
|
+
format: "esm"
|
|
97
|
+
},
|
|
98
|
+
external: createIsExternal(),
|
|
99
|
+
plugins: [
|
|
100
|
+
typescript({
|
|
101
|
+
tsconfig: path.resolve(__dirname, "tsconfig.base.json"),
|
|
102
|
+
declaration: false,
|
|
103
|
+
sourceMap: false,
|
|
104
|
+
include: ["config.ts", "src/bin/config/**/*.ts"]
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
// 4. src/bin/bin.ts
|
|
109
|
+
{
|
|
110
|
+
input: path.resolve(__dirname, "src/bin/bin.ts"),
|
|
111
|
+
output: {
|
|
112
|
+
file: path.resolve(__dirname, "lib/bin/bin.js"),
|
|
113
|
+
format: "esm",
|
|
114
|
+
banner: "#!/usr/bin/env node"
|
|
115
|
+
},
|
|
116
|
+
external: createIsExternal(),
|
|
117
|
+
plugins: [
|
|
118
|
+
typescript({
|
|
119
|
+
tsconfig: path.resolve(__dirname, "tsconfig.base.json"),
|
|
120
|
+
declaration: false,
|
|
121
|
+
sourceMap: false,
|
|
122
|
+
include: ["src/bin/**/*.ts", "src/bin/**/*.tsx"]
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
// 5. vite/plugin.ts
|
|
127
|
+
{
|
|
128
|
+
input: path.resolve(__dirname, "vite/plugin.ts"),
|
|
129
|
+
output: {
|
|
130
|
+
file: path.resolve(__dirname, "lib/vite/plugin.js"),
|
|
131
|
+
format: "esm"
|
|
132
|
+
},
|
|
133
|
+
external: createIsExternal(),
|
|
134
|
+
plugins: [
|
|
135
|
+
typescript({
|
|
136
|
+
tsconfig: path.resolve(__dirname, "tsconfig.base.json"),
|
|
137
|
+
declaration: false,
|
|
138
|
+
sourceMap: false,
|
|
139
|
+
include: ["vite/**/*.ts", "src/bin/**/*.ts"]
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
])
|
|
144
|
+
|
package/src/bin/bin.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react"
|
|
1
2
|
import { NuqsAdapter } from "nuqs/adapters/react-router/v6"
|
|
2
3
|
|
|
3
4
|
// @ts-ignore
|
|
@@ -5,12 +6,14 @@ import { useLocation } from "react-router-dom"
|
|
|
5
6
|
import { JinraiContext, JinraiProps } from "../JinraiContext"
|
|
6
7
|
|
|
7
8
|
export const Adapter = (props: JinraiProps) => {
|
|
8
|
-
|
|
9
|
+
// useLocation требует, чтобы компонент был внутри RouterProvider
|
|
10
|
+
// NuqsAdapter должен быть установлен на верхнем уровне, но может работать внутри роутера
|
|
11
|
+
// для React Router v6 адаптера
|
|
9
12
|
const { pathname } = useLocation()
|
|
10
13
|
|
|
11
14
|
return (
|
|
12
15
|
<NuqsAdapter>
|
|
13
|
-
<JinraiContext.Provider value={{ deps: [...(props.deps ?? [],
|
|
16
|
+
<JinraiContext.Provider value={{ deps: [...(props.deps ?? []), pathname] }} {...props} />
|
|
14
17
|
</NuqsAdapter>
|
|
15
18
|
)
|
|
16
19
|
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react"
|
|
2
2
|
import { NuqsAdapter } from "nuqs/adapters/react-router/v7"
|
|
3
3
|
// @ts-ignore
|
|
4
4
|
import { useLocation } from "react-router-dom"
|
|
5
5
|
import { JinraiContext, JinraiProps } from "../JinraiContext"
|
|
6
6
|
|
|
7
7
|
export const Adapter = (props: JinraiProps) => {
|
|
8
|
+
// useLocation требует, чтобы компонент был внутри RouterProvider
|
|
9
|
+
// NuqsAdapter должен быть установлен на верхнем уровне, но может работать внутри роутера
|
|
10
|
+
// для React Router v7 адаптера
|
|
8
11
|
const { pathname } = useLocation()
|
|
9
12
|
|
|
10
13
|
return (
|
|
11
14
|
<NuqsAdapter>
|
|
12
|
-
<JinraiContext.Provider value={{ deps: [...(props.deps ?? [],
|
|
15
|
+
<JinraiContext.Provider value={{ deps: [...(props.deps ?? []), pathname] }} {...props} />
|
|
13
16
|
</NuqsAdapter>
|
|
14
17
|
)
|
|
15
18
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"strict": false,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"jsx": "react-jsx",
|
|
11
|
+
"jsxImportSource": "react"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react-jsx",
|
|
4
|
+
"jsxImportSource": "react",
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
"target": "esnext",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"emitDeclarationOnly": true,
|
|
10
|
+
"outDir": "lib",
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"baseUrl": ".",
|
|
14
|
+
"paths": {
|
|
15
|
+
"react": ["node_modules/react"],
|
|
16
|
+
"react-dom": ["node_modules/react-dom"]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"include": [
|
|
20
|
+
"index.ts",
|
|
21
|
+
"config.ts",
|
|
22
|
+
"src/**/*.ts",
|
|
23
|
+
"src/**/*.tsx",
|
|
24
|
+
"vite/**/*.ts"
|
|
25
|
+
],
|
|
26
|
+
"exclude": [
|
|
27
|
+
"node_modules",
|
|
28
|
+
"lib",
|
|
29
|
+
"tests"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
|
package/rollup.front.config.mjs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import path from "node:path"
|
|
2
|
-
import { fileURLToPath } from "node:url"
|
|
3
|
-
import { createRequire } from "node:module"
|
|
4
|
-
|
|
5
|
-
import typescript from "@rollup/plugin-typescript"
|
|
6
|
-
import { defineConfig } from "rollup"
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
9
|
-
const __dirname = path.dirname(__filename)
|
|
10
|
-
|
|
11
|
-
const require = createRequire(import.meta.url)
|
|
12
|
-
const pkg = require("./package.json")
|
|
13
|
-
|
|
14
|
-
const externalDeps = new Set([
|
|
15
|
-
...Object.keys(pkg.dependencies ?? {}),
|
|
16
|
-
...Object.keys(pkg.peerDependencies ?? {})
|
|
17
|
-
])
|
|
18
|
-
|
|
19
|
-
const entryPoints = [
|
|
20
|
-
path.resolve(__dirname, "index.ts"),
|
|
21
|
-
path.resolve(__dirname, "src/front/url/adapter/rrd6.tsx"),
|
|
22
|
-
path.resolve(__dirname, "src/front/url/adapter/rrd7.tsx"),
|
|
23
|
-
path.resolve(__dirname, "src/front/url/adapter/def.tsx")
|
|
24
|
-
]
|
|
25
|
-
|
|
26
|
-
const isExternal = (id) => {
|
|
27
|
-
if (id.startsWith(".") || path.isAbsolute(id)) {
|
|
28
|
-
return false
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
for (const dep of externalDeps) {
|
|
32
|
-
if (id === dep || id.startsWith(`${dep}/`)) {
|
|
33
|
-
return true
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return false
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default defineConfig({
|
|
41
|
-
input: entryPoints,
|
|
42
|
-
output: {
|
|
43
|
-
dir: path.resolve(__dirname, "lib"),
|
|
44
|
-
format: "esm",
|
|
45
|
-
preserveModules: true,
|
|
46
|
-
preserveModulesRoot: "."
|
|
47
|
-
},
|
|
48
|
-
external: isExternal,
|
|
49
|
-
plugins: [
|
|
50
|
-
typescript({
|
|
51
|
-
tsconfig: path.resolve(__dirname, "front.config.json"),
|
|
52
|
-
declaration: false,
|
|
53
|
-
sourceMap: false
|
|
54
|
-
})
|
|
55
|
-
]
|
|
56
|
-
})
|
|
57
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|