react-email 3.0.4 → 3.0.6

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.
Files changed (115) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cli/index.js +87 -92
  3. package/dist/cli/index.mjs +28 -20
  4. package/dist/preview/.next/BUILD_ID +1 -1
  5. package/dist/preview/.next/app-build-manifest.json +31 -31
  6. package/dist/preview/.next/app-path-routes-manifest.json +1 -1
  7. package/dist/preview/.next/build-manifest.json +14 -14
  8. package/dist/preview/.next/cache/.rscinfo +1 -1
  9. package/dist/preview/.next/cache/eslint/.cache_1c3sgg +1 -0
  10. package/dist/preview/.next/cache/webpack/client-production/0.pack +0 -0
  11. package/dist/preview/.next/cache/webpack/client-production/index.pack +0 -0
  12. package/dist/preview/.next/cache/webpack/edge-server-production/index.pack +0 -0
  13. package/dist/preview/.next/cache/webpack/server-production/0.pack +0 -0
  14. package/dist/preview/.next/cache/webpack/server-production/index.pack +0 -0
  15. package/dist/preview/.next/diagnostics/framework.json +1 -1
  16. package/dist/preview/.next/next-minimal-server.js.nft.json +1 -1
  17. package/dist/preview/.next/next-server.js.nft.json +1 -1
  18. package/dist/preview/.next/prerender-manifest.json +1 -1
  19. package/dist/preview/.next/required-server-files.json +1 -1
  20. package/dist/preview/.next/server/app/_not-found/page.js +1 -1
  21. package/dist/preview/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/dist/preview/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/dist/preview/.next/server/app/favicon.ico/route.js +1 -1
  24. package/dist/preview/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  25. package/dist/preview/.next/server/app/page.js +1 -1
  26. package/dist/preview/.next/server/app/page.js.nft.json +1 -1
  27. package/dist/preview/.next/server/app/page_client-reference-manifest.js +1 -1
  28. package/dist/preview/.next/server/app/preview/[...slug]/page.js +7 -6
  29. package/dist/preview/.next/server/app/preview/[...slug]/page.js.nft.json +1 -1
  30. package/dist/preview/.next/server/app/preview/[...slug]/page_client-reference-manifest.js +1 -1
  31. package/dist/preview/.next/server/app-paths-manifest.json +1 -1
  32. package/dist/preview/.next/server/chunks/196.js +5 -0
  33. package/dist/preview/.next/server/chunks/300.js +13 -0
  34. package/dist/preview/.next/server/chunks/391.js +1 -0
  35. package/dist/preview/.next/server/chunks/631.js +6 -0
  36. package/dist/preview/.next/server/chunks/720.js +10 -0
  37. package/dist/preview/.next/server/middleware-build-manifest.js +1 -1
  38. package/dist/preview/.next/server/next-font-manifest.js +1 -1
  39. package/dist/preview/.next/server/next-font-manifest.json +1 -1
  40. package/dist/preview/.next/server/pages/500.html +1 -1
  41. package/dist/preview/.next/server/pages/_app.js +1 -1
  42. package/dist/preview/.next/server/pages/_app.js.nft.json +1 -1
  43. package/dist/preview/.next/server/pages/_document.js +1 -1
  44. package/dist/preview/.next/server/pages/_document.js.nft.json +1 -1
  45. package/dist/preview/.next/server/pages/_error.js +1 -1
  46. package/dist/preview/.next/server/pages/_error.js.nft.json +1 -1
  47. package/dist/preview/.next/server/server-reference-manifest.js +1 -1
  48. package/dist/preview/.next/server/server-reference-manifest.json +1 -1
  49. package/dist/preview/.next/static/Trk1e7GzgKOLunAXBDCy-/_buildManifest.js +1 -0
  50. package/dist/preview/.next/static/chunks/12-b9450aa0845e7574.js +1 -0
  51. package/dist/preview/.next/static/chunks/154-4202f86af36ccff4.js +1 -0
  52. package/dist/preview/.next/static/chunks/447-886131c35ca42b91.js +1 -0
  53. package/dist/preview/.next/static/chunks/5fec7a0a-5179023f3f5a9421.js +1 -0
  54. package/dist/preview/.next/static/chunks/797-46f6c20952f0a280.js +2 -0
  55. package/dist/preview/.next/static/chunks/{677-dd9544a8249ca33a.js → 860-38d96c8819ba6f19.js} +1 -1
  56. package/dist/preview/.next/static/chunks/app/_not-found/page-96d3eac723be3ee2.js +1 -0
  57. package/dist/preview/.next/static/chunks/app/layout-a2901ed1c2c53661.js +1 -0
  58. package/dist/preview/.next/static/chunks/app/page-54a86772095e22e0.js +1 -0
  59. package/dist/preview/.next/static/chunks/app/preview/[...slug]/page-2bfad134b65ddd79.js +1 -0
  60. package/dist/preview/.next/static/chunks/framework-e7cae9cecd5c9ba2.js +1 -0
  61. package/dist/preview/.next/static/chunks/main-app-cd104297c6bcc87e.js +1 -0
  62. package/dist/preview/.next/static/chunks/main-df761fde212f9cda.js +1 -0
  63. package/dist/preview/.next/static/chunks/pages/_app-203a61b355820ccf.js +1 -0
  64. package/dist/preview/.next/static/chunks/pages/_error-1764ca54938748c8.js +1 -0
  65. package/dist/preview/.next/static/chunks/{webpack-08c76d9f8dd5b0f0.js → webpack-9255716c9496e606.js} +1 -1
  66. package/dist/preview/.next/static/css/{eecb5c96aca6bd9e.css → ec5d7e66bd3b6cb8.css} +1 -1
  67. package/dist/preview/.next/trace +21 -2
  68. package/dist/preview/.next/types/app/layout.ts +1 -1
  69. package/dist/preview/.next/types/app/preview/[...slug]/page.ts +1 -1
  70. package/dist/preview/.next/types/cache-life.d.ts +2 -0
  71. package/next-env.d.ts +1 -1
  72. package/package.json +6 -6
  73. package/src/actions/get-email-path-from-slug.ts +3 -2
  74. package/src/actions/get-emails-directory-metadata-action.ts +19 -0
  75. package/src/actions/render-email-by-path.tsx +16 -5
  76. package/src/app/layout.tsx +1 -1
  77. package/src/app/preview/[...slug]/page.tsx +20 -10
  78. package/src/app/preview/[...slug]/preview.tsx +6 -7
  79. package/src/components/sidebar/sidebar-directory-children.tsx +1 -1
  80. package/src/components/sidebar/sidebar-directory.tsx +1 -1
  81. package/src/contexts/emails.tsx +5 -61
  82. package/src/hooks/use-email-rendering-result.ts +44 -0
  83. package/src/hooks/use-rendering-metadata.ts +5 -5
  84. package/src/{actions → utils}/get-emails-directory-metadata.spec.ts +2 -1
  85. package/src/{actions → utils}/get-emails-directory-metadata.ts +0 -1
  86. package/src/utils/types/hot-reload-event.ts +3 -6
  87. package/dist/preview/.next/cache/eslint/.cache_117y9un +0 -1
  88. package/dist/preview/.next/cache/webpack/client-production/1.pack +0 -0
  89. package/dist/preview/.next/cache/webpack/client-production/2.pack +0 -0
  90. package/dist/preview/.next/cache/webpack/client-production/index.pack.old +0 -0
  91. package/dist/preview/.next/cache/webpack/server-production/1.pack +0 -0
  92. package/dist/preview/.next/cache/webpack/server-production/index.pack.old +0 -0
  93. package/dist/preview/.next/server/chunks/185.js +0 -1
  94. package/dist/preview/.next/server/chunks/270.js +0 -10
  95. package/dist/preview/.next/server/chunks/323.js +0 -4
  96. package/dist/preview/.next/server/chunks/867.js +0 -7
  97. package/dist/preview/.next/server/chunks/887.js +0 -5
  98. package/dist/preview/.next/server/chunks/931.js +0 -6
  99. package/dist/preview/.next/server/chunks/945.js +0 -13
  100. package/dist/preview/.next/static/chunks/131-f4d810c5beddfab6.js +0 -2
  101. package/dist/preview/.next/static/chunks/174-3e37f7e70124a32b.js +0 -1
  102. package/dist/preview/.next/static/chunks/406-3d68715e81289266.js +0 -1
  103. package/dist/preview/.next/static/chunks/41423bf1-6f7e6cd2fc1291c3.js +0 -1
  104. package/dist/preview/.next/static/chunks/968-7fddcc3bfb4ada61.js +0 -1
  105. package/dist/preview/.next/static/chunks/app/_not-found/page-53e238cd8965175e.js +0 -1
  106. package/dist/preview/.next/static/chunks/app/layout-94f263ae274f6f80.js +0 -1
  107. package/dist/preview/.next/static/chunks/app/page-68f0897ebaef4c9c.js +0 -1
  108. package/dist/preview/.next/static/chunks/app/preview/[...slug]/page-823cfe936f21397d.js +0 -1
  109. package/dist/preview/.next/static/chunks/framework-9780ea70a2600e73.js +0 -1
  110. package/dist/preview/.next/static/chunks/main-app-d2690e9b3dbe4561.js +0 -1
  111. package/dist/preview/.next/static/chunks/main-f2abbba525af0515.js +0 -1
  112. package/dist/preview/.next/static/chunks/pages/_app-ac8e4ba1a8597f2e.js +0 -1
  113. package/dist/preview/.next/static/chunks/pages/_error-88e591eedab147f8.js +0 -1
  114. package/dist/preview/.next/static/yKpx8LQApEcHL50eu16RD/_buildManifest.js +0 -1
  115. /package/dist/preview/.next/static/{yKpx8LQApEcHL50eu16RD → Trk1e7GzgKOLunAXBDCy-}/_ssgManifest.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # react-email
2
2
 
3
+ ## 3.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - c6fcd94: Fix preview server crashing without React 19
8
+
9
+ ## 3.0.5
10
+
11
+ ### Patch Changes
12
+
13
+ - 7337d04: Fix emails being re-rendered each time there is navigation in the preview server
14
+
3
15
  ## 3.0.4
4
16
 
5
17
  ### Patch Changes
package/dist/cli/index.js CHANGED
@@ -340,7 +340,7 @@ var import_commander = require("commander");
340
340
  // package.json
341
341
  var package_default = {
342
342
  name: "react-email",
343
- version: "3.0.4",
343
+ version: "3.0.6",
344
344
  description: "A live preview of your emails right in your browser.",
345
345
  bin: {
346
346
  email: "./dist/cli/index.js"
@@ -370,14 +370,14 @@ var package_default = {
370
370
  "@babel/core": "7.24.5",
371
371
  "@babel/parser": "7.24.5",
372
372
  chalk: "4.1.2",
373
- chokidar: "^4.0.1",
373
+ chokidar: "4.0.3",
374
374
  commander: "11.1.0",
375
375
  debounce: "2.0.0",
376
376
  esbuild: "0.19.11",
377
377
  glob: "10.3.4",
378
378
  "log-symbols": "4.1.0",
379
379
  "mime-types": "2.1.35",
380
- next: "15.0.4",
380
+ next: "15.1.2",
381
381
  "normalize-path": "3.0.0",
382
382
  ora: "5.4.1",
383
383
  "socket.io": "4.8.0"
@@ -394,13 +394,13 @@ var package_default = {
394
394
  "@types/babel__core": "7.20.5",
395
395
  "@types/fs-extra": "11.0.1",
396
396
  "@types/mime-types": "2.1.4",
397
- "@types/node": "18.0.0",
397
+ "@types/node": "22.10.2",
398
398
  "@types/normalize-path": "3.0.2",
399
399
  "@types/react": "^19",
400
400
  "@types/react-dom": "^19",
401
401
  "@types/webpack": "5.28.5",
402
402
  "@vercel/style-guide": "5.1.0",
403
- autoprefixer: "10.4.14",
403
+ autoprefixer: "10.4.20",
404
404
  clsx: "2.1.0",
405
405
  eslint: "8.50.0",
406
406
  "eslint-config-prettier": "9.0.0",
@@ -508,7 +508,8 @@ var getTreeLines = function() {
508
508
  childDirents.sort(function(a, b) {
509
509
  if (a.isDirectory() && b.isFile()) {
510
510
  return -1;
511
- } else if (a.isFile() && b.isDirectory()) {
511
+ }
512
+ if (a.isFile() && b.isDirectory()) {
512
513
  return 1;
513
514
  }
514
515
  return b.name > a.name ? -1 : 1;
@@ -569,12 +570,12 @@ var tree = function() {
569
570
  };
570
571
  }();
571
572
  // src/cli/utils/preview/hot-reloading/setup-hot-reloading.ts
572
- var import_node_path5 = __toESM(require("path"));
573
+ var import_node_path6 = __toESM(require("path"));
573
574
  var import_socket = require("socket.io");
574
575
  var import_chokidar = require("chokidar");
575
576
  var import_debounce = __toESM(require("debounce"));
576
577
  // src/cli/utils/preview/hot-reloading/create-dependency-graph.ts
577
- var import_node_path4 = __toESM(require("path"));
578
+ var import_node_path5 = __toESM(require("path"));
578
579
  var import_node_fs3 = require("fs");
579
580
  // src/cli/utils/preview/hot-reloading/get-imported-modules.ts
580
581
  var import_core = require("@babel/core");
@@ -621,7 +622,7 @@ var getImportedModules = function(contents) {
621
622
  return importedPaths;
622
623
  };
623
624
  // src/cli/utils/preview/start-dev-server.ts
624
- var import_node_path3 = __toESM(require("path"));
625
+ var import_node_path4 = __toESM(require("path"));
625
626
  var import_node_http = __toESM(require("http"));
626
627
  var import_node_url = __toESM(require("url"));
627
628
  var import_next = __toESM(require("next"));
@@ -718,11 +719,11 @@ var serveStaticFile = function() {
718
719
  };
719
720
  }();
720
721
  // src/cli/utils/preview/get-env-variables-for-preview-app.ts
721
- var import_path = __toESM(require("path"));
722
+ var import_node_path3 = __toESM(require("path"));
722
723
  var getEnvVariablesForPreviewApp = function(relativePathToEmailsDirectory, cwd) {
723
724
  return {
724
725
  EMAILS_DIR_RELATIVE_PATH: relativePathToEmailsDirectory,
725
- EMAILS_DIR_ABSOLUTE_PATH: import_path.default.resolve(cwd, relativePathToEmailsDirectory),
726
+ EMAILS_DIR_ABSOLUTE_PATH: import_node_path3.default.resolve(cwd, relativePathToEmailsDirectory),
726
727
  USER_PROJECT_LOCATION: cwd
727
728
  };
728
729
  };
@@ -744,9 +745,9 @@ var safeAsyncServerListen = function(server, port) {
744
745
  });
745
746
  });
746
747
  };
747
- var isDev = !__filename.endsWith(import_node_path3.default.join("cli", "index.js"));
748
- var cliPacakgeLocation = isDev ? import_node_path3.default.resolve(__dirname, "../../../..") : import_node_path3.default.resolve(__dirname, "../..");
749
- var previewServerLocation = isDev ? import_node_path3.default.resolve(__dirname, "../../../..") : import_node_path3.default.resolve(__dirname, "../preview");
748
+ var isDev = !__filename.endsWith(import_node_path4.default.join("cli", "index.js"));
749
+ var cliPacakgeLocation = isDev ? import_node_path4.default.resolve(__dirname, "../../../..") : import_node_path4.default.resolve(__dirname, "../..");
750
+ var previewServerLocation = isDev ? import_node_path4.default.resolve(__dirname, "../../../..") : import_node_path4.default.resolve(__dirname, "../preview");
750
751
  var startDevServer = function() {
751
752
  var _ref = _async_to_generator(function(emailsDirRelativePath, staticBaseDirRelativePath, port) {
752
753
  var portAlreadyInUse, nextPortToTry, spinner, timeBeforeNextReady, app, isNextReady, nextReadyPromise, nextHandleRequest, secondsToNextReady;
@@ -824,7 +825,7 @@ var startDevServer = function() {
824
825
  process.env = _object_spread(_object_spread_props(_object_spread({}, process.env), {
825
826
  NODE_ENV: "development"
826
827
  }), getEnvVariablesForPreviewApp(// If we don't do normalization here, stuff like https://github.com/resend/react-email/issues/1354 happens.
827
- import_node_path3.default.normalize(emailsDirRelativePath), process.cwd()));
828
+ import_node_path4.default.normalize(emailsDirRelativePath), process.cwd()));
828
829
  app = (0, import_next.default)({
829
830
  // passing in env here does not get the environment variables there
830
831
  dev: isDev,
@@ -932,7 +933,7 @@ var readAllFilesInsideDirectory = function() {
932
933
  ];
933
934
  _value = _step.value;
934
935
  dirent = _value;
935
- pathToDirent = import_node_path4.default.join(directory, dirent.name);
936
+ pathToDirent = import_node_path5.default.join(directory, dirent.name);
936
937
  if (!dirent.isDirectory()) return [
937
938
  3,
938
939
  6
@@ -1019,7 +1020,7 @@ var readAllFilesInsideDirectory = function() {
1019
1020
  };
1020
1021
  }();
1021
1022
  var isJavascriptModule = function(filePath) {
1022
- var extensionName = import_node_path4.default.extname(filePath);
1023
+ var extensionName = import_node_path5.default.extname(filePath);
1023
1024
  return [
1024
1025
  ".js",
1025
1026
  ".ts",
@@ -1032,15 +1033,20 @@ var isJavascriptModule = function(filePath) {
1032
1033
  var checkFileExtensionsUntilItExists = function(pathWithoutExtension) {
1033
1034
  if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".ts"))) {
1034
1035
  return "".concat(pathWithoutExtension, ".ts");
1035
- } else if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".tsx"))) {
1036
+ }
1037
+ if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".tsx"))) {
1036
1038
  return "".concat(pathWithoutExtension, ".tsx");
1037
- } else if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".js"))) {
1039
+ }
1040
+ if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".js"))) {
1038
1041
  return "".concat(pathWithoutExtension, ".js");
1039
- } else if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".jsx"))) {
1042
+ }
1043
+ if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".jsx"))) {
1040
1044
  return "".concat(pathWithoutExtension, ".jsx");
1041
- } else if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".mjs"))) {
1045
+ }
1046
+ if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".mjs"))) {
1042
1047
  return "".concat(pathWithoutExtension, ".mjs");
1043
- } else if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".cjs"))) {
1048
+ }
1049
+ if ((0, import_node_fs3.existsSync)("".concat(pathWithoutExtension, ".cjs"))) {
1044
1050
  return "".concat(pathWithoutExtension, ".cjs");
1045
1051
  }
1046
1052
  };
@@ -1083,14 +1089,14 @@ var createDependencyGraph = function() {
1083
1089
  importedPaths = getImportedModules(contents);
1084
1090
  importedPathsRelativeToDirectory = importedPaths.map(function(dependencyPath) {
1085
1091
  var isModulePath = !dependencyPath.startsWith(".");
1086
- if (!isModulePath && !import_node_path4.default.isAbsolute(dependencyPath)) {
1087
- var pathToDependencyFromDirectory = import_node_path4.default.resolve(/*
1092
+ if (!isModulePath && !import_node_path5.default.isAbsolute(dependencyPath)) {
1093
+ var pathToDependencyFromDirectory = import_node_path5.default.resolve(/*
1088
1094
  path.resolve resolves paths differently from what imports on javascript do.
1089
1095
 
1090
1096
  So if we wouldn't do this, for an email at "/path/to/email.tsx" with a dependecy path of "./other-email"
1091
1097
  would end up going into /path/to/email.tsx/other-email instead of /path/to/other-email which is the
1092
1098
  one the import is meant to go to
1093
- */ import_node_path4.default.dirname(filePath), dependencyPath);
1099
+ */ import_node_path5.default.dirname(filePath), dependencyPath);
1094
1100
  var isDirectory = false;
1095
1101
  try {
1096
1102
  isDirectory = (0, import_node_fs3.statSync)(pathToDependencyFromDirectory).isDirectory();
@@ -1109,7 +1115,7 @@ var createDependencyGraph = function() {
1109
1115
  if (pathWithExtension1) {
1110
1116
  pathToDependencyFromDirectory = pathWithExtension1;
1111
1117
  } else if (isDev) {
1112
- console.warn("Could not determine the file extension for the file at ".concat(pathWithExtension1));
1118
+ console.warn("Could not determine the file extension for the file at ".concat(pathToDependencyFromDirectory));
1113
1119
  }
1114
1120
  }
1115
1121
  return pathToDependencyFromDirectory;
@@ -1118,10 +1124,10 @@ var createDependencyGraph = function() {
1118
1124
  }
1119
1125
  });
1120
1126
  moduleDependencies = importedPathsRelativeToDirectory.filter(function(dependencyPath) {
1121
- return !dependencyPath.startsWith(".") && !import_node_path4.default.isAbsolute(dependencyPath);
1127
+ return !dependencyPath.startsWith(".") && !import_node_path5.default.isAbsolute(dependencyPath);
1122
1128
  });
1123
1129
  nonNodeModuleImportPathsRelativeToDirectory = importedPathsRelativeToDirectory.filter(function(dependencyPath) {
1124
- return dependencyPath.startsWith(".") || import_node_path4.default.isAbsolute(dependencyPath);
1130
+ return dependencyPath.startsWith(".") || import_node_path5.default.isAbsolute(dependencyPath);
1125
1131
  });
1126
1132
  return [
1127
1133
  2,
@@ -1659,7 +1665,7 @@ var setupHotreloading = function() {
1659
1665
  });
1660
1666
  changes = [];
1661
1667
  }, 150);
1662
- absolutePathToEmailsDirectory = import_node_path5.default.resolve(process.cwd(), emailDirRelativePath);
1668
+ absolutePathToEmailsDirectory = import_node_path6.default.resolve(process.cwd(), emailDirRelativePath);
1663
1669
  return [
1664
1670
  4,
1665
1671
  createDependencyGraph(absolutePathToEmailsDirectory)
@@ -1675,7 +1681,7 @@ var setupHotreloading = function() {
1675
1681
  });
1676
1682
  getFilesOutsideEmailsDirectory = function() {
1677
1683
  return Object.keys(dependencyGraph).filter(function(p) {
1678
- return import_node_path5.default.relative(absolutePathToEmailsDirectory, p).startsWith("..");
1684
+ return import_node_path6.default.relative(absolutePathToEmailsDirectory, p).startsWith("..");
1679
1685
  });
1680
1686
  };
1681
1687
  filesOutsideEmailsDirectory = getFilesOutsideEmailsDirectory();
@@ -1728,13 +1734,13 @@ var setupHotreloading = function() {
1728
1734
  return _ts_generator(this, function(_state) {
1729
1735
  switch(_state.label){
1730
1736
  case 0:
1731
- file = relativePathToChangeTarget.split(import_node_path5.default.sep);
1737
+ file = relativePathToChangeTarget.split(import_node_path6.default.sep);
1732
1738
  if (file.length === 0) {
1733
1739
  return [
1734
1740
  2
1735
1741
  ];
1736
1742
  }
1737
- pathToChangeTarget = import_node_path5.default.resolve(absolutePathToEmailsDirectory, relativePathToChangeTarget);
1743
+ pathToChangeTarget = import_node_path6.default.resolve(absolutePathToEmailsDirectory, relativePathToChangeTarget);
1738
1744
  return [
1739
1745
  4,
1740
1746
  updateDependencyGraph(event, pathToChangeTarget)
@@ -1797,7 +1803,7 @@ var setupHotreloading = function() {
1797
1803
  dependentPath = _step2.value;
1798
1804
  changes.push({
1799
1805
  event: "change",
1800
- filename: import_node_path5.default.relative(absolutePathToEmailsDirectory, dependentPath)
1806
+ filename: import_node_path6.default.relative(absolutePathToEmailsDirectory, dependentPath)
1801
1807
  });
1802
1808
  }
1803
1809
  } catch (err) {
@@ -1859,7 +1865,7 @@ var dev = function() {
1859
1865
  return [
1860
1866
  4,
1861
1867
  startDevServer(emailsDirRelativePath, emailsDirRelativePath, // defaults to ./emails/static for the static files that are served to the preview
1862
- parseInt(port))
1868
+ Number.parseInt(port))
1863
1869
  ];
1864
1870
  case 2:
1865
1871
  devServer2 = _state.sent();
@@ -1894,19 +1900,19 @@ var dev = function() {
1894
1900
  }();
1895
1901
  // src/cli/commands/export.ts
1896
1902
  var import_node_fs7 = __toESM(require("fs"));
1897
- var import_node_path8 = __toESM(require("path"));
1903
+ var import_node_path9 = __toESM(require("path"));
1898
1904
  var import_glob = require("glob");
1899
1905
  var import_esbuild = require("esbuild");
1900
1906
  var import_ora2 = __toESM(require("ora"));
1901
1907
  var import_log_symbols3 = __toESM(require("log-symbols"));
1902
1908
  var import_normalize_path = __toESM(require("normalize-path"));
1903
- // src/actions/get-emails-directory-metadata.ts
1909
+ // src/utils/get-emails-directory-metadata.ts
1904
1910
  var import_node_fs5 = __toESM(require("fs"));
1905
- var import_node_path6 = __toESM(require("path"));
1911
+ var import_node_path7 = __toESM(require("path"));
1906
1912
  var isFileAnEmail = function(fullPath) {
1907
1913
  var stat = import_node_fs5.default.statSync(fullPath);
1908
1914
  if (stat.isDirectory()) return false;
1909
- var ext = import_node_path6.default.parse(fullPath).ext;
1915
+ var ext = import_node_path7.default.parse(fullPath).ext;
1910
1916
  if (![
1911
1917
  ".js",
1912
1918
  ".tsx",
@@ -1923,7 +1929,7 @@ var mergeDirectoriesWithSubDirectories = function(emailsDirectoryMetadata) {
1923
1929
  while(currentResultingMergedDirectory.emailFilenames.length === 0 && currentResultingMergedDirectory.subDirectories.length === 1){
1924
1930
  var onlySubDirectory = currentResultingMergedDirectory.subDirectories[0];
1925
1931
  currentResultingMergedDirectory = _object_spread_props(_object_spread({}, onlySubDirectory), {
1926
- directoryName: import_node_path6.default.join(currentResultingMergedDirectory.directoryName, onlySubDirectory.directoryName)
1932
+ directoryName: import_node_path7.default.join(currentResultingMergedDirectory.directoryName, onlySubDirectory.directoryName)
1927
1933
  });
1928
1934
  }
1929
1935
  return currentResultingMergedDirectory;
@@ -1948,16 +1954,16 @@ var getEmailsDirectoryMetadata = function() {
1948
1954
  case 1:
1949
1955
  dirents = _state.sent();
1950
1956
  emailFilenames = dirents.filter(function(dirent) {
1951
- return isFileAnEmail(import_node_path6.default.join(absolutePathToEmailsDirectory, dirent.name));
1957
+ return isFileAnEmail(import_node_path7.default.join(absolutePathToEmailsDirectory, dirent.name));
1952
1958
  }).map(function(dirent) {
1953
- return keepFileExtensions ? dirent.name : dirent.name.replace(import_node_path6.default.extname(dirent.name), "");
1959
+ return keepFileExtensions ? dirent.name : dirent.name.replace(import_node_path7.default.extname(dirent.name), "");
1954
1960
  });
1955
1961
  return [
1956
1962
  4,
1957
1963
  Promise.all(dirents.filter(function(dirent) {
1958
1964
  return dirent.isDirectory() && !dirent.name.startsWith("_") && dirent.name !== "static";
1959
1965
  }).map(function(dirent) {
1960
- var direntAbsolutePath = import_node_path6.default.join(absolutePathToEmailsDirectory, dirent.name);
1966
+ var direntAbsolutePath = import_node_path7.default.join(absolutePathToEmailsDirectory, dirent.name);
1961
1967
  return getEmailsDirectoryMetadata(direntAbsolutePath, keepFileExtensions, true, baseDirectoryPath);
1962
1968
  }))
1963
1969
  ];
@@ -1965,8 +1971,8 @@ var getEmailsDirectoryMetadata = function() {
1965
1971
  subDirectories = _state.sent();
1966
1972
  emailsMetadata = {
1967
1973
  absolutePath: absolutePathToEmailsDirectory,
1968
- relativePath: import_node_path6.default.relative(baseDirectoryPath, absolutePathToEmailsDirectory),
1969
- directoryName: absolutePathToEmailsDirectory.split(import_node_path6.default.sep).pop(),
1974
+ relativePath: import_node_path7.default.relative(baseDirectoryPath, absolutePathToEmailsDirectory),
1975
+ directoryName: absolutePathToEmailsDirectory.split(import_node_path7.default.sep).pop(),
1970
1976
  emailFilenames: emailFilenames,
1971
1977
  subDirectories: subDirectories
1972
1978
  };
@@ -1982,7 +1988,7 @@ var getEmailsDirectoryMetadata = function() {
1982
1988
  };
1983
1989
  }();
1984
1990
  // src/utils/esbuild/renderring-utilities-exporter.ts
1985
- var import_node_path7 = __toESM(require("path"));
1991
+ var import_node_path8 = __toESM(require("path"));
1986
1992
  var import_node_fs6 = require("fs");
1987
1993
  // src/utils/esbuild/escape-string-for-regex.ts
1988
1994
  function escapeStringForRegex(string) {
@@ -2016,7 +2022,7 @@ var renderingUtilitiesExporter = function(emailTemplates) {
2016
2022
  (_tmp.contents = _1.apply(_, [
2017
2023
  _state.sent(),
2018
2024
  ";\n export { render } from 'react-email-module-that-will-export-render'\n export { createElement as reactEmailCreateReactElement } from 'react';\n "
2019
- ]), _tmp.loader = import_node_path7.default.extname(pathToFile).slice(1), _tmp)
2025
+ ]), _tmp.loader = import_node_path8.default.extname(pathToFile).slice(1), _tmp)
2020
2026
  ];
2021
2027
  }
2022
2028
  });
@@ -2078,7 +2084,7 @@ var renderingUtilitiesExporter = function(emailTemplates) {
2078
2084
  var getEmailTemplatesFromDirectory = function(emailDirectory) {
2079
2085
  var templatePaths = [];
2080
2086
  emailDirectory.emailFilenames.forEach(function(filename) {
2081
- return templatePaths.push(import_node_path8.default.join(emailDirectory.absolutePath, filename));
2087
+ return templatePaths.push(import_node_path9.default.join(emailDirectory.absolutePath, filename));
2082
2088
  });
2083
2089
  emailDirectory.subDirectories.forEach(function(directory) {
2084
2090
  var _templatePaths;
@@ -2103,7 +2109,7 @@ var exportTemplates = function() {
2103
2109
  }
2104
2110
  return [
2105
2111
  4,
2106
- getEmailsDirectoryMetadata(import_node_path8.default.resolve(process.cwd(), emailsDirectoryPath), true)
2112
+ getEmailsDirectoryMetadata(import_node_path9.default.resolve(process.cwd(), emailsDirectoryPath), true)
2107
2113
  ];
2108
2114
  case 1:
2109
2115
  emailsDirectoryMetadata = _state.sent();
@@ -2298,12 +2304,12 @@ var exportTemplates = function() {
2298
2304
  spinner.text = "Copying static files";
2299
2305
  spinner.render();
2300
2306
  }
2301
- staticDirectoryPath = import_node_path8.default.join(emailsDirectoryPath, "static");
2307
+ staticDirectoryPath = import_node_path9.default.join(emailsDirectoryPath, "static");
2302
2308
  if (!import_node_fs7.default.existsSync(staticDirectoryPath)) return [
2303
2309
  3,
2304
2310
  25
2305
2311
  ];
2306
- pathToDumpStaticFilesInto = import_node_path8.default.join(pathToWhereEmailMarkupShouldBeDumped, "static");
2312
+ pathToDumpStaticFilesInto = import_node_path9.default.join(pathToWhereEmailMarkupShouldBeDumped, "static");
2307
2313
  if (!import_node_fs7.default.existsSync(pathToDumpStaticFilesInto)) return [
2308
2314
  3,
2309
2315
  22
@@ -2382,7 +2388,7 @@ var exportTemplates = function() {
2382
2388
  }();
2383
2389
  // src/cli/commands/build.ts
2384
2390
  var import_node_fs8 = __toESM(require("fs"));
2385
- var import_node_path9 = __toESM(require("path"));
2391
+ var import_node_path10 = __toESM(require("path"));
2386
2392
  var import_ora3 = __toESM(require("ora"));
2387
2393
  var import_node_child_process = require("child_process");
2388
2394
  var import_log_symbols4 = __toESM(require("log-symbols"));
@@ -2415,7 +2421,7 @@ var setNextEnvironmentVariablesForBuild = function() {
2415
2421
  nextConfigContents = "\nconst path = require('path');\nconst emailsDirRelativePath = path.normalize('".concat(emailsDirRelativePath, "');\nconst userProjectLocation = path.resolve(process.cwd(), '../');\n/** @type {import('next').NextConfig} */\nmodule.exports = {\n env: {\n NEXT_PUBLIC_IS_BUILDING: 'true',\n EMAILS_DIR_RELATIVE_PATH: emailsDirRelativePath,\n EMAILS_DIR_ABSOLUTE_PATH: path.resolve(userProjectLocation, emailsDirRelativePath),\n USER_PROJECT_LOCATION: userProjectLocation\n },\n // this is needed so that the code for building emails works properly\n webpack: (\n /** @type {import('webpack').Configuration & { externals: string[] }} */\n config,\n { isServer }\n ) => {\n if (isServer) {\n config.externals.push('esbuild');\n }\n\n return config;\n },\n typescript: {\n ignoreBuildErrors: true\n },\n eslint: {\n ignoreDuringBuilds: true\n },\n experimental: {\n webpackBuildWorker: true\n },\n}");
2416
2422
  return [
2417
2423
  4,
2418
- import_node_fs8.default.promises.writeFile(import_node_path9.default.resolve(builtPreviewAppPath, "./next.config.js"), nextConfigContents, "utf8")
2424
+ import_node_fs8.default.promises.writeFile(import_node_path10.default.resolve(builtPreviewAppPath, "./next.config.js"), nextConfigContents, "utf8")
2419
2425
  ];
2420
2426
  case 1:
2421
2427
  _state.sent();
@@ -2433,7 +2439,7 @@ var getEmailSlugsFromEmailDirectory = function(emailDirectory, emailsDirectoryAb
2433
2439
  var directoryPathRelativeToEmailsDirectory = emailDirectory.absolutePath.replace(emailsDirectoryAbsolutePath, "").trim();
2434
2440
  var slugs = [];
2435
2441
  emailDirectory.emailFilenames.forEach(function(filename) {
2436
- return slugs.push(import_node_path9.default.join(directoryPathRelativeToEmailsDirectory, filename).split(import_node_path9.default.sep).filter(function(segment) {
2442
+ return slugs.push(import_node_path10.default.join(directoryPathRelativeToEmailsDirectory, filename).split(import_node_path10.default.sep).filter(function(segment) {
2437
2443
  return segment.length > 0;
2438
2444
  }));
2439
2445
  });
@@ -2491,19 +2497,19 @@ var forceSSGForEmailPreviews = function() {
2491
2497
  }();
2492
2498
  return [
2493
2499
  4,
2494
- removeForceDynamic(import_node_path9.default.resolve(builtPreviewAppPath, "./src/app/layout.tsx"))
2500
+ removeForceDynamic(import_node_path10.default.resolve(builtPreviewAppPath, "./src/app/layout.tsx"))
2495
2501
  ];
2496
2502
  case 2:
2497
2503
  _state.sent();
2498
2504
  return [
2499
2505
  4,
2500
- removeForceDynamic(import_node_path9.default.resolve(builtPreviewAppPath, "./src/app/preview/[...slug]/page.tsx"))
2506
+ removeForceDynamic(import_node_path10.default.resolve(builtPreviewAppPath, "./src/app/preview/[...slug]/page.tsx"))
2501
2507
  ];
2502
2508
  case 3:
2503
2509
  _state.sent();
2504
2510
  return [
2505
2511
  4,
2506
- import_node_fs8.default.promises.appendFile(import_node_path9.default.resolve(builtPreviewAppPath, "./src/app/preview/[...slug]/page.tsx"), "\n\nexport function generateStaticParams() { \n return Promise.resolve(\n ".concat(JSON.stringify(parameters), "\n );\n}"), "utf8")
2512
+ import_node_fs8.default.promises.appendFile(import_node_path10.default.resolve(builtPreviewAppPath, "./src/app/preview/[...slug]/page.tsx"), "\n\nexport function generateStaticParams() { \n return Promise.resolve(\n ".concat(JSON.stringify(parameters), "\n );\n}"), "utf8")
2507
2513
  ];
2508
2514
  case 4:
2509
2515
  _state.sent();
@@ -2523,7 +2529,7 @@ var updatePackageJson = function() {
2523
2529
  return _ts_generator(this, function(_state) {
2524
2530
  switch(_state.label){
2525
2531
  case 0:
2526
- packageJsonPath = import_node_path9.default.resolve(builtPreviewAppPath, "./package.json");
2532
+ packageJsonPath = import_node_path10.default.resolve(builtPreviewAppPath, "./package.json");
2527
2533
  _ = JSON.parse;
2528
2534
  return [
2529
2535
  4,
@@ -2559,36 +2565,25 @@ var npmInstall = function() {
2559
2565
  return _ts_generator(this, function(_state) {
2560
2566
  return [
2561
2567
  2,
2562
- new Promise(function() {
2563
- var _ref = _async_to_generator(function(resolve, reject) {
2564
- var childProc;
2565
- return _ts_generator(this, function(_state) {
2566
- childProc = (0, import_node_child_process.spawn)(packageManager, [
2567
- "install",
2568
- "--silent",
2569
- "--include=dev"
2570
- ], {
2571
- cwd: builtPreviewAppPath,
2572
- shell: true
2573
- });
2574
- childProc.stdout.pipe(process.stdout);
2575
- childProc.stderr.pipe(process.stderr);
2576
- childProc.on("close", function(code) {
2577
- if (code === 0) {
2578
- resolve();
2579
- } else {
2580
- reject(new Error("Unable to install the dependencies and it exited with code: ".concat(code)));
2581
- }
2582
- });
2583
- return [
2584
- 2
2585
- ];
2586
- });
2568
+ new Promise(function(resolve, reject) {
2569
+ var childProc = (0, import_node_child_process.spawn)(packageManager, [
2570
+ "install",
2571
+ "--silent",
2572
+ "--include=dev"
2573
+ ], {
2574
+ cwd: builtPreviewAppPath,
2575
+ shell: true
2587
2576
  });
2588
- return function(resolve, reject) {
2589
- return _ref.apply(this, arguments);
2590
- };
2591
- }())
2577
+ childProc.stdout.pipe(process.stdout);
2578
+ childProc.stderr.pipe(process.stderr);
2579
+ childProc.on("close", function(code) {
2580
+ if (code === 0) {
2581
+ resolve();
2582
+ } else {
2583
+ reject(new Error("Unable to install the dependencies and it exited with code: ".concat(code)));
2584
+ }
2585
+ });
2586
+ })
2592
2587
  ];
2593
2588
  });
2594
2589
  });
@@ -2620,9 +2615,9 @@ var build2 = function() {
2620
2615
  if (!import_node_fs8.default.existsSync(emailsDirRelativePath)) {
2621
2616
  process.exit(1);
2622
2617
  }
2623
- emailsDirPath = import_node_path9.default.join(process.cwd(), emailsDirRelativePath);
2624
- staticPath = import_node_path9.default.join(emailsDirPath, "static");
2625
- builtPreviewAppPath = import_node_path9.default.join(process.cwd(), ".react-email");
2618
+ emailsDirPath = import_node_path10.default.join(process.cwd(), emailsDirRelativePath);
2619
+ staticPath = import_node_path10.default.join(emailsDirPath, "static");
2620
+ builtPreviewAppPath = import_node_path10.default.join(process.cwd(), ".react-email");
2626
2621
  if (!import_node_fs8.default.existsSync(builtPreviewAppPath)) return [
2627
2622
  3,
2628
2623
  3
@@ -2655,7 +2650,7 @@ var build2 = function() {
2655
2650
  6
2656
2651
  ];
2657
2652
  spinner.text = "Copying `static` folder into `.react-email/public/static`";
2658
- builtStaticDirectory = import_node_path9.default.resolve(builtPreviewAppPath, "./public/static");
2653
+ builtStaticDirectory = import_node_path10.default.resolve(builtPreviewAppPath, "./public/static");
2659
2654
  return [
2660
2655
  4,
2661
2656
  import_node_fs8.default.promises.cp(staticPath, builtStaticDirectory, {
@@ -2729,7 +2724,7 @@ var build2 = function() {
2729
2724
  }();
2730
2725
  // src/cli/commands/start.ts
2731
2726
  var import_node_fs9 = __toESM(require("fs"));
2732
- var import_node_path10 = __toESM(require("path"));
2727
+ var import_node_path11 = __toESM(require("path"));
2733
2728
  var import_node_child_process2 = require("child_process");
2734
2729
  var start = function() {
2735
2730
  var _ref = _async_to_generator(function() {
@@ -2737,7 +2732,7 @@ var start = function() {
2737
2732
  return _ts_generator(this, function(_state) {
2738
2733
  try {
2739
2734
  usersProjectLocation = process.cwd();
2740
- builtPreviewPath = import_node_path10.default.resolve(usersProjectLocation, "./.react-email");
2735
+ builtPreviewPath = import_node_path11.default.resolve(usersProjectLocation, "./.react-email");
2741
2736
  if (!import_node_fs9.default.existsSync(builtPreviewPath)) {
2742
2737
  console.error("Could not find .react-email, maybe you haven't ran email build?");
2743
2738
  process.exit(1);