glassjar 0.1.0 → 0.2.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/README.md +83 -0
- package/assets/cpp-exceptions/runtime.tar.gz +0 -0
- package/dist/assets/worker-BPJOu1S6.js +1112 -0
- package/dist/compiler-module-cache.d.ts +54 -0
- package/dist/compiler-module-cache.d.ts.map +1 -0
- package/dist/cpp-object-cache.d.ts +55 -0
- package/dist/cpp-object-cache.d.ts.map +1 -0
- package/dist/debugger.d.ts +6 -1
- package/dist/debugger.d.ts.map +1 -1
- package/dist/engine-worker.d.ts +3 -0
- package/dist/engine-worker.d.ts.map +1 -0
- package/dist/engine_bg.wasm +0 -0
- package/dist/glassjar.js +1268 -1375
- package/dist/glassjar.umd.cjs +2 -912
- package/dist/host-device.d.ts +35 -0
- package/dist/host-device.d.ts.map +1 -0
- package/dist/index.d.ts +177 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/stock-cache-certificates.json.d.ts +4 -0
- package/dist/toolchain-manifest.d.ts +13 -0
- package/dist/toolchain-manifest.d.ts.map +1 -0
- package/dist/util.d.ts +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/verified-toolchain.d.ts +31 -0
- package/dist/verified-toolchain.d.ts.map +1 -0
- package/dist/wasm-source.d.ts +11 -0
- package/dist/wasm-source.d.ts.map +1 -0
- package/package.json +6 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Guest-visible path of the optional, per-run duplex byte device. */
|
|
2
|
+
export declare const HOST_DEVICE_PATH = "/dev/debugger-sh-host";
|
|
3
|
+
export interface HostDevice {
|
|
4
|
+
/** Aborted on completion, stop, or callback failure. */
|
|
5
|
+
readonly signal: AbortSignal;
|
|
6
|
+
/** Arbitrary byte chunks. Returns an unsubscribe function. */
|
|
7
|
+
onData(listener: (chunk: Uint8Array) => void): () => void;
|
|
8
|
+
/** Snapshots bytes; resolves when published. Await before writing again. */
|
|
9
|
+
write(chunk: Uint8Array): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export type HostDeviceOpener = (device: HostDevice) => void | (() => void);
|
|
12
|
+
/** Internal transport; framing belongs to the application. */
|
|
13
|
+
export declare class HostDeviceSession {
|
|
14
|
+
private readonly onFailure;
|
|
15
|
+
private readonly incoming;
|
|
16
|
+
private readonly outgoing;
|
|
17
|
+
readonly workerStart: {
|
|
18
|
+
guest_to_host: SharedArrayBuffer;
|
|
19
|
+
host_to_guest: SharedArrayBuffer;
|
|
20
|
+
};
|
|
21
|
+
private readonly abort;
|
|
22
|
+
private readonly listeners;
|
|
23
|
+
private cleanup?;
|
|
24
|
+
private worker?;
|
|
25
|
+
private writing;
|
|
26
|
+
constructor(onFailure: (error: Error) => void);
|
|
27
|
+
open(opener: HostDeviceOpener): void;
|
|
28
|
+
attach(worker: Worker): void;
|
|
29
|
+
private assertOpen;
|
|
30
|
+
private write;
|
|
31
|
+
private readonly onMessage;
|
|
32
|
+
private fail;
|
|
33
|
+
close(): Error | undefined;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=host-device.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-device.d.ts","sourceRoot":"","sources":["../src/ts/host-device.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,eAAO,MAAM,gBAAgB,0BAA0B,CAAC;AAExD,MAAM,WAAW,UAAU;IACzB,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,8DAA8D;IAC9D,MAAM,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC1D,4EAA4E;IAC5E,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAoC3E,8DAA8D;AAC9D,qBAAa,iBAAiB;IAahB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAZtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,QAAQ,CAAC,WAAW;;;MAGlB;IACF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0C;IACpE,OAAO,CAAC,OAAO,CAAC,CAAa;IAC7B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;gBAEK,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;IAE9D,IAAI,CAAC,MAAM,EAAE,gBAAgB;IA+B7B,MAAM,CAAC,MAAM,EAAE,MAAM;IAMrB,OAAO,CAAC,UAAU;YAIJ,KAAK;IA2BnB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAexB;IAEF,OAAO,CAAC,IAAI;IAMZ,KAAK,IAAI,KAAK,GAAG,SAAS;CAY3B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,68 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { default as EventEmitter } from 'events';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CompilerModuleStats } from './compiler-module-cache.js';
|
|
4
|
+
import { CppCacheLimits, ObjectCacheStats } from './cpp-object-cache.js';
|
|
5
|
+
import { Debugger } from './debugger.js';
|
|
6
|
+
import { HostDeviceOpener } from './host-device.js';
|
|
7
|
+
import { Internals } from './util.js';
|
|
5
8
|
export type Lang = 'c' | 'python' | 'rust';
|
|
6
|
-
|
|
9
|
+
type StdoutMode = 1 | 2;
|
|
10
|
+
export interface CppToolchainIdentity {
|
|
11
|
+
compilerSha256: string;
|
|
12
|
+
sysrootSha256: string;
|
|
13
|
+
exceptionsSha256: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CppArtifacts {
|
|
16
|
+
sources?: string[] | null;
|
|
17
|
+
archives?: string[] | null;
|
|
18
|
+
precompiledHeader?: string | null;
|
|
19
|
+
requiredToolchain?: CppToolchainIdentity | null;
|
|
20
|
+
/** Exact bounded certificate JSON. A supplied document never grants trust. */
|
|
21
|
+
cacheCertificate?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Immutable ownership boundary. Create a new Engine when either identity changes. */
|
|
24
|
+
export interface EngineScope {
|
|
25
|
+
projectId: string;
|
|
26
|
+
accountId: string;
|
|
27
|
+
}
|
|
28
|
+
export interface CppPerformanceOptions {
|
|
29
|
+
scope: EngineScope;
|
|
30
|
+
objectCache?: boolean | Partial<CppCacheLimits>;
|
|
31
|
+
retainWorker?: boolean;
|
|
32
|
+
cacheCompilerModule?: boolean;
|
|
33
|
+
/** Idle worker lifetime; defaults to 30 seconds, at most five minutes. */
|
|
34
|
+
idleTimeoutMs?: number;
|
|
35
|
+
compilerLifetime?: 'idle' | 'project';
|
|
36
|
+
toolchainProfile?: 'legacy' | 'stock-certified-v1';
|
|
37
|
+
}
|
|
38
|
+
export interface EngineOptions {
|
|
39
|
+
cpp?: CppPerformanceOptions;
|
|
40
|
+
/**
|
|
41
|
+
* Where to load this package's `dist/engine_bg.wasm` from, for hosts that serve it
|
|
42
|
+
* themselves. Relative URLs resolve against the page. It must be the file from this
|
|
43
|
+
* exact package version. Defaults to the URL built into the package (jsDelivr for npm
|
|
44
|
+
* releases). A page loads the engine Wasm once, so every `create` must agree.
|
|
45
|
+
*/
|
|
46
|
+
wasmUrl?: string | URL;
|
|
47
|
+
}
|
|
48
|
+
export interface CompilerPreparationOptions {
|
|
49
|
+
/** Inspect an owned candidate snapshot for known cache exclusions, without Clang. */
|
|
50
|
+
validateCacheInputs?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export type { CppCacheLimits, ObjectCacheStats } from './cpp-object-cache.js';
|
|
7
53
|
export type Timing = {
|
|
8
|
-
/** Host time including worker startup and teardown. */
|
|
9
54
|
totalMs: number;
|
|
10
|
-
/** Worker time fetching, compiling, and linking before execution. */
|
|
11
55
|
buildMs: number;
|
|
12
|
-
/** Worker time for the user program execution step only. */
|
|
13
56
|
runMs: number;
|
|
14
57
|
};
|
|
15
|
-
/** The engine ran to completion with the provided `exitCode`. */
|
|
16
58
|
export type CompletedResult = {
|
|
17
59
|
type: 'completed';
|
|
18
60
|
exitCode: number;
|
|
19
61
|
timing: Timing;
|
|
20
62
|
};
|
|
21
|
-
/** The engine was stopped by calling `stop`. */
|
|
22
63
|
export type StoppedResult = {
|
|
23
64
|
type: 'stopped';
|
|
24
65
|
};
|
|
25
|
-
/** The engine had an error. This is an error with the engine itself, and not the user's code. */
|
|
26
66
|
export type ErrorResult = {
|
|
27
67
|
type: 'error';
|
|
28
68
|
error: {
|
|
@@ -30,53 +70,147 @@ export type ErrorResult = {
|
|
|
30
70
|
message: string;
|
|
31
71
|
};
|
|
32
72
|
};
|
|
33
|
-
/** The result of calling {@link Engine.run} */
|
|
34
73
|
export type RunResult = CompletedResult | StoppedResult | ErrorResult;
|
|
35
74
|
export type FsNode = string | DirNode;
|
|
36
75
|
export type DirNode = {
|
|
37
76
|
[name: string]: FsNode;
|
|
38
77
|
};
|
|
78
|
+
/** Bounded, source-free compilation measurements from one worker job. */
|
|
79
|
+
export interface CppTranslationUnitStatistics {
|
|
80
|
+
hits: number;
|
|
81
|
+
misses: number;
|
|
82
|
+
/** Actual compiler/linker step dispatches; absent in older engine reports. */
|
|
83
|
+
clang_invocations?: number;
|
|
84
|
+
link_invocations?: number;
|
|
85
|
+
bypasses: Array<{
|
|
86
|
+
source: string;
|
|
87
|
+
reason: string;
|
|
88
|
+
}>;
|
|
89
|
+
hit_sources: string[];
|
|
90
|
+
invalid_sources: string[];
|
|
91
|
+
hash_ms: number;
|
|
92
|
+
lookup_ms: number;
|
|
93
|
+
compile_ms: number;
|
|
94
|
+
link_ms: number;
|
|
95
|
+
}
|
|
96
|
+
export interface CppJobStatistics {
|
|
97
|
+
operation: 'prepare_compiler' | 'compile' | 'run';
|
|
98
|
+
workerReadyMs: number;
|
|
99
|
+
workerReused: boolean;
|
|
100
|
+
cache?: CppTranslationUnitStatistics;
|
|
101
|
+
compilerModule?: CompilerModuleStats;
|
|
102
|
+
}
|
|
103
|
+
export interface CppCacheStatistics extends ObjectCacheStats {
|
|
104
|
+
generation: number;
|
|
105
|
+
scopeEpoch: number;
|
|
106
|
+
operationId: number;
|
|
107
|
+
cacheEpoch: number;
|
|
108
|
+
toolchainProfile: 'legacy' | 'stock-certified-v1';
|
|
109
|
+
/** Exact registered certificate verified for this operation, including input bypasses. */
|
|
110
|
+
stockCertificateSha256?: string;
|
|
111
|
+
/** Last validated owned snapshot, never authority for a later mutable plan.
|
|
112
|
+
* Preparation means no known exclusion; an ordinary miss still validates its
|
|
113
|
+
* complete observed inputs and diagnostics. Compile/Run means every selected
|
|
114
|
+
* TU was admitted or hit. Cleared when a new operation starts.
|
|
115
|
+
*/
|
|
116
|
+
cacheEligible: boolean;
|
|
117
|
+
cacheEligibilityReason?: string;
|
|
118
|
+
cacheEligibilitySnapshot?: string;
|
|
119
|
+
cacheEligibilityOperationId?: number;
|
|
120
|
+
toolchainIdentityBytes: number;
|
|
121
|
+
toolchainIngestions: number;
|
|
122
|
+
toolchainHashCount: number;
|
|
123
|
+
toolchainHashMs: number;
|
|
124
|
+
compilerModuleCloned: boolean;
|
|
125
|
+
workerRetained: boolean;
|
|
126
|
+
workerRetirements: number;
|
|
127
|
+
compilerModuleIdentityBytes: number;
|
|
128
|
+
latest?: CppJobStatistics;
|
|
129
|
+
}
|
|
130
|
+
interface OperationIdentity {
|
|
131
|
+
scopeEpoch: number;
|
|
132
|
+
operationId: number;
|
|
133
|
+
cacheEpoch: number;
|
|
134
|
+
}
|
|
39
135
|
export declare class Engine {
|
|
40
136
|
readonly stdout: Stdout;
|
|
41
137
|
readonly stderr: Stdout;
|
|
42
138
|
readonly stdin: Stdin;
|
|
43
139
|
readonly debugger: Debugger;
|
|
44
|
-
/** A function which, when called, rejects the ongoing execution */
|
|
45
|
-
private rejector?;
|
|
46
|
-
/** The ongoing `run` promise, if any */
|
|
47
|
-
private promise?;
|
|
48
|
-
/**
|
|
49
|
-
* The programming language of this engine.
|
|
50
|
-
*/
|
|
51
140
|
readonly lang: Lang;
|
|
52
|
-
|
|
53
|
-
* The *initial* filesystem that the code sees.
|
|
54
|
-
*
|
|
55
|
-
* This is neither updated while the code is running, nor
|
|
56
|
-
* will updating it have any effect on code that is already running.
|
|
57
|
-
*/
|
|
141
|
+
readonly scope?: Readonly<EngineScope>;
|
|
58
142
|
fs: DirNode;
|
|
59
|
-
|
|
143
|
+
binaryFiles: Record<string, Uint8Array>;
|
|
144
|
+
cppArtifacts?: CppArtifacts;
|
|
145
|
+
hostDevice?: HostDeviceOpener;
|
|
146
|
+
private readonly options?;
|
|
147
|
+
/** Absolute `EngineOptions.wasmUrl`, handed to each worker; unset uses the default. */
|
|
148
|
+
private wasmUrl?;
|
|
149
|
+
private readonly objects;
|
|
150
|
+
private generation;
|
|
151
|
+
private scopeEpoch;
|
|
152
|
+
private operationId;
|
|
153
|
+
private disposed;
|
|
154
|
+
private active?;
|
|
155
|
+
private promise?;
|
|
156
|
+
private slot?;
|
|
157
|
+
private idleTimer?;
|
|
158
|
+
private toolchain?;
|
|
159
|
+
private toolchainLoading?;
|
|
160
|
+
private toolchainController?;
|
|
161
|
+
private initializing;
|
|
162
|
+
private toolchainIdentity?;
|
|
163
|
+
private toolchainIngestions;
|
|
164
|
+
private toolchainHashCount;
|
|
165
|
+
private toolchainHashMs;
|
|
166
|
+
private compilerModuleCloned;
|
|
167
|
+
private disposal?;
|
|
168
|
+
private cancellationDraining?;
|
|
169
|
+
private releaseDrain?;
|
|
170
|
+
private releases;
|
|
171
|
+
private retirements;
|
|
172
|
+
private latest?;
|
|
173
|
+
private cacheValidation?;
|
|
174
|
+
static create(lang: Lang, options?: EngineOptions): Promise<Engine>;
|
|
60
175
|
private constructor();
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
176
|
+
get cacheStats(): CppCacheStatistics;
|
|
177
|
+
/** Clears all retained code/objects. An active job may finish but cannot repopulate them. */
|
|
178
|
+
clearCaches(): void;
|
|
179
|
+
/** Stops synchronously, drops retained resources, and resolves after job cleanup. */
|
|
180
|
+
stop(): Promise<void>;
|
|
181
|
+
/** Cancels execution without discarding committed immutable compiler resources. */
|
|
182
|
+
cancelCurrentOperation(): Promise<void>;
|
|
183
|
+
/** Release idle compiler resources, or defer behind an active guest without stopping it. */
|
|
184
|
+
releaseCompilerResources(options?: {
|
|
185
|
+
signal?: AbortSignal;
|
|
186
|
+
}): Promise<'released' | 'cancelled'>;
|
|
187
|
+
private settleRelease;
|
|
188
|
+
private flushReleases;
|
|
189
|
+
/** Permanent synchronous fence and idempotent cleanup barrier. */
|
|
190
|
+
dispose(): Promise<void>;
|
|
191
|
+
/** Load compiler resources. Optional input validation never invokes Clang, links, or runs a guest. */
|
|
192
|
+
prepareCompiler(options?: CompilerPreparationOptions): Promise<RunResult>;
|
|
193
|
+
/** Every Run links current objects and starts a fresh student runtime. */
|
|
70
194
|
run(): Promise<RunResult>;
|
|
71
|
-
|
|
195
|
+
/** Compiles Run-profile C++ translation units only; never links, runs, or opens devices. */
|
|
196
|
+
compile(): Promise<RunResult>;
|
|
197
|
+
private submit;
|
|
198
|
+
private current;
|
|
199
|
+
private makeWorker;
|
|
200
|
+
private publishObjects;
|
|
201
|
+
private ensureToolchain;
|
|
202
|
+
private dispatch;
|
|
203
|
+
private finish;
|
|
204
|
+
private retireWorker;
|
|
72
205
|
}
|
|
73
206
|
export declare class Stdout extends EventEmitter<{
|
|
74
207
|
data: [Uint8Array];
|
|
75
208
|
}> {
|
|
76
209
|
private readonly mode;
|
|
77
210
|
private readonly callback;
|
|
211
|
+
private accepts?;
|
|
78
212
|
[Internals]: {
|
|
79
|
-
attach(worker: Worker): void;
|
|
213
|
+
attach(worker: Worker, accepts?: (message: Partial<OperationIdentity>) => boolean): void;
|
|
80
214
|
detach(worker: Worker): void;
|
|
81
215
|
};
|
|
82
216
|
constructor(mode: StdoutMode);
|
|
@@ -96,9 +230,10 @@ export declare class Stdin {
|
|
|
96
230
|
private static readonly READ_IDX;
|
|
97
231
|
private static readonly WRITE_IDX;
|
|
98
232
|
private static encoder;
|
|
99
|
-
private
|
|
100
|
-
private
|
|
101
|
-
private
|
|
233
|
+
private buffer;
|
|
234
|
+
private generation;
|
|
235
|
+
private indices;
|
|
236
|
+
private data;
|
|
102
237
|
[Internals]: {
|
|
103
238
|
clear(): void;
|
|
104
239
|
buffer: SharedArrayBuffer;
|
|
@@ -108,5 +243,7 @@ export declare class Stdin {
|
|
|
108
243
|
write(value: Uint8Array | string): Promise<void>;
|
|
109
244
|
private writeBytes;
|
|
110
245
|
}
|
|
111
|
-
export * from './debugger';
|
|
246
|
+
export * from './debugger.js';
|
|
247
|
+
export { HOST_DEVICE_PATH } from './host-device.js';
|
|
248
|
+
export type { HostDevice, HostDeviceOpener } from './host-device.js';
|
|
112
249
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAKlC,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAkB,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAA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C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Build-fixed legacy identities, verified against the shipping @yowasp/clang artifact.
|
|
2
|
+
*/
|
|
3
|
+
export declare const LEGACY_TOOLCHAIN_DIGESTS: Readonly<{
|
|
4
|
+
compiler: "24fbed474c7b5b4968fd73fc4827440b93fb351c1b6264516130300eff3e7bf5";
|
|
5
|
+
sysroot: "8745c6af23fd841fa507d0c73f6b6b8e8da1b4ec216a6339739a28b38ff7227b";
|
|
6
|
+
exceptions: "20986166552953de0e3ca5c1e9f341e7aec8b9ba54dcb244d0d2b2f9ca843ab4";
|
|
7
|
+
}>;
|
|
8
|
+
export interface ToolchainManifest {
|
|
9
|
+
readonly profile: 'legacy' | 'stock-certified-v1';
|
|
10
|
+
readonly digests: Readonly<Record<keyof typeof LEGACY_TOOLCHAIN_DIGESTS, string>>;
|
|
11
|
+
}
|
|
12
|
+
export declare function requireToolchainManifest(profile?: string): ToolchainManifest;
|
|
13
|
+
//# sourceMappingURL=toolchain-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolchain-manifest.d.ts","sourceRoot":"","sources":["../src/ts/toolchain-manifest.ts"],"names":[],"mappings":"AAEA;GACG;AACH,eAAO,MAAM,wBAAwB;;;;EAInC,CAAC;AAEH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,oBAAoB,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,OAAO,wBAAwB,EAAE,MAAM,CAAC,CAAC,CAAC;CACnF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,SAAW,GAAG,iBAAiB,CAK9E"}
|
package/dist/util.d.ts
CHANGED
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/ts/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/ts/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,OAAO,MAAiB,CAAC;AAEjD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAWnD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Engine-private immutable toolchain ownership. Seeds never cross the public API. */
|
|
2
|
+
export interface ToolchainSeed {
|
|
3
|
+
compiler: Uint8Array;
|
|
4
|
+
sysroot: Uint8Array;
|
|
5
|
+
compilerHash: string;
|
|
6
|
+
sysrootHash: string;
|
|
7
|
+
exceptionsHash: string;
|
|
8
|
+
stockProfile?: boolean;
|
|
9
|
+
module?: WebAssembly.Module;
|
|
10
|
+
}
|
|
11
|
+
export declare class VerifiedToolchain {
|
|
12
|
+
#private;
|
|
13
|
+
readonly hashCount = 3;
|
|
14
|
+
readonly hashMs: number;
|
|
15
|
+
private constructor();
|
|
16
|
+
static load(urls: readonly string[], cacheModule: boolean, signal?: AbortSignal, exceptionsHash?: string, profile?: string): Promise<VerifiedToolchain>;
|
|
17
|
+
/** Captures even Buffer/subclass inputs before the first asynchronous boundary. */
|
|
18
|
+
static fromBytes(compilerInput: Uint8Array, sysrootInput: Uint8Array, cacheModule: boolean): Promise<VerifiedToolchain>;
|
|
19
|
+
private static ingestOwned;
|
|
20
|
+
matchesExpectation(expected: {
|
|
21
|
+
compilerSha256: string;
|
|
22
|
+
sysrootSha256: string;
|
|
23
|
+
exceptionsSha256: string;
|
|
24
|
+
}): boolean;
|
|
25
|
+
get identity(): string;
|
|
26
|
+
get identityBytes(): number;
|
|
27
|
+
get compilerBytes(): number;
|
|
28
|
+
/** postMessage clones the private seed; never transfer/detach the restart owner. */
|
|
29
|
+
configure(worker: Worker, envelope: object): boolean;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=verified-toolchain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verified-toolchain.d.ts","sourceRoot":"","sources":["../src/ts/verified-toolchain.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,UAAU,CAAC;IACrB,OAAO,EAAE,UAAU,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;CAC7B;AAED,qBAAa,iBAAiB;;IAE5B,QAAQ,CAAC,SAAS,KAAK;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,OAAO;WAKM,IAAI,CACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE,WAAW,EACpB,cAAc,GAAE,MAA4C,EAC5D,OAAO,SAAW,GACjB,OAAO,CAAC,iBAAiB,CAAC;IA2C7B,mFAAmF;WACtE,SAAS,CACpB,aAAa,EAAE,UAAU,EACzB,YAAY,EAAE,UAAU,EACxB,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,iBAAiB,CAAC;mBAWR,WAAW;IAkBhC,kBAAkB,CAAC,QAAQ,EAAE;QAC3B,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;QACtB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,GAAG,OAAO;IAQX,IAAI,QAAQ,IAAI,MAAM,CAErB;IACD,IAAI,aAAa,IAAI,MAAM,CAE1B;IACD,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,oFAAoF;IACpF,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;CAWrD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the engine's own `engine_bg.wasm` comes from when the host overrides the
|
|
3
|
+
* build-time default (`EngineOptions.wasmUrl`).
|
|
4
|
+
*
|
|
5
|
+
* Workers load the Wasm as soon as they start, before any message could reach them, so
|
|
6
|
+
* the URL travels in `WorkerOptions.name` behind this prefix.
|
|
7
|
+
*/
|
|
8
|
+
export declare const WASM_WORKER_NAME_PREFIX = "glassjar-wasm:";
|
|
9
|
+
/** Resolve to an absolute http(s) URL, or throw. */
|
|
10
|
+
export declare function resolveWasmUrl(value: string | URL, base?: string): string;
|
|
11
|
+
//# sourceMappingURL=wasm-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-source.d.ts","sourceRoot":"","sources":["../src/ts/wasm-source.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,oDAAoD;AACpD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glassjar",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "A browser-based execution engine and debugger powered by WebAssembly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wasm",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
-
"dist"
|
|
29
|
+
"dist",
|
|
30
|
+
"assets/cpp-exceptions/runtime.tar.gz"
|
|
30
31
|
],
|
|
31
32
|
"scripts": {
|
|
32
33
|
"build:rs": "wasm-pack build --target web",
|
|
@@ -47,9 +48,11 @@
|
|
|
47
48
|
"prettier --write"
|
|
48
49
|
]
|
|
49
50
|
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@types/node": "22.13.1"
|
|
53
|
+
},
|
|
50
54
|
"devDependencies": {
|
|
51
55
|
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
|
|
52
|
-
"@types/node": "^22.13.1",
|
|
53
56
|
"eslint": "^9.39.2",
|
|
54
57
|
"events": "^3.3.0",
|
|
55
58
|
"husky": "^9.1.7",
|