Comparing version 0.0.4 to 0.1.0
@@ -18,6 +18,12 @@ import { Arrayable } from '@antfu/utils'; | ||
/** | ||
* Rewrite the config object | ||
* Rewrite the config object, | ||
* return nullish value to bypassing loading the file | ||
*/ | ||
rewrite?: <F = any>(obj: F, filepath: string, loader: ConfigLoaderType) => Promise<T | undefined> | T | undefined; | ||
/** | ||
* Transform the source code before loading, | ||
* return nullish value to skip transformation | ||
*/ | ||
transform?: (code: string, filepath: string) => Promise<string | undefined> | string | undefined; | ||
/** | ||
* Skip this source if error occurred on loading | ||
@@ -47,4 +53,5 @@ * | ||
} | ||
interface LoadConfigOptions extends SearchOptions { | ||
sources: Arrayable<LoadConfigSource>; | ||
interface LoadConfigOptions<T = any> extends SearchOptions { | ||
sources: Arrayable<LoadConfigSource<T>>; | ||
defaults?: T; | ||
} | ||
@@ -67,4 +74,4 @@ interface LoadConfigResult<T> { | ||
declare function loadConfig<T>(options: LoadConfigOptions): Promise<LoadConfigResult<T> | undefined>; | ||
declare function loadConfig<T>(options: LoadConfigOptions): Promise<LoadConfigResult<T>>; | ||
export { ConfigLoaderType, LoadConfigOptions, LoadConfigResult, LoadConfigSource, SearchOptions, SourceObjectFieldOptions, SourceVitePluginConfigOptions, defaultExtensions, loadConfig, sourceNuxtConfigFields, sourcePackageJsonFields, sourceViteConfigFields, sourceVitePluginConfig }; |
{ | ||
"name": "unconfig", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"description": "A universal solution for loading configurations.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18222
446