@1adybug/prettier 0.0.11 → 0.0.12
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.js +8 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -7,6 +7,13 @@ 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 fileExistsWithAnyExtension(path) {
|
|
11
|
+
if (existsSync(path)) return true;
|
|
12
|
+
const { dir, base } = parse(path);
|
|
13
|
+
if (!existsSync(dir)) return false;
|
|
14
|
+
const list = readdirSync(dir);
|
|
15
|
+
return list.some((item)=>item.startsWith(`${base}.`));
|
|
16
|
+
}
|
|
10
17
|
function getResolveAlias(filepath) {
|
|
11
18
|
try {
|
|
12
19
|
filepath = resolve(filepath);
|
|
@@ -24,7 +31,7 @@ function getResolveAlias(filepath) {
|
|
|
24
31
|
const matchPath = createMatchPath(tsconfig.absoluteBaseUrl, tsconfig.paths);
|
|
25
32
|
return function(importPath) {
|
|
26
33
|
importPath = importPath.replace(/^(.+?)\?.*$/, "$1");
|
|
27
|
-
return matchPath(importPath);
|
|
34
|
+
return matchPath(importPath, void 0, fileExistsWithAnyExtension, void 0);
|
|
28
35
|
};
|
|
29
36
|
} catch (error) {
|
|
30
37
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1adybug/prettier",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "推荐的 Prettier 配置",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prettier",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"prettier-plugin-tailwindcss": "^0.7.1",
|
|
40
40
|
"tsconfig-paths": "^4.2.0",
|
|
41
41
|
"@1adybug/prettier-plugin-sort-imports": "0.0.20",
|
|
42
|
-
"@1adybug/prettier-plugin-
|
|
43
|
-
"@1adybug/prettier-plugin-
|
|
42
|
+
"@1adybug/prettier-plugin-block-padding": "0.0.12",
|
|
43
|
+
"@1adybug/prettier-plugin-remove-braces": "0.0.6"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@rslib/core": "^0.18.2",
|