@depup/react-email__render 2.0.4-depup.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 +31 -0
- package/changes.json +10 -0
- package/dist/browser/index.d.mts +40 -0
- package/dist/browser/index.d.mts.map +1 -0
- package/dist/browser/index.d.ts +40 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +181 -0
- package/dist/browser/index.mjs +151 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/edge/index.d.mts +40 -0
- package/dist/edge/index.d.mts.map +1 -0
- package/dist/edge/index.d.ts +40 -0
- package/dist/edge/index.d.ts.map +1 -0
- package/dist/edge/index.js +187 -0
- package/dist/edge/index.mjs +157 -0
- package/dist/edge/index.mjs.map +1 -0
- package/dist/node/index.d.mts +40 -0
- package/dist/node/index.d.mts.map +1 -0
- package/dist/node/index.d.ts +40 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +216 -0
- package/dist/node/index.mjs +185 -0
- package/dist/node/index.mjs.map +1 -0
- package/license.md +7 -0
- package/package.json +152 -0
- package/readme.md +42 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import * as html from "prettier/plugins/html";
|
|
2
|
+
import { format } from "prettier/standalone";
|
|
3
|
+
import { convert } from "html-to-text";
|
|
4
|
+
import React, { Suspense } from "react";
|
|
5
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Writable } from "node:stream";
|
|
7
|
+
|
|
8
|
+
//#region src/shared/utils/pretty.ts
|
|
9
|
+
function recursivelyMapDoc(doc, callback) {
|
|
10
|
+
if (Array.isArray(doc)) return doc.map((innerDoc) => recursivelyMapDoc(innerDoc, callback));
|
|
11
|
+
if (typeof doc === "object") {
|
|
12
|
+
if (doc.type === "group") return {
|
|
13
|
+
...doc,
|
|
14
|
+
contents: recursivelyMapDoc(doc.contents, callback),
|
|
15
|
+
expandedStates: recursivelyMapDoc(doc.expandedStates, callback)
|
|
16
|
+
};
|
|
17
|
+
if ("contents" in doc) return {
|
|
18
|
+
...doc,
|
|
19
|
+
contents: recursivelyMapDoc(doc.contents, callback)
|
|
20
|
+
};
|
|
21
|
+
if ("parts" in doc) return {
|
|
22
|
+
...doc,
|
|
23
|
+
parts: recursivelyMapDoc(doc.parts, callback)
|
|
24
|
+
};
|
|
25
|
+
if (doc.type === "if-break") return {
|
|
26
|
+
...doc,
|
|
27
|
+
breakContents: recursivelyMapDoc(doc.breakContents, callback),
|
|
28
|
+
flatContents: recursivelyMapDoc(doc.flatContents, callback)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return callback(doc);
|
|
32
|
+
}
|
|
33
|
+
const modifiedHtml = { ...html };
|
|
34
|
+
if (modifiedHtml.printers) {
|
|
35
|
+
const previousPrint = modifiedHtml.printers.html.print;
|
|
36
|
+
modifiedHtml.printers.html.print = (path, options, print, args) => {
|
|
37
|
+
const node = path.getNode();
|
|
38
|
+
const rawPrintingResult = previousPrint(path, options, print, args);
|
|
39
|
+
if (node.type === "ieConditionalComment") return recursivelyMapDoc(rawPrintingResult, (doc) => {
|
|
40
|
+
if (typeof doc === "object" && doc.type === "line") return doc.soft ? "" : " ";
|
|
41
|
+
return doc;
|
|
42
|
+
});
|
|
43
|
+
return rawPrintingResult;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const defaults = {
|
|
47
|
+
endOfLine: "lf",
|
|
48
|
+
tabWidth: 2,
|
|
49
|
+
plugins: [modifiedHtml],
|
|
50
|
+
bracketSameLine: true,
|
|
51
|
+
parser: "html"
|
|
52
|
+
};
|
|
53
|
+
const pretty = (str, options = {}) => {
|
|
54
|
+
return format(str.replaceAll("\0", ""), {
|
|
55
|
+
...defaults,
|
|
56
|
+
...options
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/shared/utils/to-plain-text.ts
|
|
62
|
+
const plainTextSelectors = [
|
|
63
|
+
{
|
|
64
|
+
selector: "img",
|
|
65
|
+
format: "skip"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
selector: "[data-skip-in-text=true]",
|
|
69
|
+
format: "skip"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
selector: "a",
|
|
73
|
+
options: {
|
|
74
|
+
linkBrackets: false,
|
|
75
|
+
hideLinkHrefIfSameAsText: true
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
function toPlainText(html$1, options) {
|
|
80
|
+
return convert(html$1, {
|
|
81
|
+
wordwrap: false,
|
|
82
|
+
...options,
|
|
83
|
+
selectors: [...plainTextSelectors, ...options?.selectors ?? []]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/shared/error-boundary.tsx
|
|
89
|
+
function createErrorBoundary(reject) {
|
|
90
|
+
if (!React.Component) return (props) => /* @__PURE__ */ jsx(Fragment, { children: props.children });
|
|
91
|
+
return class ErrorBoundary extends React.Component {
|
|
92
|
+
componentDidCatch(error) {
|
|
93
|
+
reject(error);
|
|
94
|
+
}
|
|
95
|
+
render() {
|
|
96
|
+
return this.props.children;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/node/read-stream.ts
|
|
103
|
+
const readStream = async (stream) => {
|
|
104
|
+
let result = "";
|
|
105
|
+
const decoder = new TextDecoder("utf-8");
|
|
106
|
+
if ("pipeTo" in stream) {
|
|
107
|
+
const writableStream = new WritableStream({
|
|
108
|
+
write(chunk) {
|
|
109
|
+
result += decoder.decode(chunk, { stream: true });
|
|
110
|
+
},
|
|
111
|
+
close() {
|
|
112
|
+
result += decoder.decode();
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
await stream.pipeTo(writableStream);
|
|
116
|
+
} else {
|
|
117
|
+
const writable = new Writable({
|
|
118
|
+
write(chunk, _encoding, callback) {
|
|
119
|
+
result += decoder.decode(chunk, { stream: true });
|
|
120
|
+
callback();
|
|
121
|
+
},
|
|
122
|
+
final(callback) {
|
|
123
|
+
result += decoder.decode();
|
|
124
|
+
callback();
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
await new Promise((resolve, reject) => {
|
|
128
|
+
writable.on("pipe", (source) => {
|
|
129
|
+
source.on("error", (err) => {
|
|
130
|
+
writable.destroy(err);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
writable.on("error", reject);
|
|
134
|
+
writable.on("close", () => {
|
|
135
|
+
resolve();
|
|
136
|
+
});
|
|
137
|
+
stream.pipe(writable);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/node/render.tsx
|
|
145
|
+
const render = async (node, options) => {
|
|
146
|
+
const reactDOMServer = await import("react-dom/server").then((m) => {
|
|
147
|
+
if ("default" in m) return m.default;
|
|
148
|
+
return m;
|
|
149
|
+
});
|
|
150
|
+
let html$1;
|
|
151
|
+
await new Promise((resolve, reject) => {
|
|
152
|
+
if (Object.hasOwn(reactDOMServer, "renderToReadableStream") && typeof WritableStream !== "undefined") {
|
|
153
|
+
const ErrorBoundary = createErrorBoundary(reject);
|
|
154
|
+
reactDOMServer.renderToReadableStream(/* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { children: node }) }), {
|
|
155
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY,
|
|
156
|
+
onError(error) {
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
}).then((stream) => readStream(stream)).then((result) => {
|
|
160
|
+
html$1 = result;
|
|
161
|
+
resolve();
|
|
162
|
+
}).catch(reject);
|
|
163
|
+
} else {
|
|
164
|
+
const ErrorBoundary = createErrorBoundary(reject);
|
|
165
|
+
const stream = reactDOMServer.renderToPipeableStream(/* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Suspense, { children: node }) }), {
|
|
166
|
+
async onAllReady() {
|
|
167
|
+
html$1 = await readStream(stream);
|
|
168
|
+
resolve();
|
|
169
|
+
},
|
|
170
|
+
onError(error) {
|
|
171
|
+
reject(error);
|
|
172
|
+
},
|
|
173
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
if (options?.plainText) return toPlainText(html$1, options.htmlToTextOptions);
|
|
178
|
+
const document = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">${html$1.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
179
|
+
if (options?.pretty) return pretty(document);
|
|
180
|
+
return document;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
//#endregion
|
|
184
|
+
export { plainTextSelectors, pretty, render, toPlainText };
|
|
185
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["defaults: Options","plainTextSelectors: SelectorDefinition[]","html","html!: string","html"],"sources":["../../src/shared/utils/pretty.ts","../../src/shared/utils/to-plain-text.ts","../../src/shared/error-boundary.tsx","../../src/node/read-stream.ts","../../src/node/render.tsx"],"sourcesContent":["import type { Options, Plugin } from 'prettier';\nimport type { builders } from 'prettier/doc';\nimport * as html from 'prettier/plugins/html';\nimport { format } from 'prettier/standalone';\n\ninterface HtmlNode {\n type: 'element' | 'text' | 'ieConditionalComment';\n name?: string;\n sourceSpan: {\n start: { file: unknown[]; offset: number; line: number; col: number };\n end: { file: unknown[]; offset: number; line: number; col: number };\n details: null;\n };\n parent?: HtmlNode;\n}\n\nfunction recursivelyMapDoc(\n doc: builders.Doc,\n callback: (innerDoc: string | builders.DocCommand) => builders.Doc,\n): builders.Doc {\n if (Array.isArray(doc)) {\n return doc.map((innerDoc) => recursivelyMapDoc(innerDoc, callback));\n }\n\n if (typeof doc === 'object') {\n if (doc.type === 'group') {\n return {\n ...doc,\n contents: recursivelyMapDoc(doc.contents, callback),\n expandedStates: recursivelyMapDoc(\n doc.expandedStates,\n callback,\n ) as builders.Doc[],\n };\n }\n\n if ('contents' in doc) {\n return {\n ...doc,\n contents: recursivelyMapDoc(doc.contents, callback),\n };\n }\n\n if ('parts' in doc) {\n return {\n ...doc,\n parts: recursivelyMapDoc(doc.parts, callback) as builders.Doc[],\n };\n }\n\n if (doc.type === 'if-break') {\n return {\n ...doc,\n breakContents: recursivelyMapDoc(doc.breakContents, callback),\n flatContents: recursivelyMapDoc(doc.flatContents, callback),\n };\n }\n }\n\n return callback(doc);\n}\n\nconst modifiedHtml = { ...html } as Plugin;\nif (modifiedHtml.printers) {\n const previousPrint = modifiedHtml.printers.html.print;\n modifiedHtml.printers.html.print = (path, options, print, args) => {\n const node = path.getNode() as HtmlNode;\n\n const rawPrintingResult = previousPrint(path, options, print, args);\n\n if (node.type === 'ieConditionalComment') {\n const printingResult = recursivelyMapDoc(rawPrintingResult, (doc) => {\n if (typeof doc === 'object' && doc.type === 'line') {\n return doc.soft ? '' : ' ';\n }\n\n return doc;\n });\n\n return printingResult;\n }\n\n return rawPrintingResult;\n };\n}\n\nconst defaults: Options = {\n endOfLine: 'lf',\n tabWidth: 2,\n plugins: [modifiedHtml],\n bracketSameLine: true,\n parser: 'html',\n};\n\nexport const pretty = (str: string, options: Options = {}) => {\n return format(str.replaceAll('\\0', ''), {\n ...defaults,\n ...options,\n });\n};\n","import {\n convert,\n type HtmlToTextOptions,\n type SelectorDefinition,\n} from 'html-to-text';\n\nexport const plainTextSelectors: SelectorDefinition[] = [\n { selector: 'img', format: 'skip' },\n { selector: '[data-skip-in-text=true]', format: 'skip' },\n {\n selector: 'a',\n options: { linkBrackets: false, hideLinkHrefIfSameAsText: true },\n },\n];\n\nexport function toPlainText(html: string, options?: HtmlToTextOptions) {\n return convert(html, {\n wordwrap: false,\n ...options,\n selectors: [...plainTextSelectors, ...(options?.selectors ?? [])],\n });\n}\n","import React from 'react';\n\nexport function createErrorBoundary(reject: (error: unknown) => void) {\n // React Server Components don't support React.Component, so it's just not defined here\n if (!React.Component) {\n return (props: { children?: React.ReactNode }) => <>{props.children}</>;\n }\n\n return class ErrorBoundary extends React.Component<{\n children: React.ReactNode;\n }> {\n componentDidCatch(error: unknown) {\n reject(error);\n }\n render() {\n return this.props.children;\n }\n };\n}\n","import { Writable } from 'node:stream';\nimport type {\n PipeableStream,\n ReactDOMServerReadableStream,\n} from 'react-dom/server.browser';\n\nexport const readStream = async (\n stream: PipeableStream | ReactDOMServerReadableStream,\n) => {\n let result = '';\n // Create a single TextDecoder instance to handle streaming properly\n // This fixes issues with multi-byte characters (e.g., CJK) being split across chunks\n const decoder = new TextDecoder('utf-8');\n\n if ('pipeTo' in stream) {\n // means it's a readable stream\n const writableStream = new WritableStream({\n write(chunk: BufferSource) {\n // Use stream: true to handle multi-byte characters split across chunks\n result += decoder.decode(chunk, { stream: true });\n },\n close() {\n // Flush any remaining bytes\n result += decoder.decode();\n },\n });\n await stream.pipeTo(writableStream);\n } else {\n const writable = new Writable({\n write(chunk: BufferSource, _encoding, callback) {\n // Use stream: true to handle multi-byte characters split across chunks\n result += decoder.decode(chunk, { stream: true });\n\n callback();\n },\n final(callback) {\n // Flush any remaining bytes\n result += decoder.decode();\n callback();\n },\n });\n await new Promise<void>((resolve, reject) => {\n writable.on('pipe', (source) => {\n source.on('error', (err: Error) => {\n writable.destroy(err);\n });\n });\n writable.on('error', reject);\n writable.on('close', () => {\n resolve();\n });\n\n stream.pipe(writable);\n });\n }\n\n return result;\n};\n","import { Suspense } from 'react';\nimport { createErrorBoundary } from '../shared/error-boundary';\nimport type { Options } from '../shared/options';\nimport { pretty } from '../shared/utils/pretty';\nimport { toPlainText } from '../shared/utils/to-plain-text';\nimport { readStream } from './read-stream';\n\nexport const render = async (node: React.ReactNode, options?: Options) => {\n const reactDOMServer = await import('react-dom/server').then((m) => {\n if ('default' in m) {\n return m.default;\n }\n return m;\n });\n\n let html!: string;\n await new Promise<void>((resolve, reject) => {\n if (\n Object.hasOwn(reactDOMServer, 'renderToReadableStream') &&\n typeof WritableStream !== 'undefined'\n ) {\n const ErrorBoundary = createErrorBoundary(reject);\n reactDOMServer\n .renderToReadableStream(\n <ErrorBoundary>\n <Suspense>{node}</Suspense>\n </ErrorBoundary>,\n {\n progressiveChunkSize: Number.POSITIVE_INFINITY,\n onError(error) {\n // Throw immediately when an error occurs to prevent CSR fallback\n throw error;\n },\n },\n )\n .then((stream) => readStream(stream))\n .then((result) => {\n html = result;\n resolve();\n })\n .catch(reject);\n } else {\n const ErrorBoundary = createErrorBoundary(reject);\n const stream = reactDOMServer.renderToPipeableStream(\n <ErrorBoundary>\n <Suspense>{node}</Suspense>\n </ErrorBoundary>,\n {\n async onAllReady() {\n html = await readStream(stream);\n resolve();\n },\n onError(error) {\n reject(error);\n },\n progressiveChunkSize: Number.POSITIVE_INFINITY,\n },\n );\n }\n });\n\n if (options?.plainText) {\n return toPlainText(html, options.htmlToTextOptions);\n }\n\n const doctype =\n '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">';\n\n const document = `${doctype}${html.replace(/<!DOCTYPE.*?>/, '')}`;\n\n if (options?.pretty) {\n return pretty(document);\n }\n\n return document;\n};\n"],"mappings":";;;;;;;;AAgBA,SAAS,kBACP,KACA,UACc;AACd,KAAI,MAAM,QAAQ,IAAI,CACpB,QAAO,IAAI,KAAK,aAAa,kBAAkB,UAAU,SAAS,CAAC;AAGrE,KAAI,OAAO,QAAQ,UAAU;AAC3B,MAAI,IAAI,SAAS,QACf,QAAO;GACL,GAAG;GACH,UAAU,kBAAkB,IAAI,UAAU,SAAS;GACnD,gBAAgB,kBACd,IAAI,gBACJ,SACD;GACF;AAGH,MAAI,c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C3C,MACE,OAAO,OAAO,gBAAgB,yBAAyB,IACvD,OAAO,mBAAmB,aAC1B;GACA,MAAM,gBAAgB,oBAAoB,OAAO;AACjD,kBACG,uBACC,oBAAC,2BACC,oBAAC,sBAAU,OAAgB,GACb,EAChB;IACE,sBAAsB,OAAO;IAC7B,QAAQ,OAAO;AAEb,WAAM;;IAET,CACF,CACA,MAAM,WAAW,WAAW,OAAO,CAAC,CACpC,MAAM,WAAW;AAChB,aAAO;AACP,aAAS;KACT,CACD,MAAM,OAAO;SACX;GACL,MAAM,gBAAgB,oBAAoB,OAAO;GACjD,MAAM,SAAS,eAAe,uBAC5B,oBAAC,2BACC,oBAAC,sBAAU,OAAgB,GACb,EAChB;IACE,MAAM,aAAa;AACjB,cAAO,MAAM,WAAW,OAAO;AAC/B,cAAS;;IAEX,QAAQ,OAAO;AACb,YAAO,MAAM;;IAEf,sBAAsB,OAAO;IAC9B,CACF;;GAEH;AAEF,KAAI,SAAS,UACX,QAAO,YAAYC,QAAM,QAAQ,kBAAkB;CAMrD,MAAM,WAAW,4HAAaA,OAAK,QAAQ,iBAAiB,GAAG;AAE/D,KAAI,SAAS,OACX,QAAO,OAAO,SAAS;AAGzB,QAAO"}
|
package/license.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2024 Plus Five Five, Inc
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@depup/react-email__render",
|
|
3
|
+
"version": "2.0.4-depup.0",
|
|
4
|
+
"description": "[DepUp] Transform React components into HTML email templates",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"main": "./dist/browser/index.js",
|
|
7
|
+
"module": "./dist/browser/index.mjs",
|
|
8
|
+
"types": "./dist/browser/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/**",
|
|
11
|
+
"changes.json",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"workerd": {
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./dist/edge/index.d.mts",
|
|
19
|
+
"default": "./dist/edge/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"require": {
|
|
22
|
+
"types": "./dist/edge/index.d.ts",
|
|
23
|
+
"default": "./dist/edge/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"deno": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/browser/index.d.mts",
|
|
29
|
+
"default": "./dist/browser/index.mjs"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./dist/browser/index.d.ts",
|
|
33
|
+
"default": "./dist/browser/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"worker": {
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./dist/browser/index.d.mts",
|
|
39
|
+
"default": "./dist/browser/index.mjs"
|
|
40
|
+
},
|
|
41
|
+
"require": {
|
|
42
|
+
"types": "./dist/browser/index.d.ts",
|
|
43
|
+
"default": "./dist/browser/index.js"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"edge-light": {
|
|
47
|
+
"import": {
|
|
48
|
+
"types": "./dist/edge/index.d.mts",
|
|
49
|
+
"default": "./dist/edge/index.mjs"
|
|
50
|
+
},
|
|
51
|
+
"require": {
|
|
52
|
+
"types": "./dist/edge/index.d.ts",
|
|
53
|
+
"default": "./dist/edge/index.js"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"convex": {
|
|
57
|
+
"import": {
|
|
58
|
+
"types": "./dist/edge/index.d.mts",
|
|
59
|
+
"default": "./dist/edge/index.mjs"
|
|
60
|
+
},
|
|
61
|
+
"require": {
|
|
62
|
+
"types": "./dist/edge/index.d.ts",
|
|
63
|
+
"default": "./dist/edge/index.js"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"node": {
|
|
67
|
+
"import": {
|
|
68
|
+
"types": "./dist/node/index.d.mts",
|
|
69
|
+
"default": "./dist/node/index.mjs"
|
|
70
|
+
},
|
|
71
|
+
"require": {
|
|
72
|
+
"types": "./dist/node/index.d.ts",
|
|
73
|
+
"default": "./dist/node/index.js"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"browser": {
|
|
77
|
+
"import": {
|
|
78
|
+
"types": "./dist/browser/index.d.mts",
|
|
79
|
+
"default": "./dist/browser/index.mjs"
|
|
80
|
+
},
|
|
81
|
+
"require": {
|
|
82
|
+
"types": "./dist/browser/index.d.ts",
|
|
83
|
+
"default": "./dist/browser/index.js"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"default": {
|
|
87
|
+
"import": {
|
|
88
|
+
"types": "./dist/node/index.d.mts",
|
|
89
|
+
"default": "./dist/node/index.mjs"
|
|
90
|
+
},
|
|
91
|
+
"require": {
|
|
92
|
+
"types": "./dist/node/index.d.ts",
|
|
93
|
+
"default": "./dist/node/index.js"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"license": "MIT",
|
|
99
|
+
"repository": {
|
|
100
|
+
"type": "git",
|
|
101
|
+
"url": "https://github.com/resend/react-email.git",
|
|
102
|
+
"directory": "packages/render"
|
|
103
|
+
},
|
|
104
|
+
"keywords": [
|
|
105
|
+
"depup",
|
|
106
|
+
"dependency-bumped",
|
|
107
|
+
"updated-deps",
|
|
108
|
+
"@react-email/render",
|
|
109
|
+
"react",
|
|
110
|
+
"email"
|
|
111
|
+
],
|
|
112
|
+
"engines": {
|
|
113
|
+
"node": ">=20.0.0"
|
|
114
|
+
},
|
|
115
|
+
"dependencies": {
|
|
116
|
+
"html-to-text": "^9.0.5",
|
|
117
|
+
"prettier": "^3.8.1"
|
|
118
|
+
},
|
|
119
|
+
"peerDependencies": {
|
|
120
|
+
"react": "^18.0 || ^19.0 || ^19.0.0-rc",
|
|
121
|
+
"react-dom": "^18.0 || ^19.0 || ^19.0.0-rc"
|
|
122
|
+
},
|
|
123
|
+
"devDependencies": {
|
|
124
|
+
"@edge-runtime/vm": "5.0.0",
|
|
125
|
+
"@types/html-to-text": "9.0.4",
|
|
126
|
+
"@types/react": "npm:types-react@19.0.0-rc.1",
|
|
127
|
+
"@types/react-dom": "npm:types-react-dom@19.0.0",
|
|
128
|
+
"jsdom": "26.1.0",
|
|
129
|
+
"typescript": "5.8.3",
|
|
130
|
+
"tsconfig": "0.0.0"
|
|
131
|
+
},
|
|
132
|
+
"scripts": {
|
|
133
|
+
"build": "tsdown",
|
|
134
|
+
"build:watch": "tsdown --watch",
|
|
135
|
+
"clean": "rm -rf dist",
|
|
136
|
+
"test": "vitest run",
|
|
137
|
+
"test:watch": "vitest"
|
|
138
|
+
},
|
|
139
|
+
"depup": {
|
|
140
|
+
"changes": {
|
|
141
|
+
"prettier": {
|
|
142
|
+
"from": "^3.5.3",
|
|
143
|
+
"to": "^3.8.1"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"depsUpdated": 1,
|
|
147
|
+
"originalPackage": "@react-email/render",
|
|
148
|
+
"originalVersion": "2.0.4",
|
|
149
|
+
"processedAt": "2026-03-17T16:34:01.326Z",
|
|
150
|
+
"smokeTest": "failed"
|
|
151
|
+
}
|
|
152
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<div align="center"><strong>@react-email/render</strong></div>
|
|
4
|
+
<div align="center">Transform React components into HTML email templates.</div>
|
|
5
|
+
<br />
|
|
6
|
+
<div align="center">
|
|
7
|
+
<a href="https://react.email">Website</a>
|
|
8
|
+
<span> · </span>
|
|
9
|
+
<a href="https://github.com/resend/react-email">GitHub</a>
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
Install component from your command line.
|
|
16
|
+
|
|
17
|
+
#### With yarn
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
yarn add @react-email/render -E
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
#### With npm
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm install @react-email/render -E
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Getting started
|
|
30
|
+
|
|
31
|
+
Convert React components into a HTML string.
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
import { MyTemplate } from "../components/MyTemplate";
|
|
35
|
+
import { render } from "@react-email/render";
|
|
36
|
+
|
|
37
|
+
const html = await render(<MyTemplate firstName="Jim" />);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
MIT License
|