@blockcast/mmt-wasm 0.0.0-stage → 0.1.0-main.819f0bc45df3

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/README.md CHANGED
@@ -1,3 +1,48 @@
1
- # Temporary Holding Version
1
+ # @blockcast/mmt-wasm
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The libmmt Rust core (RaptorQ FEC, MMTP MFU reassembly) as wasm-bindgen output,
4
+ in the two shapes its consumers need:
5
+
6
+ | Entry point | Form | Consumer |
7
+ | --- | --- | --- |
8
+ | `@blockcast/mmt-wasm` | ES module (`--target web`) | hang's `js/watch` |
9
+ | `@blockcast/mmt-wasm/no-modules` | global script (`--target no-modules`) | pim's Shaka page, whose Closure build cannot take an ES module |
10
+
11
+ Each wrapper ships with the `.wasm` from its own out-dir and loads it as a
12
+ sibling, so both are also exported by path for callers that need the URL:
13
+
14
+ ```js
15
+ // ESM
16
+ import init, { MmtFecDecoder } from "@blockcast/mmt-wasm"
17
+ await init()
18
+
19
+ // Global script: serve pkg-no-modules/ and load the wrapper with a <script>
20
+ // tag, then hand wasm_bindgen the URL its .wasm is served from.
21
+ await wasm_bindgen("/vendor/mmt-wasm/mmt_wasm_bg.wasm")
22
+ const decoder = new wasm_bindgen.MmtFecDecoder(/* ... */)
23
+ ```
24
+
25
+ Called with no argument, the global wrapper derives the URL from its own
26
+ `<script src>` by replacing `.js` with `_bg.wasm` — so serving the two files
27
+ side by side works without passing anything.
28
+
29
+ ## Building
30
+
31
+ `pkg/` and `pkg-no-modules/` are generated and **never committed** — they are
32
+ gitignored, and `make check-source-artifacts` fails if either is ever tracked.
33
+ Produce them with the canonical target, which builds both and stages them here:
34
+
35
+ ```sh
36
+ BLOCKCAST_MMT_WASM_BUILD_ROOT=/tmp/blockcast-mmt-wasm make mmt-wasm
37
+ ```
38
+
39
+ The build root must live outside the repository. `make stage-mmt-wasm` re-stages
40
+ from an existing build root without rebuilding.
41
+
42
+ `npm test` runs the build contract: it packs the package, asserts every
43
+ `exports` target and both wrapper/`.wasm` pairs are in the tarball, and
44
+ instantiates both forms from a scratch install. Run it after `make mmt-wasm`;
45
+ with nothing staged it fails, which is the intended signal. `make clean`
46
+ unstages both directories to get back to that state — they are gitignored, so
47
+ nothing else removes them and the contract would otherwise keep validating
48
+ whatever was staged last.
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@blockcast/mmt-wasm",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-main.819f0bc45df3",
4
+ "description": "wasm-bindgen builds of the libmmt Rust core (RaptorQ FEC, MMTP MFU reassembly): `pkg` for ESM bundlers and `pkg-no-modules` as a global script for Closure-compiled pages",
5
+ "main": "pkg/mmt_wasm.js",
6
+ "types": "pkg/mmt_wasm.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./pkg/mmt_wasm.d.ts",
10
+ "import": "./pkg/mmt_wasm.js"
11
+ },
12
+ "./mmt_wasm_bg.wasm": "./pkg/mmt_wasm_bg.wasm",
13
+ "./no-modules": {
14
+ "types": "./pkg-no-modules/mmt_wasm.d.ts",
15
+ "default": "./pkg-no-modules/mmt_wasm.js"
16
+ },
17
+ "./no-modules/mmt_wasm_bg.wasm": "./pkg-no-modules/mmt_wasm_bg.wasm",
18
+ "./package.json": "./package.json"
19
+ },
20
+ "files": [
21
+ "pkg",
22
+ "pkg-no-modules"
23
+ ],
24
+ "scripts": {
25
+ "build": "make -C ../.. mmt-wasm",
26
+ "test": "node build-contract.test.mjs"
27
+ },
28
+ "keywords": [
29
+ "mmt",
30
+ "mmtp",
31
+ "raptorq",
32
+ "wasm"
33
+ ],
34
+ "license": "Apache-2.0",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/Blockcast/libmmt.git",
38
+ "directory": "packages/mmt-wasm"
39
+ }
40
+ }