@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.
- package/astro-vite-plugin.cjs +8 -8
- package/astro-vite-plugin.js +134 -158
- package/framework-registry.d.ts +2 -1
- package/package.json +3 -3
- package/astro-template.d.ts +0 -6
- package/load-salty-file.d.ts +0 -13
- package/watch-handlers.d.ts +0 -8
package/astro-vite-plugin.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
${
|
|
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(
|
|
5
|
-
const __r = resolveAstroProps(Astro.props, __gp, ${JSON.stringify(
|
|
6
|
-
const Element = ${
|
|
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(
|
|
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
|
-
${
|
|
10
|
+
${y.join(`
|
|
11
11
|
`)}
|
|
12
|
-
export { ${
|
|
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;
|
package/astro-vite-plugin.js
CHANGED
|
@@ -1,181 +1,157 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
const
|
|
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 (
|
|
13
|
-
const
|
|
14
|
-
return (
|
|
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
|
-
],
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
},
|
|
26
|
-
for (const
|
|
27
|
-
for (const
|
|
28
|
-
if (
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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(
|
|
38
|
-
const __r = resolveAstroProps(Astro.props, __gp, ${JSON.stringify(
|
|
39
|
-
const Element = ${
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
${
|
|
119
|
+
${w.join(`
|
|
107
120
|
`)}
|
|
108
|
-
export { ${
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
158
|
-
l = r;
|
|
129
|
+
handleHotUpdate: async function({ file: t, server: r, modules: a }) {
|
|
159
130
|
try {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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(
|
|
173
|
-
|
|
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
|
-
|
|
180
|
-
|
|
155
|
+
rt as default,
|
|
156
|
+
rt as saltyPlugin
|
|
181
157
|
};
|
package/framework-registry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SaltyCompiler } from '@salty-css/core/compiler/salty-compiler';
|
|
2
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
86
|
+
"@salty-css/react": "0.2.1"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@salty-css/react": {
|
package/astro-template.d.ts
DELETED
|
@@ -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>;
|
package/load-salty-file.d.ts
DELETED
|
@@ -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>;
|
package/watch-handlers.d.ts
DELETED
|
@@ -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>;
|