@wapc/widl
TypeScript icon, indicating that this package has built-in type declarations

0.0.12 • Public • Published

Web Assembly IDL (widl) Parser

This library will parse .widl files into an AST. Refer to the docs docs for more information.

Installation

$ npm install @wapc/widl

Usage (node)

const widl = require("@wapc/widl");

const source = `
namespace "mandelbrot"

interface {
  update(width: u32, height: u32, limit: u32): [u16]
}`;

const doc = widl.parse(source, { noLocation: true });

console.log(JSON.stringify(doc));

Usage (browser)

<script
  type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/@wapc/widl/dist/standalone.min.js"
></script>
<script type="text/javascript">
  const source = `
namespace "mandelbrot"

interface {
  update(width: u32, height: u32, limit: u32): [u16]
}`;

  const doc = widl.parse(source, { noLocation: true });

  console.log(JSON.stringify(doc));
</script>

License

Apache License 2.0

Package Sidebar

Install

npm i @wapc/widl

Weekly Downloads

5

Version

0.0.12

License

Apache-2.0

Unpacked Size

1.51 MB

Total Files

294

Last publish

Collaborators

  • pkedy
  • jsoverson
  • wapcbot