diff --git a/deno_dist/helper/html/index.ts b/deno_dist/helper/html/index.ts index 3d0fc0123..3bf90905f 100644 --- a/deno_dist/helper/html/index.ts +++ b/deno_dist/helper/html/index.ts @@ -1,18 +1,7 @@ -import { escapeToBuffer, stringBufferToString } from '../../utils/html.ts' -import type { - StringBuffer, - HtmlEscaped, - HtmlEscapedString, - HtmlEscapedCallback, -} from '../../utils/html.ts' +import { escapeToBuffer, stringBufferToString, raw } from '../../utils/html.ts' +import type { StringBuffer, HtmlEscaped, HtmlEscapedString } from '../../utils/html.ts' -export const raw = (value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString => { - const escapedString = new String(value) as HtmlEscapedString - escapedString.isEscaped = true - escapedString.callbacks = callbacks - - return escapedString -} +export { raw } export const html = ( strings: TemplateStringsArray, diff --git a/deno_dist/utils/html.ts b/deno_dist/utils/html.ts index 80fba5acc..eafa0b7f2 100644 --- a/deno_dist/utils/html.ts +++ b/deno_dist/utils/html.ts @@ -31,7 +31,13 @@ export type HtmlEscapedString = string & HtmlEscaped */ export type StringBuffer = (string | Promise)[] -import { raw } from '../helper/html/index.ts' +export const raw = (value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString => { + const escapedString = new String(value) as HtmlEscapedString + escapedString.isEscaped = true + escapedString.callbacks = callbacks + + return escapedString +} // The `escapeToBuffer` implementation is based on code from the MIT licensed `react-dom` package. // https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/server/escapeTextForBrowser.js diff --git a/src/helper/html/index.ts b/src/helper/html/index.ts index 1c1656759..e29b28979 100644 --- a/src/helper/html/index.ts +++ b/src/helper/html/index.ts @@ -1,18 +1,7 @@ -import { escapeToBuffer, stringBufferToString } from '../../utils/html' -import type { - StringBuffer, - HtmlEscaped, - HtmlEscapedString, - HtmlEscapedCallback, -} from '../../utils/html' +import { escapeToBuffer, stringBufferToString, raw } from '../../utils/html' +import type { StringBuffer, HtmlEscaped, HtmlEscapedString } from '../../utils/html' -export const raw = (value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString => { - const escapedString = new String(value) as HtmlEscapedString - escapedString.isEscaped = true - escapedString.callbacks = callbacks - - return escapedString -} +export { raw } export const html = ( strings: TemplateStringsArray, diff --git a/src/utils/html.ts b/src/utils/html.ts index 43c8d288e..eafa0b7f2 100644 --- a/src/utils/html.ts +++ b/src/utils/html.ts @@ -31,7 +31,13 @@ export type HtmlEscapedString = string & HtmlEscaped */ export type StringBuffer = (string | Promise)[] -import { raw } from '../helper/html' +export const raw = (value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString => { + const escapedString = new String(value) as HtmlEscapedString + escapedString.isEscaped = true + escapedString.callbacks = callbacks + + return escapedString +} // The `escapeToBuffer` implementation is based on code from the MIT licensed `react-dom` package. // https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/server/escapeTextForBrowser.js