@gasm-compiler/core 0.5.0 → 0.6.0
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/README.md +24 -5
- package/dist/browser.d.ts +2 -64
- package/dist/browser.js +1 -10
- package/dist/chunk-7JF6MVMW.js +9 -0
- package/dist/chunk-CYV3E4CZ.js +1 -0
- package/dist/compiler.js +1 -1
- package/dist/gasm_core_rs.wasm +0 -0
- package/dist/mod.js +1 -1
- package/package.json +3 -6
- package/dist/chunk-MBWDLAL5.js +0 -5
- package/dist/chunk-TICBJF7F.js +0 -9
package/README.md
CHANGED
|
@@ -15,7 +15,8 @@ Gasm v0.1 behavior remains available through an explicit compatibility option.
|
|
|
15
15
|
npm install @gasm-compiler/core
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
The compiler core is distributed as a Rust-generated WebAssembly artifact. No
|
|
19
|
+
TypeScript runtime dependency is required by consumers.
|
|
19
20
|
|
|
20
21
|
---
|
|
21
22
|
|
|
@@ -85,10 +86,12 @@ const schema = validateGasmMetadataSchema(result.metadata);
|
|
|
85
86
|
if (!schema.valid) throw new Error(schema.errors.join(", "));
|
|
86
87
|
```
|
|
87
88
|
|
|
88
|
-
Gasm
|
|
89
|
-
through its Wasm artifact.
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
All Gasm compiler semantics, including explicit v0.1 compatibility mode, are
|
|
90
|
+
implemented in `packages/core-rs` and distributed through its Wasm artifact.
|
|
91
|
+
The TypeScript package code is limited to host integration, artifact metadata,
|
|
92
|
+
source-map comments, preparation helpers, and execution APIs. Deno remains the
|
|
93
|
+
runtime for the CLI and the live core/CLI test suites, including headless
|
|
94
|
+
WebGPU execution.
|
|
92
95
|
|
|
93
96
|
The CLI also defaults to v0.2:
|
|
94
97
|
|
|
@@ -100,6 +103,22 @@ gasm-compiler compile input.wasm \
|
|
|
100
103
|
|
|
101
104
|
Use `--spec-version 0.1` when compiling archived v0.1 inputs.
|
|
102
105
|
|
|
106
|
+
#### Migrating from 0.5.x
|
|
107
|
+
|
|
108
|
+
- The Rust/Wasm compiler is now the only compiler backend. The
|
|
109
|
+
`GASM_CORE_BACKEND` environment variable no longer changes compilation.
|
|
110
|
+
- Browser backend selection APIs have been removed:
|
|
111
|
+
`setBrowserCompilerBackend()`, `getBrowserCompilerBackend()`, and
|
|
112
|
+
`BrowserCompilerBackend`.
|
|
113
|
+
- TypeScript/Rust comparison APIs and their result types have been removed:
|
|
114
|
+
`compileWithBackendComparison()`, `compileWithBackendComparisonAsync()`,
|
|
115
|
+
`BackendComparisonResult`, and `BackendMismatchDetails`.
|
|
116
|
+
- Remove backend-selection and comparison UI from integrator applications and
|
|
117
|
+
call `compile()`, `compileWithDiagnostics()`, or
|
|
118
|
+
`compileWithDiagnosticsAsync()` directly.
|
|
119
|
+
- Consumers no longer need to install TypeScript as a peer dependency of
|
|
120
|
+
`@gasm-compiler/core`.
|
|
121
|
+
|
|
103
122
|
#### Migrating from 0.3.x
|
|
104
123
|
|
|
105
124
|
- Compilation now defaults to strict Gasm v0.2 validation.
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import { C as CompileDiagnostics,
|
|
1
|
+
import { C as CompileDiagnostics, G as GasmMetadata, a as GasmBinding, P as PreparedModule, b as CompileOptions, c as PrepareModuleOptions } from './error_codes-5zCZDwFZ.js';
|
|
2
2
|
export { d as CompileError, h as DEFAULT_SPEC_VERSION, e as DemotionPolicy, f as Diagnostic, g as DiagnosticRecovery, o as ErrorCode, E as ErrorCodes, u as GasmMetadataEntryPoint, M as MutableGlobalsInit, x as PrepareMode, j as SPEC_VERSION_V01, k as SPEC_VERSION_V02, S as SpecVersion, w as buildBindingTable, s as buildGasmMetadata, l as isCompileError, n as isParseError, i as isV02Mode, m as parseWasmModule, p as prepareModule, r as resolveSpecVersion, v as validateGasmMetadataSchema } from './error_codes-5zCZDwFZ.js';
|
|
3
3
|
export { BrowserGPUExecutor } from './browser-executor.js';
|
|
4
4
|
export { BufferData, ExecuteOptions, ExecutionError, ExecutorConfig, IGPUExecutor, OutputBufferSpec, isExecutionError } from './executor.js';
|
|
5
5
|
|
|
6
|
-
type BrowserTsCompileWithDiagnosticsResult = {
|
|
7
|
-
ok: true;
|
|
8
|
-
wgsl: string;
|
|
9
|
-
diagnostics: CompileDiagnostics;
|
|
10
|
-
dispatchInfo: DispatchInfo$1;
|
|
11
|
-
} | {
|
|
12
|
-
ok: false;
|
|
13
|
-
diagnostics: CompileDiagnostics;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
6
|
interface InitRustCompilerOptions {
|
|
17
7
|
wasmUrl?: string | URL;
|
|
18
8
|
}
|
|
@@ -21,32 +11,6 @@ declare const initRustCompiler: typeof preloadCompiler;
|
|
|
21
11
|
declare function isRustCompilerInitialized(): boolean;
|
|
22
12
|
declare function waitForRustCompilerInit(): Promise<void>;
|
|
23
13
|
|
|
24
|
-
/**
|
|
25
|
-
* Shared helpers for comparing TypeScript and Rust/Wasm WGSL output.
|
|
26
|
-
*/
|
|
27
|
-
interface WgslDiffOptions {
|
|
28
|
-
/** Maximum diff hunk lines to include in formatted output. */
|
|
29
|
-
maxLines?: number;
|
|
30
|
-
/** Lines of context around each change hunk. */
|
|
31
|
-
context?: number;
|
|
32
|
-
}
|
|
33
|
-
interface WgslComparisonSummary {
|
|
34
|
-
equivalent: boolean;
|
|
35
|
-
moduleEquivalent: boolean;
|
|
36
|
-
functionEquivalent?: boolean;
|
|
37
|
-
moduleDiff?: string;
|
|
38
|
-
functionDiff?: string;
|
|
39
|
-
typescriptSnippet?: string;
|
|
40
|
-
rustSnippet?: string;
|
|
41
|
-
}
|
|
42
|
-
declare function normalizeWgslForComparison(wgsl: string): string;
|
|
43
|
-
declare function exportWgslFunctionSnippet(wgsl: string, funcName: string): string | null;
|
|
44
|
-
declare function summarizeWgslComparison(typescriptWgsl: string, rustWgsl: string, funcName?: string, options?: WgslDiffOptions): WgslComparisonSummary;
|
|
45
|
-
declare function formatUnifiedDiff(leftLabel: string, rightLabel: string, left: string, right: string, options?: WgslDiffOptions): string;
|
|
46
|
-
|
|
47
|
-
type BrowserCompilerBackend = "typescript" | "rust" | "compare";
|
|
48
|
-
declare function setBrowserCompilerBackend(backend: BrowserCompilerBackend): void;
|
|
49
|
-
declare function getBrowserCompilerBackend(): BrowserCompilerBackend;
|
|
50
14
|
declare function disassembleToWAT(wasmBytes: Uint8Array): Promise<string>;
|
|
51
15
|
|
|
52
16
|
interface DispatchInfo {
|
|
@@ -89,37 +53,11 @@ type CompileWithRuntimeInfoResult = {
|
|
|
89
53
|
ok: false;
|
|
90
54
|
diagnostics: CompileDiagnostics;
|
|
91
55
|
};
|
|
92
|
-
interface BackendMismatchDetails {
|
|
93
|
-
kind: "wgsl" | "ok_mismatch" | "rust_error" | "diagnostics";
|
|
94
|
-
message: string;
|
|
95
|
-
moduleDiff?: string;
|
|
96
|
-
functionDiff?: string;
|
|
97
|
-
typescriptWgsl?: string;
|
|
98
|
-
rustWgsl?: string;
|
|
99
|
-
}
|
|
100
|
-
interface BackendComparisonResult {
|
|
101
|
-
selectedBackend: "typescript";
|
|
102
|
-
returned: CompileWithDiagnosticsResult;
|
|
103
|
-
typescript: BrowserTsCompileWithDiagnosticsResult;
|
|
104
|
-
rust: CompileWithDiagnosticsResult | {
|
|
105
|
-
ok: false;
|
|
106
|
-
error: string;
|
|
107
|
-
};
|
|
108
|
-
equivalent: boolean;
|
|
109
|
-
mismatch?: BackendMismatchDetails;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
56
|
declare function compileWithDiagnostics(wasmBytes: Uint8Array, options?: CompileOptions): CompileWithDiagnosticsResult;
|
|
113
57
|
declare function compileToArtifact(wasmBytes: Uint8Array, options?: CompileOptions): CompileArtifactResult;
|
|
114
58
|
declare function compileWithRuntimeInfo(wasmBytes: Uint8Array, options?: PrepareModuleOptions): CompileWithRuntimeInfoResult;
|
|
115
59
|
declare function compileWithDiagnosticsAsync(wasmBytes: Uint8Array, options?: CompileOptions, initOptions?: InitRustCompilerOptions): Promise<CompileWithDiagnosticsResult>;
|
|
116
|
-
declare function compileWithBackendComparison(wasmBytes: Uint8Array, options?: CompileOptions, compareOptions?: {
|
|
117
|
-
funcName?: string;
|
|
118
|
-
}): BackendComparisonResult;
|
|
119
|
-
declare function compileWithBackendComparisonAsync(wasmBytes: Uint8Array, options?: CompileOptions, compareOptions?: {
|
|
120
|
-
funcName?: string;
|
|
121
|
-
}, initOptions?: InitRustCompilerOptions): Promise<BackendComparisonResult>;
|
|
122
60
|
declare function compile(wasmBytes: Uint8Array, options?: CompileOptions): string;
|
|
123
61
|
declare function compileAsync(wasmBytes: Uint8Array, options?: CompileOptions, initOptions?: InitRustCompilerOptions): Promise<string>;
|
|
124
62
|
|
|
125
|
-
export { type
|
|
63
|
+
export { type CompileArtifactResult, CompileDiagnostics, CompileOptions, type CompileWithDiagnosticsResult, type CompileWithRuntimeInfoResult, type DispatchInfo, GasmBinding, GasmMetadata, type InitRustCompilerOptions, PrepareModuleOptions, PreparedModule, compile, compileAsync, compileToArtifact, compileWithDiagnostics, compileWithDiagnosticsAsync, compileWithRuntimeInfo, disassembleToWAT, initRustCompiler, isRustCompilerInitialized, preloadCompiler, waitForRustCompilerInit };
|