c12 0.2.9 → 0.2.10

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.cjs CHANGED
@@ -162,9 +162,15 @@ async function extendConfig(config, opts) {
162
162
  if (!opts.extend) {
163
163
  return;
164
164
  }
165
- const key = opts.extend.extendKey;
166
- const extendSources = (Array.isArray(config[key]) ? config[key] : [config[key]]).filter(Boolean);
167
- delete config[key];
165
+ let keys = opts.extend.extendKey;
166
+ if (typeof keys === "string") {
167
+ keys = [keys];
168
+ }
169
+ const extendSources = [];
170
+ for (const key of keys) {
171
+ extendSources.push(...(Array.isArray(config[key]) ? config[key] : [config[key]]).filter(Boolean));
172
+ delete config[key];
173
+ }
168
174
  for (const extendSource of extendSources) {
169
175
  const _config = await resolveConfig(extendSource, opts);
170
176
  if (!_config.config) {
package/dist/index.d.ts CHANGED
@@ -59,7 +59,7 @@ interface LoadConfigOptions<T extends InputConfig = InputConfig> {
59
59
  overrides?: T;
60
60
  resolve?: (id: string, opts: LoadConfigOptions) => null | ResolvedConfig | Promise<ResolvedConfig | null>;
61
61
  extend?: false | {
62
- extendKey?: string;
62
+ extendKey?: string | string[];
63
63
  };
64
64
  }
65
65
  declare function loadConfig<T extends InputConfig = InputConfig>(opts: LoadConfigOptions<T>): Promise<ResolvedConfig<T>>;
package/dist/index.mjs CHANGED
@@ -138,9 +138,15 @@ async function extendConfig(config, opts) {
138
138
  if (!opts.extend) {
139
139
  return;
140
140
  }
141
- const key = opts.extend.extendKey;
142
- const extendSources = (Array.isArray(config[key]) ? config[key] : [config[key]]).filter(Boolean);
143
- delete config[key];
141
+ let keys = opts.extend.extendKey;
142
+ if (typeof keys === "string") {
143
+ keys = [keys];
144
+ }
145
+ const extendSources = [];
146
+ for (const key of keys) {
147
+ extendSources.push(...(Array.isArray(config[key]) ? config[key] : [config[key]]).filter(Boolean));
148
+ delete config[key];
149
+ }
144
150
  for (const extendSource of extendSources) {
145
151
  const _config = await resolveConfig(extendSource, opts);
146
152
  if (!_config.config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c12",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Smart Config Loader",
5
5
  "repository": "unjs/c12",
6
6
  "license": "MIT",
@@ -23,8 +23,8 @@
23
23
  "dotenv": "^16.0.1",
24
24
  "gittar": "^0.1.1",
25
25
  "jiti": "^1.14.0",
26
- "mlly": "^0.5.7",
27
- "pathe": "^0.3.3",
26
+ "mlly": "^0.5.11",
27
+ "pathe": "^0.3.4",
28
28
  "rc9": "^1.2.2"
29
29
  },
30
30
  "devDependencies": {
@@ -36,7 +36,7 @@
36
36
  "unbuild": "latest",
37
37
  "vitest": "latest"
38
38
  },
39
- "packageManager": "pnpm@7.8.0",
39
+ "packageManager": "pnpm@7.9.0",
40
40
  "scripts": {
41
41
  "build": "unbuild",
42
42
  "dev": "vitest dev",