@react-email/render 1.0.3-canary.1 → 1.0.3-canary.3

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.
@@ -75,16 +75,16 @@ var import_html_to_text = require("html-to-text");
75
75
  var import_react = require("react");
76
76
 
77
77
  // src/shared/utils/pretty.ts
78
- var import_js_beautify = __toESM(require("js-beautify"));
78
+ var import_standalone = require("prettier/standalone");
79
+ var import_html = __toESM(require("prettier/plugins/html"));
79
80
  var defaults = {
80
- unformatted: ["code", "pre", "em", "strong", "span"],
81
- indent_inner_html: true,
82
- indent_char: " ",
83
- indent_size: 2,
84
- sep: "\n"
81
+ endOfLine: "lf",
82
+ tabWidth: 2,
83
+ plugins: [import_html.default],
84
+ parser: "html"
85
85
  };
86
86
  var pretty = (str, options = {}) => {
87
- return import_js_beautify.default.html(str, __spreadValues(__spreadValues({}, defaults), options));
87
+ return (0, import_standalone.format)(str, __spreadValues(__spreadValues({}, defaults), options));
88
88
  };
89
89
 
90
90
  // src/shared/plain-text-selectors.ts
@@ -132,9 +132,9 @@ var import_jsx_runtime = require("react/jsx-runtime");
132
132
  var render = (element, options) => __async(void 0, null, function* () {
133
133
  const suspendedElement = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { children: element });
134
134
  const reactDOMServer = yield import("react-dom/server");
135
- let html;
135
+ let html2;
136
136
  if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
137
- html = yield readStream(
137
+ html2 = yield readStream(
138
138
  yield reactDOMServer.renderToReadableStream(suspendedElement)
139
139
  );
140
140
  } else {
@@ -142,7 +142,7 @@ var render = (element, options) => __async(void 0, null, function* () {
142
142
  const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
143
143
  onAllReady() {
144
144
  return __async(this, null, function* () {
145
- html = yield readStream(stream);
145
+ html2 = yield readStream(stream);
146
146
  resolve();
147
147
  });
148
148
  },
@@ -153,12 +153,12 @@ var render = (element, options) => __async(void 0, null, function* () {
153
153
  });
154
154
  }
155
155
  if (options == null ? void 0 : options.plainText) {
156
- return (0, import_html_to_text.convert)(html, __spreadValues({
156
+ return (0, import_html_to_text.convert)(html2, __spreadValues({
157
157
  selectors: plainTextSelectors
158
158
  }, options.htmlToTextOptions));
159
159
  }
160
160
  const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
161
- const document = `${doctype}${html.replace(/<!DOCTYPE.*?>/, "")}`;
161
+ const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
162
162
  if (options == null ? void 0 : options.pretty) {
163
163
  return pretty(document);
164
164
  }
@@ -172,9 +172,9 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
172
172
  var renderAsync = (element, options) => __async(void 0, null, function* () {
173
173
  const suspendedElement = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.Suspense, { children: element });
174
174
  const reactDOMServer = yield import("react-dom/server");
175
- let html;
175
+ let html2;
176
176
  if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
177
- html = yield readStream(
177
+ html2 = yield readStream(
178
178
  yield reactDOMServer.renderToReadableStream(suspendedElement)
179
179
  );
180
180
  } else {
@@ -182,7 +182,7 @@ var renderAsync = (element, options) => __async(void 0, null, function* () {
182
182
  const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
183
183
  onAllReady() {
184
184
  return __async(this, null, function* () {
185
- html = yield readStream(stream);
185
+ html2 = yield readStream(stream);
186
186
  resolve();
187
187
  });
188
188
  },
@@ -193,12 +193,12 @@ var renderAsync = (element, options) => __async(void 0, null, function* () {
193
193
  });
194
194
  }
195
195
  if (options == null ? void 0 : options.plainText) {
196
- return (0, import_html_to_text2.convert)(html, __spreadValues({
196
+ return (0, import_html_to_text2.convert)(html2, __spreadValues({
197
197
  selectors: plainTextSelectors
198
198
  }, options.htmlToTextOptions));
199
199
  }
200
200
  const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
201
- const document = `${doctype}${html.replace(/<!DOCTYPE.*?>/, "")}`;
201
+ const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
202
202
  if (options == null ? void 0 : options.pretty) {
203
203
  return pretty(document);
204
204
  }
@@ -40,16 +40,16 @@ import { convert } from "html-to-text";
40
40
  import { Suspense } from "react";
41
41
 
42
42
  // src/shared/utils/pretty.ts
43
- import jsBeautify from "js-beautify";
43
+ import { format } from "prettier/standalone";
44
+ import html from "prettier/plugins/html";
44
45
  var defaults = {
45
- unformatted: ["code", "pre", "em", "strong", "span"],
46
- indent_inner_html: true,
47
- indent_char: " ",
48
- indent_size: 2,
49
- sep: "\n"
46
+ endOfLine: "lf",
47
+ tabWidth: 2,
48
+ plugins: [html],
49
+ parser: "html"
50
50
  };
51
51
  var pretty = (str, options = {}) => {
52
- return jsBeautify.html(str, __spreadValues(__spreadValues({}, defaults), options));
52
+ return format(str, __spreadValues(__spreadValues({}, defaults), options));
53
53
  };
54
54
 
55
55
  // src/shared/plain-text-selectors.ts
@@ -97,9 +97,9 @@ import { jsx } from "react/jsx-runtime";
97
97
  var render = (element, options) => __async(void 0, null, function* () {
98
98
  const suspendedElement = /* @__PURE__ */ jsx(Suspense, { children: element });
99
99
  const reactDOMServer = yield import("react-dom/server");
100
- let html;
100
+ let html2;
101
101
  if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
102
- html = yield readStream(
102
+ html2 = yield readStream(
103
103
  yield reactDOMServer.renderToReadableStream(suspendedElement)
104
104
  );
105
105
  } else {
@@ -107,7 +107,7 @@ var render = (element, options) => __async(void 0, null, function* () {
107
107
  const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
108
108
  onAllReady() {
109
109
  return __async(this, null, function* () {
110
- html = yield readStream(stream);
110
+ html2 = yield readStream(stream);
111
111
  resolve();
112
112
  });
113
113
  },
@@ -118,12 +118,12 @@ var render = (element, options) => __async(void 0, null, function* () {
118
118
  });
119
119
  }
120
120
  if (options == null ? void 0 : options.plainText) {
121
- return convert(html, __spreadValues({
121
+ return convert(html2, __spreadValues({
122
122
  selectors: plainTextSelectors
123
123
  }, options.htmlToTextOptions));
124
124
  }
125
125
  const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
126
- const document = `${doctype}${html.replace(/<!DOCTYPE.*?>/, "")}`;
126
+ const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
127
127
  if (options == null ? void 0 : options.pretty) {
128
128
  return pretty(document);
129
129
  }
@@ -137,9 +137,9 @@ import { jsx as jsx2 } from "react/jsx-runtime";
137
137
  var renderAsync = (element, options) => __async(void 0, null, function* () {
138
138
  const suspendedElement = /* @__PURE__ */ jsx2(Suspense2, { children: element });
139
139
  const reactDOMServer = yield import("react-dom/server");
140
- let html;
140
+ let html2;
141
141
  if (Object.hasOwn(reactDOMServer, "renderToReadableStream")) {
142
- html = yield readStream(
142
+ html2 = yield readStream(
143
143
  yield reactDOMServer.renderToReadableStream(suspendedElement)
144
144
  );
145
145
  } else {
@@ -147,7 +147,7 @@ var renderAsync = (element, options) => __async(void 0, null, function* () {
147
147
  const stream = reactDOMServer.renderToPipeableStream(suspendedElement, {
148
148
  onAllReady() {
149
149
  return __async(this, null, function* () {
150
- html = yield readStream(stream);
150
+ html2 = yield readStream(stream);
151
151
  resolve();
152
152
  });
153
153
  },
@@ -158,12 +158,12 @@ var renderAsync = (element, options) => __async(void 0, null, function* () {
158
158
  });
159
159
  }
160
160
  if (options == null ? void 0 : options.plainText) {
161
- return convert2(html, __spreadValues({
161
+ return convert2(html2, __spreadValues({
162
162
  selectors: plainTextSelectors
163
163
  }, options.htmlToTextOptions));
164
164
  }
165
165
  const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
166
- const document = `${doctype}${html.replace(/<!DOCTYPE.*?>/, "")}`;
166
+ const document = `${doctype}${html2.replace(/<!DOCTYPE.*?>/, "")}`;
167
167
  if (options == null ? void 0 : options.pretty) {
168
168
  return pretty(document);
169
169
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-email/render",
3
- "version": "1.0.3-canary.1",
3
+ "version": "1.0.3-canary.3",
4
4
  "description": "Transform React components into HTML email templates",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/browser/index.js",
@@ -78,17 +78,19 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "html-to-text": "9.0.5",
81
- "js-beautify": "^1.14.11",
82
- "react": "^18.0 || ^19.0 || ^19.0.0-rc",
83
- "react-dom": "^18.0 || ^19.0 || ^19.0.0-rc",
81
+ "prettier": "3.3.3",
84
82
  "react-promise-suspense": "0.3.4"
85
83
  },
84
+ "peerDependencies": {
85
+ "react": "^18.0 || ^19.0 || ^19.0.0-rc",
86
+ "react-dom": "^18.0 || ^19.0 || ^19.0.0-rc"
87
+ },
86
88
  "devDependencies": {
87
- "@types/react": "npm:types-react@19.0.0-rc.1",
88
- "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
89
89
  "@edge-runtime/vm": "3.1.8",
90
90
  "@types/html-to-text": "9.0.4",
91
- "@types/js-beautify": "1.14.3",
91
+ "@types/prettier": "3.0.0",
92
+ "@types/react": "npm:types-react@19.0.0-rc.1",
93
+ "@types/react-dom": "npm:types-react-dom@19.0.0",
92
94
  "jsdom": "23.0.1",
93
95
  "tsup": "7.2.0",
94
96
  "typescript": "5.1.6",