@metajoy/config 1.0.2 → 1.0.3
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-asImb96q.d.mts +45 -0
- package/dist/index.d.mts +2670 -106
- package/dist/index.mjs +69 -71
- package/dist/utils/index.d.mts +2 -0
- package/dist/utils/index.mjs +80 -0
- package/package.json +9 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ConfigWatcher, InputConfig, LoadConfigOptions, ResolvedConfig, WatchConfigOptions } from "c12";
|
|
2
|
+
import { DownloadTemplateOptions } from "giget";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/config.d.ts
|
|
5
|
+
interface ApiConfig {
|
|
6
|
+
/**
|
|
7
|
+
* 接口基础地址
|
|
8
|
+
* @example "https://api.example.com"
|
|
9
|
+
*/
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
/**
|
|
12
|
+
* 接口文档路径
|
|
13
|
+
* @default "/swagger/doc.json"
|
|
14
|
+
*/
|
|
15
|
+
docPath?: string;
|
|
16
|
+
/**
|
|
17
|
+
* 接口覆盖配置
|
|
18
|
+
* @example { "users": "https://users.example.com", "posts": "https://posts.example.com" }
|
|
19
|
+
*/
|
|
20
|
+
overrides?: Record<string, string | Pick<ApiConfig, "baseUrl" | "docPath">>;
|
|
21
|
+
}
|
|
22
|
+
interface MetajoyConfig {
|
|
23
|
+
/**
|
|
24
|
+
* 接口配置
|
|
25
|
+
*/
|
|
26
|
+
api?: ApiConfig;
|
|
27
|
+
}
|
|
28
|
+
declare const _defaults: {
|
|
29
|
+
api: {};
|
|
30
|
+
};
|
|
31
|
+
type MetajoyConfigDefaults = typeof _defaults;
|
|
32
|
+
type MetajoyConfigWithDefaults = MetajoyConfig & MetajoyConfigDefaults;
|
|
33
|
+
declare function defineConfig(config: InputConfig<MetajoyConfig> & {
|
|
34
|
+
extends?: string | (string | [string, DownloadTemplateOptions])[];
|
|
35
|
+
}): import("c12").C12InputConfig<MetajoyConfig, import("c12").ConfigLayerMeta> & MetajoyConfig & {
|
|
36
|
+
extends?: string | (string | [string, DownloadTemplateOptions])[];
|
|
37
|
+
};
|
|
38
|
+
declare function loadConfig$1(options?: LoadConfigOptions<MetajoyConfig>): Promise<ResolvedConfig<MetajoyConfigWithDefaults, import("c12").ConfigLayerMeta>>;
|
|
39
|
+
declare function watchConfig$1(options?: WatchConfigOptions<MetajoyConfig>): Promise<ConfigWatcher<MetajoyConfigWithDefaults>>;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/utils/env.d.ts
|
|
42
|
+
declare function getEnvFilesForMode(mode?: string, envDir?: string | false): string[];
|
|
43
|
+
declare function loadEnv(mode?: string, envDir?: string | false, prefixes?: string | string[]): Record<string, string>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { MetajoyConfigDefaults as a, loadConfig$1 as c, MetajoyConfig as i, watchConfig$1 as l, loadEnv as n, MetajoyConfigWithDefaults as o, ApiConfig as r, defineConfig as s, getEnvFilesForMode as t };
|