@esmate/prettier 0.0.1 → 0.0.3
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/README.md +1 -23
- package/dist/index.d.ts +17 -9
- package/dist/index.js +24 -11
- package/dist/plugins/astro.d.ts +4 -0
- package/dist/plugins/svelte.d.ts +2 -0
- package/dist/plugins/svelte.js +1 -0
- package/package.json +15 -13
package/README.md
CHANGED
|
@@ -1,23 +1 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
## Setup
|
|
4
|
-
|
|
5
|
-
Install the dependencies:
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm install
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Get started
|
|
12
|
-
|
|
13
|
-
Build the library:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
pnpm build
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Build the library in watch mode:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
pnpm dev
|
|
23
|
-
```
|
|
1
|
+
# @esmate/prettier
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
import type { Config } from "prettier";
|
|
2
|
+
import type { AstroOptions } from "./plugins/astro";
|
|
3
|
+
import type { SvelteOptions } from "./plugins/svelte";
|
|
2
4
|
import type { TailwindOptions } from "./plugins/tailwind";
|
|
3
5
|
interface Options {
|
|
6
|
+
/**
|
|
7
|
+
* Ignores files from formatting.
|
|
8
|
+
*
|
|
9
|
+
* So you don't have to use .prettierignore file.
|
|
10
|
+
*/
|
|
11
|
+
ignores?: string[];
|
|
4
12
|
/**
|
|
5
13
|
* Enable Astro support.
|
|
6
14
|
*
|
|
7
|
-
*
|
|
15
|
+
* http://npm.im/prettier-plugin-astro
|
|
8
16
|
*/
|
|
9
|
-
astro?: boolean;
|
|
17
|
+
astro?: boolean | AstroOptions;
|
|
10
18
|
/**
|
|
11
|
-
* Enable
|
|
19
|
+
* Enable Svelte support.
|
|
12
20
|
*
|
|
13
|
-
*
|
|
21
|
+
* http://npm.im/prettier-plugin-svelte
|
|
14
22
|
*/
|
|
15
|
-
|
|
23
|
+
svelte?: boolean | SvelteOptions;
|
|
16
24
|
/**
|
|
17
|
-
*
|
|
25
|
+
* Enable TailwindCSS support.
|
|
18
26
|
*
|
|
19
|
-
*
|
|
27
|
+
* http://npm.im/prettier-plugin-tailwindcss
|
|
20
28
|
*/
|
|
21
|
-
|
|
29
|
+
tailwind?: boolean | TailwindOptions;
|
|
22
30
|
}
|
|
23
|
-
export declare function defineConfig(options
|
|
31
|
+
export declare function defineConfig(options: Options, config?: Config): Config;
|
|
24
32
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -15,8 +15,21 @@ function defineConfig(options, config) {
|
|
|
15
15
|
];
|
|
16
16
|
const plugins = config?.plugins || [];
|
|
17
17
|
const overrides = config?.overrides || [];
|
|
18
|
+
{
|
|
19
|
+
const ignores = [
|
|
20
|
+
"pnpm-lock.yaml"
|
|
21
|
+
];
|
|
22
|
+
if (options?.ignores) ignores.push(...options.ignores);
|
|
23
|
+
overrides.push({
|
|
24
|
+
files: ignores,
|
|
25
|
+
options: {
|
|
26
|
+
requirePragma: true
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
18
30
|
if (options?.astro) {
|
|
19
31
|
plugins.push((0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.importPlugin)("astro"));
|
|
32
|
+
configs.push(true === options.astro ? {} : options.astro);
|
|
20
33
|
overrides.push({
|
|
21
34
|
files: "*.astro",
|
|
22
35
|
options: {
|
|
@@ -24,20 +37,20 @@ function defineConfig(options, config) {
|
|
|
24
37
|
}
|
|
25
38
|
});
|
|
26
39
|
}
|
|
40
|
+
if (options?.svelte) {
|
|
41
|
+
plugins.push((0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.importPlugin)("svelte"));
|
|
42
|
+
configs.push(true === options.svelte ? {} : options.svelte);
|
|
43
|
+
overrides.push({
|
|
44
|
+
files: "*.svelte",
|
|
45
|
+
options: {
|
|
46
|
+
parser: "svelte"
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
27
50
|
if (options?.tailwind) {
|
|
28
|
-
const config = true === options.tailwind ? {} : options.tailwind;
|
|
29
|
-
configs.push(config);
|
|
30
51
|
plugins.push((0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.importPlugin)("tailwind"));
|
|
52
|
+
configs.push(true === options.tailwind ? {} : options.tailwind);
|
|
31
53
|
}
|
|
32
|
-
overrides.push({
|
|
33
|
-
files: [
|
|
34
|
-
"pnpm-lock.yaml",
|
|
35
|
-
...options?.ignores || []
|
|
36
|
-
],
|
|
37
|
-
options: {
|
|
38
|
-
requirePragma: true
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
54
|
return {
|
|
42
55
|
...configs.reduce((prev, curr)=>({
|
|
43
56
|
...prev,
|
package/dist/plugins/astro.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "prettier-plugin-svelte";
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esmate/prettier",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/viendinhcom/esmate.git"
|
|
9
|
+
},
|
|
6
10
|
"exports": {
|
|
7
11
|
".": {
|
|
8
12
|
"types": "./dist/index.d.ts",
|
|
@@ -13,28 +17,26 @@
|
|
|
13
17
|
"files": [
|
|
14
18
|
"dist"
|
|
15
19
|
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "rslib build",
|
|
18
|
-
"watch": "rslib build --watch",
|
|
19
|
-
"prepack": "rslib build",
|
|
20
|
-
"lint": "eslint",
|
|
21
|
-
"lint:fix": "eslint --fix"
|
|
22
|
-
},
|
|
23
|
-
"peerDependencies": {
|
|
24
|
-
"prettier": "^3.5.3"
|
|
25
|
-
},
|
|
26
20
|
"dependencies": {
|
|
27
|
-
"es-toolkit": "^1.38.0",
|
|
28
21
|
"make-synchronized": "^0.7.2",
|
|
29
22
|
"prettier-plugin-astro": "^0.14.1",
|
|
23
|
+
"prettier-plugin-svelte": "^3.4.0",
|
|
30
24
|
"prettier-plugin-tailwindcss": "^0.6.11"
|
|
31
25
|
},
|
|
32
26
|
"devDependencies": {
|
|
33
27
|
"@rslib/core": "^0.7.1",
|
|
34
28
|
"@types/node": "^22.8.1",
|
|
29
|
+
"eslint": "^9.27.0",
|
|
30
|
+
"prettier": "^3.5.3",
|
|
35
31
|
"typescript": "^5.8.3"
|
|
36
32
|
},
|
|
37
33
|
"publishConfig": {
|
|
38
34
|
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "rslib build",
|
|
38
|
+
"dev": "rslib build --watch",
|
|
39
|
+
"fix": "prettier --write . && eslint --fix .",
|
|
40
|
+
"check": "tsc && prettier --check . && eslint ."
|
|
39
41
|
}
|
|
40
|
-
}
|
|
42
|
+
}
|