c12 3.0.0 → 3.0.1

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { l as loadConfig, S as SUPPORTED_EXTENSIONS } from './shared/c12.D3Kdt5zI.mjs';
2
- export { a as loadDotenv, s as setupDotenv } from './shared/c12.D3Kdt5zI.mjs';
1
+ import { l as loadConfig, S as SUPPORTED_EXTENSIONS } from './shared/c12.X4pJ8kft.mjs';
2
+ export { a as loadDotenv, s as setupDotenv } from './shared/c12.X4pJ8kft.mjs';
3
3
  import { debounce } from 'perfect-debounce';
4
4
  import { resolve } from 'pathe';
5
5
  import 'node:fs';
@@ -2,7 +2,7 @@ import { existsSync, promises } from 'node:fs';
2
2
  import { rm, readFile } from 'node:fs/promises';
3
3
  import { pathToFileURL } from 'node:url';
4
4
  import { homedir } from 'node:os';
5
- import { resolve, join, dirname, basename, extname } from 'pathe';
5
+ import { resolve, join, dirname, basename, extname, normalize } from 'pathe';
6
6
  import { resolveModulePath } from 'exsolve';
7
7
  import { createJiti } from 'jiti';
8
8
  import * as rc9 from 'rc9';
@@ -373,13 +373,14 @@ async function resolveConfig(source, options, sourceOptions = {}) {
373
373
  return res;
374
374
  }
375
375
  function tryResolve(id, options) {
376
- return resolveModulePath(id, {
376
+ const res = resolveModulePath(id, {
377
377
  try: true,
378
378
  from: pathToFileURL(join(options.cwd || ".", options.configFile || "/")),
379
379
  suffixes: ["", "/index"],
380
380
  extensions: SUPPORTED_EXTENSIONS,
381
381
  cache: false
382
382
  });
383
+ return res ? normalize(res) : void 0;
383
384
  }
384
385
 
385
386
  export { SUPPORTED_EXTENSIONS as S, loadDotenv as a, loadConfig as l, setupDotenv as s };
package/dist/update.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolveModulePath } from 'exsolve';
2
- import { S as SUPPORTED_EXTENSIONS } from './shared/c12.D3Kdt5zI.mjs';
3
- import { join } from 'pathe';
2
+ import { S as SUPPORTED_EXTENSIONS } from './shared/c12.X4pJ8kft.mjs';
3
+ import { join, normalize } from 'pathe';
4
4
  import { mkdir, writeFile, readFile } from 'node:fs/promises';
5
5
  import { dirname, extname } from 'node:path';
6
6
  import 'node:fs';
@@ -61,13 +61,14 @@ async function updateConfig(opts) {
61
61
  };
62
62
  }
63
63
  function tryResolve(path, cwd, extensions) {
64
- return resolveModulePath(path, {
64
+ const res = resolveModulePath(path, {
65
65
  try: true,
66
66
  from: join(cwd, "/"),
67
67
  extensions,
68
68
  suffixes: ["", "/index"],
69
69
  cache: false
70
70
  });
71
+ return res ? normalize(res) : void 0;
71
72
  }
72
73
 
73
74
  export { updateConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c12",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Smart Config Loader",
5
5
  "repository": "unjs/c12",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "confbox": "^0.1.8",
36
36
  "defu": "^6.1.4",
37
37
  "dotenv": "^16.4.7",
38
- "exsolve": "^0.4.1",
38
+ "exsolve": "^0.4.2",
39
39
  "giget": "^2.0.0",
40
40
  "jiti": "^2.4.2",
41
41
  "ohash": "^2.0.5",