react-email 4.0.15 → 4.0.17
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 +18 -0
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +2785 -0
- package/dist/cli/index.mjs +77 -47
- package/dist/index.d.mts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +1410 -0
- package/dist/index.mjs +21 -0
- package/dist/package/index.d.mts +33 -0
- package/dist/package/index.d.ts +33 -0
- package/dist/package/index.js +62 -0
- package/dist/package/index.mjs +7 -0
- package/dist/preview/.next/BUILD_ID +1 -1
- package/dist/preview/.next/app-build-manifest.json +10 -10
- package/dist/preview/.next/app-path-routes-manifest.json +1 -1
- package/dist/preview/.next/build-manifest.json +3 -3
- package/dist/preview/.next/next-minimal-server.js.nft.json +1 -1
- package/dist/preview/.next/next-server.js.nft.json +1 -1
- package/dist/preview/.next/prerender-manifest.json +3 -3
- package/dist/preview/.next/required-server-files.json +4 -4
- package/dist/preview/.next/server/app/_not-found/page.js +1 -1
- package/dist/preview/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/preview/.next/server/app/favicon.ico/route.js +1 -1
- package/dist/preview/.next/server/app/page.js +1 -1
- package/dist/preview/.next/server/app/page.js.nft.json +1 -1
- package/dist/preview/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/preview/.next/server/app/preview/[...slug]/page.js +17 -17
- package/dist/preview/.next/server/app/preview/[...slug]/page.js.nft.json +1 -1
- package/dist/preview/.next/server/app/preview/[...slug]/page_client-reference-manifest.js +1 -1
- package/dist/preview/.next/server/app-paths-manifest.json +1 -1
- package/dist/preview/.next/server/chunks/147.js +1 -0
- package/dist/preview/.next/server/chunks/235.js +4 -4
- package/dist/preview/.next/server/middleware-build-manifest.js +1 -1
- package/dist/preview/.next/server/next-font-manifest.js +1 -1
- package/dist/preview/.next/server/next-font-manifest.json +1 -1
- package/dist/preview/.next/server/pages/500.html +1 -1
- package/dist/preview/.next/server/pages-manifest.json +1 -1
- package/dist/preview/.next/server/server-reference-manifest.js +1 -1
- package/dist/preview/.next/server/server-reference-manifest.json +1 -1
- package/dist/preview/.next/static/chunks/484-3d4d9735a701a476.js +1 -0
- package/dist/preview/.next/static/chunks/app/layout-95b74654735388bd.js +1 -0
- package/dist/preview/.next/static/chunks/app/page-2dbfb5b2dc4b1191.js +1 -0
- package/dist/preview/.next/static/chunks/app/preview/[...slug]/page-42afb14d97d633e3.js +1 -0
- package/dist/preview/.next/static/chunks/main-app-976577a424e11c75.js +1 -0
- package/dist/preview/.next/static/css/{35e8811589f0962b.css → 78c81281aa95270f.css} +1 -1
- package/dist/preview/.next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
- package/dist/preview/.next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
- package/dist/preview/.next/trace +27 -27
- package/dist/preview/.next/types/app/layout.ts +1 -1
- package/dist/preview/.next/types/app/page.ts +1 -1
- package/dist/preview/.next/types/app/preview/[...slug]/page.ts +1 -1
- package/package.json +4 -3
- package/src/app/layout.tsx +2 -2
- package/src/app/preview/[...slug]/preview.tsx +1 -1
- package/src/commands/testing/out/notifications/yelp-recent-login.html +1 -1
- package/src/commands/testing/out/reset-password/twitch-reset-password.html +1 -1
- package/src/components/shell.tsx +4 -1
- package/src/components/sidebar/file-tree-directory-children.tsx +7 -2
- package/src/package/body/dist/index.d.mts +6 -0
- package/src/package/body/dist/index.d.ts +6 -0
- package/src/package/body/dist/index.js +79 -0
- package/src/package/body/dist/index.mjs +45 -0
- package/src/package/button/dist/index.d.mts +6 -0
- package/src/package/button/dist/index.d.ts +6 -0
- package/src/package/button/dist/index.js +252 -0
- package/src/package/button/dist/index.mjs +218 -0
- package/src/package/code-block/dist/index.d.mts +4906 -0
- package/src/package/code-block/dist/index.d.ts +4906 -0
- package/src/package/code-block/dist/index.js +18205 -0
- package/src/package/code-block/dist/index.mjs +18133 -0
- package/src/package/code-inline/dist/index.d.mts +11 -0
- package/src/package/code-inline/dist/index.d.ts +11 -0
- package/src/package/code-inline/dist/index.js +106 -0
- package/src/package/code-inline/dist/index.mjs +72 -0
- package/src/package/column/dist/index.d.mts +6 -0
- package/src/package/column/dist/index.d.ts +6 -0
- package/src/package/column/dist/index.js +79 -0
- package/src/package/column/dist/index.mjs +45 -0
- package/src/package/components/dist/index.d.mts +20 -0
- package/src/package/components/dist/index.d.ts +20 -0
- package/src/package/components/dist/index.js +62 -0
- package/src/package/components/dist/index.mjs +21 -0
- package/src/package/container/dist/index.d.mts +6 -0
- package/src/package/container/dist/index.d.ts +6 -0
- package/src/package/container/dist/index.js +93 -0
- package/src/package/container/dist/index.mjs +59 -0
- package/src/package/font/dist/index.d.mts +25 -0
- package/src/package/font/dist/index.d.ts +25 -0
- package/src/package/font/dist/index.js +55 -0
- package/src/package/font/dist/index.mjs +28 -0
- package/src/package/head/dist/index.d.mts +6 -0
- package/src/package/head/dist/index.d.ts +6 -0
- package/src/package/head/dist/index.js +83 -0
- package/src/package/head/dist/index.mjs +49 -0
- package/src/package/heading/dist/index.d.mts +43 -0
- package/src/package/heading/dist/index.d.ts +43 -0
- package/src/package/heading/dist/index.js +113 -0
- package/src/package/heading/dist/index.mjs +79 -0
- package/src/package/hr/dist/index.d.mts +6 -0
- package/src/package/hr/dist/index.d.ts +6 -0
- package/src/package/hr/dist/index.js +89 -0
- package/src/package/hr/dist/index.mjs +55 -0
- package/src/package/html/dist/index.d.mts +6 -0
- package/src/package/html/dist/index.d.ts +6 -0
- package/src/package/html/dist/index.js +79 -0
- package/src/package/html/dist/index.mjs +45 -0
- package/src/package/img/dist/index.d.mts +6 -0
- package/src/package/img/dist/index.d.ts +6 -0
- package/src/package/img/dist/index.js +94 -0
- package/src/package/img/dist/index.mjs +60 -0
- package/src/package/link/dist/index.d.mts +6 -0
- package/src/package/link/dist/index.d.ts +6 -0
- package/src/package/link/dist/index.js +90 -0
- package/src/package/link/dist/index.mjs +56 -0
- package/src/package/markdown/dist/index.d.mts +15 -0
- package/src/package/markdown/dist/index.d.ts +15 -0
- package/src/package/markdown/dist/index.js +92 -0
- package/src/package/markdown/dist/index.mjs +58 -0
- package/src/package/preview/dist/index.d.mts +12 -0
- package/src/package/preview/dist/index.d.ts +12 -0
- package/src/package/preview/dist/index.js +108 -0
- package/src/package/preview/dist/index.mjs +73 -0
- package/src/package/render/dist/browser/index.d.mts +24 -0
- package/src/package/render/dist/browser/index.d.ts +24 -0
- package/src/package/render/dist/browser/index.js +250 -0
- package/src/package/render/dist/browser/index.mjs +214 -0
- package/src/package/render/dist/index.d.mts +23 -0
- package/src/package/render/dist/index.d.ts +23 -0
- package/src/package/render/dist/index.js +768 -0
- package/src/package/render/dist/index.mjs +733 -0
- package/src/package/render/dist/node/index.d.mts +27 -0
- package/src/package/render/dist/node/index.d.ts +27 -0
- package/src/package/render/dist/node/index.js +212 -0
- package/src/package/render/dist/node/index.mjs +176 -0
- package/src/package/row/dist/index.d.mts +10 -0
- package/src/package/row/dist/index.d.ts +10 -0
- package/src/package/row/dist/index.js +93 -0
- package/src/package/row/dist/index.mjs +59 -0
- package/src/package/section/dist/index.d.mts +6 -0
- package/src/package/section/dist/index.d.ts +6 -0
- package/src/package/section/dist/index.js +93 -0
- package/src/package/section/dist/index.mjs +59 -0
- package/src/package/tailwind/dist/index.d.ts +19 -0
- package/src/package/tailwind/dist/index.js +48 -0
- package/src/package/tailwind/dist/index.mjs +17167 -0
- package/src/package/tailwind/dist/tailwindcss/config.d.ts +376 -0
- package/src/package/tailwind/dist/tailwindcss/generated/.gitkeep +0 -0
- package/src/package/tailwind/dist/tailwindcss/generated/colors.d.ts +298 -0
- package/src/package/tailwind/dist/tailwindcss/generated/corePluginList.d.ts +1 -0
- package/src/package/tailwind/dist/tailwindcss/generated/default-theme.d.ts +397 -0
- package/src/package/tailwind/dist/tailwindcss/index.d.ts +11 -0
- package/src/package/text/dist/index.d.mts +6 -0
- package/src/package/text/dist/index.d.ts +6 -0
- package/src/package/text/dist/index.js +89 -0
- package/src/package/text/dist/index.mjs +55 -0
- package/src/utils/__snapshots__/get-email-component.spec.ts.snap +1 -1
- package/src/utils/caniemail/get-element-names.ts +9 -3
- package/src/utils/contains-email-template.spec.ts +12 -0
- package/src/utils/contains-email-template.ts +26 -9
- package/src/utils/improve-error-with-sourcemap.ts +0 -1
- package/src/utils/types/error-object.ts +1 -1
- package/dist/preview/.next/server/chunks/488.js +0 -1
- package/dist/preview/.next/static/chunks/484-21e30f98c67e8d58.js +0 -1
- package/dist/preview/.next/static/chunks/app/layout-3044a159bf29302b.js +0 -1
- package/dist/preview/.next/static/chunks/app/page-ed77f0af99f8ff62.js +0 -1
- package/dist/preview/.next/static/chunks/app/preview/[...slug]/page-994a4d501e46f3f8.js +0 -1
- package/dist/preview/.next/static/chunks/main-app-5bc2d814f500db60.js +0 -1
- package/dist/preview/.next/static/media/6d93bde91c0c2823-s.woff2 +0 -0
- package/dist/preview/.next/static/media/a34f9d1faa5f3315-s.p.woff2 +0 -0
- /package/dist/preview/.next/static/{0LFN6rP55keVoTJYuP-4s → 9A_Lez8sdD6nDBcSehk5k}/_buildManifest.js +0 -0
- /package/dist/preview/.next/static/{0LFN6rP55keVoTJYuP-4s → 9A_Lez8sdD6nDBcSehk5k}/_ssgManifest.js +0 -0
package/dist/cli/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { program } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "react-email",
|
|
9
|
-
version: "4.0.
|
|
9
|
+
version: "4.0.17",
|
|
10
10
|
description: "A live preview of your emails right in your browser.",
|
|
11
11
|
bin: {
|
|
12
12
|
email: "./dist/cli/index.mjs"
|
|
@@ -47,7 +47,8 @@ var package_default = {
|
|
|
47
47
|
next: "^15.3.1",
|
|
48
48
|
"normalize-path": "^3.0.0",
|
|
49
49
|
ora: "^8.0.0",
|
|
50
|
-
"socket.io": "^4.8.1"
|
|
50
|
+
"socket.io": "^4.8.1",
|
|
51
|
+
"tsconfig-paths": "4.2.0"
|
|
51
52
|
},
|
|
52
53
|
devDependencies: {
|
|
53
54
|
"@babel/core": "7.26.10",
|
|
@@ -102,7 +103,7 @@ var package_default = {
|
|
|
102
103
|
// src/cli/commands/build.ts
|
|
103
104
|
import { spawn } from "node:child_process";
|
|
104
105
|
import fs5 from "node:fs";
|
|
105
|
-
import
|
|
106
|
+
import path9 from "node:path";
|
|
106
107
|
import logSymbols3 from "log-symbols";
|
|
107
108
|
import ora2 from "ora";
|
|
108
109
|
|
|
@@ -218,14 +219,14 @@ var registerSpinnerAutostopping = (spinner) => {
|
|
|
218
219
|
};
|
|
219
220
|
|
|
220
221
|
// src/cli/utils/preview/hot-reloading/setup-hot-reloading.ts
|
|
221
|
-
import
|
|
222
|
+
import path7 from "node:path";
|
|
222
223
|
import { watch } from "chokidar";
|
|
223
224
|
import debounce from "debounce";
|
|
224
225
|
import { Server as SocketServer } from "socket.io";
|
|
225
226
|
|
|
226
227
|
// src/cli/utils/preview/hot-reloading/create-dependency-graph.ts
|
|
227
228
|
import { existsSync as existsSync2, promises as fs3, statSync } from "node:fs";
|
|
228
|
-
import
|
|
229
|
+
import path6 from "node:path";
|
|
229
230
|
|
|
230
231
|
// src/cli/utils/preview/start-dev-server.ts
|
|
231
232
|
import http from "node:http";
|
|
@@ -274,7 +275,8 @@ var serveStaticFile = async (res, parsedUrl, staticDirRelativePath) => {
|
|
|
274
275
|
} else {
|
|
275
276
|
const sanitizedFilePath = fileAbsolutePath.replace(/\n|\r/g, "");
|
|
276
277
|
console.error(
|
|
277
|
-
`Could not read file at
|
|
278
|
+
`Could not read file at %s to be served, here's the exception:`,
|
|
279
|
+
sanitizedFilePath,
|
|
278
280
|
exception
|
|
279
281
|
);
|
|
280
282
|
res.statusCode = 500;
|
|
@@ -492,12 +494,40 @@ var getImportedModules = (contents) => {
|
|
|
492
494
|
return importedPaths;
|
|
493
495
|
};
|
|
494
496
|
|
|
497
|
+
// src/cli/utils/preview/hot-reloading/resolve-path-aliases.ts
|
|
498
|
+
import path5 from "node:path";
|
|
499
|
+
import { createMatchPath, loadConfig } from "tsconfig-paths";
|
|
500
|
+
var resolvePathAliases = (importPaths, projectPath) => {
|
|
501
|
+
const configLoadResult = loadConfig(projectPath);
|
|
502
|
+
if (configLoadResult.resultType === "success") {
|
|
503
|
+
const matchPath = createMatchPath(
|
|
504
|
+
configLoadResult.absoluteBaseUrl,
|
|
505
|
+
configLoadResult.paths
|
|
506
|
+
);
|
|
507
|
+
return importPaths.map((importedPath) => {
|
|
508
|
+
const unaliasedPath = matchPath(importedPath, void 0, void 0, [
|
|
509
|
+
".tsx",
|
|
510
|
+
".ts",
|
|
511
|
+
".js",
|
|
512
|
+
".jsx",
|
|
513
|
+
".cjs",
|
|
514
|
+
".mjs"
|
|
515
|
+
]);
|
|
516
|
+
if (unaliasedPath) {
|
|
517
|
+
return `./${path5.relative(projectPath, unaliasedPath)}`;
|
|
518
|
+
}
|
|
519
|
+
return importedPath;
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
return importPaths;
|
|
523
|
+
};
|
|
524
|
+
|
|
495
525
|
// src/cli/utils/preview/hot-reloading/create-dependency-graph.ts
|
|
496
526
|
var readAllFilesInsideDirectory = async (directory) => {
|
|
497
527
|
let allFilePaths = [];
|
|
498
528
|
const topLevelDirents = await fs3.readdir(directory, { withFileTypes: true });
|
|
499
529
|
for await (const dirent of topLevelDirents) {
|
|
500
|
-
const pathToDirent =
|
|
530
|
+
const pathToDirent = path6.join(directory, dirent.name);
|
|
501
531
|
if (dirent.isDirectory()) {
|
|
502
532
|
allFilePaths = allFilePaths.concat(
|
|
503
533
|
await readAllFilesInsideDirectory(pathToDirent)
|
|
@@ -509,7 +539,7 @@ var readAllFilesInsideDirectory = async (directory) => {
|
|
|
509
539
|
return allFilePaths;
|
|
510
540
|
};
|
|
511
541
|
var isJavascriptModule = (filePath) => {
|
|
512
|
-
const extensionName =
|
|
542
|
+
const extensionName = path6.extname(filePath);
|
|
513
543
|
return [".js", ".ts", ".jsx", ".tsx", ".mjs", ".cjs"].includes(extensionName);
|
|
514
544
|
};
|
|
515
545
|
var checkFileExtensionsUntilItExists = (pathWithoutExtension) => {
|
|
@@ -536,10 +566,10 @@ var createDependencyGraph = async (directory) => {
|
|
|
536
566
|
const filePaths = await readAllFilesInsideDirectory(directory);
|
|
537
567
|
const modulePaths = filePaths.filter(isJavascriptModule);
|
|
538
568
|
const graph = Object.fromEntries(
|
|
539
|
-
modulePaths.map((
|
|
540
|
-
|
|
569
|
+
modulePaths.map((path13) => [
|
|
570
|
+
path13,
|
|
541
571
|
{
|
|
542
|
-
path:
|
|
572
|
+
path: path13,
|
|
543
573
|
dependencyPaths: [],
|
|
544
574
|
dependentPaths: [],
|
|
545
575
|
moduleDependencies: []
|
|
@@ -548,14 +578,14 @@ var createDependencyGraph = async (directory) => {
|
|
|
548
578
|
);
|
|
549
579
|
const getDependencyPaths = async (filePath) => {
|
|
550
580
|
const contents = await fs3.readFile(filePath, "utf8");
|
|
551
|
-
const importedPaths = isJavascriptModule(filePath) ? getImportedModules(contents) : [];
|
|
581
|
+
const importedPaths = isJavascriptModule(filePath) ? resolvePathAliases(getImportedModules(contents), path6.dirname(filePath)) : [];
|
|
552
582
|
const importedPathsRelativeToDirectory = importedPaths.map(
|
|
553
583
|
(dependencyPath) => {
|
|
554
584
|
const isModulePath = !dependencyPath.startsWith(".");
|
|
555
|
-
if (isModulePath ||
|
|
585
|
+
if (isModulePath || path6.isAbsolute(dependencyPath)) {
|
|
556
586
|
return dependencyPath;
|
|
557
587
|
}
|
|
558
|
-
let pathToDependencyFromDirectory =
|
|
588
|
+
let pathToDependencyFromDirectory = path6.resolve(
|
|
559
589
|
/*
|
|
560
590
|
path.resolve resolves paths differently from what imports on javascript do.
|
|
561
591
|
|
|
@@ -563,7 +593,7 @@ var createDependencyGraph = async (directory) => {
|
|
|
563
593
|
would end up going into /path/to/email.tsx/other-email instead of /path/to/other-email which is the
|
|
564
594
|
one the import is meant to go to
|
|
565
595
|
*/
|
|
566
|
-
|
|
596
|
+
path6.dirname(filePath),
|
|
567
597
|
dependencyPath
|
|
568
598
|
);
|
|
569
599
|
let isDirectory = false;
|
|
@@ -584,7 +614,7 @@ var createDependencyGraph = async (directory) => {
|
|
|
584
614
|
);
|
|
585
615
|
}
|
|
586
616
|
}
|
|
587
|
-
const extension =
|
|
617
|
+
const extension = path6.extname(pathToDependencyFromDirectory);
|
|
588
618
|
const pathWithEnsuredExtension = (() => {
|
|
589
619
|
if (extension.length > 0 && existsSync2(pathToDependencyFromDirectory)) {
|
|
590
620
|
return pathToDependencyFromDirectory;
|
|
@@ -604,10 +634,10 @@ var createDependencyGraph = async (directory) => {
|
|
|
604
634
|
}
|
|
605
635
|
);
|
|
606
636
|
const moduleDependencies = importedPathsRelativeToDirectory.filter(
|
|
607
|
-
(dependencyPath) => !dependencyPath.startsWith(".") && !
|
|
637
|
+
(dependencyPath) => !dependencyPath.startsWith(".") && !path6.isAbsolute(dependencyPath)
|
|
608
638
|
);
|
|
609
639
|
const nonNodeModuleImportPathsRelativeToDirectory = importedPathsRelativeToDirectory.filter(
|
|
610
|
-
(dependencyPath) => dependencyPath.startsWith(".") ||
|
|
640
|
+
(dependencyPath) => dependencyPath.startsWith(".") || path6.isAbsolute(dependencyPath)
|
|
611
641
|
);
|
|
612
642
|
return {
|
|
613
643
|
dependencyPaths: nonNodeModuleImportPathsRelativeToDirectory,
|
|
@@ -738,14 +768,14 @@ var setupHotreloading = async (devServer2, emailDirRelativePath) => {
|
|
|
738
768
|
changes.filter(
|
|
739
769
|
(change) => (
|
|
740
770
|
// Ensures only changes inside the emails directory are emitted
|
|
741
|
-
|
|
771
|
+
path7.resolve(absolutePathToEmailsDirectory, change.filename).startsWith(absolutePathToEmailsDirectory)
|
|
742
772
|
)
|
|
743
773
|
)
|
|
744
774
|
);
|
|
745
775
|
});
|
|
746
776
|
changes = [];
|
|
747
777
|
}, 150);
|
|
748
|
-
const absolutePathToEmailsDirectory =
|
|
778
|
+
const absolutePathToEmailsDirectory = path7.resolve(
|
|
749
779
|
process.cwd(),
|
|
750
780
|
emailDirRelativePath
|
|
751
781
|
);
|
|
@@ -755,7 +785,7 @@ var setupHotreloading = async (devServer2, emailDirRelativePath) => {
|
|
|
755
785
|
cwd: absolutePathToEmailsDirectory
|
|
756
786
|
});
|
|
757
787
|
const getFilesOutsideEmailsDirectory = () => Object.keys(dependencyGraph).filter(
|
|
758
|
-
(p) =>
|
|
788
|
+
(p) => path7.relative(absolutePathToEmailsDirectory, p).startsWith("..")
|
|
759
789
|
);
|
|
760
790
|
let filesOutsideEmailsDirectory = getFilesOutsideEmailsDirectory();
|
|
761
791
|
for (const p of filesOutsideEmailsDirectory) {
|
|
@@ -767,11 +797,11 @@ var setupHotreloading = async (devServer2, emailDirRelativePath) => {
|
|
|
767
797
|
process.on("SIGINT", exit);
|
|
768
798
|
process.on("uncaughtException", exit);
|
|
769
799
|
watcher.on("all", async (event, relativePathToChangeTarget) => {
|
|
770
|
-
const file = relativePathToChangeTarget.split(
|
|
800
|
+
const file = relativePathToChangeTarget.split(path7.sep);
|
|
771
801
|
if (file.length === 0) {
|
|
772
802
|
return;
|
|
773
803
|
}
|
|
774
|
-
const pathToChangeTarget =
|
|
804
|
+
const pathToChangeTarget = path7.resolve(
|
|
775
805
|
absolutePathToEmailsDirectory,
|
|
776
806
|
relativePathToChangeTarget
|
|
777
807
|
);
|
|
@@ -795,7 +825,7 @@ var setupHotreloading = async (devServer2, emailDirRelativePath) => {
|
|
|
795
825
|
for (const dependentPath of resolveDependentsOf(pathToChangeTarget)) {
|
|
796
826
|
changes.push({
|
|
797
827
|
event: "change",
|
|
798
|
-
filename:
|
|
828
|
+
filename: path7.relative(absolutePathToEmailsDirectory, dependentPath)
|
|
799
829
|
});
|
|
800
830
|
}
|
|
801
831
|
reload();
|
|
@@ -806,7 +836,7 @@ var setupHotreloading = async (devServer2, emailDirRelativePath) => {
|
|
|
806
836
|
// src/cli/utils/tree.ts
|
|
807
837
|
import { promises as fs4 } from "node:fs";
|
|
808
838
|
import os from "node:os";
|
|
809
|
-
import
|
|
839
|
+
import path8 from "node:path";
|
|
810
840
|
var SYMBOLS = {
|
|
811
841
|
BRANCH: "\u251C\u2500\u2500 ",
|
|
812
842
|
EMPTY: "",
|
|
@@ -816,8 +846,8 @@ var SYMBOLS = {
|
|
|
816
846
|
};
|
|
817
847
|
var getTreeLines = async (dirPath, depth, currentDepth = 0) => {
|
|
818
848
|
const base = process.cwd();
|
|
819
|
-
const dirFullpath =
|
|
820
|
-
const dirname2 =
|
|
849
|
+
const dirFullpath = path8.resolve(base, dirPath);
|
|
850
|
+
const dirname2 = path8.basename(dirFullpath);
|
|
821
851
|
let lines = [dirname2];
|
|
822
852
|
const dirStat = await fs4.stat(dirFullpath);
|
|
823
853
|
if (dirStat.isDirectory() && currentDepth < depth) {
|
|
@@ -839,7 +869,7 @@ var getTreeLines = async (dirPath, depth, currentDepth = 0) => {
|
|
|
839
869
|
if (dirent.isFile()) {
|
|
840
870
|
lines.push(`${branchingSymbol}${dirent.name}`);
|
|
841
871
|
} else {
|
|
842
|
-
const pathToDirectory =
|
|
872
|
+
const pathToDirectory = path8.join(dirFullpath, dirent.name);
|
|
843
873
|
const treeLinesForSubDirectory = await getTreeLines(
|
|
844
874
|
pathToDirectory,
|
|
845
875
|
depth,
|
|
@@ -918,7 +948,7 @@ module.exports = {
|
|
|
918
948
|
},
|
|
919
949
|
}`;
|
|
920
950
|
await fs5.promises.writeFile(
|
|
921
|
-
|
|
951
|
+
path9.resolve(builtPreviewAppPath, "./next.config.js"),
|
|
922
952
|
nextConfigContents,
|
|
923
953
|
"utf8"
|
|
924
954
|
);
|
|
@@ -928,7 +958,7 @@ var getEmailSlugsFromEmailDirectory = (emailDirectory, emailsDirectoryAbsolutePa
|
|
|
928
958
|
const slugs = [];
|
|
929
959
|
emailDirectory.emailFilenames.forEach(
|
|
930
960
|
(filename3) => slugs.push(
|
|
931
|
-
|
|
961
|
+
path9.join(directoryPathRelativeToEmailsDirectory, filename3).split(path9.sep).filter((segment) => segment.length > 0)
|
|
932
962
|
)
|
|
933
963
|
);
|
|
934
964
|
emailDirectory.subDirectories.forEach((directory) => {
|
|
@@ -959,13 +989,13 @@ var forceSSGForEmailPreviews = async (emailsDirPath, builtPreviewAppPath) => {
|
|
|
959
989
|
);
|
|
960
990
|
};
|
|
961
991
|
await removeForceDynamic(
|
|
962
|
-
|
|
992
|
+
path9.resolve(builtPreviewAppPath, "./src/app/layout.tsx")
|
|
963
993
|
);
|
|
964
994
|
await removeForceDynamic(
|
|
965
|
-
|
|
995
|
+
path9.resolve(builtPreviewAppPath, "./src/app/preview/[...slug]/page.tsx")
|
|
966
996
|
);
|
|
967
997
|
await fs5.promises.appendFile(
|
|
968
|
-
|
|
998
|
+
path9.resolve(builtPreviewAppPath, "./src/app/preview/[...slug]/page.tsx"),
|
|
969
999
|
`
|
|
970
1000
|
|
|
971
1001
|
export function generateStaticParams() {
|
|
@@ -977,7 +1007,7 @@ export function generateStaticParams() {
|
|
|
977
1007
|
);
|
|
978
1008
|
};
|
|
979
1009
|
var updatePackageJson = async (builtPreviewAppPath) => {
|
|
980
|
-
const packageJsonPath =
|
|
1010
|
+
const packageJsonPath = path9.resolve(builtPreviewAppPath, "./package.json");
|
|
981
1011
|
const packageJson = JSON.parse(
|
|
982
1012
|
await fs5.promises.readFile(packageJsonPath, "utf8")
|
|
983
1013
|
);
|
|
@@ -1036,9 +1066,9 @@ var build = async ({
|
|
|
1036
1066
|
if (!fs5.existsSync(emailsDirRelativePath)) {
|
|
1037
1067
|
process.exit(1);
|
|
1038
1068
|
}
|
|
1039
|
-
const emailsDirPath =
|
|
1040
|
-
const staticPath =
|
|
1041
|
-
const builtPreviewAppPath =
|
|
1069
|
+
const emailsDirPath = path9.join(process.cwd(), emailsDirRelativePath);
|
|
1070
|
+
const staticPath = path9.join(emailsDirPath, "static");
|
|
1071
|
+
const builtPreviewAppPath = path9.join(process.cwd(), ".react-email");
|
|
1042
1072
|
if (fs5.existsSync(builtPreviewAppPath)) {
|
|
1043
1073
|
spinner.text = "Deleting pre-existing `.react-email` folder";
|
|
1044
1074
|
await fs5.promises.rm(builtPreviewAppPath, { recursive: true });
|
|
@@ -1052,7 +1082,7 @@ var build = async ({
|
|
|
1052
1082
|
});
|
|
1053
1083
|
if (fs5.existsSync(staticPath)) {
|
|
1054
1084
|
spinner.text = "Copying `static` folder into `.react-email/public/static`";
|
|
1055
|
-
const builtStaticDirectory =
|
|
1085
|
+
const builtStaticDirectory = path9.resolve(
|
|
1056
1086
|
builtPreviewAppPath,
|
|
1057
1087
|
"./public/static"
|
|
1058
1088
|
);
|
|
@@ -1106,7 +1136,7 @@ var dev = async ({ dir: emailsDirRelativePath, port }) => {
|
|
|
1106
1136
|
// src/cli/commands/export.ts
|
|
1107
1137
|
import fs8, { unlinkSync, writeFileSync } from "node:fs";
|
|
1108
1138
|
import { createRequire } from "node:module";
|
|
1109
|
-
import
|
|
1139
|
+
import path11 from "node:path";
|
|
1110
1140
|
import url2 from "node:url";
|
|
1111
1141
|
import { build as build2 } from "esbuild";
|
|
1112
1142
|
import { glob } from "glob";
|
|
@@ -1116,7 +1146,7 @@ import ora3 from "ora";
|
|
|
1116
1146
|
|
|
1117
1147
|
// src/utils/esbuild/renderring-utilities-exporter.ts
|
|
1118
1148
|
import { promises as fs7 } from "node:fs";
|
|
1119
|
-
import
|
|
1149
|
+
import path10 from "node:path";
|
|
1120
1150
|
|
|
1121
1151
|
// src/utils/esbuild/escape-string-for-regex.ts
|
|
1122
1152
|
function escapeStringForRegex(string) {
|
|
@@ -1139,7 +1169,7 @@ var renderingUtilitiesExporter = (emailTemplates) => ({
|
|
|
1139
1169
|
export { render } from 'react-email-module-that-will-export-render'
|
|
1140
1170
|
export { createElement as reactEmailCreateReactElement } from 'react';
|
|
1141
1171
|
`,
|
|
1142
|
-
loader:
|
|
1172
|
+
loader: path10.extname(pathToFile).slice(1)
|
|
1143
1173
|
};
|
|
1144
1174
|
}
|
|
1145
1175
|
);
|
|
@@ -1170,7 +1200,7 @@ var renderingUtilitiesExporter = (emailTemplates) => ({
|
|
|
1170
1200
|
var getEmailTemplatesFromDirectory = (emailDirectory) => {
|
|
1171
1201
|
const templatePaths = [];
|
|
1172
1202
|
emailDirectory.emailFilenames.forEach(
|
|
1173
|
-
(filename3) => templatePaths.push(
|
|
1203
|
+
(filename3) => templatePaths.push(path11.join(emailDirectory.absolutePath, filename3))
|
|
1174
1204
|
);
|
|
1175
1205
|
emailDirectory.subDirectories.forEach((directory) => {
|
|
1176
1206
|
templatePaths.push(...getEmailTemplatesFromDirectory(directory));
|
|
@@ -1189,7 +1219,7 @@ var exportTemplates = async (pathToWhereEmailMarkupShouldBeDumped, emailsDirecto
|
|
|
1189
1219
|
registerSpinnerAutostopping(spinner);
|
|
1190
1220
|
}
|
|
1191
1221
|
const emailsDirectoryMetadata = await getEmailsDirectoryMetadata(
|
|
1192
|
-
|
|
1222
|
+
path11.resolve(process.cwd(), emailsDirectoryPath),
|
|
1193
1223
|
true
|
|
1194
1224
|
);
|
|
1195
1225
|
if (typeof emailsDirectoryMetadata === "undefined") {
|
|
@@ -1271,9 +1301,9 @@ ${buildFailure.message}`);
|
|
|
1271
1301
|
spinner.text = "Copying static files";
|
|
1272
1302
|
spinner.render();
|
|
1273
1303
|
}
|
|
1274
|
-
const staticDirectoryPath =
|
|
1304
|
+
const staticDirectoryPath = path11.join(emailsDirectoryPath, "static");
|
|
1275
1305
|
if (fs8.existsSync(staticDirectoryPath)) {
|
|
1276
|
-
const pathToDumpStaticFilesInto =
|
|
1306
|
+
const pathToDumpStaticFilesInto = path11.join(
|
|
1277
1307
|
pathToWhereEmailMarkupShouldBeDumped,
|
|
1278
1308
|
"static"
|
|
1279
1309
|
);
|
|
@@ -1311,11 +1341,11 @@ ${buildFailure.message}`);
|
|
|
1311
1341
|
// src/cli/commands/start.ts
|
|
1312
1342
|
import { spawn as spawn2 } from "node:child_process";
|
|
1313
1343
|
import fs9 from "node:fs";
|
|
1314
|
-
import
|
|
1344
|
+
import path12 from "node:path";
|
|
1315
1345
|
var start = async () => {
|
|
1316
1346
|
try {
|
|
1317
1347
|
const usersProjectLocation = process.cwd();
|
|
1318
|
-
const builtPreviewPath =
|
|
1348
|
+
const builtPreviewPath = path12.resolve(
|
|
1319
1349
|
usersProjectLocation,
|
|
1320
1350
|
"./.react-email"
|
|
1321
1351
|
);
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from '@react-email/body';
|
|
2
|
+
export * from '@react-email/button';
|
|
3
|
+
export * from '@react-email/code-block';
|
|
4
|
+
export * from '@react-email/code-inline';
|
|
5
|
+
export * from '@react-email/column';
|
|
6
|
+
export * from '@react-email/container';
|
|
7
|
+
export * from '@react-email/font';
|
|
8
|
+
export * from '@react-email/head';
|
|
9
|
+
export * from '@react-email/heading';
|
|
10
|
+
export * from '@react-email/hr';
|
|
11
|
+
export * from '@react-email/html';
|
|
12
|
+
export * from '@react-email/img';
|
|
13
|
+
export * from '@react-email/link';
|
|
14
|
+
export * from '@react-email/markdown';
|
|
15
|
+
export * from '@react-email/preview';
|
|
16
|
+
export * from '@react-email/render';
|
|
17
|
+
export * from '@react-email/row';
|
|
18
|
+
export * from '@react-email/section';
|
|
19
|
+
export * from '@react-email/tailwind';
|
|
20
|
+
export * from '@react-email/text';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from '@react-email/body';
|
|
2
|
+
export * from '@react-email/button';
|
|
3
|
+
export * from '@react-email/code-block';
|
|
4
|
+
export * from '@react-email/code-inline';
|
|
5
|
+
export * from '@react-email/column';
|
|
6
|
+
export * from '@react-email/container';
|
|
7
|
+
export * from '@react-email/font';
|
|
8
|
+
export * from '@react-email/head';
|
|
9
|
+
export * from '@react-email/heading';
|
|
10
|
+
export * from '@react-email/hr';
|
|
11
|
+
export * from '@react-email/html';
|
|
12
|
+
export * from '@react-email/img';
|
|
13
|
+
export * from '@react-email/link';
|
|
14
|
+
export * from '@react-email/markdown';
|
|
15
|
+
export * from '@react-email/preview';
|
|
16
|
+
export * from '@react-email/render';
|
|
17
|
+
export * from '@react-email/row';
|
|
18
|
+
export * from '@react-email/section';
|
|
19
|
+
export * from '@react-email/tailwind';
|
|
20
|
+
export * from '@react-email/text';
|