diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 7052b90d2a..5e76e542b5 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -1,5 +1,12 @@ # @react-email/components +## 0.0.38 + +### Patch Changes + +- Updated dependencies [6cd353b] + - @react-email/text@0.1.3 + ## 0.0.37 ### Patch Changes diff --git a/packages/components/package.json b/packages/components/package.json index 62ab2bc1cb..44b217e7b5 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@react-email/components", - "version": "0.0.37", + "version": "0.0.38", "description": "A collection of all components React Email.", "sideEffects": false, "main": "./dist/index.js", @@ -59,7 +59,7 @@ "@react-email/row": "workspace:0.0.12", "@react-email/section": "workspace:0.0.16", "@react-email/tailwind": "workspace:1.0.5", - "@react-email/text": "workspace:0.1.2" + "@react-email/text": "workspace:0.1.3" }, "peerDependencies": { "react": "^18.0 || ^19.0 || ^19.0.0-rc" diff --git a/packages/react-email/CHANGELOG.md b/packages/react-email/CHANGELOG.md index cfe4eafb57..f8dc3d7fe9 100644 --- a/packages/react-email/CHANGELOG.md +++ b/packages/react-email/CHANGELOG.md @@ -1,5 +1,19 @@ # react-email +## 4.0.11 + +### Patch Changes + +- 1a17219: fix improper `require` in `email export` +- 45ab698: update next to 15.3.1 + +## 4.0.10 + +### Patch Changes + +- 5ef9fe8: fix support for `import ... = require(...)` syntax +- 4c7f597: fix `email dev` not working with `traversal` error + ## 4.0.9 ### Patch Changes diff --git a/packages/react-email/package.json b/packages/react-email/package.json index ef5ffbbf05..7997cd4af5 100644 --- a/packages/react-email/package.json +++ b/packages/react-email/package.json @@ -1,6 +1,6 @@ { "name": "react-email", - "version": "4.0.9", + "version": "4.0.11", "description": "A live preview of your emails right in your browser.", "bin": { "email": "./dist/cli/index.mjs" @@ -38,7 +38,7 @@ "glob": "^11.0.0", "log-symbols": "^7.0.0", "mime-types": "^3.0.0", - "next": "^15.2.4", + "next": "^15.3.1", "normalize-path": "^3.0.0", "ora": "^8.0.0", "socket.io": "^4.8.1" diff --git a/packages/react-email/src/cli/commands/export.ts b/packages/react-email/src/cli/commands/export.ts index 39320dbc81..442c4ee0e1 100644 --- a/packages/react-email/src/cli/commands/export.ts +++ b/packages/react-email/src/cli/commands/export.ts @@ -1,5 +1,7 @@ import fs, { unlinkSync, writeFileSync } from 'node:fs'; +import { createRequire } from 'node:module'; import path from 'node:path'; +import url from 'node:url'; import type { Options } from '@react-email/components'; import { type BuildFailure, build } from 'esbuild'; import { glob } from 'glob'; @@ -32,6 +34,10 @@ type ExportTemplatesOptions = Options & { pretty?: boolean; }; +const filename = url.fileURLToPath(import.meta.url); + +const require = createRequire(filename); + /* This first builds all the templates using esbuild and then puts the output in the `.js` files. Then these `.js` files are imported dynamically and rendered to `.html` files diff --git a/packages/react-email/src/cli/utils/preview/hot-reloading/create-dependency-graph.spec.ts b/packages/react-email/src/cli/utils/preview/hot-reloading/create-dependency-graph.spec.ts index 25133d48eb..493e455529 100644 --- a/packages/react-email/src/cli/utils/preview/hot-reloading/create-dependency-graph.spec.ts +++ b/packages/react-email/src/cli/utils/preview/hot-reloading/create-dependency-graph.spec.ts @@ -10,6 +10,11 @@ const pathToFileForTestingDependencyGraph = path.join( '.for-dependency-graph.ts', ); +vi.mock('@babel/traverse', async () => { + const traverse = await vi.importActual('@babel/traverse'); + return { default: traverse }; +}); + test('createDependencyGraph()', async () => { if (existsSync(pathToFileForTestingDependencyGraph)) { await fs.rm(pathToFileForTestingDependencyGraph); diff --git a/packages/react-email/src/cli/utils/preview/hot-reloading/get-imported-modules.spec.ts b/packages/react-email/src/cli/utils/preview/hot-reloading/get-imported-modules.spec.ts index e55c151f01..8e7d545271 100644 --- a/packages/react-email/src/cli/utils/preview/hot-reloading/get-imported-modules.spec.ts +++ b/packages/react-email/src/cli/utils/preview/hot-reloading/get-imported-modules.spec.ts @@ -1,6 +1,11 @@ import { promises as fs } from 'node:fs'; import { getImportedModules } from './get-imported-modules'; +vi.mock('@babel/traverse', async () => { + const traverse = await vi.importActual('@babel/traverse'); + return { default: traverse }; +}); + describe('getImportedModules()', () => { it('should work with this test file', async () => { const contents = await fs.readFile(import.meta.filename, 'utf8'); diff --git a/packages/react-email/src/cli/utils/preview/hot-reloading/get-imported-modules.ts b/packages/react-email/src/cli/utils/preview/hot-reloading/get-imported-modules.ts index 29212742a6..cd5ad7b05b 100644 --- a/packages/react-email/src/cli/utils/preview/hot-reloading/get-imported-modules.ts +++ b/packages/react-email/src/cli/utils/preview/hot-reloading/get-imported-modules.ts @@ -1,5 +1,9 @@ import { parse } from '@babel/parser'; -import traverse from '@babel/traverse'; + +import traverseModule from '@babel/traverse'; + +// @ts-expect-error This is fine since the default export is wrapped in a default function. The problem is that babel/traverse is not ESM. +const traverse = traverseModule.default; export const getImportedModules = (contents: string) => { const importedPaths: string[] = []; @@ -22,6 +26,9 @@ export const getImportedModules = (contents: string) => { importedPaths.push(node.source.value); } }, + TSExternalModuleReference({ node }) { + importedPaths.push(node.expression.value); + }, CallExpression({ node }) { if ('name' in node.callee && node.callee.name === 'require') { if (node.arguments.length === 1) { diff --git a/packages/text/CHANGELOG.md b/packages/text/CHANGELOG.md index 59e2a0459e..8aea0ff2dd 100644 --- a/packages/text/CHANGELOG.md +++ b/packages/text/CHANGELOG.md @@ -1,5 +1,11 @@ # @react-email/text +## 0.1.3 + +### Patch Changes + +- 6cd353b: give priority to the user's style + ## 0.1.2 ### Patch Changes diff --git a/packages/text/package.json b/packages/text/package.json index d6c6c8f521..a3525f826f 100644 --- a/packages/text/package.json +++ b/packages/text/package.json @@ -1,6 +1,6 @@ { "name": "@react-email/text", - "version": "0.1.2", + "version": "0.1.3", "description": "A block of text separated by blank spaces", "sideEffects": false, "main": "./dist/index.js", diff --git a/packages/text/src/text.spec.tsx b/packages/text/src/text.spec.tsx index 242f339c90..c97ad7b388 100644 --- a/packages/text/src/text.spec.tsx +++ b/packages/text/src/text.spec.tsx @@ -8,6 +8,12 @@ describe(' component', () => { expect(html).toContain(testMessage); }); + it("gives priority to the user's style", async () => { + const style = { marginTop: '0px' }; + const html = await render(); + expect(html).toContain('margin-top:0px'); + }); + it('passes style and other props correctly', async () => { const style = { fontSize: '16px' }; const html = await render( diff --git a/packages/text/src/text.tsx b/packages/text/src/text.tsx index f89145a1a0..a4639a1d98 100644 --- a/packages/text/src/text.tsx +++ b/packages/text/src/text.tsx @@ -5,13 +5,14 @@ export type TextProps = Readonly>; export const Text = React.forwardRef( ({ style, ...props }, ref) => { - const modifiedStyle = { ...style }; + let modifiedStyle: React.CSSProperties = {}; if (modifiedStyle.marginBottom === undefined) { modifiedStyle.marginBottom = '16px'; } if (modifiedStyle.marginTop === undefined) { modifiedStyle.marginTop = '16px'; } + modifiedStyle = { ...modifiedStyle, ...style }; const margins = computeMargins(modifiedStyle); return ( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a99d89b500..ec5c103a2b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -408,7 +408,7 @@ importers: specifier: workspace:1.0.5 version: link:../tailwind '@react-email/text': - specifier: workspace:0.1.2 + specifier: workspace:0.1.3 version: link:../text react: specifier: ^19.0.0 @@ -642,8 +642,8 @@ importers: specifier: ^3.0.0 version: 3.0.1 next: - specifier: ^15.2.4 - version: 15.2.4(@babel/core@7.26.10)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + specifier: ^15.3.1 + version: 15.3.1(@babel/core@7.26.10)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) normalize-path: specifier: ^3.0.0 version: 3.0.0 @@ -2124,9 +2124,6 @@ packages: '@next/env@14.2.3': resolution: {integrity: sha512-W7fd7IbkfmeeY2gXrzJYDx8D2lWKbVoTIj1o1ScPHNzvp30s1AuoEFSdr39bC5sjxJaxTtq3OTCZboNp0lNWHA==} - '@next/env@15.2.4': - resolution: {integrity: sha512-+SFtMgoiYP3WoSswuNmxJOCwi06TdWE733D+WPjpXIe4LXGULwEaofiiAy6kbS0+XjM5xF5n3lKuBwN2SnqD9g==} - '@next/env@15.3.1': resolution: {integrity: sha512-cwK27QdzrMblHSn9DZRV+DQscHXRuJv6MydlJRpFSqJWZrTYMLzKDeyueJNN9MGd8NNiUKzDQADAf+dMLXX7YQ==} @@ -2136,12 +2133,6 @@ packages: cpu: [arm64] os: [darwin] - '@next/swc-darwin-arm64@15.2.4': - resolution: {integrity: sha512-1AnMfs655ipJEDC/FHkSr0r3lXBgpqKo4K1kiwfUf3iE68rDFXZ1TtHdMvf7D0hMItgDZ7Vuq3JgNMbt/+3bYw==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [darwin] - '@next/swc-darwin-arm64@15.3.1': resolution: {integrity: sha512-hjDw4f4/nla+6wysBL07z52Gs55Gttp5Bsk5/8AncQLJoisvTBP0pRIBK/B16/KqQyH+uN4Ww8KkcAqJODYH3w==} engines: {node: '>= 10'} @@ -2154,12 +2145,6 @@ packages: cpu: [x64] os: [darwin] - '@next/swc-darwin-x64@15.2.4': - resolution: {integrity: sha512-3qK2zb5EwCwxnO2HeO+TRqCubeI/NgCe+kL5dTJlPldV/uwCnUgC7VbEzgmxbfrkbjehL4H9BPztWOEtsoMwew==} - engines: {node: '>= 10'} - cpu: [x64] - os: [darwin] - '@next/swc-darwin-x64@15.3.1': resolution: {integrity: sha512-q+aw+cJ2ooVYdCEqZVk+T4Ni10jF6Fo5DfpEV51OupMaV5XL6pf3GCzrk6kSSZBsMKZtVC1Zm/xaNBFpA6bJ2g==} engines: {node: '>= 10'} @@ -2172,12 +2157,6 @@ packages: cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-gnu@15.2.4': - resolution: {integrity: sha512-HFN6GKUcrTWvem8AZN7tT95zPb0GUGv9v0d0iyuTb303vbXkkbHDp/DxufB04jNVD+IN9yHy7y/6Mqq0h0YVaQ==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [linux] - '@next/swc-linux-arm64-gnu@15.3.1': resolution: {integrity: sha512-wBQ+jGUI3N0QZyWmmvRHjXjTWFy8o+zPFLSOyAyGFI94oJi+kK/LIZFJXeykvgXUk1NLDAEFDZw/NVINhdk9FQ==} engines: {node: '>= 10'} @@ -2190,12 +2169,6 @@ packages: cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@15.2.4': - resolution: {integrity: sha512-Oioa0SORWLwi35/kVB8aCk5Uq+5/ZIumMK1kJV+jSdazFm2NzPDztsefzdmzzpx5oGCJ6FkUC7vkaUseNTStNA==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [linux] - '@next/swc-linux-arm64-musl@15.3.1': resolution: {integrity: sha512-IIxXEXRti/AulO9lWRHiCpUUR8AR/ZYLPALgiIg/9ENzMzLn3l0NSxVdva7R/VDcuSEBo0eGVCe3evSIHNz0Hg==} engines: {node: '>= 10'} @@ -2208,12 +2181,6 @@ packages: cpu: [x64] os: [linux] - '@next/swc-linux-x64-gnu@15.2.4': - resolution: {integrity: sha512-yb5WTRaHdkgOqFOZiu6rHV1fAEK0flVpaIN2HB6kxHVSy/dIajWbThS7qON3W9/SNOH2JWkVCyulgGYekMePuw==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - '@next/swc-linux-x64-gnu@15.3.1': resolution: {integrity: sha512-bfI4AMhySJbyXQIKH5rmLJ5/BP7bPwuxauTvVEiJ/ADoddaA9fgyNNCcsbu9SlqfHDoZmfI6g2EjzLwbsVTr5A==} engines: {node: '>= 10'} @@ -2226,12 +2193,6 @@ packages: cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@15.2.4': - resolution: {integrity: sha512-Dcdv/ix6srhkM25fgXiyOieFUkz+fOYkHlydWCtB0xMST6X9XYI3yPDKBZt1xuhOytONsIFJFB08xXYsxUwJLw==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - '@next/swc-linux-x64-musl@15.3.1': resolution: {integrity: sha512-FeAbR7FYMWR+Z+M5iSGytVryKHiAsc0x3Nc3J+FD5NVbD5Mqz7fTSy8CYliXinn7T26nDMbpExRUI/4ekTvoiA==} engines: {node: '>= 10'} @@ -2244,12 +2205,6 @@ packages: cpu: [arm64] os: [win32] - '@next/swc-win32-arm64-msvc@15.2.4': - resolution: {integrity: sha512-dW0i7eukvDxtIhCYkMrZNQfNicPDExt2jPb9AZPpL7cfyUo7QSNl1DjsHjmmKp6qNAqUESyT8YFl/Aw91cNJJg==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [win32] - '@next/swc-win32-arm64-msvc@15.3.1': resolution: {integrity: sha512-yP7FueWjphQEPpJQ2oKmshk/ppOt+0/bB8JC8svPUZNy0Pi3KbPx2Llkzv1p8CoQa+D2wknINlJpHf3vtChVBw==} engines: {node: '>= 10'} @@ -2268,12 +2223,6 @@ packages: cpu: [x64] os: [win32] - '@next/swc-win32-x64-msvc@15.2.4': - resolution: {integrity: sha512-SbnWkJmkS7Xl3kre8SdMF6F/XDh1DTFEhp0jRTj/uB8iPKoU2bb2NDfcu+iifv1+mxQEd1g2vvSxcZbXSKyWiQ==} - engines: {node: '>= 10'} - cpu: [x64] - os: [win32] - '@next/swc-win32-x64-msvc@15.3.1': resolution: {integrity: sha512-3PMvF2zRJAifcRNni9uMk/gulWfWS+qVI/pagd+4yLF5bcXPZPPH2xlYRYOsUjmCJOXSTAC2PjRzbhsRzR2fDQ==} engines: {node: '>= 10'} @@ -6242,27 +6191,6 @@ packages: sass: optional: true - next@15.2.4: - resolution: {integrity: sha512-VwL+LAaPSxEkd3lU2xWbgEOtrM8oedmyhBqaVNmgKB+GvZlCy9rgaEc+y2on0wv+l0oSFqLtYD6dcC1eAedUaQ==} - engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0} - hasBin: true - peerDependencies: - '@opentelemetry/api': ^1.1.0 - '@playwright/test': ^1.41.2 - babel-plugin-react-compiler: '*' - react: ^19.0.0 - react-dom: ^19.0.0 - sass: ^1.3.0 - peerDependenciesMeta: - '@opentelemetry/api': - optional: true - '@playwright/test': - optional: true - babel-plugin-react-compiler: - optional: true - sass: - optional: true - next@15.3.1: resolution: {integrity: sha512-8+dDV0xNLOgHlyBxP1GwHGVaNXsmp+2NhZEYrXr24GWLHtt27YrBPbPuHvzlhi7kZNYjeJNR93IF5zfFu5UL0g==} engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0} @@ -9550,70 +9478,47 @@ snapshots: '@next/env@14.2.3': {} - '@next/env@15.2.4': {} - '@next/env@15.3.1': {} '@next/swc-darwin-arm64@14.2.3': optional: true - '@next/swc-darwin-arm64@15.2.4': - optional: true - '@next/swc-darwin-arm64@15.3.1': optional: true '@next/swc-darwin-x64@14.2.3': optional: true - '@next/swc-darwin-x64@15.2.4': - optional: true - '@next/swc-darwin-x64@15.3.1': optional: true '@next/swc-linux-arm64-gnu@14.2.3': optional: true - '@next/swc-linux-arm64-gnu@15.2.4': - optional: true - '@next/swc-linux-arm64-gnu@15.3.1': optional: true '@next/swc-linux-arm64-musl@14.2.3': optional: true - '@next/swc-linux-arm64-musl@15.2.4': - optional: true - '@next/swc-linux-arm64-musl@15.3.1': optional: true '@next/swc-linux-x64-gnu@14.2.3': optional: true - '@next/swc-linux-x64-gnu@15.2.4': - optional: true - '@next/swc-linux-x64-gnu@15.3.1': optional: true '@next/swc-linux-x64-musl@14.2.3': optional: true - '@next/swc-linux-x64-musl@15.2.4': - optional: true - '@next/swc-linux-x64-musl@15.3.1': optional: true '@next/swc-win32-arm64-msvc@14.2.3': optional: true - '@next/swc-win32-arm64-msvc@15.2.4': - optional: true - '@next/swc-win32-arm64-msvc@15.3.1': optional: true @@ -9623,9 +9528,6 @@ snapshots: '@next/swc-win32-x64-msvc@14.2.3': optional: true - '@next/swc-win32-x64-msvc@15.2.4': - optional: true - '@next/swc-win32-x64-msvc@15.3.1': optional: true @@ -14239,31 +14141,6 @@ snapshots: - '@babel/core' - babel-plugin-macros - next@15.2.4(@babel/core@7.26.10)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): - dependencies: - '@next/env': 15.2.4 - '@swc/counter': 0.1.3 - '@swc/helpers': 0.5.15 - busboy: 1.6.0 - caniuse-lite: 1.0.30001690 - postcss: 8.4.31 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) - styled-jsx: 5.1.6(@babel/core@7.26.10)(react@19.0.0) - optionalDependencies: - '@next/swc-darwin-arm64': 15.2.4 - '@next/swc-darwin-x64': 15.2.4 - '@next/swc-linux-arm64-gnu': 15.2.4 - '@next/swc-linux-arm64-musl': 15.2.4 - '@next/swc-linux-x64-gnu': 15.2.4 - '@next/swc-linux-x64-musl': 15.2.4 - '@next/swc-win32-arm64-msvc': 15.2.4 - '@next/swc-win32-x64-msvc': 15.2.4 - sharp: 0.33.5 - transitivePeerDependencies: - - '@babel/core' - - babel-plugin-macros - next@15.3.1(@babel/core@7.26.10)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: '@next/env': 15.3.1