File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed
Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 22
33import fs from 'node:fs' ;
44import path from 'node:path' ;
5- import { styleText } from 'node:util' ;
65import logSymbols from 'log-symbols' ;
76import ora , { type Ora } from 'ora' ;
87import {
@@ -15,6 +14,7 @@ import { convertStackWithSourceMap } from '../utils/convert-stack-with-sourcemap
1514import { createJsxRuntime } from '../utils/create-jsx-runtime' ;
1615import { getEmailComponent } from '../utils/get-email-component' ;
1716import { registerSpinnerAutostopping } from '../utils/register-spinner-autostopping' ;
17+ import { styleText } from '../utils/style-text' ;
1818import type { ErrorObject } from '../utils/types/error-object' ;
1919
2020export interface RenderedEmailMetadata {
Original file line number Diff line number Diff line change 1+ /**
2+ * Centralized fallback for Node versions (<20.12.0) without util.styleText.
3+ * Returns the original text when styleText is unavailable.
4+ */
5+ import * as nodeUtil from 'node:util' ;
6+
7+ type StyleTextFunction = ( style : string , text : string ) => string ;
8+
9+ export const styleText : StyleTextFunction = ( nodeUtil as any ) . styleText
10+ ? ( nodeUtil as any ) . styleText
11+ : ( _ : string , text : string ) => text ;
Original file line number Diff line number Diff line change 11import http from 'node:http' ;
22import path from 'node:path' ;
33import url from 'node:url' ;
4- import { styleText } from 'node:util' ;
54import { createJiti } from 'jiti' ;
65import logSymbols from 'log-symbols' ;
76import ora from 'ora' ;
87import { registerSpinnerAutostopping } from '../../utils/register-spinner-autostopping.js' ;
98import { getPreviewServerLocation } from '../get-preview-server-location.js' ;
109import { packageJson } from '../packageJson.js' ;
10+ import { styleText } from '../style-text.js' ;
1111import { getEnvVariablesForPreviewApp } from './get-env-variables-for-preview-app.js' ;
1212import { serveStaticFile } from './serve-static-file.js' ;
1313
Original file line number Diff line number Diff line change 1+ /**
2+ * Centralized fallback for Node versions (<20.12.0) without util.styleText.
3+ * Returns the original text when styleText is unavailable.
4+ */
5+ import * as nodeUtil from 'node:util' ;
6+
7+ type StyleTextFunction = ( style : string , text : string ) => string ;
8+
9+ export const styleText : StyleTextFunction = ( nodeUtil as any ) . styleText
10+ ? ( nodeUtil as any ) . styleText
11+ : ( _ : string , text : string ) => text ;
You can’t perform that action at this time.
0 commit comments