@salty-css/astro 0.2.0-fix-astro-fixes-06-2026.4 → 0.2.1

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.
@@ -1,12 +1,12 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("@salty-css/core/compiler/salty-compiler"),F=require("@salty-css/core/compiler/helpers"),G=require("@salty-css/core/compiler/get-function-range"),R=require("@salty-css/core/util"),f=require("fs/promises"),S=require("path"),k=require("@salty-css/core/server"),H=[{name:"react",importMarkers:[/['"]@salty-css\/react(\/[^'"]*)?['"]/],loadTransform:async s=>{const t="@salty-css/react/transform-salty-file";return(s?await s(t):await import(t)).transformSaltyFile}}],x=new Map,b=(s,t)=>{const e=x.get(s.name);if(e)return e;const n=s.loadTransform(t);return x.set(s.name,n),n},A=s=>{for(const t of H)for(const e of t.importMarkers)if(e.test(s))return t},B=async(s,t)=>{const e=S.join(s,"astro",t),n=await f.readFile(e,"utf-8");if(n)try{const a=JSON.parse(n),{clientProps:l={},classNames:i="",tagIsComponent:o,tagName:r="div"}=a,g=["import { resolveAstroProps } from '@salty-css/astro/element-props';",...a.imports||[]],d=o?r:`__r.element || ${JSON.stringify(l.element||r)}`;return`---
2
- ${g.join(`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _=require("@salty-css/core/compiler/helpers"),b=require("@salty-css/core/compiler/get-function-range"),A=require("@salty-css/core/compiler/salty-compiler"),O=require("@salty-css/core/server"),P=require("@salty-css/core/util"),F=require("fs/promises"),k=require("path"),L=[{name:"react",importMarkers:[/['"]@salty-css\/react(\/[^'"]*)?['"]/],loadTransform:async s=>{const n="@salty-css/react/transform-salty-file";return(s?await s(n):await import(n)).transformSaltyFile}}],q=new Map,B=(s,n)=>{const l=q.get(s.name);if(l)return l;const e=s.loadTransform(n);return q.set(s.name,e),e},U=s=>{for(const n of L)for(const l of n.importMarkers)if(l.test(s))return n},J=(s,n={})=>{let l;const e=new A.SaltyCompiler(s,{mode:n.mode});return{name:"stylegen",configureServer:function(t){e.importFile=async o=>{const a=Date.now();return l=t.ssrLoadModule,t.ssrLoadModule(`${o}?t=${a}`)}},configResolved:async function(){try{await e.generateCss()}catch(t){throw console.error("Error during initial CSS generation:",t),t}},load:async function(t){var o,a;try{if(_.isSaltyFile(t,[],!t.includes("configFile="))){const h=await e.getDestDir();if(/.+\?configFile=(\w+).+/.test(t)){const C=new URLSearchParams(t.split("?")[1]).get("configFile");if(!C)return;const f=k.join(h,"astro",C),S=await F.readFile(f,"utf-8");if(!S)return;try{const g=JSON.parse(S),{clientProps:$={},classNames:c="",tagIsComponent:N,tagName:m="div"}=g,v=["import { resolveAstroProps } from '@salty-css/astro/element-props';",...g.imports||[]],I=N?m:`__r.element || ${JSON.stringify($.element||m)}`;return`---
2
+ ${v.join(`
3
3
  `)}
4
- const __gp = ${JSON.stringify(l)};
5
- const __r = resolveAstroProps(Astro.props, __gp, ${JSON.stringify(i)});
6
- const Element = ${d};
4
+ const __gp = ${JSON.stringify($)};
5
+ const __r = resolveAstroProps(Astro.props, __gp, ${JSON.stringify(c)});
6
+ const Element = ${I};
7
7
  ---
8
- <Element class:list={__r.class} style={__r.style} {...__r.rest}><slot/></Element>`}catch(a){console.error("Error parsing config file:",a);return}},L=async(s,t)=>{var n,a;const{compiler:e}=s;try{if(F.isSaltyFile(t,[],!t.includes("configFile="))){const i=await e.getDestDir();if(/.+\?configFile=(\w+).+/.test(t)){const h=new URLSearchParams(t.split("?")[1]).get("configFile");return h?await B(i,h):void 0}const o=await f.readFile(t,"utf-8"),r=A(o);if(r)return await(await b(r,s.importer))(e,t);const u=["import { classNameInstance } from '@salty-css/core/instances/classname-instance';"],g=[],d=[],j=await e.compileSaltyFile(t,i),$=Object.entries(j.contents);for(const[c,h]of $){const y=await F.resolveExportValue(h,1);if(!y.generator)continue;if(y.isClassName){const C=y.generator._withBuildContext({callerName:c,isProduction:e.isProduction,config:{}});g.push(`const ${c} = classNameInstance(${JSON.stringify(C.params)});`),d.push(c);continue}const[D,O]=await G.getFunctionRange(o,c),P=o.slice(D,O),m=(a=(n=/styled\(([^,]+),/.exec(P))==null?void 0:n.at(1))==null?void 0:a.trim();if(!m){console.warn(`Could not determine tag name for ${c} in ${t}`);continue}const v=y.generator._withBuildContext({callerName:c,isProduction:e.isProduction,config:{}}),w={componentName:c,tagName:m.replace(/['"`]/g,""),tagIsComponent:!1,classNames:v.classNames,imports:[],clientProps:v.clientProps},N=/^\w+$/.test(m);if(w.tagIsComponent=N,N){const C=$.some(([p])=>p===m),E=o.match(new RegExp(`import[^;]*${m}[^;]*;`));if(C){const p=R.toHash(m),J=`import ${m} from '${t}.astro?configFile=${p}.config';`;w.imports=[J]}else if(E){const p=E.at(0);w.imports=[p]}}const _=S.join(i,"astro");await f.readFile(_,"utf-8").catch(()=>!1)||await f.mkdir(_,{recursive:!0});const M=R.toHash(c),q=S.join(i,"astro",`${M}.config`);await f.writeFile(q,JSON.stringify(w)),u.push(`import ${c} from '${t}.astro?configFile=${M}.config';`),d.push(c)}return`${u.join(`
8
+ <Element class:list={__r.class} style={__r.style} {...__r.rest}><slot/></Element>`}catch(g){console.error("Error parsing config file:",g);return}}const d=await F.readFile(t,"utf-8"),p=U(d);if(p)return await(await B(p,l))(e,t);const i=["import { classNameInstance } from '@salty-css/core/instances/classname-instance';"],y=[],M=[],T=await e.compileSaltyFile(t,h),j=Object.entries(T.contents);for(const[r,C]of j){const f=await _.resolveExportValue(C,1);if(!f.generator)continue;if(f.isClassName){const E=f.generator._withBuildContext({callerName:r,isProduction:e.isProduction,config:{}});y.push(`const ${r} = classNameInstance(${JSON.stringify(E.params)});`),M.push(r);continue}const[S,g]=await b.getFunctionRange(d,r),$=d.slice(S,g),c=(a=(o=/styled\(([^,]+),/.exec($))==null?void 0:o.at(1))==null?void 0:a.trim();if(!c){console.warn(`Could not determine tag name for ${r} in ${t}`);continue}const N=f.generator._withBuildContext({callerName:r,isProduction:e.isProduction,config:{}}),m={componentName:r,tagName:c.replace(/['"`]/g,""),tagIsComponent:!1,classNames:N.classNames,imports:[],clientProps:N.clientProps},R=/^\w+$/.test(c);if(m.tagIsComponent=R,R){const E=j.some(([w])=>w===c),D=d.match(new RegExp(`import[^;]*${c}[^;]*;`));if(E){const w=P.toHash(c),H=`import ${c} from '${t}.astro?configFile=${w}.config';`;m.imports=[H]}else if(D){const w=D.at(0);m.imports=[w]}}const v=k.join(h,"astro");await F.readFile(v,"utf-8").catch(()=>!1)||await F.mkdir(v,{recursive:!0});const x=P.toHash(r),G=k.join(h,"astro",`${x}.config`);await F.writeFile(G,JSON.stringify(m)),i.push(`import ${r} from '${t}.astro?configFile=${x}.config';`),M.push(r)}return`${i.join(`
9
9
  `)}
10
- ${g.join(`
10
+ ${y.join(`
11
11
  `)}
12
- export { ${d.join(", ")} };`}return}catch(l){console.error("Error during file compilation:",l);return}},U=async(s,{file:t,server:e,modules:n})=>{try{if(await k.checkShouldRestart(t))return await s.generateCss(!1);if(!F.isSaltyFile(t))return;const i=await s.getDestDir(),o=[];for(const[r,u]of e.moduleGraph.idToModuleMap)r.startsWith(t+".astro?configFile=")&&(e.moduleGraph.invalidateModule(u),o.push(u));for(const r of e.moduleGraph.urlToModuleMap.values())r.file&&r.file.startsWith(i)&&(e.moduleGraph.invalidateModule(r),o.push(r));return e.ws.send({type:"update",updates:[]}),[...n,...o]}catch(a){console.error("Error during hot update handling:",a)}},W=async(s,t,e)=>{try{F.isSaltyFile(t)&&e.event!=="delete"&&(await k.checkShouldRestart(t)||await s.generateFile(t))}catch(n){console.error("Error during watch change handling:",n)}},I=(s,t={})=>{const e=new T.SaltyCompiler(s,{mode:t.mode}),n={compiler:e,importer:void 0},a=o=>{const r=Date.now();return import(`${o}?t=${r}`)};let l,i=!1;return e.importFile=async o=>{if(i||!l)return a(o);const r=Date.now();return n.importer=l.ssrLoadModule,l.ssrLoadModule(`${o}?t=${r}`)},{name:"stylegen",configResolved:async function(o){i=o.command==="build";try{i&&await e.generateCss()}catch(r){throw console.error("Error during initial CSS generation:",r),r}},configureServer:async function(o){l=o;try{i||await e.generateCss()}catch(r){throw console.error("Error during initial CSS generation:",r),r}},load:function(o){return L(n,o)},handleHotUpdate:function(o){return U(e,o)},watchChange:{handler:function(o,r){return W(e,o,r)}}}};exports.default=I;exports.saltyPlugin=I;
12
+ export { ${M.join(", ")} };`}return}catch(u){console.error("Error during file compilation:",u);return}},handleHotUpdate:async function({file:t,server:o,modules:a}){try{if(await O.checkShouldRestart(t))return await e.generateCss(!1);if(!_.isSaltyFile(t))return;const d=await e.getDestDir(),p=[];for(const[i,y]of o.moduleGraph.idToModuleMap)i.startsWith(t+".astro?configFile=")&&(o.moduleGraph.invalidateModule(y),p.push(y));for(const i of o.moduleGraph.urlToModuleMap.values())i.file&&i.file.startsWith(d)&&(o.moduleGraph.invalidateModule(i),p.push(i));return o.ws.send({type:"update",updates:[]}),[...a,...p]}catch(u){console.error("Error during hot update handling:",u)}},watchChange:{handler:async function(t,o){try{_.isSaltyFile(t)&&o.event!=="delete"&&(await O.checkShouldRestart(t)||await e.generateFile(t))}catch(a){console.error("Error during watch change handling:",a)}}}}};exports.default=J;exports.saltyPlugin=J;
@@ -1,181 +1,157 @@
1
- import { SaltyCompiler as G } from "@salty-css/core/compiler/salty-compiler";
2
- import { isSaltyFile as C, resolveExportValue as T } from "@salty-css/core/compiler/helpers";
3
- import { getFunctionRange as A } from "@salty-css/core/compiler/get-function-range";
4
- import { toHash as M } from "@salty-css/core/util";
5
- import { readFile as F, mkdir as H, writeFile as B } from "fs/promises";
6
- import { join as $ } from "path";
7
- import { checkShouldRestart as R } from "@salty-css/core/server";
8
- const L = [
1
+ import { isSaltyFile as M, resolveExportValue as H } from "@salty-css/core/compiler/helpers";
2
+ import { getFunctionRange as L } from "@salty-css/core/compiler/get-function-range";
3
+ import { SaltyCompiler as B } from "@salty-css/core/compiler/salty-compiler";
4
+ import { checkShouldRestart as j } from "@salty-css/core/server";
5
+ import { toHash as J } from "@salty-css/core/util";
6
+ import { readFile as R, mkdir as U, writeFile as W } from "fs/promises";
7
+ import { join as k } from "path";
8
+ const b = [
9
9
  {
10
10
  name: "react",
11
11
  importMarkers: [/['"]@salty-css\/react(\/[^'"]*)?['"]/],
12
- loadTransform: async (n) => {
13
- const t = "@salty-css/react/transform-salty-file";
14
- return (n ? await n(t) : await import(
15
- /* @vite-ignore */
16
- t
17
- )).transformSaltyFile;
12
+ loadTransform: async (s) => {
13
+ const n = "@salty-css/react/transform-salty-file";
14
+ return (s ? await s(n) : await import(n)).transformSaltyFile;
18
15
  }
19
16
  }
20
- ], I = /* @__PURE__ */ new Map(), U = (n, t) => {
21
- const o = I.get(n.name);
22
- if (o) return o;
23
- const s = n.loadTransform(t);
24
- return I.set(n.name, s), s;
25
- }, b = (n) => {
26
- for (const t of L)
27
- for (const o of t.importMarkers)
28
- if (o.test(n)) return t;
29
- }, W = async (n, t) => {
30
- const o = $(n, "astro", t), s = await F(o, "utf-8");
31
- if (s)
32
- try {
33
- const a = JSON.parse(s), { clientProps: l = {}, classNames: i = "", tagIsComponent: r, tagName: e = "div" } = a, d = ["import { resolveAstroProps } from '@salty-css/astro/element-props';", ...a.imports || []], f = r ? e : `__r.element || ${JSON.stringify(l.element || e)}`;
34
- return `---
35
- ${d.join(`
17
+ ], P = /* @__PURE__ */ new Map(), V = (s, n) => {
18
+ const l = P.get(s.name);
19
+ if (l) return l;
20
+ const o = s.loadTransform(n);
21
+ return P.set(s.name, o), o;
22
+ }, q = (s) => {
23
+ for (const n of b)
24
+ for (const l of n.importMarkers)
25
+ if (l.test(s)) return n;
26
+ }, rt = (s, n = {}) => {
27
+ let l;
28
+ const o = new B(s, { mode: n.mode });
29
+ return {
30
+ name: "stylegen",
31
+ configureServer: function(t) {
32
+ o.importFile = async (r) => {
33
+ const a = Date.now();
34
+ return l = t.ssrLoadModule, t.ssrLoadModule(`${r}?t=${a}`);
35
+ };
36
+ },
37
+ configResolved: async function() {
38
+ try {
39
+ await o.generateCss();
40
+ } catch (t) {
41
+ throw console.error("Error during initial CSS generation:", t), t;
42
+ }
43
+ },
44
+ load: async function(t) {
45
+ var r, a;
46
+ try {
47
+ if (M(t, [], !t.includes("configFile="))) {
48
+ const h = await o.getDestDir();
49
+ if (/.+\?configFile=(\w+).+/.test(t)) {
50
+ const F = new URLSearchParams(t.split("?")[1]).get("configFile");
51
+ if (!F) return;
52
+ const d = k(h, "astro", F), $ = await R(d, "utf-8");
53
+ if (!$) return;
54
+ try {
55
+ const g = JSON.parse($), { clientProps: C = {}, classNames: c = "", tagIsComponent: N, tagName: m = "div" } = g, S = ["import { resolveAstroProps } from '@salty-css/astro/element-props';", ...g.imports || []], D = N ? m : `__r.element || ${JSON.stringify(C.element || m)}`;
56
+ return `---
57
+ ${S.join(`
36
58
  `)}
37
- const __gp = ${JSON.stringify(l)};
38
- const __r = resolveAstroProps(Astro.props, __gp, ${JSON.stringify(i)});
39
- const Element = ${f};
59
+ const __gp = ${JSON.stringify(C)};
60
+ const __r = resolveAstroProps(Astro.props, __gp, ${JSON.stringify(c)});
61
+ const Element = ${D};
40
62
  ---
41
63
  <Element class:list={__r.class} style={__r.style} {...__r.rest}><slot/></Element>`;
42
- } catch (a) {
43
- console.error("Error parsing config file:", a);
44
- return;
45
- }
46
- }, V = async (n, t) => {
47
- var s, a;
48
- const { compiler: o } = n;
49
- try {
50
- if (C(t, [], !t.includes("configFile="))) {
51
- const i = await o.getDestDir();
52
- if (/.+\?configFile=(\w+).+/.test(t)) {
53
- const g = new URLSearchParams(t.split("?")[1]).get("configFile");
54
- return g ? await W(i, g) : void 0;
55
- }
56
- const r = await F(t, "utf-8"), e = b(r);
57
- if (e)
58
- return await (await U(e, n.importer))(o, t);
59
- const u = ["import { classNameInstance } from '@salty-css/core/instances/classname-instance';"], d = [], f = [], k = await o.compileSaltyFile(t, i), N = Object.entries(k.contents);
60
- for (const [c, g] of N) {
61
- const h = await T(g, 1);
62
- if (!h.generator) continue;
63
- if (h.isClassName) {
64
- const y = h.generator._withBuildContext({
65
- callerName: c,
66
- isProduction: o.isProduction,
67
- config: {}
68
- });
69
- d.push(`const ${c} = classNameInstance(${JSON.stringify(y.params)});`), f.push(c);
70
- continue;
71
- }
72
- const [D, O] = await A(r, c), j = r.slice(D, O), m = (a = (s = /styled\(([^,]+),/.exec(j)) == null ? void 0 : s.at(1)) == null ? void 0 : a.trim();
73
- if (!m) {
74
- console.warn(`Could not determine tag name for ${c} in ${t}`);
75
- continue;
76
- }
77
- const S = h.generator._withBuildContext({
78
- callerName: c,
79
- isProduction: o.isProduction,
80
- config: {}
81
- }), w = {
82
- componentName: c,
83
- tagName: m.replace(/['"`]/g, ""),
84
- tagIsComponent: !1,
85
- classNames: S.classNames,
86
- imports: [],
87
- clientProps: S.clientProps
88
- }, v = /^\w+$/.test(m);
89
- if (w.tagIsComponent = v, v) {
90
- const y = N.some(([p]) => p === m), E = r.match(new RegExp(`import[^;]*${m}[^;]*;`));
91
- if (y) {
92
- const p = M(m), P = `import ${m} from '${t}.astro?configFile=${p}.config';`;
93
- w.imports = [P];
94
- } else if (E) {
95
- const p = E.at(0);
96
- w.imports = [p];
64
+ } catch (g) {
65
+ console.error("Error parsing config file:", g);
66
+ return;
67
+ }
97
68
  }
98
- }
99
- const _ = $(i, "astro");
100
- await F(_, "utf-8").catch(() => !1) || await H(_, { recursive: !0 });
101
- const x = M(c), J = $(i, "astro", `${x}.config`);
102
- await B(J, JSON.stringify(w)), u.push(`import ${c} from '${t}.astro?configFile=${x}.config';`), f.push(c);
103
- }
104
- return `${u.join(`
69
+ const p = await R(t, "utf-8"), u = q(p);
70
+ if (u)
71
+ return await (await V(u, l))(o, t);
72
+ const i = ["import { classNameInstance } from '@salty-css/core/instances/classname-instance';"], w = [], v = [], G = await o.compileSaltyFile(t, h), I = Object.entries(G.contents);
73
+ for (const [e, F] of I) {
74
+ const d = await H(F, 1);
75
+ if (!d.generator) continue;
76
+ if (d.isClassName) {
77
+ const E = d.generator._withBuildContext({
78
+ callerName: e,
79
+ isProduction: o.isProduction,
80
+ config: {}
81
+ });
82
+ w.push(`const ${e} = classNameInstance(${JSON.stringify(E.params)});`), v.push(e);
83
+ continue;
84
+ }
85
+ const [$, g] = await L(p, e), C = p.slice($, g), c = (a = (r = /styled\(([^,]+),/.exec(C)) == null ? void 0 : r.at(1)) == null ? void 0 : a.trim();
86
+ if (!c) {
87
+ console.warn(`Could not determine tag name for ${e} in ${t}`);
88
+ continue;
89
+ }
90
+ const N = d.generator._withBuildContext({
91
+ callerName: e,
92
+ isProduction: o.isProduction,
93
+ config: {}
94
+ }), m = {
95
+ componentName: e,
96
+ tagName: c.replace(/['"`]/g, ""),
97
+ tagIsComponent: !1,
98
+ classNames: N.classNames,
99
+ imports: [],
100
+ clientProps: N.clientProps
101
+ }, _ = /^\w+$/.test(c);
102
+ if (m.tagIsComponent = _, _) {
103
+ const E = I.some(([y]) => y === c), O = p.match(new RegExp(`import[^;]*${c}[^;]*;`));
104
+ if (E) {
105
+ const y = J(c), A = `import ${c} from '${t}.astro?configFile=${y}.config';`;
106
+ m.imports = [A];
107
+ } else if (O) {
108
+ const y = O.at(0);
109
+ m.imports = [y];
110
+ }
111
+ }
112
+ const S = k(h, "astro");
113
+ await R(S, "utf-8").catch(() => !1) || await U(S, { recursive: !0 });
114
+ const x = J(e), T = k(h, "astro", `${x}.config`);
115
+ await W(T, JSON.stringify(m)), i.push(`import ${e} from '${t}.astro?configFile=${x}.config';`), v.push(e);
116
+ }
117
+ return `${i.join(`
105
118
  `)}
106
- ${d.join(`
119
+ ${w.join(`
107
120
  `)}
108
- export { ${f.join(", ")} };`;
109
- }
110
- return;
111
- } catch (l) {
112
- console.error("Error during file compilation:", l);
113
- return;
114
- }
115
- }, q = async (n, { file: t, server: o, modules: s }) => {
116
- try {
117
- if (await R(t)) return await n.generateCss(!1);
118
- if (!C(t)) return;
119
- const i = await n.getDestDir(), r = [];
120
- for (const [e, u] of o.moduleGraph.idToModuleMap)
121
- e.startsWith(t + ".astro?configFile=") && (o.moduleGraph.invalidateModule(u), r.push(u));
122
- for (const e of o.moduleGraph.urlToModuleMap.values())
123
- e.file && e.file.startsWith(i) && (o.moduleGraph.invalidateModule(e), r.push(e));
124
- return o.ws.send({ type: "update", updates: [] }), [...s, ...r];
125
- } catch (a) {
126
- console.error("Error during hot update handling:", a);
127
- }
128
- }, z = async (n, t, o) => {
129
- try {
130
- C(t) && o.event !== "delete" && (await R(t) || await n.generateFile(t));
131
- } catch (s) {
132
- console.error("Error during watch change handling:", s);
133
- }
134
- }, nt = (n, t = {}) => {
135
- const o = new G(n, { mode: t.mode }), s = { compiler: o, importer: void 0 }, a = (r) => {
136
- const e = Date.now();
137
- return import(
138
- /* @vite-ignore */
139
- `${r}?t=${e}`
140
- );
141
- };
142
- let l, i = !1;
143
- return o.importFile = async (r) => {
144
- if (i || !l) return a(r);
145
- const e = Date.now();
146
- return s.importer = l.ssrLoadModule, l.ssrLoadModule(`${r}?t=${e}`);
147
- }, {
148
- name: "stylegen",
149
- configResolved: async function(r) {
150
- i = r.command === "build";
151
- try {
152
- i && await o.generateCss();
153
- } catch (e) {
154
- throw console.error("Error during initial CSS generation:", e), e;
121
+ export { ${v.join(", ")} };`;
122
+ }
123
+ return;
124
+ } catch (f) {
125
+ console.error("Error during file compilation:", f);
126
+ return;
155
127
  }
156
128
  },
157
- configureServer: async function(r) {
158
- l = r;
129
+ handleHotUpdate: async function({ file: t, server: r, modules: a }) {
159
130
  try {
160
- i || await o.generateCss();
161
- } catch (e) {
162
- throw console.error("Error during initial CSS generation:", e), e;
131
+ if (await j(t)) return await o.generateCss(!1);
132
+ if (!M(t)) return;
133
+ const p = await o.getDestDir(), u = [];
134
+ for (const [i, w] of r.moduleGraph.idToModuleMap)
135
+ i.startsWith(t + ".astro?configFile=") && (r.moduleGraph.invalidateModule(w), u.push(w));
136
+ for (const i of r.moduleGraph.urlToModuleMap.values())
137
+ i.file && i.file.startsWith(p) && (r.moduleGraph.invalidateModule(i), u.push(i));
138
+ return r.ws.send({ type: "update", updates: [] }), [...a, ...u];
139
+ } catch (f) {
140
+ console.error("Error during hot update handling:", f);
163
141
  }
164
142
  },
165
- load: function(r) {
166
- return V(s, r);
167
- },
168
- handleHotUpdate: function(r) {
169
- return q(o, r);
170
- },
171
143
  watchChange: {
172
- handler: function(r, e) {
173
- return z(o, r, e);
144
+ handler: async function(t, r) {
145
+ try {
146
+ M(t) && r.event !== "delete" && (await j(t) || await o.generateFile(t));
147
+ } catch (a) {
148
+ console.error("Error during watch change handling:", a);
149
+ }
174
150
  }
175
151
  }
176
152
  };
177
153
  };
178
154
  export {
179
- nt as default,
180
- nt as saltyPlugin
155
+ rt as default,
156
+ rt as saltyPlugin
181
157
  };
@@ -1,5 +1,5 @@
1
1
  import { SaltyCompiler } from '@salty-css/core/compiler/salty-compiler';
2
- export type Importer = undefined | ((path: string) => Promise<any>);
2
+ type Importer = undefined | ((path: string) => Promise<any>);
3
3
  export type SaltyFileTransform = (compiler: SaltyCompiler, file: string) => Promise<string | undefined>;
4
4
  export interface FrameworkEntry {
5
5
  name: string;
@@ -9,3 +9,4 @@ export interface FrameworkEntry {
9
9
  export declare const frameworkRegistry: FrameworkEntry[];
10
10
  export declare const getFrameworkTransform: (entry: FrameworkEntry, importer: Importer) => Promise<SaltyFileTransform>;
11
11
  export declare const detectFramework: (source: string) => FrameworkEntry | undefined;
12
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/astro",
3
- "version": "0.2.0-fix-astro-fixes-06-2026.4",
3
+ "version": "0.2.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -78,12 +78,12 @@
78
78
  }
79
79
  },
80
80
  "dependencies": {
81
- "@salty-css/core": "0.2.0-fix-astro-fixes-06-2026.4",
81
+ "@salty-css/core": "0.2.1",
82
82
  "astro": "^5.13.2",
83
83
  "vite": "^6.3.5"
84
84
  },
85
85
  "peerDependencies": {
86
- "@salty-css/react": "0.2.0-fix-astro-fixes-06-2026.4"
86
+ "@salty-css/react": "0.2.1"
87
87
  },
88
88
  "peerDependenciesMeta": {
89
89
  "@salty-css/react": {
@@ -1,6 +0,0 @@
1
- /**
2
- * Render the `.astro` component template for a styled/className component from its
3
- * stored `<hash>.config` file. Returns `undefined` when the config cannot be read
4
- * or parsed so the caller can fall through.
5
- */
6
- export declare const renderAstroComponent: (destDir: string, configFile: string) => Promise<string | undefined>;
@@ -1,13 +0,0 @@
1
- import { SaltyCompiler } from '@salty-css/core/compiler/salty-compiler';
2
- import { Importer } from './framework-registry';
3
- export interface AstroPluginContext {
4
- compiler: SaltyCompiler;
5
- /** Updated just-in-time by the plugin's importFile, read here for dev transforms. */
6
- importer: Importer;
7
- }
8
- /**
9
- * Vite `load` hook body: resolves stored `.astro` component configs, delegates to
10
- * framework-specific transforms, or compiles a salty file into a styled/className
11
- * module while writing per-component `.config` files.
12
- */
13
- export declare const loadSaltyFile: (ctx: AstroPluginContext, filePath: string) => Promise<string | undefined>;
@@ -1,8 +0,0 @@
1
- import { SaltyCompiler } from '@salty-css/core/compiler/salty-compiler';
2
- import { HmrContext, ModuleNode } from 'vite';
3
- /** Vite `handleHotUpdate` hook body: invalidate config + generated-CSS modules. */
4
- export declare const handleHotUpdate: (saltyCompiler: SaltyCompiler, { file, server, modules }: HmrContext) => Promise<ModuleNode[] | void>;
5
- /** Vite `watchChange` hook body: regenerate the changed salty file on edits. */
6
- export declare const watchChange: (saltyCompiler: SaltyCompiler, filePath: string, change: {
7
- event: "create" | "update" | "delete";
8
- }) => Promise<void>;