@cbortech/cbor 0.26.8 → 0.27.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.
Files changed (60) hide show
  1. package/README.ja.md +193 -28
  2. package/README.md +196 -29
  3. package/dist/ast/CborAppSeqResult.d.ts +58 -3
  4. package/dist/ast/CborArray.d.ts +2 -2
  5. package/dist/ast/CborByteString.d.ts +17 -1
  6. package/dist/ast/CborEmbeddedCBOR.d.ts +2 -2
  7. package/dist/ast/CborFloat.d.ts +2 -2
  8. package/dist/ast/CborIndefiniteByteString.d.ts +25 -1
  9. package/dist/ast/CborIndefiniteTextString.d.ts +17 -1
  10. package/dist/ast/CborItem.d.ts +340 -10
  11. package/dist/ast/CborMap.d.ts +2 -2
  12. package/dist/ast/CborNint.d.ts +1 -1
  13. package/dist/ast/CborTag.d.ts +30 -3
  14. package/dist/ast/CborTextString.d.ts +3 -2
  15. package/dist/ast/CborUint.d.ts +1 -1
  16. package/dist/ast/CborUnresolvedAppExt.d.ts +2 -2
  17. package/dist/ast/index.cjs +1 -1
  18. package/dist/ast/index.js +2 -2
  19. package/dist/cddl/index.cjs +1 -1
  20. package/dist/cddl/index.js +1 -1
  21. package/dist/cdn/index.cjs +2 -2
  22. package/dist/cdn/index.cjs.map +1 -1
  23. package/dist/cdn/index.js +18 -18
  24. package/dist/cdn/index.js.map +1 -1
  25. package/dist/cdn/serialize-utils.d.ts +237 -10
  26. package/dist/cdn/tokenizer.d.ts +12 -11
  27. package/dist/extensions/builtins.d.ts +5 -5
  28. package/dist/extensions/cri.d.ts +4 -4
  29. package/dist/extensions/dt.d.ts +4 -4
  30. package/dist/extensions/ip.d.ts +4 -4
  31. package/dist/extensions/types.d.ts +44 -5
  32. package/dist/index.cjs +3 -3
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.js +158 -158
  36. package/dist/index.js.map +1 -1
  37. package/dist/{mapEntries-Ci_dppP6.js → mapEntries-CCLaJSaJ.js} +1599 -1275
  38. package/dist/mapEntries-CCLaJSaJ.js.map +1 -0
  39. package/dist/mapEntries-CZZJScaj.cjs +13 -0
  40. package/dist/mapEntries-CZZJScaj.cjs.map +1 -0
  41. package/dist/{schema-y8G5mDIS.js → schema-DN9inJny.js} +294 -294
  42. package/dist/{schema-y8G5mDIS.js.map → schema-DN9inJny.js.map} +1 -1
  43. package/dist/schema-zsg5yCPK.cjs +63 -0
  44. package/dist/{schema-DgnkH0P6.cjs.map → schema-zsg5yCPK.cjs.map} +1 -1
  45. package/dist/serialize-utils-DhlW61ZX.cjs +37 -0
  46. package/dist/serialize-utils-DhlW61ZX.cjs.map +1 -0
  47. package/dist/{tokenizer-N-vAvRdj.js → serialize-utils-h-CVB9rg.js} +636 -358
  48. package/dist/serialize-utils-h-CVB9rg.js.map +1 -0
  49. package/dist/types.d.ts +508 -58
  50. package/dist/utils/base64.d.ts +1 -1
  51. package/dist/utils/hexfloat.d.ts +11 -3
  52. package/dist/utils/strip-comments.d.ts +1 -1
  53. package/package.json +13 -12
  54. package/dist/mapEntries-BJzyBUH5.cjs +0 -13
  55. package/dist/mapEntries-BJzyBUH5.cjs.map +0 -1
  56. package/dist/mapEntries-Ci_dppP6.js.map +0 -1
  57. package/dist/schema-DgnkH0P6.cjs +0 -63
  58. package/dist/tokenizer-BD08xbyd.cjs +0 -36
  59. package/dist/tokenizer-BD08xbyd.cjs.map +0 -1
  60. package/dist/tokenizer-N-vAvRdj.js.map +0 -1
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { CborExtension } from './extensions/types';
2
+ import { CborItem } from './ast/CborItem';
2
3
  import { CddlSchema } from './cddl/schema';
3
4
  import { ValidateOptions as CddlValidateOptions } from './cddl/validator';
4
5
  import { CddlValidationError, CddlValidationWarning } from './cddl/errors';
@@ -14,6 +15,114 @@ import { CddlValidationError, CddlValidationWarning } from './cddl/errors';
14
15
  */
15
16
  export declare const CBOR_OMIT: unique symbol;
16
17
  export type { CborExtension } from './extensions/types';
18
+ /**
19
+ * Context passed to an `itemOptions` callback (see `ToJSOptions.itemOptions`)
20
+ * describing where the node being visited sits in the tree.
21
+ */
22
+ export interface ItemContext {
23
+ /**
24
+ * The direct parent AST node. `undefined` for the root value being
25
+ * converted. A tag or app-sequence wrapper is its content's `parent` —
26
+ * see `path` for how wrappers affect addressing.
27
+ */
28
+ parent?: CborItem;
29
+ /**
30
+ * The path segment identifying this node: an array index (`number`), or a
31
+ * map key's JS value (any type — CBOR keys are not limited to strings).
32
+ * Always equal to the last element of `path`, except `undefined` for the
33
+ * root value and while converting a map key itself (`isMapKey: true`),
34
+ * since a key has no path of its own — it names its sibling value's
35
+ * segment instead. A tag or app-sequence wrapper's content inherits the
36
+ * wrapper's own `key` (and `path`) unchanged, since the wrapper adds no
37
+ * segment of its own — see `path`.
38
+ */
39
+ key?: unknown;
40
+ /**
41
+ * The map key's own AST node, present when this node is a map entry's key
42
+ * or value — but *not* inherited into a tag/app-sequence wrapper's
43
+ * content the way `key`/`path` are, so it is only reliable at the map
44
+ * entry itself. Lets a callback inspect a non-scalar key structurally
45
+ * (e.g. via `keyNode._toCDN()`) instead of relying only on `key`'s
46
+ * computed JS value.
47
+ */
48
+ keyNode?: CborItem;
49
+ /**
50
+ * `true` when this invocation is for converting a map key itself, rather
51
+ * than one of that key's sibling value's descendants.
52
+ */
53
+ isMapKey?: boolean;
54
+ /**
55
+ * Path from the root to this node, as a sequence of array indices and map
56
+ * key JS values. Empty for the root value. A tag or app-sequence wrapper
57
+ * does not add a segment of its own — its content shares the wrapper's own
58
+ * path.
59
+ */
60
+ readonly path: readonly unknown[];
61
+ /**
62
+ * The options in effect for this node going into this call — i.e. the
63
+ * root options merged with whatever overrides its ancestors already
64
+ * returned, *before* this callback's own return value is merged on top.
65
+ * Read from this to build on the current value of an option (e.g. add an
66
+ * extension to whatever list is already in effect) instead of overriding
67
+ * it outright, or to make a decision based on an option's current value.
68
+ *
69
+ * A mutable-looking field here (currently just `extensions`) is a fresh
70
+ * copy, not the live array in effect elsewhere — mutating it in place
71
+ * (e.g. `ctx.options.extensions.push(ext)`) has no effect on this node,
72
+ * its siblings, or the caller's own options; return an override instead.
73
+ *
74
+ * Has no `reviver` — its type is `ReadonlyToJSNodeOptions`, not
75
+ * `ToJSOptions` — for the same reason this callback's own return value
76
+ * can't set one:
77
+ * since this callback may run more than once for the same node (see
78
+ * `ToJSOptions.itemOptions`), always reflecting only the reviver-
79
+ * independent options keeps what it reads consistent with what it can
80
+ * write, and keeps a callback that only inspects `options` pure across
81
+ * every one of those calls.
82
+ *
83
+ * @example
84
+ * // Add `dt_as_Date` to whatever extensions are already configured,
85
+ * // rather than replacing them.
86
+ * itemOptions: (_node, ctx) => ({
87
+ * extensions: [...(ctx.options.extensions ?? []), dt_as_Date],
88
+ * })
89
+ */
90
+ readonly options: ReadonlyToJSNodeOptions;
91
+ }
92
+ /**
93
+ * `ToJSOptions` with `reviver` removed. Used wherever an API only ever
94
+ * needs to see the reviver-*independent* part of the options in effect for
95
+ * a node — an `itemOptions` callback's return value, and the `options`
96
+ * parameter of `CborExtension.toJS()` — because reviving the value a node
97
+ * converts to always happens afterwards, exactly once per visit, in the
98
+ * container holding it (see `CborArray`/`CborMap`); it is never something
99
+ * the conversion of the node itself should (or, for `CborExtension.toJS()`,
100
+ * even can) branch on. Keeping `reviver` out of both signatures — rather
101
+ * than merely documenting that it should be ignored — means neither can
102
+ * observe whether one is present, which is what makes it safe for a
103
+ * `reviver`-driven `CborArray`/`CborMap` to convert a child more than once
104
+ * (see `ToJSOptions.itemOptions`) without either one's result depending on
105
+ * *which* of those conversions it was called for.
106
+ */
107
+ export type ToJSNodeOptions = Omit<ToJSOptions, 'reviver'>;
108
+ /**
109
+ * `ToJSNodeOptions`, as handed to code that must not mutate it in place:
110
+ * `ItemContext.options` and the `options` parameter of
111
+ * `CborExtension.toJS()`. Both describe options actually in effect
112
+ * elsewhere in the tree, so mutating what's handed out here must not be
113
+ * able to reach that: reassigning a top-level property is a type error
114
+ * (`Readonly<...>`), and `extensions`, the one field on `ToJSOptions`
115
+ * that's an ordinary mutable array, is narrowed to a readonly array so an
116
+ * in-place mutation like `.push()` is one too. This only guards against
117
+ * *accidental* mutation via the type system — the implementation
118
+ * additionally hands out a fresh snapshot, with its own copy of
119
+ * `extensions`, on every call, so even a deliberate cast past this type
120
+ * can't corrupt what another node, sibling, hook, or pass sees (see
121
+ * `_toJSChild`'s `toReadonlyNodeOptions`).
122
+ */
123
+ export type ReadonlyToJSNodeOptions = Readonly<Omit<ToJSNodeOptions, 'extensions'>> & {
124
+ readonly extensions?: readonly CborExtension[];
125
+ };
17
126
  export interface ToHexDumpOptions {
18
127
  /**
19
128
  * Indentation per nesting level.
@@ -43,7 +152,7 @@ export interface ToJSOptions {
43
152
  * - `'object'`: always `Record<string, unknown>` — non-string keys are
44
153
  * converted via `String()`. Duplicate keys are overwritten (last wins).
45
154
  * - `'entries'`: always `MapEntries` (a typed `Array` subclass) — preserves all
46
- * entries including duplicate keys (§2.6.3 of draft-ietf-cbor-edn-literals-25).
155
+ * entries including duplicate keys (§2.4.2 of draft-ietf-cbor-edn-literals-27).
47
156
  * `fromJS()` recognises `MapEntries` instances and converts them back to `CborMap`.
48
157
  * @default 'auto'
49
158
  */
@@ -80,6 +189,66 @@ export interface ToJSOptions {
80
189
  * @default false
81
190
  */
82
191
  undefinedOmits?: boolean;
192
+ /**
193
+ * Extension plugins consulted during `toJS()`, tried in order for every
194
+ * node before its own default conversion. An extension takes part by
195
+ * implementing `CborExtension.toJS()`; the first one to return a result
196
+ * for a given node wins and that node's own `_toJS()` is not called.
197
+ *
198
+ * Unlike the `extensions` option on `FromCDNOptions`/`FromCBOROptions`,
199
+ * this does not affect parsing — it only lets `toJS()` reinterpret nodes
200
+ * that a *different* extension configuration already produced. For
201
+ * example, a tree parsed with the plain `dt` extension (`DT'...'` →
202
+ * `number`) can still be converted with `dt_as_Date` selected here
203
+ * (`DT'...'` → `Date`), and vice versa — see `itemOptions` below to apply
204
+ * this to only part of a tree.
205
+ *
206
+ * There is no `builtinExtensions` equivalent for `toJS()`: leaving this
207
+ * unset (the default) keeps every node's own built-in conversion
208
+ * behavior, so no bundled extension needs to be "re-added" here just to
209
+ * get default output.
210
+ */
211
+ extensions?: CborExtension[];
212
+ /**
213
+ * Called for every node during `toJS()`, before that node is converted,
214
+ * to override the options used for its subtree. Return a partial options
215
+ * object to merge over the options in effect for this node (they apply to
216
+ * this node and are inherited by its descendants, who may override them
217
+ * again); return `undefined` to make no change.
218
+ *
219
+ * This is the mechanism for applying an option — including `extensions`,
220
+ * to select a different conversion for one node without affecting its
221
+ * siblings — to only part of a document, keyed off `ctx.path` or the
222
+ * node's own shape (`item instanceof ...`).
223
+ *
224
+ * **May be called more than once for the same AST node.** With a
225
+ * `reviver` present, `CborArray`/`CborMap` convert each child at least
226
+ * twice: once (with `reviver` itself withheld from the options this
227
+ * callback sees, though its own return value is honoured as normal) to
228
+ * build a holder a `reviver` call can inspect via `this[j]` for a
229
+ * not-yet-processed sibling `j`, and once more, for real, to compute the
230
+ * value the container actually keeps — and a node several levels down
231
+ * can in principle be offered to this callback more than twice, if a
232
+ * container at some intermediate level runs a pre-population pass of its
233
+ * own while itself sitting inside an *outer* container's. Each call is
234
+ * independent and reflects only the state relevant to *that* particular
235
+ * conversion (e.g. `ctx.path` for a value under a composite map key
236
+ * shows whatever that key currently converts to, which can differ
237
+ * between an earlier, not-yet-revived call and a later one after the
238
+ * key's own `reviver` has run). Write this callback as a pure function of
239
+ * `item`/`ctx` — it must not assume, or count, how many times it runs.
240
+ *
241
+ * @example
242
+ * // Convert only `date1` with `dt_as_Date`, leaving other DT values as
243
+ * // the epoch numbers the tree was originally parsed with.
244
+ * item.toJS({
245
+ * itemOptions: (node, ctx) =>
246
+ * ctx.path.length === 1 && ctx.path[0] === 'date1'
247
+ * ? { extensions: [dt_as_Date] }
248
+ * : undefined,
249
+ * });
250
+ */
251
+ itemOptions?: (item: CborItem, ctx: ItemContext) => Partial<ToJSNodeOptions> | undefined;
83
252
  }
84
253
  export interface ToCBOROptions {
85
254
  }
@@ -165,7 +334,7 @@ export interface FromCBOROptions {
165
334
  */
166
335
  extensions?: CborExtension[];
167
336
  /**
168
- * Override the default set of bundled application-oriented extensions
337
+ * Override the default set of bundled app-extensions
169
338
  * (`dt`, `ip`, `cri`, `t1`, `b1`, `ilbs`, `ilts`, `float`).
170
339
  *
171
340
  * - omitted (default): use the standard bundled set.
@@ -173,13 +342,13 @@ export interface FromCBOROptions {
173
342
  * - `false`: disable all of them.
174
343
  *
175
344
  * `bignum` (tags 2/3) and embedded-CBOR (tag 24) support are core RFC 8949
176
- * representation features, not application-oriented extensions, and are
177
- * always active regardless of this option.
345
+ * representation features, not app-extensions, and are always active
346
+ * regardless of this option.
178
347
  *
179
- * `dt`, `ip`, `t1`, and `b1` are mandatory-to-implement per §2.1 of
180
- * draft-ietf-cbor-edn-literals-26; disabling them produces a decoder that
348
+ * `dt`, `ip`, `t1`, and `b1` are mandatory-to-implement per §3 of
349
+ * draft-ietf-cbor-edn-literals-27; disabling them produces a decoder that
181
350
  * no longer conforms to that recommendation. This is intended for
182
- * allowlisting scenarios (see §7 Security considerations of the same
351
+ * allowlisting scenarios (see §8 Security considerations of the same
183
352
  * draft) where an application wants explicit control over which
184
353
  * extensions it accepts.
185
354
  */
@@ -254,7 +423,7 @@ export interface FromHexDumpOptions {
254
423
  */
255
424
  extensions?: CborExtension[];
256
425
  /**
257
- * Override the default set of bundled application-oriented extensions.
426
+ * Override the default set of bundled app-extensions.
258
427
  * Mirrors `FromCBOROptions.builtinExtensions`.
259
428
  */
260
429
  builtinExtensions?: CborExtension[] | false;
@@ -332,7 +501,7 @@ export interface FromCDNOptions {
332
501
  */
333
502
  extensions?: CborExtension[];
334
503
  /**
335
- * Override the default set of bundled application-oriented extensions
504
+ * Override the default set of bundled app-extensions
336
505
  * (`dt`, `ip`, `cri`, `t1`, `b1`, `ilbs`, `ilts`, `float`).
337
506
  *
338
507
  * - omitted (default): use the standard bundled set.
@@ -340,10 +509,10 @@ export interface FromCDNOptions {
340
509
  * - `false`: disable all of them; app-string literals using their
341
510
  * prefixes then fall through to `unresolvedExtension` handling.
342
511
  *
343
- * `dt`, `ip`, `t1`, and `b1` are mandatory-to-implement per §2.1 of
344
- * draft-ietf-cbor-edn-literals-26; disabling them produces a parser that
512
+ * `dt`, `ip`, `t1`, and `b1` are mandatory-to-implement per §3 of
513
+ * draft-ietf-cbor-edn-literals-27; disabling them produces a parser that
345
514
  * no longer conforms to that recommendation. This is intended for
346
- * allowlisting scenarios (see §7 Security considerations of the same
515
+ * allowlisting scenarios (see §8 Security considerations of the same
347
516
  * draft) where an application wants explicit control over which
348
517
  * extensions it accepts from untrusted CDN input.
349
518
  *
@@ -354,8 +523,8 @@ export interface FromCDNOptions {
354
523
  */
355
524
  builtinExtensions?: CborExtension[] | false;
356
525
  /**
357
- * How to handle unrecognised application-extension identifiers
358
- * (§4.1 of draft-ietf-cbor-edn-literals-25).
526
+ * How to handle unrecognised app-extension identifiers
527
+ * (§5.1 of draft-ietf-cbor-edn-literals-27).
359
528
  *
360
529
  * - `'cpa999'`: wrap the literal in a `CPA999` tag
361
530
  * (`CborUnresolvedAppExt`) instead of failing. The resulting node
@@ -381,14 +550,28 @@ export interface FromCDNOptions {
381
550
  *
382
551
  * Comments are metadata only: they are ignored by CBOR binary encoding and
383
552
  * JavaScript conversion. Use together with `ToCDNOptions.preserveComments`
384
- * to include them when formatting back to CDN.
553
+ * (or `comments`) to include them when formatting back to CDN.
385
554
  *
386
- * The string values `'c-style'` and `'cdn-style'` are treated as `true`
387
- * for parsing purposes; they become meaningful when passed to `toCDN()`.
555
+ * Passing `'c-style'`/`'cdn-style'` directly is a deprecated shorthand for
556
+ * `true` plus the equivalent `comments` still accepted, but prefer
557
+ * `comments` for the output style going forward.
388
558
  *
389
559
  * @default false
390
560
  */
391
561
  preserveComments?: boolean | 'c-style' | 'cdn-style';
562
+ /**
563
+ * Companion to `preserveComments` for a single options object shared with
564
+ * `toCDN()` (as `CBOR.format()` does internally) — see
565
+ * `ToCDNOptions.comments` for what each value means there. On the
566
+ * parse side, only *whether* a style other than `'strip'` was requested
567
+ * matters: comments are captured when `preserveComments` is `true`, or
568
+ * when `comments` is set to anything other than `'strip'`. Left
569
+ * unset alongside an unset/`false` `preserveComments`, nothing is
570
+ * captured.
571
+ *
572
+ * @default undefined
573
+ */
574
+ comments?: 'strip' | 'c-style' | 'cdn-style';
392
575
  /**
393
576
  * Shorthand for `ToCDNOptions.preserveAll`, so a single option enables
394
577
  * round-tripping through both `fromCDN()` and `toCDN()` (as
@@ -457,10 +640,10 @@ export interface FromJSOptions {
457
640
  */
458
641
  extensions?: CborExtension[];
459
642
  /**
460
- * Override the default set of bundled application-oriented extensions.
643
+ * Override the default set of bundled app-extensions.
461
644
  * Mirrors `FromCDNOptions.builtinExtensions`. Only affects builtins that
462
- * implement `fromJS()` / `parseTag()` (none of the bundled application
463
- * extensions implement `fromJS()` by default — use `dt_as_Date` via
645
+ * implement `fromJS()` / `parseTag()` (none of the bundled app-extensions
646
+ * implement `fromJS()` by default — use `dt_as_Date` via
464
647
  * `extensions` for `Date` round-tripping).
465
648
  */
466
649
  builtinExtensions?: CborExtension[] | false;
@@ -512,6 +695,77 @@ export interface FromJSOptions {
512
695
  */
513
696
  cddlValidationOptions?: CddlValidateOptions;
514
697
  }
698
+ /**
699
+ * Context passed to a `toCDN()` `itemOptions` callback (see
700
+ * `ToCDNOptions.itemOptions`) describing where the node being visited sits
701
+ * in the tree. Structurally the same shape as `ItemContext` (`toJS()`'s
702
+ * own per-item context — see there for the full rationale behind each
703
+ * field), but `path`'s map-key segments are derived the CDN way: a
704
+ * text-string key contributes its string value, any other key contributes
705
+ * its own `toCDN()` rendering — there is no "JS value" for a CDN key to
706
+ * contribute instead, since converting to JS is not what this call is
707
+ * doing.
708
+ *
709
+ * Unlike `ItemContext`, a node's `toCDN()` `itemOptions` callback can run
710
+ * more than once for reasons `toJS()`'s never does: `inlineLeafContainers`
711
+ * (and a tag/app-sequence value's own multi-word check) render an entry a
712
+ * second time, at the *same* depth and options, purely to answer a layout
713
+ * question (does it fit on one line? is it multi-word?) before the real
714
+ * render — an existing, deliberate characteristic of `toCDN()` itself (see
715
+ * `serializeContainer` in `cdn/serialize-utils.ts`), not something
716
+ * `itemOptions` introduces. Write this callback as a pure function of
717
+ * `item`/`ctx`, the same guidance as `ItemContext`'s own, for the same
718
+ * reason: it must not assume, or count, how many times it runs.
719
+ */
720
+ export interface CdnItemContext {
721
+ /** The direct parent AST node. `undefined` for the root value being converted. */
722
+ parent?: CborItem;
723
+ /**
724
+ * The path segment identifying this node: an array index (`number`), or
725
+ * a map key's string value/`toCDN()` rendering (see `CdnItemContext`'s
726
+ * own note). Always equal to the last element of `path`, except
727
+ * `undefined` for the root value and while converting a map key itself
728
+ * (`isMapKey: true`). A tag or app-sequence wrapper's content inherits
729
+ * the wrapper's own `key` (and `path`) unchanged, since the wrapper adds
730
+ * no segment of its own.
731
+ */
732
+ key?: unknown;
733
+ /** The map key's own AST node, present when this node is a map entry's key or value. */
734
+ keyNode?: CborItem;
735
+ /**
736
+ * `true` when this invocation is for converting a map key itself, rather
737
+ * than one of that key's sibling value's descendants.
738
+ */
739
+ isMapKey?: boolean;
740
+ /**
741
+ * Path from the root to this node, as a sequence of array indices and
742
+ * map key identifiers (see `CdnItemContext`'s own note). Empty for the
743
+ * root value. A tag or app-sequence wrapper does not add a segment of
744
+ * its own — its content shares the wrapper's own path.
745
+ */
746
+ readonly path: readonly unknown[];
747
+ /**
748
+ * The options in effect for this node going into this call — the root
749
+ * options merged with whatever overrides its ancestors already
750
+ * returned, *before* this callback's own return value is merged on top.
751
+ * A mutable-looking field here (currently just the deprecated
752
+ * `textStringFormat`) is a fresh copy, not the live array in effect
753
+ * elsewhere — mutating it in place has no effect on this node, its
754
+ * siblings, or the caller's own options; return an override instead.
755
+ */
756
+ readonly options: ReadonlyToCDNOptions;
757
+ }
758
+ /**
759
+ * `ToCDNOptions`, as handed to code that must not mutate it in place —
760
+ * `CdnItemContext.options` — the `toCDN()` counterpart of
761
+ * `ReadonlyToJSNodeOptions`. `textStringFormat` (the one field on
762
+ * `ToCDNOptions` that's an ordinary mutable array, and already deprecated)
763
+ * is narrowed to a readonly array for the same reason `extensions` is
764
+ * there; see `ReadonlyToJSNodeOptions`'s own doc for the full rationale.
765
+ */
766
+ export type ReadonlyToCDNOptions = Readonly<Omit<ToCDNOptions, 'textStringFormat'>> & {
767
+ readonly textStringFormat?: readonly TextStringFormat[];
768
+ };
515
769
  export interface ToCDNOptions {
516
770
  /**
517
771
  * Indentation for pretty-printing.
@@ -530,7 +784,7 @@ export interface ToCDNOptions {
530
784
  * Master switch that turns on every `preserve*` option below at once,
531
785
  * except the deprecated `preserveTextString` — `preserveComments`,
532
786
  * `preserveByteString`, `preserveRawString`, `preserveConcatenation`,
533
- * `preserveNumberFormat`, `preserveAppSequence`, and
787
+ * `preserveNumberFormat`, `preserveAppPrefix`, and
534
788
  * `preserveBlankLines` — for reformatting CDN text (e.g. on save in an
535
789
  * editor) with minimal changes: only whitespace/indentation, plus
536
790
  * anything an explicitly-set individual option overrides.
@@ -538,7 +792,11 @@ export interface ToCDNOptions {
538
792
  * An option explicitly set to a value (including `false`) is left as-is;
539
793
  * `preserveAll` only fills in the ones left `undefined`. So
540
794
  * `{ preserveAll: true, preserveNumberFormat: false }` preserves
541
- * everything except number literal spelling.
795
+ * everything except number literal spelling. `preserveComments` is filled
796
+ * in with `true` only when `comments` is *also* left unset — an
797
+ * explicit `comments` with no `preserveComments` still normalizes
798
+ * comments to that style under `preserveAll`, instead of being overridden
799
+ * by the verbatim fill-in.
542
800
  *
543
801
  * When parsing via `CBOR.fromCDN()` separately from `toCDN()` (rather
544
802
  * than through `CBOR.format()`, which passes the same options to both),
@@ -551,24 +809,45 @@ export interface ToCDNOptions {
551
809
  */
552
810
  preserveAll?: boolean;
553
811
  /**
554
- * Emit comments previously captured by `FromCDNOptions.preserveComments`.
812
+ * Emit comments previously captured by `FromCDNOptions.preserveComments`,
813
+ * with their original markers kept as-is (no normalization) — takes
814
+ * precedence over `comments` when `true`.
815
+ *
816
+ * - `true`: emit comments verbatim, with whichever marker each one was
817
+ * originally written with.
818
+ * - `false` / omitted: defer to `comments` (see below) — `'strip'` (the
819
+ * default when that's also unset) or unset means no comments are
820
+ * emitted.
821
+ * - `'c-style'` / `'cdn-style'`: deprecated shorthand for `false` plus the
822
+ * equivalent `comments`; still accepted, but prefer setting
823
+ * `comments` directly.
824
+ *
825
+ * Only effective when `indent` enables pretty-printing: single-line
826
+ * output strips all comments regardless, since line comments (`#`, `//`)
827
+ * can only be terminated by a newline.
828
+ *
829
+ * @default false
830
+ */
831
+ preserveComments?: boolean | 'c-style' | 'cdn-style';
832
+ /**
833
+ * Style to normalize comment markers to when emitting comments previously
834
+ * captured by `FromCDNOptions.preserveComments` — only consulted when
835
+ * `preserveComments` is not `true` (see there).
555
836
  *
556
- * - `true`: emit comments with their original markers.
837
+ * - `'strip'` / omitted: don't emit comments at all.
557
838
  * - `'c-style'`: emit comments, normalising line comments to `//` and block
558
839
  * comments to `/* … *\/`.
559
840
  * - `'cdn-style'`: emit comments, normalising line comments to `#` and block
560
841
  * comments to `/ … /`. When a `/* … *\/` comment's content contains `/`
561
842
  * (which cannot be represented inside `/ … /`), the `/* … *\/` form is
562
843
  * kept as-is.
563
- * - `false` / omitted: strip all comments from the output.
564
844
  *
565
- * Only effective when `indent` enables pretty-printing: single-line
566
- * output strips all comments, since line comments (`#`, `//`) can only
567
- * be terminated by a newline.
845
+ * Only effective when `indent` enables pretty-printing; see
846
+ * `preserveComments`.
568
847
  *
569
- * @default false
848
+ * @default 'strip'
570
849
  */
571
- preserveComments?: boolean | 'c-style' | 'cdn-style';
850
+ comments?: 'strip' | 'c-style' | 'cdn-style';
572
851
  /**
573
852
  * Re-emit a blank line above an array/map entry (or indefinite-length
574
853
  * string chunk) that had one before it anywhere in the parsed CDN source,
@@ -594,7 +873,7 @@ export interface ToCDNOptions {
594
873
  * This preserves the spelling and interior layout of non-concatenated
595
874
  * `h'...'`, `b64'...'`, `b32'...'`, `h32'...'`, raw-backtick byte strings,
596
875
  * and single-quoted byte strings — including a `h'xx...yy'`-family elided
597
- * literal (§4.2), whose spelling is kept independently of
876
+ * literal (§5.2), whose spelling is kept independently of
598
877
  * `preserveConcatenation` when it has no `+` of its own (see that
599
878
  * option). Byte strings produced by `+` concatenation are normalised as
600
879
  * usual; combine with `preserveConcatenation` to keep both the part
@@ -710,16 +989,29 @@ export interface ToCDNOptions {
710
989
  */
711
990
  sqstr?: 'printable-string' | 'string' | 'none';
712
991
  /**
713
- * Whether to use application-string / app-sequence notation for built-in
714
- * extensions (e.g. `dt'...'`, `DT'...'`, `ip'...'`, `IP'...'`).
992
+ * Whether to use app-prefix notation app-string (`dt'...'`, `` dt`...` ``)
993
+ * or app-sequence (`dt<<...>>`) for built-in extensions.
715
994
  * - `true`: emit extension notation (`DT'2023-01-01T12:00:00Z'`)
716
995
  * - `false`: emit raw CBOR notation (`1(-14159024)`, `52(h'c000022a')`)
996
+ *
997
+ * Named after `app-prefix` (§6.1 of draft-ietf-cbor-edn-literals-27), the
998
+ * identifier both notations are built from — not just the app-string form,
999
+ * despite the old `appStrings` name (`false` also falls back to raw tag
1000
+ * notation for a preserved app-sequence spelling; see `preserveAppPrefix`).
1001
+ *
717
1002
  * @default true
718
1003
  */
1004
+ appPrefix?: boolean;
1005
+ /**
1006
+ * @deprecated Renamed to `appPrefix` — the old name only described the
1007
+ * app-string form even though this option also gates app-sequence
1008
+ * (`<<...>>`) notation. Still honoured when `appPrefix` is left unset,
1009
+ * but `appPrefix` wins if both are set.
1010
+ */
719
1011
  appStrings?: boolean;
720
1012
  /**
721
- * For built-in extensions that support application-string notation
722
- * (`prefix'...'` or `` prefix`...` ``), application-sequence notation
1013
+ * For built-in extensions that support app-string notation
1014
+ * (`prefix'...'` or `` prefix`...` ``), app-sequence notation
723
1015
  * (`prefix<<...>>`), and/or a raw tag literal (`N(...)`), re-emit a value
724
1016
  * using its exact original spelling instead of normalizing it to the
725
1017
  * regenerated `prefix'...'` form.
@@ -729,10 +1021,10 @@ export interface ToCDNOptions {
729
1021
  * `` DT`1969-07-21T02:56:16Z` ``, `DT<<'1969-07-21T02:56:16Z'>>`, and even
730
1022
  * the raw tag form `1(1749772800)` all become
731
1023
  * `DT'2025-06-13T00:00:00Z'`-style `prefix'...'` notation, even though all
732
- * of these denote the same value. `preserveAppSequence` keeps the
1024
+ * of these denote the same value. `preserveAppPrefix` keeps the
733
1025
  * original spelling instead — whichever quoting (`'...'` vs `` `...` ``),
734
1026
  * bracketing (`<<...>>`), or raw tag form was used. Has no effect when
735
- * `appStrings` is `false` (raw tag notation is used either way regardless
1027
+ * `appPrefix` is `false` (raw tag notation is used either way regardless
736
1028
  * of the original spelling), or on values not parsed from one of these
737
1029
  * forms.
738
1030
  *
@@ -740,13 +1032,34 @@ export interface ToCDNOptions {
740
1032
  * lines falls back to normal (regenerated) notation; single-line
741
1033
  * spellings are kept.
742
1034
  *
743
- * An explicit `preserveComments` setting is still applied to comments
744
- * inside a preserved application-sequence spelling: marker styles are
745
- * normalised without changing the notation family, and `false` removes
746
- * the comments while retaining the surrounding source spelling.
1035
+ * An explicit `preserveComments`/`comments` setting is still applied
1036
+ * to comments inside a preserved app-sequence spelling: marker styles are
1037
+ * normalised without changing the notation family, and stripping comments
1038
+ * (`preserveComments: false` with `comments` unset or `'strip'`)
1039
+ * removes them while retaining the surrounding source spelling. Leaving
1040
+ * *both* unset keeps the spelling's comments exactly as originally
1041
+ * written, since nothing was explicitly requested.
1042
+ *
1043
+ * Named after `app-prefix` (§6.1 of draft-ietf-cbor-edn-literals-27; e.g.
1044
+ * `dt`, `DT`, `ip`, `IP`), the identifier that `app-string`/`app-sequence`
1045
+ * notation is built from. The raw tag literal case is still covered: it's
1046
+ * the source spelling that used *no* app-prefix at all, and this option
1047
+ * preserves that choice too, not just spellings that did use one.
1048
+ * `preserveAppSequence` was the old, narrower name for this same option,
1049
+ * since it also preserves app-string and raw-tag spellings, not just
1050
+ * `<<...>>` sequences.
747
1051
  *
748
1052
  * @default false
749
1053
  */
1054
+ preserveAppPrefix?: boolean;
1055
+ /**
1056
+ * @deprecated Renamed to `preserveAppPrefix` — the old name only
1057
+ * described the `<<...>>` form even though this option also preserves
1058
+ * `prefix'...'` / `` prefix`...` `` and raw tag (`N(...)`) spellings.
1059
+ * Still honoured when `preserveAppPrefix` is left unset, but
1060
+ * `preserveAppPrefix` wins if both are set, and it no longer
1061
+ * participates in `preserveAll` (use `preserveAppPrefix` for that).
1062
+ */
750
1063
  preserveAppSequence?: boolean;
751
1064
  /**
752
1065
  * Numeric format for integer values in CDN output.
@@ -761,9 +1074,25 @@ export interface ToCDNOptions {
761
1074
  * Numeric format for floating-point values in CDN output.
762
1075
  * - `'decimal'`: standard decimal notation (e.g. `1.5`, `145544.0_3`)
763
1076
  * - `'hex'`: C99-style hex float notation (e.g. `0x1.8p+0`, `0x1.1c54p+17_3`)
1077
+ * - `'app-extension'`: `float'...'` app-string notation carrying the
1078
+ * value's exact IEEE 754 bit pattern (e.g. `float'3fc00000'`), per §3.8
1079
+ * of draft-ietf-cbor-edn-literals-27. Unlike `'decimal'`/`'hex'`, this
1080
+ * is derived from the value's actual encoded bytes rather than its
1081
+ * numeric text, so it losslessly represents NaN payloads and
1082
+ * ±Infinity too (not just finite values). Falls back to `'decimal'`
1083
+ * when `appPrefix` is `false`, matching how other built-in extensions
1084
+ * fall back to raw notation.
1085
+ *
1086
+ * A value originally parsed from a `float'...'`/`float<<...>>` literal
1087
+ * normally re-emits that exact source spelling regardless of this option
1088
+ * (so its own encoding-width choice, or a non-canonical bit pattern, isn't
1089
+ * silently normalized away) — leaving `floatFormat` unset, or setting it
1090
+ * to `'app-extension'`, keeps that round-trip. Explicitly requesting
1091
+ * `'decimal'` or `'hex'` opts out of it and reformats the value like any
1092
+ * other float, since that's the point of asking for a different format.
764
1093
  * @default 'decimal'
765
1094
  */
766
- floatFormat?: 'decimal' | 'hex';
1095
+ floatFormat?: 'decimal' | 'hex' | 'app-extension';
767
1096
  /**
768
1097
  * Split long text strings using CDN string concatenation syntax (`"a" + "b"`).
769
1098
  * Only effective when `indent` enables pretty-printing.
@@ -790,6 +1119,11 @@ export interface ToCDNOptions {
790
1119
  * `preserveConcatenation`; when it does not, the original concatenation
791
1120
  * is preserved as usual.
792
1121
  *
1122
+ * `inlineLeafContainers` applies to the embedded CDN structure too: an
1123
+ * array/map/`<<...>>` in the string content that would stay on one line
1124
+ * as a real value keeps its split points collapsed here as well (e.g.
1125
+ * `"[1, 2, 3]"` stays a single literal instead of splitting per element).
1126
+ *
793
1127
  * Replaces the deprecated `textStringFormat: ['cdn']`.
794
1128
  *
795
1129
  * @default false
@@ -825,8 +1159,8 @@ export interface ToCDNOptions {
825
1159
  * concatenation, and only takes effect when `indent` enables
826
1160
  * pretty-printing (single-line output joins the parts into one literal).
827
1161
  *
828
- * Also applies within an elision (`...`, §4.2 of
829
- * draft-ietf-cbor-edn-literals-25): a `+`-joined fragment on either side of
1162
+ * Also applies within an elision (`...`, §5.2 of
1163
+ * draft-ietf-cbor-edn-literals-27): a `+`-joined fragment on either side of
830
1164
  * an ellipsis keeps its own part boundaries too (e.g. `'test' +
831
1165
  * h'1234...abcd' + ...` stays exactly as written instead of merging
832
1166
  * `'test'` into the byte fragment before it), and byte-string elision
@@ -842,17 +1176,100 @@ export interface ToCDNOptions {
842
1176
  */
843
1177
  preserveConcatenation?: boolean;
844
1178
  /**
845
- * When pretty-printing with `indent`, keep a container on a single line
846
- * when none of its entries contains an array or map (even wrapped in a
847
- * tag) and every entry serializes without a line break (e.g. `[1, 2, 3]`,
848
- * `{"a": 1}`, `(_ "a", "b")`). Nested leaf containers still collapse
849
- * individually: `[[1, 2], [3, 4]]` renders with one inner array per line.
1179
+ * Render preserved `+` string concatenation (see `preserveConcatenation`)
1180
+ * or an elision chain (`...`, §5.2) using `t1<<...>>` / `b1<<...>>`
1181
+ * app-sequence notation (draft-ietf-cbor-edn-literals-27 §3.5)
1182
+ * instead of the legacy `+` operator.
1183
+ *
1184
+ * - `false` (default): `"a" + "b"` / `'test' + h'1234...abcd' + ...`.
1185
+ * - `true`: `t1<<"a", "b">>` / `b1<<h'1234', h'..abcd'>>`. Falls back to
1186
+ * `false`'s rendering when `appPrefix` is `false`, since this notation
1187
+ * is itself an app-string form.
1188
+ *
1189
+ * For a plain (non-elision) concatenation, only changes the spelling used
1190
+ * where `preserveConcatenation` already causes multi-part rendering; has
1191
+ * no effect when concatenation collapses into a single merged literal
1192
+ * (e.g. `preserveConcatenation` unset, or a text string whose content is
1193
+ * reflowed by `splitCdn` instead). An elision chain is different: `...`
1194
+ * denotes genuinely unknown content, so it always renders as multiple
1195
+ * parts regardless of `preserveConcatenation` — `modernConcat` therefore
1196
+ * also applies to it unconditionally (`preserveConcatenation` there only
1197
+ * controls how much of a fragment's *own* internal boundary is shown, not
1198
+ * whether the chain itself is shown as multiple parts).
1199
+ *
1200
+ * Has no effect on a value that was itself parsed from `t1<<...>>` /
1201
+ * `b1<<...>>` source: when `appPrefix` is not `false`, `encodingIndicators`
1202
+ * is `'auto'` (both defaults), and the source is either single-line or
1203
+ * being rendered with `indent` enabled, that spelling is kept verbatim
1204
+ * regardless of `modernConcat` (see `t1`/`b1` in
1205
+ * [String Concatenation and Indefinite-Length Strings](../README.md#string-concatenation-and-indefinite-length-strings)).
1206
+ * A multi-line source falls back to normalized (collapsed) output in
1207
+ * single-line mode, since that layout can't be reproduced without
1208
+ * `indent`. `modernConcat` only affects values reconstructed from a `+`
1209
+ * chain.
850
1210
  *
851
- * `<<...>>` (CBOR Sequence Literal / embedded CBOR) is the one exception:
852
- * since it's a flat sequence of encoded items rather than a
853
- * nested-structure display, an entry that is itself an array/map still
854
- * inlines there as long as its own rendering fits on one line — e.g.
855
- * `<<{1: -7}>>` stays on one line, even though `[{1: -7}]` would not.
1211
+ * @default false
1212
+ */
1213
+ modernConcat?: boolean;
1214
+ /**
1215
+ * Render an indefinite-length string using `ilts<<...>>` / `ilbs<<...>>`
1216
+ * app-sequence notation (draft-ietf-cbor-edn-literals-27 §3.6)
1217
+ * instead of the legacy `(_ "a", "b")` streamstring form.
1218
+ *
1219
+ * - `false` (default): `(_ "a", "b")`.
1220
+ * - `true`: `ilts<<"a", "b">>` / `ilbs<<h'..', h'..'>>`. Falls back to
1221
+ * `false`'s rendering when `appPrefix` is `false`, since this notation
1222
+ * is itself an app-string form.
1223
+ *
1224
+ * Applies whenever an indefinite-length string is rendered as chunks;
1225
+ * unaffected by `encodingIndicators: 'never'`, which merges the chunks
1226
+ * into a single definite-length literal regardless of this option.
1227
+ *
1228
+ * Has no effect on a value that was itself parsed from `ilts<<...>>` /
1229
+ * `ilbs<<...>>` source: when `appPrefix` is not `false`, `encodingIndicators`
1230
+ * is `'auto'` (both defaults), and the source is either single-line or
1231
+ * being rendered with `indent` enabled, that spelling is kept verbatim
1232
+ * regardless of `modernStreamSyntax`. A multi-line source falls back to
1233
+ * normalized (collapsed) output in single-line mode, since that layout
1234
+ * can't be reproduced without `indent`. `modernStreamSyntax` only affects
1235
+ * values reconstructed from a legacy `(_ ...)` chunk list.
1236
+ *
1237
+ * @default false
1238
+ */
1239
+ modernStreamSyntax?: boolean;
1240
+ /**
1241
+ * When pretty-printing with `indent`, keep an array, map, or
1242
+ * indefinite-length string group (`(_ "a", "b")`) on a single line when
1243
+ * none of its entries contains an array or map (even wrapped in a tag),
1244
+ * none of its entries is a text string with two or more words (also even
1245
+ * wrapped in a tag), and every entry serializes without a line break
1246
+ * (e.g. `[1, 2, 3]`, `{"a": 1}`, `(_ "a", "b")`). Word boundaries follow
1247
+ * `Intl.Segmenter`'s word-break rules, so `["hello", "world"]` still
1248
+ * collapses to one line (each entry is a single word) while `["Hello,
1249
+ * World!", "This is the CBOR library."]` renders one entry per line (each
1250
+ * has two or more) — space-less scripts (Japanese, Chinese, ...) are still
1251
+ * split on their own dictionary-based word boundaries. Nested leaf
1252
+ * containers still collapse individually: `[[1, 2], [3, 4]]` renders with
1253
+ * one inner array per line.
1254
+ *
1255
+ * `<<...>>` (CBOR Sequence Literal / embedded CBOR) is not governed by
1256
+ * this option at all: its own parens never require an additional line
1257
+ * break by themselves, regardless of `inlineLeafContainers`'s value,
1258
+ * since (unlike an array, map, or indefinite-length string group) it has
1259
+ * no nested-structure display of its own to spread out — it's a flat
1260
+ * sequence of encoded items. Instead it stays on one line exactly when
1261
+ * every entry's own actual rendering already does — an entry that is
1262
+ * itself an array/map is not disqualified just for being one, unlike in
1263
+ * an outer array/map. Concretely: `<<{1: -7}>>` renders as `<<{1: -7}>>`
1264
+ * when `inlineLeafContainers` lets the inner map collapse to one line,
1265
+ * but as `<<\n {\n 1: -7\n }\n>>` when it doesn't (the map itself
1266
+ * still spreads one entry per line without the option, same as it would
1267
+ * anywhere else — `<<...>>` just doesn't add a break of its own on top
1268
+ * of that). `[{1: -7}]`, by contrast, always spreads its `{1: -7}` entry
1269
+ * onto its own line regardless of whether the map itself collapses,
1270
+ * since a nested array/map always disqualifies an outer array/map's
1271
+ * entry. A two-or-more-word text entry still forces a break inside
1272
+ * `<<...>>` either way, irrespective of `inlineLeafContainers`.
856
1273
  *
857
1274
  * Containers with preserved comments are always emitted in multi-line
858
1275
  * form. Has no effect when `indent` is omitted.
@@ -872,6 +1289,39 @@ export interface ToCDNOptions {
872
1289
  * @default 'auto'
873
1290
  */
874
1291
  encodingIndicators?: 'always' | 'auto' | 'never';
1292
+ /**
1293
+ * Called for every node during `toCDN()`, before that node is rendered,
1294
+ * to override the options used for its subtree. Return a partial options
1295
+ * object to merge over the options in effect for this node (they apply to
1296
+ * this node and are inherited by its descendants, who may override them
1297
+ * again); return `undefined` to make no change.
1298
+ *
1299
+ * This is the mechanism for applying an option to only part of a
1300
+ * document — e.g. rendering one array element in hex while the rest stay
1301
+ * decimal — keyed off `ctx.path` or the node's own shape
1302
+ * (`item instanceof ...`).
1303
+ *
1304
+ * **May be called more than once for the same AST node** — see
1305
+ * `CdnItemContext`'s own note on why, and why this callback should be a
1306
+ * pure function of `item`/`ctx` rather than relying on how many times it
1307
+ * runs.
1308
+ *
1309
+ * Not called for keys of an indefinite-length string's chunks or a
1310
+ * `<<...>>` sequence's items, which have no key of their own to convert
1311
+ * (only array elements and map entries/keys have a `path` segment).
1312
+ *
1313
+ * @example
1314
+ * // Render only the value at key "raw" using hex integers, leaving the
1315
+ * // rest of the document in the default decimal format.
1316
+ * item.toCDN({
1317
+ * indent: 2,
1318
+ * itemOptions: (_node, ctx) =>
1319
+ * ctx.path.length === 1 && ctx.path[0] === 'raw'
1320
+ * ? { intFormat: 'hex' }
1321
+ * : undefined,
1322
+ * });
1323
+ */
1324
+ itemOptions?: (item: CborItem, ctx: CdnItemContext) => Partial<ToCDNOptions> | undefined;
875
1325
  }
876
1326
  export type TextStringFormat = 'newline' | 'cdn' | DeprecatedTextStringFormat;
877
1327
  /** @deprecated Use `'cdn'` instead. */
@@ -923,12 +1373,12 @@ export interface ValidateOptions {
923
1373
  */
924
1374
  extensions?: CborExtension[];
925
1375
  /**
926
- * Override the default set of bundled application-oriented extensions.
1376
+ * Override the default set of bundled app-extensions.
927
1377
  * Mirrors `FromCBOROptions.builtinExtensions`.
928
1378
  */
929
1379
  builtinExtensions?: CborExtension[] | false;
930
1380
  /**
931
- * How to handle unrecognised application-extension identifiers.
1381
+ * How to handle unrecognised app-extension identifiers.
932
1382
  * Only applies when `type` is `'cdn'`; mirrors `FromCDNOptions.unresolvedExtension`.
933
1383
  * @default 'cpa999'
934
1384
  */
@@ -1003,9 +1453,9 @@ export interface ValidateResult {
1003
1453
  */
1004
1454
  cddlWarnings?: CddlValidationWarning[];
1005
1455
  }
1006
- /** `fromCBORSeq()` の options(`offset`/`allowTrailing` はジェネレータが管理するため除外)。 */
1456
+ /** Options for `fromCBORSeq()` (`offset`/`allowTrailing` are excluded — the generator manages them). */
1007
1457
  export type FromCBORSeqOptions = Omit<FromCBOROptions, 'offset' | 'allowTrailing'>;
1008
- /** `fromCDNSeq()` の options(`offset`/`allowTrailing` はジェネレータが管理するため除外)。 */
1458
+ /** Options for `fromCDNSeq()` (`offset`/`allowTrailing` are excluded — the generator manages them). */
1009
1459
  export type FromCDNSeqOptions = Omit<FromCDNOptions, 'offset' | 'allowTrailing'>;
1010
1460
  /**
1011
1461
  * Combined options for the `CBOR` constructor.