@wasmgroundup/emit 0.2.11 → 0.2.13

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.
package/dist/index.d.ts CHANGED
@@ -95,10 +95,14 @@ declare function locals(n: number, type: valtype): BytecodeFragment;
95
95
  declare function import_(mod: string, nm: string, d: BytecodeFragment): BytecodeFragment;
96
96
  declare function importsec(ims: BytecodeFragment): BytecodeFragment;
97
97
  declare const importdesc: {
98
- func(x: number): BytecodeFragment;
98
+ func(x: BytecodeFragment): BytecodeFragment;
99
+ table(tt: BytecodeFragment): BytecodeFragment;
100
+ mem(mt: BytecodeFragment): BytecodeFragment;
101
+ global(gt: BytecodeFragment): BytecodeFragment;
99
102
  };
100
- declare function mem(memtype: any): any;
103
+ declare function mem(memtype: BytecodeFragment): BytecodeFragment;
101
104
  declare function memsec(mems: BytecodeFragment[]): (number | BytecodeFragment)[];
105
+ declare function memtype(limits: BytecodeFragment): BytecodeFragment;
102
106
  declare const limits: {
103
107
  min(n: number): (number | number[])[];
104
108
  minmax(n: number, m: number): (number | number[])[];
@@ -110,16 +114,17 @@ declare const mut: {
110
114
  declare function globaltype(t: any, m: any): any[];
111
115
  declare function global(gt: any, e: any): any[];
112
116
  declare function globalsec(globs: BytecodeFragment[]): (number | BytecodeFragment)[];
113
- declare function tabletype(elemtype: BytecodeFragment, limits: BytecodeFragment): BytecodeFragment[];
117
+ declare function tabletype(elemtype: number, limits: BytecodeFragment): (number | BytecodeFragment)[];
114
118
  declare function table(tabletype: BytecodeFragment): BytecodeFragment;
115
119
  declare function tablesec(tables: BytecodeFragment[]): (number | BytecodeFragment)[];
116
120
  declare const elemtype: {
117
121
  funcref: number;
118
122
  };
123
+ declare const tableidx: typeof u32;
119
124
  declare const start: typeof u32;
120
125
  declare function startsec(st: BytecodeFragment): (number | BytecodeFragment)[];
121
126
  declare function data(x: BytecodeFragment, e: BytecodeFragment, bs: BytecodeFragment[]): BytecodeFragment[];
122
127
  declare function datasec(segs: BytecodeFragment[]): (number | BytecodeFragment)[];
123
128
  declare function elem(x: BytecodeFragment, e: BytecodeFragment, ys: BytecodeFragment[]): BytecodeFragment[];
124
129
  declare function elemsec(segs: BytecodeFragment[]): (number | BytecodeFragment)[];
125
- export { blocktype, BytecodeFragment, code, codesec, data, datasec, elem, elemsec, elemtype, export_, exportdesc, exportsec, f64, func, funcidx, funcsec, functype, global, globalsec, globaltype, i32, import_, importdesc, importsec, instr, limits, locals, mem, memsec, module, mut, name, section, start, startsec, table, tablesec, tabletype, typeidx, typesec, u32, valtype, vec, };
130
+ export { blocktype, BytecodeFragment, code, codesec, data, datasec, elem, elemsec, elemtype, export_, exportdesc, exportsec, f64, func, funcidx, funcsec, functype, global, globalsec, globaltype, i32, import_, importdesc, importsec, instr, limits, locals, mem, memsec, memtype, module, mut, name, section, start, startsec, table, tableidx, tablesec, tabletype, typeidx, typesec, u32, valtype, vec, };
package/dist/index.js CHANGED
@@ -96,10 +96,6 @@ const exportdesc = {
96
96
  function module(sections) {
97
97
  return [magic(), version(), sections];
98
98
  }
99
- var numtype;
100
- (function (numtype) {
101
- numtype[numtype["i32"] = 127] = "i32";
102
- })(numtype || (numtype = {}));
103
99
  const instr = {
104
100
  nop: 0x01,
105
101
  block: 0x02,
@@ -218,7 +214,19 @@ function importsec(ims) {
218
214
  const importdesc = {
219
215
  // x:typeidx
220
216
  func(x) {
221
- return [0x00, typeidx(x)];
217
+ return [0x00, x];
218
+ },
219
+ // tt:tabletype
220
+ table(tt) {
221
+ return [0x01, tt];
222
+ },
223
+ // mt:memtype
224
+ mem(mt) {
225
+ return [0x02, mt];
226
+ },
227
+ // gt:globaltype
228
+ global(gt) {
229
+ return [0x03, gt];
222
230
  },
223
231
  };
224
232
  const memidx = u32;
@@ -228,6 +236,10 @@ function mem(memtype) {
228
236
  function memsec(mems) {
229
237
  return section(SECTION_ID_MEMORY, vec(mems));
230
238
  }
239
+ // lim:limits
240
+ function memtype(limits) {
241
+ return limits;
242
+ }
231
243
  const limits = {
232
244
  min(n) {
233
245
  return [0x00, u32(n)];
@@ -283,4 +295,4 @@ function elem(x, e, ys) {
283
295
  function elemsec(segs) {
284
296
  return section(SECTION_ID_ELEMENT, vec(segs));
285
297
  }
286
- export { blocktype, code, codesec, data, datasec, elem, elemsec, elemtype, export_, exportdesc, exportsec, f64, func, funcidx, funcsec, functype, global, globalsec, globaltype, i32, import_, importdesc, importsec, instr, limits, locals, mem, memsec, module, mut, name, section, start, startsec, table, tablesec, tabletype, typeidx, typesec, u32, valtype, vec, };
298
+ export { blocktype, code, codesec, data, datasec, elem, elemsec, elemtype, export_, exportdesc, exportsec, f64, func, funcidx, funcsec, functype, global, globalsec, globaltype, i32, import_, importdesc, importsec, instr, limits, locals, mem, memsec, memtype, module, mut, name, section, start, startsec, table, tableidx, tablesec, tabletype, typeidx, typesec, u32, valtype, vec, };
package/index.ts CHANGED
@@ -126,10 +126,6 @@ function module(sections): BytecodeFragment {
126
126
  return [magic(), version(), sections];
127
127
  }
128
128
 
129
- enum numtype {
130
- i32 = 0x7f,
131
- }
132
-
133
129
  const instr = {
134
130
  nop: 0x01,
135
131
  block: 0x02,
@@ -264,14 +260,26 @@ function importsec(ims: BytecodeFragment): BytecodeFragment {
264
260
 
265
261
  const importdesc = {
266
262
  // x:typeidx
267
- func(x: number): BytecodeFragment {
268
- return [0x00, typeidx(x)];
263
+ func(x: BytecodeFragment): BytecodeFragment {
264
+ return [0x00, x];
265
+ },
266
+ // tt:tabletype
267
+ table(tt: BytecodeFragment): BytecodeFragment {
268
+ return [0x01, tt];
269
+ },
270
+ // mt:memtype
271
+ mem(mt: BytecodeFragment): BytecodeFragment {
272
+ return [0x02, mt];
273
+ },
274
+ // gt:globaltype
275
+ global(gt: BytecodeFragment): BytecodeFragment {
276
+ return [0x03, gt];
269
277
  },
270
278
  };
271
279
 
272
280
  const memidx = u32;
273
281
 
274
- function mem(memtype) {
282
+ function mem(memtype: BytecodeFragment) {
275
283
  return memtype;
276
284
  }
277
285
 
@@ -279,6 +287,11 @@ function memsec(mems: BytecodeFragment[]) {
279
287
  return section(SECTION_ID_MEMORY, vec(mems));
280
288
  }
281
289
 
290
+ // lim:limits
291
+ function memtype(limits: BytecodeFragment) {
292
+ return limits;
293
+ }
294
+
282
295
  const limits = {
283
296
  min(n: number) {
284
297
  return [0x00, u32(n)];
@@ -310,7 +323,7 @@ function globalsec(globs: BytecodeFragment[]) {
310
323
  return section(SECTION_ID_GLOBAL, vec(globs));
311
324
  }
312
325
 
313
- function tabletype(elemtype: BytecodeFragment, limits: BytecodeFragment) {
326
+ function tabletype(elemtype: number, limits: BytecodeFragment) {
314
327
  return [elemtype, limits];
315
328
  }
316
329
 
@@ -389,6 +402,7 @@ export {
389
402
  locals,
390
403
  mem,
391
404
  memsec,
405
+ memtype,
392
406
  module,
393
407
  mut,
394
408
  name,
@@ -396,6 +410,7 @@ export {
396
410
  start,
397
411
  startsec,
398
412
  table,
413
+ tableidx,
399
414
  tablesec,
400
415
  tabletype,
401
416
  typeidx,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wasmgroundup/emit",
3
3
  "description": "A library for creating binary-encoded WebAssembly modules",
4
- "version": "0.2.11",
4
+ "version": "0.2.13",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "repository": {