c12 0.2.11 → 0.2.12

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/README.md CHANGED
@@ -93,11 +93,15 @@ Loads `.env` file if enabled. It is disabled by default.
93
93
 
94
94
  ### `defaults`
95
95
 
96
- Specify default configuration. It has the **lowest** priority.
96
+ Specify default configuration. It has the **lowest** priority and is applied **after extending** config.
97
+
98
+ ### `defaultConfig`
99
+
100
+ Specify default configuration. It is applied **before** extending config.
97
101
 
98
102
  ### `overides`
99
103
 
100
- Specify override configuration. It has the **highest** priority.
104
+ Specify override configuration. It has the **highest** priority and is applied **before extending** config.
101
105
 
102
106
  ### `jiti`
103
107
 
package/dist/index.cjs CHANGED
@@ -142,7 +142,8 @@ async function loadConfig(opts) {
142
142
  r.config = defu.defu(
143
143
  opts.overrides,
144
144
  config,
145
- configRC
145
+ configRC,
146
+ opts.defaultConfig
146
147
  );
147
148
  if (opts.extend) {
148
149
  await extendConfig(r.config, opts);
package/dist/index.d.ts CHANGED
@@ -59,6 +59,7 @@ interface LoadConfigOptions<T extends InputConfig = InputConfig> {
59
59
  globalRc?: boolean;
60
60
  dotenv?: boolean | DotenvOptions;
61
61
  defaults?: T;
62
+ defaultConfig?: T;
62
63
  overrides?: T;
63
64
  resolve?: (id: string, opts: LoadConfigOptions) => null | ResolvedConfig | Promise<ResolvedConfig | null>;
64
65
  jiti?: JITI;
package/dist/index.mjs CHANGED
@@ -119,7 +119,8 @@ async function loadConfig(opts) {
119
119
  r.config = defu(
120
120
  opts.overrides,
121
121
  config,
122
- configRC
122
+ configRC,
123
+ opts.defaultConfig
123
124
  );
124
125
  if (opts.extend) {
125
126
  await extendConfig(r.config, opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c12",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Smart Config Loader",
5
5
  "repository": "unjs/c12",
6
6
  "license": "MIT",