Skip to content

Commit b81119c

Browse files
committed
chore: esm work
1 parent e0d9fdc commit b81119c

File tree

68 files changed

+2236
-1432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2236
-1432
lines changed

.moon/tasks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ tasks:
3232
- package.json
3333

3434
compile:
35-
command: tshy
35+
command: tsc --project tsconfig.json
3636
inputs:
3737
- src
3838
- package.json

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"bootstrap": "./shared/bootstrap.sh",
7-
"prepare": "husky install"
7+
"prepare": "husky"
88
},
99
"devDependencies": {
1010
"@dot/versioner": "^0.4.2",
@@ -24,8 +24,7 @@
2424
"prettier": "^3.5.3",
2525
"prettier-plugin-package": "^1.4.0",
2626
"ts-node": "10.9.2",
27-
"tshy": "^3.0.2",
28-
"typescript": "^5.2.2",
27+
"typescript": "^5.8.3",
2928
"vitest": "^3.1.1"
3029
},
3130
"lint-staged": {

packages/create-jsx-email/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"@types/yargs-parser": "^21.0.3",
3434
"chalk-template": "^1.1.0",
3535
"detect-package-manager": "^3.0.1",
36-
"globby": "14.0.2",
36+
"globby": "14.1.0",
3737
"mustache": "^4.2.0",
3838
"prompts": "^2.4.2",
3939
"yargs-parser": "^21.1.1"

packages/jsx-email/bin/email

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env -S node --enable-source-maps --no-warnings=ExperimentalWarning
2-
import './../dist/esm/cli/main.mjs';
2+
import './../dist/cli/main.mjs';

packages/jsx-email/moon.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tasks:
2828
cache: false
2929

3030
compile:
31-
command: tshy
31+
command: tsc --project tsconfig.json
3232
inputs:
3333
- src
3434
- package.json

packages/jsx-email/package.json

Lines changed: 31 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,23 @@
1313
},
1414
"author": "Andrew Powell <[email protected]>",
1515
"homepage": "https://jsx.email/",
16-
"main": "./dist/commonjs/index.js",
1716
"bin": {
1817
"email": "./bin/email"
1918
},
2019
"type": "module",
2120
"exports": {
2221
"./package.json": "./package.json",
2322
".": {
24-
"import": {
25-
"types": "./dist/esm/index.d.ts",
26-
"default": "./dist/esm/index.js"
27-
},
28-
"require": {
29-
"types": "./dist/commonjs/index.d.ts",
30-
"default": "./dist/commonjs/index.js"
31-
}
23+
"types": "./dist/index.d.ts",
24+
"default": "./dist/index.js"
3225
},
3326
"./compile": {
34-
"import": {
35-
"types": "./dist/esm/compile.d.ts",
36-
"default": "./dist/esm/compile.js"
37-
},
38-
"require": {
39-
"types": "./dist/commonjs/compile.d.ts",
40-
"default": "./dist/commonjs/compile.js"
41-
}
27+
"types": "./dist/compile.d.ts",
28+
"default": "./dist/compile.js"
4229
},
4330
"./config": {
44-
"import": {
45-
"types": "./dist/esm/config.d.ts",
46-
"default": "./dist/esm/config.js"
47-
},
48-
"require": {
49-
"types": "./dist/commonjs/config.d.ts",
50-
"default": "./dist/commonjs/config.js"
51-
}
31+
"types": "./dist/config.d.ts",
32+
"default": "./dist/config.js"
5233
}
5334
},
5435
"engines": {
@@ -70,54 +51,55 @@
7051
"react-dom": "^18.2.0 || ^19"
7152
},
7253
"dependencies": {
73-
"@dot/log": "^0.1.5",
54+
"@dot/log": "^0.2.0",
7455
"@jsx-email/doiuse-email": "^1.0.1",
7556
"@parcel/watcher": "^2.4.1",
7657
"@radix-ui/colors": "3.0.0",
77-
"@radix-ui/react-collapsible": "1.1.1",
58+
"@radix-ui/react-collapsible": "1.1.4",
7859
"@radix-ui/react-icons": "^1.3.0",
79-
"@radix-ui/react-popover": "1.1.2",
60+
"@radix-ui/react-popover": "1.1.7",
8061
"@radix-ui/react-select": "^2.0.0",
81-
"@radix-ui/react-slot": "1.1.0",
82-
"@radix-ui/react-toggle-group": "1.1.0",
83-
"@unocss/core": "^0.65.1",
84-
"@unocss/preset-rem-to-px": "^0.65.1",
85-
"@unocss/preset-typography": "^0.65.1",
86-
"@unocss/preset-uno": "^0.65.1",
87-
"@unocss/preset-wind": "^0.65.1",
88-
"@unocss/transformer-compile-class": "^0.65.1",
89-
"@unocss/transformer-variant-group": "^0.65.1",
62+
"@radix-ui/react-slot": "1.2.0",
63+
"@radix-ui/react-toggle-group": "1.1.3",
64+
"@unocss/core": "^66.0.0",
65+
"@unocss/preset-rem-to-px": "^66.0.0",
66+
"@unocss/preset-typography": "^66.0.0",
67+
"@unocss/preset-uno": "^66.0.0",
68+
"@unocss/preset-wind": "^66.0.0",
69+
"@unocss/transformer-compile-class": "^66.0.0",
70+
"@unocss/transformer-variant-group": "^66.0.0",
9071
"@vitejs/plugin-react": "^4.3.0",
9172
"autoprefixer": "^10.4.16",
92-
"chalk": "4.1.2",
73+
"chalk": "5.4.1",
74+
"chalk-template": "^1.1.0",
9375
"classnames": "2.5.1",
9476
"debug": "^4.3.4",
95-
"esbuild": "^0.24.0",
77+
"esbuild": "^0.25.2",
9678
"find-up": "^7.0.0",
97-
"framer-motion": "11.12.0",
98-
"globby": "14.0.2",
79+
"framer-motion": "12.7.3",
80+
"globby": "14.1.0",
9981
"hash-it": "^6.0.0",
10082
"html-to-text": "9.0.5",
10183
"lilconfig": "^3.1.2",
10284
"magic-string": "^0.30.5",
103-
"md-to-react-email": "5.0.4",
85+
"md-to-react-email": "5.0.5",
10486
"micromatch": "^4.0.5",
105-
"mime-types": "^2.1.35",
87+
"mime-types": "^3.0.1",
10688
"mustache": "^4.2.0",
10789
"postcss": "^8.4.32",
10890
"postcss-var-replace": "^1.0.0",
10991
"pretty-bytes": "^6.1.1",
110-
"react-router-dom": "7.0.1",
92+
"react-router-dom": "7.5.0",
11193
"rehype": "^13.0.1",
11294
"rehype-stringify": "^10.0.0",
113-
"shiki": "^1.18.0",
95+
"shiki": "^3.2.2",
11496
"source-map-support": "^0.5.21",
11597
"std-env": "^3.6.0",
116-
"tailwindcss": "3.4.15",
98+
"tailwindcss": "4.1.4",
11799
"titleize": "^4.0.0",
118100
"unist-util-visit": "^5.0.0",
119-
"valibot": "^0.42.1",
120-
"vite": "^5.2.11",
101+
"valibot": "^1.0.0",
102+
"vite": "^6.2.6",
121103
"yargs-parser": "^21.1.1"
122104
},
123105
"devDependencies": {
@@ -136,7 +118,7 @@
136118
"hast": "^1.0.0",
137119
"unified": "^11.0.4"
138120
},
139-
"types": "./dist/commonjs/index.d.ts",
121+
"types": "./dist/index.d.ts",
140122
"funding": {
141123
"type": "github",
142124
"url": "https://github.com/sponsors/shellscape"

packages/jsx-email/src/cli/commands/build.mts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import os from 'node:os';
44
import { dirname, basename, extname, join, resolve, win32, posix } from 'path';
55
import { pathToFileURL } from 'url';
66

7-
import chalk from 'chalk';
7+
import chalkTmpl from 'chalk-template';
88
import { globby } from 'globby';
99
import micromatch from 'micromatch';
1010
import { isWindows } from 'std-env';
@@ -64,7 +64,7 @@ export interface BuildTempatesResult extends BuildResult {
6464
fileName: string;
6565
}
6666

67-
export const help = chalk`
67+
export const help = chalkTmpl`
6868
{blue email build}
6969
7070
Builds a template and saves the result
@@ -110,7 +110,7 @@ export const build = async (options: BuildOptions): Promise<BuildResult> => {
110110

111111
if (typeof componentExport !== 'function') {
112112
log.error(
113-
chalk`{red Template Export Problem:} ${path} doesn't have an export of a JSX Element named \`Template\`. If you feel this is a bug, please open a new issue.`
113+
chalkTmpl`{red Template Export Problem:} ${path} doesn't have an export of a JSX Element named \`Template\`. If you feel this is a bug, please open a new issue.`
114114
);
115115
process.exit(1);
116116
}
@@ -175,9 +175,9 @@ export const buildTemplates = async ({ targetPath, buildOptions }: BuildTemplate
175175

176176
if (!silent) {
177177
const suffix = targetFiles.length > 1 ? 's' : '';
178-
log.info(chalk`{cyan Found}`, targetFiles.length, `file${suffix}:`);
178+
log.info(chalkTmpl`{cyan Found}`, targetFiles.length, `file${suffix}:`);
179179
log.info(' ', targetFiles.join('\n '), '\n');
180-
log.info(chalk`{blue Starting build...}`);
180+
log.info(chalkTmpl`{blue Starting build...}`);
181181
}
182182

183183
const compiledFiles = await compile({
@@ -215,14 +215,14 @@ export const buildTemplates = async ({ targetPath, buildOptions }: BuildTemplate
215215
if (!silent) {
216216
if (showStats && largeCount > 0) {
217217
log.warn('');
218-
log.warn(chalk`${largeCount} template(s) exceed the 102kb Gmail Clipping limit`);
218+
log.warn(chalkTmpl`${largeCount} template(s) exceed the 102kb Gmail Clipping limit`);
219219
}
220220
if (writeToFile) {
221221
log.info('');
222-
log.info(chalk`{green Build complete}. File(s) written to:`, outputPath);
222+
log.info(chalkTmpl`{green Build complete}. File(s) written to:`, outputPath);
223223
} else {
224224
log.info('');
225-
log.info(chalk`{green Build complete}`);
225+
log.info(chalkTmpl`{green Build complete}`);
226226
}
227227
}
228228

@@ -235,7 +235,7 @@ export const command: CommandFn = async (argv: BuildCommandOptions, input) => {
235235
const [targetPath] = input;
236236

237237
if (!existsSync(targetPath)) {
238-
log.error(chalk`{red The provided build target '${targetPath}' does not exist}`);
238+
log.error(chalkTmpl`{red The provided build target '${targetPath}' does not exist}`);
239239
process.exit(1);
240240
}
241241

packages/jsx-email/src/cli/commands/check.mts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { lstat } from 'node:fs/promises';
22

33
import { doIUseEmail } from '@jsx-email/doiuse-email';
44
import chalk from 'chalk';
5+
import chalkTmpl from 'chalk-template';
56
import { parse as assert, object, type InferOutput as Infer } from 'valibot';
67

78
import { formatBytes, gmailByteLimit, gmailBytesSafe } from '../helpers.mjs';
@@ -25,7 +26,7 @@ const emailClients = [
2526
];
2627

2728
const formatSubject = (what: string) =>
28-
what.replace(/`([\s\w<>.-]+)`/g, (_, bit) => chalk`{bold ${bit}}`).trim();
29+
what.replace(/`([\s\w<>.-]+)`/g, (_, bit) => chalkTmpl`{bold ${bit}}`).trim();
2930

3031
const combine = (lines: string[]) => {
3132
const rePreamble = /(`([\s\w<>.-]+)`[\s\w]+)/;
@@ -46,7 +47,7 @@ const combine = (lines: string[]) => {
4647
return result;
4748
};
4849

49-
export const help = chalk`
50+
export const help = chalkTmpl`
5051
{blue email check}
5152
5253
Check jsx-email templates for client compatibility
@@ -67,14 +68,14 @@ const runCheck = (fileName: string, html: string) => {
6768

6869
if (success && !result.warnings) return;
6970

70-
log(chalk`{underline ${fileName}} → HTML: ${htmlSize}\n`);
71+
log(chalkTmpl`{underline ${fileName}} → HTML: ${htmlSize}\n`);
7172

7273
if (!success && result.errors?.length) {
7374
const errors = combine(result.errors);
7475
const indent = ' ';
7576
for (const [preamble, clients] of Object.entries(errors)) {
7677
log(
77-
chalk` {red error} ${formatSubject(preamble)}:\n${indent}{dim ${clients.join(
78+
chalkTmpl` {red error} ${formatSubject(preamble)}:\n${indent}{dim ${clients.join(
7879
`\n${indent}`
7980
)}}\n`
8081
);
@@ -84,7 +85,7 @@ const runCheck = (fileName: string, html: string) => {
8485
}
8586

8687
if (bytes >= gmailByteLimit) {
87-
log(chalk` {red error} HTML content is over the Gmail Clipping Limit: ${htmlSize}\n`);
88+
log(chalkTmpl` {red error} HTML content is over the Gmail Clipping Limit: ${htmlSize}\n`);
8889
counts.errors += 1;
8990
}
9091

@@ -93,7 +94,7 @@ const runCheck = (fileName: string, html: string) => {
9394
const indent = ' ';
9495
for (const [preamble, clients] of Object.entries(warnings)) {
9596
log(
96-
chalk` {yellow warn} ${formatSubject(preamble)}:\n${indent}{dim ${clients.join(
97+
chalkTmpl` {yellow warn} ${formatSubject(preamble)}:\n${indent}{dim ${clients.join(
9798
`\n${indent}`
9899
)}}\n`
99100
);
@@ -102,21 +103,22 @@ const runCheck = (fileName: string, html: string) => {
102103
}
103104

104105
if (bytes > gmailBytesSafe && bytes < gmailByteLimit) {
105-
log(chalk` {red warn} HTML content is near the Gmail Clipping Limit: ${htmlSize}\n`);
106+
log(chalkTmpl` {red warn} HTML content is near the Gmail Clipping Limit: ${htmlSize}\n`);
106107
counts.warnings += 1;
107108
}
108109

109110
const errors = counts.errors > 0 ? chalk.red(counts.errors) : chalk.green(counts.errors);
110111
const warnings =
111112
counts.warnings > 0 ? chalk.yellow(counts.warnings) : chalk.green(counts.warnings);
112113

113-
log(chalk`{green Check Complete:} ${errors} error(s), ${warnings} warning(s)`);
114+
log(chalkTmpl`{green Check Complete:} ${errors} error(s), ${warnings} warning(s)`);
114115
};
115116

116117
export const command: CommandFn = async (argv: CheckOptions, input) => {
117118
if (input.length !== 1) return false;
118119

119-
const noExists = () => error(chalk`{red '${input}' doesn't appear to be a file which exists}`);
120+
const noExists = () =>
121+
error(chalkTmpl`{red '${input}' doesn't appear to be a file which exists}`);
120122

121123
try {
122124
const stat = await lstat(input[0]);
@@ -128,7 +130,7 @@ export const command: CommandFn = async (argv: CheckOptions, input) => {
128130

129131
assert(CheckOptionsStruct, argv);
130132

131-
log(chalk`{blue Checking email template for Client Compatibility...}\n`);
133+
log(chalkTmpl`{blue Checking email template for Client Compatibility...}\n`);
132134

133135
const [file] = await buildTemplates({
134136
buildOptions: { showStats: false, writeToFile: false },

packages/jsx-email/src/cli/commands/create.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { mkdir, readFile, writeFile } from 'node:fs/promises';
22
import { dirname, join, resolve } from 'node:path';
33
import { fileURLToPath } from 'node:url';
44

5-
import chalk from 'chalk';
5+
import chalk from 'chalk-template';
66
import mustache from 'mustache';
77
import {
88
parse as assert,

packages/jsx-email/src/cli/commands/help.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import chalk from 'chalk';
1+
import chalk from 'chalk-template';
22

33
import { name, version } from '../../package-info.cjs';
44

0 commit comments

Comments
 (0)