@pandacss/node 0.0.0-dev-20230128072108 → 0.0.0-dev-20230131074332

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.
Files changed (3) hide show
  1. package/dist/index.js +24 -27
  2. package/dist/index.mjs +24 -27
  3. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -2434,7 +2434,6 @@ var import_logger8 = require("@pandacss/logger");
2434
2434
  // src/watch.ts
2435
2435
  var import_logger7 = require("@pandacss/logger");
2436
2436
  var import_chokidar = __toESM(require("chokidar"));
2437
- var import_path5 = require("path");
2438
2437
  var import_ts_pattern6 = require("ts-pattern");
2439
2438
  function createWatcher(files, options = {}) {
2440
2439
  const { ignore, cwd = process.cwd(), poll } = options;
@@ -2481,18 +2480,8 @@ async function createContentWatcher(ctx, callback) {
2481
2480
  });
2482
2481
  return watcher;
2483
2482
  }
2484
- async function createAssetWatcher(ctx, callback) {
2485
- const { cwd } = ctx;
2486
- const watcher = createWatcher([(0, import_path5.join)(ctx.paths.chunk, "**/*.css")], { cwd });
2487
- watcher.on("all", async (event, file) => {
2488
- import_logger7.logger.debug({ type: `asset:${event}`, file });
2489
- await callback();
2490
- });
2491
- return watcher;
2492
- }
2493
2483
  process.setMaxListeners(Infinity);
2494
2484
  async function watch(ctx, options) {
2495
- await createAssetWatcher(ctx, options.onAssetChange);
2496
2485
  await createContentWatcher(ctx, options.onContentChange);
2497
2486
  const configWatcher = await createConfigWatcher(ctx.conf);
2498
2487
  configWatcher.on("change", async () => {
@@ -2508,24 +2497,32 @@ process.on("uncaughtException", (err) => {
2508
2497
  });
2509
2498
 
2510
2499
  // src/generate.ts
2511
- async function build(config, configPath) {
2512
- const ctx = await loadConfigAndCreateContext({ config, configPath });
2500
+ async function build(ctx) {
2513
2501
  const msg = await emitAndExtract(ctx);
2514
2502
  import_logger8.logger.info(msg);
2515
- return ctx;
2516
2503
  }
2504
+ var loadContext = async (config, configPath) => {
2505
+ const ctxRef = { current: void 0 };
2506
+ const load = async () => {
2507
+ const ctx = await loadConfigAndCreateContext({ config, configPath });
2508
+ ctxRef.current = ctx;
2509
+ };
2510
+ await load();
2511
+ return [ctxRef, load];
2512
+ };
2517
2513
  async function generate5(config, configPath) {
2518
- const ctx = await build(config, configPath);
2519
- if (ctx.watch) {
2520
- await watch(ctx, {
2521
- onConfigChange: () => {
2522
- return build(config, configPath);
2514
+ const [ctxRef, loadCtx] = await loadContext(config, configPath);
2515
+ const initialCtx = ctxRef.current;
2516
+ await build(initialCtx);
2517
+ if (initialCtx.watch) {
2518
+ await watch(initialCtx, {
2519
+ onConfigChange: async () => {
2520
+ await loadCtx();
2521
+ return build(ctxRef.current);
2523
2522
  },
2524
- onAssetChange() {
2525
- return bundleChunks(ctx);
2526
- },
2527
- onContentChange: (file) => {
2528
- return writeFileChunk(ctx, file);
2523
+ onContentChange: async (file) => {
2524
+ await writeFileChunk(ctxRef.current, file);
2525
+ return bundleChunks(ctxRef.current);
2529
2526
  }
2530
2527
  });
2531
2528
  import_logger8.logger.info(watchMessage());
@@ -2556,7 +2553,7 @@ var import_logger9 = require("@pandacss/logger");
2556
2553
  var import_fs_extra4 = require("fs-extra");
2557
2554
  var import_look_it_up3 = require("look-it-up");
2558
2555
  var import_outdent26 = require("outdent");
2559
- var import_path6 = require("path");
2556
+ var import_path5 = require("path");
2560
2557
  var import_preferred_pm2 = __toESM(require("preferred-pm"));
2561
2558
  async function setupConfig(cwd, { force }) {
2562
2559
  const configFile = findConfig();
@@ -2589,7 +2586,7 @@ async function setupConfig(cwd, { force }) {
2589
2586
  outdir: "design-system",
2590
2587
  })
2591
2588
  `;
2592
- await (0, import_fs_extra4.writeFile)((0, import_path6.join)(cwd, file), content);
2589
+ await (0, import_fs_extra4.writeFile)((0, import_path5.join)(cwd, file), content);
2593
2590
  import_logger9.logger.log(thankYouMessage());
2594
2591
  }
2595
2592
  }
@@ -2602,7 +2599,7 @@ async function setupPostcss(cwd) {
2602
2599
  },
2603
2600
  }
2604
2601
  `;
2605
- await (0, import_fs_extra4.writeFile)((0, import_path6.join)(cwd, "postcss.config.cjs"), content);
2602
+ await (0, import_fs_extra4.writeFile)((0, import_path5.join)(cwd, "postcss.config.cjs"), content);
2606
2603
  }
2607
2604
  // Annotate the CommonJS export names for ESM import in node:
2608
2605
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -2394,7 +2394,6 @@ import { logger as logger8 } from "@pandacss/logger";
2394
2394
  // src/watch.ts
2395
2395
  import { logger as logger7 } from "@pandacss/logger";
2396
2396
  import chokidar from "chokidar";
2397
- import { join as join3 } from "path";
2398
2397
  import { match as match6 } from "ts-pattern";
2399
2398
  function createWatcher(files, options = {}) {
2400
2399
  const { ignore, cwd = process.cwd(), poll } = options;
@@ -2441,18 +2440,8 @@ async function createContentWatcher(ctx, callback) {
2441
2440
  });
2442
2441
  return watcher;
2443
2442
  }
2444
- async function createAssetWatcher(ctx, callback) {
2445
- const { cwd } = ctx;
2446
- const watcher = createWatcher([join3(ctx.paths.chunk, "**/*.css")], { cwd });
2447
- watcher.on("all", async (event, file) => {
2448
- logger7.debug({ type: `asset:${event}`, file });
2449
- await callback();
2450
- });
2451
- return watcher;
2452
- }
2453
2443
  process.setMaxListeners(Infinity);
2454
2444
  async function watch(ctx, options) {
2455
- await createAssetWatcher(ctx, options.onAssetChange);
2456
2445
  await createContentWatcher(ctx, options.onContentChange);
2457
2446
  const configWatcher = await createConfigWatcher(ctx.conf);
2458
2447
  configWatcher.on("change", async () => {
@@ -2468,24 +2457,32 @@ process.on("uncaughtException", (err) => {
2468
2457
  });
2469
2458
 
2470
2459
  // src/generate.ts
2471
- async function build(config, configPath) {
2472
- const ctx = await loadConfigAndCreateContext({ config, configPath });
2460
+ async function build(ctx) {
2473
2461
  const msg = await emitAndExtract(ctx);
2474
2462
  logger8.info(msg);
2475
- return ctx;
2476
2463
  }
2464
+ var loadContext = async (config, configPath) => {
2465
+ const ctxRef = { current: void 0 };
2466
+ const load = async () => {
2467
+ const ctx = await loadConfigAndCreateContext({ config, configPath });
2468
+ ctxRef.current = ctx;
2469
+ };
2470
+ await load();
2471
+ return [ctxRef, load];
2472
+ };
2477
2473
  async function generate5(config, configPath) {
2478
- const ctx = await build(config, configPath);
2479
- if (ctx.watch) {
2480
- await watch(ctx, {
2481
- onConfigChange: () => {
2482
- return build(config, configPath);
2474
+ const [ctxRef, loadCtx] = await loadContext(config, configPath);
2475
+ const initialCtx = ctxRef.current;
2476
+ await build(initialCtx);
2477
+ if (initialCtx.watch) {
2478
+ await watch(initialCtx, {
2479
+ onConfigChange: async () => {
2480
+ await loadCtx();
2481
+ return build(ctxRef.current);
2483
2482
  },
2484
- onAssetChange() {
2485
- return bundleChunks(ctx);
2486
- },
2487
- onContentChange: (file) => {
2488
- return writeFileChunk(ctx, file);
2483
+ onContentChange: async (file) => {
2484
+ await writeFileChunk(ctxRef.current, file);
2485
+ return bundleChunks(ctxRef.current);
2489
2486
  }
2490
2487
  });
2491
2488
  logger8.info(watchMessage());
@@ -2516,7 +2513,7 @@ import { logger as logger9, quote as quote3 } from "@pandacss/logger";
2516
2513
  import { writeFile as writeFile2 } from "fs-extra";
2517
2514
  import { lookItUpSync as lookItUpSync3 } from "look-it-up";
2518
2515
  import { outdent as outdent26 } from "outdent";
2519
- import { join as join4 } from "path";
2516
+ import { join as join3 } from "path";
2520
2517
  import getPackageManager2 from "preferred-pm";
2521
2518
  async function setupConfig(cwd, { force }) {
2522
2519
  const configFile = findConfig();
@@ -2549,7 +2546,7 @@ async function setupConfig(cwd, { force }) {
2549
2546
  outdir: "design-system",
2550
2547
  })
2551
2548
  `;
2552
- await writeFile2(join4(cwd, file), content);
2549
+ await writeFile2(join3(cwd, file), content);
2553
2550
  logger9.log(thankYouMessage());
2554
2551
  }
2555
2552
  }
@@ -2562,7 +2559,7 @@ async function setupPostcss(cwd) {
2562
2559
  },
2563
2560
  }
2564
2561
  `;
2565
- await writeFile2(join4(cwd, "postcss.config.cjs"), content);
2562
+ await writeFile2(join3(cwd, "postcss.config.cjs"), content);
2566
2563
  }
2567
2564
  export {
2568
2565
  Builder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.0.0-dev-20230128072108",
3
+ "version": "0.0.0-dev-20230131074332",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -30,15 +30,15 @@
30
30
  "javascript-stringify": "2.1.0",
31
31
  "ts-pattern": "4.1.3",
32
32
  "ts-morph": "17.0.1",
33
- "@pandacss/types": "0.0.0-dev-20230128072108",
34
- "@pandacss/is-valid-prop": "0.0.0-dev-20230128072108",
35
- "@pandacss/error": "0.0.0-dev-20230128072108",
36
- "@pandacss/parser": "0.0.0-dev-20230128072108",
37
- "@pandacss/shared": "0.0.0-dev-20230128072108",
38
- "@pandacss/token-dictionary": "0.0.0-dev-20230128072108",
39
- "@pandacss/logger": "0.0.0-dev-20230128072108",
40
- "@pandacss/core": "0.0.0-dev-20230128072108",
41
- "@pandacss/config": "0.0.0-dev-20230128072108"
33
+ "@pandacss/types": "0.0.0-dev-20230131074332",
34
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230131074332",
35
+ "@pandacss/error": "0.0.0-dev-20230131074332",
36
+ "@pandacss/parser": "0.0.0-dev-20230131074332",
37
+ "@pandacss/shared": "0.0.0-dev-20230131074332",
38
+ "@pandacss/token-dictionary": "0.0.0-dev-20230131074332",
39
+ "@pandacss/logger": "0.0.0-dev-20230131074332",
40
+ "@pandacss/core": "0.0.0-dev-20230131074332",
41
+ "@pandacss/config": "0.0.0-dev-20230131074332"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/fs-extra": "11.0.1",
@@ -46,7 +46,7 @@
46
46
  "@types/glob-parent": "^5.1.1",
47
47
  "@types/pluralize": "0.0.29",
48
48
  "@types/lodash.merge": "4.6.7",
49
- "@pandacss/fixture": "0.0.0-dev-20230128072108"
49
+ "@pandacss/fixture": "0.0.0-dev-20230131074332"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",