react-email 4.2.1 → 4.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # react-email
2
2
 
3
+ ## 4.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 8259eeb: fix files with extension-like suffixes (i.e. config, .spec) breaking dependency graph
8
+
9
+ ## 4.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - eb7f0ac: dev server erroring when trying to startup with port already being used
14
+
3
15
  ## 4.2.1
4
16
 
5
17
  ## 4.2.0
package/dist/index.js CHANGED
@@ -106,7 +106,7 @@ import prompts from "prompts";
106
106
  // package.json
107
107
  var package_default = {
108
108
  name: "react-email",
109
- version: "4.2.1",
109
+ version: "4.2.3",
110
110
  description: "A live preview of your emails right in your browser.",
111
111
  bin: {
112
112
  email: "./dist/index.js"
@@ -556,9 +556,10 @@ var readAllFilesInsideDirectory = async (directory) => {
556
556
  }
557
557
  return allFilePaths;
558
558
  };
559
+ var javascriptExtensions = [".js", ".ts", ".jsx", ".tsx", ".mjs", ".cjs"];
559
560
  var isJavascriptModule = (filePath) => {
560
561
  const extensionName = path5.extname(filePath);
561
- return [".js", ".ts", ".jsx", ".tsx", ".mjs", ".cjs"].includes(extensionName);
562
+ return javascriptExtensions.includes(extensionName);
562
563
  };
563
564
  var checkFileExtensionsUntilItExists = (pathWithoutExtension) => {
564
565
  if (existsSync(`${pathWithoutExtension}.ts`)) {
@@ -634,11 +635,16 @@ var createDependencyGraph = async (directory) => {
634
635
  }
635
636
  const extension = path5.extname(pathToDependencyFromDirectory);
636
637
  const pathWithEnsuredExtension = (() => {
637
- if (extension.length > 0 && existsSync(pathToDependencyFromDirectory)) {
638
- return pathToDependencyFromDirectory;
638
+ if (extension.length > 0 && javascriptExtensions.includes(extension)) {
639
+ if (existsSync(pathToDependencyFromDirectory)) {
640
+ return pathToDependencyFromDirectory;
641
+ }
642
+ return checkFileExtensionsUntilItExists(
643
+ pathToDependencyFromDirectory.replace(extension, "")
644
+ );
639
645
  }
640
646
  return checkFileExtensionsUntilItExists(
641
- pathToDependencyFromDirectory.replace(extension, "")
647
+ pathToDependencyFromDirectory
642
648
  );
643
649
  })();
644
650
  if (pathWithEnsuredExtension) {
@@ -934,7 +940,6 @@ var startDevServer = async (emailsDirRelativePath, staticBaseDirRelativePath, po
934
940
  }
935
941
  const previewServerLocation = await getPreviewServerLocation();
936
942
  const previewServer = createJiti2(previewServerLocation);
937
- const { default: next } = await previewServer.import("next");
938
943
  devServer = http.createServer((req, res) => {
939
944
  if (!req.url) {
940
945
  res.end(404);
@@ -1005,6 +1010,12 @@ var startDevServer = async (emailsDirRelativePath, staticBaseDirRelativePath, po
1005
1010
  process.cwd()
1006
1011
  )
1007
1012
  };
1013
+ const next = await previewServer.import(
1014
+ "next",
1015
+ {
1016
+ default: true
1017
+ }
1018
+ );
1008
1019
  const app = next({
1009
1020
  // passing in env here does not get the environment variables there
1010
1021
  dev: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-email",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "description": "A live preview of your emails right in your browser.",
5
5
  "bin": {
6
6
  "email": "./dist/index.js"
@@ -34,10 +34,12 @@ const readAllFilesInsideDirectory = async (directory: string) => {
34
34
  return allFilePaths;
35
35
  };
36
36
 
37
+ const javascriptExtensions = ['.js', '.ts', '.jsx', '.tsx', '.mjs', '.cjs'];
38
+
37
39
  const isJavascriptModule = (filePath: string) => {
38
40
  const extensionName = path.extname(filePath);
39
41
 
40
- return ['.js', '.ts', '.jsx', '.tsx', '.mjs', '.cjs'].includes(extensionName);
42
+ return javascriptExtensions.includes(extensionName);
41
43
  };
42
44
 
43
45
  const checkFileExtensionsUntilItExists = (
@@ -144,12 +146,17 @@ export const createDependencyGraph = async (directory: string) => {
144
146
  const pathWithEnsuredExtension = (() => {
145
147
  if (
146
148
  extension.length > 0 &&
147
- existsSync(pathToDependencyFromDirectory)
149
+ javascriptExtensions.includes(extension)
148
150
  ) {
149
- return pathToDependencyFromDirectory;
151
+ if (existsSync(pathToDependencyFromDirectory)) {
152
+ return pathToDependencyFromDirectory;
153
+ }
154
+ return checkFileExtensionsUntilItExists(
155
+ pathToDependencyFromDirectory.replace(extension, ''),
156
+ );
150
157
  }
151
158
  return checkFileExtensionsUntilItExists(
152
- pathToDependencyFromDirectory.replace(extension, ''),
159
+ pathToDependencyFromDirectory,
153
160
  );
154
161
  })();
155
162
 
@@ -43,9 +43,6 @@ export const startDevServer = async (
43
43
  const previewServerLocation = await getPreviewServerLocation();
44
44
  const previewServer = createJiti(previewServerLocation);
45
45
 
46
- const { default: next } =
47
- await previewServer.import<typeof import('next')>('next');
48
-
49
46
  devServer = http.createServer((req, res) => {
50
47
  if (!req.url) {
51
48
  res.end(404);
@@ -137,6 +134,13 @@ export const startDevServer = async (
137
134
  ),
138
135
  };
139
136
 
137
+ const next = await previewServer.import<typeof import('next')['default']>(
138
+ 'next',
139
+ {
140
+ default: true,
141
+ },
142
+ );
143
+
140
144
  const app = next({
141
145
  // passing in env here does not get the environment variables there
142
146
  dev: false,