@salty-css/webpack 0.2.1 → 0.2.2-refactor-vite-8.8

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 CHANGED
@@ -79,29 +79,29 @@ Full reference → [salty-css.dev/docs/eslint](https://salty-css.dev/docs/eslint
79
79
 
80
80
  ## API index
81
81
 
82
- | Symbol | Import | One-liner | Docs |
83
- | ----------------------------------------------- | ------------------------------ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
84
- | [`styled`](#styled) | `@salty-css/react/styled` | React component factory with variants & extension. | [api/styled](https://salty-css.dev/docs/api/styled) |
85
- | [`className`](#classname) | `@salty-css/react/class-name` | CSS class string with `.variant()` chaining. | [api/classname](https://salty-css.dev/docs/api/classname) |
86
- | [Variants](#variants) | — | `variants`, `compoundVariants`, `anyOfVariants`, `defaultVariants` semantics. | [variants](https://salty-css.dev/docs/variants) |
87
- | [Overrides](#overrides) | — | Extend components, swap element, override per-instance via `style`. | [overrides](https://salty-css.dev/docs/overrides) |
88
- | [ESLint plugin](#eslint) | `@salty-css/eslint-config-core` | Two rules: enforce `export` and correct `variants` placement on Salty files. | [eslint](https://salty-css.dev/docs/eslint) |
89
- | [`defineConfig`](#defineconfig) | `@salty-css/core/config` | Top-level project config. | [api/config](https://salty-css.dev/docs/api/config) |
90
- | [`defineVariables`](#definevariables) | `@salty-css/core/factories` | Static, responsive, and conditional CSS variables (tokens). | [variables](https://salty-css.dev/docs/variables) |
91
- | [Theming](#theming) | — | `data-theme` switcher built on conditional variables. | [theming](https://salty-css.dev/docs/theming) |
92
- | [`defineGlobalStyles`](#defineglobalstyles) | `@salty-css/core/factories` | Global rules (`html`, `body`, etc.). | [api/define-factories](https://salty-css.dev/docs/api/define-factories) |
93
- | [`defineMediaQuery`](#definemediaquery) | `@salty-css/core/factories` | Named, reusable media queries. | [media-queries](https://salty-css.dev/docs/media-queries) |
94
- | [`defineTemplates`](#definetemplates) | `@salty-css/core/factories` | Reusable style bundles, optionally with variants. | [templates](https://salty-css.dev/docs/templates) |
95
- | [`defineFont`](#definefont) | `@salty-css/core/factories` | `@font-face` (or `@import`) + CSS variable in one. | [fonts](https://salty-css.dev/docs/fonts) |
96
- | [`defineImport`](#defineimport) | `@salty-css/core/factories` | Pull external CSS into Salty's `imports` layer. | [imports](https://salty-css.dev/docs/imports) |
97
- | [`keyframes`](#keyframes) | `@salty-css/react/keyframes` | Typed `@keyframes` with params and initial-state injection. | [animations](https://salty-css.dev/docs/animations) |
98
- | [`defineViewportClamp`](#defineviewportclamp) | `@salty-css/core/helpers` | Fluid `clamp()` values that scale with the viewport. | [viewport-clamp](https://salty-css.dev/docs/viewport-clamp) |
99
- | [`color`](#color) | `@salty-css/core/helpers` | Color manipulation (`alpha`, `darken`, …). | [color-function](https://salty-css.dev/docs/color-function) |
100
- | [Modifiers](#modifiers) | (on `defineConfig`) | Custom value transformers, e.g. `'space:3'` → `'12px'`. | [modifiers](https://salty-css.dev/docs/modifiers) |
101
- | [`withSaltyCss`](#withsaltycss-nextjs) | `@salty-css/next` | Next.js config wrapper (Webpack + Turbopack). | [installation](https://salty-css.dev/docs/installation) |
102
- | [`saltyPlugin` (Vite)](#saltyplugin-vite) | `@salty-css/vite` | Vite plugin. | [installation](https://salty-css.dev/docs/installation) |
103
- | [`saltyPlugin` (Webpack)](#saltyplugin-webpack) | `@salty-css/webpack` | Webpack loader + plugin. | [installation](https://salty-css.dev/docs/installation) |
104
- | [`saltyIntegration`](#saltyintegration-astro) | `@salty-css/astro/integration` | Astro integration. | [installation](https://salty-css.dev/docs/installation) |
82
+ | Symbol | Import | One-liner | Docs |
83
+ | ----------------------------------------------- | ------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
84
+ | [`styled`](#styled) | `@salty-css/react/styled` | React component factory with variants & extension. | [api/styled](https://salty-css.dev/docs/api/styled) |
85
+ | [`className`](#classname) | `@salty-css/react/class-name` | CSS class string with `.variant()` chaining. | [api/classname](https://salty-css.dev/docs/api/classname) |
86
+ | [Variants](#variants) | — | `variants`, `compoundVariants`, `anyOfVariants`, `defaultVariants` semantics. | [variants](https://salty-css.dev/docs/variants) |
87
+ | [Overrides](#overrides) | — | Extend components, swap element, override per-instance via `style`. | [overrides](https://salty-css.dev/docs/overrides) |
88
+ | [ESLint plugin](#eslint) | `@salty-css/eslint-config-core` | Two rules: enforce `export` and correct `variants` placement on Salty files. | [eslint](https://salty-css.dev/docs/eslint) |
89
+ | [`defineConfig`](#defineconfig) | `@salty-css/core/config` | Top-level project config. | [api/config](https://salty-css.dev/docs/api/config) |
90
+ | [`defineVariables`](#definevariables) | `@salty-css/core/factories` | Static, responsive, and conditional CSS variables (tokens). | [variables](https://salty-css.dev/docs/variables) |
91
+ | [Theming](#theming) | — | `data-theme` switcher built on conditional variables. | [theming](https://salty-css.dev/docs/theming) |
92
+ | [`defineGlobalStyles`](#defineglobalstyles) | `@salty-css/core/factories` | Global rules (`html`, `body`, etc.). | [api/define-factories](https://salty-css.dev/docs/api/define-factories) |
93
+ | [`defineMediaQuery`](#definemediaquery) | `@salty-css/core/factories` | Named, reusable media queries. | [media-queries](https://salty-css.dev/docs/media-queries) |
94
+ | [`defineTemplates`](#definetemplates) | `@salty-css/core/factories` | Reusable style bundles, optionally with variants. | [templates](https://salty-css.dev/docs/templates) |
95
+ | [`defineFont`](#definefont) | `@salty-css/core/factories` | `@font-face` (or `@import`) + CSS variable in one. | [fonts](https://salty-css.dev/docs/fonts) |
96
+ | [`defineImport`](#defineimport) | `@salty-css/core/factories` | Pull external CSS into Salty's `imports` layer. | [imports](https://salty-css.dev/docs/imports) |
97
+ | [`keyframes`](#keyframes) | `@salty-css/react/keyframes` | Typed `@keyframes` with params and initial-state injection. | [animations](https://salty-css.dev/docs/animations) |
98
+ | [`defineViewportClamp`](#defineviewportclamp) | `@salty-css/core/helpers` | Fluid `clamp()` values that scale with the viewport. | [viewport-clamp](https://salty-css.dev/docs/viewport-clamp) |
99
+ | [`color`](#color) | `@salty-css/core/helpers` | Color manipulation (`alpha`, `darken`, …). | [color-function](https://salty-css.dev/docs/color-function) |
100
+ | [Modifiers](#modifiers) | (on `defineConfig`) | Custom value transformers, e.g. `'space:3'` → `'12px'`. | [modifiers](https://salty-css.dev/docs/modifiers) |
101
+ | [`withSaltyCss`](#withsaltycss-nextjs) | `@salty-css/next` | Next.js config wrapper (Webpack + Turbopack). | [installation](https://salty-css.dev/docs/installation) |
102
+ | [`saltyPlugin` (Vite)](#saltyplugin-vite) | `@salty-css/vite` | Vite plugin. | [installation](https://salty-css.dev/docs/installation) |
103
+ | [`saltyPlugin` (Webpack)](#saltyplugin-webpack) | `@salty-css/webpack` | Webpack loader + plugin. | [installation](https://salty-css.dev/docs/installation) |
104
+ | [`saltyIntegration`](#saltyintegration-astro) | `@salty-css/astro/integration` | Astro integration. | [installation](https://salty-css.dev/docs/installation) |
105
105
 
106
106
  ---
107
107
 
@@ -376,7 +376,7 @@ export default defineImport(
376
376
  '/fonts/inter.css', // public/ folder
377
377
  'https://fonts.googleapis.com/css2?family=Inter', // URL
378
378
  { url: './print.css', media: 'print' }, // media-conditional
379
- { url: './p3.css', supports: 'color(display-p3 1 1 1)' } // supports-conditional
379
+ { url: './p3.css', supports: 'color(display-p3 1 1 1)' }, // supports-conditional
380
380
  );
381
381
  ```
382
382
 
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("path"),t=require("@salty-css/core/server"),n=require("fs"),r=require("@salty-css/core/compiler/helpers"),i=require("@salty-css/core/compiler/salty-compiler");var a=(a,o,s=!1,c=!1,l={})=>{let u=new i.SaltyCompiler(o,{mode:l.mode});a.module?.rules?.push({test:(0,r.saltyFileRegExp)(),use:[{loader:(0,e.resolve)(__dirname,c?`./loader.cjs`:`./loader.js`),options:{dir:o,mode:l.mode}}]}),s||a.plugins?.push({apply:e=>{let i=!1;e.hooks.beforeCompile.tapPromise({name:`generateCss`},async()=>{i||(i=!0,await u.generateCss(),(0,n.watch)(o,{recursive:!0},async(e,n)=>{await(0,t.checkShouldRestart)(n)?await u.generateCss():(0,r.isSaltyFile)(n)&&await u.generateFile(o)}))})}})};exports.default=a,exports.saltyPlugin=a;
@@ -1,5 +1,5 @@
1
1
  import { Configuration } from 'webpack';
2
- import { SaltyCompilerMode } from '@salty-css/core/compiler/salty-compiler';
2
+ import { SaltyCompilerMode } from '../../core/dist/compiler/salty-compiler';
3
3
  export interface SaltyWebpackPluginOptions {
4
4
  /**
5
5
  * Explicit build mode. Defaults to NODE_ENV-based detection.
@@ -8,3 +8,4 @@ export interface SaltyWebpackPluginOptions {
8
8
  }
9
9
  export declare const saltyPlugin: (config: Configuration, dir: string, isServer?: boolean, cjs?: boolean, options?: SaltyWebpackPluginOptions) => void;
10
10
  export default saltyPlugin;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,OAAO,EAAiB,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE3F,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED,eAAO,MAAM,WAAW,GAAI,QAAQ,aAAa,EAAE,KAAK,MAAM,EAAE,kBAAgB,EAAE,aAAW,EAAE,UAAS,yBAA8B,SAoCrI,CAAC;AAEF,eAAe,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,28 @@
1
+ import { resolve as e } from "path";
2
+ import { checkShouldRestart as t } from "@salty-css/core/server";
3
+ import { watch as n } from "fs";
4
+ import { isSaltyFile as r, saltyFileRegExp as i } from "@salty-css/core/compiler/helpers";
5
+ import { SaltyCompiler as a } from "@salty-css/core/compiler/salty-compiler";
6
+ //#region src/index.ts
7
+ var o = (o, s, c = !1, l = !1, u = {}) => {
8
+ let d = new a(s, { mode: u.mode });
9
+ o.module?.rules?.push({
10
+ test: i(),
11
+ use: [{
12
+ loader: e(__dirname, l ? "./loader.cjs" : "./loader.js"),
13
+ options: {
14
+ dir: s,
15
+ mode: u.mode
16
+ }
17
+ }]
18
+ }), c || o.plugins?.push({ apply: (e) => {
19
+ let i = !1;
20
+ e.hooks.beforeCompile.tapPromise({ name: "generateCss" }, async () => {
21
+ i || (i = !0, await d.generateCss(), n(s, { recursive: !0 }, async (e, n) => {
22
+ await t(n) ? await d.generateCss() : r(n) && await d.generateFile(s);
23
+ }));
24
+ });
25
+ } });
26
+ };
27
+ //#endregion
28
+ export { o as default, o as saltyPlugin };
@@ -0,0 +1 @@
1
+ let e=require("@salty-css/core/compiler/salty-compiler");var t=new WeakMap,n=new Map,r=async e=>{if(e===`react`||e===void 0)return(await import(`@salty-css/react/transform-salty-file`)).transformSaltyFile;throw Error(`@salty-css/webpack: framework "${e}" is not supported. Supported: react.`)},i=(t,r)=>{let i=`${t}|${r??``}`,a=n.get(i);return a||(a=new e.SaltyCompiler(t,{mode:r}),n.set(i,a)),a},a=e=>{let n=t.get(e);return n||(n=e.getFramework().then(r),t.set(e,n)),n};async function o(){let{dir:e,mode:t}=this.getOptions(),{resourcePath:n}=this,r=i(e,t);return await r.generateFile(n),await(await a(r))(r,n)}module.exports=o;
@@ -1,5 +1,5 @@
1
1
  import { LoaderContext } from 'webpack';
2
- import { SaltyCompilerMode } from '@salty-css/core/compiler/salty-compiler';
2
+ import { SaltyCompilerMode } from '../../core/dist/compiler/salty-compiler';
3
3
  interface SaltyLoaderOptions {
4
4
  dir: string;
5
5
  mode?: SaltyCompilerMode;
@@ -7,3 +7,4 @@ interface SaltyLoaderOptions {
7
7
  type WebpackLoaderThis = LoaderContext<SaltyLoaderOptions>;
8
8
  export default function (this: WebpackLoaderThis): Promise<string | undefined>;
9
9
  export {};
10
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAiB,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE3F,UAAU,kBAAkB;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED,KAAK,iBAAiB,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;AAmC3D,yBAA+B,IAAI,EAAE,iBAAiB,+BAOrD"}
package/dist/loader.js ADDED
@@ -0,0 +1,18 @@
1
+ import { SaltyCompiler as e } from "@salty-css/core/compiler/salty-compiler";
2
+ //#region src/loader.ts
3
+ var t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map(), r = async (e) => {
4
+ if (e === "react" || e === void 0) return (await import("@salty-css/react/transform-salty-file")).transformSaltyFile;
5
+ throw Error(`@salty-css/webpack: framework "${e}" is not supported. Supported: react.`);
6
+ }, i = (t, r) => {
7
+ let i = `${t}|${r ?? ""}`, a = n.get(i);
8
+ return a || (a = new e(t, { mode: r }), n.set(i, a)), a;
9
+ }, a = (e) => {
10
+ let n = t.get(e);
11
+ return n || (n = e.getFramework().then(r), t.set(e, n)), n;
12
+ };
13
+ async function o() {
14
+ let { dir: e, mode: t } = this.getOptions(), { resourcePath: n } = this, r = i(e, t);
15
+ return await r.generateFile(n), await (await a(r))(r, n);
16
+ }
17
+ //#endregion
18
+ export { o as default };
package/package.json CHANGED
@@ -1,16 +1,11 @@
1
1
  {
2
2
  "name": "@salty-css/webpack",
3
- "version": "0.2.1",
4
- "main": "./dist/index.js",
5
- "module": "./dist/index.mjs",
6
- "typings": "./dist/index.d.ts",
7
- "type": "module",
8
3
  "license": "MIT",
9
4
  "private": false,
10
5
  "publishConfig": {
11
6
  "access": "public"
12
7
  },
13
- "description": "Webpack plugin for Salty CSS",
8
+ "description": "Vite plugin for Salty CSS",
14
9
  "homepage": "https://salty-css.dev/",
15
10
  "repository": {
16
11
  "type": "git",
@@ -19,34 +14,48 @@
19
14
  "bugs": {
20
15
  "url": "https://github.com/margarita-form/salty-css/issues"
21
16
  },
22
- "files": [
23
- "**/*",
24
- "!**/*.tsbuildinfo"
25
- ],
26
- "nx": {
27
- "sourceRoot": "libs/webpack/src",
28
- "name": "webpack"
29
- },
30
- "exports": {
31
- ".": {
32
- "import": "./index.js",
33
- "require": "./index.cjs"
34
- },
35
- "./loader": {
36
- "import": "./loader.js",
37
- "require": "./loader.cjs"
38
- }
17
+ "version": "0.2.2-refactor-vite-8.8",
18
+ "type": "module",
19
+ "scripts": {
20
+ "build": "vite build",
21
+ "test": "vitest run"
39
22
  },
40
23
  "dependencies": {
41
- "@salty-css/core": "0.2.1",
24
+ "@salty-css/core": "0.2.2-refactor-vite-8.8",
42
25
  "webpack": ">=5.x"
43
26
  },
44
27
  "peerDependencies": {
45
- "@salty-css/react": "0.2.1"
28
+ "@salty-css/react": "0.2.2-refactor-vite-8.8"
46
29
  },
47
30
  "peerDependenciesMeta": {
48
31
  "@salty-css/react": {
49
32
  "optional": true
50
33
  }
34
+ },
35
+ "devDependencies": {
36
+ "jsdom": "^29.1.1"
37
+ },
38
+ "nx": {
39
+ "targets": {
40
+ "build": {
41
+ "dependsOn": [
42
+ "^build"
43
+ ]
44
+ }
45
+ }
46
+ },
47
+ "files": [
48
+ "dist",
49
+ "README.md"
50
+ ],
51
+ "exports": {
52
+ ".": {
53
+ "import": "./dist/index.js",
54
+ "require": "./dist/index.cjs"
55
+ },
56
+ "./loader": {
57
+ "import": "./dist/loader.js",
58
+ "require": "./dist/loader.cjs"
59
+ }
51
60
  }
52
61
  }
package/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("path"),f=require("@salty-css/core/server"),g=require("fs"),n=require("@salty-css/core/compiler/helpers"),h=require("@salty-css/core/compiler/salty-compiler"),c=(t,e,d=!1,p=!1,a={})=>{var l,r,o;const s=new h.SaltyCompiler(e,{mode:a.mode});(r=(l=t.module)==null?void 0:l.rules)==null||r.push({test:n.saltyFileRegExp(),use:[{loader:y.resolve(__dirname,p?"./loader.cjs":"./loader.js"),options:{dir:e,mode:a.mode}}]}),d||(o=t.plugins)==null||o.push({apply:m=>{let i=!1;m.hooks.beforeCompile.tapPromise({name:"generateCss"},async()=>{i||(i=!0,await s.generateCss(),g.watch(e,{recursive:!0},async(C,u)=>{await f.checkShouldRestart(u)?await s.generateCss():n.isSaltyFile(u)&&await s.generateFile(e)}))})}})};exports.default=c;exports.saltyPlugin=c;
package/index.js DELETED
@@ -1,31 +0,0 @@
1
- import { resolve as f } from "path";
2
- import { checkShouldRestart as d } from "@salty-css/core/server";
3
- import { watch as c } from "fs";
4
- import { saltyFileRegExp as y, isSaltyFile as h } from "@salty-css/core/compiler/helpers";
5
- import { SaltyCompiler as g } from "@salty-css/core/compiler/salty-compiler";
6
- const x = (s, e, n = !1, p = !1, a = {}) => {
7
- var o, l, r;
8
- const t = new g(e, { mode: a.mode });
9
- (l = (o = s.module) == null ? void 0 : o.rules) == null || l.push({
10
- test: y(),
11
- use: [
12
- {
13
- loader: f(__dirname, p ? "./loader.cjs" : "./loader.js"),
14
- options: { dir: e, mode: a.mode }
15
- }
16
- ]
17
- }), n || (r = s.plugins) == null || r.push({
18
- apply: (u) => {
19
- let i = !1;
20
- u.hooks.beforeCompile.tapPromise({ name: "generateCss" }, async () => {
21
- i || (i = !0, await t.generateCss(), c(e, { recursive: !0 }, async (w, m) => {
22
- await d(m) ? await t.generateCss() : h(m) && await t.generateFile(e);
23
- }));
24
- });
25
- }
26
- });
27
- };
28
- export {
29
- x as default,
30
- x as saltyPlugin
31
- };
package/loader.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";var i=Object.create;var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var u=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of p(e))!w.call(t,a)&&a!==r&&s(t,a,{get:()=>e[a],enumerable:!(o=l(e,a))||o.enumerable});return t};var d=(t,e,r)=>(r=t!=null?i(m(t)):{},u(e||!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t));const h=require("@salty-css/core/compiler/salty-compiler"),n=new WeakMap,c=new Map,f=async t=>{if(t==="react"||t===void 0)return(await import("@salty-css/react/transform-salty-file")).transformSaltyFile;throw new Error(`@salty-css/webpack: framework "${t}" is not supported. Supported: react.`)},y=(t,e)=>{const r=`${t}|${e??""}`;let o=c.get(r);return o||(o=new h.SaltyCompiler(t,{mode:e}),c.set(r,o)),o},g=t=>{let e=n.get(t);return e||(e=t.getFramework().then(f),n.set(t,e)),e};async function C(){const{dir:t,mode:e}=this.getOptions(),{resourcePath:r}=this,o=y(t,e);return await o.generateFile(r),await(await g(o))(o,r)}module.exports=C;
package/loader.js DELETED
@@ -1,20 +0,0 @@
1
- import { SaltyCompiler as s } from "@salty-css/core/compiler/salty-compiler";
2
- const a = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map(), c = async (t) => {
3
- if (t === "react" || t === void 0)
4
- return (await import("@salty-css/react/transform-salty-file")).transformSaltyFile;
5
- throw new Error(`@salty-css/webpack: framework "${t}" is not supported. Supported: react.`);
6
- }, i = (t, e) => {
7
- const o = `${t}|${e ?? ""}`;
8
- let r = n.get(o);
9
- return r || (r = new s(t, { mode: e }), n.set(o, r)), r;
10
- }, l = (t) => {
11
- let e = a.get(t);
12
- return e || (e = t.getFramework().then(c), a.set(t, e)), e;
13
- };
14
- async function w() {
15
- const { dir: t, mode: e } = this.getOptions(), { resourcePath: o } = this, r = i(t, e);
16
- return await r.generateFile(o), await (await l(r))(r, o);
17
- }
18
- export {
19
- w as default
20
- };