@pandacss/node 0.3.2 → 0.5.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.
@@ -0,0 +1,246 @@
1
+ export { discardDuplicate } from '@pandacss/core';
2
+ import * as _pandacss_types from '@pandacss/types';
3
+ import { PandaHookable, Artifact, ConfigResultWithHooks, ParserResultType, Config } from '@pandacss/types';
4
+ import { Generator } from '@pandacss/generator';
5
+ import { Project } from '@pandacss/parser';
6
+ import { Runtime } from '@pandacss/types/src/runtime';
7
+ import { Root, Message } from 'postcss';
8
+
9
+ declare const getChunkEngine: ({ paths, config, runtime: { path, fs }, }: Generator & {
10
+ runtime: Runtime;
11
+ hooks: PandaHookable;
12
+ }) => {
13
+ dir: string;
14
+ readFile(file: string): string;
15
+ getFiles(): string[];
16
+ format(file: string): string;
17
+ getArtifact(file: string, css: string): Artifact;
18
+ rm(file: string): void;
19
+ empty(): void;
20
+ readonly glob: string[];
21
+ };
22
+
23
+ declare const getOutputEngine: ({ paths, runtime: { path, fs }, }: Generator & {
24
+ runtime: Runtime;
25
+ hooks: PandaHookable;
26
+ }) => {
27
+ empty(): void;
28
+ write(output: Artifact | undefined): Promise<void[] | undefined>;
29
+ };
30
+
31
+ declare const createContext: (conf: ConfigResultWithHooks) => PandaContext;
32
+ type PandaContext = Generator & {
33
+ runtime: Runtime;
34
+ hooks: PandaHookable;
35
+ project: Project;
36
+ getFiles: () => string[];
37
+ chunks: ReturnType<typeof getChunkEngine>;
38
+ output: ReturnType<typeof getOutputEngine>;
39
+ };
40
+
41
+ type Options = {
42
+ onResult?: (file: string, result: ParserResultType) => void;
43
+ };
44
+ declare function analyzeTokens(ctx: PandaContext, options?: Options): {
45
+ duration: {
46
+ extractTimeByFiles: {
47
+ [k: string]: number;
48
+ };
49
+ extractTotal: number;
50
+ classify: number;
51
+ };
52
+ fileSizes: {
53
+ lineCount: number;
54
+ normal: string | number | any[] | {
55
+ value: any;
56
+ symbol: any;
57
+ exponent: number;
58
+ unit: string;
59
+ };
60
+ minified: string | number | any[] | {
61
+ value: any;
62
+ symbol: any;
63
+ exponent: number;
64
+ unit: string;
65
+ };
66
+ gzip: {
67
+ normal: string | number | any[] | {
68
+ value: any;
69
+ symbol: any;
70
+ exponent: number;
71
+ unit: string;
72
+ };
73
+ minified: string | number | any[] | {
74
+ value: any;
75
+ symbol: any;
76
+ exponent: number;
77
+ unit: string;
78
+ };
79
+ };
80
+ };
81
+ } & {
82
+ counts: {
83
+ filesWithTokens: number;
84
+ propNameUsed: number;
85
+ tokenUsed: number;
86
+ shorthandUsed: number;
87
+ propertyPathUsed: number;
88
+ typeUsed: number;
89
+ instanceNameUsed: number;
90
+ kindUsed: number;
91
+ instanceOfKindUsed: number;
92
+ colorsUsed: number;
93
+ };
94
+ stats: {
95
+ filesWithMostInstance: {
96
+ [k: string]: number;
97
+ };
98
+ filesWithMostPropValueCombinations: {
99
+ [k: string]: number;
100
+ };
101
+ mostUseds: {
102
+ propNames: {
103
+ key: string;
104
+ count: number;
105
+ }[];
106
+ tokens: {
107
+ key: string;
108
+ count: number;
109
+ }[];
110
+ shorthands: {
111
+ key: string;
112
+ count: number;
113
+ }[];
114
+ conditions: {
115
+ key: string;
116
+ count: number;
117
+ }[];
118
+ propertyPaths: {
119
+ key: string;
120
+ count: number;
121
+ }[];
122
+ categories: {
123
+ key: string;
124
+ count: number;
125
+ }[];
126
+ types: {
127
+ key: string;
128
+ count: number;
129
+ }[];
130
+ instanceNames: {
131
+ key: string;
132
+ count: number;
133
+ }[];
134
+ fromKinds: {
135
+ key: string;
136
+ count: number;
137
+ }[];
138
+ instanceOfKinds: {
139
+ key: string;
140
+ count: number;
141
+ }[];
142
+ colors: {
143
+ key: string;
144
+ count: number;
145
+ }[];
146
+ };
147
+ };
148
+ details: {
149
+ byId: Map<number, _pandacss_types.ReportItem>;
150
+ byInstanceId: Map<number, _pandacss_types.ReportInstanceItem>;
151
+ byFilepath: Map<string, Set<number>>;
152
+ byInstanceInFilepath: Map<string, Set<number>>;
153
+ globalMaps: {
154
+ byInstanceOfKind: Map<"function" | "component", Set<number>>;
155
+ byPropertyName: Map<string, Set<number>>;
156
+ byCategory: Map<string, Set<number>>;
157
+ byConditionName: Map<string, Set<number>>;
158
+ byShorthand: Map<string, Set<number>>;
159
+ byTokenName: Map<string, Set<number>>;
160
+ byPropertyPath: Map<string, Set<number>>;
161
+ fromKind: Map<"function" | "component", Set<number>>;
162
+ byType: Map<string, Set<number>>;
163
+ byInstanceName: Map<string, Set<number>>;
164
+ colorsUsed: Map<string, Set<number>>;
165
+ };
166
+ byFilePathMaps: Map<string, {
167
+ byInstanceOfKind: Map<"function" | "component", Set<number>>;
168
+ byPropertyName: Map<string, Set<number>>;
169
+ byCategory: Map<string, Set<number>>;
170
+ byConditionName: Map<string, Set<number>>;
171
+ byShorthand: Map<string, Set<number>>;
172
+ byTokenName: Map<string, Set<number>>;
173
+ byPropertyPath: Map<string, Set<number>>;
174
+ fromKind: Map<"function" | "component", Set<number>>;
175
+ byType: Map<string, Set<number>>;
176
+ byInstanceName: Map<string, Set<number>>;
177
+ colorsUsed: Map<string, Set<number>>;
178
+ }>;
179
+ };
180
+ };
181
+ declare const writeAnalyzeJSON: (fileName: string, result: ReturnType<typeof analyzeTokens>, ctx: PandaContext) => Promise<void>;
182
+
183
+ type ConfigDepsResult = {
184
+ modifiedMap: Map<string, number>;
185
+ isModified: boolean;
186
+ };
187
+ declare class Builder {
188
+ /**
189
+ * The current panda context
190
+ */
191
+ context: PandaContext | undefined;
192
+ writeFileCss(file: string, css: string): void;
193
+ checkConfigDeps(configPath: string, deps: Set<string>): ConfigDepsResult;
194
+ getConfigPath(): string;
195
+ setup(options?: {
196
+ configPath?: string;
197
+ }): Promise<void>;
198
+ setupContext(options: {
199
+ configPath: string;
200
+ depsModifiedMap: Map<string, number>;
201
+ }): Promise<void>;
202
+ getContextOrThrow(): PandaContext;
203
+ get fileModifiedMap(): Map<string, number>;
204
+ get fileCssMap(): Map<string, string>;
205
+ extractFile(ctx: PandaContext, file: string): Promise<string | undefined>;
206
+ extract(): Promise<void>;
207
+ toString(): string;
208
+ isValidRoot(root: Root): boolean;
209
+ write(root: Root): void;
210
+ registerDependency(fn: (dep: Message) => void): void;
211
+ }
212
+
213
+ declare function findConfig(): string | undefined;
214
+ declare function loadConfigAndCreateContext(options?: {
215
+ cwd?: string;
216
+ config?: Config;
217
+ configPath?: string;
218
+ }): Promise<PandaContext>;
219
+
220
+ declare function debugFiles(ctx: PandaContext, options: {
221
+ outdir: string;
222
+ dry: boolean;
223
+ }): Promise<void>;
224
+
225
+ declare function execCommand(cmd: string, cwd: string): Promise<void>;
226
+
227
+ declare function extractFile(ctx: PandaContext, file: string): string | undefined;
228
+ declare function emitArtifacts(ctx: PandaContext): Promise<string>;
229
+ declare function emitAndExtract(ctx: PandaContext): Promise<string>;
230
+ declare function extractCss(ctx: PandaContext): Promise<string>;
231
+
232
+ declare function generate(config: Config, configPath?: string): Promise<void>;
233
+
234
+ declare function parseDependency(fileOrGlob: string): Message | null;
235
+
236
+ declare function setupGitIgnore(ctx: PandaContext): void;
237
+
238
+ type SetupOptions = Partial<Config> & {
239
+ force?: boolean;
240
+ };
241
+ declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
242
+ declare function setupPostcss(cwd: string): Promise<void>;
243
+
244
+ declare function shipFiles(ctx: PandaContext, outfile: string): Promise<void>;
245
+
246
+ export { Builder, PandaContext, analyzeTokens, createContext, debugFiles, emitAndExtract, emitArtifacts, execCommand, extractCss, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
package/dist/index.d.ts CHANGED
@@ -235,9 +235,7 @@ declare function parseDependency(fileOrGlob: string): Message | null;
235
235
 
236
236
  declare function setupGitIgnore(ctx: PandaContext): void;
237
237
 
238
- type SetupOptions = {
239
- outExtension?: string;
240
- jsxFramework?: string;
238
+ type SetupOptions = Partial<Config> & {
241
239
  force?: boolean;
242
240
  };
243
241
  declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
package/dist/index.js CHANGED
@@ -33,15 +33,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "use strict";
39
40
  }
40
41
  });
41
42
 
42
43
  // ../../node_modules/.pnpm/eastasianwidth@0.2.0/node_modules/eastasianwidth/eastasianwidth.js
43
44
  var require_eastasianwidth = __commonJS({
44
45
  "../../node_modules/.pnpm/eastasianwidth@0.2.0/node_modules/eastasianwidth/eastasianwidth.js"(exports, module2) {
46
+ "use strict";
45
47
  init_cjs_shims();
46
48
  var eaw = {};
47
49
  if ("undefined" == typeof module2) {
@@ -903,10 +905,10 @@ var nodeRuntime = {
903
905
  };
904
906
  process.setMaxListeners(Infinity);
905
907
  process.on("unhandledRejection", (reason) => {
906
- import_logger2.logger.error("unhandled-rejection", reason);
908
+ import_logger2.logger.error("\u274C", reason);
907
909
  });
908
910
  process.on("uncaughtException", (reason) => {
909
- import_logger2.logger.error("uncaught-exception", reason);
911
+ import_logger2.logger.error("\u274C", reason);
910
912
  });
911
913
 
912
914
  // src/output-engine.ts
@@ -2723,15 +2725,15 @@ function setupGitIgnore(ctx) {
2723
2725
 
2724
2726
  // src/setup-config.ts
2725
2727
  init_cjs_shims();
2726
- var import_logger8 = require("@pandacss/logger");
2727
2728
  var import_generator2 = require("@pandacss/generator");
2729
+ var import_logger8 = require("@pandacss/logger");
2728
2730
  var import_fs_extra3 = require("fs-extra");
2729
2731
  var import_look_it_up3 = require("look-it-up");
2730
2732
  var import_outdent2 = require("outdent");
2731
2733
  var import_path3 = require("path");
2732
2734
  var import_preferred_pm2 = __toESM(require("preferred-pm"));
2733
2735
  async function setupConfig(cwd, opts = {}) {
2734
- const { force, outExtension, jsxFramework } = opts;
2736
+ const { force, outExtension, jsxFramework, syntax } = opts;
2735
2737
  const configFile = findConfig();
2736
2738
  const pmResult = await (0, import_preferred_pm2.default)(cwd);
2737
2739
  const pm = pmResult?.name ?? "npm";
@@ -2767,6 +2769,9 @@ outExtension: '${outExtension}',` : ""}
2767
2769
  ${jsxFramework ? `
2768
2770
  // The JSX framework to use
2769
2771
  jsxFramework: '${jsxFramework}'` : ""}
2772
+ ${syntax ? `
2773
+ // The CSS Syntax to use to use
2774
+ syntax: '${syntax}'` : ""}
2770
2775
  })
2771
2776
  `;
2772
2777
  await (0, import_fs_extra3.writeFile)((0, import_path3.join)(cwd, file), content);
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
9
9
  }) : x)(function(x) {
10
10
  if (typeof require !== "undefined")
11
11
  return require.apply(this, arguments);
12
- throw new Error('Dynamic require of "' + x + '" is not supported');
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
13
  });
14
14
  var __esm = (fn, res) => function __init() {
15
15
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
@@ -34,15 +34,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  mod
35
35
  ));
36
36
 
37
- // ../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/esm_shims.js
37
+ // ../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/esm_shims.js
38
38
  var init_esm_shims = __esm({
39
- "../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/esm_shims.js"() {
39
+ "../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/esm_shims.js"() {
40
+ "use strict";
40
41
  }
41
42
  });
42
43
 
43
44
  // ../../node_modules/.pnpm/eastasianwidth@0.2.0/node_modules/eastasianwidth/eastasianwidth.js
44
45
  var require_eastasianwidth = __commonJS({
45
46
  "../../node_modules/.pnpm/eastasianwidth@0.2.0/node_modules/eastasianwidth/eastasianwidth.js"(exports, module) {
47
+ "use strict";
46
48
  init_esm_shims();
47
49
  var eaw = {};
48
50
  if ("undefined" == typeof module) {
@@ -890,10 +892,10 @@ var nodeRuntime = {
890
892
  };
891
893
  process.setMaxListeners(Infinity);
892
894
  process.on("unhandledRejection", (reason) => {
893
- logger2.error("unhandled-rejection", reason);
895
+ logger2.error("\u274C", reason);
894
896
  });
895
897
  process.on("uncaughtException", (reason) => {
896
- logger2.error("uncaught-exception", reason);
898
+ logger2.error("\u274C", reason);
897
899
  });
898
900
 
899
901
  // src/output-engine.ts
@@ -2710,15 +2712,15 @@ function setupGitIgnore(ctx) {
2710
2712
 
2711
2713
  // src/setup-config.ts
2712
2714
  init_esm_shims();
2713
- import { logger as logger8, quote } from "@pandacss/logger";
2714
2715
  import { messages } from "@pandacss/generator";
2716
+ import { logger as logger8, quote } from "@pandacss/logger";
2715
2717
  import { writeFile as writeFile3 } from "fs-extra";
2716
2718
  import { lookItUpSync as lookItUpSync3 } from "look-it-up";
2717
2719
  import { outdent as outdent2 } from "outdent";
2718
2720
  import { join as join2 } from "path";
2719
2721
  import getPackageManager2 from "preferred-pm";
2720
2722
  async function setupConfig(cwd, opts = {}) {
2721
- const { force, outExtension, jsxFramework } = opts;
2723
+ const { force, outExtension, jsxFramework, syntax } = opts;
2722
2724
  const configFile = findConfig();
2723
2725
  const pmResult = await getPackageManager2(cwd);
2724
2726
  const pm = pmResult?.name ?? "npm";
@@ -2754,6 +2756,9 @@ outExtension: '${outExtension}',` : ""}
2754
2756
  ${jsxFramework ? `
2755
2757
  // The JSX framework to use
2756
2758
  jsxFramework: '${jsxFramework}'` : ""}
2759
+ ${syntax ? `
2760
+ // The CSS Syntax to use to use
2761
+ syntax: '${syntax}'` : ""}
2757
2762
  })
2758
2763
  `;
2759
2764
  await writeFile3(join2(cwd, file), content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.3.2",
3
+ "version": "0.5.0",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,17 +33,17 @@
33
33
  "preferred-pm": "^3.0.3",
34
34
  "ts-morph": "18.0.0",
35
35
  "ts-pattern": "4.3.0",
36
- "@pandacss/config": "0.3.2",
37
- "@pandacss/core": "0.3.2",
38
- "@pandacss/error": "0.3.2",
39
- "@pandacss/extractor": "0.3.2",
40
- "@pandacss/generator": "0.3.2",
41
- "@pandacss/is-valid-prop": "0.3.2",
42
- "@pandacss/logger": "0.3.2",
43
- "@pandacss/parser": "0.3.2",
44
- "@pandacss/shared": "0.3.2",
45
- "@pandacss/token-dictionary": "0.3.2",
46
- "@pandacss/types": "0.3.2"
36
+ "@pandacss/config": "0.5.0",
37
+ "@pandacss/core": "0.5.0",
38
+ "@pandacss/error": "0.5.0",
39
+ "@pandacss/extractor": "0.5.0",
40
+ "@pandacss/generator": "0.5.0",
41
+ "@pandacss/is-valid-prop": "0.5.0",
42
+ "@pandacss/logger": "0.5.0",
43
+ "@pandacss/parser": "0.5.0",
44
+ "@pandacss/shared": "0.5.0",
45
+ "@pandacss/token-dictionary": "0.5.0",
46
+ "@pandacss/types": "0.5.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/fs-extra": "11.0.1",
@@ -52,7 +52,7 @@
52
52
  "@types/lodash.merge": "4.6.7",
53
53
  "@types/pluralize": "0.0.29",
54
54
  "boxen": "^7.1.0",
55
- "@pandacss/fixture": "0.3.2"
55
+ "@pandacss/fixture": "0.5.0"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",