@react-email/render 1.1.4 → 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 +21 -16
- package/dist/browser/index.mjs +21 -15
- package/dist/node/index.d.mts +10 -3
- package/dist/node/index.d.ts +10 -3
- package/dist/node/index.js +21 -16
- package/dist/node/index.mjs +21 -15
- package/package.json +1 -1
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");
|
|
@@ -198,9 +204,7 @@ var render = (node, options) => __async(void 0, null, function* () {
|
|
|
198
204
|
}).then(readStream).then(resolve).catch(reject);
|
|
199
205
|
});
|
|
200
206
|
if (options == null ? void 0 : options.plainText) {
|
|
201
|
-
return (
|
|
202
|
-
selectors: plainTextSelectors
|
|
203
|
-
}, options.htmlToTextOptions));
|
|
207
|
+
return toPlainText(html2, options.htmlToTextOptions);
|
|
204
208
|
}
|
|
205
209
|
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
206
210
|
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
@@ -219,5 +223,6 @@ var renderAsync = (element, options) => {
|
|
|
219
223
|
plainTextSelectors,
|
|
220
224
|
pretty,
|
|
221
225
|
render,
|
|
222
|
-
renderAsync
|
|
226
|
+
renderAsync,
|
|
227
|
+
toPlainText
|
|
223
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");
|
|
@@ -162,9 +169,7 @@ var render = (node, options) => __async(void 0, null, function* () {
|
|
|
162
169
|
}).then(readStream).then(resolve).catch(reject);
|
|
163
170
|
});
|
|
164
171
|
if (options == null ? void 0 : options.plainText) {
|
|
165
|
-
return
|
|
166
|
-
selectors: plainTextSelectors
|
|
167
|
-
}, options.htmlToTextOptions));
|
|
172
|
+
return toPlainText(html2, options.htmlToTextOptions);
|
|
168
173
|
}
|
|
169
174
|
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
170
175
|
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
@@ -182,5 +187,6 @@ export {
|
|
|
182
187
|
plainTextSelectors,
|
|
183
188
|
pretty,
|
|
184
189
|
render,
|
|
185
|
-
renderAsync
|
|
190
|
+
renderAsync,
|
|
191
|
+
toPlainText
|
|
186
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");
|
|
@@ -215,9 +221,7 @@ var render = (node, options) => __async(void 0, null, function* () {
|
|
|
215
221
|
});
|
|
216
222
|
}
|
|
217
223
|
if (options == null ? void 0 : options.plainText) {
|
|
218
|
-
return (
|
|
219
|
-
selectors: plainTextSelectors
|
|
220
|
-
}, options.htmlToTextOptions));
|
|
224
|
+
return toPlainText(html2, options.htmlToTextOptions);
|
|
221
225
|
}
|
|
222
226
|
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
223
227
|
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
@@ -236,5 +240,6 @@ var renderAsync = (element, options) => {
|
|
|
236
240
|
plainTextSelectors,
|
|
237
241
|
pretty,
|
|
238
242
|
render,
|
|
239
|
-
renderAsync
|
|
243
|
+
renderAsync,
|
|
244
|
+
toPlainText
|
|
240
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");
|
|
@@ -179,9 +186,7 @@ var render = (node, options) => __async(void 0, null, function* () {
|
|
|
179
186
|
});
|
|
180
187
|
}
|
|
181
188
|
if (options == null ? void 0 : options.plainText) {
|
|
182
|
-
return
|
|
183
|
-
selectors: plainTextSelectors
|
|
184
|
-
}, options.htmlToTextOptions));
|
|
189
|
+
return toPlainText(html2, options.htmlToTextOptions);
|
|
185
190
|
}
|
|
186
191
|
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
187
192
|
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
@@ -199,5 +204,6 @@ export {
|
|
|
199
204
|
plainTextSelectors,
|
|
200
205
|
pretty,
|
|
201
206
|
render,
|
|
202
|
-
renderAsync
|
|
207
|
+
renderAsync,
|
|
208
|
+
toPlainText
|
|
203
209
|
};
|