@pandacss/compiler-wasm 2.0.0-beta.9 → 2.0.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/dist/{chunk-I5FPBHZT.js → chunk-ZARW4JPN.js} +8 -13
- package/dist/index.d.ts +12 -12
- package/dist/index.js +10 -3
- package/dist/{web-T6POKIJL.js → web-JSAD2QZX.js} +1 -1
- package/dist/web.d.ts +12 -12
- package/dist/web.js +8 -13
- package/package.json +5 -3
- package/pkg-node/compiler_wasm.d.ts +26 -17
- package/pkg-node/compiler_wasm.js +155 -27
- package/pkg-node/compiler_wasm_bg.wasm +0 -0
- package/pkg-node/compiler_wasm_bg.wasm.d.ts +8 -2
- package/pkg-web/compiler_wasm.d.ts +34 -19
- package/pkg-web/compiler_wasm.js +155 -27
- package/pkg-web/compiler_wasm_bg.wasm +0 -0
- package/pkg-web/compiler_wasm_bg.wasm.d.ts +8 -2
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
BuildInfo,
|
|
6
6
|
DesignSystem,
|
|
7
7
|
createUsageReport,
|
|
8
|
-
getTokenCategoryValues,
|
|
9
8
|
inspectFile,
|
|
10
9
|
inspectFiles,
|
|
11
10
|
mergeCallbacks,
|
|
@@ -14,12 +13,13 @@ import {
|
|
|
14
13
|
|
|
15
14
|
// src/callbacks.ts
|
|
16
15
|
import {
|
|
17
|
-
|
|
18
|
-
createTransformArgs,
|
|
16
|
+
createTransformHelpers,
|
|
19
17
|
getPatternDefaultValueRefsByTransformId,
|
|
20
|
-
mergePatternDefaultValues
|
|
18
|
+
mergePatternDefaultValues,
|
|
19
|
+
PATTERN_HELPERS
|
|
21
20
|
} from "@pandacss/compiler-shared";
|
|
22
21
|
function registerCallbacks(project, callbacks, hooks, tokenDictionary) {
|
|
22
|
+
const { token, utils } = createTransformHelpers(tokenDictionary);
|
|
23
23
|
const utilityTransforms = callbacks["utility.transform"];
|
|
24
24
|
if (utilityTransforms && Object.keys(utilityTransforms).length > 0 && !project.registerUtilityTransform) {
|
|
25
25
|
throw new Error("WASM project does not support utility.transform callbacks");
|
|
@@ -27,7 +27,7 @@ function registerCallbacks(project, callbacks, hooks, tokenDictionary) {
|
|
|
27
27
|
if (project.registerUtilityTransform && utilityTransforms && Object.keys(utilityTransforms).length > 0) {
|
|
28
28
|
for (const [id, callback] of Object.entries(utilityTransforms)) {
|
|
29
29
|
project.registerUtilityTransform(id, (resolved, original) => {
|
|
30
|
-
return callback(resolved,
|
|
30
|
+
return callback(resolved, { raw: original, token, utils });
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -45,7 +45,7 @@ function registerCallbacks(project, callbacks, hooks, tokenDictionary) {
|
|
|
45
45
|
project.registerPatternTransform(id, (props) => {
|
|
46
46
|
const input = props;
|
|
47
47
|
const nextProps = defaultValue ? mergePatternDefaultValues(defaultValue(input), input) : input;
|
|
48
|
-
return callback(nextProps,
|
|
48
|
+
return callback(nextProps, PATTERN_HELPERS);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -81,7 +81,7 @@ function build(mod, config, callbacks, hooks) {
|
|
|
81
81
|
assertProjectHooks(hooks, callbacks);
|
|
82
82
|
const prepared = prepareCompilerConfig(config);
|
|
83
83
|
const compiler = mod.WasmCompiler.fromConfig(fs, prepared, buildFromConfigOptions(callbacks));
|
|
84
|
-
registerCallbacks(compiler, callbacks, hooks, compiler.
|
|
84
|
+
registerCallbacks(compiler, callbacks, hooks, compiler.tokenDictionary?.());
|
|
85
85
|
Object.defineProperty(compiler, "fs", { value: fs, enumerable: false });
|
|
86
86
|
Object.defineProperty(compiler, "path", { value: wasmPathSystem(compiler), enumerable: false });
|
|
87
87
|
const buildInfo = new BuildInfo(compiler);
|
|
@@ -120,12 +120,7 @@ function buildFromConfigOptions(callbacks) {
|
|
|
120
120
|
if (!utilityValues || Object.keys(utilityValues).length === 0) return void 0;
|
|
121
121
|
return {
|
|
122
122
|
configCallbacks: {
|
|
123
|
-
utilityValues
|
|
124
|
-
Object.entries(utilityValues).map(([id, callback]) => [
|
|
125
|
-
id,
|
|
126
|
-
(tokenDictionary) => callback((category) => getTokenCategoryValues(category, tokenDictionary))
|
|
127
|
-
])
|
|
128
|
-
)
|
|
123
|
+
utilityValues
|
|
129
124
|
}
|
|
130
125
|
};
|
|
131
126
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParseFileReport, ScanOptions, LayerNames, Spec, SourceEntry, FileInspectionResult, ResolveUtilityValueInput, ResolvedUtilityValue, TokenSuggestion, WriteArtifactsOptions, WriteCssOptions, WriteCssResult, WriteLayerCssOptions, WriteSplitCssOptions,
|
|
1
|
+
import { ParseFileReport, ScanOptions, LayerNames, Spec, SourceEntry, FileInspectionResult, ResolveUtilityValueInput, ResolvedUtilityValue, TokenSuggestion, WriteArtifactsOptions, WriteCssOptions, WriteCssResult, WriteLayerCssOptions, WriteSplitCssOptions, WriteSplitCssResult, SerializedHookFilter, Atom, RecipeEntry, EncodedRecipeStyles, ProjectSummary, CompileOptions, CompileOutput, LayerCssOptions, SplitCssOptions, SplitCssResult, GenerateArtifactOptions, CodegenArtifact, CodegenArtifactId, CodegenDependency, Diagnostic, CompileFileManifest, ParsedFileView, StaticPatternResult, BuildInfoDesignSystemDependency, BuildInfoArtifact, DesignSystemManifestInput, DesignSystemManifest, SerializedConfig, UtilityValuesCallback, CompilerOptions, Compiler, ProjectCallbacks, ProjectHooks, ConfigSnapshot, Driver } from '@pandacss/compiler-shared';
|
|
2
2
|
export * from '@pandacss/compiler-shared';
|
|
3
|
-
export {
|
|
3
|
+
export { createUsageReport, mergeCallbacks } from '@pandacss/compiler-shared';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* TS-facing types that mirror the wasm-bindgen generated interfaces.
|
|
@@ -29,8 +29,7 @@ interface TokenDictionaryInput {
|
|
|
29
29
|
/** `path → CSS var form` (e.g. `colors.red.500 → var(--colors-red-500)`). */
|
|
30
30
|
vars: Record<string, string>;
|
|
31
31
|
}
|
|
32
|
-
type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' |
|
|
33
|
-
type CssSyntax = 'template-literal' | 'object-literal';
|
|
32
|
+
type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | (string & {});
|
|
34
33
|
interface MatchersInput {
|
|
35
34
|
css?: MatcherInput;
|
|
36
35
|
recipe?: MatcherInput;
|
|
@@ -41,8 +40,6 @@ interface MatchersInput {
|
|
|
41
40
|
jsxFramework?: JsxFramework;
|
|
42
41
|
/** Defaults to `["styled"]` when omitted. */
|
|
43
42
|
jsxFactories?: string[];
|
|
44
|
-
/** CSS authoring syntax preference. Omit for object-literal mode. */
|
|
45
|
-
syntax?: CssSyntax;
|
|
46
43
|
/** Enable `token('…')` folding by passing a resolved dictionary. */
|
|
47
44
|
tokenDictionary?: TokenDictionaryInput;
|
|
48
45
|
}
|
|
@@ -74,6 +71,7 @@ declare class WasmCompiler {
|
|
|
74
71
|
refreshFile(path: string): boolean;
|
|
75
72
|
refreshFileSource(path: string, source: string): boolean;
|
|
76
73
|
removeFile(path: string): boolean;
|
|
74
|
+
affectedFiles(): string[];
|
|
77
75
|
clear(): void;
|
|
78
76
|
scan(options?: ScanOptions): string[];
|
|
79
77
|
realpath(path: string): string;
|
|
@@ -84,6 +82,7 @@ declare class WasmCompiler {
|
|
|
84
82
|
parseFiles(paths: string[]): ParseFileReport[];
|
|
85
83
|
layers(): LayerNames;
|
|
86
84
|
hasLayerDeclaration(css: string): boolean;
|
|
85
|
+
stripLayerOrderStatements(css: string): string;
|
|
87
86
|
spec(): Spec;
|
|
88
87
|
sources(): SourceEntry[];
|
|
89
88
|
inspectFileSource(path: string, source: string): Omit<FileInspectionResult, 'path'>;
|
|
@@ -93,7 +92,7 @@ declare class WasmCompiler {
|
|
|
93
92
|
writeArtifacts(options: WriteArtifactsOptions): string[];
|
|
94
93
|
writeCss(options: WriteCssOptions): WriteCssResult;
|
|
95
94
|
writeLayerCss(options: WriteLayerCssOptions): WriteCssResult;
|
|
96
|
-
writeSplitCss(options: WriteSplitCssOptions):
|
|
95
|
+
writeSplitCss(options: WriteSplitCssOptions): WriteSplitCssResult;
|
|
97
96
|
isEmpty(): boolean;
|
|
98
97
|
registerUtilityTransform?(id: string, callback: (resolved: unknown, original: unknown) => unknown): void;
|
|
99
98
|
registerPatternTransform?(id: string, callback: (props: unknown, helpers: Record<string, unknown>) => unknown): void;
|
|
@@ -105,7 +104,8 @@ declare class WasmCompiler {
|
|
|
105
104
|
summary(): ProjectSummary;
|
|
106
105
|
compile(options?: CompileOptions): CompileOutput;
|
|
107
106
|
getLayerCss(options: LayerCssOptions): CompileOutput;
|
|
108
|
-
|
|
107
|
+
getKeyframeCss(options?: CompileOptions): CompileOutput;
|
|
108
|
+
getSplitCss(options?: SplitCssOptions): SplitCssResult;
|
|
109
109
|
generateArtifacts(options?: GenerateArtifactOptions): CodegenArtifact[];
|
|
110
110
|
generateArtifact(id: CodegenArtifactId, options?: GenerateArtifactOptions): CodegenArtifact | undefined;
|
|
111
111
|
generateAffectedArtifacts(dependencies: CodegenDependency[], options?: GenerateArtifactOptions): CodegenArtifact[];
|
|
@@ -114,7 +114,7 @@ declare class WasmCompiler {
|
|
|
114
114
|
/** Per-file view, or `null` when `path` isn't known. */
|
|
115
115
|
getFile(path: string): ParsedFileView | null;
|
|
116
116
|
staticPatternAtoms(): StaticPatternResult;
|
|
117
|
-
serializeBuildInfo(panda: string): BuildInfoArtifact;
|
|
117
|
+
serializeBuildInfo(panda: string, designSystemDependencies?: BuildInfoDesignSystemDependency[]): BuildInfoArtifact;
|
|
118
118
|
applyBuildInfo(name: string, buildInfo: BuildInfoArtifact, only?: string[]): boolean;
|
|
119
119
|
buildInfoSchemaVersion(): number;
|
|
120
120
|
configFingerprint(): string;
|
|
@@ -146,15 +146,15 @@ declare class WasmCompiler {
|
|
|
146
146
|
*/
|
|
147
147
|
interface WasmFromConfigOptions {
|
|
148
148
|
configCallbacks?: {
|
|
149
|
-
utilityValues?: Record<string,
|
|
149
|
+
utilityValues?: Record<string, UtilityValuesCallback>;
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* The raw wasm instance - superset of {@link Compiler} carrying the internal
|
|
154
|
-
* `
|
|
154
|
+
* `tokenDictionary` the facade hides.
|
|
155
155
|
*/
|
|
156
156
|
interface RawWasmCompiler extends WasmCompiler {
|
|
157
|
-
|
|
157
|
+
tokenDictionary?(): TokenDictionaryInput | undefined;
|
|
158
158
|
}
|
|
159
159
|
interface WasmModule {
|
|
160
160
|
WasmFileSystem: new () => WasmFileSystem;
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
createCompilerFromWasmModule,
|
|
5
5
|
createUsageReport,
|
|
6
6
|
mergeCallbacks
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZARW4JPN.js";
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
|
-
import { createRequire } from "module";
|
|
10
|
+
import { createRequire } from "node:module";
|
|
11
11
|
import { mergeCallbacks as mergeCallbacks2, mergeHooks } from "@pandacss/compiler-shared";
|
|
12
12
|
|
|
13
13
|
// src/driver.ts
|
|
@@ -47,12 +47,19 @@ var BrowserDriver = class extends BaseDriver {
|
|
|
47
47
|
return NO_CHANGE;
|
|
48
48
|
}
|
|
49
49
|
applyChange(change) {
|
|
50
|
+
const changed = this.trackSourceChange(change, this.#applySourceChange(change));
|
|
51
|
+
const refreshed = this.refreshAffectedFiles();
|
|
52
|
+
return changed || refreshed;
|
|
53
|
+
}
|
|
54
|
+
#applySourceChange(change) {
|
|
50
55
|
if (change.kind === "unlink") {
|
|
51
56
|
this.compiler.fs.removeFile?.(change.path);
|
|
52
57
|
return this.compiler.removeFile(change.path);
|
|
53
58
|
}
|
|
54
59
|
if (change.content == null) return false;
|
|
55
60
|
this.compiler.fs.addFile?.(change.path, change.content);
|
|
61
|
+
if (this.compiler.refreshFileSource(change.path, change.content)) return true;
|
|
62
|
+
if (!this.isSourceFile(change.path)) return false;
|
|
56
63
|
this.compiler.parseFileSource(change.path, change.content);
|
|
57
64
|
return true;
|
|
58
65
|
}
|
|
@@ -74,7 +81,7 @@ async function loadWasm() {
|
|
|
74
81
|
return mod;
|
|
75
82
|
}
|
|
76
83
|
async function createCompiler(config, options) {
|
|
77
|
-
const { createCompilerFromWasmModule: createCompilerFromWasmModule2 } = await import("./web-
|
|
84
|
+
const { createCompilerFromWasmModule: createCompilerFromWasmModule2 } = await import("./web-JSAD2QZX.js");
|
|
78
85
|
return createCompilerFromWasmModule2(await loadWasm(), config, options);
|
|
79
86
|
}
|
|
80
87
|
async function createCompilerFromSnapshot(snapshot, options) {
|
package/dist/web.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParseFileReport, ScanOptions, LayerNames, Spec, SourceEntry, FileInspectionResult, ResolveUtilityValueInput, ResolvedUtilityValue, TokenSuggestion, WriteArtifactsOptions, WriteCssOptions, WriteCssResult, WriteLayerCssOptions, WriteSplitCssOptions,
|
|
1
|
+
import { ParseFileReport, ScanOptions, LayerNames, Spec, SourceEntry, FileInspectionResult, ResolveUtilityValueInput, ResolvedUtilityValue, TokenSuggestion, WriteArtifactsOptions, WriteCssOptions, WriteCssResult, WriteLayerCssOptions, WriteSplitCssOptions, WriteSplitCssResult, SerializedHookFilter, Atom, RecipeEntry, EncodedRecipeStyles, ProjectSummary, CompileOptions, CompileOutput, LayerCssOptions, SplitCssOptions, SplitCssResult, GenerateArtifactOptions, CodegenArtifact, CodegenArtifactId, CodegenDependency, Diagnostic, CompileFileManifest, ParsedFileView, StaticPatternResult, BuildInfoDesignSystemDependency, BuildInfoArtifact, DesignSystemManifestInput, DesignSystemManifest, SerializedConfig, UtilityValuesCallback, CompilerOptions, Compiler, ProjectCallbacks, ProjectHooks } from '@pandacss/compiler-shared';
|
|
2
2
|
export * from '@pandacss/compiler-shared';
|
|
3
|
-
export {
|
|
3
|
+
export { createUsageReport, mergeCallbacks } from '@pandacss/compiler-shared';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* TS-facing types that mirror the wasm-bindgen generated interfaces.
|
|
@@ -29,8 +29,7 @@ interface TokenDictionaryInput {
|
|
|
29
29
|
/** `path → CSS var form` (e.g. `colors.red.500 → var(--colors-red-500)`). */
|
|
30
30
|
vars: Record<string, string>;
|
|
31
31
|
}
|
|
32
|
-
type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' |
|
|
33
|
-
type CssSyntax = 'template-literal' | 'object-literal';
|
|
32
|
+
type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | (string & {});
|
|
34
33
|
interface MatchersInput {
|
|
35
34
|
css?: MatcherInput;
|
|
36
35
|
recipe?: MatcherInput;
|
|
@@ -41,8 +40,6 @@ interface MatchersInput {
|
|
|
41
40
|
jsxFramework?: JsxFramework;
|
|
42
41
|
/** Defaults to `["styled"]` when omitted. */
|
|
43
42
|
jsxFactories?: string[];
|
|
44
|
-
/** CSS authoring syntax preference. Omit for object-literal mode. */
|
|
45
|
-
syntax?: CssSyntax;
|
|
46
43
|
/** Enable `token('…')` folding by passing a resolved dictionary. */
|
|
47
44
|
tokenDictionary?: TokenDictionaryInput;
|
|
48
45
|
}
|
|
@@ -74,6 +71,7 @@ declare class WasmCompiler {
|
|
|
74
71
|
refreshFile(path: string): boolean;
|
|
75
72
|
refreshFileSource(path: string, source: string): boolean;
|
|
76
73
|
removeFile(path: string): boolean;
|
|
74
|
+
affectedFiles(): string[];
|
|
77
75
|
clear(): void;
|
|
78
76
|
scan(options?: ScanOptions): string[];
|
|
79
77
|
realpath(path: string): string;
|
|
@@ -84,6 +82,7 @@ declare class WasmCompiler {
|
|
|
84
82
|
parseFiles(paths: string[]): ParseFileReport[];
|
|
85
83
|
layers(): LayerNames;
|
|
86
84
|
hasLayerDeclaration(css: string): boolean;
|
|
85
|
+
stripLayerOrderStatements(css: string): string;
|
|
87
86
|
spec(): Spec;
|
|
88
87
|
sources(): SourceEntry[];
|
|
89
88
|
inspectFileSource(path: string, source: string): Omit<FileInspectionResult, 'path'>;
|
|
@@ -93,7 +92,7 @@ declare class WasmCompiler {
|
|
|
93
92
|
writeArtifacts(options: WriteArtifactsOptions): string[];
|
|
94
93
|
writeCss(options: WriteCssOptions): WriteCssResult;
|
|
95
94
|
writeLayerCss(options: WriteLayerCssOptions): WriteCssResult;
|
|
96
|
-
writeSplitCss(options: WriteSplitCssOptions):
|
|
95
|
+
writeSplitCss(options: WriteSplitCssOptions): WriteSplitCssResult;
|
|
97
96
|
isEmpty(): boolean;
|
|
98
97
|
registerUtilityTransform?(id: string, callback: (resolved: unknown, original: unknown) => unknown): void;
|
|
99
98
|
registerPatternTransform?(id: string, callback: (props: unknown, helpers: Record<string, unknown>) => unknown): void;
|
|
@@ -105,7 +104,8 @@ declare class WasmCompiler {
|
|
|
105
104
|
summary(): ProjectSummary;
|
|
106
105
|
compile(options?: CompileOptions): CompileOutput;
|
|
107
106
|
getLayerCss(options: LayerCssOptions): CompileOutput;
|
|
108
|
-
|
|
107
|
+
getKeyframeCss(options?: CompileOptions): CompileOutput;
|
|
108
|
+
getSplitCss(options?: SplitCssOptions): SplitCssResult;
|
|
109
109
|
generateArtifacts(options?: GenerateArtifactOptions): CodegenArtifact[];
|
|
110
110
|
generateArtifact(id: CodegenArtifactId, options?: GenerateArtifactOptions): CodegenArtifact | undefined;
|
|
111
111
|
generateAffectedArtifacts(dependencies: CodegenDependency[], options?: GenerateArtifactOptions): CodegenArtifact[];
|
|
@@ -114,7 +114,7 @@ declare class WasmCompiler {
|
|
|
114
114
|
/** Per-file view, or `null` when `path` isn't known. */
|
|
115
115
|
getFile(path: string): ParsedFileView | null;
|
|
116
116
|
staticPatternAtoms(): StaticPatternResult;
|
|
117
|
-
serializeBuildInfo(panda: string): BuildInfoArtifact;
|
|
117
|
+
serializeBuildInfo(panda: string, designSystemDependencies?: BuildInfoDesignSystemDependency[]): BuildInfoArtifact;
|
|
118
118
|
applyBuildInfo(name: string, buildInfo: BuildInfoArtifact, only?: string[]): boolean;
|
|
119
119
|
buildInfoSchemaVersion(): number;
|
|
120
120
|
configFingerprint(): string;
|
|
@@ -146,15 +146,15 @@ declare class WasmCompiler {
|
|
|
146
146
|
*/
|
|
147
147
|
interface WasmFromConfigOptions {
|
|
148
148
|
configCallbacks?: {
|
|
149
|
-
utilityValues?: Record<string,
|
|
149
|
+
utilityValues?: Record<string, UtilityValuesCallback>;
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* The raw wasm instance - superset of {@link Compiler} carrying the internal
|
|
154
|
-
* `
|
|
154
|
+
* `tokenDictionary` the facade hides.
|
|
155
155
|
*/
|
|
156
156
|
interface RawWasmCompiler extends WasmCompiler {
|
|
157
|
-
|
|
157
|
+
tokenDictionary?(): TokenDictionaryInput | undefined;
|
|
158
158
|
}
|
|
159
159
|
interface WasmModule {
|
|
160
160
|
WasmFileSystem: new () => WasmFileSystem;
|
package/dist/web.js
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
BuildInfo,
|
|
6
6
|
DesignSystem,
|
|
7
7
|
createUsageReport,
|
|
8
|
-
getTokenCategoryValues,
|
|
9
8
|
inspectFile,
|
|
10
9
|
inspectFiles,
|
|
11
10
|
mergeCallbacks,
|
|
@@ -14,12 +13,13 @@ import {
|
|
|
14
13
|
|
|
15
14
|
// src/callbacks.ts
|
|
16
15
|
import {
|
|
17
|
-
|
|
18
|
-
createTransformArgs,
|
|
16
|
+
createTransformHelpers,
|
|
19
17
|
getPatternDefaultValueRefsByTransformId,
|
|
20
|
-
mergePatternDefaultValues
|
|
18
|
+
mergePatternDefaultValues,
|
|
19
|
+
PATTERN_HELPERS
|
|
21
20
|
} from "@pandacss/compiler-shared";
|
|
22
21
|
function registerCallbacks(project, callbacks, hooks, tokenDictionary) {
|
|
22
|
+
const { token, utils } = createTransformHelpers(tokenDictionary);
|
|
23
23
|
const utilityTransforms = callbacks["utility.transform"];
|
|
24
24
|
if (utilityTransforms && Object.keys(utilityTransforms).length > 0 && !project.registerUtilityTransform) {
|
|
25
25
|
throw new Error("WASM project does not support utility.transform callbacks");
|
|
@@ -27,7 +27,7 @@ function registerCallbacks(project, callbacks, hooks, tokenDictionary) {
|
|
|
27
27
|
if (project.registerUtilityTransform && utilityTransforms && Object.keys(utilityTransforms).length > 0) {
|
|
28
28
|
for (const [id, callback] of Object.entries(utilityTransforms)) {
|
|
29
29
|
project.registerUtilityTransform(id, (resolved, original) => {
|
|
30
|
-
return callback(resolved,
|
|
30
|
+
return callback(resolved, { raw: original, token, utils });
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -45,7 +45,7 @@ function registerCallbacks(project, callbacks, hooks, tokenDictionary) {
|
|
|
45
45
|
project.registerPatternTransform(id, (props) => {
|
|
46
46
|
const input = props;
|
|
47
47
|
const nextProps = defaultValue ? mergePatternDefaultValues(defaultValue(input), input) : input;
|
|
48
|
-
return callback(nextProps,
|
|
48
|
+
return callback(nextProps, PATTERN_HELPERS);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -81,7 +81,7 @@ function build(mod, config, callbacks, hooks) {
|
|
|
81
81
|
assertProjectHooks(hooks, callbacks);
|
|
82
82
|
const prepared = prepareCompilerConfig(config);
|
|
83
83
|
const compiler = mod.WasmCompiler.fromConfig(fs, prepared, buildFromConfigOptions(callbacks));
|
|
84
|
-
registerCallbacks(compiler, callbacks, hooks, compiler.
|
|
84
|
+
registerCallbacks(compiler, callbacks, hooks, compiler.tokenDictionary?.());
|
|
85
85
|
Object.defineProperty(compiler, "fs", { value: fs, enumerable: false });
|
|
86
86
|
Object.defineProperty(compiler, "path", { value: wasmPathSystem(compiler), enumerable: false });
|
|
87
87
|
const buildInfo = new BuildInfo(compiler);
|
|
@@ -120,12 +120,7 @@ function buildFromConfigOptions(callbacks) {
|
|
|
120
120
|
if (!utilityValues || Object.keys(utilityValues).length === 0) return void 0;
|
|
121
121
|
return {
|
|
122
122
|
configCallbacks: {
|
|
123
|
-
utilityValues
|
|
124
|
-
Object.entries(utilityValues).map(([id, callback]) => [
|
|
125
|
-
id,
|
|
126
|
-
(tokenDictionary) => callback((category) => getTokenCategoryValues(category, tokenDictionary))
|
|
127
|
-
])
|
|
128
|
-
)
|
|
123
|
+
utilityValues
|
|
129
124
|
}
|
|
130
125
|
};
|
|
131
126
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/compiler-wasm",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "WebAssembly binding for the Panda compiler engine (browser/playground target)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,10 +38,11 @@
|
|
|
38
38
|
"pkg-web"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@pandacss/compiler-shared": "2.0.
|
|
41
|
+
"@pandacss/compiler-shared": "2.0.1",
|
|
42
|
+
"@pandacss/types": "2.0.1"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@pandacss/config": "2.0.
|
|
45
|
+
"@pandacss/config": "2.0.1"
|
|
45
46
|
},
|
|
46
47
|
"engines": {
|
|
47
48
|
"node": ">=22"
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
"build:js": "tsup",
|
|
52
53
|
"build:fast": "tsup --no-dts",
|
|
53
54
|
"build:wasm": "tsx build-wasm.ts",
|
|
55
|
+
"verify:package": "node verify-package.mjs",
|
|
54
56
|
"dev": "pnpm build:fast --watch",
|
|
55
57
|
"test": "vitest run"
|
|
56
58
|
}
|
|
@@ -19,6 +19,11 @@ export class WasmCompiler {
|
|
|
19
19
|
private constructor();
|
|
20
20
|
free(): void;
|
|
21
21
|
[Symbol.dispose](): void;
|
|
22
|
+
/**
|
|
23
|
+
* Files whose folded imports changed since the last call. Clears on read.
|
|
24
|
+
* Re-parse each via `refreshFile`, then call again until empty.
|
|
25
|
+
*/
|
|
26
|
+
affectedFiles(): string[];
|
|
22
27
|
/**
|
|
23
28
|
* Hydrate an external build info into this project (additive), optionally
|
|
24
29
|
* restricted to imported modules (tree-shaking). Returns `false` on a
|
|
@@ -66,13 +71,21 @@ export class WasmCompiler {
|
|
|
66
71
|
*/
|
|
67
72
|
configFingerprint(): string;
|
|
68
73
|
/**
|
|
69
|
-
* Build a `panda
|
|
74
|
+
* Build a `panda/lib.json` value from host-supplied fields, stamping the
|
|
70
75
|
* engine-owned schema version. Backs the `designSystem.create` JS namespace.
|
|
71
76
|
*
|
|
72
77
|
* # Errors
|
|
73
78
|
* Returns a JS error if `input` is invalid or the manifest fails to serialize.
|
|
74
79
|
*/
|
|
75
80
|
createDesignSystemManifest(input: any): any;
|
|
81
|
+
/**
|
|
82
|
+
* Per-package import selections from one scan. Each entry is `null` = all,
|
|
83
|
+
* or export names to narrow.
|
|
84
|
+
*
|
|
85
|
+
* # Errors
|
|
86
|
+
* Returns a JS error when the scan fails or serialization fails.
|
|
87
|
+
*/
|
|
88
|
+
designSystemImportSelections(packages: any): any;
|
|
76
89
|
/**
|
|
77
90
|
* The manifest wire-format version this binding reads/writes.
|
|
78
91
|
*/
|
|
@@ -117,23 +130,14 @@ export class WasmCompiler {
|
|
|
117
130
|
static fromConfig(fs: WasmFileSystem, config: any, options: any): WasmCompiler;
|
|
118
131
|
/**
|
|
119
132
|
* Generate artifacts affected by the provided config dependency names.
|
|
120
|
-
*
|
|
121
|
-
* # Errors
|
|
122
|
-
* Returns a JS error if dependencies/options are invalid or serializing fails.
|
|
123
133
|
*/
|
|
124
134
|
generateAffectedArtifacts(dependencies: any, options: any): any;
|
|
125
135
|
/**
|
|
126
136
|
* Generate one codegen artifact by id.
|
|
127
|
-
*
|
|
128
|
-
* # Errors
|
|
129
|
-
* Returns a JS error if the id/options are invalid or serializing fails.
|
|
130
137
|
*/
|
|
131
138
|
generateArtifact(id: string, options: any): any;
|
|
132
139
|
/**
|
|
133
140
|
* Generate every codegen artifact from the resolved project state.
|
|
134
|
-
*
|
|
135
|
-
* # Errors
|
|
136
|
-
* Returns a JS error if options are invalid or serializing fails.
|
|
137
141
|
*/
|
|
138
142
|
generateArtifacts(options: any): any;
|
|
139
143
|
/**
|
|
@@ -143,6 +147,10 @@ export class WasmCompiler {
|
|
|
143
147
|
* Returns a JS error if serializing fails.
|
|
144
148
|
*/
|
|
145
149
|
getFile(path: string): any;
|
|
150
|
+
/**
|
|
151
|
+
* Theme `@keyframes` CSS only (no token vars or other layers).
|
|
152
|
+
*/
|
|
153
|
+
getKeyframeCss(options?: any | null): any;
|
|
146
154
|
/**
|
|
147
155
|
* CSS for the named cascade layers, concatenated in order. Sliced in Rust
|
|
148
156
|
* (byte offsets stay valid); unknown layer names are skipped.
|
|
@@ -202,8 +210,8 @@ export class WasmCompiler {
|
|
|
202
210
|
*/
|
|
203
211
|
parseFileSource(path: string, source: string): any;
|
|
204
212
|
/**
|
|
205
|
-
* Read + parse source paths
|
|
206
|
-
*
|
|
213
|
+
* Read + parse source paths from `scan()`. One report per requested path;
|
|
214
|
+
* a read miss keeps last-good state and reports a warning diagnostic.
|
|
207
215
|
*
|
|
208
216
|
* # Errors
|
|
209
217
|
* Returns a JS error when `paths` is malformed or serializing the report fails.
|
|
@@ -272,7 +280,7 @@ export class WasmCompiler {
|
|
|
272
280
|
* # Errors
|
|
273
281
|
* Returns a JS error if serializing the build info fails.
|
|
274
282
|
*/
|
|
275
|
-
serializeBuildInfo(panda: string): any;
|
|
283
|
+
serializeBuildInfo(panda: string, dependencies: any): any;
|
|
276
284
|
/**
|
|
277
285
|
* Every `sva()` slot-recipe entry.
|
|
278
286
|
*
|
|
@@ -301,6 +309,10 @@ export class WasmCompiler {
|
|
|
301
309
|
* Returns a JS error if serializing fails.
|
|
302
310
|
*/
|
|
303
311
|
staticPatternAtoms(): any;
|
|
312
|
+
/**
|
|
313
|
+
* Remove Panda `@layer a, b;` order statements; leave unrelated ones.
|
|
314
|
+
*/
|
|
315
|
+
stripLayerOrderStatements(css: string): string;
|
|
304
316
|
/**
|
|
305
317
|
* Semantic tokens that carry the same value as a token path.
|
|
306
318
|
*
|
|
@@ -325,12 +337,9 @@ export class WasmCompiler {
|
|
|
325
337
|
/**
|
|
326
338
|
* Rust-built token dictionary projected into the small JS interop shape.
|
|
327
339
|
*/
|
|
328
|
-
|
|
340
|
+
tokenDictionary(): any;
|
|
329
341
|
/**
|
|
330
342
|
* Generate artifacts and write them under `outdir`.
|
|
331
|
-
*
|
|
332
|
-
* # Errors
|
|
333
|
-
* Returns a JS error if writing or serializing fails.
|
|
334
343
|
*/
|
|
335
344
|
writeArtifacts(options: any): any;
|
|
336
345
|
writeCss(options: any): any;
|