@loaders.gl/core 4.0.0-alpha.22 → 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 +4 -5
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/api/load-in-batches.js.map +1 -1
- package/dist/es5/lib/api/load.js.map +1 -1
- package/dist/es5/lib/api/parse-in-batches.js.map +1 -1
- package/dist/es5/lib/api/parse-sync.js.map +1 -1
- package/dist/es5/lib/api/parse.js.map +1 -1
- package/dist/es5/lib/filesystems/browser-filesystem.js +2 -2
- package/dist/es5/lib/filesystems/browser-filesystem.js.map +1 -1
- package/dist/es5/lib/init.js +1 -1
- package/dist/es5/lib/progress/fetch-progress.js +1 -1
- package/dist/es5/lib/progress/fetch-progress.js.map +1 -1
- package/dist/es5/null-loader.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/api/load-in-batches.js.map +1 -1
- package/dist/esm/lib/api/load.js.map +1 -1
- package/dist/esm/lib/api/parse-in-batches.js.map +1 -1
- package/dist/esm/lib/api/parse-sync.js.map +1 -1
- package/dist/esm/lib/api/parse.js.map +1 -1
- package/dist/esm/lib/filesystems/browser-filesystem.js +1 -1
- package/dist/esm/lib/filesystems/browser-filesystem.js.map +1 -1
- package/dist/esm/lib/init.js +1 -1
- package/dist/esm/lib/progress/fetch-progress.js +1 -1
- package/dist/esm/lib/progress/fetch-progress.js.map +1 -1
- package/dist/esm/null-loader.js +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -5
- package/dist/lib/api/load-in-batches.d.ts +2 -2
- package/dist/lib/api/load-in-batches.d.ts.map +1 -1
- package/dist/lib/api/load.d.ts +4 -2
- package/dist/lib/api/load.d.ts.map +1 -1
- package/dist/lib/api/parse-in-batches.d.ts +2 -2
- package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
- package/dist/lib/api/parse-sync.d.ts +2 -2
- package/dist/lib/api/parse-sync.d.ts.map +1 -1
- package/dist/lib/api/parse.d.ts +2 -2
- package/dist/lib/api/parse.d.ts.map +1 -1
- package/dist/lib/filesystems/browser-filesystem.d.ts +2 -2
- package/dist/lib/filesystems/browser-filesystem.d.ts.map +1 -1
- package/dist/lib/filesystems/browser-filesystem.js +2 -1
- package/dist/lib/progress/fetch-progress.d.ts +1 -1
- package/dist/lib/progress/fetch-progress.d.ts.map +1 -1
- package/dist/lib/progress/fetch-progress.js +2 -1
- package/dist/null-worker-node.js +1 -1
- package/dist/null-worker.js +1 -1
- package/package.json +4 -4
- package/src/index.ts +4 -5
- package/src/lib/api/load-in-batches.ts +4 -4
- package/src/lib/api/load.ts +22 -11
- package/src/lib/api/parse-in-batches.ts +2 -2
- package/src/lib/api/parse-sync.ts +2 -2
- package/src/lib/api/parse.ts +2 -2
- package/src/lib/filesystems/browser-filesystem.ts +2 -2
- package/src/lib/progress/fetch-progress.ts +1 -1
- package/dist/es5/lib/filesystems/filesystem.js +0 -2
- package/dist/es5/lib/filesystems/filesystem.js.map +0 -1
- package/dist/esm/lib/filesystems/filesystem.js +0 -2
- package/dist/esm/lib/filesystems/filesystem.js.map +0 -1
- package/dist/lib/filesystems/filesystem.d.ts +0 -46
- package/dist/lib/filesystems/filesystem.d.ts.map +0 -1
- package/dist/lib/filesystems/filesystem.js +0 -3
- package/src/lib/filesystems/filesystem.ts +0 -51
package/src/lib/api/load.ts
CHANGED
|
@@ -18,34 +18,45 @@ import {parse} from './parse';
|
|
|
18
18
|
* @param context
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
export async function load<
|
|
21
|
+
export async function load<
|
|
22
|
+
LoaderT extends Loader,
|
|
23
|
+
OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>
|
|
24
|
+
>(
|
|
22
25
|
url: string | DataType,
|
|
23
26
|
loader: LoaderT,
|
|
24
|
-
options?:
|
|
27
|
+
options?: OptionsT,
|
|
25
28
|
context?: LoaderContext
|
|
26
29
|
): Promise<LoaderReturnType<LoaderT>>;
|
|
27
30
|
|
|
28
|
-
export async function load
|
|
31
|
+
export async function load(
|
|
29
32
|
url: string | DataType,
|
|
30
|
-
loaders: Loader[]
|
|
31
|
-
options?:
|
|
33
|
+
loaders: Loader[],
|
|
34
|
+
options?: LoaderOptions,
|
|
32
35
|
context?: LoaderContext
|
|
33
|
-
): Promise<
|
|
36
|
+
): Promise<unknown>;
|
|
37
|
+
|
|
38
|
+
export async function load(
|
|
39
|
+
url: string | DataType,
|
|
40
|
+
loaders?: LoaderOptions,
|
|
41
|
+
context?: LoaderContext
|
|
42
|
+
): Promise<unknown>;
|
|
43
|
+
|
|
44
|
+
export async function load(url: string | DataType, loaders: LoaderOptions): Promise<any>;
|
|
34
45
|
|
|
35
46
|
// implementation signature
|
|
36
|
-
export async function load
|
|
47
|
+
export async function load(
|
|
37
48
|
url: string | DataType,
|
|
38
49
|
loaders?: Loader[] | LoaderOptions,
|
|
39
|
-
options?:
|
|
50
|
+
options?: LoaderOptions,
|
|
40
51
|
context?: LoaderContext
|
|
41
|
-
): Promise<
|
|
52
|
+
): Promise<unknown> {
|
|
42
53
|
let resolvedLoaders: Loader | Loader[];
|
|
43
|
-
let resolvedOptions:
|
|
54
|
+
let resolvedOptions: LoaderOptions | undefined;
|
|
44
55
|
|
|
45
56
|
// Signature: load(url, options)
|
|
46
57
|
if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
|
|
47
58
|
resolvedLoaders = [];
|
|
48
|
-
resolvedOptions = loaders as
|
|
59
|
+
resolvedOptions = loaders as LoaderOptions;
|
|
49
60
|
context = undefined; // context not supported in short signature
|
|
50
61
|
} else {
|
|
51
62
|
resolvedLoaders = loaders as Loader | Loader[];
|
|
@@ -36,7 +36,7 @@ export async function parseInBatches(
|
|
|
36
36
|
loaders: Loader[],
|
|
37
37
|
options?: LoaderOptions,
|
|
38
38
|
context?: LoaderContext
|
|
39
|
-
): Promise<AsyncIterable<
|
|
39
|
+
): Promise<AsyncIterable<unknown>>;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Parses `data` in batches by selecting a pre-registered loader
|
|
@@ -44,7 +44,7 @@ export async function parseInBatches(
|
|
|
44
44
|
export async function parseInBatches(
|
|
45
45
|
data: BatchableDataType,
|
|
46
46
|
options?: LoaderOptions
|
|
47
|
-
): Promise<AsyncIterable<
|
|
47
|
+
): Promise<AsyncIterable<unknown>>;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Parses `data` using a specified loader
|
|
@@ -33,12 +33,12 @@ export function parseSync(
|
|
|
33
33
|
loaders: Loader[],
|
|
34
34
|
options?: LoaderOptions,
|
|
35
35
|
context?: LoaderContext
|
|
36
|
-
):
|
|
36
|
+
): unknown;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Parses `data` synchronously by matching a pre=registered loader
|
|
40
40
|
*/
|
|
41
|
-
export function parseSync(data: SyncDataType, options?: LoaderOptions):
|
|
41
|
+
export function parseSync(data: SyncDataType, options?: LoaderOptions): unknown;
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* Parses `data` synchronously using a specified loader
|
package/src/lib/api/parse.ts
CHANGED
|
@@ -36,7 +36,7 @@ export async function parse(
|
|
|
36
36
|
loaders: Loader[],
|
|
37
37
|
options?: LoaderOptions,
|
|
38
38
|
context?: LoaderContext
|
|
39
|
-
): Promise<
|
|
39
|
+
): Promise<unknown>;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Parses data asynchronously by matching a pre-registered loader
|
|
@@ -44,7 +44,7 @@ export async function parse(
|
|
|
44
44
|
export async function parse(
|
|
45
45
|
data: DataType | Promise<DataType>,
|
|
46
46
|
options?: LoaderOptions
|
|
47
|
-
): Promise<
|
|
47
|
+
): Promise<unknown>;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Parses `data` using a specified loader
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {FileSystem} from '
|
|
1
|
+
import type {FileSystem} from '@loaders.gl/loader-utils';
|
|
2
2
|
|
|
3
3
|
type BrowserFileSystemOptions = {
|
|
4
4
|
fetch?: typeof fetch;
|
|
@@ -8,7 +8,7 @@ type BrowserFileSystemOptions = {
|
|
|
8
8
|
* FileSystem adapter for a browser FileList.
|
|
9
9
|
* Holds a list of browser 'File' objects.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export class BrowserFileSystem implements FileSystem {
|
|
12
12
|
private _fetch: typeof fetch;
|
|
13
13
|
private files: {[filename: string]: File} = {};
|
|
14
14
|
private lowerCaseFiles: {[filename: string]: File} = {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Intercepts the Response stream and creates a new Response
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export async function fetchProgress(
|
|
7
7
|
response: Response | Promise<Response>,
|
|
8
8
|
onProgress: any, // TODO better callback types
|
|
9
9
|
onDone = () => {},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.js","names":[],"sources":["../../../../src/lib/filesystems/filesystem.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type ReadOptions = {};\n\nexport type Stat = {\n size: number;\n isDirectory: () => boolean;\n};\n\n/**\n * A FileSystem interface can encapsulate various file sources,\n * a FileList, a ZipFile, a GoogleDrive etc.\n */\nexport interface FileSystem {\n /**\n * Return a list of file names\n * @param dirname directory name. file system root directory if omitted\n */\n readdir(dirname?: string, options?: {recursive?: boolean}): Promise<string[]>;\n\n /**\n * Gets information from a local file from the filesystem\n * @param filename file name to stat\n * @param options currently unused\n * @throws if filename is not in local filesystem\n */\n stat(filename: string, options?: object): Promise<{size: number}>;\n\n /**\n * Fetches a local file from the filesystem (or a URL)\n * @param filename\n * @param options\n */\n fetch(filename: RequestInfo, options?: RequestInit): Promise<Response>;\n}\n\n/**\n * A random access file system\n */\nexport interface RandomAccessReadFileSystem extends FileSystem {\n open(path: string, flags: unknown, mode?: unknown): Promise<any>;\n close(fd: unknown): Promise<void>;\n fstat(fd: unknown): Promise<Stat>;\n read(\n fd: any,\n buffer: ArrayBuffer | ArrayBufferView,\n offset?: number,\n length?: number,\n position?: number\n ): Promise<{bytesRead: number; buffer: ArrayBuffer}>;\n}\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.js","names":[],"sources":["../../../../src/lib/filesystems/filesystem.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type ReadOptions = {};\n\nexport type Stat = {\n size: number;\n isDirectory: () => boolean;\n};\n\n/**\n * A FileSystem interface can encapsulate various file sources,\n * a FileList, a ZipFile, a GoogleDrive etc.\n */\nexport interface FileSystem {\n /**\n * Return a list of file names\n * @param dirname directory name. file system root directory if omitted\n */\n readdir(dirname?: string, options?: {recursive?: boolean}): Promise<string[]>;\n\n /**\n * Gets information from a local file from the filesystem\n * @param filename file name to stat\n * @param options currently unused\n * @throws if filename is not in local filesystem\n */\n stat(filename: string, options?: object): Promise<{size: number}>;\n\n /**\n * Fetches a local file from the filesystem (or a URL)\n * @param filename\n * @param options\n */\n fetch(filename: RequestInfo, options?: RequestInit): Promise<Response>;\n}\n\n/**\n * A random access file system\n */\nexport interface RandomAccessReadFileSystem extends FileSystem {\n open(path: string, flags: unknown, mode?: unknown): Promise<any>;\n close(fd: unknown): Promise<void>;\n fstat(fd: unknown): Promise<Stat>;\n read(\n fd: any,\n buffer: ArrayBuffer | ArrayBufferView,\n offset?: number,\n length?: number,\n position?: number\n ): Promise<{bytesRead: number; buffer: ArrayBuffer}>;\n}\n"],"mappings":""}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export type ReadOptions = {};
|
|
2
|
-
export type Stat = {
|
|
3
|
-
size: number;
|
|
4
|
-
isDirectory: () => boolean;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* A FileSystem interface can encapsulate various file sources,
|
|
8
|
-
* a FileList, a ZipFile, a GoogleDrive etc.
|
|
9
|
-
*/
|
|
10
|
-
export interface FileSystem {
|
|
11
|
-
/**
|
|
12
|
-
* Return a list of file names
|
|
13
|
-
* @param dirname directory name. file system root directory if omitted
|
|
14
|
-
*/
|
|
15
|
-
readdir(dirname?: string, options?: {
|
|
16
|
-
recursive?: boolean;
|
|
17
|
-
}): Promise<string[]>;
|
|
18
|
-
/**
|
|
19
|
-
* Gets information from a local file from the filesystem
|
|
20
|
-
* @param filename file name to stat
|
|
21
|
-
* @param options currently unused
|
|
22
|
-
* @throws if filename is not in local filesystem
|
|
23
|
-
*/
|
|
24
|
-
stat(filename: string, options?: object): Promise<{
|
|
25
|
-
size: number;
|
|
26
|
-
}>;
|
|
27
|
-
/**
|
|
28
|
-
* Fetches a local file from the filesystem (or a URL)
|
|
29
|
-
* @param filename
|
|
30
|
-
* @param options
|
|
31
|
-
*/
|
|
32
|
-
fetch(filename: RequestInfo, options?: RequestInit): Promise<Response>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* A random access file system
|
|
36
|
-
*/
|
|
37
|
-
export interface RandomAccessReadFileSystem extends FileSystem {
|
|
38
|
-
open(path: string, flags: unknown, mode?: unknown): Promise<any>;
|
|
39
|
-
close(fd: unknown): Promise<void>;
|
|
40
|
-
fstat(fd: unknown): Promise<Stat>;
|
|
41
|
-
read(fd: any, buffer: ArrayBuffer | ArrayBufferView, offset?: number, length?: number, position?: number): Promise<{
|
|
42
|
-
bytesRead: number;
|
|
43
|
-
buffer: ArrayBuffer;
|
|
44
|
-
}>;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=filesystem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EA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
|
5
|
-
export type Stat = {
|
|
6
|
-
size: number;
|
|
7
|
-
isDirectory: () => boolean;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A FileSystem interface can encapsulate various file sources,
|
|
12
|
-
* a FileList, a ZipFile, a GoogleDrive etc.
|
|
13
|
-
*/
|
|
14
|
-
export interface FileSystem {
|
|
15
|
-
/**
|
|
16
|
-
* Return a list of file names
|
|
17
|
-
* @param dirname directory name. file system root directory if omitted
|
|
18
|
-
*/
|
|
19
|
-
readdir(dirname?: string, options?: {recursive?: boolean}): Promise<string[]>;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Gets information from a local file from the filesystem
|
|
23
|
-
* @param filename file name to stat
|
|
24
|
-
* @param options currently unused
|
|
25
|
-
* @throws if filename is not in local filesystem
|
|
26
|
-
*/
|
|
27
|
-
stat(filename: string, options?: object): Promise<{size: number}>;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Fetches a local file from the filesystem (or a URL)
|
|
31
|
-
* @param filename
|
|
32
|
-
* @param options
|
|
33
|
-
*/
|
|
34
|
-
fetch(filename: RequestInfo, options?: RequestInit): Promise<Response>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* A random access file system
|
|
39
|
-
*/
|
|
40
|
-
export interface RandomAccessReadFileSystem extends FileSystem {
|
|
41
|
-
open(path: string, flags: unknown, mode?: unknown): Promise<any>;
|
|
42
|
-
close(fd: unknown): Promise<void>;
|
|
43
|
-
fstat(fd: unknown): Promise<Stat>;
|
|
44
|
-
read(
|
|
45
|
-
fd: any,
|
|
46
|
-
buffer: ArrayBuffer | ArrayBufferView,
|
|
47
|
-
offset?: number,
|
|
48
|
-
length?: number,
|
|
49
|
-
position?: number
|
|
50
|
-
): Promise<{bytesRead: number; buffer: ArrayBuffer}>;
|
|
51
|
-
}
|