@pandacss/node 0.21.0 → 0.22.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 CHANGED
@@ -1,33 +1,10 @@
1
1
  import * as _pandacss_types from '@pandacss/types';
2
- import { Artifact, Runtime, PandaHookable, LoadConfigResult, ArtifactId, ConfigResultWithHooks, ParserResultType, Config } from '@pandacss/types';
2
+ import { LoadConfigResult, ArtifactId, Runtime, PandaHookable, Artifact, ConfigResultWithHooks, ParserResultType, Config } from '@pandacss/types';
3
3
  import { Generator } from '@pandacss/generator';
4
- import { PandaProject } from '@pandacss/parser';
4
+ import { PandaProject, ParserResult } from '@pandacss/parser';
5
5
  import { Difference } from 'microdiff';
6
6
  import { Root, Message } from 'postcss';
7
7
 
8
- interface PandaChunksEngine {
9
- dir: string;
10
- readFile(file: string): string;
11
- getFiles(): string[];
12
- format(file: string): string;
13
- getArtifact(file: string, css: string): Artifact;
14
- rm(file: string): void;
15
- empty(): void;
16
- glob: string[];
17
- }
18
-
19
- declare class PandaOutputEngine {
20
- private paths;
21
- private fs;
22
- private path;
23
- constructor({ paths, runtime: { path, fs } }: Generator & {
24
- runtime: Runtime;
25
- hooks: PandaHookable;
26
- });
27
- empty(): void;
28
- write(output: Artifact | undefined): Promise<PromiseSettledResult<void>[] | undefined>;
29
- }
30
-
31
8
  interface DiffConfigResult {
32
9
  hasConfigChanged: boolean;
33
10
  artifacts: Set<ArtifactId>;
@@ -49,14 +26,28 @@ declare class DiffEngine {
49
26
  refresh(conf: LoadConfigResult, fn?: (conf: LoadConfigResult) => void): DiffConfigResult;
50
27
  }
51
28
 
29
+ declare class PandaOutputEngine {
30
+ private paths;
31
+ private fs;
32
+ private path;
33
+ constructor({ paths, runtime: { path, fs } }: Generator & {
34
+ runtime: Runtime;
35
+ hooks: PandaHookable;
36
+ });
37
+ empty(): void;
38
+ write(output: Artifact | undefined): Promise<PromiseSettledResult<void>[] | undefined>;
39
+ }
40
+
52
41
  declare class PandaContext extends Generator {
53
42
  runtime: Runtime;
54
43
  project: PandaProject;
55
44
  getFiles: () => string[];
56
- chunks: PandaChunksEngine;
57
45
  output: PandaOutputEngine;
58
46
  diff: DiffEngine;
59
47
  constructor(conf: ConfigResultWithHooks);
48
+ appendFilesCss(): string[];
49
+ appendAllCss(): void;
50
+ writeCss(): Promise<PromiseSettledResult<void>[] | undefined>;
60
51
  }
61
52
 
62
53
  interface Options {
@@ -207,7 +198,6 @@ declare class Builder {
207
198
  */
208
199
  context: PandaContext | undefined;
209
200
  private hasEmitted;
210
- private hasConfigChanged;
211
201
  private affecteds;
212
202
  getConfigPath: () => string;
213
203
  setup: (options?: {
@@ -220,10 +210,16 @@ declare class Builder {
220
210
  cwd?: string;
221
211
  }) => Promise<PandaContext>;
222
212
  getContextOrThrow: () => PandaContext;
223
- extractFile: (ctx: PandaContext, file: string) => Promise<string | undefined>;
213
+ getFileMeta: (file: string) => {
214
+ mtime: number;
215
+ isUnchanged: boolean;
216
+ };
217
+ extractFile: (ctx: PandaContext, file: string) => Promise<ParserResult | undefined>;
218
+ checkFilesChanged(files: string[]): boolean;
224
219
  extract: () => Promise<void>;
225
220
  toString: () => string;
226
221
  isValidRoot: (root: Root) => boolean;
222
+ private initialRoot;
227
223
  write: (root: Root) => void;
228
224
  registerDependency: (fn: (dep: Message) => void) => void;
229
225
  }
@@ -241,48 +237,18 @@ declare function debugFiles(ctx: PandaContext, options: {
241
237
  onlyConfig?: boolean;
242
238
  }): Promise<void>;
243
239
 
244
- declare function execCommand(cmd: string, cwd: string): Promise<void>;
245
-
246
- /**
247
- * Parse a file and return the corresponding css
248
- */
249
- declare function extractFile(ctx: PandaContext, file: string): string | undefined;
250
240
  declare function emitArtifacts(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
251
241
  box: string;
252
242
  msg: string;
253
243
  }>;
244
+
245
+ declare function execCommand(cmd: string, cwd: string): Promise<void>;
246
+
254
247
  /**
255
- * Writes all the css chunks in outdir/chunks/{file}.css
256
- * and bundles them in outdir/styles.css
257
- */
258
- declare function writeAndBundleCssChunks(ctx: PandaContext): Promise<{
259
- files: string[];
260
- msg: string;
261
- }>;
262
- /**
263
- * Bundles all the included files CSS into the given outfile
264
- * Including the root CSS artifact files content (global, static, reset, tokens, keyframes)
265
- * Without any imports
266
- */
267
- declare function bundleCss(ctx: PandaContext, outfile: string): Promise<{
268
- files: string[];
269
- msg: string;
270
- }>;
271
- /**
272
- * Bundles all the files CSS into outdir/chunks/{file}.css
273
- * Without writing any chunks or needing any imports
248
+ * Parse a file and return the corresponding css
274
249
  */
275
- declare function bundleMinimalFilesCss(ctx: PandaContext, outfile: string): Promise<{
276
- files: string[];
277
- msg: string;
278
- }>;
250
+ declare function extractFile(ctx: PandaContext, filePath: string): ParserResult | undefined;
279
251
  type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
280
- /**
281
- * Generates the CSS for a given artifact type
282
- */
283
- declare function generateCssArtifactOfType(ctx: PandaContext, cssType: CssArtifactType, outfile: string): Promise<{
284
- msg: string;
285
- }>;
286
252
 
287
253
  declare function generate(config: Config, configPath?: string): Promise<void>;
288
254
 
@@ -298,4 +264,4 @@ declare function setupPostcss(cwd: string): Promise<void>;
298
264
 
299
265
  declare function shipFiles(ctx: PandaContext, outfile: string): Promise<void>;
300
266
 
301
- export { Builder, CssArtifactType, PandaContext, analyzeTokens, bundleCss, bundleMinimalFilesCss, debugFiles, emitArtifacts, execCommand, extractFile, findConfig, generate, generateCssArtifactOfType, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON, writeAndBundleCssChunks };
267
+ export { Builder, CssArtifactType, PandaContext, analyzeTokens, debugFiles, emitArtifacts, execCommand, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
package/dist/index.d.ts CHANGED
@@ -1,33 +1,10 @@
1
1
  import * as _pandacss_types from '@pandacss/types';
2
- import { Artifact, Runtime, PandaHookable, LoadConfigResult, ArtifactId, ConfigResultWithHooks, ParserResultType, Config } from '@pandacss/types';
2
+ import { LoadConfigResult, ArtifactId, Runtime, PandaHookable, Artifact, ConfigResultWithHooks, ParserResultType, Config } from '@pandacss/types';
3
3
  import { Generator } from '@pandacss/generator';
4
- import { PandaProject } from '@pandacss/parser';
4
+ import { PandaProject, ParserResult } from '@pandacss/parser';
5
5
  import { Difference } from 'microdiff';
6
6
  import { Root, Message } from 'postcss';
7
7
 
8
- interface PandaChunksEngine {
9
- dir: string;
10
- readFile(file: string): string;
11
- getFiles(): string[];
12
- format(file: string): string;
13
- getArtifact(file: string, css: string): Artifact;
14
- rm(file: string): void;
15
- empty(): void;
16
- glob: string[];
17
- }
18
-
19
- declare class PandaOutputEngine {
20
- private paths;
21
- private fs;
22
- private path;
23
- constructor({ paths, runtime: { path, fs } }: Generator & {
24
- runtime: Runtime;
25
- hooks: PandaHookable;
26
- });
27
- empty(): void;
28
- write(output: Artifact | undefined): Promise<PromiseSettledResult<void>[] | undefined>;
29
- }
30
-
31
8
  interface DiffConfigResult {
32
9
  hasConfigChanged: boolean;
33
10
  artifacts: Set<ArtifactId>;
@@ -49,14 +26,28 @@ declare class DiffEngine {
49
26
  refresh(conf: LoadConfigResult, fn?: (conf: LoadConfigResult) => void): DiffConfigResult;
50
27
  }
51
28
 
29
+ declare class PandaOutputEngine {
30
+ private paths;
31
+ private fs;
32
+ private path;
33
+ constructor({ paths, runtime: { path, fs } }: Generator & {
34
+ runtime: Runtime;
35
+ hooks: PandaHookable;
36
+ });
37
+ empty(): void;
38
+ write(output: Artifact | undefined): Promise<PromiseSettledResult<void>[] | undefined>;
39
+ }
40
+
52
41
  declare class PandaContext extends Generator {
53
42
  runtime: Runtime;
54
43
  project: PandaProject;
55
44
  getFiles: () => string[];
56
- chunks: PandaChunksEngine;
57
45
  output: PandaOutputEngine;
58
46
  diff: DiffEngine;
59
47
  constructor(conf: ConfigResultWithHooks);
48
+ appendFilesCss(): string[];
49
+ appendAllCss(): void;
50
+ writeCss(): Promise<PromiseSettledResult<void>[] | undefined>;
60
51
  }
61
52
 
62
53
  interface Options {
@@ -207,7 +198,6 @@ declare class Builder {
207
198
  */
208
199
  context: PandaContext | undefined;
209
200
  private hasEmitted;
210
- private hasConfigChanged;
211
201
  private affecteds;
212
202
  getConfigPath: () => string;
213
203
  setup: (options?: {
@@ -220,10 +210,16 @@ declare class Builder {
220
210
  cwd?: string;
221
211
  }) => Promise<PandaContext>;
222
212
  getContextOrThrow: () => PandaContext;
223
- extractFile: (ctx: PandaContext, file: string) => Promise<string | undefined>;
213
+ getFileMeta: (file: string) => {
214
+ mtime: number;
215
+ isUnchanged: boolean;
216
+ };
217
+ extractFile: (ctx: PandaContext, file: string) => Promise<ParserResult | undefined>;
218
+ checkFilesChanged(files: string[]): boolean;
224
219
  extract: () => Promise<void>;
225
220
  toString: () => string;
226
221
  isValidRoot: (root: Root) => boolean;
222
+ private initialRoot;
227
223
  write: (root: Root) => void;
228
224
  registerDependency: (fn: (dep: Message) => void) => void;
229
225
  }
@@ -241,48 +237,18 @@ declare function debugFiles(ctx: PandaContext, options: {
241
237
  onlyConfig?: boolean;
242
238
  }): Promise<void>;
243
239
 
244
- declare function execCommand(cmd: string, cwd: string): Promise<void>;
245
-
246
- /**
247
- * Parse a file and return the corresponding css
248
- */
249
- declare function extractFile(ctx: PandaContext, file: string): string | undefined;
250
240
  declare function emitArtifacts(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
251
241
  box: string;
252
242
  msg: string;
253
243
  }>;
244
+
245
+ declare function execCommand(cmd: string, cwd: string): Promise<void>;
246
+
254
247
  /**
255
- * Writes all the css chunks in outdir/chunks/{file}.css
256
- * and bundles them in outdir/styles.css
257
- */
258
- declare function writeAndBundleCssChunks(ctx: PandaContext): Promise<{
259
- files: string[];
260
- msg: string;
261
- }>;
262
- /**
263
- * Bundles all the included files CSS into the given outfile
264
- * Including the root CSS artifact files content (global, static, reset, tokens, keyframes)
265
- * Without any imports
266
- */
267
- declare function bundleCss(ctx: PandaContext, outfile: string): Promise<{
268
- files: string[];
269
- msg: string;
270
- }>;
271
- /**
272
- * Bundles all the files CSS into outdir/chunks/{file}.css
273
- * Without writing any chunks or needing any imports
248
+ * Parse a file and return the corresponding css
274
249
  */
275
- declare function bundleMinimalFilesCss(ctx: PandaContext, outfile: string): Promise<{
276
- files: string[];
277
- msg: string;
278
- }>;
250
+ declare function extractFile(ctx: PandaContext, filePath: string): ParserResult | undefined;
279
251
  type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
280
- /**
281
- * Generates the CSS for a given artifact type
282
- */
283
- declare function generateCssArtifactOfType(ctx: PandaContext, cssType: CssArtifactType, outfile: string): Promise<{
284
- msg: string;
285
- }>;
286
252
 
287
253
  declare function generate(config: Config, configPath?: string): Promise<void>;
288
254
 
@@ -298,4 +264,4 @@ declare function setupPostcss(cwd: string): Promise<void>;
298
264
 
299
265
  declare function shipFiles(ctx: PandaContext, outfile: string): Promise<void>;
300
266
 
301
- export { Builder, CssArtifactType, PandaContext, analyzeTokens, bundleCss, bundleMinimalFilesCss, debugFiles, emitArtifacts, execCommand, extractFile, findConfig, generate, generateCssArtifactOfType, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON, writeAndBundleCssChunks };
267
+ export { Builder, CssArtifactType, PandaContext, analyzeTokens, debugFiles, emitArtifacts, execCommand, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };