@react-email/render 1.1.2-canary.0 → 1.1.3-canary.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 +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.js +23 -40
- package/dist/browser/index.mjs +22 -39
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +4 -4
- package/dist/node/index.mjs +3 -3
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -23,7 +23,7 @@ declare const plainTextSelectors: SelectorDefinition[];
|
|
|
23
23
|
|
|
24
24
|
declare const pretty: (str: string, options?: Options$1) => Promise<string>;
|
|
25
25
|
|
|
26
|
-
declare const render: (
|
|
26
|
+
declare const render: (node: React.ReactNode, options?: Options) => Promise<string>;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @deprecated use {@link render}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare const plainTextSelectors: SelectorDefinition[];
|
|
|
23
23
|
|
|
24
24
|
declare const pretty: (str: string, options?: Options$1) => Promise<string>;
|
|
25
25
|
|
|
26
|
-
declare const render: (
|
|
26
|
+
declare const render: (node: React.ReactNode, options?: Options) => Promise<string>;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @deprecated use {@link render}
|
package/dist/browser/index.js
CHANGED
|
@@ -89,7 +89,7 @@ var plainTextSelectors = [
|
|
|
89
89
|
];
|
|
90
90
|
|
|
91
91
|
// src/shared/utils/pretty.ts
|
|
92
|
-
var
|
|
92
|
+
var html = __toESM(require("prettier/plugins/html"));
|
|
93
93
|
var import_standalone = require("prettier/standalone");
|
|
94
94
|
function recursivelyMapDoc(doc, callback) {
|
|
95
95
|
if (Array.isArray(doc)) {
|
|
@@ -124,7 +124,7 @@ function recursivelyMapDoc(doc, callback) {
|
|
|
124
124
|
}
|
|
125
125
|
return callback(doc);
|
|
126
126
|
}
|
|
127
|
-
var modifiedHtml = __spreadValues({},
|
|
127
|
+
var modifiedHtml = __spreadValues({}, html);
|
|
128
128
|
if (modifiedHtml.printers) {
|
|
129
129
|
const previousPrint = modifiedHtml.printers.html.print;
|
|
130
130
|
modifiedHtml.printers.html.print = (path, options, print, args) => {
|
|
@@ -158,23 +158,19 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
158
158
|
var decoder = new TextDecoder("utf-8");
|
|
159
159
|
var readStream = (stream) => __async(void 0, null, function* () {
|
|
160
160
|
const chunks = [];
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
yield stream.pipeTo(writableStream);
|
|
168
|
-
} else {
|
|
169
|
-
throw new Error(
|
|
170
|
-
"For some reason, the Node version of `react-dom/server` has been imported instead of the browser one.",
|
|
171
|
-
{
|
|
161
|
+
const writableStream = new WritableStream({
|
|
162
|
+
write(chunk) {
|
|
163
|
+
chunks.push(chunk);
|
|
164
|
+
},
|
|
165
|
+
abort(reason) {
|
|
166
|
+
throw new Error("Stream aborted", {
|
|
172
167
|
cause: {
|
|
173
|
-
|
|
168
|
+
reason
|
|
174
169
|
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
yield stream.pipeTo(writableStream);
|
|
178
174
|
let length = 0;
|
|
179
175
|
chunks.forEach((item) => {
|
|
180
176
|
length += item.length;
|
|
@@ -187,32 +183,19 @@ var readStream = (stream) => __async(void 0, null, function* () {
|
|
|
187
183
|
});
|
|
188
184
|
return decoder.decode(mergedChunks);
|
|
189
185
|
});
|
|
190
|
-
var render = (
|
|
191
|
-
const suspendedElement = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { children:
|
|
192
|
-
const reactDOMServer = yield import("react-dom/server").then(
|
|
186
|
+
var render = (node, options) => __async(void 0, null, function* () {
|
|
187
|
+
const suspendedElement = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { children: node });
|
|
188
|
+
const reactDOMServer = yield import("react-dom/server.browser").then(
|
|
193
189
|
// This is beacuse react-dom/server is CJS
|
|
194
190
|
(m) => m.default
|
|
195
191
|
);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
|
|
204
|
-
onAllReady() {
|
|
205
|
-
return __async(this, null, function* () {
|
|
206
|
-
html2 = yield readStream(stream);
|
|
207
|
-
resolve();
|
|
208
|
-
});
|
|
209
|
-
},
|
|
210
|
-
onError(error) {
|
|
211
|
-
reject(error);
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
}
|
|
192
|
+
const html2 = yield new Promise((resolve, reject) => {
|
|
193
|
+
reactDOMServer.renderToReadableStream(suspendedElement, {
|
|
194
|
+
onError(error) {
|
|
195
|
+
reject(error);
|
|
196
|
+
}
|
|
197
|
+
}).then(readStream).then(resolve).catch(reject);
|
|
198
|
+
});
|
|
216
199
|
if (options == null ? void 0 : options.plainText) {
|
|
217
200
|
return (0, import_html_to_text.convert)(html2, __spreadValues({
|
|
218
201
|
selectors: plainTextSelectors
|
package/dist/browser/index.mjs
CHANGED
|
@@ -53,7 +53,7 @@ var plainTextSelectors = [
|
|
|
53
53
|
];
|
|
54
54
|
|
|
55
55
|
// src/shared/utils/pretty.ts
|
|
56
|
-
import html from "prettier/plugins/html";
|
|
56
|
+
import * as html from "prettier/plugins/html";
|
|
57
57
|
import { format } from "prettier/standalone";
|
|
58
58
|
function recursivelyMapDoc(doc, callback) {
|
|
59
59
|
if (Array.isArray(doc)) {
|
|
@@ -122,23 +122,19 @@ import { jsx } from "react/jsx-runtime";
|
|
|
122
122
|
var decoder = new TextDecoder("utf-8");
|
|
123
123
|
var readStream = (stream) => __async(void 0, null, function* () {
|
|
124
124
|
const chunks = [];
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
yield stream.pipeTo(writableStream);
|
|
132
|
-
} else {
|
|
133
|
-
throw new Error(
|
|
134
|
-
"For some reason, the Node version of `react-dom/server` has been imported instead of the browser one.",
|
|
135
|
-
{
|
|
125
|
+
const writableStream = new WritableStream({
|
|
126
|
+
write(chunk) {
|
|
127
|
+
chunks.push(chunk);
|
|
128
|
+
},
|
|
129
|
+
abort(reason) {
|
|
130
|
+
throw new Error("Stream aborted", {
|
|
136
131
|
cause: {
|
|
137
|
-
|
|
132
|
+
reason
|
|
138
133
|
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
yield stream.pipeTo(writableStream);
|
|
142
138
|
let length = 0;
|
|
143
139
|
chunks.forEach((item) => {
|
|
144
140
|
length += item.length;
|
|
@@ -151,32 +147,19 @@ var readStream = (stream) => __async(void 0, null, function* () {
|
|
|
151
147
|
});
|
|
152
148
|
return decoder.decode(mergedChunks);
|
|
153
149
|
});
|
|
154
|
-
var render = (
|
|
155
|
-
const suspendedElement = /* @__PURE__ */ jsx(Suspense, { children:
|
|
156
|
-
const reactDOMServer = yield import("react-dom/server").then(
|
|
150
|
+
var render = (node, options) => __async(void 0, null, function* () {
|
|
151
|
+
const suspendedElement = /* @__PURE__ */ jsx(Suspense, { children: node });
|
|
152
|
+
const reactDOMServer = yield import("react-dom/server.browser").then(
|
|
157
153
|
// This is beacuse react-dom/server is CJS
|
|
158
154
|
(m) => m.default
|
|
159
155
|
);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
|
|
168
|
-
onAllReady() {
|
|
169
|
-
return __async(this, null, function* () {
|
|
170
|
-
html2 = yield readStream(stream);
|
|
171
|
-
resolve();
|
|
172
|
-
});
|
|
173
|
-
},
|
|
174
|
-
onError(error) {
|
|
175
|
-
reject(error);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
}
|
|
156
|
+
const html2 = yield new Promise((resolve, reject) => {
|
|
157
|
+
reactDOMServer.renderToReadableStream(suspendedElement, {
|
|
158
|
+
onError(error) {
|
|
159
|
+
reject(error);
|
|
160
|
+
}
|
|
161
|
+
}).then(readStream).then(resolve).catch(reject);
|
|
162
|
+
});
|
|
180
163
|
if (options == null ? void 0 : options.plainText) {
|
|
181
164
|
return convert(html2, __spreadValues({
|
|
182
165
|
selectors: plainTextSelectors
|
package/dist/node/index.d.mts
CHANGED
|
@@ -23,7 +23,7 @@ declare const plainTextSelectors: SelectorDefinition[];
|
|
|
23
23
|
|
|
24
24
|
declare const pretty: (str: string, options?: Options$1) => Promise<string>;
|
|
25
25
|
|
|
26
|
-
declare const render: (
|
|
26
|
+
declare const render: (node: React.ReactNode, options?: Options) => Promise<string>;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @deprecated use {@link render}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare const plainTextSelectors: SelectorDefinition[];
|
|
|
23
23
|
|
|
24
24
|
declare const pretty: (str: string, options?: Options$1) => Promise<string>;
|
|
25
25
|
|
|
26
|
-
declare const render: (
|
|
26
|
+
declare const render: (node: React.ReactNode, options?: Options) => Promise<string>;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @deprecated use {@link render}
|
package/dist/node/index.js
CHANGED
|
@@ -89,7 +89,7 @@ var plainTextSelectors = [
|
|
|
89
89
|
];
|
|
90
90
|
|
|
91
91
|
// src/shared/utils/pretty.ts
|
|
92
|
-
var
|
|
92
|
+
var html = __toESM(require("prettier/plugins/html"));
|
|
93
93
|
var import_standalone = require("prettier/standalone");
|
|
94
94
|
function recursivelyMapDoc(doc, callback) {
|
|
95
95
|
if (Array.isArray(doc)) {
|
|
@@ -124,7 +124,7 @@ function recursivelyMapDoc(doc, callback) {
|
|
|
124
124
|
}
|
|
125
125
|
return callback(doc);
|
|
126
126
|
}
|
|
127
|
-
var modifiedHtml = __spreadValues({},
|
|
127
|
+
var modifiedHtml = __spreadValues({}, html);
|
|
128
128
|
if (modifiedHtml.printers) {
|
|
129
129
|
const previousPrint = modifiedHtml.printers.html.print;
|
|
130
130
|
modifiedHtml.printers.html.print = (path, options, print, args) => {
|
|
@@ -185,8 +185,8 @@ var readStream = (stream) => __async(void 0, null, function* () {
|
|
|
185
185
|
|
|
186
186
|
// src/node/render.tsx
|
|
187
187
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
188
|
-
var render = (
|
|
189
|
-
const suspendedElement = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { children:
|
|
188
|
+
var render = (node, options) => __async(void 0, null, function* () {
|
|
189
|
+
const suspendedElement = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { children: node });
|
|
190
190
|
const reactDOMServer = yield import("react-dom/server").then(
|
|
191
191
|
// This is beacuse react-dom/server is CJS
|
|
192
192
|
(m) => m.default
|
package/dist/node/index.mjs
CHANGED
|
@@ -53,7 +53,7 @@ var plainTextSelectors = [
|
|
|
53
53
|
];
|
|
54
54
|
|
|
55
55
|
// src/shared/utils/pretty.ts
|
|
56
|
-
import html from "prettier/plugins/html";
|
|
56
|
+
import * as html from "prettier/plugins/html";
|
|
57
57
|
import { format } from "prettier/standalone";
|
|
58
58
|
function recursivelyMapDoc(doc, callback) {
|
|
59
59
|
if (Array.isArray(doc)) {
|
|
@@ -149,8 +149,8 @@ var readStream = (stream) => __async(void 0, null, function* () {
|
|
|
149
149
|
|
|
150
150
|
// src/node/render.tsx
|
|
151
151
|
import { jsx } from "react/jsx-runtime";
|
|
152
|
-
var render = (
|
|
153
|
-
const suspendedElement = /* @__PURE__ */ jsx(Suspense, { children:
|
|
152
|
+
var render = (node, options) => __async(void 0, null, function* () {
|
|
153
|
+
const suspendedElement = /* @__PURE__ */ jsx(Suspense, { children: node });
|
|
154
154
|
const reactDOMServer = yield import("react-dom/server").then(
|
|
155
155
|
// This is beacuse react-dom/server is CJS
|
|
156
156
|
(m) => m.default
|