@loaders.gl/loader-utils 4.0.0-alpha.21 → 4.0.0-alpha.23
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/dist/es5/index.js +49 -2
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/json-loader.js +1 -1
- package/dist/es5/json-loader.js.map +1 -1
- package/dist/es5/lib/file-provider/data-view-file.js +146 -0
- package/dist/es5/lib/file-provider/data-view-file.js.map +1 -0
- package/dist/es5/lib/file-provider/file-handle-file.js +236 -0
- package/dist/es5/lib/file-provider/file-handle-file.js.map +1 -0
- package/dist/es5/lib/file-provider/file-handle.js +104 -0
- package/dist/es5/lib/file-provider/file-handle.js.map +1 -0
- package/dist/es5/lib/file-provider/file-provider.js +11 -0
- package/dist/es5/lib/file-provider/file-provider.js.map +1 -0
- package/dist/es5/lib/filesystems/filesystem.js +2 -0
- package/dist/es5/lib/filesystems/filesystem.js.map +1 -0
- package/dist/es5/lib/filesystems/node-filesystem.js +2 -2
- package/dist/es5/lib/filesystems/node-filesystem.js.map +1 -1
- package/dist/es5/lib/option-utils/merge-loader-options.js.map +1 -1
- package/dist/es5/lib/worker-loader-utils/create-loader-worker.js +2 -2
- package/dist/es5/lib/worker-loader-utils/create-loader-worker.js.map +1 -1
- package/dist/es5/lib/worker-loader-utils/encode-with-worker.js.map +1 -1
- package/dist/es5/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
- package/dist/es5/loader-types.js +58 -0
- package/dist/es5/loader-types.js.map +1 -0
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/writer-types.js +2 -0
- package/dist/es5/writer-types.js.map +1 -0
- package/dist/esm/index.js +6 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/json-loader.js +1 -1
- package/dist/esm/json-loader.js.map +1 -1
- package/dist/esm/lib/file-provider/data-view-file.js +33 -0
- package/dist/esm/lib/file-provider/data-view-file.js.map +1 -0
- package/dist/esm/lib/file-provider/file-handle-file.js +59 -0
- package/dist/esm/lib/file-provider/file-handle-file.js.map +1 -0
- package/dist/esm/lib/file-provider/file-handle.js +37 -0
- package/dist/esm/lib/file-provider/file-handle.js.map +1 -0
- package/dist/esm/lib/file-provider/file-provider.js +4 -0
- package/dist/esm/lib/file-provider/file-provider.js.map +1 -0
- package/dist/esm/lib/filesystems/filesystem.js +2 -0
- package/dist/esm/lib/filesystems/filesystem.js.map +1 -0
- package/dist/esm/lib/filesystems/node-filesystem.js +1 -1
- package/dist/esm/lib/filesystems/node-filesystem.js.map +1 -1
- package/dist/esm/lib/option-utils/merge-loader-options.js.map +1 -1
- package/dist/esm/lib/worker-loader-utils/create-loader-worker.js +2 -2
- package/dist/esm/lib/worker-loader-utils/create-loader-worker.js.map +1 -1
- package/dist/esm/lib/worker-loader-utils/encode-with-worker.js.map +1 -1
- package/dist/esm/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
- package/dist/esm/loader-types.js +16 -0
- package/dist/esm/loader-types.js.map +1 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/writer-types.js +2 -0
- package/dist/esm/writer-types.js.map +1 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -4
- package/dist/json-loader.d.ts +1 -1
- package/dist/json-loader.d.ts.map +1 -1
- package/dist/lib/file-provider/data-view-file.d.ts +37 -0
- package/dist/lib/file-provider/data-view-file.d.ts.map +1 -0
- package/dist/lib/file-provider/data-view-file.js +63 -0
- package/dist/lib/file-provider/file-handle-file.d.ts +53 -0
- package/dist/lib/file-provider/file-handle-file.d.ts.map +1 -0
- package/dist/lib/file-provider/file-handle-file.js +92 -0
- package/dist/lib/file-provider/file-handle.d.ts +40 -0
- package/dist/lib/file-provider/file-handle.d.ts.map +1 -0
- package/dist/lib/file-provider/file-handle.js +55 -0
- package/dist/lib/file-provider/file-provider.d.ts +45 -0
- package/dist/lib/file-provider/file-provider.d.ts.map +1 -0
- package/dist/lib/file-provider/file-provider.js +13 -0
- package/dist/lib/filesystems/filesystem.d.ts +81 -0
- package/dist/lib/filesystems/filesystem.d.ts.map +1 -0
- package/dist/lib/filesystems/filesystem.js +37 -0
- package/dist/lib/filesystems/node-filesystem.d.ts +2 -2
- package/dist/lib/filesystems/node-filesystem.d.ts.map +1 -1
- package/dist/lib/filesystems/node-filesystem.js +3 -2
- package/dist/lib/option-utils/merge-loader-options.d.ts +1 -1
- package/dist/lib/option-utils/merge-loader-options.d.ts.map +1 -1
- package/dist/lib/worker-loader-utils/create-loader-worker.d.ts +1 -1
- package/dist/lib/worker-loader-utils/create-loader-worker.d.ts.map +1 -1
- package/dist/lib/worker-loader-utils/create-loader-worker.js +3 -2
- package/dist/lib/worker-loader-utils/encode-with-worker.d.ts +1 -1
- package/dist/lib/worker-loader-utils/encode-with-worker.d.ts.map +1 -1
- package/dist/lib/worker-loader-utils/parse-with-worker.d.ts +1 -1
- package/dist/lib/worker-loader-utils/parse-with-worker.d.ts.map +1 -1
- package/dist/loader-types.d.ts +208 -0
- package/dist/loader-types.d.ts.map +1 -0
- package/dist/loader-types.js +36 -0
- package/dist/types.d.ts +0 -259
- package/dist/types.d.ts.map +1 -1
- package/dist/writer-types.d.ts +36 -0
- package/dist/writer-types.d.ts.map +1 -0
- package/dist/writer-types.js +3 -0
- package/package.json +3 -3
- package/src/index.ts +31 -16
- package/src/json-loader.ts +1 -1
- package/src/lib/file-provider/data-view-file.ts +72 -0
- package/src/lib/file-provider/file-handle-file.ts +116 -0
- package/src/lib/file-provider/file-handle.ts +74 -0
- package/src/lib/file-provider/file-provider.ts +56 -0
- package/src/lib/filesystems/filesystem.ts +87 -0
- package/src/lib/filesystems/node-filesystem.ts +3 -3
- package/src/lib/option-utils/merge-loader-options.ts +1 -1
- package/src/lib/worker-loader-utils/create-loader-worker.ts +20 -4
- package/src/lib/worker-loader-utils/encode-with-worker.ts +1 -1
- package/src/lib/worker-loader-utils/parse-with-worker.ts +1 -1
- package/src/loader-types.ts +366 -0
- package/src/types.ts +0 -366
- package/src/writer-types.ts +61 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FileProvider } from './file-provider';
|
|
2
|
+
/** Provides file data using DataView */
|
|
3
|
+
export declare class DataViewFile implements FileProvider {
|
|
4
|
+
/** The DataView from which data is provided */
|
|
5
|
+
private file;
|
|
6
|
+
constructor(file: DataView);
|
|
7
|
+
destroy(): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
10
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
11
|
+
*/
|
|
12
|
+
getUint8(offset: bigint): Promise<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets an unsigned 16-bit intege at the specified byte offset from the start of the file.
|
|
15
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
16
|
+
*/
|
|
17
|
+
getUint16(offset: bigint): Promise<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
20
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
21
|
+
*/
|
|
22
|
+
getUint32(offset: bigint): Promise<number>;
|
|
23
|
+
/**
|
|
24
|
+
* Gets an unsigned 64-bit integer at the specified byte offset from the start of the file.
|
|
25
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
26
|
+
*/
|
|
27
|
+
getBigUint64(offset: bigint): Promise<bigint>;
|
|
28
|
+
/**
|
|
29
|
+
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
30
|
+
* @param startOffset The offset, in bytes, from the start of the file where to start reading the data.
|
|
31
|
+
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
32
|
+
*/
|
|
33
|
+
slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer>;
|
|
34
|
+
/** the length (in bytes) of the data. */
|
|
35
|
+
get length(): bigint;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=data-view-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-view-file.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/data-view-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAc7C,wCAAwC;AACxC,qBAAa,YAAa,YAAW,YAAY;IAC/C,+CAA+C;IAC/C,OAAO,CAAC,IAAI,CAAW;gBAEX,IAAI,EAAE,QAAQ;IAKpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/C;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAInD;;;;OAIG;IACG,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE,yCAAyC;IACzC,IAAI,MAAM,WAET;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataViewFile = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if bigint can be converted to number and convert it if possible
|
|
6
|
+
* @param bigint bigint to be converted
|
|
7
|
+
* @returns number
|
|
8
|
+
*/
|
|
9
|
+
const toNumber = (bigint) => {
|
|
10
|
+
if (bigint > Number.MAX_SAFE_INTEGER) {
|
|
11
|
+
throw new Error('Offset is out of bounds');
|
|
12
|
+
}
|
|
13
|
+
return Number(bigint);
|
|
14
|
+
};
|
|
15
|
+
/** Provides file data using DataView */
|
|
16
|
+
class DataViewFile {
|
|
17
|
+
constructor(file) {
|
|
18
|
+
this.file = file;
|
|
19
|
+
}
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
21
|
+
async destroy() { }
|
|
22
|
+
/**
|
|
23
|
+
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
24
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
25
|
+
*/
|
|
26
|
+
async getUint8(offset) {
|
|
27
|
+
return this.file.getUint8(toNumber(offset));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Gets an unsigned 16-bit intege at the specified byte offset from the start of the file.
|
|
31
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
32
|
+
*/
|
|
33
|
+
async getUint16(offset) {
|
|
34
|
+
return this.file.getUint16(toNumber(offset), true);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
38
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
39
|
+
*/
|
|
40
|
+
async getUint32(offset) {
|
|
41
|
+
return this.file.getUint32(toNumber(offset), true);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets an unsigned 64-bit integer at the specified byte offset from the start of the file.
|
|
45
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
46
|
+
*/
|
|
47
|
+
async getBigUint64(offset) {
|
|
48
|
+
return this.file.getBigUint64(toNumber(offset), true);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
52
|
+
* @param startOffset The offset, in bytes, from the start of the file where to start reading the data.
|
|
53
|
+
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
54
|
+
*/
|
|
55
|
+
async slice(startOffset, endOffset) {
|
|
56
|
+
return this.file.buffer.slice(toNumber(startOffset), toNumber(endOffset));
|
|
57
|
+
}
|
|
58
|
+
/** the length (in bytes) of the data. */
|
|
59
|
+
get length() {
|
|
60
|
+
return BigInt(this.file.byteLength);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.DataViewFile = DataViewFile;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FileProvider } from './file-provider';
|
|
2
|
+
/**
|
|
3
|
+
* Provides file data using node fs library
|
|
4
|
+
*/
|
|
5
|
+
export declare class FileHandleFile implements FileProvider {
|
|
6
|
+
/**
|
|
7
|
+
* Returns a new copy of FileHandleFile
|
|
8
|
+
* @param path The path to the file in file system
|
|
9
|
+
*/
|
|
10
|
+
static from(path: string): Promise<FileHandleFile>;
|
|
11
|
+
/**
|
|
12
|
+
* The FileHandle from which data is provided
|
|
13
|
+
*/
|
|
14
|
+
private fileDescriptor;
|
|
15
|
+
/**
|
|
16
|
+
* The file length in bytes
|
|
17
|
+
*/
|
|
18
|
+
private size;
|
|
19
|
+
private constructor();
|
|
20
|
+
/** Close file */
|
|
21
|
+
destroy(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
24
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
25
|
+
*/
|
|
26
|
+
getUint8(offset: bigint): Promise<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
|
|
29
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
30
|
+
*/
|
|
31
|
+
getUint16(offset: bigint): Promise<number>;
|
|
32
|
+
/**
|
|
33
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
34
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
35
|
+
*/
|
|
36
|
+
getUint32(offset: bigint): Promise<number>;
|
|
37
|
+
/**
|
|
38
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
39
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
40
|
+
*/
|
|
41
|
+
getBigUint64(offset: bigint): Promise<bigint>;
|
|
42
|
+
/**
|
|
43
|
+
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
44
|
+
* @param startOffsset The offset, in byte, from the start of the file where to start reading the data.
|
|
45
|
+
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
46
|
+
*/
|
|
47
|
+
slice(startOffsset: bigint, endOffset: bigint): Promise<ArrayBuffer>;
|
|
48
|
+
/**
|
|
49
|
+
* the length (in bytes) of the data.
|
|
50
|
+
*/
|
|
51
|
+
get length(): bigint;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=file-handle-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-handle-file.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/file-handle-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAI7C;;GAEG;AACH,qBAAa,cAAe,YAAW,YAAY;IACjD;;;OAGG;WACU,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMxD;;OAEG;IACH,OAAO,CAAC,cAAc,CAAa;IAEnC;;OAEG;IACH,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO;IAKP,iBAAiB;IACX,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAU/C;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhD;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhD;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUnD;;;;OAIG;IACG,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAU1E;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;CACF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileHandleFile = void 0;
|
|
4
|
+
const file_handle_1 = require("./file-handle");
|
|
5
|
+
const file_aliases_1 = require("../path-utils/file-aliases");
|
|
6
|
+
/**
|
|
7
|
+
* Provides file data using node fs library
|
|
8
|
+
*/
|
|
9
|
+
class FileHandleFile {
|
|
10
|
+
/**
|
|
11
|
+
* Returns a new copy of FileHandleFile
|
|
12
|
+
* @param path The path to the file in file system
|
|
13
|
+
*/
|
|
14
|
+
static async from(path) {
|
|
15
|
+
path = (0, file_aliases_1.resolvePath)(path);
|
|
16
|
+
const fileDescriptor = await file_handle_1.FileHandle.open(path);
|
|
17
|
+
return new FileHandleFile(fileDescriptor, fileDescriptor.stat.size);
|
|
18
|
+
}
|
|
19
|
+
constructor(fileDescriptor, size) {
|
|
20
|
+
this.fileDescriptor = fileDescriptor;
|
|
21
|
+
this.size = size;
|
|
22
|
+
}
|
|
23
|
+
/** Close file */
|
|
24
|
+
async destroy() {
|
|
25
|
+
await this.fileDescriptor.close();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
29
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
30
|
+
*/
|
|
31
|
+
async getUint8(offset) {
|
|
32
|
+
const val = new Uint8Array((await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer).at(0);
|
|
33
|
+
if (val === undefined) {
|
|
34
|
+
throw new Error('something went wrong');
|
|
35
|
+
}
|
|
36
|
+
return val;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
|
|
40
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
41
|
+
*/
|
|
42
|
+
async getUint16(offset) {
|
|
43
|
+
const val = new Uint16Array((await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer).at(0);
|
|
44
|
+
if (val === undefined) {
|
|
45
|
+
throw new Error('something went wrong');
|
|
46
|
+
}
|
|
47
|
+
return val;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
51
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
52
|
+
*/
|
|
53
|
+
async getUint32(offset) {
|
|
54
|
+
const val = new Uint32Array((await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer).at(0);
|
|
55
|
+
if (val === undefined) {
|
|
56
|
+
throw new Error('something went wrong');
|
|
57
|
+
}
|
|
58
|
+
return val;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
62
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
63
|
+
*/
|
|
64
|
+
async getBigUint64(offset) {
|
|
65
|
+
const val = new BigInt64Array((await this.fileDescriptor.read(Buffer.alloc(8), 0, 8, offset)).buffer.buffer).at(0);
|
|
66
|
+
if (val === undefined) {
|
|
67
|
+
throw new Error('something went wrong');
|
|
68
|
+
}
|
|
69
|
+
return val;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
73
|
+
* @param startOffsset The offset, in byte, from the start of the file where to start reading the data.
|
|
74
|
+
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
75
|
+
*/
|
|
76
|
+
async slice(startOffsset, endOffset) {
|
|
77
|
+
const bigLength = endOffset - startOffsset;
|
|
78
|
+
if (bigLength > Number.MAX_SAFE_INTEGER) {
|
|
79
|
+
throw new Error('too big slice');
|
|
80
|
+
}
|
|
81
|
+
const length = Number(bigLength);
|
|
82
|
+
return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer
|
|
83
|
+
.buffer;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* the length (in bytes) of the data.
|
|
87
|
+
*/
|
|
88
|
+
get length() {
|
|
89
|
+
return this.size;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.FileHandleFile = FileHandleFile;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { BigIntStats } from 'fs';
|
|
4
|
+
/** file reading result */
|
|
5
|
+
export type FileReadResult = {
|
|
6
|
+
/** amount of the bytes read */
|
|
7
|
+
bytesRead: number;
|
|
8
|
+
/** the buffer filled with data from file*/
|
|
9
|
+
buffer: Buffer;
|
|
10
|
+
};
|
|
11
|
+
/** Object handling file info */
|
|
12
|
+
export declare class FileHandle {
|
|
13
|
+
private fileDescriptor;
|
|
14
|
+
private stats;
|
|
15
|
+
private constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Opens a `FileHandle`.
|
|
18
|
+
*
|
|
19
|
+
* @param path path to the file
|
|
20
|
+
* @return Fulfills with a {FileHandle} object.
|
|
21
|
+
*/
|
|
22
|
+
static open(path: string): Promise<FileHandle>;
|
|
23
|
+
/** Close file */
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Reads data from the file and stores that in the given buffer.
|
|
27
|
+
*
|
|
28
|
+
* If the file is not modified concurrently, the end-of-file is reached when the
|
|
29
|
+
* number of bytes read is zero.
|
|
30
|
+
* @param buffer A buffer that will be filled with the file data read.
|
|
31
|
+
* @param offset The location in the buffer at which to start filling.
|
|
32
|
+
* @param length The number of bytes to read.
|
|
33
|
+
* @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an
|
|
34
|
+
* integer, the current file position will remain unchanged.
|
|
35
|
+
* @return Fulfills upon success with a FileReadResult object
|
|
36
|
+
*/
|
|
37
|
+
read: (buffer: Buffer, offset: number, length: number, position: number | bigint) => Promise<FileReadResult>;
|
|
38
|
+
get stat(): BigIntStats;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=file-handle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-handle.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/file-handle.ts"],"names":[],"mappings":";;AAAA,OAAO,EAA0B,WAAW,EAAC,MAAM,IAAI,CAAC;AAExD,0BAA0B;AAC1B,MAAM,MAAM,cAAc,GAAG;IAC3B,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,gCAAgC;AAChC,qBAAa,UAAU;IACrB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,KAAK,CAAc;IAE3B,OAAO;IAIP;;;;;OAKG;WAEU,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAYpD,iBAAiB;IACX,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B;;;;;;;;;;;OAWG;IACH,IAAI,WACM,MAAM,UACN,MAAM,UACN,MAAM,YACJ,MAAM,GAAG,MAAM,KACxB,QAAQ,cAAc,CAAC,CAMxB;IAEF,IAAI,IAAI,IAAI,WAAW,CAEtB;CACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileHandle = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
/** Object handling file info */
|
|
6
|
+
class FileHandle {
|
|
7
|
+
constructor(fileDescriptor, stats) {
|
|
8
|
+
/**
|
|
9
|
+
* Reads data from the file and stores that in the given buffer.
|
|
10
|
+
*
|
|
11
|
+
* If the file is not modified concurrently, the end-of-file is reached when the
|
|
12
|
+
* number of bytes read is zero.
|
|
13
|
+
* @param buffer A buffer that will be filled with the file data read.
|
|
14
|
+
* @param offset The location in the buffer at which to start filling.
|
|
15
|
+
* @param length The number of bytes to read.
|
|
16
|
+
* @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an
|
|
17
|
+
* integer, the current file position will remain unchanged.
|
|
18
|
+
* @return Fulfills upon success with a FileReadResult object
|
|
19
|
+
*/
|
|
20
|
+
this.read = (buffer, offset, length, position) => {
|
|
21
|
+
return new Promise((s) => {
|
|
22
|
+
(0, fs_1.read)(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer) => s({ bytesRead, buffer }));
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
this.fileDescriptor = fileDescriptor;
|
|
26
|
+
this.stats = stats;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Opens a `FileHandle`.
|
|
30
|
+
*
|
|
31
|
+
* @param path path to the file
|
|
32
|
+
* @return Fulfills with a {FileHandle} object.
|
|
33
|
+
*/
|
|
34
|
+
static async open(path) {
|
|
35
|
+
const [fd, stats] = await Promise.all([
|
|
36
|
+
new Promise((resolve, reject) => {
|
|
37
|
+
(0, fs_1.open)(path, undefined, undefined, (_err, fd) => (_err ? reject(_err) : resolve(fd)));
|
|
38
|
+
}),
|
|
39
|
+
new Promise((resolve, reject) => {
|
|
40
|
+
(0, fs_1.stat)(path, { bigint: true }, (_err, stats) => (_err ? reject(_err) : resolve(stats)));
|
|
41
|
+
})
|
|
42
|
+
]);
|
|
43
|
+
return new FileHandle(fd, stats);
|
|
44
|
+
}
|
|
45
|
+
/** Close file */
|
|
46
|
+
async close() {
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
(0, fs_1.close)(this.fileDescriptor, (_err) => resolve());
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
get stat() {
|
|
52
|
+
return this.stats;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.FileHandle = FileHandle;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for providing file data
|
|
3
|
+
*/
|
|
4
|
+
export interface FileProvider {
|
|
5
|
+
/**
|
|
6
|
+
* Cleanup class data
|
|
7
|
+
*/
|
|
8
|
+
destroy(): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
11
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
12
|
+
*/
|
|
13
|
+
getUint8(offset: bigint): Promise<number>;
|
|
14
|
+
/**
|
|
15
|
+
* Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
|
|
16
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
17
|
+
*/
|
|
18
|
+
getUint16(offset: bigint): Promise<number>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
21
|
+
* @param offset The offset, in bytes, from the file of the view where to read the data.
|
|
22
|
+
*/
|
|
23
|
+
getUint32(offset: bigint): Promise<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
26
|
+
* @param offset The offset, in byte, from the file of the view where to read the data.
|
|
27
|
+
*/
|
|
28
|
+
getBigUint64(offset: bigint): Promise<bigint>;
|
|
29
|
+
/**
|
|
30
|
+
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
31
|
+
* @param startOffset The offset, in bytes, from the start of the file where to start reading the data.
|
|
32
|
+
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
33
|
+
*/
|
|
34
|
+
slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer>;
|
|
35
|
+
/**
|
|
36
|
+
* the length (in bytes) of the data.
|
|
37
|
+
*/
|
|
38
|
+
length: bigint;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check is the object has FileProvider members
|
|
42
|
+
* @param fileProvider - tested object
|
|
43
|
+
*/
|
|
44
|
+
export declare const isFileProvider: (fileProvider: unknown) => bigint;
|
|
45
|
+
//# sourceMappingURL=file-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-provider.d.ts","sourceRoot":"","sources":["../../../src/lib/file-provider/file-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9C;;;;OAIG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEpE;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,iBAAkB,OAAO,WAMnD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isFileProvider = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Check is the object has FileProvider members
|
|
6
|
+
* @param fileProvider - tested object
|
|
7
|
+
*/
|
|
8
|
+
const isFileProvider = (fileProvider) => {
|
|
9
|
+
return (fileProvider?.getUint8 &&
|
|
10
|
+
fileProvider?.slice &&
|
|
11
|
+
fileProvider?.length);
|
|
12
|
+
};
|
|
13
|
+
exports.isFileProvider = isFileProvider;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export type ReadOptions = {};
|
|
3
|
+
export type Stat = {
|
|
4
|
+
size: number;
|
|
5
|
+
isDirectory: () => boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A FileSystem interface can encapsulate various file sources,
|
|
9
|
+
* a FileList, a ZipFile, a GoogleDrive etc.
|
|
10
|
+
*/
|
|
11
|
+
export interface FileSystem {
|
|
12
|
+
/**
|
|
13
|
+
* Return a list of file names
|
|
14
|
+
* @param dirname directory name. file system root directory if omitted
|
|
15
|
+
*/
|
|
16
|
+
readdir(dirname?: string, options?: {
|
|
17
|
+
recursive?: boolean;
|
|
18
|
+
}): Promise<string[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets information from a local file from the filesystem
|
|
21
|
+
* @param filename file name to stat
|
|
22
|
+
* @param options currently unused
|
|
23
|
+
* @throws if filename is not in local filesystem
|
|
24
|
+
*/
|
|
25
|
+
stat(filename: string, options?: object): Promise<{
|
|
26
|
+
size: number;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Fetches a local file from the filesystem (or a URL)
|
|
30
|
+
* @param filename
|
|
31
|
+
* @param options
|
|
32
|
+
*/
|
|
33
|
+
fetch(filename: RequestInfo, options?: RequestInit): Promise<Response>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A random access file system
|
|
37
|
+
*/
|
|
38
|
+
export interface RandomAccessReadFileSystem extends FileSystem {
|
|
39
|
+
open(path: string, flags: unknown, mode?: unknown): Promise<any>;
|
|
40
|
+
close(fd: unknown): Promise<void>;
|
|
41
|
+
fstat(fd: unknown): Promise<Stat>;
|
|
42
|
+
read(fd: any, options?: ReadOptions): Promise<{
|
|
43
|
+
bytesRead: number;
|
|
44
|
+
buffer: Buffer;
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A FileSystem interface can encapsulate a FileList, a ZipFile, a GoogleDrive etc.
|
|
49
|
+
*
|
|
50
|
+
export interface IFileSystem {
|
|
51
|
+
/**
|
|
52
|
+
* Return a list of file names
|
|
53
|
+
* @param dirname directory name. file system root directory if omitted
|
|
54
|
+
*
|
|
55
|
+
readdir(dirname?: string, options?: {recursive?: boolean}): Promise<string[]>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Gets information from a local file from the filesystem
|
|
59
|
+
* @param filename file name to stat
|
|
60
|
+
* @param options currently unused
|
|
61
|
+
* @throws if filename is not in local filesystem
|
|
62
|
+
*
|
|
63
|
+
stat(filename: string, options?: object): Promise<{size: number}>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Fetches a local file from the filesystem (or a URL)
|
|
67
|
+
* @param filename
|
|
68
|
+
* @param options
|
|
69
|
+
*
|
|
70
|
+
fetch(filename: string, options?: object): Promise<Response>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type ReadOptions = {buffer?: ArrayBuffer; offset?: number; length?: number; position?: number};
|
|
74
|
+
export interface IRandomAccessReadFileSystem extends IFileSystem {
|
|
75
|
+
open(path: string, flags: string | number, mode?: any): Promise<any>;
|
|
76
|
+
close(fd: any): Promise<void>;
|
|
77
|
+
fstat(fd: any): Promise<object>;
|
|
78
|
+
read(fd: any, options?: ReadOptions): Promise<{bytesRead: number; buffer: Buffer}>;
|
|
79
|
+
}
|
|
80
|
+
*/
|
|
81
|
+
//# sourceMappingURL=filesystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../../src/lib/filesystems/filesystem.ts"],"names":[],"mappings":";AAEA,MAAM,MAAM,WAAW,GAAG,EAAE,CAAC;AAE7B,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,OAAO,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE9E;;;;;OAKG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IAElE;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxE;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,UAAU;IAC5D,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACjE,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;CAQpF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/**
|
|
5
|
+
* A FileSystem interface can encapsulate a FileList, a ZipFile, a GoogleDrive etc.
|
|
6
|
+
*
|
|
7
|
+
export interface IFileSystem {
|
|
8
|
+
/**
|
|
9
|
+
* Return a list of file names
|
|
10
|
+
* @param dirname directory name. file system root directory if omitted
|
|
11
|
+
*
|
|
12
|
+
readdir(dirname?: string, options?: {recursive?: boolean}): Promise<string[]>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Gets information from a local file from the filesystem
|
|
16
|
+
* @param filename file name to stat
|
|
17
|
+
* @param options currently unused
|
|
18
|
+
* @throws if filename is not in local filesystem
|
|
19
|
+
*
|
|
20
|
+
stat(filename: string, options?: object): Promise<{size: number}>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Fetches a local file from the filesystem (or a URL)
|
|
24
|
+
* @param filename
|
|
25
|
+
* @param options
|
|
26
|
+
*
|
|
27
|
+
fetch(filename: string, options?: object): Promise<Response>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type ReadOptions = {buffer?: ArrayBuffer; offset?: number; length?: number; position?: number};
|
|
31
|
+
export interface IRandomAccessReadFileSystem extends IFileSystem {
|
|
32
|
+
open(path: string, flags: string | number, mode?: any): Promise<any>;
|
|
33
|
+
close(fd: any): Promise<void>;
|
|
34
|
+
fstat(fd: any): Promise<object>;
|
|
35
|
+
read(fd: any, options?: ReadOptions): Promise<{bytesRead: number; buffer: Buffer}>;
|
|
36
|
+
}
|
|
37
|
+
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import * as fs from '../node/fs';
|
|
4
|
-
import {
|
|
4
|
+
import { FileSystem, RandomAccessReadFileSystem } from './filesystem';
|
|
5
5
|
type Stat = {
|
|
6
6
|
size: number;
|
|
7
7
|
isDirectory: () => boolean;
|
|
@@ -18,7 +18,7 @@ type ReadOptions = {
|
|
|
18
18
|
* Compatible with BrowserFileSystem.
|
|
19
19
|
* @param options
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export declare class NodeFileSystem implements FileSystem, RandomAccessReadFileSystem {
|
|
22
22
|
constructor(options: {
|
|
23
23
|
[key: string]: any;
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-filesystem.d.ts","sourceRoot":"","sources":["../../../src/lib/filesystems/node-filesystem.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"node-filesystem.d.ts","sourceRoot":"","sources":["../../../src/lib/filesystems/node-filesystem.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,UAAU,EAAE,0BAA0B,EAAC,MAAM,cAAc,CAAC;AAIpE,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC;CACjB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,cAAe,YAAW,UAAU,EAAE,0BAA0B;gBAE/D,OAAO,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC;IAInC,OAAO,CAAC,OAAO,SAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAIpD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/C,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC;IAQjD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvE,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhC,IAAI,CACR,EAAE,EAAE,MAAM,EAEV,EAAC,MAAa,EAAE,MAAU,EAAE,MAA0B,EAAE,QAAe,EAAC,EAAE,WAAW,GACpF,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAAC;CAehD"}
|
|
@@ -23,6 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.NodeFileSystem = void 0;
|
|
26
27
|
const fs = __importStar(require("../node/fs"));
|
|
27
28
|
/**
|
|
28
29
|
* FileSystem pass-through for Node.js
|
|
@@ -30,7 +31,7 @@ const fs = __importStar(require("../node/fs"));
|
|
|
30
31
|
* @param options
|
|
31
32
|
*/
|
|
32
33
|
class NodeFileSystem {
|
|
33
|
-
// implements
|
|
34
|
+
// implements FileSystem
|
|
34
35
|
constructor(options) {
|
|
35
36
|
this.fetch = options._fetch;
|
|
36
37
|
}
|
|
@@ -70,4 +71,4 @@ class NodeFileSystem {
|
|
|
70
71
|
return { bytesRead: totalBytesRead, buffer };
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
|
-
exports.
|
|
74
|
+
exports.NodeFileSystem = NodeFileSystem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-loader-options.d.ts","sourceRoot":"","sources":["../../../src/lib/option-utils/merge-loader-options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"merge-loader-options.d.ts","sourceRoot":"","sources":["../../../src/lib/option-utils/merge-loader-options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,aAAa,EAC9D,WAAW,EAAE,OAAO,GAAG,SAAS,EAChC,UAAU,EAAE,OAAO,GAClB,OAAO,CAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-loader-worker.d.ts","sourceRoot":"","sources":["../../../src/lib/worker-loader-utils/create-loader-worker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"create-loader-worker.d.ts","sourceRoot":"","sources":["../../../src/lib/worker-loader-utils/create-loader-worker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,gBAAgB,EAA+B,MAAM,oBAAoB,CAAC;AAMvF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,QAiC1D"}
|
|
@@ -23,9 +23,10 @@ function createLoaderWorker(loader) {
|
|
|
23
23
|
loader,
|
|
24
24
|
arrayBuffer: input,
|
|
25
25
|
options,
|
|
26
|
+
// @ts-expect-error fetch missing
|
|
26
27
|
context: {
|
|
27
28
|
...context,
|
|
28
|
-
|
|
29
|
+
_parse: parseOnMainThread
|
|
29
30
|
}
|
|
30
31
|
});
|
|
31
32
|
worker_utils_1.WorkerBody.postMessage('done', { result });
|
|
@@ -40,7 +41,7 @@ function createLoaderWorker(loader) {
|
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
exports.createLoaderWorker = createLoaderWorker;
|
|
43
|
-
function parseOnMainThread(arrayBuffer, options) {
|
|
44
|
+
function parseOnMainThread(arrayBuffer, loader, options, context) {
|
|
44
45
|
return new Promise((resolve, reject) => {
|
|
45
46
|
const id = requestId++;
|
|
46
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode-with-worker.d.ts","sourceRoot":"","sources":["../../../src/lib/worker-loader-utils/encode-with-worker.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"encode-with-worker.d.ts","sourceRoot":"","sources":["../../../src/lib/worker-loader-utils/encode-with-worker.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAGzD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,OAW1E"}
|