@qrcommunication/gigapdf-lib 0.63.0 → 0.64.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.
- package/CHANGELOG.md +38 -0
- package/dist/index.cjs +34 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -63
- package/dist/index.d.ts +18 -63
- package/dist/index.js +35 -123
- package/dist/index.js.map +1 -1
- package/dist/node-fs.browser.cjs +3 -13
- package/dist/node-fs.browser.cjs.map +1 -1
- package/dist/node-fs.browser.d.cts +3 -10
- package/dist/node-fs.browser.d.ts +3 -10
- package/dist/node-fs.browser.js +2 -10
- package/dist/node-fs.browser.js.map +1 -1
- package/dist/node-fs.cjs +2 -37
- package/dist/node-fs.cjs.map +1 -1
- package/dist/node-fs.d.cts +1 -11
- package/dist/node-fs.d.ts +1 -11
- package/dist/node-fs.js +1 -34
- package/dist/node-fs.js.map +1 -1
- package/gigapdf.wasm +0 -0
- package/package.json +1 -1
- package/models/ocr_alpha.gpocr +0 -0
- package/models/ocr_alpha_big.gpocr +0 -0
- package/models/ocr_alpha_hw.gpocr +0 -0
- package/models/ocr_alpha_photo.gpocr +0 -0
- package/models/ocr_alpha_print.gpocr +0 -0
- package/models/ocr_arabic.gpocr +0 -0
- package/models/ocr_arabic_small.gpocr +0 -0
- package/models/ocr_beng.gpocr +0 -0
- package/models/ocr_beng_small.gpocr +0 -0
- package/models/ocr_cjk.gpocr +0 -0
- package/models/ocr_deva.gpocr +0 -0
- package/models/ocr_deva_small.gpocr +0 -0
- package/models/ocr_jpn.gpocr +0 -0
- package/models/ocr_kann.gpocr +0 -0
- package/models/ocr_kor.gpocr +0 -0
- package/models/ocr_mlym.gpocr +0 -0
- package/models/ocr_taml.gpocr +0 -0
- package/models/ocr_taml_small.gpocr +0 -0
- package/models/ocr_telu.gpocr +0 -0
- package/models/ocr_thai.gpocr +0 -0
package/dist/node-fs.browser.cjs
CHANGED
|
@@ -20,25 +20,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/node-fs.browser.ts
|
|
21
21
|
var node_fs_browser_exports = {};
|
|
22
22
|
__export(node_fs_browser_exports, {
|
|
23
|
-
loadDefaultWasmBytes: () => loadDefaultWasmBytes
|
|
24
|
-
readModelFile: () => readModelFile,
|
|
25
|
-
readModelsDir: () => readModelsDir
|
|
23
|
+
loadDefaultWasmBytes: () => loadDefaultWasmBytes
|
|
26
24
|
});
|
|
27
25
|
module.exports = __toCommonJS(node_fs_browser_exports);
|
|
28
|
-
var NODE_ONLY = "gigapdf-lib: this loader is Node-only \u2014 in the browser, pass bytes or a URL to load()
|
|
26
|
+
var NODE_ONLY = "gigapdf-lib: this loader is Node-only \u2014 in the browser, pass bytes or a URL to load() instead";
|
|
29
27
|
async function loadDefaultWasmBytes() {
|
|
30
28
|
throw new Error(NODE_ONLY);
|
|
31
29
|
}
|
|
32
|
-
async function readModelFile(_fileName) {
|
|
33
|
-
throw new Error(NODE_ONLY);
|
|
34
|
-
}
|
|
35
|
-
async function readModelsDir() {
|
|
36
|
-
throw new Error(NODE_ONLY);
|
|
37
|
-
}
|
|
38
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
31
|
0 && (module.exports = {
|
|
40
|
-
loadDefaultWasmBytes
|
|
41
|
-
readModelFile,
|
|
42
|
-
readModelsDir
|
|
32
|
+
loadDefaultWasmBytes
|
|
43
33
|
});
|
|
44
34
|
//# sourceMappingURL=node-fs.browser.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/node-fs.browser.ts"],"sourcesContent":["/**\n * Browser stub for the Node-only filesystem loaders.\n *\n * This file is substituted for `node-fs.ts` in browser bundles via the\n * package.json `\"browser\"` field. It contains NO reference to `node:fs`/\n * `node:url`, so browser bundlers (Turbopack, webpack, Vite) have nothing to\n * resolve.
|
|
1
|
+
{"version":3,"sources":["../src/node-fs.browser.ts"],"sourcesContent":["/**\n * Browser stub for the Node-only filesystem loaders.\n *\n * This file is substituted for `node-fs.ts` in browser bundles via the\n * package.json `\"browser\"` field. It contains NO reference to `node:fs`/\n * `node:url`, so browser bundlers (Turbopack, webpack, Vite) have nothing to\n * resolve. The loader throws — in the browser you must pass bytes or a URL to\n * `GigaPdfEngine.load()` instead.\n */\n\nconst NODE_ONLY =\n \"gigapdf-lib: this loader is Node-only — in the browser, pass bytes or a URL to load() instead\";\n\n/** Browser stub — throws; pass bytes/URL to `GigaPdfEngine.load()` instead. */\nexport async function loadDefaultWasmBytes(): Promise<Uint8Array> {\n throw new Error(NODE_ONLY);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,YACJ;AAGF,eAAsB,uBAA4C;AAChE,QAAM,IAAI,MAAM,SAAS;AAC3B;","names":[]}
|
|
@@ -4,17 +4,10 @@
|
|
|
4
4
|
* This file is substituted for `node-fs.ts` in browser bundles via the
|
|
5
5
|
* package.json `"browser"` field. It contains NO reference to `node:fs`/
|
|
6
6
|
* `node:url`, so browser bundlers (Turbopack, webpack, Vite) have nothing to
|
|
7
|
-
* resolve.
|
|
8
|
-
* `GigaPdfEngine.load()`
|
|
7
|
+
* resolve. The loader throws — in the browser you must pass bytes or a URL to
|
|
8
|
+
* `GigaPdfEngine.load()` instead.
|
|
9
9
|
*/
|
|
10
10
|
/** Browser stub — throws; pass bytes/URL to `GigaPdfEngine.load()` instead. */
|
|
11
11
|
declare function loadDefaultWasmBytes(): Promise<Uint8Array>;
|
|
12
|
-
/** Browser stub — throws; pass model bytes to `loadOcrModel()` instead. */
|
|
13
|
-
declare function readModelFile(_fileName: string): Promise<Uint8Array>;
|
|
14
|
-
/** Browser stub — throws; load OCR models from bytes instead. */
|
|
15
|
-
declare function readModelsDir(): Promise<{
|
|
16
|
-
name: string;
|
|
17
|
-
bytes: Uint8Array;
|
|
18
|
-
}[]>;
|
|
19
12
|
|
|
20
|
-
export { loadDefaultWasmBytes
|
|
13
|
+
export { loadDefaultWasmBytes };
|
|
@@ -4,17 +4,10 @@
|
|
|
4
4
|
* This file is substituted for `node-fs.ts` in browser bundles via the
|
|
5
5
|
* package.json `"browser"` field. It contains NO reference to `node:fs`/
|
|
6
6
|
* `node:url`, so browser bundlers (Turbopack, webpack, Vite) have nothing to
|
|
7
|
-
* resolve.
|
|
8
|
-
* `GigaPdfEngine.load()`
|
|
7
|
+
* resolve. The loader throws — in the browser you must pass bytes or a URL to
|
|
8
|
+
* `GigaPdfEngine.load()` instead.
|
|
9
9
|
*/
|
|
10
10
|
/** Browser stub — throws; pass bytes/URL to `GigaPdfEngine.load()` instead. */
|
|
11
11
|
declare function loadDefaultWasmBytes(): Promise<Uint8Array>;
|
|
12
|
-
/** Browser stub — throws; pass model bytes to `loadOcrModel()` instead. */
|
|
13
|
-
declare function readModelFile(_fileName: string): Promise<Uint8Array>;
|
|
14
|
-
/** Browser stub — throws; load OCR models from bytes instead. */
|
|
15
|
-
declare function readModelsDir(): Promise<{
|
|
16
|
-
name: string;
|
|
17
|
-
bytes: Uint8Array;
|
|
18
|
-
}[]>;
|
|
19
12
|
|
|
20
|
-
export { loadDefaultWasmBytes
|
|
13
|
+
export { loadDefaultWasmBytes };
|
package/dist/node-fs.browser.js
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
// src/node-fs.browser.ts
|
|
2
|
-
var NODE_ONLY = "gigapdf-lib: this loader is Node-only \u2014 in the browser, pass bytes or a URL to load()
|
|
2
|
+
var NODE_ONLY = "gigapdf-lib: this loader is Node-only \u2014 in the browser, pass bytes or a URL to load() instead";
|
|
3
3
|
async function loadDefaultWasmBytes() {
|
|
4
4
|
throw new Error(NODE_ONLY);
|
|
5
5
|
}
|
|
6
|
-
async function readModelFile(_fileName) {
|
|
7
|
-
throw new Error(NODE_ONLY);
|
|
8
|
-
}
|
|
9
|
-
async function readModelsDir() {
|
|
10
|
-
throw new Error(NODE_ONLY);
|
|
11
|
-
}
|
|
12
6
|
export {
|
|
13
|
-
loadDefaultWasmBytes
|
|
14
|
-
readModelFile,
|
|
15
|
-
readModelsDir
|
|
7
|
+
loadDefaultWasmBytes
|
|
16
8
|
};
|
|
17
9
|
//# sourceMappingURL=node-fs.browser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/node-fs.browser.ts"],"sourcesContent":["/**\n * Browser stub for the Node-only filesystem loaders.\n *\n * This file is substituted for `node-fs.ts` in browser bundles via the\n * package.json `\"browser\"` field. It contains NO reference to `node:fs`/\n * `node:url`, so browser bundlers (Turbopack, webpack, Vite) have nothing to\n * resolve.
|
|
1
|
+
{"version":3,"sources":["../src/node-fs.browser.ts"],"sourcesContent":["/**\n * Browser stub for the Node-only filesystem loaders.\n *\n * This file is substituted for `node-fs.ts` in browser bundles via the\n * package.json `\"browser\"` field. It contains NO reference to `node:fs`/\n * `node:url`, so browser bundlers (Turbopack, webpack, Vite) have nothing to\n * resolve. The loader throws — in the browser you must pass bytes or a URL to\n * `GigaPdfEngine.load()` instead.\n */\n\nconst NODE_ONLY =\n \"gigapdf-lib: this loader is Node-only — in the browser, pass bytes or a URL to load() instead\";\n\n/** Browser stub — throws; pass bytes/URL to `GigaPdfEngine.load()` instead. */\nexport async function loadDefaultWasmBytes(): Promise<Uint8Array> {\n throw new Error(NODE_ONLY);\n}\n"],"mappings":";AAUA,IAAM,YACJ;AAGF,eAAsB,uBAA4C;AAChE,QAAM,IAAI,MAAM,SAAS;AAC3B;","names":[]}
|
package/dist/node-fs.cjs
CHANGED
|
@@ -20,9 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/node-fs.ts
|
|
21
21
|
var node_fs_exports = {};
|
|
22
22
|
__export(node_fs_exports, {
|
|
23
|
-
loadDefaultWasmBytes: () => loadDefaultWasmBytes
|
|
24
|
-
readModelFile: () => readModelFile,
|
|
25
|
-
readModelsDir: () => readModelsDir
|
|
23
|
+
loadDefaultWasmBytes: () => loadDefaultWasmBytes
|
|
26
24
|
});
|
|
27
25
|
module.exports = __toCommonJS(node_fs_exports);
|
|
28
26
|
|
|
@@ -40,10 +38,6 @@ async function fsReadFile() {
|
|
|
40
38
|
const { readFile } = await nodeImport("node:fs/promises");
|
|
41
39
|
return readFile;
|
|
42
40
|
}
|
|
43
|
-
async function fsReaddir() {
|
|
44
|
-
const { readdir } = await nodeImport("node:fs/promises");
|
|
45
|
-
return readdir;
|
|
46
|
-
}
|
|
47
41
|
async function urlToPath() {
|
|
48
42
|
const { fileURLToPath } = await nodeImport("node:url");
|
|
49
43
|
return fileURLToPath;
|
|
@@ -53,37 +47,8 @@ async function loadDefaultWasmBytes() {
|
|
|
53
47
|
const wasmPath = fileURLToPath(new URL("../gigapdf.wasm", importMetaUrl));
|
|
54
48
|
return readFile(wasmPath);
|
|
55
49
|
}
|
|
56
|
-
async function readModelFile(fileName) {
|
|
57
|
-
const [readFile, fileURLToPath] = await Promise.all([fsReadFile(), urlToPath()]);
|
|
58
|
-
const path = fileURLToPath(new URL(`../models/${fileName}`, importMetaUrl));
|
|
59
|
-
return readFile(path);
|
|
60
|
-
}
|
|
61
|
-
async function readModelsDir() {
|
|
62
|
-
const [readFile, readdir, fileURLToPath] = await Promise.all([
|
|
63
|
-
fsReadFile(),
|
|
64
|
-
fsReaddir(),
|
|
65
|
-
urlToPath()
|
|
66
|
-
]);
|
|
67
|
-
let entries;
|
|
68
|
-
try {
|
|
69
|
-
entries = await readdir(fileURLToPath(new URL("../models/", importMetaUrl)));
|
|
70
|
-
} catch {
|
|
71
|
-
return [];
|
|
72
|
-
}
|
|
73
|
-
const out = [];
|
|
74
|
-
for (const name of entries) {
|
|
75
|
-
if (!name.endsWith(".gpocr")) continue;
|
|
76
|
-
const bytes = await readFile(
|
|
77
|
-
fileURLToPath(new URL(`../models/${name}`, importMetaUrl))
|
|
78
|
-
);
|
|
79
|
-
out.push({ name, bytes });
|
|
80
|
-
}
|
|
81
|
-
return out;
|
|
82
|
-
}
|
|
83
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
84
51
|
0 && (module.exports = {
|
|
85
|
-
loadDefaultWasmBytes
|
|
86
|
-
readModelFile,
|
|
87
|
-
readModelsDir
|
|
52
|
+
loadDefaultWasmBytes
|
|
88
53
|
});
|
|
89
54
|
//# sourceMappingURL=node-fs.cjs.map
|
package/dist/node-fs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/node-fs.ts","../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.15_typescript@6.0.3/node_modules/tsup/assets/cjs_shims.js"],"sourcesContent":["/**\n * Node-only filesystem loaders for gigapdf-lib.\n *\n * This module is the ONLY place that touches Node's `fs`/`url` modules. It is\n * swapped out for `node-fs.browser.ts` via the package.json `\"browser\"` field\n * so that browser bundlers (Turbopack, webpack, Vite) never see a reference to\n * `node:fs/promises` / `node:url` and never try to resolve them.\n *\n * The relative paths below are resolved from the built module (`dist/node-fs.js`)\n * to the package root via the `import.meta.url` shim injected by tsup (`shims`),\n * exactly like the previous in-`index.ts` resolution did from `dist/index.js`.\n */\n\n/**\n * Indirect the specifier through a variable so any bundler that still evaluates\n * this module (it shouldn't in the browser, thanks to the `\"browser\"` mapping)\n * doesn't statically resolve these Node-only modules.\n */\nconst nodeImport = (m: string): Promise<Record<string, unknown>> =>\n import(/* webpackIgnore: true */ /* @vite-ignore */ m);\n\nasync function fsReadFile(): Promise<(p: string) => Promise<Uint8Array>> {\n const { readFile } = (await nodeImport(\"node:fs/promises\")) as {\n readFile: (p: string) => Promise<Uint8Array>;\n };\n return readFile;\n}\n\nasync function
|
|
1
|
+
{"version":3,"sources":["../src/node-fs.ts","../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.15_typescript@6.0.3/node_modules/tsup/assets/cjs_shims.js"],"sourcesContent":["/**\n * Node-only filesystem loaders for gigapdf-lib.\n *\n * This module is the ONLY place that touches Node's `fs`/`url` modules. It is\n * swapped out for `node-fs.browser.ts` via the package.json `\"browser\"` field\n * so that browser bundlers (Turbopack, webpack, Vite) never see a reference to\n * `node:fs/promises` / `node:url` and never try to resolve them.\n *\n * The relative paths below are resolved from the built module (`dist/node-fs.js`)\n * to the package root via the `import.meta.url` shim injected by tsup (`shims`),\n * exactly like the previous in-`index.ts` resolution did from `dist/index.js`.\n */\n\n/**\n * Indirect the specifier through a variable so any bundler that still evaluates\n * this module (it shouldn't in the browser, thanks to the `\"browser\"` mapping)\n * doesn't statically resolve these Node-only modules.\n */\nconst nodeImport = (m: string): Promise<Record<string, unknown>> =>\n import(/* webpackIgnore: true */ /* @vite-ignore */ m);\n\nasync function fsReadFile(): Promise<(p: string) => Promise<Uint8Array>> {\n const { readFile } = (await nodeImport(\"node:fs/promises\")) as {\n readFile: (p: string) => Promise<Uint8Array>;\n };\n return readFile;\n}\n\nasync function urlToPath(): Promise<(u: URL) => string> {\n const { fileURLToPath } = (await nodeImport(\"node:url\")) as {\n fileURLToPath: (u: URL) => string;\n };\n return fileURLToPath;\n}\n\n/** Read the bundled `gigapdf.wasm` shipped inside this package. */\nexport async function loadDefaultWasmBytes(): Promise<Uint8Array> {\n const [readFile, fileURLToPath] = await Promise.all([fsReadFile(), urlToPath()]);\n const wasmPath = fileURLToPath(new URL(\"../gigapdf.wasm\", import.meta.url));\n return readFile(wasmPath);\n}\n\n// OCR models are no longer bundled in this package — OCR runs host-side via the\n// `gigapdf-ocr-rten` crate (PaddleOCR + RTen). The `.gpocr` readers were removed.\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ADM9D,IAAM,aAAa,CAAC,MAClB;AAAA;AAAA;AAAA,EAAoD;AAAA;AAEtD,eAAe,aAA0D;AACvE,QAAM,EAAE,SAAS,IAAK,MAAM,WAAW,kBAAkB;AAGzD,SAAO;AACT;AAEA,eAAe,YAAyC;AACtD,QAAM,EAAE,cAAc,IAAK,MAAM,WAAW,UAAU;AAGtD,SAAO;AACT;AAGA,eAAsB,uBAA4C;AAChE,QAAM,CAAC,UAAU,aAAa,IAAI,MAAM,QAAQ,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,CAAC;AAC/E,QAAM,WAAW,cAAc,IAAI,IAAI,mBAAmB,aAAe,CAAC;AAC1E,SAAO,SAAS,QAAQ;AAC1B;","names":[]}
|
package/dist/node-fs.d.cts
CHANGED
|
@@ -12,15 +12,5 @@
|
|
|
12
12
|
*/
|
|
13
13
|
/** Read the bundled `gigapdf.wasm` shipped inside this package. */
|
|
14
14
|
declare function loadDefaultWasmBytes(): Promise<Uint8Array>;
|
|
15
|
-
/** Read a single bundled `.gpocr` model by its filename (under `models/`). */
|
|
16
|
-
declare function readModelFile(fileName: string): Promise<Uint8Array>;
|
|
17
|
-
/**
|
|
18
|
-
* Discover every bundled `.gpocr` model and return its name + bytes.
|
|
19
|
-
* Returns an empty list if the `models/` directory is absent (slimmed install).
|
|
20
|
-
*/
|
|
21
|
-
declare function readModelsDir(): Promise<{
|
|
22
|
-
name: string;
|
|
23
|
-
bytes: Uint8Array;
|
|
24
|
-
}[]>;
|
|
25
15
|
|
|
26
|
-
export { loadDefaultWasmBytes
|
|
16
|
+
export { loadDefaultWasmBytes };
|
package/dist/node-fs.d.ts
CHANGED
|
@@ -12,15 +12,5 @@
|
|
|
12
12
|
*/
|
|
13
13
|
/** Read the bundled `gigapdf.wasm` shipped inside this package. */
|
|
14
14
|
declare function loadDefaultWasmBytes(): Promise<Uint8Array>;
|
|
15
|
-
/** Read a single bundled `.gpocr` model by its filename (under `models/`). */
|
|
16
|
-
declare function readModelFile(fileName: string): Promise<Uint8Array>;
|
|
17
|
-
/**
|
|
18
|
-
* Discover every bundled `.gpocr` model and return its name + bytes.
|
|
19
|
-
* Returns an empty list if the `models/` directory is absent (slimmed install).
|
|
20
|
-
*/
|
|
21
|
-
declare function readModelsDir(): Promise<{
|
|
22
|
-
name: string;
|
|
23
|
-
bytes: Uint8Array;
|
|
24
|
-
}[]>;
|
|
25
15
|
|
|
26
|
-
export { loadDefaultWasmBytes
|
|
16
|
+
export { loadDefaultWasmBytes };
|
package/dist/node-fs.js
CHANGED
|
@@ -8,10 +8,6 @@ async function fsReadFile() {
|
|
|
8
8
|
const { readFile } = await nodeImport("node:fs/promises");
|
|
9
9
|
return readFile;
|
|
10
10
|
}
|
|
11
|
-
async function fsReaddir() {
|
|
12
|
-
const { readdir } = await nodeImport("node:fs/promises");
|
|
13
|
-
return readdir;
|
|
14
|
-
}
|
|
15
11
|
async function urlToPath() {
|
|
16
12
|
const { fileURLToPath } = await nodeImport("node:url");
|
|
17
13
|
return fileURLToPath;
|
|
@@ -21,36 +17,7 @@ async function loadDefaultWasmBytes() {
|
|
|
21
17
|
const wasmPath = fileURLToPath(new URL("../gigapdf.wasm", import.meta.url));
|
|
22
18
|
return readFile(wasmPath);
|
|
23
19
|
}
|
|
24
|
-
async function readModelFile(fileName) {
|
|
25
|
-
const [readFile, fileURLToPath] = await Promise.all([fsReadFile(), urlToPath()]);
|
|
26
|
-
const path = fileURLToPath(new URL(`../models/${fileName}`, import.meta.url));
|
|
27
|
-
return readFile(path);
|
|
28
|
-
}
|
|
29
|
-
async function readModelsDir() {
|
|
30
|
-
const [readFile, readdir, fileURLToPath] = await Promise.all([
|
|
31
|
-
fsReadFile(),
|
|
32
|
-
fsReaddir(),
|
|
33
|
-
urlToPath()
|
|
34
|
-
]);
|
|
35
|
-
let entries;
|
|
36
|
-
try {
|
|
37
|
-
entries = await readdir(fileURLToPath(new URL("../models/", import.meta.url)));
|
|
38
|
-
} catch {
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
const out = [];
|
|
42
|
-
for (const name of entries) {
|
|
43
|
-
if (!name.endsWith(".gpocr")) continue;
|
|
44
|
-
const bytes = await readFile(
|
|
45
|
-
fileURLToPath(new URL(`../models/${name}`, import.meta.url))
|
|
46
|
-
);
|
|
47
|
-
out.push({ name, bytes });
|
|
48
|
-
}
|
|
49
|
-
return out;
|
|
50
|
-
}
|
|
51
20
|
export {
|
|
52
|
-
loadDefaultWasmBytes
|
|
53
|
-
readModelFile,
|
|
54
|
-
readModelsDir
|
|
21
|
+
loadDefaultWasmBytes
|
|
55
22
|
};
|
|
56
23
|
//# sourceMappingURL=node-fs.js.map
|
package/dist/node-fs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/node-fs.ts"],"sourcesContent":["/**\n * Node-only filesystem loaders for gigapdf-lib.\n *\n * This module is the ONLY place that touches Node's `fs`/`url` modules. It is\n * swapped out for `node-fs.browser.ts` via the package.json `\"browser\"` field\n * so that browser bundlers (Turbopack, webpack, Vite) never see a reference to\n * `node:fs/promises` / `node:url` and never try to resolve them.\n *\n * The relative paths below are resolved from the built module (`dist/node-fs.js`)\n * to the package root via the `import.meta.url` shim injected by tsup (`shims`),\n * exactly like the previous in-`index.ts` resolution did from `dist/index.js`.\n */\n\n/**\n * Indirect the specifier through a variable so any bundler that still evaluates\n * this module (it shouldn't in the browser, thanks to the `\"browser\"` mapping)\n * doesn't statically resolve these Node-only modules.\n */\nconst nodeImport = (m: string): Promise<Record<string, unknown>> =>\n import(/* webpackIgnore: true */ /* @vite-ignore */ m);\n\nasync function fsReadFile(): Promise<(p: string) => Promise<Uint8Array>> {\n const { readFile } = (await nodeImport(\"node:fs/promises\")) as {\n readFile: (p: string) => Promise<Uint8Array>;\n };\n return readFile;\n}\n\nasync function
|
|
1
|
+
{"version":3,"sources":["../src/node-fs.ts"],"sourcesContent":["/**\n * Node-only filesystem loaders for gigapdf-lib.\n *\n * This module is the ONLY place that touches Node's `fs`/`url` modules. It is\n * swapped out for `node-fs.browser.ts` via the package.json `\"browser\"` field\n * so that browser bundlers (Turbopack, webpack, Vite) never see a reference to\n * `node:fs/promises` / `node:url` and never try to resolve them.\n *\n * The relative paths below are resolved from the built module (`dist/node-fs.js`)\n * to the package root via the `import.meta.url` shim injected by tsup (`shims`),\n * exactly like the previous in-`index.ts` resolution did from `dist/index.js`.\n */\n\n/**\n * Indirect the specifier through a variable so any bundler that still evaluates\n * this module (it shouldn't in the browser, thanks to the `\"browser\"` mapping)\n * doesn't statically resolve these Node-only modules.\n */\nconst nodeImport = (m: string): Promise<Record<string, unknown>> =>\n import(/* webpackIgnore: true */ /* @vite-ignore */ m);\n\nasync function fsReadFile(): Promise<(p: string) => Promise<Uint8Array>> {\n const { readFile } = (await nodeImport(\"node:fs/promises\")) as {\n readFile: (p: string) => Promise<Uint8Array>;\n };\n return readFile;\n}\n\nasync function urlToPath(): Promise<(u: URL) => string> {\n const { fileURLToPath } = (await nodeImport(\"node:url\")) as {\n fileURLToPath: (u: URL) => string;\n };\n return fileURLToPath;\n}\n\n/** Read the bundled `gigapdf.wasm` shipped inside this package. */\nexport async function loadDefaultWasmBytes(): Promise<Uint8Array> {\n const [readFile, fileURLToPath] = await Promise.all([fsReadFile(), urlToPath()]);\n const wasmPath = fileURLToPath(new URL(\"../gigapdf.wasm\", import.meta.url));\n return readFile(wasmPath);\n}\n\n// OCR models are no longer bundled in this package — OCR runs host-side via the\n// `gigapdf-ocr-rten` crate (PaddleOCR + RTen). The `.gpocr` readers were removed.\n"],"mappings":";AAkBA,IAAM,aAAa,CAAC,MAClB;AAAA;AAAA;AAAA,EAAoD;AAAA;AAEtD,eAAe,aAA0D;AACvE,QAAM,EAAE,SAAS,IAAK,MAAM,WAAW,kBAAkB;AAGzD,SAAO;AACT;AAEA,eAAe,YAAyC;AACtD,QAAM,EAAE,cAAc,IAAK,MAAM,WAAW,UAAU;AAGtD,SAAO;AACT;AAGA,eAAsB,uBAA4C;AAChE,QAAM,CAAC,UAAU,aAAa,IAAI,MAAM,QAAQ,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,CAAC;AAC/E,QAAM,WAAW,cAAc,IAAI,IAAI,mBAAmB,YAAY,GAAG,CAAC;AAC1E,SAAO,SAAS,QAAQ;AAC1B;","names":[]}
|
package/gigapdf.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qrcommunication/gigapdf-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"description": "TypeScript SDK for gigapdf-lib — a Rust→WASM document engine with no third-party PDF/Office/image library: read/edit/render, OCR, full-text search, AcroForm fields (read · fill · create), annotations, signing, encryption, PDF↔Office/HTML/RTF conversions, and a native HTML+CSS→PDF renderer with inline JavaScript (no headless browser). Cryptography uses audited RustCrypto; JavaScript uses the Boa engine; everything else is pure Rust. Single wasm-bindgen-free .wasm with one host import (entropy).",
|
|
5
5
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"author": "Rony Licha / QR Communication",
|
package/models/ocr_alpha.gpocr
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/models/ocr_arabic.gpocr
DELETED
|
Binary file
|
|
Binary file
|
package/models/ocr_beng.gpocr
DELETED
|
Binary file
|
|
Binary file
|
package/models/ocr_cjk.gpocr
DELETED
|
Binary file
|
package/models/ocr_deva.gpocr
DELETED
|
Binary file
|
|
Binary file
|
package/models/ocr_jpn.gpocr
DELETED
|
Binary file
|
package/models/ocr_kann.gpocr
DELETED
|
Binary file
|
package/models/ocr_kor.gpocr
DELETED
|
Binary file
|
package/models/ocr_mlym.gpocr
DELETED
|
Binary file
|
package/models/ocr_taml.gpocr
DELETED
|
Binary file
|
|
Binary file
|
package/models/ocr_telu.gpocr
DELETED
|
Binary file
|
package/models/ocr_thai.gpocr
DELETED
|
Binary file
|