@react-email/render 1.0.4 → 1.0.5-canary.1

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.
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
9
  var __getProtoOf = Object.getPrototypeOf;
@@ -19,6 +21,7 @@ var __spreadValues = (a, b) => {
19
21
  }
20
22
  return a;
21
23
  };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
25
  var __export = (target, all) => {
23
26
  for (var name in all)
24
27
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -74,19 +77,6 @@ module.exports = __toCommonJS(node_exports);
74
77
  var import_html_to_text = require("html-to-text");
75
78
  var import_react = require("react");
76
79
 
77
- // src/shared/utils/pretty.ts
78
- var import_standalone = require("prettier/standalone");
79
- var import_html = __toESM(require("prettier/plugins/html"));
80
- var defaults = {
81
- endOfLine: "lf",
82
- tabWidth: 2,
83
- plugins: [import_html.default],
84
- parser: "html"
85
- };
86
- var pretty = (str, options = {}) => {
87
- return (0, import_standalone.format)(str, __spreadValues(__spreadValues({}, defaults), options));
88
- };
89
-
90
80
  // src/shared/plain-text-selectors.ts
91
81
  var plainTextSelectors = [
92
82
  { selector: "img", format: "skip" },
@@ -97,6 +87,71 @@ var plainTextSelectors = [
97
87
  }
98
88
  ];
99
89
 
90
+ // src/shared/utils/pretty.ts
91
+ var import_html = __toESM(require("prettier/plugins/html"));
92
+ var import_standalone = require("prettier/standalone");
93
+ function recursivelyMapDoc(doc, callback) {
94
+ if (Array.isArray(doc)) {
95
+ return doc.map((innerDoc) => recursivelyMapDoc(innerDoc, callback));
96
+ }
97
+ if (typeof doc === "object") {
98
+ if (doc.type === "group") {
99
+ return __spreadProps(__spreadValues({}, doc), {
100
+ contents: recursivelyMapDoc(doc.contents, callback),
101
+ expandedStates: recursivelyMapDoc(
102
+ doc.expandedStates,
103
+ callback
104
+ )
105
+ });
106
+ }
107
+ if ("contents" in doc) {
108
+ return __spreadProps(__spreadValues({}, doc), {
109
+ contents: recursivelyMapDoc(doc.contents, callback)
110
+ });
111
+ }
112
+ if ("parts" in doc) {
113
+ return __spreadProps(__spreadValues({}, doc), {
114
+ parts: recursivelyMapDoc(doc.parts, callback)
115
+ });
116
+ }
117
+ if (doc.type === "if-break") {
118
+ return __spreadProps(__spreadValues({}, doc), {
119
+ breakContents: recursivelyMapDoc(doc.breakContents, callback),
120
+ flatContents: recursivelyMapDoc(doc.flatContents, callback)
121
+ });
122
+ }
123
+ }
124
+ return callback(doc);
125
+ }
126
+ var modifiedHtml = __spreadValues({}, import_html.default);
127
+ if (modifiedHtml.printers) {
128
+ const previousPrint = modifiedHtml.printers.html.print;
129
+ modifiedHtml.printers.html.print = (path, options, print, args) => {
130
+ const node = path.getNode();
131
+ const rawPrintingResult = previousPrint(path, options, print, args);
132
+ if (node.type === "ieConditionalComment") {
133
+ const printingResult = recursivelyMapDoc(rawPrintingResult, (doc) => {
134
+ if (typeof doc === "object" && doc.type === "line") {
135
+ return doc.soft ? "" : " ";
136
+ }
137
+ return doc;
138
+ });
139
+ return printingResult;
140
+ }
141
+ return rawPrintingResult;
142
+ };
143
+ }
144
+ var defaults = {
145
+ endOfLine: "lf",
146
+ tabWidth: 2,
147
+ plugins: [modifiedHtml],
148
+ bracketSameLine: true,
149
+ parser: "html"
150
+ };
151
+ var pretty = (str, options = {}) => {
152
+ return (0, import_standalone.format)(str.replaceAll("\0", ""), __spreadValues(__spreadValues({}, defaults), options));
153
+ };
154
+
100
155
  // src/node/read-stream.ts
101
156
  var import_node_stream = require("stream");
102
157
  var decoder = new TextDecoder("utf-8");
@@ -1,4 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
4
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -14,6 +16,7 @@ var __spreadValues = (a, b) => {
14
16
  }
15
17
  return a;
16
18
  };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
17
20
  var __async = (__this, __arguments, generator) => {
18
21
  return new Promise((resolve, reject) => {
19
22
  var fulfilled = (value) => {
@@ -39,19 +42,6 @@ var __async = (__this, __arguments, generator) => {
39
42
  import { convert } from "html-to-text";
40
43
  import { Suspense } from "react";
41
44
 
42
- // src/shared/utils/pretty.ts
43
- import { format } from "prettier/standalone";
44
- import html from "prettier/plugins/html";
45
- var defaults = {
46
- endOfLine: "lf",
47
- tabWidth: 2,
48
- plugins: [html],
49
- parser: "html"
50
- };
51
- var pretty = (str, options = {}) => {
52
- return format(str, __spreadValues(__spreadValues({}, defaults), options));
53
- };
54
-
55
45
  // src/shared/plain-text-selectors.ts
56
46
  var plainTextSelectors = [
57
47
  { selector: "img", format: "skip" },
@@ -62,6 +52,71 @@ var plainTextSelectors = [
62
52
  }
63
53
  ];
64
54
 
55
+ // src/shared/utils/pretty.ts
56
+ import html from "prettier/plugins/html";
57
+ import { format } from "prettier/standalone";
58
+ function recursivelyMapDoc(doc, callback) {
59
+ if (Array.isArray(doc)) {
60
+ return doc.map((innerDoc) => recursivelyMapDoc(innerDoc, callback));
61
+ }
62
+ if (typeof doc === "object") {
63
+ if (doc.type === "group") {
64
+ return __spreadProps(__spreadValues({}, doc), {
65
+ contents: recursivelyMapDoc(doc.contents, callback),
66
+ expandedStates: recursivelyMapDoc(
67
+ doc.expandedStates,
68
+ callback
69
+ )
70
+ });
71
+ }
72
+ if ("contents" in doc) {
73
+ return __spreadProps(__spreadValues({}, doc), {
74
+ contents: recursivelyMapDoc(doc.contents, callback)
75
+ });
76
+ }
77
+ if ("parts" in doc) {
78
+ return __spreadProps(__spreadValues({}, doc), {
79
+ parts: recursivelyMapDoc(doc.parts, callback)
80
+ });
81
+ }
82
+ if (doc.type === "if-break") {
83
+ return __spreadProps(__spreadValues({}, doc), {
84
+ breakContents: recursivelyMapDoc(doc.breakContents, callback),
85
+ flatContents: recursivelyMapDoc(doc.flatContents, callback)
86
+ });
87
+ }
88
+ }
89
+ return callback(doc);
90
+ }
91
+ var modifiedHtml = __spreadValues({}, html);
92
+ if (modifiedHtml.printers) {
93
+ const previousPrint = modifiedHtml.printers.html.print;
94
+ modifiedHtml.printers.html.print = (path, options, print, args) => {
95
+ const node = path.getNode();
96
+ const rawPrintingResult = previousPrint(path, options, print, args);
97
+ if (node.type === "ieConditionalComment") {
98
+ const printingResult = recursivelyMapDoc(rawPrintingResult, (doc) => {
99
+ if (typeof doc === "object" && doc.type === "line") {
100
+ return doc.soft ? "" : " ";
101
+ }
102
+ return doc;
103
+ });
104
+ return printingResult;
105
+ }
106
+ return rawPrintingResult;
107
+ };
108
+ }
109
+ var defaults = {
110
+ endOfLine: "lf",
111
+ tabWidth: 2,
112
+ plugins: [modifiedHtml],
113
+ bracketSameLine: true,
114
+ parser: "html"
115
+ };
116
+ var pretty = (str, options = {}) => {
117
+ return format(str.replaceAll("\0", ""), __spreadValues(__spreadValues({}, defaults), options));
118
+ };
119
+
65
120
  // src/node/read-stream.ts
66
121
  import { Writable } from "node:stream";
67
122
  var decoder = new TextDecoder("utf-8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-email/render",
3
- "version": "1.0.4",
3
+ "version": "1.0.5-canary.1",
4
4
  "description": "Transform React components into HTML email templates",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/browser/index.js",
@@ -95,7 +95,6 @@
95
95
  "tsup": "7.2.0",
96
96
  "typescript": "5.1.6",
97
97
  "vitest": "1.1.2",
98
- "eslint-config-custom": "0.0.0",
99
98
  "tsconfig": "0.0.0"
100
99
  },
101
100
  "publishConfig": {
@@ -105,7 +104,6 @@
105
104
  "build": "tsup-node",
106
105
  "clean": "rm -rf dist",
107
106
  "dev": "tsup-node --watch",
108
- "lint": "eslint .",
109
107
  "test": "vitest run",
110
108
  "test:watch": "vitest"
111
109
  }