@docmentis/udoc-node 0.8.26 → 0.8.27
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/dist/internal.d.ts +3 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +5 -0
- package/dist/internal.js.map +1 -0
- package/dist/node.d.ts +16 -7
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +20 -6
- package/dist/node.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,0EAA0E;AAC1E,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/node.d.ts
CHANGED
|
@@ -19,13 +19,6 @@ export interface UDocNodeOptions {
|
|
|
19
19
|
/** Anonymous per-user id, so usage attributes to one user across sessions.
|
|
20
20
|
* Without one, usage attributes to the domain. */
|
|
21
21
|
distinctId?: string;
|
|
22
|
-
/** The docMentis component embedding the engine, reported with every
|
|
23
|
-
* permit request and usage event. Defaults to this package; `udoc-cli`
|
|
24
|
-
* and `udoc-server` name themselves. */
|
|
25
|
-
wrapper?: {
|
|
26
|
-
name: string;
|
|
27
|
-
version: string;
|
|
28
|
-
};
|
|
29
22
|
/** Fonts of the host's own, offered to every document — each a font
|
|
30
23
|
* file's bytes or a {@link UrlFont}, fetched once a document's text asks
|
|
31
24
|
* for it; a `file:` URL is read from disk. Default none. */
|
|
@@ -78,6 +71,22 @@ export interface OpenRemoteOptions {
|
|
|
78
71
|
* udoc-server route serves them. Default `false`. */
|
|
79
72
|
withOriginal?: boolean;
|
|
80
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* A docMentis package running the engine: its name and version, which every
|
|
76
|
+
* permit request and usage event reports. Only the docMentis packages name
|
|
77
|
+
* one, never an embedder.
|
|
78
|
+
*/
|
|
79
|
+
export interface Wrapper {
|
|
80
|
+
name: string;
|
|
81
|
+
version: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Compile the bundled engine (once per process) and return a `UDocNode` for
|
|
85
|
+
* it that reports `wrapper`, the docMentis package built on this one, in place
|
|
86
|
+
* of udoc-node. Exported from the `./internal` entry only: the wrapper is a
|
|
87
|
+
* docMentis package's to declare, never an embedder's option.
|
|
88
|
+
*/
|
|
89
|
+
export declare function createAs(options: UDocNodeOptions, wrapper: Wrapper): Promise<UDocNode>;
|
|
81
90
|
/**
|
|
82
91
|
* The udoc engine in this process: the host's identity, and the compiled
|
|
83
92
|
* engine every session instantiates. Build one per host identity and open as
|
package/dist/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAiB,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAMjG,OAAO,EAAE,WAAW,EAAc,MAAM,cAAc,CAAC;AAGvD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC5B;gFAC4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;uBAEmB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;6BACyB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;uDACmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAA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AG,OAAO,CAAC,QAAQ,CAAC,CAEtF;AAKD;;;;;GAKG;AACH,qBAAa,QAAQ;;IAcjB,OAAO;IAiBP,oFAAoF;WACvE,MAAM,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIrE;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACpE,kHAAkH;IAClH,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAMtF;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAC1E,4HAA4H;IAC5H,UAAU,CACN,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,EAC5C,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,GACrC,OAAO,CAAC,WAAW,CAAC;CAuB1B"}
|
package/dist/node.js
CHANGED
|
@@ -5,8 +5,19 @@ import { compileEngine } from "./engine.js";
|
|
|
5
5
|
import { FontCache } from "./font-cache.js";
|
|
6
6
|
import { UDocSession, fetchWhole } from "./session.js";
|
|
7
7
|
import { WRAPPER_VERSION } from "./version.js";
|
|
8
|
-
/**
|
|
9
|
-
const
|
|
8
|
+
/** This package, which a `UDocNode` reports unless a package built on it names itself. */
|
|
9
|
+
const UDOC_NODE = { name: "udoc-node", version: WRAPPER_VERSION };
|
|
10
|
+
/** Builds a `UDocNode` as `wrapper`; assigned in the class, the one place its constructor is reachable. */
|
|
11
|
+
let construct;
|
|
12
|
+
/**
|
|
13
|
+
* Compile the bundled engine (once per process) and return a `UDocNode` for
|
|
14
|
+
* it that reports `wrapper`, the docMentis package built on this one, in place
|
|
15
|
+
* of udoc-node. Exported from the `./internal` entry only: the wrapper is a
|
|
16
|
+
* docMentis package's to declare, never an embedder's option.
|
|
17
|
+
*/
|
|
18
|
+
export function createAs(options, wrapper) {
|
|
19
|
+
return construct(options, wrapper);
|
|
20
|
+
}
|
|
10
21
|
/** The bytes of font files kept when {@link UDocNodeOptions.fontCacheSize} is absent. */
|
|
11
22
|
const FONT_CACHE_SIZE = 64 * 1024 * 1024;
|
|
12
23
|
/**
|
|
@@ -24,12 +35,15 @@ export class UDocNode {
|
|
|
24
35
|
#googleFontEndpoint;
|
|
25
36
|
/** The font files every session opened here shares. */
|
|
26
37
|
#fontCache;
|
|
27
|
-
|
|
38
|
+
static {
|
|
39
|
+
construct = async (options, wrapper) => new UDocNode(await compileEngine(), options, wrapper);
|
|
40
|
+
}
|
|
41
|
+
constructor(module, options, wrapper) {
|
|
28
42
|
this.#module = module;
|
|
29
43
|
this.#config = {
|
|
30
44
|
domain: options.domain ?? "unknown",
|
|
31
|
-
wrapper:
|
|
32
|
-
wrapperVersion:
|
|
45
|
+
wrapper: wrapper.name,
|
|
46
|
+
wrapperVersion: wrapper.version,
|
|
33
47
|
...(options.license !== undefined ? { license: options.license } : {}),
|
|
34
48
|
...(options.distinctId !== undefined ? { distinctId: options.distinctId } : {}),
|
|
35
49
|
disableTelemetry: options.disableTelemetry ?? false,
|
|
@@ -42,7 +56,7 @@ export class UDocNode {
|
|
|
42
56
|
}
|
|
43
57
|
/** Compile the bundled engine (once per process) and return a `UDocNode` for it. */
|
|
44
58
|
static async create(options = {}) {
|
|
45
|
-
return
|
|
59
|
+
return construct(options, UDOC_NODE);
|
|
46
60
|
}
|
|
47
61
|
open(bytes, options, delimiter) {
|
|
48
62
|
const opened = typeof options === "object" && options !== null ? options : { format: options, delimiter };
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js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,EAAE,CAAC;YACnG,kBAAkB,EAAE,IAAI,CAAC,mBAAmB;SAC/C,CAAC;IACN,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docmentis/udoc-node",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.27",
|
|
4
4
|
"description": "Read, render, and process documents programmatically in Node.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"document",
|
|
@@ -45,6 +45,10 @@
|
|
|
45
45
|
".": {
|
|
46
46
|
"types": "./dist/index.d.ts",
|
|
47
47
|
"import": "./dist/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./internal": {
|
|
50
|
+
"types": "./dist/internal.d.ts",
|
|
51
|
+
"import": "./dist/internal.js"
|
|
48
52
|
}
|
|
49
53
|
},
|
|
50
54
|
"engines": {
|
|
@@ -58,6 +62,6 @@
|
|
|
58
62
|
"clean": "rm -rf dist"
|
|
59
63
|
},
|
|
60
64
|
"dependencies": {
|
|
61
|
-
"@docmentis/udoc-wasm": "0.8.
|
|
65
|
+
"@docmentis/udoc-wasm": "0.8.30"
|
|
62
66
|
}
|
|
63
67
|
}
|