@teleporthq/teleport-postprocessor-prettier-html
Advanced tools
Comparing version
@@ -6,4 +6,4 @@ import { PostProcessor, PrettierFormatOptions } from '@teleporthq/teleport-types'; | ||
} | ||
export declare const createPostProcessor: (options?: PostProcessorFactoryOptions) => PostProcessor; | ||
export declare const createPrettierHTMLPostProcessor: (options?: PostProcessorFactoryOptions) => PostProcessor; | ||
declare const _default: PostProcessor; | ||
export default _default; |
@@ -19,6 +19,5 @@ "use strict"; | ||
var parser_html_1 = __importDefault(require("prettier/parser-html")); | ||
var parser_postcss_1 = __importDefault(require("prettier/parser-postcss")); | ||
var teleport_shared_1 = require("@teleporthq/teleport-shared"); | ||
var teleport_types_1 = require("@teleporthq/teleport-types"); | ||
exports.createPostProcessor = function (options) { | ||
exports.createPrettierHTMLPostProcessor = function (options) { | ||
if (options === void 0) { options = {}; } | ||
@@ -29,3 +28,3 @@ var fileType = options.fileType || teleport_types_1.FileType.HTML; | ||
if (codeChunks[fileType]) { | ||
codeChunks[fileType] = standalone_1.format(codeChunks[fileType], __assign({}, formatOptions, { htmlWhitespaceSensitivity: 'ignore', plugins: [parser_html_1.default, parser_postcss_1.default], parser: 'html' })); | ||
codeChunks[fileType] = standalone_1.format(codeChunks[fileType], __assign({}, formatOptions, { htmlWhitespaceSensitivity: 'ignore', plugins: [parser_html_1.default], parser: 'html' })); | ||
} | ||
@@ -39,3 +38,3 @@ else { | ||
}; | ||
exports.default = exports.createPostProcessor(); | ||
exports.default = exports.createPrettierHTMLPostProcessor(); | ||
//# sourceMappingURL=index.js.map |
@@ -6,4 +6,4 @@ import { PostProcessor, PrettierFormatOptions } from '@teleporthq/teleport-types'; | ||
} | ||
export declare const createPostProcessor: (options?: PostProcessorFactoryOptions) => PostProcessor; | ||
export declare const createPrettierHTMLPostProcessor: (options?: PostProcessorFactoryOptions) => PostProcessor; | ||
declare const _default: PostProcessor; | ||
export default _default; |
import { format } from 'prettier/standalone'; | ||
import parserHTML from 'prettier/parser-html'; | ||
import parserPostCSS from 'prettier/parser-postcss'; | ||
import { Constants } from '@teleporthq/teleport-shared'; | ||
import { FileType } from '@teleporthq/teleport-types'; | ||
export const createPostProcessor = (options = {}) => { | ||
export const createPrettierHTMLPostProcessor = (options = {}) => { | ||
const fileType = options.fileType || FileType.HTML; | ||
@@ -14,3 +13,3 @@ const formatOptions = { ...Constants.PRETTIER_CONFIG, ...options.formatOptions }; | ||
htmlWhitespaceSensitivity: 'ignore', | ||
plugins: [parserHTML, parserPostCSS], | ||
plugins: [parserHTML], | ||
parser: 'html', | ||
@@ -26,3 +25,3 @@ }); | ||
}; | ||
export default createPostProcessor(); | ||
export default createPrettierHTMLPostProcessor(); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@teleporthq/teleport-postprocessor-prettier-html", | ||
"version": "0.10.0-alpha.1", | ||
"version": "0.10.0-alpha.2", | ||
"description": "A post-processing function that formats html code chunks using prettier and the prettier-html plugin", | ||
@@ -11,2 +11,3 @@ "author": "teleportHQ", | ||
"module": "dist/esm/index.js", | ||
"sideEffects": false, | ||
"repository": { | ||
@@ -29,7 +30,7 @@ "type": "git", | ||
"dependencies": { | ||
"@teleporthq/teleport-shared": "^0.10.0-alpha.1", | ||
"@teleporthq/teleport-types": "^0.10.0-alpha.1", | ||
"@teleporthq/teleport-shared": "^0.10.0-alpha.2", | ||
"@teleporthq/teleport-types": "^0.10.0-alpha.2", | ||
"prettier": "^1.18.2" | ||
}, | ||
"gitHead": "d4c96887909af2dd6b68054751aa7eca8a48a4d0" | ||
"gitHead": "b185c3fdb7dc94ff8c7eed63f7edba055fffa8d0" | ||
} |
import { format } from 'prettier/standalone' | ||
import parserHTML from 'prettier/parser-html' | ||
import parserPostCSS from 'prettier/parser-postcss' | ||
@@ -14,3 +13,3 @@ import { Constants } from '@teleporthq/teleport-shared' | ||
export const createPostProcessor = (options: PostProcessorFactoryOptions = {}) => { | ||
export const createPrettierHTMLPostProcessor = (options: PostProcessorFactoryOptions = {}) => { | ||
const fileType = options.fileType || FileType.HTML | ||
@@ -24,3 +23,3 @@ const formatOptions = { ...Constants.PRETTIER_CONFIG, ...options.formatOptions } | ||
htmlWhitespaceSensitivity: 'ignore', | ||
plugins: [parserHTML, parserPostCSS], | ||
plugins: [parserHTML], | ||
parser: 'html', | ||
@@ -38,2 +37,2 @@ }) | ||
export default createPostProcessor() | ||
export default createPrettierHTMLPostProcessor() |
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
287368
-1.06%146
-2.01%