c12 2.0.0-beta.2 → 2.0.0

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
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const loader = require('./shared/c12.Cz0O13VW.cjs');
3
+ const loader = require('./shared/c12.NHTPwjBF.cjs');
4
4
  const perfectDebounce = require('perfect-debounce');
5
5
  const pathe = require('pathe');
6
6
  const ohash = require('ohash');
@@ -8,6 +8,7 @@ require('node:fs');
8
8
  require('node:fs/promises');
9
9
  require('node:os');
10
10
  require('jiti');
11
+ require('mlly');
11
12
  require('rc9');
12
13
  require('defu');
13
14
  require('pkg-types');
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Jiti, JitiOptions } from 'jiti';
2
2
  import { DownloadTemplateOptions } from 'giget';
3
- import { WatchOptions } from 'chokidar';
3
+ import { ChokidarOptions } from 'chokidar';
4
4
  import { diff } from 'ohash';
5
5
 
6
6
  interface DotenvOptions {
@@ -128,7 +128,7 @@ type ConfigWatcher<T extends UserInputConfig = UserInputConfig, MT extends Confi
128
128
  unwatch: () => Promise<void>;
129
129
  };
130
130
  interface WatchConfigOptions<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> extends LoadConfigOptions<T, MT> {
131
- chokidarOptions?: WatchOptions;
131
+ chokidarOptions?: ChokidarOptions;
132
132
  debounce?: false | number;
133
133
  onWatch?: (event: {
134
134
  type: "created" | "updated" | "removed";
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Jiti, JitiOptions } from 'jiti';
2
2
  import { DownloadTemplateOptions } from 'giget';
3
- import { WatchOptions } from 'chokidar';
3
+ import { ChokidarOptions } from 'chokidar';
4
4
  import { diff } from 'ohash';
5
5
 
6
6
  interface DotenvOptions {
@@ -128,7 +128,7 @@ type ConfigWatcher<T extends UserInputConfig = UserInputConfig, MT extends Confi
128
128
  unwatch: () => Promise<void>;
129
129
  };
130
130
  interface WatchConfigOptions<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> extends LoadConfigOptions<T, MT> {
131
- chokidarOptions?: WatchOptions;
131
+ chokidarOptions?: ChokidarOptions;
132
132
  debounce?: false | number;
133
133
  onWatch?: (event: {
134
134
  type: "created" | "updated" | "removed";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Jiti, JitiOptions } from 'jiti';
2
2
  import { DownloadTemplateOptions } from 'giget';
3
- import { WatchOptions } from 'chokidar';
3
+ import { ChokidarOptions } from 'chokidar';
4
4
  import { diff } from 'ohash';
5
5
 
6
6
  interface DotenvOptions {
@@ -128,7 +128,7 @@ type ConfigWatcher<T extends UserInputConfig = UserInputConfig, MT extends Confi
128
128
  unwatch: () => Promise<void>;
129
129
  };
130
130
  interface WatchConfigOptions<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> extends LoadConfigOptions<T, MT> {
131
- chokidarOptions?: WatchOptions;
131
+ chokidarOptions?: ChokidarOptions;
132
132
  debounce?: false | number;
133
133
  onWatch?: (event: {
134
134
  type: "created" | "updated" | "removed";
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { l as loadConfig, S as SUPPORTED_EXTENSIONS } from './shared/c12.cwi6FO2_.mjs';
2
- export { a as loadDotenv, s as setupDotenv } from './shared/c12.cwi6FO2_.mjs';
1
+ import { l as loadConfig, S as SUPPORTED_EXTENSIONS } from './shared/c12.C11qeCBR.mjs';
2
+ export { a as loadDotenv, s as setupDotenv } from './shared/c12.C11qeCBR.mjs';
3
3
  import { debounce } from 'perfect-debounce';
4
4
  import { resolve } from 'pathe';
5
5
  import { diff } from 'ohash';
@@ -7,6 +7,7 @@ import 'node:fs';
7
7
  import 'node:fs/promises';
8
8
  import 'node:os';
9
9
  import 'jiti';
10
+ import 'mlly';
10
11
  import 'rc9';
11
12
  import 'defu';
12
13
  import 'pkg-types';
@@ -3,6 +3,7 @@ import { rm, readFile } from 'node:fs/promises';
3
3
  import { homedir } from 'node:os';
4
4
  import { resolve, join, dirname, basename, extname } from 'pathe';
5
5
  import { createJiti } from 'jiti';
6
+ import { fileURLToPath } from 'mlly';
6
7
  import * as rc9 from 'rc9';
7
8
  import { defu } from 'defu';
8
9
  import { hash } from 'ohash';
@@ -310,10 +311,8 @@ async function resolveConfig(source, options, sourceOptions = {}) {
310
311
  source = cloned.dir;
311
312
  }
312
313
  const tryResolve = (id) => {
313
- try {
314
- return options.jiti.esmResolve(id, { try: true });
315
- } catch {
316
- }
314
+ const resolved = options.jiti.esmResolve(id, { try: true });
315
+ return resolved ? fileURLToPath(resolved) : void 0;
317
316
  };
318
317
  if (NPM_PACKAGE_RE.test(source)) {
319
318
  source = tryResolve(source) || source;
@@ -5,6 +5,7 @@ const promises = require('node:fs/promises');
5
5
  const node_os = require('node:os');
6
6
  const pathe = require('pathe');
7
7
  const jiti = require('jiti');
8
+ const mlly = require('mlly');
8
9
  const rc9 = require('rc9');
9
10
  const defu = require('defu');
10
11
  const ohash = require('ohash');
@@ -327,10 +328,8 @@ async function resolveConfig(source, options, sourceOptions = {}) {
327
328
  source = cloned.dir;
328
329
  }
329
330
  const tryResolve = (id) => {
330
- try {
331
- return options.jiti.esmResolve(id, { try: true });
332
- } catch {
333
- }
331
+ const resolved = options.jiti.esmResolve(id, { try: true });
332
+ return resolved ? mlly.fileURLToPath(resolved) : void 0;
334
333
  };
335
334
  if (NPM_PACKAGE_RE.test(source)) {
336
335
  source = tryResolve(source) || source;
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.Cz0O13VW.cjs');
4
+ const loader = require('./shared/c12.NHTPwjBF.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.cwi6FO2_.mjs';
2
+ import { S as SUPPORTED_EXTENSIONS } from './shared/c12.C11qeCBR.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.0-beta.2",
3
+ "version": "2.0.0",
4
4
  "description": "Smart Config Loader",
5
5
  "repository": "unjs/c12",
6
6
  "license": "MIT",
@@ -31,37 +31,37 @@
31
31
  "lint": "eslint . && prettier -c src test",
32
32
  "lint:fix": "eslint . --fix && prettier -w src test",
33
33
  "prepack": "unbuild",
34
- "release": "pnpm build && pnpm test && changelogen --release --prerelease --push --publish --publishTag beta",
34
+ "release": "pnpm build && pnpm test && changelogen --release --push --publish",
35
35
  "test": "pnpm lint && vitest run --coverage && pnpm test:types",
36
36
  "test:types": "tsc --noEmit"
37
37
  },
38
38
  "dependencies": {
39
- "chokidar": "^3.6.0",
39
+ "chokidar": "^4.0.1",
40
40
  "confbox": "^0.1.7",
41
41
  "defu": "^6.1.4",
42
42
  "dotenv": "^16.4.5",
43
43
  "giget": "^1.2.3",
44
- "jiti": "2.0.0-beta.3",
44
+ "jiti": "^2.0.0",
45
45
  "mlly": "^1.7.1",
46
- "ohash": "^1.1.3",
46
+ "ohash": "^1.1.4",
47
47
  "pathe": "^1.1.2",
48
48
  "perfect-debounce": "^1.0.0",
49
49
  "pkg-types": "^1.2.0",
50
50
  "rc9": "^2.1.2"
51
51
  },
52
52
  "devDependencies": {
53
- "@types/node": "^20.16.3",
54
- "@vitest/coverage-v8": "^2.0.5",
53
+ "@types/node": "^22.7.4",
54
+ "@vitest/coverage-v8": "^2.1.1",
55
55
  "automd": "^0.3.8",
56
- "changelogen": "^0.5.5",
57
- "eslint": "^9.9.1",
58
- "eslint-config-unjs": "^0.3.2",
56
+ "changelogen": "^0.5.7",
57
+ "eslint": "^9.11.1",
58
+ "eslint-config-unjs": "^0.4.1",
59
59
  "expect-type": "^0.20.0",
60
60
  "magicast": "^0.3.5",
61
61
  "prettier": "^3.3.3",
62
- "typescript": "^5.5.4",
63
- "unbuild": "3.0.0-rc.7",
64
- "vitest": "^2.0.5"
62
+ "typescript": "^5.6.2",
63
+ "unbuild": "3.0.0-rc.8",
64
+ "vitest": "^2.1.1"
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@9.9.0"
74
+ "packageManager": "pnpm@9.11.0"
75
75
  }