react-email 2.0.0-canary.3 → 2.0.0-canary.4
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 +1 -1
- package/cli/index.mjs +1 -1
- package/dist/package.json +53 -0
- package/dist/source/commands/dev.d.ts +8 -0
- package/dist/source/commands/dev.d.ts.map +1 -0
- package/dist/source/commands/dev.js +80 -0
- package/dist/source/commands/export.d.ts +3 -0
- package/dist/source/commands/export.d.ts.map +1 -0
- package/dist/source/commands/export.js +174 -0
- package/dist/source/commands/preview.d.ts +10 -0
- package/dist/source/commands/preview.d.ts.map +1 -0
- package/dist/source/commands/preview.js +108 -0
- package/dist/source/index.d.ts +3 -0
- package/dist/source/index.d.ts.map +1 -0
- package/dist/source/index.js +46 -0
- package/dist/source/utils/close-ora-on-sigint.d.ts +3 -0
- package/dist/source/utils/close-ora-on-sigint.d.ts.map +1 -0
- package/dist/source/utils/close-ora-on-sigint.js +9 -0
- package/dist/source/utils/constants.d.ts +10 -0
- package/dist/source/utils/constants.d.ts.map +1 -0
- package/dist/source/utils/constants.js +21 -0
- package/dist/source/utils/convert-to-absolute-path.d.ts +2 -0
- package/dist/source/utils/convert-to-absolute-path.d.ts.map +1 -0
- package/dist/source/utils/convert-to-absolute-path.js +11 -0
- package/dist/source/utils/download-client.d.ts +2 -0
- package/dist/source/utils/download-client.d.ts.map +1 -0
- package/dist/source/utils/download-client.js +71 -0
- package/dist/source/utils/generate-email-preview.d.ts +2 -0
- package/dist/source/utils/generate-email-preview.d.ts.map +1 -0
- package/dist/source/utils/generate-email-preview.js +150 -0
- package/dist/source/utils/index.d.ts +9 -0
- package/dist/source/utils/index.d.ts.map +1 -0
- package/dist/source/utils/index.js +24 -0
- package/dist/source/utils/install-dependencies.d.ts +3 -0
- package/dist/source/utils/install-dependencies.d.ts.map +1 -0
- package/dist/source/utils/install-dependencies.js +23 -0
- package/dist/source/utils/run-server.d.ts +9 -0
- package/dist/source/utils/run-server.d.ts.map +1 -0
- package/dist/source/utils/run-server.js +102 -0
- package/dist/source/utils/start-server-command.d.ts +4 -0
- package/dist/source/utils/start-server-command.d.ts.map +1 -0
- package/dist/source/utils/start-server-command.js +54 -0
- package/dist/source/utils/sync-package.d.ts +2 -0
- package/dist/source/utils/sync-package.d.ts.map +1 -0
- package/dist/source/utils/sync-package.js +76 -0
- package/dist/source/utils/tree.d.ts +2 -0
- package/dist/source/utils/tree.d.ts.map +1 -0
- package/dist/source/utils/tree.js +58 -0
- package/dist/source/utils/watcher.d.ts +4 -0
- package/dist/source/utils/watcher.d.ts.map +1 -0
- package/dist/source/utils/watcher.js +53 -0
- package/package.json +1 -1
- package/src/app/preview/[slug]/rendering-error.tsx +19 -3
- package/src/components/sidebar/sidebar-directory-children.tsx +5 -1
- package/src/components/sidebar/sidebar.tsx +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../../source/utils/watcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAU1C,eAAO,MAAM,qBAAqB,aAAc,MAAM,cAerD,CAAC;AAEF,eAAO,MAAM,OAAO,oBAAqB,SAAS,YAAY,MAAM,SAkCnE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.watcher = exports.createWatcherInstance = void 0;
|
|
7
|
+
var node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
var node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
var chokidar_1 = require("chokidar");
|
|
10
|
+
var shelljs_1 = require("shelljs");
|
|
11
|
+
var constants_1 = require("./constants");
|
|
12
|
+
var generate_email_preview_1 = require("./generate-email-preview");
|
|
13
|
+
var createWatcherInstance = function (watchDir) {
|
|
14
|
+
var watcher = (0, chokidar_1.watch)(watchDir, {
|
|
15
|
+
ignoreInitial: true,
|
|
16
|
+
cwd: watchDir.split(node_path_1.default.sep).slice(0, -1).join(node_path_1.default.sep),
|
|
17
|
+
ignored: /(^|[/\\])\../,
|
|
18
|
+
});
|
|
19
|
+
// Catches ctrl+c event
|
|
20
|
+
var exit = function () {
|
|
21
|
+
void watcher.close();
|
|
22
|
+
};
|
|
23
|
+
process.on('SIGINT', exit);
|
|
24
|
+
process.on('uncaughtException', exit);
|
|
25
|
+
return watcher;
|
|
26
|
+
};
|
|
27
|
+
exports.createWatcherInstance = createWatcherInstance;
|
|
28
|
+
var watcher = function (watcherInstance, watchDir) {
|
|
29
|
+
watcherInstance.on('all', function (event, filename) {
|
|
30
|
+
var file = filename.split(node_path_1.default.sep);
|
|
31
|
+
if (file[1] === undefined) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (event === constants_1.EVENT_FILE_DELETED) {
|
|
35
|
+
if (file[1] === 'static' && file[2]) {
|
|
36
|
+
node_fs_1.default.rmSync(node_path_1.default.join(constants_1.REACT_EMAIL_ROOT, 'public', 'static', file[2]));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
node_fs_1.default.rmSync(node_path_1.default.join(constants_1.REACT_EMAIL_ROOT, filename));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (file[1] === 'static' && file[2]) {
|
|
43
|
+
var srcPath = node_path_1.default.join(watchDir, 'static', file[2]);
|
|
44
|
+
var result = (0, shelljs_1.cp)('-r', srcPath, node_path_1.default.join(constants_1.REACT_EMAIL_ROOT, 'public', 'static'));
|
|
45
|
+
if (result.code > 0) {
|
|
46
|
+
throw new Error("Something went wrong while copying the file to ".concat(constants_1.PACKAGE_EMAILS_PATH, ", ").concat(result.cat()));
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
void (0, generate_email_preview_1.generateEmailsPreview)(watchDir, 'templates');
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
exports.watcher = watcher;
|
package/package.json
CHANGED
|
@@ -5,13 +5,29 @@ export const RenderingError = (props: { error: ErrorObject }) => {
|
|
|
5
5
|
return (
|
|
6
6
|
<>
|
|
7
7
|
<div className="absolute inset-0 z-50 bg-black/80" />
|
|
8
|
-
<div className="md:max-w-[568px] lg:max-w-[968px] absolute left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-
|
|
8
|
+
<div className="md:max-w-[568px] lg:max-w-[968px] absolute left-[50%] top-[50%] min-h-[50vh] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-t-4 border-red-500 bg-white text-black p-6 shadow-lg duration-200 sm:rounded-lg rounded-t-sm">
|
|
9
9
|
<div className="flex flex-col max-w-full min-w-0 space-y-1.5">
|
|
10
|
-
<h2 className="text-lg font-semibold pb-2 leading-none tracking-tight">
|
|
10
|
+
<h2 className="text-lg flex items-center flex-shrink gap-2 font-semibold pb-2 leading-none tracking-tight">
|
|
11
|
+
<svg
|
|
12
|
+
className="h-6 w-6 text-red-600 font-extrabold"
|
|
13
|
+
fill="none"
|
|
14
|
+
height="24"
|
|
15
|
+
stroke="currentColor"
|
|
16
|
+
strokeLinecap="round"
|
|
17
|
+
strokeLinejoin="round"
|
|
18
|
+
strokeWidth="2"
|
|
19
|
+
viewBox="0 0 24 24"
|
|
20
|
+
width="24"
|
|
21
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
22
|
+
>
|
|
23
|
+
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" />
|
|
24
|
+
<path d="M12 9v4" />
|
|
25
|
+
<path d="M12 17h.01" />
|
|
26
|
+
</svg>
|
|
11
27
|
{props.error.name}: {props.error.message}
|
|
12
28
|
</h2>
|
|
13
29
|
{props.error.stack ? (
|
|
14
|
-
<div className="text-sm p-2 scroll-px-4 overflow-x-auto bg-red-
|
|
30
|
+
<div className="text-sm p-2 flex-grow scroll-px-4 overflow-x-auto bg-red-800 rounded-lg text-gray-100">
|
|
15
31
|
<pre className="font-mono w-full min-w-0 leading-7">
|
|
16
32
|
{props.error.stack}
|
|
17
33
|
</pre>
|
|
@@ -85,7 +85,11 @@ export const SidebarDirectoryChildren = (props: {
|
|
|
85
85
|
<div className="bg-cyan-11 w-px absolute top-1 left-2.5 h-6" />
|
|
86
86
|
</motion.span>
|
|
87
87
|
) : null}
|
|
88
|
-
<IconFile
|
|
88
|
+
<IconFile
|
|
89
|
+
className="absolute left-4 w-[24px] h-[24px]"
|
|
90
|
+
height="24"
|
|
91
|
+
width="24"
|
|
92
|
+
/>
|
|
89
93
|
<span className="truncate pl-8">{emailFilename}</span>
|
|
90
94
|
</motion.span>
|
|
91
95
|
</Link>
|
|
@@ -17,7 +17,11 @@ export const Sidebar = React.forwardRef<SidebarElement, Readonly<SidebarProps>>(
|
|
|
17
17
|
const { emailsDirectoryMetadata } = useEmails();
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<aside
|
|
20
|
+
<aside
|
|
21
|
+
className={cn('border-r border-slate-6', className)}
|
|
22
|
+
ref={forwardedRef}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
21
25
|
<nav className="p-6 w-screen h-full md:w-full md:min-w-[275px] md:max-w-[275px] flex flex-col gap-4">
|
|
22
26
|
<SidebarDirectory
|
|
23
27
|
className="min-w-full w-full"
|