@bfra.me/prettier-config 0.2.2 → 0.3.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bfra.me/prettier-config",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Shared Prettier configuration for bfra.me",
5
5
  "license": "MIT",
6
6
  "author": "Marcus R. Brown <contact@bfra.me>",
@@ -26,14 +26,14 @@
26
26
  ],
27
27
  "types": "prettier.config.d.ts",
28
28
  "dependencies": {
29
- "prettier-package-json": "2.8.0"
29
+ "@bfra.me/prettier-plugins": "0.1.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "prettier": "^3.0.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "prettier": "3.2.5",
36
- "@bfra.me/prettier-config": "0.2.2",
36
+ "@bfra.me/prettier-config": "0.3.0",
37
37
  "@bfra.me/tsconfig": "0.3.1"
38
38
  },
39
39
  "keywords": [
@@ -1,6 +1,5 @@
1
- import {parsers} from 'prettier/plugins/babel'
2
- import {format} from 'prettier-package-json'
3
- const jsonStringifyParser = parsers['json-stringify']
1
+ import {createRequire} from 'module'
2
+ const {resolve} = createRequire(import.meta.url)
4
3
  /**
5
4
  * Shared Prettier configuration for bfra.me projects.
6
5
  */
@@ -60,28 +59,7 @@ const config = {
60
59
  },
61
60
  },
62
61
  ],
63
- plugins: [
64
- {
65
- parsers: {
66
- 'json-stringify': {
67
- ...jsonStringifyParser,
68
- preprocess(text, options) {
69
- if (jsonStringifyParser.preprocess) {
70
- text = jsonStringifyParser.preprocess(text, options)
71
- }
72
- if (/package.*json$/u.test(options.filepath)) {
73
- text = format(JSON.parse(text), {
74
- tabWidth: options.tabWidth,
75
- useTabs: options.useTabs === true,
76
- ...(options['prettier-package-json'] ?? {}),
77
- })
78
- }
79
- return text
80
- },
81
- },
82
- },
83
- },
84
- ],
62
+ plugins: ['@bfra.me/prettier-plugins/package-json'].map(plugin => resolve(plugin)),
85
63
  }
86
64
  export default config
87
65
  //# sourceMappingURL=prettier.config.js.map
@@ -1,8 +1,7 @@
1
- import type {Config, ParserOptions} from 'prettier'
2
- import {parsers} from 'prettier/plugins/babel'
3
- import {format, type Options as PrettierPackageJsonOptions} from 'prettier-package-json'
1
+ import {createRequire} from 'module'
2
+ import type {Config} from 'prettier'
4
3
 
5
- const jsonStringifyParser = parsers['json-stringify']
4
+ const {resolve} = createRequire(import.meta.url)
6
5
 
7
6
  /**
8
7
  * Shared Prettier configuration for bfra.me projects.
@@ -69,30 +68,7 @@ const config: Config = {
69
68
  },
70
69
  ],
71
70
 
72
- plugins: [
73
- {
74
- parsers: {
75
- 'json-stringify': {
76
- ...jsonStringifyParser,
77
-
78
- preprocess(text: string, options: ParserOptions) {
79
- if (jsonStringifyParser.preprocess) {
80
- text = jsonStringifyParser.preprocess(text, options)
81
- }
82
- if (/package.*json$/u.test(options.filepath)) {
83
- text = format(JSON.parse(text), {
84
- tabWidth: options.tabWidth,
85
- useTabs: options.useTabs === true,
86
- ...((options['prettier-package-json'] ??
87
- {}) as Partial<PrettierPackageJsonOptions>),
88
- })
89
- }
90
- return text
91
- },
92
- },
93
- },
94
- },
95
- ],
71
+ plugins: ['@bfra.me/prettier-plugins/package-json'].map(plugin => resolve(plugin)),
96
72
  }
97
73
 
98
74
  export default config