@react-email/render 0.0.11 → 0.0.12
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/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ var ReactDomServer = __toESM(require("react-dom/server"));
|
|
|
81
81
|
var import_html_to_text = require("html-to-text");
|
|
82
82
|
|
|
83
83
|
// src/utils/pretty.ts
|
|
84
|
-
var import_js_beautify = require("js-beautify");
|
|
84
|
+
var import_js_beautify = __toESM(require("js-beautify"));
|
|
85
85
|
var defaults = {
|
|
86
86
|
unformatted: ["code", "pre", "em", "strong", "span"],
|
|
87
87
|
indent_inner_html: true,
|
|
@@ -90,7 +90,7 @@ var defaults = {
|
|
|
90
90
|
sep: "\n"
|
|
91
91
|
};
|
|
92
92
|
var pretty = (str, options = {}) => {
|
|
93
|
-
return
|
|
93
|
+
return import_js_beautify.default.html(str, __spreadValues(__spreadValues({}, defaults), options));
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
// src/plain-text-selectors.ts
|
|
@@ -161,13 +161,13 @@ var renderAsync = (component, options) => __async(void 0, null, function* () {
|
|
|
161
161
|
const renderToStream = (_a = reactDOMServer.renderToReadableStream) != null ? _a : reactDOMServer.renderToStaticNodeStream;
|
|
162
162
|
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
163
163
|
const htmlOrReadableStream = yield renderToStream(component);
|
|
164
|
-
const
|
|
164
|
+
const html = typeof htmlOrReadableStream === "string" ? htmlOrReadableStream : yield readStream(htmlOrReadableStream);
|
|
165
165
|
if (options == null ? void 0 : options.plainText) {
|
|
166
|
-
return (0, import_html_to_text2.convert)(
|
|
166
|
+
return (0, import_html_to_text2.convert)(html, __spreadValues({
|
|
167
167
|
selectors: plainTextSelectors
|
|
168
168
|
}, options.htmlToTextOptions));
|
|
169
169
|
}
|
|
170
|
-
const document = `${doctype}${
|
|
170
|
+
const document = `${doctype}${html}`;
|
|
171
171
|
if (options == null ? void 0 : options.pretty) {
|
|
172
172
|
return pretty(document);
|
|
173
173
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -46,7 +46,7 @@ import * as ReactDomServer from "react-dom/server";
|
|
|
46
46
|
import { convert } from "html-to-text";
|
|
47
47
|
|
|
48
48
|
// src/utils/pretty.ts
|
|
49
|
-
import
|
|
49
|
+
import jsBeautify from "js-beautify";
|
|
50
50
|
var defaults = {
|
|
51
51
|
unformatted: ["code", "pre", "em", "strong", "span"],
|
|
52
52
|
indent_inner_html: true,
|
|
@@ -55,7 +55,7 @@ var defaults = {
|
|
|
55
55
|
sep: "\n"
|
|
56
56
|
};
|
|
57
57
|
var pretty = (str, options = {}) => {
|
|
58
|
-
return html(str, __spreadValues(__spreadValues({}, defaults), options));
|
|
58
|
+
return jsBeautify.html(str, __spreadValues(__spreadValues({}, defaults), options));
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
// src/plain-text-selectors.ts
|
|
@@ -126,13 +126,13 @@ var renderAsync = (component, options) => __async(void 0, null, function* () {
|
|
|
126
126
|
const renderToStream = (_a = reactDOMServer.renderToReadableStream) != null ? _a : reactDOMServer.renderToStaticNodeStream;
|
|
127
127
|
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
128
128
|
const htmlOrReadableStream = yield renderToStream(component);
|
|
129
|
-
const
|
|
129
|
+
const html = typeof htmlOrReadableStream === "string" ? htmlOrReadableStream : yield readStream(htmlOrReadableStream);
|
|
130
130
|
if (options == null ? void 0 : options.plainText) {
|
|
131
|
-
return convert2(
|
|
131
|
+
return convert2(html, __spreadValues({
|
|
132
132
|
selectors: plainTextSelectors
|
|
133
133
|
}, options.htmlToTextOptions));
|
|
134
134
|
}
|
|
135
|
-
const document = `${doctype}${
|
|
135
|
+
const document = `${doctype}${html}`;
|
|
136
136
|
if (options == null ? void 0 : options.pretty) {
|
|
137
137
|
return pretty(document);
|
|
138
138
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-email/render",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Transform React components into HTML email templates",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,6 +22,14 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --external react",
|
|
27
|
+
"clean": "rm -rf dist",
|
|
28
|
+
"dev": "tsup src/index.ts --format esm,cjs --dts --external react --watch",
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"test:watch": "vitest",
|
|
31
|
+
"test": "vitest run"
|
|
32
|
+
},
|
|
25
33
|
"repository": {
|
|
26
34
|
"type": "git",
|
|
27
35
|
"url": "https://github.com/resend/react-email.git",
|
|
@@ -45,21 +53,13 @@
|
|
|
45
53
|
"@edge-runtime/vm": "3.1.7",
|
|
46
54
|
"@types/html-to-text": "9.0.1",
|
|
47
55
|
"@types/js-beautify": "1.14.3",
|
|
56
|
+
"eslint-config-custom": "workspace:*",
|
|
48
57
|
"jsdom": "23.0.1",
|
|
58
|
+
"tsconfig": "workspace:*",
|
|
49
59
|
"typescript": "5.1.6",
|
|
50
|
-
"vitest": "0.34.6"
|
|
51
|
-
"eslint-config-custom": "0.0.0",
|
|
52
|
-
"tsconfig": "0.0.0"
|
|
60
|
+
"vitest": "0.34.6"
|
|
53
61
|
},
|
|
54
62
|
"publishConfig": {
|
|
55
63
|
"access": "public"
|
|
56
|
-
},
|
|
57
|
-
"scripts": {
|
|
58
|
-
"build": "tsup src/index.ts --format esm,cjs --dts --external react",
|
|
59
|
-
"clean": "rm -rf dist",
|
|
60
|
-
"dev": "tsup src/index.ts --format esm,cjs --dts --external react --watch",
|
|
61
|
-
"lint": "eslint .",
|
|
62
|
-
"test:watch": "vitest",
|
|
63
|
-
"test": "vitest run"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|