it-tools/dist/client/assets/chunks/chunk-e9714d86.js

3 lines
27 KiB
JavaScript
Raw Normal View History

2024-04-28 00:48:29 +08:00
function $e(){return!(typeof process>"u"||!process.cwd||!process.versions||typeof process.versions.node>"u"||!process.release||process.release.name!=="node")}function V(e,t){let n;{var r=Error.stackTraceLimit;Error.stackTraceLimit=1/0,n=new Error(e),Error.stackTraceLimit=r}return $e()&&(n.stack=be(n.stack,t)),n}function be(e,t){if(!e)return e;const n=Se(e);let r=0;return n.filter(o=>o.includes(" (internal/")||o.includes(" (node:internal")?!1:r<t&&we(o)?(r++,!1):!0).join(`
`)}function we(e){return e.startsWith(" at ")}function Se(e){return e.split(/\r?\n/)}function x(e,t){const n=globalThis.__vite_plugin_ssr=globalThis.__vite_plugin_ssr||{};return n[e]=n[e]||t}function b(e){return typeof e=="object"&&e!==null}function U(e){return Array.from(new Set(e))}const E=x("assertPackageInstances.ts",{instances:[],alreadyLogged:new Set}),ie="The client runtime of Server Routing as well as the client runtime of Client Routing are both being loaded. Make sure they aren't loaded both at the same time for a given page. See https://vite-plugin-ssr.com/client-runtimes-conflict",B="Two vite-plugin-ssr client runtime instances are being loaded. Make sure your client-side bundles don't include vite-plugin-ssr twice. (In order to reduce the size of your client-side JavaScript bundles.)";function H(){{const e=U(E.instances);Re(e.length<=1,`Both vite-plugin-ssr@${e[0]} and vite-plugin-ssr@${e[1]} loaded. Only one version should be loaded.`)}E.checkSingleInstance&&E.instances.length>1&&_(!1,B,{onlyOnce:!0,showStackTrace:!0})}function Bt(e){_(E.isClientRouting!==!0,ie,{onlyOnce:!0,showStackTrace:!0}),_(E.isClientRouting===void 0,B,{onlyOnce:!0,showStackTrace:!0}),E.isClientRouting=!1,e&&(E.checkSingleInstance=!0),H()}function Ht(e){_(E.isClientRouting!==!1,ie,{onlyOnce:!0,showStackTrace:!0}),_(E.isClientRouting===void 0,B,{onlyOnce:!0,showStackTrace:!0}),E.isClientRouting=!0,e&&(E.checkSingleInstance=!0),H()}function ve(e){E.instances.push(e),H()}function Re(e,t){if(e)return;const n=`[vite-plugin-ssr][Wrong Usage] ${t}`;throw new Error(n)}function _(e,t,{onlyOnce:n,showStackTrace:r}){if(e)return;const i=`[vite-plugin-ssr][Warning] ${t}`;if(n){const{alreadyLogged:o}=E,a=n===!0?i:n;if(o.has(a))return;o.add(a)}console.warn(r?new Error(i):i)}const Pe="0.4.142",R={projectName:"vite-plugin-ssr",projectVersion:Pe,npmPackageName:"vite-plugin-ssr",githubRepository:"https://github.com/brillout/vite-plugin-ssr"};ve(R.projectVersion);const p=new Proxy({},{get:(e,t)=>n=>t!=="code"?n:`\`${n}\``}),$=x("utils/assert.ts",{alreadyLogged:new Set,logger(e,t){t==="info"?console.log(e):console.warn(e)},showStackTraceList:new WeakSet}),Te=`[${R.npmPackageName}]`,xe=`[${R.npmPackageName}@${R.projectVersion}]`,G=2;function s(e,t){if(e)return;const n=(()=>{if(!t)return null;const a=typeof t=="string"?t:JSON.stringify(t);return p.dim(`Debug info (for ${R.projectName} maintainers; you can ignore this): ${a}`)})(),r=`${R.githubRepository}/issues/new`;let i=[`You stumbled upon a bug in ${R.projectName}'s source code.`,`Go to ${p.blue(r)} and copy-paste this error; a maintainer will fix the bug (usually under 24 hours).`,n].filter(Boolean).join(" ");i=j(i),i=W(i,"Bug"),i=L(i,!0);const o=V(i,G);throw $.onBeforeLog?.(),o}function h(e,t,{showStackTrace:n}={}){if(e)return;t=j(t),t=W(t,"Wrong Usage"),t=L(t);const r=V(t,G);throw n&&$.showStackTraceList.add(r),$.onBeforeLog?.(),r}function Ie(e){return e=j(e),e=W(e,"Error"),e=L(e),V(e,G)}function P(e,t,{onlyOnce:n,showStackTrace:r}){if(!e){if(t=j(t),t=W(t,"Warning"),t=L(t),n){const{alreadyLogged:i}=$,o=n===!0?t:n;if(i.has(o))return;i.add(o)}if($.onBeforeLog?.(),r){const i=new Error(t);$.showStackTraceList.add(i),$.logger(i,"warn")}else $.logger(t,"warn")}}function Gt(e,t,{onlyOnce:n}){if(!e){if(t=j(t),t=L(t),n){const{alreadyLogged:r}=$,i=t;if(r.has(i))return;r.add(i)}$.onBeforeLog?.(),$.logger(t,"info")}}function W(e,t){let n=`[${t}]`;const r=t==="Warning"?"yellow":"red";return n=p.bold(p[r](n)),`${n}${e}`}function j(e){return e.startsWith("[")?e:` ${e}`}function L(e,t=!1){return`${t?xe:Te}${e}`}function M(){return typeof window<"u"&&typeof window.scrollY=="number"}const C=x("utils/assertRouterType.ts",{});function Mt(){se(_e()),C.isClientRouting=!0}function _e(){return C.isClientRouting!==!1}function Jt(){se(C.isClientRouting!==!0),C.isClientRouting=!1}function se(e){h(M(),`${p.cyan("import { something } from 'vite-plugin-ssr/client/router'")} is forbidden on the server-side`,{showStackTrace:!0}),P(e,"You shouldn't `import { something } from 'vite-plugin-ssr/client/router'` when using Server Routi