prettier-plugin-bootstrap 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +10 -0
  2. package/dist/index.js +11 -11
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -85,6 +85,16 @@ Unknown classes are preserved in their original relative order and placed after
85
85
  - `acorn` / `meriyah` — Alternative JS parsers
86
86
  - `astro` — Astro components (requires `prettier-plugin-astro`)
87
87
 
88
+ ### Astro
89
+
90
+ When using with `prettier-plugin-astro`, list `prettier-plugin-bootstrap` **after** `prettier-plugin-astro` in your config so it can wrap the Astro parser:
91
+
92
+ ```json
93
+ {
94
+ "plugins": ["prettier-plugin-astro", "prettier-plugin-bootstrap"]
95
+ }
96
+ ```
97
+
88
98
  ## Development
89
99
 
90
100
  ```bash
package/dist/index.js CHANGED
@@ -375,9 +375,9 @@ const options = {
375
375
  description: "Function names whose arguments are Bootstrap class lists (e.g. clsx, classNames)."
376
376
  }
377
377
  };
378
- function createParserWrapper(parserName, processAst) {
378
+ function createParserWrapper(parserName, processAst, astFormat) {
379
379
  const wrapper = {
380
- astFormat: parserName === "html" || parserName === "vue" || parserName === "angular" ? "html" : "estree",
380
+ astFormat,
381
381
  async parse(text, options) {
382
382
  const plugins = options.plugins || [];
383
383
  let originalParser = null;
@@ -399,15 +399,15 @@ function createParserWrapper(parserName, processAst) {
399
399
  return wrapper;
400
400
  }
401
401
  const parsers = {
402
- html: createParserWrapper("html", processHtmlAst),
403
- vue: createParserWrapper("vue", processHtmlAst),
404
- angular: createParserWrapper("angular", processHtmlAst),
405
- babel: createParserWrapper("babel", processJsxAst),
406
- "babel-ts": createParserWrapper("babel-ts", processJsxAst),
407
- typescript: createParserWrapper("typescript", processJsxAst),
408
- acorn: createParserWrapper("acorn", processJsxAst),
409
- meriyah: createParserWrapper("meriyah", processJsxAst),
410
- astro: createParserWrapper("astro", processHtmlAst)
402
+ html: createParserWrapper("html", processHtmlAst, "html"),
403
+ vue: createParserWrapper("vue", processHtmlAst, "html"),
404
+ angular: createParserWrapper("angular", processHtmlAst, "html"),
405
+ babel: createParserWrapper("babel", processJsxAst, "estree"),
406
+ "babel-ts": createParserWrapper("babel-ts", processJsxAst, "estree"),
407
+ typescript: createParserWrapper("typescript", processJsxAst, "estree"),
408
+ acorn: createParserWrapper("acorn", processJsxAst, "estree"),
409
+ meriyah: createParserWrapper("meriyah", processJsxAst, "estree"),
410
+ astro: createParserWrapper("astro", processHtmlAst, "astro")
411
411
  };
412
412
  //#endregion
413
413
  export { BREAKPOINTS, CLASS_ORDER, classKey, options, parsers, sortClasses };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-bootstrap",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A Prettier plugin for automatic Bootstrap class sorting",
5
5
  "license": "MIT",
6
6
  "type": "module",