@bytecodealliance/jco
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -148,2 +148,6 @@ export namespace WasiFilesystemTypes { | ||
export class DirectoryEntryStream { | ||
readDirectoryEntry(): DirectoryEntry | undefined; | ||
} | ||
export class Descriptor { | ||
@@ -161,5 +165,1 @@ readViaStream(offset: Filesize): InputStream; | ||
} | ||
export class DirectoryEntryStream { | ||
readDirectoryEntry(): DirectoryEntry | undefined; | ||
} |
@@ -16,7 +16,2 @@ export namespace WasiIoStreams { | ||
export class InputStream { | ||
read(len: bigint): Uint8Array; | ||
blockingRead(len: bigint): Uint8Array; | ||
} | ||
export class OutputStream { | ||
@@ -28,1 +23,6 @@ checkWrite(): bigint; | ||
} | ||
export class InputStream { | ||
read(len: bigint): Uint8Array; | ||
blockingRead(len: bigint): Uint8Array; | ||
} |
@@ -10,2 +10,15 @@ export type Files = [string, Uint8Array][]; | ||
} | ||
export type BindingsMode = BindingsModeJs | BindingsModeHybrid | BindingsModeOptimized | BindingsModeDirectOptimized; | ||
export interface BindingsModeJs { | ||
tag: 'js', | ||
} | ||
export interface BindingsModeHybrid { | ||
tag: 'hybrid', | ||
} | ||
export interface BindingsModeOptimized { | ||
tag: 'optimized', | ||
} | ||
export interface BindingsModeDirectOptimized { | ||
tag: 'direct-optimized', | ||
} | ||
export interface GenerateOptions { | ||
@@ -15,2 +28,3 @@ name: string, | ||
instantiation?: InstantiationMode, | ||
importBindings?: BindingsMode, | ||
map?: Maps, | ||
@@ -17,0 +31,0 @@ compat?: boolean, |
{ | ||
"name": "@bytecodealliance/jco", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "JavaScript tooling for working with WebAssembly Components", | ||
@@ -21,9 +21,9 @@ "author": "Guy Bedford", | ||
"dependencies": { | ||
"@bytecodealliance/preview2-shim": "0.15.1", | ||
"binaryen": "^111.0.0", | ||
"chalk-template": "^0.4.0", | ||
"commander": "^9.4.1", | ||
"mkdirp": "^1.0.4", | ||
"ora": "^6.1.2", | ||
"terser": "^5.16.1" | ||
"@bytecodealliance/preview2-shim": "0.16.0", | ||
"binaryen": "^116.0.0", | ||
"chalk-template": "^1", | ||
"commander": "^12", | ||
"mkdirp": "^3", | ||
"ora": "^8", | ||
"terser": "^5" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
@@ -23,3 +23,3 @@ <div align="center"> | ||
JCO provides a fully native JS toolchain for working with [WebAssembly Components](https://github.com/WebAssembly/component-model) in JavaScript. | ||
Jco provides a fully native JS toolchain for working with [WebAssembly Components](https://github.com/WebAssembly/component-model) in JavaScript. | ||
@@ -44,3 +44,3 @@ Features include: | ||
JCO can be used as either a library import or as a CLI via the `jco` command. | ||
Jco can be used as either a library import or as a CLI via the `jco` command. | ||
@@ -47,0 +47,0 @@ ## Example |
import { readFile, writeFile } from 'node:fs/promises'; | ||
import { resolve } from 'node:path'; | ||
import c from 'chalk-template'; | ||
import { isWindows } from '../common.js'; | ||
@@ -17,2 +16,3 @@ export async function componentize (jsSource, opts) { | ||
const { component, imports } = await componentizeFn(source, { | ||
sourceName: jsSource, | ||
witPath: resolve(opts.wit), | ||
@@ -19,0 +19,0 @@ worldName: opts.worldName, |
@@ -5,3 +5,3 @@ import { getTmpDir } from '../common.js'; | ||
import { basename, resolve, extname } from 'node:path'; | ||
import { fork } from 'node:child_process'; | ||
import { spawn } from 'node:child_process'; | ||
import process from 'node:process'; | ||
@@ -79,3 +79,4 @@ import { fileURLToPath, pathToFileURL } from 'node:url'; | ||
tracing: opts.jcoTrace, | ||
map: opts.jcoMap | ||
map: opts.jcoMap, | ||
importBindings: opts.jcoImportBindings, | ||
}); | ||
@@ -117,2 +118,3 @@ } | ||
${jcoImport ? `import ${JSON.stringify(pathToFileURL(jcoImport))}` : ''} | ||
import process from 'node:process'; | ||
try { | ||
@@ -125,4 +127,6 @@ process.argv[1] = "${name}"; | ||
const nodePath = process.env.JCO_RUN_PATH || process.argv[0]; | ||
process.exitCode = await new Promise((resolve, reject) => { | ||
const cp = fork(runPath, args, { stdio: 'inherit' }); | ||
const cp = spawn(nodePath, [...process.env.JCO_RUN_ARGS ? process.env.JCO_RUN_ARGS.split(' ') : [], runPath, ...args], { stdio: 'inherit' }); | ||
@@ -129,0 +133,0 @@ cp.on('error', reject); |
@@ -83,2 +83,3 @@ import { $init, generate } from '../../obj/js-component-bindgen-component.js'; | ||
* instantiation?: 'async' | 'sync', | ||
* importBindings?: 'js' | 'optimized', 'hybrid', 'direct-optimized', | ||
* map?: Record<string, string>, | ||
@@ -137,2 +138,3 @@ * validLiftingOptimization?: bool, | ||
instantiation, | ||
importBindings: opts.importBindings ? { tag: opts.importBindings } : null, | ||
validLiftingOptimization: opts.validLiftingOptimization ?? false, | ||
@@ -139,0 +141,0 @@ tracing: opts.tracing ?? false, |
@@ -14,3 +14,3 @@ #!/usr/bin/env node | ||
.usage('<command> [options]') | ||
.version('1.0.2'); | ||
.version('1.0.3'); | ||
@@ -42,2 +42,3 @@ function myParseInt(value) { | ||
.option('--valid-lifting-optimization', 'optimize component binary validations assuming all lifted values are valid') | ||
.addOption(new Option('--import-bindings [mode]', 'bindings mode for imports').choices(['js', 'optimized', 'hybrid', 'direct-optimized']).preset('js')) | ||
.option('--tracing', 'emit `tracing` calls on function entry/exit') | ||
@@ -69,2 +70,3 @@ .option('-b, --base64-cutoff <bytes>', 'set the byte size under which core Wasm binaries will be inlined as base64', myParseInt) | ||
.option('--jco-map <mappings...>', 'specifier=./output custom mappings for the component imports') | ||
.addOption(new Option('--jco-import-bindings [mode]', 'bindings mode for imports').choices(['js', 'optimized', 'hybrid', 'direct-optimized']).preset('js')) | ||
.argument('[args...]', 'Any CLI arguments for the component') | ||
@@ -92,2 +94,3 @@ .action(asyncAction(async function run (cmd, args, opts, command) { | ||
.option('--jco-import <module>', 'Custom module to import before the server executes to support custom environment setup') | ||
.addOption(new Option('--jco-import-bindings [mode]', 'bindings mode for imports').choices(['js', 'optimized', 'hybrid', 'direct-optimized']).preset('js')) | ||
.option('--jco-map <mappings...>', 'specifier=./output custom mappings for the component imports') | ||
@@ -94,0 +97,0 @@ .argument('[args...]', 'Any CLI arguments for the component') |
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
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
10582349
8954
6
+ Added@bytecodealliance/preview2-shim@0.16.0(transitive)
+ Addedbinaryen@116.0.0(transitive)
+ Addedchalk-template@1.1.0(transitive)
+ Addedcli-cursor@5.0.0(transitive)
+ Addedcommander@12.1.0(transitive)
+ Addedemoji-regex@10.4.0(transitive)
+ Addedget-east-asian-width@1.2.0(transitive)
+ Addedis-unicode-supported@2.1.0(transitive)
+ Addedlog-symbols@6.0.0(transitive)
+ Addedmimic-function@5.0.1(transitive)
+ Addedmkdirp@3.0.1(transitive)
+ Addedonetime@7.0.0(transitive)
+ Addedora@8.1.0(transitive)
+ Addedrestore-cursor@5.1.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedstdin-discarder@0.2.2(transitive)
+ Addedstring-width@7.2.0(transitive)
- Removed@bytecodealliance/preview2-shim@0.15.1(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbinaryen@111.0.0(transitive)
- Removedbl@5.1.0(transitive)
- Removedbuffer@6.0.3(transitive)
- Removedchalk@4.1.2(transitive)
- Removedchalk-template@0.4.0(transitive)
- Removedcli-cursor@4.0.0(transitive)
- Removedclone@1.0.4(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcommander@9.5.0(transitive)
- Removeddefaults@1.0.4(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedieee754@1.2.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedlog-symbols@5.1.0(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedonetime@5.1.2(transitive)
- Removedora@6.3.1(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedrestore-cursor@4.0.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstdin-discarder@0.1.0(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwcwidth@1.0.1(transitive)
Updatedbinaryen@^116.0.0
Updatedchalk-template@^1
Updatedcommander@^12
Updatedmkdirp@^3
Updatedora@^8
Updatedterser@^5