@cbortech/cbor 0.27.0 → 0.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +100 -0
- package/README.md +103 -0
- package/dist/ast/CborAppSeqResult.d.ts +37 -4
- package/dist/ast/CborArray.d.ts +2 -2
- package/dist/ast/CborByteString.d.ts +2 -2
- package/dist/ast/CborEmbeddedCBOR.d.ts +1 -1
- package/dist/ast/CborFloat.d.ts +1 -1
- package/dist/ast/CborIndefiniteByteString.d.ts +1 -1
- package/dist/ast/CborIndefiniteTextString.d.ts +1 -1
- package/dist/ast/CborItem.d.ts +314 -9
- package/dist/ast/CborMap.d.ts +2 -2
- package/dist/ast/CborNint.d.ts +1 -1
- package/dist/ast/CborTag.d.ts +26 -4
- package/dist/ast/CborTextString.d.ts +2 -2
- package/dist/ast/CborUint.d.ts +1 -1
- package/dist/ast/CborUnresolvedAppExt.d.ts +9 -0
- package/dist/ast/index.cjs +1 -1
- package/dist/ast/index.js +2 -2
- package/dist/cbor/tagLabels.d.ts +26 -0
- package/dist/cddl/eRefScope.d.ts +241 -0
- package/dist/cddl/eref.d.ts +64 -0
- package/dist/cddl/implicitTags.d.ts +28 -0
- package/dist/cddl/index.cjs +2 -2
- package/dist/cddl/index.cjs.map +1 -1
- package/dist/cddl/index.d.ts +2 -0
- package/dist/cddl/index.js +26 -25
- package/dist/cddl/index.js.map +1 -1
- package/dist/cddl/validator.d.ts +98 -2
- package/dist/cdn/index.cjs +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/serialize-utils.d.ts +50 -15
- package/dist/extensions/cri.d.ts +2 -2
- package/dist/extensions/dt.d.ts +4 -4
- package/dist/extensions/eref.d.ts +135 -0
- package/dist/extensions/ip.d.ts +3 -3
- package/dist/extensions/types.d.ts +40 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +190 -81
- package/dist/index.js.map +1 -1
- package/dist/js/fromJS.d.ts +23 -1
- package/dist/mapEntries-8zshEr-t.js +7085 -0
- package/dist/mapEntries-8zshEr-t.js.map +1 -0
- package/dist/mapEntries-DwHPAzCN.cjs +68 -0
- package/dist/mapEntries-DwHPAzCN.cjs.map +1 -0
- package/dist/schema-7r2xjpMK.js +345 -0
- package/dist/schema-7r2xjpMK.js.map +1 -0
- package/dist/schema-YiigSWjR.cjs +8 -0
- package/dist/schema-YiigSWjR.cjs.map +1 -0
- package/dist/{serialize-utils-BuIZPaUc.js → serialize-utils-BQtutOo6.js} +70 -52
- package/dist/serialize-utils-BQtutOo6.js.map +1 -0
- package/dist/{serialize-utils-CjTqQivB.cjs → serialize-utils-DQ8T3Mzw.cjs} +9 -9
- package/dist/serialize-utils-DQ8T3Mzw.cjs.map +1 -0
- package/dist/types.d.ts +426 -4
- package/dist/utils/hexfloat.d.ts +10 -2
- package/package.json +13 -14
- package/dist/mapEntries-C1f7G0AM.cjs +0 -13
- package/dist/mapEntries-C1f7G0AM.cjs.map +0 -1
- package/dist/mapEntries-CvLdiN0h.js +0 -3946
- package/dist/mapEntries-CvLdiN0h.js.map +0 -1
- package/dist/schema-CNfrVRYp.js +0 -1977
- package/dist/schema-CNfrVRYp.js.map +0 -1
- package/dist/schema-iXpYtKQl.cjs +0 -63
- package/dist/schema-iXpYtKQl.cjs.map +0 -1
- package/dist/serialize-utils-BuIZPaUc.js.map +0 -1
- package/dist/serialize-utils-CjTqQivB.cjs.map +0 -1
package/README.ja.md
CHANGED
|
@@ -708,6 +708,79 @@ console.log(text);
|
|
|
708
708
|
// DT'2026-05-06T00:00:00Z'
|
|
709
709
|
```
|
|
710
710
|
|
|
711
|
+
### 項目ごとのオプション上書き
|
|
712
|
+
|
|
713
|
+
`toJS()` の `itemOptions` は、各ノードが変換される直前にすべてのノードに対して呼ばれるため、
|
|
714
|
+
ドキュメントの一部だけを他と異なる方法で変換できます。そのノードとその子孫に適用する
|
|
715
|
+
オプションを部分的なオプションオブジェクトとして返すか、変更しない場合は `undefined` を
|
|
716
|
+
返します。`ctx.path` は配列インデックスとマップキーからなる列でノードを識別し、
|
|
717
|
+
ルートでは空になります。
|
|
718
|
+
|
|
719
|
+
同じノードに対して複数回呼ばれることがあります —— `reviver` も併用している場合、配列や
|
|
720
|
+
object-mode の map は各子要素を少なくとも2回変換します。1回は、先行する兄弟要素自身の
|
|
721
|
+
`reviver` 呼び出しから見える値を構築するため、もう1回は実際に保持される値を計算するため
|
|
722
|
+
です。このコールバックは `node`/`ctx` のみに依存する純粋関数として書き、呼ばれる回数には
|
|
723
|
+
依存しないようにしてください。
|
|
724
|
+
|
|
725
|
+
```ts
|
|
726
|
+
import { CBOR } from '@cbortech/cbor';
|
|
727
|
+
|
|
728
|
+
const item = CBOR.fromCDN(
|
|
729
|
+
`{"date1": DT'2026-08-23T00:00:00Z', "date2": DT'2026-08-23T00:00:00Z'}`
|
|
730
|
+
);
|
|
731
|
+
|
|
732
|
+
const value = item.toJS({
|
|
733
|
+
stripTags: true,
|
|
734
|
+
itemOptions: (_node, ctx) =>
|
|
735
|
+
ctx.path.length === 1 && ctx.path[0] === 'date1'
|
|
736
|
+
? { extensions: [CBOR.dt_as_Date] }
|
|
737
|
+
: undefined,
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
console.log(value);
|
|
741
|
+
// { date1: Date(...), date2: 1787443200 }
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
`ToJSOptions` の `extensions` は `itemOptions` なしでも単体で機能し、ツリー全体を
|
|
745
|
+
再解釈できます —— デフォルトの `dt` extension でパースされた値も、`toJS()` に
|
|
746
|
+
`extensions` を渡すことで `dt_as_Date`(またはその逆)に変換し直せます。
|
|
747
|
+
|
|
748
|
+
`ctx.options` には、そのノードにおいて現在有効なオプション —— ルートのオプションに
|
|
749
|
+
祖先の `itemOptions` がすでに返した上書きをマージしたもの —— が渡されます。これにより、
|
|
750
|
+
コールバックはオプションを丸ごと置き換えるのではなく、現在の値を土台にして組み立てる
|
|
751
|
+
ことができます。
|
|
752
|
+
|
|
753
|
+
```ts
|
|
754
|
+
itemOptions: (_node, ctx) => ({
|
|
755
|
+
extensions: [...(ctx.options.extensions ?? []), CBOR.dt_as_Date],
|
|
756
|
+
});
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
`toCDN()` にも同じ `itemOptions` オプションがあり、ドキュメントの一部だけを
|
|
760
|
+
他と異なる方法でフォーマットできます。
|
|
761
|
+
|
|
762
|
+
```ts
|
|
763
|
+
import { CBOR } from '@cbortech/cbor';
|
|
764
|
+
|
|
765
|
+
const item = CBOR.fromCDN('{"raw": 255, "count": 255}');
|
|
766
|
+
|
|
767
|
+
const text = item.toCDN({
|
|
768
|
+
itemOptions: (_node, ctx) =>
|
|
769
|
+
ctx.path.length === 1 && ctx.path[0] === 'raw'
|
|
770
|
+
? { intFormat: 'hex' }
|
|
771
|
+
: undefined,
|
|
772
|
+
});
|
|
773
|
+
|
|
774
|
+
console.log(text);
|
|
775
|
+
// {"raw":0xff,"count":255}
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
`toCDN()` には `reviver` に相当するものがないため、それを理由に複数回呼ばれる
|
|
779
|
+
ことはありません —— ただし `toCDN()` 自体のレイアウト判定(`inlineLeafContainers`
|
|
780
|
+
の1行収まるかの判定、あるいはタグ/app-sequence 値自身の複数語判定)が実際の
|
|
781
|
+
出力より前にエントリを再描画してその答えを得ることがあるため、その場合には
|
|
782
|
+
やはり複数回呼ばれ得ます。こちらも純粋な関数として書いてください。
|
|
783
|
+
|
|
711
784
|
## 文字列連結と不定長文字列
|
|
712
785
|
|
|
713
786
|
draft-ietf-cbor-edn-literals-27(§3.5 / §3.6)の app-extension
|
|
@@ -1138,6 +1211,29 @@ const value = CBOR.parse('{"x": 12, "y": -3}', {
|
|
|
1138
1211
|
検証オプションは `cddlValidationOptions` で渡せます。`cddl` は
|
|
1139
1212
|
`new CBOR({ cddl: … })` のようにインスタンスのデフォルトにもできます。
|
|
1140
1213
|
|
|
1214
|
+
スキーマを指定すると、スキーマ自体が要求するタグは JavaScript 側で省略
|
|
1215
|
+
できます。`toJS()` は、prelude の `time = #6.1(number)` のような `#6.N(…)`
|
|
1216
|
+
型に一致したタグを外し、`fromJS()` はタグのない値にそれを補います。
|
|
1217
|
+
|
|
1218
|
+
```ts
|
|
1219
|
+
import { CBOR } from '@cbortech/cbor';
|
|
1220
|
+
|
|
1221
|
+
const cddl = 'event = { t: time }';
|
|
1222
|
+
|
|
1223
|
+
CBOR.parse(`{"t": DT'1969-07-21T02:56:16Z'}`, { cddl });
|
|
1224
|
+
// { t: -14159024 }(Tag.symbol のない素の number)
|
|
1225
|
+
|
|
1226
|
+
CBOR.stringify({ t: -14159024 }, { cddl });
|
|
1227
|
+
// {"t":DT'1969-07-21T02:56:16Z'}
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
タグを外すのは `fromJS()` で復元できる場合だけです。タグなしの値もその
|
|
1231
|
+
位置で妥当な場合(`time / number`)や、スキーマがタグを要求しない場合
|
|
1232
|
+
(`any`)はタグを残します。推論は、値がそのままではスキーマに一致しない
|
|
1233
|
+
ときにだけ行います。すべてのタグを明示的に保持・要求するには
|
|
1234
|
+
`implicitTags: false`(`ToJSOptions` と `FromJSOptions` のオプション)を
|
|
1235
|
+
指定します。
|
|
1236
|
+
|
|
1141
1237
|
`CDDL.compile()` は `CddlSyntaxError` または `CddlSemanticError` を throw
|
|
1142
1238
|
します。`{ strict: false }` を指定すると、意味上の問題を
|
|
1143
1239
|
`schema.warnings` に収集できます。コンパイル済みスキーマは
|
|
@@ -1178,6 +1274,7 @@ CDDL コンパイラは `@cbortech/cbor/cddl`
|
|
|
1178
1274
|
- CDN (CBOR-EDN)
|
|
1179
1275
|
- [draft-ietf-cbor-edn-literals-25](https://datatracker.ietf.org/doc/draft-ietf-cbor-edn-literals/25/)
|
|
1180
1276
|
- [draft-ietf-cbor-edn-literals-27](https://datatracker.ietf.org/doc/draft-ietf-cbor-edn-literals/27/)
|
|
1277
|
+
- [draft-ietf-cbor-edn-e-ref-03](https://datatracker.ietf.org/doc/draft-ietf-cbor-edn-e-ref/03/)
|
|
1181
1278
|
- CDDL
|
|
1182
1279
|
- [RFC 8610](https://www.rfc-editor.org/rfc/rfc8610)
|
|
1183
1280
|
- [RFC 9682](https://www.rfc-editor.org/rfc/rfc9682)
|
|
@@ -1194,6 +1291,9 @@ CDDL コンパイラは `@cbortech/cbor/cddl`
|
|
|
1194
1291
|
`#6.<type>` / `#7.<type>` head number に対応しています。コメントの `PCHAR`
|
|
1195
1292
|
検証、単独 CR の改行、EOF で終わるコメントは、collected ABNF よりも意図的に
|
|
1196
1293
|
寛容に受理します。
|
|
1294
|
+
- draft-ietf-cbor-edn-e-ref の `e'...'` application extension を試験的に
|
|
1295
|
+
サポートしています(draft本文より狭いスコープで、整数リテラルに直接束縛された
|
|
1296
|
+
名前のみ対応 — 文字列定数や、他の定数への別名参照は解決できません)。
|
|
1197
1297
|
|
|
1198
1298
|
## ライセンス
|
|
1199
1299
|
|
package/README.md
CHANGED
|
@@ -719,6 +719,81 @@ console.log(text);
|
|
|
719
719
|
// DT'2026-05-06T00:00:00Z'
|
|
720
720
|
```
|
|
721
721
|
|
|
722
|
+
### Per-item option overrides
|
|
723
|
+
|
|
724
|
+
`itemOptions` on `toJS()` is called for every node before it is converted, so
|
|
725
|
+
one part of a document can be converted differently from the rest. Return a
|
|
726
|
+
partial options object to override options for that node and its descendants,
|
|
727
|
+
or `undefined` to leave them unchanged. `ctx.path` identifies the node as a
|
|
728
|
+
sequence of array indices and map keys, empty at the root.
|
|
729
|
+
|
|
730
|
+
It can be called more than once for the same node — when a `reviver` is also
|
|
731
|
+
present, arrays and object-mode maps convert each child at least twice: once
|
|
732
|
+
to build a value visible to an earlier sibling's own `reviver` call, and once
|
|
733
|
+
more for the value that's actually kept. Write it as a pure function of
|
|
734
|
+
`node`/`ctx`, not relying on how many times it runs.
|
|
735
|
+
|
|
736
|
+
```ts
|
|
737
|
+
import { CBOR } from '@cbortech/cbor';
|
|
738
|
+
|
|
739
|
+
const item = CBOR.fromCDN(
|
|
740
|
+
`{"date1": DT'2026-08-23T00:00:00Z', "date2": DT'2026-08-23T00:00:00Z'}`
|
|
741
|
+
);
|
|
742
|
+
|
|
743
|
+
const value = item.toJS({
|
|
744
|
+
stripTags: true,
|
|
745
|
+
itemOptions: (_node, ctx) =>
|
|
746
|
+
ctx.path.length === 1 && ctx.path[0] === 'date1'
|
|
747
|
+
? { extensions: [CBOR.dt_as_Date] }
|
|
748
|
+
: undefined,
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
console.log(value);
|
|
752
|
+
// { date1: Date(...), date2: 1787443200 }
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
`extensions` on `ToJSOptions` also works on its own, without `itemOptions`, to
|
|
756
|
+
reinterpret an entire tree: a value parsed with the default `dt` extension can
|
|
757
|
+
still be converted with `dt_as_Date` (or vice versa) by passing `extensions`
|
|
758
|
+
directly to `toJS()`.
|
|
759
|
+
|
|
760
|
+
`ctx.options` carries the options already in effect for the node — the root
|
|
761
|
+
options merged with whatever an ancestor's `itemOptions` already returned —
|
|
762
|
+
so a callback can build on the current value of an option instead of
|
|
763
|
+
overriding it outright:
|
|
764
|
+
|
|
765
|
+
```ts
|
|
766
|
+
itemOptions: (_node, ctx) => ({
|
|
767
|
+
extensions: [...(ctx.options.extensions ?? []), CBOR.dt_as_Date],
|
|
768
|
+
});
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
`toCDN()` takes the same `itemOptions` option, formatting one part of a
|
|
772
|
+
document differently from the rest:
|
|
773
|
+
|
|
774
|
+
```ts
|
|
775
|
+
import { CBOR } from '@cbortech/cbor';
|
|
776
|
+
|
|
777
|
+
const item = CBOR.fromCDN('{"raw": 255, "count": 255}');
|
|
778
|
+
|
|
779
|
+
const text = item.toCDN({
|
|
780
|
+
itemOptions: (_node, ctx) =>
|
|
781
|
+
ctx.path.length === 1 && ctx.path[0] === 'raw'
|
|
782
|
+
? { intFormat: 'hex' }
|
|
783
|
+
: undefined,
|
|
784
|
+
});
|
|
785
|
+
|
|
786
|
+
console.log(text);
|
|
787
|
+
// {"raw":0xff,"count":255}
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
There is no `reviver` for `toCDN()`, so it can't be called more than once for
|
|
791
|
+
that reason — but it can still be called more than once for a node that's
|
|
792
|
+
also a `toCDN()` layout decision (`inlineLeafContainers`'s one-line collapse
|
|
793
|
+
check, or a tag/app-sequence value's own multi-word check re-render an entry
|
|
794
|
+
purely to answer that question before the real render). Write it as a pure
|
|
795
|
+
function here too.
|
|
796
|
+
|
|
722
797
|
## String Concatenation and Indefinite-Length Strings
|
|
723
798
|
|
|
724
799
|
The `t1` / `b1` / `ilbs` / `ilts` app-extensions from
|
|
@@ -1148,6 +1223,29 @@ Throwing methods such as `parse`, `decode`, and `encode` throw
|
|
|
1148
1223
|
in `result.cddlErrors`. Pass validator options through `cddlValidationOptions`,
|
|
1149
1224
|
or set `cddl` as an instance default with `new CBOR({ cddl: … })`.
|
|
1150
1225
|
|
|
1226
|
+
With a schema, tags the schema itself requires can be left implicit in
|
|
1227
|
+
JavaScript. `toJS()` drops a tag matched by a `#6.N(…)` type such as the
|
|
1228
|
+
prelude's `time = #6.1(number)`, and `fromJS()` adds it back to a value that
|
|
1229
|
+
lacks it:
|
|
1230
|
+
|
|
1231
|
+
```ts
|
|
1232
|
+
import { CBOR } from '@cbortech/cbor';
|
|
1233
|
+
|
|
1234
|
+
const cddl = 'event = { t: time }';
|
|
1235
|
+
|
|
1236
|
+
CBOR.parse(`{"t": DT'1969-07-21T02:56:16Z'}`, { cddl });
|
|
1237
|
+
// { t: -14159024 } (a plain number, no Tag.symbol)
|
|
1238
|
+
|
|
1239
|
+
CBOR.stringify({ t: -14159024 }, { cddl });
|
|
1240
|
+
// {"t":DT'1969-07-21T02:56:16Z'}
|
|
1241
|
+
```
|
|
1242
|
+
|
|
1243
|
+
A tag is dropped only when `fromJS()` would restore it: it is kept where the
|
|
1244
|
+
untagged value is also valid on its own (`time / number`) or where the schema
|
|
1245
|
+
doesn't require it (`any`). Inference only runs when the value doesn't
|
|
1246
|
+
already match the schema. Pass `implicitTags: false` (a `ToJSOptions` and
|
|
1247
|
+
`FromJSOptions` option) to keep or require every tag explicitly.
|
|
1248
|
+
|
|
1151
1249
|
`CDDL.compile()` throws `CddlSyntaxError` or `CddlSemanticError`; use
|
|
1152
1250
|
`{ strict: false }` to collect semantic issues in `schema.warnings` instead.
|
|
1153
1251
|
Compiled schemas can be formatted with `schema.format()`. The subpath also
|
|
@@ -1188,6 +1286,7 @@ types).
|
|
|
1188
1286
|
- CDN (CBOR-EDN)
|
|
1189
1287
|
- [draft-ietf-cbor-edn-literals-25](https://datatracker.ietf.org/doc/draft-ietf-cbor-edn-literals/25/)
|
|
1190
1288
|
- [draft-ietf-cbor-edn-literals-27](https://datatracker.ietf.org/doc/draft-ietf-cbor-edn-literals/27/)
|
|
1289
|
+
- [draft-ietf-cbor-edn-e-ref-03](https://datatracker.ietf.org/doc/draft-ietf-cbor-edn-e-ref/03/)
|
|
1191
1290
|
- CDDL
|
|
1192
1291
|
- [RFC 8610](https://www.rfc-editor.org/rfc/rfc8610)
|
|
1193
1292
|
- [RFC 9682](https://www.rfc-editor.org/rfc/rfc9682)
|
|
@@ -1205,6 +1304,10 @@ Implementation notes:
|
|
|
1205
1304
|
`#7.<type>` head numbers. Comment `PCHAR` validation, bare CR line endings,
|
|
1206
1305
|
and comments ending at EOF are intentionally accepted more leniently than the
|
|
1207
1306
|
collected ABNF.
|
|
1307
|
+
- Experimental support for draft-ietf-cbor-edn-e-ref's `e'...'` application
|
|
1308
|
+
extension, limited to names bound directly to an integer literal (the
|
|
1309
|
+
draft's own scope is broader) — a string constant, or an alias to another
|
|
1310
|
+
named constant, doesn't resolve.
|
|
1208
1311
|
|
|
1209
1312
|
## License
|
|
1210
1313
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToCDNOptions, ToCBOROptions, ToJSOptions } from '../types';
|
|
2
|
-
import { CborItem } from './CborItem';
|
|
2
|
+
import { CborItem, Occurrence } from './CborItem';
|
|
3
3
|
import { CborWriter } from '../cbor/encode';
|
|
4
4
|
/**
|
|
5
5
|
* Wraps a resolved app-sequence result and preserves the original EDN source
|
|
@@ -13,6 +13,39 @@ import { CborWriter } from '../cbor/encode';
|
|
|
13
13
|
* lines also delegates to the inner item, since it cannot be re-emitted
|
|
14
14
|
* without breaking the single-line guarantee.
|
|
15
15
|
*
|
|
16
|
+
* When `toCDN()`'s `itemOptions` is configured (see `needsCdnItemDispatch`),
|
|
17
|
+
* the verbatim `ednSource` fast path alone can't be trusted: it was produced
|
|
18
|
+
* without ever visiting `this.inner`'s own descendants, so an override
|
|
19
|
+
* targeting one of them (e.g. one chunk of an `ilbs<<...>>`) would otherwise
|
|
20
|
+
* never even be offered the chance to apply. But merely *having* `itemOptions`
|
|
21
|
+
* configured must not by itself change the output — many callers set it
|
|
22
|
+
* without it ever matching anything in this particular subtree, and
|
|
23
|
+
* `itemOptions` returning `undefined` everywhere is documented to mean "no
|
|
24
|
+
* change" (see `CdnItemContext`). So this renders through the normal
|
|
25
|
+
* recursive path while tracking, via `CDN_OVERRIDE_TRACKER` (an out-of-band
|
|
26
|
+
* symbol key, *not* a wrapped `itemOptions` — wrapping it would make
|
|
27
|
+
* `ctx.options.itemOptions` a different function for every descendant here
|
|
28
|
+
* than everywhere else in the tree, observable even to a pure callback),
|
|
29
|
+
* whether any call in the subtree actually returned an override, and only
|
|
30
|
+
* swaps in that freshly rendered text when one did; otherwise the exact
|
|
31
|
+
* preserved `ednSource` is still returned.
|
|
32
|
+
*
|
|
33
|
+
* Each `_toCDN()` call installs its *own fresh* tracker box before
|
|
34
|
+
* recursing, rather than reusing whatever tracker it was handed — reusing
|
|
35
|
+
* one directly would let an override applied by some unrelated part of the
|
|
36
|
+
* tree that merely happens to share the same ambient `options` object (a
|
|
37
|
+
* later sibling reached through the same `itemOptions`, say) falsely mark
|
|
38
|
+
* *this* wrapper's own verbatim source as stale. But a genuinely *nested*
|
|
39
|
+
* app-sequence (e.g. a custom `wrap<<ilbs<<h'61'>>>>` extension wrapping an
|
|
40
|
+
* `ilbs<<...>>` result) must still have its own outer verbatim source
|
|
41
|
+
* abandoned when the inner wrapper's own tracked render found something to
|
|
42
|
+
* apply — an inner override changes what the outer source would need to
|
|
43
|
+
* embed too. So once this call's own local tracker comes back `applied`,
|
|
44
|
+
* that fact is additionally bubbled up to whichever ancestor tracker (if
|
|
45
|
+
* any) this call itself received via `options` — the exact wrapper this
|
|
46
|
+
* call is nested inside, never a sibling reached only through shared
|
|
47
|
+
* top-level `options`.
|
|
48
|
+
*
|
|
16
49
|
* CBOR encoding and JS conversion always delegate to the inner item so the
|
|
17
50
|
* wrapper is fully transparent for those operations.
|
|
18
51
|
*/
|
|
@@ -42,8 +75,8 @@ export declare class CborAppSeqResult extends CborItem {
|
|
|
42
75
|
* already produced a `\n` in that string, which the caller's own
|
|
43
76
|
* `s.includes('\n')` check picks up independently either way).
|
|
44
77
|
*/
|
|
45
|
-
_isMultiWordText(options: ToCDNOptions | undefined, strict?: boolean): boolean;
|
|
78
|
+
_isMultiWordText(options: ToCDNOptions | undefined, strict?: boolean, path?: readonly unknown[]): boolean;
|
|
46
79
|
_encodeTo(writer: CborWriter, options?: ToCBOROptions): void;
|
|
47
|
-
_toCDN(options: ToCDNOptions | undefined, depth: number): string;
|
|
48
|
-
_toJS(options?: ToJSOptions): unknown;
|
|
80
|
+
_toCDN(options: ToCDNOptions | undefined, depth: number, path?: readonly unknown[]): string;
|
|
81
|
+
_toJS(options?: ToJSOptions, path?: readonly unknown[], occurrence?: Occurrence): unknown;
|
|
49
82
|
}
|
package/dist/ast/CborArray.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class CborArray extends CborItem {
|
|
|
12
12
|
});
|
|
13
13
|
get _containsCdnContainer(): boolean;
|
|
14
14
|
_encodeTo(writer: CborWriter, options?: ToCBOROptions): void;
|
|
15
|
-
_toCDN(options: ToCDNOptions | undefined, depth: number): string;
|
|
15
|
+
_toCDN(options: ToCDNOptions | undefined, depth: number, path?: readonly unknown[]): string;
|
|
16
16
|
_toHexDump(depth: number, options?: ToCDNOptions): AnnotatedLine[];
|
|
17
|
-
_toJS(options?: ToJSOptions): unknown;
|
|
17
|
+
_toJS(options?: ToJSOptions, path?: readonly unknown[], occurrence?: readonly unknown[]): unknown;
|
|
18
18
|
}
|
|
@@ -63,8 +63,8 @@ export declare class CborByteString extends CborItem {
|
|
|
63
63
|
* needed here at all now — it's accepted purely for interface
|
|
64
64
|
* consistency with the base class.
|
|
65
65
|
*/
|
|
66
|
-
_isMultiWordText(options: ToCDNOptions | undefined, _strict?: boolean): boolean;
|
|
66
|
+
_isMultiWordText(options: ToCDNOptions | undefined, _strict?: boolean, _path?: readonly unknown[]): boolean;
|
|
67
67
|
_encodeTo(writer: CborWriter, _options?: ToCBOROptions): void;
|
|
68
|
-
_toCDN(options: ToCDNOptions | undefined, _depth: number): string;
|
|
68
|
+
_toCDN(options: ToCDNOptions | undefined, _depth: number, _path?: readonly unknown[]): string;
|
|
69
69
|
_toJS(_options?: ToJSOptions): unknown;
|
|
70
70
|
}
|
|
@@ -21,7 +21,7 @@ export declare class CborEmbeddedCBOR extends CborItem {
|
|
|
21
21
|
/** The raw concatenated CBOR bytes of all contained items. */
|
|
22
22
|
private _content;
|
|
23
23
|
_encodeTo(writer: CborWriter, options?: ToCBOROptions): void;
|
|
24
|
-
_toCDN(options: ToCDNOptions | undefined, depth: number): string;
|
|
24
|
+
_toCDN(options: ToCDNOptions | undefined, depth: number, path?: readonly unknown[]): string;
|
|
25
25
|
_toHexDump(depth: number, options?: ToCDNOptions): AnnotatedLine[];
|
|
26
26
|
_toJS(_options?: ToJSOptions): unknown;
|
|
27
27
|
}
|
package/dist/ast/CborFloat.d.ts
CHANGED
|
@@ -48,6 +48,6 @@ export declare class CborFloat extends CborItem {
|
|
|
48
48
|
literalSource?: string;
|
|
49
49
|
});
|
|
50
50
|
_encodeTo(writer: CborWriter, _options?: ToCBOROptions): void;
|
|
51
|
-
_toCDN(options: ToCDNOptions | undefined, _depth: number): string;
|
|
51
|
+
_toCDN(options: ToCDNOptions | undefined, _depth: number, _path?: readonly unknown[]): string;
|
|
52
52
|
_toJS(_options?: ToJSOptions): unknown;
|
|
53
53
|
}
|
|
@@ -32,7 +32,7 @@ export declare class CborIndefiniteByteString extends CborItem {
|
|
|
32
32
|
* was removed there too).
|
|
33
33
|
*/
|
|
34
34
|
_isMultiWordText(options: ToCDNOptions | undefined, _strict?: boolean): boolean;
|
|
35
|
-
_toCDN(options: ToCDNOptions | undefined, depth: number): string;
|
|
35
|
+
_toCDN(options: ToCDNOptions | undefined, depth: number, path?: readonly unknown[]): string;
|
|
36
36
|
_toHexDump(depth: number, options?: ToCDNOptions): AnnotatedLine[];
|
|
37
37
|
_toJS(_options?: ToJSOptions): unknown;
|
|
38
38
|
}
|
|
@@ -24,7 +24,7 @@ export declare class CborIndefiniteTextString extends CborItem {
|
|
|
24
24
|
* depend on it.
|
|
25
25
|
*/
|
|
26
26
|
_isMultiWordText(options: ToCDNOptions | undefined, _strict?: boolean): boolean;
|
|
27
|
-
_toCDN(options: ToCDNOptions | undefined, depth: number): string;
|
|
27
|
+
_toCDN(options: ToCDNOptions | undefined, depth: number, path?: readonly unknown[]): string;
|
|
28
28
|
_toHexDump(depth: number, options?: ToCDNOptions): AnnotatedLine[];
|
|
29
29
|
_toJS(_options?: ToJSOptions): unknown;
|
|
30
30
|
}
|