Skip to content

Releases: jaywcjlove/auto-config-loader

v2.0.2

11 Dec 08:00
Compare
Choose a tag to compare

v2.0.1

11 Dec 07:54
Compare
Choose a tag to compare

v2.0.0

11 Dec 07:46
Compare
Choose a tag to compare

Buy me a coffee

Documentation v2.0.0: https://raw.githack.com/jaywcjlove/auto-config-loader/790defe/index.html

v1.7.8...v2.0.0

  1. test: update test case. @jaywcjlove
  2. fix: ensure consistent handling of default exports across platforms. @jaywcjlove
  3. fix: ensure consistent handling of default exports across platforms. @jaywcjlove
  4. fix(deps): update dependency jiti to v2 #13 @jaywcjlove

V1 To V2 Migration

This guide provides the steps to migrate to the latest version of the configuration loader API.

Key Changes

  1. Loader Functions Support Async

    • LoaderFunc<T> now supports returning T or Promise<T>.
    • Update custom loaders to handle asynchronous operations if needed.

    Example:

    export type LoaderFunc<T> = (
      filepath: string,
      content: string,
      jsOption?: LoadConfOption
    ) => T | Promise<T>;
  2. autoConf Returns a Promise

    • The autoConf function now returns a Promise instead of a synchronous result.
    • Update your code to handle asynchronous calls.

    Example:

    export declare function autoConf<T>(
      namespace?: string,
      option?: AutoConfOption<T>
    ): Promise<{} & T>;

Migration Steps

1. Update Custom Loader Functions

If you have custom loaders, update their return types to support asynchronous operations:

Example:

const jsonLoader: LoaderFunc<MyConfig> = async (
  filepath, content
) => JSON.parse(content);

2. Handle Asynchronous autoConf Calls

Update all calls to autoConf to use await or .then to handle Promises:

Example Using await:

const config = await autoConf('myNamespace', options);
console.log(config);

Example Using .then:

autoConf('myNamespace', options).then(config => {
  console.log(config);
});

v1.7.8

21 Nov 02:50
Compare
Choose a tag to compare

v1.7.7

16 Mar 17:48
Compare
Choose a tag to compare

v1.7.6

27 Nov 00:41
Compare
Choose a tag to compare

v1.7.5

08 Nov 09:06
Compare
Choose a tag to compare

Documentation v1.7.5: https://raw.githack.com/jaywcjlove/auto-config-loader/8ada4f2/index.html

v1.7.4...v1.7.5

v1.7.4

10 Jun 05:54
Compare
Choose a tag to compare

v1.7.3

10 Jun 05:11
Compare
Choose a tag to compare

Documentation v1.7.3: https://raw.githack.com/jaywcjlove/auto-config-loader/f2e2e6f/index.html

v1.7.2...v1.7.3

v1.7.2

10 Jun 04:42
Compare
Choose a tag to compare

Documentation v1.7.2: https://raw.githack.com/jaywcjlove/auto-config-loader/cf3fb70/index.html

v1.7.1...v1.7.2