@react-email/render 1.0.5 → 1.0.6
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 +5 -2
- package/dist/browser/index.d.ts +5 -2
- package/dist/browser/index.js +4 -75
- package/dist/browser/index.mjs +4 -75
- package/dist/node/index.d.mts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +4 -39
- package/dist/node/index.mjs +4 -39
- package/package.json +2 -3
package/dist/browser/index.d.mts
CHANGED
|
@@ -17,8 +17,11 @@ type Options = {
|
|
|
17
17
|
|
|
18
18
|
declare const render: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
19
19
|
|
|
20
|
-
declare const renderAsync: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
21
|
-
|
|
22
20
|
declare const plainTextSelectors: SelectorDefinition[];
|
|
23
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated use {@link render}
|
|
24
|
+
*/
|
|
25
|
+
declare const renderAsync: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
26
|
+
|
|
24
27
|
export { Options, plainTextSelectors, render, renderAsync };
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -17,8 +17,11 @@ type Options = {
|
|
|
17
17
|
|
|
18
18
|
declare const render: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
19
19
|
|
|
20
|
-
declare const renderAsync: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
21
|
-
|
|
22
20
|
declare const plainTextSelectors: SelectorDefinition[];
|
|
23
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated use {@link render}
|
|
24
|
+
*/
|
|
25
|
+
declare const renderAsync: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
26
|
+
|
|
24
27
|
export { Options, plainTextSelectors, render, renderAsync };
|
package/dist/browser/index.js
CHANGED
|
@@ -222,81 +222,10 @@ var render = (element, options) => __async(void 0, null, function* () {
|
|
|
222
222
|
return document;
|
|
223
223
|
});
|
|
224
224
|
|
|
225
|
-
// src/browser/
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
// src/browser/read-stream.ts
|
|
230
|
-
var decoder2 = new TextDecoder("utf-8");
|
|
231
|
-
var readStream2 = (stream) => __async(void 0, null, function* () {
|
|
232
|
-
const chunks = [];
|
|
233
|
-
if ("pipeTo" in stream) {
|
|
234
|
-
const writableStream = new WritableStream({
|
|
235
|
-
write(chunk) {
|
|
236
|
-
chunks.push(chunk);
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
yield stream.pipeTo(writableStream);
|
|
240
|
-
} else {
|
|
241
|
-
throw new Error(
|
|
242
|
-
"For some reason, the Node version of `react-dom/server` has been imported instead of the browser one.",
|
|
243
|
-
{
|
|
244
|
-
cause: {
|
|
245
|
-
stream
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
let length = 0;
|
|
251
|
-
chunks.forEach((item) => {
|
|
252
|
-
length += item.length;
|
|
253
|
-
});
|
|
254
|
-
const mergedChunks = new Uint8Array(length);
|
|
255
|
-
let offset = 0;
|
|
256
|
-
chunks.forEach((item) => {
|
|
257
|
-
mergedChunks.set(item, offset);
|
|
258
|
-
offset += item.length;
|
|
259
|
-
});
|
|
260
|
-
return decoder2.decode(mergedChunks);
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
// src/browser/render-async.tsx
|
|
264
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
265
|
-
var renderAsync = (element, options) => __async(void 0, null, function* () {
|
|
266
|
-
const suspendedElement = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.Suspense, { children: element });
|
|
267
|
-
const reactDOMServer = yield import("react-dom/server");
|
|
268
|
-
let html2;
|
|
269
|
-
if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
|
|
270
|
-
html2 = yield readStream2(
|
|
271
|
-
yield reactDOMServer.renderToReadableStream(suspendedElement)
|
|
272
|
-
);
|
|
273
|
-
} else {
|
|
274
|
-
yield new Promise((resolve, reject) => {
|
|
275
|
-
const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
|
|
276
|
-
onAllReady() {
|
|
277
|
-
return __async(this, null, function* () {
|
|
278
|
-
html2 = yield readStream2(stream);
|
|
279
|
-
resolve();
|
|
280
|
-
});
|
|
281
|
-
},
|
|
282
|
-
onError(error) {
|
|
283
|
-
reject(error);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
if (options == null ? void 0 : options.plainText) {
|
|
289
|
-
return (0, import_html_to_text2.convert)(html2, __spreadValues({
|
|
290
|
-
selectors: plainTextSelectors
|
|
291
|
-
}, options.htmlToTextOptions));
|
|
292
|
-
}
|
|
293
|
-
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
294
|
-
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
295
|
-
if (options == null ? void 0 : options.pretty) {
|
|
296
|
-
return pretty(document);
|
|
297
|
-
}
|
|
298
|
-
return document;
|
|
299
|
-
});
|
|
225
|
+
// src/browser/index.ts
|
|
226
|
+
var renderAsync = (element, options) => {
|
|
227
|
+
return render(element, options);
|
|
228
|
+
};
|
|
300
229
|
// Annotate the CommonJS export names for ESM import in node:
|
|
301
230
|
0 && (module.exports = {
|
|
302
231
|
plainTextSelectors,
|
package/dist/browser/index.mjs
CHANGED
|
@@ -187,81 +187,10 @@ var render = (element, options) => __async(void 0, null, function* () {
|
|
|
187
187
|
return document;
|
|
188
188
|
});
|
|
189
189
|
|
|
190
|
-
// src/browser/
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
// src/browser/read-stream.ts
|
|
195
|
-
var decoder2 = new TextDecoder("utf-8");
|
|
196
|
-
var readStream2 = (stream) => __async(void 0, null, function* () {
|
|
197
|
-
const chunks = [];
|
|
198
|
-
if ("pipeTo" in stream) {
|
|
199
|
-
const writableStream = new WritableStream({
|
|
200
|
-
write(chunk) {
|
|
201
|
-
chunks.push(chunk);
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
yield stream.pipeTo(writableStream);
|
|
205
|
-
} else {
|
|
206
|
-
throw new Error(
|
|
207
|
-
"For some reason, the Node version of `react-dom/server` has been imported instead of the browser one.",
|
|
208
|
-
{
|
|
209
|
-
cause: {
|
|
210
|
-
stream
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
let length = 0;
|
|
216
|
-
chunks.forEach((item) => {
|
|
217
|
-
length += item.length;
|
|
218
|
-
});
|
|
219
|
-
const mergedChunks = new Uint8Array(length);
|
|
220
|
-
let offset = 0;
|
|
221
|
-
chunks.forEach((item) => {
|
|
222
|
-
mergedChunks.set(item, offset);
|
|
223
|
-
offset += item.length;
|
|
224
|
-
});
|
|
225
|
-
return decoder2.decode(mergedChunks);
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
// src/browser/render-async.tsx
|
|
229
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
230
|
-
var renderAsync = (element, options) => __async(void 0, null, function* () {
|
|
231
|
-
const suspendedElement = /* @__PURE__ */ jsx2(Suspense2, { children: element });
|
|
232
|
-
const reactDOMServer = yield import("react-dom/server");
|
|
233
|
-
let html2;
|
|
234
|
-
if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
|
|
235
|
-
html2 = yield readStream2(
|
|
236
|
-
yield reactDOMServer.renderToReadableStream(suspendedElement)
|
|
237
|
-
);
|
|
238
|
-
} else {
|
|
239
|
-
yield new Promise((resolve, reject) => {
|
|
240
|
-
const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
|
|
241
|
-
onAllReady() {
|
|
242
|
-
return __async(this, null, function* () {
|
|
243
|
-
html2 = yield readStream2(stream);
|
|
244
|
-
resolve();
|
|
245
|
-
});
|
|
246
|
-
},
|
|
247
|
-
onError(error) {
|
|
248
|
-
reject(error);
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
if (options == null ? void 0 : options.plainText) {
|
|
254
|
-
return convert2(html2, __spreadValues({
|
|
255
|
-
selectors: plainTextSelectors
|
|
256
|
-
}, options.htmlToTextOptions));
|
|
257
|
-
}
|
|
258
|
-
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
259
|
-
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
260
|
-
if (options == null ? void 0 : options.pretty) {
|
|
261
|
-
return pretty(document);
|
|
262
|
-
}
|
|
263
|
-
return document;
|
|
264
|
-
});
|
|
190
|
+
// src/browser/index.ts
|
|
191
|
+
var renderAsync = (element, options) => {
|
|
192
|
+
return render(element, options);
|
|
193
|
+
};
|
|
265
194
|
export {
|
|
266
195
|
plainTextSelectors,
|
|
267
196
|
render,
|
package/dist/node/index.d.mts
CHANGED
|
@@ -17,11 +17,11 @@ type Options = {
|
|
|
17
17
|
|
|
18
18
|
declare const render: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
19
19
|
|
|
20
|
+
declare const plainTextSelectors: SelectorDefinition[];
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
|
-
* @deprecated use
|
|
23
|
+
* @deprecated use {@link render}
|
|
22
24
|
*/
|
|
23
25
|
declare const renderAsync: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
24
26
|
|
|
25
|
-
declare const plainTextSelectors: SelectorDefinition[];
|
|
26
|
-
|
|
27
27
|
export { Options, plainTextSelectors, render, renderAsync };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -17,11 +17,11 @@ type Options = {
|
|
|
17
17
|
|
|
18
18
|
declare const render: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
19
19
|
|
|
20
|
+
declare const plainTextSelectors: SelectorDefinition[];
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
|
-
* @deprecated use
|
|
23
|
+
* @deprecated use {@link render}
|
|
22
24
|
*/
|
|
23
25
|
declare const renderAsync: (element: React.ReactElement, options?: Options) => Promise<string>;
|
|
24
26
|
|
|
25
|
-
declare const plainTextSelectors: SelectorDefinition[];
|
|
26
|
-
|
|
27
27
|
export { Options, plainTextSelectors, render, renderAsync };
|
package/dist/node/index.js
CHANGED
|
@@ -220,45 +220,10 @@ var render = (element, options) => __async(void 0, null, function* () {
|
|
|
220
220
|
return document;
|
|
221
221
|
});
|
|
222
222
|
|
|
223
|
-
// src/node/
|
|
224
|
-
var
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
var renderAsync = (element, options) => __async(void 0, null, function* () {
|
|
228
|
-
const suspendedElement = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.Suspense, { children: element });
|
|
229
|
-
const reactDOMServer = yield import("react-dom/server");
|
|
230
|
-
let html2;
|
|
231
|
-
if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
|
|
232
|
-
html2 = yield readStream(
|
|
233
|
-
yield reactDOMServer.renderToReadableStream(suspendedElement)
|
|
234
|
-
);
|
|
235
|
-
} else {
|
|
236
|
-
yield new Promise((resolve, reject) => {
|
|
237
|
-
const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
|
|
238
|
-
onAllReady() {
|
|
239
|
-
return __async(this, null, function* () {
|
|
240
|
-
html2 = yield readStream(stream);
|
|
241
|
-
resolve();
|
|
242
|
-
});
|
|
243
|
-
},
|
|
244
|
-
onError(error) {
|
|
245
|
-
reject(error);
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
if (options == null ? void 0 : options.plainText) {
|
|
251
|
-
return (0, import_html_to_text2.convert)(html2, __spreadValues({
|
|
252
|
-
selectors: plainTextSelectors
|
|
253
|
-
}, options.htmlToTextOptions));
|
|
254
|
-
}
|
|
255
|
-
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
256
|
-
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
257
|
-
if (options == null ? void 0 : options.pretty) {
|
|
258
|
-
return pretty(document);
|
|
259
|
-
}
|
|
260
|
-
return document;
|
|
261
|
-
});
|
|
223
|
+
// src/node/index.ts
|
|
224
|
+
var renderAsync = (element, options) => {
|
|
225
|
+
return render(element, options);
|
|
226
|
+
};
|
|
262
227
|
// Annotate the CommonJS export names for ESM import in node:
|
|
263
228
|
0 && (module.exports = {
|
|
264
229
|
plainTextSelectors,
|
package/dist/node/index.mjs
CHANGED
|
@@ -185,45 +185,10 @@ var render = (element, options) => __async(void 0, null, function* () {
|
|
|
185
185
|
return document;
|
|
186
186
|
});
|
|
187
187
|
|
|
188
|
-
// src/node/
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
var renderAsync = (element, options) => __async(void 0, null, function* () {
|
|
193
|
-
const suspendedElement = /* @__PURE__ */ jsx2(Suspense2, { children: element });
|
|
194
|
-
const reactDOMServer = yield import("react-dom/server");
|
|
195
|
-
let html2;
|
|
196
|
-
if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
|
|
197
|
-
html2 = yield readStream(
|
|
198
|
-
yield reactDOMServer.renderToReadableStream(suspendedElement)
|
|
199
|
-
);
|
|
200
|
-
} else {
|
|
201
|
-
yield new Promise((resolve, reject) => {
|
|
202
|
-
const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
|
|
203
|
-
onAllReady() {
|
|
204
|
-
return __async(this, null, function* () {
|
|
205
|
-
html2 = yield readStream(stream);
|
|
206
|
-
resolve();
|
|
207
|
-
});
|
|
208
|
-
},
|
|
209
|
-
onError(error) {
|
|
210
|
-
reject(error);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
if (options == null ? void 0 : options.plainText) {
|
|
216
|
-
return convert2(html2, __spreadValues({
|
|
217
|
-
selectors: plainTextSelectors
|
|
218
|
-
}, options.htmlToTextOptions));
|
|
219
|
-
}
|
|
220
|
-
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
221
|
-
const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
|
|
222
|
-
if (options == null ? void 0 : options.pretty) {
|
|
223
|
-
return pretty(document);
|
|
224
|
-
}
|
|
225
|
-
return document;
|
|
226
|
-
});
|
|
188
|
+
// src/node/index.ts
|
|
189
|
+
var renderAsync = (element, options) => {
|
|
190
|
+
return render(element, options);
|
|
191
|
+
};
|
|
227
192
|
export {
|
|
228
193
|
plainTextSelectors,
|
|
229
194
|
render,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-email/render",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Transform React components into HTML email templates",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/browser/index.js",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"html-to-text": "9.0.5",
|
|
81
|
-
"prettier": "3.
|
|
81
|
+
"prettier": "3.5.3",
|
|
82
82
|
"react-promise-suspense": "0.3.4"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
@@ -94,7 +94,6 @@
|
|
|
94
94
|
"jsdom": "23.0.1",
|
|
95
95
|
"tsup": "7.2.0",
|
|
96
96
|
"typescript": "5.1.6",
|
|
97
|
-
"vitest": "1.1.2",
|
|
98
97
|
"tsconfig": "0.0.0"
|
|
99
98
|
},
|
|
100
99
|
"publishConfig": {
|