c12 0.2.3 → 0.2.6
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 +13 -11
- package/dist/index.mjs +13 -11
- package/package.json +5 -5
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);
|
|
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
|
}
|
|
@@ -204,9 +205,10 @@ async function resolveConfig(source, opts) {
|
|
|
204
205
|
res.config = await res.config();
|
|
205
206
|
}
|
|
206
207
|
} catch (err) {
|
|
207
|
-
if (err.code
|
|
208
|
-
|
|
208
|
+
if (err.code === "MODULE_NOT_FOUND" && String(err).includes(opts.configFile)) {
|
|
209
|
+
return res;
|
|
209
210
|
}
|
|
211
|
+
throw err;
|
|
210
212
|
}
|
|
211
213
|
return res;
|
|
212
214
|
}
|
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);
|
|
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
|
}
|
|
@@ -180,9 +181,10 @@ async function resolveConfig(source, opts) {
|
|
|
180
181
|
res.config = await res.config();
|
|
181
182
|
}
|
|
182
183
|
} catch (err) {
|
|
183
|
-
if (err.code
|
|
184
|
-
|
|
184
|
+
if (err.code === "MODULE_NOT_FOUND" && String(err).includes(opts.configFile)) {
|
|
185
|
+
return res;
|
|
185
186
|
}
|
|
187
|
+
throw err;
|
|
186
188
|
}
|
|
187
189
|
return res;
|
|
188
190
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c12",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Smart Config Loader",
|
|
5
5
|
"repository": "unjs/c12",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"defu": "^
|
|
23
|
-
"dotenv": "^
|
|
22
|
+
"defu": "^6.0.0",
|
|
23
|
+
"dotenv": "^16.0.0",
|
|
24
24
|
"gittar": "^0.1.1",
|
|
25
25
|
"jiti": "^1.12.14",
|
|
26
|
-
"mlly": "^0.
|
|
26
|
+
"mlly": "^0.5.1",
|
|
27
27
|
"pathe": "^0.2.0",
|
|
28
|
-
"rc9": "^1.2.
|
|
28
|
+
"rc9": "^1.2.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@nuxtjs/eslint-config-typescript": "latest",
|