@esmate/prettier 0.0.3 → 1.0.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@esmate/prettier",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "1.0.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/dist/index.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import type { Config } from "prettier";
2
- import type { AstroOptions } from "./plugins/astro";
3
- import type { SvelteOptions } from "./plugins/svelte";
4
- import type { TailwindOptions } from "./plugins/tailwind";
5
- interface Options {
6
- /**
7
- * Ignores files from formatting.
8
- *
9
- * So you don't have to use .prettierignore file.
10
- */
11
- ignores?: string[];
12
- /**
13
- * Enable Astro support.
14
- *
15
- * http://npm.im/prettier-plugin-astro
16
- */
17
- astro?: boolean | AstroOptions;
18
- /**
19
- * Enable Svelte support.
20
- *
21
- * http://npm.im/prettier-plugin-svelte
22
- */
23
- svelte?: boolean | SvelteOptions;
24
- /**
25
- * Enable TailwindCSS support.
26
- *
27
- * http://npm.im/prettier-plugin-tailwindcss
28
- */
29
- tailwind?: boolean | TailwindOptions;
30
- }
31
- export declare function defineConfig(options: Options, config?: Config): Config;
32
- export {};
package/dist/index.js DELETED
@@ -1,63 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
2
- function defineConfig(options, config) {
3
- const defaultConfig = {
4
- semi: true,
5
- tabWidth: 2,
6
- useTabs: false,
7
- printWidth: 120,
8
- endOfLine: "auto",
9
- singleQuote: false,
10
- proseWrap: "always",
11
- trailingComma: "all"
12
- };
13
- const configs = [
14
- config || {}
15
- ];
16
- const plugins = config?.plugins || [];
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
- }
30
- if (options?.astro) {
31
- plugins.push((0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.importPlugin)("astro"));
32
- configs.push(true === options.astro ? {} : options.astro);
33
- overrides.push({
34
- files: "*.astro",
35
- options: {
36
- parser: "astro"
37
- }
38
- });
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
- }
50
- if (options?.tailwind) {
51
- plugins.push((0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.importPlugin)("tailwind"));
52
- configs.push(true === options.tailwind ? {} : options.tailwind);
53
- }
54
- return {
55
- ...configs.reduce((prev, curr)=>({
56
- ...prev,
57
- ...curr
58
- }), defaultConfig),
59
- plugins,
60
- overrides
61
- };
62
- }
63
- export { defineConfig };
@@ -1,5 +0,0 @@
1
- export * from "prettier-plugin-astro";
2
- export interface AstroOptions {
3
- astroAllowShorthand?: boolean;
4
- astroSkipFrontmatter?: boolean;
5
- }
@@ -1 +0,0 @@
1
- export * from "prettier-plugin-astro";
@@ -1,2 +0,0 @@
1
- export * from "prettier-plugin-svelte";
2
- export type { PluginConfig as SvelteOptions } from "prettier-plugin-svelte";
@@ -1 +0,0 @@
1
- export * from "prettier-plugin-svelte";
@@ -1,2 +0,0 @@
1
- export * from "prettier-plugin-tailwindcss";
2
- export type { PluginOptions as TailwindOptions } from "prettier-plugin-tailwindcss";
@@ -1 +0,0 @@
1
- export * from "prettier-plugin-tailwindcss";
package/dist/utils.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { Config } from "prettier";
2
- declare const _default: (defaultConfig?: Config | undefined) => Config;
3
- export default _default;
4
- export declare function importPlugin(plugin: string): string;
package/dist/utils.js DELETED
@@ -1,19 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
2
- import * as __WEBPACK_EXTERNAL_MODULE_make_synchronized_25569d3e__ from "make-synchronized";
3
- import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
4
- const utils = (0, __WEBPACK_EXTERNAL_MODULE_make_synchronized_25569d3e__["default"])(import.meta, async (defaultConfig = {})=>{
5
- const configFile = await (0, __WEBPACK_EXTERNAL_MODULE_prettier__.resolveConfigFile)();
6
- if (configFile) {
7
- const userConfig = await (0, __WEBPACK_EXTERNAL_MODULE_prettier__.resolveConfig)(configFile);
8
- return {
9
- ...defaultConfig,
10
- ...userConfig
11
- };
12
- }
13
- return defaultConfig;
14
- });
15
- function importPlugin(plugin) {
16
- const __dirname = new URL(".", import.meta.url).pathname;
17
- return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(__dirname, "plugins", `${plugin}.js`);
18
- }
19
- export { utils as default, importPlugin };