react-email 4.2.2 → 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,11 @@
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
+
3
9
  ## 4.2.2
4
10
 
5
11
  ### Patch Changes
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.2",
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-email",
3
- "version": "4.2.2",
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