@bytecodealliance/jco 1.24.0 → 1.24.2

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.
Files changed (42) hide show
  1. package/package.json +4 -7
  2. package/src/api.js +9 -61
  3. package/src/cmd/componentize.js +2 -7
  4. package/src/cmd/opt.js +5 -7
  5. package/src/cmd/run.js +2 -2
  6. package/src/cmd/transpile.js +36 -604
  7. package/src/cmd/types.js +17 -8
  8. package/src/cmd/wasm-tools.js +17 -24
  9. package/src/jco.js +3 -3
  10. package/types/api.d.ts +1 -31
  11. package/types/api.d.ts.map +1 -1
  12. package/types/cmd/componentize.d.ts.map +1 -1
  13. package/types/cmd/opt.d.ts.map +1 -1
  14. package/types/cmd/transpile.d.ts +25 -15
  15. package/types/cmd/transpile.d.ts.map +1 -1
  16. package/types/cmd/types.d.ts.map +1 -1
  17. package/types/cmd/wasm-tools.d.ts.map +1 -1
  18. package/obj/interfaces/local-wasm-tools-tools.d.ts +0 -79
  19. package/obj/interfaces/wasi-cli-environment.d.ts +0 -2
  20. package/obj/interfaces/wasi-cli-exit.d.ts +0 -3
  21. package/obj/interfaces/wasi-cli-stderr.d.ts +0 -3
  22. package/obj/interfaces/wasi-cli-stdin.d.ts +0 -3
  23. package/obj/interfaces/wasi-cli-stdout.d.ts +0 -3
  24. package/obj/interfaces/wasi-cli-terminal-input.d.ts +0 -8
  25. package/obj/interfaces/wasi-cli-terminal-output.d.ts +0 -8
  26. package/obj/interfaces/wasi-cli-terminal-stderr.d.ts +0 -3
  27. package/obj/interfaces/wasi-cli-terminal-stdin.d.ts +0 -3
  28. package/obj/interfaces/wasi-cli-terminal-stdout.d.ts +0 -3
  29. package/obj/interfaces/wasi-clocks-wall-clock.d.ts +0 -5
  30. package/obj/interfaces/wasi-filesystem-preopens.d.ts +0 -3
  31. package/obj/interfaces/wasi-filesystem-types.d.ts +0 -165
  32. package/obj/interfaces/wasi-io-error.d.ts +0 -8
  33. package/obj/interfaces/wasi-io-streams.d.ts +0 -30
  34. package/obj/interfaces/wasi-random-random.d.ts +0 -2
  35. package/obj/js-component-bindgen-component.core.wasm +0 -0
  36. package/obj/js-component-bindgen-component.core2.wasm +0 -0
  37. package/obj/js-component-bindgen-component.d.ts +0 -120
  38. package/obj/js-component-bindgen-component.js +0 -13637
  39. package/obj/wasm-tools.core.wasm +0 -0
  40. package/obj/wasm-tools.core2.wasm +0 -0
  41. package/obj/wasm-tools.d.ts +0 -20
  42. package/obj/wasm-tools.js +0 -14389
package/src/cmd/types.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import { stat, mkdir } from "node:fs/promises";
2
2
  import { extname, basename, resolve } from "node:path";
3
3
 
4
- import { $init, generateTypes } from "../../obj/js-component-bindgen-component.js";
4
+ import { generateGuestTypes, generateHostTypes } from "@bytecodealliance/jco-transpile";
5
5
 
6
6
  import {
7
- isWindows,
8
7
  writeFiles,
9
8
  resolveDefaultWITPath,
10
9
  styleText,
@@ -75,16 +74,23 @@ export async function guestTypes(witPath, opts) {
75
74
  * @returns {Promise<{ [filename: string]: Uint8Array }>}
76
75
  */
77
76
  export async function typesComponent(witPath, opts) {
78
- await $init;
79
77
  const name =
80
78
  opts.name ||
81
79
  (opts.worldName
82
80
  ? opts.worldName.split(":").pop().split("/").pop()
83
81
  : basename(witPath.slice(0, -extname(witPath).length || Infinity)));
82
+
84
83
  let instantiation;
85
84
  if (opts.instantiation) {
86
- instantiation = { tag: opts.instantiation };
85
+ if (typeof opts.instantiation === "string") {
86
+ instantiation = { tag: opts.instantiation };
87
+ } else if (typeof opts.instantiation === "object") {
88
+ instantiation = opts.instantiation;
89
+ } else {
90
+ throw new Error("invalid instantiation configuration value");
91
+ }
87
92
  }
93
+
88
94
  let outDir = (opts.outDir ?? "").replace(/\\/g, "/");
89
95
  if (!outDir.endsWith("/") && outDir !== "") {
90
96
  outDir += "/";
@@ -132,17 +138,20 @@ export async function typesComponent(witPath, opts) {
132
138
  // Run the type generation
133
139
  let types;
134
140
  const absWitPath = resolve(witPath);
141
+ const guest = opts.guest ?? false;
142
+ const generateFn = guest ? generateGuestTypes : generateHostTypes;
135
143
  try {
136
- types = generateTypes(name, {
137
- wit: { tag: "path", val: (isWindows ? "//?/" : "") + absWitPath },
144
+ const generated = await generateFn(absWitPath, {
145
+ name,
138
146
  instantiation,
139
147
  tlaCompat: opts.tlaCompat ?? false,
140
148
  world: opts.worldName,
141
149
  features,
142
- guest: opts.guest ?? false,
150
+ guest,
143
151
  strict: opts.strict === true,
144
152
  asyncMode: asyncModeObj,
145
- }).map(([name, file]) => [`${outDir}${name}`, file]);
153
+ });
154
+ types = Object.entries(generated).map(([name, bytes]) => [`${outDir}${name}`, bytes]);
146
155
  } catch (err) {
147
156
  if (err.toString().includes("does not match previous package name")) {
148
157
  const hint = await printWITLayoutHint(absWitPath);
@@ -1,29 +1,27 @@
1
1
  import { resolve, basename, extname } from "node:path";
2
2
  import { writeFile } from "node:fs/promises";
3
3
 
4
+ import {
5
+ print as printFn,
6
+ parse as parseFn,
7
+ componentWit as componentWitFn,
8
+ componentNew as componentNewFn,
9
+ componentEmbed as componentEmbedFn,
10
+ metadataAdd as metadataAddFn,
11
+ metadataShow as metadataShowFn,
12
+ } from "@bytecodealliance/jco-transpile/wasm-tools";
13
+
4
14
  import { readFile, isWindows, styleText } from "../common.js";
5
- import { $init, tools } from "../../obj/wasm-tools.js";
6
- const {
7
- print: printFn,
8
- parse: parseFn,
9
- componentWit: componentWitFn,
10
- componentNew: componentNewFn,
11
- componentEmbed: componentEmbedFn,
12
- metadataAdd: metadataAddFn,
13
- metadataShow: metadataShowFn,
14
- } = tools;
15
15
 
16
16
  export async function parse(file, opts) {
17
- await $init;
18
17
  const source = (await readFile(file)).toString();
19
- const output = parseFn(source);
18
+ const output = await parseFn(source);
20
19
  await writeFile(opts.output, output);
21
20
  }
22
21
 
23
22
  export async function print(file, opts) {
24
- await $init;
25
23
  const source = await readFile(file);
26
- const output = printFn(source);
24
+ const output = await printFn(source);
27
25
  if (opts.output) {
28
26
  await writeFile(opts.output, output);
29
27
  } else {
@@ -32,9 +30,8 @@ export async function print(file, opts) {
32
30
  }
33
31
 
34
32
  export async function componentWit(file, opts) {
35
- await $init;
36
33
  const source = await readFile(file);
37
- const output = componentWitFn(source, opts.document);
34
+ const output = await componentWitFn(source, opts.document);
38
35
  if (opts.output) {
39
36
  await writeFile(opts.output, output);
40
37
  } else {
@@ -43,7 +40,6 @@ export async function componentWit(file, opts) {
43
40
  }
44
41
 
45
42
  export async function componentNew(file, opts) {
46
- await $init;
47
43
  const source = file ? await readFile(file) : null;
48
44
  let adapters = [];
49
45
  if (opts.wasiReactor && opts.wasiCommand) {
@@ -80,12 +76,11 @@ export async function componentNew(file, opts) {
80
76
  ),
81
77
  );
82
78
  }
83
- const output = componentNewFn(source, adapters);
79
+ const output = await componentNewFn(source, adapters);
84
80
  await writeFile(opts.output, output);
85
81
  }
86
82
 
87
83
  export async function componentEmbed(file, opts) {
88
- await $init;
89
84
  if (opts.metadata) {
90
85
  opts.metadata = opts.metadata.map((meta) => {
91
86
  const [field, data = ""] = meta.split("=");
@@ -96,28 +91,26 @@ export async function componentEmbed(file, opts) {
96
91
  const source = file ? await readFile(file) : null;
97
92
  opts.binary = source;
98
93
  opts.witPath = (isWindows ? "//?/" : "") + resolve(opts.wit);
99
- const output = componentEmbedFn(opts);
94
+ const output = await componentEmbedFn(opts);
100
95
  await writeFile(opts.output, output);
101
96
  }
102
97
 
103
98
  export async function metadataAdd(file, opts) {
104
- await $init;
105
99
  const metadata = opts.metadata.map((meta) => {
106
100
  const [field, data = ""] = meta.split("=");
107
101
  const [name, version = ""] = data.split("@");
108
102
  return [field, [[name, version]]];
109
103
  });
110
104
  const source = await readFile(file);
111
- const output = metadataAddFn(source, metadata);
105
+ const output = await metadataAddFn(source, metadata);
112
106
  await writeFile(opts.output, output);
113
107
  }
114
108
 
115
109
  export async function metadataShow(file, opts) {
116
- await $init;
117
110
  const source = await readFile(file);
118
111
  let output = "",
119
112
  stack = [1];
120
- const meta = metadataShowFn(source);
113
+ const meta = await metadataShowFn(source);
121
114
  if (opts.json) {
122
115
  console.log(JSON.stringify(meta, null, 2));
123
116
  } else {
package/src/jco.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import { program, Option } from "commander";
4
4
 
5
5
  import { opt } from "./cmd/opt.js";
6
- import { transpile } from "./cmd/transpile.js";
6
+ import { transpileCmd } from "./cmd/transpile.js";
7
7
  import { types, guestTypes } from "./cmd/types.js";
8
8
  import { run as runCmd, serve as serveCmd } from "./cmd/run.js";
9
9
  import {
@@ -25,7 +25,7 @@ program
25
25
  )
26
26
  .usage("<command> [options]")
27
27
  .enablePositionalOptions()
28
- .version("1.24.0");
28
+ .version("1.24.2");
29
29
 
30
30
  function myParseInt(value) {
31
31
  return parseInt(value, 10);
@@ -130,7 +130,7 @@ program
130
130
  .option("--multi-memory", "optimized output for Wasm multi-memory")
131
131
  .option("--strict", "generate bindings with strict type checking")
132
132
  .allowExcessArguments(true)
133
- .action(asyncAction(transpile));
133
+ .action(asyncAction(transpileCmd));
134
134
 
135
135
  program
136
136
  .command("types")
package/types/api.d.ts CHANGED
@@ -1,36 +1,6 @@
1
- /**
2
- * @param {Uint8Array} binary
3
- */
4
- export function print(binary: Uint8Array): Promise<string>;
5
- /**
6
- * @param {string} wat
7
- */
8
- export function parse(wat: string): Promise<Uint8Array<ArrayBufferLike>>;
9
- /**
10
- * @param {Uint8Array} binary
11
- */
12
- export function componentWit(binary: Uint8Array): Promise<string>;
13
- /**
14
- * @param {Uint8Array} binary
15
- * @param {Array<[string, Uint8Array]>} [adapters]
16
- */
17
- export function componentNew(binary: Uint8Array, adapters?: Array<[string, Uint8Array]>): Promise<Uint8Array<ArrayBufferLike>>;
18
- /**
19
- * @param {tools.EmbedOpts} embedOpts
20
- */
21
- export function componentEmbed(embedOpts: tools.EmbedOpts): Promise<Uint8Array<ArrayBufferLike>>;
22
- /**
23
- * @param {Uint8Array} binary
24
- * @param {tools.ProducersFields} metadata
25
- */
26
- export function metadataAdd(binary: Uint8Array, metadata: tools.ProducersFields): Promise<Uint8Array<ArrayBufferLike>>;
27
- /**
28
- * @param {Uint8Array} binary
29
- */
30
- export function metadataShow(binary: Uint8Array): Promise<tools.ModuleMetadata[]>;
31
1
  export function preview1AdapterCommandPath(): URL;
32
2
  export function preview1AdapterReactorPath(): URL;
33
3
  export { optimizeComponent as opt } from "./cmd/opt.js";
34
- import { tools } from "../obj/wasm-tools.js";
35
4
  export { transpileComponent as transpile, typesComponent as types } from "./cmd/transpile.js";
5
+ export { print, parse, componentWit, componentNew, componentEmbed, metadataAdd, metadataShow } from "@bytecodealliance/jco-transpile/wasm-tools";
36
6
  //# sourceMappingURL=api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.js"],"names":[],"mappings":"AAcA;;GAEG;AACH,8BAFW,UAAU,mBAKpB;AACD;;GAEG;AACH,2BAFW,MAAM,wCAKhB;AACD;;GAEG;AACH,qCAFW,UAAU,mBAKpB;AACD;;;GAGG;AACH,qCAHW,UAAU,aACV,KAAK,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,wCAKrC;AACD;;GAEG;AACH,0CAFW,KAAK,CAAC,SAAS,wCAKzB;AACD;;;GAGG;AACH,oCAHW,UAAU,YACV,KAAK,CAAC,eAAe,wCAK/B;AACD;;GAEG;AACH,qCAFW,UAAU,mCAKpB;AAED,kDAEC;AACD,kDAEC;;sBApE4B,sBAAsB"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.js"],"names":[],"mappings":"AAcA,kDAEC;AACD,kDAEC"}
@@ -1 +1 @@
1
- {"version":3,"file":"componentize.d.ts","sourceRoot":"","sources":["../../src/cmd/componentize.js"],"names":[],"mappings":"AAoDA,sEAoEC"}
1
+ {"version":3,"file":"componentize.d.ts","sourceRoot":"","sources":["../../src/cmd/componentize.js"],"names":[],"mappings":"AA+CA,sEAoEC"}
@@ -1 +1 @@
1
- {"version":3,"file":"opt.d.ts","sourceRoot":"","sources":["../../src/cmd/opt.js"],"names":[],"mappings":"AAUA,gFAkDC;AAgBD;;;;;GAKG;AACH,kDAJW,UAAU,QACV;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5E,OAAO,CAAC;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,eAAe,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAA,CAAE,CAuJ7G"}
1
+ {"version":3,"file":"opt.d.ts","sourceRoot":"","sources":["../../src/cmd/opt.js"],"names":[],"mappings":"AAUA,gFAiDC;AAgBD;;;;;GAKG;AACH,kDAJW,UAAU,QACV;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5E,OAAO,CAAC;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,eAAe,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAA,CAAE,CAsJ7G"}
@@ -1,10 +1,5 @@
1
- export function transpile(witPath: any, opts: any, program: any): Promise<void>;
2
1
  /**
3
- * Execute the bundled pre-transpiled component that can perform component transpilation,
4
- * for the given component.
5
- *
6
- * @param {Uint8Array} component
7
- * @param {{
2
+ * @typedef {{
8
3
  * name: string,
9
4
  * instantiation?: 'async' | 'sync',
10
5
  * importBindings?: 'js' | 'optimized' | 'hybrid' | 'direct-optimized',
@@ -26,10 +21,31 @@ export function transpile(witPath: any, opts: any, program: any): Promise<void>;
26
21
  * experimentalIdlImports?: bool,
27
22
  * optArgs?: string[],
28
23
  * wasmOptBin?: string[],
29
- * }} opts
24
+ * }} TranspileOpts
25
+ */
26
+ /**
27
+ * Transpile a component, given a path.
28
+ *
29
+ * @param {string} componentPath
30
+ * @param {TranspileOpts} opts
31
+ * @param {object} comander `Program` object
32
+ */
33
+ export function transpileCmd(componentPath: string, opts: TranspileOpts, program: any): Promise<void>;
34
+ /**
35
+ * Transpile a component, given WebAssembly bytes.
36
+ *
37
+ * @param {Uint8Array} component
38
+ * @param {TranspileOpts} [opts]
30
39
  * @returns {Promise<{ files: { [filename: string]: Uint8Array }, imports: string[], exports: [string, 'function' | 'instance'][] }>}
31
40
  */
32
- export function transpileComponent(component: Uint8Array, opts?: {
41
+ export function transpileComponent(component: Uint8Array, opts?: TranspileOpts): Promise<{
42
+ files: {
43
+ [filename: string]: Uint8Array;
44
+ };
45
+ imports: string[];
46
+ exports: [string, "function" | "instance"][];
47
+ }>;
48
+ export type TranspileOpts = {
33
49
  name: string;
34
50
  instantiation?: "async" | "sync";
35
51
  importBindings?: "js" | "optimized" | "hybrid" | "direct-optimized";
@@ -51,12 +67,6 @@ export function transpileComponent(component: Uint8Array, opts?: {
51
67
  experimentalIdlImports?: bool;
52
68
  optArgs?: string[];
53
69
  wasmOptBin?: string[];
54
- }): Promise<{
55
- files: {
56
- [filename: string]: Uint8Array;
57
- };
58
- imports: string[];
59
- exports: [string, "function" | "instance"][];
60
- }>;
70
+ };
61
71
  export { types, guestTypes, typesComponent } from "./types.js";
62
72
  //# sourceMappingURL=transpile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transpile.d.ts","sourceRoot":"","sources":["../../src/cmd/transpile.js"],"names":[],"mappings":"AAiCA,gFAuCC;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,8CA1BW,UAAU,SACV;IACN,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,cAAc,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AM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,IAAI,CAAC;CACd,GACS,OAAO,CAAC;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC,CA6FvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-tools.d.ts","sourceRoot":"","sources":["../../src/cmd/wasm-tools.js"],"names":[],"mappings":"AAeA,2DAKC;AAED,2DASC;AAED,kEASC;AAED,kEAwCC;AAED,oEAcC;AAED,iEAUC;AAED,kEAoCC"}
1
+ {"version":3,"file":"wasm-tools.d.ts","sourceRoot":"","sources":["../../src/cmd/wasm-tools.js"],"names":[],"mappings":"AAeA,2DAIC;AAED,2DAQC;AAED,kEAQC;AAED,kEAuCC;AAED,oEAaC;AAED,iEASC;AAED,kEAmCC"}
@@ -1,79 +0,0 @@
1
- /** @module Interface local:wasm-tools/tools **/
2
- export function parse(wat: string): Uint8Array;
3
- export function print(binary: Uint8Array): string;
4
- export function componentNew(binary: Uint8Array, adapters: Array<[string, Uint8Array]> | undefined): Uint8Array;
5
- export function componentWit(binary: Uint8Array): string;
6
- export function componentWitMetadataForWorld(wit: WitSpecifier, worldName: string | undefined): WitMetadata;
7
- export function componentEmbed(embedOpts: EmbedOpts): Uint8Array;
8
- export function metadataShow(binary: Uint8Array): Array<ModuleMetadata>;
9
- export function metadataAdd(binary: Uint8Array, metadata: ProducersFields): Uint8Array;
10
- /**
11
- * # Variants
12
- *
13
- * ## `"utf8"`
14
- *
15
- * ## `"utf16"`
16
- *
17
- * ## `"compact-utf16"`
18
- */
19
- export type StringEncoding = 'utf8' | 'utf16' | 'compact-utf16';
20
- export interface SemverVersion {
21
- major: bigint,
22
- minor: bigint,
23
- patch: bigint,
24
- pre?: string,
25
- build?: string,
26
- }
27
- export interface InterfaceMetadata {
28
- namespace: string,
29
- 'package': string,
30
- 'interface': string,
31
- version?: SemverVersion,
32
- }
33
- export interface WitMetadata {
34
- imports: Array<InterfaceMetadata>,
35
- exports: Array<InterfaceMetadata>,
36
- }
37
- export type WitSpecifier = WitSpecifierSource | WitSpecifierPath;
38
- export interface WitSpecifierSource {
39
- tag: 'source',
40
- val: string,
41
- }
42
- export interface WitSpecifierPath {
43
- tag: 'path',
44
- val: string,
45
- }
46
- export type ProducersFields = Array<[string, Array<[string, string]>]>;
47
- export type EnabledFeatureSet = EnabledFeatureSetList | EnabledFeatureSetAll;
48
- export interface EnabledFeatureSetList {
49
- tag: 'list',
50
- val: Array<string>,
51
- }
52
- export interface EnabledFeatureSetAll {
53
- tag: 'all',
54
- }
55
- export interface EmbedOpts {
56
- binary?: Uint8Array,
57
- witSource?: string,
58
- witPath?: string,
59
- stringEncoding?: StringEncoding,
60
- dummy?: boolean,
61
- world?: string,
62
- metadata?: ProducersFields,
63
- features?: EnabledFeatureSet,
64
- }
65
- export type ModuleMetaType = ModuleMetaTypeModule | ModuleMetaTypeComponent;
66
- export interface ModuleMetaTypeModule {
67
- tag: 'module',
68
- }
69
- export interface ModuleMetaTypeComponent {
70
- tag: 'component',
71
- val: number,
72
- }
73
- export interface ModuleMetadata {
74
- parentIndex?: number,
75
- name?: string,
76
- metaType: ModuleMetaType,
77
- range: [number, number],
78
- producers: ProducersFields,
79
- }
@@ -1,2 +0,0 @@
1
- /** @module Interface wasi:cli/environment@0.2.3 **/
2
- export function getEnvironment(): Array<[string, string]>;
@@ -1,3 +0,0 @@
1
- /** @module Interface wasi:cli/exit@0.2.3 **/
2
- export function exit(status: Result<void, void>): void;
3
- export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
@@ -1,3 +0,0 @@
1
- /** @module Interface wasi:cli/stderr@0.2.3 **/
2
- export function getStderr(): OutputStream;
3
- export type OutputStream = import('./wasi-io-streams.js').OutputStream;
@@ -1,3 +0,0 @@
1
- /** @module Interface wasi:cli/stdin@0.2.3 **/
2
- export function getStdin(): InputStream;
3
- export type InputStream = import('./wasi-io-streams.js').InputStream;
@@ -1,3 +0,0 @@
1
- /** @module Interface wasi:cli/stdout@0.2.3 **/
2
- export function getStdout(): OutputStream;
3
- export type OutputStream = import('./wasi-io-streams.js').OutputStream;
@@ -1,8 +0,0 @@
1
- /** @module Interface wasi:cli/terminal-input@0.2.3 **/
2
-
3
- export class TerminalInput {
4
- /**
5
- * This type does not have a public constructor.
6
- */
7
- private constructor();
8
- }
@@ -1,8 +0,0 @@
1
- /** @module Interface wasi:cli/terminal-output@0.2.3 **/
2
-
3
- export class TerminalOutput {
4
- /**
5
- * This type does not have a public constructor.
6
- */
7
- private constructor();
8
- }
@@ -1,3 +0,0 @@
1
- /** @module Interface wasi:cli/terminal-stderr@0.2.3 **/
2
- export function getTerminalStderr(): TerminalOutput | undefined;
3
- export type TerminalOutput = import('./wasi-cli-terminal-output.js').TerminalOutput;
@@ -1,3 +0,0 @@
1
- /** @module Interface wasi:cli/terminal-stdin@0.2.3 **/
2
- export function getTerminalStdin(): TerminalInput | undefined;
3
- export type TerminalInput = import('./wasi-cli-terminal-input.js').TerminalInput;
@@ -1,3 +0,0 @@
1
- /** @module Interface wasi:cli/terminal-stdout@0.2.3 **/
2
- export function getTerminalStdout(): TerminalOutput | undefined;
3
- export type TerminalOutput = import('./wasi-cli-terminal-output.js').TerminalOutput;
@@ -1,5 +0,0 @@
1
- /** @module Interface wasi:clocks/wall-clock@0.2.3 **/
2
- export interface Datetime {
3
- seconds: bigint,
4
- nanoseconds: number,
5
- }
@@ -1,3 +0,0 @@
1
- /** @module Interface wasi:filesystem/preopens@0.2.3 **/
2
- export function getDirectories(): Array<[Descriptor, string]>;
3
- export type Descriptor = import('./wasi-filesystem-types.js').Descriptor;
@@ -1,165 +0,0 @@
1
- /** @module Interface wasi:filesystem/types@0.2.3 **/
2
- export function filesystemErrorCode(err: Error): ErrorCode | undefined;
3
- export interface DescriptorFlags {
4
- read?: boolean,
5
- write?: boolean,
6
- fileIntegritySync?: boolean,
7
- dataIntegritySync?: boolean,
8
- requestedWriteSync?: boolean,
9
- mutateDirectory?: boolean,
10
- }
11
- /**
12
- * # Variants
13
- *
14
- * ## `"access"`
15
- *
16
- * ## `"would-block"`
17
- *
18
- * ## `"already"`
19
- *
20
- * ## `"bad-descriptor"`
21
- *
22
- * ## `"busy"`
23
- *
24
- * ## `"deadlock"`
25
- *
26
- * ## `"quota"`
27
- *
28
- * ## `"exist"`
29
- *
30
- * ## `"file-too-large"`
31
- *
32
- * ## `"illegal-byte-sequence"`
33
- *
34
- * ## `"in-progress"`
35
- *
36
- * ## `"interrupted"`
37
- *
38
- * ## `"invalid"`
39
- *
40
- * ## `"io"`
41
- *
42
- * ## `"is-directory"`
43
- *
44
- * ## `"loop"`
45
- *
46
- * ## `"too-many-links"`
47
- *
48
- * ## `"message-size"`
49
- *
50
- * ## `"name-too-long"`
51
- *
52
- * ## `"no-device"`
53
- *
54
- * ## `"no-entry"`
55
- *
56
- * ## `"no-lock"`
57
- *
58
- * ## `"insufficient-memory"`
59
- *
60
- * ## `"insufficient-space"`
61
- *
62
- * ## `"not-directory"`
63
- *
64
- * ## `"not-empty"`
65
- *
66
- * ## `"not-recoverable"`
67
- *
68
- * ## `"unsupported"`
69
- *
70
- * ## `"no-tty"`
71
- *
72
- * ## `"no-such-device"`
73
- *
74
- * ## `"overflow"`
75
- *
76
- * ## `"not-permitted"`
77
- *
78
- * ## `"pipe"`
79
- *
80
- * ## `"read-only"`
81
- *
82
- * ## `"invalid-seek"`
83
- *
84
- * ## `"text-file-busy"`
85
- *
86
- * ## `"cross-device"`
87
- */
88
- export type ErrorCode = 'access' | 'would-block' | 'already' | 'bad-descriptor' | 'busy' | 'deadlock' | 'quota' | 'exist' | 'file-too-large' | 'illegal-byte-sequence' | 'in-progress' | 'interrupted' | 'invalid' | 'io' | 'is-directory' | 'loop' | 'too-many-links' | 'message-size' | 'name-too-long' | 'no-device' | 'no-entry' | 'no-lock' | 'insufficient-memory' | 'insufficient-space' | 'not-directory' | 'not-empty' | 'not-recoverable' | 'unsupported' | 'no-tty' | 'no-such-device' | 'overflow' | 'not-permitted' | 'pipe' | 'read-only' | 'invalid-seek' | 'text-file-busy' | 'cross-device';
89
- /**
90
- * # Variants
91
- *
92
- * ## `"unknown"`
93
- *
94
- * ## `"block-device"`
95
- *
96
- * ## `"character-device"`
97
- *
98
- * ## `"directory"`
99
- *
100
- * ## `"fifo"`
101
- *
102
- * ## `"symbolic-link"`
103
- *
104
- * ## `"regular-file"`
105
- *
106
- * ## `"socket"`
107
- */
108
- export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
109
- export interface MetadataHashValue {
110
- lower: bigint,
111
- upper: bigint,
112
- }
113
- export type Error = import('./wasi-io-streams.js').Error;
114
- export interface PathFlags {
115
- symlinkFollow?: boolean,
116
- }
117
- export type Filesize = bigint;
118
- export type InputStream = import('./wasi-io-streams.js').InputStream;
119
- export type OutputStream = import('./wasi-io-streams.js').OutputStream;
120
- export type LinkCount = bigint;
121
- export type Datetime = import('./wasi-clocks-wall-clock.js').Datetime;
122
- export interface DescriptorStat {
123
- type: DescriptorType,
124
- linkCount: LinkCount,
125
- size: Filesize,
126
- dataAccessTimestamp?: Datetime,
127
- dataModificationTimestamp?: Datetime,
128
- statusChangeTimestamp?: Datetime,
129
- }
130
- export interface OpenFlags {
131
- create?: boolean,
132
- directory?: boolean,
133
- exclusive?: boolean,
134
- truncate?: boolean,
135
- }
136
- export interface DirectoryEntry {
137
- type: DescriptorType,
138
- name: string,
139
- }
140
-
141
- export class Descriptor {
142
- /**
143
- * This type does not have a public constructor.
144
- */
145
- private constructor();
146
- readViaStream(offset: Filesize): InputStream;
147
- writeViaStream(offset: Filesize): OutputStream;
148
- appendViaStream(): OutputStream;
149
- getFlags(): DescriptorFlags;
150
- getType(): DescriptorType;
151
- readDirectory(): DirectoryEntryStream;
152
- stat(): DescriptorStat;
153
- statAt(pathFlags: PathFlags, path: string): DescriptorStat;
154
- openAt(pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags): Descriptor;
155
- metadataHash(): MetadataHashValue;
156
- metadataHashAt(pathFlags: PathFlags, path: string): MetadataHashValue;
157
- }
158
-
159
- export class DirectoryEntryStream {
160
- /**
161
- * This type does not have a public constructor.
162
- */
163
- private constructor();
164
- readDirectoryEntry(): DirectoryEntry | undefined;
165
- }
@@ -1,8 +0,0 @@
1
- /** @module Interface wasi:io/error@0.2.3 **/
2
-
3
- export class Error {
4
- /**
5
- * This type does not have a public constructor.
6
- */
7
- private constructor();
8
- }