@salty-css/vite 0.0.1-alpha.22 → 0.0.1-alpha.221
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 +415 -26
- package/index.cjs +40 -16
- package/index.d.ts +3 -8
- package/index.js +631 -232
- package/package.json +9 -4
package/README.md
CHANGED
@@ -1,15 +1,404 @@
|
|
1
|
-
|
1
|
+

|
2
2
|
|
3
|
-
|
3
|
+
# Salty CSS - CSS-in-JS library that is kinda sweet
|
4
4
|
|
5
|
-
|
5
|
+
Is there anything saltier than CSS in frontend web development? Salty CSS is built to provide better developer experience for developers looking for performant and feature rich CSS-in-JS solutions.
|
6
6
|
|
7
|
-
|
8
|
-
2. Create `salty.config.ts` to the root of your project
|
9
|
-
3. Import global styles to any regular .css file from `saltygen/index.css` (does not exist during first run, cli command coming later)
|
10
|
-
4. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
|
7
|
+
## Features
|
11
8
|
|
12
|
-
|
9
|
+
- Build time compilation to achieve awesome runtime performance and minimal size
|
10
|
+
- Next.js, React Server Components, Astro, Vite and Webpack support
|
11
|
+
- Type safety with out of the box TypeScript and ESLint plugin
|
12
|
+
- Advanced CSS variables configuration to allow smooth token usage
|
13
|
+
- Style templates to create reusable styles easily
|
14
|
+
|
15
|
+
## Get started
|
16
|
+
|
17
|
+
Fastest way to get started with any framework is `npx salty-css init [directory]` command
|
18
|
+
|
19
|
+
- Next.js → [Next.js guide](#nextjs) + [Next.js example app](https://github.com/margarita-form/salty-css-website)
|
20
|
+
- React + Vite → [React + Vite guide](#react--vite) + [React example code](#code-examples)
|
21
|
+
- React + Webpack → Guide coming soon
|
22
|
+
|
23
|
+
## Useful commands
|
24
|
+
|
25
|
+
- Create component: `npx salty-css generate [filePath]`
|
26
|
+
- Build: `npx salty-css build [directory]`
|
27
|
+
- Update Salty CSS packages: `npx salty-css up`
|
28
|
+
|
29
|
+
## Good to know
|
30
|
+
|
31
|
+
1. All Salty CSS functions (`styled`, `classNames`, `keyframes`, etc.) must be created in `*.css.ts` or `*.css.tsx` files. This is to ensure best build performance.
|
32
|
+
2. Salty CSS components created with styled function can extend non Salty CSS components (`export const CustomLink = styled(NextJSLink, { ... });`) but those components must take in `className` prop for styles to apply.
|
33
|
+
3. Among common types like `string` and `number`, CSS-in-JS properties in Salty CSS do support `functions` and `promises` as values (`styled('span', { base: { color: async () => 'red' } });`) but running asynchronous tasks or importing heavy 3rd party libraries into `*.css.ts` or `*.css.tsx` files can cause longer build times.
|
34
|
+
|
35
|
+
## Functions
|
36
|
+
|
37
|
+
### Styling
|
38
|
+
|
39
|
+
- [styled](#styled-function) (react only) - create React components that can be used anywhere easily
|
40
|
+
- [className](#class-name-function) (framework agnostic) - create a CSS class string that can be applied to any element
|
41
|
+
|
42
|
+
### Global
|
43
|
+
|
44
|
+
- [defineGlobalStyles](#global-styles) - set global styles like `html` and `body`
|
45
|
+
- [defineVariables](#variables) - create CSS variables (tokens) that can be used in any styling function
|
46
|
+
- [defineMediaQuery](#media-queries) - create CSS media queries and use them in any styling function
|
47
|
+
- [defineTemplates](#templates) - create reusable templates that can be applied when same styles are used over and over again
|
48
|
+
- [keyframes](#keyframes-animations) - create CSS keyframes animation that can be used and imported in any styling function
|
49
|
+
|
50
|
+
### Helpers & utility
|
51
|
+
|
52
|
+
- [defineViewportClamp](#viewport-clamp) - create CSS clamp functions that are based on user's viewport and can calculate relative values easily
|
53
|
+
- [color](#color-function) - transform any valid color code or variable to be darker, lighter etc. easily (uses [color library by Qix-](https://github.com/Qix-/color))
|
54
|
+
|
55
|
+
## Styled function
|
56
|
+
|
57
|
+
Styled function is the main way to use Salty CSS within React. Styled function creates a React component that then can be used anywhere in your app. All styled functions must be created in `.css.ts` or `.css.tsx` files
|
58
|
+
|
59
|
+
```ts
|
60
|
+
// components/my-component.css.ts
|
61
|
+
import { styled } from '@salty-css/react/styled';
|
62
|
+
|
63
|
+
// Define a component with a styled function. First argument is the component name or existing component to extend and second argument is the object containing the styles and other options
|
64
|
+
export const Component = styled('div', {
|
65
|
+
className: 'wrapper', // Define custom class name that will be included for this component
|
66
|
+
element: 'section', // Define the html element that will be rendered for this component, overrides the first 'div' argument
|
67
|
+
base: {
|
68
|
+
// 👉 Add your CSS-in-JS base styles here! 👈
|
69
|
+
},
|
70
|
+
variants: {
|
71
|
+
// Define conditional styles that will be applied to the component based on the variant prop values
|
72
|
+
},
|
73
|
+
compoundVariants: [
|
74
|
+
// Define conditional styles that will be applied to the component based on the combination of variant prop values
|
75
|
+
],
|
76
|
+
defaultVariants: {
|
77
|
+
// Set default variant prop values
|
78
|
+
},
|
79
|
+
defaultProps: {
|
80
|
+
// Add additional default props for the component (eg, id and other html element attributes)
|
81
|
+
},
|
82
|
+
passProps: true, // Pass variant props to the rendered element / parent component (default: false)
|
83
|
+
});
|
84
|
+
```
|
85
|
+
|
86
|
+
## Class name function
|
87
|
+
|
88
|
+
Create CSS class names with possibility to add scope and media queries etc. Function `className` is quite similar to `styled` but does not allow extending components or classes.
|
89
|
+
|
90
|
+
```ts
|
91
|
+
// styles/my-class.css.ts
|
92
|
+
import { className } from '@salty-css/react/class-name';
|
93
|
+
|
94
|
+
// Define a CSS class with className function. First and only argument is the object containing the styles and other options
|
95
|
+
export const myClass = className({
|
96
|
+
className: 'wrapper', // Define custom class name that will be included to the scope
|
97
|
+
base: {
|
98
|
+
// 👉 Add your CSS-in-JS base styles here! 👈
|
99
|
+
},
|
100
|
+
});
|
101
|
+
```
|
102
|
+
|
103
|
+
## Global styles
|
104
|
+
|
105
|
+
```ts
|
106
|
+
// /styles/global.css.ts
|
107
|
+
import { defineGlobalStyles } from '@salty-css/core/factories';
|
108
|
+
|
109
|
+
export default defineGlobalStyles({
|
110
|
+
html: {
|
111
|
+
fontFamily: 'Arial, sans-serif',
|
112
|
+
},
|
113
|
+
body: {
|
114
|
+
backgroundColor: '#fff',
|
115
|
+
margin: 0,
|
116
|
+
},
|
117
|
+
// Add more global styles as needed
|
118
|
+
});
|
119
|
+
```
|
120
|
+
|
121
|
+
## Variables
|
122
|
+
|
123
|
+
```ts
|
124
|
+
// /styles/variables.css.ts
|
125
|
+
import { defineVariables } from '@salty-css/core/factories';
|
126
|
+
|
127
|
+
export default defineVariables({
|
128
|
+
/*
|
129
|
+
Define static variable token (like colors, font sizes, etc.). and use them in your styles (e.g. color: '{colors.brand.highlight}').
|
130
|
+
Variables can be nested (colors.brand.main) and can reference other variables.
|
131
|
+
*/
|
132
|
+
colors: {
|
133
|
+
dark: '#111',
|
134
|
+
light: '#fefefe',
|
135
|
+
brand: {
|
136
|
+
main: '#0070f3',
|
137
|
+
highlight: '#ff4081',
|
138
|
+
},
|
139
|
+
},
|
140
|
+
fontFamily: {
|
141
|
+
heading: 'Arial, sans-serif',
|
142
|
+
body: 'Georgia, serif',
|
143
|
+
},
|
144
|
+
|
145
|
+
/*
|
146
|
+
Define variables that are responsive to a media query (defined in media.css.ts) asn use them in your styles as normal (e.g. font-size: '{fontSize.heading.regular}').
|
147
|
+
These variables will be automatically updated when the media query is matched. Base values are used when no media query is matched.
|
148
|
+
*/
|
149
|
+
responsive: {
|
150
|
+
base: {
|
151
|
+
fontSize: {
|
152
|
+
heading: {
|
153
|
+
small: '32px',
|
154
|
+
regular: '48px',
|
155
|
+
large: '64px',
|
156
|
+
},
|
157
|
+
body: {
|
158
|
+
small: '16px',
|
159
|
+
regular: '20px',
|
160
|
+
large: '24px',
|
161
|
+
},
|
162
|
+
},
|
163
|
+
},
|
164
|
+
'@largeMobileDown': {
|
165
|
+
fontSize: {
|
166
|
+
heading: {
|
167
|
+
small: '20px',
|
168
|
+
regular: '32px',
|
169
|
+
large: '48px',
|
170
|
+
},
|
171
|
+
body: {
|
172
|
+
small: '14px',
|
173
|
+
regular: '16px',
|
174
|
+
large: '20px',
|
175
|
+
},
|
176
|
+
},
|
177
|
+
},
|
178
|
+
},
|
179
|
+
|
180
|
+
/*
|
181
|
+
Conditional variables are used to define styles that depend on a class name (e.g. <div className="theme-dark">). or data-attribute (e.g. <div data-theme="dark">).
|
182
|
+
*/
|
183
|
+
conditional: {
|
184
|
+
theme: {
|
185
|
+
dark: {
|
186
|
+
backgroundColor: '{colors.dark}',
|
187
|
+
textColor: '{colors.light}',
|
188
|
+
},
|
189
|
+
light: {
|
190
|
+
backgroundColor: '{colors.light}',
|
191
|
+
textColor: '{colors.dark}',
|
192
|
+
},
|
193
|
+
},
|
194
|
+
},
|
195
|
+
});
|
196
|
+
```
|
197
|
+
|
198
|
+
## Media queries
|
199
|
+
|
200
|
+
Create global media queries that can be either used directly as a scope (e.g. `'@MEDIA_QUERY_NAME': { color: 'blue' }`) or imported to be used in JS.
|
201
|
+
|
202
|
+
```ts
|
203
|
+
// /styles/media.css.ts
|
204
|
+
import { defineMediaQuery } from '@salty-css/react/config';
|
205
|
+
|
206
|
+
export const largePortraitUp = defineMediaQuery((media) => media.minWidth(600));
|
207
|
+
export const largeMobileDown = defineMediaQuery((media) => media.maxWidth(600));
|
208
|
+
```
|
209
|
+
|
210
|
+
Example usage:
|
211
|
+
|
212
|
+
```ts
|
213
|
+
styled('span', { base: { fontSize: '64px', '@largeMobileDown': { fontSize: '32px' } } });
|
214
|
+
```
|
215
|
+
|
216
|
+
## Templates
|
217
|
+
|
218
|
+
With templates you can create reusable styles that can be used in any styles function. Templates can be static (all values defined in the template) or functions (parameters can be passed to define values). Templates can be used in styles by using template's name (e.g. textStyle) as property name and for static a key as the value for functions any supported parameter value can be used as the value.
|
219
|
+
|
220
|
+
```ts
|
221
|
+
// /styles/templates.css.ts
|
222
|
+
import { defineTemplates } from '@salty-css/core/factories';
|
223
|
+
|
224
|
+
export default defineTemplates({
|
225
|
+
// Static templates for text styles.
|
226
|
+
textStyle: {
|
227
|
+
headline: {
|
228
|
+
small: {
|
229
|
+
fontSize: '{fontSize.heading.small}',
|
230
|
+
},
|
231
|
+
regular: {
|
232
|
+
fontSize: '{fontSize.heading.regular}',
|
233
|
+
},
|
234
|
+
large: {
|
235
|
+
fontSize: '{fontSize.heading.large}',
|
236
|
+
},
|
237
|
+
},
|
238
|
+
body: {
|
239
|
+
small: {
|
240
|
+
fontSize: '{fontSize.body.small}',
|
241
|
+
lineHeight: '1.5em',
|
242
|
+
},
|
243
|
+
regular: {
|
244
|
+
fontSize: '{fontSize.body.regular}',
|
245
|
+
lineHeight: '1.33em',
|
246
|
+
},
|
247
|
+
},
|
248
|
+
},
|
249
|
+
// Dynamic function templates for card styles.
|
250
|
+
card: (value: string) => {
|
251
|
+
return {
|
252
|
+
padding: value,
|
253
|
+
borderRadius: '8px',
|
254
|
+
boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)',
|
255
|
+
};
|
256
|
+
},
|
257
|
+
});
|
258
|
+
```
|
259
|
+
|
260
|
+
Example usage:
|
261
|
+
|
262
|
+
```ts
|
263
|
+
styled('div', { base: { textStyle: 'headline.large', card: '20px' } });
|
264
|
+
```
|
265
|
+
|
266
|
+
## Keyframes animations
|
267
|
+
|
268
|
+
```ts
|
269
|
+
// /styles/animations.css.ts
|
270
|
+
import { keyframes } from '@salty-css/react/keyframes';
|
271
|
+
|
272
|
+
export const fadeIn = keyframes({
|
273
|
+
// Name of the animation in final CSS
|
274
|
+
animationName: 'fadeIn',
|
275
|
+
// Add `from` or `0%` to the component's css making it the initial state.
|
276
|
+
appendInitialStyles: true,
|
277
|
+
// CSS animation default params used with the value
|
278
|
+
params: {
|
279
|
+
delay: '250ms',
|
280
|
+
fillMode: 'forwards',
|
281
|
+
},
|
282
|
+
// Rest is animation timeline
|
283
|
+
from: {
|
284
|
+
opacity: 0,
|
285
|
+
},
|
286
|
+
to: {
|
287
|
+
opacity: 1,
|
288
|
+
},
|
289
|
+
});
|
290
|
+
```
|
291
|
+
|
292
|
+
Example usage:
|
293
|
+
|
294
|
+
```ts
|
295
|
+
import { fadeIn } from 'path-to-animations.css.ts';
|
296
|
+
|
297
|
+
export const Wrapper = styled('div', { base: { animation: fadeIn } });
|
298
|
+
```
|
299
|
+
|
300
|
+
## Viewport clamp
|
301
|
+
|
302
|
+
Create a CSS clamp function based on screen sizes. Useful when aiming to create font sizes or spacings that scale with the screen.
|
303
|
+
|
304
|
+
```ts
|
305
|
+
// /styles/clamp.css.ts
|
306
|
+
import { defineViewportClamp } from '@salty-css/react/helpers';
|
307
|
+
|
308
|
+
export const fhdClamp = defineViewportClamp({ screenSize: 1920 });
|
309
|
+
export const mobileClamp = defineViewportClamp({ screenSize: 640 });
|
310
|
+
```
|
311
|
+
|
312
|
+
Example usage:
|
313
|
+
|
314
|
+
```ts
|
315
|
+
styled('span', { base: { fontSize: fhdClamp(96), '@largeMobileDown': { fontSize: mobileClamp(48) } } });
|
316
|
+
```
|
317
|
+
|
318
|
+
## Color function
|
319
|
+
|
320
|
+
Modify any color easily, add opacity, darken...
|
321
|
+
|
322
|
+
Example usage:
|
323
|
+
|
324
|
+
```ts
|
325
|
+
import { color } from '@salty-css/core/helpers';
|
326
|
+
|
327
|
+
export const Wrapper = styled('span', { base: { backgroundColor: color('#000').alpha(0.5) } });
|
328
|
+
```
|
329
|
+
|
330
|
+
## Salty CSS CLI
|
331
|
+
|
332
|
+
In your existing repository you can use `npx salty-css [command]` to initialize a project, generate components, update related packages and build required files.
|
333
|
+
|
334
|
+
- Initialize project → `npx salty-css init [directory]` - Installs required packages, detects framework in use and creates project files to the provided directory. Directory can be left blank if you want files to be created to the current directory.
|
335
|
+
- Generate component → `npx salty-css update [version]` - Update @salty-css packages in your repository. Default version is "latest". Additional options like `--dir`, `--tag`, `--name` and `--className` are also supported.
|
336
|
+
- Build files → `npx salty-css build [directory]` - Compile Salty CSS related files in your project. This should not be needed if you are using tools like Next.js or Vite
|
337
|
+
|
338
|
+
## Usage
|
339
|
+
|
340
|
+
### Next.js
|
341
|
+
|
342
|
+

|
343
|
+
|
344
|
+
Salty CSS provides Next.js App & Pages router support with full React Server Components support.
|
345
|
+
|
346
|
+
### Add Salty CSS to Next.js
|
347
|
+
|
348
|
+
1. In your existing Next.js repository you can run `npx salty-css init` to automatically configure Salty CSS.
|
349
|
+
2. Create your first Salty CSS component with `npx salty-css generate [filePath]` (e.g. src/custom-wrapper)
|
350
|
+
3. Import your component for example to `page.tsx` and see it working!
|
351
|
+
|
352
|
+
And note: steps 2 & 3 are just to show how get new components up and running, step 1 does all of the important stuff 🤯
|
353
|
+
|
354
|
+
#### Manual configuration
|
355
|
+
|
356
|
+
1. For Next.js support install `npm i @salty-css/next @salty-css/core @salty-css/react`
|
357
|
+
2. Create `salty.config.ts` to your app directory
|
358
|
+
3. Add Salty CSS plugin to next.js config
|
359
|
+
|
360
|
+
- **Next.js 15:** In `next.config.ts` add import for salty plugin `import { withSaltyCss } from '@salty-css/next';` and then add `withSaltyCss` to wrap your nextConfig export like so `export default withSaltyCss(nextConfig);`
|
361
|
+
- **Next.js 14 and older:** In `next.config.js` add import for salty plugin `const { withSaltyCss } = require('@salty-css/next');` and then add `withSaltyCss` to wrap your nextConfig export like so `module.exports = withSaltyCss(nextConfig);`
|
362
|
+
|
363
|
+
4. Make sure that `salty.config.ts` and `next.config.ts` are in the same folder!
|
364
|
+
5. Build `saltygen` directory by running your app once or with cli `npx salty-css build [directory]`
|
365
|
+
6. Import global styles from `saltygen/index.css` to some global css file with `@import 'insert_path_to_index_css';`.
|
366
|
+
|
367
|
+
[Check out Next.js demo project](https://github.com/margarita-form/salty-css-website) or [react example code](#code-examples)
|
368
|
+
|
369
|
+
---
|
370
|
+
|
371
|
+
### React + Vite
|
372
|
+
|
373
|
+

|
374
|
+
|
375
|
+
### Add Salty CSS to your React + Vite app
|
376
|
+
|
377
|
+
1. In your existing Vite repository you can run `npx salty-css init` to automatically configure Salty CSS.
|
378
|
+
2. Create your first Salty CSS component with `npx salty-css generate [filePath]` (e.g. src/custom-wrapper)
|
379
|
+
3. Import your component for example to `main.tsx` and see it working!
|
380
|
+
|
381
|
+
And note: steps 2 & 3 are just to show how get new components up and running, step 1 does all of the important stuff 🤯
|
382
|
+
|
383
|
+
#### Manual configuration
|
384
|
+
|
385
|
+
1. For Vite support install `npm i @salty-css/vite @salty-css/core`
|
386
|
+
2. In `vite.config` add import for salty plugin `import { saltyPlugin } from '@salty-css/vite';` and then add `saltyPlugin(__dirname)` to your vite configuration plugins
|
387
|
+
3. Make sure that `salty.config.ts` and `vite.config.ts` are in the same folder!
|
388
|
+
4. Build `saltygen` directory by running your app once or with cli `npx salty-css build [directory]`
|
389
|
+
5. Import global styles from `saltygen/index.css` to some global css file with `@import 'insert_path_to_index_css';`.
|
390
|
+
|
391
|
+
[Check out react example code](#code-examples)
|
392
|
+
|
393
|
+
---
|
394
|
+
|
395
|
+
### Create components
|
396
|
+
|
397
|
+
1. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
|
398
|
+
|
399
|
+
## Code examples
|
400
|
+
|
401
|
+
### Basic usage example with Button
|
13
402
|
|
14
403
|
**Salty config**
|
15
404
|
|
@@ -31,23 +420,6 @@ export const config = defineConfig({
|
|
31
420
|
});
|
32
421
|
```
|
33
422
|
|
34
|
-
**Your React component file**
|
35
|
-
|
36
|
-
```tsx
|
37
|
-
import { Wrapper } from '../components/wrapper/wrapper.css';
|
38
|
-
import { Button } from '../components/button/button.css';
|
39
|
-
|
40
|
-
export const IndexPage = () => {
|
41
|
-
return (
|
42
|
-
<Wrapper>
|
43
|
-
<Button variant="solid" onClick={() => alert('It is a button.')}>
|
44
|
-
Outlined
|
45
|
-
</Button>
|
46
|
-
</Wrapper>
|
47
|
-
);
|
48
|
-
};
|
49
|
-
```
|
50
|
-
|
51
423
|
**Wrapper** (`components/wrapper/wrapper.css.ts`)
|
52
424
|
|
53
425
|
```tsx
|
@@ -72,7 +444,7 @@ export const Button = styled('button', {
|
|
72
444
|
padding: `0.6em 1.2em`,
|
73
445
|
border: '1px solid currentColor',
|
74
446
|
background: 'transparent',
|
75
|
-
color: 'currentColor
|
447
|
+
color: 'currentColor',
|
76
448
|
cursor: 'pointer',
|
77
449
|
transition: '200ms',
|
78
450
|
textDecoration: 'none',
|
@@ -108,4 +480,21 @@ export const Button = styled('button', {
|
|
108
480
|
});
|
109
481
|
```
|
110
482
|
|
483
|
+
**Your React component file**
|
484
|
+
|
485
|
+
```tsx
|
486
|
+
import { Wrapper } from '../components/wrapper/wrapper.css';
|
487
|
+
import { Button } from '../components/button/button.css';
|
488
|
+
|
489
|
+
export const IndexPage = () => {
|
490
|
+
return (
|
491
|
+
<Wrapper>
|
492
|
+
<Button variant="solid" onClick={() => alert('It is a button.')}>
|
493
|
+
Outlined
|
494
|
+
</Button>
|
495
|
+
</Wrapper>
|
496
|
+
);
|
497
|
+
};
|
498
|
+
```
|
499
|
+
|
111
500
|
More examples coming soon
|
package/index.cjs
CHANGED
@@ -1,18 +1,42 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
`);if(!
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
`);let i=`@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
1
|
+
"use strict";var Tt=Object.defineProperty;var Dt=(e,t,s)=>t in e?Tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var tt=(e,t,s)=>Dt(e,typeof t!="symbol"?t+"":t,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Et=require("esbuild"),Ot=require("child_process"),f=require("path"),d=require("fs"),st=require("fs/promises"),G=require("winston");var it=typeof document<"u"?document.currentScript:null;function Mt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const gt=Mt(Et),mt=e=>String.fromCharCode(e+(e>25?39:97)),Rt=(e,t)=>{let s="",n;for(n=Math.abs(e);n>52;n=n/52|0)s=mt(n%52)+s;return s=mt(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},Vt=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},z=(e,t=5)=>{const s=Vt(5381,JSON.stringify(e))>>>0;return Rt(s,t)};function V(e){return e?typeof e!="string"?V(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?"-":"")+t.toLowerCase()):""}const vt=e=>t=>{if(typeof t!="string"||!e)return;let s=t;const n=[];return Object.values(e).forEach(o=>{const{pattern:r,transform:i}=o;s=s.replace(r,$=>{const{value:b,css:l}=i($);return l&&n.push(l),b})}),{transformed:s,additionalCss:n}},wt=e=>t=>typeof t!="string"||!/\{[^{}]+\}/g.test(t)?void 0:{transformed:t.replace(/\{([^{}]+)\}/g,(...o)=>`var(--${V(o[1].replaceAll(".","-"))})`)},At=wt(),Jt=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],zt=(e,t,s)=>Jt.some(o=>typeof o=="string"?o===e:o.test(e))?`${t}px`:`${t}`,Wt=["Webkit","Moz","ms","O"],It=e=>e.startsWith("-")?e:Wt.some(t=>e.startsWith(t))?`-${V(e)}`:V(e),et=async(e,t="",s,n=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const o=new Set,r=Object.entries(e),i=async([p,u])=>{const w=p.trim(),_=It(w),D=(M,N=";")=>`${_}:${M}${N}`,k={scope:t,config:s};if(typeof u=="function")return i([p,u(k)]);if(u instanceof Promise)return i([p,await u]);if(typeof u=="object"){if(!u)return;if(u.isColor)return D(u.toString());if(w==="defaultVariants")return;if(w==="variants"){const T=Object.entries(u);for(const[a,m]of T){if(!m)return;const j=Object.entries(m);for(const[c,g]of j){if(!g)return;const x=`${t}.${a}-${c}`;(await et(g,x,s)).forEach(J=>o.add(J))}}return}if(w==="compoundVariants"){for(const T of u){const{css:a,...m}=T,j=Object.entries(m).reduce((g,[x,E])=>`${g}.${x}-${E}`,t);(await et(a,j,s)).forEach(g=>o.add(g))}return}if(w.startsWith("@")){const T=w,a=await K(u,t,s),m=`${T} { ${a} }`;o.add(m);return}const M=p.includes("&")?w.replace("&",t):w.startsWith(":")?`${t}${w}`:`${t} ${w}`;(await et(u,M,s)).forEach(T=>o.add(T));return}if(typeof u=="number"){const M=zt(_,u);return D(M)}if(typeof u!="string")if("toString"in u)u=u.toString();else throw new Error(`Invalid value type for property ${_}`);return D(u)},$=r.map(i),{modifiers:b}={},l=[wt(),vt(b)],S=(await Promise.all($).then(p=>Promise.all(p.map(u=>l.reduce(async(w,_)=>{const D=await w;if(!D)return D;const k=await _(D);if(!k)return D;const{transformed:M,additionalCss:N}=k;let T="";if(N)for(const a of N)T+=await K(a,"");return`${T}${M}`},Promise.resolve(u)))))).filter(p=>p!==void 0).join(`
|
2
|
+
`);if(!S.trim())return Array.from(o);const h=t?`${t} {
|
3
|
+
${S}
|
4
|
+
}`:S;return o.has(h)?Array.from(o):[h,...o]},K=async(e,t,s,n=!1)=>(await et(e,t,s,n)).join(`
|
5
|
+
`),$t=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[o,r]of Object.entries(e))if(typeof r!="function")if(r&&typeof r=="object"){const i=o.trim(),$=await $t(r,[...t,i]);s.push($)}else n[o]=r;if(Object.keys(n).length){const o=t.map(V).join("-"),r="t_"+z(o,4),i=await K(n,`.${o}, .${r}`);s.push(i)}return s.join(`
|
6
|
+
`)},Zt=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="function"?t[s]="any":typeof n=="object"&&(t[s]=bt(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},bt=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const r=t?`${t}.${n}`:n;return typeof o=="object"?bt(o,r,s):s.add(t)}),[...s]):[],St=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=f.join(e,"package.json");return d.existsSync(t)?t:St(f.join(e,".."))},qt=async e=>{const t=St(e);return await st.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Ht=async e=>{const t=await qt(e);if(t)return t.type};let I;const jt=async e=>{if(I)return I;const t=await Ht(e);return t==="module"?I="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:it&&it.tagName.toUpperCase()==="SCRIPT"&&it.src||new URL("index.cjs",document.baseURI).href).endsWith(".cjs"))&&(I="cjs"),I||"esm"},at=G.createLogger({level:"debug",format:G.format.combine(G.format.colorize(),G.format.cli()),transports:[new G.transports.Console({})]});function Ft(e){return e?typeof e!="string"?Ft(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const Lt={"*, *::before, *::after":{boxSizing:"border-box"},"*":{margin:0},html:{lineHeight:1.15,textSizeAdjust:"100%",WebkitFontSmoothing:"antialiased"},"img, picture, video, canvas, svg":{display:"block",maxWidth:"100%"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"},p:{textWrap:"pretty"},"h1, h2, h3, h4, h5, h6":{textWrap:"balance"},a:{color:"currentColor"},button:{lineHeight:"1em",color:"currentColor"},"input, optgroup, select, textarea":{fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15em"}},Z=(...e)=>e.flat().reduce((t,s)=>s!=null&&s._current?{...t,...s._current}:{...t,...s},{}),Bt=(...e)=>e.flat().reduce((t,s)=>({...t,...s._children}),{});class Gt{constructor(t){tt(this,"_path");this.params=t}get _current(){return this.params.template}get isDefineTemplate(){return!0}_setPath(t){return this._path=t,this}}class Kt{constructor(t){tt(this,"_path");tt(this,"templates",[]);this.params=t,Object.entries(t).forEach(([s,n])=>{this.templates.push(new Gt({name:s,template:n}))})}get _current(){return this.params}get _children(){return Object.fromEntries(this.templates.map(t=>[t.params.name,t]))}get isDefineTemplates(){return!0}_setPath(t){return this._path=t,this.templates.forEach(s=>s._setPath(t)),this}}const Ut=e=>new Kt(e),A={externalModules:[],rcFile:void 0,destDir:void 0},Ct=e=>{if(A.externalModules.length>0)return A.externalModules;const s=d.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return A.externalModules=n,n},W=async e=>{if(A.destDir)return A.destDir;const t=await ct(e),s=f.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return A.destDir=s,s},Pt=["salty","css","styles","styled"],Qt=(e=[])=>new RegExp(`\\.(${[...Pt,...e].join("|")})\\.`),q=(e,t=[])=>Qt(t).test(e),_t=async e=>{if(A.rcFile)return A.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=f.join(e,".saltyrc.json"),s=await st.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(A.rcFile=s,s):_t(f.join(e,".."))},ct=async e=>{var n,o;const t=await _t(e),s=(n=t.projects)==null?void 0:n.find(r=>e.endsWith(r.dir||""));return s||((o=t.projects)==null?void 0:o.find(r=>r.dir===t.defaultProject))},Xt=async e=>{const t=await ct(e),s=await W(e),n=f.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=f.join(s,"salty.config.js"),r=await jt(e),i=Ct(n);await gt.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:r,external:i});const $=Date.now(),{config:b}=await import(`${o}?t=${$}`);return{config:b,path:o}},Yt=async(e,t)=>{var ut,dt;const s=await W(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async C=>{const{contents:P,outputFilePath:v}=await nt(e,C,s);Object.entries(P).forEach(([O,R])=>{R.isMedia?n.mediaQueries.push([O,R]):R.isGlobalDefine?n.globalStyles.push(R):R.isDefineVariables?n.variables.push(R):R.isDefineTemplates&&n.templates.push(R._setPath(`${O};;${v}`))})}));const{config:o,path:r}=await Xt(e),i={...o},$=new Set,b=(C,P=[])=>C?Object.entries(C).flatMap(([v,O])=>{if(!O)return;if(typeof O=="object")return b(O,[...P,v]);const R=Ft(v),ot=V(v),rt=[...P,R].join(".");$.add(`"${rt}"`);const Y=[...P.map(V),ot].join("-"),pt=At(O);return pt?`--${Y}: ${pt.transformed};`:`--${Y}: ${O};`}):[],l=C=>C?Object.entries(C).flatMap(([P,v])=>{const O=b(v);return P==="base"?O.join(""):`${P} { ${O.join("")} }`}):[],y=C=>C?Object.entries(C).flatMap(([P,v])=>Object.entries(v).flatMap(([O,R])=>{const ot=b(R,[P]),rt=`.${P}-${O}, [data-${P}="${O}"]`,Y=ot.join("");return`${rt} { ${Y} }`})):[],S=C=>({...C,responsive:void 0,conditional:void 0}),h=C=>n.variables.map(P=>C==="static"?S(P._current):P._current[C]),F=Z(S(o.variables),h("static")),p=b(F),u=Z((ut=o.variables)==null?void 0:ut.responsive,h("responsive")),w=l(u),_=Z((dt=o.variables)==null?void 0:dt.conditional,h("conditional")),D=y(_),k=f.join(s,"css/_variables.css"),M=`:root { ${p.join("")} ${w.join("")} } ${D.join("")}`;d.writeFileSync(k,M),i.staticVariables=F;const N=f.join(s,"css/_global.css"),T=Z(o.global,n.globalStyles),a=await K(T,"");d.writeFileSync(N,`@layer global { ${a} }`);const m=f.join(s,"css/_reset.css"),c=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:Lt,g=await K(c,"");d.writeFileSync(m,`@layer reset { ${g} }`);const x=f.join(s,"css/_templates.css"),E=Z(o.templates,n.templates),J=await $t(E),H=Zt(E);d.writeFileSync(x,`@layer templates { ${J} }`),i.templates=E;const L=o.templates?[Ut(o.templates)._setPath(`config;;${r}`)]:[],U=Bt(n.templates,L);i.templatePaths=Object.fromEntries(Object.entries(U).map(([C,P])=>[C,P._path]));const{mediaQueries:Q}=n;i.mediaQueries=Object.fromEntries(Q.map(([C,P])=>[`@${C}`,P]));const B=Q.map(([C])=>`'@${C}'`).join(" | "),X=f.join(s,"types/css-tokens.d.ts"),Nt=`
|
7
|
+
// Variable types
|
8
|
+
type VariableTokens = ${[...$].join("|")};
|
9
|
+
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
11
10
|
|
12
|
-
|
11
|
+
// Template types
|
12
|
+
type TemplateTokens = {
|
13
|
+
${Object.entries(H).map(([C,P])=>`${C}?: ${P}`).join(`
|
13
14
|
`)}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
}
|
16
|
+
|
17
|
+
// Media query types
|
18
|
+
type MediaQueryKeys = ${B||"''"};
|
19
|
+
`;d.writeFileSync(X,Nt);const kt=f.join(s,"cache/config-cache.json");d.writeFileSync(kt,JSON.stringify(i,null,2))},yt=e=>e.replace(/styled\(([^"'`{,]+),/g,(t,s)=>{if(/^['"`]/.test(s))return t;const o=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!o.test(e))return t;const i=o.exec(e);if(i){const $=i.at(1);if(Pt.some(l=>$==null?void 0:$.includes(l)))return t}return"styled('div',"}),te=(e,t)=>{try{const s=d.readFileSync(f.join(t,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
|
20
|
+
|
21
|
+
${e}`:`globalThis.saltyConfig = {};
|
22
|
+
|
23
|
+
${e}`}catch{return e}},nt=async(e,t,s)=>{const n=z(t),o=f.join(s,"./temp");d.existsSync(o)||d.mkdirSync(o);const r=f.parse(t);let i=d.readFileSync(t,"utf8");i=yt(i),i=te(i,e);const $=f.join(s,"js",n+".js"),b=await ct(e),l=f.join(e,(b==null?void 0:b.configDir)||"","salty.config.ts"),y=Ct(l),S=await jt(e);await gt.build({stdin:{contents:i,sourcefile:r.base,resolveDir:r.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:$,format:S,target:["node20"],keepNames:!0,external:y,packages:"external",plugins:[{name:"test",setup:p=>{p.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},u=>{const w=d.readFileSync(u.path,"utf8");return{contents:yt(w),loader:"ts"}})}}]});const h=Date.now();return{contents:await import(`${$}?t=${h}`),outputFilePath:$}},ee=async e=>{const t=await W(e),s=f.join(t,"cache/config-cache.json"),n=d.readFileSync(s,"utf8");if(!n)throw new Error("Could not find config cache file");return JSON.parse(n)},lt=async e=>{const t=await ee(e),s=await W(e),n=f.join(s,"salty.config.js"),o=Date.now(),{config:r}=await import(`${n}?t=${o}`);return Z(r,t)},ft=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},se=async(e,t=ft(),s=!0)=>{try{const n=Date.now();t?at.info("Generating CSS in production mode! 🔥"):at.info("Generating CSS in development mode! 🚀");const o=[],r=[],i=await W(e),$=f.join(i,"index.css");s&&(()=>{d.existsSync(i)&&Ot.execSync("rm -rf "+i),d.mkdirSync(i,{recursive:!0}),d.mkdirSync(f.join(i,"css")),d.mkdirSync(f.join(i,"types")),d.mkdirSync(f.join(i,"js")),d.mkdirSync(f.join(i,"cache"))})();const l=new Set,y=new Set;async function S(a){const m=["node_modules","saltygen"],j=d.statSync(a);if(j.isDirectory()){const c=d.readdirSync(a);if(m.some(x=>a.includes(x)))return;await Promise.all(c.map(x=>S(f.join(a,x))))}else if(j.isFile()&&q(a)){l.add(a);const g=d.readFileSync(a,"utf8");/define[\w\d]+\(/.test(g)&&y.add(a)}}await S(e),await Yt(e,y);const h={keyframes:[],components:[],classNames:[]};await Promise.all([...l].map(async a=>{const{contents:m}=await nt(e,a,i);for(let[j,c]of Object.entries(m))c instanceof Promise&&(c=await c),c.isKeyframes?h.keyframes.push({value:c,src:a,name:j}):c.isClassName?h.classNames.push({...c,src:a,name:j}):c.generator&&h.components.push({...c,src:a,name:j})}));const F=await lt(e);for(const a of h.keyframes){const{value:m}=a,j=`a_${m.animationName}.css`,c=`css/${j}`,g=f.join(i,c);o.push(j),d.writeFileSync(g,m.css)}const p={};for(const a of h.components){const{src:m,name:j}=a;p[m]||(p[m]=[]);const c=a.generator._withBuildContext({callerName:j,isProduction:t,config:F});r[c.priority]||(r[c.priority]=[]);const g=await c.css;if(!g)continue;r[c.priority].push(c.cssFileName);const x=`css/${c.cssFileName}`,E=f.join(i,x);d.writeFileSync(E,g),F.importStrategy==="component"&&p[m].push(c.cssFileName)}for(const a of h.classNames){const{src:m,name:j}=a;p[m]||(p[m]=[]);const c=a.generator._withBuildContext({callerName:j,isProduction:t,config:F}),g=await c.css;if(!g)continue;r[c.priority]||(r[c.priority]=[]),r[c.priority].push(c.cssFileName);const x=`css/${c.cssFileName}`,E=f.join(i,x);d.writeFileSync(E,g),F.importStrategy==="component"&&p[m].push(c.cssFileName)}F.importStrategy==="component"&&Object.entries(p).forEach(([a,m])=>{const j=m.map(J=>`@import url('./${J}');`).join(`
|
24
|
+
`),c=z(a,6),g=f.parse(a),x=V(g.name),E=f.join(i,`css/f_${x}-${c}.css`);d.writeFileSync(E,j||"/* Empty file */")});const u=o.map(a=>`@import url('./css/${a}');`).join(`
|
25
|
+
`);let k=`@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
26
|
+
|
27
|
+
${["_variables.css","_reset.css","_global.css","_templates.css"].filter(a=>{try{return d.readFileSync(f.join(i,"css",a),"utf8").length>0}catch{return!1}}).map(a=>`@import url('./css/${a}');`).join(`
|
28
|
+
`)}
|
29
|
+
${u}`;if(F.importStrategy!=="component"){const a=r.reduce((m,j,c)=>{const g=j.reduce((H,L)=>{var X;const U=f.join(i,"css",L),Q=d.readFileSync(U,"utf8"),B=((X=/.*-([^-]+)-\d+.css/.exec(L))==null?void 0:X.at(1))||z(U,6);return H.includes(B)?H:`${H}
|
30
|
+
/*start:${B}-${L}*/
|
31
|
+
${Q}
|
32
|
+
/*end:${B}*/
|
33
|
+
`},""),x=`l_${c}.css`,E=f.join(i,"css",x),J=`@layer l${c} { ${g}
|
34
|
+
}`;return d.writeFileSync(E,J),`${m}
|
35
|
+
@import url('./css/${x}');`},"");k+=a}d.writeFileSync($,k);const N=Date.now()-n,T=N<200?"🔥":N<500?"🚀":N<1e3?"🎉":N<2e3?"🚗":N<5e3?"🤔":"🥴";at.info(`Generated CSS in ${N}ms! ${T}`)}catch(n){console.error(n)}},ne=async(e,t,s=ft())=>{try{const n=await W(e);if(q(t)){const r=[],i=await lt(e),{contents:$}=await nt(e,t,n);for(const[b,l]of Object.entries($)){if(l.isKeyframes&&l.css){const u=`css/${`a_${l.animationName}.css`}`,w=f.join(n,u);d.writeFileSync(w,await l.css);return}if(l.isClassName){const p=l.generator._withBuildContext({callerName:b,isProduction:s,config:i}),u=await p.css;if(!u)continue;r[p.priority]||(r[p.priority]=[]),r[p.priority].push(p.cssFileName);const w=`css/${p.cssFileName}`,_=f.join(n,w);d.writeFileSync(_,u)}if(!l.generator)return;const y=l.generator._withBuildContext({callerName:b,isProduction:s,config:i}),S=await y.css;if(!S)continue;const h=`css/${y.cssFileName}`,F=f.join(n,h);d.writeFileSync(F,S),r[y.priority]||(r[y.priority]=[]),r[y.priority].push(y.cssFileName)}if(i.importStrategy!=="component")r.forEach((b,l)=>{const y=`l_${l}.css`,S=f.join(n,"css",y);let h=d.readFileSync(S,"utf8");b.forEach(F=>{var _;const p=f.join(n,"css",F),u=((_=/.*-([^-]+)-\d+.css/.exec(F))==null?void 0:_.at(1))||z(p,6);if(!h.includes(u)){const D=d.readFileSync(p,"utf8"),k=`/*start:${u}-${F}*/
|
36
|
+
${D}
|
37
|
+
/*end:${u}*/
|
38
|
+
`;h=`${h.replace(/\}$/,"")}
|
39
|
+
${k}
|
40
|
+
}`}}),d.writeFileSync(S,h)});else{const b=r.flat().map(F=>`@import url('./${F}');`).join(`
|
41
|
+
`),l=z(t,6),y=f.parse(t),S=V(y.name),h=f.join(n,`css/f_${S}-${l}.css`);d.writeFileSync(h,b||"/* Empty file */")}}}catch(n){console.error(n)}},oe=async(e,t,s=ft())=>{try{const n=await W(e);if(q(t)){const r=d.readFileSync(t,"utf8");r.replace(/^(?!export\s)const\s.*/gm,y=>`export ${y}`)!==r&&await st.writeFile(t,r);const $=await lt(e),{contents:b}=await nt(e,t,n);let l=r;if(Object.entries(b).forEach(([y,S])=>{var c;if(S.isKeyframes||!S.generator)return;const h=S.generator._withBuildContext({callerName:y,isProduction:s,config:$}),F=new RegExp(`\\s${y}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(r);if(!F)return console.error("Could not find the original declaration");const p=(c=F.at(1))==null?void 0:c.trim(),u=new RegExp(`\\s${y}[=\\s]+styled\\(`,"g").exec(l);if(!u)return console.error("Could not find the original declaration");const{index:w}=u;let _=!1;const D=setTimeout(()=>_=!0,5e3);let k=0,M=!1,N=0;for(;!M&&!_;){const g=l[w+k];g==="("&&N++,g===")"&&N--,N===0&&g===")"&&(M=!0),k>l.length&&(_=!0),k++}if(!_)clearTimeout(D);else throw new Error("Failed to find the end of the styled call and timed out");const T=w+k,a=l.slice(w,T),m=l,j=` ${y} = styled(${p}, "${h.classNames}", ${JSON.stringify(h.clientProps)});`;l=l.replace(a,j),m===l&&console.error("Minimize file failed to change content",{name:y,tagName:p})}),$.importStrategy==="component"){const y=z(t,6),S=f.parse(t);l=`import '../../saltygen/css/${`f_${V(S.name)}-${y}.css`}';
|
42
|
+
${l}`}return l=l.replace("{ styled }","{ styledClient as styled }"),l=l.replace("@salty-css/react/styled","@salty-css/react/styled-client"),l}}catch(n){console.error("Error in minimizeFile:",n)}},ht=async e=>{if(!e||e.includes("node_modules")||e.includes("saltygen"))return!1;if(e.includes("salty.config"))return!0;if(!q(e))return!1;const n=await st.readFile(e,"utf-8");return!!/.+define[A-Z]\w+/.test(n)},xt=e=>({name:"stylegen",buildStart:()=>se(e),load:async t=>{if(q(t))return await oe(e,t)},handleHotUpdate:async({file:t,server:s})=>{await ht(t)&&s.restart()},watchChange:{handler:async t=>{q(t)&&(await ht(t)||await ne(e,t))}}});exports.default=xt;exports.saltyPlugin=xt;
|
package/index.d.ts
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
load: (filePath: string) => Promise<string | undefined>;
|
5
|
-
watchChange: {
|
6
|
-
handler: (filePath: string) => Promise<void>;
|
7
|
-
};
|
8
|
-
};
|
1
|
+
import { PluginOption } from 'vite';
|
2
|
+
export declare const saltyPlugin: (dir: string) => PluginOption;
|
3
|
+
export default saltyPlugin;
|