@loaders.gl/loader-utils 4.0.0-alpha.21 → 4.0.0-alpha.22
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 +19 -0
- 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/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 +1 -0
- 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/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 +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/json-loader.d.ts +1 -1
- package/dist/json-loader.d.ts.map +1 -1
- 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 -215
- 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 +21 -12
- package/src/json-loader.ts +1 -1
- 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 -332
- package/src/writer-types.ts +61 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// loaders.gl, MIT license
|
|
2
|
+
|
|
3
|
+
// WRITERS
|
|
4
|
+
|
|
5
|
+
/** Options for writers */
|
|
6
|
+
export type WriterOptions = {
|
|
7
|
+
/** worker source. If is set will be used instead of loading worker from the Internet */
|
|
8
|
+
source?: string | null;
|
|
9
|
+
/** Force to load WASM libraries from local file system in NodeJS or from loaders.gl CDN in a web browser */
|
|
10
|
+
useLocalLibraries?: boolean;
|
|
11
|
+
/** writer-specific options */
|
|
12
|
+
[writerId: string]: any;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A writer definition that can be used with `@loaders.gl/core` functions
|
|
17
|
+
*/
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
+
export type Writer<DataT = unknown, BatchT = unknown, WriterOptionsT = WriterOptions> = {
|
|
20
|
+
name: string;
|
|
21
|
+
|
|
22
|
+
id: string;
|
|
23
|
+
module: string;
|
|
24
|
+
version: string;
|
|
25
|
+
worker?: string | boolean;
|
|
26
|
+
|
|
27
|
+
// TODO - are these are needed?
|
|
28
|
+
extensions?: string[];
|
|
29
|
+
mimeTypes?: string[];
|
|
30
|
+
binary?: boolean;
|
|
31
|
+
text?: boolean;
|
|
32
|
+
|
|
33
|
+
options: WriterOptionsT;
|
|
34
|
+
deprecatedOptions?: Record<string, string>;
|
|
35
|
+
|
|
36
|
+
// encodeText?: EncodeText;
|
|
37
|
+
// encode?: Encode;
|
|
38
|
+
encodeSync?: EncodeSync;
|
|
39
|
+
// encodeInBatches?: EncodeInBatches;
|
|
40
|
+
encodeURLtoURL?: EncodeURLtoURL;
|
|
41
|
+
|
|
42
|
+
encode?(data: DataT, options?: WriterOptionsT): Promise<ArrayBuffer>;
|
|
43
|
+
encodeText?(table: DataT, options?: WriterOptionsT): Promise<string> | string;
|
|
44
|
+
encodeInBatches?(data: AsyncIterable<any>, options?: WriterOptionsT): AsyncIterable<ArrayBuffer>;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// type Encode = (data: any, options?: WriterOptions) => Promise<ArrayBuffer>;
|
|
48
|
+
type EncodeSync = (data: any, options?: WriterOptions) => ArrayBuffer;
|
|
49
|
+
// TODO
|
|
50
|
+
// type EncodeText = Function;
|
|
51
|
+
// type EncodeInBatches = Function;
|
|
52
|
+
type EncodeURLtoURL = (
|
|
53
|
+
inputUrl: string,
|
|
54
|
+
outputUrl: string,
|
|
55
|
+
options?: WriterOptions
|
|
56
|
+
) => Promise<string>;
|
|
57
|
+
|
|
58
|
+
/** Typescript helper to extract the writer options type from a generic writer type */
|
|
59
|
+
export type WriterOptionsType<T = Writer> = T extends Writer<unknown, unknown, infer Options>
|
|
60
|
+
? Options
|
|
61
|
+
: never;
|