c12 1.4.0 → 1.4.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.cjs CHANGED
@@ -329,11 +329,12 @@ const eventMap = {
329
329
  async function watchConfig(options) {
330
330
  let config = await loadConfig(options);
331
331
  const configName = options.name || "config";
332
+ const configFileName = options.configFile ?? (options.name !== "config" ? `${options.name}.config` : "config");
332
333
  const watchingFiles = [
333
334
  ...new Set(
334
335
  (config.layers || []).filter((l) => l.cwd).flatMap((l) => [
335
336
  ...["ts", "js", "mjs", "cjs", "cts", "mts", "json"].map(
336
- (ext) => pathe.resolve(l.cwd, (options.name || "config") + "." + ext)
337
+ (ext) => pathe.resolve(l.cwd, configFileName + "." + ext)
337
338
  ),
338
339
  l.source && pathe.resolve(l.cwd, l.source),
339
340
  // TODO: Support watching rc from home and workspace
@@ -379,7 +380,7 @@ async function watchConfig(options) {
379
380
  }
380
381
  };
381
382
  if (options.debounce !== false) {
382
- _fswatcher.on("all", perfectDebounce.debounce(onChange, options.debounce));
383
+ _fswatcher.on("all", perfectDebounce.debounce(onChange, options.debounce ?? 100));
383
384
  } else {
384
385
  _fswatcher.on("all", onChange);
385
386
  }
package/dist/index.mjs CHANGED
@@ -309,11 +309,12 @@ const eventMap = {
309
309
  async function watchConfig(options) {
310
310
  let config = await loadConfig(options);
311
311
  const configName = options.name || "config";
312
+ const configFileName = options.configFile ?? (options.name !== "config" ? `${options.name}.config` : "config");
312
313
  const watchingFiles = [
313
314
  ...new Set(
314
315
  (config.layers || []).filter((l) => l.cwd).flatMap((l) => [
315
316
  ...["ts", "js", "mjs", "cjs", "cts", "mts", "json"].map(
316
- (ext) => resolve(l.cwd, (options.name || "config") + "." + ext)
317
+ (ext) => resolve(l.cwd, configFileName + "." + ext)
317
318
  ),
318
319
  l.source && resolve(l.cwd, l.source),
319
320
  // TODO: Support watching rc from home and workspace
@@ -359,7 +360,7 @@ async function watchConfig(options) {
359
360
  }
360
361
  };
361
362
  if (options.debounce !== false) {
362
- _fswatcher.on("all", debounce(onChange, options.debounce));
363
+ _fswatcher.on("all", debounce(onChange, options.debounce ?? 100));
363
364
  } else {
364
365
  _fswatcher.on("all", onChange);
365
366
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c12",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Smart Config Loader",
5
5
  "repository": "unjs/c12",
6
6
  "license": "MIT",