Skip to content

Commit c095e78

Browse files
committed
remove esm2umd dependency
1 parent b6bda05 commit c095e78

17 files changed

Lines changed: 44 additions & 2344 deletions

File tree

.github/workflows/publish.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ jobs:
3838
npm test
3939
cd lib/loader
4040
npm version "$VERSION" --no-git-tag-version
41-
npm run build
4241
npm test
4342
cd ../rtrace
4443
npm version "$VERSION" --no-git-tag-version
45-
npm run build
4644
npm test
4745
cd ../..
4846
fi

lib/loader/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A tiny module loader that makes working with AssemblyScript modules as convenien
77
## Example
88

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

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

39+
The package is ESM-only. From CommonJS, load it with a dynamic import:
40+
41+
```js
42+
const loader = (await import("@assemblyscript/loader")).default;
43+
```
44+
45+
Node.js 20.19+ and 22.12+ also accept a plain `require` of an ES module.
46+
4247
## Usage
4348

4449
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

lib/loader/index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,12 @@ export declare function demangle<T extends Record<string,unknown>>(
122122
exports: Record<string,unknown>,
123123
extendedExports?: Record<string,unknown>
124124
): T;
125+
126+
declare const _default: {
127+
instantiate: typeof instantiate,
128+
instantiateSync: typeof instantiateSync,
129+
instantiateStreaming: typeof instantiateStreaming,
130+
demangle: typeof demangle
131+
};
132+
133+
export default _default;

0 commit comments

Comments
 (0)