@salty-css/core 0.1.0-alpha.34 → 0.1.0-alpha.36
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 +2 -0
- package/{class-name-generator-B-D7IL8N.js → class-name-generator-CUEoPowv.js} +1 -1
- package/{class-name-generator-BRDOJe3J.cjs → class-name-generator-MtPkBfM_.cjs} +1 -1
- package/compiler/helpers.cjs +10 -2
- package/compiler/helpers.d.ts +3 -2
- package/compiler/helpers.js +11 -3
- package/compiler/salty-compiler.cjs +1 -1
- package/compiler/salty-compiler.js +1 -1
- package/css/keyframes.cjs +1 -1
- package/css/keyframes.js +1 -1
- package/generators/index.cjs +1 -1
- package/generators/index.js +2 -2
- package/instances/classname-instance.cjs +1 -1
- package/instances/classname-instance.js +1 -1
- package/package.json +1 -1
- package/{parse-styles-BWm11azy.cjs → parse-styles-BbI-2wdn.cjs} +3 -1
- package/{parse-styles-w1u1BniY.js → parse-styles-BgVqQAni.js} +3 -1
- package/parsers/index.cjs +1 -1
- package/parsers/index.js +2 -2
- package/parsers/parser-regexes.d.ts +1 -0
- package/runtime/index.cjs +1 -1
- package/runtime/index.js +1 -1
- package/util/module-type.d.ts +1 -1
package/README.md
CHANGED
|
@@ -617,6 +617,8 @@ And note: steps 2 & 3 are just to show how get new components up and running, st
|
|
|
617
617
|
- **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);`
|
|
618
618
|
- **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);`
|
|
619
619
|
|
|
620
|
+
Both Webpack and Turbopack are supported. `withSaltyCss` auto-detects which bundler Next.js is using (`next dev --turbopack` sets `process.env.TURBOPACK=1`), so no extra config is required. To force a specific bundler, pass `{ bundler: 'webpack' | 'turbopack' }` as the second argument.
|
|
621
|
+
|
|
620
622
|
4. Make sure that `salty.config.ts` and `next.config.ts` are in the same folder!
|
|
621
623
|
5. Build `saltygen` directory by running your app once or with cli `npx salty-css build [directory]`
|
|
622
624
|
6. Import global styles from `saltygen/index.css` to some global css file with `@import 'insert_path_to_index_css';`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { p as parseAndJoinStyles, b as parseTemplateCallSite } from "./parse-styles-
|
|
4
|
+
import { p as parseAndJoinStyles, b as parseTemplateCallSite } from "./parse-styles-BgVqQAni.js";
|
|
5
5
|
import { t as toHash, d as dashCase } from "./to-hash-DSoCPs8D.js";
|
|
6
6
|
class StylesGenerator {
|
|
7
7
|
constructor(params) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
const parseStyles = require("./parse-styles-
|
|
5
|
+
const parseStyles = require("./parse-styles-BbI-2wdn.cjs");
|
|
6
6
|
const toHash = require("./to-hash-DT2ImSPA.cjs");
|
|
7
7
|
class StylesGenerator {
|
|
8
8
|
constructor(params) {
|
package/compiler/helpers.cjs
CHANGED
|
@@ -16,11 +16,19 @@ const resolveExportValue = async (value, maxLevel = 10, _level = 0) => {
|
|
|
16
16
|
return value;
|
|
17
17
|
};
|
|
18
18
|
const saltyFileExtensions = ["salty", "css", "styles", "styled"];
|
|
19
|
+
const tsFileExtensions = ["ts", "tsx", "js", "jsx", "mjs", "cjs"];
|
|
19
20
|
const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
20
|
-
const saltyFileRegExp = (additional = []) =>
|
|
21
|
-
const
|
|
21
|
+
const saltyFileRegExp = (additional = [], testExtension = true) => {
|
|
22
|
+
const extensions = [...saltyFileExtensions, ...additional].map(escapeRegExp).join("|");
|
|
23
|
+
if (testExtension) {
|
|
24
|
+
return new RegExp(`\\.(${extensions})\\.(${tsFileExtensions.map(escapeRegExp).join("|")})$`);
|
|
25
|
+
}
|
|
26
|
+
return new RegExp(`\\.(${extensions})\\.`);
|
|
27
|
+
};
|
|
28
|
+
const isSaltyFile = (file, additional = [], testExtension = true) => saltyFileRegExp(additional, testExtension).test(file);
|
|
22
29
|
exports.getCorePackageRoot = getCorePackageRoot;
|
|
23
30
|
exports.isSaltyFile = isSaltyFile;
|
|
24
31
|
exports.resolveExportValue = resolveExportValue;
|
|
25
32
|
exports.saltyFileExtensions = saltyFileExtensions;
|
|
26
33
|
exports.saltyFileRegExp = saltyFileRegExp;
|
|
34
|
+
exports.tsFileExtensions = tsFileExtensions;
|
package/compiler/helpers.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const getCorePackageRoot: () => string;
|
|
2
2
|
export declare const resolveExportValue: <T>(value: unknown, maxLevel?: number, _level?: number) => Promise<T>;
|
|
3
3
|
export declare const saltyFileExtensions: string[];
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const tsFileExtensions: string[];
|
|
5
|
+
export declare const saltyFileRegExp: (additional?: string[], testExtension?: boolean) => RegExp;
|
|
6
|
+
export declare const isSaltyFile: (file: string, additional?: string[], testExtension?: boolean) => boolean;
|
package/compiler/helpers.js
CHANGED
|
@@ -13,13 +13,21 @@ const resolveExportValue = async (value, maxLevel = 10, _level = 0) => {
|
|
|
13
13
|
return value;
|
|
14
14
|
};
|
|
15
15
|
const saltyFileExtensions = ["salty", "css", "styles", "styled"];
|
|
16
|
+
const tsFileExtensions = ["ts", "tsx", "js", "jsx", "mjs", "cjs"];
|
|
16
17
|
const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
17
|
-
const saltyFileRegExp = (additional = []) =>
|
|
18
|
-
const
|
|
18
|
+
const saltyFileRegExp = (additional = [], testExtension = true) => {
|
|
19
|
+
const extensions = [...saltyFileExtensions, ...additional].map(escapeRegExp).join("|");
|
|
20
|
+
if (testExtension) {
|
|
21
|
+
return new RegExp(`\\.(${extensions})\\.(${tsFileExtensions.map(escapeRegExp).join("|")})$`);
|
|
22
|
+
}
|
|
23
|
+
return new RegExp(`\\.(${extensions})\\.`);
|
|
24
|
+
};
|
|
25
|
+
const isSaltyFile = (file, additional = [], testExtension = true) => saltyFileRegExp(additional, testExtension).test(file);
|
|
19
26
|
export {
|
|
20
27
|
getCorePackageRoot,
|
|
21
28
|
isSaltyFile,
|
|
22
29
|
resolveExportValue,
|
|
23
30
|
saltyFileExtensions,
|
|
24
|
-
saltyFileRegExp
|
|
31
|
+
saltyFileRegExp,
|
|
32
|
+
tsFileExtensions
|
|
25
33
|
};
|
|
@@ -13,7 +13,7 @@ const compiler_helpers = require("./helpers.cjs");
|
|
|
13
13
|
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
14
14
|
const defineTemplates = require("../define-templates-Deq1aCbN.cjs");
|
|
15
15
|
const module$1 = require("module");
|
|
16
|
-
const parseStyles = require("../parse-styles-
|
|
16
|
+
const parseStyles = require("../parse-styles-BbI-2wdn.cjs");
|
|
17
17
|
const css_merge = require("../css/merge.cjs");
|
|
18
18
|
const compiler_getFiles = require("./get-files.cjs");
|
|
19
19
|
const parsers_index = require("../parsers/index.cjs");
|
|
@@ -11,7 +11,7 @@ import { isSaltyFile, resolveExportValue, saltyFileExtensions } from "./helpers.
|
|
|
11
11
|
import { t as toHash, d as dashCase } from "../to-hash-DSoCPs8D.js";
|
|
12
12
|
import { d as defineTemplates } from "../define-templates-CVhhgPnd.js";
|
|
13
13
|
import { createRequire } from "module";
|
|
14
|
-
import { p as parseAndJoinStyles, c as parseVariableTokens } from "../parse-styles-
|
|
14
|
+
import { p as parseAndJoinStyles, c as parseVariableTokens } from "../parse-styles-BgVqQAni.js";
|
|
15
15
|
import { mergeObjects, mergeFactories } from "../css/merge.js";
|
|
16
16
|
import { getPackageJson } from "./get-files.js";
|
|
17
17
|
import { parseTemplates, getTemplateTypes, getTemplateVariantMaps } from "../parsers/index.js";
|
package/css/keyframes.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const parseStyles = require("../parse-styles-
|
|
3
|
+
const parseStyles = require("../parse-styles-BbI-2wdn.cjs");
|
|
4
4
|
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
5
5
|
const keyframes = ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes2 }) => {
|
|
6
6
|
const modifyKeyframes = async (params = {}) => {
|
package/css/keyframes.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as parseAndJoinStyles } from "../parse-styles-
|
|
1
|
+
import { p as parseAndJoinStyles } from "../parse-styles-BgVqQAni.js";
|
|
2
2
|
import { t as toHash } from "../to-hash-DSoCPs8D.js";
|
|
3
3
|
const keyframes = ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes2 }) => {
|
|
4
4
|
const modifyKeyframes = async (params = {}) => {
|
package/generators/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const classNameGenerator = require("../class-name-generator-
|
|
3
|
+
const classNameGenerator = require("../class-name-generator-MtPkBfM_.cjs");
|
|
4
4
|
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
5
5
|
class StyledGenerator extends classNameGenerator.StylesGenerator {
|
|
6
6
|
constructor(tagName, _params) {
|
package/generators/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as StylesGenerator } from "../class-name-generator-
|
|
2
|
-
import { C } from "../class-name-generator-
|
|
1
|
+
import { S as StylesGenerator } from "../class-name-generator-CUEoPowv.js";
|
|
2
|
+
import { C } from "../class-name-generator-CUEoPowv.js";
|
|
3
3
|
import { d as dashCase } from "../to-hash-DSoCPs8D.js";
|
|
4
4
|
class StyledGenerator extends StylesGenerator {
|
|
5
5
|
constructor(tagName, _params) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const classNameGenerator = require("../class-name-generator-
|
|
3
|
+
const classNameGenerator = require("../class-name-generator-MtPkBfM_.cjs");
|
|
4
4
|
const classNameInstance = (params) => {
|
|
5
5
|
const generator = new classNameGenerator.ClassNameGenerator(params);
|
|
6
6
|
const createClass = (classNameStr) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ClassNameGenerator } from "../class-name-generator-
|
|
1
|
+
import { C as ClassNameGenerator } from "../class-name-generator-CUEoPowv.js";
|
|
2
2
|
const classNameInstance = (params) => {
|
|
3
3
|
const generator = new ClassNameGenerator(params);
|
|
4
4
|
const createClass = (classNameStr) => {
|
package/package.json
CHANGED
|
@@ -94,6 +94,7 @@ const reportParserIssue = (strict, message) => {
|
|
|
94
94
|
const pseudoTypoRegex = /^&(hover|focus(-(visible|within))?|active|visited|checked|disabled|enabled|empty|target|first-child|last-child|first-of-type|last-of-type|placeholder|placeholder-shown|root)\b/;
|
|
95
95
|
const templateLiteralLeftoverRegex = /\$\{[^}]+\}/;
|
|
96
96
|
const bareAtRuleRegex = /^@(media|supports|container|layer)\s*$/;
|
|
97
|
+
const keyframesAtRuleRegex = /^@(?:-(?:webkit|moz|o|ms)-)?keyframes\b/;
|
|
97
98
|
const isRichTemplateNode = (node) => {
|
|
98
99
|
if (!node || typeof node !== "object") return false;
|
|
99
100
|
if (Array.isArray(node)) return false;
|
|
@@ -375,8 +376,9 @@ const parseStyles = async (styles, currentScope = "", config, omitTemplates = fa
|
|
|
375
376
|
}
|
|
376
377
|
if (_key.startsWith("@")) {
|
|
377
378
|
if (bareAtRuleRegex.test(_key)) reportParserIssue(strict, `At-rule "${_key}" is missing its condition (e.g. "@media (min-width: 600px)").`);
|
|
379
|
+
const innerScope = keyframesAtRuleRegex.test(_key) ? "" : currentScope;
|
|
378
380
|
const mediaQuery = ((_b = config == null ? void 0 : config.mediaQueries) == null ? void 0 : _b[_key]) || _key;
|
|
379
|
-
const results2 = await parseAndJoinStyles(value,
|
|
381
|
+
const results2 = await parseAndJoinStyles(value, innerScope, config);
|
|
380
382
|
const query = `${mediaQuery} { ${results2} }`;
|
|
381
383
|
cssStyles.add(query);
|
|
382
384
|
return void 0;
|
|
@@ -93,6 +93,7 @@ const reportParserIssue = (strict, message) => {
|
|
|
93
93
|
const pseudoTypoRegex = /^&(hover|focus(-(visible|within))?|active|visited|checked|disabled|enabled|empty|target|first-child|last-child|first-of-type|last-of-type|placeholder|placeholder-shown|root)\b/;
|
|
94
94
|
const templateLiteralLeftoverRegex = /\$\{[^}]+\}/;
|
|
95
95
|
const bareAtRuleRegex = /^@(media|supports|container|layer)\s*$/;
|
|
96
|
+
const keyframesAtRuleRegex = /^@(?:-(?:webkit|moz|o|ms)-)?keyframes\b/;
|
|
96
97
|
const isRichTemplateNode = (node) => {
|
|
97
98
|
if (!node || typeof node !== "object") return false;
|
|
98
99
|
if (Array.isArray(node)) return false;
|
|
@@ -374,8 +375,9 @@ const parseStyles = async (styles, currentScope = "", config, omitTemplates = fa
|
|
|
374
375
|
}
|
|
375
376
|
if (_key.startsWith("@")) {
|
|
376
377
|
if (bareAtRuleRegex.test(_key)) reportParserIssue(strict, `At-rule "${_key}" is missing its condition (e.g. "@media (min-width: 600px)").`);
|
|
378
|
+
const innerScope = keyframesAtRuleRegex.test(_key) ? "" : currentScope;
|
|
377
379
|
const mediaQuery = ((_b = config == null ? void 0 : config.mediaQueries) == null ? void 0 : _b[_key]) || _key;
|
|
378
|
-
const results2 = await parseAndJoinStyles(value,
|
|
380
|
+
const results2 = await parseAndJoinStyles(value, innerScope, config);
|
|
379
381
|
const query = `${mediaQuery} { ${results2} }`;
|
|
380
382
|
cssStyles.add(query);
|
|
381
383
|
return void 0;
|
package/parsers/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const parseStyles = require("../parse-styles-
|
|
3
|
+
const parseStyles = require("../parse-styles-BbI-2wdn.cjs");
|
|
4
4
|
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
5
5
|
const RICH_META_KEYS = /* @__PURE__ */ new Set(["base", "variants", "defaultVariants", "compoundVariants", "anyOfVariants"]);
|
|
6
6
|
const isChildEntry = (key, value) => {
|
package/parsers/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as isRichTemplateNode, p as parseAndJoinStyles } from "../parse-styles-
|
|
2
|
-
import { a, d, e, c, r } from "../parse-styles-
|
|
1
|
+
import { i as isRichTemplateNode, p as parseAndJoinStyles } from "../parse-styles-BgVqQAni.js";
|
|
2
|
+
import { a, d, e, c, r } from "../parse-styles-BgVqQAni.js";
|
|
3
3
|
import { d as dashCase, t as toHash } from "../to-hash-DSoCPs8D.js";
|
|
4
4
|
const RICH_META_KEYS = /* @__PURE__ */ new Set(["base", "variants", "defaultVariants", "compoundVariants", "anyOfVariants"]);
|
|
5
5
|
const isChildEntry = (key, value) => {
|
package/runtime/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const parseStyles = require("../parse-styles-
|
|
3
|
+
const parseStyles = require("../parse-styles-BbI-2wdn.cjs");
|
|
4
4
|
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
5
5
|
const defineRuntime = (config) => {
|
|
6
6
|
const className = (styles) => toHash.toHash(styles);
|
package/runtime/index.js
CHANGED
package/util/module-type.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const detectCurrentModuleType: (dirname: string) => Promise<"
|
|
1
|
+
export declare const detectCurrentModuleType: (dirname: string) => Promise<"cjs" | "esm">;
|