@pandacss/node 0.23.0 → 0.24.1
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 +511 -547
- package/dist/index.mjs +508 -542
- package/package.json +20 -16
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,15 +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;
|
|
201
|
-
private
|
|
208
|
+
private filesMeta;
|
|
202
209
|
private affecteds;
|
|
203
|
-
getConfigPath: () => string;
|
|
210
|
+
getConfigPath: (cwd?: string) => string;
|
|
204
211
|
setup: (options?: {
|
|
205
212
|
configPath?: string;
|
|
206
213
|
cwd?: string;
|
|
@@ -215,41 +222,47 @@ declare class Builder {
|
|
|
215
222
|
mtime: number;
|
|
216
223
|
isUnchanged: boolean;
|
|
217
224
|
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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;
|
|
222
231
|
isValidRoot: (root: Root) => boolean;
|
|
223
232
|
private initialRoot;
|
|
224
233
|
write: (root: Root) => void;
|
|
225
234
|
registerDependency: (fn: (dep: Message) => void) => void;
|
|
226
235
|
}
|
|
236
|
+
interface FileMeta {
|
|
237
|
+
mtime: number;
|
|
238
|
+
isUnchanged: boolean;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
|
|
242
|
+
box: string;
|
|
243
|
+
msg: string;
|
|
244
|
+
}>;
|
|
227
245
|
|
|
228
|
-
declare function findConfig(): string | undefined;
|
|
229
246
|
declare function loadConfigAndCreateContext(options?: {
|
|
230
247
|
cwd?: string;
|
|
231
248
|
config?: Config;
|
|
232
249
|
configPath?: string;
|
|
233
250
|
}): Promise<PandaContext>;
|
|
234
251
|
|
|
235
|
-
|
|
252
|
+
interface CssGenOptions {
|
|
253
|
+
cwd: string;
|
|
254
|
+
outfile?: string;
|
|
255
|
+
type?: CssArtifactType;
|
|
256
|
+
minimal?: boolean;
|
|
257
|
+
}
|
|
258
|
+
declare const cssgen: (ctx: PandaContext, options: CssGenOptions) => Promise<void>;
|
|
259
|
+
|
|
260
|
+
interface DebugOptions {
|
|
236
261
|
outdir: string;
|
|
237
262
|
dry: boolean;
|
|
238
263
|
onlyConfig?: boolean;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
declare function emitArtifacts(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
|
|
242
|
-
box: string;
|
|
243
|
-
msg: string;
|
|
244
|
-
}>;
|
|
245
|
-
|
|
246
|
-
declare function execCommand(cmd: string, cwd: string): Promise<void>;
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Parse a file and return the corresponding css
|
|
250
|
-
*/
|
|
251
|
-
declare function extractFile(ctx: PandaContext, filePath: string): ParserResult | undefined;
|
|
252
|
-
type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
|
|
264
|
+
}
|
|
265
|
+
declare function debug(ctx: PandaContext, options: DebugOptions): Promise<void>;
|
|
253
266
|
|
|
254
267
|
declare function generate(config: Config, configPath?: string): Promise<void>;
|
|
255
268
|
|
|
@@ -263,6 +276,4 @@ type SetupOptions = Partial<Config> & {
|
|
|
263
276
|
declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
|
|
264
277
|
declare function setupPostcss(cwd: string): Promise<void>;
|
|
265
278
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
export { Builder, CssArtifactType, PandaContext, analyzeTokens, debugFiles, emitArtifacts, execCommand, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
|
|
279
|
+
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,15 +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;
|
|
201
|
-
private
|
|
208
|
+
private filesMeta;
|
|
202
209
|
private affecteds;
|
|
203
|
-
getConfigPath: () => string;
|
|
210
|
+
getConfigPath: (cwd?: string) => string;
|
|
204
211
|
setup: (options?: {
|
|
205
212
|
configPath?: string;
|
|
206
213
|
cwd?: string;
|
|
@@ -215,41 +222,47 @@ declare class Builder {
|
|
|
215
222
|
mtime: number;
|
|
216
223
|
isUnchanged: boolean;
|
|
217
224
|
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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;
|
|
222
231
|
isValidRoot: (root: Root) => boolean;
|
|
223
232
|
private initialRoot;
|
|
224
233
|
write: (root: Root) => void;
|
|
225
234
|
registerDependency: (fn: (dep: Message) => void) => void;
|
|
226
235
|
}
|
|
236
|
+
interface FileMeta {
|
|
237
|
+
mtime: number;
|
|
238
|
+
isUnchanged: boolean;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
|
|
242
|
+
box: string;
|
|
243
|
+
msg: string;
|
|
244
|
+
}>;
|
|
227
245
|
|
|
228
|
-
declare function findConfig(): string | undefined;
|
|
229
246
|
declare function loadConfigAndCreateContext(options?: {
|
|
230
247
|
cwd?: string;
|
|
231
248
|
config?: Config;
|
|
232
249
|
configPath?: string;
|
|
233
250
|
}): Promise<PandaContext>;
|
|
234
251
|
|
|
235
|
-
|
|
252
|
+
interface CssGenOptions {
|
|
253
|
+
cwd: string;
|
|
254
|
+
outfile?: string;
|
|
255
|
+
type?: CssArtifactType;
|
|
256
|
+
minimal?: boolean;
|
|
257
|
+
}
|
|
258
|
+
declare const cssgen: (ctx: PandaContext, options: CssGenOptions) => Promise<void>;
|
|
259
|
+
|
|
260
|
+
interface DebugOptions {
|
|
236
261
|
outdir: string;
|
|
237
262
|
dry: boolean;
|
|
238
263
|
onlyConfig?: boolean;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
declare function emitArtifacts(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
|
|
242
|
-
box: string;
|
|
243
|
-
msg: string;
|
|
244
|
-
}>;
|
|
245
|
-
|
|
246
|
-
declare function execCommand(cmd: string, cwd: string): Promise<void>;
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Parse a file and return the corresponding css
|
|
250
|
-
*/
|
|
251
|
-
declare function extractFile(ctx: PandaContext, filePath: string): ParserResult | undefined;
|
|
252
|
-
type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
|
|
264
|
+
}
|
|
265
|
+
declare function debug(ctx: PandaContext, options: DebugOptions): Promise<void>;
|
|
253
266
|
|
|
254
267
|
declare function generate(config: Config, configPath?: string): Promise<void>;
|
|
255
268
|
|
|
@@ -263,6 +276,4 @@ type SetupOptions = Partial<Config> & {
|
|
|
263
276
|
declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
|
|
264
277
|
declare function setupPostcss(cwd: string): Promise<void>;
|
|
265
278
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
export { Builder, CssArtifactType, PandaContext, analyzeTokens, debugFiles, emitArtifacts, execCommand, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
|
|
279
|
+
export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, writeAnalyzeJSON };
|