@fireproof/vendor 1.0.2 → 1.0.4
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/package.json +1 -1
- package/src/@ipld/car/dist/src/promise-fs-opts.d.ts +30 -0
- package/src/@ipld/car/dist/src/promise-fs-opts.d.ts.map +1 -0
- package/src/@ipld/car/dist/src/reader.d.ts +6 -2
- package/src/@ipld/car/dist/src/reader.d.ts.map +1 -1
- package/src/@ipld/car/dist/src/writer.d.ts +1 -2
- package/src/@ipld/car/dist/src/writer.d.ts.map +1 -1
- package/src/@ipld/car/src/promise-fs-opts.js +42 -0
- package/src/@ipld/car/src/reader.js +1 -21
- package/src/@ipld/car/src/writer.js +2 -6
- package/src/cborg/cborg/bin.js +1 -1
- package/src/cborg/cborg/decode.js +1 -1
- package/src/cborg/cborg/diagnostic.js +1 -1
- package/src/cborg/cborg/diagnostic_test.js +1 -1
- package/src/cborg/cborg/encode.js +1 -1
- package/src/cborg/cborg/index.js +1 -1
- package/src/cborg/cborg/length.js +1 -1
- package/src/cborg/interface.ts +1 -1
- package/src/cborg/json/decode.js +1 -1
- package/src/cborg/json/encode.js +1 -1
- package/src/cborg/taglib.js +1 -1
- package/src/cborg/test/common.js +1 -1
- package/src/cborg/test/test-0uint.js +1 -1
- package/src/cborg/test/test-1negint.js +1 -1
- package/src/cborg/test/test-2bytes.js +1 -1
- package/src/cborg/test/test-3string.js +1 -1
- package/src/cborg/test/test-4array.js +1 -1
- package/src/cborg/test/test-5map.js +1 -1
- package/src/cborg/test/test-6tag.js +1 -1
- package/src/cborg/test/test-7float.js +1 -1
- package/src/cborg/test/test-bl.js +1 -1
- package/src/cborg/test/test-cbor-vectors.js +1 -1
- package/src/cborg/test/test-decode-errors.js +1 -1
- package/src/cborg/test/test-length.js +1 -1
- package/src/cborg/test/test-partial.js +1 -1
- package/src/cborg/utils/bl.js +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* @description This function is needed not to initialize the `fs.read` on load time. To run in cf workers without polyfill.
|
|
4
|
+
* @param {number} fd
|
|
5
|
+
* @param {Uint8Array} buffer
|
|
6
|
+
* @param {number} offset
|
|
7
|
+
* @param {number} length
|
|
8
|
+
* @param {number} position
|
|
9
|
+
* @returns {Promise<{ bytesRead: number, buffer: Uint8Array }>}
|
|
10
|
+
*/
|
|
11
|
+
export function fsread(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): Promise<{
|
|
12
|
+
bytesRead: number;
|
|
13
|
+
buffer: Uint8Array;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* @description This function is needed not to initialize the `fs.write` on load time. To run in cf workers without polyfill.
|
|
17
|
+
* @param {number} fd
|
|
18
|
+
* @param {Uint8Array} buffer
|
|
19
|
+
* @param {number} offset
|
|
20
|
+
* @param {number} length
|
|
21
|
+
* @param {number} position
|
|
22
|
+
* @returns {Promise<{ bytesRead: number, buffer: Uint8Array }>}
|
|
23
|
+
*/
|
|
24
|
+
export function fswrite(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): Promise<{
|
|
25
|
+
bytesRead: number;
|
|
26
|
+
buffer: Uint8Array;
|
|
27
|
+
}>;
|
|
28
|
+
export { fs };
|
|
29
|
+
import fs from 'fs';
|
|
30
|
+
//# sourceMappingURL=promise-fs-opts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise-fs-opts.d.ts","sourceRoot":"","sources":["../../src/promise-fs-opts.js"],"names":[],"mappings":";AAUA;;;;;;;;GAQG;AACH,2BAPW,MAAM,UACN,UAAU,UACV,MAAM,UACN,MAAM,YACN,MAAM,GACJ,QAAQ;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,CAK9D;AAOD;;;;;;;;GAQG;AACH,4BAPW,MAAM,UACN,UAAU,UACV,MAAM,UACN,MAAM,YACN,MAAM,GACJ,QAAQ;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,CAK9D;;eAzCc,IAAI"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./api').Block} Block
|
|
3
|
+
* @typedef {import('./api').BlockIndex} BlockIndex
|
|
4
|
+
* @typedef {import('./api').CarReader} CarReaderIface
|
|
5
|
+
*/
|
|
2
6
|
/**
|
|
3
7
|
* @class
|
|
4
8
|
* @implements {CarReaderIface}
|
|
@@ -31,5 +35,5 @@ export type Block = import('./api').Block;
|
|
|
31
35
|
export type BlockIndex = import('./api').BlockIndex;
|
|
32
36
|
export type CarReaderIface = import('./api').CarReader;
|
|
33
37
|
import { CarReader as BrowserCarReader } from './reader-browser.js';
|
|
34
|
-
import fs from 'fs';
|
|
38
|
+
import { fs } from './promise-fs-opts.js';
|
|
35
39
|
//# sourceMappingURL=reader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/reader.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/reader.js"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;;GAGG;AACH;IACE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,mBARW,GAAG,QAAQ,CAAC,UAAU,GAAG,MAAM,cAG/B,UAAU,GAGR,QAAQ,KAAK,CAAC,CAiB1B;CACF;AAED,8BAA4B;oBAhDf,OAAO,OAAO,EAAE,KAAK;yBACrB,OAAO,OAAO,EAAE,UAAU;6BAC1B,OAAO,OAAO,EAAE,SAAS;8CALQ,qBAAqB;mBADxC,sBAAsB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* @typedef {import('multiformats/cid').CID} CID
|
|
4
3
|
* @typedef {import('./api').BlockWriter} BlockWriter
|
|
@@ -41,5 +40,5 @@ export const __browser: false;
|
|
|
41
40
|
export type CID = import('multiformats/cid').CID;
|
|
42
41
|
export type BlockWriter = import('./api').BlockWriter;
|
|
43
42
|
import { CarWriter as BrowserCarWriter } from './writer-browser.js';
|
|
44
|
-
import fs from 'fs';
|
|
43
|
+
import { fs } from './promise-fs-opts.js';
|
|
45
44
|
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/writer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/writer.js"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;GAGG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,6BATW,GAAG,QAAQ,CAAC,UAAU,GAAG,MAAM,SAG/B,GAAG,EAAE,GAIH,QAAQ,IAAI,CAAC,CAoCzB;CACF;AAED,8BAA4B;kBAzEf,OAAO,kBAAkB,EAAE,GAAG;0BAC9B,OAAO,OAAO,EAAE,WAAW;8CAJM,qBAAqB;mBAD/B,sBAAsB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import { promisify } from 'util'
|
|
3
|
+
|
|
4
|
+
export { fs }
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description not happy with typing here, but it's needed for the `promisify(fs.read)` function.
|
|
8
|
+
* @type {any}
|
|
9
|
+
*/
|
|
10
|
+
let _fsReadFn
|
|
11
|
+
/**
|
|
12
|
+
* @description This function is needed not to initialize the `fs.read` on load time. To run in cf workers without polyfill.
|
|
13
|
+
* @param {number} fd
|
|
14
|
+
* @param {Uint8Array} buffer
|
|
15
|
+
* @param {number} offset
|
|
16
|
+
* @param {number} length
|
|
17
|
+
* @param {number} position
|
|
18
|
+
* @returns {Promise<{ bytesRead: number, buffer: Uint8Array }>}
|
|
19
|
+
*/
|
|
20
|
+
export function fsread (fd, buffer, offset, length, position) {
|
|
21
|
+
_fsReadFn = _fsReadFn || promisify(fs.read)
|
|
22
|
+
return _fsReadFn(fd, buffer, offset, length, position)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @description not happy with typing here, but it's needed for the `promisify(fs.write)` function.
|
|
27
|
+
* @type {any}
|
|
28
|
+
*/
|
|
29
|
+
let _fsWriteFn
|
|
30
|
+
/**
|
|
31
|
+
* @description This function is needed not to initialize the `fs.write` on load time. To run in cf workers without polyfill.
|
|
32
|
+
* @param {number} fd
|
|
33
|
+
* @param {Uint8Array} buffer
|
|
34
|
+
* @param {number} offset
|
|
35
|
+
* @param {number} length
|
|
36
|
+
* @param {number} position
|
|
37
|
+
* @returns {Promise<{ bytesRead: number, buffer: Uint8Array }>}
|
|
38
|
+
*/
|
|
39
|
+
export function fswrite (fd, buffer, offset, length, position) {
|
|
40
|
+
_fsWriteFn = _fsWriteFn || promisify(fs.write)
|
|
41
|
+
return _fsWriteFn(fd, buffer, offset, length, position)
|
|
42
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import { promisify } from 'util'
|
|
1
|
+
import { fsread, fs } from './promise-fs-opts.js'
|
|
3
2
|
import { CarReader as BrowserCarReader } from './reader-browser.js'
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -8,25 +7,6 @@ import { CarReader as BrowserCarReader } from './reader-browser.js'
|
|
|
8
7
|
* @typedef {import('./api').CarReader} CarReaderIface
|
|
9
8
|
*/
|
|
10
9
|
|
|
11
|
-
/**
|
|
12
|
-
* @description not happy with typing here, but it's needed for the `promisify(fs.read)` function.
|
|
13
|
-
* @type {any}
|
|
14
|
-
*/
|
|
15
|
-
let _fsReadFn
|
|
16
|
-
/**
|
|
17
|
-
* @description This function is needed not to initialize the `fs.read` on load time. To run in cf workers without polyfill.
|
|
18
|
-
* @param {number} fd
|
|
19
|
-
* @param {Uint8Array} buffer
|
|
20
|
-
* @param {number} offset
|
|
21
|
-
* @param {number} length
|
|
22
|
-
* @param {number} position
|
|
23
|
-
* @returns {Promise<{ bytesRead: number, buffer: Uint8Array }>}
|
|
24
|
-
*/
|
|
25
|
-
function fsread (fd, buffer, offset, length, position) {
|
|
26
|
-
_fsReadFn = _fsReadFn || promisify(fs.read)
|
|
27
|
-
return _fsReadFn(fd, buffer, offset, length, position)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
10
|
/**
|
|
31
11
|
* @class
|
|
32
12
|
* @implements {CarReaderIface}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import { promisify } from 'util'
|
|
3
1
|
import { readHeader, chunkReader } from './decoder.js'
|
|
4
2
|
import { createHeader } from './encoder.js'
|
|
3
|
+
import { fsread, fswrite, fs } from './promise-fs-opts.js'
|
|
5
4
|
import { CarWriter as BrowserCarWriter } from './writer-browser.js'
|
|
6
5
|
|
|
7
|
-
const fsread = promisify(fs.read)
|
|
8
|
-
const fswrite = promisify(fs.write)
|
|
9
|
-
|
|
10
6
|
/**
|
|
11
7
|
* @typedef {import('multiformats/cid').CID} CID
|
|
12
8
|
* @typedef {import('./api').BlockWriter} BlockWriter
|
|
@@ -81,4 +77,4 @@ export class CarWriter extends BrowserCarWriter {
|
|
|
81
77
|
}
|
|
82
78
|
}
|
|
83
79
|
|
|
84
|
-
export const __browser =
|
|
80
|
+
export const __browser = !fs
|
package/src/cborg/cborg/bin.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import process from 'process'
|
|
4
4
|
import { decode, encode } from "@fireproof/vendor/cborg"
|
|
5
5
|
import { tokensToDiagnostic, fromDiag } from './diagnostic.js'
|
|
6
|
-
import { fromHex as _fromHex, toHex } from
|
|
6
|
+
import { fromHex as _fromHex, toHex } from "@fireproof/vendor/cborg/utils"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {number} code
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tokeniser } from './decode.js'
|
|
2
|
-
import { uintBoundaries, toHex, fromHex, Type } from
|
|
2
|
+
import { uintBoundaries, toHex, fromHex, Type } from "@fireproof/vendor/cborg/utils"
|
|
3
3
|
|
|
4
4
|
const utf8Encoder = new TextEncoder()
|
|
5
5
|
const utf8Decoder = new TextDecoder()
|
package/src/cborg/cborg/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { encode } from './encode.js'
|
|
2
2
|
import { decode, decodeFirst, Tokeniser, tokensToObject } from './decode.js'
|
|
3
|
-
import { Token, Type } from
|
|
3
|
+
import { Token, Type } from "@fireproof/vendor/cborg/utils"
|
|
4
4
|
|
|
5
5
|
// is this needed for the json module and other independ encoders
|
|
6
6
|
export { encodeCustom } from './encode.js'
|
package/src/cborg/interface.ts
CHANGED
package/src/cborg/json/decode.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// never reference the file directly to ensure the
|
|
2
2
|
// indepency of the json module
|
|
3
3
|
import { decode as _decode, decodeFirst as _decodeFirst } from "@fireproof/vendor/cborg"
|
|
4
|
-
import { Token, Type, decodeCodePointsArray } from
|
|
4
|
+
import { Token, Type, decodeCodePointsArray } from "@fireproof/vendor/cborg/utils"
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {import('../interface').DecodeOptions} DecodeOptions
|
package/src/cborg/json/encode.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// never reference the file directly to ensure the
|
|
2
2
|
// indepency of the json module
|
|
3
3
|
import { encodeCustom } from "@fireproof/vendor/cborg"
|
|
4
|
-
import { Type, asU8A, fromString } from
|
|
4
|
+
import { Type, asU8A, fromString } from "@fireproof/vendor/cborg/utils"
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {import('../interface').EncodeOptions} EncodeOptions
|
package/src/cborg/taglib.js
CHANGED
package/src/cborg/test/common.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as chai from 'chai'
|
|
4
4
|
|
|
5
5
|
import { decode, encode } from "@fireproof/vendor/cborg"
|
|
6
|
-
import { fromHex, toHex, Token, Type } from
|
|
6
|
+
import { fromHex, toHex, Token, Type } from "@fireproof/vendor/cborg/utils"
|
|
7
7
|
import { dateDecoder, dateEncoder } from './common.js'
|
|
8
8
|
|
|
9
9
|
const { assert } = chai
|
|
@@ -4,7 +4,7 @@ import * as chai from 'chai'
|
|
|
4
4
|
|
|
5
5
|
import { decode, encode } from "@fireproof/vendor/cborg"
|
|
6
6
|
import * as taglib from "@fireproof/vendor/cborg/taglib"
|
|
7
|
-
import { fromHex, toHex } from
|
|
7
|
+
import { fromHex, toHex } from "@fireproof/vendor/cborg/utils"
|
|
8
8
|
// fixtures from https://github.com/cbor/test-vectors
|
|
9
9
|
import { fixtures } from './appendix_a.js'
|
|
10
10
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as chai from 'chai'
|
|
4
4
|
import { garbage } from 'ipld-garbage'
|
|
5
|
-
import { uintBoundaries } from
|
|
5
|
+
import { uintBoundaries } from "@fireproof/vendor/cborg/utils"
|
|
6
6
|
import { encode } from "@fireproof/vendor/cborg"
|
|
7
7
|
import { encodedLength } from "@fireproof/vendor/cborg/length"
|
|
8
8
|
import { dateEncoder } from './common.js'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as chai from 'chai'
|
|
4
4
|
import { garbage } from 'ipld-garbage'
|
|
5
|
-
import { uintBoundaries } from
|
|
5
|
+
import { uintBoundaries } from "@fireproof/vendor/cborg/utils"
|
|
6
6
|
import { encode, decodeFirst } from "@fireproof/vendor/cborg"
|
|
7
7
|
import { dateDecoder, dateEncoder } from './common.js'
|
|
8
8
|
|
package/src/cborg/utils/bl.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
// TODO: ipjs doesn't support this, only for test files: https://github.com/mikeal/ipjs/blob/master/src/package/testFile.js#L39
|
|
19
|
-
import { alloc, concat, slice } from
|
|
19
|
+
import { alloc, concat, slice } from "@fireproof/vendor/cborg/utils"
|
|
20
20
|
|
|
21
21
|
// the ts-ignores in this file are almost all for the `Uint8Array|number[]` duality that exists
|
|
22
22
|
// for perf reasons. Consider better approaches to this or removing it entirely, it is quite
|