@shad0wz7/nestjs-pdf 2.1.0 → 2.2.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 +4 -0
- package/dist/index.d.mts +126 -10
- package/dist/index.d.ts +126 -10
- package/dist/index.js +1413 -164
- package/dist/index.mjs +1395 -148
- package/package.json +9 -2
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ var require_main = __commonJS({
|
|
|
75
75
|
}
|
|
76
76
|
__name(dim, "dim");
|
|
77
77
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
78
|
-
function
|
|
78
|
+
function parse4(src) {
|
|
79
79
|
const obj = {};
|
|
80
80
|
let lines = src.toString();
|
|
81
81
|
lines = lines.replace(/\r\n?/mg, "\n");
|
|
@@ -94,7 +94,7 @@ var require_main = __commonJS({
|
|
|
94
94
|
}
|
|
95
95
|
return obj;
|
|
96
96
|
}
|
|
97
|
-
__name(
|
|
97
|
+
__name(parse4, "parse");
|
|
98
98
|
function _parseVault(options) {
|
|
99
99
|
options = options || {};
|
|
100
100
|
const vaultPath = _vaultPath(options);
|
|
@@ -278,8 +278,8 @@ var require_main = __commonJS({
|
|
|
278
278
|
const shortPaths = [];
|
|
279
279
|
for (const filePath of optionPaths) {
|
|
280
280
|
try {
|
|
281
|
-
const
|
|
282
|
-
shortPaths.push(
|
|
281
|
+
const relative3 = path2.relative(process.cwd(), filePath);
|
|
282
|
+
shortPaths.push(relative3);
|
|
283
283
|
} catch (e) {
|
|
284
284
|
if (debug) {
|
|
285
285
|
_debug(`failed to load ${filePath} ${e.message}`);
|
|
@@ -377,7 +377,7 @@ var require_main = __commonJS({
|
|
|
377
377
|
_parseVault,
|
|
378
378
|
config,
|
|
379
379
|
decrypt,
|
|
380
|
-
parse,
|
|
380
|
+
parse: parse4,
|
|
381
381
|
populate
|
|
382
382
|
};
|
|
383
383
|
module2.exports.configDotenv = DotenvModule.configDotenv;
|
|
@@ -472,9 +472,9 @@ var require_main2 = __commonJS({
|
|
|
472
472
|
}
|
|
473
473
|
});
|
|
474
474
|
|
|
475
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
475
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.constants.js
|
|
476
476
|
var require_config_constants = __commonJS({
|
|
477
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
477
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.constants.js"(exports2) {
|
|
478
478
|
"use strict";
|
|
479
479
|
Object.defineProperty(exports2, "__esModule", {
|
|
480
480
|
value: true
|
|
@@ -495,8 +495,8 @@ var require_config_constants = __commonJS({
|
|
|
495
495
|
var require_isArray = __commonJS({
|
|
496
496
|
"node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isArray.js"(exports2, module2) {
|
|
497
497
|
"use strict";
|
|
498
|
-
var
|
|
499
|
-
module2.exports =
|
|
498
|
+
var isArray2 = Array.isArray;
|
|
499
|
+
module2.exports = isArray2;
|
|
500
500
|
}
|
|
501
501
|
});
|
|
502
502
|
|
|
@@ -567,11 +567,11 @@ var require_objectToString = __commonJS({
|
|
|
567
567
|
"use strict";
|
|
568
568
|
var objectProto = Object.prototype;
|
|
569
569
|
var nativeObjectToString = objectProto.toString;
|
|
570
|
-
function
|
|
570
|
+
function objectToString2(value) {
|
|
571
571
|
return nativeObjectToString.call(value);
|
|
572
572
|
}
|
|
573
|
-
__name(
|
|
574
|
-
module2.exports =
|
|
573
|
+
__name(objectToString2, "objectToString");
|
|
574
|
+
module2.exports = objectToString2;
|
|
575
575
|
}
|
|
576
576
|
});
|
|
577
577
|
|
|
@@ -581,7 +581,7 @@ var require_baseGetTag = __commonJS({
|
|
|
581
581
|
"use strict";
|
|
582
582
|
var Symbol2 = require_Symbol();
|
|
583
583
|
var getRawTag = require_getRawTag();
|
|
584
|
-
var
|
|
584
|
+
var objectToString2 = require_objectToString();
|
|
585
585
|
var nullTag = "[object Null]";
|
|
586
586
|
var undefinedTag = "[object Undefined]";
|
|
587
587
|
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
@@ -589,7 +589,7 @@ var require_baseGetTag = __commonJS({
|
|
|
589
589
|
if (value == null) {
|
|
590
590
|
return value === void 0 ? undefinedTag : nullTag;
|
|
591
591
|
}
|
|
592
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) :
|
|
592
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString2(value);
|
|
593
593
|
}
|
|
594
594
|
__name(baseGetTag, "baseGetTag");
|
|
595
595
|
module2.exports = baseGetTag;
|
|
@@ -627,12 +627,12 @@ var require_isSymbol = __commonJS({
|
|
|
627
627
|
var require_isKey = __commonJS({
|
|
628
628
|
"node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_isKey.js"(exports2, module2) {
|
|
629
629
|
"use strict";
|
|
630
|
-
var
|
|
630
|
+
var isArray2 = require_isArray();
|
|
631
631
|
var isSymbol = require_isSymbol();
|
|
632
632
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
633
633
|
var reIsPlainProp = /^\w*$/;
|
|
634
634
|
function isKey(value, object) {
|
|
635
|
-
if (
|
|
635
|
+
if (isArray2(value)) {
|
|
636
636
|
return false;
|
|
637
637
|
}
|
|
638
638
|
var type = typeof value;
|
|
@@ -669,15 +669,15 @@ var require_isFunction = __commonJS({
|
|
|
669
669
|
var funcTag = "[object Function]";
|
|
670
670
|
var genTag = "[object GeneratorFunction]";
|
|
671
671
|
var proxyTag = "[object Proxy]";
|
|
672
|
-
function
|
|
672
|
+
function isFunction2(value) {
|
|
673
673
|
if (!isObject(value)) {
|
|
674
674
|
return false;
|
|
675
675
|
}
|
|
676
676
|
var tag = baseGetTag(value);
|
|
677
677
|
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
678
678
|
}
|
|
679
|
-
__name(
|
|
680
|
-
module2.exports =
|
|
679
|
+
__name(isFunction2, "isFunction");
|
|
680
|
+
module2.exports = isFunction2;
|
|
681
681
|
}
|
|
682
682
|
});
|
|
683
683
|
|
|
@@ -736,7 +736,7 @@ var require_toSource = __commonJS({
|
|
|
736
736
|
var require_baseIsNative = __commonJS({
|
|
737
737
|
"node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseIsNative.js"(exports2, module2) {
|
|
738
738
|
"use strict";
|
|
739
|
-
var
|
|
739
|
+
var isFunction2 = require_isFunction();
|
|
740
740
|
var isMasked = require_isMasked();
|
|
741
741
|
var isObject = require_isObject();
|
|
742
742
|
var toSource = require_toSource();
|
|
@@ -751,7 +751,7 @@ var require_baseIsNative = __commonJS({
|
|
|
751
751
|
if (!isObject(value) || isMasked(value)) {
|
|
752
752
|
return false;
|
|
753
753
|
}
|
|
754
|
-
var pattern =
|
|
754
|
+
var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
|
|
755
755
|
return pattern.test(toSource(value));
|
|
756
756
|
}
|
|
757
757
|
__name(baseIsNative, "baseIsNative");
|
|
@@ -1058,8 +1058,8 @@ var require_Map = __commonJS({
|
|
|
1058
1058
|
"use strict";
|
|
1059
1059
|
var getNative = require_getNative();
|
|
1060
1060
|
var root = require_root();
|
|
1061
|
-
var
|
|
1062
|
-
module2.exports =
|
|
1061
|
+
var Map2 = getNative(root, "Map");
|
|
1062
|
+
module2.exports = Map2;
|
|
1063
1063
|
}
|
|
1064
1064
|
});
|
|
1065
1065
|
|
|
@@ -1069,12 +1069,12 @@ var require_mapCacheClear = __commonJS({
|
|
|
1069
1069
|
"use strict";
|
|
1070
1070
|
var Hash = require_Hash();
|
|
1071
1071
|
var ListCache = require_ListCache();
|
|
1072
|
-
var
|
|
1072
|
+
var Map2 = require_Map();
|
|
1073
1073
|
function mapCacheClear() {
|
|
1074
1074
|
this.size = 0;
|
|
1075
1075
|
this.__data__ = {
|
|
1076
1076
|
"hash": new Hash(),
|
|
1077
|
-
"map": new (
|
|
1077
|
+
"map": new (Map2 || ListCache)(),
|
|
1078
1078
|
"string": new Hash()
|
|
1079
1079
|
};
|
|
1080
1080
|
}
|
|
@@ -1286,7 +1286,7 @@ var require_baseToString = __commonJS({
|
|
|
1286
1286
|
"use strict";
|
|
1287
1287
|
var Symbol2 = require_Symbol();
|
|
1288
1288
|
var arrayMap = require_arrayMap();
|
|
1289
|
-
var
|
|
1289
|
+
var isArray2 = require_isArray();
|
|
1290
1290
|
var isSymbol = require_isSymbol();
|
|
1291
1291
|
var INFINITY = 1 / 0;
|
|
1292
1292
|
var symbolProto = Symbol2 ? Symbol2.prototype : void 0;
|
|
@@ -1295,7 +1295,7 @@ var require_baseToString = __commonJS({
|
|
|
1295
1295
|
if (typeof value == "string") {
|
|
1296
1296
|
return value;
|
|
1297
1297
|
}
|
|
1298
|
-
if (
|
|
1298
|
+
if (isArray2(value)) {
|
|
1299
1299
|
return arrayMap(value, baseToString) + "";
|
|
1300
1300
|
}
|
|
1301
1301
|
if (isSymbol(value)) {
|
|
@@ -1326,12 +1326,12 @@ var require_toString = __commonJS({
|
|
|
1326
1326
|
var require_castPath = __commonJS({
|
|
1327
1327
|
"node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_castPath.js"(exports2, module2) {
|
|
1328
1328
|
"use strict";
|
|
1329
|
-
var
|
|
1329
|
+
var isArray2 = require_isArray();
|
|
1330
1330
|
var isKey = require_isKey();
|
|
1331
1331
|
var stringToPath = require_stringToPath();
|
|
1332
1332
|
var toString = require_toString();
|
|
1333
1333
|
function castPath(value, object) {
|
|
1334
|
-
if (
|
|
1334
|
+
if (isArray2(value)) {
|
|
1335
1335
|
return value;
|
|
1336
1336
|
}
|
|
1337
1337
|
return isKey(value, object) ? [
|
|
@@ -1476,7 +1476,7 @@ var require_hasPath = __commonJS({
|
|
|
1476
1476
|
"use strict";
|
|
1477
1477
|
var castPath = require_castPath();
|
|
1478
1478
|
var isArguments = require_isArguments();
|
|
1479
|
-
var
|
|
1479
|
+
var isArray2 = require_isArray();
|
|
1480
1480
|
var isIndex = require_isIndex();
|
|
1481
1481
|
var isLength = require_isLength();
|
|
1482
1482
|
var toKey = require_toKey();
|
|
@@ -1494,7 +1494,7 @@ var require_hasPath = __commonJS({
|
|
|
1494
1494
|
return result;
|
|
1495
1495
|
}
|
|
1496
1496
|
length = object == null ? 0 : object.length;
|
|
1497
|
-
return !!length && isLength(length) && isIndex(key, length) && (
|
|
1497
|
+
return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object));
|
|
1498
1498
|
}
|
|
1499
1499
|
__name(hasPath, "hasPath");
|
|
1500
1500
|
module2.exports = hasPath;
|
|
@@ -1623,9 +1623,9 @@ var require_set = __commonJS({
|
|
|
1623
1623
|
}
|
|
1624
1624
|
});
|
|
1625
1625
|
|
|
1626
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1626
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.service.js
|
|
1627
1627
|
var require_config_service = __commonJS({
|
|
1628
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1628
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.service.js"(exports2) {
|
|
1629
1629
|
"use strict";
|
|
1630
1630
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
1631
1631
|
if (k2 === void 0) k2 = k;
|
|
@@ -1858,9 +1858,9 @@ var require_config_service = __commonJS({
|
|
|
1858
1858
|
}
|
|
1859
1859
|
});
|
|
1860
1860
|
|
|
1861
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1861
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/config-host.module.js
|
|
1862
1862
|
var require_config_host_module = __commonJS({
|
|
1863
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1863
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/config-host.module.js"(exports2) {
|
|
1864
1864
|
"use strict";
|
|
1865
1865
|
var __decorate = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
|
|
1866
1866
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1903,9 +1903,9 @@ var require_config_host_module = __commonJS({
|
|
|
1903
1903
|
}
|
|
1904
1904
|
});
|
|
1905
1905
|
|
|
1906
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1906
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-config-token.util.js
|
|
1907
1907
|
var require_get_config_token_util = __commonJS({
|
|
1908
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1908
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-config-token.util.js"(exports2) {
|
|
1909
1909
|
"use strict";
|
|
1910
1910
|
Object.defineProperty(exports2, "__esModule", {
|
|
1911
1911
|
value: true
|
|
@@ -1918,9 +1918,9 @@ var require_get_config_token_util = __commonJS({
|
|
|
1918
1918
|
}
|
|
1919
1919
|
});
|
|
1920
1920
|
|
|
1921
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1921
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/create-config-factory.util.js
|
|
1922
1922
|
var require_create_config_factory_util = __commonJS({
|
|
1923
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1923
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/create-config-factory.util.js"(exports2) {
|
|
1924
1924
|
"use strict";
|
|
1925
1925
|
Object.defineProperty(exports2, "__esModule", {
|
|
1926
1926
|
value: true
|
|
@@ -1939,9 +1939,9 @@ var require_create_config_factory_util = __commonJS({
|
|
|
1939
1939
|
}
|
|
1940
1940
|
});
|
|
1941
1941
|
|
|
1942
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1942
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-registration-token.util.js
|
|
1943
1943
|
var require_get_registration_token_util = __commonJS({
|
|
1944
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1944
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-registration-token.util.js"(exports2) {
|
|
1945
1945
|
"use strict";
|
|
1946
1946
|
Object.defineProperty(exports2, "__esModule", {
|
|
1947
1947
|
value: true
|
|
@@ -1955,9 +1955,9 @@ var require_get_registration_token_util = __commonJS({
|
|
|
1955
1955
|
}
|
|
1956
1956
|
});
|
|
1957
1957
|
|
|
1958
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1958
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/merge-configs.util.js
|
|
1959
1959
|
var require_merge_configs_util = __commonJS({
|
|
1960
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1960
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/merge-configs.util.js"(exports2) {
|
|
1961
1961
|
"use strict";
|
|
1962
1962
|
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
1963
1963
|
return mod && mod.__esModule ? mod : {
|
|
@@ -1980,9 +1980,9 @@ var require_merge_configs_util = __commonJS({
|
|
|
1980
1980
|
}
|
|
1981
1981
|
});
|
|
1982
1982
|
|
|
1983
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1983
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.module.js
|
|
1984
1984
|
var require_config_module = __commonJS({
|
|
1985
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
1985
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.module.js"(exports2) {
|
|
1986
1986
|
"use strict";
|
|
1987
1987
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
1988
1988
|
if (k2 === void 0) k2 = k;
|
|
@@ -2237,7 +2237,7 @@ var require_config_module = __commonJS({
|
|
|
2237
2237
|
}
|
|
2238
2238
|
};
|
|
2239
2239
|
exports2.ConfigModule = ConfigModule2;
|
|
2240
|
-
ConfigModule2._envVariablesLoaded = new Promise((
|
|
2240
|
+
ConfigModule2._envVariablesLoaded = new Promise((resolve5) => ConfigModule_1.environmentVariablesLoadedSignal = resolve5);
|
|
2241
2241
|
exports2.ConfigModule = ConfigModule2 = ConfigModule_1 = __decorate([
|
|
2242
2242
|
(0, common_1.Module)({
|
|
2243
2243
|
imports: [
|
|
@@ -2258,9 +2258,9 @@ var require_config_module = __commonJS({
|
|
|
2258
2258
|
}
|
|
2259
2259
|
});
|
|
2260
2260
|
|
|
2261
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2261
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/conditional.module.js
|
|
2262
2262
|
var require_conditional_module = __commonJS({
|
|
2263
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2263
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/conditional.module.js"(exports2) {
|
|
2264
2264
|
"use strict";
|
|
2265
2265
|
Object.defineProperty(exports2, "__esModule", {
|
|
2266
2266
|
value: true
|
|
@@ -2320,9 +2320,9 @@ var require_conditional_module = __commonJS({
|
|
|
2320
2320
|
}
|
|
2321
2321
|
});
|
|
2322
2322
|
|
|
2323
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2323
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/config-object.type.js
|
|
2324
2324
|
var require_config_object_type = __commonJS({
|
|
2325
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2325
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/config-object.type.js"(exports2) {
|
|
2326
2326
|
"use strict";
|
|
2327
2327
|
Object.defineProperty(exports2, "__esModule", {
|
|
2328
2328
|
value: true
|
|
@@ -2330,9 +2330,9 @@ var require_config_object_type = __commonJS({
|
|
|
2330
2330
|
}
|
|
2331
2331
|
});
|
|
2332
2332
|
|
|
2333
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2333
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/config.type.js
|
|
2334
2334
|
var require_config_type = __commonJS({
|
|
2335
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2335
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/config.type.js"(exports2) {
|
|
2336
2336
|
"use strict";
|
|
2337
2337
|
Object.defineProperty(exports2, "__esModule", {
|
|
2338
2338
|
value: true
|
|
@@ -2340,9 +2340,9 @@ var require_config_type = __commonJS({
|
|
|
2340
2340
|
}
|
|
2341
2341
|
});
|
|
2342
2342
|
|
|
2343
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2343
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/no-infer.type.js
|
|
2344
2344
|
var require_no_infer_type = __commonJS({
|
|
2345
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2345
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/no-infer.type.js"(exports2) {
|
|
2346
2346
|
"use strict";
|
|
2347
2347
|
Object.defineProperty(exports2, "__esModule", {
|
|
2348
2348
|
value: true
|
|
@@ -2350,9 +2350,9 @@ var require_no_infer_type = __commonJS({
|
|
|
2350
2350
|
}
|
|
2351
2351
|
});
|
|
2352
2352
|
|
|
2353
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2353
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/path-value.type.js
|
|
2354
2354
|
var require_path_value_type = __commonJS({
|
|
2355
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2355
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/path-value.type.js"(exports2) {
|
|
2356
2356
|
"use strict";
|
|
2357
2357
|
Object.defineProperty(exports2, "__esModule", {
|
|
2358
2358
|
value: true
|
|
@@ -2360,9 +2360,9 @@ var require_path_value_type = __commonJS({
|
|
|
2360
2360
|
}
|
|
2361
2361
|
});
|
|
2362
2362
|
|
|
2363
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2363
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/index.js
|
|
2364
2364
|
var require_types = __commonJS({
|
|
2365
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2365
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/index.js"(exports2) {
|
|
2366
2366
|
"use strict";
|
|
2367
2367
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
2368
2368
|
if (k2 === void 0) k2 = k;
|
|
@@ -2393,9 +2393,9 @@ var require_types = __commonJS({
|
|
|
2393
2393
|
}
|
|
2394
2394
|
});
|
|
2395
2395
|
|
|
2396
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2396
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/register-as.util.js
|
|
2397
2397
|
var require_register_as_util = __commonJS({
|
|
2398
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2398
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/register-as.util.js"(exports2) {
|
|
2399
2399
|
"use strict";
|
|
2400
2400
|
Object.defineProperty(exports2, "__esModule", {
|
|
2401
2401
|
value: true
|
|
@@ -2430,9 +2430,9 @@ var require_register_as_util = __commonJS({
|
|
|
2430
2430
|
}
|
|
2431
2431
|
});
|
|
2432
2432
|
|
|
2433
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2433
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/index.js
|
|
2434
2434
|
var require_utils = __commonJS({
|
|
2435
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2435
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/index.js"(exports2) {
|
|
2436
2436
|
"use strict";
|
|
2437
2437
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
2438
2438
|
if (k2 === void 0) k2 = k;
|
|
@@ -2461,9 +2461,9 @@ var require_utils = __commonJS({
|
|
|
2461
2461
|
}
|
|
2462
2462
|
});
|
|
2463
2463
|
|
|
2464
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2464
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/config-change-event.interface.js
|
|
2465
2465
|
var require_config_change_event_interface = __commonJS({
|
|
2466
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2466
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/config-change-event.interface.js"(exports2) {
|
|
2467
2467
|
"use strict";
|
|
2468
2468
|
Object.defineProperty(exports2, "__esModule", {
|
|
2469
2469
|
value: true
|
|
@@ -2471,9 +2471,9 @@ var require_config_change_event_interface = __commonJS({
|
|
|
2471
2471
|
}
|
|
2472
2472
|
});
|
|
2473
2473
|
|
|
2474
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2474
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/config-factory.interface.js
|
|
2475
2475
|
var require_config_factory_interface = __commonJS({
|
|
2476
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2476
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/config-factory.interface.js"(exports2) {
|
|
2477
2477
|
"use strict";
|
|
2478
2478
|
Object.defineProperty(exports2, "__esModule", {
|
|
2479
2479
|
value: true
|
|
@@ -2481,9 +2481,9 @@ var require_config_factory_interface = __commonJS({
|
|
|
2481
2481
|
}
|
|
2482
2482
|
});
|
|
2483
2483
|
|
|
2484
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2484
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/config-module-options.interface.js
|
|
2485
2485
|
var require_config_module_options_interface = __commonJS({
|
|
2486
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2486
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/config-module-options.interface.js"(exports2) {
|
|
2487
2487
|
"use strict";
|
|
2488
2488
|
Object.defineProperty(exports2, "__esModule", {
|
|
2489
2489
|
value: true
|
|
@@ -2491,9 +2491,9 @@ var require_config_module_options_interface = __commonJS({
|
|
|
2491
2491
|
}
|
|
2492
2492
|
});
|
|
2493
2493
|
|
|
2494
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2494
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/index.js
|
|
2495
2495
|
var require_interfaces = __commonJS({
|
|
2496
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2496
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/index.js"(exports2) {
|
|
2497
2497
|
"use strict";
|
|
2498
2498
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
2499
2499
|
if (k2 === void 0) k2 = k;
|
|
@@ -2523,9 +2523,9 @@ var require_interfaces = __commonJS({
|
|
|
2523
2523
|
}
|
|
2524
2524
|
});
|
|
2525
2525
|
|
|
2526
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2526
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/index.js
|
|
2527
2527
|
var require_dist = __commonJS({
|
|
2528
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2528
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/dist/index.js"(exports2) {
|
|
2529
2529
|
"use strict";
|
|
2530
2530
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
2531
2531
|
if (k2 === void 0) k2 = k;
|
|
@@ -2558,9 +2558,9 @@ var require_dist = __commonJS({
|
|
|
2558
2558
|
}
|
|
2559
2559
|
});
|
|
2560
2560
|
|
|
2561
|
-
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2561
|
+
// node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/index.js
|
|
2562
2562
|
var require_config = __commonJS({
|
|
2563
|
-
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.
|
|
2563
|
+
"node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.23_reflect-metadata@0.2.2_rxjs@7.8.2__rxjs@7.8.2/node_modules/@nestjs/config/index.js"(exports2) {
|
|
2564
2564
|
"use strict";
|
|
2565
2565
|
function __export2(m) {
|
|
2566
2566
|
for (var p in m) if (!exports2.hasOwnProperty(p)) exports2[p] = m[p];
|
|
@@ -2575,7 +2575,9 @@ var require_config = __commonJS({
|
|
|
2575
2575
|
var index_exports = {};
|
|
2576
2576
|
__export(index_exports, {
|
|
2577
2577
|
EjsService: () => EjsService,
|
|
2578
|
+
EtaService: () => EtaService,
|
|
2578
2579
|
MjmlService: () => MjmlService,
|
|
2580
|
+
MustacheService: () => MustacheService,
|
|
2579
2581
|
NestjsPdfModule: () => NestjsPdfModule,
|
|
2580
2582
|
NestjsPdfService: () => NestjsPdfService,
|
|
2581
2583
|
NunjucksService: () => NunjucksService,
|
|
@@ -2587,24 +2589,23 @@ __export(index_exports, {
|
|
|
2587
2589
|
module.exports = __toCommonJS(index_exports);
|
|
2588
2590
|
|
|
2589
2591
|
// src/nestjs-pdf.module.ts
|
|
2590
|
-
var
|
|
2592
|
+
var import_common11 = require("@nestjs/common");
|
|
2591
2593
|
|
|
2592
2594
|
// src/nestjs-pdf.service.ts
|
|
2593
|
-
var
|
|
2595
|
+
var import_common9 = require("@nestjs/common");
|
|
2594
2596
|
|
|
2595
2597
|
// src/puppeteer/puppeteer.service.ts
|
|
2596
|
-
var
|
|
2598
|
+
var import_common8 = require("@nestjs/common");
|
|
2597
2599
|
|
|
2598
|
-
// src/
|
|
2600
|
+
// src/helpers/tokens.ts
|
|
2599
2601
|
var PDF_PARAMETERS = "PDF_PARAMETERS";
|
|
2600
2602
|
var HANDLEBARS_PARAMETERS = "HANDLEBARS_PARAMETERS";
|
|
2601
2603
|
|
|
2602
|
-
// src/puppeteer/browser.service.ts
|
|
2604
|
+
// src/puppeteer/browser/browser.service.ts
|
|
2603
2605
|
var import_common = require("@nestjs/common");
|
|
2604
|
-
var
|
|
2605
|
-
var
|
|
2606
|
-
var
|
|
2607
|
-
var import_puppeteer = __toESM(require("puppeteer"));
|
|
2606
|
+
var import_node_fs = require("fs");
|
|
2607
|
+
var import_node_path = require("path");
|
|
2608
|
+
var import_puppeteer = require("puppeteer");
|
|
2608
2609
|
var import_browsers = require("@puppeteer/browsers");
|
|
2609
2610
|
function _ts_decorate(decorators, target, key, desc) {
|
|
2610
2611
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2630,7 +2631,7 @@ __name(sleep, "sleep");
|
|
|
2630
2631
|
async function rmWithRetries(dir, retries = 5) {
|
|
2631
2632
|
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
2632
2633
|
try {
|
|
2633
|
-
await
|
|
2634
|
+
await import_node_fs.promises.rm(dir, {
|
|
2634
2635
|
recursive: true,
|
|
2635
2636
|
force: true
|
|
2636
2637
|
});
|
|
@@ -2662,7 +2663,7 @@ var BrowserService = class {
|
|
|
2662
2663
|
useLockedBrowser;
|
|
2663
2664
|
buildId;
|
|
2664
2665
|
constructor(pdfParams) {
|
|
2665
|
-
this.cacheDir =
|
|
2666
|
+
this.cacheDir = (0, import_node_path.resolve)(".cache/puppeteer-browser");
|
|
2666
2667
|
this.options = pdfParams;
|
|
2667
2668
|
if (pdfParams.cleanupBrowserCacheOnExit) {
|
|
2668
2669
|
this.registerCleanupHooks();
|
|
@@ -2685,7 +2686,7 @@ var BrowserService = class {
|
|
|
2685
2686
|
async getBrowserInstance(args, headless) {
|
|
2686
2687
|
if (!this._browserInstance?.connected) {
|
|
2687
2688
|
const executablePath = await this.getExecutablePath();
|
|
2688
|
-
this._browserInstance = await import_puppeteer.
|
|
2689
|
+
this._browserInstance = await (0, import_puppeteer.launch)({
|
|
2689
2690
|
executablePath,
|
|
2690
2691
|
headless,
|
|
2691
2692
|
args
|
|
@@ -2735,10 +2736,10 @@ var BrowserService = class {
|
|
|
2735
2736
|
const logger = new import_common.Logger("NestJsPdf");
|
|
2736
2737
|
const dir = this.cacheDir;
|
|
2737
2738
|
try {
|
|
2738
|
-
if (!
|
|
2739
|
+
if (!(0, import_node_fs.existsSync)(dir)) return;
|
|
2739
2740
|
logger.log(`Cleanup puppeteer cache on signal: ${dir}`);
|
|
2740
2741
|
await rmWithRetries(dir, 6);
|
|
2741
|
-
if (
|
|
2742
|
+
if ((0, import_node_fs.existsSync)(dir)) {
|
|
2742
2743
|
await sleep(100);
|
|
2743
2744
|
await rmWithRetries(dir, 3);
|
|
2744
2745
|
}
|
|
@@ -2747,7 +2748,7 @@ var BrowserService = class {
|
|
|
2747
2748
|
logger.error(`Cleanup failed for ${dir}`, err instanceof Error ? err.stack : String(err));
|
|
2748
2749
|
}
|
|
2749
2750
|
try {
|
|
2750
|
-
const leftover = await
|
|
2751
|
+
const leftover = await import_node_fs.promises.readdir(dir, {
|
|
2751
2752
|
recursive: true
|
|
2752
2753
|
});
|
|
2753
2754
|
logger.warn(`Leftover files: ${leftover.slice(0, 20).join(", ")}...`);
|
|
@@ -2758,10 +2759,10 @@ var BrowserService = class {
|
|
|
2758
2759
|
async install(lock = false) {
|
|
2759
2760
|
const browser = this.browser;
|
|
2760
2761
|
const versionTag = this.browserTag;
|
|
2761
|
-
const browserPlatform =
|
|
2762
|
+
const browserPlatform = (0, import_browsers.detectBrowserPlatform)() ?? import_browsers.BrowserPlatform.LINUX;
|
|
2762
2763
|
let buildId;
|
|
2763
2764
|
if (this.buildId === void 0) {
|
|
2764
|
-
buildId = await
|
|
2765
|
+
buildId = await (0, import_browsers.resolveBuildId)(browser, browserPlatform, versionTag);
|
|
2765
2766
|
} else {
|
|
2766
2767
|
buildId = this.buildId;
|
|
2767
2768
|
}
|
|
@@ -2780,9 +2781,9 @@ var BrowserService = class {
|
|
|
2780
2781
|
buildId,
|
|
2781
2782
|
baseUrl: this.options?.browserInstallBaseUrl ?? void 0
|
|
2782
2783
|
};
|
|
2783
|
-
if (await
|
|
2784
|
+
if (await (0, import_browsers.canDownload)(installOption)) {
|
|
2784
2785
|
import_common.Logger.log(`Installing ${installOption.browser} ${installOption.buildId}`, "NestJsPdf");
|
|
2785
|
-
const installedBrowser = await
|
|
2786
|
+
const installedBrowser = await (0, import_browsers.install)(installOption);
|
|
2786
2787
|
if (await this.hasBrowserInstalled(browser, buildId)) {
|
|
2787
2788
|
import_common.Logger.log("Browser installed successfully", "NestJsPdf");
|
|
2788
2789
|
if (lock) {
|
|
@@ -2874,7 +2875,7 @@ var BrowserService = class {
|
|
|
2874
2875
|
this.useLockedBrowser = useLockedBrowser;
|
|
2875
2876
|
}
|
|
2876
2877
|
async hasBrowserInstalled(browser, buildId) {
|
|
2877
|
-
const installedBrowserlist = await
|
|
2878
|
+
const installedBrowserlist = await (0, import_browsers.getInstalledBrowsers)({
|
|
2878
2879
|
cacheDir: this.cacheDir
|
|
2879
2880
|
});
|
|
2880
2881
|
const installedBrowser = installedBrowserlist.find((installedBrowser2) => {
|
|
@@ -2885,14 +2886,14 @@ var BrowserService = class {
|
|
|
2885
2886
|
async getExecutablePath() {
|
|
2886
2887
|
const browser = this.browser;
|
|
2887
2888
|
const versionTag = this.browserTag;
|
|
2888
|
-
const browserPlatform =
|
|
2889
|
+
const browserPlatform = (0, import_browsers.detectBrowserPlatform)() ?? import_browsers.BrowserPlatform.LINUX;
|
|
2889
2890
|
let buildId = null;
|
|
2890
2891
|
if (this.useLockedBrowser) {
|
|
2891
2892
|
buildId = this.getLockedBuildId(browser);
|
|
2892
2893
|
import_common.Logger.log(`Using locked browser ${buildId}`, "NestJsPdf");
|
|
2893
2894
|
}
|
|
2894
|
-
buildId ??= await
|
|
2895
|
-
const installedBrowserlist = await
|
|
2895
|
+
buildId ??= await (0, import_browsers.resolveBuildId)(browser, browserPlatform, versionTag);
|
|
2896
|
+
const installedBrowserlist = await (0, import_browsers.getInstalledBrowsers)({
|
|
2896
2897
|
cacheDir: this.cacheDir
|
|
2897
2898
|
});
|
|
2898
2899
|
const installedBrowser = installedBrowserlist.find((installedBrowser2) => {
|
|
@@ -2909,19 +2910,19 @@ var BrowserService = class {
|
|
|
2909
2910
|
return installedBrowser.executablePath;
|
|
2910
2911
|
}
|
|
2911
2912
|
writeLockFile(browser, buildId) {
|
|
2912
|
-
const lockFile =
|
|
2913
|
+
const lockFile = (0, import_node_path.resolve)(this.cacheDir, `${browser}.lock`);
|
|
2913
2914
|
const data = JSON.stringify({
|
|
2914
2915
|
browser,
|
|
2915
2916
|
buildId,
|
|
2916
2917
|
date: (/* @__PURE__ */ new Date()).toISOString()
|
|
2917
2918
|
});
|
|
2918
|
-
|
|
2919
|
+
(0, import_node_fs.writeFileSync)(lockFile, data);
|
|
2919
2920
|
import_common.Logger.log(`Browser ${browser} locked to build ${buildId}`, "NestJsPdf");
|
|
2920
2921
|
}
|
|
2921
2922
|
getLockedBuildId(browser) {
|
|
2922
|
-
const lockFile =
|
|
2923
|
-
if (
|
|
2924
|
-
const data =
|
|
2923
|
+
const lockFile = (0, import_node_path.resolve)(this.cacheDir, `${browser}.lock`);
|
|
2924
|
+
if ((0, import_node_fs.existsSync)(lockFile)) {
|
|
2925
|
+
const data = (0, import_node_fs.readFileSync)(lockFile);
|
|
2925
2926
|
const lock = JSON.parse(data.toString());
|
|
2926
2927
|
return lock.buildId;
|
|
2927
2928
|
}
|
|
@@ -2953,10 +2954,10 @@ __name(mergePuppeteerParameters, "mergePuppeteerParameters");
|
|
|
2953
2954
|
var import_p_limit = __toESM(require("p-limit"));
|
|
2954
2955
|
var import_nestjs_hbs = require("@gboutte/nestjs-hbs");
|
|
2955
2956
|
|
|
2956
|
-
// src/puppeteer/
|
|
2957
|
+
// src/puppeteer/engines/mjml/mjml.service.ts
|
|
2957
2958
|
var import_common2 = require("@nestjs/common");
|
|
2958
2959
|
var import_mjml = __toESM(require("mjml"));
|
|
2959
|
-
var
|
|
2960
|
+
var import_node_fs2 = require("fs");
|
|
2960
2961
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
2961
2962
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2962
2963
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2973,7 +2974,7 @@ var MjmlService = class {
|
|
|
2973
2974
|
return html;
|
|
2974
2975
|
}
|
|
2975
2976
|
async renderFile(filePath, options) {
|
|
2976
|
-
const template = (0,
|
|
2977
|
+
const template = (0, import_node_fs2.readFileSync)(filePath, "utf-8");
|
|
2977
2978
|
return await this.render(template, options);
|
|
2978
2979
|
}
|
|
2979
2980
|
};
|
|
@@ -2981,10 +2982,10 @@ MjmlService = _ts_decorate2([
|
|
|
2981
2982
|
(0, import_common2.Injectable)()
|
|
2982
2983
|
], MjmlService);
|
|
2983
2984
|
|
|
2984
|
-
// src/puppeteer/
|
|
2985
|
+
// src/puppeteer/engines/pug/pug.service.ts
|
|
2985
2986
|
var import_common3 = require("@nestjs/common");
|
|
2986
|
-
var
|
|
2987
|
-
var
|
|
2987
|
+
var import_node_fs3 = require("fs");
|
|
2988
|
+
var import_pug = require("pug");
|
|
2988
2989
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
2989
2990
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2990
2991
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2998,7 +2999,7 @@ var PugService = class {
|
|
|
2998
2999
|
}
|
|
2999
3000
|
render(template, data = {}, options) {
|
|
3000
3001
|
try {
|
|
3001
|
-
const compiledFn = import_pug.
|
|
3002
|
+
const compiledFn = (0, import_pug.compile)(template, {
|
|
3002
3003
|
...options
|
|
3003
3004
|
});
|
|
3004
3005
|
return compiledFn(data);
|
|
@@ -3010,7 +3011,7 @@ var PugService = class {
|
|
|
3010
3011
|
}
|
|
3011
3012
|
renderFile(filePath, data = {}, options) {
|
|
3012
3013
|
try {
|
|
3013
|
-
const template = (0,
|
|
3014
|
+
const template = (0, import_node_fs3.readFileSync)(filePath, "utf-8");
|
|
3014
3015
|
return this.render(template, data, options);
|
|
3015
3016
|
} catch (error) {
|
|
3016
3017
|
throw new Error(`Pug file rendering failed: ${String(error)}`, {
|
|
@@ -3023,7 +3024,7 @@ PugService = _ts_decorate3([
|
|
|
3023
3024
|
(0, import_common3.Injectable)()
|
|
3024
3025
|
], PugService);
|
|
3025
3026
|
|
|
3026
|
-
// src/puppeteer/
|
|
3027
|
+
// src/puppeteer/engines/ejs/ejs.service.ts
|
|
3027
3028
|
var import_common4 = require("@nestjs/common");
|
|
3028
3029
|
var import_ejs = require("ejs");
|
|
3029
3030
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
@@ -3066,9 +3067,9 @@ EjsService = _ts_decorate4([
|
|
|
3066
3067
|
(0, import_common4.Injectable)()
|
|
3067
3068
|
], EjsService);
|
|
3068
3069
|
|
|
3069
|
-
// src/puppeteer/
|
|
3070
|
+
// src/puppeteer/engines/nunjucks/nunjucks.service.ts
|
|
3070
3071
|
var import_common5 = require("@nestjs/common");
|
|
3071
|
-
var
|
|
3072
|
+
var import_nunjucks = require("nunjucks");
|
|
3072
3073
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
3073
3074
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3074
3075
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3085,7 +3086,7 @@ var NunjucksService = class {
|
|
|
3085
3086
|
__name(this, "NunjucksService");
|
|
3086
3087
|
}
|
|
3087
3088
|
constructor() {
|
|
3088
|
-
|
|
3089
|
+
(0, import_nunjucks.configure)({
|
|
3089
3090
|
noCache: true,
|
|
3090
3091
|
trimBlocks: true,
|
|
3091
3092
|
lstripBlocks: true
|
|
@@ -3101,9 +3102,9 @@ var NunjucksService = class {
|
|
|
3101
3102
|
trimBlocks: options.trimBlocks ?? true,
|
|
3102
3103
|
lstripBlocks: options.lstripBlocks ?? true
|
|
3103
3104
|
};
|
|
3104
|
-
|
|
3105
|
+
(0, import_nunjucks.configure)(configOptions);
|
|
3105
3106
|
}
|
|
3106
|
-
return
|
|
3107
|
+
return (0, import_nunjucks.renderString)(template, data);
|
|
3107
3108
|
} catch (error) {
|
|
3108
3109
|
throw new Error(`Nunjucks rendering failed: ${String(error)}`, {
|
|
3109
3110
|
cause: error
|
|
@@ -3120,9 +3121,9 @@ var NunjucksService = class {
|
|
|
3120
3121
|
trimBlocks: options.trimBlocks ?? true,
|
|
3121
3122
|
lstripBlocks: options.lstripBlocks ?? true
|
|
3122
3123
|
};
|
|
3123
|
-
|
|
3124
|
+
(0, import_nunjucks.configure)(configOptions);
|
|
3124
3125
|
}
|
|
3125
|
-
return
|
|
3126
|
+
return (0, import_nunjucks.render)(filePath, data);
|
|
3126
3127
|
} catch (error) {
|
|
3127
3128
|
throw new Error(`Nunjucks file rendering failed: ${String(error)}`, {
|
|
3128
3129
|
cause: error
|
|
@@ -3136,7 +3137,508 @@ NunjucksService = _ts_decorate5([
|
|
|
3136
3137
|
_ts_metadata2("design:paramtypes", [])
|
|
3137
3138
|
], NunjucksService);
|
|
3138
3139
|
|
|
3139
|
-
// src/puppeteer/
|
|
3140
|
+
// src/puppeteer/engines/eta/eta.service.ts
|
|
3141
|
+
var import_common6 = require("@nestjs/common");
|
|
3142
|
+
|
|
3143
|
+
// node_modules/.pnpm/eta@4.6.0/node_modules/eta/dist/index.mjs
|
|
3144
|
+
var fs = __toESM(require("fs"), 1);
|
|
3145
|
+
var path = __toESM(require("path"), 1);
|
|
3146
|
+
var EtaError = class extends Error {
|
|
3147
|
+
static {
|
|
3148
|
+
__name(this, "EtaError");
|
|
3149
|
+
}
|
|
3150
|
+
constructor(message) {
|
|
3151
|
+
super(message);
|
|
3152
|
+
this.name = "Eta Error";
|
|
3153
|
+
}
|
|
3154
|
+
};
|
|
3155
|
+
var EtaParseError = class extends EtaError {
|
|
3156
|
+
static {
|
|
3157
|
+
__name(this, "EtaParseError");
|
|
3158
|
+
}
|
|
3159
|
+
constructor(message) {
|
|
3160
|
+
super(message);
|
|
3161
|
+
this.name = "EtaParser Error";
|
|
3162
|
+
}
|
|
3163
|
+
};
|
|
3164
|
+
var EtaRuntimeError = class extends EtaError {
|
|
3165
|
+
static {
|
|
3166
|
+
__name(this, "EtaRuntimeError");
|
|
3167
|
+
}
|
|
3168
|
+
constructor(message) {
|
|
3169
|
+
super(message);
|
|
3170
|
+
this.name = "EtaRuntime Error";
|
|
3171
|
+
}
|
|
3172
|
+
};
|
|
3173
|
+
var EtaFileResolutionError = class extends EtaError {
|
|
3174
|
+
static {
|
|
3175
|
+
__name(this, "EtaFileResolutionError");
|
|
3176
|
+
}
|
|
3177
|
+
constructor(message) {
|
|
3178
|
+
super(message);
|
|
3179
|
+
this.name = "EtaFileResolution Error";
|
|
3180
|
+
}
|
|
3181
|
+
};
|
|
3182
|
+
var EtaNameResolutionError = class extends EtaError {
|
|
3183
|
+
static {
|
|
3184
|
+
__name(this, "EtaNameResolutionError");
|
|
3185
|
+
}
|
|
3186
|
+
constructor(message) {
|
|
3187
|
+
super(message);
|
|
3188
|
+
this.name = "EtaNameResolution Error";
|
|
3189
|
+
}
|
|
3190
|
+
};
|
|
3191
|
+
function ParseErr(message, str, indx) {
|
|
3192
|
+
const whitespace = str.slice(0, indx).split(/\n/);
|
|
3193
|
+
const lineNo = whitespace.length;
|
|
3194
|
+
const colNo = whitespace[lineNo - 1].length + 1;
|
|
3195
|
+
message += " at line " + lineNo + " col " + colNo + ":\n\n " + str.split(/\n/)[lineNo - 1] + "\n " + Array(colNo).join(" ") + "^";
|
|
3196
|
+
throw new EtaParseError(message);
|
|
3197
|
+
}
|
|
3198
|
+
__name(ParseErr, "ParseErr");
|
|
3199
|
+
function RuntimeErr(originalError, str, lineNo, path$1) {
|
|
3200
|
+
const lines = str.split("\n");
|
|
3201
|
+
const start = Math.max(lineNo - 3, 0);
|
|
3202
|
+
const end = Math.min(lines.length, lineNo + 3);
|
|
3203
|
+
const filename = path$1;
|
|
3204
|
+
const context = lines.slice(start, end).map((line, i) => {
|
|
3205
|
+
const curr = i + start + 1;
|
|
3206
|
+
return (curr === lineNo ? " >> " : " ") + curr + "| " + line;
|
|
3207
|
+
}).join("\n");
|
|
3208
|
+
const err = new EtaRuntimeError((filename ? filename + ":" + lineNo + "\n" : "line " + lineNo + "\n") + context + "\n\n" + originalError.message);
|
|
3209
|
+
err.name = originalError.name;
|
|
3210
|
+
err.cause = originalError;
|
|
3211
|
+
throw err;
|
|
3212
|
+
}
|
|
3213
|
+
__name(RuntimeErr, "RuntimeErr");
|
|
3214
|
+
function readFile(path$1) {
|
|
3215
|
+
let res = "";
|
|
3216
|
+
try {
|
|
3217
|
+
res = fs.readFileSync(path$1, "utf8");
|
|
3218
|
+
} catch (err) {
|
|
3219
|
+
if (err?.code === "ENOENT") throw new EtaFileResolutionError(`Could not find template: ${path$1}`);
|
|
3220
|
+
else throw err;
|
|
3221
|
+
}
|
|
3222
|
+
return res;
|
|
3223
|
+
}
|
|
3224
|
+
__name(readFile, "readFile");
|
|
3225
|
+
function resolvePath(templatePath, options) {
|
|
3226
|
+
let resolvedFilePath = "";
|
|
3227
|
+
const views = this.config.views;
|
|
3228
|
+
if (!views) throw new EtaFileResolutionError("Views directory is not defined");
|
|
3229
|
+
const baseFilePath = options?.filepath;
|
|
3230
|
+
const defaultExtension = this.config.defaultExtension === void 0 ? ".eta" : this.config.defaultExtension;
|
|
3231
|
+
const cacheIndex = JSON.stringify({
|
|
3232
|
+
filename: baseFilePath,
|
|
3233
|
+
path: templatePath,
|
|
3234
|
+
views: this.config.views
|
|
3235
|
+
});
|
|
3236
|
+
templatePath += path.extname(templatePath) ? "" : defaultExtension;
|
|
3237
|
+
if (baseFilePath) {
|
|
3238
|
+
if (this.config.cacheFilepaths && this.filepathCache[cacheIndex]) return this.filepathCache[cacheIndex];
|
|
3239
|
+
if (absolutePathRegExp.exec(templatePath)?.length) {
|
|
3240
|
+
const formattedPath = templatePath.replace(/^\/*|^\\*/, "");
|
|
3241
|
+
resolvedFilePath = path.join(views, formattedPath);
|
|
3242
|
+
} else resolvedFilePath = path.join(path.dirname(baseFilePath), templatePath);
|
|
3243
|
+
} else resolvedFilePath = path.join(views, templatePath);
|
|
3244
|
+
if (dirIsChild(views, resolvedFilePath)) {
|
|
3245
|
+
if (baseFilePath && this.config.cacheFilepaths) this.filepathCache[cacheIndex] = resolvedFilePath;
|
|
3246
|
+
return resolvedFilePath;
|
|
3247
|
+
} else throw new EtaFileResolutionError(`Template '${templatePath}' is not in the views directory`);
|
|
3248
|
+
}
|
|
3249
|
+
__name(resolvePath, "resolvePath");
|
|
3250
|
+
function dirIsChild(parent, dir) {
|
|
3251
|
+
const relative3 = path.relative(parent, dir);
|
|
3252
|
+
return relative3 && !relative3.startsWith("..") && !path.isAbsolute(relative3);
|
|
3253
|
+
}
|
|
3254
|
+
__name(dirIsChild, "dirIsChild");
|
|
3255
|
+
var absolutePathRegExp = /^\\|^\//;
|
|
3256
|
+
var AsyncFunction = (async () => {
|
|
3257
|
+
}).constructor;
|
|
3258
|
+
function compile2(str, options) {
|
|
3259
|
+
const config = this.config;
|
|
3260
|
+
const ctor = options?.async ? AsyncFunction : Function;
|
|
3261
|
+
try {
|
|
3262
|
+
return new ctor(config.varName, "options", this.compileToString.call(this, str, options));
|
|
3263
|
+
} catch (e) {
|
|
3264
|
+
if (e instanceof SyntaxError) throw new EtaParseError("Bad template syntax\n\n" + e.message + "\n" + Array(e.message.length + 1).join("=") + "\n" + this.compileToString.call(this, str, options) + "\n");
|
|
3265
|
+
else throw e;
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
__name(compile2, "compile");
|
|
3269
|
+
function compileToString(str, options) {
|
|
3270
|
+
const config = this.config;
|
|
3271
|
+
const isAsync = options?.async;
|
|
3272
|
+
const compileBody$1 = this.compileBody;
|
|
3273
|
+
const buffer = this.parse.call(this, str);
|
|
3274
|
+
let res = `${config.functionHeader}
|
|
3275
|
+
let include = (__eta_t, __eta_d) => this.render(__eta_t, {...${config.varName}, ...(__eta_d ?? {})}, options);
|
|
3276
|
+
let includeAsync = (__eta_t, __eta_d) => this.renderAsync(__eta_t, {...${config.varName}, ...(__eta_d ?? {})}, options);
|
|
3277
|
+
|
|
3278
|
+
let __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction, blocks: {}${config.debug ? ', line: 1, templateStr: "' + str.replace(/\\|"/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n") + '"' : ""}};
|
|
3279
|
+
|
|
3280
|
+
function layout(path, data) {
|
|
3281
|
+
__eta.layout = path;
|
|
3282
|
+
__eta.layoutData = data;
|
|
3283
|
+
}${config.debug ? "try {" : ""}${config.useWith ? "with(" + config.varName + "||{}){" : ""}
|
|
3284
|
+
|
|
3285
|
+
function ${config.outputFunctionName}(s){__eta.res+=s;}
|
|
3286
|
+
function capture(fn){const s=__eta.res;__eta.res='';try{fn();return __eta.res}finally{__eta.res=s;}}
|
|
3287
|
+
async function captureAsync(fn){const s=__eta.res;__eta.res='';try{await fn();return __eta.res}finally{__eta.res=s;}}
|
|
3288
|
+
function block(name,fn){if(__eta.layout){if(fn){__eta.blocks[name]=capture(fn);}return '';}const b=${config.varName}.__blocks||{};if(name in b){return b[name];}return fn?capture(fn):'';}
|
|
3289
|
+
async function blockAsync(name,fn){if(__eta.layout){if(fn){__eta.blocks[name]=await captureAsync(fn);}return '';}const b=${config.varName}.__blocks||{};if(name in b){return b[name];}return fn?await captureAsync(fn):'';}
|
|
3290
|
+
|
|
3291
|
+
${compileBody$1.call(this, buffer)}
|
|
3292
|
+
if (__eta.layout) {
|
|
3293
|
+
__eta.res = ${isAsync ? "await includeAsync" : "include"} (__eta.layout, {...${config.varName}, body: __eta.res, ...__eta.layoutData, __blocks: __eta.blocks});
|
|
3294
|
+
}
|
|
3295
|
+
${config.useWith ? "}" : ""}${config.debug ? "} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }" : ""}
|
|
3296
|
+
return __eta.res;
|
|
3297
|
+
`;
|
|
3298
|
+
if (config.plugins) for (let i = 0; i < config.plugins.length; i++) {
|
|
3299
|
+
const plugin = config.plugins[i];
|
|
3300
|
+
if (plugin.processFnString) res = plugin.processFnString(res, config);
|
|
3301
|
+
}
|
|
3302
|
+
return res;
|
|
3303
|
+
}
|
|
3304
|
+
__name(compileToString, "compileToString");
|
|
3305
|
+
function compileBody(buff) {
|
|
3306
|
+
const config = this.config;
|
|
3307
|
+
let i = 0;
|
|
3308
|
+
const buffLength = buff.length;
|
|
3309
|
+
let returnStr = "";
|
|
3310
|
+
for (; i < buffLength; i++) {
|
|
3311
|
+
const currentBlock = buff[i];
|
|
3312
|
+
if (typeof currentBlock === "string") returnStr += "__eta.res+='" + currentBlock + "';\n";
|
|
3313
|
+
else {
|
|
3314
|
+
const type = currentBlock.t;
|
|
3315
|
+
let content = currentBlock.val || "";
|
|
3316
|
+
if (config.debug) returnStr += "__eta.line=" + currentBlock.lineNo + "\n";
|
|
3317
|
+
if (type === "r") {
|
|
3318
|
+
if (config.autoFilter) content = "__eta.f(" + content + ")";
|
|
3319
|
+
returnStr += "__eta.res+=" + content + ";\n";
|
|
3320
|
+
} else if (type === "i") {
|
|
3321
|
+
if (config.autoFilter) content = "__eta.f(" + content + ")";
|
|
3322
|
+
if (config.autoEscape) content = "__eta.e(" + content + ")";
|
|
3323
|
+
returnStr += "__eta.res+=" + content + ";\n";
|
|
3324
|
+
} else if (type === "e") returnStr += content + "\n";
|
|
3325
|
+
else if (Object.hasOwn(config.customTags, type)) returnStr += `__eta.res+=this.config.customTags[${JSON.stringify(type)}](${JSON.stringify(content)},${config.varName});
|
|
3326
|
+
`;
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
return returnStr;
|
|
3330
|
+
}
|
|
3331
|
+
__name(compileBody, "compileBody");
|
|
3332
|
+
function trimWS(str, config, wsLeft, wsRight) {
|
|
3333
|
+
let leftTrim;
|
|
3334
|
+
let rightTrim;
|
|
3335
|
+
if (Array.isArray(config.autoTrim)) {
|
|
3336
|
+
leftTrim = config.autoTrim[1];
|
|
3337
|
+
rightTrim = config.autoTrim[0];
|
|
3338
|
+
} else leftTrim = rightTrim = config.autoTrim;
|
|
3339
|
+
if (wsLeft || wsLeft === false) leftTrim = wsLeft;
|
|
3340
|
+
if (wsRight || wsRight === false) rightTrim = wsRight;
|
|
3341
|
+
if (!rightTrim && !leftTrim) return str;
|
|
3342
|
+
if (leftTrim === "slurp" && rightTrim === "slurp") return str.trim();
|
|
3343
|
+
if (leftTrim === "_" || leftTrim === "slurp") str = str.trimStart();
|
|
3344
|
+
else if (leftTrim === "-" || leftTrim === "nl") str = str.replace(/^(?:\r\n|\n|\r)/, "");
|
|
3345
|
+
if (rightTrim === "_" || rightTrim === "slurp") str = str.trimEnd();
|
|
3346
|
+
else if (rightTrim === "-" || rightTrim === "nl") str = str.replace(/(?:\r\n|\n|\r)$/, "");
|
|
3347
|
+
return str;
|
|
3348
|
+
}
|
|
3349
|
+
__name(trimWS, "trimWS");
|
|
3350
|
+
var escMap = {
|
|
3351
|
+
"&": "&",
|
|
3352
|
+
"<": "<",
|
|
3353
|
+
">": ">",
|
|
3354
|
+
'"': """,
|
|
3355
|
+
"'": "'"
|
|
3356
|
+
};
|
|
3357
|
+
function replaceChar(s) {
|
|
3358
|
+
return escMap[s];
|
|
3359
|
+
}
|
|
3360
|
+
__name(replaceChar, "replaceChar");
|
|
3361
|
+
function XMLEscape(str) {
|
|
3362
|
+
const newStr = String(str);
|
|
3363
|
+
if (/[&<>"']/.test(newStr)) return newStr.replace(/[&<>"']/g, replaceChar);
|
|
3364
|
+
else return newStr;
|
|
3365
|
+
}
|
|
3366
|
+
__name(XMLEscape, "XMLEscape");
|
|
3367
|
+
var defaultConfig = {
|
|
3368
|
+
autoEscape: true,
|
|
3369
|
+
autoFilter: false,
|
|
3370
|
+
autoTrim: [false, "nl"],
|
|
3371
|
+
cache: false,
|
|
3372
|
+
cacheFilepaths: true,
|
|
3373
|
+
customTags: {},
|
|
3374
|
+
debug: false,
|
|
3375
|
+
escapeFunction: XMLEscape,
|
|
3376
|
+
filterFunction: /* @__PURE__ */ __name((val) => String(val), "filterFunction"),
|
|
3377
|
+
outputFunctionName: "output",
|
|
3378
|
+
functionHeader: "",
|
|
3379
|
+
parse: {
|
|
3380
|
+
exec: "",
|
|
3381
|
+
interpolate: "=",
|
|
3382
|
+
raw: "~"
|
|
3383
|
+
},
|
|
3384
|
+
plugins: [],
|
|
3385
|
+
rmWhitespace: false,
|
|
3386
|
+
tags: ["<%", "%>"],
|
|
3387
|
+
useWith: false,
|
|
3388
|
+
varName: "it",
|
|
3389
|
+
defaultExtension: ".eta"
|
|
3390
|
+
};
|
|
3391
|
+
var templateLitReg = /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g;
|
|
3392
|
+
var singleQuoteReg = /'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g;
|
|
3393
|
+
var doubleQuoteReg = /"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;
|
|
3394
|
+
function escapeRegExp(string) {
|
|
3395
|
+
return string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
|
|
3396
|
+
}
|
|
3397
|
+
__name(escapeRegExp, "escapeRegExp");
|
|
3398
|
+
function getLineNo(str, index) {
|
|
3399
|
+
return str.slice(0, index).split("\n").length;
|
|
3400
|
+
}
|
|
3401
|
+
__name(getLineNo, "getLineNo");
|
|
3402
|
+
function parse(str) {
|
|
3403
|
+
const config = this.config;
|
|
3404
|
+
let buffer = [];
|
|
3405
|
+
let trimLeftOfNextStr = false;
|
|
3406
|
+
let lastIndex = 0;
|
|
3407
|
+
const parseOptions = config.parse;
|
|
3408
|
+
const customTagPrefixes = Object.keys(config.customTags);
|
|
3409
|
+
if (config.plugins) for (let i = 0; i < config.plugins.length; i++) {
|
|
3410
|
+
const plugin = config.plugins[i];
|
|
3411
|
+
if (plugin.processTemplate) str = plugin.processTemplate(str, config);
|
|
3412
|
+
}
|
|
3413
|
+
if (config.rmWhitespace) str = str.replace(/[\r\n]+/g, "\n").replace(/^\s+|\s+$/gm, "");
|
|
3414
|
+
templateLitReg.lastIndex = 0;
|
|
3415
|
+
singleQuoteReg.lastIndex = 0;
|
|
3416
|
+
doubleQuoteReg.lastIndex = 0;
|
|
3417
|
+
function pushString(strng, shouldTrimRightOfString) {
|
|
3418
|
+
if (strng) {
|
|
3419
|
+
strng = trimWS(strng, config, trimLeftOfNextStr, shouldTrimRightOfString);
|
|
3420
|
+
if (strng) {
|
|
3421
|
+
strng = strng.replace(/\\|'/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n");
|
|
3422
|
+
buffer.push(strng);
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
__name(pushString, "pushString");
|
|
3427
|
+
const prefixes = [
|
|
3428
|
+
parseOptions.exec,
|
|
3429
|
+
parseOptions.interpolate,
|
|
3430
|
+
parseOptions.raw,
|
|
3431
|
+
...customTagPrefixes
|
|
3432
|
+
].reduce((accumulator, prefix) => {
|
|
3433
|
+
if (accumulator && prefix) return accumulator + "|" + escapeRegExp(prefix);
|
|
3434
|
+
else if (prefix) return escapeRegExp(prefix);
|
|
3435
|
+
else return accumulator;
|
|
3436
|
+
}, "");
|
|
3437
|
+
const parseOpenReg = new RegExp(escapeRegExp(config.tags[0]) + "(-|_)?\\s*(" + prefixes + ")?\\s*", "g");
|
|
3438
|
+
const parseCloseReg = new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?" + escapeRegExp(config.tags[1]) + ")", "g");
|
|
3439
|
+
let m;
|
|
3440
|
+
while (m = parseOpenReg.exec(str)) {
|
|
3441
|
+
const precedingString = str.slice(lastIndex, m.index);
|
|
3442
|
+
lastIndex = m[0].length + m.index;
|
|
3443
|
+
const wsLeft = m[1];
|
|
3444
|
+
const prefix = m[2] || "";
|
|
3445
|
+
pushString(precedingString, wsLeft);
|
|
3446
|
+
parseCloseReg.lastIndex = lastIndex;
|
|
3447
|
+
let closeTag;
|
|
3448
|
+
let currentObj = false;
|
|
3449
|
+
while (closeTag = parseCloseReg.exec(str)) if (closeTag[1]) {
|
|
3450
|
+
const content = str.slice(lastIndex, closeTag.index);
|
|
3451
|
+
parseOpenReg.lastIndex = lastIndex = parseCloseReg.lastIndex;
|
|
3452
|
+
trimLeftOfNextStr = closeTag[2];
|
|
3453
|
+
currentObj = {
|
|
3454
|
+
t: prefix === parseOptions.exec ? "e" : prefix === parseOptions.raw ? "r" : prefix === parseOptions.interpolate ? "i" : customTagPrefixes.includes(prefix) ? prefix : "",
|
|
3455
|
+
val: content
|
|
3456
|
+
};
|
|
3457
|
+
break;
|
|
3458
|
+
} else {
|
|
3459
|
+
const char = closeTag[0];
|
|
3460
|
+
if (char === "/*") {
|
|
3461
|
+
const commentCloseInd = str.indexOf("*/", parseCloseReg.lastIndex);
|
|
3462
|
+
if (commentCloseInd === -1) ParseErr("unclosed comment", str, closeTag.index);
|
|
3463
|
+
parseCloseReg.lastIndex = commentCloseInd;
|
|
3464
|
+
} else if (char === "'") {
|
|
3465
|
+
singleQuoteReg.lastIndex = closeTag.index;
|
|
3466
|
+
if (singleQuoteReg.exec(str)) parseCloseReg.lastIndex = singleQuoteReg.lastIndex;
|
|
3467
|
+
else ParseErr("unclosed string", str, closeTag.index);
|
|
3468
|
+
} else if (char === '"') {
|
|
3469
|
+
doubleQuoteReg.lastIndex = closeTag.index;
|
|
3470
|
+
if (doubleQuoteReg.exec(str)) parseCloseReg.lastIndex = doubleQuoteReg.lastIndex;
|
|
3471
|
+
else ParseErr("unclosed string", str, closeTag.index);
|
|
3472
|
+
} else if (char === "`") {
|
|
3473
|
+
templateLitReg.lastIndex = closeTag.index;
|
|
3474
|
+
if (templateLitReg.exec(str)) parseCloseReg.lastIndex = templateLitReg.lastIndex;
|
|
3475
|
+
else ParseErr("unclosed string", str, closeTag.index);
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
if (currentObj) {
|
|
3479
|
+
if (config.debug) currentObj.lineNo = getLineNo(str, m.index);
|
|
3480
|
+
buffer.push(currentObj);
|
|
3481
|
+
} else ParseErr("unclosed tag", str, m.index);
|
|
3482
|
+
}
|
|
3483
|
+
pushString(str.slice(lastIndex, str.length), false);
|
|
3484
|
+
if (config.plugins) for (let i = 0; i < config.plugins.length; i++) {
|
|
3485
|
+
const plugin = config.plugins[i];
|
|
3486
|
+
if (plugin.processAST) buffer = plugin.processAST(buffer, config);
|
|
3487
|
+
}
|
|
3488
|
+
return buffer;
|
|
3489
|
+
}
|
|
3490
|
+
__name(parse, "parse");
|
|
3491
|
+
function handleCache(template, options) {
|
|
3492
|
+
const templateStore = options?.async ? this.templatesAsync : this.templatesSync;
|
|
3493
|
+
if (this.resolvePath && this.readFile && !template.startsWith("@")) {
|
|
3494
|
+
const templatePath = options.filepath;
|
|
3495
|
+
const cachedTemplate = templateStore.get(templatePath);
|
|
3496
|
+
if (this.config.cache && cachedTemplate) return cachedTemplate;
|
|
3497
|
+
else {
|
|
3498
|
+
const templateString = this.readFile(templatePath);
|
|
3499
|
+
const templateFn = this.compile(templateString, options);
|
|
3500
|
+
if (this.config.cache) templateStore.define(templatePath, templateFn);
|
|
3501
|
+
return templateFn;
|
|
3502
|
+
}
|
|
3503
|
+
} else {
|
|
3504
|
+
const cachedTemplate = templateStore.get(template);
|
|
3505
|
+
if (cachedTemplate) return cachedTemplate;
|
|
3506
|
+
else throw new EtaNameResolutionError(`Failed to get template '${template}'`);
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
__name(handleCache, "handleCache");
|
|
3510
|
+
function render3(template, data, meta) {
|
|
3511
|
+
let templateFn;
|
|
3512
|
+
const options = {
|
|
3513
|
+
...meta,
|
|
3514
|
+
async: false
|
|
3515
|
+
};
|
|
3516
|
+
if (typeof template === "string") {
|
|
3517
|
+
if (this.resolvePath && this.readFile && !template.startsWith("@")) options.filepath = this.resolvePath(template, options);
|
|
3518
|
+
templateFn = handleCache.call(this, template, options);
|
|
3519
|
+
} else templateFn = template;
|
|
3520
|
+
return templateFn.call(this, data, options);
|
|
3521
|
+
}
|
|
3522
|
+
__name(render3, "render");
|
|
3523
|
+
function renderAsync(template, data, meta) {
|
|
3524
|
+
let templateFn;
|
|
3525
|
+
const options = {
|
|
3526
|
+
...meta,
|
|
3527
|
+
async: true
|
|
3528
|
+
};
|
|
3529
|
+
if (typeof template === "string") {
|
|
3530
|
+
if (this.resolvePath && this.readFile && !template.startsWith("@")) options.filepath = this.resolvePath(template, options);
|
|
3531
|
+
templateFn = handleCache.call(this, template, options);
|
|
3532
|
+
} else templateFn = template;
|
|
3533
|
+
const res = templateFn.call(this, data, options);
|
|
3534
|
+
return Promise.resolve(res);
|
|
3535
|
+
}
|
|
3536
|
+
__name(renderAsync, "renderAsync");
|
|
3537
|
+
function renderString2(template, data) {
|
|
3538
|
+
const templateFn = this.compile(template, { async: false });
|
|
3539
|
+
return render3.call(this, templateFn, data);
|
|
3540
|
+
}
|
|
3541
|
+
__name(renderString2, "renderString");
|
|
3542
|
+
function renderStringAsync(template, data) {
|
|
3543
|
+
const templateFn = this.compile(template, { async: true });
|
|
3544
|
+
return renderAsync.call(this, templateFn, data);
|
|
3545
|
+
}
|
|
3546
|
+
__name(renderStringAsync, "renderStringAsync");
|
|
3547
|
+
var Cacher = class {
|
|
3548
|
+
static {
|
|
3549
|
+
__name(this, "Cacher");
|
|
3550
|
+
}
|
|
3551
|
+
constructor(cache) {
|
|
3552
|
+
this.cache = cache;
|
|
3553
|
+
}
|
|
3554
|
+
define(key, val) {
|
|
3555
|
+
this.cache[key] = val;
|
|
3556
|
+
}
|
|
3557
|
+
get(key) {
|
|
3558
|
+
return this.cache[key];
|
|
3559
|
+
}
|
|
3560
|
+
remove(key) {
|
|
3561
|
+
delete this.cache[key];
|
|
3562
|
+
}
|
|
3563
|
+
reset() {
|
|
3564
|
+
this.cache = {};
|
|
3565
|
+
}
|
|
3566
|
+
load(cacheObj) {
|
|
3567
|
+
this.cache = {
|
|
3568
|
+
...this.cache,
|
|
3569
|
+
...cacheObj
|
|
3570
|
+
};
|
|
3571
|
+
}
|
|
3572
|
+
};
|
|
3573
|
+
var Eta$1 = class {
|
|
3574
|
+
static {
|
|
3575
|
+
__name(this, "Eta$1");
|
|
3576
|
+
}
|
|
3577
|
+
constructor(customConfig) {
|
|
3578
|
+
if (customConfig) this.config = {
|
|
3579
|
+
...defaultConfig,
|
|
3580
|
+
...customConfig
|
|
3581
|
+
};
|
|
3582
|
+
else this.config = { ...defaultConfig };
|
|
3583
|
+
const reserved = [
|
|
3584
|
+
this.config.parse.exec,
|
|
3585
|
+
this.config.parse.interpolate,
|
|
3586
|
+
this.config.parse.raw,
|
|
3587
|
+
"-",
|
|
3588
|
+
"_"
|
|
3589
|
+
];
|
|
3590
|
+
for (const prefix of Object.keys(this.config.customTags)) if (reserved.includes(prefix)) throw new EtaError(`Custom tag prefix "${prefix}" conflicts with a built-in prefix`);
|
|
3591
|
+
}
|
|
3592
|
+
config;
|
|
3593
|
+
RuntimeErr = RuntimeErr;
|
|
3594
|
+
compile = compile2;
|
|
3595
|
+
compileToString = compileToString;
|
|
3596
|
+
compileBody = compileBody;
|
|
3597
|
+
parse = parse;
|
|
3598
|
+
render = render3;
|
|
3599
|
+
renderAsync = renderAsync;
|
|
3600
|
+
renderString = renderString2;
|
|
3601
|
+
renderStringAsync = renderStringAsync;
|
|
3602
|
+
filepathCache = {};
|
|
3603
|
+
templatesSync = new Cacher({});
|
|
3604
|
+
templatesAsync = new Cacher({});
|
|
3605
|
+
resolvePath = null;
|
|
3606
|
+
readFile = null;
|
|
3607
|
+
configure(customConfig) {
|
|
3608
|
+
this.config = {
|
|
3609
|
+
...this.config,
|
|
3610
|
+
...customConfig
|
|
3611
|
+
};
|
|
3612
|
+
}
|
|
3613
|
+
withConfig(customConfig) {
|
|
3614
|
+
return {
|
|
3615
|
+
...this,
|
|
3616
|
+
config: {
|
|
3617
|
+
...this.config,
|
|
3618
|
+
...customConfig
|
|
3619
|
+
}
|
|
3620
|
+
};
|
|
3621
|
+
}
|
|
3622
|
+
loadTemplate(name, template, options) {
|
|
3623
|
+
if (typeof template === "string") (options?.async ? this.templatesAsync : this.templatesSync).define(name, this.compile(template, options));
|
|
3624
|
+
else {
|
|
3625
|
+
let templates = this.templatesSync;
|
|
3626
|
+
if (template.constructor.name === "AsyncFunction" || options?.async) templates = this.templatesAsync;
|
|
3627
|
+
templates.define(name, template);
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
3630
|
+
};
|
|
3631
|
+
var Eta = class extends Eta$1 {
|
|
3632
|
+
static {
|
|
3633
|
+
__name(this, "Eta");
|
|
3634
|
+
}
|
|
3635
|
+
readFile = readFile;
|
|
3636
|
+
resolvePath = resolvePath;
|
|
3637
|
+
};
|
|
3638
|
+
|
|
3639
|
+
// src/puppeteer/engines/eta/eta.service.ts
|
|
3640
|
+
var import_node_path2 = require("path");
|
|
3641
|
+
var import_node_fs4 = require("fs");
|
|
3140
3642
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
3141
3643
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3142
3644
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3148,6 +3650,655 @@ function _ts_metadata3(k, v) {
|
|
|
3148
3650
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3149
3651
|
}
|
|
3150
3652
|
__name(_ts_metadata3, "_ts_metadata");
|
|
3653
|
+
var EtaService = class {
|
|
3654
|
+
static {
|
|
3655
|
+
__name(this, "EtaService");
|
|
3656
|
+
}
|
|
3657
|
+
eta;
|
|
3658
|
+
templateCache = /* @__PURE__ */ new Map();
|
|
3659
|
+
maxCacheSize = 100;
|
|
3660
|
+
constructor() {
|
|
3661
|
+
this.eta = new Eta({
|
|
3662
|
+
cache: true,
|
|
3663
|
+
autoEscape: true,
|
|
3664
|
+
useWith: true
|
|
3665
|
+
});
|
|
3666
|
+
}
|
|
3667
|
+
/**
|
|
3668
|
+
* Render an Eta template from a string
|
|
3669
|
+
* @param template The template string to render
|
|
3670
|
+
* @param data The data object to use for rendering
|
|
3671
|
+
* @param options Optional Eta rendering options
|
|
3672
|
+
* @returns The rendered HTML string
|
|
3673
|
+
*/
|
|
3674
|
+
render(template, data = {}, options) {
|
|
3675
|
+
try {
|
|
3676
|
+
const eta = options && Object.keys(options).length > 0 ? new Eta({
|
|
3677
|
+
cache: true,
|
|
3678
|
+
autoEscape: true,
|
|
3679
|
+
useWith: true,
|
|
3680
|
+
...options,
|
|
3681
|
+
varName: options.varName ?? "it"
|
|
3682
|
+
}) : this.eta;
|
|
3683
|
+
return eta.renderString(template, data);
|
|
3684
|
+
} catch (error) {
|
|
3685
|
+
throw new Error(`Eta rendering failed: ${String(error)}`, {
|
|
3686
|
+
cause: error
|
|
3687
|
+
});
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
/**
|
|
3691
|
+
* Render an Eta template from a file
|
|
3692
|
+
* @param filePath The path to the template file
|
|
3693
|
+
* @param data The data object to use for rendering
|
|
3694
|
+
* @param options Optional Eta rendering options
|
|
3695
|
+
* @returns The rendered HTML string
|
|
3696
|
+
*/
|
|
3697
|
+
renderFile(filePath, data = {}, options) {
|
|
3698
|
+
try {
|
|
3699
|
+
const resolvedPath = (0, import_node_path2.resolve)(filePath);
|
|
3700
|
+
const useCache = options?.cache ?? true;
|
|
3701
|
+
let template = useCache ? this.templateCache.get(resolvedPath) : void 0;
|
|
3702
|
+
if (!template) {
|
|
3703
|
+
template = (0, import_node_fs4.readFileSync)(resolvedPath, "utf-8");
|
|
3704
|
+
if (useCache && this.templateCache.size < this.maxCacheSize) {
|
|
3705
|
+
this.templateCache.set(resolvedPath, template);
|
|
3706
|
+
}
|
|
3707
|
+
}
|
|
3708
|
+
return this.render(template, data, options);
|
|
3709
|
+
} catch (error) {
|
|
3710
|
+
throw new Error(`Eta file rendering failed for ${filePath}: ${String(error)}`, {
|
|
3711
|
+
cause: error
|
|
3712
|
+
});
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
/**
|
|
3716
|
+
* Clear the template cache
|
|
3717
|
+
*/
|
|
3718
|
+
clearCache() {
|
|
3719
|
+
this.templateCache.clear();
|
|
3720
|
+
}
|
|
3721
|
+
/**
|
|
3722
|
+
* Get the current cache size
|
|
3723
|
+
* @returns The number of cached templates
|
|
3724
|
+
*/
|
|
3725
|
+
getCacheSize() {
|
|
3726
|
+
return this.templateCache.size;
|
|
3727
|
+
}
|
|
3728
|
+
};
|
|
3729
|
+
EtaService = _ts_decorate6([
|
|
3730
|
+
(0, import_common6.Injectable)(),
|
|
3731
|
+
_ts_metadata3("design:type", Function),
|
|
3732
|
+
_ts_metadata3("design:paramtypes", [])
|
|
3733
|
+
], EtaService);
|
|
3734
|
+
|
|
3735
|
+
// src/puppeteer/engines/mustache/mustache.service.ts
|
|
3736
|
+
var import_common7 = require("@nestjs/common");
|
|
3737
|
+
|
|
3738
|
+
// node_modules/.pnpm/mustache@4.2.0/node_modules/mustache/mustache.mjs
|
|
3739
|
+
var objectToString = Object.prototype.toString;
|
|
3740
|
+
var isArray = Array.isArray || /* @__PURE__ */ __name(function isArrayPolyfill(object) {
|
|
3741
|
+
return objectToString.call(object) === "[object Array]";
|
|
3742
|
+
}, "isArrayPolyfill");
|
|
3743
|
+
function isFunction(object) {
|
|
3744
|
+
return typeof object === "function";
|
|
3745
|
+
}
|
|
3746
|
+
__name(isFunction, "isFunction");
|
|
3747
|
+
function typeStr(obj) {
|
|
3748
|
+
return isArray(obj) ? "array" : typeof obj;
|
|
3749
|
+
}
|
|
3750
|
+
__name(typeStr, "typeStr");
|
|
3751
|
+
function escapeRegExp2(string) {
|
|
3752
|
+
return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
3753
|
+
}
|
|
3754
|
+
__name(escapeRegExp2, "escapeRegExp");
|
|
3755
|
+
function hasProperty(obj, propName) {
|
|
3756
|
+
return obj != null && typeof obj === "object" && propName in obj;
|
|
3757
|
+
}
|
|
3758
|
+
__name(hasProperty, "hasProperty");
|
|
3759
|
+
function primitiveHasOwnProperty(primitive, propName) {
|
|
3760
|
+
return primitive != null && typeof primitive !== "object" && primitive.hasOwnProperty && primitive.hasOwnProperty(propName);
|
|
3761
|
+
}
|
|
3762
|
+
__name(primitiveHasOwnProperty, "primitiveHasOwnProperty");
|
|
3763
|
+
var regExpTest = RegExp.prototype.test;
|
|
3764
|
+
function testRegExp(re, string) {
|
|
3765
|
+
return regExpTest.call(re, string);
|
|
3766
|
+
}
|
|
3767
|
+
__name(testRegExp, "testRegExp");
|
|
3768
|
+
var nonSpaceRe = /\S/;
|
|
3769
|
+
function isWhitespace(string) {
|
|
3770
|
+
return !testRegExp(nonSpaceRe, string);
|
|
3771
|
+
}
|
|
3772
|
+
__name(isWhitespace, "isWhitespace");
|
|
3773
|
+
var entityMap = {
|
|
3774
|
+
"&": "&",
|
|
3775
|
+
"<": "<",
|
|
3776
|
+
">": ">",
|
|
3777
|
+
'"': """,
|
|
3778
|
+
"'": "'",
|
|
3779
|
+
"/": "/",
|
|
3780
|
+
"`": "`",
|
|
3781
|
+
"=": "="
|
|
3782
|
+
};
|
|
3783
|
+
function escapeHtml(string) {
|
|
3784
|
+
return String(string).replace(/[&<>"'`=\/]/g, /* @__PURE__ */ __name(function fromEntityMap(s) {
|
|
3785
|
+
return entityMap[s];
|
|
3786
|
+
}, "fromEntityMap"));
|
|
3787
|
+
}
|
|
3788
|
+
__name(escapeHtml, "escapeHtml");
|
|
3789
|
+
var whiteRe = /\s*/;
|
|
3790
|
+
var spaceRe = /\s+/;
|
|
3791
|
+
var equalsRe = /\s*=/;
|
|
3792
|
+
var curlyRe = /\s*\}/;
|
|
3793
|
+
var tagRe = /#|\^|\/|>|\{|&|=|!/;
|
|
3794
|
+
function parseTemplate(template, tags) {
|
|
3795
|
+
if (!template)
|
|
3796
|
+
return [];
|
|
3797
|
+
var lineHasNonSpace = false;
|
|
3798
|
+
var sections = [];
|
|
3799
|
+
var tokens = [];
|
|
3800
|
+
var spaces = [];
|
|
3801
|
+
var hasTag = false;
|
|
3802
|
+
var nonSpace = false;
|
|
3803
|
+
var indentation = "";
|
|
3804
|
+
var tagIndex = 0;
|
|
3805
|
+
function stripSpace() {
|
|
3806
|
+
if (hasTag && !nonSpace) {
|
|
3807
|
+
while (spaces.length)
|
|
3808
|
+
delete tokens[spaces.pop()];
|
|
3809
|
+
} else {
|
|
3810
|
+
spaces = [];
|
|
3811
|
+
}
|
|
3812
|
+
hasTag = false;
|
|
3813
|
+
nonSpace = false;
|
|
3814
|
+
}
|
|
3815
|
+
__name(stripSpace, "stripSpace");
|
|
3816
|
+
var openingTagRe, closingTagRe, closingCurlyRe;
|
|
3817
|
+
function compileTags(tagsToCompile) {
|
|
3818
|
+
if (typeof tagsToCompile === "string")
|
|
3819
|
+
tagsToCompile = tagsToCompile.split(spaceRe, 2);
|
|
3820
|
+
if (!isArray(tagsToCompile) || tagsToCompile.length !== 2)
|
|
3821
|
+
throw new Error("Invalid tags: " + tagsToCompile);
|
|
3822
|
+
openingTagRe = new RegExp(escapeRegExp2(tagsToCompile[0]) + "\\s*");
|
|
3823
|
+
closingTagRe = new RegExp("\\s*" + escapeRegExp2(tagsToCompile[1]));
|
|
3824
|
+
closingCurlyRe = new RegExp("\\s*" + escapeRegExp2("}" + tagsToCompile[1]));
|
|
3825
|
+
}
|
|
3826
|
+
__name(compileTags, "compileTags");
|
|
3827
|
+
compileTags(tags || mustache.tags);
|
|
3828
|
+
var scanner = new Scanner(template);
|
|
3829
|
+
var start, type, value, chr, token, openSection;
|
|
3830
|
+
while (!scanner.eos()) {
|
|
3831
|
+
start = scanner.pos;
|
|
3832
|
+
value = scanner.scanUntil(openingTagRe);
|
|
3833
|
+
if (value) {
|
|
3834
|
+
for (var i = 0, valueLength = value.length; i < valueLength; ++i) {
|
|
3835
|
+
chr = value.charAt(i);
|
|
3836
|
+
if (isWhitespace(chr)) {
|
|
3837
|
+
spaces.push(tokens.length);
|
|
3838
|
+
indentation += chr;
|
|
3839
|
+
} else {
|
|
3840
|
+
nonSpace = true;
|
|
3841
|
+
lineHasNonSpace = true;
|
|
3842
|
+
indentation += " ";
|
|
3843
|
+
}
|
|
3844
|
+
tokens.push(["text", chr, start, start + 1]);
|
|
3845
|
+
start += 1;
|
|
3846
|
+
if (chr === "\n") {
|
|
3847
|
+
stripSpace();
|
|
3848
|
+
indentation = "";
|
|
3849
|
+
tagIndex = 0;
|
|
3850
|
+
lineHasNonSpace = false;
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
}
|
|
3854
|
+
if (!scanner.scan(openingTagRe))
|
|
3855
|
+
break;
|
|
3856
|
+
hasTag = true;
|
|
3857
|
+
type = scanner.scan(tagRe) || "name";
|
|
3858
|
+
scanner.scan(whiteRe);
|
|
3859
|
+
if (type === "=") {
|
|
3860
|
+
value = scanner.scanUntil(equalsRe);
|
|
3861
|
+
scanner.scan(equalsRe);
|
|
3862
|
+
scanner.scanUntil(closingTagRe);
|
|
3863
|
+
} else if (type === "{") {
|
|
3864
|
+
value = scanner.scanUntil(closingCurlyRe);
|
|
3865
|
+
scanner.scan(curlyRe);
|
|
3866
|
+
scanner.scanUntil(closingTagRe);
|
|
3867
|
+
type = "&";
|
|
3868
|
+
} else {
|
|
3869
|
+
value = scanner.scanUntil(closingTagRe);
|
|
3870
|
+
}
|
|
3871
|
+
if (!scanner.scan(closingTagRe))
|
|
3872
|
+
throw new Error("Unclosed tag at " + scanner.pos);
|
|
3873
|
+
if (type == ">") {
|
|
3874
|
+
token = [type, value, start, scanner.pos, indentation, tagIndex, lineHasNonSpace];
|
|
3875
|
+
} else {
|
|
3876
|
+
token = [type, value, start, scanner.pos];
|
|
3877
|
+
}
|
|
3878
|
+
tagIndex++;
|
|
3879
|
+
tokens.push(token);
|
|
3880
|
+
if (type === "#" || type === "^") {
|
|
3881
|
+
sections.push(token);
|
|
3882
|
+
} else if (type === "/") {
|
|
3883
|
+
openSection = sections.pop();
|
|
3884
|
+
if (!openSection)
|
|
3885
|
+
throw new Error('Unopened section "' + value + '" at ' + start);
|
|
3886
|
+
if (openSection[1] !== value)
|
|
3887
|
+
throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
|
|
3888
|
+
} else if (type === "name" || type === "{" || type === "&") {
|
|
3889
|
+
nonSpace = true;
|
|
3890
|
+
} else if (type === "=") {
|
|
3891
|
+
compileTags(value);
|
|
3892
|
+
}
|
|
3893
|
+
}
|
|
3894
|
+
stripSpace();
|
|
3895
|
+
openSection = sections.pop();
|
|
3896
|
+
if (openSection)
|
|
3897
|
+
throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
|
|
3898
|
+
return nestTokens(squashTokens(tokens));
|
|
3899
|
+
}
|
|
3900
|
+
__name(parseTemplate, "parseTemplate");
|
|
3901
|
+
function squashTokens(tokens) {
|
|
3902
|
+
var squashedTokens = [];
|
|
3903
|
+
var token, lastToken;
|
|
3904
|
+
for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
|
|
3905
|
+
token = tokens[i];
|
|
3906
|
+
if (token) {
|
|
3907
|
+
if (token[0] === "text" && lastToken && lastToken[0] === "text") {
|
|
3908
|
+
lastToken[1] += token[1];
|
|
3909
|
+
lastToken[3] = token[3];
|
|
3910
|
+
} else {
|
|
3911
|
+
squashedTokens.push(token);
|
|
3912
|
+
lastToken = token;
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
}
|
|
3916
|
+
return squashedTokens;
|
|
3917
|
+
}
|
|
3918
|
+
__name(squashTokens, "squashTokens");
|
|
3919
|
+
function nestTokens(tokens) {
|
|
3920
|
+
var nestedTokens = [];
|
|
3921
|
+
var collector = nestedTokens;
|
|
3922
|
+
var sections = [];
|
|
3923
|
+
var token, section;
|
|
3924
|
+
for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
|
|
3925
|
+
token = tokens[i];
|
|
3926
|
+
switch (token[0]) {
|
|
3927
|
+
case "#":
|
|
3928
|
+
case "^":
|
|
3929
|
+
collector.push(token);
|
|
3930
|
+
sections.push(token);
|
|
3931
|
+
collector = token[4] = [];
|
|
3932
|
+
break;
|
|
3933
|
+
case "/":
|
|
3934
|
+
section = sections.pop();
|
|
3935
|
+
section[5] = token[2];
|
|
3936
|
+
collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
|
|
3937
|
+
break;
|
|
3938
|
+
default:
|
|
3939
|
+
collector.push(token);
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3942
|
+
return nestedTokens;
|
|
3943
|
+
}
|
|
3944
|
+
__name(nestTokens, "nestTokens");
|
|
3945
|
+
function Scanner(string) {
|
|
3946
|
+
this.string = string;
|
|
3947
|
+
this.tail = string;
|
|
3948
|
+
this.pos = 0;
|
|
3949
|
+
}
|
|
3950
|
+
__name(Scanner, "Scanner");
|
|
3951
|
+
Scanner.prototype.eos = /* @__PURE__ */ __name(function eos() {
|
|
3952
|
+
return this.tail === "";
|
|
3953
|
+
}, "eos");
|
|
3954
|
+
Scanner.prototype.scan = /* @__PURE__ */ __name(function scan(re) {
|
|
3955
|
+
var match = this.tail.match(re);
|
|
3956
|
+
if (!match || match.index !== 0)
|
|
3957
|
+
return "";
|
|
3958
|
+
var string = match[0];
|
|
3959
|
+
this.tail = this.tail.substring(string.length);
|
|
3960
|
+
this.pos += string.length;
|
|
3961
|
+
return string;
|
|
3962
|
+
}, "scan");
|
|
3963
|
+
Scanner.prototype.scanUntil = /* @__PURE__ */ __name(function scanUntil(re) {
|
|
3964
|
+
var index = this.tail.search(re), match;
|
|
3965
|
+
switch (index) {
|
|
3966
|
+
case -1:
|
|
3967
|
+
match = this.tail;
|
|
3968
|
+
this.tail = "";
|
|
3969
|
+
break;
|
|
3970
|
+
case 0:
|
|
3971
|
+
match = "";
|
|
3972
|
+
break;
|
|
3973
|
+
default:
|
|
3974
|
+
match = this.tail.substring(0, index);
|
|
3975
|
+
this.tail = this.tail.substring(index);
|
|
3976
|
+
}
|
|
3977
|
+
this.pos += match.length;
|
|
3978
|
+
return match;
|
|
3979
|
+
}, "scanUntil");
|
|
3980
|
+
function Context(view, parentContext) {
|
|
3981
|
+
this.view = view;
|
|
3982
|
+
this.cache = { ".": this.view };
|
|
3983
|
+
this.parent = parentContext;
|
|
3984
|
+
}
|
|
3985
|
+
__name(Context, "Context");
|
|
3986
|
+
Context.prototype.push = /* @__PURE__ */ __name(function push(view) {
|
|
3987
|
+
return new Context(view, this);
|
|
3988
|
+
}, "push");
|
|
3989
|
+
Context.prototype.lookup = /* @__PURE__ */ __name(function lookup(name) {
|
|
3990
|
+
var cache = this.cache;
|
|
3991
|
+
var value;
|
|
3992
|
+
if (cache.hasOwnProperty(name)) {
|
|
3993
|
+
value = cache[name];
|
|
3994
|
+
} else {
|
|
3995
|
+
var context = this, intermediateValue, names, index, lookupHit = false;
|
|
3996
|
+
while (context) {
|
|
3997
|
+
if (name.indexOf(".") > 0) {
|
|
3998
|
+
intermediateValue = context.view;
|
|
3999
|
+
names = name.split(".");
|
|
4000
|
+
index = 0;
|
|
4001
|
+
while (intermediateValue != null && index < names.length) {
|
|
4002
|
+
if (index === names.length - 1)
|
|
4003
|
+
lookupHit = hasProperty(intermediateValue, names[index]) || primitiveHasOwnProperty(intermediateValue, names[index]);
|
|
4004
|
+
intermediateValue = intermediateValue[names[index++]];
|
|
4005
|
+
}
|
|
4006
|
+
} else {
|
|
4007
|
+
intermediateValue = context.view[name];
|
|
4008
|
+
lookupHit = hasProperty(context.view, name);
|
|
4009
|
+
}
|
|
4010
|
+
if (lookupHit) {
|
|
4011
|
+
value = intermediateValue;
|
|
4012
|
+
break;
|
|
4013
|
+
}
|
|
4014
|
+
context = context.parent;
|
|
4015
|
+
}
|
|
4016
|
+
cache[name] = value;
|
|
4017
|
+
}
|
|
4018
|
+
if (isFunction(value))
|
|
4019
|
+
value = value.call(this.view);
|
|
4020
|
+
return value;
|
|
4021
|
+
}, "lookup");
|
|
4022
|
+
function Writer() {
|
|
4023
|
+
this.templateCache = {
|
|
4024
|
+
_cache: {},
|
|
4025
|
+
set: /* @__PURE__ */ __name(function set(key, value) {
|
|
4026
|
+
this._cache[key] = value;
|
|
4027
|
+
}, "set"),
|
|
4028
|
+
get: /* @__PURE__ */ __name(function get(key) {
|
|
4029
|
+
return this._cache[key];
|
|
4030
|
+
}, "get"),
|
|
4031
|
+
clear: /* @__PURE__ */ __name(function clear() {
|
|
4032
|
+
this._cache = {};
|
|
4033
|
+
}, "clear")
|
|
4034
|
+
};
|
|
4035
|
+
}
|
|
4036
|
+
__name(Writer, "Writer");
|
|
4037
|
+
Writer.prototype.clearCache = /* @__PURE__ */ __name(function clearCache() {
|
|
4038
|
+
if (typeof this.templateCache !== "undefined") {
|
|
4039
|
+
this.templateCache.clear();
|
|
4040
|
+
}
|
|
4041
|
+
}, "clearCache");
|
|
4042
|
+
Writer.prototype.parse = /* @__PURE__ */ __name(function parse2(template, tags) {
|
|
4043
|
+
var cache = this.templateCache;
|
|
4044
|
+
var cacheKey = template + ":" + (tags || mustache.tags).join(":");
|
|
4045
|
+
var isCacheEnabled = typeof cache !== "undefined";
|
|
4046
|
+
var tokens = isCacheEnabled ? cache.get(cacheKey) : void 0;
|
|
4047
|
+
if (tokens == void 0) {
|
|
4048
|
+
tokens = parseTemplate(template, tags);
|
|
4049
|
+
isCacheEnabled && cache.set(cacheKey, tokens);
|
|
4050
|
+
}
|
|
4051
|
+
return tokens;
|
|
4052
|
+
}, "parse");
|
|
4053
|
+
Writer.prototype.render = /* @__PURE__ */ __name(function render4(template, view, partials, config) {
|
|
4054
|
+
var tags = this.getConfigTags(config);
|
|
4055
|
+
var tokens = this.parse(template, tags);
|
|
4056
|
+
var context = view instanceof Context ? view : new Context(view, void 0);
|
|
4057
|
+
return this.renderTokens(tokens, context, partials, template, config);
|
|
4058
|
+
}, "render");
|
|
4059
|
+
Writer.prototype.renderTokens = /* @__PURE__ */ __name(function renderTokens(tokens, context, partials, originalTemplate, config) {
|
|
4060
|
+
var buffer = "";
|
|
4061
|
+
var token, symbol, value;
|
|
4062
|
+
for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
|
|
4063
|
+
value = void 0;
|
|
4064
|
+
token = tokens[i];
|
|
4065
|
+
symbol = token[0];
|
|
4066
|
+
if (symbol === "#") value = this.renderSection(token, context, partials, originalTemplate, config);
|
|
4067
|
+
else if (symbol === "^") value = this.renderInverted(token, context, partials, originalTemplate, config);
|
|
4068
|
+
else if (symbol === ">") value = this.renderPartial(token, context, partials, config);
|
|
4069
|
+
else if (symbol === "&") value = this.unescapedValue(token, context);
|
|
4070
|
+
else if (symbol === "name") value = this.escapedValue(token, context, config);
|
|
4071
|
+
else if (symbol === "text") value = this.rawValue(token);
|
|
4072
|
+
if (value !== void 0)
|
|
4073
|
+
buffer += value;
|
|
4074
|
+
}
|
|
4075
|
+
return buffer;
|
|
4076
|
+
}, "renderTokens");
|
|
4077
|
+
Writer.prototype.renderSection = /* @__PURE__ */ __name(function renderSection(token, context, partials, originalTemplate, config) {
|
|
4078
|
+
var self2 = this;
|
|
4079
|
+
var buffer = "";
|
|
4080
|
+
var value = context.lookup(token[1]);
|
|
4081
|
+
function subRender(template) {
|
|
4082
|
+
return self2.render(template, context, partials, config);
|
|
4083
|
+
}
|
|
4084
|
+
__name(subRender, "subRender");
|
|
4085
|
+
if (!value) return;
|
|
4086
|
+
if (isArray(value)) {
|
|
4087
|
+
for (var j = 0, valueLength = value.length; j < valueLength; ++j) {
|
|
4088
|
+
buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate, config);
|
|
4089
|
+
}
|
|
4090
|
+
} else if (typeof value === "object" || typeof value === "string" || typeof value === "number") {
|
|
4091
|
+
buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate, config);
|
|
4092
|
+
} else if (isFunction(value)) {
|
|
4093
|
+
if (typeof originalTemplate !== "string")
|
|
4094
|
+
throw new Error("Cannot use higher-order sections without the original template");
|
|
4095
|
+
value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);
|
|
4096
|
+
if (value != null)
|
|
4097
|
+
buffer += value;
|
|
4098
|
+
} else {
|
|
4099
|
+
buffer += this.renderTokens(token[4], context, partials, originalTemplate, config);
|
|
4100
|
+
}
|
|
4101
|
+
return buffer;
|
|
4102
|
+
}, "renderSection");
|
|
4103
|
+
Writer.prototype.renderInverted = /* @__PURE__ */ __name(function renderInverted(token, context, partials, originalTemplate, config) {
|
|
4104
|
+
var value = context.lookup(token[1]);
|
|
4105
|
+
if (!value || isArray(value) && value.length === 0)
|
|
4106
|
+
return this.renderTokens(token[4], context, partials, originalTemplate, config);
|
|
4107
|
+
}, "renderInverted");
|
|
4108
|
+
Writer.prototype.indentPartial = /* @__PURE__ */ __name(function indentPartial(partial, indentation, lineHasNonSpace) {
|
|
4109
|
+
var filteredIndentation = indentation.replace(/[^ \t]/g, "");
|
|
4110
|
+
var partialByNl = partial.split("\n");
|
|
4111
|
+
for (var i = 0; i < partialByNl.length; i++) {
|
|
4112
|
+
if (partialByNl[i].length && (i > 0 || !lineHasNonSpace)) {
|
|
4113
|
+
partialByNl[i] = filteredIndentation + partialByNl[i];
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
return partialByNl.join("\n");
|
|
4117
|
+
}, "indentPartial");
|
|
4118
|
+
Writer.prototype.renderPartial = /* @__PURE__ */ __name(function renderPartial(token, context, partials, config) {
|
|
4119
|
+
if (!partials) return;
|
|
4120
|
+
var tags = this.getConfigTags(config);
|
|
4121
|
+
var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
|
|
4122
|
+
if (value != null) {
|
|
4123
|
+
var lineHasNonSpace = token[6];
|
|
4124
|
+
var tagIndex = token[5];
|
|
4125
|
+
var indentation = token[4];
|
|
4126
|
+
var indentedValue = value;
|
|
4127
|
+
if (tagIndex == 0 && indentation) {
|
|
4128
|
+
indentedValue = this.indentPartial(value, indentation, lineHasNonSpace);
|
|
4129
|
+
}
|
|
4130
|
+
var tokens = this.parse(indentedValue, tags);
|
|
4131
|
+
return this.renderTokens(tokens, context, partials, indentedValue, config);
|
|
4132
|
+
}
|
|
4133
|
+
}, "renderPartial");
|
|
4134
|
+
Writer.prototype.unescapedValue = /* @__PURE__ */ __name(function unescapedValue(token, context) {
|
|
4135
|
+
var value = context.lookup(token[1]);
|
|
4136
|
+
if (value != null)
|
|
4137
|
+
return value;
|
|
4138
|
+
}, "unescapedValue");
|
|
4139
|
+
Writer.prototype.escapedValue = /* @__PURE__ */ __name(function escapedValue(token, context, config) {
|
|
4140
|
+
var escape = this.getConfigEscape(config) || mustache.escape;
|
|
4141
|
+
var value = context.lookup(token[1]);
|
|
4142
|
+
if (value != null)
|
|
4143
|
+
return typeof value === "number" && escape === mustache.escape ? String(value) : escape(value);
|
|
4144
|
+
}, "escapedValue");
|
|
4145
|
+
Writer.prototype.rawValue = /* @__PURE__ */ __name(function rawValue(token) {
|
|
4146
|
+
return token[1];
|
|
4147
|
+
}, "rawValue");
|
|
4148
|
+
Writer.prototype.getConfigTags = /* @__PURE__ */ __name(function getConfigTags(config) {
|
|
4149
|
+
if (isArray(config)) {
|
|
4150
|
+
return config;
|
|
4151
|
+
} else if (config && typeof config === "object") {
|
|
4152
|
+
return config.tags;
|
|
4153
|
+
} else {
|
|
4154
|
+
return void 0;
|
|
4155
|
+
}
|
|
4156
|
+
}, "getConfigTags");
|
|
4157
|
+
Writer.prototype.getConfigEscape = /* @__PURE__ */ __name(function getConfigEscape(config) {
|
|
4158
|
+
if (config && typeof config === "object" && !isArray(config)) {
|
|
4159
|
+
return config.escape;
|
|
4160
|
+
} else {
|
|
4161
|
+
return void 0;
|
|
4162
|
+
}
|
|
4163
|
+
}, "getConfigEscape");
|
|
4164
|
+
var mustache = {
|
|
4165
|
+
name: "mustache.js",
|
|
4166
|
+
version: "4.2.0",
|
|
4167
|
+
tags: ["{{", "}}"],
|
|
4168
|
+
clearCache: void 0,
|
|
4169
|
+
escape: void 0,
|
|
4170
|
+
parse: void 0,
|
|
4171
|
+
render: void 0,
|
|
4172
|
+
Scanner: void 0,
|
|
4173
|
+
Context: void 0,
|
|
4174
|
+
Writer: void 0,
|
|
4175
|
+
/**
|
|
4176
|
+
* Allows a user to override the default caching strategy, by providing an
|
|
4177
|
+
* object with set, get and clear methods. This can also be used to disable
|
|
4178
|
+
* the cache by setting it to the literal `undefined`.
|
|
4179
|
+
*/
|
|
4180
|
+
set templateCache(cache) {
|
|
4181
|
+
defaultWriter.templateCache = cache;
|
|
4182
|
+
},
|
|
4183
|
+
/**
|
|
4184
|
+
* Gets the default or overridden caching object from the default writer.
|
|
4185
|
+
*/
|
|
4186
|
+
get templateCache() {
|
|
4187
|
+
return defaultWriter.templateCache;
|
|
4188
|
+
}
|
|
4189
|
+
};
|
|
4190
|
+
var defaultWriter = new Writer();
|
|
4191
|
+
mustache.clearCache = /* @__PURE__ */ __name(function clearCache2() {
|
|
4192
|
+
return defaultWriter.clearCache();
|
|
4193
|
+
}, "clearCache");
|
|
4194
|
+
mustache.parse = /* @__PURE__ */ __name(function parse3(template, tags) {
|
|
4195
|
+
return defaultWriter.parse(template, tags);
|
|
4196
|
+
}, "parse");
|
|
4197
|
+
mustache.render = /* @__PURE__ */ __name(function render5(template, view, partials, config) {
|
|
4198
|
+
if (typeof template !== "string") {
|
|
4199
|
+
throw new TypeError('Invalid template! Template should be a "string" but "' + typeStr(template) + '" was given as the first argument for mustache#render(template, view, partials)');
|
|
4200
|
+
}
|
|
4201
|
+
return defaultWriter.render(template, view, partials, config);
|
|
4202
|
+
}, "render");
|
|
4203
|
+
mustache.escape = escapeHtml;
|
|
4204
|
+
mustache.Scanner = Scanner;
|
|
4205
|
+
mustache.Context = Context;
|
|
4206
|
+
mustache.Writer = Writer;
|
|
4207
|
+
var mustache_default = mustache;
|
|
4208
|
+
|
|
4209
|
+
// src/puppeteer/engines/mustache/mustache.service.ts
|
|
4210
|
+
var import_node_path3 = require("path");
|
|
4211
|
+
var import_node_fs5 = require("fs");
|
|
4212
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
4213
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4214
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4215
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4216
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4217
|
+
}
|
|
4218
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
4219
|
+
var MustacheService = class {
|
|
4220
|
+
static {
|
|
4221
|
+
__name(this, "MustacheService");
|
|
4222
|
+
}
|
|
4223
|
+
templateCache = /* @__PURE__ */ new Map();
|
|
4224
|
+
maxCacheSize = 100;
|
|
4225
|
+
/**
|
|
4226
|
+
* Render a Mustache template from a string
|
|
4227
|
+
* @param template The template string to render
|
|
4228
|
+
* @param data The data object to use for rendering
|
|
4229
|
+
* @param options Optional Mustache rendering options
|
|
4230
|
+
* @returns The rendered HTML string
|
|
4231
|
+
*/
|
|
4232
|
+
render(template, data = {}, options) {
|
|
4233
|
+
try {
|
|
4234
|
+
const tags = options?.tags ?? [
|
|
4235
|
+
"{{",
|
|
4236
|
+
"}}"
|
|
4237
|
+
];
|
|
4238
|
+
return mustache_default.render(template, data, void 0, {
|
|
4239
|
+
tags,
|
|
4240
|
+
escape: options?.escape
|
|
4241
|
+
});
|
|
4242
|
+
} catch (error) {
|
|
4243
|
+
throw new Error(`Mustache rendering failed: ${String(error)}`, {
|
|
4244
|
+
cause: error
|
|
4245
|
+
});
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
4248
|
+
/**
|
|
4249
|
+
* Render a Mustache template from a file
|
|
4250
|
+
* @param filePath The path to the template file
|
|
4251
|
+
* @param data The data object to use for rendering
|
|
4252
|
+
* @param options Optional Mustache rendering options
|
|
4253
|
+
* @returns The rendered HTML string
|
|
4254
|
+
*/
|
|
4255
|
+
renderFile(filePath, data = {}, options) {
|
|
4256
|
+
try {
|
|
4257
|
+
const resolvedPath = (0, import_node_path3.resolve)(filePath);
|
|
4258
|
+
let template = this.templateCache.get(resolvedPath);
|
|
4259
|
+
if (!template) {
|
|
4260
|
+
template = (0, import_node_fs5.readFileSync)(resolvedPath, "utf-8");
|
|
4261
|
+
if (this.templateCache.size < this.maxCacheSize) {
|
|
4262
|
+
this.templateCache.set(resolvedPath, template);
|
|
4263
|
+
}
|
|
4264
|
+
}
|
|
4265
|
+
return this.render(template, data, options);
|
|
4266
|
+
} catch (error) {
|
|
4267
|
+
throw new Error(`Mustache file rendering failed for ${filePath}: ${String(error)}`, {
|
|
4268
|
+
cause: error
|
|
4269
|
+
});
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4272
|
+
/**
|
|
4273
|
+
* Clear the template cache
|
|
4274
|
+
*/
|
|
4275
|
+
clearCache() {
|
|
4276
|
+
this.templateCache.clear();
|
|
4277
|
+
}
|
|
4278
|
+
/**
|
|
4279
|
+
* Get the current cache size
|
|
4280
|
+
* @returns The number of cached templates
|
|
4281
|
+
*/
|
|
4282
|
+
getCacheSize() {
|
|
4283
|
+
return this.templateCache.size;
|
|
4284
|
+
}
|
|
4285
|
+
};
|
|
4286
|
+
MustacheService = _ts_decorate7([
|
|
4287
|
+
(0, import_common7.Injectable)()
|
|
4288
|
+
], MustacheService);
|
|
4289
|
+
|
|
4290
|
+
// src/puppeteer/puppeteer.service.ts
|
|
4291
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
4292
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4293
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4294
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4295
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4296
|
+
}
|
|
4297
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
4298
|
+
function _ts_metadata4(k, v) {
|
|
4299
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4300
|
+
}
|
|
4301
|
+
__name(_ts_metadata4, "_ts_metadata");
|
|
3151
4302
|
function _ts_param2(paramIndex, decorator) {
|
|
3152
4303
|
return function(target, key) {
|
|
3153
4304
|
decorator(target, key, paramIndex);
|
|
@@ -3165,7 +4316,9 @@ var PuppeteerService = class {
|
|
|
3165
4316
|
pugService;
|
|
3166
4317
|
ejsService;
|
|
3167
4318
|
nunjucksService;
|
|
3168
|
-
|
|
4319
|
+
etaService;
|
|
4320
|
+
mustacheService;
|
|
4321
|
+
constructor(hbsService, browserService, options, mjmlService, pugService, ejsService, nunjucksService, etaService, mustacheService) {
|
|
3169
4322
|
this.hbsService = hbsService;
|
|
3170
4323
|
this.browserService = browserService;
|
|
3171
4324
|
this.options = options;
|
|
@@ -3173,13 +4326,15 @@ var PuppeteerService = class {
|
|
|
3173
4326
|
this.pugService = pugService;
|
|
3174
4327
|
this.ejsService = ejsService;
|
|
3175
4328
|
this.nunjucksService = nunjucksService;
|
|
4329
|
+
this.etaService = etaService;
|
|
4330
|
+
this.mustacheService = mustacheService;
|
|
3176
4331
|
}
|
|
3177
4332
|
limit = (0, import_p_limit.default)(3);
|
|
3178
4333
|
async generatePdfFromHtml(html, options) {
|
|
3179
4334
|
return this.limit(async () => {
|
|
3180
4335
|
const mergePuppeteerOptions = mergePuppeteerParameters(this.options, options);
|
|
3181
4336
|
if (mergePuppeteerOptions.chromiumRevision !== void 0) {
|
|
3182
|
-
|
|
4337
|
+
import_common8.Logger.warn("Using `chromiumRevision` is no longer supported since the puppeteer update.");
|
|
3183
4338
|
}
|
|
3184
4339
|
const headless = mergePuppeteerOptions.headless ?? true;
|
|
3185
4340
|
const args = mergePuppeteerOptions.extraPuppeteerArgs || [
|
|
@@ -3239,14 +4394,14 @@ var PuppeteerService = class {
|
|
|
3239
4394
|
await page.evaluate(() => document.fonts.ready);
|
|
3240
4395
|
return await page.pdf(pdfOptions);
|
|
3241
4396
|
} catch (e) {
|
|
3242
|
-
|
|
4397
|
+
import_common8.Logger.error(e);
|
|
3243
4398
|
throw e;
|
|
3244
4399
|
} finally {
|
|
3245
4400
|
if (context) {
|
|
3246
4401
|
try {
|
|
3247
4402
|
await context.close();
|
|
3248
4403
|
} catch (error) {
|
|
3249
|
-
|
|
4404
|
+
import_common8.Logger.error(error);
|
|
3250
4405
|
}
|
|
3251
4406
|
}
|
|
3252
4407
|
await this.browserService.markJobFinished();
|
|
@@ -3317,23 +4472,55 @@ var PuppeteerService = class {
|
|
|
3317
4472
|
const html = this.nunjucksService.renderFile(file, data, options?.nunjucksOptions ?? this.options.nunjucksOptions);
|
|
3318
4473
|
return this.generatePdfFromHtml(html, options);
|
|
3319
4474
|
}
|
|
4475
|
+
async generatePdfFromEtaString(template, data = {}, options) {
|
|
4476
|
+
if (!this.etaService) {
|
|
4477
|
+
throw new Error("Eta service is not available. If the problem persists, open an issue in the repo.");
|
|
4478
|
+
}
|
|
4479
|
+
const html = this.etaService.render(template, data, options?.etaOptions ?? this.options.etaOptions);
|
|
4480
|
+
return this.generatePdfFromHtml(html, options);
|
|
4481
|
+
}
|
|
4482
|
+
async generatePdfFromEtaFile(file, data = {}, options) {
|
|
4483
|
+
if (!this.etaService) {
|
|
4484
|
+
throw new Error("Eta service is not available. If the problem persists, open an issue in the repo.");
|
|
4485
|
+
}
|
|
4486
|
+
const html = this.etaService.renderFile(file, data, options?.etaOptions ?? this.options.etaOptions);
|
|
4487
|
+
return this.generatePdfFromHtml(html, options);
|
|
4488
|
+
}
|
|
4489
|
+
async generatePdfFromMustacheString(template, data = {}, options) {
|
|
4490
|
+
if (!this.mustacheService) {
|
|
4491
|
+
throw new Error("Mustache service is not available. If the problem persists, open an issue in the repo.");
|
|
4492
|
+
}
|
|
4493
|
+
const html = this.mustacheService.render(template, data, options?.mustacheOptions ?? this.options.mustacheOptions);
|
|
4494
|
+
return this.generatePdfFromHtml(html, options);
|
|
4495
|
+
}
|
|
4496
|
+
async generatePdfFromMustacheFile(file, data = {}, options) {
|
|
4497
|
+
if (!this.mustacheService) {
|
|
4498
|
+
throw new Error("Mustache service is not available. If the problem persists, open an issue in the repo.");
|
|
4499
|
+
}
|
|
4500
|
+
const html = this.mustacheService.renderFile(file, data, options?.mustacheOptions ?? this.options.mustacheOptions);
|
|
4501
|
+
return this.generatePdfFromHtml(html, options);
|
|
4502
|
+
}
|
|
3320
4503
|
};
|
|
3321
|
-
PuppeteerService =
|
|
3322
|
-
(0,
|
|
3323
|
-
_ts_param2(2, (0,
|
|
3324
|
-
_ts_param2(3, (0,
|
|
3325
|
-
_ts_param2(4, (0,
|
|
3326
|
-
_ts_param2(5, (0,
|
|
3327
|
-
_ts_param2(6, (0,
|
|
3328
|
-
|
|
3329
|
-
|
|
4504
|
+
PuppeteerService = _ts_decorate8([
|
|
4505
|
+
(0, import_common8.Injectable)(),
|
|
4506
|
+
_ts_param2(2, (0, import_common8.Inject)(PDF_PARAMETERS)),
|
|
4507
|
+
_ts_param2(3, (0, import_common8.Optional)()),
|
|
4508
|
+
_ts_param2(4, (0, import_common8.Optional)()),
|
|
4509
|
+
_ts_param2(5, (0, import_common8.Optional)()),
|
|
4510
|
+
_ts_param2(6, (0, import_common8.Optional)()),
|
|
4511
|
+
_ts_param2(7, (0, import_common8.Optional)()),
|
|
4512
|
+
_ts_param2(8, (0, import_common8.Optional)()),
|
|
4513
|
+
_ts_metadata4("design:type", Function),
|
|
4514
|
+
_ts_metadata4("design:paramtypes", [
|
|
3330
4515
|
typeof import_nestjs_hbs.HandlebarsService === "undefined" ? Object : import_nestjs_hbs.HandlebarsService,
|
|
3331
4516
|
typeof BrowserService === "undefined" ? Object : BrowserService,
|
|
3332
4517
|
typeof PuppeteerParameters === "undefined" ? Object : PuppeteerParameters,
|
|
3333
4518
|
typeof MjmlService === "undefined" ? Object : MjmlService,
|
|
3334
4519
|
typeof PugService === "undefined" ? Object : PugService,
|
|
3335
4520
|
typeof EjsService === "undefined" ? Object : EjsService,
|
|
3336
|
-
typeof NunjucksService === "undefined" ? Object : NunjucksService
|
|
4521
|
+
typeof NunjucksService === "undefined" ? Object : NunjucksService,
|
|
4522
|
+
typeof EtaService === "undefined" ? Object : EtaService,
|
|
4523
|
+
typeof MustacheService === "undefined" ? Object : MustacheService
|
|
3337
4524
|
])
|
|
3338
4525
|
], PuppeteerService);
|
|
3339
4526
|
|
|
@@ -3491,17 +4678,17 @@ async function addSignatureFieldUsingAnchor(pdf, fieldName = "SignatureDebtor",
|
|
|
3491
4678
|
__name(addSignatureFieldUsingAnchor, "addSignatureFieldUsingAnchor");
|
|
3492
4679
|
|
|
3493
4680
|
// src/nestjs-pdf.service.ts
|
|
3494
|
-
function
|
|
4681
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
3495
4682
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3496
4683
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3497
4684
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3498
4685
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3499
4686
|
}
|
|
3500
|
-
__name(
|
|
3501
|
-
function
|
|
4687
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
4688
|
+
function _ts_metadata5(k, v) {
|
|
3502
4689
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3503
4690
|
}
|
|
3504
|
-
__name(
|
|
4691
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
3505
4692
|
var NestjsPdfService = class {
|
|
3506
4693
|
static {
|
|
3507
4694
|
__name(this, "NestjsPdfService");
|
|
@@ -3618,6 +4805,46 @@ var NestjsPdfService = class {
|
|
|
3618
4805
|
return this.puppeteerService.generatePdfFromNunjucksFile(file, data, options);
|
|
3619
4806
|
}
|
|
3620
4807
|
/**
|
|
4808
|
+
* @param template Eta template string
|
|
4809
|
+
* @param data Data to inject into the template
|
|
4810
|
+
* @param options PDF generation options (optional)
|
|
4811
|
+
* @returns PDF generated from the provided Eta template with data applied
|
|
4812
|
+
* @description This method generates a PDF from an Eta template provided as a string. Eta is a fast and lightweight embedded templating language with a syntax similar to EJS but with better performance. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
|
|
4813
|
+
*/
|
|
4814
|
+
generatePdfFromEtaString(template, data = {}, options) {
|
|
4815
|
+
return this.puppeteerService.generatePdfFromEtaString(template, data, options);
|
|
4816
|
+
}
|
|
4817
|
+
/**
|
|
4818
|
+
* @param file Path to the Eta template file
|
|
4819
|
+
* @param data Data to inject into the template
|
|
4820
|
+
* @param options PDF generation options (optional)
|
|
4821
|
+
* @returns PDF generated from the Eta template at the provided file path with data applied
|
|
4822
|
+
* @description This method generates a PDF from an Eta template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
|
|
4823
|
+
*/
|
|
4824
|
+
generatePdfFromEtaFile(file, data = {}, options) {
|
|
4825
|
+
return this.puppeteerService.generatePdfFromEtaFile(file, data, options);
|
|
4826
|
+
}
|
|
4827
|
+
/**
|
|
4828
|
+
* @param template Mustache template string
|
|
4829
|
+
* @param data Data to inject into the template
|
|
4830
|
+
* @param options PDF generation options (optional)
|
|
4831
|
+
* @returns PDF generated from the provided Mustache template with data applied
|
|
4832
|
+
* @description This method generates a PDF from a Mustache template provided as a string. Mustache is a logic-less template language that emphasizes readable and simple templates. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
|
|
4833
|
+
*/
|
|
4834
|
+
generatePdfFromMustacheString(template, data = {}, options) {
|
|
4835
|
+
return this.puppeteerService.generatePdfFromMustacheString(template, data, options);
|
|
4836
|
+
}
|
|
4837
|
+
/**
|
|
4838
|
+
* @param file Path to the Mustache template file
|
|
4839
|
+
* @param data Data to inject into the template
|
|
4840
|
+
* @param options PDF generation options (optional)
|
|
4841
|
+
* @returns PDF generated from the Mustache template at the provided file path with data applied
|
|
4842
|
+
* @description This method generates a PDF from a Mustache template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
|
|
4843
|
+
*/
|
|
4844
|
+
generatePdfFromMustacheFile(file, data = {}, options) {
|
|
4845
|
+
return this.puppeteerService.generatePdfFromMustacheFile(file, data, options);
|
|
4846
|
+
}
|
|
4847
|
+
/**
|
|
3621
4848
|
* @param pdf The PDF bytes to modify
|
|
3622
4849
|
* @param fieldName The name of the signature field to add (default: 'SignatureDebtor')
|
|
3623
4850
|
* @param anchorText The text anchor to locate the signature field position (default: '__SIG_DEBTOR_ANCHOR__')
|
|
@@ -3643,29 +4870,29 @@ var NestjsPdfService = class {
|
|
|
3643
4870
|
return await addSignatureFieldUsingAnchor(pdf, fieldName, anchorText);
|
|
3644
4871
|
}
|
|
3645
4872
|
};
|
|
3646
|
-
NestjsPdfService =
|
|
3647
|
-
(0,
|
|
3648
|
-
|
|
3649
|
-
|
|
4873
|
+
NestjsPdfService = _ts_decorate9([
|
|
4874
|
+
(0, import_common9.Injectable)(),
|
|
4875
|
+
_ts_metadata5("design:type", Function),
|
|
4876
|
+
_ts_metadata5("design:paramtypes", [
|
|
3650
4877
|
typeof PuppeteerService === "undefined" ? Object : PuppeteerService
|
|
3651
4878
|
])
|
|
3652
4879
|
], NestjsPdfService);
|
|
3653
4880
|
|
|
3654
4881
|
// src/puppeteer/puppeteer.module.ts
|
|
3655
|
-
var
|
|
4882
|
+
var import_common10 = require("@nestjs/common");
|
|
3656
4883
|
var import_config = __toESM(require_config());
|
|
3657
4884
|
var import_nestjs_hbs2 = require("@gboutte/nestjs-hbs");
|
|
3658
|
-
function
|
|
4885
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
3659
4886
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3660
4887
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3661
4888
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3662
4889
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3663
4890
|
}
|
|
3664
|
-
__name(
|
|
3665
|
-
function
|
|
4891
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
4892
|
+
function _ts_metadata6(k, v) {
|
|
3666
4893
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3667
4894
|
}
|
|
3668
|
-
__name(
|
|
4895
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
3669
4896
|
function _ts_param3(paramIndex, decorator) {
|
|
3670
4897
|
return function(target, key) {
|
|
3671
4898
|
decorator(target, key, paramIndex);
|
|
@@ -3699,7 +4926,9 @@ var PuppeteerModule = class _PuppeteerModule {
|
|
|
3699
4926
|
MjmlService,
|
|
3700
4927
|
PugService,
|
|
3701
4928
|
EjsService,
|
|
3702
|
-
NunjucksService
|
|
4929
|
+
NunjucksService,
|
|
4930
|
+
EtaService,
|
|
4931
|
+
MustacheService
|
|
3703
4932
|
];
|
|
3704
4933
|
return {
|
|
3705
4934
|
module: _PuppeteerModule,
|
|
@@ -3712,7 +4941,9 @@ var PuppeteerModule = class _PuppeteerModule {
|
|
|
3712
4941
|
MjmlService,
|
|
3713
4942
|
PugService,
|
|
3714
4943
|
EjsService,
|
|
3715
|
-
NunjucksService
|
|
4944
|
+
NunjucksService,
|
|
4945
|
+
EtaService,
|
|
4946
|
+
MustacheService
|
|
3716
4947
|
]
|
|
3717
4948
|
};
|
|
3718
4949
|
}
|
|
@@ -3744,52 +4975,60 @@ var PuppeteerModule = class _PuppeteerModule {
|
|
|
3744
4975
|
MjmlService,
|
|
3745
4976
|
PugService,
|
|
3746
4977
|
EjsService,
|
|
3747
|
-
NunjucksService
|
|
4978
|
+
NunjucksService,
|
|
4979
|
+
EtaService,
|
|
4980
|
+
MustacheService
|
|
3748
4981
|
],
|
|
3749
4982
|
exports: [
|
|
3750
4983
|
PuppeteerService,
|
|
3751
4984
|
MjmlService,
|
|
3752
4985
|
PugService,
|
|
3753
4986
|
EjsService,
|
|
3754
|
-
NunjucksService
|
|
4987
|
+
NunjucksService,
|
|
4988
|
+
EtaService,
|
|
4989
|
+
MustacheService
|
|
3755
4990
|
]
|
|
3756
4991
|
};
|
|
3757
4992
|
}
|
|
3758
4993
|
};
|
|
3759
|
-
PuppeteerModule =
|
|
3760
|
-
(0,
|
|
4994
|
+
PuppeteerModule = _ts_decorate10([
|
|
4995
|
+
(0, import_common10.Module)({
|
|
3761
4996
|
providers: [
|
|
3762
4997
|
PuppeteerService,
|
|
3763
4998
|
BrowserService,
|
|
3764
4999
|
MjmlService,
|
|
3765
5000
|
PugService,
|
|
3766
5001
|
EjsService,
|
|
3767
|
-
NunjucksService
|
|
5002
|
+
NunjucksService,
|
|
5003
|
+
EtaService,
|
|
5004
|
+
MustacheService
|
|
3768
5005
|
],
|
|
3769
5006
|
exports: [
|
|
3770
5007
|
PuppeteerService,
|
|
3771
5008
|
MjmlService,
|
|
3772
5009
|
PugService,
|
|
3773
5010
|
EjsService,
|
|
3774
|
-
NunjucksService
|
|
5011
|
+
NunjucksService,
|
|
5012
|
+
EtaService,
|
|
5013
|
+
MustacheService
|
|
3775
5014
|
]
|
|
3776
5015
|
}),
|
|
3777
|
-
_ts_param3(1, (0,
|
|
3778
|
-
|
|
3779
|
-
|
|
5016
|
+
_ts_param3(1, (0, import_common10.Inject)(PDF_PARAMETERS)),
|
|
5017
|
+
_ts_metadata6("design:type", Function),
|
|
5018
|
+
_ts_metadata6("design:paramtypes", [
|
|
3780
5019
|
typeof BrowserService === "undefined" ? Object : BrowserService,
|
|
3781
5020
|
typeof PuppeteerParameters === "undefined" ? Object : PuppeteerParameters
|
|
3782
5021
|
])
|
|
3783
5022
|
], PuppeteerModule);
|
|
3784
5023
|
|
|
3785
5024
|
// src/nestjs-pdf.module.ts
|
|
3786
|
-
function
|
|
5025
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
3787
5026
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3788
5027
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3789
5028
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3790
5029
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3791
5030
|
}
|
|
3792
|
-
__name(
|
|
5031
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
3793
5032
|
var NestjsPdfModule = class _NestjsPdfModule {
|
|
3794
5033
|
static {
|
|
3795
5034
|
__name(this, "NestjsPdfModule");
|
|
@@ -3823,21 +5062,23 @@ var NestjsPdfModule = class _NestjsPdfModule {
|
|
|
3823
5062
|
};
|
|
3824
5063
|
}
|
|
3825
5064
|
};
|
|
3826
|
-
NestjsPdfModule =
|
|
3827
|
-
(0,
|
|
5065
|
+
NestjsPdfModule = _ts_decorate11([
|
|
5066
|
+
(0, import_common11.Module)({})
|
|
3828
5067
|
], NestjsPdfModule);
|
|
3829
5068
|
|
|
3830
5069
|
// src/helpers/getRelativePath.helper.ts
|
|
3831
|
-
var
|
|
5070
|
+
var import_node_path4 = require("path");
|
|
3832
5071
|
function getRelativePathToValue(moduleDir, relativeToModule) {
|
|
3833
|
-
const fullTemplatePath = (0,
|
|
3834
|
-
return (0,
|
|
5072
|
+
const fullTemplatePath = (0, import_node_path4.resolve)(moduleDir, relativeToModule);
|
|
5073
|
+
return (0, import_node_path4.relative)(process.cwd(), fullTemplatePath);
|
|
3835
5074
|
}
|
|
3836
5075
|
__name(getRelativePathToValue, "getRelativePathToValue");
|
|
3837
5076
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3838
5077
|
0 && (module.exports = {
|
|
3839
5078
|
EjsService,
|
|
5079
|
+
EtaService,
|
|
3840
5080
|
MjmlService,
|
|
5081
|
+
MustacheService,
|
|
3841
5082
|
NestjsPdfModule,
|
|
3842
5083
|
NestjsPdfService,
|
|
3843
5084
|
NunjucksService,
|
|
@@ -3846,3 +5087,11 @@ __name(getRelativePathToValue, "getRelativePathToValue");
|
|
|
3846
5087
|
PuppeteerService,
|
|
3847
5088
|
getRelativePathToValue
|
|
3848
5089
|
});
|
|
5090
|
+
/*! Bundled license information:
|
|
5091
|
+
|
|
5092
|
+
mustache/mustache.mjs:
|
|
5093
|
+
(*!
|
|
5094
|
+
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
5095
|
+
* http://github.com/janl/mustache.js
|
|
5096
|
+
*)
|
|
5097
|
+
*/
|