@pandacss/node 0.0.2 → 0.3.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/LICENSE.md +1 -1
- package/dist/index.d.ts +27 -12
- package/dist/index.js +254 -340
- package/dist/index.mjs +236 -324
- package/package.json +14 -16
package/dist/index.mjs
CHANGED
|
@@ -34,83 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
mod
|
|
35
35
|
));
|
|
36
36
|
|
|
37
|
-
// ../../node_modules/.pnpm/tsup@6.7.
|
|
37
|
+
// ../../node_modules/.pnpm/tsup@6.7.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.
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// ../../node_modules/.pnpm/duplexer@0.1.2/node_modules/duplexer/index.js
|
|
44
|
-
var require_duplexer = __commonJS({
|
|
45
|
-
"../../node_modules/.pnpm/duplexer@0.1.2/node_modules/duplexer/index.js"(exports, module) {
|
|
46
|
-
init_esm_shims();
|
|
47
|
-
var Stream = __require("stream");
|
|
48
|
-
var writeMethods = ["write", "end", "destroy"];
|
|
49
|
-
var readMethods = ["resume", "pause"];
|
|
50
|
-
var readEvents = ["data", "close"];
|
|
51
|
-
var slice = Array.prototype.slice;
|
|
52
|
-
module.exports = duplex;
|
|
53
|
-
function forEach(arr, fn) {
|
|
54
|
-
if (arr.forEach) {
|
|
55
|
-
return arr.forEach(fn);
|
|
56
|
-
}
|
|
57
|
-
for (var i = 0; i < arr.length; i++) {
|
|
58
|
-
fn(arr[i], i);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function duplex(writer, reader) {
|
|
62
|
-
var stream = new Stream();
|
|
63
|
-
var ended = false;
|
|
64
|
-
forEach(writeMethods, proxyWriter);
|
|
65
|
-
forEach(readMethods, proxyReader);
|
|
66
|
-
forEach(readEvents, proxyStream);
|
|
67
|
-
reader.on("end", handleEnd);
|
|
68
|
-
writer.on("drain", function() {
|
|
69
|
-
stream.emit("drain");
|
|
70
|
-
});
|
|
71
|
-
writer.on("error", reemit);
|
|
72
|
-
reader.on("error", reemit);
|
|
73
|
-
stream.writable = writer.writable;
|
|
74
|
-
stream.readable = reader.readable;
|
|
75
|
-
return stream;
|
|
76
|
-
function proxyWriter(methodName) {
|
|
77
|
-
stream[methodName] = method;
|
|
78
|
-
function method() {
|
|
79
|
-
return writer[methodName].apply(writer, arguments);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function proxyReader(methodName) {
|
|
83
|
-
stream[methodName] = method;
|
|
84
|
-
function method() {
|
|
85
|
-
stream.emit(methodName);
|
|
86
|
-
var func = reader[methodName];
|
|
87
|
-
if (func) {
|
|
88
|
-
return func.apply(reader, arguments);
|
|
89
|
-
}
|
|
90
|
-
reader.emit(methodName);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function proxyStream(methodName) {
|
|
94
|
-
reader.on(methodName, reemit2);
|
|
95
|
-
function reemit2() {
|
|
96
|
-
var args = slice.call(arguments);
|
|
97
|
-
args.unshift(methodName);
|
|
98
|
-
stream.emit.apply(stream, args);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function handleEnd() {
|
|
102
|
-
if (ended) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
ended = true;
|
|
106
|
-
var args = slice.call(arguments);
|
|
107
|
-
args.unshift("end");
|
|
108
|
-
stream.emit.apply(stream, args);
|
|
109
|
-
}
|
|
110
|
-
function reemit(err) {
|
|
111
|
-
stream.emit("error", err);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
39
|
+
"../../node_modules/.pnpm/tsup@6.7.0_postcss@8.4.24_typescript@5.1.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
114
40
|
}
|
|
115
41
|
});
|
|
116
42
|
|
|
@@ -480,8 +406,9 @@ import { discardDuplicate as discardDuplicate2 } from "@pandacss/core";
|
|
|
480
406
|
// src/analyze-tokens.ts
|
|
481
407
|
init_esm_shims();
|
|
482
408
|
import { logger } from "@pandacss/logger";
|
|
409
|
+
import { filesize } from "filesize";
|
|
483
410
|
import { writeFile } from "fs/promises";
|
|
484
|
-
import
|
|
411
|
+
import zlib from "zlib";
|
|
485
412
|
|
|
486
413
|
// src/classify.ts
|
|
487
414
|
init_esm_shims();
|
|
@@ -533,7 +460,7 @@ var classifyTokens = (ctx, parserResultByFilepath) => {
|
|
|
533
460
|
}
|
|
534
461
|
if (type === "pattern") {
|
|
535
462
|
const pattern = ctx.patterns.getConfig(from.toLowerCase());
|
|
536
|
-
const patternProp = pattern
|
|
463
|
+
const patternProp = pattern?.properties?.[propName];
|
|
537
464
|
if (!patternProp)
|
|
538
465
|
return false;
|
|
539
466
|
if (patternProp.type === "boolean" || patternProp.type === "number") {
|
|
@@ -745,56 +672,25 @@ var getMostUsedInMap = (map, pickCount) => {
|
|
|
745
672
|
return Array.from(map.entries()).map(([key, list]) => [key, list.size]).sort((a, b) => b[1] - a[1]).slice(0, pickCount).map(([key, count]) => ({ key, count }));
|
|
746
673
|
};
|
|
747
674
|
|
|
748
|
-
// src/get-node-range.ts
|
|
749
|
-
init_esm_shims();
|
|
750
|
-
var getNodeRange = (node) => {
|
|
751
|
-
const src = node.getSourceFile();
|
|
752
|
-
const [startPosition, endPosition] = [node.getStart(), node.getEnd()];
|
|
753
|
-
const startInfo = src.getLineAndColumnAtPos(startPosition);
|
|
754
|
-
const endInfo = src.getLineAndColumnAtPos(endPosition);
|
|
755
|
-
return {
|
|
756
|
-
startPosition,
|
|
757
|
-
startLineNumber: startInfo.line,
|
|
758
|
-
startColumn: startInfo.column,
|
|
759
|
-
endPosition,
|
|
760
|
-
endLineNumber: endInfo.line,
|
|
761
|
-
endColumn: endInfo.column
|
|
762
|
-
};
|
|
763
|
-
};
|
|
764
|
-
|
|
765
|
-
// src/analyze-tokens.ts
|
|
766
|
-
import { filesize } from "filesize";
|
|
767
|
-
|
|
768
|
-
// ../../node_modules/.pnpm/gzip-size@7.0.0/node_modules/gzip-size/index.js
|
|
769
|
-
init_esm_shims();
|
|
770
|
-
var import_duplexer = __toESM(require_duplexer(), 1);
|
|
771
|
-
import zlib from "node:zlib";
|
|
772
|
-
import { promisify } from "node:util";
|
|
773
|
-
var getOptions = (options) => ({ level: 9, ...options });
|
|
774
|
-
var gzip = promisify(zlib.gzip);
|
|
775
|
-
function gzipSizeSync(input, options) {
|
|
776
|
-
return zlib.gzipSync(input, getOptions(options)).length;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
675
|
// src/analyze-tokens.ts
|
|
676
|
+
var gzipSizeSync = (code) => zlib.gzipSync(code, { level: zlib.constants.Z_BEST_COMPRESSION }).length;
|
|
780
677
|
function analyzeTokens(ctx, options = {}) {
|
|
781
|
-
const
|
|
782
|
-
const
|
|
783
|
-
const
|
|
784
|
-
|
|
678
|
+
const filesMap = /* @__PURE__ */ new Map();
|
|
679
|
+
const timesMap = /* @__PURE__ */ new Map();
|
|
680
|
+
const files = ctx.getFiles();
|
|
681
|
+
files.forEach((file) => {
|
|
785
682
|
const start2 = performance.now();
|
|
786
683
|
const result = ctx.project.parseSourceFile(file);
|
|
787
684
|
const extractMs = performance.now() - start2;
|
|
788
|
-
|
|
685
|
+
timesMap.set(file, extractMs);
|
|
789
686
|
logger.debug("analyze", `Parsed ${file} in ${extractMs}ms`);
|
|
790
687
|
if (result) {
|
|
791
|
-
|
|
688
|
+
filesMap.set(file, result);
|
|
792
689
|
options.onResult?.(file, result);
|
|
793
690
|
}
|
|
794
|
-
return [file, result];
|
|
795
691
|
});
|
|
796
|
-
const totalMs = Array.from(
|
|
797
|
-
logger.debug("analyze", `Analyzed ${
|
|
692
|
+
const totalMs = Array.from(timesMap.values()).reduce((a, b) => a + b, 0);
|
|
693
|
+
logger.debug("analyze", `Analyzed ${files.length} files in ${totalMs.toFixed(2)}ms`);
|
|
798
694
|
const minify = ctx.config.minify;
|
|
799
695
|
const chunkFiles = ctx.chunks.getFiles();
|
|
800
696
|
ctx.config.optimize = true;
|
|
@@ -804,18 +700,17 @@ function analyzeTokens(ctx, options = {}) {
|
|
|
804
700
|
const minifiedCss = ctx.getCss({ files: chunkFiles });
|
|
805
701
|
ctx.config.minify = minify;
|
|
806
702
|
const start = performance.now();
|
|
807
|
-
const analysis = classifyTokens(ctx,
|
|
703
|
+
const analysis = classifyTokens(ctx, filesMap);
|
|
808
704
|
const classifyMs = performance.now() - start;
|
|
809
705
|
return Object.assign(
|
|
810
706
|
{
|
|
811
707
|
duration: {
|
|
812
|
-
extractTimeByFiles: Object.fromEntries(
|
|
708
|
+
extractTimeByFiles: Object.fromEntries(timesMap.entries()),
|
|
813
709
|
extractTotal: totalMs,
|
|
814
710
|
classify: classifyMs
|
|
815
711
|
},
|
|
816
712
|
fileSizes: {
|
|
817
713
|
lineCount: css.split("\n").length,
|
|
818
|
-
// rulesCount: css.split('{').length - 1, ?
|
|
819
714
|
normal: filesize(Buffer.byteLength(css, "utf-8")),
|
|
820
715
|
minified: filesize(Buffer.byteLength(minifiedCss, "utf-8")),
|
|
821
716
|
gzip: {
|
|
@@ -834,14 +729,11 @@ var analyzeResultSerializer = (_key, value) => {
|
|
|
834
729
|
if (value instanceof Map) {
|
|
835
730
|
return Object.fromEntries(value);
|
|
836
731
|
}
|
|
837
|
-
if (Node.isNode(value)) {
|
|
838
|
-
return { kind: value.getKindName(), range: getNodeRange(value) };
|
|
839
|
-
}
|
|
840
732
|
return value;
|
|
841
733
|
};
|
|
842
734
|
var writeAnalyzeJSON = (fileName, result, ctx) => {
|
|
843
735
|
result.details.byInstanceId.forEach((item) => {
|
|
844
|
-
item.box =
|
|
736
|
+
item.box = item.box.toJSON();
|
|
845
737
|
});
|
|
846
738
|
return writeFile(
|
|
847
739
|
fileName,
|
|
@@ -862,6 +754,7 @@ var writeAnalyzeJSON = (fileName, result, ctx) => {
|
|
|
862
754
|
|
|
863
755
|
// src/builder.ts
|
|
864
756
|
init_esm_shims();
|
|
757
|
+
import { getConfigDependencies } from "@pandacss/config";
|
|
865
758
|
import { discardDuplicate, mergeCss as mergeCss2 } from "@pandacss/core";
|
|
866
759
|
import { ConfigNotFoundError } from "@pandacss/error";
|
|
867
760
|
import { logger as logger4 } from "@pandacss/logger";
|
|
@@ -872,6 +765,7 @@ import { resolve as resolve2 } from "path";
|
|
|
872
765
|
// src/config.ts
|
|
873
766
|
init_esm_shims();
|
|
874
767
|
import { loadConfigFile } from "@pandacss/config";
|
|
768
|
+
import { createDebugger, createHooks } from "hookable";
|
|
875
769
|
import { lookItUpSync } from "look-it-up";
|
|
876
770
|
|
|
877
771
|
// src/create-context.ts
|
|
@@ -883,18 +777,22 @@ import { Obj, pipe, tap } from "lil-fp";
|
|
|
883
777
|
// src/chunk-engine.ts
|
|
884
778
|
init_esm_shims();
|
|
885
779
|
import { mergeCss } from "@pandacss/core";
|
|
886
|
-
var getChunkEngine = ({
|
|
887
|
-
|
|
780
|
+
var getChunkEngine = ({
|
|
781
|
+
paths,
|
|
782
|
+
config,
|
|
783
|
+
runtime: { path: path2, fs }
|
|
784
|
+
}) => ({
|
|
785
|
+
dir: path2.join(...paths.chunk),
|
|
888
786
|
readFile(file) {
|
|
889
|
-
const fileName =
|
|
890
|
-
return
|
|
787
|
+
const fileName = path2.join(...paths.chunk, this.format(file));
|
|
788
|
+
return fs.existsSync(fileName) ? fs.readFileSync(fileName) : "";
|
|
891
789
|
},
|
|
892
790
|
getFiles() {
|
|
893
|
-
const files =
|
|
894
|
-
return files.map((file) =>
|
|
791
|
+
const files = fs.existsSync(this.dir) ? fs.readDirSync(this.dir) : [];
|
|
792
|
+
return files.map((file) => fs.readFileSync(path2.join(this.dir, file)));
|
|
895
793
|
},
|
|
896
794
|
format(file) {
|
|
897
|
-
return
|
|
795
|
+
return path2.relative(config.cwd, file).replaceAll(path2.sep, "__").replace(path2.extname(file), ".css");
|
|
898
796
|
},
|
|
899
797
|
getArtifact(file, css) {
|
|
900
798
|
const fileName = this.format(file);
|
|
@@ -905,10 +803,10 @@ var getChunkEngine = ({ paths, config, runtime: { path: path3, fs: fs2 } }) => (
|
|
|
905
803
|
};
|
|
906
804
|
},
|
|
907
805
|
rm(file) {
|
|
908
|
-
return
|
|
806
|
+
return fs.rmFileSync(path2.join(...paths.chunk, this.format(file)));
|
|
909
807
|
},
|
|
910
808
|
empty() {
|
|
911
|
-
return
|
|
809
|
+
return fs.rmDirSync(this.dir);
|
|
912
810
|
},
|
|
913
811
|
get glob() {
|
|
914
812
|
return [`${this.dir}/**/*.css`];
|
|
@@ -957,15 +855,19 @@ var nodeRuntime = {
|
|
|
957
855
|
glob(opts) {
|
|
958
856
|
if (!opts.include)
|
|
959
857
|
return [];
|
|
960
|
-
|
|
858
|
+
const ignore = opts.exclude ?? [];
|
|
859
|
+
if (!ignore.length) {
|
|
860
|
+
ignore.push("**/*.d.ts");
|
|
861
|
+
}
|
|
862
|
+
return glob.sync(opts.include, { cwd: opts.cwd, ignore, absolute: true });
|
|
961
863
|
},
|
|
962
864
|
writeFile: writeFile2,
|
|
963
865
|
writeFileSync,
|
|
964
866
|
readDirSync: readdirSync,
|
|
965
867
|
rmDirSync: emptyDirSync,
|
|
966
868
|
rmFileSync: removeSync,
|
|
967
|
-
ensureDirSync(
|
|
968
|
-
return ensureDirSync(
|
|
869
|
+
ensureDirSync(path2) {
|
|
870
|
+
return ensureDirSync(path2);
|
|
969
871
|
},
|
|
970
872
|
watch(options) {
|
|
971
873
|
const { include, exclude, cwd, poll } = options;
|
|
@@ -996,20 +898,23 @@ process.on("uncaughtException", (reason) => {
|
|
|
996
898
|
|
|
997
899
|
// src/output-engine.ts
|
|
998
900
|
init_esm_shims();
|
|
999
|
-
var getOutputEngine = ({
|
|
901
|
+
var getOutputEngine = ({
|
|
902
|
+
paths,
|
|
903
|
+
runtime: { path: path2, fs }
|
|
904
|
+
}) => ({
|
|
1000
905
|
empty() {
|
|
1001
|
-
|
|
906
|
+
fs.rmDirSync(path2.join(...paths.root));
|
|
1002
907
|
},
|
|
1003
908
|
async write(output) {
|
|
1004
909
|
if (!output)
|
|
1005
910
|
return;
|
|
1006
911
|
const { dir = paths.root, files } = output;
|
|
1007
|
-
|
|
912
|
+
fs.ensureDirSync(path2.join(...dir));
|
|
1008
913
|
return Promise.all(
|
|
1009
914
|
files.map(async ({ file, code }) => {
|
|
1010
|
-
const absPath =
|
|
915
|
+
const absPath = path2.join(...dir, file);
|
|
1011
916
|
if (code) {
|
|
1012
|
-
return
|
|
917
|
+
return fs.writeFile(absPath, code);
|
|
1013
918
|
}
|
|
1014
919
|
})
|
|
1015
920
|
);
|
|
@@ -1020,18 +925,19 @@ var getOutputEngine = ({ paths, runtime: { path: path3, fs: fs2 } }) => ({
|
|
|
1020
925
|
var createContext = (conf) => pipe(
|
|
1021
926
|
conf,
|
|
1022
927
|
createGenerator,
|
|
1023
|
-
Obj.assign({ runtime: nodeRuntime }),
|
|
928
|
+
Obj.assign({ runtime: nodeRuntime, hooks: conf.hooks }),
|
|
1024
929
|
tap(({ config, runtime }) => {
|
|
1025
930
|
config.cwd ||= runtime.cwd();
|
|
1026
931
|
}),
|
|
1027
|
-
Obj.bind("getFiles", ({ config, runtime: { fs
|
|
932
|
+
Obj.bind("getFiles", ({ config, runtime: { fs } }) => () => {
|
|
1028
933
|
const { include, exclude, cwd } = config;
|
|
1029
|
-
return
|
|
934
|
+
return fs.glob({ include, exclude, cwd });
|
|
1030
935
|
}),
|
|
1031
|
-
Obj.bind("project", ({ getFiles, runtime: { fs
|
|
936
|
+
Obj.bind("project", ({ getFiles, runtime: { fs }, parserOptions }) => {
|
|
1032
937
|
return createProject({
|
|
1033
938
|
getFiles,
|
|
1034
|
-
readFile:
|
|
939
|
+
readFile: fs.readFileSync,
|
|
940
|
+
hooks: conf.hooks,
|
|
1035
941
|
parserOptions
|
|
1036
942
|
});
|
|
1037
943
|
}),
|
|
@@ -1050,6 +956,7 @@ function findConfig() {
|
|
|
1050
956
|
}
|
|
1051
957
|
}
|
|
1052
958
|
async function loadConfigAndCreateContext(options = {}) {
|
|
959
|
+
const hooks = createHooks();
|
|
1053
960
|
const { cwd = process.cwd(), config, configPath } = options;
|
|
1054
961
|
const conf = await loadConfigFile({ cwd, file: configPath });
|
|
1055
962
|
if (config) {
|
|
@@ -1058,7 +965,15 @@ async function loadConfigAndCreateContext(options = {}) {
|
|
|
1058
965
|
if (options.cwd) {
|
|
1059
966
|
conf.config.cwd = options.cwd;
|
|
1060
967
|
}
|
|
1061
|
-
|
|
968
|
+
conf.config.outdir ??= "styled-system";
|
|
969
|
+
if (conf.config.hooks) {
|
|
970
|
+
hooks.addHooks(conf.config.hooks);
|
|
971
|
+
}
|
|
972
|
+
await hooks.callHook("config:resolved", conf);
|
|
973
|
+
if (conf.config.logLevel === "debug") {
|
|
974
|
+
createDebugger(hooks, { tag: "panda" });
|
|
975
|
+
}
|
|
976
|
+
return createContext({ ...conf, hooks });
|
|
1062
977
|
}
|
|
1063
978
|
|
|
1064
979
|
// src/extract.ts
|
|
@@ -1076,7 +991,7 @@ import process3 from "node:process";
|
|
|
1076
991
|
// ../../node_modules/.pnpm/string-width@5.1.2/node_modules/string-width/index.js
|
|
1077
992
|
init_esm_shims();
|
|
1078
993
|
|
|
1079
|
-
// ../../node_modules/.pnpm/strip-ansi@7.0
|
|
994
|
+
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
|
1080
995
|
init_esm_shims();
|
|
1081
996
|
|
|
1082
997
|
// ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
|
|
@@ -1089,12 +1004,13 @@ function ansiRegex({ onlyFirst = false } = {}) {
|
|
|
1089
1004
|
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
1090
1005
|
}
|
|
1091
1006
|
|
|
1092
|
-
// ../../node_modules/.pnpm/strip-ansi@7.0
|
|
1007
|
+
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
|
1008
|
+
var regex = ansiRegex();
|
|
1093
1009
|
function stripAnsi(string) {
|
|
1094
1010
|
if (typeof string !== "string") {
|
|
1095
1011
|
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
1096
1012
|
}
|
|
1097
|
-
return string.replace(
|
|
1013
|
+
return string.replace(regex, "");
|
|
1098
1014
|
}
|
|
1099
1015
|
|
|
1100
1016
|
// ../../node_modules/.pnpm/string-width@5.1.2/node_modules/string-width/index.js
|
|
@@ -1736,70 +1652,78 @@ var import_ansi_align = __toESM(require_ansi_align(), 1);
|
|
|
1736
1652
|
// ../../node_modules/.pnpm/wrap-ansi@8.1.0/node_modules/wrap-ansi/index.js
|
|
1737
1653
|
init_esm_shims();
|
|
1738
1654
|
|
|
1739
|
-
// ../../node_modules/.pnpm/ansi-styles@6.
|
|
1655
|
+
// ../../node_modules/.pnpm/ansi-styles@6.2.1/node_modules/ansi-styles/index.js
|
|
1740
1656
|
init_esm_shims();
|
|
1741
1657
|
var ANSI_BACKGROUND_OFFSET2 = 10;
|
|
1742
1658
|
var wrapAnsi162 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
1743
1659
|
var wrapAnsi2562 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
1744
1660
|
var wrapAnsi16m2 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
1661
|
+
var styles3 = {
|
|
1662
|
+
modifier: {
|
|
1663
|
+
reset: [0, 0],
|
|
1664
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
1665
|
+
bold: [1, 22],
|
|
1666
|
+
dim: [2, 22],
|
|
1667
|
+
italic: [3, 23],
|
|
1668
|
+
underline: [4, 24],
|
|
1669
|
+
overline: [53, 55],
|
|
1670
|
+
inverse: [7, 27],
|
|
1671
|
+
hidden: [8, 28],
|
|
1672
|
+
strikethrough: [9, 29]
|
|
1673
|
+
},
|
|
1674
|
+
color: {
|
|
1675
|
+
black: [30, 39],
|
|
1676
|
+
red: [31, 39],
|
|
1677
|
+
green: [32, 39],
|
|
1678
|
+
yellow: [33, 39],
|
|
1679
|
+
blue: [34, 39],
|
|
1680
|
+
magenta: [35, 39],
|
|
1681
|
+
cyan: [36, 39],
|
|
1682
|
+
white: [37, 39],
|
|
1683
|
+
// Bright color
|
|
1684
|
+
blackBright: [90, 39],
|
|
1685
|
+
gray: [90, 39],
|
|
1686
|
+
// Alias of `blackBright`
|
|
1687
|
+
grey: [90, 39],
|
|
1688
|
+
// Alias of `blackBright`
|
|
1689
|
+
redBright: [91, 39],
|
|
1690
|
+
greenBright: [92, 39],
|
|
1691
|
+
yellowBright: [93, 39],
|
|
1692
|
+
blueBright: [94, 39],
|
|
1693
|
+
magentaBright: [95, 39],
|
|
1694
|
+
cyanBright: [96, 39],
|
|
1695
|
+
whiteBright: [97, 39]
|
|
1696
|
+
},
|
|
1697
|
+
bgColor: {
|
|
1698
|
+
bgBlack: [40, 49],
|
|
1699
|
+
bgRed: [41, 49],
|
|
1700
|
+
bgGreen: [42, 49],
|
|
1701
|
+
bgYellow: [43, 49],
|
|
1702
|
+
bgBlue: [44, 49],
|
|
1703
|
+
bgMagenta: [45, 49],
|
|
1704
|
+
bgCyan: [46, 49],
|
|
1705
|
+
bgWhite: [47, 49],
|
|
1706
|
+
// Bright color
|
|
1707
|
+
bgBlackBright: [100, 49],
|
|
1708
|
+
bgGray: [100, 49],
|
|
1709
|
+
// Alias of `bgBlackBright`
|
|
1710
|
+
bgGrey: [100, 49],
|
|
1711
|
+
// Alias of `bgBlackBright`
|
|
1712
|
+
bgRedBright: [101, 49],
|
|
1713
|
+
bgGreenBright: [102, 49],
|
|
1714
|
+
bgYellowBright: [103, 49],
|
|
1715
|
+
bgBlueBright: [104, 49],
|
|
1716
|
+
bgMagentaBright: [105, 49],
|
|
1717
|
+
bgCyanBright: [106, 49],
|
|
1718
|
+
bgWhiteBright: [107, 49]
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
var modifierNames2 = Object.keys(styles3.modifier);
|
|
1722
|
+
var foregroundColorNames2 = Object.keys(styles3.color);
|
|
1723
|
+
var backgroundColorNames2 = Object.keys(styles3.bgColor);
|
|
1724
|
+
var colorNames2 = [...foregroundColorNames2, ...backgroundColorNames2];
|
|
1745
1725
|
function assembleStyles2() {
|
|
1746
1726
|
const codes = /* @__PURE__ */ new Map();
|
|
1747
|
-
const styles3 = {
|
|
1748
|
-
modifier: {
|
|
1749
|
-
reset: [0, 0],
|
|
1750
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
1751
|
-
bold: [1, 22],
|
|
1752
|
-
dim: [2, 22],
|
|
1753
|
-
italic: [3, 23],
|
|
1754
|
-
underline: [4, 24],
|
|
1755
|
-
overline: [53, 55],
|
|
1756
|
-
inverse: [7, 27],
|
|
1757
|
-
hidden: [8, 28],
|
|
1758
|
-
strikethrough: [9, 29]
|
|
1759
|
-
},
|
|
1760
|
-
color: {
|
|
1761
|
-
black: [30, 39],
|
|
1762
|
-
red: [31, 39],
|
|
1763
|
-
green: [32, 39],
|
|
1764
|
-
yellow: [33, 39],
|
|
1765
|
-
blue: [34, 39],
|
|
1766
|
-
magenta: [35, 39],
|
|
1767
|
-
cyan: [36, 39],
|
|
1768
|
-
white: [37, 39],
|
|
1769
|
-
// Bright color
|
|
1770
|
-
blackBright: [90, 39],
|
|
1771
|
-
redBright: [91, 39],
|
|
1772
|
-
greenBright: [92, 39],
|
|
1773
|
-
yellowBright: [93, 39],
|
|
1774
|
-
blueBright: [94, 39],
|
|
1775
|
-
magentaBright: [95, 39],
|
|
1776
|
-
cyanBright: [96, 39],
|
|
1777
|
-
whiteBright: [97, 39]
|
|
1778
|
-
},
|
|
1779
|
-
bgColor: {
|
|
1780
|
-
bgBlack: [40, 49],
|
|
1781
|
-
bgRed: [41, 49],
|
|
1782
|
-
bgGreen: [42, 49],
|
|
1783
|
-
bgYellow: [43, 49],
|
|
1784
|
-
bgBlue: [44, 49],
|
|
1785
|
-
bgMagenta: [45, 49],
|
|
1786
|
-
bgCyan: [46, 49],
|
|
1787
|
-
bgWhite: [47, 49],
|
|
1788
|
-
// Bright color
|
|
1789
|
-
bgBlackBright: [100, 49],
|
|
1790
|
-
bgRedBright: [101, 49],
|
|
1791
|
-
bgGreenBright: [102, 49],
|
|
1792
|
-
bgYellowBright: [103, 49],
|
|
1793
|
-
bgBlueBright: [104, 49],
|
|
1794
|
-
bgMagentaBright: [105, 49],
|
|
1795
|
-
bgCyanBright: [106, 49],
|
|
1796
|
-
bgWhiteBright: [107, 49]
|
|
1797
|
-
}
|
|
1798
|
-
};
|
|
1799
|
-
styles3.color.gray = styles3.color.blackBright;
|
|
1800
|
-
styles3.bgColor.bgGray = styles3.bgColor.bgBlackBright;
|
|
1801
|
-
styles3.color.grey = styles3.color.blackBright;
|
|
1802
|
-
styles3.bgColor.bgGrey = styles3.bgColor.bgBlackBright;
|
|
1803
1727
|
for (const [groupName, group] of Object.entries(styles3)) {
|
|
1804
1728
|
for (const [styleName, style] of Object.entries(group)) {
|
|
1805
1729
|
styles3[styleName] = {
|
|
@@ -2364,8 +2288,8 @@ async function bundleChunks(ctx) {
|
|
|
2364
2288
|
});
|
|
2365
2289
|
}
|
|
2366
2290
|
async function writeFileChunk(ctx, file) {
|
|
2367
|
-
const { path:
|
|
2368
|
-
logger3.debug("chunk:write", `File: ${
|
|
2291
|
+
const { path: path2 } = ctx.runtime;
|
|
2292
|
+
logger3.debug("chunk:write", `File: ${path2.relative(ctx.config.cwd, file)}`);
|
|
2369
2293
|
const css = extractFile(ctx, file);
|
|
2370
2294
|
if (!css)
|
|
2371
2295
|
return;
|
|
@@ -2374,11 +2298,11 @@ async function writeFileChunk(ctx, file) {
|
|
|
2374
2298
|
}
|
|
2375
2299
|
function extractFile(ctx, file) {
|
|
2376
2300
|
const {
|
|
2377
|
-
runtime: { path:
|
|
2301
|
+
runtime: { path: path2 },
|
|
2378
2302
|
config: { cwd }
|
|
2379
2303
|
} = ctx;
|
|
2380
2304
|
return pipe2(
|
|
2381
|
-
{ file:
|
|
2305
|
+
{ file: path2.abs(cwd, file) },
|
|
2382
2306
|
tap2(() => logger3.debug("file:extract", file)),
|
|
2383
2307
|
Obj2.bind("measure", () => logger3.time.debug(`Extracted ${file}`)),
|
|
2384
2308
|
Obj2.bind(
|
|
@@ -2420,58 +2344,6 @@ async function extractCss(ctx) {
|
|
|
2420
2344
|
return ctx.messages.buildComplete(ctx.getFiles().length);
|
|
2421
2345
|
}
|
|
2422
2346
|
|
|
2423
|
-
// src/get-mod-deps.ts
|
|
2424
|
-
init_esm_shims();
|
|
2425
|
-
import fs from "fs";
|
|
2426
|
-
import path from "path";
|
|
2427
|
-
var jsExtensions = [".js", ".cjs", ".mjs"];
|
|
2428
|
-
var jsResolutionOrder = ["", ".js", ".cjs", ".mjs", ".ts", ".cts", ".mts", ".jsx", ".tsx"];
|
|
2429
|
-
var tsResolutionOrder = ["", ".ts", ".cts", ".mts", ".tsx", ".js", ".cjs", ".mjs", ".jsx"];
|
|
2430
|
-
function resolveWithExtension(file, extensions) {
|
|
2431
|
-
for (const ext of extensions) {
|
|
2432
|
-
const full = `${file}${ext}`;
|
|
2433
|
-
if (fs.existsSync(full) && fs.statSync(full).isFile()) {
|
|
2434
|
-
return full;
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2437
|
-
for (const ext of extensions) {
|
|
2438
|
-
const full = `${file}/index${ext}`;
|
|
2439
|
-
if (fs.existsSync(full)) {
|
|
2440
|
-
return full;
|
|
2441
|
-
}
|
|
2442
|
-
}
|
|
2443
|
-
return null;
|
|
2444
|
-
}
|
|
2445
|
-
function* getDeps(filename, base, seen, ext = path.extname(filename)) {
|
|
2446
|
-
const absoluteFile = resolveWithExtension(
|
|
2447
|
-
path.resolve(base, filename),
|
|
2448
|
-
jsExtensions.includes(ext) ? jsResolutionOrder : tsResolutionOrder
|
|
2449
|
-
);
|
|
2450
|
-
if (absoluteFile === null)
|
|
2451
|
-
return;
|
|
2452
|
-
if (seen.has(absoluteFile))
|
|
2453
|
-
return;
|
|
2454
|
-
seen.add(absoluteFile);
|
|
2455
|
-
yield absoluteFile;
|
|
2456
|
-
base = path.dirname(absoluteFile);
|
|
2457
|
-
ext = path.extname(absoluteFile);
|
|
2458
|
-
const contents = fs.readFileSync(absoluteFile, "utf-8");
|
|
2459
|
-
for (const match2 of [
|
|
2460
|
-
...contents.matchAll(/import[\s\S]*?['"](.{3,}?)['"]/gi),
|
|
2461
|
-
...contents.matchAll(/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi),
|
|
2462
|
-
...contents.matchAll(/require\(['"`](.+)['"`]\)/gi)
|
|
2463
|
-
]) {
|
|
2464
|
-
if (!match2[1].startsWith("."))
|
|
2465
|
-
continue;
|
|
2466
|
-
yield* getDeps(match2[1], base, seen, ext);
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2469
|
-
function getModuleDependencies(filePath) {
|
|
2470
|
-
if (filePath === null)
|
|
2471
|
-
return /* @__PURE__ */ new Set();
|
|
2472
|
-
return new Set(getDeps(filePath, path.dirname(filePath), /* @__PURE__ */ new Set()));
|
|
2473
|
-
}
|
|
2474
|
-
|
|
2475
2347
|
// src/parse-dependency.ts
|
|
2476
2348
|
init_esm_shims();
|
|
2477
2349
|
import isGlob from "is-glob";
|
|
@@ -2548,7 +2420,7 @@ var Builder = class {
|
|
|
2548
2420
|
delete __require.cache[file];
|
|
2549
2421
|
}
|
|
2550
2422
|
if (setupCount > 0) {
|
|
2551
|
-
logger4.
|
|
2423
|
+
logger4.debug("builder", "\u2699\uFE0F Config changed, reloading");
|
|
2552
2424
|
}
|
|
2553
2425
|
return { isModified: true, modifiedMap: newModified };
|
|
2554
2426
|
}
|
|
@@ -2559,15 +2431,18 @@ var Builder = class {
|
|
|
2559
2431
|
}
|
|
2560
2432
|
return configPath;
|
|
2561
2433
|
}
|
|
2562
|
-
async setup() {
|
|
2563
|
-
|
|
2564
|
-
const
|
|
2434
|
+
async setup(options = {}) {
|
|
2435
|
+
logger4.debug("builder", "\u{1F6A7} Setup");
|
|
2436
|
+
const configPath = options.configPath ?? this.getConfigPath();
|
|
2437
|
+
const { deps: configDeps } = getConfigDependencies(configPath);
|
|
2565
2438
|
const deps = this.checkConfigDeps(configPath, configDeps);
|
|
2566
2439
|
if (deps.isModified) {
|
|
2567
|
-
|
|
2440
|
+
await this.setupContext({
|
|
2568
2441
|
configPath,
|
|
2569
2442
|
depsModifiedMap: deps.modifiedMap
|
|
2570
2443
|
});
|
|
2444
|
+
const updatedCtx = this.context;
|
|
2445
|
+
await updatedCtx.hooks.callHook("config:change", updatedCtx.config);
|
|
2571
2446
|
}
|
|
2572
2447
|
const cache = configCache.get(configPath);
|
|
2573
2448
|
if (cache) {
|
|
@@ -2589,7 +2464,7 @@ var Builder = class {
|
|
|
2589
2464
|
}
|
|
2590
2465
|
configCache.set(configPath, {
|
|
2591
2466
|
context: this.context,
|
|
2592
|
-
deps: new Set(this.context.
|
|
2467
|
+
deps: new Set(this.context.dependencies ?? []),
|
|
2593
2468
|
depsModifiedMap
|
|
2594
2469
|
});
|
|
2595
2470
|
contentFilesCache.set(this.context, {
|
|
@@ -2674,17 +2549,18 @@ var Builder = class {
|
|
|
2674
2549
|
// src/debug-files.ts
|
|
2675
2550
|
init_esm_shims();
|
|
2676
2551
|
import { colors, logger as logger5 } from "@pandacss/logger";
|
|
2677
|
-
import
|
|
2678
|
-
import * as path2 from "path";
|
|
2552
|
+
import * as nodePath from "path";
|
|
2679
2553
|
async function debugFiles(ctx, options) {
|
|
2680
2554
|
const files = ctx.getFiles();
|
|
2681
2555
|
const measureTotal = logger5.time.debug(`Done parsing ${files.length} files`);
|
|
2682
2556
|
ctx.config.minify = false;
|
|
2683
2557
|
ctx.config.optimize = true;
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2558
|
+
const { fs, path: path2 } = ctx.runtime;
|
|
2559
|
+
const outdir = options.outdir;
|
|
2560
|
+
if (!options.dry && outdir) {
|
|
2561
|
+
fs.ensureDirSync(outdir);
|
|
2562
|
+
logger5.info("cli", `Writing ${colors.bold(`${outdir}/config.json`)}`);
|
|
2563
|
+
await fs.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2688
2564
|
}
|
|
2689
2565
|
const filesWithCss = [];
|
|
2690
2566
|
await Promise.all(
|
|
@@ -2694,18 +2570,7 @@ async function debugFiles(ctx, options) {
|
|
|
2694
2570
|
measure();
|
|
2695
2571
|
if (!result)
|
|
2696
2572
|
return;
|
|
2697
|
-
const list = result.
|
|
2698
|
-
const node = result2.box.getNode();
|
|
2699
|
-
const range = getNodeRange(node);
|
|
2700
|
-
return {
|
|
2701
|
-
name: result2.name,
|
|
2702
|
-
type: result2.type,
|
|
2703
|
-
data: result2.data,
|
|
2704
|
-
kind: node.getKindName(),
|
|
2705
|
-
line: range.startLineNumber,
|
|
2706
|
-
column: range.startColumn
|
|
2707
|
-
};
|
|
2708
|
-
});
|
|
2573
|
+
const list = result.toArray().map((resultItem) => resultItem.box?.toJSON?.() ?? resultItem);
|
|
2709
2574
|
const css = ctx.getParserCss(result);
|
|
2710
2575
|
if (!css)
|
|
2711
2576
|
return;
|
|
@@ -2713,17 +2578,17 @@ async function debugFiles(ctx, options) {
|
|
|
2713
2578
|
console.log({ path: file, ast: list, code: css });
|
|
2714
2579
|
return Promise.resolve();
|
|
2715
2580
|
}
|
|
2716
|
-
if (
|
|
2581
|
+
if (outdir) {
|
|
2717
2582
|
filesWithCss.push(file);
|
|
2718
|
-
const parsedPath =
|
|
2583
|
+
const parsedPath = nodePath.parse(file);
|
|
2719
2584
|
const relative3 = path2.relative(ctx.config.cwd, parsedPath.dir);
|
|
2720
2585
|
const astJsonPath = `${relative3}/${parsedPath.name}.ast.json`.replaceAll(path2.sep, "__");
|
|
2721
2586
|
const cssPath = `${relative3}/${parsedPath.name}.css`.replaceAll(path2.sep, "__");
|
|
2722
|
-
logger5.info("cli", `Writing ${colors.bold(`${
|
|
2723
|
-
logger5.info("cli", `Writing ${colors.bold(`${
|
|
2587
|
+
logger5.info("cli", `Writing ${colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2588
|
+
logger5.info("cli", `Writing ${colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2724
2589
|
return Promise.all([
|
|
2725
|
-
|
|
2726
|
-
|
|
2590
|
+
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(list, debugResultSerializer, 2)),
|
|
2591
|
+
fs.writeFile(`${outdir}/${cssPath}`, css)
|
|
2727
2592
|
]);
|
|
2728
2593
|
}
|
|
2729
2594
|
})
|
|
@@ -2786,22 +2651,23 @@ async function generate(config, configPath) {
|
|
|
2786
2651
|
const ctx = ctxRef.current;
|
|
2787
2652
|
await build(ctx);
|
|
2788
2653
|
const {
|
|
2789
|
-
runtime: { fs
|
|
2654
|
+
runtime: { fs, path: path2 },
|
|
2790
2655
|
dependencies,
|
|
2791
2656
|
config: { cwd }
|
|
2792
2657
|
} = ctx;
|
|
2793
2658
|
if (ctx.config.watch) {
|
|
2794
|
-
const configWatcher =
|
|
2659
|
+
const configWatcher = fs.watch({ include: dependencies });
|
|
2795
2660
|
configWatcher.on("change", async () => {
|
|
2796
2661
|
logger7.info("config:change", "Config changed, restarting...");
|
|
2797
2662
|
await loadCtx();
|
|
2663
|
+
await ctxRef.current.hooks.callHook("config:change", ctxRef.current.config);
|
|
2798
2664
|
return build(ctxRef.current);
|
|
2799
2665
|
});
|
|
2800
|
-
const contentWatcher =
|
|
2666
|
+
const contentWatcher = fs.watch(ctx.config);
|
|
2801
2667
|
contentWatcher.on("all", async (event, file) => {
|
|
2802
2668
|
logger7.info(`file:${event}`, file);
|
|
2803
2669
|
match(event).with("unlink", () => {
|
|
2804
|
-
ctx.project.removeSourceFile(
|
|
2670
|
+
ctx.project.removeSourceFile(path2.abs(cwd, file));
|
|
2805
2671
|
ctx.chunks.rm(file);
|
|
2806
2672
|
}).with("change", async () => {
|
|
2807
2673
|
ctx.project.reloadSourceFile(file);
|
|
@@ -2822,12 +2688,15 @@ init_esm_shims();
|
|
|
2822
2688
|
import { appendFileSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
2823
2689
|
import { lookItUpSync as lookItUpSync2 } from "look-it-up";
|
|
2824
2690
|
import outdent from "outdent";
|
|
2825
|
-
function setupGitIgnore(
|
|
2691
|
+
function setupGitIgnore(ctx) {
|
|
2692
|
+
const { outdir, gitignore } = ctx.config;
|
|
2826
2693
|
if (!gitignore)
|
|
2827
2694
|
return;
|
|
2828
|
-
const txt = outdent
|
|
2695
|
+
const txt = outdent`
|
|
2696
|
+
|
|
2697
|
+
## Panda
|
|
2829
2698
|
${outdir}
|
|
2830
|
-
${outdir}
|
|
2699
|
+
${ctx.studio.outdir}
|
|
2831
2700
|
`;
|
|
2832
2701
|
const file = lookItUpSync2(".gitignore");
|
|
2833
2702
|
if (!file) {
|
|
@@ -2843,12 +2712,13 @@ function setupGitIgnore({ config: { outdir, gitignore = true } }) {
|
|
|
2843
2712
|
init_esm_shims();
|
|
2844
2713
|
import { logger as logger8, quote } from "@pandacss/logger";
|
|
2845
2714
|
import { messages } from "@pandacss/generator";
|
|
2846
|
-
import { writeFile as
|
|
2715
|
+
import { writeFile as writeFile3 } from "fs-extra";
|
|
2847
2716
|
import { lookItUpSync as lookItUpSync3 } from "look-it-up";
|
|
2848
2717
|
import { outdent as outdent2 } from "outdent";
|
|
2849
2718
|
import { join as join2 } from "path";
|
|
2850
2719
|
import getPackageManager2 from "preferred-pm";
|
|
2851
|
-
async function setupConfig(cwd,
|
|
2720
|
+
async function setupConfig(cwd, opts = {}) {
|
|
2721
|
+
const { force, outExtension, jsxFramework } = opts;
|
|
2852
2722
|
const configFile = findConfig();
|
|
2853
2723
|
const pmResult = await getPackageManager2(cwd);
|
|
2854
2724
|
const pm = pmResult?.name ?? "npm";
|
|
@@ -2860,36 +2730,74 @@ async function setupConfig(cwd, { force }) {
|
|
|
2860
2730
|
logger8.warn("init:config", messages.configExists(cmd));
|
|
2861
2731
|
} else {
|
|
2862
2732
|
const content = outdent2`
|
|
2863
|
-
|
|
2733
|
+
import { defineConfig } from "@pandacss/dev"
|
|
2734
|
+
|
|
2735
|
+
export default defineConfig({
|
|
2736
|
+
// Whether to use css reset
|
|
2737
|
+
preflight: true,
|
|
2738
|
+
${outExtension ? `
|
|
2739
|
+
// The extension for the emitted JavaScript files
|
|
2740
|
+
outExtension: '${outExtension}',` : ""}
|
|
2741
|
+
// Where to look for your css declarations
|
|
2742
|
+
include: ["./src/**/*.{js,jsx,ts,tsx}", "./pages/**/*.{js,jsx,ts,tsx}"],
|
|
2743
|
+
|
|
2744
|
+
// Files to exclude
|
|
2745
|
+
exclude: [],
|
|
2864
2746
|
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
outdir: "styled-system",
|
|
2877
|
-
})
|
|
2747
|
+
// Useful for theme customization
|
|
2748
|
+
theme: {
|
|
2749
|
+
extend: {}
|
|
2750
|
+
},
|
|
2751
|
+
|
|
2752
|
+
// The output directory for your css system
|
|
2753
|
+
outdir: "styled-system",
|
|
2754
|
+
${jsxFramework ? `
|
|
2755
|
+
// The JSX framework to use
|
|
2756
|
+
jsxFramework: '${jsxFramework}'` : ""}
|
|
2757
|
+
})
|
|
2878
2758
|
`;
|
|
2879
|
-
await
|
|
2759
|
+
await writeFile3(join2(cwd, file), content);
|
|
2880
2760
|
logger8.log(messages.thankYou());
|
|
2881
2761
|
}
|
|
2882
2762
|
}
|
|
2883
2763
|
async function setupPostcss(cwd) {
|
|
2884
2764
|
logger8.info("init:postcss", `creating postcss config file: ${quote("postcss.config.cjs")}`);
|
|
2885
2765
|
const content = outdent2`
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2766
|
+
module.exports = {
|
|
2767
|
+
plugins: {
|
|
2768
|
+
'@pandacss/dev/postcss': {},
|
|
2769
|
+
},
|
|
2770
|
+
}
|
|
2891
2771
|
`;
|
|
2892
|
-
await
|
|
2772
|
+
await writeFile3(join2(cwd, "postcss.config.cjs"), content);
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
// src/ship-files.ts
|
|
2776
|
+
init_esm_shims();
|
|
2777
|
+
import { colors as colors2, logger as logger9 } from "@pandacss/logger";
|
|
2778
|
+
import { createParserResult } from "@pandacss/parser";
|
|
2779
|
+
import { writeFile as writeFile4 } from "fs/promises";
|
|
2780
|
+
import * as path from "path";
|
|
2781
|
+
async function shipFiles(ctx, outfile) {
|
|
2782
|
+
const files = ctx.getFiles();
|
|
2783
|
+
const extractResult = createParserResult();
|
|
2784
|
+
const filesWithCss = [];
|
|
2785
|
+
files.forEach(async (file) => {
|
|
2786
|
+
const result = ctx.project.parseSourceFile(file);
|
|
2787
|
+
if (!result || result.isEmpty())
|
|
2788
|
+
return;
|
|
2789
|
+
const css = ctx.getParserCss(result);
|
|
2790
|
+
if (!css)
|
|
2791
|
+
return;
|
|
2792
|
+
extractResult.merge(result);
|
|
2793
|
+
filesWithCss.push(path.relative(ctx.config.cwd, file));
|
|
2794
|
+
});
|
|
2795
|
+
logger9.info("cli", `Found ${colors2.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
|
|
2796
|
+
const minify = ctx.config.minify;
|
|
2797
|
+
logger9.info("cli", `Writing ${minify ? "[min] " : " "}${colors2.bold(outfile)}`);
|
|
2798
|
+
const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
|
|
2799
|
+
await writeFile4(outfile, output);
|
|
2800
|
+
logger9.info("cli", "Done!");
|
|
2893
2801
|
}
|
|
2894
2802
|
export {
|
|
2895
2803
|
Builder,
|
|
@@ -2901,10 +2809,14 @@ export {
|
|
|
2901
2809
|
emitArtifacts,
|
|
2902
2810
|
execCommand,
|
|
2903
2811
|
extractCss,
|
|
2812
|
+
extractFile,
|
|
2813
|
+
findConfig,
|
|
2904
2814
|
generate,
|
|
2905
2815
|
loadConfigAndCreateContext,
|
|
2816
|
+
parseDependency,
|
|
2906
2817
|
setupConfig,
|
|
2907
2818
|
setupGitIgnore,
|
|
2908
2819
|
setupPostcss,
|
|
2820
|
+
shipFiles,
|
|
2909
2821
|
writeAnalyzeJSON
|
|
2910
2822
|
};
|