react-email 2.1.4 → 2.1.5

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/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: "2.1.4",
343
+ version: "2.1.5",
344
344
  description: "A live preview of your emails right in your browser.",
345
345
  bin: {
346
346
  email: "./cli/index.js"
@@ -370,13 +370,13 @@ var package_default = {
370
370
  "@babel/core": "7.24.5",
371
371
  "@babel/parser": "7.24.5",
372
372
  "@radix-ui/colors": "1.0.1",
373
- "@radix-ui/react-collapsible": "1.0.3",
374
- "@radix-ui/react-popover": "1.0.7",
375
- "@radix-ui/react-slot": "1.0.2",
376
- "@radix-ui/react-toggle-group": "1.0.4",
377
- "@radix-ui/react-tooltip": "1.0.7",
373
+ "@radix-ui/react-collapsible": "1.1.0",
374
+ "@radix-ui/react-popover": "1.1.1",
375
+ "@radix-ui/react-slot": "1.1.0",
376
+ "@radix-ui/react-toggle-group": "1.1.0",
377
+ "@radix-ui/react-tooltip": "1.1.1",
378
378
  "@swc/core": "1.3.101",
379
- "@types/react": "^18.2.0",
379
+ "@types/react": "18.2.47",
380
380
  "@types/react-dom": "^18.2.0",
381
381
  "@types/webpack": "5.28.5",
382
382
  autoprefixer: "10.4.14",
@@ -399,7 +399,6 @@ var package_default = {
399
399
  "prism-react-renderer": "2.1.0",
400
400
  react: "^18.2.0",
401
401
  "react-dom": "^18.2.0",
402
- shelljs: "0.8.5",
403
402
  "socket.io": "4.7.3",
404
403
  "socket.io-client": "4.7.3",
405
404
  sonner: "1.3.1",
@@ -417,7 +416,6 @@ var package_default = {
417
416
  "@types/mime-types": "2.1.4",
418
417
  "@types/node": "18.0.0",
419
418
  "@types/normalize-path": "3.0.2",
420
- "@types/shelljs": "0.8.15",
421
419
  "@vercel/style-guide": "5.1.0",
422
420
  eslint: "8.50.0",
423
421
  tsup: "7.2.0",
@@ -1786,7 +1784,6 @@ var import_esbuild = require("esbuild");
1786
1784
  var import_ora2 = __toESM(require("ora"));
1787
1785
  var import_log_symbols2 = __toESM(require("log-symbols"));
1788
1786
  var import_normalize_path = __toESM(require("normalize-path"));
1789
- var import_shelljs = require("shelljs");
1790
1787
  // src/actions/get-emails-directory-metadata.ts
1791
1788
  var import_node_fs5 = __toESM(require("fs"));
1792
1789
  var import_node_path6 = __toESM(require("path"));
@@ -1972,7 +1969,7 @@ var getEmailTemplatesFromDirectory = function(emailDirectory) {
1972
1969
  };
1973
1970
  var exportTemplates = function() {
1974
1971
  var _ref = _async_to_generator(function(pathToWhereEmailMarkupShouldBeDumped, emailsDirectoryPath, options) {
1975
- var spinner, emailsDirectoryMetadata, allTemplates, exception, buildFailure, allBuiltTemplates, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, template, emailModule, rendered, htmlPath, exception1, err, staticDirectoryPath, pathToDumpStaticFilesInto, result, fileTree;
1972
+ var spinner, emailsDirectoryMetadata, allTemplates, exception, buildFailure, allBuiltTemplates, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, template, emailModule, rendered, htmlPath, exception1, err, staticDirectoryPath, pathToDumpStaticFilesInto, exception2, fileTree;
1976
1973
  return _ts_generator(this, function(_state) {
1977
1974
  switch(_state.label){
1978
1975
  case 0:
@@ -2154,7 +2151,7 @@ var exportTemplates = function() {
2154
2151
  staticDirectoryPath = import_node_path8.default.join(emailsDirectoryPath, "static");
2155
2152
  if (!import_node_fs7.default.existsSync(staticDirectoryPath)) return [
2156
2153
  3,
2157
- 18
2154
+ 20
2158
2155
  ];
2159
2156
  pathToDumpStaticFilesInto = import_node_path8.default.join(pathToWhereEmailMarkupShouldBeDumped, "static");
2160
2157
  if (!import_node_fs7.default.existsSync(pathToDumpStaticFilesInto)) return [
@@ -2171,36 +2168,53 @@ var exportTemplates = function() {
2171
2168
  _state.sent();
2172
2169
  _state.label = 17;
2173
2170
  case 17:
2174
- result = (0, import_shelljs.cp)("-r", staticDirectoryPath, import_node_path8.default.join(pathToWhereEmailMarkupShouldBeDumped, "static"));
2175
- if (result.code > 0) {
2176
- if (spinner) {
2177
- spinner.stopAndPersist({
2178
- symbol: import_log_symbols2.default.error,
2179
- text: "Failed to copy static files"
2180
- });
2181
- }
2182
- throw new Error("Something went wrong while copying the file to ".concat(pathToWhereEmailMarkupShouldBeDumped, "/static, ").concat(result.stderr));
2183
- }
2184
- _state.label = 18;
2171
+ _state.trys.push([
2172
+ 17,
2173
+ 19,
2174
+ ,
2175
+ 20
2176
+ ]);
2177
+ return [
2178
+ 4,
2179
+ import_node_fs7.default.promises.cp(staticDirectoryPath, pathToDumpStaticFilesInto, {
2180
+ recursive: true
2181
+ })
2182
+ ];
2185
2183
  case 18:
2186
- if (!(spinner && !options.silent)) return [
2184
+ _state.sent();
2185
+ return [
2187
2186
  3,
2188
2187
  20
2189
2188
  ];
2189
+ case 19:
2190
+ exception2 = _state.sent();
2191
+ console.error(exception2);
2192
+ if (spinner) {
2193
+ spinner.stopAndPersist({
2194
+ symbol: import_log_symbols2.default.error,
2195
+ text: "Failed to copy static files"
2196
+ });
2197
+ }
2198
+ throw new Error("Something went wrong while copying the file to ".concat(pathToWhereEmailMarkupShouldBeDumped, "/static, ").concat(exception2));
2199
+ case 20:
2200
+ if (!(spinner && !options.silent)) return [
2201
+ 3,
2202
+ 22
2203
+ ];
2190
2204
  spinner.succeed();
2191
2205
  return [
2192
2206
  4,
2193
2207
  tree(pathToWhereEmailMarkupShouldBeDumped, 4)
2194
2208
  ];
2195
- case 19:
2209
+ case 21:
2196
2210
  fileTree = _state.sent();
2197
2211
  console.log(fileTree);
2198
2212
  spinner.stopAndPersist({
2199
2213
  symbol: import_log_symbols2.default.success,
2200
2214
  text: "Successfully exported emails"
2201
2215
  });
2202
- _state.label = 20;
2203
- case 20:
2216
+ _state.label = 22;
2217
+ case 22:
2204
2218
  return [
2205
2219
  2
2206
2220
  ];
@@ -2215,7 +2229,6 @@ var exportTemplates = function() {
2215
2229
  var import_node_fs8 = __toESM(require("fs"));
2216
2230
  var import_node_path9 = __toESM(require("path"));
2217
2231
  var import_ora3 = __toESM(require("ora"));
2218
- var import_shelljs2 = __toESM(require("shelljs"));
2219
2232
  var import_node_child_process = require("child_process");
2220
2233
  var import_log_symbols3 = __toESM(require("log-symbols"));
2221
2234
  var buildPreviewApp = function(absoluteDirectory) {
@@ -2224,14 +2237,11 @@ var buildPreviewApp = function(absoluteDirectory) {
2224
2237
  "run",
2225
2238
  "build"
2226
2239
  ], {
2227
- cwd: absoluteDirectory
2228
- });
2229
- nextBuild.stdout.on("data", function(msg) {
2230
- process.stdout.write(msg);
2231
- });
2232
- nextBuild.stderr.on("data", function(msg) {
2233
- process.stderr.write(msg);
2240
+ cwd: absoluteDirectory,
2241
+ shell: true
2234
2242
  });
2243
+ nextBuild.stdout.pipe(process.stdout);
2244
+ nextBuild.stderr.pipe(process.stderr);
2235
2245
  nextBuild.on("close", function(code) {
2236
2246
  if (code === 0) {
2237
2247
  resolve();
@@ -2359,17 +2369,35 @@ var npmInstall = function() {
2359
2369
  return _ts_generator(this, function(_state) {
2360
2370
  return [
2361
2371
  2,
2362
- new Promise(function(resolve, reject) {
2363
- import_shelljs2.default.exec("".concat(packageManager, " install --silent"), {
2364
- cwd: builtPreviewAppPath
2365
- }, function(code) {
2366
- if (code === 0) {
2367
- resolve();
2368
- } else {
2369
- reject(new Error("Unable to install the dependencies and it exited with code: ".concat(code)));
2370
- }
2372
+ new Promise(function() {
2373
+ var _ref = _async_to_generator(function(resolve, reject) {
2374
+ var childProc;
2375
+ return _ts_generator(this, function(_state) {
2376
+ childProc = (0, import_node_child_process.spawn)(packageManager, [
2377
+ "install",
2378
+ "--silent"
2379
+ ], {
2380
+ cwd: builtPreviewAppPath,
2381
+ shell: true
2382
+ });
2383
+ childProc.stdout.pipe(process.stdout);
2384
+ childProc.stderr.pipe(process.stderr);
2385
+ childProc.on("close", function(code) {
2386
+ if (code === 0) {
2387
+ resolve();
2388
+ } else {
2389
+ reject(new Error("Unable to install the dependencies and it exited with code: ".concat(code)));
2390
+ }
2391
+ });
2392
+ return [
2393
+ 2
2394
+ ];
2395
+ });
2371
2396
  });
2372
- })
2397
+ return function(resolve, reject) {
2398
+ return _ref.apply(this, arguments);
2399
+ };
2400
+ }())
2373
2401
  ];
2374
2402
  });
2375
2403
  });
@@ -2425,7 +2453,7 @@ var build2 = function() {
2425
2453
  import_node_fs8.default.promises.cp(cliPacakgeLocation, builtPreviewAppPath, {
2426
2454
  recursive: true,
2427
2455
  filter: function(source) {
2428
- return !source.includes("/cli/") && !source.includes("/.next/") && !/\/node_modules\/?$/.test(source);
2456
+ return !/(\/|\\)cli(\/|\\)?/.test(source) && !/(\/|\\)\.next(\/|\\)?/.test(source) && !/(\/|\\)\.turbo(\/|\\)?/.test(source) && !/(\/|\\)node_modules(\/|\\)?$/.test(source);
2429
2457
  }
2430
2458
  })
2431
2459
  ];
@@ -2525,14 +2553,11 @@ var start = function() {
2525
2553
  nextStart = (0, import_node_child_process2.spawn)("npm", [
2526
2554
  "start"
2527
2555
  ], {
2528
- cwd: builtPreviewPath
2529
- });
2530
- nextStart.stdout.on("data", function(msg) {
2531
- process.stdout.write(msg);
2532
- });
2533
- nextStart.stderr.on("data", function(msg) {
2534
- process.stderr.write(msg);
2556
+ cwd: builtPreviewPath,
2557
+ shell: true
2535
2558
  });
2559
+ nextStart.stdout.pipe(process.stdout);
2560
+ nextStart.stderr.pipe(process.stderr);
2536
2561
  } catch (error) {
2537
2562
  console.log(error);
2538
2563
  process.exit(1);
package/cli/index.mjs CHANGED
@@ -13,7 +13,7 @@ import { program } from "commander";
13
13
  // package.json
14
14
  var package_default = {
15
15
  name: "react-email",
16
- version: "2.1.4",
16
+ version: "2.1.5",
17
17
  description: "A live preview of your emails right in your browser.",
18
18
  bin: {
19
19
  email: "./cli/index.js"
@@ -43,13 +43,13 @@ var package_default = {
43
43
  "@babel/core": "7.24.5",
44
44
  "@babel/parser": "7.24.5",
45
45
  "@radix-ui/colors": "1.0.1",
46
- "@radix-ui/react-collapsible": "1.0.3",
47
- "@radix-ui/react-popover": "1.0.7",
48
- "@radix-ui/react-slot": "1.0.2",
49
- "@radix-ui/react-toggle-group": "1.0.4",
50
- "@radix-ui/react-tooltip": "1.0.7",
46
+ "@radix-ui/react-collapsible": "1.1.0",
47
+ "@radix-ui/react-popover": "1.1.1",
48
+ "@radix-ui/react-slot": "1.1.0",
49
+ "@radix-ui/react-toggle-group": "1.1.0",
50
+ "@radix-ui/react-tooltip": "1.1.1",
51
51
  "@swc/core": "1.3.101",
52
- "@types/react": "^18.2.0",
52
+ "@types/react": "18.2.47",
53
53
  "@types/react-dom": "^18.2.0",
54
54
  "@types/webpack": "5.28.5",
55
55
  autoprefixer: "10.4.14",
@@ -72,7 +72,6 @@ var package_default = {
72
72
  "prism-react-renderer": "2.1.0",
73
73
  react: "^18.2.0",
74
74
  "react-dom": "^18.2.0",
75
- shelljs: "0.8.5",
76
75
  "socket.io": "4.7.3",
77
76
  "socket.io-client": "4.7.3",
78
77
  sonner: "1.3.1",
@@ -90,7 +89,6 @@ var package_default = {
90
89
  "@types/mime-types": "2.1.4",
91
90
  "@types/node": "18.0.0",
92
91
  "@types/normalize-path": "3.0.2",
93
- "@types/shelljs": "0.8.15",
94
92
  "@vercel/style-guide": "5.1.0",
95
93
  eslint: "8.50.0",
96
94
  tsup: "7.2.0",
@@ -699,7 +697,6 @@ import { build } from "esbuild";
699
697
  import ora2 from "ora";
700
698
  import logSymbols2 from "log-symbols";
701
699
  import normalize from "normalize-path";
702
- import { cp } from "shelljs";
703
700
 
704
701
  // src/actions/get-emails-directory-metadata.ts
705
702
  import fs5 from "fs";
@@ -919,12 +916,12 @@ ${allTemplates.map((p) => `- ${p}`).join("\n")}`
919
916
  );
920
917
  if (fs7.existsSync(pathToDumpStaticFilesInto))
921
918
  await fs7.promises.rm(pathToDumpStaticFilesInto, { recursive: true });
922
- const result = cp(
923
- "-r",
924
- staticDirectoryPath,
925
- path9.join(pathToWhereEmailMarkupShouldBeDumped, "static")
926
- );
927
- if (result.code > 0) {
919
+ try {
920
+ await fs7.promises.cp(staticDirectoryPath, pathToDumpStaticFilesInto, {
921
+ recursive: true
922
+ });
923
+ } catch (exception) {
924
+ console.error(exception);
928
925
  if (spinner) {
929
926
  spinner.stopAndPersist({
930
927
  symbol: logSymbols2.error,
@@ -932,7 +929,7 @@ ${allTemplates.map((p) => `- ${p}`).join("\n")}`
932
929
  });
933
930
  }
934
931
  throw new Error(
935
- `Something went wrong while copying the file to ${pathToWhereEmailMarkupShouldBeDumped}/static, ${result.stderr}`
932
+ `Something went wrong while copying the file to ${pathToWhereEmailMarkupShouldBeDumped}/static, ${exception}`
936
933
  );
937
934
  }
938
935
  }
@@ -951,20 +948,16 @@ ${allTemplates.map((p) => `- ${p}`).join("\n")}`
951
948
  import fs8 from "fs";
952
949
  import path10 from "path";
953
950
  import ora3 from "ora";
954
- import shell from "shelljs";
955
951
  import { spawn } from "child_process";
956
952
  import logSymbols3 from "log-symbols";
957
953
  var buildPreviewApp = (absoluteDirectory) => {
958
954
  return new Promise((resolve, reject) => {
959
955
  const nextBuild = spawn("npm", ["run", "build"], {
960
- cwd: absoluteDirectory
961
- });
962
- nextBuild.stdout.on("data", (msg) => {
963
- process.stdout.write(msg);
964
- });
965
- nextBuild.stderr.on("data", (msg) => {
966
- process.stderr.write(msg);
956
+ cwd: absoluteDirectory,
957
+ shell: true
967
958
  });
959
+ nextBuild.stdout.pipe(process.stdout);
960
+ nextBuild.stderr.pipe(process.stderr);
968
961
  nextBuild.on("close", (code) => {
969
962
  if (code === 0) {
970
963
  resolve();
@@ -1082,22 +1075,24 @@ var updatePackageJson = async (builtPreviewAppPath) => {
1082
1075
  );
1083
1076
  };
1084
1077
  var npmInstall = async (builtPreviewAppPath, packageManager) => {
1085
- return new Promise((resolve, reject) => {
1086
- shell.exec(
1087
- `${packageManager} install --silent`,
1088
- { cwd: builtPreviewAppPath },
1089
- (code) => {
1090
- if (code === 0) {
1091
- resolve();
1092
- } else {
1093
- reject(
1094
- new Error(
1095
- `Unable to install the dependencies and it exited with code: ${code}`
1096
- )
1097
- );
1098
- }
1078
+ return new Promise(async (resolve, reject) => {
1079
+ const childProc = spawn(packageManager, ["install", "--silent"], {
1080
+ cwd: builtPreviewAppPath,
1081
+ shell: true
1082
+ });
1083
+ childProc.stdout.pipe(process.stdout);
1084
+ childProc.stderr.pipe(process.stderr);
1085
+ childProc.on("close", (code) => {
1086
+ if (code === 0) {
1087
+ resolve();
1088
+ } else {
1089
+ reject(
1090
+ new Error(
1091
+ `Unable to install the dependencies and it exited with code: ${code}`
1092
+ )
1093
+ );
1099
1094
  }
1100
- );
1095
+ });
1101
1096
  });
1102
1097
  };
1103
1098
  var build2 = async ({
@@ -1125,7 +1120,7 @@ var build2 = async ({
1125
1120
  await fs8.promises.cp(cliPacakgeLocation, builtPreviewAppPath, {
1126
1121
  recursive: true,
1127
1122
  filter: (source) => {
1128
- return !source.includes("/cli/") && !source.includes("/.next/") && !/\/node_modules\/?$/.test(source);
1123
+ return !/(\/|\\)cli(\/|\\)?/.test(source) && !/(\/|\\)\.next(\/|\\)?/.test(source) && !/(\/|\\)\.turbo(\/|\\)?/.test(source) && !/(\/|\\)node_modules(\/|\\)?$/.test(source);
1129
1124
  }
1130
1125
  });
1131
1126
  if (fs8.existsSync(staticPath)) {
@@ -1177,14 +1172,11 @@ var start = async () => {
1177
1172
  );
1178
1173
  }
1179
1174
  const nextStart = spawn2("npm", ["start"], {
1180
- cwd: builtPreviewPath
1181
- });
1182
- nextStart.stdout.on("data", (msg) => {
1183
- process.stdout.write(msg);
1184
- });
1185
- nextStart.stderr.on("data", (msg) => {
1186
- process.stderr.write(msg);
1175
+ cwd: builtPreviewPath,
1176
+ shell: true
1187
1177
  });
1178
+ nextStart.stdout.pipe(process.stdout);
1179
+ nextStart.stderr.pipe(process.stderr);
1188
1180
  } catch (error) {
1189
1181
  console.log(error);
1190
1182
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-email",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "A live preview of your emails right in your browser.",
5
5
  "bin": {
6
6
  "email": "./cli/index.js"
@@ -22,13 +22,13 @@
22
22
  "@babel/core": "7.24.5",
23
23
  "@babel/parser": "7.24.5",
24
24
  "@radix-ui/colors": "1.0.1",
25
- "@radix-ui/react-collapsible": "1.0.3",
26
- "@radix-ui/react-popover": "1.0.7",
27
- "@radix-ui/react-slot": "1.0.2",
28
- "@radix-ui/react-toggle-group": "1.0.4",
29
- "@radix-ui/react-tooltip": "1.0.7",
25
+ "@radix-ui/react-collapsible": "1.1.0",
26
+ "@radix-ui/react-popover": "1.1.1",
27
+ "@radix-ui/react-slot": "1.1.0",
28
+ "@radix-ui/react-toggle-group": "1.1.0",
29
+ "@radix-ui/react-tooltip": "1.1.1",
30
30
  "@swc/core": "1.3.101",
31
- "@types/react": "^18.2.0",
31
+ "@types/react": "18.2.47",
32
32
  "@types/react-dom": "^18.2.0",
33
33
  "@types/webpack": "5.28.5",
34
34
  "autoprefixer": "10.4.14",
@@ -51,7 +51,6 @@
51
51
  "prism-react-renderer": "2.1.0",
52
52
  "react": "^18.2.0",
53
53
  "react-dom": "^18.2.0",
54
- "shelljs": "0.8.5",
55
54
  "socket.io": "4.7.3",
56
55
  "socket.io-client": "4.7.3",
57
56
  "sonner": "1.3.1",
@@ -69,7 +68,6 @@
69
68
  "@types/mime-types": "2.1.4",
70
69
  "@types/node": "18.0.0",
71
70
  "@types/normalize-path": "3.0.2",
72
- "@types/shelljs": "0.8.15",
73
71
  "@vercel/style-guide": "5.1.0",
74
72
  "eslint": "8.50.0",
75
73
  "tsup": "7.2.0",
@@ -26,6 +26,7 @@ import cluster from 'node:cluster';
26
26
  import childProcess from 'node:child_process';
27
27
  import buffer from 'node:buffer';
28
28
  import assert from 'node:assert';
29
+ import asyncHooks from 'node:async_hooks';
29
30
 
30
31
  /**
31
32
  * A map of the name of the modules (including `node:` prefixed ones)
@@ -71,6 +72,8 @@ export const staticNodeModulesForVM = {
71
72
  'node:http': http,
72
73
  fs,
73
74
  'node:fs': fs,
75
+ 'fs/promises': fs.promises,
76
+ 'node:fs/promises': fs.promises,
74
77
  events,
75
78
  'node:events': events,
76
79
  domain,
@@ -89,4 +92,6 @@ export const staticNodeModulesForVM = {
89
92
  'node:buffer': buffer,
90
93
  assert,
91
94
  'node:assert': assert,
95
+ 'async_hooks': asyncHooks,
96
+ 'node:async_hooks': asyncHooks,
92
97
  };