@alint-js/config 0.0.4 → 0.0.6
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 +4 -4
- package/dist/index.mjs +8 -10
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AlintConfig, AlintConfig as AlintConfig$1, ModelSize, ProviderDefinition, ProviderType, RunnerConfig, SetupConfig, SetupConfig as SetupConfig$1, SetupModelDefinition } from "@alint-js/core";
|
|
2
2
|
|
|
3
|
-
//#region src/load
|
|
3
|
+
//#region src/config/load.d.ts
|
|
4
4
|
declare function loadAlintConfig(cwd: string, configFile?: string): Promise<AlintConfig$1>;
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/paths.d.ts
|
|
@@ -11,16 +11,16 @@ interface GlobalSetupConfigPathOptions {
|
|
|
11
11
|
declare function getGlobalSetupConfigPath(env?: NodeJS.ProcessEnv, options?: GlobalSetupConfigPathOptions): string;
|
|
12
12
|
declare function getProjectSetupConfigPath(cwd: string): string;
|
|
13
13
|
//#endregion
|
|
14
|
-
//#region src/setup
|
|
14
|
+
//#region src/setup/load.d.ts
|
|
15
15
|
declare const emptySetupConfig: SetupConfig$1;
|
|
16
16
|
declare function loadSetupConfig(filePath: string): Promise<SetupConfig$1>;
|
|
17
17
|
declare function mergeSetupConfigs(...configs: SetupConfig$1[]): SetupConfig$1;
|
|
18
18
|
//#endregion
|
|
19
|
-
//#region src/setup
|
|
19
|
+
//#region src/setup/toml.d.ts
|
|
20
20
|
declare function parseSetupConfigToml(toml: string): SetupConfig$1;
|
|
21
21
|
declare function stringifySetupConfigToml(config: SetupConfig$1): string;
|
|
22
22
|
//#endregion
|
|
23
|
-
//#region src/setup
|
|
23
|
+
//#region src/setup/write.d.ts
|
|
24
24
|
declare function writeSetupConfig(filePath: string, config: SetupConfig$1): Promise<void>;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { type AlintConfig, type GlobalSetupConfigPathOptions, type ModelSize, type ProviderDefinition, type ProviderType, type RunnerConfig, type SetupConfig, type SetupModelDefinition, emptySetupConfig, getGlobalSetupConfigPath, getProjectSetupConfigPath, loadAlintConfig, loadSetupConfig, mergeSetupConfigs, parseSetupConfigToml, stringifySetupConfigToml, writeSetupConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -5,18 +5,16 @@ import { dirname, join } from "pathe";
|
|
|
5
5
|
import { xdgConfig } from "xdg-basedir";
|
|
6
6
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
7
7
|
import { parse, stringify } from "smol-toml";
|
|
8
|
-
//#region src/load
|
|
8
|
+
//#region src/config/load.ts
|
|
9
9
|
async function loadAlintConfig(cwd, configFile) {
|
|
10
|
-
|
|
10
|
+
const result = await loadConfig({
|
|
11
11
|
configFile,
|
|
12
12
|
cwd,
|
|
13
|
-
defaults: {
|
|
14
|
-
plugins: [],
|
|
15
|
-
rules: {}
|
|
16
|
-
},
|
|
17
13
|
dotenv: true,
|
|
18
14
|
name: "alint"
|
|
19
|
-
})
|
|
15
|
+
});
|
|
16
|
+
if (result._configFile === void 0) return [];
|
|
17
|
+
return result.config ?? [];
|
|
20
18
|
}
|
|
21
19
|
//#endregion
|
|
22
20
|
//#region src/paths.ts
|
|
@@ -31,7 +29,7 @@ function resolveDefaultConfigHome(options) {
|
|
|
31
29
|
return options.xdgConfig ?? xdgConfig ?? join(homedir(), ".config");
|
|
32
30
|
}
|
|
33
31
|
//#endregion
|
|
34
|
-
//#region src/setup
|
|
32
|
+
//#region src/setup/toml.ts
|
|
35
33
|
const modelSizes = /* @__PURE__ */ new Set([
|
|
36
34
|
"large",
|
|
37
35
|
"medium",
|
|
@@ -172,7 +170,7 @@ function toTomlRunnerCache(cache) {
|
|
|
172
170
|
return cache;
|
|
173
171
|
}
|
|
174
172
|
//#endregion
|
|
175
|
-
//#region src/setup
|
|
173
|
+
//#region src/setup/load.ts
|
|
176
174
|
const emptySetupConfig = {
|
|
177
175
|
providers: [],
|
|
178
176
|
version: 1
|
|
@@ -273,7 +271,7 @@ function prioritizeProviders(providers, prioritizedProviders) {
|
|
|
273
271
|
return [...prioritizedProviders, ...providers.filter((provider) => !prioritizedProviderIds.has(provider.id))];
|
|
274
272
|
}
|
|
275
273
|
//#endregion
|
|
276
|
-
//#region src/setup
|
|
274
|
+
//#region src/setup/write.ts
|
|
277
275
|
async function writeSetupConfig(filePath, config) {
|
|
278
276
|
await mkdir(dirname(filePath), { recursive: true });
|
|
279
277
|
await writeFile(filePath, stringifySetupConfigToml(config), "utf8");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alint-js/config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.6",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.mts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"pathe": "^2.0.3",
|
|
18
18
|
"smol-toml": "^1.7.0",
|
|
19
19
|
"xdg-basedir": "^5.1.0",
|
|
20
|
-
"@alint-js/core": "0.0.
|
|
20
|
+
"@alint-js/core": "0.0.6"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^26.0.1",
|