prettier-plugin-toml
Advanced tools
Comparing version 2.0.0 to 2.0.1
import type { Plugin } from 'prettier'; | ||
declare const TomlPlugin: Plugin<string>; | ||
export type * from './options.js'; | ||
export type * from './types.js'; | ||
export default TomlPlugin; |
@@ -1,11 +0,11 @@ | ||
import { Taplo } from '@taplo/lib'; | ||
import taplo from '@taplo/lib'; | ||
import { languages } from './languages.js'; | ||
import { prettierOptionsDefinitions } from './options.js'; | ||
const PLUGIN_NAME = 'toml'; | ||
let taplo; | ||
let taploIns; | ||
async function format(code, options) { | ||
if (!taplo) { | ||
taplo = await Taplo.initialize(); | ||
if (!taploIns) { | ||
taploIns = await taplo.Taplo.initialize(); | ||
} | ||
return taplo.format(code, { options }); | ||
return taploIns.format(code, { options }); | ||
} | ||
@@ -16,10 +16,7 @@ const TomlPlugin = { | ||
[PLUGIN_NAME]: { | ||
async parse(code, options) { | ||
const indentString = options.useTabs | ||
? '\t' | ||
: ' '.repeat(options.tabWidth); | ||
return await format(code.trim(), { | ||
parse(code, options) { | ||
return format(code.trim(), { | ||
...options, | ||
columnWidth: options.printWidth, | ||
indentString, | ||
indentString: options.useTabs ? '\t' : ' '.repeat(options.tabWidth), | ||
trailingNewline: true, | ||
@@ -26,0 +23,0 @@ arrayTrailingComma: options.trailingComma !== 'none', |
{ | ||
"name": "prettier-plugin-toml", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "An opinionated `toml` formatter plugin for Prettier", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
21411
419