load-oxfmt-config 0.1.0 → 0.1.1
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.mts +29 -3
- package/dist/index.mjs +2 -2
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import { FormatOptions } from "oxfmt";
|
|
2
2
|
|
|
3
3
|
//#region src/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Format option override for a single matching rule
|
|
6
|
+
*/
|
|
7
|
+
interface FormatOptionOverride {
|
|
8
|
+
/**
|
|
9
|
+
* Glob patterns to match files
|
|
10
|
+
*/
|
|
11
|
+
files: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Glob patterns to exclude files
|
|
14
|
+
*/
|
|
15
|
+
excludeFiles?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Format options to apply
|
|
18
|
+
*/
|
|
19
|
+
options?: FormatOptions;
|
|
20
|
+
}
|
|
4
21
|
interface Options {
|
|
5
22
|
/**
|
|
6
23
|
* Path to the configuration file
|
|
@@ -15,6 +32,15 @@ interface Options {
|
|
|
15
32
|
*/
|
|
16
33
|
useCache?: boolean;
|
|
17
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Final oxfmt options (including overrides)
|
|
37
|
+
*/
|
|
38
|
+
interface OxfmtOptions extends FormatOptions {
|
|
39
|
+
/**
|
|
40
|
+
* Array of format option overrides
|
|
41
|
+
*/
|
|
42
|
+
overrides?: FormatOptionOverride[];
|
|
43
|
+
}
|
|
18
44
|
//#endregion
|
|
19
45
|
//#region src/core.d.ts
|
|
20
46
|
/**
|
|
@@ -22,7 +48,7 @@ interface Options {
|
|
|
22
48
|
* Caching is enabled by default; pass `useCache: false` to force a re-read.
|
|
23
49
|
*
|
|
24
50
|
* @param options - Optional loader settings (cwd, configPath, useCache).
|
|
25
|
-
* @returns Parsed oxfmt
|
|
51
|
+
* @returns Parsed oxfmt OxfmtOptions or an empty object when missing.
|
|
26
52
|
* @throws {Error} when the config file exists but cannot be parsed.
|
|
27
53
|
*
|
|
28
54
|
* @example
|
|
@@ -30,7 +56,7 @@ interface Options {
|
|
|
30
56
|
* const config = await loadOxfmtConfig({ cwd: '/project' })
|
|
31
57
|
* ```
|
|
32
58
|
*/
|
|
33
|
-
declare function loadOxfmtConfig(options?: Options): Promise<
|
|
59
|
+
declare function loadOxfmtConfig(options?: Options): Promise<OxfmtOptions>;
|
|
34
60
|
/**
|
|
35
61
|
* Resolve the oxfmt config file path.
|
|
36
62
|
* - If `configPath` is provided, absolute paths are returned as-is; relative paths are joined to cwd.
|
|
@@ -42,4 +68,4 @@ declare function loadOxfmtConfig(options?: Options): Promise<FormatOptions>;
|
|
|
42
68
|
*/
|
|
43
69
|
declare function resolveOxfmtrcPath(cwd: string, configPath?: string): Promise<string | undefined>;
|
|
44
70
|
//#endregion
|
|
45
|
-
export { Options, loadOxfmtConfig, resolveOxfmtrcPath };
|
|
71
|
+
export { FormatOptionOverride, Options, OxfmtOptions, loadOxfmtConfig, resolveOxfmtrcPath };
|
package/dist/index.mjs
CHANGED
|
@@ -19,7 +19,7 @@ const configCache = /* @__PURE__ */ new Map();
|
|
|
19
19
|
* Caching is enabled by default; pass `useCache: false` to force a re-read.
|
|
20
20
|
*
|
|
21
21
|
* @param options - Optional loader settings (cwd, configPath, useCache).
|
|
22
|
-
* @returns Parsed oxfmt
|
|
22
|
+
* @returns Parsed oxfmt OxfmtOptions or an empty object when missing.
|
|
23
23
|
* @throws {Error} when the config file exists but cannot be parsed.
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
@@ -108,7 +108,7 @@ function getResolveCacheKey(cwd, configPath) {
|
|
|
108
108
|
* Read and parse config file, supporting JSON and JSONC.
|
|
109
109
|
*
|
|
110
110
|
* @param resolvedPath - Absolute path to the config file.
|
|
111
|
-
* @returns Parsed
|
|
111
|
+
* @returns Parsed OxfmtOptions object.
|
|
112
112
|
*/
|
|
113
113
|
async function readConfigFromFile(resolvedPath) {
|
|
114
114
|
const content = await readFile(resolvedPath, "utf-8");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "load-oxfmt-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "Load .oxfmtrc.json(c) for oxfmt.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"jsonc-parser",
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
"jsonc-parser": "^3.3.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@ntnyq/eslint-config": "^6.0.0-beta.
|
|
47
|
+
"@ntnyq/eslint-config": "^6.0.0-beta.7",
|
|
48
48
|
"@ntnyq/tsconfig": "^3.1.0",
|
|
49
|
-
"@types/node": "^25.2.
|
|
50
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
51
|
-
"bumpp": "^10.4.
|
|
52
|
-
"eslint": "^
|
|
49
|
+
"@types/node": "^25.2.2",
|
|
50
|
+
"@typescript/native-preview": "^7.0.0-dev.20260208.1",
|
|
51
|
+
"bumpp": "^10.4.1",
|
|
52
|
+
"eslint": "^10.0.0",
|
|
53
53
|
"husky": "^9.1.7",
|
|
54
54
|
"nano-staged": "^0.9.0",
|
|
55
55
|
"npm-run-all2": "^8.0.4",
|
|
56
56
|
"oxfmt": "^0.28.0",
|
|
57
|
-
"tsdown": "^0.20.
|
|
57
|
+
"tsdown": "^0.20.3",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
59
|
"vitest": "^4.0.18"
|
|
60
60
|
},
|