@pandacss/node 0.7.0 → 0.9.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[];
@@ -195,6 +195,7 @@ declare class Builder {
195
195
  getConfigPath(): string;
196
196
  setup(options?: {
197
197
  configPath?: string;
198
+ cwd?: string;
198
199
  }): Promise<void>;
199
200
  setupContext(options: {
200
201
  configPath: 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[];
@@ -195,6 +195,7 @@ declare class Builder {
195
195
  getConfigPath(): string;
196
196
  setup(options?: {
197
197
  configPath?: string;
198
+ cwd?: string;
198
199
  }): Promise<void>;
199
200
  setupContext(options: {
200
201
  configPath: string;
package/dist/index.js CHANGED
@@ -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,7 +1006,7 @@ 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();
@@ -2340,21 +2344,21 @@ function extractFile(ctx, file) {
2340
2344
  runtime: { path: path2 },
2341
2345
  config: { cwd }
2342
2346
  } = ctx;
2343
- return (0, import_lil_fp2.pipe)(
2347
+ return (0, import_lil_fp.pipe)(
2344
2348
  { file: path2.abs(cwd, file) },
2345
- (0, import_lil_fp2.tap)(() => import_logger3.logger.debug("file:extract", file)),
2346
- import_lil_fp2.Obj.bind("measure", () => import_logger3.logger.time.debug(`Extracted ${file}`)),
2347
- 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(
2348
2352
  "result",
2349
- (0, import_lil_fp2.tryCatch)(
2353
+ (0, import_lil_fp.tryCatch)(
2350
2354
  ({ file: file2 }) => ctx.project.parseSourceFile(file2),
2351
2355
  (error) => import_logger3.logger.error("file:parse", error)
2352
2356
  )
2353
2357
  ),
2354
- import_lil_fp2.Obj.bind("measureCss", () => import_logger3.logger.time.debug(`Parsed ${file}`)),
2355
- import_lil_fp2.Obj.bind("css", ({ result }) => result ? ctx.getParserCss(result) : void 0),
2356
- (0, import_lil_fp2.tap)(({ measure, measureCss }) => [measureCss(), measure()]),
2357
- 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")
2358
2362
  );
2359
2363
  }
2360
2364
  function extractFiles(ctx) {
@@ -2457,7 +2461,10 @@ var Builder = class {
2457
2461
  const newModified = /* @__PURE__ */ new Map();
2458
2462
  const prevModified = configCache.get(configPath)?.depsModifiedMap;
2459
2463
  for (const file of deps) {
2460
- const time = (0, import_fs_extra2.statSync)(file).mtimeMs;
2464
+ const stats = (0, import_fs_extra2.statSync)(file, { throwIfNoEntry: false });
2465
+ if (!stats)
2466
+ continue;
2467
+ const time = stats.mtimeMs;
2461
2468
  newModified.set(file, time);
2462
2469
  if (!prevModified || !prevModified.has(file) || time > prevModified.get(file)) {
2463
2470
  modified = true;
@@ -2484,19 +2491,10 @@ var Builder = class {
2484
2491
  async setup(options = {}) {
2485
2492
  import_logger4.logger.debug("builder", "\u{1F6A7} Setup");
2486
2493
  const configPath = options.configPath ?? this.getConfigPath();
2487
- let tsOptions = { baseUrl: void 0, pathMappings: [] };
2488
- if (this.context?.tsconfig) {
2489
- const options2 = this.context.tsconfig.compilerOptions;
2490
- if (options2?.paths) {
2491
- const baseUrl = options2.baseUrl;
2492
- tsOptions = {
2493
- baseUrl,
2494
- pathMappings: (0, import_config2.convertTsPathsToRegexes)(options2?.paths, baseUrl ?? this.context.config.cwd)
2495
- };
2496
- }
2497
- }
2498
- const { deps: foundDeps } = (0, import_config2.getConfigDependencies)(configPath, tsOptions);
2499
- const cwd = this.context?.config.cwd ?? (0, import_path2.dirname)(configPath);
2494
+ const tsOptions = this.context?.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2495
+ const compilerOptions = this.context?.tsconfig?.compilerOptions ?? {};
2496
+ const { deps: foundDeps } = (0, import_config2.getConfigDependencies)(configPath, tsOptions, compilerOptions);
2497
+ const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
2500
2498
  const configDeps = /* @__PURE__ */ new Set([...foundDeps, ...(this.context?.dependencies ?? []).map((file) => (0, import_path2.resolve)(cwd, file))]);
2501
2499
  this.configDependencies = configDeps;
2502
2500
  const deps = this.checkConfigDeps(configPath, configDeps);
@@ -2810,7 +2808,7 @@ outExtension: '${outExtension}',` : ""}
2810
2808
  outdir: "styled-system",
2811
2809
  ${jsxFramework ? `
2812
2810
  // The JSX framework to use
2813
- jsxFramework: '${jsxFramework}'` : ""}
2811
+ jsxFramework: '${jsxFramework}',` : ""}
2814
2812
  ${syntax ? `
2815
2813
  // The CSS Syntax to use to use
2816
2814
  syntax: '${syntax}'` : ""}
package/dist/index.mjs CHANGED
@@ -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 { dirname as dirname2, resolve as resolve2 } from "path";
765
+ import { 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,7 +992,7 @@ 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();
@@ -2326,21 +2330,21 @@ function extractFile(ctx, file) {
2326
2330
  runtime: { path: path2 },
2327
2331
  config: { cwd }
2328
2332
  } = ctx;
2329
- return pipe2(
2333
+ return pipe(
2330
2334
  { file: path2.abs(cwd, file) },
2331
- tap2(() => logger3.debug("file:extract", file)),
2332
- Obj2.bind("measure", () => logger3.time.debug(`Extracted ${file}`)),
2333
- Obj2.bind(
2335
+ tap(() => logger3.debug("file:extract", file)),
2336
+ Obj.bind("measure", () => logger3.time.debug(`Extracted ${file}`)),
2337
+ Obj.bind(
2334
2338
  "result",
2335
2339
  tryCatch(
2336
2340
  ({ file: file2 }) => ctx.project.parseSourceFile(file2),
2337
2341
  (error) => logger3.error("file:parse", error)
2338
2342
  )
2339
2343
  ),
2340
- Obj2.bind("measureCss", () => logger3.time.debug(`Parsed ${file}`)),
2341
- Obj2.bind("css", ({ result }) => result ? ctx.getParserCss(result) : void 0),
2342
- tap2(({ measure, measureCss }) => [measureCss(), measure()]),
2343
- 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")
2344
2348
  );
2345
2349
  }
2346
2350
  function extractFiles(ctx) {
@@ -2443,7 +2447,10 @@ var Builder = class {
2443
2447
  const newModified = /* @__PURE__ */ new Map();
2444
2448
  const prevModified = configCache.get(configPath)?.depsModifiedMap;
2445
2449
  for (const file of deps) {
2446
- const time = statSync(file).mtimeMs;
2450
+ const stats = statSync(file, { throwIfNoEntry: false });
2451
+ if (!stats)
2452
+ continue;
2453
+ const time = stats.mtimeMs;
2447
2454
  newModified.set(file, time);
2448
2455
  if (!prevModified || !prevModified.has(file) || time > prevModified.get(file)) {
2449
2456
  modified = true;
@@ -2470,19 +2477,10 @@ var Builder = class {
2470
2477
  async setup(options = {}) {
2471
2478
  logger4.debug("builder", "\u{1F6A7} Setup");
2472
2479
  const configPath = options.configPath ?? this.getConfigPath();
2473
- let tsOptions = { baseUrl: void 0, pathMappings: [] };
2474
- if (this.context?.tsconfig) {
2475
- const options2 = this.context.tsconfig.compilerOptions;
2476
- if (options2?.paths) {
2477
- const baseUrl = options2.baseUrl;
2478
- tsOptions = {
2479
- baseUrl,
2480
- pathMappings: convertTsPathsToRegexes(options2?.paths, baseUrl ?? this.context.config.cwd)
2481
- };
2482
- }
2483
- }
2484
- const { deps: foundDeps } = getConfigDependencies(configPath, tsOptions);
2485
- const cwd = this.context?.config.cwd ?? dirname2(configPath);
2480
+ const tsOptions = this.context?.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
2481
+ const compilerOptions = this.context?.tsconfig?.compilerOptions ?? {};
2482
+ const { deps: foundDeps } = getConfigDependencies(configPath, tsOptions, compilerOptions);
2483
+ const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
2486
2484
  const configDeps = /* @__PURE__ */ new Set([...foundDeps, ...(this.context?.dependencies ?? []).map((file) => resolve2(cwd, file))]);
2487
2485
  this.configDependencies = configDeps;
2488
2486
  const deps = this.checkConfigDeps(configPath, configDeps);
@@ -2796,7 +2794,7 @@ outExtension: '${outExtension}',` : ""}
2796
2794
  outdir: "styled-system",
2797
2795
  ${jsxFramework ? `
2798
2796
  // The JSX framework to use
2799
- jsxFramework: '${jsxFramework}'` : ""}
2797
+ jsxFramework: '${jsxFramework}',` : ""}
2800
2798
  ${syntax ? `
2801
2799
  // The CSS Syntax to use to use
2802
2800
  syntax: '${syntax}'` : ""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -31,20 +31,20 @@
31
31
  "pluralize": "8.0.0",
32
32
  "postcss": "8.4.25",
33
33
  "preferred-pm": "^3.0.3",
34
- "ts-morph": "18.0.0",
35
- "ts-pattern": "5.0.1",
34
+ "ts-morph": "19.0.0",
35
+ "ts-pattern": "5.0.4",
36
36
  "tsconfck": "^2.1.1",
37
- "@pandacss/config": "0.7.0",
38
- "@pandacss/core": "0.7.0",
39
- "@pandacss/error": "0.7.0",
40
- "@pandacss/extractor": "0.7.0",
41
- "@pandacss/generator": "0.7.0",
42
- "@pandacss/is-valid-prop": "0.7.0",
43
- "@pandacss/logger": "0.7.0",
44
- "@pandacss/parser": "0.7.0",
45
- "@pandacss/shared": "0.7.0",
46
- "@pandacss/token-dictionary": "0.7.0",
47
- "@pandacss/types": "0.7.0"
37
+ "@pandacss/config": "0.9.0",
38
+ "@pandacss/core": "0.9.0",
39
+ "@pandacss/error": "0.9.0",
40
+ "@pandacss/extractor": "0.9.0",
41
+ "@pandacss/generator": "0.9.0",
42
+ "@pandacss/is-valid-prop": "0.9.0",
43
+ "@pandacss/logger": "0.9.0",
44
+ "@pandacss/parser": "0.9.0",
45
+ "@pandacss/shared": "0.9.0",
46
+ "@pandacss/token-dictionary": "0.9.0",
47
+ "@pandacss/types": "0.9.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/fs-extra": "11.0.1",
@@ -53,7 +53,7 @@
53
53
  "@types/lodash.merge": "4.6.7",
54
54
  "@types/pluralize": "0.0.30",
55
55
  "boxen": "^7.1.1",
56
- "@pandacss/fixture": "0.7.0"
56
+ "@pandacss/fixture": "0.9.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",