@muil/templates-renderer
Advanced tools
Comparing version 1.3.14 to 1.4.0
{ | ||
"name": "@muil/templates-renderer", | ||
"version": "1.3.14", | ||
"version": "1.4.0", | ||
"license": "MIT", | ||
@@ -19,3 +19,3 @@ "main": "src/index.js", | ||
"juice": "^7.0.0", | ||
"puppeteer-core": "^9.1.1", | ||
"puppeteer-core": "^14.0.0", | ||
"reflect-metadata": "^0.1.13", | ||
@@ -25,7 +25,7 @@ "request": "^2.88.2", | ||
"uuid": "^8.3.1", | ||
"vm2": "3.9.2" | ||
"vm2": "3.9.9" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"react": "^17.0.1", | ||
"react-dom": "^17.0.1", | ||
"styled-components": "^5.2.0" | ||
@@ -38,3 +38,3 @@ }, | ||
}, | ||
"gitHead": "f262db28992c70a6d34ed1f03eacb6256b8a81af" | ||
"gitHead": "984b2bb64d92bfa78594b5608075ce9d82f7ec68" | ||
} |
/// <reference types="node" /> | ||
import puppeteer from 'puppeteer-core'; | ||
export declare const generatePdf: (html: string, format?: puppeteer.PaperFormat, orientation?: 'portrait' | 'landscape') => Promise<Buffer>; | ||
export declare const generatePng: (html: string) => Promise<string | void | Buffer>; | ||
export declare const generatePng: (html: string) => Promise<string | Buffer>; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -40,6 +44,6 @@ if (k2 === undefined) k2 = k; | ||
require: { | ||
external: ['react', 'react-dom/server'], | ||
external: ['react', 'react-dom'], | ||
}, | ||
}); | ||
const tempFileName = `./.muil/temp/${uuid_1.v4()}.js`; | ||
const tempFileName = `./.muil/temp/${(0, uuid_1.v4)()}.js`; | ||
await fs.promises.mkdir('./.muil/temp', { recursive: true }); | ||
@@ -64,3 +68,3 @@ await fs.promises.copyFile(templatePath, tempFileName); | ||
require: { | ||
external: ['react-dom/server'], | ||
external: ['react-dom'], | ||
}, | ||
@@ -84,3 +88,3 @@ }); | ||
: null; | ||
let html = emailTemplate_1.default({ | ||
let html = (0, emailTemplate_1.default)({ | ||
css: templateCss, | ||
@@ -92,6 +96,6 @@ styles: (await Promise.all(styleCollectors.map((collector) => collector(ReactElement)))).join('\n'), | ||
if (type === 'html' && inlineCss) { | ||
html = juice_1.default(html); | ||
html = (0, juice_1.default)(html); | ||
} | ||
if (minifyHtml) { | ||
html = html_minifier_1.minify(html, { | ||
html = (0, html_minifier_1.minify)(html, { | ||
preventAttributesEscaping: true, | ||
@@ -106,6 +110,6 @@ minifyCSS: true, | ||
case 'png': { | ||
return puppeteer_1.generatePng(html); | ||
return (0, puppeteer_1.generatePng)(html); | ||
} | ||
case 'pdf': { | ||
return puppeteer_1.generatePdf(html, pdfFormat, pdfOrientation); | ||
return (0, puppeteer_1.generatePdf)(html, pdfFormat, pdfOrientation); | ||
} | ||
@@ -112,0 +116,0 @@ default: { |
@@ -12,3 +12,3 @@ "use strict"; | ||
require: { | ||
external: ['react', 'react-dom/server', 'styled-components'], | ||
external: ['react', 'react-dom', 'styled-components'], | ||
}, | ||
@@ -15,0 +15,0 @@ }); |
@@ -15,3 +15,3 @@ "use strict"; | ||
TemplatesRendererModule = __decorate([ | ||
common_1.Module({ | ||
(0, common_1.Module)({ | ||
providers: [templates_renderer_service_1.TemplatesRendererService], | ||
@@ -18,0 +18,0 @@ exports: [templates_renderer_service_1.TemplatesRendererService], |
@@ -17,3 +17,3 @@ "use strict"; | ||
async render({ type = 'html', templatePath, templateCssPath = null, props = {}, shadowSupport = false, inlineCss = true, minifyHtml = true, pdfFormat = 'a4', pdfOrientation = 'portrait', }) { | ||
return renderTemplate_1.default({ | ||
return (0, renderTemplate_1.default)({ | ||
type, | ||
@@ -32,5 +32,5 @@ templatePath, | ||
TemplatesRendererService = __decorate([ | ||
common_1.Injectable() | ||
(0, common_1.Injectable)() | ||
], TemplatesRendererService); | ||
exports.TemplatesRendererService = TemplatesRendererService; | ||
//# sourceMappingURL=templates-renderer.service.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
381
79236
+ Added@types/node@22.5.4(transitive)
+ Addedacorn@8.12.1(transitive)
+ Addedacorn-walk@8.3.4(transitive)
+ Addedcaniuse-lite@1.0.30001659(transitive)
+ Addedcross-fetch@3.1.5(transitive)
+ Addeddebug@4.3.4(transitive)
+ Addeddevtools-protocol@0.0.1001819(transitive)
+ Addedelectron-to-chromium@1.5.18(transitive)
+ Addedms@2.1.2(transitive)
+ Addednode-fetch@2.6.7(transitive)
+ Addedpump@3.0.0(transitive)
+ Addedpuppeteer-core@14.4.1(transitive)
+ Addedreact@17.0.2(transitive)
+ Addedreact-dom@17.0.2(transitive)
+ Addedreact-is@18.3.1(transitive)
+ Addedscheduler@0.20.2(transitive)
+ Addedvm2@3.9.9(transitive)
+ Addedws@8.7.0(transitive)
- Removed@types/node@22.5.5(transitive)
- Removedcaniuse-lite@1.0.30001660(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddevtools-protocol@0.0.869402(transitive)
- Removedelectron-to-chromium@1.5.23(transitive)
- Removedms@2.1.3(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedpuppeteer-core@9.1.1(transitive)
- Removedreact@16.14.0(transitive)
- Removedreact-dom@16.14.0(transitive)
- Removedscheduler@0.19.1(transitive)
- Removedvm2@3.9.2(transitive)
- Removedws@7.5.10(transitive)
Updatedpuppeteer-core@^14.0.0
Updatedvm2@3.9.9