@salty-css/astro 0.1.0-refactor-add-additional-paths-to-config-cache.1 → 0.1.0
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.d.ts +2 -6
- package/astro-vite-plugin.js +100 -77
- package/framework-registry.d.ts +12 -0
- package/integration.cjs +1 -1
- package/integration.d.ts +0 -16
- package/integration.js +16 -25
- package/package.json +10 -6
- package/dynamic-styles.cjs +0 -1
- package/dynamic-styles.d.ts +0 -20
- package/dynamic-styles.js +0 -11
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.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SaltyCompilerMode } from '@salty-css/core/compiler/salty-compiler';
|
|
2
2
|
import { PluginOption } from 'vite';
|
|
3
3
|
export interface SaltyAstroPluginOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Explicit build mode. Defaults to NODE_ENV-based detection.
|
|
6
6
|
*/
|
|
7
7
|
mode?: SaltyCompilerMode;
|
|
8
|
-
/**
|
|
9
|
-
* Reuse an existing SaltyCompiler instance instead of creating a new one.
|
|
10
|
-
*/
|
|
11
|
-
compiler: SaltyCompiler;
|
|
12
8
|
}
|
|
13
|
-
export declare const saltyPlugin: (
|
|
9
|
+
export declare const saltyPlugin: (dir: string, options?: SaltyAstroPluginOptions) => PluginOption;
|
|
14
10
|
export default saltyPlugin;
|
package/astro-vite-plugin.js
CHANGED
|
@@ -1,134 +1,157 @@
|
|
|
1
|
-
import { isSaltyFile as
|
|
2
|
-
import { getFunctionRange as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
{
|
|
10
|
+
name: "react",
|
|
11
|
+
importMarkers: [/['"]@salty-css\/react(\/[^'"]*)?['"]/],
|
|
12
|
+
loadTransform: async (s) => {
|
|
13
|
+
const n = "@salty-css/react/transform-salty-file";
|
|
14
|
+
return (s ? await s(n) : await import(n)).transformSaltyFile;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
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 });
|
|
9
29
|
return {
|
|
10
30
|
name: "stylegen",
|
|
11
31
|
configureServer: function(t) {
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
return t.ssrLoadModule(`${
|
|
32
|
+
o.importFile = async (r) => {
|
|
33
|
+
const a = Date.now();
|
|
34
|
+
return l = t.ssrLoadModule, t.ssrLoadModule(`${r}?t=${a}`);
|
|
15
35
|
};
|
|
16
36
|
},
|
|
17
37
|
configResolved: async function() {
|
|
18
38
|
try {
|
|
19
|
-
await
|
|
39
|
+
await o.generateCss();
|
|
20
40
|
} catch (t) {
|
|
21
41
|
throw console.error("Error during initial CSS generation:", t), t;
|
|
22
42
|
}
|
|
23
43
|
},
|
|
24
44
|
load: async function(t) {
|
|
25
|
-
var
|
|
45
|
+
var r, a;
|
|
26
46
|
try {
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
47
|
+
if (M(t, [], !t.includes("configFile="))) {
|
|
48
|
+
const h = await o.getDestDir();
|
|
29
49
|
if (/.+\?configFile=(\w+).+/.test(t)) {
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
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;
|
|
34
54
|
try {
|
|
35
|
-
const
|
|
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)}`;
|
|
36
56
|
return `---
|
|
37
|
-
${
|
|
57
|
+
${S.join(`
|
|
38
58
|
`)}
|
|
39
|
-
const __gp = ${JSON.stringify(
|
|
40
|
-
const __r = resolveAstroProps(Astro.props, __gp, ${JSON.stringify(
|
|
41
|
-
const Element = ${
|
|
59
|
+
const __gp = ${JSON.stringify(C)};
|
|
60
|
+
const __r = resolveAstroProps(Astro.props, __gp, ${JSON.stringify(c)});
|
|
61
|
+
const Element = ${D};
|
|
42
62
|
---
|
|
43
63
|
<Element class:list={__r.class} style={__r.style} {...__r.rest}><slot/></Element>`;
|
|
44
|
-
} catch (
|
|
45
|
-
console.error("Error parsing config file:",
|
|
64
|
+
} catch (g) {
|
|
65
|
+
console.error("Error parsing config file:", g);
|
|
46
66
|
return;
|
|
47
67
|
}
|
|
48
68
|
}
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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({
|
|
55
78
|
callerName: e,
|
|
56
|
-
isProduction:
|
|
79
|
+
isProduction: o.isProduction,
|
|
57
80
|
config: {}
|
|
58
81
|
});
|
|
59
|
-
|
|
82
|
+
w.push(`const ${e} = classNameInstance(${JSON.stringify(E.params)});`), v.push(e);
|
|
60
83
|
continue;
|
|
61
84
|
}
|
|
62
|
-
const [
|
|
63
|
-
if (!
|
|
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) {
|
|
64
87
|
console.warn(`Could not determine tag name for ${e} in ${t}`);
|
|
65
88
|
continue;
|
|
66
89
|
}
|
|
67
|
-
const
|
|
90
|
+
const N = d.generator._withBuildContext({
|
|
68
91
|
callerName: e,
|
|
69
|
-
isProduction:
|
|
92
|
+
isProduction: o.isProduction,
|
|
70
93
|
config: {}
|
|
71
|
-
}),
|
|
94
|
+
}), m = {
|
|
72
95
|
componentName: e,
|
|
73
|
-
tagName:
|
|
96
|
+
tagName: c.replace(/['"`]/g, ""),
|
|
74
97
|
tagIsComponent: !1,
|
|
75
|
-
classNames:
|
|
98
|
+
classNames: N.classNames,
|
|
76
99
|
imports: [],
|
|
77
|
-
clientProps:
|
|
78
|
-
},
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
} else if (
|
|
85
|
-
const
|
|
86
|
-
|
|
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];
|
|
87
110
|
}
|
|
88
111
|
}
|
|
89
|
-
const
|
|
90
|
-
await S
|
|
91
|
-
const
|
|
92
|
-
await
|
|
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);
|
|
93
116
|
}
|
|
94
|
-
return `${
|
|
117
|
+
return `${i.join(`
|
|
95
118
|
`)}
|
|
96
|
-
${
|
|
119
|
+
${w.join(`
|
|
97
120
|
`)}
|
|
98
|
-
export { ${
|
|
121
|
+
export { ${v.join(", ")} };`;
|
|
99
122
|
}
|
|
100
123
|
return;
|
|
101
|
-
} catch (
|
|
102
|
-
console.error("Error during file compilation:",
|
|
124
|
+
} catch (f) {
|
|
125
|
+
console.error("Error during file compilation:", f);
|
|
103
126
|
return;
|
|
104
127
|
}
|
|
105
128
|
},
|
|
106
|
-
handleHotUpdate: async function({ file: t, server:
|
|
129
|
+
handleHotUpdate: async function({ file: t, server: r, modules: a }) {
|
|
107
130
|
try {
|
|
108
|
-
if (await
|
|
109
|
-
if (!
|
|
110
|
-
const
|
|
111
|
-
for (const [
|
|
112
|
-
|
|
113
|
-
for (const
|
|
114
|
-
|
|
115
|
-
return
|
|
116
|
-
} catch (
|
|
117
|
-
console.error("Error during hot update handling:",
|
|
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);
|
|
118
141
|
}
|
|
119
142
|
},
|
|
120
143
|
watchChange: {
|
|
121
|
-
handler: async function(t,
|
|
144
|
+
handler: async function(t, r) {
|
|
122
145
|
try {
|
|
123
|
-
|
|
124
|
-
} catch (
|
|
125
|
-
console.error("Error during watch change handling:",
|
|
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);
|
|
126
149
|
}
|
|
127
150
|
}
|
|
128
151
|
}
|
|
129
152
|
};
|
|
130
153
|
};
|
|
131
154
|
export {
|
|
132
|
-
|
|
133
|
-
|
|
155
|
+
rt as default,
|
|
156
|
+
rt as saltyPlugin
|
|
134
157
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SaltyCompiler } from '@salty-css/core/compiler/salty-compiler';
|
|
2
|
+
type Importer = undefined | ((path: string) => Promise<any>);
|
|
3
|
+
export type SaltyFileTransform = (compiler: SaltyCompiler, file: string) => Promise<string | undefined>;
|
|
4
|
+
export interface FrameworkEntry {
|
|
5
|
+
name: string;
|
|
6
|
+
importMarkers: RegExp[];
|
|
7
|
+
loadTransform: (importer: Importer) => Promise<SaltyFileTransform>;
|
|
8
|
+
}
|
|
9
|
+
export declare const frameworkRegistry: FrameworkEntry[];
|
|
10
|
+
export declare const getFrameworkTransform: (entry: FrameworkEntry, importer: Importer) => Promise<SaltyFileTransform>;
|
|
11
|
+
export declare const detectFramework: (source: string) => FrameworkEntry | undefined;
|
|
12
|
+
export {};
|
package/integration.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./astro-vite-plugin.cjs"),u=require("path"),t=(e={})=>({name:"astro-salty-integration",hooks:{"astro:config:setup":({config:r,updateConfig:o})=>{const{srcDir:i="src",rootDir:n=r.root.pathname}=e,s=u.join(n,i);o({vite:{plugins:[a.default(s)]}})}}});exports.default=t;exports.saltyIntegration=t;
|
package/integration.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { AstroIntegration } from 'astro';
|
|
2
|
-
import { SaltyCompilerMode } from '@salty-css/core/compiler/salty-compiler';
|
|
3
|
-
import { CopyConfigCacheOption } from '@salty-css/core/compiler/copy-config-cache';
|
|
4
2
|
interface SaltyIntegrationOptions {
|
|
5
3
|
/**
|
|
6
4
|
* The source directory where SaltyCSS Config is located.
|
|
@@ -12,20 +10,6 @@ interface SaltyIntegrationOptions {
|
|
|
12
10
|
* Default is the current directory of the Astro configuration.
|
|
13
11
|
*/
|
|
14
12
|
rootDir?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Explicit build mode. Defaults to NODE_ENV-based detection.
|
|
17
|
-
*/
|
|
18
|
-
mode?: SaltyCompilerMode;
|
|
19
|
-
/**
|
|
20
|
-
* Where to copy the Salty `config-cache.json` after a production build.
|
|
21
|
-
*
|
|
22
|
-
* - `true` (default) → copy to Astro's `dist` output dir.
|
|
23
|
-
* - `false` → no copy.
|
|
24
|
-
* - `string | string[]` → copy to the default destination PLUS each listed path.
|
|
25
|
-
* Useful for adapters that emit a separate server bundle (e.g. Cloudflare's
|
|
26
|
-
* `dist/_worker.js/`, Vercel's `.vercel/output/functions/...`).
|
|
27
|
-
*/
|
|
28
|
-
copyConfigCache?: CopyConfigCacheOption;
|
|
29
13
|
}
|
|
30
14
|
export declare const saltyIntegration: (options?: SaltyIntegrationOptions) => AstroIntegration;
|
|
31
15
|
export default saltyIntegration;
|
package/integration.js
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
t = p(a, n), o = new c(t, { mode: s }), i({
|
|
14
|
-
vite: { plugins: [f({ compiler: o })] }
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
"astro:build:done": async ({ dir: r }) => {
|
|
18
|
-
if (!o || !t || !o.isProduction) return;
|
|
19
|
-
const i = u(r), n = m(e.copyConfigCache, i, t);
|
|
20
|
-
await l(o, n);
|
|
21
|
-
}
|
|
1
|
+
import a from "./astro-vite-plugin.js";
|
|
2
|
+
import { join as e } from "path";
|
|
3
|
+
const l = (t = {}) => ({
|
|
4
|
+
name: "astro-salty-integration",
|
|
5
|
+
hooks: {
|
|
6
|
+
"astro:config:setup": ({ config: o, updateConfig: r }) => {
|
|
7
|
+
const { srcDir: i = "src", rootDir: n = o.root.pathname } = t, s = e(n, i);
|
|
8
|
+
r({
|
|
9
|
+
vite: {
|
|
10
|
+
plugins: [a(s)]
|
|
11
|
+
}
|
|
12
|
+
});
|
|
22
13
|
}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
14
|
+
}
|
|
15
|
+
});
|
|
25
16
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
l as default,
|
|
18
|
+
l as saltyIntegration
|
|
28
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salty-css/astro",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -52,10 +52,6 @@
|
|
|
52
52
|
"import": "./element-props.js",
|
|
53
53
|
"require": "./element-props.cjs"
|
|
54
54
|
},
|
|
55
|
-
"./dynamic-styles": {
|
|
56
|
-
"import": "./dynamic-styles.js",
|
|
57
|
-
"require": "./dynamic-styles.cjs"
|
|
58
|
-
},
|
|
59
55
|
"./runtime": {
|
|
60
56
|
"import": "./runtime.js",
|
|
61
57
|
"require": "./runtime.cjs"
|
|
@@ -78,8 +74,16 @@
|
|
|
78
74
|
}
|
|
79
75
|
},
|
|
80
76
|
"dependencies": {
|
|
81
|
-
"@salty-css/core": "
|
|
77
|
+
"@salty-css/core": "0.1.0",
|
|
82
78
|
"astro": "^5.13.2",
|
|
83
79
|
"vite": "^6.3.5"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"@salty-css/react": "0.1.0"
|
|
83
|
+
},
|
|
84
|
+
"peerDependenciesMeta": {
|
|
85
|
+
"@salty-css/react": {
|
|
86
|
+
"optional": true
|
|
87
|
+
}
|
|
84
88
|
}
|
|
85
89
|
}
|
package/dynamic-styles.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@salty-css/core/css/dynamic-styles"),n=async(t,a)=>{const s=e.getDynamicStylesClassName(t),y=await e.getDynamicStylesCss(t,a||`.${s}`);return{className:s,css:y}};Object.defineProperty(exports,"getDynamicStylesClassName",{enumerable:!0,get:()=>e.getDynamicStylesClassName});Object.defineProperty(exports,"getDynamicStylesCss",{enumerable:!0,get:()=>e.getDynamicStylesCss});exports.resolveDynamicStyles=n;
|
package/dynamic-styles.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BaseStyles } from '@salty-css/core/types';
|
|
2
|
-
import { getDynamicStylesClassName, getDynamicStylesCss } from '@salty-css/core/css/dynamic-styles';
|
|
3
|
-
export { getDynamicStylesClassName, getDynamicStylesCss };
|
|
4
|
-
/**
|
|
5
|
-
* Resolve dynamic styles for SSR usage inside an `.astro` component.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```astro
|
|
9
|
-
* ---
|
|
10
|
-
* import { resolveDynamicStyles } from '@salty-css/astro/dynamic-styles';
|
|
11
|
-
* const { className, css } = await resolveDynamicStyles({ color: 'red' });
|
|
12
|
-
* ---
|
|
13
|
-
* <style set:html={css}></style>
|
|
14
|
-
* <div class={className}><slot/></div>
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare const resolveDynamicStyles: (styles: BaseStyles, scope?: string) => Promise<{
|
|
18
|
-
className: string;
|
|
19
|
-
css: string;
|
|
20
|
-
}>;
|
package/dynamic-styles.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { getDynamicStylesClassName as c, getDynamicStylesCss as m } from "@salty-css/core/css/dynamic-styles";
|
|
2
|
-
import { getDynamicStylesClassName as r, getDynamicStylesCss as i } from "@salty-css/core/css/dynamic-styles";
|
|
3
|
-
const y = async (s, t) => {
|
|
4
|
-
const e = c(s), a = await m(s, t || `.${e}`);
|
|
5
|
-
return { className: e, css: a };
|
|
6
|
-
};
|
|
7
|
-
export {
|
|
8
|
-
r as getDynamicStylesClassName,
|
|
9
|
-
i as getDynamicStylesCss,
|
|
10
|
-
y as resolveDynamicStyles
|
|
11
|
-
};
|