@pandacss/compiler 2.0.0-beta.7 → 2.0.0-beta.9
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/binding.cjs +53 -52
- package/dist/{chunk-VRB2SXJJ.js → chunk-G4RVGB4O.js} +319 -73
- package/dist/index.d.ts +15 -152
- package/dist/index.js +5 -3
- package/dist/loader.d.ts +3 -2
- package/dist/loader.js +1 -1
- package/dist/tooling/index.d.ts +105 -0
- package/dist/tooling/index.js +1047 -0
- package/dist/types-DsStlLvF.d.ts +155 -0
- package/package.json +22 -16
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { SerializedConfig, Compiler, Span, Diagnostic, MatchCategory, ExtractedCall, ExtractedJsx, ExtractResult, NativeTransformSourceInput, TransformSourceResult, BuildInfoNative, DesignSystemManifestInput, DesignSystemManifest, FileInspectionResult, SerializedHookFilter, CompileOutput } from '@pandacss/compiler-shared';
|
|
2
|
+
|
|
3
|
+
interface CompileInput {
|
|
4
|
+
files?: Array<{
|
|
5
|
+
path: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}>;
|
|
8
|
+
config?: SerializedConfig;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
cacheDir?: string;
|
|
11
|
+
emitLayerDeclaration?: boolean;
|
|
12
|
+
}
|
|
13
|
+
type ImportSpecifierKind = 'named' | 'default' | 'namespace';
|
|
14
|
+
interface ImportSpecifier {
|
|
15
|
+
kind: ImportSpecifierKind;
|
|
16
|
+
imported: string;
|
|
17
|
+
local: string;
|
|
18
|
+
typeOnly: boolean;
|
|
19
|
+
span: Span;
|
|
20
|
+
}
|
|
21
|
+
type ImportKind = 'sideEffect' | 'value';
|
|
22
|
+
interface ImportRecord {
|
|
23
|
+
module: string;
|
|
24
|
+
kind: ImportKind;
|
|
25
|
+
typeOnly: boolean;
|
|
26
|
+
specifiers: ImportSpecifier[];
|
|
27
|
+
span: Span;
|
|
28
|
+
}
|
|
29
|
+
interface ImportScanResult {
|
|
30
|
+
imports: ImportRecord[];
|
|
31
|
+
diagnostics: Diagnostic[];
|
|
32
|
+
}
|
|
33
|
+
interface Matcher {
|
|
34
|
+
modules: string[];
|
|
35
|
+
/** Omit to match any imported name (used for recipes/patterns). */
|
|
36
|
+
names?: string[];
|
|
37
|
+
}
|
|
38
|
+
type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | 'qwik' | (string & {});
|
|
39
|
+
type CssSyntax = 'template-literal' | 'object-literal';
|
|
40
|
+
interface Matchers {
|
|
41
|
+
css: Matcher;
|
|
42
|
+
recipe: Matcher;
|
|
43
|
+
pattern: Matcher;
|
|
44
|
+
jsx?: Matcher;
|
|
45
|
+
tokens: Matcher;
|
|
46
|
+
/** Configured JSX framework. Enables JSX-aware extraction diagnostics. */
|
|
47
|
+
jsxFramework?: JsxFramework;
|
|
48
|
+
/** Resolved Panda token dictionary. When present, `token('path')` and
|
|
49
|
+
* `token.var('path')` calls fold to their dictionary value during
|
|
50
|
+
* extraction. */
|
|
51
|
+
tokenDictionary?: TokenDictionary;
|
|
52
|
+
/** Resolved JSX factory names that accept member-chain tags (`<styled.div>`). */
|
|
53
|
+
jsxFactories?: string[];
|
|
54
|
+
/** CSS authoring syntax preference. Omit for object-literal mode. */
|
|
55
|
+
syntax?: CssSyntax;
|
|
56
|
+
}
|
|
57
|
+
/** Two parallel `path → string` maps backing `token()` resolution.
|
|
58
|
+
* - `values['colors.red.500']` → raw value, e.g. `'#ef4444'`
|
|
59
|
+
* - `vars['colors.red.500']` → CSS-var form, e.g. `'var(--colors-red-500)'` */
|
|
60
|
+
interface TokenDictionary {
|
|
61
|
+
values: Record<string, string>;
|
|
62
|
+
vars: Record<string, string>;
|
|
63
|
+
}
|
|
64
|
+
interface MatchedImport {
|
|
65
|
+
category: MatchCategory;
|
|
66
|
+
module: string;
|
|
67
|
+
name: string;
|
|
68
|
+
alias: string;
|
|
69
|
+
kind: ImportSpecifierKind;
|
|
70
|
+
}
|
|
71
|
+
interface ExtractedCallsResult {
|
|
72
|
+
calls: ExtractedCall[];
|
|
73
|
+
diagnostics: Diagnostic[];
|
|
74
|
+
}
|
|
75
|
+
interface ExtractedJsxResult {
|
|
76
|
+
jsx: ExtractedJsx[];
|
|
77
|
+
diagnostics: Diagnostic[];
|
|
78
|
+
}
|
|
79
|
+
/** Full result including raw + matched imports, for tooling / parity flows. */
|
|
80
|
+
interface ExtractDebugResult {
|
|
81
|
+
imports: ImportRecord[];
|
|
82
|
+
matched: MatchedImport[];
|
|
83
|
+
calls: ExtractedCall[];
|
|
84
|
+
jsx: ExtractedJsx[];
|
|
85
|
+
diagnostics: Diagnostic[];
|
|
86
|
+
}
|
|
87
|
+
/** Reusable extractor session — built once from a `Matchers` config, then
|
|
88
|
+
* called per file. For one-off use, prefer a `Compiler` + `extractFileSource`. */
|
|
89
|
+
interface ExtractorSession {
|
|
90
|
+
extract(path: string, source: string): ExtractResult;
|
|
91
|
+
extractDebug(path: string, source: string): ExtractDebugResult;
|
|
92
|
+
matchImports(scan: ImportScanResult): MatchedImport[];
|
|
93
|
+
}
|
|
94
|
+
interface ExtractorSessionConstructor {
|
|
95
|
+
new (matchers: Matchers): ExtractorSession;
|
|
96
|
+
}
|
|
97
|
+
interface TraceOptions {
|
|
98
|
+
/** Tracing filter, e.g. "trace", "debug", or "pandacss_project=trace". */
|
|
99
|
+
filter?: string;
|
|
100
|
+
/** `fmt` → stderr. `chrome-json` → trace file. `profile` → both, plus `takeTimingsJson`. */
|
|
101
|
+
output?: 'fmt' | 'chrome-json' | 'profile';
|
|
102
|
+
/** Required for useful `chrome-json`/`profile` output. Defaults to `.panda/trace.json`. */
|
|
103
|
+
file?: string;
|
|
104
|
+
}
|
|
105
|
+
interface NativeCompilerOptions {
|
|
106
|
+
crossFile?: boolean;
|
|
107
|
+
}
|
|
108
|
+
interface RawDesignSystemBinding {
|
|
109
|
+
createDesignSystemManifest(input: DesignSystemManifestInput): DesignSystemManifest;
|
|
110
|
+
designSystemManifestSchemaVersion(): number;
|
|
111
|
+
}
|
|
112
|
+
interface RawFileSystemBinding {
|
|
113
|
+
readFile(path: string): string | null | undefined;
|
|
114
|
+
exists(path: string): boolean;
|
|
115
|
+
}
|
|
116
|
+
interface RawPathBinding {
|
|
117
|
+
realpath(path: string): string;
|
|
118
|
+
resolvePath(path: string, cwd?: string): string;
|
|
119
|
+
joinPath(parts: string[]): string;
|
|
120
|
+
dirname(path: string): string;
|
|
121
|
+
}
|
|
122
|
+
interface NativeCompiler extends Compiler {
|
|
123
|
+
}
|
|
124
|
+
interface RawSourceTransformBinding {
|
|
125
|
+
transformSource(input: NativeTransformSourceInput): TransformSourceResult;
|
|
126
|
+
}
|
|
127
|
+
/** The raw native instance — superset of {@link NativeCompiler} carrying the internal
|
|
128
|
+
* methods the facade hides. */
|
|
129
|
+
interface RawCompiler extends NativeCompiler, RawSourceTransformBinding, BuildInfoNative, RawDesignSystemBinding, RawFileSystemBinding, RawPathBinding {
|
|
130
|
+
inspectFileSource(path: string, source: string): Omit<FileInspectionResult, 'path'>;
|
|
131
|
+
token_dictionary?(): TokenDictionary | undefined;
|
|
132
|
+
registerUtilityTransform?(id: string, callback: (resolved: unknown, original: unknown) => unknown): void;
|
|
133
|
+
registerPatternTransform?(id: string, callback: (props: unknown, helpers: Record<string, unknown>) => unknown): void;
|
|
134
|
+
registerSourceTransform?(id: string, filter: SerializedHookFilter | undefined, callback: (filePath: string, content: string) => string | undefined): void;
|
|
135
|
+
}
|
|
136
|
+
interface CompilerConstructor {
|
|
137
|
+
fromConfig(config: SerializedConfig, options?: NativeCompilerOptions, utilityValuesCallbacks?: Record<string, (tokenDictionary: TokenDictionary | undefined) => unknown>): RawCompiler;
|
|
138
|
+
}
|
|
139
|
+
interface NativeBinding {
|
|
140
|
+
startTracing?(options?: TraceOptions): boolean;
|
|
141
|
+
flushTracing?(): void;
|
|
142
|
+
takeTimingsJson?(): string | null | undefined;
|
|
143
|
+
shutdownTracing?(): boolean;
|
|
144
|
+
compile(input?: CompileInput): CompileOutput;
|
|
145
|
+
scanImports(path: string, source: string): ImportScanResult;
|
|
146
|
+
matchImports(scan: ImportScanResult, matchers: Matchers): MatchedImport[];
|
|
147
|
+
extractCalls(path: string, source: string, matched: MatchedImport[], matchers: Matchers): ExtractedCallsResult;
|
|
148
|
+
extractJsx(path: string, source: string, matched: MatchedImport[], matchers: Matchers): ExtractedJsxResult;
|
|
149
|
+
extract(path: string, source: string, matchers: Matchers): ExtractResult;
|
|
150
|
+
extractDebug(path: string, source: string, matchers: Matchers): ExtractDebugResult;
|
|
151
|
+
Extractor: ExtractorSessionConstructor;
|
|
152
|
+
Compiler: CompilerConstructor;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type { CompileInput as C, ExtractedCallsResult as E, ImportSpecifierKind as I, JsxFramework as J, Matcher as M, NativeCompiler as N, RawSourceTransformBinding as R, TraceOptions as T, ImportSpecifier as a, ImportKind as b, ImportRecord as c, ImportScanResult as d, CssSyntax as e, Matchers as f, TokenDictionary as g, MatchedImport as h, ExtractedJsxResult as i, ExtractDebugResult as j, ExtractorSession as k, ExtractorSessionConstructor as l, NativeCompilerOptions as m, RawCompiler as n, CompilerConstructor as o, NativeBinding as p };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/compiler",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.9",
|
|
4
4
|
"description": "Native Rust binding for the Panda compiler engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"types": "./dist/loader.d.ts",
|
|
17
17
|
"default": "./dist/loader.js"
|
|
18
18
|
},
|
|
19
|
+
"./tooling": {
|
|
20
|
+
"source": "./src/tooling/index.ts",
|
|
21
|
+
"types": "./dist/tooling/index.d.ts",
|
|
22
|
+
"default": "./dist/tooling/index.js"
|
|
23
|
+
},
|
|
19
24
|
"./package.json": "./package.json"
|
|
20
25
|
},
|
|
21
26
|
"author": "Segun Adebayo <joseshegs@gmail.com>",
|
|
@@ -51,33 +56,34 @@
|
|
|
51
56
|
},
|
|
52
57
|
"dependencies": {
|
|
53
58
|
"@napi-rs/wasm-runtime": "^1.1.6",
|
|
54
|
-
"@pandacss/compiler-shared": "2.0.0-beta.
|
|
55
|
-
"@pandacss/config": "2.0.0-beta.
|
|
59
|
+
"@pandacss/compiler-shared": "2.0.0-beta.9",
|
|
60
|
+
"@pandacss/config": "2.0.0-beta.9",
|
|
61
|
+
"@pandacss/types": "2.0.0-beta.9"
|
|
56
62
|
},
|
|
57
63
|
"devDependencies": {
|
|
58
64
|
"@napi-rs/cli": "^3.7.1",
|
|
59
65
|
"rolldown": "1.0.0-rc.17",
|
|
60
|
-
"@pandacss/preset-base": "2.0.0-beta.
|
|
61
|
-
"@pandacss/preset-panda": "2.0.0-beta.
|
|
66
|
+
"@pandacss/preset-base": "2.0.0-beta.9",
|
|
67
|
+
"@pandacss/preset-panda": "2.0.0-beta.9"
|
|
62
68
|
},
|
|
63
69
|
"engines": {
|
|
64
70
|
"node": ">=22"
|
|
65
71
|
},
|
|
66
72
|
"optionalDependencies": {
|
|
67
|
-
"@pandacss/compiler-darwin-arm64": "2.0.0-beta.
|
|
68
|
-
"@pandacss/compiler-darwin-x64": "2.0.0-beta.
|
|
69
|
-
"@pandacss/compiler-linux-x64-gnu": "2.0.0-beta.
|
|
70
|
-
"@pandacss/compiler-linux-arm64-gnu": "2.0.0-beta.
|
|
71
|
-
"@pandacss/compiler-linux-x64-musl": "2.0.0-beta.
|
|
72
|
-
"@pandacss/compiler-linux-arm64-musl": "2.0.0-beta.
|
|
73
|
-
"@pandacss/compiler-win32-x64-msvc": "2.0.0-beta.
|
|
74
|
-
"@pandacss/compiler-win32-arm64-msvc": "2.0.0-beta.
|
|
75
|
-
"@pandacss/compiler-wasm32-wasi": "2.0.0-beta.
|
|
73
|
+
"@pandacss/compiler-darwin-arm64": "2.0.0-beta.9",
|
|
74
|
+
"@pandacss/compiler-darwin-x64": "2.0.0-beta.9",
|
|
75
|
+
"@pandacss/compiler-linux-x64-gnu": "2.0.0-beta.9",
|
|
76
|
+
"@pandacss/compiler-linux-arm64-gnu": "2.0.0-beta.9",
|
|
77
|
+
"@pandacss/compiler-linux-x64-musl": "2.0.0-beta.9",
|
|
78
|
+
"@pandacss/compiler-linux-arm64-musl": "2.0.0-beta.9",
|
|
79
|
+
"@pandacss/compiler-win32-x64-msvc": "2.0.0-beta.9",
|
|
80
|
+
"@pandacss/compiler-win32-arm64-msvc": "2.0.0-beta.9",
|
|
81
|
+
"@pandacss/compiler-wasm32-wasi": "2.0.0-beta.9"
|
|
76
82
|
},
|
|
77
83
|
"scripts": {
|
|
78
84
|
"build": "pnpm build:native && pnpm build:js",
|
|
79
|
-
"build:js": "tsup src/index.ts src/loader.ts --format=esm --platform=node --dts",
|
|
80
|
-
"build:fast": "tsup src/index.ts src/loader.ts --format=esm --platform=node --no-dts",
|
|
85
|
+
"build:js": "tsup src/index.ts src/loader.ts --format=esm --platform=node --dts && tsup src/tooling/index.ts --format=esm --platform=node --dts --out-dir dist/tooling",
|
|
86
|
+
"build:fast": "tsup src/index.ts src/loader.ts src/tooling/index.ts --format=esm --platform=node --no-dts",
|
|
81
87
|
"build:native": "napi build --platform --release --manifest-path crate/Cargo.toml --output-dir . --js binding.cjs --dts native.d.ts",
|
|
82
88
|
"dev": "pnpm build:fast --watch",
|
|
83
89
|
"test": "vitest run",
|