@1adybug/prettier 0.0.2 → 0.0.4

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 +6 -6
  2. package/package.json +53 -60
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { readFileSync } from "fs";
2
2
  import { builtinModules } from "module";
3
- import json5 from "json5";
4
- import prettier_plugin_block_padding from "prettier-plugin-block-padding";
3
+ import prettier_plugin_block_padding from "@1adybug/prettier-plugin-block-padding";
5
4
  import prettier_plugin_remove_braces from "@1adybug/prettier-plugin-remove-braces";
6
5
  import { createPlugin } from "@1adybug/prettier-plugin-sort-imports";
6
+ import json5 from "json5";
7
7
  import * as __rspack_external_prettier_plugin_tailwindcss_a3404f7e from "prettier-plugin-tailwindcss";
8
8
  const packageJson = json5.parse(readFileSync("package.json", "utf-8"));
9
9
  function hasDependency(dependency) {
@@ -27,7 +27,7 @@ function isBuiltin(path) {
27
27
  let pathAlias = [];
28
28
  try {
29
29
  const tsConfig = json5.parse(readFileSync("tsconfig.json", "utf-8"));
30
- pathAlias = Object.keys(tsConfig.compilerOptions?.paths ?? {}).map((item)=>item.match(/^((@|~).*\/)\*/)).filter(Boolean).map((item)=>item?.[1]);
30
+ pathAlias = Object.keys(tsConfig.compilerOptions?.paths ?? {}).map((item)=>item.match(/^((@|~).*\/)\*/)).filter(Boolean).map((item)=>item[1]);
31
31
  } catch {}
32
32
  function isAbsolute(path) {
33
33
  return pathAlias.some((item)=>path.startsWith(item));
@@ -68,9 +68,10 @@ const otherPlugins = hasTailwindcss ? [
68
68
  ];
69
69
  const src_plugin = createPlugin({
70
70
  getGroup ({ path }) {
71
+ const type = getModuleType(path);
71
72
  const info = {
72
- type: getModuleType(path),
73
- dir: getDir(path)
73
+ type,
74
+ dir: "absolute" === type || "relative" === type ? getDir(path) : ""
74
75
  };
75
76
  return JSON.stringify(info);
76
77
  },
@@ -79,7 +80,6 @@ const src_plugin = createPlugin({
79
80
  },
80
81
  separator: "",
81
82
  sortSideEffect: true,
82
- removeUnusedImports: true,
83
83
  otherPlugins
84
84
  });
85
85
  const src = src_plugin;
package/package.json CHANGED
@@ -1,62 +1,55 @@
1
1
  {
2
- "name": "@1adybug/prettier",
3
- "version": "0.0.2",
4
- "description": "自用的 Prettier 配置",
5
- "keywords": [
6
- "prettier",
7
- "plugin"
8
- ],
9
- "author": "1adybug <lurongv@qq.com>",
10
- "license": "MIT",
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/1adybug/prettier.git"
14
- },
15
- "homepage": "https://github.com/1adybug/prettier#readme",
16
- "bugs": {
17
- "url": "https://github.com/1adybug/prettier/issues"
18
- },
19
- "type": "module",
20
- "exports": {
21
- ".": {
22
- "types": "./dist/index.d.ts",
23
- "import": "./dist/index.js"
24
- }
25
- },
26
- "types": "./dist/index.d.ts",
27
- "files": [
28
- "dist"
29
- ],
30
- "sideEffects": false,
31
- "scripts": {
32
- "build": "rslib build",
33
- "dev": "rslib build --watch",
34
- "format": "prettier --write .",
35
- "fg": "npm run format && git add . && git commit -m \"✨feature: format\"",
36
- "prepare": "husky"
37
- },
38
- "dependencies": {
39
- "@1adybug/prettier-plugin-remove-braces": "^0.0.3",
40
- "@1adybug/prettier-plugin-sort-imports": "^0.0.16",
41
- "json5": "^2.2.3",
42
- "prettier-plugin-block-padding": "^0.0.10",
43
- "prettier-plugin-tailwindcss": "^0.7.1"
44
- },
45
- "devDependencies": {
46
- "@rslib/core": "^0.18.2",
47
- "@types/node": "^24.10.1",
48
- "husky": "^9.1.7",
49
- "lint-staged": "^16.2.7",
50
- "typescript": "^5.9.3"
51
- },
52
- "peerDependencies": {
53
- "prettier": "^3.0.0"
54
- },
55
- "publishConfig": {
56
- "access": "public",
57
- "registry": "https://registry.npmjs.com/"
58
- },
59
- "lint-staged": {
60
- "**/*": "prettier --write --ignore-unknown"
2
+ "name": "@1adybug/prettier",
3
+ "version": "0.0.4",
4
+ "description": "推荐的 Prettier 配置",
5
+ "keywords": [
6
+ "prettier",
7
+ "plugin"
8
+ ],
9
+ "author": "1adybug <lurongv@qq.com>",
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/1adybug/prettier.git"
14
+ },
15
+ "homepage": "https://github.com/1adybug/prettier/tree/main/packages/prettier",
16
+ "bugs": {
17
+ "url": "https://github.com/1adybug/prettier/issues"
18
+ },
19
+ "type": "module",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js"
61
24
  }
62
- }
25
+ },
26
+ "main": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "sideEffects": false,
32
+ "publishConfig": {
33
+ "access": "public",
34
+ "registry": "https://registry.npmjs.com/"
35
+ },
36
+ "dependencies": {
37
+ "json5": "^2.2.3",
38
+ "prettier-plugin-tailwindcss": "^0.7.1",
39
+ "@1adybug/prettier-plugin-block-padding": "0.0.11",
40
+ "@1adybug/prettier-plugin-remove-braces": "0.0.4",
41
+ "@1adybug/prettier-plugin-sort-imports": "0.0.18"
42
+ },
43
+ "devDependencies": {
44
+ "@rslib/core": "^0.18.2",
45
+ "@types/node": "^24.10.1",
46
+ "typescript": "^5.9.3"
47
+ },
48
+ "peerDependencies": {
49
+ "prettier": "^3.0.0"
50
+ },
51
+ "scripts": {
52
+ "build": "rslib build",
53
+ "dev": "rslib build --watch"
54
+ }
55
+ }