@1adybug/prettier 0.0.12 → 0.0.14

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -2
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -7,12 +7,20 @@ import { createPlugin } from "@1adybug/prettier-plugin-sort-imports";
7
7
  import { createMatchPath, loadConfig } from "tsconfig-paths";
8
8
  import * as __rspack_external_prettier_plugin_tailwindcss_a3404f7e from "prettier-plugin-tailwindcss";
9
9
  const src_require = createRequire(import.meta.url);
10
+ function isPossibleFile(base, item) {
11
+ if (!item.startsWith(`${base}.`)) return false;
12
+ const left = item.slice(base.length + 1);
13
+ if (!left) return false;
14
+ if ("d.ts" === left) return true;
15
+ if (left.includes(".")) return false;
16
+ return true;
17
+ }
10
18
  function fileExistsWithAnyExtension(path) {
11
19
  if (existsSync(path)) return true;
12
20
  const { dir, base } = parse(path);
13
21
  if (!existsSync(dir)) return false;
14
22
  const list = readdirSync(dir);
15
- return list.some((item)=>item.startsWith(`${base}.`));
23
+ return list.some((item)=>isPossibleFile(base, item));
16
24
  }
17
25
  function getResolveAlias(filepath) {
18
26
  try {
@@ -90,7 +98,7 @@ function getResolvedPathDir(resolvedPath) {
90
98
  if (existsSync(resolvedPath) && statSync(resolvedPath).isFile()) return parse(resolvedPath).dir;
91
99
  const { dir, base } = parse(resolvedPath);
92
100
  const list = readdirSync(dir);
93
- for (const item of list)if (item.startsWith(`${base}.`) && statSync(join(dir, item)).isFile()) return dir;
101
+ for (const item of list)if (isPossibleFile(base, item) && statSync(join(dir, item)).isFile()) return dir;
94
102
  return resolvedPath;
95
103
  }
96
104
  const config = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1adybug/prettier",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "推荐的 Prettier 配置",
5
5
  "keywords": [
6
6
  "prettier",
@@ -38,9 +38,9 @@
38
38
  "dependencies": {
39
39
  "prettier-plugin-tailwindcss": "^0.7.1",
40
40
  "tsconfig-paths": "^4.2.0",
41
- "@1adybug/prettier-plugin-sort-imports": "0.0.20",
42
- "@1adybug/prettier-plugin-block-padding": "0.0.12",
43
- "@1adybug/prettier-plugin-remove-braces": "0.0.6"
41
+ "@1adybug/prettier-plugin-sort-imports": "0.0.21",
42
+ "@1adybug/prettier-plugin-block-padding": "0.0.13",
43
+ "@1adybug/prettier-plugin-remove-braces": "0.0.7"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@rslib/core": "^0.18.2",
@@ -48,7 +48,7 @@
48
48
  "typescript": "^5.9.3"
49
49
  },
50
50
  "peerDependencies": {
51
- "prettier": "^3.0.0"
51
+ "prettier": "^3.7.3"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "rslib build",