@bytecodealliance/jco
Advanced tools
Comparing version 0.11.0 to 0.11.1
export namespace WasiCliTerminalInput { | ||
export function dropTerminalInput(this: TerminalInput): void; | ||
export function dropTerminalInput(this_: TerminalInput): void; | ||
} | ||
export type TerminalInput = number; |
export namespace WasiCliTerminalOutput { | ||
export function dropTerminalOutput(this: TerminalOutput): void; | ||
export function dropTerminalOutput(this_: TerminalOutput): void; | ||
} | ||
export type TerminalOutput = number; |
export namespace WasiFilesystemTypes { | ||
export function readViaStream(this: Descriptor, offset: Filesize): InputStream; | ||
export function writeViaStream(this: Descriptor, offset: Filesize): OutputStream; | ||
export function appendViaStream(this: Descriptor): OutputStream; | ||
export function getType(this: Descriptor): DescriptorType; | ||
export function stat(this: Descriptor): DescriptorStat; | ||
export function openAt(this: Descriptor, pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags, modes: Modes): Descriptor; | ||
export function dropDescriptor(this: Descriptor): void; | ||
export function dropDirectoryEntryStream(this: DirectoryEntryStream): void; | ||
export function metadataHash(this: Descriptor): MetadataHashValue; | ||
export function readViaStream(this_: Descriptor, offset: Filesize): InputStream; | ||
export function writeViaStream(this_: Descriptor, offset: Filesize): OutputStream; | ||
export function appendViaStream(this_: Descriptor): OutputStream; | ||
export function getType(this_: Descriptor): DescriptorType; | ||
export function stat(this_: Descriptor): DescriptorStat; | ||
export function openAt(this_: Descriptor, pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags, modes: Modes): Descriptor; | ||
export function dropDescriptor(this_: Descriptor): void; | ||
export function dropDirectoryEntryStream(this_: DirectoryEntryStream): void; | ||
export function metadataHash(this_: Descriptor): MetadataHashValue; | ||
} | ||
@@ -12,0 +12,0 @@ export type Descriptor = number; |
export namespace WasiIoStreams { | ||
export function read(this: InputStream, len: bigint): [Uint8Array, StreamStatus]; | ||
export function blockingRead(this: InputStream, len: bigint): [Uint8Array, StreamStatus]; | ||
export function dropInputStream(this: InputStream): void; | ||
export function write(this: OutputStream, buf: Uint8Array | ArrayBuffer): [bigint, StreamStatus]; | ||
export function blockingWrite(this: OutputStream, buf: Uint8Array | ArrayBuffer): [bigint, StreamStatus]; | ||
export function dropOutputStream(this: OutputStream): void; | ||
export function read(this_: InputStream, len: bigint): [Uint8Array, StreamStatus]; | ||
export function blockingRead(this_: InputStream, len: bigint): [Uint8Array, StreamStatus]; | ||
export function dropInputStream(this_: InputStream): void; | ||
export function write(this_: OutputStream, buf: Uint8Array | ArrayBuffer): [bigint, StreamStatus]; | ||
export function blockingWrite(this_: OutputStream, buf: Uint8Array | ArrayBuffer): [bigint, StreamStatus]; | ||
export function dropOutputStream(this_: OutputStream): void; | ||
} | ||
@@ -9,0 +9,0 @@ export type InputStream = number; |
@@ -1,3 +0,3 @@ | ||
export namespace WasiCliEnvironment1 { | ||
export namespace WasiCliEnvironment { | ||
export function getEnvironment(): [string, string][]; | ||
} |
@@ -1,4 +0,4 @@ | ||
export namespace WasiCliExit1 { | ||
export namespace WasiCliExit { | ||
export function exit(status: Result<void, void>): void; | ||
} | ||
export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E }; |
@@ -1,2 +0,2 @@ | ||
export namespace WasiCliStderr1 { | ||
export namespace WasiCliStderr { | ||
export function getStderr(): OutputStream; | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export namespace WasiCliStdin1 { | ||
export namespace WasiCliStdin { | ||
export function getStdin(): InputStream; | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export namespace WasiCliStdout1 { | ||
export namespace WasiCliStdout { | ||
export function getStdout(): OutputStream; | ||
@@ -3,0 +3,0 @@ } |
@@ -1,4 +0,4 @@ | ||
export namespace WasiCliTerminalInput1 { | ||
export function dropTerminalInput(this: TerminalInput): void; | ||
export namespace WasiCliTerminalInput { | ||
export function dropTerminalInput(this_: TerminalInput): void; | ||
} | ||
export type TerminalInput = number; |
@@ -1,4 +0,4 @@ | ||
export namespace WasiCliTerminalOutput1 { | ||
export function dropTerminalOutput(this: TerminalOutput): void; | ||
export namespace WasiCliTerminalOutput { | ||
export function dropTerminalOutput(this_: TerminalOutput): void; | ||
} | ||
export type TerminalOutput = number; |
@@ -1,2 +0,2 @@ | ||
export namespace WasiCliTerminalStderr1 { | ||
export namespace WasiCliTerminalStderr { | ||
export function getTerminalStderr(): TerminalOutput | null; | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export namespace WasiCliTerminalStdin1 { | ||
export namespace WasiCliTerminalStdin { | ||
export function getTerminalStdin(): TerminalInput | null; | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export namespace WasiCliTerminalStdout1 { | ||
export namespace WasiCliTerminalStdout { | ||
export function getTerminalStdout(): TerminalOutput | null; | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export namespace WasiClocksWallClock1 { | ||
export namespace WasiClocksWallClock { | ||
} | ||
@@ -3,0 +3,0 @@ export interface Datetime { |
@@ -1,2 +0,2 @@ | ||
export namespace WasiFilesystemPreopens1 { | ||
export namespace WasiFilesystemPreopens { | ||
export function getDirectories(): [Descriptor, string][]; | ||
@@ -3,0 +3,0 @@ } |
@@ -1,11 +0,11 @@ | ||
export namespace WasiFilesystemTypes1 { | ||
export function readViaStream(this: Descriptor, offset: Filesize): InputStream; | ||
export function writeViaStream(this: Descriptor, offset: Filesize): OutputStream; | ||
export function appendViaStream(this: Descriptor): OutputStream; | ||
export function getType(this: Descriptor): DescriptorType; | ||
export function stat(this: Descriptor): DescriptorStat; | ||
export function openAt(this: Descriptor, pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags, modes: Modes): Descriptor; | ||
export function dropDescriptor(this: Descriptor): void; | ||
export function dropDirectoryEntryStream(this: DirectoryEntryStream): void; | ||
export function metadataHash(this: Descriptor): MetadataHashValue; | ||
export namespace WasiFilesystemTypes { | ||
export function readViaStream(this_: Descriptor, offset: Filesize): InputStream; | ||
export function writeViaStream(this_: Descriptor, offset: Filesize): OutputStream; | ||
export function appendViaStream(this_: Descriptor): OutputStream; | ||
export function getType(this_: Descriptor): DescriptorType; | ||
export function stat(this_: Descriptor): DescriptorStat; | ||
export function openAt(this_: Descriptor, pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags, modes: Modes): Descriptor; | ||
export function dropDescriptor(this_: Descriptor): void; | ||
export function dropDirectoryEntryStream(this_: DirectoryEntryStream): void; | ||
export function metadataHash(this_: Descriptor): MetadataHashValue; | ||
} | ||
@@ -12,0 +12,0 @@ export type Descriptor = number; |
@@ -1,8 +0,8 @@ | ||
export namespace WasiIoStreams1 { | ||
export function read(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, StreamStatus]; | ||
export function blockingRead(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, StreamStatus]; | ||
export function dropInputStream(this: InputStream): void; | ||
export function write(this: OutputStream, buf: Uint8Array): [bigint, StreamStatus]; | ||
export function blockingWrite(this: OutputStream, buf: Uint8Array): [bigint, StreamStatus]; | ||
export function dropOutputStream(this: OutputStream): void; | ||
export namespace WasiIoStreams { | ||
export function read(this_: InputStream, len: bigint): [Uint8Array | ArrayBuffer, StreamStatus]; | ||
export function blockingRead(this_: InputStream, len: bigint): [Uint8Array | ArrayBuffer, StreamStatus]; | ||
export function dropInputStream(this_: InputStream): void; | ||
export function write(this_: OutputStream, buf: Uint8Array): [bigint, StreamStatus]; | ||
export function blockingWrite(this_: OutputStream, buf: Uint8Array): [bigint, StreamStatus]; | ||
export function dropOutputStream(this_: OutputStream): void; | ||
} | ||
@@ -9,0 +9,0 @@ export type InputStream = number; |
@@ -1,3 +0,3 @@ | ||
export namespace WasiRandomRandom1 { | ||
export namespace WasiRandomRandom { | ||
export function getRandomBytes(len: bigint): Uint8Array | ArrayBuffer; | ||
} |
@@ -47,17 +47,17 @@ export type Files = [string, Uint8Array][]; | ||
} | ||
import { WasiCliEnvironment1 } from './imports/wasi-cli-environment'; | ||
import { WasiCliExit1 } from './imports/wasi-cli-exit'; | ||
import { WasiCliStderr1 } from './imports/wasi-cli-stderr'; | ||
import { WasiCliStdin1 } from './imports/wasi-cli-stdin'; | ||
import { WasiCliStdout1 } from './imports/wasi-cli-stdout'; | ||
import { WasiCliTerminalInput1 } from './imports/wasi-cli-terminal-input'; | ||
import { WasiCliTerminalOutput1 } from './imports/wasi-cli-terminal-output'; | ||
import { WasiCliTerminalStderr1 } from './imports/wasi-cli-terminal-stderr'; | ||
import { WasiCliTerminalStdin1 } from './imports/wasi-cli-terminal-stdin'; | ||
import { WasiCliTerminalStdout1 } from './imports/wasi-cli-terminal-stdout'; | ||
import { WasiClocksWallClock1 } from './imports/wasi-clocks-wall-clock'; | ||
import { WasiFilesystemPreopens1 } from './imports/wasi-filesystem-preopens'; | ||
import { WasiFilesystemTypes1 } from './imports/wasi-filesystem-types'; | ||
import { WasiIoStreams1 } from './imports/wasi-io-streams'; | ||
import { WasiRandomRandom1 } from './imports/wasi-random-random'; | ||
import { WasiCliEnvironment } from './imports/wasi-cli-environment'; | ||
import { WasiCliExit } from './imports/wasi-cli-exit'; | ||
import { WasiCliStderr } from './imports/wasi-cli-stderr'; | ||
import { WasiCliStdin } from './imports/wasi-cli-stdin'; | ||
import { WasiCliStdout } from './imports/wasi-cli-stdout'; | ||
import { WasiCliTerminalInput } from './imports/wasi-cli-terminal-input'; | ||
import { WasiCliTerminalOutput } from './imports/wasi-cli-terminal-output'; | ||
import { WasiCliTerminalStderr } from './imports/wasi-cli-terminal-stderr'; | ||
import { WasiCliTerminalStdin } from './imports/wasi-cli-terminal-stdin'; | ||
import { WasiCliTerminalStdout } from './imports/wasi-cli-terminal-stdout'; | ||
import { WasiClocksWallClock } from './imports/wasi-clocks-wall-clock'; | ||
import { WasiFilesystemPreopens } from './imports/wasi-filesystem-preopens'; | ||
import { WasiFilesystemTypes } from './imports/wasi-filesystem-types'; | ||
import { WasiIoStreams } from './imports/wasi-io-streams'; | ||
import { WasiRandomRandom } from './imports/wasi-random-random'; | ||
export function generate(component: Uint8Array | ArrayBuffer, options: GenerateOptions): Transpiled; | ||
@@ -64,0 +64,0 @@ export function generateTypes(name: string, options: TypeGenerationOptions): Files; |
@@ -2245,4 +2245,4 @@ import { environment, exit as exit$1, stderr, stdin, stdout, terminalInput, terminalOutput, terminalStderr, terminalStdin, terminalStdout } from '@bytecodealliance/preview2-shim/cli'; | ||
const module1 = fetchCompile(new URL('./js-component-bindgen-component.core2.wasm', import.meta.url)); | ||
const module2 = base64Compile('AGFzbQEAAAABUgxgAX8AYAN/fn8AYAJ/fwBgCH9/f39/f39/AGACfn8AYAR/f39/AGACf38Bf2AEf39/fwF/YAl/f39/f35+f38Bf2ABfwF/YAN/f38Bf2ABfwADHRwAAQECAgIDAgQAAQEFBQAAAAYHBwgGBgYJBgoLBAUBcAEcHAeOAR0BMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbCCRpbXBvcnRzAQAK9wIcCQAgAEEAEQAACw0AIAAgASACQQERAQALDQAgACABIAJBAhEBAAsLACAAIAFBAxECAAsLACAAIAFBBBECAAsLACAAIAFBBRECAAsXACAAIAEgAiADIAQgBSAGIAdBBhEDAAsLACAAIAFBBxECAAsLACAAIAFBCBEEAAsJACAAQQkRAAALDQAgACABIAJBChEBAAsNACAAIAEgAkELEQEACw8AIAAgASACIANBDBEFAAsPACAAIAEgAiADQQ0RBQALCQAgAEEOEQAACwkAIABBDxEAAAsJACAAQRARAAALCwAgACABQRERBgALDwAgACABIAIgA0ESEQcACw8AIAAgASACIANBExEHAAsZACAAIAEgAiADIAQgBSAGIAcgCEEUEQgACwsAIAAgAUEVEQYACwsAIAAgAUEWEQYACwsAIAAgAUEXEQYACwkAIABBGBEJAAsL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AAjI2AAoAAjI3AAsACCRpbXBvcnRzAXABHBwJIgEAQQALHAABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhsALglwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAYwLjEzLjIAHARuYW1lABUUd2l0LWNvbXBvbmVudDpmaXh1cHM'); | ||
const module2 = base64Compile('AGFzbQEAAAABUgxgAX8AYAN/fn8AYAJ/fwBgCH9/f39/f39/AGACfn8AYAR/f39/AGACf38Bf2AEf39/fwF/YAl/f39/f35+f38Bf2ABfwF/YAN/f38Bf2ABfwADHRwAAQECAgIDAgQAAQEFBQAAAAYHBwgGBgYJBgoLBAUBcAEcHAeOAR0BMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbCCRpbXBvcnRzAQAK9wIcCQAgAEEAEQAACw0AIAAgASACQQERAQALDQAgACABIAJBAhEBAAsLACAAIAFBAxECAAsLACAAIAFBBBECAAsLACAAIAFBBRECAAsXACAAIAEgAiADIAQgBSAGIAdBBhEDAAsLACAAIAFBBxECAAsLACAAIAFBCBEEAAsJACAAQQkRAAALDQAgACABIAJBChEBAAsNACAAIAEgAkELEQEACw8AIAAgASACIANBDBEFAAsPACAAIAEgAiADQQ0RBQALCQAgAEEOEQAACwkAIABBDxEAAAsJACAAQRARAAALCwAgACABQRERBgALDwAgACABIAIgA0ESEQcACw8AIAAgASACIANBExEHAAsZACAAIAEgAiADIAQgBSAGIAcgCEEUEQgACwsAIAAgAUEVEQYACwsAIAAgAUEWEQYACwsAIAAgAUEXEQYACwkAIABBGBEJAAsLACAAIAFBGREGAAsNACAAIAEgAkEaEQoACwkAIABBGxELAAsALglwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNv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9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAYwLjE0LjAAHARuYW1lABUUd2l0LWNvbXBvbmVudDpmaXh1cHM'); | ||
const instanceFlags0 = new WebAssembly.Global({ value: "i32", mutable: true }, 3); | ||
@@ -2249,0 +2249,0 @@ Promise.all([module0, module1, module2, module3]).catch(() => {}); |
@@ -1,58 +0,19 @@ | ||
/** | ||
* # Variants | ||
* | ||
* ## `"utf8"` | ||
* | ||
* ## `"utf16"` | ||
* | ||
* ## `"compact-utf16"` | ||
*/ | ||
export type StringEncoding = 'utf8' | 'utf16' | 'compact-utf16'; | ||
export type ProducersFields = [string, [string, string][]][]; | ||
export interface EmbedOpts { | ||
binary?: Uint8Array, | ||
witSource?: string, | ||
witPath?: string, | ||
stringEncoding?: StringEncoding, | ||
dummy?: boolean, | ||
world?: string, | ||
metadata?: ProducersFields, | ||
} | ||
export type ModuleMetaType = ModuleMetaTypeModule | ModuleMetaTypeComponent; | ||
export interface ModuleMetaTypeModule { | ||
tag: 'module', | ||
} | ||
export interface ModuleMetaTypeComponent { | ||
tag: 'component', | ||
val: number, | ||
} | ||
export interface ModuleMetadata { | ||
name?: string, | ||
metaType: ModuleMetaType, | ||
range: [number, number], | ||
producers: ProducersFields, | ||
} | ||
import { WasiCliEnvironment1 } from './imports/wasi-cli-environment'; | ||
import { WasiCliExit1 } from './imports/wasi-cli-exit'; | ||
import { WasiCliStderr1 } from './imports/wasi-cli-stderr'; | ||
import { WasiCliStdin1 } from './imports/wasi-cli-stdin'; | ||
import { WasiCliStdout1 } from './imports/wasi-cli-stdout'; | ||
import { WasiCliTerminalInput1 } from './imports/wasi-cli-terminal-input'; | ||
import { WasiCliTerminalOutput1 } from './imports/wasi-cli-terminal-output'; | ||
import { WasiCliTerminalStderr1 } from './imports/wasi-cli-terminal-stderr'; | ||
import { WasiCliTerminalStdin1 } from './imports/wasi-cli-terminal-stdin'; | ||
import { WasiCliTerminalStdout1 } from './imports/wasi-cli-terminal-stdout'; | ||
import { WasiClocksWallClock1 } from './imports/wasi-clocks-wall-clock'; | ||
import { WasiFilesystemPreopens1 } from './imports/wasi-filesystem-preopens'; | ||
import { WasiFilesystemTypes1 } from './imports/wasi-filesystem-types'; | ||
import { WasiIoStreams1 } from './imports/wasi-io-streams'; | ||
import { WasiRandomRandom1 } from './imports/wasi-random-random'; | ||
export function parse(wat: string): Uint8Array; | ||
export function print(binary: Uint8Array | ArrayBuffer): string; | ||
export function componentNew(binary: Uint8Array | ArrayBuffer, adapters: [string, Uint8Array | ArrayBuffer][] | null): Uint8Array; | ||
export function componentWit(binary: Uint8Array | ArrayBuffer): string; | ||
export function componentEmbed(embedOpts: EmbedOpts): Uint8Array; | ||
export function metadataShow(binary: Uint8Array | ArrayBuffer): ModuleMetadata[]; | ||
export function metadataAdd(binary: Uint8Array | ArrayBuffer, metadata: ProducersFields): Uint8Array; | ||
import { WasiCliEnvironment } from './imports/wasi-cli-environment'; | ||
import { WasiCliExit } from './imports/wasi-cli-exit'; | ||
import { WasiCliStderr } from './imports/wasi-cli-stderr'; | ||
import { WasiCliStdin } from './imports/wasi-cli-stdin'; | ||
import { WasiCliStdout } from './imports/wasi-cli-stdout'; | ||
import { WasiCliTerminalInput } from './imports/wasi-cli-terminal-input'; | ||
import { WasiCliTerminalOutput } from './imports/wasi-cli-terminal-output'; | ||
import { WasiCliTerminalStderr } from './imports/wasi-cli-terminal-stderr'; | ||
import { WasiCliTerminalStdin } from './imports/wasi-cli-terminal-stdin'; | ||
import { WasiCliTerminalStdout } from './imports/wasi-cli-terminal-stdout'; | ||
import { WasiClocksWallClock } from './imports/wasi-clocks-wall-clock'; | ||
import { WasiFilesystemPreopens } from './imports/wasi-filesystem-preopens'; | ||
import { WasiFilesystemTypes } from './imports/wasi-filesystem-types'; | ||
import { WasiIoStreams } from './imports/wasi-io-streams'; | ||
import { WasiRandomRandom } from './imports/wasi-random-random'; | ||
import { LocalWasmToolsTools } from './exports/local-wasm-tools-tools'; | ||
export const tools: typeof LocalWasmToolsTools; | ||
export const $init: Promise<void>; |
{ | ||
"name": "@bytecodealliance/jco", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"description": "JavaScript tooling for working with WebAssembly Components", | ||
@@ -9,3 +9,6 @@ "author": "Guy Bedford", | ||
}, | ||
"exports": "./src/api.js", | ||
"exports": { | ||
"browser": "./src/browser.js", | ||
"default": "./src/api.js" | ||
}, | ||
"imports": { | ||
@@ -19,3 +22,3 @@ "#ora": { | ||
"dependencies": { | ||
"@bytecodealliance/preview2-shim": "0.0.13", | ||
"@bytecodealliance/preview2-shim": "0.0.14", | ||
"binaryen": "^111.0.0", | ||
@@ -29,3 +32,3 @@ "chalk-template": "^0.4.0", | ||
"devDependencies": { | ||
"@bytecodealliance/componentize-js": "^0.1.1", | ||
"@bytecodealliance/componentize-js": "^0.2.0", | ||
"@types/node": "^18.11.17", | ||
@@ -32,0 +35,0 @@ "@typescript-eslint/eslint-plugin": "^5.41.0", |
@@ -57,2 +57,3 @@ <div align="center"> | ||
transpile [options] <component-path> Transpile a WebAssembly Component to JS + core Wasm for JavaScript execution | ||
run <command> [args...] Run a WebAssembly Command component | ||
opt [options] <component-file> optimizes a Wasm component, including running wasm-opt Binaryen optimizations | ||
@@ -102,3 +103,3 @@ wit [options] <component-path> extract the WIT from a WebAssembly Component [wasm-tools component wit] | ||
* `--no-wasi-shim`: Disable the WASI shim mapping to `@bytecodealliance/preview2-shim`. | ||
* `--map`: Provide custom mappings for world imports. Supports both wildcard mappings (`*` similarly as in the package.json "exports" field) as well as `#` mappings for targetting exported interfaces. For example, the WASI mappings are internally defined with mappings like `--map wasi:filesystem/*=@bytecodealliance/preview2-shim/filesystem#*` to map `import as * filesystem from 'wasi:filesystem/filesystem'` to `import { filesystem } from '@bytecodealliance/preview2-shim/filesystem`. | ||
* `--map`: Provide custom mappings for world imports. Supports both wildcard mappings (`*` similarly as in the package.json "exports" field) as well as `#` mappings for targetting exported interfaces. For example, the WASI mappings are internally defined with mappings like `--map wasi:filesystem/*=@bytecodealliance/preview2-shim/filesystem#*` to map `import as * filesystem from 'wasi:filesystem/types'` to `import { types } from '@bytecodealliance/preview2-shim/filesystem`. | ||
* `--no-nodejs-compat`: Disables Node.js compat in the output to load core Wasm with FS methods. | ||
@@ -128,2 +129,14 @@ * `--instantiation`: Instead of a direct ES module, export an `instantiate` function which can take the imports as an argument instead of implicit imports. | ||
### Run | ||
For Wasm components that implement the WASI Command world, a `jco run` utility is provided to run these applications in Node.js: | ||
``` | ||
jco run cowasy.component.wasm hello | ||
``` | ||
Using the preview2-shim WASI implementation, full access to the underlying system primitives is provided, including filesystem and environment variable permissions. | ||
> Since [preview2-shim](packages/preview2-shim) is an experimental work-in-progress implementation, there will likely be bugs. | ||
## API | ||
@@ -184,2 +197,2 @@ | ||
for inclusion in this project by you, as defined in the Apache-2.0 license, | ||
shall be licensed as above, without any additional terms or conditions. | ||
shall be licensed as above, without any additional terms or conditions. |
export { optimizeComponent as opt } from './cmd/opt.js'; | ||
export { transpileComponent as transpile } from './cmd/transpile.js'; | ||
import { $init, print as printFn, parse as parseFn, componentWit as componentWitFn, componentNew as componentNewFn, componentEmbed as componentEmbedFn, metadataAdd as metadataAddFn, metadataShow as metadataShowFn } from "../obj/wasm-tools.js"; | ||
import { $init, tools } from "../obj/wasm-tools.js"; | ||
const { print: printFn, parse: parseFn, componentWit: componentWitFn, componentNew: componentNewFn, componentEmbed: componentEmbedFn, metadataAdd: metadataAddFn, metadataShow: metadataShowFn } = tools; | ||
@@ -5,0 +6,0 @@ /** |
@@ -1,2 +0,3 @@ | ||
import { $init, metadataShow, print } from '../../obj/wasm-tools.js'; | ||
import { $init, tools } from '../../obj/wasm-tools.js'; | ||
const { metadataShow, print } = tools; | ||
import { writeFile } from 'fs/promises'; | ||
@@ -3,0 +4,0 @@ import { fileURLToPath } from 'url'; |
@@ -13,4 +13,4 @@ import { $init, generate } from '../../obj/js-component-bindgen-component.js'; | ||
export async function transpile (componentPath, opts, program) { | ||
const varIdx = program.parent.rawArgs.indexOf('--'); | ||
if (varIdx !== -1) | ||
const varIdx = program?.parent.rawArgs.indexOf('--'); | ||
if (varIdx !== undefined && varIdx !== -1) | ||
opts.optArgs = program.parent.rawArgs.slice(varIdx + 1); | ||
@@ -112,2 +112,3 @@ const component = await readFile(componentPath); | ||
noNodejsCompat: !(opts.nodejsCompat ?? true), | ||
noTypescript: opts.noTypescript || false, | ||
tlaCompat: opts.tlaCompat ?? false, | ||
@@ -114,0 +115,0 @@ base64Cutoff: opts.js ? 0 : opts.base64Cutoff ?? 5000 |
import { writeFile } from "node:fs/promises"; | ||
import { readFile } from '../common.js'; | ||
import { $init, print as printFn, parse as parseFn, componentWit as componentWitFn, componentNew as componentNewFn, componentEmbed as componentEmbedFn, metadataAdd as metadataAddFn, metadataShow as metadataShowFn } from "../../obj/wasm-tools.js"; | ||
import { $init, tools } from "../../obj/wasm-tools.js"; | ||
const { print: printFn, parse: parseFn, componentWit: componentWitFn, componentNew: componentNewFn, componentEmbed: componentEmbedFn, metadataAdd: metadataAddFn, metadataShow: metadataShowFn } = tools; | ||
import { resolve, basename, extname } from 'node:path'; | ||
@@ -40,4 +41,10 @@ import c from 'chalk-template'; | ||
let adapters = null; | ||
if (opts.wasiReactor && opts.wasiCommand) | ||
throw new Error('Must select one of --wasi-command or --wasi-reactor'); | ||
if (opts.wasiReactor) | ||
adapters = [['wasi_snapshot_preview1', (await readFile(new URL('../../lib/wasi_snapshot_preview1.reactor.wasm', import.meta.url))).buffer]]; | ||
else if (opts.wasiCommand) | ||
adapters = [['wasi_snapshot_preview1', (await readFile(new URL('../../lib/wasi_snapshot_preview1.command.wasm', import.meta.url))).buffer]]; | ||
if (opts.adapt) | ||
adapters = await Promise.all(opts.adapt.map(async adapt => { | ||
adapters = adapters.concat(await Promise.all(opts.adapt.map(async adapt => { | ||
let adapter; | ||
@@ -50,3 +57,3 @@ if (adapt.includes('=')) | ||
return adapter; | ||
})); | ||
}))); | ||
const output = componentNewFn(source, adapters); | ||
@@ -53,0 +60,0 @@ await writeFile(opts.output, output); |
@@ -5,2 +5,3 @@ #!/usr/bin/env node | ||
import { transpile } from './cmd/transpile.js'; | ||
import { run } from './cmd/run.js'; | ||
import { parse, print, componentNew, componentEmbed, metadataAdd, metadataShow, componentWit } from './cmd/wasm-tools.js'; | ||
@@ -51,2 +52,9 @@ import { componentize } from './cmd/componentize.js'; | ||
program.command('run') | ||
.description('Run a WebAssembly Command component') | ||
.usage('<command.wasm> <args...>') | ||
.argument('<command>', 'Wasm command binary to run') | ||
.argument('[args...]', 'Any CLI arguments to provide to the command') | ||
.action(asyncAction(run)); | ||
program.command('opt') | ||
@@ -99,2 +107,4 @@ .description('optimizes a Wasm component, including running wasm-opt Binaryen optimizations') | ||
.option('--adapt <[NAME=]adapter...>', 'component adapters to apply') | ||
.option('--wasi-reactor', 'build with the WASI Reactor adapter') | ||
.option('--wasi-command', 'build with the WASI Command adapter') | ||
.action(asyncAction(componentNew)); | ||
@@ -101,0 +111,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 3 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 4 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
27789944
195
7
57
6440
+ Added@bytecodealliance/preview2-shim@0.0.14(transitive)
- Removed@bytecodealliance/preview2-shim@0.0.13(transitive)