@embedpdf/engine-runtime 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.
@@ -0,0 +1,26 @@
1
+ import type { PdfRuntimeModule } from '../core/pdf-runtime-module';
2
+ export type LegacyType = null | 'number' | 'string' | 'boolean';
3
+ export type LegacyWrappedPdfiumModule = {
4
+ pdfium: {
5
+ HEAPU8: {
6
+ subarray(begin: number, end?: number): Uint8Array;
7
+ slice(begin: number, end?: number): Uint8Array;
8
+ };
9
+ cwrap: (name: string, result: LegacyType, params: readonly LegacyType[]) => (...args: any[]) => any;
10
+ getValue: (ptr: number, type: string) => number | bigint;
11
+ setValue: (ptr: number, value: number | bigint, type: string) => void;
12
+ UTF8ToString: (ptr: number) => string;
13
+ UTF16ToString: (ptr: number) => string;
14
+ stringToUTF8: (str: string, ptr: number, maxBytes: number) => void;
15
+ stringToUTF16: (str: string, ptr: number, maxBytes: number) => void;
16
+ addFunction: (fn: (...args: unknown[]) => unknown, signature?: string) => number;
17
+ removeFunction: (ptr: number) => void;
18
+ wasmExports: {
19
+ malloc: (bytes: number) => number;
20
+ free: (ptr: number) => void;
21
+ };
22
+ };
23
+ [name: string]: unknown;
24
+ };
25
+ export declare function toWrappedPdfiumModule(runtime: PdfRuntimeModule): LegacyWrappedPdfiumModule;
26
+ export { toWrappedPdfiumModule as toLegacyWrappedModule };
@@ -0,0 +1,3 @@
1
+ import type { PdfRuntimeModule } from '../core/pdf-runtime-module';
2
+ import type { RuntimeTarget } from '../core/platform';
3
+ export declare function createNativeRuntime(target: RuntimeTarget): Promise<PdfRuntimeModule>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The public surface COMMON to both entries (`index.browser.ts` /
3
+ * `index.node.ts`). One package name, one API, two physical graphs — the
4
+ * entries add only `createPdfRuntime` + `resolveRuntimeTarget`, each from
5
+ * their own environment's implementation.
6
+ */
7
+ export type { Callback, CallbackFn, CallbackKind, CreatePdfRuntimeOptions, MemoryValueKind, PdfFileAccessHandle, PdfRuntimeFileAccess, PdfRuntimeCallbacks, PdfRuntimeMemory, PdfRuntimeModule, Ptr, } from './core/pdf-runtime-module';
8
+ export { NULL_PTR } from './core/pdf-runtime-module';
9
+ export type { PdfFunctions } from './core/pdf-functions.generated';
10
+ export { packageNameForTarget, type RuntimeTarget } from './core/platform';
11
+ export { toLegacyWrappedModule, toWrappedPdfiumModule, type LegacyWrappedPdfiumModule, } from './legacy/to-wrapped-pdfium-module';
@@ -0,0 +1,2 @@
1
+ import type { CreatePdfRuntimeOptions, PdfRuntimeModule } from '../core/pdf-runtime-module';
2
+ export declare function createWasmRuntime(opts?: CreatePdfRuntimeOptions): Promise<PdfRuntimeModule>;
package/package.json ADDED
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "@embedpdf/engine-runtime",
3
+ "version": "3.0.0-next.0",
4
+ "private": false,
5
+ "description": "Low-level PDF execution runtime for EmbedPDF, backed by EmbedPDF's fork of PDFium and distributed as WASM and native platform packages.",
6
+ "type": "module",
7
+ "license": "Apache-2.0",
8
+ "main": "./dist/index.node.cjs",
9
+ "module": "./dist/index.browser.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "node": {
14
+ "import": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.node.js"
17
+ },
18
+ "require": {
19
+ "types": "./dist/index.d.cts",
20
+ "default": "./dist/index.node.cjs"
21
+ }
22
+ },
23
+ "default": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.browser.js"
26
+ }
27
+ }
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/embedpdf/embed-pdf-viewer.git",
32
+ "directory": "packages/engine/runtime"
33
+ },
34
+ "homepage": "https://www.embedpdf.com",
35
+ "bugs": {
36
+ "url": "https://github.com/embedpdf/embed-pdf-viewer/issues"
37
+ },
38
+ "keywords": [
39
+ "pdf",
40
+ "runtime",
41
+ "wasm",
42
+ "native",
43
+ "embedpdf"
44
+ ],
45
+ "files": [
46
+ "dist",
47
+ "LICENSE",
48
+ "README.md"
49
+ ],
50
+ "dependencies": {
51
+ "detect-libc": "^2.1.2"
52
+ },
53
+ "optionalDependencies": {
54
+ "@embedpdf/engine-runtime-darwin-arm64": "3.0.0-next.0",
55
+ "@embedpdf/engine-runtime-linux-arm64": "3.0.0-next.0",
56
+ "@embedpdf/engine-runtime-darwin-x64": "3.0.0-next.0",
57
+ "@embedpdf/engine-runtime-linux-x64": "3.0.0-next.0",
58
+ "@embedpdf/engine-runtime-linuxmusl-x64": "3.0.0-next.0",
59
+ "@embedpdf/engine-runtime-wasm32": "3.0.0-next.0",
60
+ "@embedpdf/engine-runtime-linuxmusl-arm64": "3.0.0-next.0",
61
+ "@embedpdf/engine-runtime-win32-arm64": "3.0.0-next.0",
62
+ "@embedpdf/engine-runtime-win32-x64": "3.0.0-next.0"
63
+ },
64
+ "devDependencies": {
65
+ "@rollup/plugin-commonjs": "^25.0.8",
66
+ "@rollup/plugin-node-resolve": "^15.2.1",
67
+ "@rollup/plugin-replace": "^5.0.2",
68
+ "@rollup/plugin-typescript": "^12.3.0",
69
+ "@types/emscripten": "^1.39.13",
70
+ "@types/node": "latest",
71
+ "chokidar-cli": "^3.0.0",
72
+ "cmake-js": "^7.3.1",
73
+ "esbuild": "^0.28.1",
74
+ "magic-string": "^0.30.17",
75
+ "rollup": "^4.53.5",
76
+ "rollup-plugin-dts": "^6.3.0",
77
+ "typescript": "^5.0.0"
78
+ },
79
+ "publishConfig": {
80
+ "access": "public"
81
+ },
82
+ "scripts": {
83
+ "build": "rollup -c",
84
+ "build:target": "bash ./scripts/build-target.sh",
85
+ "build:local": "bash ./scripts/build-all-local.sh",
86
+ "clean": "rimraf dist build/libpdfium build/generated npm/*/lib",
87
+ "fetch": "bash ./scripts/fetch-libpdfium.sh",
88
+ "generate:functions": "node ./build/generate-functions.mjs",
89
+ "generate:napi": "node ./build/generate-napi-binding.mjs",
90
+ "generate:runtime-methods": "node ./build/generate-runtime-methods.mjs",
91
+ "lint": "eslint src --color",
92
+ "lint:fix": "eslint src --color --fix",
93
+ "runtime:use-local": "bash ./scripts/runtime-use-local.sh",
94
+ "test:pdfium": "bash ./scripts/test-pdfium.sh",
95
+ "test:pdfium:unit": "PDFIUM_TEST_SUITE=unit bash ./scripts/test-pdfium.sh",
96
+ "test:pdfium:embedder": "PDFIUM_TEST_SUITE=embedder bash ./scripts/test-pdfium.sh",
97
+ "test:pdfium:docker": "bash ./scripts/test-pdfium-docker.sh",
98
+ "test:pdfium:unit:docker": "PDFIUM_TEST_SUITE=unit bash ./scripts/test-pdfium-docker.sh",
99
+ "test:pdfium:embedder:docker": "PDFIUM_TEST_SUITE=embedder bash ./scripts/test-pdfium-docker.sh",
100
+ "test:pdfium:goldens:linux": "PDFIUM_TEST_SUITE=embedder bash ./scripts/test-pdfium-docker.sh --write-pngs",
101
+ "test:parity": "node --test ./test/*.test.mjs",
102
+ "verify:packages": "bash ./scripts/verify-packages.sh",
103
+ "verify:browser-purity": "node ./scripts/verify-browser-purity.mjs",
104
+ "dev": "bash ./scripts/dev.sh",
105
+ "fetch:payload": "bash scripts/fetch-payload.sh"
106
+ }
107
+ }