@cbortech/cbor 0.26.0 → 0.26.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 +42 -0
- package/README.md +42 -0
- package/dist/ast/index.cjs +1 -1
- package/dist/ast/index.js +2 -2
- package/dist/extensions/builtins.d.ts +24 -1
- package/dist/extensions/ellipsis.d.ts +3 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +149 -149
- package/dist/index.js.map +1 -1
- package/dist/js/fromJS.d.ts +1 -1
- package/dist/mapEntries-CZLpI8fS.cjs +14 -0
- package/dist/mapEntries-CZLpI8fS.cjs.map +1 -0
- package/dist/{mapEntries-BdzS6bFp.js → mapEntries-KwZz9nq2.js} +627 -570
- package/dist/mapEntries-KwZz9nq2.js.map +1 -0
- package/dist/types.d.ts +55 -0
- package/package.json +7 -7
- package/dist/mapEntries-BdzS6bFp.js.map +0 -1
- package/dist/mapEntries-DJtvWpWq.cjs +0 -14
- package/dist/mapEntries-DJtvWpWq.cjs.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -147,6 +147,26 @@ export interface FromCBOROptions {
|
|
|
147
147
|
* `CborTag` node.
|
|
148
148
|
*/
|
|
149
149
|
extensions?: CborExtension[];
|
|
150
|
+
/**
|
|
151
|
+
* Override the default set of bundled application-oriented extensions
|
|
152
|
+
* (`dt`, `ip`, `cri`, `t1`, `b1`, `ilbs`, `ilts`, `float`).
|
|
153
|
+
*
|
|
154
|
+
* - omitted (default): use the standard bundled set.
|
|
155
|
+
* - array: replace the bundled set with exactly these extensions.
|
|
156
|
+
* - `false`: disable all of them.
|
|
157
|
+
*
|
|
158
|
+
* `bignum` (tags 2/3) and embedded-CBOR (tag 24) support are core RFC 8949
|
|
159
|
+
* representation features, not application-oriented extensions, and are
|
|
160
|
+
* always active regardless of this option.
|
|
161
|
+
*
|
|
162
|
+
* `dt`, `ip`, `t1`, and `b1` are mandatory-to-implement per §2.1 of
|
|
163
|
+
* draft-ietf-cbor-edn-literals-26; disabling them produces a decoder that
|
|
164
|
+
* no longer conforms to that recommendation. This is intended for
|
|
165
|
+
* allowlisting scenarios (see §7 Security considerations of the same
|
|
166
|
+
* draft) where an application wants explicit control over which
|
|
167
|
+
* extensions it accepts.
|
|
168
|
+
*/
|
|
169
|
+
builtinExtensions?: CborExtension[] | false;
|
|
150
170
|
/**
|
|
151
171
|
* Controls how CBOR validity violations are handled.
|
|
152
172
|
*
|
|
@@ -193,6 +213,11 @@ export interface FromHexDumpOptions {
|
|
|
193
213
|
* returning a non-`undefined` value replaces the default `CborTag` node.
|
|
194
214
|
*/
|
|
195
215
|
extensions?: CborExtension[];
|
|
216
|
+
/**
|
|
217
|
+
* Override the default set of bundled application-oriented extensions.
|
|
218
|
+
* Mirrors `FromCBOROptions.builtinExtensions`.
|
|
219
|
+
*/
|
|
220
|
+
builtinExtensions?: CborExtension[] | false;
|
|
196
221
|
/**
|
|
197
222
|
* Controls how CBOR validity violations are handled during hex-dump decoding.
|
|
198
223
|
* Mirrors `FromCBOROptions.strict`. With `strict: false`, trailing bytes after
|
|
@@ -256,6 +281,28 @@ export interface FromCDNOptions {
|
|
|
256
281
|
* extension for the same prefix.
|
|
257
282
|
*/
|
|
258
283
|
extensions?: CborExtension[];
|
|
284
|
+
/**
|
|
285
|
+
* Override the default set of bundled application-oriented extensions
|
|
286
|
+
* (`dt`, `ip`, `cri`, `t1`, `b1`, `ilbs`, `ilts`, `float`).
|
|
287
|
+
*
|
|
288
|
+
* - omitted (default): use the standard bundled set.
|
|
289
|
+
* - array: replace the bundled set with exactly these extensions.
|
|
290
|
+
* - `false`: disable all of them; app-string literals using their
|
|
291
|
+
* prefixes then fall through to `unresolvedExtension` handling.
|
|
292
|
+
*
|
|
293
|
+
* `dt`, `ip`, `t1`, and `b1` are mandatory-to-implement per §2.1 of
|
|
294
|
+
* draft-ietf-cbor-edn-literals-26; disabling them produces a parser that
|
|
295
|
+
* no longer conforms to that recommendation. This is intended for
|
|
296
|
+
* allowlisting scenarios (see §7 Security considerations of the same
|
|
297
|
+
* draft) where an application wants explicit control over which
|
|
298
|
+
* extensions it accepts from untrusted CDN input.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* // Only accept dt/DT — everything else becomes an Unresolved (tag 999) node.
|
|
302
|
+
* import { CBOR, dt } from '@cbortech/cbor';
|
|
303
|
+
* CBOR.fromCDN(text, { builtinExtensions: [dt] });
|
|
304
|
+
*/
|
|
305
|
+
builtinExtensions?: CborExtension[] | false;
|
|
259
306
|
/**
|
|
260
307
|
* How to handle unrecognised application-extension identifiers
|
|
261
308
|
* (§4.1 of draft-ietf-cbor-edn-literals-25).
|
|
@@ -338,6 +385,14 @@ export interface FromJSOptions {
|
|
|
338
385
|
* Extensions with `fromJS()` are given first chance to convert each value.
|
|
339
386
|
*/
|
|
340
387
|
extensions?: CborExtension[];
|
|
388
|
+
/**
|
|
389
|
+
* Override the default set of bundled application-oriented extensions.
|
|
390
|
+
* Mirrors `FromCDNOptions.builtinExtensions`. Only affects builtins that
|
|
391
|
+
* implement `fromJS()` / `parseTag()` (none of the bundled application
|
|
392
|
+
* extensions implement `fromJS()` by default — use `dt_as_Date` via
|
|
393
|
+
* `extensions` for `Date` round-tripping).
|
|
394
|
+
*/
|
|
395
|
+
builtinExtensions?: CborExtension[] | false;
|
|
341
396
|
/**
|
|
342
397
|
* How to encode integer-valued JS `number`s.
|
|
343
398
|
* - `'int'`: encode as CborUint / CborNint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cbortech/cbor",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.2",
|
|
4
4
|
"description": "Convert between CBOR, CDN (CBOR-EDN), and JavaScript values",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cbor",
|
|
@@ -104,16 +104,16 @@
|
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@types/node": "^24.13.2",
|
|
107
|
-
"@vitest/browser": "^4.1.
|
|
108
|
-
"@vitest/browser-playwright": "^4.1.
|
|
109
|
-
"@vitest/coverage-v8": "^4.1.
|
|
110
|
-
"@vitest/ui": "^4.1.
|
|
107
|
+
"@vitest/browser": "^4.1.10",
|
|
108
|
+
"@vitest/browser-playwright": "^4.1.10",
|
|
109
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
110
|
+
"@vitest/ui": "^4.1.10",
|
|
111
111
|
"cross-env": "^10.1.0",
|
|
112
112
|
"playwright": "^1.61.1",
|
|
113
113
|
"prettier": "^3.9.4",
|
|
114
114
|
"typescript": "^5.9.3",
|
|
115
|
-
"vite": "^8.1.
|
|
115
|
+
"vite": "^8.1.3",
|
|
116
116
|
"vite-plugin-dts": "^4.5.4",
|
|
117
|
-
"vitest": "^4.1.
|
|
117
|
+
"vitest": "^4.1.10"
|
|
118
118
|
}
|
|
119
119
|
}
|