epub-gen3 0.2.0 → 0.2.1

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.
Files changed (3) hide show
  1. package/browser.js +14 -0
  2. package/index.mjs +4 -0
  3. package/package.json +13 -2
package/browser.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Browser entry-point for epub-gen3.
3
+ *
4
+ * Re-exports the WASM Epub class and a ready promise that resolves once the
5
+ * WASM module is initialised. Import this instead of the raw wasm glue:
6
+ *
7
+ * import { Epub, ready } from 'epub-gen3/browser'
8
+ * await ready
9
+ * const epub = new Epub(info, chapters)
10
+ */
11
+ import init, { Epub } from './wasm/epub_gen_wasm.js'
12
+
13
+ export { Epub }
14
+ export const ready = init()
package/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'
2
+ const require = createRequire(import.meta.url)
3
+ const { Epub } = require('./index.js')
4
+ export { Epub }
package/package.json CHANGED
@@ -1,10 +1,19 @@
1
1
  {
2
2
  "name": "epub-gen3",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Generate EPUB files from Rust — Node.js native addon",
5
5
  "main": "index.js",
6
- "browser": "./wasm/epub_gen_wasm.js",
6
+ "browser": "./browser.js",
7
7
  "types": "index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "browser": "./browser.js",
11
+ "import": "./index.mjs",
12
+ "require": "./index.js"
13
+ },
14
+ "./browser": "./browser.js",
15
+ "./wasm/*": "./wasm/*"
16
+ },
8
17
  "napi": {
9
18
  "name": "epub-gen3",
10
19
  "triples": {
@@ -28,6 +37,8 @@
28
37
  },
29
38
  "files": [
30
39
  "index.js",
40
+ "index.mjs",
41
+ "browser.js",
31
42
  "index.d.ts",
32
43
  "*.node",
33
44
  "wasm/"