c12 0.2.2 → 0.2.5

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
@@ -130,20 +130,21 @@ async function loadConfig(opts) {
130
130
  Object.assign(configRC, rc9__namespace.read({ name: opts.rcFile, dir: opts.cwd }));
131
131
  }
132
132
  r.config = defu__default(opts.overrides, config, configRC);
133
- const baseLayers = [
134
- opts.overrides && { config: opts.overrides, configFile: void 0, cwd: void 0 },
135
- { config, configFile: opts.configFile, cwd: opts.cwd },
136
- opts.rcFile && { config: configRC, configFile: opts.rcFile }
137
- ].filter((l) => l && l.config && Object.keys(l.config).length);
138
133
  if (opts.extend) {
139
134
  await extendConfig(r.config, opts);
140
- r.layers = [
141
- ...baseLayers,
142
- ...r.config._layers
143
- ];
135
+ r.layers = r.config._layers;
144
136
  delete r.config._layers;
145
137
  r.config = defu__default(r.config, ...r.layers.map((e) => e.config));
146
138
  }
139
+ const baseLayers = [
140
+ opts.overrides && { config: opts.overrides, configFile: void 0, cwd: void 0 },
141
+ { config, configFile: opts.configFile, cwd: opts.cwd },
142
+ opts.rcFile && { config: configRC, configFile: opts.rcFile }
143
+ ].filter((l) => l && l.config);
144
+ r.layers = [
145
+ ...baseLayers,
146
+ ...r.layers
147
+ ];
147
148
  if (opts.defaults) {
148
149
  r.config = defu__default(r.config, opts.defaults);
149
150
  }
package/dist/index.mjs CHANGED
@@ -106,20 +106,21 @@ async function loadConfig(opts) {
106
106
  Object.assign(configRC, rc9.read({ name: opts.rcFile, dir: opts.cwd }));
107
107
  }
108
108
  r.config = defu(opts.overrides, config, configRC);
109
- const baseLayers = [
110
- opts.overrides && { config: opts.overrides, configFile: void 0, cwd: void 0 },
111
- { config, configFile: opts.configFile, cwd: opts.cwd },
112
- opts.rcFile && { config: configRC, configFile: opts.rcFile }
113
- ].filter((l) => l && l.config && Object.keys(l.config).length);
114
109
  if (opts.extend) {
115
110
  await extendConfig(r.config, opts);
116
- r.layers = [
117
- ...baseLayers,
118
- ...r.config._layers
119
- ];
111
+ r.layers = r.config._layers;
120
112
  delete r.config._layers;
121
113
  r.config = defu(r.config, ...r.layers.map((e) => e.config));
122
114
  }
115
+ const baseLayers = [
116
+ opts.overrides && { config: opts.overrides, configFile: void 0, cwd: void 0 },
117
+ { config, configFile: opts.configFile, cwd: opts.cwd },
118
+ opts.rcFile && { config: configRC, configFile: opts.rcFile }
119
+ ].filter((l) => l && l.config);
120
+ r.layers = [
121
+ ...baseLayers,
122
+ ...r.layers
123
+ ];
123
124
  if (opts.defaults) {
124
125
  r.config = defu(r.config, opts.defaults);
125
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c12",
3
- "version": "0.2.2",
3
+ "version": "0.2.5",
4
4
  "description": "Smart Config Loader",
5
5
  "repository": "unjs/c12",
6
6
  "license": "MIT",
@@ -27,13 +27,13 @@
27
27
  "test": "vitest run --coverage"
28
28
  },
29
29
  "dependencies": {
30
- "defu": "^5.0.1",
31
- "dotenv": "^14.3.2",
30
+ "defu": "^6.0.0",
31
+ "dotenv": "^16.0.0",
32
32
  "gittar": "^0.1.1",
33
33
  "jiti": "^1.12.14",
34
- "mlly": "^0.4.1",
34
+ "mlly": "^0.5.1",
35
35
  "pathe": "^0.2.0",
36
- "rc9": "^1.2.0"
36
+ "rc9": "^1.2.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@nuxtjs/eslint-config-typescript": "latest",