@esmate/prettier 1.0.4 → 1.0.6

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/LICENSE ADDED
@@ -0,0 +1,16 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Vien Dinh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
7
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ persons to whom the Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11
+ Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -8,7 +8,8 @@ Prettier configuration for humans with support for React, Vue, Svelte, Astro, Ta
8
8
  npm install -D @esmate/prettier prettier
9
9
  ```
10
10
 
11
- If you are using [ESMate CLI](https://www.npmjs.com/package/esmate), it's built-in, so only need to install `prettier`.
11
+ Check out [ESMate CLI](https://www.npmjs.com/package/esmate) for better integration with
12
+ [ESLint](https://github.com/VienDinhCom/esmate/tree/main/packages/eslint)
12
13
 
13
14
  ## Usage
14
15
 
@@ -19,8 +20,8 @@ Define your Prettier configuration in a `prettier.config.js` file:
19
20
  import { defineConfig } from "@esmate/prettier";
20
21
 
21
22
  export default defineConfig({
22
- // astro: true
23
- // svelte: true
23
+ // astro: true,
24
+ // svelte: true,
24
25
 
25
26
  tailwind: {
26
27
  tailwindFunctions: ["cn"],
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_globby__ from "globby";
1
3
  import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
2
4
  function defineConfig(options, config) {
3
5
  const defaultConfig = {
@@ -16,10 +18,15 @@ function defineConfig(options, config) {
16
18
  const plugins = config?.plugins || [];
17
19
  const overrides = config?.overrides || [];
18
20
  {
21
+ const rootDir = (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.findRootDir)();
19
22
  const ignores = [
20
- "pnpm-lock.yaml"
23
+ "pnpm-lock.yaml",
24
+ "package-lock.json"
21
25
  ];
22
- if (options?.ignores) ignores.push(...options.ignores);
26
+ if (options?.ignores) for (const pattern of options.ignores){
27
+ const files = (0, __WEBPACK_EXTERNAL_MODULE_globby__.globbySync)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(rootDir, pattern)).map((file)=>file.replace(rootDir + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep, ""));
28
+ ignores.push(...files);
29
+ }
23
30
  overrides.push({
24
31
  files: ignores,
25
32
  options: {
package/dist/utils.d.ts CHANGED
@@ -2,3 +2,4 @@ import type { Config } from "prettier";
2
2
  declare const _default: (defaultConfig?: Config | undefined) => Config;
3
3
  export default _default;
4
4
  export declare function importPlugin(plugin: string): string;
5
+ export declare function findRootDir(): string;
package/dist/utils.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_make_synchronized_25569d3e__ from "make-synchronized";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_find_up_69e9ea2b__ from "find-up";
4
5
  const utils = (0, __WEBPACK_EXTERNAL_MODULE_make_synchronized_25569d3e__["default"])(import.meta, async (defaultConfig = {})=>{
5
6
  const configFile = await (0, __WEBPACK_EXTERNAL_MODULE_prettier__.resolveConfigFile)();
6
7
  if (configFile) {
@@ -16,4 +17,9 @@ function importPlugin(plugin) {
16
17
  const __dirname = new URL(".", import.meta.url).pathname;
17
18
  return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(__dirname, "plugins", `${plugin}.js`);
18
19
  }
19
- export { utils as default, importPlugin };
20
+ function findRootDir() {
21
+ const pkgPath = (0, __WEBPACK_EXTERNAL_MODULE_find_up_69e9ea2b__.findUpSync)("package.json");
22
+ if (pkgPath) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].parse(pkgPath).dir;
23
+ throw new Error("Could not find root directory where package.json is located");
24
+ }
25
+ export { utils as default, findRootDir, importPlugin };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@esmate/prettier",
3
3
  "type": "module",
4
- "version": "1.0.4",
4
+ "version": "1.0.6",
5
5
  "description": "Prettier configuration for humans.",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -29,6 +29,8 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
+ "find-up": "^7.0.0",
33
+ "globby": "^14.1.0",
32
34
  "make-synchronized": "^0.7.2",
33
35
  "prettier-plugin-astro": "^0.14.1",
34
36
  "prettier-plugin-svelte": "^3.4.0",