@react-email/render 1.1.3 → 1.2.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/dist/browser/index.d.mts +10 -3
- package/dist/browser/index.d.ts +10 -3
- package/dist/browser/index.js +23 -17
- package/dist/browser/index.mjs +23 -16
- package/dist/node/index.d.mts +10 -3
- package/dist/node/index.d.ts +10 -3
- package/dist/node/index.js +26 -18
- package/dist/node/index.mjs +26 -17
- package/package.json +2 -2
- package/dist/index.d.mts +0 -23
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -768
- package/dist/index.mjs +0 -733
package/dist/browser/index.d.mts
CHANGED
|
@@ -7,8 +7,14 @@ type Options = {
|
|
|
7
7
|
*/
|
|
8
8
|
pretty?: boolean;
|
|
9
9
|
} & ({
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use {@link toPlainText} instead
|
|
12
|
+
*/
|
|
10
13
|
plainText?: false;
|
|
11
14
|
} | {
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated use {@link toPlainText} instead
|
|
17
|
+
*/
|
|
12
18
|
plainText?: true;
|
|
13
19
|
/**
|
|
14
20
|
* These are options you can pass down directly to the library we use for
|
|
@@ -19,10 +25,11 @@ type Options = {
|
|
|
19
25
|
htmlToTextOptions?: HtmlToTextOptions;
|
|
20
26
|
});
|
|
21
27
|
|
|
22
|
-
declare const plainTextSelectors: SelectorDefinition[];
|
|
23
|
-
|
|
24
28
|
declare const pretty: (str: string, options?: Options$1) => Promise<string>;
|
|
25
29
|
|
|
30
|
+
declare const plainTextSelectors: SelectorDefinition[];
|
|
31
|
+
declare function toPlainText(html: string, options?: HtmlToTextOptions): string;
|
|
32
|
+
|
|
26
33
|
declare const render: (node: React.ReactNode, options?: Options) => Promise<string>;
|
|
27
34
|
|
|
28
35
|
/**
|
|
@@ -30,4 +37,4 @@ declare const render: (node: React.ReactNode, options?: Options) => Promise<stri
|
|
|
30
37
|
*/
|
|
31
38
|
declare const renderAsync: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
32
39
|
|
|
33
|
-
export { type Options, plainTextSelectors, pretty, render, renderAsync };
|
|
40
|
+
export { type Options, plainTextSelectors, pretty, render, renderAsync, toPlainText };
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -7,8 +7,14 @@ type Options = {
|
|
|
7
7
|
*/
|
|
8
8
|
pretty?: boolean;
|
|
9
9
|
} & ({
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use {@link toPlainText} instead
|
|
12
|
+
*/
|
|
10
13
|
plainText?: false;
|
|
11
14
|
} | {
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated use {@link toPlainText} instead
|
|
17
|
+
*/
|
|
12
18
|
plainText?: true;
|
|
13
19
|
/**
|
|
14
20
|
* These are options you can pass down directly to the library we use for
|
|
@@ -19,10 +25,11 @@ type Options = {
|
|
|
19
25
|
htmlToTextOptions?: HtmlToTextOptions;
|
|
20
26
|
});
|
|
21
27
|
|
|
22
|
-
declare const plainTextSelectors: SelectorDefinition[];
|
|
23
|
-
|
|
24
28
|
declare const pretty: (str: string, options?: Options$1) => Promise<string>;
|
|
25
29
|
|
|
30
|
+
declare const plainTextSelectors: SelectorDefinition[];
|
|
31
|
+
declare function toPlainText(html: string, options?: HtmlToTextOptions): string;
|
|
32
|
+
|
|
26
33
|
declare const render: (node: React.ReactNode, options?: Options) => Promise<string>;
|
|
27
34
|
|
|
28
35
|
/**
|
|
@@ -30,4 +37,4 @@ declare const render: (node: React.ReactNode, options?: Options) => Promise<stri
|
|
|
30
37
|
*/
|
|
31
38
|
declare const renderAsync: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
32
39
|
|
|
33
|
-
export { type Options, plainTextSelectors, pretty, render, renderAsync };
|
|
40
|
+
export { type Options, plainTextSelectors, pretty, render, renderAsync, toPlainText };
|
package/dist/browser/index.js
CHANGED
|
@@ -70,24 +70,14 @@ __export(index_exports, {
|
|
|
70
70
|
plainTextSelectors: () => plainTextSelectors,
|
|
71
71
|
pretty: () => pretty,
|
|
72
72
|
render: () => render,
|
|
73
|
-
renderAsync: () => renderAsync
|
|
73
|
+
renderAsync: () => renderAsync,
|
|
74
|
+
toPlainText: () => toPlainText
|
|
74
75
|
});
|
|
75
76
|
module.exports = __toCommonJS(index_exports);
|
|
76
77
|
|
|
77
78
|
// src/browser/render.tsx
|
|
78
|
-
var import_html_to_text = require("html-to-text");
|
|
79
79
|
var import_react = require("react");
|
|
80
80
|
|
|
81
|
-
// src/shared/plain-text-selectors.ts
|
|
82
|
-
var plainTextSelectors = [
|
|
83
|
-
{ selector: "img", format: "skip" },
|
|
84
|
-
{ selector: "[data-skip-in-text=true]", format: "skip" },
|
|
85
|
-
{
|
|
86
|
-
selector: "a",
|
|
87
|
-
options: { linkBrackets: false }
|
|
88
|
-
}
|
|
89
|
-
];
|
|
90
|
-
|
|
91
81
|
// src/shared/utils/pretty.ts
|
|
92
82
|
var html = __toESM(require("prettier/plugins/html"));
|
|
93
83
|
var import_standalone = require("prettier/standalone");
|
|
@@ -153,6 +143,22 @@ var pretty = (str, options = {}) => {
|
|
|
153
143
|
return (0, import_standalone.format)(str.replaceAll("\0", ""), __spreadValues(__spreadValues({}, defaults), options));
|
|
154
144
|
};
|
|
155
145
|
|
|
146
|
+
// src/shared/utils/to-plain-text.ts
|
|
147
|
+
var import_html_to_text = require("html-to-text");
|
|
148
|
+
var plainTextSelectors = [
|
|
149
|
+
{ selector: "img", format: "skip" },
|
|
150
|
+
{ selector: "[data-skip-in-text=true]", format: "skip" },
|
|
151
|
+
{
|
|
152
|
+
selector: "a",
|
|
153
|
+
options: { linkBrackets: false }
|
|
154
|
+
}
|
|
155
|
+
];
|
|
156
|
+
function toPlainText(html2, options) {
|
|
157
|
+
return (0, import_html_to_text.convert)(html2, __spreadValues({
|
|
158
|
+
selectors: plainTextSelectors
|
|
159
|
+
}, options));
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
// src/browser/render.tsx
|
|
157
163
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
158
164
|
var decoder = new TextDecoder("utf-8");
|
|
@@ -193,13 +199,12 @@ var render = (node, options) => __async(void 0, null, function* () {
|
|
|
193
199
|
reactDOMServer.renderToReadableStream(suspendedElement, {
|
|
194
200
|
onError(error) {
|
|
195
201
|
reject(error);
|
|
196
|
-
}
|
|
202
|
+
},
|
|
203
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY
|
|
197
204
|
}).then(readStream).then(resolve).catch(reject);
|
|
198
205
|
});
|
|
199
206
|
if (options == null ? void 0 : options.plainText) {
|
|
200
|
-
return (
|
|
201
|
-
selectors: plainTextSelectors
|
|
202
|
-
}, options.htmlToTextOptions));
|
|
207
|
+
return toPlainText(html2, options.htmlToTextOptions);
|
|
203
208
|
}
|
|
204
209
|
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
205
210
|
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
@@ -218,5 +223,6 @@ var renderAsync = (element, options) => {
|
|
|
218
223
|
plainTextSelectors,
|
|
219
224
|
pretty,
|
|
220
225
|
render,
|
|
221
|
-
renderAsync
|
|
226
|
+
renderAsync,
|
|
227
|
+
toPlainText
|
|
222
228
|
});
|
package/dist/browser/index.mjs
CHANGED
|
@@ -39,19 +39,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// src/browser/render.tsx
|
|
42
|
-
import { convert } from "html-to-text";
|
|
43
42
|
import { Suspense } from "react";
|
|
44
43
|
|
|
45
|
-
// src/shared/plain-text-selectors.ts
|
|
46
|
-
var plainTextSelectors = [
|
|
47
|
-
{ selector: "img", format: "skip" },
|
|
48
|
-
{ selector: "[data-skip-in-text=true]", format: "skip" },
|
|
49
|
-
{
|
|
50
|
-
selector: "a",
|
|
51
|
-
options: { linkBrackets: false }
|
|
52
|
-
}
|
|
53
|
-
];
|
|
54
|
-
|
|
55
44
|
// src/shared/utils/pretty.ts
|
|
56
45
|
import * as html from "prettier/plugins/html";
|
|
57
46
|
import { format } from "prettier/standalone";
|
|
@@ -117,6 +106,24 @@ var pretty = (str, options = {}) => {
|
|
|
117
106
|
return format(str.replaceAll("\0", ""), __spreadValues(__spreadValues({}, defaults), options));
|
|
118
107
|
};
|
|
119
108
|
|
|
109
|
+
// src/shared/utils/to-plain-text.ts
|
|
110
|
+
import {
|
|
111
|
+
convert
|
|
112
|
+
} from "html-to-text";
|
|
113
|
+
var plainTextSelectors = [
|
|
114
|
+
{ selector: "img", format: "skip" },
|
|
115
|
+
{ selector: "[data-skip-in-text=true]", format: "skip" },
|
|
116
|
+
{
|
|
117
|
+
selector: "a",
|
|
118
|
+
options: { linkBrackets: false }
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
function toPlainText(html2, options) {
|
|
122
|
+
return convert(html2, __spreadValues({
|
|
123
|
+
selectors: plainTextSelectors
|
|
124
|
+
}, options));
|
|
125
|
+
}
|
|
126
|
+
|
|
120
127
|
// src/browser/render.tsx
|
|
121
128
|
import { jsx } from "react/jsx-runtime";
|
|
122
129
|
var decoder = new TextDecoder("utf-8");
|
|
@@ -157,13 +164,12 @@ var render = (node, options) => __async(void 0, null, function* () {
|
|
|
157
164
|
reactDOMServer.renderToReadableStream(suspendedElement, {
|
|
158
165
|
onError(error) {
|
|
159
166
|
reject(error);
|
|
160
|
-
}
|
|
167
|
+
},
|
|
168
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY
|
|
161
169
|
}).then(readStream).then(resolve).catch(reject);
|
|
162
170
|
});
|
|
163
171
|
if (options == null ? void 0 : options.plainText) {
|
|
164
|
-
return
|
|
165
|
-
selectors: plainTextSelectors
|
|
166
|
-
}, options.htmlToTextOptions));
|
|
172
|
+
return toPlainText(html2, options.htmlToTextOptions);
|
|
167
173
|
}
|
|
168
174
|
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
169
175
|
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
@@ -181,5 +187,6 @@ export {
|
|
|
181
187
|
plainTextSelectors,
|
|
182
188
|
pretty,
|
|
183
189
|
render,
|
|
184
|
-
renderAsync
|
|
190
|
+
renderAsync,
|
|
191
|
+
toPlainText
|
|
185
192
|
};
|
package/dist/node/index.d.mts
CHANGED
|
@@ -7,8 +7,14 @@ type Options = {
|
|
|
7
7
|
*/
|
|
8
8
|
pretty?: boolean;
|
|
9
9
|
} & ({
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use {@link toPlainText} instead
|
|
12
|
+
*/
|
|
10
13
|
plainText?: false;
|
|
11
14
|
} | {
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated use {@link toPlainText} instead
|
|
17
|
+
*/
|
|
12
18
|
plainText?: true;
|
|
13
19
|
/**
|
|
14
20
|
* These are options you can pass down directly to the library we use for
|
|
@@ -19,10 +25,11 @@ type Options = {
|
|
|
19
25
|
htmlToTextOptions?: HtmlToTextOptions;
|
|
20
26
|
});
|
|
21
27
|
|
|
22
|
-
declare const plainTextSelectors: SelectorDefinition[];
|
|
23
|
-
|
|
24
28
|
declare const pretty: (str: string, options?: Options$1) => Promise<string>;
|
|
25
29
|
|
|
30
|
+
declare const plainTextSelectors: SelectorDefinition[];
|
|
31
|
+
declare function toPlainText(html: string, options?: HtmlToTextOptions): string;
|
|
32
|
+
|
|
26
33
|
declare const render: (node: React.ReactNode, options?: Options) => Promise<string>;
|
|
27
34
|
|
|
28
35
|
/**
|
|
@@ -30,4 +37,4 @@ declare const render: (node: React.ReactNode, options?: Options) => Promise<stri
|
|
|
30
37
|
*/
|
|
31
38
|
declare const renderAsync: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
32
39
|
|
|
33
|
-
export { type Options, plainTextSelectors, pretty, render, renderAsync };
|
|
40
|
+
export { type Options, plainTextSelectors, pretty, render, renderAsync, toPlainText };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -7,8 +7,14 @@ type Options = {
|
|
|
7
7
|
*/
|
|
8
8
|
pretty?: boolean;
|
|
9
9
|
} & ({
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use {@link toPlainText} instead
|
|
12
|
+
*/
|
|
10
13
|
plainText?: false;
|
|
11
14
|
} | {
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated use {@link toPlainText} instead
|
|
17
|
+
*/
|
|
12
18
|
plainText?: true;
|
|
13
19
|
/**
|
|
14
20
|
* These are options you can pass down directly to the library we use for
|
|
@@ -19,10 +25,11 @@ type Options = {
|
|
|
19
25
|
htmlToTextOptions?: HtmlToTextOptions;
|
|
20
26
|
});
|
|
21
27
|
|
|
22
|
-
declare const plainTextSelectors: SelectorDefinition[];
|
|
23
|
-
|
|
24
28
|
declare const pretty: (str: string, options?: Options$1) => Promise<string>;
|
|
25
29
|
|
|
30
|
+
declare const plainTextSelectors: SelectorDefinition[];
|
|
31
|
+
declare function toPlainText(html: string, options?: HtmlToTextOptions): string;
|
|
32
|
+
|
|
26
33
|
declare const render: (node: React.ReactNode, options?: Options) => Promise<string>;
|
|
27
34
|
|
|
28
35
|
/**
|
|
@@ -30,4 +37,4 @@ declare const render: (node: React.ReactNode, options?: Options) => Promise<stri
|
|
|
30
37
|
*/
|
|
31
38
|
declare const renderAsync: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
32
39
|
|
|
33
|
-
export { type Options, plainTextSelectors, pretty, render, renderAsync };
|
|
40
|
+
export { type Options, plainTextSelectors, pretty, render, renderAsync, toPlainText };
|
package/dist/node/index.js
CHANGED
|
@@ -70,24 +70,14 @@ __export(index_exports, {
|
|
|
70
70
|
plainTextSelectors: () => plainTextSelectors,
|
|
71
71
|
pretty: () => pretty,
|
|
72
72
|
render: () => render,
|
|
73
|
-
renderAsync: () => renderAsync
|
|
73
|
+
renderAsync: () => renderAsync,
|
|
74
|
+
toPlainText: () => toPlainText
|
|
74
75
|
});
|
|
75
76
|
module.exports = __toCommonJS(index_exports);
|
|
76
77
|
|
|
77
78
|
// src/node/render.tsx
|
|
78
|
-
var import_html_to_text = require("html-to-text");
|
|
79
79
|
var import_react = require("react");
|
|
80
80
|
|
|
81
|
-
// src/shared/plain-text-selectors.ts
|
|
82
|
-
var plainTextSelectors = [
|
|
83
|
-
{ selector: "img", format: "skip" },
|
|
84
|
-
{ selector: "[data-skip-in-text=true]", format: "skip" },
|
|
85
|
-
{
|
|
86
|
-
selector: "a",
|
|
87
|
-
options: { linkBrackets: false }
|
|
88
|
-
}
|
|
89
|
-
];
|
|
90
|
-
|
|
91
81
|
// src/shared/utils/pretty.ts
|
|
92
82
|
var html = __toESM(require("prettier/plugins/html"));
|
|
93
83
|
var import_standalone = require("prettier/standalone");
|
|
@@ -153,6 +143,22 @@ var pretty = (str, options = {}) => {
|
|
|
153
143
|
return (0, import_standalone.format)(str.replaceAll("\0", ""), __spreadValues(__spreadValues({}, defaults), options));
|
|
154
144
|
};
|
|
155
145
|
|
|
146
|
+
// src/shared/utils/to-plain-text.ts
|
|
147
|
+
var import_html_to_text = require("html-to-text");
|
|
148
|
+
var plainTextSelectors = [
|
|
149
|
+
{ selector: "img", format: "skip" },
|
|
150
|
+
{ selector: "[data-skip-in-text=true]", format: "skip" },
|
|
151
|
+
{
|
|
152
|
+
selector: "a",
|
|
153
|
+
options: { linkBrackets: false }
|
|
154
|
+
}
|
|
155
|
+
];
|
|
156
|
+
function toPlainText(html2, options) {
|
|
157
|
+
return (0, import_html_to_text.convert)(html2, __spreadValues({
|
|
158
|
+
selectors: plainTextSelectors
|
|
159
|
+
}, options));
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
// src/node/read-stream.ts
|
|
157
163
|
var import_node_stream = require("stream");
|
|
158
164
|
var decoder = new TextDecoder("utf-8");
|
|
@@ -194,7 +200,9 @@ var render = (node, options) => __async(void 0, null, function* () {
|
|
|
194
200
|
let html2;
|
|
195
201
|
if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
|
|
196
202
|
html2 = yield readStream(
|
|
197
|
-
yield reactDOMServer.renderToReadableStream(suspendedElement
|
|
203
|
+
yield reactDOMServer.renderToReadableStream(suspendedElement, {
|
|
204
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY
|
|
205
|
+
})
|
|
198
206
|
);
|
|
199
207
|
} else {
|
|
200
208
|
yield new Promise((resolve, reject) => {
|
|
@@ -207,14 +215,13 @@ var render = (node, options) => __async(void 0, null, function* () {
|
|
|
207
215
|
},
|
|
208
216
|
onError(error) {
|
|
209
217
|
reject(error);
|
|
210
|
-
}
|
|
218
|
+
},
|
|
219
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY
|
|
211
220
|
});
|
|
212
221
|
});
|
|
213
222
|
}
|
|
214
223
|
if (options == null ? void 0 : options.plainText) {
|
|
215
|
-
return (
|
|
216
|
-
selectors: plainTextSelectors
|
|
217
|
-
}, options.htmlToTextOptions));
|
|
224
|
+
return toPlainText(html2, options.htmlToTextOptions);
|
|
218
225
|
}
|
|
219
226
|
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
220
227
|
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
@@ -233,5 +240,6 @@ var renderAsync = (element, options) => {
|
|
|
233
240
|
plainTextSelectors,
|
|
234
241
|
pretty,
|
|
235
242
|
render,
|
|
236
|
-
renderAsync
|
|
243
|
+
renderAsync,
|
|
244
|
+
toPlainText
|
|
237
245
|
});
|
package/dist/node/index.mjs
CHANGED
|
@@ -39,19 +39,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// src/node/render.tsx
|
|
42
|
-
import { convert } from "html-to-text";
|
|
43
42
|
import { Suspense } from "react";
|
|
44
43
|
|
|
45
|
-
// src/shared/plain-text-selectors.ts
|
|
46
|
-
var plainTextSelectors = [
|
|
47
|
-
{ selector: "img", format: "skip" },
|
|
48
|
-
{ selector: "[data-skip-in-text=true]", format: "skip" },
|
|
49
|
-
{
|
|
50
|
-
selector: "a",
|
|
51
|
-
options: { linkBrackets: false }
|
|
52
|
-
}
|
|
53
|
-
];
|
|
54
|
-
|
|
55
44
|
// src/shared/utils/pretty.ts
|
|
56
45
|
import * as html from "prettier/plugins/html";
|
|
57
46
|
import { format } from "prettier/standalone";
|
|
@@ -117,6 +106,24 @@ var pretty = (str, options = {}) => {
|
|
|
117
106
|
return format(str.replaceAll("\0", ""), __spreadValues(__spreadValues({}, defaults), options));
|
|
118
107
|
};
|
|
119
108
|
|
|
109
|
+
// src/shared/utils/to-plain-text.ts
|
|
110
|
+
import {
|
|
111
|
+
convert
|
|
112
|
+
} from "html-to-text";
|
|
113
|
+
var plainTextSelectors = [
|
|
114
|
+
{ selector: "img", format: "skip" },
|
|
115
|
+
{ selector: "[data-skip-in-text=true]", format: "skip" },
|
|
116
|
+
{
|
|
117
|
+
selector: "a",
|
|
118
|
+
options: { linkBrackets: false }
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
function toPlainText(html2, options) {
|
|
122
|
+
return convert(html2, __spreadValues({
|
|
123
|
+
selectors: plainTextSelectors
|
|
124
|
+
}, options));
|
|
125
|
+
}
|
|
126
|
+
|
|
120
127
|
// src/node/read-stream.ts
|
|
121
128
|
import { Writable } from "node:stream";
|
|
122
129
|
var decoder = new TextDecoder("utf-8");
|
|
@@ -158,7 +165,9 @@ var render = (node, options) => __async(void 0, null, function* () {
|
|
|
158
165
|
let html2;
|
|
159
166
|
if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
|
|
160
167
|
html2 = yield readStream(
|
|
161
|
-
yield reactDOMServer.renderToReadableStream(suspendedElement
|
|
168
|
+
yield reactDOMServer.renderToReadableStream(suspendedElement, {
|
|
169
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY
|
|
170
|
+
})
|
|
162
171
|
);
|
|
163
172
|
} else {
|
|
164
173
|
yield new Promise((resolve, reject) => {
|
|
@@ -171,14 +180,13 @@ var render = (node, options) => __async(void 0, null, function* () {
|
|
|
171
180
|
},
|
|
172
181
|
onError(error) {
|
|
173
182
|
reject(error);
|
|
174
|
-
}
|
|
183
|
+
},
|
|
184
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY
|
|
175
185
|
});
|
|
176
186
|
});
|
|
177
187
|
}
|
|
178
188
|
if (options == null ? void 0 : options.plainText) {
|
|
179
|
-
return
|
|
180
|
-
selectors: plainTextSelectors
|
|
181
|
-
}, options.htmlToTextOptions));
|
|
189
|
+
return toPlainText(html2, options.htmlToTextOptions);
|
|
182
190
|
}
|
|
183
191
|
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
184
192
|
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
@@ -196,5 +204,6 @@ export {
|
|
|
196
204
|
plainTextSelectors,
|
|
197
205
|
pretty,
|
|
198
206
|
render,
|
|
199
|
-
renderAsync
|
|
207
|
+
renderAsync,
|
|
208
|
+
toPlainText
|
|
200
209
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-email/render",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Transform React components into HTML email templates",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/browser/index.js",
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"build": "tsup-node",
|
|
104
|
+
"build:watch": "tsup-node --watch",
|
|
104
105
|
"clean": "rm -rf dist",
|
|
105
|
-
"dev": "tsup-node --watch",
|
|
106
106
|
"test": "vitest run",
|
|
107
107
|
"test:watch": "vitest"
|
|
108
108
|
}
|
package/dist/index.d.mts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { HtmlToTextOptions } from 'html-to-text';
|
|
2
|
-
import { Options as Options$1 } from 'prettier';
|
|
3
|
-
|
|
4
|
-
type Options = {
|
|
5
|
-
pretty?: boolean;
|
|
6
|
-
} & ({
|
|
7
|
-
plainText?: false;
|
|
8
|
-
} | {
|
|
9
|
-
plainText?: true;
|
|
10
|
-
/**
|
|
11
|
-
* These are options you can pass down directly to the library we use for
|
|
12
|
-
* converting the rendered email's HTML into plain text.
|
|
13
|
-
*
|
|
14
|
-
* @see https://github.com/html-to-text/node-html-to-text
|
|
15
|
-
*/
|
|
16
|
-
htmlToTextOptions?: HtmlToTextOptions;
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
declare const render: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
20
|
-
|
|
21
|
-
declare const pretty: (str: string, options?: Options$1) => Promise<string>;
|
|
22
|
-
|
|
23
|
-
export { Options, pretty, render };
|
package/dist/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { HtmlToTextOptions } from 'html-to-text';
|
|
2
|
-
import { Options as Options$1 } from 'prettier';
|
|
3
|
-
|
|
4
|
-
type Options = {
|
|
5
|
-
pretty?: boolean;
|
|
6
|
-
} & ({
|
|
7
|
-
plainText?: false;
|
|
8
|
-
} | {
|
|
9
|
-
plainText?: true;
|
|
10
|
-
/**
|
|
11
|
-
* These are options you can pass down directly to the library we use for
|
|
12
|
-
* converting the rendered email's HTML into plain text.
|
|
13
|
-
*
|
|
14
|
-
* @see https://github.com/html-to-text/node-html-to-text
|
|
15
|
-
*/
|
|
16
|
-
htmlToTextOptions?: HtmlToTextOptions;
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
declare const render: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
20
|
-
|
|
21
|
-
declare const pretty: (str: string, options?: Options$1) => Promise<string>;
|
|
22
|
-
|
|
23
|
-
export { Options, pretty, render };
|