@salty-css/core 0.1.0-alpha.5 → 0.1.0-alpha.7
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 +27 -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 +548 -332
- package/bin/main.d.ts +8 -0
- package/bin/main.js +548 -332
- package/bin/package-json.d.ts +21 -0
- package/bin/saltyrc.d.ts +31 -0
- package/bin/templates.d.ts +14 -0
- package/package.json +1 -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,4 @@
|
|
|
1
|
+
const astroComponent = "---\nimport { <%- styledComponentName %> } from './<%- fileName %>.css';\n\ninterface Props {\n text?: string;\n}\n\nconst { text = 'Lorem ipsum' } = Astro.props;\n---\n\n<<%- styledComponentName %>>\n {text}\n</<%- styledComponentName %>>\n";
|
|
2
|
+
export {
|
|
3
|
+
astroComponent as default
|
|
4
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const astroComponent = "---\nimport { <%- styledComponentName %> } from './<%- fileName %>.css';\n\ninterface Props {\n text?: string;\n}\n\nconst { text = 'Lorem ipsum' } = Astro.props;\n---\n\n<<%- styledComponentName %>>\n {text}\n</<%- styledComponentName %>>\n";
|
|
4
|
+
exports.default = astroComponent;
|
package/bin/context.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RCFile } from '../types/cli-types';
|
|
2
|
+
import { PackageJson } from './package-json';
|
|
3
|
+
export interface ProjectContext {
|
|
4
|
+
cwd: string;
|
|
5
|
+
projectDir: string;
|
|
6
|
+
relativeProjectPath: string;
|
|
7
|
+
packageJson?: PackageJson;
|
|
8
|
+
rcFile: RCFile;
|
|
9
|
+
cliVersion: string;
|
|
10
|
+
skipInstall: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const resolveProjectDir: (dir: string, rootDir?: string) => string;
|
|
13
|
+
export interface BuildContextOptions {
|
|
14
|
+
dir: string;
|
|
15
|
+
skipInstall?: boolean;
|
|
16
|
+
/** When false, build context even if package.json is missing (used by commands that should not require one). */
|
|
17
|
+
requirePackageJson?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const buildContext: (opts: BuildContextOptions) => Promise<ProjectContext>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FrameworkAdapter } from './types';
|
|
2
|
+
export declare const astroConfigFiles: readonly ["astro.config.mjs", "astro.config.ts", "astro.config.js", "astro.config.cjs"];
|
|
3
|
+
export declare const findAstroConfig: (projectDir: string) => string | null;
|
|
4
|
+
export declare const astroFramework: FrameworkAdapter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ProjectContext } from '../context';
|
|
2
|
+
import { FrameworkAdapter, FrameworkName } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Adapters are evaluated in this order; the first whose `detect()` returns true wins.
|
|
5
|
+
* React is the final fallback, so its `detect()` always returns true.
|
|
6
|
+
*/
|
|
7
|
+
export declare const frameworkRegistry: FrameworkAdapter[];
|
|
8
|
+
export declare const frameworksByName: Record<FrameworkName, FrameworkAdapter>;
|
|
9
|
+
export declare const detectFramework: (ctx: ProjectContext) => Promise<FrameworkAdapter>;
|
|
10
|
+
export declare const getFramework: (name: string | undefined) => FrameworkAdapter | undefined;
|
|
11
|
+
export type { FrameworkAdapter, FrameworkName } from './types';
|
|
12
|
+
export { reactFramework } from './react';
|
|
13
|
+
export { astroFramework, findAstroConfig, astroConfigFiles } from './astro';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ProjectContext } from '../context';
|
|
2
|
+
import { TemplateKey } from '../templates';
|
|
3
|
+
export type FrameworkName = 'react' | 'astro';
|
|
4
|
+
export interface ComponentTemplates {
|
|
5
|
+
/** Template used for the styled-file when the wrapper component is requested. */
|
|
6
|
+
styled: TemplateKey;
|
|
7
|
+
/** Template used for the wrapper component file. */
|
|
8
|
+
wrapper: TemplateKey;
|
|
9
|
+
/** Extension for the wrapper component file (including dot), e.g. '.tsx' or '.astro'. */
|
|
10
|
+
wrapperExt: string;
|
|
11
|
+
}
|
|
12
|
+
export interface FrameworkAdapter {
|
|
13
|
+
name: FrameworkName;
|
|
14
|
+
/** The path to the framework's source files. */
|
|
15
|
+
srcDirectory: string;
|
|
16
|
+
/** True when this framework matches the project. Adapters are evaluated in registry order. */
|
|
17
|
+
detect(ctx: ProjectContext): Promise<boolean> | boolean;
|
|
18
|
+
/** The runtime npm spec to install for this framework, e.g. `@salty-css/react@1.2.3`. */
|
|
19
|
+
runtimePackage(version: string): string;
|
|
20
|
+
/** Templates used by the `generate` command. */
|
|
21
|
+
templates: {
|
|
22
|
+
/** Template used for a standalone styled-file (no wrapper). */
|
|
23
|
+
styled: TemplateKey;
|
|
24
|
+
/** Optional wrapper component templates. Omit if the framework does not support `--reactComponent`. */
|
|
25
|
+
component?: ComponentTemplates;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BuildIntegrationAdapter, ConfigEdit } from './types';
|
|
2
|
+
export declare const astroPackage: (version: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the new content of an Astro config (with saltyIntegration wired in),
|
|
5
|
+
* or `{ content: null }` if the integration is already present or if no safe
|
|
6
|
+
* insertion point was found.
|
|
7
|
+
*/
|
|
8
|
+
export declare const editAstroConfig: (existing: string) => ConfigEdit & {
|
|
9
|
+
warning?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const astroIntegration: BuildIntegrationAdapter;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BuildIntegrationAdapter, ConfigEdit } from './types';
|
|
2
|
+
export declare const eslintConfigCandidates: (projectDir: string, rootDir: string) => string[];
|
|
3
|
+
export declare const editEslintConfig: (existing: string, isJsFlat: boolean) => ConfigEdit & {
|
|
4
|
+
warning?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const eslintIntegration: BuildIntegrationAdapter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ProjectContext } from '../context';
|
|
2
|
+
import { BuildIntegrationAdapter } from './types';
|
|
3
|
+
export declare const buildIntegrationRegistry: BuildIntegrationAdapter[];
|
|
4
|
+
export declare const detectAndApplyIntegrations: (ctx: ProjectContext) => Promise<{
|
|
5
|
+
name: string;
|
|
6
|
+
configPath: string;
|
|
7
|
+
changed: boolean;
|
|
8
|
+
}[]>;
|
|
9
|
+
export type { BuildIntegrationAdapter, ConfigEdit } from './types';
|
|
10
|
+
export { viteIntegration, editViteConfig, vitePackage } from './vite';
|
|
11
|
+
export { nextIntegration, editNextConfig, nextPackage, nextConfigFiles } from './next';
|
|
12
|
+
export { astroIntegration, editAstroConfig, astroPackage } from './astro';
|
|
13
|
+
export { eslintIntegration, editEslintConfig, eslintConfigCandidates } from './eslint';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BuildIntegrationAdapter, ConfigEdit } from './types';
|
|
2
|
+
export declare const nextConfigFiles: readonly ["next.config.js", "next.config.cjs", "next.config.ts", "next.config.mjs"];
|
|
3
|
+
export declare const nextPackage: (version: string) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Returns the new content of a Next.js config (with withSaltyCss wired in),
|
|
6
|
+
* or `{ content: null }` if the plugin is already present.
|
|
7
|
+
*/
|
|
8
|
+
export declare const editNextConfig: (existing: string) => ConfigEdit;
|
|
9
|
+
export declare const nextIntegration: BuildIntegrationAdapter;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ProjectContext } from '../context';
|
|
2
|
+
export interface IntegrationApplyResult {
|
|
3
|
+
/** Whether any file was edited or any install was performed. */
|
|
4
|
+
changed: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface BuildIntegrationAdapter {
|
|
7
|
+
name: string;
|
|
8
|
+
/** Returns the config file path this integration targets, or null when not applicable. */
|
|
9
|
+
detect(ctx: ProjectContext): Promise<string | null> | string | null;
|
|
10
|
+
/** Idempotently wire the integration into the project (edit configs, install dev deps). */
|
|
11
|
+
apply(ctx: ProjectContext, configPath: string): Promise<IntegrationApplyResult>;
|
|
12
|
+
}
|
|
13
|
+
/** Pure transform — returned by an integration when it knows how to rewrite a config file. */
|
|
14
|
+
export interface ConfigEdit {
|
|
15
|
+
/** New content to write, or null when no edit is needed. */
|
|
16
|
+
content: string | null;
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BuildIntegrationAdapter, ConfigEdit } from './types';
|
|
2
|
+
export declare const vitePackage: (version: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the new content of a Vite config (with the salty plugin wired in),
|
|
5
|
+
* or `{ content: null }` if the plugin is already present.
|
|
6
|
+
*/
|
|
7
|
+
export declare const editViteConfig: (existing: string) => ConfigEdit;
|
|
8
|
+
export declare const viteIntegration: BuildIntegrationAdapter;
|