@o3co/ts.hocon 1.12.0 → 1.14.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.
Files changed (43) hide show
  1. package/README.ja.md +256 -32
  2. package/README.md +166 -32
  3. package/dist/adapters/env.cjs +26 -1678
  4. package/dist/adapters/env.d.cts +1 -1
  5. package/dist/adapters/env.d.ts +1 -1
  6. package/dist/adapters/env.js +11 -1625
  7. package/dist/adapters/json5.cjs +496 -0
  8. package/dist/adapters/json5.d.cts +47 -0
  9. package/dist/adapters/json5.d.ts +47 -0
  10. package/dist/adapters/json5.js +496 -0
  11. package/dist/adapters/jsonc.cjs +17 -1632
  12. package/dist/adapters/jsonc.d.cts +1 -1
  13. package/dist/adapters/jsonc.d.ts +1 -1
  14. package/dist/adapters/jsonc.js +9 -1586
  15. package/dist/adapters/properties.cjs +7 -1773
  16. package/dist/adapters/properties.d.cts +1 -1
  17. package/dist/adapters/properties.d.ts +1 -1
  18. package/dist/adapters/properties.js +6 -1735
  19. package/dist/adapters/toml.cjs +12 -1626
  20. package/dist/adapters/toml.d.cts +1 -1
  21. package/dist/adapters/toml.d.ts +1 -1
  22. package/dist/adapters/toml.js +10 -1589
  23. package/dist/adapters/yaml.cjs +20 -1635
  24. package/dist/adapters/yaml.d.cts +1 -1
  25. package/dist/adapters/yaml.d.ts +1 -1
  26. package/dist/adapters/yaml.js +10 -1589
  27. package/dist/chunk-GBNQADHT.cjs +83 -0
  28. package/dist/chunk-IMJ7QHIK.cjs +158 -0
  29. package/dist/chunk-QY7ECGS6.js +83 -0
  30. package/dist/chunk-RO4D6BH7.cjs +3792 -0
  31. package/dist/chunk-WTXULUZS.js +3792 -0
  32. package/dist/chunk-XWKO4JM3.js +158 -0
  33. package/dist/{config-Dlq6rF3w.d.cts → config-OccaKqXu.d.cts} +148 -4
  34. package/dist/{config-Dlq6rF3w.d.ts → config-OccaKqXu.d.ts} +148 -4
  35. package/dist/index.cjs +35 -3449
  36. package/dist/index.d.cts +2 -2
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.js +25 -3383
  39. package/dist/zod.cjs +107 -3291
  40. package/dist/zod.d.cts +83 -3
  41. package/dist/zod.d.ts +83 -3
  42. package/dist/zod.js +95 -3245
  43. package/package.json +12 -2
@@ -1,1657 +1,43 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/adapters/yaml.ts
31
- var yaml_exports = {};
32
- __export(yaml_exports, {
33
- fromYamlValue: () => fromYamlValue,
34
- parseYaml: () => parseYaml
35
- });
36
- module.exports = __toCommonJS(yaml_exports);
37
- var import_yaml = __toESM(require("yaml"), 1);
38
-
39
- // src/coerce.ts
40
- var DECIMAL_NUMBER_RE = /^-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/;
41
- function isHoconWs(cp) {
42
- if (cp === 9 || cp === 10 || cp === 11 || cp === 12 || cp === 13) return true;
43
- if (cp >= 28 && cp <= 31) return true;
44
- if (cp === 32 || cp === 160 || cp === 65279) return true;
45
- if (cp === 5760) return true;
46
- if (cp >= 8192 && cp <= 8202) return true;
47
- if (cp === 8232 || cp === 8233 || cp === 8239 || cp === 8287) return true;
48
- if (cp === 12288) return true;
49
- return false;
50
- }
51
- function trimHoconWs(s) {
52
- let start = 0;
53
- let end = s.length;
54
- while (start < end && isHoconWs(s.charCodeAt(start))) {
55
- start++;
56
- }
57
- while (end > start && isHoconWs(s.charCodeAt(end - 1))) {
58
- end--;
59
- }
60
- return s.slice(start, end);
61
- }
62
- var TRUTHY = /* @__PURE__ */ new Set(["true", "yes", "on"]);
63
- var FALSY = /* @__PURE__ */ new Set(["false", "no", "off"]);
64
- function coerceBoolean(value) {
65
- const lower = value.toLowerCase();
66
- if (TRUTHY.has(lower)) return true;
67
- if (FALSY.has(lower)) return false;
68
- return void 0;
69
- }
70
- function coerceNumber(value) {
71
- if (!DECIMAL_NUMBER_RE.test(value)) return void 0;
72
- return Number(value);
73
- }
74
- var DURATION_UNITS = {
75
- ns: 1e-6,
76
- nanosecond: 1e-6,
77
- nanoseconds: 1e-6,
78
- us: 1e-3,
79
- microsecond: 1e-3,
80
- microseconds: 1e-3,
81
- ms: 1,
82
- millisecond: 1,
83
- milliseconds: 1,
84
- s: 1e3,
85
- second: 1e3,
86
- seconds: 1e3,
87
- m: 6e4,
88
- minute: 6e4,
89
- minutes: 6e4,
90
- h: 36e5,
91
- hour: 36e5,
92
- hours: 36e5,
93
- d: 864e5,
94
- day: 864e5,
95
- days: 864e5
96
- };
97
- var OUTPUT_DURATION_UNITS = {
98
- ns: 1e-6,
99
- us: 1e-3,
100
- ms: 1,
101
- s: 1e3,
102
- m: 6e4,
103
- h: 36e5,
104
- d: 864e5
105
- };
106
- function parseDuration(value, outputUnit = "ms") {
107
- const trimmed = trimHoconWs(value);
108
- let i = 0;
109
- while (i < trimmed.length) {
110
- const ch = trimmed[i];
111
- if (i === 0 && (ch === "-" || ch === "+")) {
112
- i++;
113
- continue;
114
- }
115
- if (ch !== "." && (ch < "0" || ch > "9")) break;
116
- i++;
117
- }
118
- if (i === 0) return NaN;
119
- const num = Number(trimmed.slice(0, i));
120
- if (Number.isNaN(num)) return NaN;
121
- const unit = trimHoconWs(trimmed.slice(i));
122
- const divisor = OUTPUT_DURATION_UNITS[outputUnit];
123
- if (divisor === void 0) return NaN;
124
- if (unit === "") {
125
- return num / divisor;
126
- }
127
- const mult = DURATION_UNITS[unit];
128
- if (mult === void 0) return NaN;
129
- const ms = num * mult;
130
- return ms / divisor;
131
- }
132
- var BYTE_UNITS = {
133
- B: 1,
134
- byte: 1,
135
- bytes: 1,
136
- KB: 1e3,
137
- kilobyte: 1e3,
138
- kilobytes: 1e3,
139
- KiB: 1024,
140
- kibibyte: 1024,
141
- kibibytes: 1024,
142
- MB: 1e6,
143
- megabyte: 1e6,
144
- megabytes: 1e6,
145
- MiB: 1048576,
146
- mebibyte: 1048576,
147
- mebibytes: 1048576,
148
- GB: 1e9,
149
- gigabyte: 1e9,
150
- gigabytes: 1e9,
151
- GiB: 1073741824,
152
- gibibyte: 1073741824,
153
- gibibytes: 1073741824,
154
- TB: 1e12,
155
- terabyte: 1e12,
156
- terabytes: 1e12,
157
- TiB: 1099511627776,
158
- tebibyte: 1099511627776,
159
- tebibytes: 1099511627776,
160
- // S21.4 — HOCON.md L1385: single-letter abbreviations → powers of two (java -Xmx convention).
161
- // Lightbend typesafe-config 1.4.3 verified: 1K=1024, 1M=1048576, etc.
162
- // Both upper- and lowercase accepted per Lightbend behaviour.
163
- // Z/Y (2^70/2^80) are deferred — they overflow MAX_SAFE_INTEGER and require BigInt accessor.
164
- K: 1024,
165
- k: 1024,
166
- M: 1024 ** 2,
167
- m: 1024 ** 2,
168
- G: 1024 ** 3,
169
- g: 1024 ** 3,
170
- T: 1024 ** 4,
171
- t: 1024 ** 4,
172
- P: 1024 ** 5,
173
- p: 1024 ** 5,
174
- E: 1024 ** 6,
175
- e: 1024 ** 6,
176
- // lowercase short-form aliases
177
- b: 1,
178
- kb: 1e3,
179
- kib: 1024,
180
- mb: 1e6,
181
- mib: 1048576,
182
- gb: 1e9,
183
- gib: 1073741824,
184
- tb: 1e12,
185
- tib: 1099511627776
186
- };
187
- var OUTPUT_BYTE_UNITS = {
188
- B: 1,
189
- KB: 1e3,
190
- KiB: 1024,
191
- MB: 1e6,
192
- MiB: 1048576,
193
- GB: 1e9,
194
- GiB: 1073741824,
195
- TB: 1e12,
196
- TiB: 1099511627776
197
- };
198
- function parseBytes(value, outputUnit = "B") {
199
- const trimmed = trimHoconWs(value);
200
- let i = 0;
201
- while (i < trimmed.length) {
202
- const ch = trimmed[i];
203
- if (i === 0 && (ch === "-" || ch === "+")) {
204
- i++;
205
- continue;
206
- }
207
- if (ch !== "." && (ch < "0" || ch > "9")) break;
208
- i++;
209
- }
210
- if (i === 0) return NaN;
211
- const num = Number(trimmed.slice(0, i));
212
- if (Number.isNaN(num)) return NaN;
213
- const unit = trimHoconWs(trimmed.slice(i));
214
- const divisor = OUTPUT_BYTE_UNITS[outputUnit];
215
- if (divisor === void 0) return NaN;
216
- if (unit === "") {
217
- const bytes2 = Math.trunc(num);
218
- if (Math.abs(bytes2) > Number.MAX_SAFE_INTEGER) {
219
- throw new RangeError("byte size overflows representable range (max 2^53-1 bytes)");
220
- }
221
- return bytes2 / divisor;
222
- }
223
- let mult = BYTE_UNITS[unit];
224
- if (mult === void 0) {
225
- mult = BYTE_UNITS[unit.toLowerCase()];
226
- }
227
- if (mult === void 0) return NaN;
228
- const bytes = num * mult;
229
- if (Math.abs(bytes) > Number.MAX_SAFE_INTEGER) {
230
- throw new RangeError("byte size overflows representable range (max 2^53-1 bytes)");
231
- }
232
- const result = bytes / divisor;
233
- return outputUnit === "B" ? Math.round(result) : result;
234
- }
235
-
236
- // src/errors.ts
237
- var ResolveError = class extends Error {
238
- constructor(message, path, line, col, file) {
239
- super(message);
240
- this.path = path;
241
- this.line = line;
242
- this.col = col;
243
- this.file = file;
244
- this.name = "ResolveError";
245
- }
246
- };
247
- var ConfigError = class extends Error {
248
- constructor(message, path) {
249
- super(message);
250
- this.path = path;
251
- this.name = "ConfigError";
252
- }
253
- };
254
- var NotResolvedError = class extends ConfigError {
255
- constructor(path) {
256
- super(`value at path "${path}" is not resolved (call resolve() first)`, path);
257
- this.name = "NotResolvedError";
258
- }
259
- };
260
-
261
- // src/internal/resolver/fold-self-ref.ts
262
- function substFullKey(s) {
263
- return stringSegmentsToKey(s.segments.map((seg) => seg.text));
264
- }
265
- function stringSegmentsToKey(segments) {
266
- return segments.map((t) => {
267
- if (t === "" || /[^a-zA-Z0-9\-_]/.test(t)) {
268
- return `"${t.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
269
- }
270
- return t;
271
- }).join(".");
272
- }
273
- function containsSelfRef(v, fullKey) {
274
- if (isSubst(v)) return !v.knownAbsent && substFullKey(v) === fullKey;
275
- if (isConcat(v)) return v.nodes.some((n) => containsSelfRef(n, fullKey));
276
- if (isResObj(v)) {
277
- for (const f of v.fields.values()) {
278
- if (containsSelfRef(f, fullKey)) return true;
279
- }
280
- return false;
281
- }
282
- const hv = v;
283
- if (hv.kind === "array") {
284
- return hv.items.some((item) => containsSelfRef(item, fullKey));
285
- }
286
- if (hv.kind === "object") {
287
- for (const f of hv.fields.values()) {
288
- if (containsSelfRef(f, fullKey)) return true;
289
- }
290
- return false;
291
- }
292
- return false;
293
- }
294
- function foldSelfRef(v, fullKey, replacement) {
295
- if (isSubst(v)) {
296
- return substFullKey(v) === fullKey ? replacement : v;
297
- }
298
- if (isConcat(v)) {
299
- return {
300
- _kind: "concat-placeholder",
301
- nodes: v.nodes.map((n) => foldSelfRef(n, fullKey, replacement)),
302
- line: v.line,
303
- col: v.col
304
- };
305
- }
306
- if (isResObj(v)) {
307
- const newFields = /* @__PURE__ */ new Map();
308
- for (const [k, val] of v.fields) {
309
- newFields.set(k, foldSelfRef(val, fullKey, replacement));
310
- }
311
- return { _kind: "res-obj", fields: newFields, priorValues: new Map(v.priorValues), resetKeys: new Set(v.resetKeys) };
312
- }
313
- const hv = v;
314
- if (hv.kind === "array") {
315
- return {
316
- kind: "array",
317
- items: hv.items.map((item) => foldSelfRef(item, fullKey, replacement))
318
- };
319
- }
320
- if (hv.kind === "object") {
321
- const newFields = /* @__PURE__ */ new Map();
322
- for (const [k, val] of hv.fields) {
323
- newFields.set(k, foldSelfRef(val, fullKey, replacement));
324
- }
325
- return { kind: "object", fields: newFields };
326
- }
327
- return v;
328
- }
329
- function foldOrSkipPrior(prior, fullKey, old) {
330
- if (!containsSelfRef(prior, fullKey)) return cloneResolverValue(prior);
331
- if (old === void 0) return foldOptionalSelfRefAbsent(prior, fullKey);
332
- return foldSelfRef(prior, fullKey, old);
333
- }
334
- function foldOptionalSelfRefAbsent(v, fullKey) {
335
- if (isSubst(v) && substFullKey(v) === fullKey) {
336
- if (!v.optional) return void 0;
337
- return {
338
- _kind: "subst-placeholder",
339
- segments: v.segments.map((seg) => ({ text: seg.text, line: seg.line, col: seg.col })),
340
- optional: v.optional,
341
- knownAbsent: true,
342
- listSuffix: v.listSuffix,
343
- line: v.line,
344
- col: v.col,
345
- prefixLen: v.prefixLen
346
- };
347
- }
348
- if (isConcat(v)) {
349
- const nodes = [];
350
- for (const node of v.nodes) {
351
- const folded = foldOptionalSelfRefAbsent(node, fullKey);
352
- if (folded === void 0) return void 0;
353
- nodes.push(folded);
354
- }
355
- return { _kind: "concat-placeholder", nodes, line: v.line, col: v.col };
356
- }
357
- if (isResObj(v)) {
358
- const fields = /* @__PURE__ */ new Map();
359
- for (const [key, value] of v.fields) {
360
- const folded = foldOptionalSelfRefAbsent(value, fullKey);
361
- if (folded === void 0) return void 0;
362
- fields.set(key, folded);
363
- }
364
- return { _kind: "res-obj", fields, priorValues: new Map(v.priorValues), resetKeys: new Set(v.resetKeys) };
365
- }
366
- const hv = v;
367
- if (hv.kind === "array") {
368
- const items = [];
369
- for (const item of hv.items) {
370
- const folded = foldOptionalSelfRefAbsent(item, fullKey);
371
- if (folded === void 0) return void 0;
372
- items.push(folded);
373
- }
374
- return { kind: "array", items };
375
- }
376
- if (hv.kind === "object") {
377
- const fields = /* @__PURE__ */ new Map();
378
- for (const [key, value] of hv.fields) {
379
- const folded = foldOptionalSelfRefAbsent(value, fullKey);
380
- if (folded === void 0) return void 0;
381
- fields.set(key, folded);
382
- }
383
- return { kind: "object", fields };
384
- }
385
- return cloneResolverValue(v);
386
- }
387
- function cloneResolverValue(v) {
388
- if (isSubst(v)) {
389
- return {
390
- _kind: "subst-placeholder",
391
- segments: v.segments.map((seg) => ({ text: seg.text, line: seg.line, col: seg.col })),
392
- optional: v.optional,
393
- knownAbsent: v.knownAbsent,
394
- listSuffix: v.listSuffix,
395
- line: v.line,
396
- col: v.col,
397
- prefixLen: v.prefixLen
398
- };
399
- }
400
- if (isConcat(v)) {
401
- return {
402
- _kind: "concat-placeholder",
403
- nodes: v.nodes.map((n) => cloneResolverValue(n)),
404
- line: v.line,
405
- col: v.col
406
- };
407
- }
408
- if (isResObj(v)) {
409
- const newFields = /* @__PURE__ */ new Map();
410
- for (const [k, val] of v.fields) newFields.set(k, cloneResolverValue(val));
411
- const newPriors = /* @__PURE__ */ new Map();
412
- for (const [k, val] of v.priorValues) newPriors.set(k, cloneResolverValue(val));
413
- return { _kind: "res-obj", fields: newFields, priorValues: newPriors, resetKeys: new Set(v.resetKeys) };
414
- }
415
- const hv = v;
416
- if (hv.kind === "array") {
417
- return {
418
- kind: "array",
419
- items: hv.items.map((item) => cloneResolverValue(item))
420
- };
421
- }
422
- if (hv.kind === "object") {
423
- const newFields = /* @__PURE__ */ new Map();
424
- for (const [k, val] of hv.fields) {
425
- newFields.set(k, cloneResolverValue(val));
426
- }
427
- return { kind: "object", fields: newFields };
428
- }
429
- return hv;
430
- }
431
- function containsSubstByPath(v, target) {
432
- if (isSubst(v)) return !v.knownAbsent && segmentsTextEqual(v.segments, target);
433
- if (isConcat(v)) return v.nodes.some((n) => containsSubstByPath(n, target));
434
- if (isResObj(v)) {
435
- for (const f of v.fields.values()) {
436
- if (containsSubstByPath(f, target)) return true;
437
- }
438
- return false;
439
- }
440
- const hv = v;
441
- if (hv.kind === "array") {
442
- return hv.items.some((item) => containsSubstByPath(item, target));
443
- }
444
- if (hv.kind === "object") {
445
- for (const f of hv.fields.values()) {
446
- if (containsSubstByPath(f, target)) return true;
447
- }
448
- return false;
449
- }
450
- return false;
451
- }
452
- function segmentsTextEqual(a, b) {
453
- if (a.length !== b.length) return false;
454
- for (let i = 0; i < a.length; i++) {
455
- const ai = a[i];
456
- const bi = b[i];
457
- if (ai === void 0 || bi === void 0 || ai.text !== bi.text) return false;
458
- }
459
- return true;
460
- }
461
-
462
- // src/internal/resolver/types.ts
463
- var separatorValues = /* @__PURE__ */ new WeakSet();
464
- function isSubst(v) {
465
- return v._kind === "subst-placeholder";
466
- }
467
- function isConcat(v) {
468
- return v._kind === "concat-placeholder";
469
- }
470
- function isResObj(v) {
471
- return v._kind === "res-obj";
472
- }
473
- function makeResObj() {
474
- return { _kind: "res-obj", fields: /* @__PURE__ */ new Map(), priorValues: /* @__PURE__ */ new Map(), resetKeys: /* @__PURE__ */ new Set() };
475
- }
476
- function mergeUnresolved(receiver, fallback) {
477
- const result = makeResObj();
478
- for (const [k, v] of fallback.fields) {
479
- result.fields.set(k, v);
480
- }
481
- for (const [k, v] of fallback.priorValues) {
482
- result.priorValues.set(k, v);
483
- }
484
- for (const [k, rv] of receiver.fields) {
485
- const existing = result.fields.get(k);
486
- if (existing !== void 0) {
487
- const recPrior = receiver.priorValues.get(k);
488
- if (recPrior !== void 0 && !isResObj(recPrior)) {
489
- result.fields.set(k, rv);
490
- continue;
491
- }
492
- if (isResObj(rv) && isResObj(existing)) {
493
- result.fields.set(k, mergeUnresolved(rv, existing));
494
- continue;
495
- }
496
- const foldedPrior = foldOrSkipPrior(existing, k, void 0);
497
- if (foldedPrior !== void 0) result.priorValues.set(k, foldedPrior);
498
- }
499
- result.fields.set(k, rv);
500
- }
501
- for (const [k, v] of receiver.priorValues) {
502
- if (receiver.fields.has(k)) {
503
- result.priorValues.set(k, v);
504
- }
505
- }
506
- return result;
507
- }
508
-
509
- // src/internal/resolver/utils.ts
510
- function segmentsToKey(segments) {
511
- return segments.map((s) => {
512
- const t = s.text;
513
- if (t === "" || /[^a-zA-Z0-9\-_]/.test(t)) {
514
- return `"${t.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
515
- }
516
- return t;
517
- }).join(".");
518
- }
519
- function lookupPath(root, segments) {
520
- const [head, ...tail] = segments;
521
- if (head === void 0) return void 0;
522
- const key = head.text;
523
- const val = root.fields.get(key);
524
- if (val === void 0) return void 0;
525
- if (tail.length === 0) return val;
526
- if (isResObj(val)) return lookupPath(val, tail);
527
- return void 0;
528
- }
529
- function lookupResObj(root, segments) {
530
- let cur = root;
531
- for (const seg of segments) {
532
- const val = cur.fields.get(seg.text);
533
- if (val === void 0 || !isResObj(val)) return void 0;
534
- cur = val;
535
- }
536
- return cur;
537
- }
538
- function deepMergeHoconValues(base, overlay) {
539
- const merged = new Map(base.fields);
540
- for (const [k, v] of overlay.fields) {
541
- const existing = merged.get(k);
542
- if (existing?.kind === "object" && v.kind === "object") {
543
- merged.set(k, deepMergeHoconValues(existing, v));
544
- } else {
545
- merged.set(k, v);
546
- }
547
- }
548
- return { kind: "object", fields: merged };
549
- }
550
-
551
- // src/internal/resolver/include-loader.ts
552
- var import_node_module = require("module");
553
- var nodePath = __toESM(require("path"), 1);
554
- var import_node_url = require("url");
555
-
556
- // src/internal/strip-bom.ts
557
- function stripBom(input) {
558
- return input.charCodeAt(0) === 65279 ? input.slice(1) : input;
559
- }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
560
2
 
561
- // src/internal/depth.ts
562
- function guardStackDepth(fn, wrap) {
563
- try {
564
- return fn();
565
- } catch (e) {
566
- if (!isStackOverflow(e)) throw e;
567
- throw wrap(STACK_MESSAGE);
568
- }
569
- }
570
- var STACK_MESSAGE = "input is nested too deeply for this engine's stack, or contains a cycle (flatten the document, or break the cycle)";
571
- function isStackOverflow(e) {
572
- if (!(e instanceof RangeError)) return false;
573
- const m = e.message.toLowerCase();
574
- return m.includes("call stack") || // V8: "Maximum call stack size exceeded"
575
- m.includes("recursion") || // SpiderMonkey: "too much recursion"
576
- m.includes("stack overflow");
577
- }
578
- function depthError(message) {
579
- return new ConfigError(message, "");
580
- }
3
+ var _chunkGBNQADHTcjs = require('../chunk-GBNQADHT.cjs');
581
4
 
582
- // src/value/numeric-array.ts
583
- function numericObjectToArray(value) {
584
- if (value.kind !== "object") return null;
585
- if (value.fields.size === 0) return null;
586
- const canonicalInt = /^(0|[1-9][0-9]*)$/;
587
- const eligible = [];
588
- for (const [key, val] of value.fields) {
589
- if (!canonicalInt.test(key)) continue;
590
- const n = Number(key);
591
- if (!Number.isInteger(n) || n > 2147483647) continue;
592
- eligible.push({ n, v: val });
593
- }
594
- if (eligible.length === 0) return null;
595
- eligible.sort((a, b) => a.n - b.n);
596
- return eligible.map((e) => e.v);
597
- }
598
5
 
599
- // src/internal/resolver/substitution-resolver.ts
600
- var SubstitutionResolver = class {
601
- constructor(root, opts) {
602
- this.root = root;
603
- this.opts = opts;
604
- this.resolving = /* @__PURE__ */ new Set();
605
- this.cache = /* @__PURE__ */ new Map();
606
- // Tracks ConcatPlaceholder nodes currently being iterated by resolveConcat.
607
- // Used by isSelfRef detection: fires only when found === a concat currently
608
- // mid-iteration (i.e. we are inside found's own resolution), preventing the
609
- // "foofoo" double-count without misfiring when an external field looks up the
610
- // same concat via a substitution (multi-reviewer convergence fix).
611
- //
612
- // Spec deviation: the S13a.13 spec ★1 decision #1 specified path-equality
613
- // preservation for self-ref detection. Round-2 multi-agent-review surfaced a
614
- // false-positive on external lookups (`a = ${?a}foo; b = ${a}`), so the
615
- // criterion was tightened to node-membership-in-iterating-set — strictly
616
- // narrower than path-equality. Spec amendment deferred to a follow-up
617
- // xx.hocon PR (see Phase 6 #3f close-out notes).
618
- this.resolvingConcats = /* @__PURE__ */ new WeakSet();
619
- // Path stack tracking the full dotted path of the field currently being
620
- // assigned in `resolveResObj`. Leaf keys are pushed on entry to each
621
- // `(key, val)` iteration and popped on exit, so nested objects build up
622
- // the full path (e.g. `["o", "history"]` while resolving `o.history`).
623
- //
624
- // Used to tighten self-ref detection at the L192 found-lookup site:
625
- // a substitution `${X}` whose looked-up value contains a Subst pointing
626
- // at `X` is only a true self-reference when the field currently being
627
- // assigned is `X` (or a descendant of `X`). Without this guard, an
628
- // external lookup like `b = ${o}` (where o has a self-referential
629
- // field) would mis-fire and short-circuit to o's prior, returning the
630
- // wrong value for b. The is_owner gate (rfp prefix-matches s.segments)
631
- // narrows the check to the owner case only.
632
- //
633
- // Cross-impl with rs.hocon v1.5.1's resolving_field_path (same purpose,
634
- // same prefix-match semantics).
635
- this.resolvingFieldPath = [];
636
- }
637
- /** Returns a prefix for error messages, including origin info when set. */
638
- originPrefix() {
639
- return this.opts.originDescription ? `${this.opts.originDescription}: ` : "";
640
- }
641
- resolve() {
642
- return this.resolveResObj(this.root);
643
- }
644
- resolveResObj(obj) {
645
- const result = /* @__PURE__ */ new Map();
646
- for (const [key, val] of obj.fields) {
647
- this.resolvingFieldPath.push(key);
648
- const fullCacheKey = stringSegmentsToKey(this.resolvingFieldPath);
649
- this.cache.delete(fullCacheKey);
650
- let resolved;
651
- try {
652
- resolved = this.resolveVal(val, obj);
653
- } finally {
654
- this.resolvingFieldPath.pop();
655
- }
656
- if (resolved !== void 0) {
657
- if (resolved.kind === "object") {
658
- const prior = obj.priorValues.get(key);
659
- if (prior !== void 0) {
660
- const priorResolved = this.resolveVal(prior, obj);
661
- if (priorResolved !== void 0 && priorResolved.kind === "object") {
662
- const finalValue = deepMergeHoconValues(
663
- priorResolved,
664
- resolved
665
- );
666
- result.set(key, finalValue);
667
- this.cache.set(fullCacheKey, finalValue);
668
- this.cacheDescendants(fullCacheKey, finalValue);
669
- continue;
670
- }
671
- }
672
- }
673
- result.set(key, resolved);
674
- this.cache.set(fullCacheKey, resolved);
675
- this.cacheDescendants(fullCacheKey, resolved);
676
- } else {
677
- const prior = obj.priorValues.get(key);
678
- if (prior !== void 0) {
679
- const priorResolved = this.resolveVal(prior, obj);
680
- if (priorResolved !== void 0) {
681
- result.set(key, priorResolved);
682
- this.cache.set(fullCacheKey, priorResolved);
683
- this.cacheDescendants(fullCacheKey, priorResolved);
684
- }
685
- }
686
- }
687
- }
688
- return { kind: "object", fields: result };
689
- }
690
- cacheDescendants(prefix, value) {
691
- if (value.kind !== "object") return;
692
- for (const [key, child] of value.fields) {
693
- const childKey = `${prefix}.${stringSegmentsToKey([key])}`;
694
- this.cache.set(childKey, child);
695
- this.cacheDescendants(childKey, child);
696
- }
697
- }
698
- resolveVal(v, scope) {
699
- if (isSubst(v)) return this.resolveSubst(v, scope);
700
- if (isConcat(v)) {
701
- this.resolvingConcats.add(v);
702
- try {
703
- const concatResult = this.resolveConcat(v.nodes, scope, v.line, v.col);
704
- return concatResult;
705
- } finally {
706
- this.resolvingConcats.delete(v);
707
- }
708
- }
709
- if (isResObj(v)) return this.resolveResObj(v);
710
- const hv = v;
711
- if (hv.kind === "array") {
712
- return {
713
- kind: "array",
714
- items: hv.items.map(
715
- (item) => this.resolveVal(item, scope) ?? { kind: "scalar", raw: "null", valueType: "null" }
716
- )
717
- };
718
- }
719
- return hv;
720
- }
721
- resolveSubst(s, scope) {
722
- if (s.knownAbsent) return void 0;
723
- const key = s.listSuffix ? `${segmentsToKey(s.segments)}[]` : segmentsToKey(s.segments);
724
- if (this.cache.has(key)) return this.cache.get(key);
725
- if (this.resolving.has(key)) {
726
- let prior;
727
- if (s.segments.length > 1) {
728
- const leafSeg = s.segments[s.segments.length - 1]?.text ?? "";
729
- const parentScope = lookupResObj(
730
- this.root,
731
- s.segments.slice(0, s.segments.length - 1)
732
- );
733
- prior = parentScope?.priorValues.get(leafSeg);
734
- } else {
735
- const rootSeg = s.segments[0]?.text ?? "";
736
- prior = scope.priorValues.get(rootSeg) ?? this.root.priorValues.get(rootSeg);
737
- }
738
- if (prior !== void 0) {
739
- const saved = this.resolving;
740
- this.resolving = new Set(saved);
741
- try {
742
- return this.resolveVal(prior, scope);
743
- } finally {
744
- this.resolving = saved;
745
- }
746
- }
747
- if (s.optional) return void 0;
748
- throw new ResolveError(
749
- this.originPrefix() + `circular substitution: ${key}`,
750
- key,
751
- s.line,
752
- s.col
753
- );
754
- }
755
- this.resolving.add(key);
756
- try {
757
- const found = lookupPath(this.root, s.segments);
758
- if (found !== void 0) {
759
- const rfp = this.resolvingFieldPath;
760
- const isOwner = rfp.length >= s.segments.length && s.segments.every((seg, i) => rfp[i] === seg.text);
761
- const isSelfRef = isConcat(found) && this.resolvingConcats.has(found) || isOwner && containsSubstByPath(found, s.segments);
762
- if (isSelfRef) {
763
- let prior;
764
- if (s.segments.length > 1) {
765
- const leafSeg = s.segments[s.segments.length - 1]?.text ?? "";
766
- const parentScope = lookupResObj(
767
- this.root,
768
- s.segments.slice(0, s.segments.length - 1)
769
- );
770
- prior = parentScope?.priorValues.get(leafSeg);
771
- } else {
772
- const rootSeg = s.segments[0]?.text ?? "";
773
- prior = scope.priorValues.get(rootSeg) ?? this.root.priorValues.get(rootSeg);
774
- }
775
- if (prior !== void 0) {
776
- const result2 = this.resolveVal(prior, scope);
777
- if (result2 !== void 0) this.cache.set(key, result2);
778
- return result2;
779
- }
780
- if (s.optional) return void 0;
781
- throw new ResolveError(
782
- `${this.originPrefix()}could not resolve substitution: \${${key}}`,
783
- key,
784
- s.line,
785
- s.col
786
- );
787
- }
788
- let result = this.resolveVal(found, scope);
789
- const effectiveLen = s.segments.length - s.prefixLen;
790
- if (effectiveLen === 1 && result !== void 0 && result.kind === "object") {
791
- const leafSeg = s.segments[s.segments.length - 1]?.text ?? "";
792
- let prior;
793
- if (s.prefixLen > 0) {
794
- const parentScope = lookupResObj(
795
- this.root,
796
- s.segments.slice(0, s.segments.length - 1)
797
- );
798
- prior = parentScope?.priorValues.get(leafSeg);
799
- } else {
800
- prior = scope.priorValues.get(leafSeg) ?? this.root.priorValues.get(leafSeg);
801
- }
802
- if (prior !== void 0) {
803
- const priorResolved = this.resolveVal(prior, scope);
804
- if (priorResolved !== void 0 && priorResolved.kind === "object") {
805
- result = deepMergeHoconValues(
806
- priorResolved,
807
- result
808
- );
809
- }
810
- }
811
- }
812
- if (result !== void 0) this.cache.set(key, result);
813
- return result;
814
- }
815
- if (s.prefixLen > 0 && s.segments.length > s.prefixLen) {
816
- const originalSegments = s.segments.slice(s.prefixLen);
817
- const fallbackFound = lookupPath(this.root, originalSegments);
818
- if (fallbackFound !== void 0) {
819
- let result = this.resolveVal(fallbackFound, scope);
820
- if (originalSegments.length === 1 && result !== void 0 && result.kind === "object") {
821
- const rootSeg = originalSegments[0]?.text ?? "";
822
- const prior = this.root.priorValues.get(rootSeg);
823
- if (prior !== void 0) {
824
- const priorResolved = this.resolveVal(prior, scope);
825
- if (priorResolved !== void 0 && priorResolved.kind === "object") {
826
- result = deepMergeHoconValues(
827
- priorResolved,
828
- result
829
- );
830
- }
831
- }
832
- }
833
- if (result !== void 0) this.cache.set(key, result);
834
- return result;
835
- }
836
- }
837
- if (s.listSuffix && this.opts.useSystemEnvironment !== false) {
838
- const result = this.resolveEnvList(s);
839
- if (result !== void 0) {
840
- this.cache.set(key, result);
841
- return result;
842
- }
843
- if (s.optional) return void 0;
844
- const envBase = s.segments.map((seg) => seg.text).join(".");
845
- throw new ResolveError(
846
- `${this.originPrefix()}could not resolve substitution: \${${key}} (no environment variables ${envBase}_0, ${envBase}_1, \u2026 set)`,
847
- key,
848
- s.line,
849
- s.col
850
- );
851
- } else if (s.listSuffix) {
852
- if (s.optional) return void 0;
853
- if (this.opts.allowUnresolved) return s;
854
- throw new ResolveError(
855
- `${this.originPrefix()}could not resolve substitution: \${${key}}`,
856
- key,
857
- s.line,
858
- s.col
859
- );
860
- }
861
- if (this.opts.useSystemEnvironment !== false) {
862
- const envKey = s.segments.map((seg) => seg.text).join(".");
863
- const envVal = this.opts.env[envKey] ?? (s.prefixLen > 0 ? this.opts.env[s.segments.slice(s.prefixLen).map((seg) => seg.text).join(".")] : void 0);
864
- if (envVal !== void 0) {
865
- const result = { kind: "scalar", raw: envVal, valueType: "string" };
866
- this.cache.set(key, result);
867
- return result;
868
- }
869
- }
870
- if (s.optional) return void 0;
871
- if (this.opts.allowUnresolved) {
872
- return s;
873
- }
874
- throw new ResolveError(
875
- `${this.originPrefix()}could not resolve substitution: \${${key}}`,
876
- key,
877
- s.line,
878
- s.col
879
- );
880
- } finally {
881
- this.resolving.delete(key);
882
- }
883
- }
884
- /**
885
- * S13c: scan environment for NAME_0, NAME_1, … and return an Array<Scalar(String)>.
886
- *
887
- * Candidate bases follow the same fully-qualified→bare order used by the scalar
888
- * env fallback. The first base whose _0 key is present wins entirely — no
889
- * cross-base merging (spec §Relativized fallback precedence rules).
890
- *
891
- * Returns the HoconValue Array if any candidate base has _0, or undefined if
892
- * none do (caller applies optional/required handling).
893
- */
894
- resolveEnvList(s) {
895
- const bases = this.candidateBases(s);
896
- for (const base of bases) {
897
- const key0 = base + "_0";
898
- if (!(key0 in this.opts.env)) continue;
899
- const items = [];
900
- for (let i = 0; ; i++) {
901
- const k = base + "_" + i;
902
- if (!(k in this.opts.env)) break;
903
- items.push({ kind: "scalar", raw: this.opts.env[k], valueType: "string" });
904
- }
905
- return { kind: "array", items };
906
- }
907
- return void 0;
908
- }
909
- /**
910
- * Return the candidate base names for env-var-list lookup, in precedence order.
911
- * Mirrors the fully-qualified→bare fallback used by the scalar env path.
912
- */
913
- candidateBases(s) {
914
- const full = s.segments.map((seg) => seg.text).join(".");
915
- if (s.prefixLen === 0) return [full];
916
- const bare = s.segments.slice(s.prefixLen).map((seg) => seg.text).join(".");
917
- return [full, bare];
918
- }
919
- resolveConcat(nodes, scope, line = 0, col = 0) {
920
- const rawResolved = nodes.map((n) => this.resolveVal(n, scope));
921
- if (this.opts.allowUnresolved) {
922
- for (const v of rawResolved) {
923
- if (v !== void 0 && isSubst(v)) {
924
- return v;
925
- }
926
- }
927
- }
928
- const resolved = rawResolved.filter((v) => v !== void 0);
929
- if (resolved.length === 0) return void 0;
930
- if (resolved.length === 1) return resolved[0];
931
- const nonSep = resolved.filter((v) => !separatorValues.has(v));
932
- if (nonSep.length === 0) {
933
- const str = resolved.map((v) => v.kind === "scalar" ? v.raw : JSON.stringify(v)).join("");
934
- return { kind: "scalar", raw: str, valueType: "string" };
935
- }
936
- const joinPair = (left, right) => {
937
- if (left.kind === "object" && right.kind === "object") {
938
- return deepMergeHoconValues(left, right);
939
- }
940
- if (left.kind === "array" && right.kind === "object") {
941
- const converted = numericObjectToArray(right);
942
- if (converted !== null) {
943
- return { kind: "array", items: [...left.items, ...converted] };
944
- }
945
- throw new ResolveError(
946
- "cannot concatenate array with object: value concatenation requires same-kind operands (S10.4)",
947
- "",
948
- line,
949
- col
950
- );
951
- }
952
- if (left.kind === "object" && right.kind === "array") {
953
- const converted = numericObjectToArray(left);
954
- if (converted !== null) {
955
- return { kind: "array", items: [...converted, ...right.items] };
956
- }
957
- throw new ResolveError(
958
- "cannot concatenate object with array: value concatenation requires same-kind operands (S10.4)",
959
- "",
960
- line,
961
- col
962
- );
963
- }
964
- if (left.kind === "array" && right.kind === "array") {
965
- return { kind: "array", items: [...left.items, ...right.items] };
966
- }
967
- if (left.kind === "array" || right.kind === "array") {
968
- throw new ResolveError(
969
- `cannot concatenate ${left.kind} with ${right.kind}: arrays and objects may not appear in string value concatenation (S10.13)`,
970
- "",
971
- line,
972
- col
973
- );
974
- }
975
- if (left.kind === "object" || right.kind === "object") {
976
- throw new ResolveError(
977
- `cannot concatenate ${left.kind} with ${right.kind}: arrays and objects may not appear in string value concatenation (S10.13)`,
978
- "",
979
- line,
980
- col
981
- );
982
- }
983
- return { kind: "scalar", raw: left.raw + right.raw, valueType: "string" };
984
- };
985
- const [head, ...tail] = nonSep;
986
- const folded = tail.reduce(joinPair, head);
987
- if (folded.kind === "scalar") {
988
- const str = resolved.map((v) => v.kind === "scalar" ? v.raw : JSON.stringify(v)).join("");
989
- return { kind: "scalar", raw: str, valueType: "string" };
990
- }
991
- return folded;
992
- }
993
- };
994
6
 
995
- // src/internal/resolver/resolver.ts
996
- function resolveTree(tree, opts) {
997
- return new SubstitutionResolver(tree, opts).resolve();
998
- }
999
- function containsPlaceholders(tree) {
1000
- for (const val of tree.fields.values()) {
1001
- if (valContainsPlaceholders(val)) return true;
1002
- }
1003
- return false;
1004
- }
1005
- function valContainsPlaceholders(v) {
1006
- const rv = v;
1007
- if (isSubst(rv) || isConcat(rv)) return true;
1008
- if (isResObj(rv)) return containsPlaceholders(rv);
1009
- const hv = v;
1010
- if (hv?.kind === "array") {
1011
- return hv.items.some((item) => valContainsPlaceholders(item));
1012
- }
1013
- return false;
1014
- }
1015
- function buildPartialHoconFromResObj(tree) {
1016
- const fields = /* @__PURE__ */ new Map();
1017
- for (const [k, v] of tree.fields) {
1018
- if (!isSubst(v) && !isConcat(v)) {
1019
- if (isResObj(v)) {
1020
- fields.set(k, buildPartialHoconFromResObj(v));
1021
- } else {
1022
- if (!valContainsPlaceholders(v)) {
1023
- fields.set(k, v);
1024
- }
1025
- }
1026
- }
1027
- }
1028
- return { kind: "object", fields };
1029
- }
1030
- function hoconValueToResObj2(value) {
1031
- const obj = makeResObj();
1032
- for (const [k, v] of value.fields) {
1033
- if (v.kind === "object") {
1034
- obj.fields.set(k, hoconValueToResObj2(v));
1035
- } else {
1036
- obj.fields.set(k, v);
1037
- }
1038
- }
1039
- return obj;
1040
- }
1041
7
 
1042
- // src/config.ts
1043
- var Config = class _Config {
1044
- constructor(root, opts) {
1045
- this.root = root;
1046
- this._resolved = opts?.resolved ?? true;
1047
- this._parseBaseDir = opts?.parseBaseDir;
1048
- this._originDescription = opts?.originDescription;
1049
- this._resObjRoot = opts?.resObjRoot;
1050
- this._resolveOpts = opts?.resolveOpts;
1051
- }
1052
- /** Returns true when the Config's value tree contains no unresolved
1053
- * substitution placeholders. Whole-config granularity (E12 decision 11). */
1054
- isResolved() {
1055
- return this._resolved;
1056
- }
1057
- /** @internal Test-only: construct a resolved Config from a HoconValue. */
1058
- static _fromResolvedValue(root, opts) {
1059
- return new _Config(root, { resolved: true, originDescription: opts?.originDescription });
1060
- }
1061
- /** @internal Construct an unresolved Config carrying a ResObj tree.
1062
- * Used by parseStringWithOptions (deferred path) in T6. */
1063
- static _fromUnresolvedResObj(tree, opts) {
1064
- const partialRoot = buildPartialHoconFromResObj(tree);
1065
- return new _Config(partialRoot, {
1066
- resolved: opts.resolved,
1067
- parseBaseDir: opts.parseBaseDir,
1068
- originDescription: opts.originDescription,
1069
- resObjRoot: tree,
1070
- resolveOpts: opts.resolveOpts
1071
- });
1072
- }
1073
- get(path) {
1074
- const v = this.lookupNode(path);
1075
- if (v === void 0) return void 0;
1076
- return hoconToJs(v);
1077
- }
1078
- /**
1079
- * Returns the raw {@link HoconValue} node at `path` as a deeply-immutable
1080
- * {@link ReadonlyHoconValue} view, or `undefined` if the path is absent. Unlike
1081
- * `get` (which decodes to a plain JS value), this exposes the value tree for
1082
- * structural introspection via the `value.ts` accessors (`asString`, `asObject`,
1083
- * `isScalar`, …).
1084
- *
1085
- * `getValue('')` returns the root object node.
1086
- *
1087
- * Throws {@link NotResolvedError} when the node (or its subtree) is unresolved:
1088
- * the `HoconValue` union has no placeholder variant, so an unresolved value
1089
- * cannot be represented. This matches `getConfig` / `getList`.
1090
- */
1091
- getValue(path) {
1092
- const v = this.lookupNode(path);
1093
- if (v === void 0) {
1094
- if (!this._resolved && this._resObjRootSubtreeHasPlaceholders(path)) {
1095
- throw new NotResolvedError(path);
1096
- }
1097
- return void 0;
1098
- }
1099
- if (v.kind !== "scalar" && !this._resolved && this._resObjRootSubtreeHasPlaceholders(path)) {
1100
- throw new NotResolvedError(path);
1101
- }
1102
- return v;
1103
- }
1104
- getString(path) {
1105
- const v = this.requireScalar(path);
1106
- if (v.valueType === "null") {
1107
- throw new ConfigError(`expected string at ${path}, got ${v.valueType}`, path);
1108
- }
1109
- return v.raw;
1110
- }
1111
- getNumber(path) {
1112
- const v = this.requireScalar(path);
1113
- const coerced = coerceNumber(v.raw);
1114
- if (coerced !== void 0) return coerced;
1115
- throw new ConfigError(`expected number at ${path}, got ${v.valueType}`, path);
1116
- }
1117
- getBoolean(path) {
1118
- const v = this.requireScalar(path);
1119
- const coerced = coerceBoolean(v.raw);
1120
- if (coerced !== void 0) return coerced;
1121
- throw new ConfigError(`expected boolean at ${path}, got ${v.valueType}`, path);
1122
- }
1123
- getDuration(path, unit) {
1124
- const v = this.requireScalar(path);
1125
- if (v.valueType !== "string" && v.valueType !== "number") {
1126
- throw new ConfigError(`expected duration at ${path}, got ${v.valueType}`, path);
1127
- }
1128
- const result = parseDuration(v.raw, unit);
1129
- if (Number.isNaN(result)) throw new ConfigError(`invalid duration at ${path}: ${JSON.stringify(v.raw)}`, path);
1130
- return result;
1131
- }
1132
- getBytes(path, unit) {
1133
- const v = this.requireScalar(path);
1134
- if (v.valueType !== "string" && v.valueType !== "number") {
1135
- throw new ConfigError(`expected byte size at ${path}, got ${v.valueType}`, path);
1136
- }
1137
- const result = parseBytes(v.raw, unit);
1138
- if (Number.isNaN(result)) throw new ConfigError(`invalid byte size at ${path}: ${JSON.stringify(v.raw)}`, path);
1139
- if (result < 0) throw new ConfigError(`byte size must be non-negative at ${path}: ${JSON.stringify(v.raw)}`, path);
1140
- return result;
1141
- }
1142
- getConfig(path) {
1143
- const v = this.lookupNode(path);
1144
- if (v === void 0) {
1145
- if (!this._resolved && this._resObjRootSubtreeHasPlaceholders(path)) {
1146
- throw new NotResolvedError(path);
1147
- }
1148
- throw new ConfigError(`path not found: ${path}`, path);
1149
- }
1150
- if (v.kind !== "object") throw new ConfigError(`expected object at ${path}`, path);
1151
- if (!this._resolved && this._resObjRootSubtreeHasPlaceholders(path)) {
1152
- throw new NotResolvedError(path);
1153
- }
1154
- return new _Config(v, { resolved: this._resolved });
1155
- }
1156
- getList(path) {
1157
- const v = this.lookupNode(path);
1158
- if (v === void 0) {
1159
- if (!this._resolved && this._resObjRootSubtreeHasPlaceholders(path)) {
1160
- throw new NotResolvedError(path);
1161
- }
1162
- throw new ConfigError(`path not found: ${path}`, path);
1163
- }
1164
- if (!this._resolved && this._resObjRootSubtreeHasPlaceholders(path)) {
1165
- throw new NotResolvedError(path);
1166
- }
1167
- if (v.kind === "object") {
1168
- const converted = numericObjectToArray(v);
1169
- if (converted !== null) return converted.map((item) => hoconToJs(item));
1170
- }
1171
- if (v.kind !== "array") throw new ConfigError(`expected array at ${path}`, path);
1172
- return v.items.map((item) => hoconToJs(item));
1173
- }
1174
- has(path) {
1175
- return this.lookupNode(path) !== void 0;
1176
- }
1177
- keys() {
1178
- return [...this.root.fields.keys()];
1179
- }
1180
- withFallback(fallback) {
1181
- if (fallback == null) return this;
1182
- const selfTree = this._resObjRoot ?? hoconValueToResObj2(this.root);
1183
- const fbTree = fallback._resObjRoot ?? hoconValueToResObj2(fallback.root);
1184
- const merged = mergeUnresolved(selfTree, fbTree);
1185
- const hasPlaceholders = containsPlaceholders(merged);
1186
- const partialRoot = buildPartialHoconFromResObj(merged);
1187
- return new _Config(partialRoot, {
1188
- resolved: !hasPlaceholders,
1189
- parseBaseDir: this._parseBaseDir,
1190
- originDescription: this._originDescription,
1191
- resObjRoot: merged,
1192
- resolveOpts: this._resolveOpts ?? fallback._resolveOpts
1193
- });
1194
- }
1195
- /**
1196
- * Runs substitution resolution (phase 2) on the stored unresolved tree.
1197
- * Idempotent: calling resolve() on an already-resolved Config returns an
1198
- * equivalent resolved Config.
1199
- *
1200
- * opts.allowUnresolved (default false) — when true, leaves unresolved
1201
- * non-optional placeholders in place rather than throwing.
1202
- * opts.useSystemEnvironment (default true) — when false, env var lookups
1203
- * are suppressed (hermetic resolution).
1204
- *
1205
- * E12 decision 3.
1206
- */
1207
- resolve(opts = {}) {
1208
- if (this._resolved) {
1209
- return new _Config(this.root, {
1210
- resolved: true,
1211
- parseBaseDir: this._parseBaseDir,
1212
- originDescription: this._originDescription
1213
- });
1214
- }
1215
- const tree = this._resObjRoot;
1216
- if (!tree) {
1217
- return new _Config(this.root, { resolved: true });
1218
- }
1219
- const resolveOpts = {
1220
- ...this._resolveOpts ?? { env: {}, baseDir: void 0, readFileSync: () => {
1221
- throw new Error("no files");
1222
- } },
1223
- allowUnresolved: opts.allowUnresolved ?? false,
1224
- useSystemEnvironment: opts.useSystemEnvironment ?? true,
1225
- originDescription: this._originDescription
1226
- };
1227
- const resolved = resolveTree(tree, resolveOpts);
1228
- if (resolved.kind !== "object") throw new Error("resolve: expected object root");
1229
- if (opts.allowUnresolved) {
1230
- const { stripped, hadPlaceholders } = stripPlaceholderFields(resolved);
1231
- return new _Config(stripped, {
1232
- resolved: !hadPlaceholders,
1233
- parseBaseDir: this._parseBaseDir,
1234
- originDescription: this._originDescription,
1235
- resObjRoot: hadPlaceholders ? tree : void 0,
1236
- resolveOpts: hadPlaceholders ? resolveOpts : void 0
1237
- });
1238
- }
1239
- return new _Config(resolved, {
1240
- resolved: true,
1241
- parseBaseDir: this._parseBaseDir,
1242
- originDescription: this._originDescription
1243
- });
1244
- }
1245
- /**
1246
- * Resolves receiver substitutions using source as lookup context.
1247
- * Source's keys are NOT merged into the result — differs from
1248
- * `this.withFallback(source).resolve()` which includes source keys.
1249
- *
1250
- * Precondition (E12 decision 10): source must be resolved. If
1251
- * source.isResolved() is false, throws NotResolvedError.
1252
- *
1253
- * On an already-resolved receiver, resolveWith is a no-op (returns an
1254
- * equivalent resolved Config, source keys not included).
1255
- *
1256
- * E12 decisions 9, 10.
1257
- */
1258
- resolveWith(source, opts = {}) {
1259
- if (!source.isResolved()) {
1260
- throw new NotResolvedError("source");
1261
- }
1262
- if (this._resolved) {
1263
- return new _Config(this.root, {
1264
- resolved: true,
1265
- parseBaseDir: this._parseBaseDir,
1266
- originDescription: this._originDescription
1267
- });
1268
- }
1269
- const receiverTree = this._resObjRoot ?? hoconValueToResObj2(this.root);
1270
- const srcTree = hoconValueToResObj2(source.root);
1271
- const merged = mergeUnresolved(receiverTree, srcTree);
1272
- const resolveOpts = {
1273
- ...this._resolveOpts ?? { env: {}, baseDir: void 0, readFileSync: () => {
1274
- throw new Error("no files");
1275
- } },
1276
- allowUnresolved: opts.allowUnresolved ?? false,
1277
- useSystemEnvironment: opts.useSystemEnvironment ?? true,
1278
- originDescription: this._originDescription
1279
- };
1280
- const resolved = resolveTree(merged, resolveOpts);
1281
- if (resolved.kind !== "object") throw new Error("resolveWith: expected object root");
1282
- const receiverShapeForFilter = resObjToKeyShape(receiverTree);
1283
- const filtered = filterByReceiverShape(resolved, receiverShapeForFilter);
1284
- if (opts.allowUnresolved) {
1285
- const { stripped, hadPlaceholders } = stripPlaceholderFields(filtered);
1286
- return new _Config(stripped, {
1287
- resolved: !hadPlaceholders,
1288
- parseBaseDir: this._parseBaseDir,
1289
- originDescription: this._originDescription,
1290
- resObjRoot: hadPlaceholders ? receiverTree : void 0,
1291
- resolveOpts: hadPlaceholders ? resolveOpts : void 0
1292
- });
1293
- }
1294
- return new _Config(filtered, {
1295
- resolved: true,
1296
- parseBaseDir: this._parseBaseDir,
1297
- originDescription: this._originDescription
1298
- });
1299
- }
1300
- /**
1301
- * The whole config as plain JS data: objects, arrays, strings, numbers,
1302
- * booleans and `null`.
1303
- *
1304
- * Keys are reproduced exactly as the config carries them, `__proto__`,
1305
- * `constructor` and `prototype` included: each is defined as an **own data
1306
- * property**, so the returned object's prototype is always
1307
- * `Object.prototype`, and this call writes nothing to the global one.
1308
- *
1309
- * ### Passing the result to other code
1310
- *
1311
- * A config file — especially a `.properties` file or an env namespace you
1312
- * merged in — can therefore hand you an own `__proto__` key, and what happens
1313
- * next depends entirely on how the consumer copies it:
1314
- *
1315
- * ```ts
1316
- * const data = cfg.toObject()
1317
- * { ...data } // safe — own properties are copied as data
1318
- * structuredClone(data) // safe
1319
- * Object.assign({}, data) // NOT safe — [[Set]] on the {} target hits
1320
- * // Object.prototype's __proto__ setter: the key
1321
- * // vanishes and config data becomes the result's
1322
- * // prototype
1323
- * deepMerge({}, data) // NOT safe — a naive recursive merge reads
1324
- * // target['__proto__'], gets Object.prototype,
1325
- * // and writes to it: global pollution
1326
- * for (const k in data) … // prefer Object.entries / Object.keys
1327
- * ```
1328
- *
1329
- * Those two hazards come from the **destination** object's prototype, so no
1330
- * option here can disarm them — copy with spread or `structuredClone` instead.
1331
- *
1332
- * What `{ nullPrototype: true }` does give you is a result that inherits
1333
- * nothing: every object comes back with a `null` prototype, so reading
1334
- * `x.__proto__`, `x.constructor` or `x.toString` yields config data or
1335
- * `undefined` rather than something from `Object.prototype`, and code that
1336
- * merges *into* this object cannot climb out of it. Keys are all still
1337
- * present. The trade-off is the usual one for prototype-less objects: not
1338
- * `instanceof Object`, and no `hasOwnProperty` of their own.
1339
- *
1340
- * Numbers follow the JS number model, so an integer wider than 2^53 rounds
1341
- * here even when the config holds it exactly — read those with
1342
- * {@link Config.getString} instead.
1343
- */
1344
- toObject(opts) {
1345
- return hoconToJs(this.root, opts?.nullPrototype === true);
1346
- }
1347
- /**
1348
- * @internal Test-only: renders this resolved Config's value tree as canonical
1349
- * JSON (sorted keys, no whitespace). Used by Layer-2 fixture tests to compare
1350
- * against Lightbend ground truth. NOT part of the public API.
1351
- *
1352
- * Throws if the Config is unresolved (contains placeholders).
1353
- */
1354
- _renderJSONForTest() {
1355
- return renderHoconAsJSON(this.root);
1356
- }
1357
- lookupNode(path) {
1358
- const segments = splitConfigPath(path);
1359
- let current = this.root;
1360
- for (const seg of segments) {
1361
- if (current.kind !== "object") return void 0;
1362
- const next = current.fields.get(seg);
1363
- if (next === void 0) return void 0;
1364
- current = next;
1365
- }
1366
- return current;
1367
- }
1368
- /**
1369
- * _resObjRootSubtreeHasPlaceholders — walk _resObjRoot to the given path and
1370
- * return true if the subtree there contains any unresolved placeholder.
1371
- * Used by getConfig / getList (T2) to detect transitive unresolved placeholders
1372
- * in object / array subtrees that would otherwise appear to be "resolved" in the
1373
- * partial HoconValue root (because individual leaf fields are omitted rather than
1374
- * the whole subtree when their value is a direct placeholder scalar, but object
1375
- * sub-containers are retained in the partial root with the placeholder-keyed
1376
- * fields omitted from them — so the object appears "present but empty-ish").
1377
- */
1378
- _resObjRootSubtreeHasPlaceholders(path) {
1379
- const tree = this._resObjRoot;
1380
- if (!tree) return false;
1381
- const segments = splitConfigPath(path);
1382
- let cur = tree;
1383
- for (const seg of segments) {
1384
- const val = cur.fields.get(seg);
1385
- if (val === void 0) return false;
1386
- if (isResObj(val)) {
1387
- cur = val;
1388
- } else {
1389
- return valContainsPlaceholders(val);
1390
- }
1391
- }
1392
- return containsPlaceholders(cur);
1393
- }
1394
- requireScalar(path) {
1395
- const v = this.lookupNode(path);
1396
- if (v === void 0) {
1397
- if (!this._resolved && this._resObjRootSubtreeHasPlaceholders(path)) {
1398
- throw new NotResolvedError(path);
1399
- }
1400
- throw new ConfigError(`path not found: ${path}`, path);
1401
- }
1402
- if (v.kind !== "scalar") throw new ConfigError(`expected scalar at ${path}, got ${v.kind}`, path);
1403
- return v;
1404
- }
1405
- };
1406
- function splitConfigPath(path) {
1407
- const segments = [];
1408
- let i = 0;
1409
- while (i < path.length) {
1410
- if (path[i] === '"') {
1411
- i++;
1412
- let segment = "";
1413
- let closed = false;
1414
- while (i < path.length) {
1415
- const ch = path[i];
1416
- if (ch === "\\" && i + 1 < path.length) {
1417
- const next = path[i + 1];
1418
- segment += next;
1419
- i += 2;
1420
- continue;
1421
- }
1422
- if (ch === '"') {
1423
- closed = true;
1424
- i++;
1425
- break;
1426
- }
1427
- segment += ch;
1428
- i++;
1429
- }
1430
- if (!closed) throw new ConfigError(`unterminated quoted path segment: ${path}`, path);
1431
- segments.push(segment);
1432
- if (i < path.length && path[i] === ".") i++;
1433
- } else {
1434
- const dot = path.indexOf(".", i);
1435
- if (dot === -1) {
1436
- segments.push(path.slice(i));
1437
- break;
1438
- }
1439
- segments.push(path.slice(i, dot));
1440
- i = dot + 1;
1441
- }
1442
- }
1443
- return segments;
1444
- }
1445
- function scalarToJs(raw, valueType) {
1446
- switch (valueType) {
1447
- case "null":
1448
- return null;
1449
- case "boolean":
1450
- return raw === "true";
1451
- case "number":
1452
- return Number(raw);
1453
- case "string":
1454
- return raw;
1455
- }
1456
- }
1457
- function hoconToJs(v, nullPrototype = false) {
1458
- switch (v.kind) {
1459
- case "scalar":
1460
- return scalarToJs(v.raw, v.valueType);
1461
- case "array":
1462
- return v.items.map((item) => hoconToJs(item, nullPrototype));
1463
- case "object": {
1464
- const entries = Array.from(v.fields, ([k, val]) => [k, hoconToJs(val, nullPrototype)]);
1465
- if (nullPrototype) {
1466
- const obj = /* @__PURE__ */ Object.create(null);
1467
- for (const [k, val] of entries) Object.defineProperty(obj, k, {
1468
- value: val,
1469
- writable: true,
1470
- enumerable: true,
1471
- configurable: true
1472
- });
1473
- return obj;
1474
- }
1475
- return Object.fromEntries(entries);
1476
- }
1477
- }
1478
- }
1479
- function resObjToKeyShape(tree) {
1480
- const fields = /* @__PURE__ */ new Map();
1481
- for (const [k, v] of tree.fields) {
1482
- if (isSubst(v) || isConcat(v)) {
1483
- fields.set(k, { kind: "scalar", raw: "", valueType: "null" });
1484
- } else if (isResObj(v)) {
1485
- fields.set(k, resObjToKeyShape(v));
1486
- } else {
1487
- fields.set(k, v);
1488
- }
1489
- }
1490
- return { kind: "object", fields };
1491
- }
1492
- function stripPlaceholderFields(v) {
1493
- const fields = /* @__PURE__ */ new Map();
1494
- let hadPlaceholders = false;
1495
- for (const [k, val] of v.fields) {
1496
- if (val._kind === "subst-placeholder" || val._kind === "concat-placeholder") {
1497
- hadPlaceholders = true;
1498
- } else if (val.kind === "object") {
1499
- const inner = stripPlaceholderFields(val);
1500
- if (inner.hadPlaceholders) hadPlaceholders = true;
1501
- fields.set(k, inner.stripped);
1502
- } else {
1503
- fields.set(k, val);
1504
- }
1505
- }
1506
- return { stripped: { kind: "object", fields }, hadPlaceholders };
1507
- }
1508
- function filterByReceiverShape(resolved, receiverShape) {
1509
- const fields = /* @__PURE__ */ new Map();
1510
- for (const [k, rv] of resolved.fields) {
1511
- if (!receiverShape.fields.has(k)) continue;
1512
- const receiverVal = receiverShape.fields.get(k);
1513
- if (rv.kind === "object" && receiverVal.kind === "object") {
1514
- fields.set(k, filterByReceiverShape(rv, receiverVal));
1515
- } else {
1516
- fields.set(k, rv);
1517
- }
1518
- }
1519
- return { kind: "object", fields };
1520
- }
1521
- function renderHoconAsJSON(v) {
1522
- switch (v.kind) {
1523
- case "scalar": {
1524
- switch (v.valueType) {
1525
- case "null":
1526
- return "null";
1527
- case "boolean":
1528
- return v.raw;
1529
- case "number": {
1530
- const norm = normalizeLeadingZeroNumber(v.raw);
1531
- return JSON_NUMBER_RE.test(norm) ? norm : JSON.stringify(v.raw);
1532
- }
1533
- case "string":
1534
- return JSON.stringify(v.raw);
1535
- }
1536
- break;
1537
- }
1538
- case "array": {
1539
- const items = v.items.map(renderHoconAsJSON);
1540
- return `[${items.join(",")}]`;
1541
- }
1542
- case "object": {
1543
- const keys = [...v.fields.keys()].sort();
1544
- const pairs = keys.map((k) => {
1545
- const val = v.fields.get(k);
1546
- return `${JSON.stringify(k)}:${renderHoconAsJSON(val)}`;
1547
- });
1548
- return `{${pairs.join(",")}}`;
1549
- }
1550
- }
1551
- throw new Error(`renderHoconAsJSON: unsupported value kind (unresolved placeholder?)`);
1552
- }
1553
- var JSON_NUMBER_RE = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
1554
- function normalizeLeadingZeroNumber(raw) {
1555
- return raw.replace(/^([+-]?)0+(\d)/, "$1$2");
1556
- }
1557
8
 
1558
- // src/value-factory.ts
1559
- function fromMap(values, originDescription) {
1560
- const fields = guardStackDepth(
1561
- () => coerceObject(values, ""),
1562
- (msg) => depthError(`fromMap: ${msg}`)
1563
- );
1564
- const root = { kind: "object", fields };
1565
- return Config._fromResolvedValue(root, { originDescription });
1566
- }
1567
- var INT64_MAX = 9223372036854775807n;
1568
- var INT64_MIN = -9223372036854775808n;
1569
- function coerceObject(obj, atPath) {
1570
- const fields = /* @__PURE__ */ new Map();
1571
- for (const [k, v] of Object.entries(obj)) {
1572
- const childPath = atPath ? `${atPath}.${k}` : k;
1573
- fields.set(k, coerceValue(v, childPath));
1574
- }
1575
- return fields;
1576
- }
1577
- function coerceValue(v, atPath) {
1578
- if (v === null) {
1579
- return { kind: "scalar", raw: "null", valueType: "null" };
1580
- }
1581
- if (v === void 0) {
1582
- throw new ConfigError(
1583
- `fromMap: undefined is not a valid HOCON value at path "${atPath}"`,
1584
- atPath
1585
- );
1586
- }
1587
- switch (typeof v) {
1588
- case "string":
1589
- return { kind: "scalar", raw: v, valueType: "string" };
1590
- case "number": {
1591
- if (Number.isNaN(v) || !Number.isFinite(v)) {
1592
- throw new ConfigError(
1593
- `fromMap: ${v} is not representable in HOCON (NaN/Infinity not allowed) at path "${atPath}"`,
1594
- atPath
1595
- );
1596
- }
1597
- return { kind: "scalar", raw: Object.is(v, -0) ? "-0" : String(v), valueType: "number" };
1598
- }
1599
- case "boolean":
1600
- return { kind: "scalar", raw: v ? "true" : "false", valueType: "boolean" };
1601
- case "bigint": {
1602
- if (v > INT64_MAX || v < INT64_MIN) {
1603
- throw new ConfigError(
1604
- `fromMap: integer ${v} is out of int64 range (HOCON integers are int64; spec F0.5) at path "${atPath}"`,
1605
- atPath
1606
- );
1607
- }
1608
- return { kind: "scalar", raw: String(v), valueType: "number" };
1609
- }
1610
- case "object": {
1611
- if (Array.isArray(v)) {
1612
- const items = v.map((item, i) => coerceValue(item, `${atPath}[${i}]`));
1613
- return { kind: "array", items };
1614
- }
1615
- const fields = coerceObject(v, atPath);
1616
- return { kind: "object", fields };
1617
- }
1618
- default:
1619
- throw new ConfigError(
1620
- `fromMap: unsupported value type "${typeof v}" at path "${atPath}"`,
1621
- atPath
1622
- );
1623
- }
1624
- }
9
+ var _chunkRO4D6BH7cjs = require('../chunk-RO4D6BH7.cjs');
1625
10
 
1626
11
  // src/adapters/yaml.ts
12
+ var _yaml = require('yaml'); var _yaml2 = _interopRequireDefault(_yaml);
1627
13
  function parseYaml(input, originDescription) {
1628
- const docs = import_yaml.default.parseAllDocuments(stripBom(input), { version: "1.2", merge: true, intAsBigInt: true });
14
+ const docs = _yaml2.default.parseAllDocuments(_chunkRO4D6BH7cjs.stripBom.call(void 0, input), { version: "1.2", merge: true, intAsBigInt: true });
1629
15
  if (docs.length > 1) {
1630
- throw new ConfigError(
16
+ throw new (0, _chunkRO4D6BH7cjs.ConfigError)(
1631
17
  "yaml: multi-document streams are not supported (spec F5.7); a config is one document",
1632
18
  ""
1633
19
  );
1634
20
  }
1635
21
  const doc = docs[0];
1636
- if (doc === void 0) return fromMap({}, originDescription);
22
+ if (doc === void 0) return _chunkGBNQADHTcjs.fromMap.call(void 0, {}, originDescription);
1637
23
  if (doc.errors.length > 0) {
1638
- throw new ConfigError(`yaml: ${doc.errors[0]?.message ?? "parse error"}`, "");
24
+ throw new (0, _chunkRO4D6BH7cjs.ConfigError)(`yaml: ${_nullishCoalesce(_optionalChain([doc, 'access', _ => _.errors, 'access', _2 => _2[0], 'optionalAccess', _3 => _3.message]), () => ( "parse error"))}`, "");
1639
25
  }
1640
26
  return fromYamlValue(doc.toJS({ mapAsMap: true }), originDescription);
1641
27
  }
1642
28
  function fromYamlValue(value, originDescription) {
1643
- if (value === null || value === void 0) return fromMap({}, originDescription);
1644
- const normalized = guardStackDepth(
29
+ if (value === null || value === void 0) return _chunkGBNQADHTcjs.fromMap.call(void 0, {}, originDescription);
30
+ const normalized = _chunkRO4D6BH7cjs.guardStackDepth.call(void 0,
1645
31
  () => convert(value, ""),
1646
- (msg) => depthError(`yaml: ${msg}`)
32
+ (msg) => _chunkRO4D6BH7cjs.depthError.call(void 0, `yaml: ${msg}`)
1647
33
  );
1648
34
  if (typeof normalized !== "object" || normalized === null || Array.isArray(normalized)) {
1649
- throw new ConfigError(
35
+ throw new (0, _chunkRO4D6BH7cjs.ConfigError)(
1650
36
  `yaml: document root is ${Array.isArray(normalized) ? "an array" : typeof normalized}, but a config root must be an object (spec F0.3)`,
1651
37
  ""
1652
38
  );
1653
39
  }
1654
- return fromMap(normalized, originDescription);
40
+ return _chunkGBNQADHTcjs.fromMap.call(void 0, normalized, originDescription);
1655
41
  }
1656
42
  function convert(v, atPath) {
1657
43
  if (Array.isArray(v)) return v.map((e, i) => convert(e, `${atPath}[${i}]`));
@@ -1663,14 +49,14 @@ function convert(v, atPath) {
1663
49
  const seen = /* @__PURE__ */ new Map();
1664
50
  for (const [k, e] of v) {
1665
51
  if (k !== null && typeof k === "object") {
1666
- throw new ConfigError(
52
+ throw new (0, _chunkRO4D6BH7cjs.ConfigError)(
1667
53
  `yaml: a collection key at "${atPath}" is not usable as an object key (spec F5.3)`,
1668
54
  atPath
1669
55
  );
1670
56
  }
1671
57
  const key = String(k);
1672
58
  if (seen.has(key)) {
1673
- throw new ConfigError(
59
+ throw new (0, _chunkRO4D6BH7cjs.ConfigError)(
1674
60
  `yaml: sibling mapping keys ${keyForm(seen.get(key))} and ${keyForm(k)} both give the key "${key}"${atPath === "" ? "" : ` at "${atPath}"`}; rename one of them, because one of the two values would otherwise be lost. Quoting a non-string key helps only where that changes the key text, as 0x10 does and 1 does not (spec F5.3)`,
1675
61
  atPath
1676
62
  );
@@ -1691,7 +77,7 @@ function convert(v, atPath) {
1691
77
  );
1692
78
  }
1693
79
  if (typeof v === "number" && !Number.isFinite(v)) {
1694
- throw new ConfigError(
80
+ throw new (0, _chunkRO4D6BH7cjs.ConfigError)(
1695
81
  `yaml: ${v} at "${atPath}" is not representable in HOCON (spec F0.6)`,
1696
82
  atPath
1697
83
  );
@@ -1718,8 +104,7 @@ var MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
1718
104
  function isSafeIntegerBigInt(v) {
1719
105
  return v <= MAX_SAFE && v >= MIN_SAFE;
1720
106
  }
1721
- // Annotate the CommonJS export names for ESM import in node:
1722
- 0 && (module.exports = {
1723
- fromYamlValue,
1724
- parseYaml
1725
- });
107
+
108
+
109
+
110
+ exports.fromYamlValue = fromYamlValue; exports.parseYaml = parseYaml;