@shad0wz7/nestjs-pdf 2.0.1 → 2.1.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 CHANGED
@@ -3,13 +3,12 @@
3
3
  A small NestJS library to generate and manipulate PDFs using Puppeteer and multiple template engines, including Handlebars, EJS, Pug, and MJML.
4
4
 
5
5
  Main features:
6
+
6
7
  - Generate PDFs from HTML, Handlebars, EJS, Pug or MJML templates
7
8
  - Concurrency limiting for Puppeteer jobs (p-limit)
8
9
  - Add signature fields based on a text anchor in an existing PDF
9
10
  - Simple API (module and service) to integrate easily into a Nest application
10
11
 
11
- > Note: this repository contains the library source. To use it in another project, you can either install it from npm or import the local package from the source.
12
-
13
12
  ## Installation
14
13
 
15
14
  To add the library inside your project :
@@ -29,6 +28,14 @@ pnpm add ../path/to/nestjs-pdf
29
28
 
30
29
  Import the module and configure it in your Nest application:
31
30
 
31
+ To use a template engine, you need to install the corresponding package as a dependency in your project:
32
+
33
+ - For Handlebars: `npm install @gboutte/nestjs-hbs`
34
+ - For EJS: `npm install ejs`
35
+ - For Pug: `npm install pug`
36
+ - For MJML: `npm install mjml`
37
+ - For Nunjucks: `npm install nunjucks`
38
+
32
39
  ```ts
33
40
  import { Module } from '@nestjs/common';
34
41
  import { NestjsPdfModule } from 'nestjs-pdf';
@@ -68,11 +75,17 @@ Use a Handlebars template (string or file):
68
75
 
69
76
  ```ts
70
77
  const template = '<h1>{{title}}</h1><p>{{content}}</p>';
71
- const pdf = await pdfService.generatePdfFromTemplateHbsString(template, { title: 'T', content: '...' });
78
+ const pdf = await pdfService.generatePdfFromTemplateHbsString(template, {
79
+ title: 'T',
80
+ content: '...',
81
+ });
72
82
  ```
73
83
 
74
84
  ```ts
75
- const pdf = await pdfService.generatePdfFromTemplateHbsFile(filePath, { title: 'T', content: '...' });
85
+ const pdf = await pdfService.generatePdfFromTemplateHbsFile(filePath, {
86
+ title: 'T',
87
+ content: '...',
88
+ });
76
89
  ```
77
90
 
78
91
  Add a signature field to an existing PDF (anchor-based):
@@ -94,9 +107,65 @@ If the anchor is not found, the signature field will be added at a default posit
94
107
 
95
108
  The library exposes Puppeteer options via the `PuppeteerParameters` interface (see `src/puppeteer/puppeteer-parameters.interface.ts`). You can configure:
96
109
 
97
- - `headless` (boolean | 'shell')
98
- - `pdfOptions` (native Puppeteer options for `page.pdf`)
99
- - `extraPuppeteerArgs` (launch arguments for Chromium)
110
+
111
+ | | Description |
112
+ |-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
113
+ | `pdfOptions` | The pdf options can be found on: https://pptr.dev/api/puppeteer.pdfoptions. Native Puppeteer options for `page.pdf` |
114
+ | `hbsOptions` | The handlebars can be found on [@gboutte/nestjs-hbs](https://github.com/gboutte/nestjs-hbs) as it use a peer dependency and not handlebars directly |
115
+ | `ejsOptions` | The ejs options can be found on [EJS documentation](https://ejs.co/#options) |
116
+ | `pugOptions` | The pug options can be found on [Pug documentation](https://pugjs.org/api/reference.html#options) |
117
+ | `mjmlOptions` | The mjml options can be found on [MJML documentation](https://mjml.io/documentation/#options) |
118
+ | `nunjucksOptions` | The nunjucks options can be found on [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#configure) |
119
+ | `browser` | The browser to use for the PDF generation. By default: `Browser.CHROMIUM`. Allowed values `Browser.CHROMIUM`, `Browser.CHROMEHEADLESSSHELL`, `Browser.CHROME`, `Browser.FIREFOX`, `Browser.CHROMEDRIVER` ([Official documentation of Browser](https://pptr.dev/browsers-api/browsers.browser)) |
120
+ | `browserTag` | The version of the browser to use for the PDF generation. By default: `BrowserTag.LATEST` if Browser is **CHROMIUM** else `BrowserTag.STABLE`. Allowed values `BrowserTag.STABLE`, `BrowserTag.LATEST`, `BrowserTag.BETA`, `BrowserTag.DEV`, `BrowserTag.CANARY` |
121
+ | `browserInstallBaseUrl` | The baseUrl used for the installation of the browser. This baseUrl is passed to the [`install`](https://pptr.dev/browsers-api/browsers.install) method of `@puppeteer/browsers` |
122
+ | `headless` | Define if you want to use chromium headless or not, or the old headless version (`shell`). By default it's `true`. Allowed values: `true`,`false`,`"shell"` |
123
+ | `useLockedBrowser` | Define if you want to use the locked version of the browser. By default it's `false`. Allowed values: `true`,`false` |
124
+ | `buildId` | You can force the build id. Should be `string` |
125
+ | `cleanupBrowserCacheOnExit` | Define if you want to clean up the browser cache folder on exit. By default it's `true`. Allowed values: `true`,`false` |
126
+ | `extraPuppeteerArgs` | It passes some extra arguments to Puppeteer's launch method. You can check the default args at bellow. Should be `string[]` |
127
+
128
+ these are the default extra arguments passed to Puppeteer:
129
+ ```ts
130
+ [
131
+ '--autoplay-policy=user-gesture-required',
132
+ '--disable-background-networking',
133
+ '--disable-background-timer-throttling',
134
+ '--disable-backgrounding-occluded-windows',
135
+ '--disable-breakpad',
136
+ '--disable-client-side-phishing-detection',
137
+ '--disable-component-update',
138
+ '--disable-default-apps',
139
+ '--disable-dev-shm-usage',
140
+ '--disable-domain-reliability',
141
+ '--disable-extensions',
142
+ '--disable-features=AudioServiceOutOfProcess',
143
+ '--disable-hang-monitor',
144
+ '--disable-ipc-flooding-protection',
145
+ '--disable-notifications',
146
+ '--disable-offer-store-unmasked-wallet-cards',
147
+ '--disable-popup-blocking',
148
+ '--disable-print-preview',
149
+ '--disable-prompt-on-repost',
150
+ '--disable-renderer-backgrounding',
151
+ '--disable-setuid-sandbox',
152
+ '--disable-speech-api',
153
+ '--disable-sync',
154
+ '--hide-scrollbars',
155
+ '--ignore-gpu-blacklist',
156
+ '--metrics-recording-only',
157
+ '--mute-audio',
158
+ '--no-default-browser-check',
159
+ '--no-first-run',
160
+ '--no-pings',
161
+ '--password-store=basic',
162
+ '--use-gl=swiftshader',
163
+ '--use-mock-keychain',
164
+ '--disable-accelerated-2d-canvas',
165
+ '--no-zygote',
166
+ '--disable-gpu',
167
+ ];
168
+ ```
100
169
 
101
170
  You can use `forRootAsync(...)` if you need to provide configuration asynchronously.
102
171
 
package/dist/index.d.mts CHANGED
@@ -6,6 +6,7 @@ import { Browser, BrowserContext, PDFOptions } from 'puppeteer';
6
6
  import { MJMLParsingOptions } from 'mjml-core';
7
7
  import pug, { LocalsObject } from 'pug';
8
8
  import { Options, Data } from 'ejs';
9
+ import { ConfigureOptions } from 'nunjucks';
9
10
  import { HandlebarsService } from '@gboutte/nestjs-hbs';
10
11
 
11
12
  declare enum BrowserTag {
@@ -67,12 +68,26 @@ declare class EjsService {
67
68
  renderFile(filePath: string, data?: Data, options?: EjsOptions): Promise<string>;
68
69
  }
69
70
 
71
+ interface NunjucksOptions extends Partial<ConfigureOptions> {
72
+ noCache?: boolean;
73
+ watch?: boolean;
74
+ throwOnUndefined?: boolean;
75
+ trimBlocks?: boolean;
76
+ lstripBlocks?: boolean;
77
+ }
78
+ declare class NunjucksService {
79
+ constructor();
80
+ render(template: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
81
+ renderFile(filePath: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
82
+ }
83
+
70
84
  interface PuppeteerParameters {
71
85
  pdfOptions?: PDFOptions;
72
86
  hbsOptions?: HandlebarsOptions;
73
87
  mjmlOptions?: MJMLParsingOptions;
74
88
  pugOptions?: PugOptions;
75
89
  ejsOptions?: EjsOptions;
90
+ nunjucksOptions?: NunjucksOptions;
76
91
  chromiumRevision?: string;
77
92
  buildId?: string;
78
93
  headless?: boolean | 'shell';
@@ -105,7 +120,8 @@ declare class PuppeteerService {
105
120
  private readonly mjmlService?;
106
121
  private readonly pugService?;
107
122
  private readonly ejsService?;
108
- constructor(hbsService: HandlebarsService, browserService: BrowserService, options: PuppeteerParameters, mjmlService?: MjmlService | undefined, pugService?: PugService | undefined, ejsService?: EjsService | undefined);
123
+ private readonly nunjucksService?;
124
+ constructor(hbsService: HandlebarsService, browserService: BrowserService, options: PuppeteerParameters, mjmlService?: MjmlService | undefined, pugService?: PugService | undefined, ejsService?: EjsService | undefined, nunjucksService?: NunjucksService | undefined);
109
125
  private readonly limit;
110
126
  generatePdfFromHtml(html: string, options?: PuppeteerParameters): Promise<Uint8Array>;
111
127
  generatePdfFromTemplateHbsString(template: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
@@ -116,6 +132,8 @@ declare class PuppeteerService {
116
132
  generatePdfFromPugFile(file: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
117
133
  generatePdfFromEjsString(template: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
118
134
  generatePdfFromEjsFile(file: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
135
+ generatePdfFromNunjucksString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
136
+ generatePdfFromNunjucksFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
119
137
  }
120
138
 
121
139
  declare class NestjsPdfService {
@@ -128,24 +146,6 @@ declare class NestjsPdfService {
128
146
  * @description This method uses the Puppeteer service to generate a PDF from an HTML string. Generation options can be customized by passing a `PuppeteerParameters` object as the second argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
129
147
  */
130
148
  generatePdfFromHtml(html: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
131
- /**
132
- * @deprecated Use the new method generatePdfFromTemplateHbsString
133
- * @param template Handlebars template string
134
- * @param parameters Data parameters to inject into the template
135
- * @param options PDF generation options (optional)
136
- * @returns PDF generated from the provided Handlebars template with parameters applied
137
- * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
138
- */
139
- generatePdfFromTemplateString(template: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
140
- /**
141
- * @deprecated Use the new method generatePdfFromTemplateHbsFile
142
- * @param file Path to the Handlebars template file
143
- * @param parameters Data parameters to inject into the template
144
- * @param options PDF generation options (optional)
145
- * @returns PDF generated from the Handlebars template at the provided file path with parameters applied
146
- * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
147
- */
148
- generatePdfFromTemplateFile(file: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
149
149
  /**
150
150
  * @param template Handlebars template string
151
151
  * @param parameters Data parameters to inject into the template
@@ -208,6 +208,22 @@ declare class NestjsPdfService {
208
208
  * @description This method generates a PDF from a Pug 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.
209
209
  */
210
210
  generatePdfFromPugFile(file: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
211
+ /**
212
+ * @param template Nunjucks template string
213
+ * @param data Data to inject into the template
214
+ * @param options PDF generation options (optional)
215
+ * @returns PDF generated from the provided Nunjucks template with data applied
216
+ * @description This method generates a PDF from a Nunjucks template provided as a string. Nunjucks is a powerful templating language with support for inheritance, macros, and filters. 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.
217
+ */
218
+ generatePdfFromNunjucksString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
219
+ /**
220
+ * @param file Path to the Nunjucks template file
221
+ * @param data Data to inject into the template
222
+ * @param options PDF generation options (optional)
223
+ * @returns PDF generated from the Nunjucks template at the provided file path with data applied
224
+ * @description This method generates a PDF from a Nunjucks 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.
225
+ */
226
+ generatePdfFromNunjucksFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
211
227
  /**
212
228
  * @param pdf The PDF bytes to modify
213
229
  * @param fieldName The name of the signature field to add (default: 'SignatureDebtor')
@@ -257,4 +273,4 @@ declare class PuppeteerModule implements OnModuleInit {
257
273
  */
258
274
  declare function getRelativePathToValue(moduleDir: string, relativeToModule: string): string;
259
275
 
260
- export { type EjsOptions, EjsService, MjmlService, NestjsPdfModule, NestjsPdfService, type PdfLibModuleAsyncOptions, type PugOptions, PugService, PuppeteerModule, type PuppeteerModuleAsyncOptions, type PuppeteerParameters, PuppeteerService, getRelativePathToValue };
276
+ export { type EjsOptions, EjsService, MjmlService, NestjsPdfModule, NestjsPdfService, type NunjucksOptions, NunjucksService, type PdfLibModuleAsyncOptions, type PugOptions, PugService, PuppeteerModule, type PuppeteerModuleAsyncOptions, type PuppeteerParameters, PuppeteerService, getRelativePathToValue };
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import { Browser, BrowserContext, PDFOptions } from 'puppeteer';
6
6
  import { MJMLParsingOptions } from 'mjml-core';
7
7
  import pug, { LocalsObject } from 'pug';
8
8
  import { Options, Data } from 'ejs';
9
+ import { ConfigureOptions } from 'nunjucks';
9
10
  import { HandlebarsService } from '@gboutte/nestjs-hbs';
10
11
 
11
12
  declare enum BrowserTag {
@@ -67,12 +68,26 @@ declare class EjsService {
67
68
  renderFile(filePath: string, data?: Data, options?: EjsOptions): Promise<string>;
68
69
  }
69
70
 
71
+ interface NunjucksOptions extends Partial<ConfigureOptions> {
72
+ noCache?: boolean;
73
+ watch?: boolean;
74
+ throwOnUndefined?: boolean;
75
+ trimBlocks?: boolean;
76
+ lstripBlocks?: boolean;
77
+ }
78
+ declare class NunjucksService {
79
+ constructor();
80
+ render(template: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
81
+ renderFile(filePath: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
82
+ }
83
+
70
84
  interface PuppeteerParameters {
71
85
  pdfOptions?: PDFOptions;
72
86
  hbsOptions?: HandlebarsOptions;
73
87
  mjmlOptions?: MJMLParsingOptions;
74
88
  pugOptions?: PugOptions;
75
89
  ejsOptions?: EjsOptions;
90
+ nunjucksOptions?: NunjucksOptions;
76
91
  chromiumRevision?: string;
77
92
  buildId?: string;
78
93
  headless?: boolean | 'shell';
@@ -105,7 +120,8 @@ declare class PuppeteerService {
105
120
  private readonly mjmlService?;
106
121
  private readonly pugService?;
107
122
  private readonly ejsService?;
108
- constructor(hbsService: HandlebarsService, browserService: BrowserService, options: PuppeteerParameters, mjmlService?: MjmlService | undefined, pugService?: PugService | undefined, ejsService?: EjsService | undefined);
123
+ private readonly nunjucksService?;
124
+ constructor(hbsService: HandlebarsService, browserService: BrowserService, options: PuppeteerParameters, mjmlService?: MjmlService | undefined, pugService?: PugService | undefined, ejsService?: EjsService | undefined, nunjucksService?: NunjucksService | undefined);
109
125
  private readonly limit;
110
126
  generatePdfFromHtml(html: string, options?: PuppeteerParameters): Promise<Uint8Array>;
111
127
  generatePdfFromTemplateHbsString(template: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
@@ -116,6 +132,8 @@ declare class PuppeteerService {
116
132
  generatePdfFromPugFile(file: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
117
133
  generatePdfFromEjsString(template: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
118
134
  generatePdfFromEjsFile(file: string, data?: Data, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
135
+ generatePdfFromNunjucksString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
136
+ generatePdfFromNunjucksFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
119
137
  }
120
138
 
121
139
  declare class NestjsPdfService {
@@ -128,24 +146,6 @@ declare class NestjsPdfService {
128
146
  * @description This method uses the Puppeteer service to generate a PDF from an HTML string. Generation options can be customized by passing a `PuppeteerParameters` object as the second argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
129
147
  */
130
148
  generatePdfFromHtml(html: string, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
131
- /**
132
- * @deprecated Use the new method generatePdfFromTemplateHbsString
133
- * @param template Handlebars template string
134
- * @param parameters Data parameters to inject into the template
135
- * @param options PDF generation options (optional)
136
- * @returns PDF generated from the provided Handlebars template with parameters applied
137
- * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
138
- */
139
- generatePdfFromTemplateString(template: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
140
- /**
141
- * @deprecated Use the new method generatePdfFromTemplateHbsFile
142
- * @param file Path to the Handlebars template file
143
- * @param parameters Data parameters to inject into the template
144
- * @param options PDF generation options (optional)
145
- * @returns PDF generated from the Handlebars template at the provided file path with parameters applied
146
- * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
147
- */
148
- generatePdfFromTemplateFile(file: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
149
149
  /**
150
150
  * @param template Handlebars template string
151
151
  * @param parameters Data parameters to inject into the template
@@ -208,6 +208,22 @@ declare class NestjsPdfService {
208
208
  * @description This method generates a PDF from a Pug 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.
209
209
  */
210
210
  generatePdfFromPugFile(file: string, data?: LocalsObject, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
211
+ /**
212
+ * @param template Nunjucks template string
213
+ * @param data Data to inject into the template
214
+ * @param options PDF generation options (optional)
215
+ * @returns PDF generated from the provided Nunjucks template with data applied
216
+ * @description This method generates a PDF from a Nunjucks template provided as a string. Nunjucks is a powerful templating language with support for inheritance, macros, and filters. 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.
217
+ */
218
+ generatePdfFromNunjucksString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
219
+ /**
220
+ * @param file Path to the Nunjucks template file
221
+ * @param data Data to inject into the template
222
+ * @param options PDF generation options (optional)
223
+ * @returns PDF generated from the Nunjucks template at the provided file path with data applied
224
+ * @description This method generates a PDF from a Nunjucks 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.
225
+ */
226
+ generatePdfFromNunjucksFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
211
227
  /**
212
228
  * @param pdf The PDF bytes to modify
213
229
  * @param fieldName The name of the signature field to add (default: 'SignatureDebtor')
@@ -257,4 +273,4 @@ declare class PuppeteerModule implements OnModuleInit {
257
273
  */
258
274
  declare function getRelativePathToValue(moduleDir: string, relativeToModule: string): string;
259
275
 
260
- export { type EjsOptions, EjsService, MjmlService, NestjsPdfModule, NestjsPdfService, type PdfLibModuleAsyncOptions, type PugOptions, PugService, PuppeteerModule, type PuppeteerModuleAsyncOptions, type PuppeteerParameters, PuppeteerService, getRelativePathToValue };
276
+ export { type EjsOptions, EjsService, MjmlService, NestjsPdfModule, NestjsPdfService, type NunjucksOptions, NunjucksService, type PdfLibModuleAsyncOptions, type PugOptions, PugService, PuppeteerModule, type PuppeteerModuleAsyncOptions, type PuppeteerParameters, PuppeteerService, getRelativePathToValue };
package/dist/index.js CHANGED
@@ -2578,6 +2578,7 @@ __export(index_exports, {
2578
2578
  MjmlService: () => MjmlService,
2579
2579
  NestjsPdfModule: () => NestjsPdfModule,
2580
2580
  NestjsPdfService: () => NestjsPdfService,
2581
+ NunjucksService: () => NunjucksService,
2581
2582
  PugService: () => PugService,
2582
2583
  PuppeteerModule: () => PuppeteerModule,
2583
2584
  PuppeteerService: () => PuppeteerService,
@@ -2586,13 +2587,13 @@ __export(index_exports, {
2586
2587
  module.exports = __toCommonJS(index_exports);
2587
2588
 
2588
2589
  // src/nestjs-pdf.module.ts
2589
- var import_common8 = require("@nestjs/common");
2590
+ var import_common9 = require("@nestjs/common");
2590
2591
 
2591
2592
  // src/nestjs-pdf.service.ts
2592
- var import_common6 = require("@nestjs/common");
2593
+ var import_common7 = require("@nestjs/common");
2593
2594
 
2594
2595
  // src/puppeteer/puppeteer.service.ts
2595
- var import_common5 = require("@nestjs/common");
2596
+ var import_common6 = require("@nestjs/common");
2596
2597
 
2597
2598
  // src/puppeteer/helpers/tokens.ts
2598
2599
  var PDF_PARAMETERS = "PDF_PARAMETERS";
@@ -3065,7 +3066,9 @@ EjsService = _ts_decorate4([
3065
3066
  (0, import_common4.Injectable)()
3066
3067
  ], EjsService);
3067
3068
 
3068
- // src/puppeteer/puppeteer.service.ts
3069
+ // src/puppeteer/services/nunjucks.service.ts
3070
+ var import_common5 = require("@nestjs/common");
3071
+ var nunjucks = __toESM(require("nunjucks"));
3069
3072
  function _ts_decorate5(decorators, target, key, desc) {
3070
3073
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3071
3074
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3077,6 +3080,74 @@ function _ts_metadata2(k, v) {
3077
3080
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3078
3081
  }
3079
3082
  __name(_ts_metadata2, "_ts_metadata");
3083
+ var NunjucksService = class {
3084
+ static {
3085
+ __name(this, "NunjucksService");
3086
+ }
3087
+ constructor() {
3088
+ nunjucks.configure({
3089
+ noCache: true,
3090
+ trimBlocks: true,
3091
+ lstripBlocks: true
3092
+ });
3093
+ }
3094
+ render(template, data = {}, options) {
3095
+ try {
3096
+ if (options) {
3097
+ const configOptions = {
3098
+ noCache: options.noCache ?? true,
3099
+ watch: options.watch ?? false,
3100
+ throwOnUndefined: options.throwOnUndefined ?? false,
3101
+ trimBlocks: options.trimBlocks ?? true,
3102
+ lstripBlocks: options.lstripBlocks ?? true
3103
+ };
3104
+ nunjucks.configure(configOptions);
3105
+ }
3106
+ return nunjucks.renderString(template, data);
3107
+ } catch (error) {
3108
+ throw new Error(`Nunjucks rendering failed: ${String(error)}`, {
3109
+ cause: error
3110
+ });
3111
+ }
3112
+ }
3113
+ renderFile(filePath, data = {}, options) {
3114
+ try {
3115
+ if (options) {
3116
+ const configOptions = {
3117
+ noCache: options.noCache ?? true,
3118
+ watch: options.watch ?? false,
3119
+ throwOnUndefined: options.throwOnUndefined ?? false,
3120
+ trimBlocks: options.trimBlocks ?? true,
3121
+ lstripBlocks: options.lstripBlocks ?? true
3122
+ };
3123
+ nunjucks.configure(configOptions);
3124
+ }
3125
+ return nunjucks.render(filePath, data);
3126
+ } catch (error) {
3127
+ throw new Error(`Nunjucks file rendering failed: ${String(error)}`, {
3128
+ cause: error
3129
+ });
3130
+ }
3131
+ }
3132
+ };
3133
+ NunjucksService = _ts_decorate5([
3134
+ (0, import_common5.Injectable)(),
3135
+ _ts_metadata2("design:type", Function),
3136
+ _ts_metadata2("design:paramtypes", [])
3137
+ ], NunjucksService);
3138
+
3139
+ // src/puppeteer/puppeteer.service.ts
3140
+ function _ts_decorate6(decorators, target, key, desc) {
3141
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3142
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3143
+ 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;
3144
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3145
+ }
3146
+ __name(_ts_decorate6, "_ts_decorate");
3147
+ function _ts_metadata3(k, v) {
3148
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3149
+ }
3150
+ __name(_ts_metadata3, "_ts_metadata");
3080
3151
  function _ts_param2(paramIndex, decorator) {
3081
3152
  return function(target, key) {
3082
3153
  decorator(target, key, paramIndex);
@@ -3093,20 +3164,22 @@ var PuppeteerService = class {
3093
3164
  mjmlService;
3094
3165
  pugService;
3095
3166
  ejsService;
3096
- constructor(hbsService, browserService, options, mjmlService, pugService, ejsService) {
3167
+ nunjucksService;
3168
+ constructor(hbsService, browserService, options, mjmlService, pugService, ejsService, nunjucksService) {
3097
3169
  this.hbsService = hbsService;
3098
3170
  this.browserService = browserService;
3099
3171
  this.options = options;
3100
3172
  this.mjmlService = mjmlService;
3101
3173
  this.pugService = pugService;
3102
3174
  this.ejsService = ejsService;
3175
+ this.nunjucksService = nunjucksService;
3103
3176
  }
3104
3177
  limit = (0, import_p_limit.default)(3);
3105
3178
  async generatePdfFromHtml(html, options) {
3106
3179
  return this.limit(async () => {
3107
3180
  const mergePuppeteerOptions = mergePuppeteerParameters(this.options, options);
3108
3181
  if (mergePuppeteerOptions.chromiumRevision !== void 0) {
3109
- import_common5.Logger.warn("Using `chromiumRevision` is no longer supported since the puppeteer update.");
3182
+ import_common6.Logger.warn("Using `chromiumRevision` is no longer supported since the puppeteer update.");
3110
3183
  }
3111
3184
  const headless = mergePuppeteerOptions.headless ?? true;
3112
3185
  const args = mergePuppeteerOptions.extraPuppeteerArgs || [
@@ -3166,14 +3239,14 @@ var PuppeteerService = class {
3166
3239
  await page.evaluate(() => document.fonts.ready);
3167
3240
  return await page.pdf(pdfOptions);
3168
3241
  } catch (e) {
3169
- import_common5.Logger.error(e);
3242
+ import_common6.Logger.error(e);
3170
3243
  throw e;
3171
3244
  } finally {
3172
3245
  if (context) {
3173
3246
  try {
3174
3247
  await context.close();
3175
3248
  } catch (error) {
3176
- import_common5.Logger.error(error);
3249
+ import_common6.Logger.error(error);
3177
3250
  }
3178
3251
  }
3179
3252
  await this.browserService.markJobFinished();
@@ -3230,21 +3303,37 @@ var PuppeteerService = class {
3230
3303
  const html = await this.ejsService.renderFile(file, data, options?.ejsOptions ?? this.options.ejsOptions);
3231
3304
  return this.generatePdfFromHtml(html, options);
3232
3305
  }
3306
+ async generatePdfFromNunjucksString(template, data = {}, options) {
3307
+ if (!this.nunjucksService) {
3308
+ throw new Error("Nunjucks service is not available. If the problem persists, open an issue in the repo.");
3309
+ }
3310
+ const html = this.nunjucksService.render(template, data, options?.nunjucksOptions ?? this.options.nunjucksOptions);
3311
+ return this.generatePdfFromHtml(html, options);
3312
+ }
3313
+ async generatePdfFromNunjucksFile(file, data = {}, options) {
3314
+ if (!this.nunjucksService) {
3315
+ throw new Error("Nunjucks service is not available. If the problem persists, open an issue in the repo.");
3316
+ }
3317
+ const html = this.nunjucksService.renderFile(file, data, options?.nunjucksOptions ?? this.options.nunjucksOptions);
3318
+ return this.generatePdfFromHtml(html, options);
3319
+ }
3233
3320
  };
3234
- PuppeteerService = _ts_decorate5([
3235
- (0, import_common5.Injectable)(),
3236
- _ts_param2(2, (0, import_common5.Inject)(PDF_PARAMETERS)),
3237
- _ts_param2(3, (0, import_common5.Optional)()),
3238
- _ts_param2(4, (0, import_common5.Optional)()),
3239
- _ts_param2(5, (0, import_common5.Optional)()),
3240
- _ts_metadata2("design:type", Function),
3241
- _ts_metadata2("design:paramtypes", [
3321
+ PuppeteerService = _ts_decorate6([
3322
+ (0, import_common6.Injectable)(),
3323
+ _ts_param2(2, (0, import_common6.Inject)(PDF_PARAMETERS)),
3324
+ _ts_param2(3, (0, import_common6.Optional)()),
3325
+ _ts_param2(4, (0, import_common6.Optional)()),
3326
+ _ts_param2(5, (0, import_common6.Optional)()),
3327
+ _ts_param2(6, (0, import_common6.Optional)()),
3328
+ _ts_metadata3("design:type", Function),
3329
+ _ts_metadata3("design:paramtypes", [
3242
3330
  typeof import_nestjs_hbs.HandlebarsService === "undefined" ? Object : import_nestjs_hbs.HandlebarsService,
3243
3331
  typeof BrowserService === "undefined" ? Object : BrowserService,
3244
3332
  typeof PuppeteerParameters === "undefined" ? Object : PuppeteerParameters,
3245
3333
  typeof MjmlService === "undefined" ? Object : MjmlService,
3246
3334
  typeof PugService === "undefined" ? Object : PugService,
3247
- typeof EjsService === "undefined" ? Object : EjsService
3335
+ typeof EjsService === "undefined" ? Object : EjsService,
3336
+ typeof NunjucksService === "undefined" ? Object : NunjucksService
3248
3337
  ])
3249
3338
  ], PuppeteerService);
3250
3339
 
@@ -3402,17 +3491,17 @@ async function addSignatureFieldUsingAnchor(pdf, fieldName = "SignatureDebtor",
3402
3491
  __name(addSignatureFieldUsingAnchor, "addSignatureFieldUsingAnchor");
3403
3492
 
3404
3493
  // src/nestjs-pdf.service.ts
3405
- function _ts_decorate6(decorators, target, key, desc) {
3494
+ function _ts_decorate7(decorators, target, key, desc) {
3406
3495
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3407
3496
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3408
3497
  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;
3409
3498
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3410
3499
  }
3411
- __name(_ts_decorate6, "_ts_decorate");
3412
- function _ts_metadata3(k, v) {
3500
+ __name(_ts_decorate7, "_ts_decorate");
3501
+ function _ts_metadata4(k, v) {
3413
3502
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3414
3503
  }
3415
- __name(_ts_metadata3, "_ts_metadata");
3504
+ __name(_ts_metadata4, "_ts_metadata");
3416
3505
  var NestjsPdfService = class {
3417
3506
  static {
3418
3507
  __name(this, "NestjsPdfService");
@@ -3431,28 +3520,6 @@ var NestjsPdfService = class {
3431
3520
  return this.puppeteerService.generatePdfFromHtml(html, options);
3432
3521
  }
3433
3522
  /**
3434
- * @deprecated Use the new method generatePdfFromTemplateHbsString
3435
- * @param template Handlebars template string
3436
- * @param parameters Data parameters to inject into the template
3437
- * @param options PDF generation options (optional)
3438
- * @returns PDF generated from the provided Handlebars template with parameters applied
3439
- * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
3440
- */
3441
- generatePdfFromTemplateString(template, parameters = {}, options) {
3442
- return this.generatePdfFromTemplateHbsString(template, parameters, options);
3443
- }
3444
- /**
3445
- * @deprecated Use the new method generatePdfFromTemplateHbsFile
3446
- * @param file Path to the Handlebars template file
3447
- * @param parameters Data parameters to inject into the template
3448
- * @param options PDF generation options (optional)
3449
- * @returns PDF generated from the Handlebars template at the provided file path with parameters applied
3450
- * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
3451
- */
3452
- generatePdfFromTemplateFile(file, parameters = {}, options) {
3453
- return this.generatePdfFromTemplateHbsFile(file, parameters, options);
3454
- }
3455
- /**
3456
3523
  * @param template Handlebars template string
3457
3524
  * @param parameters Data parameters to inject into the template
3458
3525
  * @param options PDF generation options (optional)
@@ -3531,6 +3598,26 @@ var NestjsPdfService = class {
3531
3598
  return this.puppeteerService.generatePdfFromPugFile(file, data, options);
3532
3599
  }
3533
3600
  /**
3601
+ * @param template Nunjucks template string
3602
+ * @param data Data to inject into the template
3603
+ * @param options PDF generation options (optional)
3604
+ * @returns PDF generated from the provided Nunjucks template with data applied
3605
+ * @description This method generates a PDF from a Nunjucks template provided as a string. Nunjucks is a powerful templating language with support for inheritance, macros, and filters. 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.
3606
+ */
3607
+ generatePdfFromNunjucksString(template, data = {}, options) {
3608
+ return this.puppeteerService.generatePdfFromNunjucksString(template, data, options);
3609
+ }
3610
+ /**
3611
+ * @param file Path to the Nunjucks template file
3612
+ * @param data Data to inject into the template
3613
+ * @param options PDF generation options (optional)
3614
+ * @returns PDF generated from the Nunjucks template at the provided file path with data applied
3615
+ * @description This method generates a PDF from a Nunjucks 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.
3616
+ */
3617
+ generatePdfFromNunjucksFile(file, data = {}, options) {
3618
+ return this.puppeteerService.generatePdfFromNunjucksFile(file, data, options);
3619
+ }
3620
+ /**
3534
3621
  * @param pdf The PDF bytes to modify
3535
3622
  * @param fieldName The name of the signature field to add (default: 'SignatureDebtor')
3536
3623
  * @param anchorText The text anchor to locate the signature field position (default: '__SIG_DEBTOR_ANCHOR__')
@@ -3556,29 +3643,29 @@ var NestjsPdfService = class {
3556
3643
  return await addSignatureFieldUsingAnchor(pdf, fieldName, anchorText);
3557
3644
  }
3558
3645
  };
3559
- NestjsPdfService = _ts_decorate6([
3560
- (0, import_common6.Injectable)(),
3561
- _ts_metadata3("design:type", Function),
3562
- _ts_metadata3("design:paramtypes", [
3646
+ NestjsPdfService = _ts_decorate7([
3647
+ (0, import_common7.Injectable)(),
3648
+ _ts_metadata4("design:type", Function),
3649
+ _ts_metadata4("design:paramtypes", [
3563
3650
  typeof PuppeteerService === "undefined" ? Object : PuppeteerService
3564
3651
  ])
3565
3652
  ], NestjsPdfService);
3566
3653
 
3567
3654
  // src/puppeteer/puppeteer.module.ts
3568
- var import_common7 = require("@nestjs/common");
3655
+ var import_common8 = require("@nestjs/common");
3569
3656
  var import_config = __toESM(require_config());
3570
3657
  var import_nestjs_hbs2 = require("@gboutte/nestjs-hbs");
3571
- function _ts_decorate7(decorators, target, key, desc) {
3658
+ function _ts_decorate8(decorators, target, key, desc) {
3572
3659
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3573
3660
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3574
3661
  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;
3575
3662
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3576
3663
  }
3577
- __name(_ts_decorate7, "_ts_decorate");
3578
- function _ts_metadata4(k, v) {
3664
+ __name(_ts_decorate8, "_ts_decorate");
3665
+ function _ts_metadata5(k, v) {
3579
3666
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3580
3667
  }
3581
- __name(_ts_metadata4, "_ts_metadata");
3668
+ __name(_ts_metadata5, "_ts_metadata");
3582
3669
  function _ts_param3(paramIndex, decorator) {
3583
3670
  return function(target, key) {
3584
3671
  decorator(target, key, paramIndex);
@@ -3611,7 +3698,8 @@ var PuppeteerModule = class _PuppeteerModule {
3611
3698
  import_nestjs_hbs2.HandlebarsService,
3612
3699
  MjmlService,
3613
3700
  PugService,
3614
- EjsService
3701
+ EjsService,
3702
+ NunjucksService
3615
3703
  ];
3616
3704
  return {
3617
3705
  module: _PuppeteerModule,
@@ -3623,7 +3711,8 @@ var PuppeteerModule = class _PuppeteerModule {
3623
3711
  PuppeteerService,
3624
3712
  MjmlService,
3625
3713
  PugService,
3626
- EjsService
3714
+ EjsService,
3715
+ NunjucksService
3627
3716
  ]
3628
3717
  };
3629
3718
  }
@@ -3654,49 +3743,53 @@ var PuppeteerModule = class _PuppeteerModule {
3654
3743
  import_nestjs_hbs2.HandlebarsService,
3655
3744
  MjmlService,
3656
3745
  PugService,
3657
- EjsService
3746
+ EjsService,
3747
+ NunjucksService
3658
3748
  ],
3659
3749
  exports: [
3660
3750
  PuppeteerService,
3661
3751
  MjmlService,
3662
3752
  PugService,
3663
- EjsService
3753
+ EjsService,
3754
+ NunjucksService
3664
3755
  ]
3665
3756
  };
3666
3757
  }
3667
3758
  };
3668
- PuppeteerModule = _ts_decorate7([
3669
- (0, import_common7.Module)({
3759
+ PuppeteerModule = _ts_decorate8([
3760
+ (0, import_common8.Module)({
3670
3761
  providers: [
3671
3762
  PuppeteerService,
3672
3763
  BrowserService,
3673
3764
  MjmlService,
3674
3765
  PugService,
3675
- EjsService
3766
+ EjsService,
3767
+ NunjucksService
3676
3768
  ],
3677
3769
  exports: [
3678
3770
  PuppeteerService,
3679
3771
  MjmlService,
3680
3772
  PugService,
3681
- EjsService
3773
+ EjsService,
3774
+ NunjucksService
3682
3775
  ]
3683
3776
  }),
3684
- _ts_param3(1, (0, import_common7.Inject)(PDF_PARAMETERS)),
3685
- _ts_metadata4("design:type", Function),
3686
- _ts_metadata4("design:paramtypes", [
3777
+ _ts_param3(1, (0, import_common8.Inject)(PDF_PARAMETERS)),
3778
+ _ts_metadata5("design:type", Function),
3779
+ _ts_metadata5("design:paramtypes", [
3687
3780
  typeof BrowserService === "undefined" ? Object : BrowserService,
3688
3781
  typeof PuppeteerParameters === "undefined" ? Object : PuppeteerParameters
3689
3782
  ])
3690
3783
  ], PuppeteerModule);
3691
3784
 
3692
3785
  // src/nestjs-pdf.module.ts
3693
- function _ts_decorate8(decorators, target, key, desc) {
3786
+ function _ts_decorate9(decorators, target, key, desc) {
3694
3787
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3695
3788
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3696
3789
  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;
3697
3790
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3698
3791
  }
3699
- __name(_ts_decorate8, "_ts_decorate");
3792
+ __name(_ts_decorate9, "_ts_decorate");
3700
3793
  var NestjsPdfModule = class _NestjsPdfModule {
3701
3794
  static {
3702
3795
  __name(this, "NestjsPdfModule");
@@ -3730,8 +3823,8 @@ var NestjsPdfModule = class _NestjsPdfModule {
3730
3823
  };
3731
3824
  }
3732
3825
  };
3733
- NestjsPdfModule = _ts_decorate8([
3734
- (0, import_common8.Module)({})
3826
+ NestjsPdfModule = _ts_decorate9([
3827
+ (0, import_common9.Module)({})
3735
3828
  ], NestjsPdfModule);
3736
3829
 
3737
3830
  // src/helpers/getRelativePath.helper.ts
@@ -3747,6 +3840,7 @@ __name(getRelativePathToValue, "getRelativePathToValue");
3747
3840
  MjmlService,
3748
3841
  NestjsPdfModule,
3749
3842
  NestjsPdfService,
3843
+ NunjucksService,
3750
3844
  PugService,
3751
3845
  PuppeteerModule,
3752
3846
  PuppeteerService,
package/dist/index.mjs CHANGED
@@ -2575,10 +2575,10 @@ var require_config = __commonJS({
2575
2575
  import { Module as Module2 } from "@nestjs/common";
2576
2576
 
2577
2577
  // src/nestjs-pdf.service.ts
2578
- import { Injectable as Injectable6 } from "@nestjs/common";
2578
+ import { Injectable as Injectable7 } from "@nestjs/common";
2579
2579
 
2580
2580
  // src/puppeteer/puppeteer.service.ts
2581
- import { Inject as Inject2, Injectable as Injectable5, Logger as Logger2, Optional } from "@nestjs/common";
2581
+ import { Inject as Inject2, Injectable as Injectable6, Logger as Logger2, Optional } from "@nestjs/common";
2582
2582
 
2583
2583
  // src/puppeteer/helpers/tokens.ts
2584
2584
  var PDF_PARAMETERS = "PDF_PARAMETERS";
@@ -3051,7 +3051,9 @@ EjsService = _ts_decorate4([
3051
3051
  Injectable4()
3052
3052
  ], EjsService);
3053
3053
 
3054
- // src/puppeteer/puppeteer.service.ts
3054
+ // src/puppeteer/services/nunjucks.service.ts
3055
+ import { Injectable as Injectable5 } from "@nestjs/common";
3056
+ import * as nunjucks from "nunjucks";
3055
3057
  function _ts_decorate5(decorators, target, key, desc) {
3056
3058
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3057
3059
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3063,6 +3065,74 @@ function _ts_metadata2(k, v) {
3063
3065
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3064
3066
  }
3065
3067
  __name(_ts_metadata2, "_ts_metadata");
3068
+ var NunjucksService = class {
3069
+ static {
3070
+ __name(this, "NunjucksService");
3071
+ }
3072
+ constructor() {
3073
+ nunjucks.configure({
3074
+ noCache: true,
3075
+ trimBlocks: true,
3076
+ lstripBlocks: true
3077
+ });
3078
+ }
3079
+ render(template, data = {}, options) {
3080
+ try {
3081
+ if (options) {
3082
+ const configOptions = {
3083
+ noCache: options.noCache ?? true,
3084
+ watch: options.watch ?? false,
3085
+ throwOnUndefined: options.throwOnUndefined ?? false,
3086
+ trimBlocks: options.trimBlocks ?? true,
3087
+ lstripBlocks: options.lstripBlocks ?? true
3088
+ };
3089
+ nunjucks.configure(configOptions);
3090
+ }
3091
+ return nunjucks.renderString(template, data);
3092
+ } catch (error) {
3093
+ throw new Error(`Nunjucks rendering failed: ${String(error)}`, {
3094
+ cause: error
3095
+ });
3096
+ }
3097
+ }
3098
+ renderFile(filePath, data = {}, options) {
3099
+ try {
3100
+ if (options) {
3101
+ const configOptions = {
3102
+ noCache: options.noCache ?? true,
3103
+ watch: options.watch ?? false,
3104
+ throwOnUndefined: options.throwOnUndefined ?? false,
3105
+ trimBlocks: options.trimBlocks ?? true,
3106
+ lstripBlocks: options.lstripBlocks ?? true
3107
+ };
3108
+ nunjucks.configure(configOptions);
3109
+ }
3110
+ return nunjucks.render(filePath, data);
3111
+ } catch (error) {
3112
+ throw new Error(`Nunjucks file rendering failed: ${String(error)}`, {
3113
+ cause: error
3114
+ });
3115
+ }
3116
+ }
3117
+ };
3118
+ NunjucksService = _ts_decorate5([
3119
+ Injectable5(),
3120
+ _ts_metadata2("design:type", Function),
3121
+ _ts_metadata2("design:paramtypes", [])
3122
+ ], NunjucksService);
3123
+
3124
+ // src/puppeteer/puppeteer.service.ts
3125
+ function _ts_decorate6(decorators, target, key, desc) {
3126
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3127
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3128
+ 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;
3129
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3130
+ }
3131
+ __name(_ts_decorate6, "_ts_decorate");
3132
+ function _ts_metadata3(k, v) {
3133
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3134
+ }
3135
+ __name(_ts_metadata3, "_ts_metadata");
3066
3136
  function _ts_param2(paramIndex, decorator) {
3067
3137
  return function(target, key) {
3068
3138
  decorator(target, key, paramIndex);
@@ -3079,13 +3149,15 @@ var PuppeteerService = class {
3079
3149
  mjmlService;
3080
3150
  pugService;
3081
3151
  ejsService;
3082
- constructor(hbsService, browserService, options, mjmlService, pugService, ejsService) {
3152
+ nunjucksService;
3153
+ constructor(hbsService, browserService, options, mjmlService, pugService, ejsService, nunjucksService) {
3083
3154
  this.hbsService = hbsService;
3084
3155
  this.browserService = browserService;
3085
3156
  this.options = options;
3086
3157
  this.mjmlService = mjmlService;
3087
3158
  this.pugService = pugService;
3088
3159
  this.ejsService = ejsService;
3160
+ this.nunjucksService = nunjucksService;
3089
3161
  }
3090
3162
  limit = pLimit(3);
3091
3163
  async generatePdfFromHtml(html, options) {
@@ -3216,21 +3288,37 @@ var PuppeteerService = class {
3216
3288
  const html = await this.ejsService.renderFile(file, data, options?.ejsOptions ?? this.options.ejsOptions);
3217
3289
  return this.generatePdfFromHtml(html, options);
3218
3290
  }
3291
+ async generatePdfFromNunjucksString(template, data = {}, options) {
3292
+ if (!this.nunjucksService) {
3293
+ throw new Error("Nunjucks service is not available. If the problem persists, open an issue in the repo.");
3294
+ }
3295
+ const html = this.nunjucksService.render(template, data, options?.nunjucksOptions ?? this.options.nunjucksOptions);
3296
+ return this.generatePdfFromHtml(html, options);
3297
+ }
3298
+ async generatePdfFromNunjucksFile(file, data = {}, options) {
3299
+ if (!this.nunjucksService) {
3300
+ throw new Error("Nunjucks service is not available. If the problem persists, open an issue in the repo.");
3301
+ }
3302
+ const html = this.nunjucksService.renderFile(file, data, options?.nunjucksOptions ?? this.options.nunjucksOptions);
3303
+ return this.generatePdfFromHtml(html, options);
3304
+ }
3219
3305
  };
3220
- PuppeteerService = _ts_decorate5([
3221
- Injectable5(),
3306
+ PuppeteerService = _ts_decorate6([
3307
+ Injectable6(),
3222
3308
  _ts_param2(2, Inject2(PDF_PARAMETERS)),
3223
3309
  _ts_param2(3, Optional()),
3224
3310
  _ts_param2(4, Optional()),
3225
3311
  _ts_param2(5, Optional()),
3226
- _ts_metadata2("design:type", Function),
3227
- _ts_metadata2("design:paramtypes", [
3312
+ _ts_param2(6, Optional()),
3313
+ _ts_metadata3("design:type", Function),
3314
+ _ts_metadata3("design:paramtypes", [
3228
3315
  typeof HandlebarsService === "undefined" ? Object : HandlebarsService,
3229
3316
  typeof BrowserService === "undefined" ? Object : BrowserService,
3230
3317
  typeof PuppeteerParameters === "undefined" ? Object : PuppeteerParameters,
3231
3318
  typeof MjmlService === "undefined" ? Object : MjmlService,
3232
3319
  typeof PugService === "undefined" ? Object : PugService,
3233
- typeof EjsService === "undefined" ? Object : EjsService
3320
+ typeof EjsService === "undefined" ? Object : EjsService,
3321
+ typeof NunjucksService === "undefined" ? Object : NunjucksService
3234
3322
  ])
3235
3323
  ], PuppeteerService);
3236
3324
 
@@ -3388,17 +3476,17 @@ async function addSignatureFieldUsingAnchor(pdf, fieldName = "SignatureDebtor",
3388
3476
  __name(addSignatureFieldUsingAnchor, "addSignatureFieldUsingAnchor");
3389
3477
 
3390
3478
  // src/nestjs-pdf.service.ts
3391
- function _ts_decorate6(decorators, target, key, desc) {
3479
+ function _ts_decorate7(decorators, target, key, desc) {
3392
3480
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3393
3481
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3394
3482
  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;
3395
3483
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3396
3484
  }
3397
- __name(_ts_decorate6, "_ts_decorate");
3398
- function _ts_metadata3(k, v) {
3485
+ __name(_ts_decorate7, "_ts_decorate");
3486
+ function _ts_metadata4(k, v) {
3399
3487
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3400
3488
  }
3401
- __name(_ts_metadata3, "_ts_metadata");
3489
+ __name(_ts_metadata4, "_ts_metadata");
3402
3490
  var NestjsPdfService = class {
3403
3491
  static {
3404
3492
  __name(this, "NestjsPdfService");
@@ -3417,28 +3505,6 @@ var NestjsPdfService = class {
3417
3505
  return this.puppeteerService.generatePdfFromHtml(html, options);
3418
3506
  }
3419
3507
  /**
3420
- * @deprecated Use the new method generatePdfFromTemplateHbsString
3421
- * @param template Handlebars template string
3422
- * @param parameters Data parameters to inject into the template
3423
- * @param options PDF generation options (optional)
3424
- * @returns PDF generated from the provided Handlebars template with parameters applied
3425
- * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
3426
- */
3427
- generatePdfFromTemplateString(template, parameters = {}, options) {
3428
- return this.generatePdfFromTemplateHbsString(template, parameters, options);
3429
- }
3430
- /**
3431
- * @deprecated Use the new method generatePdfFromTemplateHbsFile
3432
- * @param file Path to the Handlebars template file
3433
- * @param parameters Data parameters to inject into the template
3434
- * @param options PDF generation options (optional)
3435
- * @returns PDF generated from the Handlebars template at the provided file path with parameters applied
3436
- * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
3437
- */
3438
- generatePdfFromTemplateFile(file, parameters = {}, options) {
3439
- return this.generatePdfFromTemplateHbsFile(file, parameters, options);
3440
- }
3441
- /**
3442
3508
  * @param template Handlebars template string
3443
3509
  * @param parameters Data parameters to inject into the template
3444
3510
  * @param options PDF generation options (optional)
@@ -3517,6 +3583,26 @@ var NestjsPdfService = class {
3517
3583
  return this.puppeteerService.generatePdfFromPugFile(file, data, options);
3518
3584
  }
3519
3585
  /**
3586
+ * @param template Nunjucks template string
3587
+ * @param data Data to inject into the template
3588
+ * @param options PDF generation options (optional)
3589
+ * @returns PDF generated from the provided Nunjucks template with data applied
3590
+ * @description This method generates a PDF from a Nunjucks template provided as a string. Nunjucks is a powerful templating language with support for inheritance, macros, and filters. 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.
3591
+ */
3592
+ generatePdfFromNunjucksString(template, data = {}, options) {
3593
+ return this.puppeteerService.generatePdfFromNunjucksString(template, data, options);
3594
+ }
3595
+ /**
3596
+ * @param file Path to the Nunjucks template file
3597
+ * @param data Data to inject into the template
3598
+ * @param options PDF generation options (optional)
3599
+ * @returns PDF generated from the Nunjucks template at the provided file path with data applied
3600
+ * @description This method generates a PDF from a Nunjucks 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.
3601
+ */
3602
+ generatePdfFromNunjucksFile(file, data = {}, options) {
3603
+ return this.puppeteerService.generatePdfFromNunjucksFile(file, data, options);
3604
+ }
3605
+ /**
3520
3606
  * @param pdf The PDF bytes to modify
3521
3607
  * @param fieldName The name of the signature field to add (default: 'SignatureDebtor')
3522
3608
  * @param anchorText The text anchor to locate the signature field position (default: '__SIG_DEBTOR_ANCHOR__')
@@ -3542,10 +3628,10 @@ var NestjsPdfService = class {
3542
3628
  return await addSignatureFieldUsingAnchor(pdf, fieldName, anchorText);
3543
3629
  }
3544
3630
  };
3545
- NestjsPdfService = _ts_decorate6([
3546
- Injectable6(),
3547
- _ts_metadata3("design:type", Function),
3548
- _ts_metadata3("design:paramtypes", [
3631
+ NestjsPdfService = _ts_decorate7([
3632
+ Injectable7(),
3633
+ _ts_metadata4("design:type", Function),
3634
+ _ts_metadata4("design:paramtypes", [
3549
3635
  typeof PuppeteerService === "undefined" ? Object : PuppeteerService
3550
3636
  ])
3551
3637
  ], NestjsPdfService);
@@ -3554,17 +3640,17 @@ NestjsPdfService = _ts_decorate6([
3554
3640
  import { Inject as Inject3, Module } from "@nestjs/common";
3555
3641
  var import_config = __toESM(require_config());
3556
3642
  import { HandlebarsService as HandlebarsService2 } from "@gboutte/nestjs-hbs";
3557
- function _ts_decorate7(decorators, target, key, desc) {
3643
+ function _ts_decorate8(decorators, target, key, desc) {
3558
3644
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3559
3645
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3560
3646
  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;
3561
3647
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3562
3648
  }
3563
- __name(_ts_decorate7, "_ts_decorate");
3564
- function _ts_metadata4(k, v) {
3649
+ __name(_ts_decorate8, "_ts_decorate");
3650
+ function _ts_metadata5(k, v) {
3565
3651
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3566
3652
  }
3567
- __name(_ts_metadata4, "_ts_metadata");
3653
+ __name(_ts_metadata5, "_ts_metadata");
3568
3654
  function _ts_param3(paramIndex, decorator) {
3569
3655
  return function(target, key) {
3570
3656
  decorator(target, key, paramIndex);
@@ -3597,7 +3683,8 @@ var PuppeteerModule = class _PuppeteerModule {
3597
3683
  HandlebarsService2,
3598
3684
  MjmlService,
3599
3685
  PugService,
3600
- EjsService
3686
+ EjsService,
3687
+ NunjucksService
3601
3688
  ];
3602
3689
  return {
3603
3690
  module: _PuppeteerModule,
@@ -3609,7 +3696,8 @@ var PuppeteerModule = class _PuppeteerModule {
3609
3696
  PuppeteerService,
3610
3697
  MjmlService,
3611
3698
  PugService,
3612
- EjsService
3699
+ EjsService,
3700
+ NunjucksService
3613
3701
  ]
3614
3702
  };
3615
3703
  }
@@ -3640,49 +3728,53 @@ var PuppeteerModule = class _PuppeteerModule {
3640
3728
  HandlebarsService2,
3641
3729
  MjmlService,
3642
3730
  PugService,
3643
- EjsService
3731
+ EjsService,
3732
+ NunjucksService
3644
3733
  ],
3645
3734
  exports: [
3646
3735
  PuppeteerService,
3647
3736
  MjmlService,
3648
3737
  PugService,
3649
- EjsService
3738
+ EjsService,
3739
+ NunjucksService
3650
3740
  ]
3651
3741
  };
3652
3742
  }
3653
3743
  };
3654
- PuppeteerModule = _ts_decorate7([
3744
+ PuppeteerModule = _ts_decorate8([
3655
3745
  Module({
3656
3746
  providers: [
3657
3747
  PuppeteerService,
3658
3748
  BrowserService,
3659
3749
  MjmlService,
3660
3750
  PugService,
3661
- EjsService
3751
+ EjsService,
3752
+ NunjucksService
3662
3753
  ],
3663
3754
  exports: [
3664
3755
  PuppeteerService,
3665
3756
  MjmlService,
3666
3757
  PugService,
3667
- EjsService
3758
+ EjsService,
3759
+ NunjucksService
3668
3760
  ]
3669
3761
  }),
3670
3762
  _ts_param3(1, Inject3(PDF_PARAMETERS)),
3671
- _ts_metadata4("design:type", Function),
3672
- _ts_metadata4("design:paramtypes", [
3763
+ _ts_metadata5("design:type", Function),
3764
+ _ts_metadata5("design:paramtypes", [
3673
3765
  typeof BrowserService === "undefined" ? Object : BrowserService,
3674
3766
  typeof PuppeteerParameters === "undefined" ? Object : PuppeteerParameters
3675
3767
  ])
3676
3768
  ], PuppeteerModule);
3677
3769
 
3678
3770
  // src/nestjs-pdf.module.ts
3679
- function _ts_decorate8(decorators, target, key, desc) {
3771
+ function _ts_decorate9(decorators, target, key, desc) {
3680
3772
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3681
3773
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3682
3774
  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;
3683
3775
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3684
3776
  }
3685
- __name(_ts_decorate8, "_ts_decorate");
3777
+ __name(_ts_decorate9, "_ts_decorate");
3686
3778
  var NestjsPdfModule = class _NestjsPdfModule {
3687
3779
  static {
3688
3780
  __name(this, "NestjsPdfModule");
@@ -3716,7 +3808,7 @@ var NestjsPdfModule = class _NestjsPdfModule {
3716
3808
  };
3717
3809
  }
3718
3810
  };
3719
- NestjsPdfModule = _ts_decorate8([
3811
+ NestjsPdfModule = _ts_decorate9([
3720
3812
  Module2({})
3721
3813
  ], NestjsPdfModule);
3722
3814
 
@@ -3732,6 +3824,7 @@ export {
3732
3824
  MjmlService,
3733
3825
  NestjsPdfModule,
3734
3826
  NestjsPdfService,
3827
+ NunjucksService,
3735
3828
  PugService,
3736
3829
  PuppeteerModule,
3737
3830
  PuppeteerService,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shad0wz7/nestjs-pdf",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "A NestJS library for generating PDFs with Puppeteer and Handlebars.",
5
5
  "author": "Emmanuel Boisset",
6
6
  "license": "MIT",
@@ -21,7 +21,7 @@
21
21
  "LICENSE"
22
22
  ],
23
23
  "scripts": {
24
- "build": "tsup src/index.ts --format cjs,esm --dts --clean --external pdfjs-dist --external pdf-lib --external @napi-rs/canvas",
24
+ "build": "tsup",
25
25
  "prepublishOnly": "pnpm lint && pnpm test && pnpm build",
26
26
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
27
27
  "lint": "eslint \"{src,test}/**/*.ts\" --fix",
@@ -36,6 +36,7 @@
36
36
  "puppeteer",
37
37
  "handlebars",
38
38
  "hbs",
39
+ "nunjucks",
39
40
  "ejs",
40
41
  "mjml",
41
42
  "pug",
@@ -48,24 +49,18 @@
48
49
  "rxjs": "^7.8.0"
49
50
  },
50
51
  "dependencies": {
51
- "@gboutte/nestjs-hbs": "^0.2.0",
52
52
  "@puppeteer/browsers": "^2.13.2",
53
53
  "deepmerge-ts": "^7.1.5",
54
- "ejs": "^5.0.2",
55
- "mjml": "^5.2.1",
56
54
  "p-limit": "^7.3.0",
57
55
  "pdf-lib": "^1.17.1",
58
56
  "pdfjs-dist": "^5.7.284",
59
- "pug": "^3.0.3",
60
57
  "puppeteer": "^24.43.1"
61
58
  },
62
59
  "devDependencies": {
63
60
  "@eslint/eslintrc": "^3.3.5",
64
61
  "@eslint/js": "^10.0.1",
65
62
  "@nestjs/cli": "^11.0.21",
66
- "@nestjs/common": "^11.1.19",
67
63
  "@nestjs/config": "^4.0.4",
68
- "@nestjs/core": "^11.1.19",
69
64
  "@nestjs/platform-express": "^11.1.19",
70
65
  "@nestjs/schematics": "^11.1.0",
71
66
  "@nestjs/testing": "^11.1.19",
@@ -76,6 +71,7 @@
76
71
  "@types/mjml": "^5.0.0",
77
72
  "@types/mjml-core": "^5.0.0",
78
73
  "@types/node": "^25.6.2",
74
+ "@types/nunjucks": "^3.2.6",
79
75
  "@types/pug": "^2.0.10",
80
76
  "@types/supertest": "^7.2.0",
81
77
  "eslint": "^10.3.0",
@@ -83,7 +79,6 @@
83
79
  "eslint-plugin-prettier": "^5.5.5",
84
80
  "globals": "^17.6.0",
85
81
  "jest": "^30.4.2",
86
- "mjml-core": "^5.2.0",
87
82
  "prettier": "^3.8.3",
88
83
  "reflect-metadata": "^0.2.2",
89
84
  "source-map-support": "^0.5.21",
@@ -97,10 +92,15 @@
97
92
  "typescript-eslint": "^8.59.3"
98
93
  },
99
94
  "optionalDependencies": {
100
- "@napi-rs/canvas": "^1.0.0"
95
+ "@gboutte/nestjs-hbs": "^0.2.0",
96
+ "@napi-rs/canvas": "^1.0.0",
97
+ "ejs": "^5.0.2",
98
+ "mjml": "^5.2.1",
99
+ "nunjucks": "^3.2.4",
100
+ "pug": "^3.0.3"
101
101
  },
102
102
  "repository": {
103
- "url": "https://github.com/ShadowZ11/nestjs-pdf"
103
+ "url": "git+https://github.com/ShadowZ11/nestjs-pdf.git"
104
104
  },
105
105
  "publishConfig": {
106
106
  "access": "public",