@1adybug/prettier 0.0.6 → 0.0.8
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 +9 -13
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { existsSync,
|
|
2
|
-
import { builtinModules } from "module";
|
|
1
|
+
import { existsSync, statSync } from "fs";
|
|
2
|
+
import { builtinModules, createRequire } from "module";
|
|
3
3
|
import { join, parse, resolve } from "path";
|
|
4
4
|
import prettier_plugin_block_padding from "@1adybug/prettier-plugin-block-padding";
|
|
5
5
|
import prettier_plugin_remove_braces from "@1adybug/prettier-plugin-remove-braces";
|
|
6
6
|
import { createPlugin } from "@1adybug/prettier-plugin-sort-imports";
|
|
7
|
-
import json5 from "json5";
|
|
8
7
|
import { createMatchPath, loadConfig } from "tsconfig-paths";
|
|
9
8
|
import * as __rspack_external_prettier_plugin_tailwindcss_a3404f7e from "prettier-plugin-tailwindcss";
|
|
9
|
+
const src_require = createRequire(import.meta.url);
|
|
10
10
|
const extensions = [
|
|
11
11
|
".ts",
|
|
12
12
|
".tsx",
|
|
@@ -37,17 +37,13 @@ function getResolveAlias(filepath) {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const packageJson = json5.parse(readFileSync("package.json", "utf-8"));
|
|
41
40
|
function hasDependency(dependency) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
...peerDependencies
|
|
49
|
-
});
|
|
50
|
-
return total.some((item)=>"string" == typeof dependency ? item === dependency : dependency.test(item));
|
|
41
|
+
try {
|
|
42
|
+
src_require.resolve(dependency);
|
|
43
|
+
return true;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
51
47
|
}
|
|
52
48
|
function isReact(path) {
|
|
53
49
|
return /^(npm:)?react(-dom|-native)?(\/|$)/.test(path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1adybug/prettier",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "推荐的 Prettier 配置",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prettier",
|
|
@@ -20,10 +20,12 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
|
-
"import": "./dist/index.js"
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.js"
|
|
24
25
|
}
|
|
25
26
|
},
|
|
26
27
|
"main": "./dist/index.js",
|
|
28
|
+
"module": "./dist/index.js",
|
|
27
29
|
"types": "./dist/index.d.ts",
|
|
28
30
|
"files": [
|
|
29
31
|
"dist"
|
|
@@ -34,12 +36,11 @@
|
|
|
34
36
|
"registry": "https://registry.npmjs.com/"
|
|
35
37
|
},
|
|
36
38
|
"dependencies": {
|
|
37
|
-
"json5": "^2.2.3",
|
|
38
39
|
"prettier-plugin-tailwindcss": "^0.7.1",
|
|
39
40
|
"tsconfig-paths": "^4.2.0",
|
|
41
|
+
"@1adybug/prettier-plugin-block-padding": "0.0.11",
|
|
40
42
|
"@1adybug/prettier-plugin-sort-imports": "0.0.19",
|
|
41
|
-
"@1adybug/prettier-plugin-remove-braces": "0.0.5"
|
|
42
|
-
"@1adybug/prettier-plugin-block-padding": "0.0.11"
|
|
43
|
+
"@1adybug/prettier-plugin-remove-braces": "0.0.5"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@rslib/core": "^0.18.2",
|