mikser-io-post-mjml 4.0.0 → 5.0.1

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.
Files changed (2) hide show
  1. package/index.js +10 -3
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import mjml2html from 'mjml'
2
- import { readFile } from 'node:fs/promises'
2
+ import { readFile, writeFile, mkdir } from 'node:fs/promises'
3
3
  import path from 'node:path'
4
4
 
5
5
  // Declare the produced file extension so mikser-io can compute the
6
6
  // destination correctly even though the postprocessor name and the
7
- // output extension differ. Requires mikser-io >= 6.3.
7
+ // output extension differ.
8
8
  export const output = 'html'
9
9
 
10
10
  export async function postprocess({ entity, options, config, logger }) {
@@ -22,7 +22,14 @@ export async function postprocess({ entity, options, config, logger }) {
22
22
  }
23
23
  }
24
24
 
25
- return html
25
+ // File-path contract: write directly to entity.destination, return
26
+ // its path so the chain dispatcher can thread it as the next stage's
27
+ // origin. Intermediates land in scratch under runtimeFolder; final
28
+ // stage's destination is the outputFolder/<destination>.
29
+ const outputPath = path.join(options.outputFolder, entity.destination)
30
+ await mkdir(path.dirname(outputPath), { recursive: true })
31
+ await writeFile(outputPath, html)
32
+ return { success: true, result: entity.destination }
26
33
  }
27
34
 
28
35
  // v9 factory — ADR-0010.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mikser-io-post-mjml",
3
- "version": "4.0.0",
4
- "description": "",
3
+ "version": "5.0.1",
4
+ "description": "MJML postprocessor for Mikser. Compiles a rendered MJML document into responsive email-safe HTML.",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {},