Skip to content

Commit 4e7bc52

Browse files
authored
Merge pull request #1764 from maizzle/chore/remove-format-default
chore: remove default html.format from config
2 parents 3527adc + 3619f10 commit 4e7bc52

6 files changed

Lines changed: 9 additions & 11 deletions

File tree

src/config/defaults.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const defaults: MaizzleConfig = {
2323
},
2424
html: {
2525
decodeEntities: true,
26-
format: true,
2726
},
2827
useTransformers: true,
2928
}

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ export type { PurgeCssOptions } from './transformers/purgeCss.ts'
6464
export { filters } from './transformers/filters/index.ts'
6565
export { replaceStrings } from './transformers/replaceStrings.ts'
6666
export { format } from './transformers/format.ts'
67-
export type { FormatOptions } from './transformers/format.ts'
67+
export type { FormatConfig } from './transformers/format.ts'
6868
export { minify } from './transformers/minify.ts'
6969
export type { MinifyOptions } from './transformers/minify.ts'

src/tests/render/basic.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ describe('render', () => {
9595
expect(result.config.css?.inline).toBe(true)
9696
expect(result.config.css?.purge).toBe(true)
9797
expect(result.config.css?.shorthand).toBe(true)
98-
expect(result.config.html?.format).toBe(true)
9998
})
10099
})
101100

src/tests/transformers/format.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, it, expect } from 'vitest'
2-
import { format, type FormatOptions } from '../../transformers/format.ts'
2+
import { format, type FormatConfig } from '../../transformers/format.ts'
33

4-
async function run(html: string, option?: boolean | FormatOptions): Promise<string> {
4+
async function run(html: string, option?: boolean | FormatConfig): Promise<string> {
55
if (option === false) return html
66
const opts = (option === true || option == null) ? {} : option
77
return format(html, opts)

src/transformers/format.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { format as oxfmt } from 'oxfmt'
22
import { defu as merge } from 'defu'
3-
import type { FormatOptions } from 'oxfmt'
3+
import type { FormatConfig } from 'oxfmt'
44

5-
export type { FormatOptions } from 'oxfmt'
5+
export type { FormatConfig } from 'oxfmt'
66

7-
const DEFAULT_OPTIONS: FormatOptions = {
7+
const DEFAULT_OPTIONS: FormatConfig = {
88
printWidth: 320,
99
htmlWhitespaceSensitivity: 'ignore',
1010
embeddedLanguageFormatting: 'off',
@@ -17,15 +17,15 @@ const DEFAULT_OPTIONS: FormatOptions = {
1717
* you pass.
1818
*
1919
* @param html HTML string to format.
20-
* @param options [oxfmt `FormatOptions`](https://github.com/oxc-project/oxfmt).
20+
* @param options [oxfmt `FormatConfig`](https://github.com/oxc-project/oxfmt).
2121
* @returns The formatted HTML string.
2222
*
2323
* @example
2424
* import { format } from '@maizzle/framework'
2525
*
2626
* const pretty = await format(html, { useTabs: true, tabWidth: 4 })
2727
*/
28-
export async function format(html: string, options: FormatOptions = {}): Promise<string> {
28+
export async function format(html: string, options: FormatConfig = {}): Promise<string> {
2929
const merged = merge(options, DEFAULT_OPTIONS)
3030
const result = await oxfmt('input.html', html, merged)
3131
return result.code

src/types/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ export interface HtmlConfig {
360360
*
361361
* Set to `true` to enable with defaults, or pass options.
362362
*/
363-
format?: boolean | import('oxfmt').FormatOptions
363+
format?: boolean | import('oxfmt').FormatConfig
364364
/**
365365
* Minify the HTML output.
366366
*

0 commit comments

Comments
 (0)