load-oxfmt-config 0.0.0 → 0.0.2

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 (3) hide show
  1. package/README.md +24 -4
  2. package/dist/index.d.mts +4 -140
  3. package/package.json +19 -18
package/README.md CHANGED
@@ -26,7 +26,7 @@ pnpm add load-oxfmt-config
26
26
  ```ts
27
27
  import { loadOxfmtConfig } from 'load-oxfmt-config'
28
28
 
29
- const config = loadOxfmtConfig({
29
+ const config = await loadOxfmtConfig({
30
30
  cwd: '/configs',
31
31
  })
32
32
 
@@ -35,9 +35,29 @@ console.log({ config })
35
35
 
36
36
  ## Options
37
37
 
38
- - `configPath?: string` Path to the oxfmt config file, resolved relative to `cwd`.
39
- - `cwd?: string` Current working directory used when searching for config files. Defaults to `process.cwd()`.
40
- - `useCache?: boolean` Enable in-memory caching for path resolution and parsed config contents. Defaults to `true`.
38
+ ### configPath
39
+
40
+ **Type**: `string`\
41
+ **Required**: `false`\
42
+ **Default**: `undefined`
43
+
44
+ Path to the oxfmt config file, resolved relative to `cwd`.
45
+
46
+ ### cwd
47
+
48
+ **Type**: `string`\
49
+ **Required**: `false`\
50
+ **Default**: `process.cwd()`
51
+
52
+ Current working directory used when searching for config files.
53
+
54
+ ### useCache
55
+
56
+ **Type**: `boolean`\
57
+ **Required**: `false`\
58
+ **Default**: `true`
59
+
60
+ Enable in-memory caching for path resolution and parsed config contents.
41
61
 
42
62
  ## License
43
63
 
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import { FormatOptions } from "oxfmt";
2
+
1
3
  //#region src/types.d.ts
2
4
  interface Options {
3
5
  /**
@@ -13,154 +15,16 @@ interface Options {
13
15
  */
14
16
  useCache?: boolean;
15
17
  }
16
- /**
17
- * Oxfmt configuration interface
18
- */
19
- interface OxfmtConfig {
20
- /**
21
- * Include parentheses around a sole arrow function parameter.
22
- * @default `always`
23
- */
24
- arrowParens?: 'always' | 'avoid';
25
- /**
26
- * Put the `>` of a multi-line JSX element at the end of the last line\ninstead of being alone on the next line.
27
- * @default false
28
- */
29
- bracketSameLine?: boolean;
30
- /**
31
- * Print spaces between brackets in object literals.
32
- * @default true
33
- */
34
- bracketSpacing?: boolean;
35
- /**
36
- * Control whether to format embedded parts in the file.
37
- * @default `off`
38
- */
39
- embeddedLanguageFormatting?: 'auto' | 'off';
40
- /**
41
- * Which end of line characters to apply.
42
- * @default `lf`
43
- */
44
- endOfLine?: 'cr' | 'crlf' | 'lf';
45
- /**
46
- * Experimental: Sort `package.json` keys.
47
- * @default true
48
- */
49
- experimentalSortPackageJson?: boolean;
50
- /**
51
- * Ignore files matching these glob patterns. Current working directory is used as the root.
52
- */
53
- ignorePatterns?: string[];
54
- /**
55
- * Whether to insert a final newline at the end of the file.
56
- * @default true
57
- */
58
- insertFinalNewline?: boolean;
59
- /**
60
- * Use single quotes instead of double quotes in JSX.
61
- * @default false
62
- */
63
- jsxSingleQuote?: boolean;
64
- /**
65
- * How to wrap object literals when they could fit on one line or span multiple lines.
66
- * @default `preserve`
67
- * NOTE: In addition to Prettier's `preserve` and `collapse`, we also support `always`
68
- */
69
- objectWrap?: 'always' | 'never' | 'preserve';
70
- /**
71
- * The line length that the printer will wrap on.
72
- * @default 100
73
- */
74
- printWidth?: number;
75
- /**
76
- * Change when properties in objects are quoted.
77
- * @default `as-needed`
78
- */
79
- quoteProps?: 'as-needed' | 'consistent' | 'preserve';
80
- /**
81
- * Print semicolons at the ends of statements.
82
- * @default true
83
- */
84
- semi?: boolean;
85
- /**
86
- * Put each attribute on a new line in JSX.
87
- * @default false
88
- */
89
- singleAttributePerLine?: boolean;
90
- /**
91
- * Use single quotes instead of double quotes.
92
- * @default false
93
- */
94
- singleQuote?: boolean;
95
- /**
96
- * Number of spaces per indentation level.
97
- * @default 2
98
- */
99
- tabWidth?: number;
100
- /**
101
- * Print trailing commas wherever possible.
102
- * @default `all`
103
- */
104
- trailingComma?: 'all' | 'es5' | 'none';
105
- /**
106
- * Use tabs for indentation or spaces.
107
- * @default false
108
- */
109
- useTabs?: boolean;
110
- /**
111
- * Experimental: Sort import statements. Disabled by default.
112
- */
113
- experimentalSortImports?: {
114
- /**
115
- * Custom groups configuration for organizing imports.\nEach array element represents a group, and multiple group names in the same array are treated as one.\nAccepts both `string` and `string[]` as group elements.
116
- */
117
- groups?: Array<string | string[]>;
118
- /**
119
- * Ignore case when sorting.
120
- * @default true
121
- */
122
- ignoreCase?: boolean;
123
- /**
124
- * Glob patterns to identify internal imports.
125
- */
126
- internalPattern?: string[];
127
- /**
128
- * Add newlines between import groups.
129
- * @default true
130
- */
131
- newlinesBetween?: boolean;
132
- /**
133
- * Sort order. (Default: `asc`)
134
- * @default `asc`
135
- */
136
- order?: 'asc' | 'desc';
137
- /**
138
- * Partition imports by comments.
139
- * @default false
140
- */
141
- partitionByComment?: boolean;
142
- /**
143
- * Partition imports by newlines.
144
- * @default false
145
- */
146
- partitionByNewline?: boolean;
147
- /**
148
- * Sort side-effect imports.
149
- * @default false
150
- */
151
- sortSideEffects?: boolean;
152
- };
153
- }
154
18
  //#endregion
155
19
  //#region src/core.d.ts
156
20
  /**
157
21
  * Load oxfmt configuration by resolving the config file path and parsing its contents.
158
22
  * Uses in-memory caches by default; set `useCache` to false to force re-read.
159
23
  */
160
- declare function loadOxfmtConfig(options?: Options): Promise<OxfmtConfig>;
24
+ declare function loadOxfmtConfig(options?: Options): Promise<FormatOptions>;
161
25
  /**
162
26
  * Resolve the oxfmt config file path, searching upward from the provided cwd when no explicit path is given.
163
27
  */
164
28
  declare function resolveOxfmtrcPath(cwd: string, configPath?: string): Promise<string | undefined>;
165
29
  //#endregion
166
- export { Options, OxfmtConfig, loadOxfmtConfig, resolveOxfmtrcPath };
30
+ export { Options, loadOxfmtConfig, resolveOxfmtrcPath };
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "load-oxfmt-config",
3
3
  "type": "module",
4
- "version": "0.0.0",
5
- "packageManager": "pnpm@10.26.1",
4
+ "version": "0.0.2",
6
5
  "description": "Load .oxfmtrc.json(c) for oxfmt.",
7
6
  "keywords": [
8
7
  "jsonc-parser",
@@ -25,12 +24,12 @@
25
24
  "exports": {
26
25
  "./package.json": "./package.json",
27
26
  ".": {
28
- "types": "./dist/index.d.ts",
29
- "default": "./dist/index.js"
27
+ "types": "./dist/index.d.mts",
28
+ "default": "./dist/index.mjs"
30
29
  }
31
30
  },
32
- "main": "./dist/index.js",
33
- "types": "./dist/index.d.ts",
31
+ "main": "./dist/index.mjs",
32
+ "types": "./dist/index.d.mts",
34
33
  "files": [
35
34
  "dist"
36
35
  ],
@@ -38,17 +37,8 @@
38
37
  "access": "public"
39
38
  },
40
39
  "sideEffects": false,
41
- "scripts": {
42
- "build": "tsdown",
43
- "dev": "tsdown --watch",
44
- "lint": "eslint",
45
- "prepare": "husky",
46
- "prepublishOnly": "pnpm run build",
47
- "release": "run-s release:check release:version",
48
- "release:check": "run-s lint typecheck test",
49
- "release:version": "bumpp",
50
- "test": "vitest",
51
- "typecheck": "tsc --noEmit"
40
+ "peerDependencies": {
41
+ "oxfmt": "^0.20.0"
52
42
  },
53
43
  "dependencies": {
54
44
  "jsonc-parser": "^3.3.1"
@@ -63,6 +53,7 @@
63
53
  "husky": "^9.1.7",
64
54
  "nano-staged": "^0.9.0",
65
55
  "npm-run-all2": "^8.0.4",
56
+ "oxfmt": "^0.20.0",
66
57
  "prettier": "^3.7.4",
67
58
  "tsdown": "^0.18.2",
68
59
  "typescript": "^5.9.3",
@@ -71,5 +62,15 @@
71
62
  "nano-staged": {
72
63
  "*.{js,ts,mjs,cjs,md,vue,yml,yaml,toml,json}": "eslint --fix",
73
64
  "*.{css,scss,html}": "prettier -uw"
65
+ },
66
+ "scripts": {
67
+ "build": "tsdown",
68
+ "dev": "tsdown --watch",
69
+ "lint": "eslint",
70
+ "release": "run-s release:check release:version",
71
+ "release:check": "run-s lint typecheck test",
72
+ "release:version": "bumpp",
73
+ "test": "vitest",
74
+ "typecheck": "tsc --noEmit"
74
75
  }
75
- }
76
+ }