@hazae41/bobine 0.0.21 → 0.0.22

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.
@@ -1,12 +1,11 @@
1
- // deno-lint-ignore-file prefer-const
2
1
  import * as Wasm from "@hazae41/wasm";
3
2
  export function meter(module, from, name) {
4
3
  let wtype = module.body.sections.find(section => section.kind === Wasm.TypeSection.kind);
5
4
  let wimport = module.body.sections.find(section => section.kind === Wasm.ImportSection.kind);
6
- let wexport = module.body.sections.find(section => section.kind === Wasm.ExportSection.kind);
7
- let wcode = module.body.sections.find(section => section.kind === Wasm.CodeSection.kind);
8
- let welem = module.body.sections.find(section => section.kind === Wasm.ElementSection.kind);
9
- let wstart = module.body.sections.find(section => section.kind === Wasm.StartSection.kind);
5
+ const wexport = module.body.sections.find(section => section.kind === Wasm.ExportSection.kind);
6
+ const wcode = module.body.sections.find(section => section.kind === Wasm.CodeSection.kind);
7
+ const welem = module.body.sections.find(section => section.kind === Wasm.ElementSection.kind);
8
+ const wstart = module.body.sections.find(section => section.kind === Wasm.StartSection.kind);
10
9
  if (wtype == null) {
11
10
  wtype = new Wasm.TypeSection([]);
12
11
  module.body.sections.unshift(wtype);
@@ -1,4 +1,4 @@
1
- // deno-lint-ignore-file no-namespace
1
+ /// <reference types="../bytes/lib.d.ts"/>
2
2
  export class Packed {
3
3
  value;
4
4
  constructor(value) {
@@ -58,8 +58,10 @@ export async function main(args) {
58
58
  response.headers.set("Access-Control-Allow-Headers", "*");
59
59
  return response;
60
60
  }
61
- catch (cause) {
62
- console.error(cause);
61
+ catch (error) {
62
+ console.error(error);
63
+ if (error instanceof Error)
64
+ return new Response(error.message, { status: 500 });
63
65
  return new Response(null, { status: 500 });
64
66
  }
65
67
  };
@@ -1,4 +1,3 @@
1
- // deno-lint-ignore-file no-cond-assign no-unused-vars require-await
2
1
  var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
3
2
  if (value !== null && value !== void 0) {
4
3
  if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
@@ -1,4 +1,3 @@
1
- // deno-lint-ignore-file no-explicit-any no-unused-vars ban-unused-ignore
2
1
  /// <reference lib="webworker" />
3
2
  import { meter } from "../../libs/metering/mod.js";
4
3
  import { Packed } from "../../libs/packed/mod.js";
@@ -91,8 +90,7 @@ function run(module, method, params, mode, maxsparks) {
91
90
  imports["console"] = {
92
91
  log: (text) => {
93
92
  logs.push(text);
94
- if (process.env.NODE_ENV !== "production")
95
- console.log(text);
93
+ console.log(text);
96
94
  return;
97
95
  }
98
96
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@hazae41/bobine",
4
- "version": "0.0.21",
4
+ "version": "0.0.22",
5
5
  "description": "A blockchain in your garage",
6
6
  "repository": "github:hazae41/bobine",
7
7
  "author": "hazae41",