@pandacss/node 0.22.1 → 0.24.0
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/dist/index.d.mts +61 -50
- package/dist/index.d.ts +61 -50
- package/dist/index.js +518 -552
- package/dist/index.mjs +515 -547
- package/package.json +21 -18
package/dist/index.d.mts
CHANGED
|
@@ -1,57 +1,62 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
|
-
import { LoadConfigResult,
|
|
2
|
+
import { LoadConfigResult, Artifact, Runtime, PandaHookable, ConfigResultWithHooks, WatchOptions, WatcherEventType, ParserResultInterface, ArtifactId, Config, CssArtifactType } from '@pandacss/types';
|
|
3
|
+
import { StyleEncoder, Stylesheet } from '@pandacss/core';
|
|
3
4
|
import { Generator } from '@pandacss/generator';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
5
|
+
import * as _pandacss_parser from '@pandacss/parser';
|
|
6
|
+
import { Project, ParserResult } from '@pandacss/parser';
|
|
7
|
+
import * as _pandacss_config from '@pandacss/config';
|
|
6
8
|
import { Root, Message } from 'postcss';
|
|
7
9
|
|
|
8
|
-
interface DiffConfigResult {
|
|
9
|
-
hasConfigChanged: boolean;
|
|
10
|
-
artifacts: Set<ArtifactId>;
|
|
11
|
-
diffs: Difference[];
|
|
12
|
-
}
|
|
13
10
|
declare class DiffEngine {
|
|
14
11
|
private ctx;
|
|
15
|
-
private
|
|
12
|
+
private prevConfig;
|
|
16
13
|
constructor(ctx: Generator);
|
|
17
14
|
/**
|
|
18
15
|
* Reload config from disk and refresh the context
|
|
19
16
|
*/
|
|
20
|
-
reloadConfigAndRefreshContext(fn?: (conf: LoadConfigResult) => void): Promise<DiffConfigResult>;
|
|
17
|
+
reloadConfigAndRefreshContext(fn?: (conf: LoadConfigResult) => void): Promise<_pandacss_config.DiffConfigResult>;
|
|
21
18
|
/**
|
|
22
19
|
* Update the context from the refreshed config
|
|
23
20
|
* then persist the changes on each affected engines
|
|
24
21
|
* Returns the list of affected artifacts/engines
|
|
25
22
|
*/
|
|
26
|
-
refresh(conf: LoadConfigResult, fn?: (conf: LoadConfigResult) => void): DiffConfigResult;
|
|
23
|
+
refresh(conf: LoadConfigResult, fn?: (conf: LoadConfigResult) => void): _pandacss_config.DiffConfigResult;
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
interface OutputEngineOptions extends Generator {
|
|
27
|
+
runtime: Runtime;
|
|
28
|
+
hooks: PandaHookable;
|
|
29
|
+
}
|
|
30
|
+
declare class OutputEngine {
|
|
30
31
|
private paths;
|
|
31
32
|
private fs;
|
|
32
33
|
private path;
|
|
33
|
-
constructor(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
empty(): void;
|
|
38
|
-
write(output: Artifact | undefined): Promise<PromiseSettledResult<void>[] | undefined>;
|
|
34
|
+
constructor(options: OutputEngineOptions);
|
|
35
|
+
empty: () => void;
|
|
36
|
+
ensure: (file: string, cwd: string) => string;
|
|
37
|
+
write: (output: Artifact | undefined) => Promise<PromiseSettledResult<void>[]> | undefined;
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
declare class PandaContext extends Generator {
|
|
42
41
|
runtime: Runtime;
|
|
43
|
-
project:
|
|
44
|
-
|
|
45
|
-
output: PandaOutputEngine;
|
|
42
|
+
project: Project;
|
|
43
|
+
output: OutputEngine;
|
|
46
44
|
diff: DiffEngine;
|
|
47
45
|
constructor(conf: ConfigResultWithHooks);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
getFiles: () => string[];
|
|
47
|
+
parseFile: (filePath: string, styleEncoder?: StyleEncoder) => ParserResult | undefined;
|
|
48
|
+
parseFiles: (styleEncoder?: StyleEncoder) => {
|
|
49
|
+
filesWithCss: string[];
|
|
50
|
+
files: string[];
|
|
51
|
+
results: ParserResult[];
|
|
52
|
+
};
|
|
53
|
+
writeCss: (sheet?: Stylesheet) => Promise<PromiseSettledResult<void>[]> | undefined;
|
|
54
|
+
watchConfig: (cb: () => void | Promise<void>, opts?: Omit<WatchOptions, 'include'>) => void;
|
|
55
|
+
watchFiles: (cb: (event: WatcherEventType, file: string) => void | Promise<void>) => void;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
interface Options {
|
|
54
|
-
onResult?: (file: string, result:
|
|
59
|
+
onResult?: (file: string, result: ParserResultInterface) => void;
|
|
55
60
|
}
|
|
56
61
|
declare function analyzeTokens(ctx: PandaContext, options?: Options): {
|
|
57
62
|
duration: {
|
|
@@ -192,14 +197,17 @@ declare function analyzeTokens(ctx: PandaContext, options?: Options): {
|
|
|
192
197
|
};
|
|
193
198
|
declare const writeAnalyzeJSON: (filePath: string, result: ReturnType<typeof analyzeTokens>, ctx: PandaContext) => Promise<void>;
|
|
194
199
|
|
|
200
|
+
declare function buildInfo(ctx: PandaContext, outfile: string): Promise<void>;
|
|
201
|
+
|
|
195
202
|
declare class Builder {
|
|
196
203
|
/**
|
|
197
204
|
* The current panda context
|
|
198
205
|
*/
|
|
199
206
|
context: PandaContext | undefined;
|
|
200
207
|
private hasEmitted;
|
|
208
|
+
private filesMeta;
|
|
201
209
|
private affecteds;
|
|
202
|
-
getConfigPath: () => string;
|
|
210
|
+
getConfigPath: (cwd?: string) => string;
|
|
203
211
|
setup: (options?: {
|
|
204
212
|
configPath?: string;
|
|
205
213
|
cwd?: string;
|
|
@@ -214,41 +222,46 @@ declare class Builder {
|
|
|
214
222
|
mtime: number;
|
|
215
223
|
isUnchanged: boolean;
|
|
216
224
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
225
|
+
checkFilesChanged(files: string[]): {
|
|
226
|
+
changes: Map<string, FileMeta>;
|
|
227
|
+
hasFilesChanged: boolean;
|
|
228
|
+
};
|
|
229
|
+
extractFile: (ctx: PandaContext, file: string) => _pandacss_parser.ParserResult | undefined;
|
|
230
|
+
extract: () => void;
|
|
221
231
|
isValidRoot: (root: Root) => boolean;
|
|
222
|
-
private initialRoot;
|
|
223
232
|
write: (root: Root) => void;
|
|
224
233
|
registerDependency: (fn: (dep: Message) => void) => void;
|
|
225
234
|
}
|
|
235
|
+
interface FileMeta {
|
|
236
|
+
mtime: number;
|
|
237
|
+
isUnchanged: boolean;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
|
|
241
|
+
box: string;
|
|
242
|
+
msg: string;
|
|
243
|
+
}>;
|
|
226
244
|
|
|
227
|
-
declare function findConfig(): string | undefined;
|
|
228
245
|
declare function loadConfigAndCreateContext(options?: {
|
|
229
246
|
cwd?: string;
|
|
230
247
|
config?: Config;
|
|
231
248
|
configPath?: string;
|
|
232
249
|
}): Promise<PandaContext>;
|
|
233
250
|
|
|
234
|
-
|
|
251
|
+
interface CssGenOptions {
|
|
252
|
+
cwd: string;
|
|
253
|
+
outfile?: string;
|
|
254
|
+
type?: CssArtifactType;
|
|
255
|
+
minimal?: boolean;
|
|
256
|
+
}
|
|
257
|
+
declare const cssgen: (ctx: PandaContext, options: CssGenOptions) => Promise<void>;
|
|
258
|
+
|
|
259
|
+
interface DebugOptions {
|
|
235
260
|
outdir: string;
|
|
236
261
|
dry: boolean;
|
|
237
262
|
onlyConfig?: boolean;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
declare function emitArtifacts(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
|
|
241
|
-
box: string;
|
|
242
|
-
msg: string;
|
|
243
|
-
}>;
|
|
244
|
-
|
|
245
|
-
declare function execCommand(cmd: string, cwd: string): Promise<void>;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Parse a file and return the corresponding css
|
|
249
|
-
*/
|
|
250
|
-
declare function extractFile(ctx: PandaContext, filePath: string): ParserResult | undefined;
|
|
251
|
-
type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
|
|
263
|
+
}
|
|
264
|
+
declare function debug(ctx: PandaContext, options: DebugOptions): Promise<void>;
|
|
252
265
|
|
|
253
266
|
declare function generate(config: Config, configPath?: string): Promise<void>;
|
|
254
267
|
|
|
@@ -262,6 +275,4 @@ type SetupOptions = Partial<Config> & {
|
|
|
262
275
|
declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
|
|
263
276
|
declare function setupPostcss(cwd: string): Promise<void>;
|
|
264
277
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
export { Builder, CssArtifactType, PandaContext, analyzeTokens, debugFiles, emitArtifacts, execCommand, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
|
|
278
|
+
export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, writeAnalyzeJSON };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,57 +1,62 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
|
-
import { LoadConfigResult,
|
|
2
|
+
import { LoadConfigResult, Artifact, Runtime, PandaHookable, ConfigResultWithHooks, WatchOptions, WatcherEventType, ParserResultInterface, ArtifactId, Config, CssArtifactType } from '@pandacss/types';
|
|
3
|
+
import { StyleEncoder, Stylesheet } from '@pandacss/core';
|
|
3
4
|
import { Generator } from '@pandacss/generator';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
5
|
+
import * as _pandacss_parser from '@pandacss/parser';
|
|
6
|
+
import { Project, ParserResult } from '@pandacss/parser';
|
|
7
|
+
import * as _pandacss_config from '@pandacss/config';
|
|
6
8
|
import { Root, Message } from 'postcss';
|
|
7
9
|
|
|
8
|
-
interface DiffConfigResult {
|
|
9
|
-
hasConfigChanged: boolean;
|
|
10
|
-
artifacts: Set<ArtifactId>;
|
|
11
|
-
diffs: Difference[];
|
|
12
|
-
}
|
|
13
10
|
declare class DiffEngine {
|
|
14
11
|
private ctx;
|
|
15
|
-
private
|
|
12
|
+
private prevConfig;
|
|
16
13
|
constructor(ctx: Generator);
|
|
17
14
|
/**
|
|
18
15
|
* Reload config from disk and refresh the context
|
|
19
16
|
*/
|
|
20
|
-
reloadConfigAndRefreshContext(fn?: (conf: LoadConfigResult) => void): Promise<DiffConfigResult>;
|
|
17
|
+
reloadConfigAndRefreshContext(fn?: (conf: LoadConfigResult) => void): Promise<_pandacss_config.DiffConfigResult>;
|
|
21
18
|
/**
|
|
22
19
|
* Update the context from the refreshed config
|
|
23
20
|
* then persist the changes on each affected engines
|
|
24
21
|
* Returns the list of affected artifacts/engines
|
|
25
22
|
*/
|
|
26
|
-
refresh(conf: LoadConfigResult, fn?: (conf: LoadConfigResult) => void): DiffConfigResult;
|
|
23
|
+
refresh(conf: LoadConfigResult, fn?: (conf: LoadConfigResult) => void): _pandacss_config.DiffConfigResult;
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
interface OutputEngineOptions extends Generator {
|
|
27
|
+
runtime: Runtime;
|
|
28
|
+
hooks: PandaHookable;
|
|
29
|
+
}
|
|
30
|
+
declare class OutputEngine {
|
|
30
31
|
private paths;
|
|
31
32
|
private fs;
|
|
32
33
|
private path;
|
|
33
|
-
constructor(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
empty(): void;
|
|
38
|
-
write(output: Artifact | undefined): Promise<PromiseSettledResult<void>[] | undefined>;
|
|
34
|
+
constructor(options: OutputEngineOptions);
|
|
35
|
+
empty: () => void;
|
|
36
|
+
ensure: (file: string, cwd: string) => string;
|
|
37
|
+
write: (output: Artifact | undefined) => Promise<PromiseSettledResult<void>[]> | undefined;
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
declare class PandaContext extends Generator {
|
|
42
41
|
runtime: Runtime;
|
|
43
|
-
project:
|
|
44
|
-
|
|
45
|
-
output: PandaOutputEngine;
|
|
42
|
+
project: Project;
|
|
43
|
+
output: OutputEngine;
|
|
46
44
|
diff: DiffEngine;
|
|
47
45
|
constructor(conf: ConfigResultWithHooks);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
getFiles: () => string[];
|
|
47
|
+
parseFile: (filePath: string, styleEncoder?: StyleEncoder) => ParserResult | undefined;
|
|
48
|
+
parseFiles: (styleEncoder?: StyleEncoder) => {
|
|
49
|
+
filesWithCss: string[];
|
|
50
|
+
files: string[];
|
|
51
|
+
results: ParserResult[];
|
|
52
|
+
};
|
|
53
|
+
writeCss: (sheet?: Stylesheet) => Promise<PromiseSettledResult<void>[]> | undefined;
|
|
54
|
+
watchConfig: (cb: () => void | Promise<void>, opts?: Omit<WatchOptions, 'include'>) => void;
|
|
55
|
+
watchFiles: (cb: (event: WatcherEventType, file: string) => void | Promise<void>) => void;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
interface Options {
|
|
54
|
-
onResult?: (file: string, result:
|
|
59
|
+
onResult?: (file: string, result: ParserResultInterface) => void;
|
|
55
60
|
}
|
|
56
61
|
declare function analyzeTokens(ctx: PandaContext, options?: Options): {
|
|
57
62
|
duration: {
|
|
@@ -192,14 +197,17 @@ declare function analyzeTokens(ctx: PandaContext, options?: Options): {
|
|
|
192
197
|
};
|
|
193
198
|
declare const writeAnalyzeJSON: (filePath: string, result: ReturnType<typeof analyzeTokens>, ctx: PandaContext) => Promise<void>;
|
|
194
199
|
|
|
200
|
+
declare function buildInfo(ctx: PandaContext, outfile: string): Promise<void>;
|
|
201
|
+
|
|
195
202
|
declare class Builder {
|
|
196
203
|
/**
|
|
197
204
|
* The current panda context
|
|
198
205
|
*/
|
|
199
206
|
context: PandaContext | undefined;
|
|
200
207
|
private hasEmitted;
|
|
208
|
+
private filesMeta;
|
|
201
209
|
private affecteds;
|
|
202
|
-
getConfigPath: () => string;
|
|
210
|
+
getConfigPath: (cwd?: string) => string;
|
|
203
211
|
setup: (options?: {
|
|
204
212
|
configPath?: string;
|
|
205
213
|
cwd?: string;
|
|
@@ -214,41 +222,46 @@ declare class Builder {
|
|
|
214
222
|
mtime: number;
|
|
215
223
|
isUnchanged: boolean;
|
|
216
224
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
225
|
+
checkFilesChanged(files: string[]): {
|
|
226
|
+
changes: Map<string, FileMeta>;
|
|
227
|
+
hasFilesChanged: boolean;
|
|
228
|
+
};
|
|
229
|
+
extractFile: (ctx: PandaContext, file: string) => _pandacss_parser.ParserResult | undefined;
|
|
230
|
+
extract: () => void;
|
|
221
231
|
isValidRoot: (root: Root) => boolean;
|
|
222
|
-
private initialRoot;
|
|
223
232
|
write: (root: Root) => void;
|
|
224
233
|
registerDependency: (fn: (dep: Message) => void) => void;
|
|
225
234
|
}
|
|
235
|
+
interface FileMeta {
|
|
236
|
+
mtime: number;
|
|
237
|
+
isUnchanged: boolean;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
|
|
241
|
+
box: string;
|
|
242
|
+
msg: string;
|
|
243
|
+
}>;
|
|
226
244
|
|
|
227
|
-
declare function findConfig(): string | undefined;
|
|
228
245
|
declare function loadConfigAndCreateContext(options?: {
|
|
229
246
|
cwd?: string;
|
|
230
247
|
config?: Config;
|
|
231
248
|
configPath?: string;
|
|
232
249
|
}): Promise<PandaContext>;
|
|
233
250
|
|
|
234
|
-
|
|
251
|
+
interface CssGenOptions {
|
|
252
|
+
cwd: string;
|
|
253
|
+
outfile?: string;
|
|
254
|
+
type?: CssArtifactType;
|
|
255
|
+
minimal?: boolean;
|
|
256
|
+
}
|
|
257
|
+
declare const cssgen: (ctx: PandaContext, options: CssGenOptions) => Promise<void>;
|
|
258
|
+
|
|
259
|
+
interface DebugOptions {
|
|
235
260
|
outdir: string;
|
|
236
261
|
dry: boolean;
|
|
237
262
|
onlyConfig?: boolean;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
declare function emitArtifacts(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
|
|
241
|
-
box: string;
|
|
242
|
-
msg: string;
|
|
243
|
-
}>;
|
|
244
|
-
|
|
245
|
-
declare function execCommand(cmd: string, cwd: string): Promise<void>;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Parse a file and return the corresponding css
|
|
249
|
-
*/
|
|
250
|
-
declare function extractFile(ctx: PandaContext, filePath: string): ParserResult | undefined;
|
|
251
|
-
type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
|
|
263
|
+
}
|
|
264
|
+
declare function debug(ctx: PandaContext, options: DebugOptions): Promise<void>;
|
|
252
265
|
|
|
253
266
|
declare function generate(config: Config, configPath?: string): Promise<void>;
|
|
254
267
|
|
|
@@ -262,6 +275,4 @@ type SetupOptions = Partial<Config> & {
|
|
|
262
275
|
declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
|
|
263
276
|
declare function setupPostcss(cwd: string): Promise<void>;
|
|
264
277
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
export { Builder, CssArtifactType, PandaContext, analyzeTokens, debugFiles, emitArtifacts, execCommand, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
|
|
278
|
+
export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, writeAnalyzeJSON };
|