react-email-rails 0.4.1 → 0.6.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/index.d.ts +1 -1
- package/dist/runtime.d.ts +12 -0
- package/dist/runtime.js +0 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/src/index.ts +2 -0
- package/src/runtime.ts +14 -9
- package/src/version.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,5 +15,5 @@ export type ReactEmailRailsViteOptions = Pick<UserConfig, "assetsInclude" | "css
|
|
|
15
15
|
};
|
|
16
16
|
export declare const EMAIL_ENVIRONMENT = "email";
|
|
17
17
|
export declare function reactEmailRails(options?: ReactEmailRailsOptions): Plugin;
|
|
18
|
-
export type { EmailModule, EmailRegistry, EmailRenderOptions, RenderedEmail, RenderRequest, RenderResult, } from "./runtime.js";
|
|
18
|
+
export type { EmailModule, EmailRegistry, EmailRenderOptions, Mailer, Message, RenderedEmail, RenderRequest, RenderResult, } from "./runtime.js";
|
|
19
19
|
export { RENDER_PROTOCOL_VERSION, VERSION } from "./version.js";
|
package/dist/runtime.d.ts
CHANGED
|
@@ -10,6 +10,18 @@ export type RenderRequest = {
|
|
|
10
10
|
props?: Record<string, unknown>;
|
|
11
11
|
renderOptions?: EmailRenderOptions;
|
|
12
12
|
};
|
|
13
|
+
export type Mailer = {
|
|
14
|
+
mailerName: string;
|
|
15
|
+
actionName: string;
|
|
16
|
+
};
|
|
17
|
+
export type Message = {
|
|
18
|
+
subject: string | null;
|
|
19
|
+
to: string[] | null;
|
|
20
|
+
cc: string[] | null;
|
|
21
|
+
bcc: string[] | null;
|
|
22
|
+
from: string[] | null;
|
|
23
|
+
replyTo: string[] | null;
|
|
24
|
+
};
|
|
13
25
|
export type HealthRequest = {
|
|
14
26
|
health: true;
|
|
15
27
|
};
|
package/dist/runtime.js
CHANGED
|
@@ -5,7 +5,6 @@ export function toComponentName(globPath, root, extension) {
|
|
|
5
5
|
const start = globPath.lastIndexOf(root) + root.length;
|
|
6
6
|
return globPath.slice(start, globPath.length - extension.length);
|
|
7
7
|
}
|
|
8
|
-
// Map glob results to a component-name registry (used for both email and document registries).
|
|
9
8
|
export function buildRegistry(modules, extensions, root) {
|
|
10
9
|
const registry = Object.create(null);
|
|
11
10
|
for (const [path, loader] of Object.entries(modules)) {
|
|
@@ -20,7 +19,6 @@ export async function renderEmail(request, registry) {
|
|
|
20
19
|
throw new Error(`React email component not found: ${request.component}`);
|
|
21
20
|
const mod = typeof loader === "function" ? await loader() : loader;
|
|
22
21
|
const element = React.createElement(mod.default, request.props ?? {});
|
|
23
|
-
// @react-email/render re-renders the tree per call, so html and text are two passes.
|
|
24
22
|
return {
|
|
25
23
|
html: await render(element, { ...request.renderOptions?.html, plainText: false }),
|
|
26
24
|
text: await render(element, { ...request.renderOptions?.text, plainText: true }),
|
|
@@ -73,12 +71,8 @@ export async function serve(registry, documents = null) {
|
|
|
73
71
|
process.exitCode = 1;
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
|
-
// Reserve stdout for the JSON render protocol: stray writes (e.g. console.log, which Node
|
|
77
|
-
// routes through process.stdout.write) are diverted to stderr so they can't corrupt a frame.
|
|
78
|
-
// Returns the writer to use for protocol output.
|
|
79
74
|
function isolateStdout() {
|
|
80
75
|
const protocolWrite = process.stdout.write.bind(process.stdout);
|
|
81
|
-
// Forward encoding/callback (and the function-as-second-arg overload), not just chunk.
|
|
82
76
|
process.stdout.write = ((chunk, encoding, callback) => typeof encoding === "function"
|
|
83
77
|
? process.stderr.write(chunk, encoding)
|
|
84
78
|
: process.stderr.write(chunk, encoding, callback));
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.6.0";
|
|
2
2
|
export declare const RENDER_PROTOCOL_VERSION = 3;
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.6.0";
|
|
2
2
|
export const RENDER_PROTOCOL_VERSION = 3;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-email-rails",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Build and send emails using React and Rails",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
"@tiptap/pm": "^3",
|
|
96
96
|
"@types/node": "^25.9.1",
|
|
97
97
|
"@types/react": "^19.2.15",
|
|
98
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
98
|
+
"@typescript/native-preview": "7.0.0-dev.20260605.1",
|
|
99
99
|
"happy-dom": "^20.8.9",
|
|
100
100
|
"marked": "^18.0.5",
|
|
101
|
-
"oxfmt": "^0.
|
|
101
|
+
"oxfmt": "^0.54.0",
|
|
102
102
|
"oxlint": "^1.67.0",
|
|
103
103
|
"oxlint-tsgolint": "^0.23.0",
|
|
104
104
|
"react": "^19.2.6",
|
package/src/index.ts
CHANGED
package/src/runtime.ts
CHANGED
|
@@ -16,6 +16,20 @@ export type RenderRequest = {
|
|
|
16
16
|
renderOptions?: EmailRenderOptions
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export type Mailer = {
|
|
20
|
+
mailerName: string
|
|
21
|
+
actionName: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type Message = {
|
|
25
|
+
subject: string | null
|
|
26
|
+
to: string[] | null
|
|
27
|
+
cc: string[] | null
|
|
28
|
+
bcc: string[] | null
|
|
29
|
+
from: string[] | null
|
|
30
|
+
replyTo: string[] | null
|
|
31
|
+
}
|
|
32
|
+
|
|
19
33
|
export type HealthRequest = {
|
|
20
34
|
health: true
|
|
21
35
|
}
|
|
@@ -42,15 +56,12 @@ export type ParseDocumentRequest = {
|
|
|
42
56
|
context?: unknown
|
|
43
57
|
}
|
|
44
58
|
|
|
45
|
-
// A document node type that rendered to nothing, with how many times it occurred.
|
|
46
59
|
export type DroppedNode = { type: string; count: number }
|
|
47
60
|
|
|
48
|
-
// A render result plus non-fatal warnings (dropped document nodes); component renders carry none.
|
|
49
61
|
export type RenderResult = RenderedEmail & { warnings?: DroppedNode[] }
|
|
50
62
|
|
|
51
63
|
export type ParseResult = { document: unknown }
|
|
52
64
|
|
|
53
|
-
// Injected by the generated server module so `serve` renders documents without importing the editor module.
|
|
54
65
|
export type DocumentSupport<Registry = unknown> = {
|
|
55
66
|
registry: Registry
|
|
56
67
|
compose: (request: RenderDocumentRequest, registry: Registry) => Promise<RenderResult>
|
|
@@ -72,7 +83,6 @@ export function toComponentName(globPath: string, root: string, extension: strin
|
|
|
72
83
|
return globPath.slice(start, globPath.length - extension.length)
|
|
73
84
|
}
|
|
74
85
|
|
|
75
|
-
// Map glob results to a component-name registry (used for both email and document registries).
|
|
76
86
|
export function buildRegistry(
|
|
77
87
|
modules: EmailRegistry,
|
|
78
88
|
extensions: string[],
|
|
@@ -97,7 +107,6 @@ export async function renderEmail(
|
|
|
97
107
|
const mod = typeof loader === "function" ? await loader() : loader
|
|
98
108
|
const element = React.createElement(mod.default, request.props ?? {})
|
|
99
109
|
|
|
100
|
-
// @react-email/render re-renders the tree per call, so html and text are two passes.
|
|
101
110
|
return {
|
|
102
111
|
html: await render(element, { ...request.renderOptions?.html, plainText: false }),
|
|
103
112
|
text: await render(element, { ...request.renderOptions?.text, plainText: true }),
|
|
@@ -173,12 +182,8 @@ export async function serve<Registry = unknown>(
|
|
|
173
182
|
}
|
|
174
183
|
}
|
|
175
184
|
|
|
176
|
-
// Reserve stdout for the JSON render protocol: stray writes (e.g. console.log, which Node
|
|
177
|
-
// routes through process.stdout.write) are diverted to stderr so they can't corrupt a frame.
|
|
178
|
-
// Returns the writer to use for protocol output.
|
|
179
185
|
function isolateStdout(): (chunk: string) => boolean {
|
|
180
186
|
const protocolWrite = process.stdout.write.bind(process.stdout)
|
|
181
|
-
// Forward encoding/callback (and the function-as-second-arg overload), not just chunk.
|
|
182
187
|
process.stdout.write = ((chunk, encoding, callback) =>
|
|
183
188
|
typeof encoding === "function"
|
|
184
189
|
? process.stderr.write(chunk, encoding)
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.6.0"
|
|
2
2
|
export const RENDER_PROTOCOL_VERSION = 3
|