@julclang/julc-vm-wasm 0.0.0-stage → 0.1.0-pre21

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.
@@ -0,0 +1 @@
1
+ {"type": "commonjs"}
package/engine.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ // Generated at build time (ADR-077 D2): the engine files of @julclang/julc-vm-wasm 0.1.0-pre21.
2
+ import type {FeatureGroup, Manifest} from '@julclang/wasm-client';
3
+
4
+ /** engine/engine.json, inlined and frozen, groups included. */
5
+ export declare const manifest: Readonly<Omit<Manifest, 'groups'>> & {readonly groups?: readonly FeatureGroup[]};
6
+ /** The launcher, engine/julc-vm-90278477499e.js. */
7
+ export declare const launcherUrl: URL;
8
+ /** The WebAssembly module, engine/julc-vm-90278477499e.js.wasm. */
9
+ export declare const moduleUrl: URL;
10
+ /** The JuLC release of this package, its engine and the client it needs. */
11
+ export declare const version: "0.1.0-pre21";
12
+ /** New objects describing the engine on every call; createJulc's package mode takes them as they are. */
13
+ export declare function engineFiles(): {manifest: Manifest; launcherUrl: URL; moduleUrl: URL; version: "0.1.0-pre21"};
package/engine.js ADDED
@@ -0,0 +1,20 @@
1
+ // Generated at build time from engine/engine.json (ADR-077 D2): the engine files of @julclang/julc-vm-wasm 0.1.0-pre21.
2
+ // Each is named by a string literal, so bundlers copy it and it resolves beside this module.
3
+ const freeze = value => {
4
+ for (const member of Object.values(value)) if (typeof member === 'object' && member !== null) freeze(member);
5
+ return Object.freeze(value);
6
+ };
7
+ export const manifest = freeze({"version":"90278477499e","launcher":"julc-vm-90278477499e.js","variant":"vm","api":0,"groups":["vm","debug"],"julcVersion":"0.1.0-pre21"});
8
+ export const launcherUrl = new URL('./engine/julc-vm-90278477499e.js', import.meta.url);
9
+ export const moduleUrl = new URL('./engine/julc-vm-90278477499e.js.wasm', import.meta.url);
10
+ export const version = "0.1.0-pre21";
11
+
12
+ /** New objects describing the engine on every call, independent of the exports above. */
13
+ export function engineFiles() {
14
+ return {
15
+ manifest: {"version":"90278477499e","launcher":"julc-vm-90278477499e.js","variant":"vm","api":0,"groups":["vm","debug"],"julcVersion":"0.1.0-pre21"},
16
+ launcherUrl: new URL('./engine/julc-vm-90278477499e.js', import.meta.url),
17
+ moduleUrl: new URL('./engine/julc-vm-90278477499e.js.wasm', import.meta.url),
18
+ version: "0.1.0-pre21",
19
+ };
20
+ }
package/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ // @julclang/julc-vm-wasm (ADR-077 D2, D5): createJulcVm, and the types of @julclang/wasm-client, which this package
2
+ // depends on at its own exact version.
3
+ import type {PackageOptions, VmPackageClient} from '@julclang/wasm-client';
4
+
5
+ export type * from '@julclang/wasm-client';
6
+
7
+ /** What the caller may set: the engine's files, manifest and version are this package's (engine.js). */
8
+ export type EngineOptions = Omit<PackageOptions, 'launcherUrl' | 'moduleUrl' | 'manifest' | 'expectedVersion' | 'rest'
9
+ | 'baseUrl'>;
10
+
11
+ /** Create a client of JuLC's VM engine, running in its own worker; dispose() ends it. */
12
+ export function createJulcVm(options?: EngineOptions): Promise<VmPackageClient>;
package/index.js ADDED
@@ -0,0 +1,21 @@
1
+ // @julclang/julc-vm-wasm (ADR-077 D2): JuLC's VM engine, loaded by @julclang/wasm-client in package mode from the
2
+ // files engine.js names. In Node.js, @julclang/wasm-client resolves to its Node.js bridge.
3
+ import {createJulc} from '@julclang/wasm-client';
4
+ import {engineFiles} from './engine.js';
5
+
6
+ // This package names its engine: the caller never chooses the files, the manifest or the version they must match.
7
+ const OWN = ['baseUrl', 'launcherUrl', 'moduleUrl', 'manifest', 'expectedVersion'];
8
+
9
+ /** Create a client of JuLC's VM engine, running in its own worker; dispose() ends it. */
10
+ export async function createJulcVm(options) {
11
+ options ??= {};
12
+ for (const name of OWN) {
13
+ if (options[name] !== undefined) throw new Error(`createJulcVm() loads this package's engine: remove ${name}`);
14
+ }
15
+ if (options.rest !== undefined && options.rest !== false) {
16
+ throw new Error('The REST adapter is not available in package mode: remove rest');
17
+ }
18
+ // Fresh objects for each client: nothing a caller does to engine.js's exports reaches them.
19
+ const {manifest, launcherUrl, moduleUrl, version} = engineFiles();
20
+ return createJulc({...options, launcherUrl, moduleUrl, manifest, expectedVersion: version, rest: false});
21
+ }
package/node.js ADDED
@@ -0,0 +1,4 @@
1
+ // @julclang/julc-vm-wasm in Node.js (ADR-077 D3). The engine is the same: index.js imports @julclang/wasm-client, which
2
+ // Node.js and server bundlers resolve to the client's Node.js bridge (its "node" condition), so each client runs the
3
+ // engine in its own worker_threads worker. The caller passes no flags.
4
+ export {createJulcVm} from './index.js';
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
- "name": "@julclang/julc-vm-wasm",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@julclang/julc-vm-wasm",
3
+ "version": "0.1.0-pre21",
4
+ "description": "JuLC's Plutus VM as WebAssembly, for browsers and Node.js: decode, hash, apply parameters to, evaluate and debug Plutus V1, V2 and V3 scripts. Experimental: API version 0.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/bloxbean/julc.git",
9
+ "directory": "julc-wasm"
10
+ },
11
+ "homepage": "https://github.com/bloxbean/julc/tree/main/julc-wasm",
12
+ "type": "module",
13
+ "types": "./index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./index.d.ts",
17
+ "node": "./node.js",
18
+ "default": "./index.js"
19
+ },
20
+ "./engine": {
21
+ "types": "./engine.d.ts",
22
+ "default": "./engine.js"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
26
+ "sideEffects": [
27
+ "./engine/*.js"
28
+ ],
29
+ "engines": {
30
+ "node": ">=22.3.0"
31
+ },
32
+ "dependencies": {
33
+ "@julclang/wasm-client": "0.1.0-pre21"
34
+ },
35
+ "files": [
36
+ "LICENSE",
37
+ "README.md",
38
+ "engine/",
39
+ "engine.d.ts",
40
+ "engine.js",
41
+ "index.d.ts",
42
+ "index.js",
43
+ "node.js"
44
+ ]
45
+ }