@bfra.me/prettier-config 0.5.0 → 0.7.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/120-proof.d.ts +9 -3
- package/120-proof.js +9 -5
- package/120-proof.ts +8 -2
- package/package.json +14 -4
- package/plugins.d.ts +6 -3
- package/plugins.js +7 -2
- package/prettier.config.d.ts +4 -2
- package/prettier.config.js +8 -7
- package/prettier.config.ts +4 -1
- package/tsup.config.ts +11 -0
package/120-proof.d.ts
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
-
import
|
1
|
+
import {Config} from 'prettier'
|
2
|
+
|
3
|
+
declare const preset: {
|
4
|
+
readonly semi: boolean
|
5
|
+
readonly printWidth: 120
|
6
|
+
}
|
2
7
|
/**
|
3
8
|
* Shared Prettier configuration for bfra.me projects with `printWidth` set to 120 characters.
|
4
9
|
*/
|
5
|
-
declare const config: Config
|
6
|
-
|
10
|
+
declare const config: Config & typeof preset
|
11
|
+
|
12
|
+
export {config as default}
|
package/120-proof.js
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
import prettierConfig from '@bfra.me/prettier-config'
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
const {searchParams: params} = new URL(import.meta.url)
|
3
|
+
const preset = {
|
4
|
+
semi: params.has('semi') || prettierConfig.semi || false,
|
5
|
+
printWidth: 120,
|
6
|
+
}
|
5
7
|
const config = {
|
6
8
|
...prettierConfig,
|
7
|
-
|
9
|
+
...preset,
|
8
10
|
}
|
9
|
-
|
11
|
+
var proof_default = config
|
12
|
+
export {proof_default as default}
|
13
|
+
//# sourceMappingURL=120-proof.js.map
|
package/120-proof.ts
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
import prettierConfig from '@bfra.me/prettier-config'
|
2
2
|
import type {Config} from 'prettier'
|
3
3
|
|
4
|
+
const {searchParams: params} = new URL(import.meta.url)
|
5
|
+
const preset = {
|
6
|
+
semi: params.has('semi') || prettierConfig.semi || false,
|
7
|
+
printWidth: 120,
|
8
|
+
} as const satisfies Pick<Config, 'printWidth' | 'semi'>
|
9
|
+
|
4
10
|
/**
|
5
11
|
* Shared Prettier configuration for bfra.me projects with `printWidth` set to 120 characters.
|
6
12
|
*/
|
7
|
-
const config: Config = {
|
13
|
+
const config: Config & typeof preset = {
|
8
14
|
...prettierConfig,
|
9
|
-
|
15
|
+
...preset,
|
10
16
|
}
|
11
17
|
|
12
18
|
export default config
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bfra.me/prettier-config",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.7.0",
|
4
4
|
"description": "Shared Prettier configuration for bfra.me",
|
5
5
|
"keywords": [
|
6
6
|
"bfra.me",
|
@@ -27,6 +27,9 @@
|
|
27
27
|
},
|
28
28
|
"./100-proof": "./prettier.config.js",
|
29
29
|
"./120-proof": "./120-proof.js",
|
30
|
+
"./semi/*": "./*.js?semi=true",
|
31
|
+
"./semi": "./prettier.config.js?semi=true",
|
32
|
+
"./*/semi": "./*.js?semi=true",
|
30
33
|
"./package.json": "./package.json"
|
31
34
|
},
|
32
35
|
"main": "prettier.config.js",
|
@@ -40,9 +43,15 @@
|
|
40
43
|
"@bfra.me/prettier-plugins": "0.3.0"
|
41
44
|
},
|
42
45
|
"devDependencies": {
|
46
|
+
"@types/fs-extra": "11.0.4",
|
47
|
+
"execa": "9.3.1",
|
48
|
+
"fast-glob": "3.3.2",
|
49
|
+
"fs-extra": "11.2.0",
|
43
50
|
"prettier": "3.3.3",
|
51
|
+
"tsup": "8.2.0",
|
52
|
+
"vitest": "2.0.2",
|
44
53
|
"@bfra.me/tsconfig": "0.6.0",
|
45
|
-
"@bfra.me/prettier-config": "0.
|
54
|
+
"@bfra.me/prettier-config": "0.7.0"
|
46
55
|
},
|
47
56
|
"peerDependencies": {
|
48
57
|
"prettier": "^3.0.0"
|
@@ -52,7 +61,8 @@
|
|
52
61
|
"provenance": true
|
53
62
|
},
|
54
63
|
"scripts": {
|
55
|
-
"build": "
|
56
|
-
"format": "prettier --ignore-path .prettierignore --log-level log --write ."
|
64
|
+
"build": "tsup && pnpm run format",
|
65
|
+
"format": "prettier --ignore-path .prettierignore --log-level log --write .",
|
66
|
+
"test": "vitest"
|
57
67
|
}
|
58
68
|
}
|
package/plugins.d.ts
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import {Plugin} from 'prettier'
|
2
|
+
|
3
|
+
type InteropDefault<T> = T extends {
|
3
4
|
default: infer U
|
4
5
|
}
|
5
6
|
? U
|
6
7
|
: T
|
7
|
-
|
8
|
+
declare const resolve: <T extends Plugin>(
|
8
9
|
resolver: (id: string) => string,
|
9
10
|
plugin: string,
|
10
11
|
) => string | T
|
12
|
+
|
13
|
+
export {type InteropDefault, resolve}
|
package/plugins.js
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
+
var __defProp = Object.defineProperty
|
2
|
+
var __name = (target, value) => __defProp(target, 'name', {value, configurable: true})
|
1
3
|
function interopDefault(m) {
|
2
4
|
return m.default || m
|
3
5
|
}
|
6
|
+
__name(interopDefault, 'interopDefault')
|
4
7
|
import {default as pluginPackageJson} from '@bfra.me/prettier-plugins/package-json'
|
5
8
|
const resolvedPlugins = {
|
6
9
|
'@bfra.me/prettier-plugins/package-json': interopDefault(pluginPackageJson),
|
7
10
|
}
|
8
|
-
|
11
|
+
const resolve = /* @__PURE__ */ __name((resolver, plugin) => {
|
9
12
|
try {
|
10
13
|
if (resolvedPlugins[plugin]) {
|
11
14
|
return resolvedPlugins[plugin]
|
@@ -14,4 +17,6 @@ export const resolve = (resolver, plugin) => {
|
|
14
17
|
} finally {
|
15
18
|
return plugin
|
16
19
|
}
|
17
|
-
}
|
20
|
+
}, 'resolve')
|
21
|
+
export {resolve}
|
22
|
+
//# sourceMappingURL=plugins.js.map
|
package/prettier.config.d.ts
CHANGED
package/prettier.config.js
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
import {resolve} from './plugins.js'
|
2
2
|
import {createRequire} from 'module'
|
3
|
-
const
|
4
|
-
const resolvePlugin = resolve.bind(null,
|
5
|
-
|
6
|
-
* Shared Prettier configuration for bfra.me projects.
|
7
|
-
*/
|
3
|
+
const require2 = createRequire(import.meta.url)
|
4
|
+
const resolvePlugin = resolve.bind(null, require2.resolve)
|
5
|
+
const {searchParams: params} = new URL(import.meta.url)
|
8
6
|
const config = {
|
9
7
|
arrowParens: 'avoid',
|
10
8
|
bracketSpacing: false,
|
11
9
|
endOfLine: 'auto',
|
12
10
|
printWidth: 100,
|
13
|
-
semi:
|
11
|
+
semi: params.has('semi', 'true'),
|
14
12
|
singleQuote: true,
|
15
13
|
overrides: [
|
16
14
|
// Adapted from https://github.com/sxzz/prettier-config/blob/1e5cc3021e5816aceebe0b90af1d530239442ecf/index.js.
|
@@ -31,6 +29,7 @@ const config = {
|
|
31
29
|
'**/.vitepress/cache/**',
|
32
30
|
'**/.vite-inspect/**',
|
33
31
|
'**/__snapshots__/**',
|
32
|
+
'**/test/fixtures/**',
|
34
33
|
'**/auto-import?(s).d.ts',
|
35
34
|
'**/.changeset/*.md',
|
36
35
|
'**/CHANGELOG*.md',
|
@@ -70,4 +69,6 @@ const config = {
|
|
70
69
|
],
|
71
70
|
plugins: ['@bfra.me/prettier-plugins/package-json'].map(resolvePlugin),
|
72
71
|
}
|
73
|
-
|
72
|
+
var prettier_config_default = config
|
73
|
+
export {prettier_config_default as default}
|
74
|
+
//# sourceMappingURL=prettier.config.js.map
|
package/prettier.config.ts
CHANGED
@@ -6,6 +6,8 @@ import {createRequire} from 'module'
|
|
6
6
|
const require = createRequire(import.meta.url)
|
7
7
|
const resolvePlugin = resolve.bind(null, require.resolve)
|
8
8
|
|
9
|
+
const {searchParams: params} = new URL(import.meta.url)
|
10
|
+
|
9
11
|
/**
|
10
12
|
* Shared Prettier configuration for bfra.me projects.
|
11
13
|
*/
|
@@ -14,7 +16,7 @@ const config: Config = {
|
|
14
16
|
bracketSpacing: false,
|
15
17
|
endOfLine: 'auto',
|
16
18
|
printWidth: 100,
|
17
|
-
semi:
|
19
|
+
semi: params.has('semi', 'true'),
|
18
20
|
singleQuote: true,
|
19
21
|
|
20
22
|
overrides: [
|
@@ -36,6 +38,7 @@ const config: Config = {
|
|
36
38
|
'**/.vitepress/cache/**',
|
37
39
|
'**/.vite-inspect/**',
|
38
40
|
'**/__snapshots__/**',
|
41
|
+
'**/test/fixtures/**',
|
39
42
|
|
40
43
|
'**/auto-import?(s).d.ts',
|
41
44
|
'**/.changeset/*.md',
|
package/tsup.config.ts
ADDED