@1adybug/prettier 0.0.8 → 0.0.10

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.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { PluginConfig } from "@1adybug/prettier-plugin-sort-imports";
1
2
  import { Plugin } from "prettier";
3
+ export declare const config: PluginConfig;
2
4
  export declare const plugin: Plugin<any>;
3
5
  export default plugin;
package/dist/index.js CHANGED
@@ -94,13 +94,13 @@ function getResolvedPathDir(resolvedPath) {
94
94
  }
95
95
  return resolvedPath;
96
96
  }
97
- const src_plugin = createPlugin({
97
+ const config = {
98
98
  getGroup ({ path, filepath }) {
99
99
  if (filepath) src_resolveAlias ??= getResolveAlias(filepath);
100
100
  const type = getModuleType(path);
101
101
  let dir = "";
102
102
  if ("absolute" === type) dir = getResolvedPathDir(src_resolveAlias(path));
103
- if ("relative" === type && !!filepath) dir = getResolvedPathDir(resolve(filepath, path));
103
+ if ("relative" === type && !!filepath) dir = getResolvedPathDir(resolve(filepath, "../", path));
104
104
  const info = {
105
105
  type,
106
106
  dir
@@ -108,11 +108,12 @@ const src_plugin = createPlugin({
108
108
  return JSON.stringify(info);
109
109
  },
110
110
  sortGroup (a, b) {
111
- return Number(a.isSideEffect) - Number(b.isSideEffect) || compareGroupName(a.name, b.name);
111
+ return Number(a.isExport) - Number(b.isExport) || Number(a.isSideEffect) - Number(b.isSideEffect) || compareGroupName(a.name, b.name);
112
112
  },
113
113
  separator: "",
114
114
  sortSideEffect: true,
115
115
  otherPlugins
116
- });
116
+ };
117
+ const src_plugin = createPlugin(config);
117
118
  const src = src_plugin;
118
- export { src as default, src_plugin as plugin };
119
+ export { config, src as default, src_plugin as plugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1adybug/prettier",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
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-block-padding": "0.0.11",
42
- "@1adybug/prettier-plugin-sort-imports": "0.0.19",
43
- "@1adybug/prettier-plugin-remove-braces": "0.0.5"
41
+ "@1adybug/prettier-plugin-remove-braces": "0.0.6",
42
+ "@1adybug/prettier-plugin-sort-imports": "0.0.20",
43
+ "@1adybug/prettier-plugin-block-padding": "0.0.12"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@rslib/core": "^0.18.2",