@pandacss/node 1.11.3 → 1.11.5
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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +44 -256
- package/dist/index.mjs +47 -253
- package/package.json +13 -13
package/dist/index.d.mts
CHANGED
|
@@ -35,6 +35,7 @@ declare class OutputEngine {
|
|
|
35
35
|
constructor(options: OutputEngineOptions);
|
|
36
36
|
empty: () => void;
|
|
37
37
|
ensure: (file: string, cwd: string) => string;
|
|
38
|
+
writeFile: (filePath: string, code: string) => Promise<void> | undefined;
|
|
38
39
|
write: (output: Artifact | undefined) => Promise<PromiseSettledResult<void>[]> | undefined;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -69,7 +70,7 @@ declare function analyze(ctx: PandaContext, options?: AnalysisOptions): {
|
|
|
69
70
|
report: _pandacss_reporter.TokenAnalysisReport;
|
|
70
71
|
formatted: string;
|
|
71
72
|
};
|
|
72
|
-
writeReport(filePath: string): Promise<void
|
|
73
|
+
writeReport(filePath: string): Promise<void> | undefined;
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
declare function buildInfo(ctx: PandaContext, outfile: string): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ declare class OutputEngine {
|
|
|
35
35
|
constructor(options: OutputEngineOptions);
|
|
36
36
|
empty: () => void;
|
|
37
37
|
ensure: (file: string, cwd: string) => string;
|
|
38
|
+
writeFile: (filePath: string, code: string) => Promise<void> | undefined;
|
|
38
39
|
write: (output: Artifact | undefined) => Promise<PromiseSettledResult<void>[]> | undefined;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -69,7 +70,7 @@ declare function analyze(ctx: PandaContext, options?: AnalysisOptions): {
|
|
|
69
70
|
report: _pandacss_reporter.TokenAnalysisReport;
|
|
70
71
|
formatted: string;
|
|
71
72
|
};
|
|
72
|
-
writeReport(filePath: string): Promise<void
|
|
73
|
+
writeReport(filePath: string): Promise<void> | undefined;
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
declare function buildInfo(ctx: PandaContext, outfile: string): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -344,10 +344,8 @@ function analyze(ctx, options = {}) {
|
|
|
344
344
|
return { report, formatted: (0, import_reporter.formatTokenReport)(report.getSummary(), format) };
|
|
345
345
|
},
|
|
346
346
|
writeReport(filePath) {
|
|
347
|
-
const dirname2 = ctx.runtime.path.dirname(filePath);
|
|
348
|
-
ctx.runtime.fs.ensureDirSync(dirname2);
|
|
349
347
|
const str = JSON.stringify(reporter.report, replacer, 2);
|
|
350
|
-
return ctx.
|
|
348
|
+
return ctx.output.writeFile(filePath, str);
|
|
351
349
|
}
|
|
352
350
|
};
|
|
353
351
|
}
|
|
@@ -370,8 +368,7 @@ async function buildInfo(ctx, outfile) {
|
|
|
370
368
|
ctx.staticCss.process(staticCss);
|
|
371
369
|
}
|
|
372
370
|
const output = JSON.stringify(ctx.encoder.toJSON(), null, minify ? 0 : 2);
|
|
373
|
-
ctx.output.
|
|
374
|
-
await ctx.runtime.fs.writeFile(outfile, output);
|
|
371
|
+
await ctx.output.writeFile(outfile, output);
|
|
375
372
|
import_logger.logger.info("cli", "Done!");
|
|
376
373
|
}
|
|
377
374
|
|
|
@@ -1862,8 +1859,8 @@ var nodeRuntime = {
|
|
|
1862
1859
|
readDirSync: import_fs_extra.default.readdirSync,
|
|
1863
1860
|
rmDirSync: import_fs_extra.default.emptyDirSync,
|
|
1864
1861
|
rmFileSync: import_fs_extra.default.removeSync,
|
|
1865
|
-
ensureDirSync(
|
|
1866
|
-
return import_fs_extra.default.ensureDirSync(
|
|
1862
|
+
ensureDirSync(path4) {
|
|
1863
|
+
return import_fs_extra.default.ensureDirSync(path4);
|
|
1867
1864
|
},
|
|
1868
1865
|
watch(options) {
|
|
1869
1866
|
const { include, exclude, cwd, poll } = options;
|
|
@@ -1874,8 +1871,8 @@ var nodeRuntime = {
|
|
|
1874
1871
|
const watcher = import_chokidar.default.watch(dirnames, {
|
|
1875
1872
|
usePolling: poll,
|
|
1876
1873
|
cwd,
|
|
1877
|
-
ignored(
|
|
1878
|
-
const relativePath = (0, import_path2.relative)(workingDir,
|
|
1874
|
+
ignored(path4, stats) {
|
|
1875
|
+
const relativePath = (0, import_path2.relative)(workingDir, path4);
|
|
1879
1876
|
return !!stats?.isFile() && !isValidPath(relativePath);
|
|
1880
1877
|
},
|
|
1881
1878
|
ignoreInitial: true,
|
|
@@ -1920,6 +1917,14 @@ var OutputEngine = class {
|
|
|
1920
1917
|
this.fs.ensureDirSync(dirname2);
|
|
1921
1918
|
return outPath;
|
|
1922
1919
|
};
|
|
1920
|
+
writeFile = (filePath, code) => {
|
|
1921
|
+
this.fs.ensureDirSync(this.path.dirname(filePath));
|
|
1922
|
+
if (this.fs.existsSync(filePath) && this.fs.readFileSync(filePath) === code) {
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
import_logger3.logger.debug("write:file", filePath);
|
|
1926
|
+
return this.fs.writeFile(filePath, code);
|
|
1927
|
+
};
|
|
1923
1928
|
write = (output) => {
|
|
1924
1929
|
if (!output) return;
|
|
1925
1930
|
const { dir = this.paths.root, files } = output;
|
|
@@ -1929,8 +1934,7 @@ var OutputEngine = class {
|
|
|
1929
1934
|
if (!artifact?.code) return;
|
|
1930
1935
|
const { file, code } = artifact;
|
|
1931
1936
|
const absPath = this.path.join(...dir, file);
|
|
1932
|
-
|
|
1933
|
-
return this.fs.writeFile(absPath, code);
|
|
1937
|
+
return this.writeFile(absPath, code);
|
|
1934
1938
|
})
|
|
1935
1939
|
);
|
|
1936
1940
|
};
|
|
@@ -2022,13 +2026,13 @@ var PandaContext = class extends import_generator2.Generator {
|
|
|
2022
2026
|
});
|
|
2023
2027
|
};
|
|
2024
2028
|
writeSplitCss = async (sheet) => {
|
|
2025
|
-
const { path: pathUtil, fs:
|
|
2029
|
+
const { path: pathUtil, fs: fs3 } = this.runtime;
|
|
2026
2030
|
const rootDir = this.paths.root;
|
|
2027
2031
|
const stylesDir = [...rootDir, "styles"];
|
|
2028
2032
|
const artifacts = this.getSplitCssArtifacts(sheet);
|
|
2029
2033
|
const subDirs = new Set([...artifacts.recipes, ...artifacts.themes].map((a) => a.dir).filter(Boolean));
|
|
2030
|
-
|
|
2031
|
-
subDirs.forEach((dir) =>
|
|
2034
|
+
fs3.ensureDirSync(pathUtil.join(...stylesDir));
|
|
2035
|
+
subDirs.forEach((dir) => fs3.ensureDirSync(pathUtil.join(...stylesDir, dir)));
|
|
2032
2036
|
const styleFiles = [];
|
|
2033
2037
|
for (const layer of artifacts.layers) {
|
|
2034
2038
|
styleFiles.push({ file: layer.file, code: layer.code });
|
|
@@ -2098,226 +2102,12 @@ var PandaContext = class extends import_generator2.Generator {
|
|
|
2098
2102
|
// src/load-tsconfig.ts
|
|
2099
2103
|
init_cjs_shims();
|
|
2100
2104
|
var import_config2 = require("@pandacss/config");
|
|
2101
|
-
var import_node_path2 = __toESM(require("path"));
|
|
2102
|
-
|
|
2103
|
-
// src/tsconfig-utils.ts
|
|
2104
|
-
init_cjs_shims();
|
|
2105
|
-
var import_node_fs = require("fs");
|
|
2106
2105
|
var import_node_path = __toESM(require("path"));
|
|
2107
|
-
async function resolveDirectTsconfigJson(filename) {
|
|
2108
|
-
if (import_node_path.default.extname(filename) !== ".json") return null;
|
|
2109
|
-
const resolved = import_node_path.default.resolve(filename);
|
|
2110
|
-
try {
|
|
2111
|
-
const stat = await import_node_fs.promises.stat(resolved);
|
|
2112
|
-
if (stat.isFile() || stat.isFIFO()) return resolved;
|
|
2113
|
-
throw new Error(`${filename} exists but is not a regular file.`);
|
|
2114
|
-
} catch (e) {
|
|
2115
|
-
if (e && typeof e === "object" && "code" in e && e.code === "ENOENT") {
|
|
2116
|
-
return null;
|
|
2117
|
-
}
|
|
2118
|
-
throw e;
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
async function findClosestTsconfig(filename, root, configName = "tsconfig.json") {
|
|
2122
|
-
const resolvedRoot = import_node_path.default.resolve(root);
|
|
2123
|
-
let dir = import_node_path.default.dirname(import_node_path.default.resolve(filename));
|
|
2124
|
-
for (; ; ) {
|
|
2125
|
-
const candidate = import_node_path.default.join(dir, configName);
|
|
2126
|
-
try {
|
|
2127
|
-
const stat = await import_node_fs.promises.stat(candidate);
|
|
2128
|
-
if (stat.isFile() || stat.isFIFO()) {
|
|
2129
|
-
return candidate;
|
|
2130
|
-
}
|
|
2131
|
-
} catch {
|
|
2132
|
-
}
|
|
2133
|
-
if (dir === resolvedRoot || import_node_path.default.dirname(dir) === dir) {
|
|
2134
|
-
return null;
|
|
2135
|
-
}
|
|
2136
|
-
dir = import_node_path.default.dirname(dir);
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
function resolveBaseUrlForCompilerOptions(baseUrl, tsconfigFile, cwd) {
|
|
2140
|
-
if (baseUrl == null) return cwd;
|
|
2141
|
-
if (baseUrl.startsWith("${")) return baseUrl;
|
|
2142
|
-
if (import_node_path.default.isAbsolute(baseUrl)) return baseUrl;
|
|
2143
|
-
return import_node_path.default.resolve(import_node_path.default.dirname(tsconfigFile), baseUrl);
|
|
2144
|
-
}
|
|
2145
|
-
var SOURCE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
2146
|
-
function resolveReferencedTsconfigPath(refPath, fromDir, configName = "tsconfig.json") {
|
|
2147
|
-
const p = refPath.endsWith(".json") ? refPath : import_node_path.default.join(refPath, configName);
|
|
2148
|
-
return import_node_path.default.resolve(fromDir, p);
|
|
2149
|
-
}
|
|
2150
|
-
async function resolveSolutionTsconfigForFile(absoluteFilename, rootTsconfigPath, rootParsed, getTsconfigModule) {
|
|
2151
|
-
const { parseTsconfig } = getTsconfigModule;
|
|
2152
|
-
if (isSourceFileIncludedInTsconfig(absoluteFilename, rootTsconfigPath, rootParsed)) {
|
|
2153
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2154
|
-
}
|
|
2155
|
-
const refs = rootParsed.references;
|
|
2156
|
-
if (!refs?.length) {
|
|
2157
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2158
|
-
}
|
|
2159
|
-
if (!SOURCE_EXTENSIONS.some((ext) => absoluteFilename.endsWith(ext))) {
|
|
2160
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2161
|
-
}
|
|
2162
|
-
const rootDir = import_node_path.default.dirname(rootTsconfigPath);
|
|
2163
|
-
for (const ref of refs) {
|
|
2164
|
-
const refPath = resolveReferencedTsconfigPath(ref.path, rootDir);
|
|
2165
|
-
try {
|
|
2166
|
-
await import_node_fs.promises.access(refPath);
|
|
2167
|
-
} catch {
|
|
2168
|
-
continue;
|
|
2169
|
-
}
|
|
2170
|
-
const childParsed = parseTsconfig(refPath);
|
|
2171
|
-
if (isSourceFileIncludedInTsconfig(absoluteFilename, refPath, childParsed)) {
|
|
2172
|
-
return { tsconfig: childParsed, tsconfigFile: refPath };
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2176
|
-
}
|
|
2177
|
-
var POSIX_SEP_RE = new RegExp("\\" + import_node_path.default.posix.sep, "g");
|
|
2178
|
-
var NATIVE_SEP_RE = new RegExp("\\" + import_node_path.default.sep, "g");
|
|
2179
|
-
var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
|
|
2180
|
-
var GLOB_ALL_PATTERN = `**/*`;
|
|
2181
|
-
var TS_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
2182
|
-
var JS_EXTENSIONS = [".js", ".jsx", ".mjs", ".cjs"];
|
|
2183
|
-
var TSJS_EXTENSIONS = TS_EXTENSIONS.concat(JS_EXTENSIONS);
|
|
2184
|
-
var TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
|
|
2185
|
-
var TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
|
|
2186
|
-
var IS_POSIX = import_node_path.default.posix.sep === import_node_path.default.sep;
|
|
2187
|
-
var native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, import_node_path.default.posix.sep);
|
|
2188
|
-
var resolve2posix = IS_POSIX ? (dir, filename) => dir ? import_node_path.default.resolve(dir, filename) : import_node_path.default.resolve(filename) : (dir, filename) => {
|
|
2189
|
-
const posix2native = (f) => f.replace(POSIX_SEP_RE, import_node_path.default.sep);
|
|
2190
|
-
return native2posix(
|
|
2191
|
-
dir ? import_node_path.default.resolve(posix2native(dir), posix2native(filename)) : import_node_path.default.resolve(posix2native(filename))
|
|
2192
|
-
);
|
|
2193
|
-
};
|
|
2194
|
-
function isGlobMatch(filename, dir, patterns, allowJs) {
|
|
2195
|
-
const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
|
|
2196
|
-
return patterns.some((patternArg) => {
|
|
2197
|
-
let pattern = patternArg;
|
|
2198
|
-
let lastWildcardIndex = pattern.length;
|
|
2199
|
-
let hasWildcard = false;
|
|
2200
|
-
let hasExtension = false;
|
|
2201
|
-
let hasSlash = false;
|
|
2202
|
-
let lastSlashIndex = -1;
|
|
2203
|
-
for (let i = pattern.length - 1; i > -1; i--) {
|
|
2204
|
-
const c = pattern[i];
|
|
2205
|
-
if (!hasWildcard) {
|
|
2206
|
-
if (c === "*" || c === "?") {
|
|
2207
|
-
lastWildcardIndex = i;
|
|
2208
|
-
hasWildcard = true;
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
if (!hasSlash) {
|
|
2212
|
-
if (c === ".") {
|
|
2213
|
-
hasExtension = true;
|
|
2214
|
-
} else if (c === "/") {
|
|
2215
|
-
lastSlashIndex = i;
|
|
2216
|
-
hasSlash = true;
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
if (hasWildcard && hasSlash) {
|
|
2220
|
-
break;
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
|
|
2224
|
-
pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
|
|
2225
|
-
lastWildcardIndex = pattern.length - 1;
|
|
2226
|
-
hasWildcard = true;
|
|
2227
|
-
}
|
|
2228
|
-
if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) {
|
|
2229
|
-
return false;
|
|
2230
|
-
}
|
|
2231
|
-
if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) {
|
|
2232
|
-
return false;
|
|
2233
|
-
}
|
|
2234
|
-
if (pattern === GLOB_ALL_PATTERN) {
|
|
2235
|
-
return filename.startsWith(`${dir}/`);
|
|
2236
|
-
}
|
|
2237
|
-
const resolvedPattern = resolve2posix(dir, pattern);
|
|
2238
|
-
let firstWildcardIndex = -1;
|
|
2239
|
-
for (let i = 0; i < resolvedPattern.length; i++) {
|
|
2240
|
-
if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
|
|
2241
|
-
firstWildcardIndex = i;
|
|
2242
|
-
hasWildcard = true;
|
|
2243
|
-
break;
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) {
|
|
2247
|
-
return false;
|
|
2248
|
-
}
|
|
2249
|
-
if (!hasWildcard) {
|
|
2250
|
-
return filename === resolvedPattern;
|
|
2251
|
-
}
|
|
2252
|
-
if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) {
|
|
2253
|
-
return true;
|
|
2254
|
-
}
|
|
2255
|
-
if (PATTERN_REGEX_CACHE.has(resolvedPattern)) {
|
|
2256
|
-
return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
|
|
2257
|
-
}
|
|
2258
|
-
const regex2 = pattern2regex(resolvedPattern, allowJs);
|
|
2259
|
-
PATTERN_REGEX_CACHE.set(resolvedPattern, regex2);
|
|
2260
|
-
return regex2.test(filename);
|
|
2261
|
-
});
|
|
2262
|
-
}
|
|
2263
|
-
function pattern2regex(resolvedPattern, allowJs) {
|
|
2264
|
-
let regexStr = "^";
|
|
2265
|
-
for (let i = 0; i < resolvedPattern.length; i++) {
|
|
2266
|
-
const char = resolvedPattern[i];
|
|
2267
|
-
if (char === "?") {
|
|
2268
|
-
regexStr += "[^\\/]";
|
|
2269
|
-
continue;
|
|
2270
|
-
}
|
|
2271
|
-
if (char === "*") {
|
|
2272
|
-
if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
|
|
2273
|
-
i += 2;
|
|
2274
|
-
regexStr += "(?:[^\\/]*\\/)*";
|
|
2275
|
-
continue;
|
|
2276
|
-
}
|
|
2277
|
-
regexStr += "[^\\/]*";
|
|
2278
|
-
continue;
|
|
2279
|
-
}
|
|
2280
|
-
if ("/.+^${}()|[]\\".includes(char)) {
|
|
2281
|
-
regexStr += "\\";
|
|
2282
|
-
}
|
|
2283
|
-
regexStr += char;
|
|
2284
|
-
}
|
|
2285
|
-
if (resolvedPattern.endsWith("*")) {
|
|
2286
|
-
regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
|
|
2287
|
-
}
|
|
2288
|
-
regexStr += "$";
|
|
2289
|
-
return new RegExp(regexStr);
|
|
2290
|
-
}
|
|
2291
|
-
function isIncluded(filename, tsconfigFile, tsconfig) {
|
|
2292
|
-
const dir = native2posix(import_node_path.default.dirname(tsconfigFile));
|
|
2293
|
-
const files = (tsconfig.files || []).map((file) => resolve2posix(dir, file));
|
|
2294
|
-
const absoluteFilename = resolve2posix(null, filename);
|
|
2295
|
-
if (files.includes(filename)) {
|
|
2296
|
-
return true;
|
|
2297
|
-
}
|
|
2298
|
-
const allowJs = tsconfig.compilerOptions?.allowJs;
|
|
2299
|
-
const included = isGlobMatch(
|
|
2300
|
-
absoluteFilename,
|
|
2301
|
-
dir,
|
|
2302
|
-
tsconfig.include || (tsconfig.files ? [] : [GLOB_ALL_PATTERN]),
|
|
2303
|
-
allowJs
|
|
2304
|
-
);
|
|
2305
|
-
if (included) {
|
|
2306
|
-
const excluded = isGlobMatch(absoluteFilename, dir, tsconfig.exclude || [], allowJs);
|
|
2307
|
-
return !excluded;
|
|
2308
|
-
}
|
|
2309
|
-
return false;
|
|
2310
|
-
}
|
|
2311
|
-
function isSourceFileIncludedInTsconfig(absoluteFilename, tsconfigFile, tsconfig) {
|
|
2312
|
-
return isIncluded(absoluteFilename, tsconfigFile, tsconfig);
|
|
2313
|
-
}
|
|
2314
|
-
|
|
2315
|
-
// src/load-tsconfig.ts
|
|
2316
2106
|
async function loadTsConfig(conf, cwd) {
|
|
2317
2107
|
const root = cwd;
|
|
2318
|
-
let tsconfigFile = await resolveDirectTsconfigJson(conf.path);
|
|
2108
|
+
let tsconfigFile = await (0, import_config2.resolveDirectTsconfigJson)(conf.path);
|
|
2319
2109
|
if (!tsconfigFile) {
|
|
2320
|
-
tsconfigFile = await findClosestTsconfig(conf.path, root, "tsconfig.json");
|
|
2110
|
+
tsconfigFile = await (0, import_config2.findClosestTsconfig)(conf.path, root, "tsconfig.json");
|
|
2321
2111
|
}
|
|
2322
2112
|
if (!tsconfigFile) {
|
|
2323
2113
|
return {
|
|
@@ -2327,8 +2117,8 @@ async function loadTsConfig(conf, cwd) {
|
|
|
2327
2117
|
}
|
|
2328
2118
|
const gtc = await import("get-tsconfig");
|
|
2329
2119
|
const rootParsed = gtc.parseTsconfig(tsconfigFile);
|
|
2330
|
-
const { tsconfig, tsconfigFile: effectiveTsconfigPath } = await resolveSolutionTsconfigForFile(
|
|
2331
|
-
|
|
2120
|
+
const { tsconfig, tsconfigFile: effectiveTsconfigPath } = await (0, import_config2.resolveSolutionTsconfigForFile)(
|
|
2121
|
+
import_node_path.default.resolve(conf.path),
|
|
2332
2122
|
tsconfigFile,
|
|
2333
2123
|
rootParsed,
|
|
2334
2124
|
gtc
|
|
@@ -2344,7 +2134,7 @@ async function loadTsConfig(conf, cwd) {
|
|
|
2344
2134
|
baseUrl,
|
|
2345
2135
|
pathMappings: (0, import_config2.convertTsPathsToRegexes)(
|
|
2346
2136
|
compilerOptions.paths,
|
|
2347
|
-
resolveBaseUrlForCompilerOptions(baseUrl, effectiveTsconfigPath, cwd)
|
|
2137
|
+
(0, import_config2.resolveBaseUrlForCompilerOptions)(baseUrl, effectiveTsconfigPath, cwd)
|
|
2348
2138
|
)
|
|
2349
2139
|
};
|
|
2350
2140
|
}
|
|
@@ -2582,8 +2372,8 @@ var Builder = class {
|
|
|
2582
2372
|
// src/cpu-profile.ts
|
|
2583
2373
|
init_cjs_shims();
|
|
2584
2374
|
var import_logger6 = require("@pandacss/logger");
|
|
2585
|
-
var
|
|
2586
|
-
var
|
|
2375
|
+
var import_node_fs = __toESM(require("fs"));
|
|
2376
|
+
var import_node_path2 = __toESM(require("path"));
|
|
2587
2377
|
var import_node_readline = __toESM(require("readline"));
|
|
2588
2378
|
var startProfiling = async (cwd, prefix, isWatching) => {
|
|
2589
2379
|
const inspector = await import("inspector").then((r) => r.default);
|
|
@@ -2647,8 +2437,8 @@ var startProfiling = async (cwd, prefix, isWatching) => {
|
|
|
2647
2437
|
const date = /* @__PURE__ */ new Date();
|
|
2648
2438
|
const timestamp = date.toISOString().replace(/[-:.]/g, "");
|
|
2649
2439
|
const title = `panda-${prefix}-${timestamp}`;
|
|
2650
|
-
const outfile =
|
|
2651
|
-
|
|
2440
|
+
const outfile = import_node_path2.default.join(cwd, `${title}.cpuprofile`);
|
|
2441
|
+
import_node_fs.default.writeFileSync(outfile, JSON.stringify(params.profile));
|
|
2652
2442
|
import_logger6.logger.info("cpu-prof", outfile);
|
|
2653
2443
|
cb?.();
|
|
2654
2444
|
});
|
|
@@ -2668,7 +2458,7 @@ var cssgen = async (ctx, options) => {
|
|
|
2668
2458
|
if (outfile) {
|
|
2669
2459
|
const css = ctx.getCss(sheet);
|
|
2670
2460
|
import_logger7.logger.info("css", ctx.runtime.path.resolve(outfile));
|
|
2671
|
-
await ctx.
|
|
2461
|
+
await ctx.output.writeFile(outfile, css);
|
|
2672
2462
|
} else {
|
|
2673
2463
|
await ctx.writeCss(sheet);
|
|
2674
2464
|
}
|
|
@@ -2686,7 +2476,7 @@ var cssgen = async (ctx, options) => {
|
|
|
2686
2476
|
} else if (outfile) {
|
|
2687
2477
|
const css = ctx.getCss(sheet);
|
|
2688
2478
|
import_logger7.logger.info("css", ctx.runtime.path.resolve(outfile));
|
|
2689
|
-
await ctx.
|
|
2479
|
+
await ctx.output.writeFile(outfile, css);
|
|
2690
2480
|
} else {
|
|
2691
2481
|
await ctx.writeCss(sheet);
|
|
2692
2482
|
}
|
|
@@ -2702,12 +2492,12 @@ async function debug(ctx, options) {
|
|
|
2702
2492
|
const files = ctx.getFiles();
|
|
2703
2493
|
const measureTotal = import_logger8.logger.time.debug(`Done parsing ${files.length} files`);
|
|
2704
2494
|
ctx.config.minify = false;
|
|
2705
|
-
const { fs:
|
|
2495
|
+
const { fs: fs3, path: path4 } = ctx.runtime;
|
|
2706
2496
|
const outdir = options.outdir;
|
|
2707
2497
|
if (!options.dry && outdir) {
|
|
2708
|
-
|
|
2498
|
+
fs3.ensureDirSync(outdir);
|
|
2709
2499
|
import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/config.json`)}`);
|
|
2710
|
-
await
|
|
2500
|
+
await fs3.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2711
2501
|
}
|
|
2712
2502
|
if (options.onlyConfig) {
|
|
2713
2503
|
measureTotal();
|
|
@@ -2730,14 +2520,14 @@ async function debug(ctx, options) {
|
|
|
2730
2520
|
if (outdir) {
|
|
2731
2521
|
filesWithCss.push(file);
|
|
2732
2522
|
const parsedPath = (0, import_path5.parse)(file);
|
|
2733
|
-
const relative2 =
|
|
2734
|
-
const astJsonPath = `${relative2}${
|
|
2735
|
-
const cssPath = `${relative2}${
|
|
2523
|
+
const relative2 = path4.relative(ctx.config.cwd, parsedPath.dir);
|
|
2524
|
+
const astJsonPath = `${relative2}${path4.sep}${parsedPath.name}.ast.json`.replaceAll(path4.sep, "__");
|
|
2525
|
+
const cssPath = `${relative2}${path4.sep}${parsedPath.name}.css`.replaceAll(path4.sep, "__");
|
|
2736
2526
|
import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2737
2527
|
import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2738
2528
|
return Promise.allSettled([
|
|
2739
|
-
|
|
2740
|
-
|
|
2529
|
+
fs3.writeFile(`${outdir}${path4.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2530
|
+
fs3.writeFile(`${outdir}${path4.sep}${cssPath}`, css)
|
|
2741
2531
|
]);
|
|
2742
2532
|
}
|
|
2743
2533
|
});
|
|
@@ -2779,7 +2569,6 @@ async function generate(config, configPath) {
|
|
|
2779
2569
|
{ cwd, poll }
|
|
2780
2570
|
);
|
|
2781
2571
|
const bundleStyles = async (ctx2, changedFilePath) => {
|
|
2782
|
-
const outfile = ctx2.runtime.path.join(...ctx2.paths.root, "styles.css");
|
|
2783
2572
|
const parserResult = ctx2.project.parseSourceFile(changedFilePath);
|
|
2784
2573
|
if (parserResult) {
|
|
2785
2574
|
const done = import_logger9.logger.time.info(ctx2.messages.buildComplete(1));
|
|
@@ -2787,8 +2576,7 @@ async function generate(config, configPath) {
|
|
|
2787
2576
|
ctx2.appendLayerParams(sheet);
|
|
2788
2577
|
ctx2.appendBaselineCss(sheet);
|
|
2789
2578
|
ctx2.appendParserCss(sheet);
|
|
2790
|
-
|
|
2791
|
-
await ctx2.runtime.fs.writeFile(outfile, css);
|
|
2579
|
+
await ctx2.writeCss(sheet);
|
|
2792
2580
|
done();
|
|
2793
2581
|
}
|
|
2794
2582
|
};
|
|
@@ -2834,16 +2622,16 @@ function setupGitIgnore(ctx) {
|
|
|
2834
2622
|
// src/logstream.ts
|
|
2835
2623
|
init_cjs_shims();
|
|
2836
2624
|
var import_logger10 = require("@pandacss/logger");
|
|
2837
|
-
var
|
|
2838
|
-
var
|
|
2625
|
+
var import_node_fs2 = __toESM(require("fs"));
|
|
2626
|
+
var import_node_path3 = __toESM(require("path"));
|
|
2839
2627
|
var setLogStream = (options) => {
|
|
2840
2628
|
const { cwd = process.cwd() } = options;
|
|
2841
2629
|
let stream;
|
|
2842
2630
|
if (options.logfile) {
|
|
2843
|
-
const outPath =
|
|
2631
|
+
const outPath = import_node_path3.default.resolve(cwd, options.logfile);
|
|
2844
2632
|
ensure(outPath);
|
|
2845
2633
|
import_logger10.logger.info("logfile", outPath);
|
|
2846
|
-
stream =
|
|
2634
|
+
stream = import_node_fs2.default.createWriteStream(outPath, { flags: "a" });
|
|
2847
2635
|
import_logger10.logger.onLog = (entry) => {
|
|
2848
2636
|
stream?.write(JSON.stringify(entry) + "\n");
|
|
2849
2637
|
};
|
|
@@ -2861,8 +2649,8 @@ var setLogStream = (options) => {
|
|
|
2861
2649
|
};
|
|
2862
2650
|
};
|
|
2863
2651
|
var ensure = (outPath) => {
|
|
2864
|
-
const dirname2 =
|
|
2865
|
-
|
|
2652
|
+
const dirname2 = import_node_path3.default.dirname(outPath);
|
|
2653
|
+
import_node_fs2.default.mkdirSync(dirname2, { recursive: true });
|
|
2866
2654
|
return outPath;
|
|
2867
2655
|
};
|
|
2868
2656
|
|
package/dist/index.mjs
CHANGED
|
@@ -320,10 +320,8 @@ function analyze(ctx, options = {}) {
|
|
|
320
320
|
return { report, formatted: formatTokenReport(report.getSummary(), format) };
|
|
321
321
|
},
|
|
322
322
|
writeReport(filePath) {
|
|
323
|
-
const dirname2 = ctx.runtime.path.dirname(filePath);
|
|
324
|
-
ctx.runtime.fs.ensureDirSync(dirname2);
|
|
325
323
|
const str = JSON.stringify(reporter.report, replacer, 2);
|
|
326
|
-
return ctx.
|
|
324
|
+
return ctx.output.writeFile(filePath, str);
|
|
327
325
|
}
|
|
328
326
|
};
|
|
329
327
|
}
|
|
@@ -346,8 +344,7 @@ async function buildInfo(ctx, outfile) {
|
|
|
346
344
|
ctx.staticCss.process(staticCss);
|
|
347
345
|
}
|
|
348
346
|
const output = JSON.stringify(ctx.encoder.toJSON(), null, minify ? 0 : 2);
|
|
349
|
-
ctx.output.
|
|
350
|
-
await ctx.runtime.fs.writeFile(outfile, output);
|
|
347
|
+
await ctx.output.writeFile(outfile, output);
|
|
351
348
|
logger.info("cli", "Done!");
|
|
352
349
|
}
|
|
353
350
|
|
|
@@ -1838,8 +1835,8 @@ var nodeRuntime = {
|
|
|
1838
1835
|
readDirSync: fsExtra.readdirSync,
|
|
1839
1836
|
rmDirSync: fsExtra.emptyDirSync,
|
|
1840
1837
|
rmFileSync: fsExtra.removeSync,
|
|
1841
|
-
ensureDirSync(
|
|
1842
|
-
return fsExtra.ensureDirSync(
|
|
1838
|
+
ensureDirSync(path5) {
|
|
1839
|
+
return fsExtra.ensureDirSync(path5);
|
|
1843
1840
|
},
|
|
1844
1841
|
watch(options) {
|
|
1845
1842
|
const { include, exclude, cwd, poll } = options;
|
|
@@ -1850,8 +1847,8 @@ var nodeRuntime = {
|
|
|
1850
1847
|
const watcher = chokidar.watch(dirnames, {
|
|
1851
1848
|
usePolling: poll,
|
|
1852
1849
|
cwd,
|
|
1853
|
-
ignored(
|
|
1854
|
-
const relativePath = relative(workingDir,
|
|
1850
|
+
ignored(path5, stats) {
|
|
1851
|
+
const relativePath = relative(workingDir, path5);
|
|
1855
1852
|
return !!stats?.isFile() && !isValidPath(relativePath);
|
|
1856
1853
|
},
|
|
1857
1854
|
ignoreInitial: true,
|
|
@@ -1896,6 +1893,14 @@ var OutputEngine = class {
|
|
|
1896
1893
|
this.fs.ensureDirSync(dirname2);
|
|
1897
1894
|
return outPath;
|
|
1898
1895
|
};
|
|
1896
|
+
writeFile = (filePath, code) => {
|
|
1897
|
+
this.fs.ensureDirSync(this.path.dirname(filePath));
|
|
1898
|
+
if (this.fs.existsSync(filePath) && this.fs.readFileSync(filePath) === code) {
|
|
1899
|
+
return;
|
|
1900
|
+
}
|
|
1901
|
+
logger3.debug("write:file", filePath);
|
|
1902
|
+
return this.fs.writeFile(filePath, code);
|
|
1903
|
+
};
|
|
1899
1904
|
write = (output) => {
|
|
1900
1905
|
if (!output) return;
|
|
1901
1906
|
const { dir = this.paths.root, files } = output;
|
|
@@ -1905,8 +1910,7 @@ var OutputEngine = class {
|
|
|
1905
1910
|
if (!artifact?.code) return;
|
|
1906
1911
|
const { file, code } = artifact;
|
|
1907
1912
|
const absPath = this.path.join(...dir, file);
|
|
1908
|
-
|
|
1909
|
-
return this.fs.writeFile(absPath, code);
|
|
1913
|
+
return this.writeFile(absPath, code);
|
|
1910
1914
|
})
|
|
1911
1915
|
);
|
|
1912
1916
|
};
|
|
@@ -1998,13 +2002,13 @@ var PandaContext = class extends Generator2 {
|
|
|
1998
2002
|
});
|
|
1999
2003
|
};
|
|
2000
2004
|
writeSplitCss = async (sheet) => {
|
|
2001
|
-
const { path: pathUtil, fs:
|
|
2005
|
+
const { path: pathUtil, fs: fs3 } = this.runtime;
|
|
2002
2006
|
const rootDir = this.paths.root;
|
|
2003
2007
|
const stylesDir = [...rootDir, "styles"];
|
|
2004
2008
|
const artifacts = this.getSplitCssArtifacts(sheet);
|
|
2005
2009
|
const subDirs = new Set([...artifacts.recipes, ...artifacts.themes].map((a) => a.dir).filter(Boolean));
|
|
2006
|
-
|
|
2007
|
-
subDirs.forEach((dir) =>
|
|
2010
|
+
fs3.ensureDirSync(pathUtil.join(...stylesDir));
|
|
2011
|
+
subDirs.forEach((dir) => fs3.ensureDirSync(pathUtil.join(...stylesDir, dir)));
|
|
2008
2012
|
const styleFiles = [];
|
|
2009
2013
|
for (const layer of artifacts.layers) {
|
|
2010
2014
|
styleFiles.push({ file: layer.file, code: layer.code });
|
|
@@ -2073,222 +2077,14 @@ var PandaContext = class extends Generator2 {
|
|
|
2073
2077
|
|
|
2074
2078
|
// src/load-tsconfig.ts
|
|
2075
2079
|
init_esm_shims();
|
|
2076
|
-
import {
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2080
|
+
import {
|
|
2081
|
+
convertTsPathsToRegexes,
|
|
2082
|
+
findClosestTsconfig,
|
|
2083
|
+
resolveBaseUrlForCompilerOptions,
|
|
2084
|
+
resolveDirectTsconfigJson,
|
|
2085
|
+
resolveSolutionTsconfigForFile
|
|
2086
|
+
} from "@pandacss/config";
|
|
2082
2087
|
import path2 from "path";
|
|
2083
|
-
async function resolveDirectTsconfigJson(filename) {
|
|
2084
|
-
if (path2.extname(filename) !== ".json") return null;
|
|
2085
|
-
const resolved = path2.resolve(filename);
|
|
2086
|
-
try {
|
|
2087
|
-
const stat = await fs.stat(resolved);
|
|
2088
|
-
if (stat.isFile() || stat.isFIFO()) return resolved;
|
|
2089
|
-
throw new Error(`${filename} exists but is not a regular file.`);
|
|
2090
|
-
} catch (e) {
|
|
2091
|
-
if (e && typeof e === "object" && "code" in e && e.code === "ENOENT") {
|
|
2092
|
-
return null;
|
|
2093
|
-
}
|
|
2094
|
-
throw e;
|
|
2095
|
-
}
|
|
2096
|
-
}
|
|
2097
|
-
async function findClosestTsconfig(filename, root, configName = "tsconfig.json") {
|
|
2098
|
-
const resolvedRoot = path2.resolve(root);
|
|
2099
|
-
let dir = path2.dirname(path2.resolve(filename));
|
|
2100
|
-
for (; ; ) {
|
|
2101
|
-
const candidate = path2.join(dir, configName);
|
|
2102
|
-
try {
|
|
2103
|
-
const stat = await fs.stat(candidate);
|
|
2104
|
-
if (stat.isFile() || stat.isFIFO()) {
|
|
2105
|
-
return candidate;
|
|
2106
|
-
}
|
|
2107
|
-
} catch {
|
|
2108
|
-
}
|
|
2109
|
-
if (dir === resolvedRoot || path2.dirname(dir) === dir) {
|
|
2110
|
-
return null;
|
|
2111
|
-
}
|
|
2112
|
-
dir = path2.dirname(dir);
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2115
|
-
function resolveBaseUrlForCompilerOptions(baseUrl, tsconfigFile, cwd) {
|
|
2116
|
-
if (baseUrl == null) return cwd;
|
|
2117
|
-
if (baseUrl.startsWith("${")) return baseUrl;
|
|
2118
|
-
if (path2.isAbsolute(baseUrl)) return baseUrl;
|
|
2119
|
-
return path2.resolve(path2.dirname(tsconfigFile), baseUrl);
|
|
2120
|
-
}
|
|
2121
|
-
var SOURCE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
2122
|
-
function resolveReferencedTsconfigPath(refPath, fromDir, configName = "tsconfig.json") {
|
|
2123
|
-
const p = refPath.endsWith(".json") ? refPath : path2.join(refPath, configName);
|
|
2124
|
-
return path2.resolve(fromDir, p);
|
|
2125
|
-
}
|
|
2126
|
-
async function resolveSolutionTsconfigForFile(absoluteFilename, rootTsconfigPath, rootParsed, getTsconfigModule) {
|
|
2127
|
-
const { parseTsconfig } = getTsconfigModule;
|
|
2128
|
-
if (isSourceFileIncludedInTsconfig(absoluteFilename, rootTsconfigPath, rootParsed)) {
|
|
2129
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2130
|
-
}
|
|
2131
|
-
const refs = rootParsed.references;
|
|
2132
|
-
if (!refs?.length) {
|
|
2133
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2134
|
-
}
|
|
2135
|
-
if (!SOURCE_EXTENSIONS.some((ext) => absoluteFilename.endsWith(ext))) {
|
|
2136
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2137
|
-
}
|
|
2138
|
-
const rootDir = path2.dirname(rootTsconfigPath);
|
|
2139
|
-
for (const ref of refs) {
|
|
2140
|
-
const refPath = resolveReferencedTsconfigPath(ref.path, rootDir);
|
|
2141
|
-
try {
|
|
2142
|
-
await fs.access(refPath);
|
|
2143
|
-
} catch {
|
|
2144
|
-
continue;
|
|
2145
|
-
}
|
|
2146
|
-
const childParsed = parseTsconfig(refPath);
|
|
2147
|
-
if (isSourceFileIncludedInTsconfig(absoluteFilename, refPath, childParsed)) {
|
|
2148
|
-
return { tsconfig: childParsed, tsconfigFile: refPath };
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2152
|
-
}
|
|
2153
|
-
var POSIX_SEP_RE = new RegExp("\\" + path2.posix.sep, "g");
|
|
2154
|
-
var NATIVE_SEP_RE = new RegExp("\\" + path2.sep, "g");
|
|
2155
|
-
var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
|
|
2156
|
-
var GLOB_ALL_PATTERN = `**/*`;
|
|
2157
|
-
var TS_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
2158
|
-
var JS_EXTENSIONS = [".js", ".jsx", ".mjs", ".cjs"];
|
|
2159
|
-
var TSJS_EXTENSIONS = TS_EXTENSIONS.concat(JS_EXTENSIONS);
|
|
2160
|
-
var TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
|
|
2161
|
-
var TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
|
|
2162
|
-
var IS_POSIX = path2.posix.sep === path2.sep;
|
|
2163
|
-
var native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, path2.posix.sep);
|
|
2164
|
-
var resolve2posix = IS_POSIX ? (dir, filename) => dir ? path2.resolve(dir, filename) : path2.resolve(filename) : (dir, filename) => {
|
|
2165
|
-
const posix2native = (f) => f.replace(POSIX_SEP_RE, path2.sep);
|
|
2166
|
-
return native2posix(
|
|
2167
|
-
dir ? path2.resolve(posix2native(dir), posix2native(filename)) : path2.resolve(posix2native(filename))
|
|
2168
|
-
);
|
|
2169
|
-
};
|
|
2170
|
-
function isGlobMatch(filename, dir, patterns, allowJs) {
|
|
2171
|
-
const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
|
|
2172
|
-
return patterns.some((patternArg) => {
|
|
2173
|
-
let pattern = patternArg;
|
|
2174
|
-
let lastWildcardIndex = pattern.length;
|
|
2175
|
-
let hasWildcard = false;
|
|
2176
|
-
let hasExtension = false;
|
|
2177
|
-
let hasSlash = false;
|
|
2178
|
-
let lastSlashIndex = -1;
|
|
2179
|
-
for (let i = pattern.length - 1; i > -1; i--) {
|
|
2180
|
-
const c = pattern[i];
|
|
2181
|
-
if (!hasWildcard) {
|
|
2182
|
-
if (c === "*" || c === "?") {
|
|
2183
|
-
lastWildcardIndex = i;
|
|
2184
|
-
hasWildcard = true;
|
|
2185
|
-
}
|
|
2186
|
-
}
|
|
2187
|
-
if (!hasSlash) {
|
|
2188
|
-
if (c === ".") {
|
|
2189
|
-
hasExtension = true;
|
|
2190
|
-
} else if (c === "/") {
|
|
2191
|
-
lastSlashIndex = i;
|
|
2192
|
-
hasSlash = true;
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
if (hasWildcard && hasSlash) {
|
|
2196
|
-
break;
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
|
|
2200
|
-
pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
|
|
2201
|
-
lastWildcardIndex = pattern.length - 1;
|
|
2202
|
-
hasWildcard = true;
|
|
2203
|
-
}
|
|
2204
|
-
if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) {
|
|
2205
|
-
return false;
|
|
2206
|
-
}
|
|
2207
|
-
if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) {
|
|
2208
|
-
return false;
|
|
2209
|
-
}
|
|
2210
|
-
if (pattern === GLOB_ALL_PATTERN) {
|
|
2211
|
-
return filename.startsWith(`${dir}/`);
|
|
2212
|
-
}
|
|
2213
|
-
const resolvedPattern = resolve2posix(dir, pattern);
|
|
2214
|
-
let firstWildcardIndex = -1;
|
|
2215
|
-
for (let i = 0; i < resolvedPattern.length; i++) {
|
|
2216
|
-
if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
|
|
2217
|
-
firstWildcardIndex = i;
|
|
2218
|
-
hasWildcard = true;
|
|
2219
|
-
break;
|
|
2220
|
-
}
|
|
2221
|
-
}
|
|
2222
|
-
if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) {
|
|
2223
|
-
return false;
|
|
2224
|
-
}
|
|
2225
|
-
if (!hasWildcard) {
|
|
2226
|
-
return filename === resolvedPattern;
|
|
2227
|
-
}
|
|
2228
|
-
if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) {
|
|
2229
|
-
return true;
|
|
2230
|
-
}
|
|
2231
|
-
if (PATTERN_REGEX_CACHE.has(resolvedPattern)) {
|
|
2232
|
-
return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
|
|
2233
|
-
}
|
|
2234
|
-
const regex2 = pattern2regex(resolvedPattern, allowJs);
|
|
2235
|
-
PATTERN_REGEX_CACHE.set(resolvedPattern, regex2);
|
|
2236
|
-
return regex2.test(filename);
|
|
2237
|
-
});
|
|
2238
|
-
}
|
|
2239
|
-
function pattern2regex(resolvedPattern, allowJs) {
|
|
2240
|
-
let regexStr = "^";
|
|
2241
|
-
for (let i = 0; i < resolvedPattern.length; i++) {
|
|
2242
|
-
const char = resolvedPattern[i];
|
|
2243
|
-
if (char === "?") {
|
|
2244
|
-
regexStr += "[^\\/]";
|
|
2245
|
-
continue;
|
|
2246
|
-
}
|
|
2247
|
-
if (char === "*") {
|
|
2248
|
-
if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
|
|
2249
|
-
i += 2;
|
|
2250
|
-
regexStr += "(?:[^\\/]*\\/)*";
|
|
2251
|
-
continue;
|
|
2252
|
-
}
|
|
2253
|
-
regexStr += "[^\\/]*";
|
|
2254
|
-
continue;
|
|
2255
|
-
}
|
|
2256
|
-
if ("/.+^${}()|[]\\".includes(char)) {
|
|
2257
|
-
regexStr += "\\";
|
|
2258
|
-
}
|
|
2259
|
-
regexStr += char;
|
|
2260
|
-
}
|
|
2261
|
-
if (resolvedPattern.endsWith("*")) {
|
|
2262
|
-
regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
|
|
2263
|
-
}
|
|
2264
|
-
regexStr += "$";
|
|
2265
|
-
return new RegExp(regexStr);
|
|
2266
|
-
}
|
|
2267
|
-
function isIncluded(filename, tsconfigFile, tsconfig) {
|
|
2268
|
-
const dir = native2posix(path2.dirname(tsconfigFile));
|
|
2269
|
-
const files = (tsconfig.files || []).map((file) => resolve2posix(dir, file));
|
|
2270
|
-
const absoluteFilename = resolve2posix(null, filename);
|
|
2271
|
-
if (files.includes(filename)) {
|
|
2272
|
-
return true;
|
|
2273
|
-
}
|
|
2274
|
-
const allowJs = tsconfig.compilerOptions?.allowJs;
|
|
2275
|
-
const included = isGlobMatch(
|
|
2276
|
-
absoluteFilename,
|
|
2277
|
-
dir,
|
|
2278
|
-
tsconfig.include || (tsconfig.files ? [] : [GLOB_ALL_PATTERN]),
|
|
2279
|
-
allowJs
|
|
2280
|
-
);
|
|
2281
|
-
if (included) {
|
|
2282
|
-
const excluded = isGlobMatch(absoluteFilename, dir, tsconfig.exclude || [], allowJs);
|
|
2283
|
-
return !excluded;
|
|
2284
|
-
}
|
|
2285
|
-
return false;
|
|
2286
|
-
}
|
|
2287
|
-
function isSourceFileIncludedInTsconfig(absoluteFilename, tsconfigFile, tsconfig) {
|
|
2288
|
-
return isIncluded(absoluteFilename, tsconfigFile, tsconfig);
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
// src/load-tsconfig.ts
|
|
2292
2088
|
async function loadTsConfig(conf, cwd) {
|
|
2293
2089
|
const root = cwd;
|
|
2294
2090
|
let tsconfigFile = await resolveDirectTsconfigJson(conf.path);
|
|
@@ -2304,7 +2100,7 @@ async function loadTsConfig(conf, cwd) {
|
|
|
2304
2100
|
const gtc = await import("get-tsconfig");
|
|
2305
2101
|
const rootParsed = gtc.parseTsconfig(tsconfigFile);
|
|
2306
2102
|
const { tsconfig, tsconfigFile: effectiveTsconfigPath } = await resolveSolutionTsconfigForFile(
|
|
2307
|
-
|
|
2103
|
+
path2.resolve(conf.path),
|
|
2308
2104
|
tsconfigFile,
|
|
2309
2105
|
rootParsed,
|
|
2310
2106
|
gtc
|
|
@@ -2558,8 +2354,8 @@ var Builder = class {
|
|
|
2558
2354
|
// src/cpu-profile.ts
|
|
2559
2355
|
init_esm_shims();
|
|
2560
2356
|
import { logger as logger6 } from "@pandacss/logger";
|
|
2561
|
-
import
|
|
2562
|
-
import
|
|
2357
|
+
import fs from "fs";
|
|
2358
|
+
import path3 from "path";
|
|
2563
2359
|
import readline from "readline";
|
|
2564
2360
|
var startProfiling = async (cwd, prefix, isWatching) => {
|
|
2565
2361
|
const inspector = await import("inspector").then((r) => r.default);
|
|
@@ -2623,8 +2419,8 @@ var startProfiling = async (cwd, prefix, isWatching) => {
|
|
|
2623
2419
|
const date = /* @__PURE__ */ new Date();
|
|
2624
2420
|
const timestamp = date.toISOString().replace(/[-:.]/g, "");
|
|
2625
2421
|
const title = `panda-${prefix}-${timestamp}`;
|
|
2626
|
-
const outfile =
|
|
2627
|
-
|
|
2422
|
+
const outfile = path3.join(cwd, `${title}.cpuprofile`);
|
|
2423
|
+
fs.writeFileSync(outfile, JSON.stringify(params.profile));
|
|
2628
2424
|
logger6.info("cpu-prof", outfile);
|
|
2629
2425
|
cb?.();
|
|
2630
2426
|
});
|
|
@@ -2644,7 +2440,7 @@ var cssgen = async (ctx, options) => {
|
|
|
2644
2440
|
if (outfile) {
|
|
2645
2441
|
const css = ctx.getCss(sheet);
|
|
2646
2442
|
logger7.info("css", ctx.runtime.path.resolve(outfile));
|
|
2647
|
-
await ctx.
|
|
2443
|
+
await ctx.output.writeFile(outfile, css);
|
|
2648
2444
|
} else {
|
|
2649
2445
|
await ctx.writeCss(sheet);
|
|
2650
2446
|
}
|
|
@@ -2662,7 +2458,7 @@ var cssgen = async (ctx, options) => {
|
|
|
2662
2458
|
} else if (outfile) {
|
|
2663
2459
|
const css = ctx.getCss(sheet);
|
|
2664
2460
|
logger7.info("css", ctx.runtime.path.resolve(outfile));
|
|
2665
|
-
await ctx.
|
|
2461
|
+
await ctx.output.writeFile(outfile, css);
|
|
2666
2462
|
} else {
|
|
2667
2463
|
await ctx.writeCss(sheet);
|
|
2668
2464
|
}
|
|
@@ -2678,12 +2474,12 @@ async function debug(ctx, options) {
|
|
|
2678
2474
|
const files = ctx.getFiles();
|
|
2679
2475
|
const measureTotal = logger8.time.debug(`Done parsing ${files.length} files`);
|
|
2680
2476
|
ctx.config.minify = false;
|
|
2681
|
-
const { fs:
|
|
2477
|
+
const { fs: fs3, path: path5 } = ctx.runtime;
|
|
2682
2478
|
const outdir = options.outdir;
|
|
2683
2479
|
if (!options.dry && outdir) {
|
|
2684
|
-
|
|
2480
|
+
fs3.ensureDirSync(outdir);
|
|
2685
2481
|
logger8.info("cli", `Writing ${colors2.bold(`${outdir}/config.json`)}`);
|
|
2686
|
-
await
|
|
2482
|
+
await fs3.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2687
2483
|
}
|
|
2688
2484
|
if (options.onlyConfig) {
|
|
2689
2485
|
measureTotal();
|
|
@@ -2706,14 +2502,14 @@ async function debug(ctx, options) {
|
|
|
2706
2502
|
if (outdir) {
|
|
2707
2503
|
filesWithCss.push(file);
|
|
2708
2504
|
const parsedPath = parse(file);
|
|
2709
|
-
const relative2 =
|
|
2710
|
-
const astJsonPath = `${relative2}${
|
|
2711
|
-
const cssPath = `${relative2}${
|
|
2505
|
+
const relative2 = path5.relative(ctx.config.cwd, parsedPath.dir);
|
|
2506
|
+
const astJsonPath = `${relative2}${path5.sep}${parsedPath.name}.ast.json`.replaceAll(path5.sep, "__");
|
|
2507
|
+
const cssPath = `${relative2}${path5.sep}${parsedPath.name}.css`.replaceAll(path5.sep, "__");
|
|
2712
2508
|
logger8.info("cli", `Writing ${colors2.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2713
2509
|
logger8.info("cli", `Writing ${colors2.bold(`${outdir}/${cssPath}`)}`);
|
|
2714
2510
|
return Promise.allSettled([
|
|
2715
|
-
|
|
2716
|
-
|
|
2511
|
+
fs3.writeFile(`${outdir}${path5.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2512
|
+
fs3.writeFile(`${outdir}${path5.sep}${cssPath}`, css)
|
|
2717
2513
|
]);
|
|
2718
2514
|
}
|
|
2719
2515
|
});
|
|
@@ -2755,7 +2551,6 @@ async function generate(config, configPath) {
|
|
|
2755
2551
|
{ cwd, poll }
|
|
2756
2552
|
);
|
|
2757
2553
|
const bundleStyles = async (ctx2, changedFilePath) => {
|
|
2758
|
-
const outfile = ctx2.runtime.path.join(...ctx2.paths.root, "styles.css");
|
|
2759
2554
|
const parserResult = ctx2.project.parseSourceFile(changedFilePath);
|
|
2760
2555
|
if (parserResult) {
|
|
2761
2556
|
const done = logger9.time.info(ctx2.messages.buildComplete(1));
|
|
@@ -2763,8 +2558,7 @@ async function generate(config, configPath) {
|
|
|
2763
2558
|
ctx2.appendLayerParams(sheet);
|
|
2764
2559
|
ctx2.appendBaselineCss(sheet);
|
|
2765
2560
|
ctx2.appendParserCss(sheet);
|
|
2766
|
-
|
|
2767
|
-
await ctx2.runtime.fs.writeFile(outfile, css);
|
|
2561
|
+
await ctx2.writeCss(sheet);
|
|
2768
2562
|
done();
|
|
2769
2563
|
}
|
|
2770
2564
|
};
|
|
@@ -2810,16 +2604,16 @@ function setupGitIgnore(ctx) {
|
|
|
2810
2604
|
// src/logstream.ts
|
|
2811
2605
|
init_esm_shims();
|
|
2812
2606
|
import { logger as logger10 } from "@pandacss/logger";
|
|
2813
|
-
import
|
|
2814
|
-
import
|
|
2607
|
+
import fs2 from "fs";
|
|
2608
|
+
import path4 from "path";
|
|
2815
2609
|
var setLogStream = (options) => {
|
|
2816
2610
|
const { cwd = process.cwd() } = options;
|
|
2817
2611
|
let stream;
|
|
2818
2612
|
if (options.logfile) {
|
|
2819
|
-
const outPath =
|
|
2613
|
+
const outPath = path4.resolve(cwd, options.logfile);
|
|
2820
2614
|
ensure(outPath);
|
|
2821
2615
|
logger10.info("logfile", outPath);
|
|
2822
|
-
stream =
|
|
2616
|
+
stream = fs2.createWriteStream(outPath, { flags: "a" });
|
|
2823
2617
|
logger10.onLog = (entry) => {
|
|
2824
2618
|
stream?.write(JSON.stringify(entry) + "\n");
|
|
2825
2619
|
};
|
|
@@ -2837,8 +2631,8 @@ var setLogStream = (options) => {
|
|
|
2837
2631
|
};
|
|
2838
2632
|
};
|
|
2839
2633
|
var ensure = (outPath) => {
|
|
2840
|
-
const dirname2 =
|
|
2841
|
-
|
|
2634
|
+
const dirname2 = path4.dirname(outPath);
|
|
2635
|
+
fs2.mkdirSync(dirname2, { recursive: true });
|
|
2842
2636
|
return outPath;
|
|
2843
2637
|
};
|
|
2844
2638
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/node",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.5",
|
|
4
4
|
"description": "The core css panda library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -53,18 +53,18 @@
|
|
|
53
53
|
"ts-morph": "28.0.0",
|
|
54
54
|
"ts-pattern": "5.9.0",
|
|
55
55
|
"get-tsconfig": "^4.13.0",
|
|
56
|
-
"@pandacss/config": "1.11.
|
|
57
|
-
"@pandacss/core": "1.11.
|
|
58
|
-
"@pandacss/generator": "1.11.
|
|
59
|
-
"@pandacss/plugin-lightningcss": "1.11.
|
|
60
|
-
"@pandacss/plugin-svelte": "1.11.
|
|
61
|
-
"@pandacss/plugin-vue": "1.11.
|
|
62
|
-
"@pandacss/reporter": "1.11.
|
|
63
|
-
"@pandacss/logger": "1.11.
|
|
64
|
-
"@pandacss/parser": "1.11.
|
|
65
|
-
"@pandacss/shared": "1.11.
|
|
66
|
-
"@pandacss/token-dictionary": "1.11.
|
|
67
|
-
"@pandacss/types": "1.11.
|
|
56
|
+
"@pandacss/config": "1.11.5",
|
|
57
|
+
"@pandacss/core": "1.11.5",
|
|
58
|
+
"@pandacss/generator": "1.11.5",
|
|
59
|
+
"@pandacss/plugin-lightningcss": "1.11.5",
|
|
60
|
+
"@pandacss/plugin-svelte": "1.11.5",
|
|
61
|
+
"@pandacss/plugin-vue": "1.11.5",
|
|
62
|
+
"@pandacss/reporter": "1.11.5",
|
|
63
|
+
"@pandacss/logger": "1.11.5",
|
|
64
|
+
"@pandacss/parser": "1.11.5",
|
|
65
|
+
"@pandacss/shared": "1.11.5",
|
|
66
|
+
"@pandacss/token-dictionary": "1.11.5",
|
|
67
|
+
"@pandacss/types": "1.11.5"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/picomatch": "4.0.2",
|