@cssxio/unplugin 0.3.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/chunk-VCJX4HRK.js +93 -0
- package/dist/esbuild.cjs +7 -7
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/{options-CHY4_3I-.d.cts → options-Cx1s2I5t.d.cts} +2 -0
- package/dist/{options-CHY4_3I-.d.ts → options-Cx1s2I5t.d.ts} +2 -0
- package/dist/rollup.cjs +6 -6
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +6 -6
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.js +1 -1
- package/dist/vite.cjs +6 -6
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +1 -1
- package/dist/webpack.cjs +6 -6
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-BYZGCOHM.js +0 -93
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cssxio/unplugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Universal bundler plugin for CSSX.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"sideEffects": false,
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@babel/core": "^7.29.7",
|
|
53
|
-
"@cssxio/babel-plugin": "^0.2
|
|
54
|
-
"@cssxio/compiler": "^0.2
|
|
53
|
+
"@cssxio/babel-plugin": "^0.4.2",
|
|
54
|
+
"@cssxio/compiler": "^0.4.2",
|
|
55
55
|
"unplugin": "^3.3.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
package/dist/chunk-BYZGCOHM.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import{createClassNameAllocator as Ae}from"@cssxio/compiler";import{createUnplugin as Ne}from"unplugin";import{Buffer as Pe}from"buffer";import{mkdir as Le,unlink as $e,writeFile as Fe}from"fs/promises";import{basename as je,dirname as Ie,resolve as U}from"path";import{compileUtilities as Q,createSelectorAliases as Y}from"@cssxio/compiler";import{basename as ee}from"path";async function S(e,t,s,o=!0,n){let l=Object.create(null),u=Object.create(null),r=new Set,d=!0,i=new Map;for(let h of[...e].sort((m,p)=>m.id.localeCompare(p.id))){for(let[m,p]of Object.entries(h.candidates))if(m in l||(l[m]=p),h.id&&!i.has(m)){let y=h.origins?.[m];i.set(m,{id:h.id,line:y?.line??0,column:y?.column??0})}for(let[m,p]of Object.entries(h.composites??{})){let y=u[m];if(y&&y.join(" ")!==p.join(" "))throw new Error(`CSSX composite class collision for "${m}".`);u[m]=p}h.atomicClasses===void 0&&(d=!1);for(let m of h.atomicClasses??[])r.add(m)}let g=Object.keys(l).sort();if(g.length===0)return{css:""};let C=await Q(g,h=>l[h],t,Y(u),d?r:void 0,{darkMode:n}),a=C.css&&s?`@layer ${s}{`:"",f=`${a}${C.css}${a?"}":""}`,c=o?te(`${a}${C.prefixCss}`,C.entries,i):void 0;return{css:f,...c?{map:c}:{}}}function k(e,t){return e.map?`${e.css}
|
|
2
|
-
/*# sourceMappingURL=${ee(t)}.map */`:e.css}function R(e,t){return JSON.stringify({...e,file:t})}function te(e,t,s){let o=[...new Set(t.map(r=>s.get(r.candidate)?.id).filter(r=>!!r))].sort();if(o.length===0)return;let n=new Map(o.map((r,d)=>[r,d])),l=[],u=B({line:0,column:0},e);for(let r of t){let d=s.get(r.candidate);d&&l.push({...u,source:n.get(d.id),originalLine:d.line,originalColumn:d.column}),u=B(u,r.css)}return{version:3,sources:o,names:[],mappings:se(l)}}function B(e,t){let s=t.split(`
|
|
3
|
-
`);return{line:e.line+s.length-1,column:s.at(-1).length+e.column*+(s.length===1)}}function se(e){let t=Array.from({length:Math.max(0,...e.map(r=>r.line))+1},()=>[]),s=0,o=0,n=0,l=0,u=0;for(let r of e)u*=+(r.line===l),l=r.line,t[r.line]?.push(`${P(r.column-u)}${P(r.source-s)}${P(r.originalLine-o)}${P(r.originalColumn-n)}`),u=r.column,s=r.source,o=r.originalLine,n=r.originalColumn;return t.map(r=>r.join(",")).join(";")}var ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function P(e){let t="",s=e<0?-e<<1|1:e<<1;do{let o=s&31;s>>>=5,s&&(o|=32),t+=ne[o]}while(s);return t}import{readFile as re}from"fs/promises";import{dirname as oe,isAbsolute as ae,normalize as ie,resolve as O,sep as D}from"path";async function M(e){return e.themeFile===void 0?e.theme:re(O(process.cwd(),e.themeFile),"utf8")}function L(e){if(e.theme!==void 0&&e.themeFile!==void 0)throw new Error("CSSX accepts either theme or themeFile, not both.");if(e.layer!==void 0&&!/^[A-Za-z_-][A-Za-z0-9_-]*$/.test(e.layer))throw new Error("CSSX layer must be a valid CSS layer identifier.");if(e.sourceMap!==void 0&&typeof e.sourceMap!="boolean")throw new Error("CSSX sourceMap must be a boolean.");if(e.darkMode!==void 0&&e.darkMode!=="media"&&e.darkMode!=="selector")throw new Error('CSSX darkMode must be "media" or "selector".');if(e.reusabilityBudget!==void 0&&e.reusabilityBudget!=="auto"&&(!Number.isFinite(e.reusabilityBudget)||e.reusabilityBudget<0||e.reusabilityBudget>100))throw new Error('CSSX reusabilityBudget must be "auto" or a number from 0 through 100.');I(e.cssFileName??"cssx.css")}function j(e){let t=2166136261;for(let s=0;s<e.length;s++)t^=e.charCodeAt(s),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function b(e,t){return I(e).replaceAll("[hash]",j(t))}function $(e,t){return`${e&&e!=="/"?`/${e.replace(/^\/+|\/+$/g,"")}`:""}/${I(t).replaceAll(D,"/")}`}function F(e,t,s){return t.outdir?O(e,t.outdir,s):t.outfile?O(oe(O(e,t.outfile)),s):O(e,s)}function w(e){return e.split("?",1).join("")}function I(e){if(!e||ae(e))throw new Error("cssFileName must be a non-empty relative path.");let t=ie(e);if(t===".."||t.startsWith(`..${D}`))throw new Error("cssFileName must not escape the bundler output directory.");if(!t.endsWith(".css"))throw new Error("cssFileName must end in .css.");return t}function H(e,t,s){let o=e.getNativeBuildContext?.();if(!o||o.framework!=="webpack"&&o.framework!=="rspack")return;let n=o.loaderContext?._module;if(!n)return;let l=n.buildInfo??(n.buildInfo={});l[s]=t}function E(e,t,s,o,n,l,u,r){e.hooks.thisCompilation.tap("@cssxio/unplugin",d=>{d.hooks.processAssets.tapPromise({name:"@cssxio/unplugin",stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},async()=>{let i=[...d.modules].map(a=>le(a,l,u)),g=await S(i.some(a=>Object.keys(a.candidates).length>0)?i:[...u?.values()??[]],await s(),o,n,r);if(!g.css)return;let C=b(t,g.css);if(d.getAsset?.(C))throw new Error(`CSSX CSS asset collision at "${C}".`);if(d.emitAsset(C,new e.webpack.sources.RawSource(k(g,C))),g.map){let a=`${C}.map`;if(d.getAsset?.(a))throw new Error(`CSSX CSS map asset collision at "${a}".`);d.emitAsset(a,new e.webpack.sources.RawSource(R(g.map,C)))}})})}function le(e,t,s){let o=e.buildInfo?.[t];if(!o||typeof o!="object")return s?.get(e.resource?.split("?",1)[0]??"")??{id:"",candidates:{},composites:{},origins:{}};let{id:n,candidates:l,composites:u,atomicClasses:r,origins:d}=o;return{id:typeof n=="string"?n:"",candidates:l&&typeof l=="object"?l:{},composites:u&&typeof u=="object"?u:{},...Array.isArray(r)?{atomicClasses:r}:{},origins:d&&typeof d=="object"?d:{}}}import{transformAsync as de}from"@babel/core";import ce from"@cssxio/babel-plugin";import{compileUtilities as ue,createClassNameAllocator as me,createSelectorAliases as pe}from"@cssxio/compiler";var fe=new Set([".js",".jsx",".ts",".tsx",".cjs",".cjsx",".cts",".ctsx",".mjs",".mjsx",".mts",".mtsx",".astro"]);async function v(e,t,s={},o){L(s);let n=s.importSource??"@cssxio/cssx",l=t.split("?",1).join("");if(!fe.has(l.slice(l.lastIndexOf(".")))||!e.includes(n))return null;if(l.endsWith(".astro"))return ye(e,t,s);let u=await M(s),r=await de(e,{babelrc:!1,configFile:!1,filename:l,parserOpts:{plugins:["jsx","typescript"]},plugins:[[ce,{importSource:n,classNameAllocator:s.classNameAllocator,theme:u,reusabilityBudget:s.reusabilityBudget,stableClassNames:s.stableClassNames,darkMode:s.darkMode}]],sourceMaps:!0,...o?{inputSourceMap:o}:{}}),d=r.metadata,{candidates:i,origins:g,composites:C,atomicClasses:a,cssOnlySignature:f}=d.cssx,c=Object.keys(i),h=c.length===0?"":(await ue(c,m=>i[m],u,pe(C),new Set(a),{darkMode:s.darkMode})).css;return{code:r.code,rules:h?[Ce(xe(h,s.layer))]:[],candidates:i,composites:C,atomicClasses:a,origins:g,cssOnlySignature:f,map:r.map}}async function ye(e,t,s){let o=ge(e);if(o.length===0)return null;let n=s.classNameAllocator??me(),l=s.importSource??"@cssxio/cssx",u={},r={},d=[],i=e;for(let g of[...o].reverse()){let C=await v(`import { sx } from ${JSON.stringify(l)};
|
|
4
|
-
const style = ${g.code};`,`${t}.ts`,{...s,classNameAllocator:n}),a=he(C.code);i=`${i.slice(0,g.start)}${a}${i.slice(g.end)}`,Object.assign(u,C.candidates),Object.assign(r,C.composites),d.push(...C.rules)}return{code:i,rules:d,candidates:u,composites:r,atomicClasses:[],origins:{},cssOnlySignature:i}}function ge(e){let t=[],s=/\bsx\s*\(/g;for(let o of e.matchAll(s)){let n=o.index,l=e.indexOf("(",n),u=0,r="";for(let d=l;d<e.length;d+=1){let i=e[d];if(r){i==="\\"?d+=1:i===r&&(r="");continue}if(i==='"'||i==="'"||i==="`")r=i;else if(i==="(")u+=1;else if(i===")"&&--u===0){t.push({start:n,end:d+1,code:e.slice(n,d+1)}),s.lastIndex=d+1;break}}}return t}function he(e){let t="const style = ",s=e.indexOf(t)+t.length,o=e.indexOf(";",s);return e.slice(s,o)}function V(e,t){if(!e||typeof e!="object")return;let s=e.getCombinedSourcemap;if(typeof s!="function")return;let o=s.call(e);if(!o||typeof o!="object")return;let n=o;if(!(n.version!==3||!Array.isArray(n.sources)||typeof n.mappings!="string"))return{version:n.version,sources:[...n.sources],names:[...n.names??[]],mappings:n.mappings,file:n.file??t.split("?",1).join(""),...n.sourceRoot?{sourceRoot:n.sourceRoot}:{},...n.sourcesContent?{sourcesContent:[...n.sourcesContent]}:{}}}function Ce(e){return{className:`cssx-${j(e)}`,css:e}}function xe(e,t){return e&&t?`@layer ${t}{${e}}`:e}function T(e,t,s=Date.now()){e.ws.send({type:"update",updates:[{type:"css-update",path:t,acceptedPath:t,timestamp:s}]})}import{Buffer as _}from"buffer";import{mkdir as Se,readFile as we,realpath as be,unlink as W,writeFile as X}from"fs/promises";import{basename as q,dirname as ke,resolve as G}from"path";import{createClassNameAllocator as Me}from"@cssxio/compiler";var ve=/\.[cm]?[jt]sx?$/;function J(e={}){let t=new Map,s=Me(),o,n;return{name:"@cssxio/unplugin",setup(l){let u=l.initialOptions.absWorkingDir??process.cwd();l.initialOptions.metafile=!0,l.onLoad({filter:ve},async({path:r})=>{let d=await we(r,"utf8"),i=await v(d,r,{...e,classNameAllocator:s});if(!i)return;let g=await z(r);return t.set(g,{id:g,candidates:i.candidates,composites:i.composites,atomicClasses:i.atomicClasses,origins:i.origins}),{contents:i.code,loader:Oe(r)}}),l.onEnd(async r=>{if(!r.metafile)return;let d=new Set(await Promise.all(Object.keys(r.metafile.inputs).map(c=>z(G(u,c)))));for(let c of t.keys())d.has(c)||t.delete(c);let i=await Re([...t],e),g=F(u,l.initialOptions,b(e.cssFileName??"cssx.css",i.css));if(!i.css){o&&await W(o).catch(()=>{}),n&&await W(n).catch(()=>{}),o=void 0,n=void 0;return}let C=i.map?`${i.css}
|
|
5
|
-
/*# sourceMappingURL=${q(g)}.map */`:i.css,a=`${g}.map`,f=i.map?JSON.stringify({...i.map,file:q(g)}):void 0;if(l.initialOptions.write===!1){if(!r.outputFiles)return;if(r.outputFiles.some(c=>c.path===g))throw new Error(`CSSX CSS asset collision at "${g}".`);r.outputFiles.push({path:g,contents:_.from(C),hash:"",text:C}),f&&r.outputFiles.push({path:a,contents:_.from(f),hash:"",text:f});return}await Se(ke(g),{recursive:!0}),await X(g,C),f&&await X(a,f),o=g,n=f?a:void 0})}}}async function Re(e,t){let s=await M(t);return S(e.map(([,o])=>o),s,t.layer,t.sourceMap??!0,t.darkMode)}function Oe(e){return/\.tsx?$/.test(e)?"ts":"js"}async function z(e){return be(e).catch(()=>G(e))}var A="@cssxio/unplugin/rules",Ee=/\.(?:[cm]?[jt]sx?|astro)(?:\?.*)?$/;function Te(e,t,s){let o=new Set;for(let n of t)e.moduleGraph?.invalidateModule(n,o,s,!0);for(let n of o){if(!n.id)continue;let l=e.runner?.evaluatedModules?.getModuleById(n.id);l&&e.runner?.evaluatedModules?.invalidateModule(l)}}function Ue(e){return!e||typeof e!="object"?{id:"",rules:[],candidates:{},composites:{},origins:{},cssOnlySignature:""}:Be(e[A])}function Be(e){if(!e||typeof e!="object")return{id:"",rules:[],candidates:{},composites:{},origins:{},cssOnlySignature:""};let{id:t,rules:s,candidates:o,composites:n,atomicClasses:l,origins:u,cssOnlySignature:r}=e;return{id:typeof t=="string"?t:"",rules:Array.isArray(s)?s:[],candidates:o&&typeof o=="object"?o:{},composites:n&&typeof n=="object"?n:{},...Array.isArray(l)?{atomicClasses:l}:{},origins:u&&typeof u=="object"?u:{},cssOnlySignature:typeof r=="string"?r:""}}var De=(e={},t)=>{L(e);let s=e.cssFileName??"cssx.css",o=e.sourceMap??!0,n=new Map,l=Ae(),u=new Map,r,d=process.cwd(),i,g=()=>M(e),C=async function(a,f){let c=new Set(Object.values(f).flatMap(y=>y.type==="chunk"?Object.keys(y.modules??{}):[]).map(w));if(t.framework!=="vite")for(let y of n.keys())c.has(y)||n.delete(y);let h=t.framework==="vite"?[...n.values()]:[...c].map(y=>{let x=Ue(this.getModuleInfo(y)?.meta);return Object.keys(x.candidates).length>0?x:n.get(y)??x}),m=await S(h,await g(),e.layer,o,e.darkMode);if(!m.css)return;let p=b(s,m.css);if(Object.hasOwn(f,p))throw new Error(`CSSX CSS asset collision at "${p}".`);if(this.emitFile({type:"asset",fileName:p,source:k(m,p)}),m.map){let y=`${p}.map`;if(Object.hasOwn(f,y))throw new Error(`CSSX CSS map asset collision at "${y}".`);this.emitFile({type:"asset",fileName:y,source:R(m.map,p)})}};return{name:"@cssxio/unplugin",enforce:"pre",transform:{filter:{id:Ee},async handler(a,f){e.themeFile&&this.addWatchFile?.(U(process.cwd(),e.themeFile));let c=await v(a,f,{...e,classNameAllocator:l},V(this,f)),h={id:w(f),rules:c?.rules??[],candidates:c?.candidates??{},composites:c?.composites??{},atomicClasses:c?.atomicClasses??[],origins:c?.origins??{},cssOnlySignature:c?.cssOnlySignature??""};H(this,h,A);let m=w(f);(c||m===f)&&(n.set(m,h),u.set(U(d,m),h)),t.framework==="vite"&&i&&T(i,$("/",s));let p=c?.code??a;return{code:(t.framework==="webpack"||t.framework==="rspack")&&c?`${p}
|
|
6
|
-
${He(s)}`:p,meta:{[A]:h},...c?.map?{map:c.map}:{}}}},watchChange(a,f){f.event==="delete"&&n.delete(w(a))},rollup:{generateBundle:C},vite:{generateBundle:C,configureServer(a){i=a;let f=$(a.config.base,s),c=$("/",s);a.watcher?.on("unlink",h=>{n.delete(w(h)),T(a,c)}),a.middlewares.use((h,m,p)=>{let y=h.url?.split("?",1)[0];if(y!==f&&(y!==`${f}.map`||!o))return p();g().then(x=>S([...n.values()],x,e.layer,o,e.darkMode)).then(x=>{if(y===`${f}.map`){m.setHeader("Content-Type","application/json; charset=utf-8"),m.setHeader("Cache-Control","no-store"),m.end(x.map?R(x.map,s):"");return}m.setHeader("Content-Type","text/css; charset=utf-8"),m.setHeader("Cache-Control","no-store"),m.end(k(x,s))}).catch(x=>{m.setHeader("Content-Type","text/plain; charset=utf-8"),m.end(x instanceof Error?x.message:"Unable to compile CSSX development stylesheet.")})})},hotUpdate:{order:"pre",async handler(a){let f=this.environment;if(!f||f.name==="client")return;let c=a.modules.filter(p=>{let y=n.get(w(p.id??""));return!!(y&&y.cssOnlySignature&&y.atomicClasses?.length===0)});if(c.length===0)return;let h=new Map(c.map(p=>[p,n.get(w(p.id)).cssOnlySignature]));for(let p of c)p.url&&await f.transformRequest(p.url);if(c.every(p=>{let y=n.get(w(p.id));return!!(y&&y.atomicClasses.length===0&&y.cssOnlySignature===h.get(p))}))return Te(f,c,a.timestamp),a.modules.filter(p=>!c.includes(p))}}},...t.framework==="webpack"?{webpack(a){E(a,s,g,e.layer,o,A,n,e.darkMode)}}:{},...t.framework==="rspack"?{rspack(a){E(a,s,g,e.layer,o,A,n,e.darkMode)}}:{},...t.framework==="esbuild"?{esbuild:{config(a){a.metafile=!0},setup(a){let f=a.initialOptions.absWorkingDir??process.cwd();d=f,a.onEnd(async c=>{if(!c.metafile)return;let h=new Set(Object.keys(c.metafile.inputs).map(x=>U(f,x)));for(let x of u.keys())h.has(x)||u.delete(x);let m=await S([...u.values()],await g(),e.layer,o,e.darkMode),p=F(f,a.initialOptions,b(s,m.css));if(!m.css){r&&await $e(r).catch(()=>{}),r=void 0;return}let y=k(m,je(p));if(a.initialOptions.write===!1){let x=c.outputFiles;if(!x)return;let K={path:p,contents:Pe.from(y),hash:"",text:y};if(x.findIndex(Z=>Z.path===p)!==-1)throw new Error(`CSSX CSS asset collision at "${p}".`);x.push(K);return}await Le(Ie(p),{recursive:!0}),await Fe(p,y),r=p})}}}:{}}},N=Ne(De);function He(e){return`if (typeof document !== "undefined" && typeof module !== "undefined" && module.hot) {
|
|
7
|
-
const key = "__cssxStylesheetHmr";
|
|
8
|
-
const state = globalThis[key] || (globalThis[key] = { revision: 0, staged: [], replacements: [] });
|
|
9
|
-
const stylesheetLink = [...document.querySelectorAll('link[rel="stylesheet"]')].find((link) =>
|
|
10
|
-
new URL(link.href, document.baseURI).pathname.endsWith(${JSON.stringify(`/${e}`)}),
|
|
11
|
-
);
|
|
12
|
-
const nextLink = stylesheetLink && (() => {
|
|
13
|
-
const path = new URL(stylesheetLink.href, document.baseURI).pathname;
|
|
14
|
-
return path.includes("/_next/");
|
|
15
|
-
})();
|
|
16
|
-
if (!state.installed) {
|
|
17
|
-
state.installed = true;
|
|
18
|
-
state.stage = () => {
|
|
19
|
-
const revision = ++state.revision;
|
|
20
|
-
state.staged = [];
|
|
21
|
-
state.replacements = [];
|
|
22
|
-
const links = [...document.querySelectorAll('link[rel="stylesheet"]')].filter((link) =>
|
|
23
|
-
new URL(link.href, document.baseURI).pathname.endsWith(${JSON.stringify(`/${e}`)}),
|
|
24
|
-
);
|
|
25
|
-
return Promise.all(
|
|
26
|
-
links.map(
|
|
27
|
-
(link) =>
|
|
28
|
-
new Promise((resolve) => {
|
|
29
|
-
const replacement = link.cloneNode();
|
|
30
|
-
const url = new URL(link.href, document.baseURI);
|
|
31
|
-
url.searchParams.set("cssx", String(revision));
|
|
32
|
-
replacement.href = url.href;
|
|
33
|
-
const finish = (loaded) => {
|
|
34
|
-
replacement.removeEventListener("load", onLoad);
|
|
35
|
-
replacement.removeEventListener("error", onError);
|
|
36
|
-
if (loaded) {
|
|
37
|
-
state.staged.push(link);
|
|
38
|
-
if (state.removeOnLoad) link.remove();
|
|
39
|
-
}
|
|
40
|
-
else replacement.remove();
|
|
41
|
-
resolve();
|
|
42
|
-
};
|
|
43
|
-
const onLoad = () => finish(true);
|
|
44
|
-
const onError = () => finish(false);
|
|
45
|
-
replacement.addEventListener("load", onLoad);
|
|
46
|
-
replacement.addEventListener("error", onError);
|
|
47
|
-
state.replacements.push(replacement);
|
|
48
|
-
link.after(replacement);
|
|
49
|
-
}),
|
|
50
|
-
),
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
module.hot.addStatusHandler((status) => {
|
|
54
|
-
if (status === "prepare" || status === "dispose") {
|
|
55
|
-
return state.stage();
|
|
56
|
-
}
|
|
57
|
-
if (status === "idle") {
|
|
58
|
-
for (const link of state.staged) link.remove();
|
|
59
|
-
state.staged = [];
|
|
60
|
-
state.replacements = [];
|
|
61
|
-
}
|
|
62
|
-
if (status === "abort" || status === "fail") {
|
|
63
|
-
for (const replacement of state.replacements) replacement.remove();
|
|
64
|
-
state.staged = [];
|
|
65
|
-
state.replacements = [];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
if (nextLink) module.hot.accept(() => void state.stage());
|
|
69
|
-
for (const updateKey of Object.getOwnPropertyNames(globalThis).filter((name) => name.startsWith("webpackHotUpdate"))) {
|
|
70
|
-
const update = globalThis[updateKey];
|
|
71
|
-
if (typeof update !== "function") continue;
|
|
72
|
-
globalThis[updateKey] = function (...args) {
|
|
73
|
-
void state.stage();
|
|
74
|
-
return update.apply(this, args);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
if (stylesheetLink) {
|
|
78
|
-
state.removeOnLoad = Boolean(nextLink);
|
|
79
|
-
const refresh = async () => {
|
|
80
|
-
try {
|
|
81
|
-
const url = new URL(stylesheetLink.href, document.baseURI);
|
|
82
|
-
url.searchParams.set("cssx-probe", String(Date.now()));
|
|
83
|
-
const css = await fetch(url.href, { cache: "no-store" }).then((response) => response.text());
|
|
84
|
-
if (state.css && state.css !== css) void state.stage();
|
|
85
|
-
state.css = css;
|
|
86
|
-
} catch {
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
void refresh();
|
|
90
|
-
state.poll = setInterval(() => void refresh(), 500);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}`}var wt=N.vite,bt=N.rollup,kt=N.webpack,Mt=N.rspack,vt=N;export{S as a,v as b,De as c,N as d,wt as e,bt as f,kt as g,Mt as h,vt as i,J as j};
|