chromiumly 2.5.1 → 2.7.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/README.md +55 -35
- package/dist/chromium/converters/converter.d.ts +1 -1
- package/dist/chromium/converters/converter.js +1 -1
- package/dist/chromium/converters/converter.js.map +1 -1
- package/dist/chromium/converters/html.converter.d.ts +13 -4
- package/dist/chromium/converters/html.converter.js +9 -2
- package/dist/chromium/converters/html.converter.js.map +1 -1
- package/dist/chromium/converters/markdown.converter.d.ts +9 -4
- package/dist/chromium/converters/markdown.converter.js +7 -3
- package/dist/chromium/converters/markdown.converter.js.map +1 -1
- package/dist/chromium/converters/url.converter.d.ts +9 -4
- package/dist/chromium/converters/url.converter.js +6 -2
- package/dist/chromium/converters/url.converter.js.map +1 -1
- package/dist/chromium/index.d.ts +3 -3
- package/dist/chromium/index.js.map +1 -1
- package/dist/chromium/interfaces/common.types.d.ts +13 -0
- package/dist/chromium/interfaces/common.types.js +3 -0
- package/dist/chromium/interfaces/common.types.js.map +1 -0
- package/dist/chromium/interfaces/converter.types.d.ts +4 -10
- package/dist/chromium/utils/converter.utils.d.ts +2 -12
- package/dist/chromium/utils/converter.utils.js +36 -50
- package/dist/chromium/utils/converter.utils.js.map +1 -1
- package/dist/common/gotenberg.utils.d.ts +11 -1
- package/dist/common/gotenberg.utils.js +25 -2
- package/dist/common/gotenberg.utils.js.map +1 -1
- package/dist/common/index.d.ts +3 -3
- package/dist/common/index.js.map +1 -1
- package/dist/common/types.d.ts +1 -1
- package/dist/gotenberg.js +4 -3
- package/dist/gotenberg.js.map +1 -1
- package/dist/libre-office/index.d.ts +2 -2
- package/dist/libre-office/index.js.map +1 -1
- package/dist/libre-office/utils/constants.js +80 -76
- package/dist/libre-office/utils/constants.js.map +1 -1
- package/dist/libre-office/utils/libre-office.utils.d.ts +3 -3
- package/dist/libre-office/utils/libre-office.utils.js +5 -5
- package/dist/libre-office/utils/libre-office.utils.js.map +1 -1
- package/dist/main.config.d.ts +1 -1
- package/dist/main.config.js +6 -6
- package/dist/main.config.js.map +1 -1
- package/dist/main.d.ts +3 -3
- package/dist/main.js.map +1 -1
- package/dist/pdf-engines/index.d.ts +1 -1
- package/dist/pdf-engines/index.js.map +1 -1
- package/dist/pdf-engines/pdf.engine.d.ts +3 -3
- package/dist/pdf-engines/pdf.engine.js +5 -5
- package/dist/pdf-engines/pdf.engine.js.map +1 -1
- package/dist/pdf-engines/utils/engine.utils.d.ts +2 -2
- package/dist/pdf-engines/utils/engine.utils.js +3 -3
- package/dist/pdf-engines/utils/engine.utils.js.map +1 -1
- package/package.json +25 -17
- package/src/.prettierrc.yml +4 -0
- package/src/chromium/converters/converter.ts +2 -2
- package/src/chromium/converters/html.converter.ts +40 -24
- package/src/chromium/converters/markdown.converter.ts +32 -26
- package/src/chromium/converters/tests/html.converter.test.ts +111 -68
- package/src/chromium/converters/tests/markdown.converter.test.ts +102 -77
- package/src/chromium/converters/tests/url.converter.test.ts +90 -66
- package/src/chromium/converters/url.converter.ts +31 -25
- package/src/chromium/index.ts +3 -3
- package/src/chromium/interfaces/common.types.ts +15 -0
- package/src/chromium/interfaces/converter.types.ts +4 -12
- package/src/chromium/utils/converter.utils.ts +67 -60
- package/src/chromium/utils/tests/converter.utils.test.ts +237 -167
- package/src/common/constants.ts +3 -3
- package/src/common/gotenberg.utils.ts +39 -8
- package/src/common/index.ts +3 -3
- package/src/common/tests/gotenberg.utils.test.ts +38 -31
- package/src/common/types.ts +2 -2
- package/src/gotenberg.ts +9 -9
- package/src/libre-office/index.ts +2 -2
- package/src/libre-office/utils/constants.ts +80 -76
- package/src/libre-office/utils/libre-office.utils.ts +21 -18
- package/src/libre-office/utils/tests/libre-office.utils.test.ts +58 -49
- package/src/main.config.ts +13 -13
- package/src/main.ts +3 -3
- package/src/pdf-engines/index.ts +1 -1
- package/src/pdf-engines/pdf.engine.ts +23 -19
- package/src/pdf-engines/tests/pdf.engine.test.ts +52 -49
- package/src/pdf-engines/utils/engine.utils.ts +12 -9
- package/src/pdf-engines/utils/tests/engine.utils.test.ts +23 -23
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConverterUtils = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
5
|
const common_1 = require("../../common");
|
|
7
|
-
const fs_2 = require("fs");
|
|
8
6
|
/**
|
|
9
7
|
* Utility class for handling common tasks related to conversion.
|
|
10
8
|
*/
|
|
@@ -16,67 +14,49 @@ class ConverterUtils {
|
|
|
16
14
|
* @param {PageProperties} pageProperties - The page properties to be added to the FormData.
|
|
17
15
|
*/
|
|
18
16
|
static addPageProperties(data, pageProperties) {
|
|
17
|
+
if (pageProperties.singlePage) {
|
|
18
|
+
data.append('singlePage', String(pageProperties.singlePage));
|
|
19
|
+
}
|
|
19
20
|
if (pageProperties.size) {
|
|
20
|
-
common_1.GotenbergUtils.assert(pageProperties.size.width >= 1.0 &&
|
|
21
|
-
|
|
22
|
-
data.append(
|
|
21
|
+
common_1.GotenbergUtils.assert(pageProperties.size.width >= 1.0 &&
|
|
22
|
+
pageProperties.size.height >= 1.5, 'size is smaller than the minimum printing requirements (i.e. 1.0 x 1.5 in)');
|
|
23
|
+
data.append('paperWidth', pageProperties.size.width);
|
|
24
|
+
data.append('paperHeight', pageProperties.size.height);
|
|
23
25
|
}
|
|
24
26
|
if (pageProperties.margins) {
|
|
25
27
|
common_1.GotenbergUtils.assert(pageProperties.margins.top >= 0 &&
|
|
26
28
|
pageProperties.margins.bottom >= 0 &&
|
|
27
29
|
pageProperties.margins.left >= 0 &&
|
|
28
|
-
pageProperties.margins.left >= 0,
|
|
29
|
-
data.append(
|
|
30
|
-
data.append(
|
|
31
|
-
data.append(
|
|
32
|
-
data.append(
|
|
30
|
+
pageProperties.margins.left >= 0, 'negative margins are not allowed');
|
|
31
|
+
data.append('marginTop', pageProperties.margins.top);
|
|
32
|
+
data.append('marginBottom', pageProperties.margins.bottom);
|
|
33
|
+
data.append('marginLeft', pageProperties.margins.left);
|
|
34
|
+
data.append('marginRight', pageProperties.margins.right);
|
|
33
35
|
}
|
|
34
36
|
if (pageProperties.preferCssPageSize) {
|
|
35
|
-
data.append(
|
|
37
|
+
data.append('preferCssPageSize', String(pageProperties.preferCssPageSize));
|
|
36
38
|
}
|
|
37
39
|
if (pageProperties.printBackground) {
|
|
38
|
-
data.append(
|
|
40
|
+
data.append('printBackground', String(pageProperties.printBackground));
|
|
39
41
|
}
|
|
40
42
|
if (pageProperties.omitBackground) {
|
|
41
|
-
data.append(
|
|
43
|
+
data.append('omitBackground', String(pageProperties.omitBackground));
|
|
42
44
|
}
|
|
43
45
|
if (pageProperties.landscape) {
|
|
44
|
-
data.append(
|
|
46
|
+
data.append('landscape', String(pageProperties.landscape));
|
|
45
47
|
}
|
|
46
48
|
if (pageProperties.scale) {
|
|
47
|
-
common_1.GotenbergUtils.assert(pageProperties.scale >= 0.1 && pageProperties.scale <= 2.0,
|
|
48
|
-
data.append(
|
|
49
|
+
common_1.GotenbergUtils.assert(pageProperties.scale >= 0.1 && pageProperties.scale <= 2.0, 'scale is outside of [0.1 - 2] range');
|
|
50
|
+
data.append('scale', pageProperties.scale);
|
|
49
51
|
}
|
|
50
52
|
if (pageProperties.nativePageRanges) {
|
|
51
53
|
common_1.GotenbergUtils.assert(pageProperties.nativePageRanges.from > 0 &&
|
|
52
54
|
pageProperties.nativePageRanges.to > 0 &&
|
|
53
55
|
pageProperties.nativePageRanges.to >=
|
|
54
|
-
pageProperties.nativePageRanges.from,
|
|
55
|
-
data.append(
|
|
56
|
+
pageProperties.nativePageRanges.from, 'page ranges syntax error');
|
|
57
|
+
data.append('nativePageRanges', `${pageProperties.nativePageRanges.from}-${pageProperties.nativePageRanges.to}`);
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Adds a file to the FormData object.
|
|
60
|
-
*
|
|
61
|
-
* @param {FormData} data - The FormData object to which the file will be added.
|
|
62
|
-
* @param {PathLikeOrReadStream} file - The file to be added (either a PathLike or a ReadStream).
|
|
63
|
-
* @param {string} name - The name to be used for the file in the FormData.
|
|
64
|
-
* @returns {Promise<void>} A Promise that resolves once the file has been added.
|
|
65
|
-
*/
|
|
66
|
-
static addFile(data, file, name) {
|
|
67
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
if (Buffer.isBuffer(file)) {
|
|
69
|
-
data.append("files", file, name);
|
|
70
|
-
}
|
|
71
|
-
else if (file instanceof fs_2.ReadStream) {
|
|
72
|
-
data.append("files", file, name);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
yield fs_1.promises.access(file, fs_1.constants.R_OK);
|
|
76
|
-
data.append("files", (0, fs_1.createReadStream)(file), name);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
60
|
/**
|
|
81
61
|
* Customizes the FormData object based on the provided conversion options.
|
|
82
62
|
*
|
|
@@ -87,39 +67,45 @@ class ConverterUtils {
|
|
|
87
67
|
static customize(data, options) {
|
|
88
68
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
89
69
|
if (options.pdfFormat) {
|
|
90
|
-
data.append(
|
|
70
|
+
data.append('pdfa', options.pdfFormat);
|
|
91
71
|
}
|
|
92
72
|
if (options.pdfUA) {
|
|
93
|
-
data.append(
|
|
73
|
+
data.append('pdfua', String(options.pdfUA));
|
|
94
74
|
}
|
|
95
75
|
if (options.header) {
|
|
96
76
|
const { header } = options;
|
|
97
|
-
yield
|
|
77
|
+
yield common_1.GotenbergUtils.addFile(data, header, 'header.html');
|
|
98
78
|
}
|
|
99
79
|
if (options.footer) {
|
|
100
80
|
const { footer } = options;
|
|
101
|
-
yield
|
|
81
|
+
yield common_1.GotenbergUtils.addFile(data, footer, 'footer.html');
|
|
102
82
|
}
|
|
103
83
|
if (options.emulatedMediaType) {
|
|
104
|
-
data.append(
|
|
84
|
+
data.append('emulatedMediaType', options.emulatedMediaType);
|
|
105
85
|
}
|
|
106
86
|
if (options.properties) {
|
|
107
87
|
ConverterUtils.addPageProperties(data, options.properties);
|
|
108
88
|
}
|
|
109
89
|
if (options.waitDelay) {
|
|
110
|
-
data.append(
|
|
90
|
+
data.append('waitDelay', options.waitDelay);
|
|
111
91
|
}
|
|
112
92
|
if (options.waitForExpression) {
|
|
113
|
-
data.append(
|
|
93
|
+
data.append('waitForExpression', options.waitForExpression);
|
|
114
94
|
}
|
|
115
95
|
if (options.userAgent) {
|
|
116
|
-
data.append(
|
|
96
|
+
data.append('userAgent', options.userAgent);
|
|
117
97
|
}
|
|
118
98
|
if (options.extraHttpHeaders) {
|
|
119
|
-
data.append(
|
|
99
|
+
data.append('extraHttpHeaders', JSON.stringify(options.extraHttpHeaders));
|
|
100
|
+
}
|
|
101
|
+
if (options.failOnHttpStatusCodes) {
|
|
102
|
+
data.append('failOnHttpStatusCodes', JSON.stringify(options.failOnHttpStatusCodes));
|
|
120
103
|
}
|
|
121
104
|
if (options.failOnConsoleExceptions) {
|
|
122
|
-
data.append(
|
|
105
|
+
data.append('failOnConsoleExceptions', String(options.failOnConsoleExceptions));
|
|
106
|
+
}
|
|
107
|
+
if (options.skipNetworkIdleEvent) {
|
|
108
|
+
data.append('skipNetworkIdleEvent', String(options.skipNetworkIdleEvent));
|
|
123
109
|
}
|
|
124
110
|
});
|
|
125
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.utils.js","sourceRoot":"","sources":["../../../src/chromium/utils/converter.utils.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"converter.utils.js","sourceRoot":"","sources":["../../../src/chromium/utils/converter.utils.ts"],"names":[],"mappings":";;;;AAMA,yCAA8C;AAE9C;;GAEG;AACH,MAAa,cAAc;IACvB;;;;;OAKG;IACI,MAAM,CAAC,iBAAiB,CAC3B,IAAc,EACd,cAA8B;QAE9B,IAAI,cAAc,CA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,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;YAChD,CAAC;YAED,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;gBAC3B,IAAI,CAAC,MAAM,CACP,kBAAkB,EAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAC3C,CAAC;YACN,CAAC;YAED,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;gBAChC,IAAI,CAAC,MAAM,CACP,uBAAuB,EACvB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAChD,CAAC;YACN,CAAC;YAED,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;gBAClC,IAAI,CAAC,MAAM,CACP,yBAAyB,EACzB,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAC1C,CAAC;YACN,CAAC;YAED,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;gBAC/B,IAAI,CAAC,MAAM,CACP,sBAAsB,EACtB,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CACvC,CAAC;YACN,CAAC;QACL,CAAC;KAAA;CACJ;AAxKD,wCAwKC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import FormData from
|
|
2
|
+
import FormData from 'form-data';
|
|
3
|
+
import { PathLikeOrReadStream } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Utility class for common tasks related to the Gotenberg service.
|
|
5
6
|
*/
|
|
@@ -21,4 +22,13 @@ export declare class GotenbergUtils {
|
|
|
21
22
|
* @throws {Error} Throws an error if the HTTP response status is not OK.
|
|
22
23
|
*/
|
|
23
24
|
static fetch(endpoint: string, data: FormData): Promise<Buffer>;
|
|
25
|
+
/**
|
|
26
|
+
* Adds a file to the FormData object.
|
|
27
|
+
*
|
|
28
|
+
* @param {FormData} data - The FormData object to which the file will be added.
|
|
29
|
+
* @param {PathLikeOrReadStream} file - The file to be added (either a PathLike or a ReadStream).
|
|
30
|
+
* @param {string} name - The name to be used for the file in the FormData.
|
|
31
|
+
* @returns {Promise<void>} A Promise that resolves once the file has been added.
|
|
32
|
+
*/
|
|
33
|
+
static addFile(data: FormData, file: PathLikeOrReadStream, name: string): Promise<void>;
|
|
24
34
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GotenbergUtils = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_1 = require("fs");
|
|
5
6
|
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
6
7
|
/**
|
|
7
8
|
* Utility class for common tasks related to the Gotenberg service.
|
|
@@ -30,9 +31,9 @@ class GotenbergUtils {
|
|
|
30
31
|
static fetch(endpoint, data) {
|
|
31
32
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
33
|
const response = yield (0, node_fetch_1.default)(endpoint, {
|
|
33
|
-
method:
|
|
34
|
+
method: 'post',
|
|
34
35
|
body: data,
|
|
35
|
-
headers: Object.assign({}, data.getHeaders())
|
|
36
|
+
headers: Object.assign({}, data.getHeaders())
|
|
36
37
|
});
|
|
37
38
|
if (!response.ok) {
|
|
38
39
|
throw new Error(`${response.status} ${response.statusText}`);
|
|
@@ -40,6 +41,28 @@ class GotenbergUtils {
|
|
|
40
41
|
return response.buffer();
|
|
41
42
|
});
|
|
42
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Adds a file to the FormData object.
|
|
46
|
+
*
|
|
47
|
+
* @param {FormData} data - The FormData object to which the file will be added.
|
|
48
|
+
* @param {PathLikeOrReadStream} file - The file to be added (either a PathLike or a ReadStream).
|
|
49
|
+
* @param {string} name - The name to be used for the file in the FormData.
|
|
50
|
+
* @returns {Promise<void>} A Promise that resolves once the file has been added.
|
|
51
|
+
*/
|
|
52
|
+
static addFile(data, file, name) {
|
|
53
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
if (Buffer.isBuffer(file)) {
|
|
55
|
+
data.append('files', file, name);
|
|
56
|
+
}
|
|
57
|
+
else if (file instanceof fs_1.ReadStream) {
|
|
58
|
+
data.append('files', file, name);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
yield fs_1.promises.access(file, fs_1.constants.R_OK);
|
|
62
|
+
data.append('files', (0, fs_1.createReadStream)(file), name);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
43
66
|
}
|
|
44
67
|
exports.GotenbergUtils = GotenbergUtils;
|
|
45
68
|
//# sourceMappingURL=gotenberg.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gotenberg.utils.js","sourceRoot":"","sources":["../../src/common/gotenberg.utils.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"gotenberg.utils.js","sourceRoot":"","sources":["../../src/common/gotenberg.utils.ts"],"names":[],"mappings":";;;;AAAA,2BAAuE;AAEvE,oEAA+B;AAG/B;;GAEG;AACH,MAAa,cAAc;IACvB;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAChB,SAAkB,EAClB,OAAe;QAEf,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAO,KAAK,CACrB,QAAgB,EAChB,IAAc;;YAEd,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,QAAQ,EAAE;gBACnC,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI;gBACV,OAAO,oBACA,IAAI,CAAC,UAAU,EAAE,CACvB;aACJ,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YACjE,CAAC;YAED,OAAO,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC7B,CAAC;KAAA;IAED;;;;;;;OAOG;IACI,MAAM,CAAO,OAAO,CACvB,IAAc,EACd,IAA0B,EAC1B,IAAY;;YAEZ,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YACrC,CAAC;iBAAM,IAAI,IAAI,YAAY,eAAU,EAAE,CAAC;gBACpC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACJ,MAAM,aAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,cAAS,CAAC,IAAI,CAAC,CAAC;gBAC5C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAA,qBAAgB,EAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACvD,CAAC;QACL,CAAC;KAAA;CACJ;AAlED,wCAkEC"}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { PdfFormat } from
|
|
2
|
-
export { GotenbergUtils } from
|
|
3
|
-
export { PathLikeOrReadStream } from
|
|
1
|
+
export { PdfFormat } from './constants';
|
|
2
|
+
export { GotenbergUtils } from './gotenberg.utils';
|
|
3
|
+
export { PathLikeOrReadStream } from './types';
|
package/dist/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
|
package/dist/common/types.d.ts
CHANGED
package/dist/gotenberg.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Gotenberg = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
process.env.SUPPRESS_NO_CONFIG_WARNING =
|
|
5
|
+
process.env.SUPPRESS_NO_CONFIG_WARNING = 'y';
|
|
6
6
|
const dotenv = tslib_1.__importStar(require("dotenv"));
|
|
7
7
|
const path = tslib_1.__importStar(require("path"));
|
|
8
8
|
const config_1 = tslib_1.__importDefault(require("config"));
|
|
9
9
|
// Load endpoint from environment-specific file (e.g., .env.development)
|
|
10
10
|
const envFile = `.env.${process.env.NODE_ENV}`;
|
|
11
|
-
const envFileFallback =
|
|
11
|
+
const envFileFallback = '.env';
|
|
12
12
|
const dotenvConfig = dotenv.config({ path: path.resolve(envFile) });
|
|
13
13
|
// Fallback to loading the default environment file.
|
|
14
14
|
if (dotenvConfig.error) {
|
|
@@ -25,5 +25,6 @@ exports.Gotenberg = Gotenberg;
|
|
|
25
25
|
* Defaults to the value from the environment variable `GOTENBERG_ENDPOINT`, or falls back to the configuration file.
|
|
26
26
|
* @type {string}
|
|
27
27
|
*/
|
|
28
|
-
Gotenberg.endpoint = process.env.GOTENBERG_ENDPOINT ||
|
|
28
|
+
Gotenberg.endpoint = process.env.GOTENBERG_ENDPOINT ||
|
|
29
|
+
config_1.default.get('gotenberg.endpoint');
|
|
29
30
|
//# sourceMappingURL=gotenberg.js.map
|
package/dist/gotenberg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gotenberg.js","sourceRoot":"","sources":["../src/gotenberg.ts"],"names":[],"mappings":";;;;AAAA,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,GAAG,CAAC;AAE7C,uDAAiC;AACjC,mDAA6B;AAC7B,4DAA4B;AAE5B,wEAAwE;AACxE,MAAM,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/C,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"gotenberg.js","sourceRoot":"","sources":["../src/gotenberg.ts"],"names":[],"mappings":";;;;AAAA,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,GAAG,CAAC;AAE7C,uDAAiC;AACjC,mDAA6B;AAC7B,4DAA4B;AAE5B,wEAAwE;AACxE,MAAM,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/C,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAEpE,oDAAoD;AACpD,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;IACrB,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAa,SAAS;;AAAtB,8BASC;AARG;;;;GAIG;AACW,kBAAQ,GAClB,OAAO,CAAC,GAAG,CAAC,kBAAkB;IAC9B,gBAAM,CAAC,GAAG,CAAS,oBAAoB,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { PageProperties } from
|
|
2
|
-
export { LibreOfficeUtils } from
|
|
1
|
+
export { PageProperties } from './interfaces/libre-office.types';
|
|
2
|
+
export { LibreOfficeUtils } from './utils/libre-office.utils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/libre-office/index.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/libre-office/index.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAArD,sHAAA,gBAAgB,OAAA"}
|
|
@@ -2,81 +2,85 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LIBRE_OFFICE_EXTENSIONS = void 0;
|
|
4
4
|
exports.LIBRE_OFFICE_EXTENSIONS = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
5
|
+
'bib',
|
|
6
|
+
'doc',
|
|
7
|
+
'xml',
|
|
8
|
+
'docx',
|
|
9
|
+
'fodt',
|
|
10
|
+
'html',
|
|
11
|
+
'ltx',
|
|
12
|
+
'txt',
|
|
13
|
+
'odt',
|
|
14
|
+
'ott',
|
|
15
|
+
'pdb',
|
|
16
|
+
'pdf',
|
|
17
|
+
'psw',
|
|
18
|
+
'rtf',
|
|
19
|
+
'sdw',
|
|
20
|
+
'stw',
|
|
21
|
+
'sxw',
|
|
22
|
+
'uot',
|
|
23
|
+
'vor',
|
|
24
|
+
'wps',
|
|
25
|
+
'epub',
|
|
26
|
+
'png',
|
|
27
|
+
'bmp',
|
|
28
|
+
'emf',
|
|
29
|
+
'eps',
|
|
30
|
+
'fodg',
|
|
31
|
+
'gif',
|
|
32
|
+
'jpg',
|
|
33
|
+
'met',
|
|
34
|
+
'odd',
|
|
35
|
+
'otg',
|
|
36
|
+
'pbm',
|
|
37
|
+
'pct',
|
|
38
|
+
'pgm',
|
|
39
|
+
'ppm',
|
|
40
|
+
'ras',
|
|
41
|
+
'std',
|
|
42
|
+
'svg',
|
|
43
|
+
'svm',
|
|
44
|
+
'swf',
|
|
45
|
+
'sxd',
|
|
46
|
+
'sxw',
|
|
47
|
+
'tiff',
|
|
48
|
+
'xhtml',
|
|
49
|
+
'xpm',
|
|
50
|
+
'fodp',
|
|
51
|
+
'pages',
|
|
52
|
+
'potm',
|
|
53
|
+
'pot',
|
|
54
|
+
'pptx',
|
|
55
|
+
'pps',
|
|
56
|
+
'ppt',
|
|
57
|
+
'pwp',
|
|
58
|
+
'sda',
|
|
59
|
+
'sdd',
|
|
60
|
+
'sti',
|
|
61
|
+
'sxi',
|
|
62
|
+
'uop',
|
|
63
|
+
'wmf',
|
|
64
|
+
'csv',
|
|
65
|
+
'dbf',
|
|
66
|
+
'dif',
|
|
67
|
+
'fods',
|
|
68
|
+
'ods',
|
|
69
|
+
'ots',
|
|
70
|
+
'pxl',
|
|
71
|
+
'sdc',
|
|
72
|
+
'slk',
|
|
73
|
+
'stc',
|
|
74
|
+
'sxc',
|
|
75
|
+
'uos',
|
|
76
|
+
'xls',
|
|
77
|
+
'xlt',
|
|
78
|
+
'xlsx',
|
|
79
|
+
'tif',
|
|
80
|
+
'jpeg',
|
|
81
|
+
'odp',
|
|
82
|
+
'odg',
|
|
83
|
+
'dotx',
|
|
84
|
+
'xltx'
|
|
81
85
|
];
|
|
82
86
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/libre-office/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG;IACnC,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/libre-office/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG;IACnC,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;CACT,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import FormData from
|
|
2
|
-
import { PathLikeOrReadStream } from
|
|
3
|
-
import { PageProperties } from
|
|
1
|
+
import FormData from 'form-data';
|
|
2
|
+
import { PathLikeOrReadStream } from '../../common';
|
|
3
|
+
import { PageProperties } from '../interfaces/libre-office.types';
|
|
4
4
|
/**
|
|
5
5
|
* Utility class for handling common tasks related to LibreOffice conversions.
|
|
6
6
|
*/
|
|
@@ -36,11 +36,11 @@ class LibreOfficeUtils {
|
|
|
36
36
|
file = (0, fs_1.createReadStream)(value);
|
|
37
37
|
}
|
|
38
38
|
if (!fileInfo) {
|
|
39
|
-
throw new Error(
|
|
39
|
+
throw new Error('File type could not be determined');
|
|
40
40
|
}
|
|
41
41
|
const extension = fileInfo.ext;
|
|
42
42
|
if (constants_1.LIBRE_OFFICE_EXTENSIONS.includes(extension)) {
|
|
43
|
-
data.append(
|
|
43
|
+
data.append('files', file, `${key}.${extension}`);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
46
|
throw new Error(`${extension} is not supported`);
|
|
@@ -56,14 +56,14 @@ class LibreOfficeUtils {
|
|
|
56
56
|
*/
|
|
57
57
|
static addPageProperties(data, pageProperties) {
|
|
58
58
|
if (pageProperties.landscape) {
|
|
59
|
-
data.append(
|
|
59
|
+
data.append('landscape', String(pageProperties.landscape));
|
|
60
60
|
}
|
|
61
61
|
if (pageProperties.nativePageRanges) {
|
|
62
62
|
common_1.GotenbergUtils.assert(pageProperties.nativePageRanges.from > 0 &&
|
|
63
63
|
pageProperties.nativePageRanges.to > 0 &&
|
|
64
64
|
pageProperties.nativePageRanges.to >=
|
|
65
|
-
pageProperties.nativePageRanges.from,
|
|
66
|
-
data.append(
|
|
65
|
+
pageProperties.nativePageRanges.from, 'page ranges syntax error');
|
|
66
|
+
data.append('nativePageRanges', `${pageProperties.nativePageRanges.from}-${pageProperties.nativePageRanges.to}`);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libre-office.utils.js","sourceRoot":"","sources":["../../../src/libre-office/utils/libre-office.utils.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"libre-office.utils.js","sourceRoot":"","sources":["../../../src/libre-office/utils/libre-office.utils.ts"],"names":[],"mappings":";;;;AAAA,2BAAuE;AACvE,wDAAwB;AAExB,yCAAmD;AAInD,yCAAoE;AACpE,2CAAsD;AAGtD;;GAEG;AACH,MAAa,g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CAAC,GAAG,SAAS,mBAAmB,CAAC,CAAC;gBACrD,CAAC;YACL,CAAC;QACL,CAAC;KAAA;IAED;;;;;OAKG;IACI,MAAM,CAAC,iBAAiB,CAC3B,IAAc,EACd,cAA8B;QAE9B,IAAI,cAAc,CAAC,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;QAC/D,CAAC;QAED,IAAI,cAAc,CAAC,gBAAgB,EAAE,CAAC;YAClC,uBAAc,CAAC,MAAM,CACjB,cAAc,CAAC,gBAAgB,CAAC,IAAI,GAAG,CAAC;gBACpC,cAAc,CAAC,gBAAgB,CAAC,EAAE,GAAG,CAAC;gBACtC,cAAc,CAAC,gBAAgB,CAAC,EAAE;oBAC9B,cAAc,CAAC,gBAAgB,CAAC,IAAI,EAC5C,0BAA0B,CAC7B,CAAC;YAEF,IAAI,CAAC,MAAM,CACP,kBAAkB,EAClB,GAAG,cAAc,CAAC,gBAAgB,CAAC,IAAI,IAAI,cAAc,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAClF,CAAC;QACN,CAAC;IACL,CAAC;CACJ;AAtED,4CAsEC"}
|
package/dist/main.config.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare class Chromiumly {
|
|
|
34
34
|
* The path for Chromium-related conversions.
|
|
35
35
|
* @type {string}
|
|
36
36
|
*/
|
|
37
|
-
static readonly
|
|
37
|
+
static readonly CHROMIUM_CONVERT_PATH = "forms/chromium/convert";
|
|
38
38
|
/**
|
|
39
39
|
* The path for PDF engine-related operations.
|
|
40
40
|
* @type {string}
|
package/dist/main.config.js
CHANGED
|
@@ -43,17 +43,17 @@ Chromiumly.GOTENBERG_ENDPOINT = gotenberg_1.Gotenberg.endpoint;
|
|
|
43
43
|
* The path for Chromium-related conversions.
|
|
44
44
|
* @type {string}
|
|
45
45
|
*/
|
|
46
|
-
Chromiumly.
|
|
46
|
+
Chromiumly.CHROMIUM_CONVERT_PATH = 'forms/chromium/convert';
|
|
47
47
|
/**
|
|
48
48
|
* The path for PDF engine-related operations.
|
|
49
49
|
* @type {string}
|
|
50
50
|
*/
|
|
51
|
-
Chromiumly.PDF_ENGINES_PATH =
|
|
51
|
+
Chromiumly.PDF_ENGINES_PATH = 'forms/pdfengines';
|
|
52
52
|
/**
|
|
53
53
|
* The path for LibreOffice-related conversions.
|
|
54
54
|
* @type {string}
|
|
55
55
|
*/
|
|
56
|
-
Chromiumly.LIBRE_OFFICE_PATH =
|
|
56
|
+
Chromiumly.LIBRE_OFFICE_PATH = 'forms/libreoffice';
|
|
57
57
|
/**
|
|
58
58
|
* Routes for Chromium conversions.
|
|
59
59
|
* @type {Object}
|
|
@@ -61,20 +61,20 @@ Chromiumly.LIBRE_OFFICE_PATH = "forms/libreoffice";
|
|
|
61
61
|
Chromiumly.CHROMIUM_ROUTES = {
|
|
62
62
|
url: ChromiumRoute.URL,
|
|
63
63
|
html: ChromiumRoute.HTML,
|
|
64
|
-
markdown: ChromiumRoute.MARKDOWN
|
|
64
|
+
markdown: ChromiumRoute.MARKDOWN
|
|
65
65
|
};
|
|
66
66
|
/**
|
|
67
67
|
* Routes for PDF engine operations.
|
|
68
68
|
* @type {Object}
|
|
69
69
|
*/
|
|
70
70
|
Chromiumly.PDF_ENGINE_ROUTES = {
|
|
71
|
-
merge: PdfEngineRoute.MERGE
|
|
71
|
+
merge: PdfEngineRoute.MERGE
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
74
|
* Routes for LibreOffice conversions.
|
|
75
75
|
* @type {Object}
|
|
76
76
|
*/
|
|
77
77
|
Chromiumly.LIBRE_OFFICE_ROUTES = {
|
|
78
|
-
convert: LibreOfficeRoute.CONVERT
|
|
78
|
+
convert: LibreOfficeRoute.CONVERT
|
|
79
79
|
};
|
|
80
80
|
//# sourceMappingURL=main.config.js.map
|
package/dist/main.config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.config.js","sourceRoot":"","sources":["../src/main.config.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"main.config.js","sourceRoot":"","sources":["../src/main.config.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAExC;;;GAGG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,4BAAW,CAAA;IACX,8BAAa,CAAA;IACb,sCAAqB,CAAA;AACzB,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAED;;;GAGG;AACH,IAAK,cAEJ;AAFD,WAAK,cAAc;IACf,iCAAe,CAAA;AACnB,CAAC,EAFI,cAAc,KAAd,cAAc,QAElB;AAED;;;GAGG;AACH,IAAK,gBAEJ;AAFD,WAAK,gBAAgB;IACjB,uCAAmB,CAAA;AACvB,CAAC,EAFI,gBAAgB,KAAhB,gBAAgB,QAEpB;AAED;;GAEG;AACH,MAAa,UAAU;;AAAvB,gCAkDC;AAjDG;;;GAGG;AACoB,6BAAkB,GAAG,qBAAS,CAAC,QAAQ,CAAC;AAE/D;;;GAGG;AACoB,gCAAqB,GAAG,wBAAwB,CAAC;AAExE;;;GAGG;AACoB,2BAAgB,GAAG,kBAAkB,CAAC;AAE7D;;;GAGG;AACoB,4BAAiB,GAAG,mBAAmB,CAAC;AAE/D;;;GAGG;AACoB,0BAAe,GAAG;IACrC,GAAG,EAAE,aAAa,CAAC,GAAG;IACtB,IAAI,EAAE,aAAa,CAAC,IAAI;IACxB,QAAQ,EAAE,aAAa,CAAC,QAAQ;CACnC,CAAC;AAEF;;;GAGG;AACoB,4BAAiB,GAAG;IACvC,KAAK,EAAE,cAAc,CAAC,KAAK;CAC9B,CAAC;AAEF;;;GAGG;AACoB,8BAAmB,GAAG;IACzC,OAAO,EAAE,gBAAgB,CAAC,OAAO;CACpC,CAAC"}
|
package/dist/main.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { PdfFormat } from
|
|
2
|
-
export { HtmlConverter, MarkdownConverter, UrlConverter } from
|
|
3
|
-
export { PDFEngine } from
|
|
1
|
+
export { PdfFormat } from './common/constants';
|
|
2
|
+
export { HtmlConverter, MarkdownConverter, UrlConverter } from './chromium';
|
|
3
|
+
export { PDFEngine } from './pdf-engines';
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;AAAA,gDAA+C;AAAtC,sGAAA,SAAS,OAAA;AAClB,uCAA4E;AAAnE,yGAAA,aAAa,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,wGAAA,YAAY,OAAA;AACvD,6CAA0C;AAAjC,wGAAA,SAAS,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PDFEngine } from
|
|
1
|
+
export { PDFEngine } from './pdf.engine';
|