@cbortech/cbor 0.26.7 → 0.26.8

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 (38) hide show
  1. package/README.ja.md +0 -19
  2. package/README.md +0 -19
  3. package/dist/ast/CborByteString.d.ts +11 -0
  4. package/dist/ast/CborTextString.d.ts +16 -0
  5. package/dist/ast/index.cjs +1 -1
  6. package/dist/ast/index.d.ts +1 -0
  7. package/dist/ast/index.js +1 -1
  8. package/dist/cddl/index.cjs +1 -1
  9. package/dist/cddl/index.js +1 -1
  10. package/dist/cdn/index.cjs +2 -2
  11. package/dist/cdn/index.cjs.map +1 -1
  12. package/dist/cdn/index.d.ts +2 -0
  13. package/dist/cdn/index.js +26 -26
  14. package/dist/cdn/index.js.map +1 -1
  15. package/dist/cdn/serialize-utils.d.ts +35 -14
  16. package/dist/index.cjs +3 -3
  17. package/dist/index.d.ts +2 -1
  18. package/dist/index.js +3 -3
  19. package/dist/mapEntries-BJzyBUH5.cjs +13 -0
  20. package/dist/mapEntries-BJzyBUH5.cjs.map +1 -0
  21. package/dist/{mapEntries-DxrDre2P.js → mapEntries-Ci_dppP6.js} +1151 -1373
  22. package/dist/mapEntries-Ci_dppP6.js.map +1 -0
  23. package/dist/{schema-t_bdPk8_.cjs → schema-DgnkH0P6.cjs} +3 -3
  24. package/dist/{schema-t_bdPk8_.cjs.map → schema-DgnkH0P6.cjs.map} +1 -1
  25. package/dist/{schema-Bofmsptw.js → schema-y8G5mDIS.js} +3 -3
  26. package/dist/{schema-Bofmsptw.js.map → schema-y8G5mDIS.js.map} +1 -1
  27. package/dist/tokenizer-BD08xbyd.cjs +36 -0
  28. package/dist/tokenizer-BD08xbyd.cjs.map +1 -0
  29. package/dist/{tokenizer-CeuixxXi.js → tokenizer-N-vAvRdj.js} +350 -14
  30. package/dist/tokenizer-N-vAvRdj.js.map +1 -0
  31. package/dist/types.d.ts +14 -7
  32. package/package.json +1 -2
  33. package/dist/mapEntries-D2NyeCX3.cjs +0 -17
  34. package/dist/mapEntries-D2NyeCX3.cjs.map +0 -1
  35. package/dist/mapEntries-DxrDre2P.js.map +0 -1
  36. package/dist/tokenizer-CeuixxXi.js.map +0 -1
  37. package/dist/tokenizer-EciPlN0n.cjs +0 -30
  38. package/dist/tokenizer-EciPlN0n.cjs.map +0 -1
package/README.ja.md CHANGED
@@ -330,25 +330,6 @@ CBOR.format('`\\d+`', { preserveRawString: true });
330
330
  // '`\\d+`'
331
331
  ```
332
332
 
333
- ### ダブルクォート文字列の表記を保持する
334
-
335
- デフォルトでは、`CBOR.format()` はダブルクォートのテキスト文字列をデコード後の
336
- 値から再エスケープします。そのため `\uXXXX` エスケープはリテラル文字に変換され
337
- ます。`preserveTextString` を指定すると、連結されていない `"..."` リテラルを
338
- 元のソース表記のまま再出力します。(バッククォートの raw 文字列(`` `...` ``)
339
- はこのオプションではなく `preserveRawString` の対象です。`+` 連結を経由した
340
- 文字列は、このオプションを指定していても通常どおり正規化されます。)
341
-
342
- ```ts
343
- import { CBOR } from '@cbortech/cbor';
344
-
345
- CBOR.format('"caf\\u00e9"');
346
- // '"café"'
347
-
348
- CBOR.format('"caf\\u00e9"', { preserveTextString: true });
349
- // '"caf\\u00e9"'
350
- ```
351
-
352
333
  ### 数値リテラルの表記を保持する
353
334
 
354
335
  デフォルトでは、`CBOR.format()` は整数・浮動小数点数リテラルを正規化します。
package/README.md CHANGED
@@ -336,25 +336,6 @@ CBOR.format('`\\d+`', { preserveRawString: true });
336
336
  // '`\\d+`'
337
337
  ```
338
338
 
339
- ### Preserve double-quoted string spelling
340
-
341
- By default, `CBOR.format()` re-escapes double-quoted text strings from their
342
- decoded value, so e.g. a `\uXXXX` escape becomes the literal character.
343
- `preserveTextString` re-emits a non-concatenated `"..."` literal using its
344
- original source spelling instead. (Raw backtick literals such as `` `...` ``
345
- are covered by `preserveRawString`, not this option; a string reached via
346
- `+` concatenation is normalised as usual regardless of this option.)
347
-
348
- ```ts
349
- import { CBOR } from '@cbortech/cbor';
350
-
351
- CBOR.format('"caf\\u00e9"');
352
- // '"café"'
353
-
354
- CBOR.format('"caf\\u00e9"', { preserveTextString: true });
355
- // '"caf\\u00e9"'
356
- ```
357
-
358
339
  ### Preserve number literal spelling
359
340
 
360
341
  By default, `CBOR.format()` normalizes integer and floating-point literals:
@@ -9,6 +9,17 @@ export interface CborByteStringPart {
9
9
  source?: string;
10
10
  /** Which comment syntax `source` recognizes, if any — see `ednCommentSyntax`. */
11
11
  commentSyntax?: ByteCommentSyntax;
12
+ /**
13
+ * Source span of this part's own literal token, when known — used to place
14
+ * a comment sitting between two `+`-joined parts (attached to the whole
15
+ * `CborByteString` as a `dangling` comment, since there is no per-part AST
16
+ * node for it to attach to) at the right gap in `_toCDN`'s
17
+ * `preserveConcatenation` branch. `undefined` for a part merged from a
18
+ * single elided literal's own internal segments, which cannot have a
19
+ * comment between them.
20
+ */
21
+ start?: number;
22
+ end?: number;
12
23
  }
13
24
  /** CBOR Major Type 2 — definite-length byte string. */
14
25
  export declare class CborByteString extends CborItem {
@@ -33,6 +33,18 @@ export declare class CborTextString extends CborItem {
33
33
  * `textString`.
34
34
  */
35
35
  readonly ednPartIsByteString: readonly boolean[] | undefined;
36
+ /**
37
+ * Source span of each `ednParts` entry's own literal token, aligned by
38
+ * index — used to place a comment sitting between two `+`-joined parts at
39
+ * the right gap instead of dropping it (there is no per-part AST node for
40
+ * such a comment to attach to; it lands as `dangling` on this whole node
41
+ * instead — see `CborByteString.ednParts`'s equivalent doc). `undefined`
42
+ * for a node not parsed from a `+` chain at all.
43
+ */
44
+ readonly ednPartSpans: readonly {
45
+ start: number;
46
+ end: number;
47
+ }[] | undefined;
36
48
  constructor(value: string, options?: {
37
49
  encodingWidth?: EncodingWidth;
38
50
  ednParts?: readonly string[];
@@ -40,6 +52,10 @@ export declare class CborTextString extends CborItem {
40
52
  quotedEdnSource?: string;
41
53
  ednPartSources?: readonly (string | undefined)[];
42
54
  ednPartIsByteString?: readonly boolean[];
55
+ ednPartSpans?: readonly {
56
+ start: number;
57
+ end: number;
58
+ }[];
43
59
  });
44
60
  _encodeTo(writer: CborWriter, _options?: ToCBOROptions): void;
45
61
  _toCDN(options: ToCDNOptions | undefined, depth: number): string;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../mapEntries-D2NyeCX3.cjs");exports.CborArray=e.D,exports.CborBigNint=e._,exports.CborBigUint=e.v,exports.CborByteString=e.A,exports.CborEmbeddedCBOR=e.w,exports.CborFloat=e.M,exports.CborIndefiniteByteString=e.k,exports.CborIndefiniteTextString=e.O,exports.CborItem=e.I,exports.CborMap=e.E,exports.CborNint=e.P,exports.CborSimple=e.T,exports.CborTag=e.j,exports.CborTextString=e.h,exports.CborUint=e.F;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../mapEntries-BJzyBUH5.cjs");exports.CborArray=e.D,exports.CborBigNint=e._,exports.CborBigUint=e.v,exports.CborByteString=e.A,exports.CborEmbeddedCBOR=e.w,exports.CborFloat=e.M,exports.CborIndefiniteByteString=e.k,exports.CborIndefiniteTextString=e.O,exports.CborItem=e.I,exports.CborMap=e.E,exports.CborNint=e.P,exports.CborSimple=e.T,exports.CborTag=e.j,exports.CborTextString=e.h,exports.CborUint=e.F;
@@ -1,4 +1,5 @@
1
1
  export { CborItem } from './CborItem';
2
+ export type { AppSeqEncodingEdit, AppSeqSourceFeatures } from './CborItem';
2
3
  export { CborUint } from './CborUint';
3
4
  export { CborBigUint, CborBigNint } from './CborBignum';
4
5
  export { CborNint } from './CborNint';
package/dist/ast/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as e, D as t, E as n, F as r, I as i, M as a, O as o, P as s, T as c, _ as l, h as u, j as d, k as f, v as p, w as m } from "../mapEntries-DxrDre2P.js";
1
+ import { A as e, D as t, E as n, F as r, I as i, M as a, O as o, P as s, T as c, _ as l, h as u, j as d, k as f, v as p, w as m } from "../mapEntries-Ci_dppP6.js";
2
2
  export { t as CborArray, l as CborBigNint, p as CborBigUint, e as CborByteString, m as CborEmbeddedCBOR, a as CborFloat, f as CborIndefiniteByteString, o as CborIndefiniteTextString, i as CborItem, n as CborMap, s as CborNint, c as CborSimple, d as CborTag, u as CborTextString, r as CborUint };
@@ -1,3 +1,3 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../schema-t_bdPk8_.cjs");function t(e,t){let n=Math.max(0,Math.min(t,e.length)),r=1,i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===10&&(r++,i=t+1);return{line:r,column:n-i+1}}var n=class{static compile(t,n){return e.n(t,n)}};function r(t){let n=new e.o(t),r=[];for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}function i(t){let n=new e.o(t),r=[];try{for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}catch(i){let a=i instanceof e.l?i:new e.l(i instanceof Error?i.message:String(i)),o=n.lastEndOffset;if(o<t.length){let e=1,n=1;for(let r=0;r<o;r++)t[r]===`
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../schema-DgnkH0P6.cjs");function t(e,t){let n=Math.max(0,Math.min(t,e.length)),r=1,i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===10&&(r++,i=t+1);return{line:r,column:n-i+1}}var n=class{static compile(t,n){return e.n(t,n)}};function r(t){let n=new e.o(t),r=[];for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}function i(t){let n=new e.o(t),r=[];try{for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}catch(i){let a=i instanceof e.l?i:new e.l(i instanceof Error?i.message:String(i)),o=n.lastEndOffset;if(o<t.length){let e=1,n=1;for(let r=0;r<o;r++)t[r]===`
2
2
  `?(e++,n=1):n++;r.push({type:`ERROR`,value:t.slice(o),raw:t.slice(o),line:e,col:n,offset:o,endOffset:t.length})}return{tokens:r,comments:n.comments,error:a}}}exports.CDDL=n,exports.default=n,exports.CddlMismatchError=e.s,exports.CddlSchema=e.t,exports.CddlSemanticError=e.c,exports.CddlSyntaxError=e.l,exports.PRELUDE_CDDL=e.r,exports.getPreludeRules=e.i,exports.parseCDDL=e.a,exports.positionAt=t,exports.tokenize=r,exports.tokenizeLenient=i;
3
3
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../schema-Bofmsptw.js";
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../schema-y8G5mDIS.js";
2
2
  //#region src/cddl/position.ts
3
3
  function l(e, t) {
4
4
  let n = Math.max(0, Math.min(t, e.length)), r = 1, i = 0;
@@ -1,3 +1,3 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../tokenizer-EciPlN0n.cjs");function t(t){let n=new e.t(t),r=[];for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}function n(t){let n=new e.t(t),r=[];try{for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}catch(i){let a=i instanceof e.o?i:new e.o(i instanceof Error?i.message:String(i)),o=n.lastEndOffset;if(o<t.length){let e=1,n=1;for(let r=0;r<o;r++)t[r]===`
2
- `?(e++,n=1):n++;r.push({type:`ERROR`,value:t.slice(o),raw:t.slice(o),line:e,col:n,offset:o,endOffset:t.length})}return{tokens:r,comments:n.comments,error:a}}}exports.CdnSyntaxError=e.o,exports.tokenize=t,exports.tokenizeLenient=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../tokenizer-BD08xbyd.cjs");function t(t){let n=new e.t(t),r=[];for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}function n(t){let n=new e.t(t),r=[];try{for(;;){let e=n.consume();if(e.type===`EOF`)break;r.push(e)}return{tokens:r,comments:n.comments}}catch(i){let a=i instanceof e.D?i:new e.D(i instanceof Error?i.message:String(i)),o=n.lastEndOffset;if(o<t.length){let e=1,n=1;for(let r=0;r<o;r++)t[r]===`
2
+ `?(e++,n=1):n++;r.push({type:`ERROR`,value:t.slice(o),raw:t.slice(o),line:e,col:n,offset:o,endOffset:t.length})}return{tokens:r,comments:n.comments,error:a}}}exports.CdnSyntaxError=e.D,exports.adjustAppSeqIndicator=e.n,exports.adjustRawAppSeqSource=e.r,exports.canonicalEncodingWidth=e.i,exports.decideTaggedAppSeqRendering=e.s,exports.resolveEiSuffix=e._,exports.tokenize=t,exports.tokenizeLenient=n;
3
3
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../src/cdn/index.ts"],"sourcesContent":["/**\n * Public lower-level CDN tokenization API (`@cbortech/cbor/cdn`).\n *\n * Exposes the same lexer the parser uses, so tooling such as syntax\n * highlighters stays in exact agreement with parsing behavior.\n */\n\nimport { Tokenizer, type Token, type EdnComment } from './tokenizer';\nimport { CdnSyntaxError } from './errors';\n\nexport type { Token, TokenType, EdnComment } from './tokenizer';\nexport { CdnSyntaxError } from './errors';\n\nexport interface TokenizeResult {\n /** Scanned tokens in source order, excluding the final EOF token. */\n tokens: Token[];\n /** Comments encountered while scanning, in source order. */\n comments: EdnComment[];\n}\n\nexport interface TokenizeLenientResult extends TokenizeResult {\n /**\n * The scan failure, if any. When set, `tokens` ends with a synthetic\n * `ERROR` token covering the source from the last clean token to the end\n * of the input.\n */\n error?: CdnSyntaxError;\n}\n\n/**\n * Tokenize CDN text. Throws {@link CdnSyntaxError} on invalid input.\n */\nexport function tokenize(text: string): TokenizeResult {\n const tokenizer = new Tokenizer(text);\n const tokens: Token[] = [];\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n}\n\n/**\n * Error-tolerant tokenization for editors and highlighters: never throws on\n * invalid input. Tokens before the failure are returned as scanned; the\n * remainder of the input is covered by a single synthetic `ERROR` token and\n * the failure is reported in `error`.\n */\nexport function tokenizeLenient(text: string): TokenizeLenientResult {\n const tokenizer = new Tokenizer(text);\n const tokens: Token[] = [];\n try {\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n } catch (e) {\n const error =\n e instanceof CdnSyntaxError\n ? e\n : new CdnSyntaxError(e instanceof Error ? e.message : String(e));\n const start = tokenizer.lastEndOffset;\n if (start < text.length) {\n let line = 1;\n let col = 1;\n for (let i = 0; i < start; i++) {\n if (text[i] === '\\n') {\n line++;\n col = 1;\n } else {\n col++;\n }\n }\n tokens.push({\n type: 'ERROR',\n value: text.slice(start),\n raw: text.slice(start),\n line,\n col,\n offset: start,\n endOffset: text.length,\n });\n }\n return { tokens, comments: tokenizer.comments, error };\n }\n}\n"],"mappings":"gHAgCA,SAAgB,EAAS,EAA8B,CACrD,IAAM,EAAY,IAAI,EAAA,EAAU,CAAI,EAC9B,EAAkB,CAAC,EACzB,OAAS,CACP,IAAM,EAAM,EAAU,QAAQ,EAC9B,GAAI,EAAI,OAAS,MAAO,MACxB,EAAO,KAAK,CAAG,CACjB,CACA,MAAO,CAAE,SAAQ,SAAU,EAAU,QAAS,CAChD,CAQA,SAAgB,EAAgB,EAAqC,CACnE,IAAM,EAAY,IAAI,EAAA,EAAU,CAAI,EAC9B,EAAkB,CAAC,EACzB,GAAI,CACF,OAAS,CACP,IAAM,EAAM,EAAU,QAAQ,EAC9B,GAAI,EAAI,OAAS,MAAO,MACxB,EAAO,KAAK,CAAG,CACjB,CACA,MAAO,CAAE,SAAQ,SAAU,EAAU,QAAS,CAChD,OAAS,EAAG,CACV,IAAM,EACJ,aAAa,EAAA,EACT,EACA,IAAI,EAAA,EAAe,aAAa,MAAQ,EAAE,QAAU,OAAO,CAAC,CAAC,EAC7D,EAAQ,EAAU,cACxB,GAAI,EAAQ,EAAK,OAAQ,CACvB,IAAI,EAAO,EACP,EAAM,EACV,IAAK,IAAI,EAAI,EAAG,EAAI,EAAO,IACrB,EAAK,KAAO;GACd,IACA,EAAM,GAEN,IAGJ,EAAO,KAAK,CACV,KAAM,QACN,MAAO,EAAK,MAAM,CAAK,EACvB,IAAK,EAAK,MAAM,CAAK,EACrB,OACA,MACA,OAAQ,EACR,UAAW,EAAK,MAClB,CAAC,CACH,CACA,MAAO,CAAE,SAAQ,SAAU,EAAU,SAAU,OAAM,CACvD,CACF"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/cdn/index.ts"],"sourcesContent":["/**\n * Public lower-level CDN tokenization and serialization API\n * (`@cbortech/cbor/cdn`).\n *\n * Exposes the same lexer the parser uses, so tooling such as syntax\n * highlighters stays in exact agreement with parsing behavior. Also exposes\n * the `preserveAppSequence` source-preservation primitives that the built-in\n * `dt`/`ip`/`cri` extensions use, so a third-party `CborExtension` whose\n * result has its own dedicated notation (regenerated from a resolved value,\n * the way `dt'...'`/`ip'...'`/`cri'...'` do) can support `preserveAppSequence`\n * too, instead of always discarding the original `` prefix`...` ``,\n * non-canonical `prefix'...'`, or raw-tag `N(...)` source spelling. See the\n * `dt`/`ip`/`cri` extension sources for the pattern these are meant to be\n * used in.\n */\n\nimport { Tokenizer, type Token, type EdnComment } from './tokenizer';\nimport { CdnSyntaxError } from './errors';\n\nexport type { Token, TokenType, EdnComment } from './tokenizer';\nexport { CdnSyntaxError } from './errors';\n\nexport {\n resolveEiSuffix,\n canonicalEncodingWidth,\n decideTaggedAppSeqRendering,\n adjustRawAppSeqSource,\n adjustAppSeqIndicator,\n} from './serialize-utils';\nexport type { AppSeqRenderDecision } from './serialize-utils';\n\nexport interface TokenizeResult {\n /** Scanned tokens in source order, excluding the final EOF token. */\n tokens: Token[];\n /** Comments encountered while scanning, in source order. */\n comments: EdnComment[];\n}\n\nexport interface TokenizeLenientResult extends TokenizeResult {\n /**\n * The scan failure, if any. When set, `tokens` ends with a synthetic\n * `ERROR` token covering the source from the last clean token to the end\n * of the input.\n */\n error?: CdnSyntaxError;\n}\n\n/**\n * Tokenize CDN text. Throws {@link CdnSyntaxError} on invalid input.\n */\nexport function tokenize(text: string): TokenizeResult {\n const tokenizer = new Tokenizer(text);\n const tokens: Token[] = [];\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n}\n\n/**\n * Error-tolerant tokenization for editors and highlighters: never throws on\n * invalid input. Tokens before the failure are returned as scanned; the\n * remainder of the input is covered by a single synthetic `ERROR` token and\n * the failure is reported in `error`.\n */\nexport function tokenizeLenient(text: string): TokenizeLenientResult {\n const tokenizer = new Tokenizer(text);\n const tokens: Token[] = [];\n try {\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n } catch (e) {\n const error =\n e instanceof CdnSyntaxError\n ? e\n : new CdnSyntaxError(e instanceof Error ? e.message : String(e));\n const start = tokenizer.lastEndOffset;\n if (start < text.length) {\n let line = 1;\n let col = 1;\n for (let i = 0; i < start; i++) {\n if (text[i] === '\\n') {\n line++;\n col = 1;\n } else {\n col++;\n }\n }\n tokens.push({\n type: 'ERROR',\n value: text.slice(start),\n raw: text.slice(start),\n line,\n col,\n offset: start,\n endOffset: text.length,\n });\n }\n return { tokens, comments: tokenizer.comments, error };\n }\n}\n"],"mappings":"gHAkDA,SAAgB,EAAS,EAA8B,CACrD,IAAM,EAAY,IAAI,EAAA,EAAU,CAAI,EAC9B,EAAkB,CAAC,EACzB,OAAS,CACP,IAAM,EAAM,EAAU,QAAQ,EAC9B,GAAI,EAAI,OAAS,MAAO,MACxB,EAAO,KAAK,CAAG,CACjB,CACA,MAAO,CAAE,SAAQ,SAAU,EAAU,QAAS,CAChD,CAQA,SAAgB,EAAgB,EAAqC,CACnE,IAAM,EAAY,IAAI,EAAA,EAAU,CAAI,EAC9B,EAAkB,CAAC,EACzB,GAAI,CACF,OAAS,CACP,IAAM,EAAM,EAAU,QAAQ,EAC9B,GAAI,EAAI,OAAS,MAAO,MACxB,EAAO,KAAK,CAAG,CACjB,CACA,MAAO,CAAE,SAAQ,SAAU,EAAU,QAAS,CAChD,OAAS,EAAG,CACV,IAAM,EACJ,aAAa,EAAA,EACT,EACA,IAAI,EAAA,EAAe,aAAa,MAAQ,EAAE,QAAU,OAAO,CAAC,CAAC,EAC7D,EAAQ,EAAU,cACxB,GAAI,EAAQ,EAAK,OAAQ,CACvB,IAAI,EAAO,EACP,EAAM,EACV,IAAK,IAAI,EAAI,EAAG,EAAI,EAAO,IACrB,EAAK,KAAO;GACd,IACA,EAAM,GAEN,IAGJ,EAAO,KAAK,CACV,KAAM,QACN,MAAO,EAAK,MAAM,CAAK,EACvB,IAAK,EAAK,MAAM,CAAK,EACrB,OACA,MACA,OAAQ,EACR,UAAW,EAAK,MAClB,CAAC,CACH,CACA,MAAO,CAAE,SAAQ,SAAU,EAAU,SAAU,OAAM,CACvD,CACF"}
@@ -2,6 +2,8 @@ import { Token, EdnComment } from './tokenizer';
2
2
  import { CdnSyntaxError } from './errors';
3
3
  export type { Token, TokenType, EdnComment } from './tokenizer';
4
4
  export { CdnSyntaxError } from './errors';
5
+ export { resolveEiSuffix, canonicalEncodingWidth, decideTaggedAppSeqRendering, adjustRawAppSeqSource, adjustAppSeqIndicator, } from './serialize-utils';
6
+ export type { AppSeqRenderDecision } from './serialize-utils';
5
7
  export interface TokenizeResult {
6
8
  /** Scanned tokens in source order, excluding the final EOF token. */
7
9
  tokens: Token[];
package/dist/cdn/index.js CHANGED
@@ -1,52 +1,52 @@
1
- import { o as e, t } from "../tokenizer-CeuixxXi.js";
1
+ import { D as e, _ as t, i as n, n as r, r as i, s as a, t as o } from "../tokenizer-N-vAvRdj.js";
2
2
  //#region src/cdn/index.ts
3
- function n(e) {
4
- let n = new t(e), r = [];
3
+ function s(e) {
4
+ let t = new o(e), n = [];
5
5
  for (;;) {
6
- let e = n.consume();
6
+ let e = t.consume();
7
7
  if (e.type === "EOF") break;
8
- r.push(e);
8
+ n.push(e);
9
9
  }
10
10
  return {
11
- tokens: r,
12
- comments: n.comments
11
+ tokens: n,
12
+ comments: t.comments
13
13
  };
14
14
  }
15
- function r(n) {
16
- let r = new t(n), i = [];
15
+ function c(t) {
16
+ let n = new o(t), r = [];
17
17
  try {
18
18
  for (;;) {
19
- let e = r.consume();
19
+ let e = n.consume();
20
20
  if (e.type === "EOF") break;
21
- i.push(e);
21
+ r.push(e);
22
22
  }
23
23
  return {
24
- tokens: i,
25
- comments: r.comments
24
+ tokens: r,
25
+ comments: n.comments
26
26
  };
27
- } catch (t) {
28
- let a = t instanceof e ? t : new e(t instanceof Error ? t.message : String(t)), o = r.lastEndOffset;
29
- if (o < n.length) {
30
- let e = 1, t = 1;
31
- for (let r = 0; r < o; r++) n[r] === "\n" ? (e++, t = 1) : t++;
32
- i.push({
27
+ } catch (i) {
28
+ let a = i instanceof e ? i : new e(i instanceof Error ? i.message : String(i)), o = n.lastEndOffset;
29
+ if (o < t.length) {
30
+ let e = 1, n = 1;
31
+ for (let r = 0; r < o; r++) t[r] === "\n" ? (e++, n = 1) : n++;
32
+ r.push({
33
33
  type: "ERROR",
34
- value: n.slice(o),
35
- raw: n.slice(o),
34
+ value: t.slice(o),
35
+ raw: t.slice(o),
36
36
  line: e,
37
- col: t,
37
+ col: n,
38
38
  offset: o,
39
- endOffset: n.length
39
+ endOffset: t.length
40
40
  });
41
41
  }
42
42
  return {
43
- tokens: i,
44
- comments: r.comments,
43
+ tokens: r,
44
+ comments: n.comments,
45
45
  error: a
46
46
  };
47
47
  }
48
48
  }
49
49
  //#endregion
50
- export { e as CdnSyntaxError, n as tokenize, r as tokenizeLenient };
50
+ export { e as CdnSyntaxError, r as adjustAppSeqIndicator, i as adjustRawAppSeqSource, n as canonicalEncodingWidth, a as decideTaggedAppSeqRendering, t as resolveEiSuffix, s as tokenize, c as tokenizeLenient };
51
51
 
52
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/cdn/index.ts"],"sourcesContent":["/**\n * Public lower-level CDN tokenization API (`@cbortech/cbor/cdn`).\n *\n * Exposes the same lexer the parser uses, so tooling such as syntax\n * highlighters stays in exact agreement with parsing behavior.\n */\n\nimport { Tokenizer, type Token, type EdnComment } from './tokenizer';\nimport { CdnSyntaxError } from './errors';\n\nexport type { Token, TokenType, EdnComment } from './tokenizer';\nexport { CdnSyntaxError } from './errors';\n\nexport interface TokenizeResult {\n /** Scanned tokens in source order, excluding the final EOF token. */\n tokens: Token[];\n /** Comments encountered while scanning, in source order. */\n comments: EdnComment[];\n}\n\nexport interface TokenizeLenientResult extends TokenizeResult {\n /**\n * The scan failure, if any. When set, `tokens` ends with a synthetic\n * `ERROR` token covering the source from the last clean token to the end\n * of the input.\n */\n error?: CdnSyntaxError;\n}\n\n/**\n * Tokenize CDN text. Throws {@link CdnSyntaxError} on invalid input.\n */\nexport function tokenize(text: string): TokenizeResult {\n const tokenizer = new Tokenizer(text);\n const tokens: Token[] = [];\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n}\n\n/**\n * Error-tolerant tokenization for editors and highlighters: never throws on\n * invalid input. Tokens before the failure are returned as scanned; the\n * remainder of the input is covered by a single synthetic `ERROR` token and\n * the failure is reported in `error`.\n */\nexport function tokenizeLenient(text: string): TokenizeLenientResult {\n const tokenizer = new Tokenizer(text);\n const tokens: Token[] = [];\n try {\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n } catch (e) {\n const error =\n e instanceof CdnSyntaxError\n ? e\n : new CdnSyntaxError(e instanceof Error ? e.message : String(e));\n const start = tokenizer.lastEndOffset;\n if (start < text.length) {\n let line = 1;\n let col = 1;\n for (let i = 0; i < start; i++) {\n if (text[i] === '\\n') {\n line++;\n col = 1;\n } else {\n col++;\n }\n }\n tokens.push({\n type: 'ERROR',\n value: text.slice(start),\n raw: text.slice(start),\n line,\n col,\n offset: start,\n endOffset: text.length,\n });\n }\n return { tokens, comments: tokenizer.comments, error };\n }\n}\n"],"mappings":";;AAgCA,SAAgB,EAAS,GAA8B;CACrD,IAAM,IAAY,IAAI,EAAU,CAAI,GAC9B,IAAkB,CAAC;CACzB,SAAS;EACP,IAAM,IAAM,EAAU,QAAQ;EAC9B,IAAI,EAAI,SAAS,OAAO;EACxB,EAAO,KAAK,CAAG;CACjB;CACA,OAAO;EAAE;EAAQ,UAAU,EAAU;CAAS;AAChD;AAQA,SAAgB,EAAgB,GAAqC;CACnE,IAAM,IAAY,IAAI,EAAU,CAAI,GAC9B,IAAkB,CAAC;CACzB,IAAI;EACF,SAAS;GACP,IAAM,IAAM,EAAU,QAAQ;GAC9B,IAAI,EAAI,SAAS,OAAO;GACxB,EAAO,KAAK,CAAG;EACjB;EACA,OAAO;GAAE;GAAQ,UAAU,EAAU;EAAS;CAChD,SAAS,GAAG;EACV,IAAM,IACJ,aAAa,IACT,IACA,IAAI,EAAe,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC,GAC7D,IAAQ,EAAU;EACxB,IAAI,IAAQ,EAAK,QAAQ;GACvB,IAAI,IAAO,GACP,IAAM;GACV,KAAK,IAAI,IAAI,GAAG,IAAI,GAAO,KACzB,AAAI,EAAK,OAAO,QACd,KACA,IAAM,KAEN;GAGJ,EAAO,KAAK;IACV,MAAM;IACN,OAAO,EAAK,MAAM,CAAK;IACvB,KAAK,EAAK,MAAM,CAAK;IACrB;IACA;IACA,QAAQ;IACR,WAAW,EAAK;GAClB,CAAC;EACH;EACA,OAAO;GAAE;GAAQ,UAAU,EAAU;GAAU;EAAM;CACvD;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/cdn/index.ts"],"sourcesContent":["/**\n * Public lower-level CDN tokenization and serialization API\n * (`@cbortech/cbor/cdn`).\n *\n * Exposes the same lexer the parser uses, so tooling such as syntax\n * highlighters stays in exact agreement with parsing behavior. Also exposes\n * the `preserveAppSequence` source-preservation primitives that the built-in\n * `dt`/`ip`/`cri` extensions use, so a third-party `CborExtension` whose\n * result has its own dedicated notation (regenerated from a resolved value,\n * the way `dt'...'`/`ip'...'`/`cri'...'` do) can support `preserveAppSequence`\n * too, instead of always discarding the original `` prefix`...` ``,\n * non-canonical `prefix'...'`, or raw-tag `N(...)` source spelling. See the\n * `dt`/`ip`/`cri` extension sources for the pattern these are meant to be\n * used in.\n */\n\nimport { Tokenizer, type Token, type EdnComment } from './tokenizer';\nimport { CdnSyntaxError } from './errors';\n\nexport type { Token, TokenType, EdnComment } from './tokenizer';\nexport { CdnSyntaxError } from './errors';\n\nexport {\n resolveEiSuffix,\n canonicalEncodingWidth,\n decideTaggedAppSeqRendering,\n adjustRawAppSeqSource,\n adjustAppSeqIndicator,\n} from './serialize-utils';\nexport type { AppSeqRenderDecision } from './serialize-utils';\n\nexport interface TokenizeResult {\n /** Scanned tokens in source order, excluding the final EOF token. */\n tokens: Token[];\n /** Comments encountered while scanning, in source order. */\n comments: EdnComment[];\n}\n\nexport interface TokenizeLenientResult extends TokenizeResult {\n /**\n * The scan failure, if any. When set, `tokens` ends with a synthetic\n * `ERROR` token covering the source from the last clean token to the end\n * of the input.\n */\n error?: CdnSyntaxError;\n}\n\n/**\n * Tokenize CDN text. Throws {@link CdnSyntaxError} on invalid input.\n */\nexport function tokenize(text: string): TokenizeResult {\n const tokenizer = new Tokenizer(text);\n const tokens: Token[] = [];\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n}\n\n/**\n * Error-tolerant tokenization for editors and highlighters: never throws on\n * invalid input. Tokens before the failure are returned as scanned; the\n * remainder of the input is covered by a single synthetic `ERROR` token and\n * the failure is reported in `error`.\n */\nexport function tokenizeLenient(text: string): TokenizeLenientResult {\n const tokenizer = new Tokenizer(text);\n const tokens: Token[] = [];\n try {\n for (;;) {\n const tok = tokenizer.consume();\n if (tok.type === 'EOF') break;\n tokens.push(tok);\n }\n return { tokens, comments: tokenizer.comments };\n } catch (e) {\n const error =\n e instanceof CdnSyntaxError\n ? e\n : new CdnSyntaxError(e instanceof Error ? e.message : String(e));\n const start = tokenizer.lastEndOffset;\n if (start < text.length) {\n let line = 1;\n let col = 1;\n for (let i = 0; i < start; i++) {\n if (text[i] === '\\n') {\n line++;\n col = 1;\n } else {\n col++;\n }\n }\n tokens.push({\n type: 'ERROR',\n value: text.slice(start),\n raw: text.slice(start),\n line,\n col,\n offset: start,\n endOffset: text.length,\n });\n }\n return { tokens, comments: tokenizer.comments, error };\n }\n}\n"],"mappings":";;AAkDA,SAAgB,EAAS,GAA8B;CACrD,IAAM,IAAY,IAAI,EAAU,CAAI,GAC9B,IAAkB,CAAC;CACzB,SAAS;EACP,IAAM,IAAM,EAAU,QAAQ;EAC9B,IAAI,EAAI,SAAS,OAAO;EACxB,EAAO,KAAK,CAAG;CACjB;CACA,OAAO;EAAE;EAAQ,UAAU,EAAU;CAAS;AAChD;AAQA,SAAgB,EAAgB,GAAqC;CACnE,IAAM,IAAY,IAAI,EAAU,CAAI,GAC9B,IAAkB,CAAC;CACzB,IAAI;EACF,SAAS;GACP,IAAM,IAAM,EAAU,QAAQ;GAC9B,IAAI,EAAI,SAAS,OAAO;GACxB,EAAO,KAAK,CAAG;EACjB;EACA,OAAO;GAAE;GAAQ,UAAU,EAAU;EAAS;CAChD,SAAS,GAAG;EACV,IAAM,IACJ,aAAa,IACT,IACA,IAAI,EAAe,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC,GAC7D,IAAQ,EAAU;EACxB,IAAI,IAAQ,EAAK,QAAQ;GACvB,IAAI,IAAO,GACP,IAAM;GACV,KAAK,IAAI,IAAI,GAAG,IAAI,GAAO,KACzB,AAAI,EAAK,OAAO,QACd,KACA,IAAM,KAEN;GAGJ,EAAO,KAAK;IACV,MAAM;IACN,OAAO,EAAK,MAAM,CAAK;IACvB,KAAK,EAAK,MAAM,CAAK;IACrB;IACA;IACA,QAAQ;IACR,WAAW,EAAK;GAClB,CAAC;EACH;EACA,OAAO;GAAE;GAAQ,UAAU,EAAU;GAAU;EAAM;CACvD;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { CborComment, CborComments, ToCDNOptions } from '../types';
2
2
  import { EncodingWidth } from '../cbor/encode';
3
+ import { AppSeqEncodingEdit, AppSeqSourceFeatures } from '../ast/CborItem';
3
4
  /** Resolve indent option to a string, or null for single-line output. */
4
5
  export declare function resolveIndent(options: ToCDNOptions | undefined): string | null;
5
6
  /** Build the indent prefix for a given depth. */
@@ -9,8 +10,15 @@ export declare function indentOf(indentStr: string, depth: number): string;
9
10
  *
10
11
  * Single-line (` + `) when indent is disabled; otherwise each continuation
11
12
  * part starts on its own line, indented one level deeper than the owner.
13
+ *
14
+ * `midComments`, when given, holds already-converted comment lines for each
15
+ * gap between two consecutive parts (`midComments[i]` sits between
16
+ * `literals[i]` and `literals[i + 1]`) — e.g. a comment between two
17
+ * `+`-joined byte-string literals, which has nowhere else to attach since
18
+ * there is no per-part AST node. Ignored in single-line mode, matching every
19
+ * other comment kind.
12
20
  */
13
- export declare function joinConcatParts(literals: readonly string[], indentStr: string | null, depth: number): string;
21
+ export declare function joinConcatParts(literals: readonly string[], indentStr: string | null, depth: number, midComments?: readonly (readonly string[])[]): string;
14
22
  export interface Commented {
15
23
  comments?: CborComments;
16
24
  blankLineBefore?: boolean;
@@ -30,6 +38,31 @@ export declare function hasContainerLayoutComments(item: Commented): boolean;
30
38
  * this (e.g. `/**…*\/` → `/ *…/`).
31
39
  */
32
40
  export declare function convertCommentText(comment: CborComment, style: 'c-style' | 'cdn-style' | undefined): string;
41
+ /**
42
+ * Bucket a flat, source-ordered list of comments (typically a node's own
43
+ * `comments.dangling`) by which gap between two consecutive `parts` each
44
+ * one's offset falls into — `result[i]` sits between `parts[i]` and
45
+ * `parts[i + 1]`, already converted to the requested marker style.
46
+ *
47
+ * Used for a comment that sits between two `+`-joined fragments merged into
48
+ * a single value with no per-fragment AST node of its own to attach to (a
49
+ * concatenated `CborByteString`'s own `ednParts`, or — inside a bytes
50
+ * elision — a `CborEllipsis` item's `ednParts`): `attachComments` can only
51
+ * land such a comment on the merged node as a whole, as `dangling`, so this
52
+ * re-derives which specific gap it belongs in from each part's own
53
+ * `start`/`end` span. A comment is dropped (as it already was before this
54
+ * function existed) when either neighbouring part lacks a known span — a
55
+ * part merged from a single elided literal's own internal segments, which
56
+ * cannot have a comment between them anyway (see `_elidedHexAtoms`).
57
+ *
58
+ * Returns `undefined` (rather than an all-empty array) when nothing landed
59
+ * in any gap, so callers can cheaply skip the mid-comment rendering path
60
+ * entirely in the common case.
61
+ */
62
+ export declare function danglingCommentsByGap(dangling: readonly CborComment[] | undefined, parts: readonly {
63
+ start?: number;
64
+ end?: number;
65
+ }[] | undefined, style: 'c-style' | 'cdn-style' | undefined): string[][] | undefined;
33
66
  /**
34
67
  * Split an item's leading comments into ones that get their own line above
35
68
  * it, and a trailing run of comments the parser found on the same source
@@ -210,12 +243,6 @@ export declare function canonicalEncodingWidth(n: bigint): EncodingWidth;
210
243
  export declare function resolveEiSuffix(options: ToCDNOptions | undefined, encodingWidth: EncodingWidth | undefined, getCanonical: () => EncodingWidth): string;
211
244
  /** How a node should render under `preserveAppSequence`. */
212
245
  export type AppSeqRenderDecision = 'verbatim' | 'adjusted' | 'source' | 'structural' | 'normal';
213
- interface AppSeqSourceFeatures {
214
- byteString?: boolean;
215
- textString?: boolean;
216
- rawString?: boolean;
217
- concatenation?: boolean;
218
- }
219
246
  /**
220
247
  * Decide how an extension result node — from a `prefix'...'` /
221
248
  * `` prefix`...` `` / `prefix<<...>>` source, or (for a tag-wrapper node
@@ -269,12 +296,7 @@ interface AppSeqSourceFeatures {
269
296
  */
270
297
  export declare function decideTaggedAppSeqRendering(options: ToCDNOptions | undefined, appSeqSource: string | undefined, ednSource: string | undefined, sourceFeatures?: AppSeqSourceFeatures, editsComplete?: boolean): AppSeqRenderDecision;
271
298
  /** Apply comment/EI options directly to a preserved raw-tag source. */
272
- export declare function adjustRawAppSeqSource(appSeqSource: string, options: ToCDNOptions | undefined, comments: readonly CborComment[] | undefined, encodingEdits: readonly {
273
- start: number;
274
- end: number;
275
- always: string;
276
- never: string;
277
- }[] | undefined): string;
299
+ export declare function adjustRawAppSeqSource(appSeqSource: string, options: ToCDNOptions | undefined, comments: readonly CborComment[] | undefined, encodingEdits: readonly AppSeqEncodingEdit[] | undefined): string;
278
300
  /**
279
301
  * Adjust an `'adjusted'` app-string/-sequence source: apply requested comment
280
302
  * conversion/removal by captured source span, strip the existing
@@ -291,4 +313,3 @@ export declare function adjustRawAppSeqSource(appSeqSource: string, options: ToC
291
313
  * reliable way to locate it.
292
314
  */
293
315
  export declare function adjustAppSeqIndicator(appSeqSource: string, newSuffix: string, options: ToCDNOptions | undefined, innerItemEnd: number | undefined, comments: readonly CborComment[] | undefined): string;
294
- export {};
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./tokenizer-EciPlN0n.cjs"),t=require("./schema-t_bdPk8_.cjs"),n=require("./mapEntries-D2NyeCX3.cjs");function r(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var i={appStringPrefixes:[`same`],preserveAppSeqSource:!0,parseAppSequence(e,t,n){if(t.length===0)throw SyntaxError(`same<<...>> requires at least one item`);let i=t[0],a=i.toCBOR();for(let e=1;e<t.length;e++)if(!r(a,t[e].toCBOR())){let t=`same<<...>>: item ${e} produces different CBOR bytes than item 0`;if(n)n(t);else throw SyntaxError(t)}return i}},a=new Map,o=64;function s(e){if(typeof e!=`string`)return e;let n=a.get(e);return n||(n=t.n(e),a.size>=o&&a.delete(a.keys().next().value),a.set(e,n)),n}function c(e,n,r){if(n){let i=n.validate(e,r);if(!i.valid)throw new t.s(i.errors,i.warnings)}return e}function l(e,t){return c(e,s(t?.cddl),t?.cddlValidationOptions)}var u=class t{static OMIT=n.z;static TAG=n.B;static Tag=n.H;static Simple=n.R;static MapEntries=n.t;static dt_as_Date=n.m;#e;constructor(e){this.#e=e??{}}#t(e){return{...this.#e,...e??{}}}fromCBOR(e,n){let r=t.fromCBOR(e,this.#t(n));return r._defaults=this.#e,r}fromCDN(e,n){let r=t.fromCDN(e,this.#t(n));return r._defaults=this.#e,r}fromEDN(e,t){return this.fromCDN(e,t)}fromJS(e,n){let r=t.fromJS(e,this.#t(n));return r._defaults=this.#e,r}fromHexDump(e,n){let r=t.fromHexDump(e,this.#t(n));return r._defaults=this.#e,r}*fromCBORSeq(e,n){for(let r of t.fromCBORSeq(e,this.#t(n)))r._defaults=this.#e,yield r}*fromCDNSeq(e,n){for(let r of t.fromCDNSeq(e,this.#t(n)))r._defaults=this.#e,yield r}*fromHexDumpSeq(e,n){for(let r of t.fromHexDumpSeq(e,this.#t(n)))r._defaults=this.#e,yield r}decode(e,n){return t.decode(e,this.#t(n))}*decodeSeq(e,n){yield*t.decodeSeq(e,this.#t(n))}*parseSeq(e,n){yield*t.parseSeq(e,this.#t(n))}encode(e,n){return t.encode(e,this.#t(n))}compile(e,n){return t.compile(e,this.#t(n))}decompile(e,n){return t.decompile(e,this.#t(n))}toHex(e,n){return t.toHex(e,this.#t(n))}fromHex(e,n){return t.fromHex(e,this.#t(n))}validate(e,n){return t.validate(e,this.#t(n))}cborToCborEdn(e,t){return this.cborToCdn(e,t)}cborToCdn(e,n){let r=this.#t(n),i=t.fromCBOR(e,r);return i._defaults=this.#e,i.toCDN(r)}cborEdnToCbor(e,t){return this.cdnToCbor(e,t)}cdnToCbor(e,n){let r=this.#t(n);return t.fromCDN(e,r).toCBOR(r)}parse(e,n){if(typeof n==`function`){let r=this.#t({reviver:n});return t.fromCDN(e,r).toJS(r)}let r=this.#t(n);return t.fromCDN(e,r).toJS(r)}stringify(e,n,r){if(typeof n==`function`||Array.isArray(n)||n===null||n===void 0&&r!==void 0){let i={...this.#e};return n===null?i.replacer=void 0:(typeof n==`function`||Array.isArray(n))&&(i.replacer=n),r!==void 0&&(i.indent=_(r)),t.stringify(e,i)}return t.stringify(e,this.#t(n??void 0))}format(e,n){return t.format(e,this.#t(n))}static fromCBOR(e,t){return l(n.u(e,t),t)}static fromCDN(e,t){return l(n.g(e,t),t)}static fromEDN(e,n){return t.fromCDN(e,n)}static*fromHexDumpSeq(e,n){let r=[],i=d(e).trim().split(/\s+/).filter(Boolean);for(let e of i)if(/^[0-9A-Fa-f]{2}$/.test(e))r.push(parseInt(e,16));else if(/^[0-9A-Fa-f]+$/.test(e)&&e.length%2==0)for(let t=0;t<e.length;t+=2)r.push(parseInt(e.slice(t,t+2),16));else throw SyntaxError(`Invalid hex token in dump: ${JSON.stringify(e)}`);yield*t.fromCBORSeq(new Uint8Array(r),n)}static*fromCBORSeq(e,t){let r=s(t?.cddl),i=e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=0;for(;a<i.byteLength;){let e=n.u(i,{...t,offset:a,allowTrailing:!0});yield c(e,r,t?.cddlValidationOptions),a=e.end}}static*fromCDNSeq(t,r){let i=s(r?.cddl),a=!!r?.preserveComments,o=0,l=!0;for(;;){let{offset:s,hadSeparator:u,commaOffset:d}=g(t,o,r,a?l?`all`:`after-newline`:`none`);if(l&&d>=0){let e=`leading comma in CDN sequence`;if(r?.strict!==!1)throw SyntaxError(e);m(e,d,r)}if(s>=t.length||a&&h(t,s)&&g(t,s,r).offset>=t.length)break;if(!l&&!u){let e=`CDN sequence items must be separated by whitespace, comma, or comment`;if(r?.strict!==!1)throw SyntaxError(e);m(e,s,r)}o=s;let f;try{f=n.g(t,{...r,offset:o,allowTrailing:!0,_skipRS:!0})}catch(t){if(r?.strict!==!1)throw t;m(t instanceof Error?t.message:String(t),o,r,!0,t instanceof e.o?t:void 0);break}yield c(f,i,r?.cddlValidationOptions),o=f.end,l=!1}}static fromJS(e,t){return l(n.r(e,t),t)}static fromHexDump(e,t){let r=[],i=d(e).trim().split(/\s+/).filter(Boolean);for(let e of i)if(/^[0-9A-Fa-f]{2}$/.test(e))r.push(parseInt(e,16));else if(/^[0-9A-Fa-f]+$/.test(e)&&e.length%2==0)for(let t=0;t<e.length;t+=2)r.push(parseInt(e.slice(t,t+2),16));else throw SyntaxError(`Invalid hex token in dump: ${JSON.stringify(e)}`);return l(n.u(new Uint8Array(r),t),t)}static decode(e,n){return t.fromCBOR(e,n).toJS(n)}static*decodeSeq(e,n){for(let r of t.fromCBORSeq(e,n))yield r.toJS(n)}static*parseSeq(e,n){for(let r of t.fromCDNSeq(e,n))yield r.toJS(n)}static encode(e,n){return t.fromJS(e,n).toCBOR(n)}static compile(e,n){let r=[...t.fromCDNSeq(e,n)].map(e=>e.toCBOR(n)),i=r.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.length;return a}static decompile(e,n){return[...t.fromCBORSeq(e,n)].map(e=>e.toCDN(n)).join(`
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./tokenizer-BD08xbyd.cjs"),t=require("./schema-DgnkH0P6.cjs"),n=require("./mapEntries-BJzyBUH5.cjs");function r(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var i={appStringPrefixes:[`same`],preserveAppSeqSource:!0,parseAppSequence(e,t,n){if(t.length===0)throw SyntaxError(`same<<...>> requires at least one item`);let i=t[0],a=i.toCBOR();for(let e=1;e<t.length;e++)if(!r(a,t[e].toCBOR())){let t=`same<<...>>: item ${e} produces different CBOR bytes than item 0`;if(n)n(t);else throw SyntaxError(t)}return i}},a=new Map,o=64;function s(e){if(typeof e!=`string`)return e;let n=a.get(e);return n||(n=t.n(e),a.size>=o&&a.delete(a.keys().next().value),a.set(e,n)),n}function c(e,n,r){if(n){let i=n.validate(e,r);if(!i.valid)throw new t.s(i.errors,i.warnings)}return e}function l(e,t){return c(e,s(t?.cddl),t?.cddlValidationOptions)}var u=class t{static OMIT=n.z;static TAG=n.B;static Tag=n.H;static Simple=n.R;static MapEntries=n.t;static dt_as_Date=n.m;#e;constructor(e){this.#e=e??{}}#t(e){return{...this.#e,...e??{}}}fromCBOR(e,n){let r=t.fromCBOR(e,this.#t(n));return r._defaults=this.#e,r}fromCDN(e,n){let r=t.fromCDN(e,this.#t(n));return r._defaults=this.#e,r}fromEDN(e,t){return this.fromCDN(e,t)}fromJS(e,n){let r=t.fromJS(e,this.#t(n));return r._defaults=this.#e,r}fromHexDump(e,n){let r=t.fromHexDump(e,this.#t(n));return r._defaults=this.#e,r}*fromCBORSeq(e,n){for(let r of t.fromCBORSeq(e,this.#t(n)))r._defaults=this.#e,yield r}*fromCDNSeq(e,n){for(let r of t.fromCDNSeq(e,this.#t(n)))r._defaults=this.#e,yield r}*fromHexDumpSeq(e,n){for(let r of t.fromHexDumpSeq(e,this.#t(n)))r._defaults=this.#e,yield r}decode(e,n){return t.decode(e,this.#t(n))}*decodeSeq(e,n){yield*t.decodeSeq(e,this.#t(n))}*parseSeq(e,n){yield*t.parseSeq(e,this.#t(n))}encode(e,n){return t.encode(e,this.#t(n))}compile(e,n){return t.compile(e,this.#t(n))}decompile(e,n){return t.decompile(e,this.#t(n))}toHex(e,n){return t.toHex(e,this.#t(n))}fromHex(e,n){return t.fromHex(e,this.#t(n))}validate(e,n){return t.validate(e,this.#t(n))}cborToCborEdn(e,t){return this.cborToCdn(e,t)}cborToCdn(e,n){let r=this.#t(n),i=t.fromCBOR(e,r);return i._defaults=this.#e,i.toCDN(r)}cborEdnToCbor(e,t){return this.cdnToCbor(e,t)}cdnToCbor(e,n){let r=this.#t(n);return t.fromCDN(e,r).toCBOR(r)}parse(e,n){if(typeof n==`function`){let r=this.#t({reviver:n});return t.fromCDN(e,r).toJS(r)}let r=this.#t(n);return t.fromCDN(e,r).toJS(r)}stringify(e,n,r){if(typeof n==`function`||Array.isArray(n)||n===null||n===void 0&&r!==void 0){let i={...this.#e};return n===null?i.replacer=void 0:(typeof n==`function`||Array.isArray(n))&&(i.replacer=n),r!==void 0&&(i.indent=_(r)),t.stringify(e,i)}return t.stringify(e,this.#t(n??void 0))}format(e,n){return t.format(e,this.#t(n))}static fromCBOR(e,t){return l(n.u(e,t),t)}static fromCDN(e,t){return l(n.g(e,t),t)}static fromEDN(e,n){return t.fromCDN(e,n)}static*fromHexDumpSeq(e,n){let r=[],i=d(e).trim().split(/\s+/).filter(Boolean);for(let e of i)if(/^[0-9A-Fa-f]{2}$/.test(e))r.push(parseInt(e,16));else if(/^[0-9A-Fa-f]+$/.test(e)&&e.length%2==0)for(let t=0;t<e.length;t+=2)r.push(parseInt(e.slice(t,t+2),16));else throw SyntaxError(`Invalid hex token in dump: ${JSON.stringify(e)}`);yield*t.fromCBORSeq(new Uint8Array(r),n)}static*fromCBORSeq(e,t){let r=s(t?.cddl),i=e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=0;for(;a<i.byteLength;){let e=n.u(i,{...t,offset:a,allowTrailing:!0});yield c(e,r,t?.cddlValidationOptions),a=e.end}}static*fromCDNSeq(t,r){let i=s(r?.cddl),a=!!r?.preserveComments,o=0,l=!0;for(;;){let{offset:s,hadSeparator:u,commaOffset:d}=g(t,o,r,a?l?`all`:`after-newline`:`none`);if(l&&d>=0){let e=`leading comma in CDN sequence`;if(r?.strict!==!1)throw SyntaxError(e);m(e,d,r)}if(s>=t.length||a&&h(t,s)&&g(t,s,r).offset>=t.length)break;if(!l&&!u){let e=`CDN sequence items must be separated by whitespace, comma, or comment`;if(r?.strict!==!1)throw SyntaxError(e);m(e,s,r)}o=s;let f;try{f=n.g(t,{...r,offset:o,allowTrailing:!0,_skipRS:!0})}catch(t){if(r?.strict!==!1)throw t;m(t instanceof Error?t.message:String(t),o,r,!0,t instanceof e.D?t:void 0);break}yield c(f,i,r?.cddlValidationOptions),o=f.end,l=!1}}static fromJS(e,t){return l(n.r(e,t),t)}static fromHexDump(e,t){let r=[],i=d(e).trim().split(/\s+/).filter(Boolean);for(let e of i)if(/^[0-9A-Fa-f]{2}$/.test(e))r.push(parseInt(e,16));else if(/^[0-9A-Fa-f]+$/.test(e)&&e.length%2==0)for(let t=0;t<e.length;t+=2)r.push(parseInt(e.slice(t,t+2),16));else throw SyntaxError(`Invalid hex token in dump: ${JSON.stringify(e)}`);return l(n.u(new Uint8Array(r),t),t)}static decode(e,n){return t.fromCBOR(e,n).toJS(n)}static*decodeSeq(e,n){for(let r of t.fromCBORSeq(e,n))yield r.toJS(n)}static*parseSeq(e,n){for(let r of t.fromCDNSeq(e,n))yield r.toJS(n)}static encode(e,n){return t.fromJS(e,n).toCBOR(n)}static compile(e,n){let r=[...t.fromCDNSeq(e,n)].map(e=>e.toCBOR(n)),i=r.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.length;return a}static decompile(e,n){return[...t.fromCBORSeq(e,n)].map(e=>e.toCDN(n)).join(`
2
2
  `)}static toHex(e,n){return[...t.fromCBORSeq(e,n)].map(e=>e.toHexDump(n)).join(`
3
- `)}static fromHex(e,n){let r=[...t.fromHexDumpSeq(e,n)].map(e=>e.toCBOR(n)),i=r.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.length;return a}static validate(n,r){let i=[],a=[],o,c={strict:!1,extensions:r?.extensions,builtinExtensions:r?.builtinExtensions,onWarning:e=>{if(`hint`in e&&e.hint){a.push(e);return}if(`fatal`in e&&e.fatal){o=e;return}i.push(e)}},l=s(r?.cddl),u=[],d=[],f=e=>{if(!l)return;let t=l.validate(e,r?.cddlValidationOptions);u.push(...t.errors),t.warnings&&d.push(...t.warnings)},p=l?{cddlErrors:u,cddlWarnings:d}:{},m=0;try{let e=r?.type??`cbor`;if(e===`cdn`){let e={...c,unresolvedExtension:r?.unresolvedExtension};for(let r of t.fromCDNSeq(n,e))m++,f(r)}else if(e===`hex`)for(let e of t.fromHexDumpSeq(n,c))m++,f(e);else for(let e of t.fromCBORSeq(n,c))m++,f(e)}catch(e){return{valid:!1,count:m,warnings:i,hints:a,error:e instanceof Error?e:Error(String(e)),...p}}if(o){let t=o.cause instanceof Error?o.cause:new e.o(o.message,{offset:o.offset});return{valid:!1,count:m,warnings:i,hints:a,error:t,...p}}return{valid:i.length===0&&u.length===0,count:m,warnings:i,hints:a,...p}}static cborToCdn(e,n){return t.fromCBOR(e,n).toCDN(n)}static cborToCborEdn(e,n){return t.fromCBOR(e,n).toCDN(n)}static cdnToCbor(e,n){return t.fromCDN(e,n).toCBOR(n)}static cborEdnToCbor(e,n){return t.fromCDN(e,n).toCBOR(n)}static parse(e,n){return typeof n==`function`?t.fromCDN(e).toJS({reviver:n}):t.fromCDN(e,n).toJS(n)}static stringify(e,t,r){if(typeof t==`function`||Array.isArray(t)||t===null||t===void 0&&r!==void 0){let i=typeof t==`function`||Array.isArray(t)?t:void 0,a=_(r);if(i){let t=n.n(e,i);return t===void 0||t===n.z?void 0:n.r(t).toCDN(a===void 0?void 0:{indent:a})}return n.r(e).toCDN(a===void 0?void 0:{indent:a})}let i=t;if(i?.replacer){let t=n.n(e,i.replacer,i.extensions,i.undefinedOmits,i.builtinExtensions);if(t===void 0||t===n.z)return;let{replacer:r,...a}=i;return l(n.r(t,Object.keys(a).length>0?a:void 0),i).toCDN(i)}return l(n.r(e,i),i).toCDN(i)}static format(e,n){return t.fromCDN(e,n).toCDN(n)}};function d(e){let t=``,n=0;for(;n<e.length;){let r=e[n],i=e[n+1]??``;if(r===`-`&&i===`-`){n=f(e,n+2),t+=` `;continue}if(r===`—`){n=f(e,n+1),t+=` `;continue}if(r===`#`){n=f(e,n+1),t+=` `;continue}if(r===`/`&&i===`/`){n=f(e,n+2),t+=` `;continue}if(r===`/`&&i===`*`){let r=e.indexOf(`*/`,n+2);if(r<0)throw SyntaxError(`Unterminated comment in hex dump`);t+=p(e.slice(n,r+2)),n=r+2;continue}if(r===`/`){let r=e.indexOf(`/`,n+1);if(r<0)throw SyntaxError(`Unterminated comment in hex dump`);t+=p(e.slice(n,r+1)),n=r+1;continue}t+=r,n++}return t}function f(e,t){let n=e.indexOf(`
3
+ `)}static fromHex(e,n){let r=[...t.fromHexDumpSeq(e,n)].map(e=>e.toCBOR(n)),i=r.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.length;return a}static validate(n,r){let i=[],a=[],o,c={strict:!1,extensions:r?.extensions,builtinExtensions:r?.builtinExtensions,onWarning:e=>{if(`hint`in e&&e.hint){a.push(e);return}if(`fatal`in e&&e.fatal){o=e;return}i.push(e)}},l=s(r?.cddl),u=[],d=[],f=e=>{if(!l)return;let t=l.validate(e,r?.cddlValidationOptions);u.push(...t.errors),t.warnings&&d.push(...t.warnings)},p=l?{cddlErrors:u,cddlWarnings:d}:{},m=0;try{let e=r?.type??`cbor`;if(e===`cdn`){let e={...c,unresolvedExtension:r?.unresolvedExtension};for(let r of t.fromCDNSeq(n,e))m++,f(r)}else if(e===`hex`)for(let e of t.fromHexDumpSeq(n,c))m++,f(e);else for(let e of t.fromCBORSeq(n,c))m++,f(e)}catch(e){return{valid:!1,count:m,warnings:i,hints:a,error:e instanceof Error?e:Error(String(e)),...p}}if(o){let t=o.cause instanceof Error?o.cause:new e.D(o.message,{offset:o.offset});return{valid:!1,count:m,warnings:i,hints:a,error:t,...p}}return{valid:i.length===0&&u.length===0,count:m,warnings:i,hints:a,...p}}static cborToCdn(e,n){return t.fromCBOR(e,n).toCDN(n)}static cborToCborEdn(e,n){return t.fromCBOR(e,n).toCDN(n)}static cdnToCbor(e,n){return t.fromCDN(e,n).toCBOR(n)}static cborEdnToCbor(e,n){return t.fromCDN(e,n).toCBOR(n)}static parse(e,n){return typeof n==`function`?t.fromCDN(e).toJS({reviver:n}):t.fromCDN(e,n).toJS(n)}static stringify(e,t,r){if(typeof t==`function`||Array.isArray(t)||t===null||t===void 0&&r!==void 0){let i=typeof t==`function`||Array.isArray(t)?t:void 0,a=_(r);if(i){let t=n.n(e,i);return t===void 0||t===n.z?void 0:n.r(t).toCDN(a===void 0?void 0:{indent:a})}return n.r(e).toCDN(a===void 0?void 0:{indent:a})}let i=t;if(i?.replacer){let t=n.n(e,i.replacer,i.extensions,i.undefinedOmits,i.builtinExtensions);if(t===void 0||t===n.z)return;let{replacer:r,...a}=i;return l(n.r(t,Object.keys(a).length>0?a:void 0),i).toCDN(i)}return l(n.r(e,i),i).toCDN(i)}static format(e,n){return t.fromCDN(e,n).toCDN(n)}};function d(e){let t=``,n=0;for(;n<e.length;){let r=e[n],i=e[n+1]??``;if(r===`-`&&i===`-`){n=f(e,n+2),t+=` `;continue}if(r===`—`){n=f(e,n+1),t+=` `;continue}if(r===`#`){n=f(e,n+1),t+=` `;continue}if(r===`/`&&i===`/`){n=f(e,n+2),t+=` `;continue}if(r===`/`&&i===`*`){let r=e.indexOf(`*/`,n+2);if(r<0)throw SyntaxError(`Unterminated comment in hex dump`);t+=p(e.slice(n,r+2)),n=r+2;continue}if(r===`/`){let r=e.indexOf(`/`,n+1);if(r<0)throw SyntaxError(`Unterminated comment in hex dump`);t+=p(e.slice(n,r+1)),n=r+1;continue}t+=r,n++}return t}function f(e,t){let n=e.indexOf(`
4
4
  `,t);return n<0?e.length:n}function p(e){return e.replace(/[^\r\n]/g,` `)}function m(e,t,n,r,i){let a=i?.offset??t,o={message:e,offset:a};r&&(o.fatal=!0),i&&(o.cause=i),i?.offset!==void 0&&(o.line=i.line,o.column=i.column,o.endOffset=i.endOffset),n?.onWarning?n.onWarning(o):n?.silent||console.warn(`CDN sequence warning at offset ${a}: ${e}`)}function h(e,t){let n=e[t];return n===`#`||n===`/`}function g(e,t,n,r=`none`){let i=t,a=!1,o=!1,s=!1,c=-1,l=()=>r===`all`||r===`after-newline`&&s;for(;i<e.length;){let t=e[i];if(t===` `||t===` `||t===`\r`||t===``){a=!0,i++;continue}if(t===`
5
5
  `){a=!0,s=!0,i++;continue}if(t===`#`){if(a=!0,l())break;let t=e.indexOf(`
6
6
  `,i+1);i=t<0?e.length:t+1,s=!0;continue}if(t===`/`&&e[i+1]===`/`){if(a=!0,l())break;let t=e.indexOf(`
7
7
  `,i+2);i=t<0?e.length:t+1,s=!0;continue}if(t===`/`&&e[i+1]===`*`){if(a=!0,l())break;let t=e.indexOf(`*/`,i+2);if(t<0){let t=`unterminated /* comment in CDN sequence`;if(n?.strict!==!1)throw SyntaxError(t);m(t,i,n,!0),i=e.length}else e.slice(i,t).includes(`
8
8
  `)&&(s=!0),i=t+2;continue}if(t===`/`&&e[i+1]!==`/`){if(a=!0,l())break;let t=e.indexOf(`/`,i+1);if(t<0){let t=`unterminated / comment in CDN sequence`;if(n?.strict!==!1)throw SyntaxError(t);m(t,i,n,!0),i=e.length}else e.slice(i,t).includes(`
9
- `)&&(s=!0),i=t+1;continue}if(t===`,`&&!o){a=!0,o=!0,c=i,i++;continue}break}return{offset:i,hadSeparator:a,commaOffset:c}}function _(e){if(typeof e==`number`){let t=Math.floor(Math.min(10,Math.max(0,e)));return t===0?void 0:t}if(typeof e==`string`)return e.slice(0,10)||void 0}exports.BUILTIN_EXTENSIONS=n.i,exports.CBOR=u,exports.default=u,exports.CBOR_OMIT=n.z,exports.CBOR_TAG=n.B,exports.CddlMismatchError=t.s,exports.CdnSyntaxError=e.o,exports.MapEntries=n.t,exports.Null=n.V,exports.Simple=n.R,exports.Tag=n.H,exports.Undefined=n.U,exports.b1=n.c,exports.b32=n.S,exports.cri=n.d,exports.dt=n.p,exports.dt_as_Date=n.m,exports.float=n.a,exports.h32=n.C,exports.ilbs=n.o,exports.ilts=n.s,exports.ip=n.f,exports.same=i,exports.t1=n.l;
9
+ `)&&(s=!0),i=t+1;continue}if(t===`,`&&!o){a=!0,o=!0,c=i,i++;continue}break}return{offset:i,hadSeparator:a,commaOffset:c}}function _(e){if(typeof e==`number`){let t=Math.floor(Math.min(10,Math.max(0,e)));return t===0?void 0:t}if(typeof e==`string`)return e.slice(0,10)||void 0}exports.BUILTIN_EXTENSIONS=n.i,exports.CBOR=u,exports.default=u,exports.CBOR_OMIT=n.z,exports.CBOR_TAG=n.B,exports.CddlMismatchError=t.s,exports.CdnSyntaxError=e.D,exports.MapEntries=n.t,exports.Null=n.V,exports.Simple=n.R,exports.Tag=n.H,exports.Undefined=n.U,exports.b1=n.c,exports.b32=n.S,exports.cri=n.d,exports.dt=n.p,exports.dt_as_Date=n.m,exports.float=n.a,exports.h32=n.C,exports.ilbs=n.o,exports.ilts=n.s,exports.ip=n.f,exports.same=i,exports.t1=n.l;
10
10
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export type { CBOROptions, CborExtension, DecodeWarning, ParseWarning, FromCBOROptions, FromCBORSeqOptions, ToCBOROptions, FromCDNOptions, FromCDNSeqOptions, ToCDNOptions, FromEDNOptions, ToEDNOptions, FromJSOptions, ToJSOptions, FromHexDumpOptions, ToHexDumpOptions, ValidateOptions, ValidateResult, } from './types';
1
+ export type { CBOROptions, CborExtension, CborComment, CborComments, DecodeWarning, ParseWarning, FromCBOROptions, FromCBORSeqOptions, ToCBOROptions, FromCDNOptions, FromCDNSeqOptions, ToCDNOptions, FromEDNOptions, ToEDNOptions, FromJSOptions, ToJSOptions, FromHexDumpOptions, ToHexDumpOptions, ValidateOptions, ValidateResult, } from './types';
2
+ export type { EncodingWidth } from './cbor/encode';
2
3
  export { CdnSyntaxError } from './cdn/errors';
3
4
  export { CddlMismatchError } from './cddl/errors';
4
5
  export type { CddlValidationError, CddlValidationWarning } from './cddl/errors';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { o as e } from "./tokenizer-CeuixxXi.js";
2
- import { n as t, s as n } from "./schema-Bofmsptw.js";
3
- import { B as r, C as i, H as a, R as o, S as s, U as c, V as l, a as u, c as d, d as f, f as p, g as m, i as h, l as g, m as _, n as v, o as y, p as b, r as x, s as S, t as C, u as w, z as T } from "./mapEntries-DxrDre2P.js";
1
+ import { D as e } from "./tokenizer-N-vAvRdj.js";
2
+ import { n as t, s as n } from "./schema-y8G5mDIS.js";
3
+ import { B as r, C as i, H as a, R as o, S as s, U as c, V as l, a as u, c as d, d as f, f as p, g as m, i as h, l as g, m as _, n as v, o as y, p as b, r as x, s as S, t as C, u as w, z as T } from "./mapEntries-Ci_dppP6.js";
4
4
  //#region src/extensions/same.ts
5
5
  function E(e, t) {
6
6
  if (e.length !== t.length) return !1;