@prettier/plugin-pug
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -38,5 +38,6 @@ "use strict"; | ||
pugExplicitDiv: options.pugExplicitDiv, | ||
pugPreserveAttributeBrackets: options.pugPreserveAttributeBrackets, | ||
}; | ||
} | ||
exports.convergeOptions = convergeOptions; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVyZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvb3B0aW9ucy9jb252ZXJnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFVQSxTQUFnQixlQUFlLENBQzdCLE9BQXlDO0lBRXpDLE9BQU87UUFFTCxVQUFVLEVBQUUsT0FBTyxDQUFDLFVBQVU7UUFDOUIsYUFBYSxFQUNYLE9BQU8sQ0FBQyxhQUFhLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxVQUFVO1FBQzNFLFdBQVcsRUFBRSxPQUFPLENBQUMsV0FBVztRQUNoQyxjQUFjLEVBQUUsT0FBTyxDQUFDLGNBQWMsSUFBSSxPQUFPLENBQUMsV0FBVztRQUM3RCxRQUFRLEVBQUUsT0FBTyxDQUFDLFFBQVE7UUFDMUIsV0FBVyxFQUNULE9BQU8sQ0FBQyxXQUFXLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxRQUFRO1FBQ3JFLE9BQU8sRUFBRSxPQUFPLENBQUMsT0FBTztRQUN4QixVQUFVLEVBQUUsT0FBTyxDQUFDLFVBQVUsSUFBSSxPQUFPLENBQUMsT0FBTztRQUNqRCxjQUFjLEVBQUUsT0FBTyxDQUFDLGNBQWM7UUFDdEMsaUJBQWlCLEVBQUUs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QUMsWUFBWTtRQUNsQyxjQUFjLEVBQUUsT0FBTyxDQUFDLGNBQWM7UUFDdEMsNEJBQTRCLEVBQUUsT0FBTyxDQUFDLDRCQUE0QjtLQUNuRSxDQUFDO0FBQ0osQ0FBQztBQTVDRCwwQ0E0Q0MifQ== |
@@ -14,2 +14,3 @@ "use strict"; | ||
const pug_id_notation_1 = require("./pug-id-notation"); | ||
const pug_preserve_attribute_brackets_1 = require("./pug-preserve-attribute-brackets"); | ||
const pug_single_file_component_indentation_1 = require("./pug-single-file-component-indentation"); | ||
@@ -41,5 +42,6 @@ const pug_wrap_attributes_1 = require("./pug-wrap-attributes"); | ||
pugFramework: pug_framework_1.PUG_FRAMEWORK, | ||
pugPreserveAttributeBrackets: pug_preserve_attribute_brackets_1.PUG_PRESERVE_ATTRIBUTE_BRACKETS, | ||
}; | ||
var constants_1 = require("./constants"); | ||
Object.defineProperty(exports, "CATEGORY_PUG", { enumerable: true, get: function () { return constants_1.CATEGORY_PUG; } }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvb3B0aW9ucy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwyREFJNkI7QUFDN0IscUNBU2tCO0FBQ2xCLHlEQUc0QjtBQUM1Qix1RUFBMkU7QUFDM0UsNkRBQTBEO0FBQzFELDZEQUEwRDtBQUMxRCwrRUFBbUY7QUFDbkYseURBQXNEO0FBQ3RELG1EQUFnRDtBQUNoRCx1REFBb0Q7QUFDcEQsbUdBQWdHO0FBQ2hHLCtEQUcrQjtBQUtsQixRQUFBLE9BQU8sR0FBbUI7SUFDckMsYUFBYSxFQUFFLCtCQUFzQjtJQUNyQyxjQUFjLEVBQUUsZ0NBQXVCO0lBQ3ZDLFdBQVcsRUFBRSw2QkFBb0I7SUFDakMsVUFBVSxFQUFFL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sdUZBQW9GO0FBQ3BGLG1HQUFnRztBQUNoRywrREFHK0I7QUFLbEIsUUFBQSxPQUFPLEdBQW1CO0lBQ3JDLGFBQWEsRUFBRSwrQkFBc0I7SUFDckMsY0FBYyxFQUFFLGdDQUF1QjtJQUN2QyxXQUFXLEVBQUUsNkJBQW9CO0lBQ2pDLFVBQVUsRUFBRSw0QkFBbUI7SUFDL0IsaUJBQWlCLEVBQUUsbUNBQTBCO0lBQzdDLGNBQWMsRUFBRSxnQ0FBdUI7SUFDdkMsT0FBTyxFQUFFLHdCQUFlO0lBQ3hCLGtCQUFrQixFQUFFLHFDQUE0QjtJQUNoRCxxQkFBcUIsRUFBRSx3REFBOEI7SUFDckQsd0JBQXdCLEVBQUUsZ0VBQWtDO0lBQzVELGlCQUFpQixFQUFFLDhDQUEwQjtJQUM3QywwQkFBMEIsRUFBRSx3REFBb0M7SUFDaEUsb0JBQW9CLEVBQUUsa0RBQThCO0lBQ3BELDBCQUEwQixFQUFFLG1EQUE2QjtJQUN6RCx3QkFBd0IsRUFBRSxpREFBMkI7SUFDckQsa0JBQWtCLEVBQUUsOENBQTJCO0lBQy9DLGdCQUFnQixFQUFFLHVDQUFrQjtJQUNwQyxhQUFhLEVBQUUsaUNBQWU7SUFDOUIsZ0JBQWdCLEVBQUUsdUNBQWtCO0lBQ3BDLGNBQWMsRUFBRSxtQ0FBZ0I7SUFDaEMsNkJBQTZCLEVBQUUsMkRBQXdDO0lBQ3ZFLGlDQUFpQyxFQUFFLDZFQUFxQztJQUN4RSxZQUFZLEVBQUUsNkJBQWE7SUFDM0IsNEJBQTRCLEVBQUUsaUVBQStCO0NBQzlELENBQUM7QUFFRix5Q0FBMkM7QUFBbEMseUdBQUEsWUFBWSxPQUFBIn0= |
{ | ||
"name": "@prettier/plugin-pug", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Prettier Pug Plugin", | ||
@@ -13,3 +13,3 @@ "main": "dist/index.js", | ||
"lint": "eslint .", | ||
"test": "vitest --run", | ||
"test": "vitest", | ||
"prepublishOnly": "pnpm run clean && pnpm install && pnpm run build" | ||
@@ -54,8 +54,8 @@ }, | ||
"devDependencies": { | ||
"@types/node": "~18.0.0", | ||
"@types/prettier": "~2.6.3", | ||
"@typescript-eslint/eslint-plugin": "~5.29.0", | ||
"@typescript-eslint/parser": "~5.29.0", | ||
"@types/node": "~18.6.2", | ||
"@types/prettier": "~2.6.4", | ||
"@typescript-eslint/eslint-plugin": "~5.31.0", | ||
"@typescript-eslint/parser": "~5.31.0", | ||
"benchmark": "~2.1.4", | ||
"eslint": "~8.18.0", | ||
"eslint": "~8.20.0", | ||
"eslint-config-prettier": "~8.5.0", | ||
@@ -65,4 +65,4 @@ "eslint-define-config": "~1.5.1", | ||
"eslint-plugin-inclusive-language": "~2.2.0", | ||
"eslint-plugin-jsdoc": "~39.3.3", | ||
"eslint-plugin-prettier": "~4.0.0", | ||
"eslint-plugin-jsdoc": "~39.3.4", | ||
"eslint-plugin-prettier": "~4.2.1", | ||
"eslint-plugin-spellcheck": "~0.0.19", | ||
@@ -72,5 +72,5 @@ "prettier": "2.7.1", | ||
"typescript": "~4.7.4", | ||
"vite": "~2.9.12", | ||
"vite": "~3.0.4", | ||
"vitepress": "1.0.0-alpha.4", | ||
"vitest": "~0.15.2" | ||
"vitest": "~0.19.1" | ||
}, | ||
@@ -80,3 +80,3 @@ "peerDependencies": { | ||
}, | ||
"packageManager": "pnpm@7.3.0", | ||
"packageManager": "pnpm@7.7.0", | ||
"engines": { | ||
@@ -89,2 +89,3 @@ "node": ">=14.6.0", | ||
"ignoreMissing": [ | ||
"@algolia/client-search", | ||
"@types/react", | ||
@@ -91,0 +92,0 @@ "react", |
@@ -53,3 +53,4 @@ import type { ParserOptions } from 'prettier'; | ||
pugExplicitDiv: options.pugExplicitDiv, | ||
pugPreserveAttributeBrackets: options.pugPreserveAttributeBrackets, | ||
}; | ||
} |
@@ -28,2 +28,3 @@ import type { SupportOptions } from 'prettier'; | ||
import { PUG_ID_NOTATION } from './pug-id-notation'; | ||
import { PUG_PRESERVE_ATTRIBUTE_BRACKETS } from './pug-preserve-attribute-brackets'; | ||
import { PUG_SINGLE_FILE_COMPONENT_INDENTATION } from './pug-single-file-component-indentation'; | ||
@@ -62,2 +63,3 @@ import { | ||
pugFramework: PUG_FRAMEWORK, | ||
pugPreserveAttributeBrackets: PUG_PRESERVE_ATTRIBUTE_BRACKETS, | ||
}; | ||
@@ -64,0 +66,0 @@ |
@@ -63,2 +63,4 @@ import type { ParserOptions } from 'prettier'; | ||
pugFramework: PugFramework; | ||
pugPreserveAttributeBrackets: boolean; | ||
} |
@@ -145,3 +145,9 @@ import 'prettier'; | ||
pugFramework?: PugParserOptions['pugFramework']; | ||
/** | ||
* Preserve attribute brackets. | ||
* | ||
* @default false | ||
*/ | ||
pugPreserveAttributeBrackets?: PugParserOptions['pugPreserveAttributeBrackets']; | ||
} | ||
} |
@@ -145,2 +145,3 @@ import type { BuiltInParserName, Options, RequiredOptions } from 'prettier'; | ||
readonly pugExplicitDiv: boolean; | ||
readonly pugPreserveAttributeBrackets: boolean; | ||
} | ||
@@ -1099,3 +1100,3 @@ | ||
// Prevent wrong quotation if there is an extra whitespace at the end | ||
const rightTrimmedVal: string = val.trimRight(); | ||
const rightTrimmedVal: string = val.trimEnd(); | ||
if (isQuoted(rightTrimmedVal)) { | ||
@@ -1174,5 +1175,10 @@ val = makeString(rightTrimmedVal.slice(1, -1), this.quotes); | ||
if (this.options.pugBracketSameLine) { | ||
this.result = this.result.trimRight(); | ||
this.result = this.result.trimEnd(); | ||
} | ||
this.result += ')'; | ||
} else if ( | ||
this.options.pugPreserveAttributeBrackets && | ||
this.previousToken?.type === 'start-attributes' | ||
) { | ||
this.result += '()'; | ||
} | ||
@@ -1240,7 +1246,9 @@ if ( | ||
) { | ||
this.result += 'div'; | ||
this.result += `${this.computedIndent}div`; | ||
} | ||
if ( | ||
this.nextToken && | ||
['text', 'newline', 'indent', 'eos'].includes(this.nextToken?.type) | ||
['text', 'newline', 'indent', 'outdent', 'eos'].includes( | ||
this.nextToken.type, | ||
) | ||
) { | ||
@@ -1252,3 +1260,3 @@ const classes: string[] = this.classLiteralToAttribute.splice( | ||
this.result += `(class=${this.quoteString(classes.join(' '))})`; | ||
if (this.nextToken?.type === 'text') { | ||
if (this.nextToken.type === 'text') { | ||
this.result += ' '; | ||
@@ -1408,2 +1416,4 @@ } | ||
} | ||
} else if (type === 'eos') { | ||
break; | ||
} | ||
@@ -1420,5 +1430,8 @@ token = this.getNextToken(); | ||
if (lastLine !== undefined) { | ||
lines.push(lastLine.trimRight()); | ||
lines.push(lastLine.trimEnd()); | ||
} | ||
result += lines.join('\n'); | ||
if (token.type === 'eos') { | ||
result += '\n'; | ||
} | ||
} | ||
@@ -1758,3 +1771,3 @@ } | ||
result = result.trimRight(); | ||
result = result.trimEnd(); | ||
const indentString: string = this.indentString.repeat( | ||
@@ -1761,0 +1774,0 @@ this.indentLevel + 1, |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
335863
64
6403