breaking: Use only esm modules for lib/* packages and remove esm2umd dependency by MaxGraey · Pull Request #3037 · AssemblyScript/assemblyscript · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/publish.yml
13 changes: 9 additions & 4 deletions lib/loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A tiny module loader that makes working with AssemblyScript modules as convenien
## Example

```ts
import loader from "@assemblyscript/loader"; // or require
import loader from "@assemblyscript/loader";
loader.instantiate(
// Binary to instantiate
fetch("optimized.wasm"), // or fs.readFileSync
Expand All @@ -33,12 +33,17 @@ npm install --save @assemblyscript/loader
On the web:

```html
<!-- ESM -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@assemblyscript/loader/index.js"></script>
<!-- UMD -->
<script src="https://cdn.jsdelivr.net/npm/@assemblyscript/loader/umd/index.js"></script>
```

The package is ESM-only. From CommonJS, load it with a dynamic import:

```js
const loader = (await import("@assemblyscript/loader")).default;
```

Node.js 20.19+ and 22.12+ also accept a plain `require` of an ES module.

## Usage

One task the loader does not perform is to implicitly translate between WebAssembly pointers and JavaScript objects, and that's where the mixed in utility comes into play. For example, if one has
Expand Down
9 changes: 9 additions & 0 deletions lib/loader/index.d.ts
Loading
Loading