@salty-css/core 0.1.0-alpha.4 → 0.1.0-alpha.6
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-component-5hrNTCJ5.js +4 -0
- package/astro-component-Dj3enX6K.cjs +4 -0
- package/bin/commands/build.d.ts +2 -0
- package/bin/commands/generate.d.ts +2 -0
- package/bin/commands/init.d.ts +2 -0
- package/bin/commands/update.d.ts +2 -0
- package/bin/commands/version.d.ts +2 -0
- package/bin/context.d.ts +19 -0
- package/bin/detection/css-file.d.ts +5 -0
- package/bin/frameworks/astro.d.ts +4 -0
- package/bin/frameworks/index.d.ts +13 -0
- package/bin/frameworks/react.d.ts +2 -0
- package/bin/frameworks/types.d.ts +25 -0
- package/bin/integrations/astro.d.ts +11 -0
- package/bin/integrations/eslint.d.ts +6 -0
- package/bin/integrations/index.d.ts +13 -0
- package/bin/integrations/next.d.ts +9 -0
- package/bin/integrations/types.d.ts +17 -0
- package/bin/integrations/vite.d.ts +8 -0
- package/bin/main.cjs +545 -332
- package/bin/main.d.ts +8 -0
- package/bin/main.js +545 -332
- package/bin/package-json.d.ts +21 -0
- package/bin/saltyrc.d.ts +30 -0
- package/bin/templates.d.ts +14 -0
- package/compiler/salty-compiler.cjs +1 -1
- package/compiler/salty-compiler.js +1 -1
- package/css/dynamic-styles.cjs +15 -0
- package/css/dynamic-styles.d.ts +10 -0
- package/css/dynamic-styles.js +15 -0
- package/css/index.cjs +3 -0
- package/css/index.d.ts +1 -0
- package/css/index.js +3 -0
- package/package.json +5 -1
- package/styled-file-BzmB9_Ez.cjs +12 -0
- package/{react-styled-file-U02jek-B.cjs → styled-file-CPd_rTW2.cjs} +2 -2
- package/{react-styled-file-B99mwk0w.js → styled-file-Cda3EeR6.js} +2 -2
- package/styled-file-DLcgYmGN.js +12 -0
- package/{react-vanilla-file-D9px70iK.js → vanilla-file-1kOqbCIM.js} +2 -2
- package/{react-vanilla-file-Bj6XC8GS.cjs → vanilla-file-r0fp2q_m.cjs} +2 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PathLike } from 'fs';
|
|
2
|
+
export declare const defaultPackageJsonPath: string;
|
|
3
|
+
export interface PackageJson {
|
|
4
|
+
name?: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
scripts?: Record<string, string>;
|
|
7
|
+
dependencies?: Record<string, string>;
|
|
8
|
+
devDependencies?: Record<string, string>;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare const readPackageJson: (filePath?: PathLike) => Promise<PackageJson>;
|
|
12
|
+
export declare const updatePackageJson: (content: string | object, filePath?: PathLike) => Promise<void>;
|
|
13
|
+
export declare const readThisPackageJson: () => Promise<PackageJson>;
|
|
14
|
+
export declare const corePackages: {
|
|
15
|
+
core: (version: string) => string;
|
|
16
|
+
eslintConfigCore: (version: string) => string;
|
|
17
|
+
};
|
|
18
|
+
export declare const addPrepareScript: (pkg: PackageJson) => {
|
|
19
|
+
changed: boolean;
|
|
20
|
+
pkg: PackageJson;
|
|
21
|
+
};
|
package/bin/saltyrc.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RCFile } from '../types/cli-types';
|
|
2
|
+
export declare const SALTYRC_FILENAME = ".saltyrc.json";
|
|
3
|
+
export declare const SALTYRC_SCHEMA = "./node_modules/@salty-css/core/.saltyrc.schema.json";
|
|
4
|
+
export declare const SALTYRC_INFO = "This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.";
|
|
5
|
+
export interface ProjectEntry {
|
|
6
|
+
dir: string;
|
|
7
|
+
framework: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export declare const saltyrcPath: (rootDir?: string) => string;
|
|
11
|
+
export declare const readRc: (rootDir?: string) => Promise<RCFile>;
|
|
12
|
+
export declare const readRawRc: (rootDir?: string) => Promise<string | undefined>;
|
|
13
|
+
export declare const getDefaultProject: (rootDir?: string) => Promise<string | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* Pure transform: returns the new saltyrc content for an upsert. Does not touch the filesystem.
|
|
16
|
+
* - If `existingRaw` is undefined, returns a fresh file with the project as the only entry.
|
|
17
|
+
* - If the project entry already exists, returns the same content (no-op).
|
|
18
|
+
* - Otherwise appends the new entry and returns updated content.
|
|
19
|
+
*/
|
|
20
|
+
export declare const upsertProjectInRc: (existingRaw: string | undefined, relativeProjectPath: string, framework: string) => {
|
|
21
|
+
content: string;
|
|
22
|
+
changed: boolean;
|
|
23
|
+
created: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Writes the saltyrc file, creating or updating the project entry for the given dir.
|
|
27
|
+
* Returns true when a write occurred.
|
|
28
|
+
*/
|
|
29
|
+
export declare const writeProjectToRc: (rootDir: string, relativeProjectPath: string, framework: string) => Promise<boolean>;
|
|
30
|
+
export declare const getProjectFramework: (rc: RCFile, relativeProjectPath: string) => string | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const templateLoaders: {
|
|
2
|
+
readonly 'salty.config.ts': () => Promise<any>;
|
|
3
|
+
readonly 'saltygen/index.css': () => Promise<any>;
|
|
4
|
+
readonly 'react/styled-file.ts': () => Promise<any>;
|
|
5
|
+
readonly 'react/vanilla-file.ts': () => Promise<any>;
|
|
6
|
+
readonly 'astro/styled-file.ts': () => Promise<any>;
|
|
7
|
+
readonly 'astro/component.astro': () => Promise<any>;
|
|
8
|
+
};
|
|
9
|
+
export type TemplateKey = keyof typeof templateLoaders;
|
|
10
|
+
export declare const readTemplate: <T extends object>(key: TemplateKey, options?: T) => Promise<{
|
|
11
|
+
fileName: "salty.config.ts" | "saltygen/index.css" | "react/styled-file.ts" | "react/vanilla-file.ts" | "astro/styled-file.ts" | "astro/component.astro";
|
|
12
|
+
content: string;
|
|
13
|
+
}>;
|
|
14
|
+
export {};
|
|
@@ -15,8 +15,8 @@ const dashCase = require("../dash-case-DIwKaYgE.cjs");
|
|
|
15
15
|
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
16
16
|
const parseStyles = require("../parse-styles-CA3TP5n1.cjs");
|
|
17
17
|
const css_merge = require("../css/merge.cjs");
|
|
18
|
-
const compiler_getFiles = require("./get-files.cjs");
|
|
19
18
|
const parsers_index = require("../parsers/index.cjs");
|
|
19
|
+
const compiler_getFiles = require("./get-files.cjs");
|
|
20
20
|
const console = require("console");
|
|
21
21
|
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
22
22
|
function _interopNamespaceDefault(e) {
|
|
@@ -13,8 +13,8 @@ import { d as dashCase } from "../dash-case-DblXvymC.js";
|
|
|
13
13
|
import { t as toHash } from "../to-hash-DAN2LcHK.js";
|
|
14
14
|
import { p as parseAndJoinStyles, b as parseVariableTokens } from "../parse-styles-BTIoYnBr.js";
|
|
15
15
|
import { mergeObjects, mergeFactories } from "../css/merge.js";
|
|
16
|
-
import { getPackageJson } from "./get-files.js";
|
|
17
16
|
import { parseTemplates, getTemplateTypes } from "../parsers/index.js";
|
|
17
|
+
import { getPackageJson } from "./get-files.js";
|
|
18
18
|
import console from "console";
|
|
19
19
|
const logger = createLogger({
|
|
20
20
|
level: "debug",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const parseStyles = require("../parse-styles-CA3TP5n1.cjs");
|
|
4
|
+
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
5
|
+
const cache_resolveDynamicConfigCache = require("../cache/resolve-dynamic-config-cache.cjs");
|
|
6
|
+
const getDynamicStylesClassName = (styles) => {
|
|
7
|
+
return toHash.toHash(styles);
|
|
8
|
+
};
|
|
9
|
+
const getDynamicStylesCss = async (styles, scope) => {
|
|
10
|
+
const config = await cache_resolveDynamicConfigCache.resolveDynamicConfigCache();
|
|
11
|
+
const parsed = await parseStyles.parseStyles(styles, scope, config);
|
|
12
|
+
return parsed.join("\n");
|
|
13
|
+
};
|
|
14
|
+
exports.getDynamicStylesClassName = getDynamicStylesClassName;
|
|
15
|
+
exports.getDynamicStylesCss = getDynamicStylesCss;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseStyles } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a hash of the dynamic styles that then can be used as scope.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getDynamicStylesClassName: (styles: BaseStyles) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Add any dynamic styles to your app with a custom scope.
|
|
8
|
+
* Note: this works only with server components.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getDynamicStylesCss: (styles: BaseStyles, scope?: string) => Promise<string>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { a as parseStyles } from "../parse-styles-BTIoYnBr.js";
|
|
2
|
+
import { t as toHash } from "../to-hash-DAN2LcHK.js";
|
|
3
|
+
import { resolveDynamicConfigCache } from "../cache/resolve-dynamic-config-cache.js";
|
|
4
|
+
const getDynamicStylesClassName = (styles) => {
|
|
5
|
+
return toHash(styles);
|
|
6
|
+
};
|
|
7
|
+
const getDynamicStylesCss = async (styles, scope) => {
|
|
8
|
+
const config = await resolveDynamicConfigCache();
|
|
9
|
+
const parsed = await parseStyles(styles, scope, config);
|
|
10
|
+
return parsed.join("\n");
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
getDynamicStylesClassName,
|
|
14
|
+
getDynamicStylesCss
|
|
15
|
+
};
|
package/css/index.cjs
CHANGED
|
@@ -4,9 +4,12 @@ const css_keyframes = require("./keyframes.cjs");
|
|
|
4
4
|
const css_media = require("./media.cjs");
|
|
5
5
|
const css_token = require("./token.cjs");
|
|
6
6
|
const css_merge = require("./merge.cjs");
|
|
7
|
+
const css_dynamicStyles = require("./dynamic-styles.cjs");
|
|
7
8
|
exports.keyframes = css_keyframes.keyframes;
|
|
8
9
|
exports.MediaQueryFactory = css_media.MediaQueryFactory;
|
|
9
10
|
exports.media = css_media.media;
|
|
10
11
|
exports.token = css_token.token;
|
|
11
12
|
exports.mergeFactories = css_merge.mergeFactories;
|
|
12
13
|
exports.mergeObjects = css_merge.mergeObjects;
|
|
14
|
+
exports.getDynamicStylesClassName = css_dynamicStyles.getDynamicStylesClassName;
|
|
15
|
+
exports.getDynamicStylesCss = css_dynamicStyles.getDynamicStylesCss;
|
package/css/index.d.ts
CHANGED
package/css/index.js
CHANGED
|
@@ -2,8 +2,11 @@ import { keyframes } from "./keyframes.js";
|
|
|
2
2
|
import { MediaQueryFactory, media } from "./media.js";
|
|
3
3
|
import { token } from "./token.js";
|
|
4
4
|
import { mergeFactories, mergeObjects } from "./merge.js";
|
|
5
|
+
import { getDynamicStylesClassName, getDynamicStylesCss } from "./dynamic-styles.js";
|
|
5
6
|
export {
|
|
6
7
|
MediaQueryFactory,
|
|
8
|
+
getDynamicStylesClassName,
|
|
9
|
+
getDynamicStylesCss,
|
|
7
10
|
keyframes,
|
|
8
11
|
media,
|
|
9
12
|
mergeFactories,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salty-css/core",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.6",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -87,6 +87,10 @@
|
|
|
87
87
|
"import": "./css/merge.js",
|
|
88
88
|
"require": "./css/merge.cjs"
|
|
89
89
|
},
|
|
90
|
+
"./css/dynamic-styles": {
|
|
91
|
+
"import": "./css/dynamic-styles.js",
|
|
92
|
+
"require": "./css/dynamic-styles.cjs"
|
|
93
|
+
},
|
|
90
94
|
"./helpers": {
|
|
91
95
|
"import": "./helpers/index.js",
|
|
92
96
|
"require": "./helpers/index.cjs"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const styledFile = `import { styled } from "@salty-css/astro/styled";
|
|
4
|
+
|
|
5
|
+
export const <%- name %> = styled('<%- tag %>', {
|
|
6
|
+
<% if(className) { %>className: '<%- className %>',<% } %>
|
|
7
|
+
base: {
|
|
8
|
+
// Add your styles here
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
`;
|
|
12
|
+
exports.default = styledFile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const styledFile = `import { styled } from "@salty-css/react/styled";
|
|
4
4
|
|
|
5
5
|
export const <%- name %> = styled('<%- tag %>', {
|
|
6
6
|
<% if(className) { %>className: '<%- className %>',<% } %>
|
|
@@ -8,4 +8,4 @@ export const <%- name %> = styled('<%- tag %>', {
|
|
|
8
8
|
// Add your styles here
|
|
9
9
|
}
|
|
10
10
|
})`;
|
|
11
|
-
exports.default =
|
|
11
|
+
exports.default = styledFile;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const styledFile = `import { styled } from "@salty-css/react/styled";
|
|
2
2
|
|
|
3
3
|
export const <%- name %> = styled('<%- tag %>', {
|
|
4
4
|
<% if(className) { %>className: '<%- className %>',<% } %>
|
|
@@ -7,5 +7,5 @@ export const <%- name %> = styled('<%- tag %>', {
|
|
|
7
7
|
}
|
|
8
8
|
})`;
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
styledFile as default
|
|
11
11
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const styledFile = `import { styled } from "@salty-css/astro/styled";
|
|
2
|
+
|
|
3
|
+
export const <%- name %> = styled('<%- tag %>', {
|
|
4
|
+
<% if(className) { %>className: '<%- className %>',<% } %>
|
|
5
|
+
base: {
|
|
6
|
+
// Add your styles here
|
|
7
|
+
}
|
|
8
|
+
})
|
|
9
|
+
`;
|
|
10
|
+
export {
|
|
11
|
+
styledFile as default
|
|
12
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const vanillaFile = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
|
|
2
2
|
|
|
3
3
|
interface <%- componentName %>Props {
|
|
4
4
|
text?: string;
|
|
@@ -14,5 +14,5 @@ export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName
|
|
|
14
14
|
|
|
15
15
|
export default <%- componentName %>;`;
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
vanillaFile as default
|
|
18
18
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const vanillaFile = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
|
|
4
4
|
|
|
5
5
|
interface <%- componentName %>Props {
|
|
6
6
|
text?: string;
|
|
@@ -15,4 +15,4 @@ export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export default <%- componentName %>;`;
|
|
18
|
-
exports.default =
|
|
18
|
+
exports.default = vanillaFile;
|