react-email 4.2.11 → 4.3.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/CHANGELOG.md +8 -0
- package/dev/CHANGELOG.md +2 -0
- package/dev/package.json +1 -1
- package/dist/index.js +931 -1321
- package/package.json +4 -5
- package/readme.md +3 -4
- package/src/commands/build.ts +5 -5
- package/src/utils/get-emails-directory-metadata.ts +0 -1
- package/src/utils/preview/hot-reloading/get-imported-modules.spec.ts +6 -6
- package/src/utils/preview/serve-static-file.ts +0 -1
- package/src/utils/preview/start-dev-server.ts +0 -2
- package/tsdown.config.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-email",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "A live preview of your emails right in your browser.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"email": "./dist/index.js"
|
|
@@ -45,13 +45,12 @@
|
|
|
45
45
|
"next": "^15.3.2",
|
|
46
46
|
"react": "19.0.0",
|
|
47
47
|
"react-dom": "19.0.0",
|
|
48
|
-
"tsup": "8.4.0",
|
|
49
48
|
"typescript": "5.8.3",
|
|
50
|
-
"@react-email/components": "0.5.
|
|
49
|
+
"@react-email/components": "0.5.6"
|
|
51
50
|
},
|
|
52
51
|
"scripts": {
|
|
53
|
-
"build": "
|
|
54
|
-
"build:watch": "
|
|
52
|
+
"build": "tsdown",
|
|
53
|
+
"build:watch": "tsdown --watch src",
|
|
55
54
|
"clean": "rm -rf dist",
|
|
56
55
|
"test": "vitest run",
|
|
57
56
|
"test:watch": "vitest"
|
package/readme.md
CHANGED
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
<div align="center">The next generation of writing emails.<br />High-quality, unstyled components for creating emails.</div>
|
|
5
5
|
<br />
|
|
6
6
|
<div align="center">
|
|
7
|
-
<a href="https://react.email">Website</a>
|
|
7
|
+
<a href="https://react.email">Website</a>
|
|
8
8
|
<span> · </span>
|
|
9
|
-
<a href="https://github.com/resend/react-email">GitHub</a>
|
|
10
|
-
|
|
11
|
-
<a href="https://react.email/discord">Discord</a>
|
|
9
|
+
<a href="https://github.com/resend/react-email">GitHub</a>
|
|
10
|
+
|
|
12
11
|
</div>
|
|
13
12
|
|
|
14
13
|
## Getting started
|
package/src/commands/build.ts
CHANGED
|
@@ -78,14 +78,14 @@ const setNextEnvironmentVariablesForBuild = async (
|
|
|
78
78
|
const nextConfigContents = `
|
|
79
79
|
const path = require('path');
|
|
80
80
|
const emailsDirRelativePath = path.normalize('${emailsDirRelativePath}');
|
|
81
|
-
const userProjectLocation = '${process.cwd()}';
|
|
81
|
+
const userProjectLocation = '${process.cwd().replace(/\\/g, '/')}';
|
|
82
82
|
/** @type {import('next').NextConfig} */
|
|
83
83
|
module.exports = {
|
|
84
84
|
env: {
|
|
85
85
|
NEXT_PUBLIC_IS_BUILDING: 'true',
|
|
86
86
|
EMAILS_DIR_RELATIVE_PATH: emailsDirRelativePath,
|
|
87
87
|
EMAILS_DIR_ABSOLUTE_PATH: path.resolve(userProjectLocation, emailsDirRelativePath),
|
|
88
|
-
PREVIEW_SERVER_LOCATION: '${builtPreviewAppPath}',
|
|
88
|
+
PREVIEW_SERVER_LOCATION: '${builtPreviewAppPath.replace(/\\/g, '/')}',
|
|
89
89
|
USER_PROJECT_LOCATION: userProjectLocation
|
|
90
90
|
},
|
|
91
91
|
// this is needed so that the code for building emails works properly
|
|
@@ -154,9 +154,9 @@ const forceSSGForEmailPreviews = async (
|
|
|
154
154
|
emailsDirPath: string,
|
|
155
155
|
builtPreviewAppPath: string,
|
|
156
156
|
) => {
|
|
157
|
-
const emailDirectoryMetadata =
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
const emailDirectoryMetadata = (await getEmailsDirectoryMetadata(
|
|
158
|
+
emailsDirPath,
|
|
159
|
+
))!;
|
|
160
160
|
|
|
161
161
|
const parameters = getEmailSlugsFromEmailDirectory(
|
|
162
162
|
emailDirectoryMetadata,
|
|
@@ -7,7 +7,7 @@ vi.mock('@babel/traverse', async () => {
|
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
describe('getImportedModules()', () => {
|
|
10
|
-
it('
|
|
10
|
+
it('works with this test file', async () => {
|
|
11
11
|
const contents = await fs.readFile(import.meta.filename, 'utf8');
|
|
12
12
|
|
|
13
13
|
expect(getImportedModules(contents)).toEqual([
|
|
@@ -16,7 +16,7 @@ describe('getImportedModules()', () => {
|
|
|
16
16
|
]);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
it('
|
|
19
|
+
it('works with direct exports', () => {
|
|
20
20
|
const contents = `export * from './component-a';
|
|
21
21
|
export { ComponentB } from './component-b';
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ describe('getImportedModules()', () => {
|
|
|
29
29
|
]);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
it('
|
|
32
|
+
it('works with regular imports and double quotes', () => {
|
|
33
33
|
const contents = `import {
|
|
34
34
|
Body,
|
|
35
35
|
Button,
|
|
@@ -59,7 +59,7 @@ import * as React from "react";
|
|
|
59
59
|
]);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
it('
|
|
62
|
+
it('works with regular imports and single quotes', () => {
|
|
63
63
|
const contents = `import {
|
|
64
64
|
Body,
|
|
65
65
|
Button,
|
|
@@ -89,7 +89,7 @@ import * as React from 'react';
|
|
|
89
89
|
]);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
it('
|
|
92
|
+
it('works with commonjs require with double quotes', () => {
|
|
93
93
|
const contents = `const {
|
|
94
94
|
Body,
|
|
95
95
|
Button,
|
|
@@ -119,7 +119,7 @@ const React = require("react");
|
|
|
119
119
|
]);
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
-
it('
|
|
122
|
+
it('works with commonjs require with single quotes', () => {
|
|
123
123
|
const contents = `const {
|
|
124
124
|
Body,
|
|
125
125
|
Button,
|
|
@@ -83,8 +83,6 @@ export const startDevServer = async (
|
|
|
83
83
|
const { portAlreadyInUse } = await safeAsyncServerListen(devServer, port);
|
|
84
84
|
|
|
85
85
|
if (!portAlreadyInUse) {
|
|
86
|
-
// this errors when linting but doesn't on the editor so ignore the warning on this
|
|
87
|
-
/* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access */
|
|
88
86
|
console.log(
|
|
89
87
|
styleText('greenBright', ` React Email ${packageJson.version}`),
|
|
90
88
|
);
|