@pandacss/node 0.6.0 → 0.8.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  export { discardDuplicate } from '@pandacss/core';
2
2
  import * as _pandacss_types from '@pandacss/types';
3
- import { PandaHookable, Artifact, ConfigResultWithHooks, ParserResultType, Config } from '@pandacss/types';
3
+ import { PandaHookable, Artifact, ConfigResultWithHooks, Runtime as Runtime$1, ParserResultType, Config } from '@pandacss/types';
4
4
  import { Generator } from '@pandacss/generator';
5
5
  import { Project } from '@pandacss/parser';
6
6
  import { Runtime } from '@pandacss/types/src/runtime';
@@ -30,7 +30,7 @@ declare const getOutputEngine: ({ paths, runtime: { path, fs }, }: Generator & {
30
30
 
31
31
  declare const createContext: (conf: ConfigResultWithHooks) => PandaContext;
32
32
  type PandaContext = Generator & {
33
- runtime: Runtime;
33
+ runtime: Runtime$1;
34
34
  hooks: PandaHookable;
35
35
  project: Project;
36
36
  getFiles: () => string[];
@@ -189,6 +189,7 @@ declare class Builder {
189
189
  * The current panda context
190
190
  */
191
191
  context: PandaContext | undefined;
192
+ configDependencies: Set<string>;
192
193
  writeFileCss(file: string, css: string): void;
193
194
  checkConfigDeps(configPath: string, deps: Set<string>): ConfigDepsResult;
194
195
  getConfigPath(): string;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { discardDuplicate } from '@pandacss/core';
2
2
  import * as _pandacss_types from '@pandacss/types';
3
- import { PandaHookable, Artifact, ConfigResultWithHooks, ParserResultType, Config } from '@pandacss/types';
3
+ import { PandaHookable, Artifact, ConfigResultWithHooks, Runtime as Runtime$1, ParserResultType, Config } from '@pandacss/types';
4
4
  import { Generator } from '@pandacss/generator';
5
5
  import { Project } from '@pandacss/parser';
6
6
  import { Runtime } from '@pandacss/types/src/runtime';
@@ -30,7 +30,7 @@ declare const getOutputEngine: ({ paths, runtime: { path, fs }, }: Generator & {
30
30
 
31
31
  declare const createContext: (conf: ConfigResultWithHooks) => PandaContext;
32
32
  type PandaContext = Generator & {
33
- runtime: Runtime;
33
+ runtime: Runtime$1;
34
34
  hooks: PandaHookable;
35
35
  project: Project;
36
36
  getFiles: () => string[];
@@ -189,6 +189,7 @@ declare class Builder {
189
189
  * The current panda context
190
190
  */
191
191
  context: PandaContext | undefined;
192
+ configDependencies: Set<string>;
192
193
  writeFileCss(file: string, css: string): void;
193
194
  checkConfigDeps(configPath: string, deps: Set<string>): ConfigDepsResult;
194
195
  getConfigPath(): string;
package/dist/index.js CHANGED
@@ -33,9 +33,9 @@ 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@7.1.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.25_typescript@5.1.6/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@7.1.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.25_typescript@5.1.6/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -798,7 +798,6 @@ var import_tsconfck = require("tsconfck");
798
798
  init_cjs_shims();
799
799
  var import_generator = require("@pandacss/generator");
800
800
  var import_parser = require("@pandacss/parser");
801
- var import_lil_fp = require("lil-fp");
802
801
 
803
802
  // src/chunk-engine.ts
804
803
  init_cjs_shims();
@@ -939,29 +938,29 @@ var getOutputEngine = ({
939
938
  });
940
939
 
941
940
  // src/create-context.ts
942
- var createContext = (conf) => (0, import_lil_fp.pipe)(
943
- conf,
944
- import_generator.createGenerator,
945
- import_lil_fp.Obj.assign({ runtime: nodeRuntime, hooks: conf.hooks }),
946
- (0, import_lil_fp.tap)(({ config, runtime }) => {
947
- config.cwd ||= runtime.cwd();
948
- }),
949
- import_lil_fp.Obj.bind("getFiles", ({ config, runtime: { fs } }) => () => {
950
- const { include, exclude, cwd } = config;
951
- return fs.glob({ include, exclude, cwd });
952
- }),
953
- import_lil_fp.Obj.bind("project", ({ getFiles, runtime: { fs }, parserOptions }) => {
954
- return (0, import_parser.createProject)({
941
+ var createContext = (conf) => {
942
+ const generator = (0, import_generator.createGenerator)(conf);
943
+ const config = conf.config;
944
+ const runtime = nodeRuntime;
945
+ config.cwd ||= runtime.cwd();
946
+ const { include, exclude, cwd } = config;
947
+ const getFiles = () => runtime.fs.glob({ include, exclude, cwd });
948
+ const ctx = {
949
+ ...conf,
950
+ ...generator,
951
+ runtime: nodeRuntime,
952
+ hooks: conf.hooks,
953
+ getFiles,
954
+ project: (0, import_parser.createProject)({
955
955
  ...conf.tsconfig,
956
956
  getFiles,
957
- readFile: fs.readFileSync,
957
+ readFile: runtime.fs.readFileSync,
958
958
  hooks: conf.hooks,
959
- parserOptions
960
- });
961
- }),
962
- import_lil_fp.Obj.bind("chunks", getChunkEngine),
963
- import_lil_fp.Obj.bind("output", getOutputEngine)
964
- );
959
+ parserOptions: { join: runtime.path.join, ...generator.parserOptions }
960
+ })
961
+ };
962
+ return Object.assign(ctx, { chunks: getChunkEngine(ctx), output: getOutputEngine(ctx) });
963
+ };
965
964
 
966
965
  // src/config.ts
967
966
  var configs = [".ts", ".js", ".mjs", ".cjs"];
@@ -987,6 +986,11 @@ async function loadConfigAndCreateContext(options = {}) {
987
986
  if (tsconfigResult) {
988
987
  conf.tsconfig = tsconfigResult.tsconfig;
989
988
  conf.tsconfigFile = tsconfigResult.tsconfigFile;
989
+ const options2 = tsconfigResult.tsconfig?.compilerOptions;
990
+ if (options2?.paths) {
991
+ const baseUrl = options2.baseUrl;
992
+ conf.tsOptions = { baseUrl, pathMappings: (0, import_config.convertTsPathsToRegexes)(options2.paths, baseUrl ?? cwd) };
993
+ }
990
994
  }
991
995
  conf.config.outdir ??= "styled-system";
992
996
  if (conf.config.hooks) {
@@ -1002,12 +1006,12 @@ async function loadConfigAndCreateContext(options = {}) {
1002
1006
  // src/extract.ts
1003
1007
  init_cjs_shims();
1004
1008
  var import_logger3 = require("@pandacss/logger");
1005
- var import_lil_fp2 = require("lil-fp");
1009
+ var import_lil_fp = require("lil-fp");
1006
1010
 
1007
1011
  // src/cli-box.ts
1008
1012
  init_cjs_shims();
1009
1013
 
1010
- // ../../node_modules/.pnpm/boxen@7.1.0/node_modules/boxen/index.js
1014
+ // ../../node_modules/.pnpm/boxen@7.1.1/node_modules/boxen/index.js
1011
1015
  init_cjs_shims();
1012
1016
  var import_node_process2 = __toESM(require("process"), 1);
1013
1017
 
@@ -1583,7 +1587,7 @@ function widestLine(string) {
1583
1587
  return lineWidth;
1584
1588
  }
1585
1589
 
1586
- // ../../node_modules/.pnpm/boxen@7.1.0/node_modules/boxen/index.js
1590
+ // ../../node_modules/.pnpm/boxen@7.1.1/node_modules/boxen/index.js
1587
1591
  var import_cli_boxes = __toESM(require_cli_boxes(), 1);
1588
1592
 
1589
1593
  // ../../node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
@@ -1669,7 +1673,7 @@ function camelCase(input, options) {
1669
1673
  return postProcess(input, toUpperCase);
1670
1674
  }
1671
1675
 
1672
- // ../../node_modules/.pnpm/boxen@7.1.0/node_modules/boxen/index.js
1676
+ // ../../node_modules/.pnpm/boxen@7.1.1/node_modules/boxen/index.js
1673
1677
  var import_ansi_align = __toESM(require_ansi_align(), 1);
1674
1678
 
1675
1679
  // ../../node_modules/.pnpm/wrap-ansi@8.1.0/node_modules/wrap-ansi/index.js
@@ -2013,11 +2017,11 @@ function wrapAnsi(string, columns, options) {
2013
2017
  return String(string).normalize().replace(/\r\n/g, "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
2014
2018
  }
2015
2019
 
2016
- // ../../node_modules/.pnpm/boxen@7.1.0/node_modules/boxen/index.js
2020
+ // ../../node_modules/.pnpm/boxen@7.1.1/node_modules/boxen/index.js
2017
2021
  var import_cli_boxes2 = __toESM(require_cli_boxes(), 1);
2018
2022
  var NEWLINE = "\n";
2019
2023
  var PAD = " ";
2020
- var BORDERS_WIDTH = 2;
2024
+ var NONE = "none";
2021
2025
  var terminalColumns = () => {
2022
2026
  const { env: env2, stdout, stderr } = import_node_process2.default;
2023
2027
  if (stdout?.columns) {
@@ -2043,6 +2047,7 @@ var getObject = (detail) => typeof detail === "number" ? {
2043
2047
  left: 0,
2044
2048
  ...detail
2045
2049
  };
2050
+ var getBorderWidth = (borderStyle) => borderStyle === NONE ? 0 : 2;
2046
2051
  var getBorderChars = (borderStyle) => {
2047
2052
  const sides = [
2048
2053
  "topLeft",
@@ -2055,7 +2060,7 @@ var getBorderChars = (borderStyle) => {
2055
2060
  "bottom"
2056
2061
  ];
2057
2062
  let characters;
2058
- if (borderStyle === "none") {
2063
+ if (borderStyle === NONE) {
2059
2064
  borderStyle = {};
2060
2065
  for (const side of sides) {
2061
2066
  borderStyle[side] = "";
@@ -2084,10 +2089,10 @@ var getBorderChars = (borderStyle) => {
2084
2089
  }
2085
2090
  return characters;
2086
2091
  };
2087
- var makeTitle = (text, horizontal, alignement) => {
2092
+ var makeTitle = (text, horizontal, alignment) => {
2088
2093
  let title = "";
2089
2094
  const textWidth = stringWidth(text);
2090
- switch (alignement) {
2095
+ switch (alignment) {
2091
2096
  case "left": {
2092
2097
  title = text + horizontal.slice(textWidth);
2093
2098
  break;
@@ -2190,17 +2195,28 @@ var boxContent = (content, contentWidth, options) => {
2190
2195
  const columns = terminalColumns();
2191
2196
  let marginLeft = PAD.repeat(options.margin.left);
2192
2197
  if (options.float === "center") {
2193
- const marginWidth = Math.max((columns - contentWidth - BORDERS_WIDTH) / 2, 0);
2198
+ const marginWidth = Math.max((columns - contentWidth - getBorderWidth(options.borderStyle)) / 2, 0);
2194
2199
  marginLeft = PAD.repeat(marginWidth);
2195
2200
  } else if (options.float === "right") {
2196
- const marginWidth = Math.max(columns - contentWidth - options.margin.right - BORDERS_WIDTH, 0);
2201
+ const marginWidth = Math.max(columns - contentWidth - options.margin.right - getBorderWidth(options.borderStyle), 0);
2197
2202
  marginLeft = PAD.repeat(marginWidth);
2198
2203
  }
2199
- const top = colorizeBorder(NEWLINE.repeat(options.margin.top) + marginLeft + chars.topLeft + (options.title ? makeTitle(options.title, chars.top.repeat(contentWidth), options.titleAlignment) : chars.top.repeat(contentWidth)) + chars.topRight);
2200
- const bottom = colorizeBorder(marginLeft + chars.bottomLeft + chars.bottom.repeat(contentWidth) + chars.bottomRight + NEWLINE.repeat(options.margin.bottom));
2204
+ let result = "";
2205
+ if (options.margin.top) {
2206
+ result += NEWLINE.repeat(options.margin.top);
2207
+ }
2208
+ if (options.borderStyle !== NONE || options.title) {
2209
+ result += colorizeBorder(marginLeft + chars.topLeft + (options.title ? makeTitle(options.title, chars.top.repeat(contentWidth), options.titleAlignment) : chars.top.repeat(contentWidth)) + chars.topRight) + NEWLINE;
2210
+ }
2201
2211
  const lines = content.split(NEWLINE);
2202
- const middle = lines.map((line) => marginLeft + colorizeBorder(chars.left) + colorizeContent(line) + colorizeBorder(chars.right)).join(NEWLINE);
2203
- return top + NEWLINE + middle + NEWLINE + bottom;
2212
+ result += lines.map((line) => marginLeft + colorizeBorder(chars.left) + colorizeContent(line) + colorizeBorder(chars.right)).join(NEWLINE);
2213
+ if (options.borderStyle !== NONE) {
2214
+ result += NEWLINE + colorizeBorder(marginLeft + chars.bottomLeft + chars.bottom.repeat(contentWidth) + chars.bottomRight);
2215
+ }
2216
+ if (options.margin.bottom) {
2217
+ result += NEWLINE.repeat(options.margin.bottom);
2218
+ }
2219
+ return result;
2204
2220
  };
2205
2221
  var sanitizeOptions = (options) => {
2206
2222
  if (options.fullscreen && import_node_process2.default?.stdout) {
@@ -2216,28 +2232,30 @@ var sanitizeOptions = (options) => {
2216
2232
  }
2217
2233
  }
2218
2234
  if (options.width) {
2219
- options.width = Math.max(1, options.width - BORDERS_WIDTH);
2235
+ options.width = Math.max(1, options.width - getBorderWidth(options.borderStyle));
2220
2236
  }
2221
2237
  if (options.height) {
2222
- options.height = Math.max(1, options.height - BORDERS_WIDTH);
2238
+ options.height = Math.max(1, options.height - getBorderWidth(options.borderStyle));
2223
2239
  }
2224
2240
  return options;
2225
2241
  };
2242
+ var formatTitle = (title, borderStyle) => borderStyle === NONE ? title : ` ${title} `;
2226
2243
  var determineDimensions = (text, options) => {
2227
2244
  options = sanitizeOptions(options);
2228
2245
  const widthOverride = options.width !== void 0;
2229
2246
  const columns = terminalColumns();
2230
- const maxWidth = columns - options.margin.left - options.margin.right - BORDERS_WIDTH;
2231
- const widest = widestLine(wrapAnsi(text, columns - BORDERS_WIDTH, { hard: true, trim: false })) + options.padding.left + options.padding.right;
2247
+ const borderWidth = getBorderWidth(options.borderStyle);
2248
+ const maxWidth = columns - options.margin.left - options.margin.right - borderWidth;
2249
+ const widest = widestLine(wrapAnsi(text, columns - borderWidth, { hard: true, trim: false })) + options.padding.left + options.padding.right;
2232
2250
  if (options.title && widthOverride) {
2233
2251
  options.title = options.title.slice(0, Math.max(0, options.width - 2));
2234
2252
  if (options.title) {
2235
- options.title = ` ${options.title} `;
2253
+ options.title = formatTitle(options.title, options.borderStyle);
2236
2254
  }
2237
2255
  } else if (options.title) {
2238
2256
  options.title = options.title.slice(0, Math.max(0, maxWidth - 2));
2239
2257
  if (options.title) {
2240
- options.title = ` ${options.title} `;
2258
+ options.title = formatTitle(options.title, options.borderStyle);
2241
2259
  if (stringWidth(options.title) > widest) {
2242
2260
  options.width = stringWidth(options.title);
2243
2261
  }
@@ -2246,12 +2264,12 @@ var determineDimensions = (text, options) => {
2246
2264
  options.width = options.width ? options.width : widest;
2247
2265
  if (!widthOverride) {
2248
2266
  if (options.margin.left && options.margin.right && options.width > maxWidth) {
2249
- const spaceForMargins = columns - options.width - BORDERS_WIDTH;
2267
+ const spaceForMargins = columns - options.width - borderWidth;
2250
2268
  const multiplier = spaceForMargins / (options.margin.left + options.margin.right);
2251
2269
  options.margin.left = Math.max(0, Math.floor(options.margin.left * multiplier));
2252
2270
  options.margin.right = Math.max(0, Math.floor(options.margin.right * multiplier));
2253
2271
  }
2254
- options.width = Math.min(options.width, columns - BORDERS_WIDTH - options.margin.left - options.margin.right);
2272
+ options.width = Math.min(options.width, columns - borderWidth - options.margin.left - options.margin.right);
2255
2273
  }
2256
2274
  if (options.width - (options.padding.left + options.padding.right) <= 0) {
2257
2275
  options.padding.left = 0;
@@ -2326,21 +2344,21 @@ function extractFile(ctx, file) {
2326
2344
  runtime: { path: path2 },
2327
2345
  config: { cwd }
2328
2346
  } = ctx;
2329
- return (0, import_lil_fp2.pipe)(
2347
+ return (0, import_lil_fp.pipe)(
2330
2348
  { file: path2.abs(cwd, file) },
2331
- (0, import_lil_fp2.tap)(() => import_logger3.logger.debug("file:extract", file)),
2332
- import_lil_fp2.Obj.bind("measure", () => import_logger3.logger.time.debug(`Extracted ${file}`)),
2333
- import_lil_fp2.Obj.bind(
2349
+ (0, import_lil_fp.tap)(() => import_logger3.logger.debug("file:extract", file)),
2350
+ import_lil_fp.Obj.bind("measure", () => import_logger3.logger.time.debug(`Extracted ${file}`)),
2351
+ import_lil_fp.Obj.bind(
2334
2352
  "result",
2335
- (0, import_lil_fp2.tryCatch)(
2353
+ (0, import_lil_fp.tryCatch)(
2336
2354
  ({ file: file2 }) => ctx.project.parseSourceFile(file2),
2337
2355
  (error) => import_logger3.logger.error("file:parse", error)
2338
2356
  )
2339
2357
  ),
2340
- import_lil_fp2.Obj.bind("measureCss", () => import_logger3.logger.time.debug(`Parsed ${file}`)),
2341
- import_lil_fp2.Obj.bind("css", ({ result }) => result ? ctx.getParserCss(result) : void 0),
2342
- (0, import_lil_fp2.tap)(({ measure, measureCss }) => [measureCss(), measure()]),
2343
- import_lil_fp2.Obj.get("css")
2358
+ import_lil_fp.Obj.bind("measureCss", () => import_logger3.logger.time.debug(`Parsed ${file}`)),
2359
+ import_lil_fp.Obj.bind("css", ({ result }) => result ? ctx.getParserCss(result) : void 0),
2360
+ (0, import_lil_fp.tap)(({ measure, measureCss }) => [measureCss(), measure()]),
2361
+ import_lil_fp.Obj.get("css")
2344
2362
  );
2345
2363
  }
2346
2364
  function extractFiles(ctx) {
@@ -2426,11 +2444,13 @@ function parseDependency(fileOrGlob) {
2426
2444
  var configCache = /* @__PURE__ */ new Map();
2427
2445
  var contentFilesCache = /* @__PURE__ */ new WeakMap();
2428
2446
  var setupCount = 0;
2447
+ var layersName = ["reset", "base", "tokens", "recipes", "utilities"];
2429
2448
  var Builder = class {
2430
2449
  /**
2431
2450
  * The current panda context
2432
2451
  */
2433
2452
  context;
2453
+ configDependencies = /* @__PURE__ */ new Set();
2434
2454
  writeFileCss(file, css) {
2435
2455
  const oldCss = this.fileCssMap?.get(file) ?? "";
2436
2456
  const newCss = (0, import_core2.mergeCss)(oldCss, css);
@@ -2468,18 +2488,12 @@ var Builder = class {
2468
2488
  async setup(options = {}) {
2469
2489
  import_logger4.logger.debug("builder", "\u{1F6A7} Setup");
2470
2490
  const configPath = options.configPath ?? this.getConfigPath();
2471
- let tsOptions = { baseUrl: void 0, pathMappings: [] };
2472
- if (this.context?.tsconfig) {
2473
- const options2 = this.context.tsconfig.compilerOptions;
2474
- if (options2?.paths) {
2475
- const baseUrl = options2.baseUrl;
2476
- tsOptions = {
2477
- baseUrl,
2478
- pathMappings: (0, import_config2.convertTsPathsToRegexes)(options2?.paths, baseUrl ?? this.context.config.cwd)
2479
- };
2480
- }
2481
- }
2482
- const { deps: configDeps } = (0, import_config2.getConfigDependencies)(configPath, tsOptions);
2491
+ const tsOptions = this.context?.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2492
+ const compilerOptions = this.context?.tsconfig?.compilerOptions ?? {};
2493
+ const { deps: foundDeps } = (0, import_config2.getConfigDependencies)(configPath, tsOptions, compilerOptions);
2494
+ const cwd = this.context?.config.cwd ?? (0, import_path2.dirname)(configPath);
2495
+ const configDeps = /* @__PURE__ */ new Set([...foundDeps, ...(this.context?.dependencies ?? []).map((file) => (0, import_path2.resolve)(cwd, file))]);
2496
+ this.configDependencies = configDeps;
2483
2497
  const deps = this.checkConfigDeps(configPath, configDeps);
2484
2498
  if (deps.isModified) {
2485
2499
  await this.setupContext({
@@ -2556,12 +2570,12 @@ var Builder = class {
2556
2570
  resolve: true
2557
2571
  });
2558
2572
  }
2559
- // ASSUMPTION: Layer structure is an exact match (no extra layers)
2560
2573
  isValidRoot(root) {
2561
- const params = "reset, base, tokens, recipes, utilities";
2562
2574
  let found = false;
2563
2575
  root.walkAtRules("layer", (rule) => {
2564
- if (rule.params === params) {
2576
+ const foundLayers = /* @__PURE__ */ new Set();
2577
+ rule.params.split(",").forEach((name) => foundLayers.add(name.trim()));
2578
+ if (foundLayers.size >= 5 && layersName.every((name) => foundLayers.has(name))) {
2565
2579
  found = true;
2566
2580
  }
2567
2581
  });
@@ -2588,6 +2602,9 @@ var Builder = class {
2588
2602
  for (const file of ctx.dependencies) {
2589
2603
  fn({ type: "dependency", file: (0, import_path2.resolve)(file) });
2590
2604
  }
2605
+ for (const file of this.configDependencies) {
2606
+ fn({ type: "dependency", file: (0, import_path2.resolve)(file) });
2607
+ }
2591
2608
  }
2592
2609
  };
2593
2610
 
@@ -2788,7 +2805,7 @@ outExtension: '${outExtension}',` : ""}
2788
2805
  outdir: "styled-system",
2789
2806
  ${jsxFramework ? `
2790
2807
  // The JSX framework to use
2791
- jsxFramework: '${jsxFramework}'` : ""}
2808
+ jsxFramework: '${jsxFramework}',` : ""}
2792
2809
  ${syntax ? `
2793
2810
  // The CSS Syntax to use to use
2794
2811
  syntax: '${syntax}'` : ""}
package/dist/index.mjs CHANGED
@@ -34,9 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  mod
35
35
  ));
36
36
 
37
- // ../../node_modules/.pnpm/tsup@7.1.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.25_typescript@5.1.6/node_modules/tsup/assets/esm_shims.js
38
38
  var init_esm_shims = __esm({
39
- "../../node_modules/.pnpm/tsup@7.1.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.25_typescript@5.1.6/node_modules/tsup/assets/esm_shims.js"() {
40
40
  "use strict";
41
41
  }
42
42
  });
@@ -756,17 +756,17 @@ var writeAnalyzeJSON = (fileName, result, ctx) => {
756
756
 
757
757
  // src/builder.ts
758
758
  init_esm_shims();
759
- import { getConfigDependencies, convertTsPathsToRegexes } from "@pandacss/config";
759
+ import { getConfigDependencies } from "@pandacss/config";
760
760
  import { discardDuplicate, mergeCss as mergeCss2 } from "@pandacss/core";
761
761
  import { ConfigNotFoundError } from "@pandacss/error";
762
762
  import { logger as logger4 } from "@pandacss/logger";
763
763
  import { existsSync as existsSync2 } from "fs";
764
764
  import { statSync } from "fs-extra";
765
- import { resolve as resolve2 } from "path";
765
+ import { dirname as dirname2, resolve as resolve2 } from "path";
766
766
 
767
767
  // src/config.ts
768
768
  init_esm_shims();
769
- import { loadConfigFile } from "@pandacss/config";
769
+ import { convertTsPathsToRegexes, loadConfigFile } from "@pandacss/config";
770
770
  import { createDebugger, createHooks } from "hookable";
771
771
  import { lookItUpSync } from "look-it-up";
772
772
  import { parse } from "tsconfck";
@@ -775,7 +775,6 @@ import { parse } from "tsconfck";
775
775
  init_esm_shims();
776
776
  import { createGenerator } from "@pandacss/generator";
777
777
  import { createProject } from "@pandacss/parser";
778
- import { Obj, pipe, tap } from "lil-fp";
779
778
 
780
779
  // src/chunk-engine.ts
781
780
  init_esm_shims();
@@ -925,29 +924,29 @@ var getOutputEngine = ({
925
924
  });
926
925
 
927
926
  // src/create-context.ts
928
- var createContext = (conf) => pipe(
929
- conf,
930
- createGenerator,
931
- Obj.assign({ runtime: nodeRuntime, hooks: conf.hooks }),
932
- tap(({ config, runtime }) => {
933
- config.cwd ||= runtime.cwd();
934
- }),
935
- Obj.bind("getFiles", ({ config, runtime: { fs } }) => () => {
936
- const { include, exclude, cwd } = config;
937
- return fs.glob({ include, exclude, cwd });
938
- }),
939
- Obj.bind("project", ({ getFiles, runtime: { fs }, parserOptions }) => {
940
- return createProject({
927
+ var createContext = (conf) => {
928
+ const generator = createGenerator(conf);
929
+ const config = conf.config;
930
+ const runtime = nodeRuntime;
931
+ config.cwd ||= runtime.cwd();
932
+ const { include, exclude, cwd } = config;
933
+ const getFiles = () => runtime.fs.glob({ include, exclude, cwd });
934
+ const ctx = {
935
+ ...conf,
936
+ ...generator,
937
+ runtime: nodeRuntime,
938
+ hooks: conf.hooks,
939
+ getFiles,
940
+ project: createProject({
941
941
  ...conf.tsconfig,
942
942
  getFiles,
943
- readFile: fs.readFileSync,
943
+ readFile: runtime.fs.readFileSync,
944
944
  hooks: conf.hooks,
945
- parserOptions
946
- });
947
- }),
948
- Obj.bind("chunks", getChunkEngine),
949
- Obj.bind("output", getOutputEngine)
950
- );
945
+ parserOptions: { join: runtime.path.join, ...generator.parserOptions }
946
+ })
947
+ };
948
+ return Object.assign(ctx, { chunks: getChunkEngine(ctx), output: getOutputEngine(ctx) });
949
+ };
951
950
 
952
951
  // src/config.ts
953
952
  var configs = [".ts", ".js", ".mjs", ".cjs"];
@@ -973,6 +972,11 @@ async function loadConfigAndCreateContext(options = {}) {
973
972
  if (tsconfigResult) {
974
973
  conf.tsconfig = tsconfigResult.tsconfig;
975
974
  conf.tsconfigFile = tsconfigResult.tsconfigFile;
975
+ const options2 = tsconfigResult.tsconfig?.compilerOptions;
976
+ if (options2?.paths) {
977
+ const baseUrl = options2.baseUrl;
978
+ conf.tsOptions = { baseUrl, pathMappings: convertTsPathsToRegexes(options2.paths, baseUrl ?? cwd) };
979
+ }
976
980
  }
977
981
  conf.config.outdir ??= "styled-system";
978
982
  if (conf.config.hooks) {
@@ -988,12 +992,12 @@ async function loadConfigAndCreateContext(options = {}) {
988
992
  // src/extract.ts
989
993
  init_esm_shims();
990
994
  import { logger as logger3 } from "@pandacss/logger";
991
- import { Obj as Obj2, pipe as pipe2, tap as tap2, tryCatch } from "lil-fp";
995
+ import { Obj, pipe, tap, tryCatch } from "lil-fp";
992
996
 
993
997
  // src/cli-box.ts
994
998
  init_esm_shims();
995
999
 
996
- // ../../node_modules/.pnpm/boxen@7.1.0/node_modules/boxen/index.js
1000
+ // ../../node_modules/.pnpm/boxen@7.1.1/node_modules/boxen/index.js
997
1001
  init_esm_shims();
998
1002
  import process3 from "node:process";
999
1003
 
@@ -1569,7 +1573,7 @@ function widestLine(string) {
1569
1573
  return lineWidth;
1570
1574
  }
1571
1575
 
1572
- // ../../node_modules/.pnpm/boxen@7.1.0/node_modules/boxen/index.js
1576
+ // ../../node_modules/.pnpm/boxen@7.1.1/node_modules/boxen/index.js
1573
1577
  var import_cli_boxes = __toESM(require_cli_boxes(), 1);
1574
1578
 
1575
1579
  // ../../node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
@@ -1655,7 +1659,7 @@ function camelCase(input, options) {
1655
1659
  return postProcess(input, toUpperCase);
1656
1660
  }
1657
1661
 
1658
- // ../../node_modules/.pnpm/boxen@7.1.0/node_modules/boxen/index.js
1662
+ // ../../node_modules/.pnpm/boxen@7.1.1/node_modules/boxen/index.js
1659
1663
  var import_ansi_align = __toESM(require_ansi_align(), 1);
1660
1664
 
1661
1665
  // ../../node_modules/.pnpm/wrap-ansi@8.1.0/node_modules/wrap-ansi/index.js
@@ -1999,11 +2003,11 @@ function wrapAnsi(string, columns, options) {
1999
2003
  return String(string).normalize().replace(/\r\n/g, "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
2000
2004
  }
2001
2005
 
2002
- // ../../node_modules/.pnpm/boxen@7.1.0/node_modules/boxen/index.js
2006
+ // ../../node_modules/.pnpm/boxen@7.1.1/node_modules/boxen/index.js
2003
2007
  var import_cli_boxes2 = __toESM(require_cli_boxes(), 1);
2004
2008
  var NEWLINE = "\n";
2005
2009
  var PAD = " ";
2006
- var BORDERS_WIDTH = 2;
2010
+ var NONE = "none";
2007
2011
  var terminalColumns = () => {
2008
2012
  const { env: env2, stdout, stderr } = process3;
2009
2013
  if (stdout?.columns) {
@@ -2029,6 +2033,7 @@ var getObject = (detail) => typeof detail === "number" ? {
2029
2033
  left: 0,
2030
2034
  ...detail
2031
2035
  };
2036
+ var getBorderWidth = (borderStyle) => borderStyle === NONE ? 0 : 2;
2032
2037
  var getBorderChars = (borderStyle) => {
2033
2038
  const sides = [
2034
2039
  "topLeft",
@@ -2041,7 +2046,7 @@ var getBorderChars = (borderStyle) => {
2041
2046
  "bottom"
2042
2047
  ];
2043
2048
  let characters;
2044
- if (borderStyle === "none") {
2049
+ if (borderStyle === NONE) {
2045
2050
  borderStyle = {};
2046
2051
  for (const side of sides) {
2047
2052
  borderStyle[side] = "";
@@ -2070,10 +2075,10 @@ var getBorderChars = (borderStyle) => {
2070
2075
  }
2071
2076
  return characters;
2072
2077
  };
2073
- var makeTitle = (text, horizontal, alignement) => {
2078
+ var makeTitle = (text, horizontal, alignment) => {
2074
2079
  let title = "";
2075
2080
  const textWidth = stringWidth(text);
2076
- switch (alignement) {
2081
+ switch (alignment) {
2077
2082
  case "left": {
2078
2083
  title = text + horizontal.slice(textWidth);
2079
2084
  break;
@@ -2176,17 +2181,28 @@ var boxContent = (content, contentWidth, options) => {
2176
2181
  const columns = terminalColumns();
2177
2182
  let marginLeft = PAD.repeat(options.margin.left);
2178
2183
  if (options.float === "center") {
2179
- const marginWidth = Math.max((columns - contentWidth - BORDERS_WIDTH) / 2, 0);
2184
+ const marginWidth = Math.max((columns - contentWidth - getBorderWidth(options.borderStyle)) / 2, 0);
2180
2185
  marginLeft = PAD.repeat(marginWidth);
2181
2186
  } else if (options.float === "right") {
2182
- const marginWidth = Math.max(columns - contentWidth - options.margin.right - BORDERS_WIDTH, 0);
2187
+ const marginWidth = Math.max(columns - contentWidth - options.margin.right - getBorderWidth(options.borderStyle), 0);
2183
2188
  marginLeft = PAD.repeat(marginWidth);
2184
2189
  }
2185
- const top = colorizeBorder(NEWLINE.repeat(options.margin.top) + marginLeft + chars.topLeft + (options.title ? makeTitle(options.title, chars.top.repeat(contentWidth), options.titleAlignment) : chars.top.repeat(contentWidth)) + chars.topRight);
2186
- const bottom = colorizeBorder(marginLeft + chars.bottomLeft + chars.bottom.repeat(contentWidth) + chars.bottomRight + NEWLINE.repeat(options.margin.bottom));
2190
+ let result = "";
2191
+ if (options.margin.top) {
2192
+ result += NEWLINE.repeat(options.margin.top);
2193
+ }
2194
+ if (options.borderStyle !== NONE || options.title) {
2195
+ result += colorizeBorder(marginLeft + chars.topLeft + (options.title ? makeTitle(options.title, chars.top.repeat(contentWidth), options.titleAlignment) : chars.top.repeat(contentWidth)) + chars.topRight) + NEWLINE;
2196
+ }
2187
2197
  const lines = content.split(NEWLINE);
2188
- const middle = lines.map((line) => marginLeft + colorizeBorder(chars.left) + colorizeContent(line) + colorizeBorder(chars.right)).join(NEWLINE);
2189
- return top + NEWLINE + middle + NEWLINE + bottom;
2198
+ result += lines.map((line) => marginLeft + colorizeBorder(chars.left) + colorizeContent(line) + colorizeBorder(chars.right)).join(NEWLINE);
2199
+ if (options.borderStyle !== NONE) {
2200
+ result += NEWLINE + colorizeBorder(marginLeft + chars.bottomLeft + chars.bottom.repeat(contentWidth) + chars.bottomRight);
2201
+ }
2202
+ if (options.margin.bottom) {
2203
+ result += NEWLINE.repeat(options.margin.bottom);
2204
+ }
2205
+ return result;
2190
2206
  };
2191
2207
  var sanitizeOptions = (options) => {
2192
2208
  if (options.fullscreen && process3?.stdout) {
@@ -2202,28 +2218,30 @@ var sanitizeOptions = (options) => {
2202
2218
  }
2203
2219
  }
2204
2220
  if (options.width) {
2205
- options.width = Math.max(1, options.width - BORDERS_WIDTH);
2221
+ options.width = Math.max(1, options.width - getBorderWidth(options.borderStyle));
2206
2222
  }
2207
2223
  if (options.height) {
2208
- options.height = Math.max(1, options.height - BORDERS_WIDTH);
2224
+ options.height = Math.max(1, options.height - getBorderWidth(options.borderStyle));
2209
2225
  }
2210
2226
  return options;
2211
2227
  };
2228
+ var formatTitle = (title, borderStyle) => borderStyle === NONE ? title : ` ${title} `;
2212
2229
  var determineDimensions = (text, options) => {
2213
2230
  options = sanitizeOptions(options);
2214
2231
  const widthOverride = options.width !== void 0;
2215
2232
  const columns = terminalColumns();
2216
- const maxWidth = columns - options.margin.left - options.margin.right - BORDERS_WIDTH;
2217
- const widest = widestLine(wrapAnsi(text, columns - BORDERS_WIDTH, { hard: true, trim: false })) + options.padding.left + options.padding.right;
2233
+ const borderWidth = getBorderWidth(options.borderStyle);
2234
+ const maxWidth = columns - options.margin.left - options.margin.right - borderWidth;
2235
+ const widest = widestLine(wrapAnsi(text, columns - borderWidth, { hard: true, trim: false })) + options.padding.left + options.padding.right;
2218
2236
  if (options.title && widthOverride) {
2219
2237
  options.title = options.title.slice(0, Math.max(0, options.width - 2));
2220
2238
  if (options.title) {
2221
- options.title = ` ${options.title} `;
2239
+ options.title = formatTitle(options.title, options.borderStyle);
2222
2240
  }
2223
2241
  } else if (options.title) {
2224
2242
  options.title = options.title.slice(0, Math.max(0, maxWidth - 2));
2225
2243
  if (options.title) {
2226
- options.title = ` ${options.title} `;
2244
+ options.title = formatTitle(options.title, options.borderStyle);
2227
2245
  if (stringWidth(options.title) > widest) {
2228
2246
  options.width = stringWidth(options.title);
2229
2247
  }
@@ -2232,12 +2250,12 @@ var determineDimensions = (text, options) => {
2232
2250
  options.width = options.width ? options.width : widest;
2233
2251
  if (!widthOverride) {
2234
2252
  if (options.margin.left && options.margin.right && options.width > maxWidth) {
2235
- const spaceForMargins = columns - options.width - BORDERS_WIDTH;
2253
+ const spaceForMargins = columns - options.width - borderWidth;
2236
2254
  const multiplier = spaceForMargins / (options.margin.left + options.margin.right);
2237
2255
  options.margin.left = Math.max(0, Math.floor(options.margin.left * multiplier));
2238
2256
  options.margin.right = Math.max(0, Math.floor(options.margin.right * multiplier));
2239
2257
  }
2240
- options.width = Math.min(options.width, columns - BORDERS_WIDTH - options.margin.left - options.margin.right);
2258
+ options.width = Math.min(options.width, columns - borderWidth - options.margin.left - options.margin.right);
2241
2259
  }
2242
2260
  if (options.width - (options.padding.left + options.padding.right) <= 0) {
2243
2261
  options.padding.left = 0;
@@ -2312,21 +2330,21 @@ function extractFile(ctx, file) {
2312
2330
  runtime: { path: path2 },
2313
2331
  config: { cwd }
2314
2332
  } = ctx;
2315
- return pipe2(
2333
+ return pipe(
2316
2334
  { file: path2.abs(cwd, file) },
2317
- tap2(() => logger3.debug("file:extract", file)),
2318
- Obj2.bind("measure", () => logger3.time.debug(`Extracted ${file}`)),
2319
- Obj2.bind(
2335
+ tap(() => logger3.debug("file:extract", file)),
2336
+ Obj.bind("measure", () => logger3.time.debug(`Extracted ${file}`)),
2337
+ Obj.bind(
2320
2338
  "result",
2321
2339
  tryCatch(
2322
2340
  ({ file: file2 }) => ctx.project.parseSourceFile(file2),
2323
2341
  (error) => logger3.error("file:parse", error)
2324
2342
  )
2325
2343
  ),
2326
- Obj2.bind("measureCss", () => logger3.time.debug(`Parsed ${file}`)),
2327
- Obj2.bind("css", ({ result }) => result ? ctx.getParserCss(result) : void 0),
2328
- tap2(({ measure, measureCss }) => [measureCss(), measure()]),
2329
- Obj2.get("css")
2344
+ Obj.bind("measureCss", () => logger3.time.debug(`Parsed ${file}`)),
2345
+ Obj.bind("css", ({ result }) => result ? ctx.getParserCss(result) : void 0),
2346
+ tap(({ measure, measureCss }) => [measureCss(), measure()]),
2347
+ Obj.get("css")
2330
2348
  );
2331
2349
  }
2332
2350
  function extractFiles(ctx) {
@@ -2412,11 +2430,13 @@ function parseDependency(fileOrGlob) {
2412
2430
  var configCache = /* @__PURE__ */ new Map();
2413
2431
  var contentFilesCache = /* @__PURE__ */ new WeakMap();
2414
2432
  var setupCount = 0;
2433
+ var layersName = ["reset", "base", "tokens", "recipes", "utilities"];
2415
2434
  var Builder = class {
2416
2435
  /**
2417
2436
  * The current panda context
2418
2437
  */
2419
2438
  context;
2439
+ configDependencies = /* @__PURE__ */ new Set();
2420
2440
  writeFileCss(file, css) {
2421
2441
  const oldCss = this.fileCssMap?.get(file) ?? "";
2422
2442
  const newCss = mergeCss2(oldCss, css);
@@ -2454,18 +2474,12 @@ var Builder = class {
2454
2474
  async setup(options = {}) {
2455
2475
  logger4.debug("builder", "\u{1F6A7} Setup");
2456
2476
  const configPath = options.configPath ?? this.getConfigPath();
2457
- let tsOptions = { baseUrl: void 0, pathMappings: [] };
2458
- if (this.context?.tsconfig) {
2459
- const options2 = this.context.tsconfig.compilerOptions;
2460
- if (options2?.paths) {
2461
- const baseUrl = options2.baseUrl;
2462
- tsOptions = {
2463
- baseUrl,
2464
- pathMappings: convertTsPathsToRegexes(options2?.paths, baseUrl ?? this.context.config.cwd)
2465
- };
2466
- }
2467
- }
2468
- const { deps: configDeps } = getConfigDependencies(configPath, tsOptions);
2477
+ const tsOptions = this.context?.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2478
+ const compilerOptions = this.context?.tsconfig?.compilerOptions ?? {};
2479
+ const { deps: foundDeps } = getConfigDependencies(configPath, tsOptions, compilerOptions);
2480
+ const cwd = this.context?.config.cwd ?? dirname2(configPath);
2481
+ const configDeps = /* @__PURE__ */ new Set([...foundDeps, ...(this.context?.dependencies ?? []).map((file) => resolve2(cwd, file))]);
2482
+ this.configDependencies = configDeps;
2469
2483
  const deps = this.checkConfigDeps(configPath, configDeps);
2470
2484
  if (deps.isModified) {
2471
2485
  await this.setupContext({
@@ -2542,12 +2556,12 @@ var Builder = class {
2542
2556
  resolve: true
2543
2557
  });
2544
2558
  }
2545
- // ASSUMPTION: Layer structure is an exact match (no extra layers)
2546
2559
  isValidRoot(root) {
2547
- const params = "reset, base, tokens, recipes, utilities";
2548
2560
  let found = false;
2549
2561
  root.walkAtRules("layer", (rule) => {
2550
- if (rule.params === params) {
2562
+ const foundLayers = /* @__PURE__ */ new Set();
2563
+ rule.params.split(",").forEach((name) => foundLayers.add(name.trim()));
2564
+ if (foundLayers.size >= 5 && layersName.every((name) => foundLayers.has(name))) {
2551
2565
  found = true;
2552
2566
  }
2553
2567
  });
@@ -2574,6 +2588,9 @@ var Builder = class {
2574
2588
  for (const file of ctx.dependencies) {
2575
2589
  fn({ type: "dependency", file: resolve2(file) });
2576
2590
  }
2591
+ for (const file of this.configDependencies) {
2592
+ fn({ type: "dependency", file: resolve2(file) });
2593
+ }
2577
2594
  }
2578
2595
  };
2579
2596
 
@@ -2774,7 +2791,7 @@ outExtension: '${outExtension}',` : ""}
2774
2791
  outdir: "styled-system",
2775
2792
  ${jsxFramework ? `
2776
2793
  // The JSX framework to use
2777
- jsxFramework: '${jsxFramework}'` : ""}
2794
+ jsxFramework: '${jsxFramework}',` : ""}
2778
2795
  ${syntax ? `
2779
2796
  // The CSS Syntax to use to use
2780
2797
  syntax: '${syntax}'` : ""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "chokidar": "^3.5.3",
18
- "fast-glob": "^3.2.12",
18
+ "fast-glob": "^3.3.0",
19
19
  "file-size": "^1.0.0",
20
20
  "filesize": "^10.0.7",
21
21
  "fs-extra": "11.1.1",
@@ -29,31 +29,31 @@
29
29
  "pathe": "^1.1.1",
30
30
  "pkg-types": "1.0.3",
31
31
  "pluralize": "8.0.0",
32
- "postcss": "8.4.24",
32
+ "postcss": "8.4.25",
33
33
  "preferred-pm": "^3.0.3",
34
- "ts-morph": "18.0.0",
35
- "ts-pattern": "4.3.0",
34
+ "ts-morph": "19.0.0",
35
+ "ts-pattern": "5.0.4",
36
36
  "tsconfck": "^2.1.1",
37
- "@pandacss/config": "0.6.0",
38
- "@pandacss/core": "0.6.0",
39
- "@pandacss/error": "0.6.0",
40
- "@pandacss/extractor": "0.6.0",
41
- "@pandacss/generator": "0.6.0",
42
- "@pandacss/is-valid-prop": "0.6.0",
43
- "@pandacss/logger": "0.6.0",
44
- "@pandacss/parser": "0.6.0",
45
- "@pandacss/shared": "0.6.0",
46
- "@pandacss/token-dictionary": "0.6.0",
47
- "@pandacss/types": "0.6.0"
37
+ "@pandacss/config": "0.8.0",
38
+ "@pandacss/core": "0.8.0",
39
+ "@pandacss/error": "0.8.0",
40
+ "@pandacss/extractor": "0.8.0",
41
+ "@pandacss/generator": "0.8.0",
42
+ "@pandacss/is-valid-prop": "0.8.0",
43
+ "@pandacss/logger": "0.8.0",
44
+ "@pandacss/parser": "0.8.0",
45
+ "@pandacss/shared": "0.8.0",
46
+ "@pandacss/token-dictionary": "0.8.0",
47
+ "@pandacss/types": "0.8.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/fs-extra": "11.0.1",
51
51
  "@types/glob-parent": "^5.1.1",
52
52
  "@types/is-glob": "^4.0.2",
53
53
  "@types/lodash.merge": "4.6.7",
54
- "@types/pluralize": "0.0.29",
55
- "boxen": "^7.1.0",
56
- "@pandacss/fixture": "0.6.0"
54
+ "@types/pluralize": "0.0.30",
55
+ "boxen": "^7.1.1",
56
+ "@pandacss/fixture": "0.8.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",