@teleporthq/teleport-postprocessor-prettier-html
Advanced tools
Comparing version
@@ -5,2 +5,3 @@ import { PostProcessor, PrettierFormatOptions } from '@teleporthq/teleport-types'; | ||
formatOptions?: PrettierFormatOptions; | ||
strictHtmlWhitespaceSensitivity?: boolean; | ||
} | ||
@@ -7,0 +8,0 @@ export declare const createPrettierHTMLPostProcessor: (options?: PostProcessorFactoryOptions) => PostProcessor; |
@@ -27,5 +27,6 @@ "use strict"; | ||
var formatOptions = __assign(__assign({}, teleport_shared_1.Constants.PRETTIER_CONFIG), options.formatOptions); | ||
var htmlWhitespaceSensitivity = (options === null || options === void 0 ? void 0 : options.strictHtmlWhitespaceSensitivity) === true ? 'strict' : 'ignore'; | ||
var processor = function (codeChunks) { | ||
if (codeChunks[fileType]) { | ||
codeChunks[fileType] = format(codeChunks[fileType], __assign(__assign({}, formatOptions), { htmlWhitespaceSensitivity: 'ignore', plugins: [parser_html_js_1.default], parser: 'html' })); | ||
codeChunks[fileType] = format(codeChunks[fileType], __assign(__assign({}, formatOptions), { htmlWhitespaceSensitivity: htmlWhitespaceSensitivity, plugins: [parser_html_js_1.default], parser: 'html' })); | ||
} | ||
@@ -32,0 +33,0 @@ else { |
@@ -5,2 +5,3 @@ import { PostProcessor, PrettierFormatOptions } from '@teleporthq/teleport-types'; | ||
formatOptions?: PrettierFormatOptions; | ||
strictHtmlWhitespaceSensitivity?: boolean; | ||
} | ||
@@ -7,0 +8,0 @@ export declare const createPrettierHTMLPostProcessor: (options?: PostProcessorFactoryOptions) => PostProcessor; |
@@ -21,5 +21,6 @@ var __assign = (this && this.__assign) || function () { | ||
var formatOptions = __assign(__assign({}, Constants.PRETTIER_CONFIG), options.formatOptions); | ||
var htmlWhitespaceSensitivity = (options === null || options === void 0 ? void 0 : options.strictHtmlWhitespaceSensitivity) === true ? 'strict' : 'ignore'; | ||
var processor = function (codeChunks) { | ||
if (codeChunks[fileType]) { | ||
codeChunks[fileType] = format(codeChunks[fileType], __assign(__assign({}, formatOptions), { htmlWhitespaceSensitivity: 'ignore', plugins: [parserHTML], parser: 'html' })); | ||
codeChunks[fileType] = format(codeChunks[fileType], __assign(__assign({}, formatOptions), { htmlWhitespaceSensitivity: htmlWhitespaceSensitivity, plugins: [parserHTML], parser: 'html' })); | ||
} | ||
@@ -26,0 +27,0 @@ else { |
{ | ||
"name": "@teleporthq/teleport-postprocessor-prettier-html", | ||
"version": "0.33.0-alpha.0", | ||
"version": "0.33.0", | ||
"description": "A post-processing function that formats html code chunks using prettier and the prettier-html plugin", | ||
@@ -27,7 +27,7 @@ "author": "teleportHQ", | ||
"dependencies": { | ||
"@teleporthq/teleport-shared": "^0.33.0-alpha.0", | ||
"@teleporthq/teleport-types": "^0.33.0-alpha.0", | ||
"@teleporthq/teleport-shared": "^0.33.0", | ||
"@teleporthq/teleport-types": "^0.33.0", | ||
"prettier": "^2.3.1" | ||
}, | ||
"gitHead": "39118491a74ce56aa7c7b137f242827feae93fff" | ||
"gitHead": "dcee5f4e79929958ae17fac528995e1f759d4713" | ||
} |
@@ -11,2 +11,3 @@ import standalone from 'prettier/standalone.js' | ||
formatOptions?: PrettierFormatOptions | ||
strictHtmlWhitespaceSensitivity?: boolean | ||
} | ||
@@ -17,2 +18,4 @@ | ||
const formatOptions = { ...Constants.PRETTIER_CONFIG, ...options.formatOptions } | ||
const htmlWhitespaceSensitivity = | ||
options?.strictHtmlWhitespaceSensitivity === true ? 'strict' : 'ignore' | ||
@@ -23,3 +26,3 @@ const processor: PostProcessor = (codeChunks) => { | ||
...formatOptions, | ||
htmlWhitespaceSensitivity: 'ignore', | ||
htmlWhitespaceSensitivity, | ||
plugins: [parserHTML], | ||
@@ -26,0 +29,0 @@ parser: 'html', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
62182
24.5%152
4.83%