c12 2.0.0 → 2.0.2
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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<!-- automd:badges color=yellow codecov -->
|
|
4
4
|
|
|
5
5
|
[](https://npmjs.com/package/c12)
|
|
6
|
-
[](https://
|
|
6
|
+
[](https://npm.chart.dev/c12)
|
|
7
7
|
[](https://codecov.io/gh/unjs/c12)
|
|
8
8
|
|
|
9
9
|
<!-- /automd -->
|
|
@@ -33,6 +33,7 @@ c12 (pronounced as /siːtwelv/, like c-twelve) is a smart configuration loader.
|
|
|
33
33
|
- [Changelogen](https://changelogen.unjs.io)
|
|
34
34
|
- [RemixKit](https://github.com/jrestall/remix-kit)
|
|
35
35
|
- [Hey API](https://github.com/hey-api/openapi-ts)
|
|
36
|
+
- [kysely-ctl](https://github.com/kysely-org/kysely-ctl)
|
|
36
37
|
|
|
37
38
|
## Usage
|
|
38
39
|
|
|
@@ -55,6 +56,9 @@ pnpm install c12
|
|
|
55
56
|
|
|
56
57
|
# bun
|
|
57
58
|
bun install c12
|
|
59
|
+
|
|
60
|
+
# deno
|
|
61
|
+
deno install c12
|
|
58
62
|
```
|
|
59
63
|
|
|
60
64
|
<!-- /automd -->
|
|
@@ -63,7 +67,7 @@ Import:
|
|
|
63
67
|
|
|
64
68
|
<!-- automd:jsimport cjs imports="loadConfig,watchConfig" -->
|
|
65
69
|
|
|
66
|
-
**ESM** (Node.js, Bun)
|
|
70
|
+
**ESM** (Node.js, Bun, Deno)
|
|
67
71
|
|
|
68
72
|
```js
|
|
69
73
|
import { loadConfig, watchConfig } from "c12";
|
|
@@ -404,6 +408,9 @@ pnpm install -D magicast
|
|
|
404
408
|
|
|
405
409
|
# bun
|
|
406
410
|
bun install -D magicast
|
|
411
|
+
|
|
412
|
+
# deno
|
|
413
|
+
deno install --dev magicast
|
|
407
414
|
```
|
|
408
415
|
|
|
409
416
|
<!-- /automd -->
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as loadConfig, S as SUPPORTED_EXTENSIONS } from './shared/c12.
|
|
2
|
-
export { a as loadDotenv, s as setupDotenv } from './shared/c12.
|
|
1
|
+
import { l as loadConfig, S as SUPPORTED_EXTENSIONS } from './shared/c12.UwygHULp.mjs';
|
|
2
|
+
export { a as loadDotenv, s as setupDotenv } from './shared/c12.UwygHULp.mjs';
|
|
3
3
|
import { debounce } from 'perfect-debounce';
|
|
4
4
|
import { resolve } from 'pathe';
|
|
5
5
|
import { diff } from 'ohash';
|
|
@@ -166,6 +166,9 @@ async function loadConfig(options) {
|
|
|
166
166
|
_configs.main = _mainConfig.config;
|
|
167
167
|
r.configFile = _mainConfig.configFile;
|
|
168
168
|
}
|
|
169
|
+
if (_mainConfig.meta) {
|
|
170
|
+
r.meta = _mainConfig.meta;
|
|
171
|
+
}
|
|
169
172
|
if (options.rcFile) {
|
|
170
173
|
const rcSources = [];
|
|
171
174
|
rcSources.push(rc9__namespace.read({ name: options.rcFile, dir: options.cwd }));
|
|
@@ -357,7 +360,9 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
357
360
|
const contents = await promises.readFile(res.configFile, "utf8");
|
|
358
361
|
res.config = asyncLoader(contents);
|
|
359
362
|
} else {
|
|
360
|
-
res.config = await options.jiti.import(res.configFile
|
|
363
|
+
res.config = await options.jiti.import(res.configFile, {
|
|
364
|
+
default: true
|
|
365
|
+
});
|
|
361
366
|
}
|
|
362
367
|
if (res.config instanceof Function) {
|
|
363
368
|
res.config = await res.config();
|
|
@@ -149,6 +149,9 @@ async function loadConfig(options) {
|
|
|
149
149
|
_configs.main = _mainConfig.config;
|
|
150
150
|
r.configFile = _mainConfig.configFile;
|
|
151
151
|
}
|
|
152
|
+
if (_mainConfig.meta) {
|
|
153
|
+
r.meta = _mainConfig.meta;
|
|
154
|
+
}
|
|
152
155
|
if (options.rcFile) {
|
|
153
156
|
const rcSources = [];
|
|
154
157
|
rcSources.push(rc9.read({ name: options.rcFile, dir: options.cwd }));
|
|
@@ -340,7 +343,9 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
340
343
|
const contents = await readFile(res.configFile, "utf8");
|
|
341
344
|
res.config = asyncLoader(contents);
|
|
342
345
|
} else {
|
|
343
|
-
res.config = await options.jiti.import(res.configFile
|
|
346
|
+
res.config = await options.jiti.import(res.configFile, {
|
|
347
|
+
default: true
|
|
348
|
+
});
|
|
344
349
|
}
|
|
345
350
|
if (res.config instanceof Function) {
|
|
346
351
|
res.config = await res.config();
|
package/dist/update.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const mlly = require('mlly');
|
|
4
|
-
const loader = require('./shared/c12.
|
|
4
|
+
const loader = require('./shared/c12.D1gWAjF7.cjs');
|
|
5
5
|
const pathe = require('pathe');
|
|
6
6
|
const promises = require('node:fs/promises');
|
|
7
7
|
const node_path = require('node:path');
|
package/dist/update.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolvePath } from 'mlly';
|
|
2
|
-
import { S as SUPPORTED_EXTENSIONS } from './shared/c12.
|
|
2
|
+
import { S as SUPPORTED_EXTENSIONS } from './shared/c12.UwygHULp.mjs';
|
|
3
3
|
import { join } from 'pathe';
|
|
4
4
|
import { mkdir, writeFile, readFile } from 'node:fs/promises';
|
|
5
5
|
import { dirname, extname } from 'node:path';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c12",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Smart Config Loader",
|
|
5
5
|
"repository": "unjs/c12",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,32 +36,32 @@
|
|
|
36
36
|
"test:types": "tsc --noEmit"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"chokidar": "^4.0.
|
|
40
|
-
"confbox": "^0.1.
|
|
39
|
+
"chokidar": "^4.0.3",
|
|
40
|
+
"confbox": "^0.1.8",
|
|
41
41
|
"defu": "^6.1.4",
|
|
42
|
-
"dotenv": "^16.4.
|
|
43
|
-
"giget": "^1.2.
|
|
44
|
-
"jiti": "^2.
|
|
45
|
-
"mlly": "^1.7.
|
|
42
|
+
"dotenv": "^16.4.7",
|
|
43
|
+
"giget": "^1.2.4",
|
|
44
|
+
"jiti": "^2.4.2",
|
|
45
|
+
"mlly": "^1.7.4",
|
|
46
46
|
"ohash": "^1.1.4",
|
|
47
|
-
"pathe": "^
|
|
47
|
+
"pathe": "^2.0.2",
|
|
48
48
|
"perfect-debounce": "^1.0.0",
|
|
49
|
-
"pkg-types": "^1.
|
|
49
|
+
"pkg-types": "^1.3.1",
|
|
50
50
|
"rc9": "^2.1.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@types/node": "^22.
|
|
54
|
-
"@vitest/coverage-v8": "^
|
|
55
|
-
"automd": "^0.3.
|
|
53
|
+
"@types/node": "^22.13.1",
|
|
54
|
+
"@vitest/coverage-v8": "^3.0.5",
|
|
55
|
+
"automd": "^0.3.12",
|
|
56
56
|
"changelogen": "^0.5.7",
|
|
57
|
-
"eslint": "^9.
|
|
58
|
-
"eslint-config-unjs": "^0.4.
|
|
59
|
-
"expect-type": "^
|
|
57
|
+
"eslint": "^9.20.0",
|
|
58
|
+
"eslint-config-unjs": "^0.4.2",
|
|
59
|
+
"expect-type": "^1.1.0",
|
|
60
60
|
"magicast": "^0.3.5",
|
|
61
|
-
"prettier": "^3.
|
|
62
|
-
"typescript": "^5.
|
|
63
|
-
"unbuild": "3.
|
|
64
|
-
"vitest": "^
|
|
61
|
+
"prettier": "^3.5.0",
|
|
62
|
+
"typescript": "^5.7.3",
|
|
63
|
+
"unbuild": "^3.3.1",
|
|
64
|
+
"vitest": "^3.0.5"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"magicast": "^0.3.5"
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"optional": true
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
-
"packageManager": "pnpm@
|
|
74
|
+
"packageManager": "pnpm@10.3.0"
|
|
75
75
|
}
|