@esmate/prettier 0.0.0 → 0.0.2

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/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 {
4
6
  /**
5
7
  * Enable Astro support.
6
8
  *
7
- * https://github.com/withastro/prettier-plugin-astro
9
+ * http://npm.im/prettier-plugin-astro
8
10
  */
9
- astro?: boolean;
11
+ astro?: boolean | AstroOptions;
10
12
  /**
11
- * Enable TailwindCSS support.
13
+ * Ignores files from formatting.
12
14
  *
13
- * https://github.com/tailwindlabs/prettier-plugin-tailwindcss
15
+ * So you don't have to use .prettierignore file.
14
16
  */
15
- tailwind?: boolean | TailwindOptions;
17
+ ignores?: string[];
16
18
  /**
17
- * Ignores files from formatting.
19
+ * Enable Svelte support.
18
20
  *
19
- * https://github.com/tailwindlabs/prettier-plugin-tailwindcss
21
+ * http://npm.im/prettier-plugin-svelte
20
22
  */
21
- ignores?: string[];
23
+ svelte?: boolean | SvelteOptions;
24
+ /**
25
+ * Enable TailwindCSS support.
26
+ *
27
+ * http://npm.im/prettier-plugin-tailwindcss
28
+ */
29
+ tailwind?: boolean | TailwindOptions;
22
30
  }
23
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,
@@ -1 +1,5 @@
1
1
  export * from "prettier-plugin-astro";
2
+ export interface AstroOptions {
3
+ astroAllowShorthand?: boolean;
4
+ astroSkipFrontmatter?: boolean;
5
+ }
@@ -0,0 +1,2 @@
1
+ export * from "prettier-plugin-svelte";
2
+ export type { PluginConfig as SvelteOptions } from "prettier-plugin-svelte";
@@ -0,0 +1 @@
1
+ export * from "prettier-plugin-svelte";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@esmate/prettier",
3
3
  "type": "module",
4
- "version": "0.0.0",
4
+ "version": "0.0.2",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {
@@ -24,9 +24,9 @@
24
24
  "prettier": "^3.5.3"
25
25
  },
26
26
  "dependencies": {
27
- "es-toolkit": "^1.38.0",
28
27
  "make-synchronized": "^0.7.2",
29
28
  "prettier-plugin-astro": "^0.14.1",
29
+ "prettier-plugin-svelte": "^3.4.0",
30
30
  "prettier-plugin-tailwindcss": "^0.6.11"
31
31
  },
32
32
  "devDependencies": {