@pandacss/node 0.0.0-dev-20221128100346 → 0.0.0-dev-20221128114707
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.ts +18 -15
- package/dist/index.js +57 -39
- package/dist/index.mjs +60 -42
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -57,10 +57,11 @@ declare function createContext(conf: LoadConfigResult, io?: IO): {
|
|
|
57
57
|
pattern: string;
|
|
58
58
|
jsx: string;
|
|
59
59
|
};
|
|
60
|
-
reloadSourceFiles()
|
|
61
|
-
getSourceFile(file: string)
|
|
62
|
-
addSourceFile(file: string)
|
|
63
|
-
|
|
60
|
+
reloadSourceFiles: () => void;
|
|
61
|
+
getSourceFile: (file: string) => ts_morph.SourceFile | undefined;
|
|
62
|
+
addSourceFile: (file: string) => void;
|
|
63
|
+
reloadSourceFile: (file: string) => void;
|
|
64
|
+
removeSourceFile: (file: string) => boolean | undefined;
|
|
64
65
|
parseSourceFile: (sourceFile: ts_morph.SourceFile | undefined) => Collector | undefined;
|
|
65
66
|
getPath: (str: string) => string;
|
|
66
67
|
paths: {
|
|
@@ -88,7 +89,7 @@ declare function createContext(conf: LoadConfigResult, io?: IO): {
|
|
|
88
89
|
file: string;
|
|
89
90
|
} | undefined;
|
|
90
91
|
patterns: Record<string, PatternConfig>;
|
|
91
|
-
|
|
92
|
+
hasPatterns: boolean;
|
|
92
93
|
getPattern: (name: string) => PatternConfig | undefined;
|
|
93
94
|
execPattern: (name: string, data: Record<string, any>) => _pandacss_types.StyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false>;
|
|
94
95
|
patternNodes: {
|
|
@@ -174,10 +175,11 @@ declare class Builder {
|
|
|
174
175
|
pattern: string;
|
|
175
176
|
jsx: string;
|
|
176
177
|
};
|
|
177
|
-
reloadSourceFiles()
|
|
178
|
-
getSourceFile(file: string)
|
|
179
|
-
addSourceFile(file: string)
|
|
180
|
-
|
|
178
|
+
reloadSourceFiles: () => void;
|
|
179
|
+
getSourceFile: (file: string) => ts_morph.SourceFile | undefined;
|
|
180
|
+
addSourceFile: (file: string) => void;
|
|
181
|
+
reloadSourceFile: (file: string) => void;
|
|
182
|
+
removeSourceFile: (file: string) => boolean | undefined;
|
|
181
183
|
parseSourceFile: (sourceFile: ts_morph.SourceFile | undefined) => _pandacss_parser.Collector | undefined;
|
|
182
184
|
getPath: (str: string) => string;
|
|
183
185
|
paths: {
|
|
@@ -205,7 +207,7 @@ declare class Builder {
|
|
|
205
207
|
file: string;
|
|
206
208
|
} | undefined;
|
|
207
209
|
patterns: Record<string, _pandacss_types.PatternConfig>;
|
|
208
|
-
|
|
210
|
+
hasPatterns: boolean;
|
|
209
211
|
getPattern: (name: string) => _pandacss_types.PatternConfig | undefined;
|
|
210
212
|
execPattern: (name: string, data: Record<string, any>) => _pandacss_types.StyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false>;
|
|
211
213
|
patternNodes: {
|
|
@@ -289,10 +291,11 @@ declare function loadConfigAndCreateContext(options?: {
|
|
|
289
291
|
pattern: string;
|
|
290
292
|
jsx: string;
|
|
291
293
|
};
|
|
292
|
-
reloadSourceFiles()
|
|
293
|
-
getSourceFile(file: string)
|
|
294
|
-
addSourceFile(file: string)
|
|
295
|
-
|
|
294
|
+
reloadSourceFiles: () => void;
|
|
295
|
+
getSourceFile: (file: string) => ts_morph.SourceFile | undefined;
|
|
296
|
+
addSourceFile: (file: string) => void;
|
|
297
|
+
reloadSourceFile: (file: string) => void;
|
|
298
|
+
removeSourceFile: (file: string) => boolean | undefined;
|
|
296
299
|
parseSourceFile: (sourceFile: ts_morph.SourceFile | undefined) => _pandacss_parser.Collector | undefined;
|
|
297
300
|
getPath: (str: string) => string;
|
|
298
301
|
paths: {
|
|
@@ -320,7 +323,7 @@ declare function loadConfigAndCreateContext(options?: {
|
|
|
320
323
|
file: string;
|
|
321
324
|
} | undefined;
|
|
322
325
|
patterns: Record<string, _pandacss_types.PatternConfig>;
|
|
323
|
-
|
|
326
|
+
hasPatterns: boolean;
|
|
324
327
|
getPattern: (name: string) => _pandacss_types.PatternConfig | undefined;
|
|
325
328
|
execPattern: (name: string, data: Record<string, any>) => _pandacss_types.StyleObject<_pandacss_types_dist_system_types.TCondition, _pandacss_types_dist_system_types.NeverType, false>;
|
|
326
329
|
patternNodes: {
|
package/dist/index.js
CHANGED
|
@@ -496,8 +496,6 @@ function generate(name, pattern, jsxFactory) {
|
|
|
496
496
|
};
|
|
497
497
|
}
|
|
498
498
|
function generatePreactJsxPattern(ctx) {
|
|
499
|
-
if (!ctx.hasPattern)
|
|
500
|
-
return [];
|
|
501
499
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate(name, pattern, ctx.jsxFactory));
|
|
502
500
|
}
|
|
503
501
|
|
|
@@ -684,8 +682,6 @@ function generate2(name, pattern, jsxFactory) {
|
|
|
684
682
|
};
|
|
685
683
|
}
|
|
686
684
|
function generateReactJsxPattern(ctx) {
|
|
687
|
-
if (!ctx.hasPattern)
|
|
688
|
-
return [];
|
|
689
685
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate2(name, pattern, ctx.jsxFactory));
|
|
690
686
|
}
|
|
691
687
|
|
|
@@ -857,8 +853,6 @@ function generate3(name, pattern, jsxFactory) {
|
|
|
857
853
|
};
|
|
858
854
|
}
|
|
859
855
|
function generateSolidJsxPattern(ctx) {
|
|
860
|
-
if (!ctx.hasPattern)
|
|
861
|
-
return [];
|
|
862
856
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate3(name, pattern, ctx.jsxFactory));
|
|
863
857
|
}
|
|
864
858
|
|
|
@@ -877,6 +871,8 @@ var patternMap = {
|
|
|
877
871
|
preact: generatePreactJsxPattern
|
|
878
872
|
};
|
|
879
873
|
function generateJsxPatterns(ctx) {
|
|
874
|
+
if (!ctx.hasPatterns)
|
|
875
|
+
return [];
|
|
880
876
|
return patternMap[ctx.jsxFramework](ctx);
|
|
881
877
|
}
|
|
882
878
|
var layoutGridMap = {
|
|
@@ -939,7 +935,7 @@ function generate4(name, pattern) {
|
|
|
939
935
|
};
|
|
940
936
|
}
|
|
941
937
|
function generatePattern(ctx) {
|
|
942
|
-
if (!ctx.
|
|
938
|
+
if (!ctx.hasPatterns)
|
|
943
939
|
return;
|
|
944
940
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate4(name, pattern));
|
|
945
941
|
}
|
|
@@ -1509,7 +1505,7 @@ function artifactsGeneratedMessage(ctx) {
|
|
|
1509
1505
|
ctx.hasTokens && import_outdent23.outdent`
|
|
1510
1506
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/tokens")}: the css variables and js function to query your tokens
|
|
1511
1507
|
`,
|
|
1512
|
-
ctx.
|
|
1508
|
+
ctx.hasPatterns && import_outdent23.outdent`
|
|
1513
1509
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/patterns")}: functions to implement common css patterns
|
|
1514
1510
|
`,
|
|
1515
1511
|
ctx.hasRecipes && import_outdent23.outdent`
|
|
@@ -1613,6 +1609,7 @@ var import_fs_extra2 = require("fs-extra");
|
|
|
1613
1609
|
var import_promises = require("fs/promises");
|
|
1614
1610
|
var import_path3 = require("path");
|
|
1615
1611
|
var import_postcss = __toESM(require("postcss"));
|
|
1612
|
+
var import_ts_morph = require("ts-morph");
|
|
1616
1613
|
var import_ts_pattern6 = require("ts-pattern");
|
|
1617
1614
|
var helpers = {
|
|
1618
1615
|
map: import_shared11.mapObject
|
|
@@ -1716,6 +1713,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1716
1713
|
function getPatternFnName(jsx) {
|
|
1717
1714
|
return patternNodes.find((node) => node.name === jsx)?.baseName ?? (0, import_shared11.uncapitalize)(jsx);
|
|
1718
1715
|
}
|
|
1716
|
+
const hasPatterns = Object.keys(patterns).length > 0;
|
|
1719
1717
|
function getRecipe(name) {
|
|
1720
1718
|
const recipe = recipes[name];
|
|
1721
1719
|
if (!recipe) {
|
|
@@ -1738,6 +1736,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1738
1736
|
return [{}, props];
|
|
1739
1737
|
return splitProps(props, recipe.props);
|
|
1740
1738
|
}
|
|
1739
|
+
const hasRecipes = Object.keys(recipes).length > 0;
|
|
1741
1740
|
const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
|
|
1742
1741
|
function isProperty(prop) {
|
|
1743
1742
|
const regex = new RegExp("^(?:" + properties.join("|") + ")$");
|
|
@@ -1812,14 +1811,46 @@ function createContext(conf, io = fileSystem) {
|
|
|
1812
1811
|
}
|
|
1813
1812
|
const files = getFiles();
|
|
1814
1813
|
import_logger4.logger.debug({ type: "ctx:files", msg: files });
|
|
1814
|
+
const tsProject = (0, import_parser.createProject)();
|
|
1815
|
+
function addSourceFile(file) {
|
|
1816
|
+
tsProject.createSourceFile(file, (0, import_fs3.readFileSync)(file, "utf8"), {
|
|
1817
|
+
overwrite: true,
|
|
1818
|
+
scriptKind: import_ts_morph.ScriptKind.TSX
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
function reloadSourceFile(file) {
|
|
1822
|
+
const sourceFile = tsProject.getSourceFile(file);
|
|
1823
|
+
sourceFile?.refreshFromFileSystemSync();
|
|
1824
|
+
}
|
|
1825
|
+
function reloadSourceFiles() {
|
|
1826
|
+
const files2 = getFiles();
|
|
1827
|
+
for (const file of files2) {
|
|
1828
|
+
const source = tsProject.getSourceFile(file);
|
|
1829
|
+
if (source) {
|
|
1830
|
+
source.refreshFromFileSystemSync();
|
|
1831
|
+
} else {
|
|
1832
|
+
tsProject.addSourceFileAtPath(file);
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
function getSourceFile(file) {
|
|
1837
|
+
return tsProject.getSourceFile(absPath(file));
|
|
1838
|
+
}
|
|
1839
|
+
function removeSourceFile(file) {
|
|
1840
|
+
const sourceFile = tsProject.getSourceFile(absPath(file));
|
|
1841
|
+
if (sourceFile) {
|
|
1842
|
+
return tsProject.removeSourceFile(sourceFile);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
files.forEach((file) => {
|
|
1846
|
+
addSourceFile(file);
|
|
1847
|
+
});
|
|
1815
1848
|
const importMap = {
|
|
1816
1849
|
css: `${outdir}/css`,
|
|
1817
1850
|
recipe: `${outdir}/recipes`,
|
|
1818
1851
|
pattern: `${outdir}/patterns`,
|
|
1819
1852
|
jsx: `${outdir}/jsx`
|
|
1820
1853
|
};
|
|
1821
|
-
const tsProject = (0, import_parser.createProject)();
|
|
1822
|
-
tsProject.addSourceFilesAtPaths(files);
|
|
1823
1854
|
const parseSourceFile = (0, import_parser.createParser)({
|
|
1824
1855
|
importMap,
|
|
1825
1856
|
jsx: {
|
|
@@ -1901,29 +1932,11 @@ function createContext(conf, io = fileSystem) {
|
|
|
1901
1932
|
exclude,
|
|
1902
1933
|
conditions,
|
|
1903
1934
|
importMap,
|
|
1904
|
-
reloadSourceFiles
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
source.refreshFromFileSystemSync();
|
|
1910
|
-
} else {
|
|
1911
|
-
tsProject.addSourceFileAtPath(file);
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
},
|
|
1915
|
-
getSourceFile(file) {
|
|
1916
|
-
return tsProject.getSourceFile(absPath(file));
|
|
1917
|
-
},
|
|
1918
|
-
addSourceFile(file) {
|
|
1919
|
-
return tsProject.addSourceFileAtPath(absPath(file));
|
|
1920
|
-
},
|
|
1921
|
-
removeSourceFile(file) {
|
|
1922
|
-
const sourceFile = tsProject.getSourceFile(absPath(file));
|
|
1923
|
-
if (sourceFile) {
|
|
1924
|
-
return tsProject.removeSourceFile(sourceFile);
|
|
1925
|
-
}
|
|
1926
|
-
},
|
|
1935
|
+
reloadSourceFiles,
|
|
1936
|
+
getSourceFile,
|
|
1937
|
+
addSourceFile,
|
|
1938
|
+
reloadSourceFile,
|
|
1939
|
+
removeSourceFile,
|
|
1927
1940
|
parseSourceFile,
|
|
1928
1941
|
getPath,
|
|
1929
1942
|
paths,
|
|
@@ -1935,14 +1948,14 @@ function createContext(conf, io = fileSystem) {
|
|
|
1935
1948
|
utility,
|
|
1936
1949
|
collectStyles,
|
|
1937
1950
|
patterns,
|
|
1938
|
-
|
|
1951
|
+
hasPatterns,
|
|
1939
1952
|
getPattern,
|
|
1940
1953
|
execPattern,
|
|
1941
1954
|
patternNodes,
|
|
1942
1955
|
getPatternFnName,
|
|
1943
1956
|
recipes,
|
|
1944
1957
|
getRecipe,
|
|
1945
|
-
hasRecipes
|
|
1958
|
+
hasRecipes,
|
|
1946
1959
|
jsxFramework,
|
|
1947
1960
|
jsxFactory,
|
|
1948
1961
|
cssVarRoot,
|
|
@@ -2115,6 +2128,7 @@ var import_logger8 = require("@pandacss/logger");
|
|
|
2115
2128
|
var import_logger7 = require("@pandacss/logger");
|
|
2116
2129
|
var import_chokidar = __toESM(require("chokidar"));
|
|
2117
2130
|
var import_path6 = require("path");
|
|
2131
|
+
var import_ts_pattern7 = require("ts-pattern");
|
|
2118
2132
|
function createWatcher(files, options = {}) {
|
|
2119
2133
|
const { ignore, cwd = process.cwd(), poll } = options;
|
|
2120
2134
|
const coalesce = poll || process.platform === "win32";
|
|
@@ -2146,13 +2160,17 @@ async function createContentWatcher(ctx, callback) {
|
|
|
2146
2160
|
});
|
|
2147
2161
|
watcher.on("all", async (event, file) => {
|
|
2148
2162
|
import_logger7.logger.debug({ type: `file:${event}`, file });
|
|
2149
|
-
|
|
2150
|
-
|
|
2163
|
+
(0, import_ts_pattern7.match)(event).with("unlink", () => {
|
|
2164
|
+
ctx.removeSourceFile(file);
|
|
2151
2165
|
ctx.chunks.rm(file);
|
|
2152
|
-
}
|
|
2166
|
+
}).with("change", async () => {
|
|
2167
|
+
ctx.reloadSourceFile(file);
|
|
2168
|
+
await callback(file);
|
|
2169
|
+
}).with("add", async () => {
|
|
2153
2170
|
ctx.addSourceFile(file);
|
|
2154
2171
|
await callback(file);
|
|
2155
|
-
}
|
|
2172
|
+
}).otherwise(() => {
|
|
2173
|
+
});
|
|
2156
2174
|
});
|
|
2157
2175
|
return watcher;
|
|
2158
2176
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -451,8 +451,6 @@ function generate(name, pattern, jsxFactory) {
|
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
453
|
function generatePreactJsxPattern(ctx) {
|
|
454
|
-
if (!ctx.hasPattern)
|
|
455
|
-
return [];
|
|
456
454
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate(name, pattern, ctx.jsxFactory));
|
|
457
455
|
}
|
|
458
456
|
|
|
@@ -639,8 +637,6 @@ function generate2(name, pattern, jsxFactory) {
|
|
|
639
637
|
};
|
|
640
638
|
}
|
|
641
639
|
function generateReactJsxPattern(ctx) {
|
|
642
|
-
if (!ctx.hasPattern)
|
|
643
|
-
return [];
|
|
644
640
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate2(name, pattern, ctx.jsxFactory));
|
|
645
641
|
}
|
|
646
642
|
|
|
@@ -812,8 +808,6 @@ function generate3(name, pattern, jsxFactory) {
|
|
|
812
808
|
};
|
|
813
809
|
}
|
|
814
810
|
function generateSolidJsxPattern(ctx) {
|
|
815
|
-
if (!ctx.hasPattern)
|
|
816
|
-
return [];
|
|
817
811
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate3(name, pattern, ctx.jsxFactory));
|
|
818
812
|
}
|
|
819
813
|
|
|
@@ -832,6 +826,8 @@ var patternMap = {
|
|
|
832
826
|
preact: generatePreactJsxPattern
|
|
833
827
|
};
|
|
834
828
|
function generateJsxPatterns(ctx) {
|
|
829
|
+
if (!ctx.hasPatterns)
|
|
830
|
+
return [];
|
|
835
831
|
return patternMap[ctx.jsxFramework](ctx);
|
|
836
832
|
}
|
|
837
833
|
var layoutGridMap = {
|
|
@@ -894,7 +890,7 @@ function generate4(name, pattern) {
|
|
|
894
890
|
};
|
|
895
891
|
}
|
|
896
892
|
function generatePattern(ctx) {
|
|
897
|
-
if (!ctx.
|
|
893
|
+
if (!ctx.hasPatterns)
|
|
898
894
|
return;
|
|
899
895
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate4(name, pattern));
|
|
900
896
|
}
|
|
@@ -1464,7 +1460,7 @@ function artifactsGeneratedMessage(ctx) {
|
|
|
1464
1460
|
ctx.hasTokens && outdent23`
|
|
1465
1461
|
${tick} ${quote2(ctx.outdir, "/tokens")}: the css variables and js function to query your tokens
|
|
1466
1462
|
`,
|
|
1467
|
-
ctx.
|
|
1463
|
+
ctx.hasPatterns && outdent23`
|
|
1468
1464
|
${tick} ${quote2(ctx.outdir, "/patterns")}: functions to implement common css patterns
|
|
1469
1465
|
`,
|
|
1470
1466
|
ctx.hasRecipes && outdent23`
|
|
@@ -1547,7 +1543,7 @@ import { discardDuplicate as discardDuplicate2 } from "@pandacss/core";
|
|
|
1547
1543
|
import { ConfigNotFoundError } from "@pandacss/error";
|
|
1548
1544
|
import { logger as logger5 } from "@pandacss/logger";
|
|
1549
1545
|
import { toHash } from "@pandacss/shared";
|
|
1550
|
-
import { existsSync as existsSync2, readFileSync as
|
|
1546
|
+
import { existsSync as existsSync2, readFileSync as readFileSync5 } from "fs";
|
|
1551
1547
|
import { statSync } from "fs-extra";
|
|
1552
1548
|
import { resolve as resolve3 } from "path";
|
|
1553
1549
|
|
|
@@ -1569,11 +1565,12 @@ import { createParser, createProject } from "@pandacss/parser";
|
|
|
1569
1565
|
import { capitalize as capitalize10, compact, mapObject, uncapitalize } from "@pandacss/shared";
|
|
1570
1566
|
import { TokenDictionary } from "@pandacss/token-dictionary";
|
|
1571
1567
|
import glob from "fast-glob";
|
|
1572
|
-
import { readdirSync } from "fs";
|
|
1568
|
+
import { readdirSync, readFileSync as readFileSync4 } from "fs";
|
|
1573
1569
|
import { emptyDir, ensureDir, existsSync } from "fs-extra";
|
|
1574
1570
|
import { readFile, unlink, writeFile } from "fs/promises";
|
|
1575
1571
|
import { extname, isAbsolute, join as join2, relative, resolve, sep } from "path";
|
|
1576
1572
|
import postcss from "postcss";
|
|
1573
|
+
import { ScriptKind } from "ts-morph";
|
|
1577
1574
|
import { match as match6, P } from "ts-pattern";
|
|
1578
1575
|
var helpers = {
|
|
1579
1576
|
map: mapObject
|
|
@@ -1677,6 +1674,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1677
1674
|
function getPatternFnName(jsx) {
|
|
1678
1675
|
return patternNodes.find((node) => node.name === jsx)?.baseName ?? uncapitalize(jsx);
|
|
1679
1676
|
}
|
|
1677
|
+
const hasPatterns = Object.keys(patterns).length > 0;
|
|
1680
1678
|
function getRecipe(name) {
|
|
1681
1679
|
const recipe = recipes[name];
|
|
1682
1680
|
if (!recipe) {
|
|
@@ -1699,6 +1697,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1699
1697
|
return [{}, props];
|
|
1700
1698
|
return splitProps(props, recipe.props);
|
|
1701
1699
|
}
|
|
1700
|
+
const hasRecipes = Object.keys(recipes).length > 0;
|
|
1702
1701
|
const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
|
|
1703
1702
|
function isProperty(prop) {
|
|
1704
1703
|
const regex = new RegExp("^(?:" + properties.join("|") + ")$");
|
|
@@ -1773,14 +1772,46 @@ function createContext(conf, io = fileSystem) {
|
|
|
1773
1772
|
}
|
|
1774
1773
|
const files = getFiles();
|
|
1775
1774
|
logger4.debug({ type: "ctx:files", msg: files });
|
|
1775
|
+
const tsProject = createProject();
|
|
1776
|
+
function addSourceFile(file) {
|
|
1777
|
+
tsProject.createSourceFile(file, readFileSync4(file, "utf8"), {
|
|
1778
|
+
overwrite: true,
|
|
1779
|
+
scriptKind: ScriptKind.TSX
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
function reloadSourceFile(file) {
|
|
1783
|
+
const sourceFile = tsProject.getSourceFile(file);
|
|
1784
|
+
sourceFile?.refreshFromFileSystemSync();
|
|
1785
|
+
}
|
|
1786
|
+
function reloadSourceFiles() {
|
|
1787
|
+
const files2 = getFiles();
|
|
1788
|
+
for (const file of files2) {
|
|
1789
|
+
const source = tsProject.getSourceFile(file);
|
|
1790
|
+
if (source) {
|
|
1791
|
+
source.refreshFromFileSystemSync();
|
|
1792
|
+
} else {
|
|
1793
|
+
tsProject.addSourceFileAtPath(file);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
function getSourceFile(file) {
|
|
1798
|
+
return tsProject.getSourceFile(absPath(file));
|
|
1799
|
+
}
|
|
1800
|
+
function removeSourceFile(file) {
|
|
1801
|
+
const sourceFile = tsProject.getSourceFile(absPath(file));
|
|
1802
|
+
if (sourceFile) {
|
|
1803
|
+
return tsProject.removeSourceFile(sourceFile);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
files.forEach((file) => {
|
|
1807
|
+
addSourceFile(file);
|
|
1808
|
+
});
|
|
1776
1809
|
const importMap = {
|
|
1777
1810
|
css: `${outdir}/css`,
|
|
1778
1811
|
recipe: `${outdir}/recipes`,
|
|
1779
1812
|
pattern: `${outdir}/patterns`,
|
|
1780
1813
|
jsx: `${outdir}/jsx`
|
|
1781
1814
|
};
|
|
1782
|
-
const tsProject = createProject();
|
|
1783
|
-
tsProject.addSourceFilesAtPaths(files);
|
|
1784
1815
|
const parseSourceFile = createParser({
|
|
1785
1816
|
importMap,
|
|
1786
1817
|
jsx: {
|
|
@@ -1862,29 +1893,11 @@ function createContext(conf, io = fileSystem) {
|
|
|
1862
1893
|
exclude,
|
|
1863
1894
|
conditions,
|
|
1864
1895
|
importMap,
|
|
1865
|
-
reloadSourceFiles
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
source.refreshFromFileSystemSync();
|
|
1871
|
-
} else {
|
|
1872
|
-
tsProject.addSourceFileAtPath(file);
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
},
|
|
1876
|
-
getSourceFile(file) {
|
|
1877
|
-
return tsProject.getSourceFile(absPath(file));
|
|
1878
|
-
},
|
|
1879
|
-
addSourceFile(file) {
|
|
1880
|
-
return tsProject.addSourceFileAtPath(absPath(file));
|
|
1881
|
-
},
|
|
1882
|
-
removeSourceFile(file) {
|
|
1883
|
-
const sourceFile = tsProject.getSourceFile(absPath(file));
|
|
1884
|
-
if (sourceFile) {
|
|
1885
|
-
return tsProject.removeSourceFile(sourceFile);
|
|
1886
|
-
}
|
|
1887
|
-
},
|
|
1896
|
+
reloadSourceFiles,
|
|
1897
|
+
getSourceFile,
|
|
1898
|
+
addSourceFile,
|
|
1899
|
+
reloadSourceFile,
|
|
1900
|
+
removeSourceFile,
|
|
1888
1901
|
parseSourceFile,
|
|
1889
1902
|
getPath,
|
|
1890
1903
|
paths,
|
|
@@ -1896,14 +1909,14 @@ function createContext(conf, io = fileSystem) {
|
|
|
1896
1909
|
utility,
|
|
1897
1910
|
collectStyles,
|
|
1898
1911
|
patterns,
|
|
1899
|
-
|
|
1912
|
+
hasPatterns,
|
|
1900
1913
|
getPattern,
|
|
1901
1914
|
execPattern,
|
|
1902
1915
|
patternNodes,
|
|
1903
1916
|
getPatternFnName,
|
|
1904
1917
|
recipes,
|
|
1905
1918
|
getRecipe,
|
|
1906
|
-
hasRecipes
|
|
1919
|
+
hasRecipes,
|
|
1907
1920
|
jsxFramework,
|
|
1908
1921
|
jsxFactory,
|
|
1909
1922
|
cssVarRoot,
|
|
@@ -1978,7 +1991,7 @@ function getConfigHash() {
|
|
|
1978
1991
|
if (!file) {
|
|
1979
1992
|
throw new ConfigNotFoundError();
|
|
1980
1993
|
}
|
|
1981
|
-
return toHash(
|
|
1994
|
+
return toHash(readFileSync5(file, "utf-8"));
|
|
1982
1995
|
}
|
|
1983
1996
|
var Builder = class {
|
|
1984
1997
|
fileModifiedMap = /* @__PURE__ */ new Map();
|
|
@@ -2076,6 +2089,7 @@ import { logger as logger8 } from "@pandacss/logger";
|
|
|
2076
2089
|
import { logger as logger7 } from "@pandacss/logger";
|
|
2077
2090
|
import chokidar from "chokidar";
|
|
2078
2091
|
import { join as join3 } from "path";
|
|
2092
|
+
import { match as match7 } from "ts-pattern";
|
|
2079
2093
|
function createWatcher(files, options = {}) {
|
|
2080
2094
|
const { ignore, cwd = process.cwd(), poll } = options;
|
|
2081
2095
|
const coalesce = poll || process.platform === "win32";
|
|
@@ -2107,13 +2121,17 @@ async function createContentWatcher(ctx, callback) {
|
|
|
2107
2121
|
});
|
|
2108
2122
|
watcher.on("all", async (event, file) => {
|
|
2109
2123
|
logger7.debug({ type: `file:${event}`, file });
|
|
2110
|
-
|
|
2111
|
-
|
|
2124
|
+
match7(event).with("unlink", () => {
|
|
2125
|
+
ctx.removeSourceFile(file);
|
|
2112
2126
|
ctx.chunks.rm(file);
|
|
2113
|
-
}
|
|
2127
|
+
}).with("change", async () => {
|
|
2128
|
+
ctx.reloadSourceFile(file);
|
|
2129
|
+
await callback(file);
|
|
2130
|
+
}).with("add", async () => {
|
|
2114
2131
|
ctx.addSourceFile(file);
|
|
2115
2132
|
await callback(file);
|
|
2116
|
-
}
|
|
2133
|
+
}).otherwise(() => {
|
|
2134
|
+
});
|
|
2117
2135
|
});
|
|
2118
2136
|
return watcher;
|
|
2119
2137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/node",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20221128114707",
|
|
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
|
"telejson": "6.0.8",
|
|
31
31
|
"ts-pattern": "4.0.6",
|
|
32
32
|
"ts-morph": "17.0.1",
|
|
33
|
-
"@pandacss/types": "0.0.0-dev-
|
|
34
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
35
|
-
"@pandacss/error": "0.0.0-dev-
|
|
36
|
-
"@pandacss/parser": "0.0.0-dev-
|
|
37
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
38
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
39
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
40
|
-
"@pandacss/core": "0.0.0-dev-
|
|
41
|
-
"@pandacss/config": "0.0.0-dev-
|
|
33
|
+
"@pandacss/types": "0.0.0-dev-20221128114707",
|
|
34
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20221128114707",
|
|
35
|
+
"@pandacss/error": "0.0.0-dev-20221128114707",
|
|
36
|
+
"@pandacss/parser": "0.0.0-dev-20221128114707",
|
|
37
|
+
"@pandacss/shared": "0.0.0-dev-20221128114707",
|
|
38
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20221128114707",
|
|
39
|
+
"@pandacss/logger": "0.0.0-dev-20221128114707",
|
|
40
|
+
"@pandacss/core": "0.0.0-dev-20221128114707",
|
|
41
|
+
"@pandacss/config": "0.0.0-dev-20221128114707"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/fs-extra": "9.0.13",
|
|
@@ -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-
|
|
49
|
+
"@pandacss/fixture": "0.0.0-dev-20221128114707"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsup src/index.ts --format=cjs,esm --shims --dts",
|