@outfitter/config 0.1.0 → 0.2.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/README.md CHANGED
@@ -68,7 +68,7 @@ if (result.isOk()) {
68
68
  2. `$XDG_CONFIG_HOME/{appName}/config.{ext}`
69
69
  3. `~/.config/{appName}/config.{ext}`
70
70
 
71
- **File Format Preference:** `.toml` > `.yaml` > `.yml` > `.json` > `.json5`
71
+ **File Format Preference:** `.toml` > `.yaml` > `.yml` > `.json` > `.jsonc` > `.json5`
72
72
 
73
73
  **Returns:** `Result<T, NotFoundError | ValidationError | ParseError>`
74
74
 
@@ -267,6 +267,7 @@ Higher precedence sources override lower ones. Nested objects are deep-merged.
267
267
  | `.toml` | smol-toml | Preferred for configuration |
268
268
  | `.yaml`, `.yml` | yaml | YAML anchors/aliases supported |
269
269
  | `.json` | JSON.parse | Strict parsing |
270
+ | `.jsonc` | json5 | JSON with comments and trailing commas |
270
271
  | `.json5` | json5 | Comments and trailing commas allowed |
271
272
 
272
273
  ---
package/dist/index.d.ts CHANGED
@@ -310,6 +310,7 @@ declare function deepMerge<T extends object>(target: T, source: Partial<T>): T;
310
310
  * - `.toml` - Parsed with smol-toml (preferred for config)
311
311
  * - `.yaml`, `.yml` - Parsed with yaml (merge key support enabled)
312
312
  * - `.json` - Parsed with strict JSON.parse
313
+ * - `.jsonc` - Parsed with json5 compatibility (comments/trailing commas)
313
314
  * - `.json5` - Parsed with json5 (comments and trailing commas allowed)
314
315
  *
315
316
  * @param content - Raw file content to parse
@@ -438,7 +439,7 @@ interface LoadConfigOptions {
438
439
  * 2. `$XDG_CONFIG_HOME/{appName}/config.{ext}`
439
440
  * 3. `~/.config/{appName}/config.{ext}`
440
441
  *
441
- * File format preference: `.toml` > `.yaml` > `.yml` > `.json` > `.json5`
442
+ * File format preference: `.toml` > `.yaml` > `.yml` > `.json` > `.jsonc` > `.json5`
442
443
  *
443
444
  * @typeParam T - The configuration type (inferred from schema)
444
445
  * @param appName - Application name for XDG directory lookup
package/dist/index.js CHANGED
@@ -9159,6 +9159,7 @@ function parseConfigFile(content, filename) {
9159
9159
  const parsed = JSON.parse(content);
9160
9160
  return Result.ok(parsed);
9161
9161
  }
9162
+ case "jsonc":
9162
9163
  case "json5": {
9163
9164
  const parsed = import_json5.default.parse(content);
9164
9165
  return Result.ok(parsed);
@@ -9206,7 +9207,7 @@ function resolveConfig(schema, sources) {
9206
9207
  }
9207
9208
  return Result.ok(parseResult.data);
9208
9209
  }
9209
- var CONFIG_EXTENSIONS = ["toml", "yaml", "yml", "json", "json5"];
9210
+ var CONFIG_EXTENSIONS = ["toml", "yaml", "yml", "json", "jsonc", "json5"];
9210
9211
  function findConfigFile(dir) {
9211
9212
  for (const ext of CONFIG_EXTENSIONS) {
9212
9213
  const filePath = join(dir, `config.${ext}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@outfitter/config",
3
3
  "description": "XDG-compliant config loading with schema validation for Outfitter",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -27,8 +27,8 @@
27
27
  "clean": "rm -rf dist"
28
28
  },
29
29
  "dependencies": {
30
- "@outfitter/contracts": "0.1.0",
31
- "@outfitter/types": "0.1.0",
30
+ "@outfitter/contracts": "0.2.0",
31
+ "@outfitter/types": "0.2.0",
32
32
  "zod": "^4.3.5"
33
33
  },
34
34
  "devDependencies": {