@bytecodealliance/jco
Advanced tools
Comparing version 0.14.2 to 1.0.0
export namespace WasiFilesystemTypes { | ||
export { Descriptor }; | ||
export { DirectoryEntryStream }; | ||
export function filesystemErrorCode(err: Error): ErrorCode | undefined; | ||
export { DirectoryEntryStream }; | ||
} | ||
@@ -141,8 +141,9 @@ export type Filesize = bigint; | ||
} | ||
export interface DirectoryEntry { | ||
type: DescriptorType, | ||
name: string, | ||
} | ||
import type { Error } from '../interfaces/wasi-io-streams.js'; | ||
export { Error }; | ||
export class DirectoryEntryStream { | ||
} | ||
export class Descriptor { | ||
@@ -153,5 +154,12 @@ readViaStream(offset: Filesize): InputStream; | ||
getType(): DescriptorType; | ||
readDirectory(): DirectoryEntryStream; | ||
stat(): DescriptorStat; | ||
statAt(pathFlags: PathFlags, path: string): DescriptorStat; | ||
openAt(pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags): Descriptor; | ||
metadataHash(): MetadataHashValue; | ||
metadataHashAt(pathFlags: PathFlags, path: string): MetadataHashValue; | ||
} | ||
export class DirectoryEntryStream { | ||
readDirectoryEntry(): DirectoryEntry | undefined; | ||
} |
{ | ||
"name": "@bytecodealliance/jco", | ||
"version": "0.14.2", | ||
"version": "1.0.0", | ||
"description": "JavaScript tooling for working with WebAssembly Components", | ||
@@ -21,3 +21,3 @@ "author": "Guy Bedford", | ||
"dependencies": { | ||
"@bytecodealliance/preview2-shim": "0.14.2", | ||
"@bytecodealliance/preview2-shim": "0.15.1", | ||
"binaryen": "^111.0.0", | ||
@@ -31,3 +31,3 @@ "chalk-template": "^0.4.0", | ||
"devDependencies": { | ||
"@bytecodealliance/componentize-js": "^0.5.0", | ||
"@bytecodealliance/componentize-js": "^0.6.0", | ||
"@types/node": "^18.11.17", | ||
@@ -39,3 +39,3 @@ "@typescript-eslint/eslint-plugin": "^5.41.0", | ||
"terser": "^5.16.1", | ||
"typescript": "^4.3.2" | ||
"typescript": "^5.3.3" | ||
}, | ||
@@ -42,0 +42,0 @@ "repository": { |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
export function print(binary: Parameters<import('../obj/wasm-tools.js').print>[0]): Promise<ReturnType<import('../obj/wasm-tools.js').print>>; | ||
export function print(binary: any): Promise<ReturnType<import('../obj/wasm-tools.js').print>>; | ||
/** | ||
@@ -11,3 +11,3 @@ * @param {Parameters<import('../obj/wasm-tools.js').parse>[0]} wat | ||
*/ | ||
export function parse(wat: Parameters<import('../obj/wasm-tools.js').parse>[0]): Promise<ReturnType<import('../obj/wasm-tools.js').parse>>; | ||
export function parse(wat: any): Promise<ReturnType<import('../obj/wasm-tools.js').parse>>; | ||
/** | ||
@@ -17,3 +17,3 @@ * @param {Parameters<import('../obj/wasm-tools.js').componentWit>[0]} binary | ||
*/ | ||
export function componentWit(binary: Parameters<import('../obj/wasm-tools.js').componentWit>[0]): Promise<ReturnType<import('../obj/wasm-tools.js').componentWit>>; | ||
export function componentWit(binary: any): Promise<ReturnType<import('../obj/wasm-tools.js').componentWit>>; | ||
/** | ||
@@ -24,3 +24,3 @@ * @param {Parameters<import('../obj/wasm-tools.js').componentNew>[0]} binary | ||
*/ | ||
export function componentNew(binary: Parameters<import('../obj/wasm-tools.js').componentNew>[0], adapters: Parameters<import('../obj/wasm-tools.js').componentNew>[1]): Promise<ReturnType<import('../obj/wasm-tools.js').componentNew>>; | ||
export function componentNew(binary: any, adapters: any): Promise<ReturnType<import('../obj/wasm-tools.js').componentNew>>; | ||
/** | ||
@@ -30,3 +30,3 @@ * @param {Parameters<import('../obj/wasm-tools.js').componentEmbed>[0]} embedOpts | ||
*/ | ||
export function componentEmbed(embedOpts: Parameters<import('../obj/wasm-tools.js').componentEmbed>[0]): Promise<ReturnType<import('../obj/wasm-tools.js').componentEmbed>>; | ||
export function componentEmbed(embedOpts: any): Promise<ReturnType<import('../obj/wasm-tools.js').componentEmbed>>; | ||
/** | ||
@@ -37,3 +37,3 @@ * @param {Parameters<import('../obj/wasm-tools.js').metadataAdd>[0]} binary | ||
*/ | ||
export function metadataAdd(binary: Parameters<import('../obj/wasm-tools.js').metadataAdd>[0], metadata: Parameters<import('../obj/wasm-tools.js').metadataAdd>[1]): Promise<ReturnType<import('../obj/wasm-tools.js').metadataAdd>>; | ||
export function metadataAdd(binary: any, metadata: any): Promise<ReturnType<import('../obj/wasm-tools.js').metadataAdd>>; | ||
/** | ||
@@ -43,3 +43,3 @@ * @param {Parameters<import('../obj/wasm-tools.js').metadataShow>[0]} binary | ||
*/ | ||
export function metadataShow(binary: Parameters<import('../obj/wasm-tools.js').metadataShow>[0]): Promise<ReturnType<import('../obj/wasm-tools.js').metadataShow>>; | ||
export function metadataShow(binary: any): Promise<ReturnType<import('../obj/wasm-tools.js').metadataShow>>; | ||
export function preview1AdapterCommandPath(): URL; | ||
@@ -46,0 +46,0 @@ export function preview1AdapterReactorPath(): URL; |
export function run(componentPath: any, args: any, opts: any): Promise<void>; | ||
export function serve(componentPath: any, args: any, opts: any): Promise<void>; | ||
//# sourceMappingURL=run.d.ts.map |
import { $init, generate } from '../../obj/js-component-bindgen-component.js'; | ||
import { writeFile } from 'fs/promises'; | ||
import { mkdir } from 'fs/promises'; | ||
import { dirname, extname, basename } from 'path'; | ||
import { writeFile } from 'node:fs/promises'; | ||
import { mkdir } from 'node:fs/promises'; | ||
import { dirname, extname, basename, resolve } from 'node:path'; | ||
import c from 'chalk-template'; | ||
@@ -10,4 +10,9 @@ import { readFile, sizeStr, table, spawnIOTmp, setShowSpinner, getShowSpinner } from '../common.js'; | ||
import { fileURLToPath } from 'url'; | ||
import { $init as wasmToolsInit, tools } from "../../obj/wasm-tools.js"; | ||
const { componentEmbed, componentNew } = tools; | ||
import ora from '#ora'; | ||
import { platform } from 'node:process'; | ||
const isWindows = platform === 'win32'; | ||
export async function transpile (componentPath, opts, program) { | ||
@@ -17,4 +22,14 @@ const varIdx = program?.parent.rawArgs.indexOf('--'); | ||
opts.optArgs = program.parent.rawArgs.slice(varIdx + 1); | ||
const component = await readFile(componentPath); | ||
let component; | ||
if (!opts.stub) { | ||
component = await readFile(componentPath); | ||
} else { | ||
await wasmToolsInit; | ||
component = componentNew(componentEmbed({ | ||
dummy: true, | ||
witPath: (isWindows ? '//?/' : '') + resolve(componentPath) | ||
}), []); | ||
} | ||
if (!opts.quiet) | ||
@@ -21,0 +36,0 @@ setShowSpinner(true); |
@@ -7,3 +7,2 @@ import { writeFile } from "node:fs/promises"; | ||
import c from 'chalk-template'; | ||
import { platform } from 'node:process'; | ||
@@ -10,0 +9,0 @@ export async function parse(file, opts) { |
@@ -14,3 +14,3 @@ #!/usr/bin/env node | ||
.usage('<command> [options]') | ||
.version('0.14.2'); | ||
.version('1.0.0'); | ||
@@ -23,3 +23,3 @@ function myParseInt(value) { | ||
.description('Create a component from a JavaScript module') | ||
.usage('<js-source> -o <component-path>') | ||
.usage('<js-source> --wit wit-world.wit -o <component-path>') | ||
.argument('<js-source>', 'JS source file to build') | ||
@@ -49,2 +49,3 @@ .requiredOption('-w, --wit <path>', 'WIT path to build with') | ||
.option('--no-wasi-shim', 'disable automatic rewriting of WASI imports to use @bytecodealliance/preview2-shim') | ||
.option('--stub', 'generate a stub implementation from a WIT file directly') | ||
.option('--js', 'output JS instead of core WebAssembly') | ||
@@ -51,0 +52,0 @@ .addOption(new Option('-I, --instantiation [mode]', 'output for custom module instantiation').choices(['async', 'sync']).preset('async')) |
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
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
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10372264
8421
0
3
63
+ Added@bytecodealliance/preview2-shim@0.15.1(transitive)
- Removed@bytecodealliance/preview2-shim@0.14.2(transitive)