cbor-x 1.3.0 → 1.3.3
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/decode.d.ts +2 -0
- package/decode.js +1167 -1160
- package/dist/index.js +1041 -1034
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +15 -14
- package/dist/node-index.js +93 -0
- package/dist/node.cjs +1095 -1086
- package/dist/test.js +675 -1251
- package/index.d.ts +3 -2
- package/node-index.js +10 -8
- package/package.json +77 -79
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
import { Options } from './decode'
|
|
2
|
+
export { Decoder, decode, addExtension, FLOAT32_OPTIONS, clearSource, roundFloat32, isNativeAccelerationEnabled } from './decode'
|
|
3
|
+
export { Encoder, encode } from './encode'
|
|
3
4
|
import { Transform, Readable } from 'stream'
|
|
4
5
|
|
|
5
6
|
export as namespace CBOR;
|
package/node-index.js
CHANGED
|
@@ -7,16 +7,18 @@ export const mapsAsObjects = true
|
|
|
7
7
|
import { setExtractor } from './decode.js'
|
|
8
8
|
import { createRequire } from 'module'
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
if (extractor)
|
|
12
|
-
setExtractor(extractor.extractStrings)
|
|
10
|
+
const nativeAccelerationDisabled = process.env.CBOR_NATIVE_ACCELERATION_DISABLED !== undefined && process.env.CBOR_NATIVE_ACCELERATION_DISABLED.toLowerCase() === 'true';
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
if (!nativeAccelerationDisabled) {
|
|
13
|
+
let extractor
|
|
15
14
|
try {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (typeof require == 'function')
|
|
16
|
+
extractor = require('cbor-extract')
|
|
17
|
+
else
|
|
18
|
+
extractor = createRequire(import.meta.url)('cbor-extract')
|
|
19
|
+
if (extractor)
|
|
20
|
+
setExtractor(extractor.extractStrings)
|
|
18
21
|
} catch (error) {
|
|
19
|
-
|
|
20
|
-
console.warn('For browser usage, directly use cbor-x/decode or cbor-x/encode modules. ' + error.message.split('\n')[0])
|
|
22
|
+
// native module is optional
|
|
21
23
|
}
|
|
22
24
|
}
|
package/package.json
CHANGED
|
@@ -1,79 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cbor-x",
|
|
3
|
-
"author": "Kris Zyp",
|
|
4
|
-
"version": "1.3.
|
|
5
|
-
"description": "Ultra-fast and conformant CBOR (RFC 8949) implementation with support for numerous tag extensions including records and structured cloning",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"types": "./index.d.ts",
|
|
8
|
-
"main": "./dist/node.cjs",
|
|
9
|
-
"module": "./index.js",
|
|
10
|
-
"keywords": [
|
|
11
|
-
"CBOR",
|
|
12
|
-
"performance",
|
|
13
|
-
"structured",
|
|
14
|
-
"clone"
|
|
15
|
-
],
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "http://github.com/kriszyp/cbor-x"
|
|
19
|
-
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"benchmark": "node ./tests/benchmark.cjs",
|
|
22
|
-
"build": "rollup -c",
|
|
23
|
-
"dry-run": "npm publish --dry-run",
|
|
24
|
-
"prepare": "npm run build",
|
|
25
|
-
"test": "mocha tests/test**.*js -u tdd --experimental-json-modules"
|
|
26
|
-
},
|
|
27
|
-
"type": "module",
|
|
28
|
-
"exports": {
|
|
29
|
-
".": {
|
|
30
|
-
"node": {
|
|
31
|
-
"require": "./dist/node.cjs",
|
|
32
|
-
"import": "./node-index.js"
|
|
33
|
-
},
|
|
34
|
-
"default": "./index.js"
|
|
35
|
-
},
|
|
36
|
-
"./encode": {
|
|
37
|
-
"node": {
|
|
38
|
-
"import": "./index.js",
|
|
39
|
-
"require": "./dist/node.cjs"
|
|
40
|
-
},
|
|
41
|
-
"default": {
|
|
42
|
-
"import": "./encode.js"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"./decode": {
|
|
46
|
-
"node": {
|
|
47
|
-
"import": "./index.js",
|
|
48
|
-
"require": "./dist/node.cjs"
|
|
49
|
-
},
|
|
50
|
-
"default": {
|
|
51
|
-
"import": "./decode.js"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"/*.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"@
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"cbor
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"rollup
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "cbor-x",
|
|
3
|
+
"author": "Kris Zyp",
|
|
4
|
+
"version": "1.3.3",
|
|
5
|
+
"description": "Ultra-fast and conformant CBOR (RFC 8949) implementation with support for numerous tag extensions including records and structured cloning",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"main": "./dist/node.cjs",
|
|
9
|
+
"module": "./index.js",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"CBOR",
|
|
12
|
+
"performance",
|
|
13
|
+
"structured",
|
|
14
|
+
"clone"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "http://github.com/kriszyp/cbor-x"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"benchmark": "node ./tests/benchmark.cjs",
|
|
22
|
+
"build": "rollup -c",
|
|
23
|
+
"dry-run": "npm publish --dry-run",
|
|
24
|
+
"prepare": "npm run build",
|
|
25
|
+
"test": "mocha tests/test**.*js -u tdd --experimental-json-modules"
|
|
26
|
+
},
|
|
27
|
+
"type": "module",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"node": {
|
|
31
|
+
"require": "./dist/node.cjs",
|
|
32
|
+
"import": "./node-index.js"
|
|
33
|
+
},
|
|
34
|
+
"default": "./index.js"
|
|
35
|
+
},
|
|
36
|
+
"./encode": {
|
|
37
|
+
"node": {
|
|
38
|
+
"import": "./index.js",
|
|
39
|
+
"require": "./dist/node.cjs"
|
|
40
|
+
},
|
|
41
|
+
"default": {
|
|
42
|
+
"import": "./encode.js"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"./decode": {
|
|
46
|
+
"node": {
|
|
47
|
+
"import": "./index.js",
|
|
48
|
+
"require": "./dist/node.cjs"
|
|
49
|
+
},
|
|
50
|
+
"default": {
|
|
51
|
+
"import": "./decode.js"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"./package.json": "./package.json"
|
|
55
|
+
},
|
|
56
|
+
"files": [
|
|
57
|
+
"/dist",
|
|
58
|
+
"*.md",
|
|
59
|
+
"/*.js",
|
|
60
|
+
"/*.ts"
|
|
61
|
+
],
|
|
62
|
+
"optionalDependencies": {
|
|
63
|
+
"cbor-extract": "^2.0.2"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
67
|
+
"@types/node": "latest",
|
|
68
|
+
"async": "^3",
|
|
69
|
+
"cbor": "^5",
|
|
70
|
+
"cbor-sync": "^1.0.4",
|
|
71
|
+
"chai": "^4.3.4",
|
|
72
|
+
"esm": "^3.2.25",
|
|
73
|
+
"mocha": "^8.1.3",
|
|
74
|
+
"rollup": "^1.20.3",
|
|
75
|
+
"rollup-plugin-babel-minify": "^9.0.0"
|
|
76
|
+
}
|
|
77
|
+
}
|