@embedpdf/engine-runtime-wasm32 3.0.0-next.0

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.
Binary file
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "version": "3.0.0-next.0",
3
+ "license": "Apache-2.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "name": "@embedpdf/engine-runtime-wasm32",
8
+ "type": "module",
9
+ "main": "./lib/embedpdf.node.cjs",
10
+ "module": "./lib/embedpdf.browser.js",
11
+ "exports": {
12
+ ".": {
13
+ "node": {
14
+ "import": "./lib/embedpdf.node.js",
15
+ "require": "./lib/embedpdf.node.cjs"
16
+ },
17
+ "default": "./lib/embedpdf.browser.js"
18
+ },
19
+ "./embedpdf.wasm": "./lib/embedpdf.wasm",
20
+ "./wasm-url": {
21
+ "types": "./wasm-url.d.ts",
22
+ "default": "./wasm-url.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "lib",
27
+ "wasm-url.js",
28
+ "wasm-url.d.ts",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/embedpdf/embed-pdf-viewer.git",
35
+ "directory": "packages/engine/runtime/npm/wasm32"
36
+ }
37
+ }
package/wasm-url.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /** URL of `lib/embedpdf.wasm`, resolved by the consumer's bundler (or at
2
+ * runtime for native ESM). See wasm-url.js for the full contract. */
3
+ declare const url: string;
4
+ export default url;
package/wasm-url.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The bundler-facing wasm location contract (`@embedpdf/engine-runtime-wasm32/wasm-url`).
3
+ *
4
+ * Bundlers that support the static `new URL(..., import.meta.url)` asset form
5
+ * (webpack 5 / Next, Vite build, Turbopack, Rspack, Parcel 2) resolve this at
6
+ * BUILD time: they copy `lib/embedpdf.wasm` into the application's build output
7
+ * and rewrite this expression to the emitted asset's URL. That is what makes
8
+ * `localEngine()` zero-config — the wasm ships inside the consumer's build,
9
+ * versioned in lockstep with node_modules, no CDN involved.
10
+ *
11
+ * Toolchains that leave the expression untouched resolve it at RUNTIME against
12
+ * wherever this file actually lives — correct for native ESM served from real
13
+ * files (e.g. a CDN mirroring the npm layout), wrong for flattened bundles
14
+ * (plain esbuild), where the resulting fetch fails and the engine falls back
15
+ * to its pinned CDN URL (see @embedpdf/engine's wasm-source.ts).
16
+ *
17
+ * Lives at the package root: lib/ is regenerated by build/compile.esm.sh.
18
+ */
19
+ export default new URL('./lib/embedpdf.wasm', import.meta.url).href;