@loaders.gl/loader-utils 4.0.1 → 4.0.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/dist/index.cjs CHANGED
@@ -147,8 +147,8 @@ function mergeOptionsRecursively(baseOptions, newOptions) {
147
147
  // src/lib/worker-loader-utils/create-loader-worker.ts
148
148
  var import_worker_utils = require("@loaders.gl/worker-utils");
149
149
  var requestId = 0;
150
- function createLoaderWorker(loader) {
151
- if (!import_worker_utils.WorkerBody.inWorkerThread()) {
150
+ async function createLoaderWorker(loader) {
151
+ if (!await import_worker_utils.WorkerBody.inWorkerThread()) {
152
152
  return;
153
153
  }
154
154
  import_worker_utils.WorkerBody.onmessage = async (type, payload) => {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type { DataType, SyncDataType, BatchableDataType, TypedArray, BigTypedArray, TypedArrayConstructor, BigTypedArrayConstructor, NumberArray, NumericArray, FetchLike } from './types';
2
2
  export type { Loader, LoaderWithParser, LoaderContext, LoaderOptions, LoaderOptionsType, LoaderReturnType, LoaderBatchType } from './loader-types';
3
3
  export { parseFromContext, parseSyncFromContext, parseInBatchesFromContext } from './loader-types';
4
- export type { Writer, WriterOptions, WriterOptionsType } from './writer-types';
4
+ export type { Writer, WriterWithEncoder, WriterOptions, WriterOptionsType } from './writer-types';
5
5
  export { assert } from './lib/env-utils/assert';
6
6
  export { isBrowser, isWorker, nodeVersion, self, window, global, document } from './lib/env-utils/globals';
7
7
  export { mergeLoaderOptions } from './lib/option-utils/merge-loader-options';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAEV,QAAQ,EACR,YAAY,EACZ,iBAAiB,EAEjB,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,YAAY,EAEZ,SAAS,EACV,MAAM,SAAS,CAAC;AAIjB,YAAY,EACV,M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AAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,YAAY,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["parseFromContext","parseSyncFromContext","parseInBatchesFromContext","assert","isBrowser","isWorker","nodeVersion","self","window","global","document","mergeLoaderOptions","createLoaderWorker","parseWithWorker","canParseWithWorker","canEncodeWithWorker","parseJSON","sliceArrayBuffer","concatenateArrayBuffers","concatenateTypedArrays","compareArrayBuffers","padToNBytes","copyToArray","copyArrayBuffer","padStringToByteAlignment","copyStringToDataView","copyBinaryToDataView","copyPaddedArrayBufferToDataView","copyPaddedStringToDataView","getFirstCharacters","getMagicString","makeTextEncoderIterator","makeTextDecoderIterator","makeLineIterator","makeNumberedLineIterator","forEach","concatenateArrayBuffersAsync","default","RequestScheduler","setPathPrefix","getPathPrefix","resolvePath","addAliases","_addAliases","JSONLoader","isBuffer","toBuffer","toArrayBuffer","promisify1","promisify2","path","stream","BlobFile","HttpFile","NodeFileFacade","NodeFile","NodeFileSystemFacade","NodeFilesystem","isFileProvider","FileHandleFile","DataViewFile","DataSource","ImageSource"],"sources":["../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n// TYPES\n\nexport type {\n // misc\n DataType,\n SyncDataType,\n BatchableDataType,\n // numeric array types\n TypedArray,\n BigTypedArray,\n TypedArrayConstructor,\n BigTypedArrayConstructor,\n NumberArray,\n NumericArray,\n // fetch\n FetchLike\n} from './types';\n\n// loaders\n\nexport type {\n Loader,\n LoaderWithParser,\n LoaderContext,\n LoaderOptions,\n LoaderOptionsType,\n LoaderReturnType,\n LoaderBatchType\n} from './loader-types';\n\nexport {parseFromContext, parseSyncFromContext, parseInBatchesFromContext} from './loader-types';\n\n// writers\n\nexport type {Writer, WriterOptions, WriterOptionsType} from './writer-types';\n\n// GENERAL UTILS\nexport {assert} from './lib/env-utils/assert';\nexport {\n isBrowser,\n isWorker,\n nodeVersion,\n self,\n window,\n global,\n document\n} from './lib/env-utils/globals';\n\nexport {mergeLoaderOptions} from './lib/option-utils/merge-loader-options';\n\n// LOADERS.GL-SPECIFIC WORKER UTILS\nexport {createLoaderWorker} from './lib/worker-loader-utils/create-loader-worker';\nexport {parseWithWorker, canParseWithWorker} from './lib/worker-loader-utils/parse-with-worker';\nexport {canEncodeWithWorker} from './lib/worker-loader-utils/encode-with-worker';\n\n// PARSER UTILS\nexport {parseJSON} from './lib/parser-utils/parse-json';\n\n// MEMORY COPY UTILS\nexport {\n sliceArrayBuffer,\n concatenateArrayBuffers,\n concatenateTypedArrays,\n compareArrayBuffers\n} from './lib/binary-utils/array-buffer-utils';\nexport {padToNBytes, copyToArray, copyArrayBuffer} from './lib/binary-utils/memory-copy-utils';\nexport {\n padStringToByteAlignment,\n copyStringToDataView,\n copyBinaryToDataView,\n copyPaddedArrayBufferToDataView,\n copyPaddedStringToDataView\n} from './lib/binary-utils/dataview-copy-utils';\nexport {getFirstCharacters, getMagicString} from './lib/binary-utils/get-first-characters';\n\n// ITERATOR UTILS\nexport {\n makeTextEncoderIterator,\n makeTextDecoderIterator,\n makeLineIterator,\n makeNumberedLineIterator\n} from './lib/iterators/text-iterators';\nexport {forEach, concatenateArrayBuffersAsync} from './lib/iterators/async-iteration';\n\n// REQUEST UTILS\nexport {default as RequestScheduler} from './lib/request-utils/request-scheduler';\n\n// PATH HELPERS\nexport {setPathPrefix, getPathPrefix, resolvePath} from './lib/path-utils/file-aliases';\nexport {addAliases as _addAliases} from './lib/path-utils/file-aliases';\n\n// MICRO LOADERS\nexport {JSONLoader} from './json-loader';\n\n// NODE support\n\n// Node.js emulation (can be used in browser)\n\n// Avoid direct use of `Buffer` which pulls in 50KB polyfill\nexport {isBuffer, toBuffer, toArrayBuffer} from './lib/binary-utils/memory-conversion-utils';\n\n// Note.js wrappers (can be safely imported, but not used in browser)\n\n// Use instead of importing 'util' to avoid node dependencies\nexport {promisify1, promisify2} from './lib/node/promisify';\n\n// `path` replacement (avoids bundling big path polyfill)\nimport * as path from './lib/path-utils/path';\nexport {path};\n\n// Use instead of importing 'stream' to avoid node dependencies`\nimport * as stream from './lib/node/stream';\nexport {stream};\n\n// EXPERIMENTAL: FILE SYSTEMS\n\nexport type {ReadableFile, WritableFile, Stat} from './lib/files/file';\nexport {BlobFile} from './lib/files/blob-file';\nexport {HttpFile} from './lib/files/http-file';\nexport {NodeFileFacade as NodeFile} from './lib/files/node-file-facade';\n\nexport type {FileSystem, RandomAccessFileSystem} from './lib/filesystems/filesystem';\nexport {NodeFileSystemFacade as NodeFilesystem} from './lib/filesystems/node-filesystem-facade';\n\n// TODO - replace with ReadableFile\nexport type {FileProvider} from './lib/file-provider/file-provider';\nexport {isFileProvider} from './lib/file-provider/file-provider';\nexport {FileHandleFile} from './lib/file-provider/file-handle-file';\nexport {DataViewFile} from './lib/file-provider/data-view-file';\n\n// EXPERIMENTAL: DATA SOURCES\nexport type {Service} from './service-types';\n\nexport type {DataSourceProps} from './lib/sources/data-source';\nexport {DataSource} from './lib/sources/data-source';\n\nexport type {ImageType} from './lib/sources/utils/image-type';\nexport type {ImageSourceProps, ImageSourceMetadata} from './lib/sources/image-source';\nexport type {GetImageParameters} from './lib/sources/image-source';\nexport {ImageSource} from './lib/sources/image-source';\n\nexport type {\n TileSourceProps,\n TileSourceMetadata,\n GetTileParameters,\n TileLoadParameters\n} from './lib/sources/tile-source';\nexport type {TileSource} from './lib/sources/tile-source';\n\nexport type {ImageTileSource} from './lib/sources/image-tile-source';\n\nexport type {VectorTileSource} from './lib/sources/vector-tile-source';\n"],"mappings":"SAiCQA,gBAAgB,EAAEC,oBAAoB,EAAEC,yBAAyB;AAAA,SAOjEC,MAAM;AAAA,SAEZC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,IAAI,EACJC,MAAM,EACNC,MAAM,EACNC,QAAQ;AAAA,SAGFC,kBAAkB;AAAA,SAGlBC,kBAAkB;AAAA,SAClBC,eAAe,EAAEC,kBAAkB;AAAA,SACnCC,mBAAmB;AAAA,SAGnBC,SAAS;AAAA,SAIfC,gBAAgB,EAChBC,uBAAuB,EACvBC,sBAAsB,EACtBC,mBAAmB;AAAA,SAEbC,WAAW,EAAEC,WAAW,EAAEC,eAAe;AAAA,SAE/CC,wBAAwB,EACxBC,oBAAoB,EACpBC,oBAAoB,EACpBC,+BAA+B,EAC/BC,0BAA0B;AAAA,SAEpBC,kBAAkB,EAAEC,cAAc;AAAA,SAIxCC,uBAAuB,EACvBC,uBAAuB,EACvBC,gBAAgB,EAChBC,wBAAwB;AAAA,SAElBC,OAAO,EAAEC,4BAA4B;AAAA,SAGrCC,OAAO,IAAIC,gBAAgB;AAAA,SAG3BC,aAAa,EAAEC,aAAa,EAAEC,WAAW;AAAA,SACzCC,UAAU,IAAIC,WAAW;AAAA,SAGzBC,UAAU;AAAA,SAOVC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa;AAAA,SAKjCC,UAAU,EAAEC,UAAU;AAAA,OAGvB,KAAKC,IAAI;AAChB,SAAQA,IAAI;AAAE,OAGP,KAAKC,MAAM;AAClB,SAAQA,MAAM;AAAE,SAKRC,QAAQ;AAAA,SACRC,QAAQ;AAAA,SACRC,cAAc,IAAIC,QAAQ;AAAA,SAG1BC,oBAAoB,IAAIC,cAAc;AAAA,SAItCC,cAAc;AAAA,SACdC,cAAc;AAAA,SACdC,YAAY;AAAA,SAMZC,UAAU;AAAA,SAKVC,WAAW"}
1
+ {"version":3,"file":"index.js","names":["parseFromContext","parseSyncFromContext","parseInBatchesFromContext","assert","isBrowser","isWorker","nodeVersion","self","window","global","document","mergeLoaderOptions","createLoaderWorker","parseWithWorker","canParseWithWorker","canEncodeWithWorker","parseJSON","sliceArrayBuffer","concatenateArrayBuffers","concatenateTypedArrays","compareArrayBuffers","padToNBytes","copyToArray","copyArrayBuffer","padStringToByteAlignment","copyStringToDataView","copyBinaryToDataView","copyPaddedArrayBufferToDataView","copyPaddedStringToDataView","getFirstCharacters","getMagicString","makeTextEncoderIterator","makeTextDecoderIterator","makeLineIterator","makeNumberedLineIterator","forEach","concatenateArrayBuffersAsync","default","RequestScheduler","setPathPrefix","getPathPrefix","resolvePath","addAliases","_addAliases","JSONLoader","isBuffer","toBuffer","toArrayBuffer","promisify1","promisify2","path","stream","BlobFile","HttpFile","NodeFileFacade","NodeFile","NodeFileSystemFacade","NodeFilesystem","isFileProvider","FileHandleFile","DataViewFile","DataSource","ImageSource"],"sources":["../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n// TYPES\n\nexport type {\n // misc\n DataType,\n SyncDataType,\n BatchableDataType,\n // numeric array types\n TypedArray,\n BigTypedArray,\n TypedArrayConstructor,\n BigTypedArrayConstructor,\n NumberArray,\n NumericArray,\n // fetch\n FetchLike\n} from './types';\n\n// loaders\n\nexport type {\n Loader,\n LoaderWithParser,\n LoaderContext,\n LoaderOptions,\n LoaderOptionsType,\n LoaderReturnType,\n LoaderBatchType\n} from './loader-types';\n\nexport {parseFromContext, parseSyncFromContext, parseInBatchesFromContext} from './loader-types';\n\n// writers\n\nexport type {Writer, WriterWithEncoder, WriterOptions, WriterOptionsType} from './writer-types';\n\n// GENERAL UTILS\nexport {assert} from './lib/env-utils/assert';\nexport {\n isBrowser,\n isWorker,\n nodeVersion,\n self,\n window,\n global,\n document\n} from './lib/env-utils/globals';\n\nexport {mergeLoaderOptions} from './lib/option-utils/merge-loader-options';\n\n// LOADERS.GL-SPECIFIC WORKER UTILS\nexport {createLoaderWorker} from './lib/worker-loader-utils/create-loader-worker';\nexport {parseWithWorker, canParseWithWorker} from './lib/worker-loader-utils/parse-with-worker';\nexport {canEncodeWithWorker} from './lib/worker-loader-utils/encode-with-worker';\n\n// PARSER UTILS\nexport {parseJSON} from './lib/parser-utils/parse-json';\n\n// MEMORY COPY UTILS\nexport {\n sliceArrayBuffer,\n concatenateArrayBuffers,\n concatenateTypedArrays,\n compareArrayBuffers\n} from './lib/binary-utils/array-buffer-utils';\nexport {padToNBytes, copyToArray, copyArrayBuffer} from './lib/binary-utils/memory-copy-utils';\nexport {\n padStringToByteAlignment,\n copyStringToDataView,\n copyBinaryToDataView,\n copyPaddedArrayBufferToDataView,\n copyPaddedStringToDataView\n} from './lib/binary-utils/dataview-copy-utils';\nexport {getFirstCharacters, getMagicString} from './lib/binary-utils/get-first-characters';\n\n// ITERATOR UTILS\nexport {\n makeTextEncoderIterator,\n makeTextDecoderIterator,\n makeLineIterator,\n makeNumberedLineIterator\n} from './lib/iterators/text-iterators';\nexport {forEach, concatenateArrayBuffersAsync} from './lib/iterators/async-iteration';\n\n// REQUEST UTILS\nexport {default as RequestScheduler} from './lib/request-utils/request-scheduler';\n\n// PATH HELPERS\nexport {setPathPrefix, getPathPrefix, resolvePath} from './lib/path-utils/file-aliases';\nexport {addAliases as _addAliases} from './lib/path-utils/file-aliases';\n\n// MICRO LOADERS\nexport {JSONLoader} from './json-loader';\n\n// NODE support\n\n// Node.js emulation (can be used in browser)\n\n// Avoid direct use of `Buffer` which pulls in 50KB polyfill\nexport {isBuffer, toBuffer, toArrayBuffer} from './lib/binary-utils/memory-conversion-utils';\n\n// Note.js wrappers (can be safely imported, but not used in browser)\n\n// Use instead of importing 'util' to avoid node dependencies\nexport {promisify1, promisify2} from './lib/node/promisify';\n\n// `path` replacement (avoids bundling big path polyfill)\nimport * as path from './lib/path-utils/path';\nexport {path};\n\n// Use instead of importing 'stream' to avoid node dependencies`\nimport * as stream from './lib/node/stream';\nexport {stream};\n\n// EXPERIMENTAL: FILE SYSTEMS\n\nexport type {ReadableFile, WritableFile, Stat} from './lib/files/file';\nexport {BlobFile} from './lib/files/blob-file';\nexport {HttpFile} from './lib/files/http-file';\nexport {NodeFileFacade as NodeFile} from './lib/files/node-file-facade';\n\nexport type {FileSystem, RandomAccessFileSystem} from './lib/filesystems/filesystem';\nexport {NodeFileSystemFacade as NodeFilesystem} from './lib/filesystems/node-filesystem-facade';\n\n// TODO - replace with ReadableFile\nexport type {FileProvider} from './lib/file-provider/file-provider';\nexport {isFileProvider} from './lib/file-provider/file-provider';\nexport {FileHandleFile} from './lib/file-provider/file-handle-file';\nexport {DataViewFile} from './lib/file-provider/data-view-file';\n\n// EXPERIMENTAL: DATA SOURCES\nexport type {Service} from './service-types';\n\nexport type {DataSourceProps} from './lib/sources/data-source';\nexport {DataSource} from './lib/sources/data-source';\n\nexport type {ImageType} from './lib/sources/utils/image-type';\nexport type {ImageSourceProps, ImageSourceMetadata} from './lib/sources/image-source';\nexport type {GetImageParameters} from './lib/sources/image-source';\nexport {ImageSource} from './lib/sources/image-source';\n\nexport type {\n TileSourceProps,\n TileSourceMetadata,\n GetTileParameters,\n TileLoadParameters\n} from './lib/sources/tile-source';\nexport type {TileSource} from './lib/sources/tile-source';\n\nexport type {ImageTileSource} from './lib/sources/image-tile-source';\n\nexport type {VectorTileSource} from './lib/sources/vector-tile-source';\n"],"mappings":"SAiCQA,gBAAgB,EAAEC,oBAAoB,EAAEC,yBAAyB;AAAA,SAOjEC,MAAM;AAAA,SAEZC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,IAAI,EACJC,MAAM,EACNC,MAAM,EACNC,QAAQ;AAAA,SAGFC,kBAAkB;AAAA,SAGlBC,kBAAkB;AAAA,SAClBC,eAAe,EAAEC,kBAAkB;AAAA,SACnCC,mBAAmB;AAAA,SAGnBC,SAAS;AAAA,SAIfC,gBAAgB,EAChBC,uBAAuB,EACvBC,sBAAsB,EACtBC,mBAAmB;AAAA,SAEbC,WAAW,EAAEC,WAAW,EAAEC,eAAe;AAAA,SAE/CC,wBAAwB,EACxBC,oBAAoB,EACpBC,oBAAoB,EACpBC,+BAA+B,EAC/BC,0BAA0B;AAAA,SAEpBC,kBAAkB,EAAEC,cAAc;AAAA,SAIxCC,uBAAuB,EACvBC,uBAAuB,EACvBC,gBAAgB,EAChBC,wBAAwB;AAAA,SAElBC,OAAO,EAAEC,4BAA4B;AAAA,SAGrCC,OAAO,IAAIC,gBAAgB;AAAA,SAG3BC,aAAa,EAAEC,aAAa,EAAEC,WAAW;AAAA,SACzCC,UAAU,IAAIC,WAAW;AAAA,SAGzBC,UAAU;AAAA,SAOVC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa;AAAA,SAKjCC,UAAU,EAAEC,UAAU;AAAA,OAGvB,KAAKC,IAAI;AAChB,SAAQA,IAAI;AAAE,OAGP,KAAKC,MAAM;AAClB,SAAQA,MAAM;AAAE,SAKRC,QAAQ;AAAA,SACRC,QAAQ;AAAA,SACRC,cAAc,IAAIC,QAAQ;AAAA,SAG1BC,oBAAoB,IAAIC,cAAc;AAAA,SAItCC,cAAc;AAAA,SACdC,cAAc;AAAA,SACdC,YAAY;AAAA,SAMZC,UAAU;AAAA,SAKVC,WAAW"}
@@ -1,4 +1,7 @@
1
1
  import { ReadableFile } from './file';
2
+ /**
3
+ * BlobFile provides a "file like interface" to the data in a Blob or File object
4
+ */
2
5
  export declare class BlobFile implements ReadableFile {
3
6
  readonly handle: Blob;
4
7
  readonly size: number;
@@ -1 +1 @@
1
- {"version":3,"file":"blob-file.d.ts","sourceRoot":"","sources":["../../../src/lib/files/blob-file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,qBAAa,QAAS,YAAW,YAAY;IAC3C,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAET,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,WAAW;IAOrC,KAAK;IAEL,IAAI;;;;;IAQJ,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAIhE"}
1
+ {"version":3,"file":"blob-file.d.ts","sourceRoot":"","sources":["../../../src/lib/files/blob-file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC;;GAEG;AACH,qBAAa,QAAS,YAAW,YAAY;IAC3C,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAET,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,WAAW;IAOrC,KAAK;IAEL,IAAI;;;;;IAQJ,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAIhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"blob-file.js","names":["BlobFile","constructor","blob","handle","size","bigsize","url","ArrayBuffer","Blob","byteLength","BigInt","File","name","close","stat","isDirectory","read","start","length","arrayBuffer","slice"],"sources":["../../../src/lib/files/blob-file.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {ReadableFile} from './file';\n\nexport class BlobFile implements ReadableFile {\n readonly handle: Blob;\n readonly size: number;\n readonly bigsize: bigint;\n readonly url: string;\n\n constructor(blob: Blob | File | ArrayBuffer) {\n this.handle = blob instanceof ArrayBuffer ? new Blob([blob]) : blob;\n this.size = blob instanceof ArrayBuffer ? blob.byteLength : blob.size;\n this.bigsize = BigInt(this.size);\n this.url = blob instanceof File ? blob.name : '';\n }\n\n async close() {}\n\n async stat() {\n return {\n size: this.handle.size,\n bigsize: BigInt(this.handle.size),\n isDirectory: false\n };\n }\n\n async read(start: number, length: number): Promise<ArrayBuffer> {\n const arrayBuffer = await this.handle.slice(start, start + length).arrayBuffer();\n return arrayBuffer;\n }\n}\n"],"mappings":"AAKA,OAAO,MAAMA,QAAQ,CAAyB;EAM5CC,WAAWA,CAACC,IAA+B,EAAE;IAAA,KALpCC,MAAM;IAAA,KACNC,IAAI;IAAA,KACJC,OAAO;IAAA,KACPC,GAAG;IAGV,IAAI,CAACH,MAAM,GAAGD,IAAI,YAAYK,WAAW,GAAG,IAAIC,IAAI,CAAC,CAACN,IAAI,CAAC,CAAC,GAAGA,IAAI;IACnE,IAAI,CAACE,IAAI,GAAGF,IAAI,YAAYK,WAAW,GAAGL,IAAI,CAACO,UAAU,GAAGP,IAAI,CAACE,IAAI;IACrE,IAAI,CAACC,OAAO,GAAGK,MAAM,CAAC,IAAI,CAACN,IAAI,CAAC;IAChC,IAAI,CAACE,GAAG,GAAGJ,IAAI,YAAYS,IAAI,GAAGT,IAAI,CAACU,IAAI,GAAG,EAAE;EAClD;EAEA,MAAMC,KAAKA,CAAA,EAAG,CAAC;EAEf,MAAMC,IAAIA,CAAA,EAAG;IACX,OAAO;MACLV,IAAI,EAAE,IAAI,CAACD,MAAM,CAACC,IAAI;MACtBC,OAAO,EAAEK,MAAM,CAAC,IAAI,CAACP,MAAM,CAACC,IAAI,CAAC;MACjCW,WAAW,EAAE;IACf,CAAC;EACH;EAEA,MAAMC,IAAIA,CAACC,KAAa,EAAEC,MAAc,EAAwB;IAC9D,MAAMC,WAAW,GAAG,MAAM,IAAI,CAAChB,MAAM,CAACiB,KAAK,CAACH,KAAK,EAAEA,KAAK,GAAGC,MAAM,CAAC,CAACC,WAAW,CAAC,CAAC;IAChF,OAAOA,WAAW;EACpB;AACF"}
1
+ {"version":3,"file":"blob-file.js","names":["BlobFile","constructor","blob","handle","size","bigsize","url","ArrayBuffer","Blob","byteLength","BigInt","File","name","close","stat","isDirectory","read","start","length","arrayBuffer","slice"],"sources":["../../../src/lib/files/blob-file.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {ReadableFile} from './file';\n\n/**\n * BlobFile provides a \"file like interface\" to the data in a Blob or File object\n */\nexport class BlobFile implements ReadableFile {\n readonly handle: Blob;\n readonly size: number;\n readonly bigsize: bigint;\n readonly url: string;\n\n constructor(blob: Blob | File | ArrayBuffer) {\n this.handle = blob instanceof ArrayBuffer ? new Blob([blob]) : blob;\n this.size = blob instanceof ArrayBuffer ? blob.byteLength : blob.size;\n this.bigsize = BigInt(this.size);\n this.url = blob instanceof File ? blob.name : '';\n }\n\n async close() {}\n\n async stat() {\n return {\n size: this.handle.size,\n bigsize: BigInt(this.handle.size),\n isDirectory: false\n };\n }\n\n async read(start: number, length: number): Promise<ArrayBuffer> {\n const arrayBuffer = await this.handle.slice(start, start + length).arrayBuffer();\n return arrayBuffer;\n }\n}\n"],"mappings":"AAQA,OAAO,MAAMA,QAAQ,CAAyB;EAM5CC,WAAWA,CAACC,IAA+B,EAAE;IAAA,KALpCC,MAAM;IAAA,KACNC,IAAI;IAAA,KACJC,OAAO;IAAA,KACPC,GAAG;IAGV,IAAI,CAACH,MAAM,GAAGD,IAAI,YAAYK,WAAW,GAAG,IAAIC,IAAI,CAAC,CAACN,IAAI,CAAC,CAAC,GAAGA,IAAI;IACnE,IAAI,CAACE,IAAI,GAAGF,IAAI,YAAYK,WAAW,GAAGL,IAAI,CAACO,UAAU,GAAGP,IAAI,CAACE,IAAI;IACrE,IAAI,CAACC,OAAO,GAAGK,MAAM,CAAC,IAAI,CAACN,IAAI,CAAC;IAChC,IAAI,CAACE,GAAG,GAAGJ,IAAI,YAAYS,IAAI,GAAGT,IAAI,CAACU,IAAI,GAAG,EAAE;EAClD;EAEA,MAAMC,KAAKA,CAAA,EAAG,CAAC;EAEf,MAAMC,IAAIA,CAAA,EAAG;IACX,OAAO;MACLV,IAAI,EAAE,IAAI,CAACD,MAAM,CAACC,IAAI;MACtBC,OAAO,EAAEK,MAAM,CAAC,IAAI,CAACP,MAAM,CAACC,IAAI,CAAC;MACjCW,WAAW,EAAE;IACf,CAAC;EACH;EAEA,MAAMC,IAAIA,CAACC,KAAa,EAAEC,MAAc,EAAwB;IAC9D,MAAMC,WAAW,GAAG,MAAM,IAAI,CAAChB,MAAM,CAACiB,KAAK,CAACH,KAAK,EAAEA,KAAK,GAAGC,MAAM,CAAC,CAACC,WAAW,CAAC,CAAC;IAChF,OAAOA,WAAW;EACpB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/lib/node/buffer.ts"],"names":[],"mappings":";AAMA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,KAAA,OAOnC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CAcjE"}
1
+ {"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/lib/node/buffer.ts"],"names":[],"mappings":";AAMA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,KAAA,OAOnC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CAejE"}
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.js","names":["toArrayBuffer","buffer","Buffer","isBuffer","typedArray","Uint8Array","byteOffset","length","slice","toBuffer","binaryData","ArrayBuffer","isView","from","Error"],"sources":["../../../src/lib/node/buffer.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n// Isolates Buffer references to ensure they are only bundled under Node.js (avoids big webpack polyfill)\n// this file is selected by the package.json \"browser\" field).\n\n/**\n * Convert Buffer to ArrayBuffer\n * Converts Node.js `Buffer` to `ArrayBuffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toArrayBuffer(buffer) {\n // TODO - per docs we should just be able to call buffer.buffer, but there are issues\n if (Buffer.isBuffer(buffer)) {\n const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);\n return typedArray.slice().buffer;\n }\n return buffer;\n}\n\n/**\n * Convert (copy) ArrayBuffer to Buffer\n */\nexport function toBuffer(binaryData: ArrayBuffer | Buffer): Buffer {\n if (Buffer.isBuffer(binaryData)) {\n return binaryData;\n }\n\n if (ArrayBuffer.isView(binaryData)) {\n binaryData = binaryData.buffer;\n }\n\n if (typeof Buffer !== 'undefined' && binaryData instanceof ArrayBuffer) {\n return Buffer.from(binaryData);\n }\n\n throw new Error('toBuffer');\n}\n"],"mappings":"AAWA,OAAO,SAASA,aAAaA,CAACC,MAAM,EAAE;EAEpC,IAAIC,MAAM,CAACC,QAAQ,CAACF,MAAM,CAAC,EAAE;IAC3B,MAAMG,UAAU,GAAG,IAAIC,UAAU,CAACJ,MAAM,CAACA,MAAM,EAAEA,MAAM,CAACK,UAAU,EAAEL,MAAM,CAACM,MAAM,CAAC;IAClF,OAAOH,UAAU,CAACI,KAAK,CAAC,CAAC,CAACP,MAAM;EAClC;EACA,OAAOA,MAAM;AACf;AAKA,OAAO,SAASQ,QAAQA,CAACC,UAAgC,EAAU;EACjE,IAAIR,MAAM,CAACC,QAAQ,CAACO,UAAU,CAAC,EAAE;IAC/B,OAAOA,UAAU;EACnB;EAEA,IAAIC,WAAW,CAACC,MAAM,CAACF,UAAU,CAAC,EAAE;IAClCA,UAAU,GAAGA,UAAU,CAACT,MAAM;EAChC;EAEA,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAIQ,UAAU,YAAYC,WAAW,EAAE;IACtE,OAAOT,MAAM,CAACW,IAAI,CAACH,UAAU,CAAC;EAChC;EAEA,MAAM,IAAII,KAAK,CAAC,UAAU,CAAC;AAC7B"}
1
+ {"version":3,"file":"buffer.js","names":["toArrayBuffer","buffer","Buffer","isBuffer","typedArray","Uint8Array","byteOffset","length","slice","toBuffer","binaryData","ArrayBuffer","isView","from","Error"],"sources":["../../../src/lib/node/buffer.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n// Isolates Buffer references to ensure they are only bundled under Node.js (avoids big webpack polyfill)\n// this file is selected by the package.json \"browser\" field).\n\n/**\n * Convert Buffer to ArrayBuffer\n * Converts Node.js `Buffer` to `ArrayBuffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toArrayBuffer(buffer) {\n // TODO - per docs we should just be able to call buffer.buffer, but there are issues\n if (Buffer.isBuffer(buffer)) {\n const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);\n return typedArray.slice().buffer;\n }\n return buffer;\n}\n\n/**\n * Convert (copy) ArrayBuffer to Buffer\n */\nexport function toBuffer(binaryData: ArrayBuffer | Buffer): Buffer {\n if (Buffer.isBuffer(binaryData)) {\n return binaryData;\n }\n\n if (ArrayBuffer.isView(binaryData)) {\n binaryData = binaryData.buffer;\n }\n\n // TODO - move to loaders.gl/polyfills\n if (typeof Buffer !== 'undefined' && binaryData instanceof ArrayBuffer) {\n return Buffer.from(binaryData);\n }\n\n throw new Error('toBuffer');\n}\n"],"mappings":"AAWA,OAAO,SAASA,aAAaA,CAACC,MAAM,EAAE;EAEpC,IAAIC,MAAM,CAACC,QAAQ,CAACF,MAAM,CAAC,EAAE;IAC3B,MAAMG,UAAU,GAAG,IAAIC,UAAU,CAACJ,MAAM,CAACA,MAAM,EAAEA,MAAM,CAACK,UAAU,EAAEL,MAAM,CAACM,MAAM,CAAC;IAClF,OAAOH,UAAU,CAACI,KAAK,CAAC,CAAC,CAACP,MAAM;EAClC;EACA,OAAOA,MAAM;AACf;AAKA,OAAO,SAASQ,QAAQA,CAACC,UAAgC,EAAU;EACjE,IAAIR,MAAM,CAACC,QAAQ,CAACO,UAAU,CAAC,EAAE;IAC/B,OAAOA,UAAU;EACnB;EAEA,IAAIC,WAAW,CAACC,MAAM,CAACF,UAAU,CAAC,EAAE;IAClCA,UAAU,GAAGA,UAAU,CAACT,MAAM;EAChC;EAGA,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAIQ,UAAU,YAAYC,WAAW,EAAE;IACtE,OAAOT,MAAM,CAACW,IAAI,CAACH,UAAU,CAAC;EAChC;EAEA,MAAM,IAAII,KAAK,CAAC,UAAU,CAAC;AAC7B"}
@@ -3,5 +3,5 @@ import type { LoaderWithParser } from '../../loader-types';
3
3
  * Set up a WebWorkerGlobalScope to talk with the main thread
4
4
  * @param loader
5
5
  */
6
- export declare function createLoaderWorker(loader: LoaderWithParser): void;
6
+ export declare function createLoaderWorker(loader: LoaderWithParser): Promise<void>;
7
7
  //# sourceMappingURL=create-loader-worker.d.ts.map
@@ -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,EAA+B,MAAM,oBAAoB,CAAC;AAMvF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,QAiC1D"}
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,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,iBAiChE"}
@@ -1,7 +1,7 @@
1
1
  import { WorkerBody } from '@loaders.gl/worker-utils';
2
2
  let requestId = 0;
3
- export function createLoaderWorker(loader) {
4
- if (!WorkerBody.inWorkerThread()) {
3
+ export async function createLoaderWorker(loader) {
4
+ if (!(await WorkerBody.inWorkerThread())) {
5
5
  return;
6
6
  }
7
7
  WorkerBody.onmessage = async (type, payload) => {
@@ -1 +1 @@
1
- {"version":3,"file":"create-loader-worker.js","names":["WorkerBody","requestId","createLoaderWorker","loader","inWorkerThread","onmessage","type","payload","input","options","context","result","parseData","arrayBuffer","_parse","parseOnMainThread","postMessage","error","message","Error","Promise","resolve","reject","id","onMessage","removeEventListener","addEventListener","_ref","data","parser","parseSync","parse","parseTextSync","textDecoder","TextDecoder","decode","name","modules","worker"],"sources":["../../../src/lib/worker-loader-utils/create-loader-worker.ts"],"sourcesContent":["/* eslint-disable no-restricted-globals */\nimport type {LoaderWithParser, LoaderOptions, LoaderContext} from '../../loader-types';\nimport {WorkerBody} from '@loaders.gl/worker-utils';\n// import {validateLoaderVersion} from './validate-loader-version';\n\nlet requestId = 0;\n\n/**\n * Set up a WebWorkerGlobalScope to talk with the main thread\n * @param loader\n */\nexport function createLoaderWorker(loader: LoaderWithParser) {\n // Check that we are actually in a worker thread\n if (!WorkerBody.inWorkerThread()) {\n return;\n }\n\n WorkerBody.onmessage = async (type, payload) => {\n switch (type) {\n case 'process':\n try {\n // validateLoaderVersion(loader, data.source.split('@')[1]);\n\n const {input, options = {}, context = {}} = payload;\n\n const result = await parseData({\n loader,\n arrayBuffer: input,\n options,\n // @ts-expect-error fetch missing\n context: {\n ...context,\n _parse: parseOnMainThread\n }\n });\n WorkerBody.postMessage('done', {result});\n } catch (error) {\n const message = error instanceof Error ? error.message : '';\n WorkerBody.postMessage('error', {error: message});\n }\n break;\n default:\n }\n };\n}\n\nfunction parseOnMainThread(\n arrayBuffer: ArrayBuffer,\n loader: any,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const id = requestId++;\n\n /**\n */\n const onMessage = (type, payload) => {\n if (payload.id !== id) {\n // not ours\n return;\n }\n\n switch (type) {\n case 'done':\n WorkerBody.removeEventListener(onMessage);\n resolve(payload.result);\n break;\n\n case 'error':\n WorkerBody.removeEventListener(onMessage);\n reject(payload.error);\n break;\n\n default:\n // ignore\n }\n };\n\n WorkerBody.addEventListener(onMessage);\n\n // Ask the main thread to decode data\n const payload = {id, input: arrayBuffer, options};\n WorkerBody.postMessage('process', payload);\n });\n}\n\n// TODO - Support byteOffset and byteLength (enabling parsing of embedded binaries without copies)\n// TODO - Why not support async loader.parse* funcs here?\n// TODO - Why not reuse a common function instead of reimplementing loader.parse* selection logic? Keeping loader small?\n// TODO - Lack of appropriate parser functions can be detected when we create worker, no need to wait until parse\nasync function parseData({\n loader,\n arrayBuffer,\n options,\n context\n}: {\n loader: LoaderWithParser;\n arrayBuffer: ArrayBuffer;\n options: LoaderOptions;\n context: LoaderContext;\n}) {\n let data;\n let parser;\n if (loader.parseSync || loader.parse) {\n data = arrayBuffer;\n parser = loader.parseSync || loader.parse;\n } else if (loader.parseTextSync) {\n const textDecoder = new TextDecoder();\n data = textDecoder.decode(arrayBuffer);\n parser = loader.parseTextSync;\n } else {\n throw new Error(`Could not load data with ${loader.name} loader`);\n }\n\n // TODO - proper merge in of loader options...\n options = {\n ...options,\n modules: (loader && loader.options && loader.options.modules) || {},\n worker: false\n };\n\n return await parser(data, {...options}, context, loader);\n}\n"],"mappings":"AAEA,SAAQA,UAAU,QAAO,0BAA0B;AAGnD,IAAIC,SAAS,GAAG,CAAC;AAMjB,OAAO,SAASC,kBAAkBA,CAACC,MAAwB,EAAE;EAE3D,IAAI,CAACH,UAAU,CAACI,cAAc,CAAC,CAAC,EAAE;IAChC;EACF;EAEAJ,UAAU,CAACK,SAAS,GAAG,OAAOC,IAAI,EAAEC,OAAO,KAAK;IAC9C,QAAQD,IAAI;MACV,KAAK,SAAS;QACZ,IAAI;UAGF,MAAM;YAACE,KAAK;YAAEC,OAAO,GAAG,CAAC,CAAC;YAAEC,OAAO,GAAG,CAAC;UAAC,CAAC,GAAGH,OAAO;UAEnD,MAAMI,MAAM,GAAG,MAAMC,SAAS,CAAC;YAC7BT,MAAM;YACNU,WAAW,EAAEL,KAAK;YAClBC,OAAO;YAEPC,OAAO,EAAE;cACP,GAAGA,OAAO;cACVI,MAAM,EAAEC;YACV;UACF,CAAC,CAAC;UACFf,UAAU,CAACgB,WAAW,CAAC,MAAM,EAAE;YAACL;UAAM,CAAC,CAAC;QAC1C,CAAC,CAAC,OAAOM,KAAK,EAAE;UACd,MAAMC,OAAO,GAAGD,KAAK,YAAYE,KAAK,GAAGF,KAAK,CAACC,OAAO,GAAG,EAAE;UAC3DlB,UAAU,CAACgB,WAAW,CAAC,OAAO,EAAE;YAACC,KAAK,EAAEC;UAAO,CAAC,CAAC;QACnD;QACA;MACF;IACF;EACF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,CAAC;IACrCN,IAAI,GAAGK,WAAW,CAACE,MAAM,CAACtB,WAAW,CAAC;IACtCgB,MAAM,GAAG1B,MAAM,CAAC6B,aAAa;EAC/B,CAAC,MAAM;IACL,MAAM,IAAIb,KAAK,CAAE,4BAA2BhB,MAAM,CAACiC,IAAK,SAAQ,CAAC;EACnE;EAGA3B,OAAO,GAAG;IACR,GAAGA,OAAO;IACV4B,OAAO,EAAGlC,MAAM,IAAIA,MAAM,CAACM,OAAO,IAAIN,MAAM,CAACM,OAAO,CAAC4B,OAAO,IAAK,CAAC,CAAC;IACnEC,MAAM,EAAE;EACV,CAAC;EAED,OAAO,MAAMT,MAAM,CAACD,IAAI,EAAE;IAAC,GAAGnB;EAAO,CAAC,EAAEC,OAAO,EAAEP,MAAM,CAAC;AAC1D"}
1
+ {"version":3,"file":"create-loader-worker.js","names":["WorkerBody","requestId","createLoaderWorker","loader","inWorkerThread","onmessage","type","payload","input","options","context","result","parseData","arrayBuffer","_parse","parseOnMainThread","postMessage","error","message","Error","Promise","resolve","reject","id","onMessage","removeEventListener","addEventListener","_ref","data","parser","parseSync","parse","parseTextSync","textDecoder","TextDecoder","decode","name","modules","worker"],"sources":["../../../src/lib/worker-loader-utils/create-loader-worker.ts"],"sourcesContent":["/* eslint-disable no-restricted-globals */\nimport type {LoaderWithParser, LoaderOptions, LoaderContext} from '../../loader-types';\nimport {WorkerBody} from '@loaders.gl/worker-utils';\n// import {validateLoaderVersion} from './validate-loader-version';\n\nlet requestId = 0;\n\n/**\n * Set up a WebWorkerGlobalScope to talk with the main thread\n * @param loader\n */\nexport async function createLoaderWorker(loader: LoaderWithParser) {\n // Check that we are actually in a worker thread\n if (!(await WorkerBody.inWorkerThread())) {\n return;\n }\n\n WorkerBody.onmessage = async (type, payload) => {\n switch (type) {\n case 'process':\n try {\n // validateLoaderVersion(loader, data.source.split('@')[1]);\n\n const {input, options = {}, context = {}} = payload;\n\n const result = await parseData({\n loader,\n arrayBuffer: input,\n options,\n // @ts-expect-error fetch missing\n context: {\n ...context,\n _parse: parseOnMainThread\n }\n });\n WorkerBody.postMessage('done', {result});\n } catch (error) {\n const message = error instanceof Error ? error.message : '';\n WorkerBody.postMessage('error', {error: message});\n }\n break;\n default:\n }\n };\n}\n\nfunction parseOnMainThread(\n arrayBuffer: ArrayBuffer,\n loader: any,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const id = requestId++;\n\n /**\n */\n const onMessage = (type, payload) => {\n if (payload.id !== id) {\n // not ours\n return;\n }\n\n switch (type) {\n case 'done':\n WorkerBody.removeEventListener(onMessage);\n resolve(payload.result);\n break;\n\n case 'error':\n WorkerBody.removeEventListener(onMessage);\n reject(payload.error);\n break;\n\n default:\n // ignore\n }\n };\n\n WorkerBody.addEventListener(onMessage);\n\n // Ask the main thread to decode data\n const payload = {id, input: arrayBuffer, options};\n WorkerBody.postMessage('process', payload);\n });\n}\n\n// TODO - Support byteOffset and byteLength (enabling parsing of embedded binaries without copies)\n// TODO - Why not support async loader.parse* funcs here?\n// TODO - Why not reuse a common function instead of reimplementing loader.parse* selection logic? Keeping loader small?\n// TODO - Lack of appropriate parser functions can be detected when we create worker, no need to wait until parse\nasync function parseData({\n loader,\n arrayBuffer,\n options,\n context\n}: {\n loader: LoaderWithParser;\n arrayBuffer: ArrayBuffer;\n options: LoaderOptions;\n context: LoaderContext;\n}) {\n let data;\n let parser;\n if (loader.parseSync || loader.parse) {\n data = arrayBuffer;\n parser = loader.parseSync || loader.parse;\n } else if (loader.parseTextSync) {\n const textDecoder = new TextDecoder();\n data = textDecoder.decode(arrayBuffer);\n parser = loader.parseTextSync;\n } else {\n throw new Error(`Could not load data with ${loader.name} loader`);\n }\n\n // TODO - proper merge in of loader options...\n options = {\n ...options,\n modules: (loader && loader.options && loader.options.modules) || {},\n worker: false\n };\n\n return await parser(data, {...options}, context, loader);\n}\n"],"mappings":"AAEA,SAAQA,UAAU,QAAO,0BAA0B;AAGnD,IAAIC,S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AO,MAAMT,MAAM,CAACD,IAAI,EAAE;IAAC,GAAGnB;EAAO,CAAC,EAAEC,OAAO,EAAEP,MAAM,CAAC;AAC1D"}
@@ -1,4 +1,5 @@
1
1
  import { FetchLike, TransformBatches } from './types';
2
+ import { ReadableFile } from './lib/files/file';
2
3
  /**
3
4
  * Core Loader Options
4
5
  */
@@ -126,19 +127,20 @@ export type Loader<DataT = any, BatchT = any, LoaderOptionsT = LoaderOptions> =
126
127
  export type LoaderWithParser<DataT = any, BatchT = any, LoaderOptionsT = LoaderOptions> = Loader<DataT, BatchT, LoaderOptionsT> & {
127
128
  /** Perform actions before load. @deprecated Not officially supported. */
128
129
  preload?: Preload;
129
- /** Parse atomically from an arraybuffer asynchronously */
130
+ /** Parse asynchronously and atomically from an arraybuffer */
130
131
  parse: (arrayBuffer: ArrayBuffer, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;
131
- parseFile?: (file: Blob, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;
132
- /** Parse atomically from an arraybuffer synchronously */
132
+ /** Parse asynchronously and atomically from a random access "file like" input */
133
+ parseFile?: (file: ReadableFile, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;
134
+ /** Parse synchronously and atomically from an arraybuffer */
133
135
  parseSync?: (arrayBuffer: ArrayBuffer, options?: LoaderOptionsT, context?: LoaderContext) => DataT;
134
136
  /** Parse atomically from a string asynchronously */
135
137
  parseText?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;
136
138
  /** Parse atomically from a string synchronously */
137
139
  parseTextSync?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => DataT;
138
- /** Parse batches of data from an iterator, return an iterator that yield parsed batches. */
140
+ /** Parse batches of data from an iterator (e.g. fetch stream), return an iterator that yield parsed batches. */
139
141
  parseInBatches?: (iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>, options?: LoaderOptionsT, context?: LoaderContext) => AsyncIterable<BatchT>;
140
- /** Like `parseInBatches` for loaders that don't integrate with fetch. @deprecated Not officially supported. */
141
- parseFileInBatches?: (file: Blob, options?: LoaderOptionsT, context?: LoaderContext) => AsyncIterable<BatchT>;
142
+ /** For random access, file like sources, source that don't integrate with fetch. */
143
+ parseFileInBatches?: (file: ReadableFile, options?: LoaderOptionsT, context?: LoaderContext) => AsyncIterable<BatchT>;
142
144
  };
143
145
  /**
144
146
  * A Loader context is provided as a third parameters to a loader object's
@@ -1 +1 @@
1
- {"version":3,"file":"loader-types.d.ts","sourceRoot":"","sources":["../src/loader-types.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,SAAS,EACT,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAIjB;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI,CAAC;IACtD,6BAA6B;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAGlC,kDAAkD;IAClD,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAI5B,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,6CAA6C;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,gDAAgD;IAChD,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAIhC,4BAA4B;IAC5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,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEtC;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,aAAa,GAAG,SAAS,EAClC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,OAAO,CAAC,CAAC;AAmBpB;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAE3D,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,aAAa,GACrB,gBAAgB,CAAC,OAAO,CAAC,CAK3B;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAE3D,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,EACnE,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAKlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"loader-types.js","names":["parseFromContext","data","loaders","options","context","_parse","parseSyncFromContext","loader","_parseSync","Error","parseInBatchesFromContext","_parseInBatches"],"sources":["../src/loader-types.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {\n FetchLike,\n TransformBatches /* , DataType, SyncDataType, BatchableDataType */\n} from './types';\n\n// LOADERS\n\n/**\n * Core Loader Options\n */\nexport type LoaderOptions = {\n /** fetch options or a custom fetch function */\n fetch?: typeof fetch | FetchLike | RequestInit | null;\n /** Do not throw on errors */\n nothrow?: boolean;\n\n /** loader selection, search first for supplied mimeType */\n mimeType?: string;\n /** loader selection, provide fallback mimeType is server does not provide */\n fallbackMimeType?: string;\n /** loader selection, avoid searching registered loaders */\n ignoreRegisteredLoaders?: boolean;\n\n // general\n /** Experimental: Supply a logger to the parser */\n log?: any;\n /** Force to load WASM libraries from local file system in NodeJS or from loaders.gl CDN in a web browser */\n useLocalLibraries?: boolean;\n\n // batched parsing\n\n /** Size of each batch. `auto` matches batches to size of incoming chunks */\n batchSize?: number | 'auto';\n /** Minimal amount of time between batches */\n batchDebounceMs?: number;\n /** Stop loading after a given number of rows (compare SQL limit clause) */\n limit?: 0;\n /** Experimental: Stop loading after reaching */\n _limitMB?: 0;\n /** Generate metadata batches */\n metadata?: boolean;\n /** Transforms to run on incoming batches */\n transforms?: TransformBatches[];\n\n // workers\n\n /** CDN load workers from */\n CDN?: string | null;\n /** Set to `false` to disable workers */\n worker?: boolean;\n /** Number of concurrent workers (per loader) on desktop browser */\n maxConcurrency?: number;\n /** Number of concurrent workers (per loader) on mobile browsers */\n maxMobileConcurrency?: number;\n /** Set to `false` to prevent reuse workers */\n reuseWorkers?: boolean;\n /** Whether to use workers under Node.js (experimental) */\n _nodeWorkers?: boolean;\n /** set to 'test' to run local worker */\n _workerType?: string;\n\n /** @deprecated `options.batchType` removed, Use `options.<loader>.type` instead */\n batchType?: 'row' | 'columnar' | 'arrow';\n /** @deprecated `options.throw removed`, Use `options.nothrow` instead */\n throws?: boolean;\n /** @deprecated `options.dataType` no longer used */\n dataType?: never;\n /** @deprecated `options.uri` no longer used */\n uri?: never;\n /** @deprecated Use `options.fetch.method` */\n method?: never;\n /** @deprecated Use `options.fetch.headers` */\n headers?: never;\n /** @deprecated Use `options.fetch.body` */\n body?: never;\n /** @deprecated Use `options.fetch.mode` */\n mode?: never;\n /** @deprecated Use `options.fetch.credentials` */\n credentials?: never;\n /** @deprecated Use `options.fetch.cache` */\n cache?: never;\n /** @deprecated Use `options.fetch.redirect` */\n redirect?: never;\n /** @deprecated Use `options.fetch.referrer` */\n referrer?: never;\n /** @deprecated Use `options.fetch.referrerPolicy` */\n referrerPolicy?: never;\n /** @deprecated Use `options.fetch.integrity` */\n integrity?: never;\n /** @deprecated Use `options.fetch.keepalive` */\n keepalive?: never;\n /** @deprecated Use `options.fetch.signal` */\n signal?: never;\n\n // Accept other keys (loader options objects, e.g. `options.csv`, `options.json` ...)\n [loaderId: string]: unknown;\n};\n\ntype PreloadOptions = {\n [key: string]: unknown;\n};\n\n/**\n * A worker loader definition that can be used with `@loaders.gl/core` functions\n */\nexport type Loader<DataT = any, BatchT = any, LoaderOptionsT = LoaderOptions> = {\n /** The result type of this loader */\n dataType?: DataT;\n /** The batched result type of this loader */\n batchType?: BatchT;\n\n /** Default Options */\n options: LoaderOptionsT;\n /** Deprecated Options */\n deprecatedOptions?: Record<string, string | Record<string, string>>;\n\n /** Human readable name */\n name: string;\n /** id should be the same as the field used in LoaderOptions */\n id: string;\n /** module is used to generate worker threads, need to be the module directory name */\n module: string;\n /** Version should be injected by build tools */\n version: string;\n /** A boolean, or a URL */\n worker?: string | boolean;\n // end Worker\n\n /** Which category does this loader belong to */\n category?: string;\n /** File extensions that are potential matches with this loader. */\n extensions: string[];\n /** MIMETypes that indicate a match with this loader. @note Some MIMETypes are generic and supported by many loaders */\n mimeTypes: string[];\n\n /** Is the input of this loader binary */\n binary?: boolean;\n /** Is the input of this loader text */\n text?: boolean;\n\n /** Test some initial bytes of content to see if this loader might be a match */\n tests?: (((ArrayBuffer: ArrayBuffer) => boolean) | ArrayBuffer | string)[];\n\n /** @deprecated */\n supported?: boolean;\n /** @deprecated */\n testText?: (string: string) => boolean;\n};\n\n/**\n * A \"bundled\" loader definition that can be used with `@loaders.gl/core` functions\n * If a worker loader is supported it will also be supported.\n */\nexport type LoaderWithParser<DataT = any, BatchT = any, LoaderOptionsT = LoaderOptions> = Loader<\n DataT,\n BatchT,\n LoaderOptionsT\n> & {\n /** Perform actions before load. @deprecated Not officially supported. */\n preload?: Preload;\n /** Parse atomically from an arraybuffer asynchronously */\n parse: (\n arrayBuffer: ArrayBuffer,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => Promise<DataT>;\n parseFile?: (file: Blob, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;\n /** Parse atomically from an arraybuffer synchronously */\n parseSync?: (\n arrayBuffer: ArrayBuffer,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => DataT;\n /** Parse atomically from a string asynchronously */\n parseText?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;\n /** Parse atomically from a string synchronously */\n parseTextSync?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => DataT;\n /** Parse batches of data from an iterator, return an iterator that yield parsed batches. */\n parseInBatches?: (\n iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => AsyncIterable<BatchT>;\n /** Like `parseInBatches` for loaders that don't integrate with fetch. @deprecated Not officially supported. */\n parseFileInBatches?: (\n file: Blob,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => AsyncIterable<BatchT>;\n};\n\n/**\n * A Loader context is provided as a third parameters to a loader object's\n * parse functions when that loader is called by other loaders rather then\n * directly by the application.\n *\n * - The context object allows the subloaders to be aware of the parameters and\n * options that the application provided in the top level call.\n * - The context also providedsaccess to parse functions so that the subloader\n * does not need to include the core module.\n * - In addition, the context's parse functions may also redirect loads from worker\n * threads back to main thread.\n */\nexport type LoaderContext = {\n /** Loader list provided to top-level loader call plus any sub loaders */\n loaders?: Loader[] | null;\n /** If URL is available. */\n url?: string;\n /** the file name component of the URL (leading path and query string removed) */\n filename?: string;\n /** the directory name component of the URL (leading path excluding file name and query string) */\n baseUrl?: string;\n /** Query string (characters after `?`) */\n queryString?: string;\n\n /** Provides access to any application overrides of fetch() */\n fetch: typeof fetch | FetchLike;\n\n /** TBD */\n response?: Response;\n\n /**\n * Parse function for subloaders. Avoids importing `core`. In workers, may redirect to main thread\n */\n _parse: (\n arrayBuffer: ArrayBuffer,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => Promise<any>;\n\n /**\n * ParseSync function. Avoids importing `core`. In workers, may redirect to main thread\n * @deprecated Do not call directly, use `parseSyncFromContext` instead\n */\n _parseSync?: (\n arrayBuffer: ArrayBuffer,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => any;\n\n /**\n * ParseInBatches function. Avoids importing `core`.\n * @deprecated Do not call directly, use `parseInBatchesFromContext` instead\n */\n _parseInBatches?: (\n iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer> | Response,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => AsyncIterable<any> | Promise<AsyncIterable<any>>;\n};\n\n// type Parse = (\n// arrayBuffer: ArrayBuffer,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => Promise<any>;\n// type ParseSync = (\n// arrayBuffer: ArrayBuffer,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => any;\n// type ParseText = (text: string, options?: LoaderOptions) => Promise<any>;\n// type ParseTextSync = (text: string, options?: LoaderOptions) => any;\n// type ParseInBatches = (\n// iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => AsyncIterable<any>;\n// type ParseFileInBatches = (\n// file: Blob,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => AsyncIterable<any>;\n\ntype Preload = (url: string, options?: PreloadOptions) => any;\n\n/** Typescript helper to extract options type from a generic loader type */\nexport type LoaderOptionsType<T = Loader> = T extends Loader<any, any, infer Options>\n ? Options\n : never;\n/** Typescript helper to extract data type from a generic loader type */\nexport type LoaderReturnType<T = Loader> = T extends Loader<infer Return, any, any>\n ? Return\n : never;\n/** Typescript helper to extract batch type from a generic loader type */\nexport type LoaderBatchType<T = Loader> = T extends Loader<any, infer Batch, any> ? Batch : never;\n\n/**\n * Parses `data` asynchronously using the supplied loader, parse function provided via the loader context\n */\nexport async function parseFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: ArrayBuffer,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): Promise<LoaderReturnType<LoaderT>>;\n\n/**\n * Parses `data` asynchronously by matching one of the supplied loader\n */\nexport async function parseFromContext(\n data: ArrayBuffer,\n loaders: Loader[],\n options: LoaderOptions | undefined,\n context: LoaderContext\n): Promise<unknown>;\n\n/**\n * Parses `data` using a specified loader\n * @param data\n * @param loaders\n * @param options\n * @param context\n */\n// implementation signature\nexport async function parseFromContext(\n data: ArrayBuffer,\n loaders: Loader | Loader[],\n options: LoaderOptions | undefined,\n context: LoaderContext\n): Promise<unknown> {\n return context._parse(data, loaders, options, context);\n}\n\n/**\n * Parses `data` synchronously using the specified loader, parse function provided via the loader context\n */\nexport function parseSyncFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: ArrayBuffer,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): LoaderReturnType<LoaderT> {\n if (!context._parseSync) {\n throw new Error('parseSync');\n }\n return context._parseSync(data, loader, options, context);\n}\n\n/**\n * Parses `data` synchronously using a specified loader, parse function provided via the loader context\n */\nexport async function parseInBatchesFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: Iterable<ArrayBuffer> | AsyncIterable<ArrayBuffer> | Response,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): Promise<AsyncIterable<LoaderBatchType<LoaderT>>> {\n if (!context._parseInBatches) {\n throw new Error('parseInBatches');\n }\n return context._parseInBatches(data, loader, options, context);\n}\n"],"mappings":"AAoUA,OAAO,eAAeA,gBAAgBA,CACpCC,IAAiB,EACjBC,OAA0B,EAC1BC,OAAkC,EAClCC,OAAsB,EACJ;EAClB,OAAOA,OAAO,CAACC,MAAM,CAACJ,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAEC,OAAO,CAAC;AACxD;AAKA,OAAO,SAASE,oBAAoBA,CAIlCL,IAAiB,EACjBM,MAAe,EACfJ,OAA6B,EAC7BC,OAAsB,EACK;EAC3B,IAAI,CAACA,OAAO,CAACI,UAAU,EAAE;IACvB,MAAM,IAAIC,KAAK,CAAC,WAAW,CAAC;EAC9B;EACA,OAAOL,OAAO,CAACI,UAAU,CAACP,IAAI,EAAEM,MAAM,EAAEJ,OAAO,EAAEC,OAAO,CAAC;AAC3D;AAKA,OAAO,eAAeM,yBAAyBA,CAI7CT,IAAmE,EACnEM,MAAe,EACfJ,OAA6B,EAC7BC,OAAsB,EAC4B;EAClD,IAAI,CAACA,OAAO,CAACO,eAAe,EAAE;IAC5B,MAAM,IAAIF,KAAK,CAAC,gBAAgB,CAAC;EACnC;EACA,OAAOL,OAAO,CAACO,eAAe,CAACV,IAAI,EAAEM,MAAM,EAAEJ,OAAO,EAAEC,OAAO,CAAC;AAChE"}
1
+ {"version":3,"file":"loader-types.js","names":["parseFromContext","data","loaders","options","context","_parse","parseSyncFromContext","loader","_parseSync","Error","parseInBatchesFromContext","_parseInBatches"],"sources":["../src/loader-types.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {\n FetchLike,\n TransformBatches /* , DataType, SyncDataType, BatchableDataType */\n} from './types';\nimport {ReadableFile} from './lib/files/file';\n\n// LOADERS\n\n/**\n * Core Loader Options\n */\nexport type LoaderOptions = {\n /** fetch options or a custom fetch function */\n fetch?: typeof fetch | FetchLike | RequestInit | null;\n /** Do not throw on errors */\n nothrow?: boolean;\n\n /** loader selection, search first for supplied mimeType */\n mimeType?: string;\n /** loader selection, provide fallback mimeType is server does not provide */\n fallbackMimeType?: string;\n /** loader selection, avoid searching registered loaders */\n ignoreRegisteredLoaders?: boolean;\n\n // general\n /** Experimental: Supply a logger to the parser */\n log?: any;\n /** Force to load WASM libraries from local file system in NodeJS or from loaders.gl CDN in a web browser */\n useLocalLibraries?: boolean;\n\n // batched parsing\n\n /** Size of each batch. `auto` matches batches to size of incoming chunks */\n batchSize?: number | 'auto';\n /** Minimal amount of time between batches */\n batchDebounceMs?: number;\n /** Stop loading after a given number of rows (compare SQL limit clause) */\n limit?: 0;\n /** Experimental: Stop loading after reaching */\n _limitMB?: 0;\n /** Generate metadata batches */\n metadata?: boolean;\n /** Transforms to run on incoming batches */\n transforms?: TransformBatches[];\n\n // workers\n\n /** CDN load workers from */\n CDN?: string | null;\n /** Set to `false` to disable workers */\n worker?: boolean;\n /** Number of concurrent workers (per loader) on desktop browser */\n maxConcurrency?: number;\n /** Number of concurrent workers (per loader) on mobile browsers */\n maxMobileConcurrency?: number;\n /** Set to `false` to prevent reuse workers */\n reuseWorkers?: boolean;\n /** Whether to use workers under Node.js (experimental) */\n _nodeWorkers?: boolean;\n /** set to 'test' to run local worker */\n _workerType?: string;\n\n /** @deprecated `options.batchType` removed, Use `options.<loader>.type` instead */\n batchType?: 'row' | 'columnar' | 'arrow';\n /** @deprecated `options.throw removed`, Use `options.nothrow` instead */\n throws?: boolean;\n /** @deprecated `options.dataType` no longer used */\n dataType?: never;\n /** @deprecated `options.uri` no longer used */\n uri?: never;\n /** @deprecated Use `options.fetch.method` */\n method?: never;\n /** @deprecated Use `options.fetch.headers` */\n headers?: never;\n /** @deprecated Use `options.fetch.body` */\n body?: never;\n /** @deprecated Use `options.fetch.mode` */\n mode?: never;\n /** @deprecated Use `options.fetch.credentials` */\n credentials?: never;\n /** @deprecated Use `options.fetch.cache` */\n cache?: never;\n /** @deprecated Use `options.fetch.redirect` */\n redirect?: never;\n /** @deprecated Use `options.fetch.referrer` */\n referrer?: never;\n /** @deprecated Use `options.fetch.referrerPolicy` */\n referrerPolicy?: never;\n /** @deprecated Use `options.fetch.integrity` */\n integrity?: never;\n /** @deprecated Use `options.fetch.keepalive` */\n keepalive?: never;\n /** @deprecated Use `options.fetch.signal` */\n signal?: never;\n\n // Accept other keys (loader options objects, e.g. `options.csv`, `options.json` ...)\n [loaderId: string]: unknown;\n};\n\ntype PreloadOptions = {\n [key: string]: unknown;\n};\n\n/**\n * A worker loader definition that can be used with `@loaders.gl/core` functions\n */\nexport type Loader<DataT = any, BatchT = any, LoaderOptionsT = LoaderOptions> = {\n /** The result type of this loader */\n dataType?: DataT;\n /** The batched result type of this loader */\n batchType?: BatchT;\n\n /** Default Options */\n options: LoaderOptionsT;\n /** Deprecated Options */\n deprecatedOptions?: Record<string, string | Record<string, string>>;\n\n /** Human readable name */\n name: string;\n /** id should be the same as the field used in LoaderOptions */\n id: string;\n /** module is used to generate worker threads, need to be the module directory name */\n module: string;\n /** Version should be injected by build tools */\n version: string;\n /** A boolean, or a URL */\n worker?: string | boolean;\n // end Worker\n\n /** Which category does this loader belong to */\n category?: string;\n /** File extensions that are potential matches with this loader. */\n extensions: string[];\n /** MIMETypes that indicate a match with this loader. @note Some MIMETypes are generic and supported by many loaders */\n mimeTypes: string[];\n\n /** Is the input of this loader binary */\n binary?: boolean;\n /** Is the input of this loader text */\n text?: boolean;\n\n /** Test some initial bytes of content to see if this loader might be a match */\n tests?: (((ArrayBuffer: ArrayBuffer) => boolean) | ArrayBuffer | string)[];\n\n /** @deprecated */\n supported?: boolean;\n /** @deprecated */\n testText?: (string: string) => boolean;\n};\n\n/**\n * A \"bundled\" loader definition that can be used with `@loaders.gl/core` functions\n * If a worker loader is supported it will also be supported.\n */\nexport type LoaderWithParser<DataT = any, BatchT = any, LoaderOptionsT = LoaderOptions> = Loader<\n DataT,\n BatchT,\n LoaderOptionsT\n> & {\n /** Perform actions before load. @deprecated Not officially supported. */\n preload?: Preload;\n /** Parse asynchronously and atomically from an arraybuffer */\n parse: (\n arrayBuffer: ArrayBuffer,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => Promise<DataT>;\n /** Parse asynchronously and atomically from a random access \"file like\" input */\n parseFile?: (\n file: ReadableFile,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => Promise<DataT>;\n /** Parse synchronously and atomically from an arraybuffer */\n parseSync?: (\n arrayBuffer: ArrayBuffer,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => DataT;\n /** Parse atomically from a string asynchronously */\n parseText?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;\n /** Parse atomically from a string synchronously */\n parseTextSync?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => DataT;\n /** Parse batches of data from an iterator (e.g. fetch stream), return an iterator that yield parsed batches. */\n parseInBatches?: (\n iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => AsyncIterable<BatchT>;\n /** For random access, file like sources, source that don't integrate with fetch. */\n parseFileInBatches?: (\n file: ReadableFile,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => AsyncIterable<BatchT>;\n};\n\n/**\n * A Loader context is provided as a third parameters to a loader object's\n * parse functions when that loader is called by other loaders rather then\n * directly by the application.\n *\n * - The context object allows the subloaders to be aware of the parameters and\n * options that the application provided in the top level call.\n * - The context also providedsaccess to parse functions so that the subloader\n * does not need to include the core module.\n * - In addition, the context's parse functions may also redirect loads from worker\n * threads back to main thread.\n */\nexport type LoaderContext = {\n /** Loader list provided to top-level loader call plus any sub loaders */\n loaders?: Loader[] | null;\n /** If URL is available. */\n url?: string;\n /** the file name component of the URL (leading path and query string removed) */\n filename?: string;\n /** the directory name component of the URL (leading path excluding file name and query string) */\n baseUrl?: string;\n /** Query string (characters after `?`) */\n queryString?: string;\n\n /** Provides access to any application overrides of fetch() */\n fetch: typeof fetch | FetchLike;\n\n /** TBD */\n response?: Response;\n\n /**\n * Parse function for subloaders. Avoids importing `core`. In workers, may redirect to main thread\n */\n _parse: (\n arrayBuffer: ArrayBuffer,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => Promise<any>;\n\n /**\n * ParseSync function. Avoids importing `core`. In workers, may redirect to main thread\n * @deprecated Do not call directly, use `parseSyncFromContext` instead\n */\n _parseSync?: (\n arrayBuffer: ArrayBuffer,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => any;\n\n /**\n * ParseInBatches function. Avoids importing `core`.\n * @deprecated Do not call directly, use `parseInBatchesFromContext` instead\n */\n _parseInBatches?: (\n iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer> | Response,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => AsyncIterable<any> | Promise<AsyncIterable<any>>;\n};\n\n// type Parse = (\n// arrayBuffer: ArrayBuffer,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => Promise<any>;\n// type ParseSync = (\n// arrayBuffer: ArrayBuffer,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => any;\n// type ParseText = (text: string, options?: LoaderOptions) => Promise<any>;\n// type ParseTextSync = (text: string, options?: LoaderOptions) => any;\n// type ParseInBatches = (\n// iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => AsyncIterable<any>;\n// type ParseFileInBatches = (\n// file: Blob,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => AsyncIterable<any>;\n\ntype Preload = (url: string, options?: PreloadOptions) => any;\n\n/** Typescript helper to extract options type from a generic loader type */\nexport type LoaderOptionsType<T = Loader> = T extends Loader<any, any, infer Options>\n ? Options\n : never;\n/** Typescript helper to extract data type from a generic loader type */\nexport type LoaderReturnType<T = Loader> = T extends Loader<infer Return, any, any>\n ? Return\n : never;\n/** Typescript helper to extract batch type from a generic loader type */\nexport type LoaderBatchType<T = Loader> = T extends Loader<any, infer Batch, any> ? Batch : never;\n\n/**\n * Parses `data` asynchronously using the supplied loader, parse function provided via the loader context\n */\nexport async function parseFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: ArrayBuffer,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): Promise<LoaderReturnType<LoaderT>>;\n\n/**\n * Parses `data` asynchronously by matching one of the supplied loader\n */\nexport async function parseFromContext(\n data: ArrayBuffer,\n loaders: Loader[],\n options: LoaderOptions | undefined,\n context: LoaderContext\n): Promise<unknown>;\n\n/**\n * Parses `data` using a specified loader\n * @param data\n * @param loaders\n * @param options\n * @param context\n */\n// implementation signature\nexport async function parseFromContext(\n data: ArrayBuffer,\n loaders: Loader | Loader[],\n options: LoaderOptions | undefined,\n context: LoaderContext\n): Promise<unknown> {\n return context._parse(data, loaders, options, context);\n}\n\n/**\n * Parses `data` synchronously using the specified loader, parse function provided via the loader context\n */\nexport function parseSyncFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: ArrayBuffer,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): LoaderReturnType<LoaderT> {\n if (!context._parseSync) {\n throw new Error('parseSync');\n }\n return context._parseSync(data, loader, options, context);\n}\n\n/**\n * Parses `data` synchronously using a specified loader, parse function provided via the loader context\n */\nexport async function parseInBatchesFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: Iterable<ArrayBuffer> | AsyncIterable<ArrayBuffer> | Response,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): Promise<AsyncIterable<LoaderBatchType<LoaderT>>> {\n if (!context._parseInBatches) {\n throw new Error('parseInBatches');\n }\n return context._parseInBatches(data, loader, options, context);\n}\n"],"mappings":"AA0UA,OAAO,eAAeA,gBAAgBA,CACpCC,IAAiB,EACjBC,OAA0B,EAC1BC,OAAkC,EAClCC,OAAsB,EACJ;EAClB,OAAOA,OAAO,CAACC,MAAM,CAACJ,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAEC,OAAO,CAAC;AACxD;AAKA,OAAO,SAASE,oBAAoBA,CAIlCL,IAAiB,EACjBM,MAAe,EACfJ,OAA6B,EAC7BC,OAAsB,EACK;EAC3B,IAAI,CAACA,OAAO,CAACI,UAAU,EAAE;IACvB,MAAM,IAAIC,KAAK,CAAC,WAAW,CAAC;EAC9B;EACA,OAAOL,OAAO,CAACI,UAAU,CAACP,IAAI,EAAEM,MAAM,EAAEJ,OAAO,EAAEC,OAAO,CAAC;AAC3D;AAKA,OAAO,eAAeM,yBAAyBA,CAI7CT,IAAmE,EACnEM,MAAe,EACfJ,OAA6B,EAC7BC,OAAsB,EAC4B;EAClD,IAAI,CAACA,OAAO,CAACO,eAAe,EAAE;IAC5B,MAAM,IAAIF,KAAK,CAAC,gBAAgB,CAAC;EACnC;EACA,OAAOL,OAAO,CAACO,eAAe,CAACV,IAAI,EAAEM,MAAM,EAAEJ,OAAO,EAAEC,OAAO,CAAC;AAChE"}
@@ -11,17 +11,37 @@ export type WriterOptions = {
11
11
  * A writer definition that can be used with `@loaders.gl/core` functions
12
12
  */
13
13
  export type Writer<DataT = unknown, BatchT = unknown, WriterOptionsT = WriterOptions> = {
14
+ /** The result type of this loader */
15
+ dataType?: DataT;
16
+ /** The batched result type of this loader */
17
+ batchType?: BatchT;
18
+ /** Human readable name */
14
19
  name: string;
20
+ /** id should be the same as the field used in LoaderOptions */
15
21
  id: string;
22
+ /** module is used to generate worker threads, need to be the module directory name */
16
23
  module: string;
24
+ /** Version should be injected by build tools */
17
25
  version: string;
26
+ /** A boolean, or a URL */
18
27
  worker?: string | boolean;
19
- extensions?: string[];
28
+ /** Which category does this loader belong to */
29
+ category?: string;
30
+ /** File extensions that are potential matches with this loader. */
31
+ extensions: string[];
32
+ /** MIMETypes that indicate a match with this loader. @note Some MIMETypes are generic and supported by many loaders */
20
33
  mimeTypes?: string[];
34
+ /** Is the input of this loader binary */
21
35
  binary?: boolean;
36
+ /** Is the input of this loader text */
22
37
  text?: boolean;
23
38
  options: WriterOptionsT;
24
39
  deprecatedOptions?: Record<string, string>;
40
+ };
41
+ /**
42
+ * A writer definition that can be used with `@loaders.gl/core` functions
43
+ */
44
+ export type WriterWithEncoder<DataT = unknown, BatchT = unknown, WriterOptionsT = WriterOptions> = Writer<DataT, BatchT, WriterOptionsT> & {
25
45
  encode?(data: DataT, options?: WriterOptionsT): Promise<ArrayBuffer>;
26
46
  encodeSync?(data: DataT, options?: WriterOptionsT): ArrayBuffer;
27
47
  encodeText?(table: DataT, options?: WriterOptionsT): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"writer-types.d.ts","sourceRoot":"","sources":["../src/writer-types.ts"],"names":[],"mappings":"AAKA,0BAA0B;AAC1B,MAAM,MAAM,aAAa,GAAG;IAC1B,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,8BAA8B;IAC9B,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC;CACzB,CAAC;AAEF;;GAEG;AAEH,MAAM,MAAM,MAAM,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,cAAc,GAAG,aAAa,IAAI;IACtF,IAAI,EAAE,MAAM,CAAC;IAEb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAG1B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE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G,WAAW,CAAC;IAEhE,UAAU,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrE,cAAc,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IAEhE,eAAe,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;IAEjG,cAAc,CAAC,EAAE,CACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,cAAc,KACrB,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB,CAAC;AAEF,sFAAsF;AACtF,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,GACzF,OAAO,GACP,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"writer-types.js","names":[],"sources":["../src/writer-types.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n// WRITERS\n\n/** Options for writers */\nexport type WriterOptions = {\n /** worker source. If is set will be used instead of loading worker from the Internet */\n source?: string | null;\n /** Force to load WASM libraries from local file system in NodeJS or from loaders.gl CDN in a web browser */\n useLocalLibraries?: boolean;\n /** writer-specific options */\n [writerId: string]: any;\n};\n\n/**\n * A writer definition that can be used with `@loaders.gl/core` functions\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type Writer<DataT = unknown, BatchT = unknown, WriterOptionsT = WriterOptions> = {\n name: string;\n\n id: string;\n module: string;\n version: string;\n worker?: string | boolean;\n\n // TODO - are these are needed?\n extensions?: string[];\n mimeTypes?: string[];\n binary?: boolean;\n text?: boolean;\n\n options: WriterOptionsT;\n deprecatedOptions?: Record<string, string>;\n\n // encodeText?: EncodeText;\n // encode?: Encode;\n encode?(data: DataT, options?: WriterOptionsT): Promise<ArrayBuffer>;\n encodeSync?(data: DataT, options?: WriterOptionsT): ArrayBuffer;\n\n encodeText?(table: DataT, options?: WriterOptionsT): Promise<string>;\n encodeTextSync?(table: DataT, options?: WriterOptionsT): string;\n\n encodeInBatches?(data: AsyncIterable<any>, options?: WriterOptionsT): AsyncIterable<ArrayBuffer>;\n\n encodeURLtoURL?: (\n inputUrl: string,\n outputUrl: string,\n options?: WriterOptionsT\n ) => Promise<string>;\n};\n\n/** Typescript helper to extract the writer options type from a generic writer type */\nexport type WriterOptionsType<T = Writer> = T extends Writer<unknown, unknown, infer Options>\n ? Options\n : never;\n"],"mappings":""}
1
+ {"version":3,"file":"writer-types.js","names":[],"sources":["../src/writer-types.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n// WRITERS\n\n/** Options for writers */\nexport type WriterOptions = {\n /** worker source. If is set will be used instead of loading worker from the Internet */\n source?: string | null;\n /** Force to load WASM libraries from local file system in NodeJS or from loaders.gl CDN in a web browser */\n useLocalLibraries?: boolean;\n /** writer-specific options */\n [writerId: string]: any;\n};\n\n/**\n * A writer definition that can be used with `@loaders.gl/core` functions\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type Writer<DataT = unknown, BatchT = unknown, WriterOptionsT = WriterOptions> = {\n /** The result type of this loader */\n dataType?: DataT;\n /** The batched result type of this loader */\n batchType?: BatchT;\n\n /** Human readable name */\n name: string;\n /** id should be the same as the field used in LoaderOptions */\n id: string;\n /** module is used to generate worker threads, need to be the module directory name */\n module: string;\n /** Version should be injected by build tools */\n version: string;\n /** A boolean, or a URL */\n worker?: string | boolean;\n // end Worker\n\n /** Which category does this loader belong to */\n category?: string;\n /** File extensions that are potential matches with this loader. */\n extensions: string[];\n /** MIMETypes that indicate a match with this loader. @note Some MIMETypes are generic and supported by many loaders */\n mimeTypes?: string[];\n\n /** Is the input of this loader binary */\n binary?: boolean;\n /** Is the input of this loader text */\n text?: boolean;\n\n options: WriterOptionsT;\n deprecatedOptions?: Record<string, string>;\n};\n\n/**\n * A writer definition that can be used with `@loaders.gl/core` functions\n */\nexport type WriterWithEncoder<\n DataT = unknown,\n BatchT = unknown,\n WriterOptionsT = WriterOptions\n> = Writer<DataT, BatchT, WriterOptionsT> & {\n encode?(data: DataT, options?: WriterOptionsT): Promise<ArrayBuffer>;\n encodeSync?(data: DataT, options?: WriterOptionsT): ArrayBuffer;\n\n encodeText?(table: DataT, options?: WriterOptionsT): Promise<string>;\n encodeTextSync?(table: DataT, options?: WriterOptionsT): string;\n\n encodeInBatches?(data: AsyncIterable<any>, options?: WriterOptionsT): AsyncIterable<ArrayBuffer>;\n\n encodeURLtoURL?: (\n inputUrl: string,\n outputUrl: string,\n options?: WriterOptionsT\n ) => Promise<string>;\n};\n\n/** Typescript helper to extract the writer options type from a generic writer type */\nexport type WriterOptionsType<T = Writer> = T extends Writer<unknown, unknown, infer Options>\n ? Options\n : never;\n"],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/loader-utils",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "Framework-independent loaders for 3D graphics formats",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,8 +47,8 @@
47
47
  "scripts": {},
48
48
  "dependencies": {
49
49
  "@babel/runtime": "^7.3.1",
50
- "@loaders.gl/worker-utils": "4.0.1",
50
+ "@loaders.gl/worker-utils": "4.0.3",
51
51
  "@probe.gl/stats": "^4.0.2"
52
52
  },
53
- "gitHead": "765e5a26a6bf3f2cc02cabffc4a1e3665ec92a53"
53
+ "gitHead": "03c871839b36c997249dabae1844df53a35d3760"
54
54
  }
package/src/index.ts CHANGED
@@ -35,7 +35,7 @@ export {parseFromContext, parseSyncFromContext, parseInBatchesFromContext} from
35
35
 
36
36
  // writers
37
37
 
38
- export type {Writer, WriterOptions, WriterOptionsType} from './writer-types';
38
+ export type {Writer, WriterWithEncoder, WriterOptions, WriterOptionsType} from './writer-types';
39
39
 
40
40
  // GENERAL UTILS
41
41
  export {assert} from './lib/env-utils/assert';
@@ -3,6 +3,9 @@
3
3
 
4
4
  import {ReadableFile} from './file';
5
5
 
6
+ /**
7
+ * BlobFile provides a "file like interface" to the data in a Blob or File object
8
+ */
6
9
  export class BlobFile implements ReadableFile {
7
10
  readonly handle: Blob;
8
11
  readonly size: number;
@@ -30,6 +30,7 @@ export function toBuffer(binaryData: ArrayBuffer | Buffer): Buffer {
30
30
  binaryData = binaryData.buffer;
31
31
  }
32
32
 
33
+ // TODO - move to loaders.gl/polyfills
33
34
  if (typeof Buffer !== 'undefined' && binaryData instanceof ArrayBuffer) {
34
35
  return Buffer.from(binaryData);
35
36
  }
@@ -9,9 +9,9 @@ let requestId = 0;
9
9
  * Set up a WebWorkerGlobalScope to talk with the main thread
10
10
  * @param loader
11
11
  */
12
- export function createLoaderWorker(loader: LoaderWithParser) {
12
+ export async function createLoaderWorker(loader: LoaderWithParser) {
13
13
  // Check that we are actually in a worker thread
14
- if (!WorkerBody.inWorkerThread()) {
14
+ if (!(await WorkerBody.inWorkerThread())) {
15
15
  return;
16
16
  }
17
17
 
@@ -5,6 +5,7 @@ import {
5
5
  FetchLike,
6
6
  TransformBatches /* , DataType, SyncDataType, BatchableDataType */
7
7
  } from './types';
8
+ import {ReadableFile} from './lib/files/file';
8
9
 
9
10
  // LOADERS
10
11
 
@@ -161,14 +162,19 @@ export type LoaderWithParser<DataT = any, BatchT = any, LoaderOptionsT = LoaderO
161
162
  > & {
162
163
  /** Perform actions before load. @deprecated Not officially supported. */
163
164
  preload?: Preload;
164
- /** Parse atomically from an arraybuffer asynchronously */
165
+ /** Parse asynchronously and atomically from an arraybuffer */
165
166
  parse: (
166
167
  arrayBuffer: ArrayBuffer,
167
168
  options?: LoaderOptionsT,
168
169
  context?: LoaderContext
169
170
  ) => Promise<DataT>;
170
- parseFile?: (file: Blob, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;
171
- /** Parse atomically from an arraybuffer synchronously */
171
+ /** Parse asynchronously and atomically from a random access "file like" input */
172
+ parseFile?: (
173
+ file: ReadableFile,
174
+ options?: LoaderOptionsT,
175
+ context?: LoaderContext
176
+ ) => Promise<DataT>;
177
+ /** Parse synchronously and atomically from an arraybuffer */
172
178
  parseSync?: (
173
179
  arrayBuffer: ArrayBuffer,
174
180
  options?: LoaderOptionsT,
@@ -178,15 +184,15 @@ export type LoaderWithParser<DataT = any, BatchT = any, LoaderOptionsT = LoaderO
178
184
  parseText?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;
179
185
  /** Parse atomically from a string synchronously */
180
186
  parseTextSync?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => DataT;
181
- /** Parse batches of data from an iterator, return an iterator that yield parsed batches. */
187
+ /** Parse batches of data from an iterator (e.g. fetch stream), return an iterator that yield parsed batches. */
182
188
  parseInBatches?: (
183
189
  iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,
184
190
  options?: LoaderOptionsT,
185
191
  context?: LoaderContext
186
192
  ) => AsyncIterable<BatchT>;
187
- /** Like `parseInBatches` for loaders that don't integrate with fetch. @deprecated Not officially supported. */
193
+ /** For random access, file like sources, source that don't integrate with fetch. */
188
194
  parseFileInBatches?: (
189
- file: Blob,
195
+ file: ReadableFile,
190
196
  options?: LoaderOptionsT,
191
197
  context?: LoaderContext
192
198
  ) => AsyncIterable<BatchT>;
@@ -18,24 +18,47 @@ export type WriterOptions = {
18
18
  */
19
19
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
20
20
  export type Writer<DataT = unknown, BatchT = unknown, WriterOptionsT = WriterOptions> = {
21
- name: string;
21
+ /** The result type of this loader */
22
+ dataType?: DataT;
23
+ /** The batched result type of this loader */
24
+ batchType?: BatchT;
22
25
 
26
+ /** Human readable name */
27
+ name: string;
28
+ /** id should be the same as the field used in LoaderOptions */
23
29
  id: string;
30
+ /** module is used to generate worker threads, need to be the module directory name */
24
31
  module: string;
32
+ /** Version should be injected by build tools */
25
33
  version: string;
34
+ /** A boolean, or a URL */
26
35
  worker?: string | boolean;
36
+ // end Worker
27
37
 
28
- // TODO - are these are needed?
29
- extensions?: string[];
38
+ /** Which category does this loader belong to */
39
+ category?: string;
40
+ /** File extensions that are potential matches with this loader. */
41
+ extensions: string[];
42
+ /** MIMETypes that indicate a match with this loader. @note Some MIMETypes are generic and supported by many loaders */
30
43
  mimeTypes?: string[];
44
+
45
+ /** Is the input of this loader binary */
31
46
  binary?: boolean;
47
+ /** Is the input of this loader text */
32
48
  text?: boolean;
33
49
 
34
50
  options: WriterOptionsT;
35
51
  deprecatedOptions?: Record<string, string>;
52
+ };
36
53
 
37
- // encodeText?: EncodeText;
38
- // encode?: Encode;
54
+ /**
55
+ * A writer definition that can be used with `@loaders.gl/core` functions
56
+ */
57
+ export type WriterWithEncoder<
58
+ DataT = unknown,
59
+ BatchT = unknown,
60
+ WriterOptionsT = WriterOptions
61
+ > = Writer<DataT, BatchT, WriterOptionsT> & {
39
62
  encode?(data: DataT, options?: WriterOptionsT): Promise<ArrayBuffer>;
40
63
  encodeSync?(data: DataT, options?: WriterOptionsT): ArrayBuffer;
41
64