@loaders.gl/loader-utils 4.0.0-beta.2 → 4.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1252 -0
- package/dist/index.d.ts +7 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/{esm/json-loader.js → json-loader.js} +1 -1
- package/dist/json-loader.js.map +1 -0
- package/dist/lib/binary-utils/array-buffer-utils.js.map +1 -0
- package/dist/{esm/lib → lib}/binary-utils/dataview-copy-utils.js +1 -1
- package/dist/lib/binary-utils/dataview-copy-utils.js.map +1 -0
- package/dist/lib/binary-utils/get-first-characters.js.map +1 -0
- package/dist/{esm/lib → lib}/binary-utils/memory-conversion-utils.js +1 -1
- package/dist/lib/binary-utils/memory-conversion-utils.js.map +1 -0
- package/dist/{esm/lib → lib}/binary-utils/memory-copy-utils.js +1 -1
- package/dist/lib/binary-utils/memory-copy-utils.js.map +1 -0
- package/dist/lib/env-utils/assert.js.map +1 -0
- package/dist/lib/env-utils/globals.js.map +1 -0
- package/dist/lib/file-provider/data-view-file.d.ts +4 -1
- package/dist/lib/file-provider/data-view-file.d.ts.map +1 -1
- package/dist/{esm/lib → lib}/file-provider/data-view-file.js +1 -2
- package/dist/lib/file-provider/data-view-file.js.map +1 -0
- package/dist/lib/file-provider/file-handle-file.d.ts +12 -19
- package/dist/lib/file-provider/file-handle-file.d.ts.map +1 -1
- package/dist/lib/file-provider/file-handle-file.js +56 -0
- package/dist/lib/file-provider/file-handle-file.js.map +1 -0
- package/dist/lib/file-provider/file-provider.d.ts +1 -0
- package/dist/lib/file-provider/file-provider.d.ts.map +1 -1
- package/dist/lib/file-provider/file-provider.js.map +1 -0
- package/dist/lib/files/blob-file.d.ts +16 -0
- package/dist/lib/files/blob-file.d.ts.map +1 -0
- package/dist/lib/files/blob-file.js +25 -0
- package/dist/lib/files/blob-file.js.map +1 -0
- package/dist/lib/files/file.d.ts +33 -0
- package/dist/lib/files/file.d.ts.map +1 -0
- package/dist/lib/files/file.js +2 -0
- package/dist/lib/files/file.js.map +1 -0
- package/dist/lib/files/http-file.d.ts +21 -0
- package/dist/lib/files/http-file.d.ts.map +1 -0
- package/dist/lib/files/http-file.js +79 -0
- package/dist/lib/files/http-file.js.map +1 -0
- package/dist/lib/files/node-file-facade.d.ts +18 -0
- package/dist/lib/files/node-file-facade.d.ts.map +1 -0
- package/dist/lib/files/node-file-facade.js +29 -0
- package/dist/lib/files/node-file-facade.js.map +1 -0
- package/dist/lib/files/sources.d.ts +1 -0
- package/dist/lib/files/sources.d.ts.map +1 -0
- package/dist/lib/files/sources.js +2 -0
- package/dist/lib/files/sources.js.map +1 -0
- package/dist/lib/filesystems/filesystem.d.ts +18 -65
- package/dist/lib/filesystems/filesystem.d.ts.map +1 -1
- package/dist/lib/filesystems/filesystem.js.map +1 -0
- package/dist/lib/filesystems/node-filesystem-facade.d.ts +23 -0
- package/dist/lib/filesystems/node-filesystem-facade.d.ts.map +1 -0
- package/dist/lib/filesystems/node-filesystem-facade.js +37 -0
- package/dist/lib/filesystems/node-filesystem-facade.js.map +1 -0
- package/dist/{esm/lib → lib}/iterators/async-iteration.js +1 -1
- package/dist/lib/iterators/async-iteration.js.map +1 -0
- package/dist/lib/iterators/text-iterators.js.map +1 -0
- package/dist/lib/node/buffer.browser.d.ts +1 -1
- package/dist/lib/node/buffer.browser.d.ts.map +1 -1
- package/dist/lib/node/buffer.browser.js.map +1 -0
- package/dist/lib/node/buffer.d.ts +1 -1
- package/dist/lib/node/buffer.d.ts.map +1 -1
- package/dist/lib/node/buffer.js.map +1 -0
- package/dist/lib/node/fs.browser.js.map +1 -0
- package/dist/lib/node/promisify.js.map +1 -0
- package/dist/lib/node/stream.browser.js.map +1 -0
- package/dist/lib/node/stream.js.map +1 -0
- package/dist/lib/option-utils/merge-loader-options.js.map +1 -0
- package/dist/lib/parser-utils/parse-json.js +9 -0
- package/dist/lib/parser-utils/parse-json.js.map +1 -0
- package/dist/{esm/lib → lib}/path-utils/file-aliases.js +1 -1
- package/dist/lib/path-utils/file-aliases.js.map +1 -0
- package/dist/lib/path-utils/get-cwd.js.map +1 -0
- package/dist/{esm/lib → lib}/path-utils/path.js +6 -6
- package/dist/lib/path-utils/path.js.map +1 -0
- package/dist/{esm/lib → lib}/request-utils/request-scheduler.js +6 -7
- package/dist/lib/request-utils/request-scheduler.js.map +1 -0
- package/dist/{esm/lib → lib}/sources/data-source.js +4 -5
- package/dist/lib/sources/data-source.js.map +1 -0
- package/dist/lib/sources/image-source.js +5 -0
- package/dist/lib/sources/image-source.js.map +1 -0
- package/dist/lib/sources/image-tile-source.js.map +1 -0
- package/dist/lib/sources/tile-source.js.map +1 -0
- package/dist/lib/sources/utils/image-type.js.map +1 -0
- package/dist/lib/sources/utils/utils.js.map +1 -0
- package/dist/lib/sources/vector-tile-source.js.map +1 -0
- package/dist/{esm/lib → lib}/worker-loader-utils/create-loader-worker.js +1 -1
- package/dist/lib/worker-loader-utils/create-loader-worker.js.map +1 -0
- package/dist/{esm/lib → lib}/worker-loader-utils/encode-with-worker.js +1 -1
- package/dist/lib/worker-loader-utils/encode-with-worker.js.map +1 -0
- package/dist/{esm/lib → lib}/worker-loader-utils/parse-with-worker.js +1 -1
- package/dist/lib/worker-loader-utils/parse-with-worker.js.map +1 -0
- package/dist/loader-types.js.map +1 -0
- package/dist/service-types.js.map +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -0
- package/dist/workers/json-worker.js +4 -0
- package/dist/workers/json-worker.js.map +1 -0
- package/dist/writer-types.js.map +1 -0
- package/package.json +13 -5
- package/src/index.ts +10 -15
- package/src/lib/file-provider/data-view-file.ts +4 -2
- package/src/lib/file-provider/file-handle-file.ts +28 -44
- package/src/lib/file-provider/file-provider.ts +1 -0
- package/src/lib/files/blob-file.ts +32 -0
- package/src/lib/files/file.ts +37 -0
- package/src/lib/files/http-file.ts +120 -0
- package/src/lib/files/node-file-facade.ts +39 -0
- package/src/lib/files/sources.ts +150 -0
- package/src/lib/filesystems/filesystem.ts +19 -68
- package/src/lib/filesystems/node-filesystem-facade.ts +63 -0
- package/src/lib/node/buffer.browser.ts +1 -1
- package/src/lib/node/buffer.ts +1 -1
- package/src/types.ts +0 -4
- package/dist/es5/index.js +0 -389
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/json-loader.js +0 -44
- package/dist/es5/json-loader.js.map +0 -1
- package/dist/es5/lib/binary-utils/array-buffer-utils.js +0 -80
- package/dist/es5/lib/binary-utils/array-buffer-utils.js.map +0 -1
- package/dist/es5/lib/binary-utils/dataview-copy-utils.js +0 -58
- package/dist/es5/lib/binary-utils/dataview-copy-utils.js.map +0 -1
- package/dist/es5/lib/binary-utils/get-first-characters.js +0 -31
- package/dist/es5/lib/binary-utils/get-first-characters.js.map +0 -1
- package/dist/es5/lib/binary-utils/memory-conversion-utils.js +0 -44
- package/dist/es5/lib/binary-utils/memory-conversion-utils.js.map +0 -1
- package/dist/es5/lib/binary-utils/memory-copy-utils.js +0 -34
- package/dist/es5/lib/binary-utils/memory-copy-utils.js.map +0 -1
- package/dist/es5/lib/env-utils/assert.js +0 -12
- package/dist/es5/lib/env-utils/assert.js.map +0 -1
- package/dist/es5/lib/env-utils/globals.js +0 -30
- package/dist/es5/lib/env-utils/globals.js.map +0 -1
- package/dist/es5/lib/file-provider/data-view-file.js +0 -146
- package/dist/es5/lib/file-provider/data-view-file.js.map +0 -1
- package/dist/es5/lib/file-provider/file-handle-file.js +0 -236
- package/dist/es5/lib/file-provider/file-handle-file.js.map +0 -1
- package/dist/es5/lib/file-provider/file-handle.js +0 -98
- package/dist/es5/lib/file-provider/file-handle.js.map +0 -1
- package/dist/es5/lib/file-provider/file-provider.js +0 -11
- package/dist/es5/lib/file-provider/file-provider.js.map +0 -1
- package/dist/es5/lib/filesystems/filesystem.js +0 -2
- package/dist/es5/lib/filesystems/filesystem.js.map +0 -1
- package/dist/es5/lib/filesystems/node-filesystem.js +0 -176
- package/dist/es5/lib/filesystems/node-filesystem.js.map +0 -1
- package/dist/es5/lib/filesystems/readable-file.js +0 -91
- package/dist/es5/lib/filesystems/readable-file.js.map +0 -1
- package/dist/es5/lib/filesystems/writable-file.js +0 -82
- package/dist/es5/lib/filesystems/writable-file.js.map +0 -1
- package/dist/es5/lib/iterators/async-iteration.js +0 -190
- package/dist/es5/lib/iterators/async-iteration.js.map +0 -1
- package/dist/es5/lib/iterators/text-iterators.js +0 -305
- package/dist/es5/lib/iterators/text-iterators.js.map +0 -1
- package/dist/es5/lib/node/buffer.browser.js +0 -14
- package/dist/es5/lib/node/buffer.browser.js.map +0 -1
- package/dist/es5/lib/node/buffer.js +0 -27
- package/dist/es5/lib/node/buffer.js.map +0 -1
- package/dist/es5/lib/node/fs.browser.js +0 -9
- package/dist/es5/lib/node/fs.browser.js.map +0 -1
- package/dist/es5/lib/node/fs.js +0 -82
- package/dist/es5/lib/node/fs.js.map +0 -1
- package/dist/es5/lib/node/promisify.js +0 -36
- package/dist/es5/lib/node/promisify.js.map +0 -1
- package/dist/es5/lib/node/stream.browser.js +0 -9
- package/dist/es5/lib/node/stream.browser.js.map +0 -1
- package/dist/es5/lib/node/stream.js +0 -15
- package/dist/es5/lib/node/stream.js.map +0 -1
- package/dist/es5/lib/option-utils/merge-loader-options.js +0 -30
- package/dist/es5/lib/option-utils/merge-loader-options.js.map +0 -1
- package/dist/es5/lib/parser-utils/parse-json.js +0 -15
- package/dist/es5/lib/parser-utils/parse-json.js.map +0 -1
- package/dist/es5/lib/path-utils/file-aliases.js +0 -33
- package/dist/es5/lib/path-utils/file-aliases.js.map +0 -1
- package/dist/es5/lib/path-utils/get-cwd.js +0 -15
- package/dist/es5/lib/path-utils/get-cwd.js.map +0 -1
- package/dist/es5/lib/path-utils/path.js +0 -136
- package/dist/es5/lib/path-utils/path.js.map +0 -1
- package/dist/es5/lib/request-utils/request-scheduler.js +0 -150
- package/dist/es5/lib/request-utils/request-scheduler.js.map +0 -1
- package/dist/es5/lib/sources/data-source.js +0 -67
- package/dist/es5/lib/sources/data-source.js.map +0 -1
- package/dist/es5/lib/sources/image-source.js +0 -31
- package/dist/es5/lib/sources/image-source.js.map +0 -1
- package/dist/es5/lib/sources/image-tile-source.js +0 -2
- package/dist/es5/lib/sources/image-tile-source.js.map +0 -1
- package/dist/es5/lib/sources/tile-source.js +0 -2
- package/dist/es5/lib/sources/tile-source.js.map +0 -1
- package/dist/es5/lib/sources/utils/image-type.js +0 -2
- package/dist/es5/lib/sources/utils/image-type.js.map +0 -1
- package/dist/es5/lib/sources/utils/utils.js +0 -36
- package/dist/es5/lib/sources/utils/utils.js.map +0 -1
- package/dist/es5/lib/sources/vector-tile-source.js +0 -2
- package/dist/es5/lib/sources/vector-tile-source.js.map +0 -1
- package/dist/es5/lib/worker-loader-utils/create-loader-worker.js +0 -142
- package/dist/es5/lib/worker-loader-utils/create-loader-worker.js.map +0 -1
- package/dist/es5/lib/worker-loader-utils/encode-with-worker.js +0 -18
- package/dist/es5/lib/worker-loader-utils/encode-with-worker.js.map +0 -1
- package/dist/es5/lib/worker-loader-utils/parse-with-worker.js +0 -115
- package/dist/es5/lib/worker-loader-utils/parse-with-worker.js.map +0 -1
- package/dist/es5/loader-types.js +0 -58
- package/dist/es5/loader-types.js.map +0 -1
- package/dist/es5/service-types.js +0 -2
- package/dist/es5/service-types.js.map +0 -1
- package/dist/es5/types.js +0 -2
- package/dist/es5/types.js.map +0 -1
- package/dist/es5/workers/json-worker.js +0 -6
- package/dist/es5/workers/json-worker.js.map +0 -1
- package/dist/es5/writer-types.js +0 -2
- package/dist/es5/writer-types.js.map +0 -1
- package/dist/esm/index.js +0 -36
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/json-loader.js.map +0 -1
- package/dist/esm/lib/binary-utils/array-buffer-utils.js.map +0 -1
- package/dist/esm/lib/binary-utils/dataview-copy-utils.js.map +0 -1
- package/dist/esm/lib/binary-utils/get-first-characters.js.map +0 -1
- package/dist/esm/lib/binary-utils/memory-conversion-utils.js.map +0 -1
- package/dist/esm/lib/binary-utils/memory-copy-utils.js.map +0 -1
- package/dist/esm/lib/env-utils/assert.js.map +0 -1
- package/dist/esm/lib/env-utils/globals.js.map +0 -1
- package/dist/esm/lib/file-provider/data-view-file.js.map +0 -1
- package/dist/esm/lib/file-provider/file-handle-file.js +0 -59
- package/dist/esm/lib/file-provider/file-handle-file.js.map +0 -1
- package/dist/esm/lib/file-provider/file-handle.js +0 -33
- package/dist/esm/lib/file-provider/file-handle.js.map +0 -1
- package/dist/esm/lib/file-provider/file-provider.js.map +0 -1
- package/dist/esm/lib/filesystems/filesystem.js.map +0 -1
- package/dist/esm/lib/filesystems/node-filesystem.js +0 -46
- package/dist/esm/lib/filesystems/node-filesystem.js.map +0 -1
- package/dist/esm/lib/filesystems/readable-file.js +0 -20
- package/dist/esm/lib/filesystems/readable-file.js.map +0 -1
- package/dist/esm/lib/filesystems/writable-file.js +0 -20
- package/dist/esm/lib/filesystems/writable-file.js.map +0 -1
- package/dist/esm/lib/iterators/async-iteration.js.map +0 -1
- package/dist/esm/lib/iterators/text-iterators.js.map +0 -1
- package/dist/esm/lib/node/buffer.browser.js.map +0 -1
- package/dist/esm/lib/node/buffer.js.map +0 -1
- package/dist/esm/lib/node/fs.browser.js.map +0 -1
- package/dist/esm/lib/node/fs.js +0 -29
- package/dist/esm/lib/node/fs.js.map +0 -1
- package/dist/esm/lib/node/promisify.js.map +0 -1
- package/dist/esm/lib/node/stream.browser.js.map +0 -1
- package/dist/esm/lib/node/stream.js.map +0 -1
- package/dist/esm/lib/option-utils/merge-loader-options.js.map +0 -1
- package/dist/esm/lib/parser-utils/parse-json.js +0 -9
- package/dist/esm/lib/parser-utils/parse-json.js.map +0 -1
- package/dist/esm/lib/path-utils/file-aliases.js.map +0 -1
- package/dist/esm/lib/path-utils/get-cwd.js.map +0 -1
- package/dist/esm/lib/path-utils/path.js.map +0 -1
- package/dist/esm/lib/request-utils/request-scheduler.js.map +0 -1
- package/dist/esm/lib/sources/data-source.js.map +0 -1
- package/dist/esm/lib/sources/image-source.js +0 -6
- package/dist/esm/lib/sources/image-source.js.map +0 -1
- package/dist/esm/lib/sources/image-tile-source.js.map +0 -1
- package/dist/esm/lib/sources/tile-source.js.map +0 -1
- package/dist/esm/lib/sources/utils/image-type.js.map +0 -1
- package/dist/esm/lib/sources/utils/utils.js.map +0 -1
- package/dist/esm/lib/sources/vector-tile-source.js.map +0 -1
- package/dist/esm/lib/worker-loader-utils/create-loader-worker.js.map +0 -1
- package/dist/esm/lib/worker-loader-utils/encode-with-worker.js.map +0 -1
- package/dist/esm/lib/worker-loader-utils/parse-with-worker.js.map +0 -1
- package/dist/esm/loader-types.js.map +0 -1
- package/dist/esm/service-types.js.map +0 -1
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/workers/json-worker.js +0 -4
- package/dist/esm/workers/json-worker.js.map +0 -1
- package/dist/esm/writer-types.js.map +0 -1
- package/dist/lib/file-provider/file-handle.d.ts +0 -40
- package/dist/lib/file-provider/file-handle.d.ts.map +0 -1
- package/dist/lib/filesystems/node-filesystem.d.ts +0 -39
- package/dist/lib/filesystems/node-filesystem.d.ts.map +0 -1
- package/dist/lib/filesystems/readable-file.d.ts +0 -10
- package/dist/lib/filesystems/readable-file.d.ts.map +0 -1
- package/dist/lib/filesystems/writable-file.d.ts +0 -18
- package/dist/lib/filesystems/writable-file.d.ts.map +0 -1
- package/dist/lib/node/fs.d.ts +0 -30
- package/dist/lib/node/fs.d.ts.map +0 -1
- package/src/lib/file-provider/file-handle.ts +0 -79
- package/src/lib/filesystems/node-filesystem.ts +0 -67
- package/src/lib/filesystems/readable-file.ts +0 -30
- package/src/lib/filesystems/writable-file.ts +0 -44
- package/src/lib/node/fs.ts +0 -49
- /package/dist/{esm/lib → lib}/binary-utils/array-buffer-utils.js +0 -0
- /package/dist/{esm/lib → lib}/binary-utils/get-first-characters.js +0 -0
- /package/dist/{esm/lib → lib}/env-utils/assert.js +0 -0
- /package/dist/{esm/lib → lib}/env-utils/globals.js +0 -0
- /package/dist/{esm/lib → lib}/file-provider/file-provider.js +0 -0
- /package/dist/{esm/lib → lib}/filesystems/filesystem.js +0 -0
- /package/dist/{esm/lib → lib}/iterators/text-iterators.js +0 -0
- /package/dist/{esm/lib → lib}/node/buffer.browser.js +0 -0
- /package/dist/{esm/lib → lib}/node/buffer.js +0 -0
- /package/dist/{esm/lib → lib}/node/fs.browser.js +0 -0
- /package/dist/{esm/lib → lib}/node/promisify.js +0 -0
- /package/dist/{esm/lib → lib}/node/stream.browser.js +0 -0
- /package/dist/{esm/lib → lib}/node/stream.js +0 -0
- /package/dist/{esm/lib → lib}/option-utils/merge-loader-options.js +0 -0
- /package/dist/{esm/lib → lib}/path-utils/get-cwd.js +0 -0
- /package/dist/{esm/lib → lib}/sources/image-tile-source.js +0 -0
- /package/dist/{esm/lib → lib}/sources/tile-source.js +0 -0
- /package/dist/{esm/lib → lib}/sources/utils/image-type.js +0 -0
- /package/dist/{esm/lib → lib}/sources/utils/utils.js +0 -0
- /package/dist/{esm/lib → lib}/sources/vector-tile-source.js +0 -0
- /package/dist/{esm/loader-types.js → loader-types.js} +0 -0
- /package/dist/{esm/service-types.js → service-types.js} +0 -0
- /package/dist/{esm/types.js → types.js} +0 -0
- /package/dist/{esm/writer-types.js → writer-types.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loader-types.js","names":["parseFromContext","_x","_x2","_x3","_x4","_parseFromContext","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","loaders","options","context","wrap","_callee$","_context","prev","next","abrupt","_parse","stop","parseSyncFromContext","loader","_parseSync","Error","parseInBatchesFromContext","_x5","_x6","_x7","_x8","_parseInBatchesFromContext","_callee2","_callee2$","_context2","_parseInBatches"],"sources":["../../src/loader-types.ts"],"sourcesContent":["// loaders.gl, MIT license\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 `options.method` removed. Use `options.fetch.method` */\n method?: never;\n /** @deprecated `options.headers` removed. Use `options.fetch.headers` */\n headers?: never;\n /** @deprecated `options.body` removed. Use `options.fetch.body` */\n body?: never;\n /** @deprecated `options.mode` removed. Use `options.fetch.mode` */\n mode?: never;\n /** @deprecated `options.credentials` removed. Use `options.fetch.credentials` */\n credentials?: never;\n /** @deprecated `options.cache` removed. Use `options.fetch.cache` */\n cache?: never;\n /** @deprecated `options.redirect` removed. Use `options.fetch.redirect` */\n redirect?: never;\n /** @deprecated `options.referrer` removed. Use `options.fetch.referrer` */\n referrer?: never;\n /** @deprecated `options.referrerPolicy` removed. Use `options.fetch.referrerPolicy` */\n referrerPolicy?: never;\n /** @deprecated `options.integrity` removed. Use `options.fetch.integrity` */\n integrity?: never;\n /** @deprecated `options.keepalive` removed. Use `options.fetch.keepalive` */\n keepalive?: never;\n /** @deprecated `options.signal` removed. 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":";;;;;;;;;;;SAmUsBA,gBAAgBA,CAAAC,EAAA,EAAAC,GAAA,EAAAC,GAAA,EAAAC,GAAA;EAAA,OAAAC,iBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,kBAAA;EAAAA,iBAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAA/B,SAAAC,QACLC,IAAiB,EACjBC,OAA0B,EAC1BC,OAAkC,EAClCC,OAAsB;IAAA,OAAAN,YAAA,CAAAD,OAAA,CAAAQ,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,OAAAF,QAAA,CAAAG,MAAA,WAEfN,OAAO,CAACO,MAAM,CAACV,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAEC,OAAO,CAAC;QAAA;QAAA;UAAA,OAAAG,QAAA,CAAAK,IAAA;MAAA;IAAA,GAAAZ,OAAA;EAAA,CACvD;EAAA,OAAAP,iBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAKM,SAASkB,oBAAoBA,CAIlCZ,IAAiB,EACjBa,MAAe,EACfX,OAA6B,EAC7BC,OAAsB,EACK;EAC3B,IAAI,CAACA,OAAO,CAACW,UAAU,EAAE;IACvB,MAAM,IAAIC,KAAK,CAAC,WAAW,CAAC;EAC9B;EACA,OAAOZ,OAAO,CAACW,UAAU,CAACd,IAAI,EAAEa,MAAM,EAAEX,OAAO,EAAEC,OAAO,CAAC;AAC3D;AAAC,SAKqBa,yBAAyBA,CAAAC,GAAA,EAAAC,GAAA,EAAAC,GAAA,EAAAC,GAAA;EAAA,OAAAC,0BAAA,CAAA5B,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAA2B,2BAAA;EAAAA,0BAAA,OAAA1B,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAxC,SAAAwB,SAILtB,IAAmE,EACnEa,MAAe,EACfX,OAA6B,EAC7BC,OAAsB;IAAA,OAAAN,YAAA,CAAAD,OAAA,CAAAQ,IAAA,UAAAmB,UAAAC,SAAA;MAAA,kBAAAA,SAAA,CAAAjB,IAAA,GAAAiB,SAAA,CAAAhB,IAAA;QAAA;UAAA,IAEjBL,OAAO,CAACsB,eAAe;YAAAD,SAAA,CAAAhB,IAAA;YAAA;UAAA;UAAA,MACpB,IAAIO,KAAK,CAAC,gBAAgB,CAAC;QAAA;UAAA,OAAAS,SAAA,CAAAf,MAAA,WAE5BN,OAAO,CAACsB,eAAe,CAACzB,IAAI,EAAEa,MAAM,EAAEX,OAAO,EAAEC,OAAO,CAAC;QAAA;QAAA;UAAA,OAAAqB,SAAA,CAAAb,IAAA;MAAA;IAAA,GAAAW,QAAA;EAAA,CAC/D;EAAA,OAAAD,0BAAA,CAAA5B,KAAA,OAAAC,SAAA;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-types.js","names":[],"sources":["../../src/service-types.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {ImageSource, ImageSourceProps} from './lib/sources/image-source';\n\n/** Export interface source */\nexport interface Service<SourceT = ImageSource, SourcePropsT = ImageSourceProps> {\n source?: SourceT;\n props?: SourcePropsT;\n type: string;\n testURL: (url: string) => boolean;\n create(props: SourcePropsT): SourceT;\n}\n"],"mappings":""}
|
package/dist/es5/types.js
DELETED
package/dist/es5/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["// Typed arrays\n\nexport type TypedIntArray =\n | Int8Array\n | Uint8Array\n | Uint8ClampedArray\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Int32Array\n | Uint32Array;\n\nexport type TypedFloatArray = Uint16Array | Float32Array | Float64Array;\n\nexport type TypedArray = TypedIntArray | TypedFloatArray;\n\nexport type BigTypedArray = TypedArray | BigInt64Array | BigUint64Array;\n\nexport type TypedArrayConstructor =\n | Int8ArrayConstructor\n | Uint8ArrayConstructor\n | Int16ArrayConstructor\n | Uint16ArrayConstructor\n | Int32ArrayConstructor\n | Uint32ArrayConstructor\n | Int32ArrayConstructor\n | Uint32ArrayConstructor\n | Float32ArrayConstructor\n | Float64ArrayConstructor;\n\nexport type BigTypedArrayConstructor =\n | TypedArrayConstructor\n | BigInt64ArrayConstructor\n | BigUint64ArrayConstructor;\n\n/** Any numeric array: typed array or `number[]` */\nexport type NumberArray = number[] | TypedArray;\n\nexport type NumericArray = number[] | TypedArray;\n\n// FETCH\n\nexport type FetchLike = (url: string, options?: RequestInit) => Promise<Response>;\n\n// MISC TYPES\n\nexport type TransformBatches = (\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n) => AsyncIterable<ArrayBuffer>;\n\n/** Types that can be synchronously parsed */\nexport type SyncDataType = string | ArrayBuffer; // TODO File | Blob can be read synchronously...\n\n/** Types that can be parsed async */\nexport type DataType =\n | string\n | ArrayBuffer\n | File\n | Blob\n | Response\n | ReadableStream\n | Iterable<ArrayBuffer>\n | AsyncIterable<ArrayBuffer>;\n\n/** Types that can be parsed in batches */\nexport type BatchableDataType =\n | DataType\n | Iterable<ArrayBuffer>\n | AsyncIterable<ArrayBuffer>\n | Promise<AsyncIterable<ArrayBuffer>>;\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-worker.js","names":["_createLoaderWorker","require","_jsonLoader","createLoaderWorker","JSONLoader"],"sources":["../../../src/workers/json-worker.ts"],"sourcesContent":["import {createLoaderWorker} from '../lib/worker-loader-utils/create-loader-worker';\nimport {JSONLoader} from '../json-loader';\n\ncreateLoaderWorker(JSONLoader);\n"],"mappings":";;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,sCAAkB,EAACC,sBAAU,CAAC"}
|
package/dist/es5/writer-types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer-types.js","names":[],"sources":["../../src/writer-types.ts"],"sourcesContent":["// loaders.gl, MIT license\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":""}
|
package/dist/esm/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export { parseFromContext, parseSyncFromContext, parseInBatchesFromContext } from './loader-types';
|
|
2
|
-
export { assert } from './lib/env-utils/assert';
|
|
3
|
-
export { isBrowser, isWorker, nodeVersion, self, window, global, document } from './lib/env-utils/globals';
|
|
4
|
-
export { mergeLoaderOptions } from './lib/option-utils/merge-loader-options';
|
|
5
|
-
export { createLoaderWorker } from './lib/worker-loader-utils/create-loader-worker';
|
|
6
|
-
export { parseWithWorker, canParseWithWorker } from './lib/worker-loader-utils/parse-with-worker';
|
|
7
|
-
export { canEncodeWithWorker } from './lib/worker-loader-utils/encode-with-worker';
|
|
8
|
-
export { parseJSON } from './lib/parser-utils/parse-json';
|
|
9
|
-
export { sliceArrayBuffer, concatenateArrayBuffers, concatenateTypedArrays, compareArrayBuffers } from './lib/binary-utils/array-buffer-utils';
|
|
10
|
-
export { padToNBytes, copyToArray, copyArrayBuffer } from './lib/binary-utils/memory-copy-utils';
|
|
11
|
-
export { padStringToByteAlignment, copyStringToDataView, copyBinaryToDataView, copyPaddedArrayBufferToDataView, copyPaddedStringToDataView } from './lib/binary-utils/dataview-copy-utils';
|
|
12
|
-
export { getFirstCharacters, getMagicString } from './lib/binary-utils/get-first-characters';
|
|
13
|
-
export { makeTextEncoderIterator, makeTextDecoderIterator, makeLineIterator, makeNumberedLineIterator } from './lib/iterators/text-iterators';
|
|
14
|
-
export { forEach, concatenateArrayBuffersAsync } from './lib/iterators/async-iteration';
|
|
15
|
-
export { default as RequestScheduler } from './lib/request-utils/request-scheduler';
|
|
16
|
-
export { setPathPrefix, getPathPrefix, resolvePath } from './lib/path-utils/file-aliases';
|
|
17
|
-
export { addAliases as _addAliases } from './lib/path-utils/file-aliases';
|
|
18
|
-
export { JSONLoader } from './json-loader';
|
|
19
|
-
export { isBuffer, toBuffer, toArrayBuffer } from './lib/binary-utils/memory-conversion-utils';
|
|
20
|
-
export { promisify1, promisify2 } from './lib/node/promisify';
|
|
21
|
-
import * as path from './lib/path-utils/path';
|
|
22
|
-
export { path };
|
|
23
|
-
import * as fs from './lib/node/fs';
|
|
24
|
-
export { fs };
|
|
25
|
-
import * as stream from './lib/node/stream';
|
|
26
|
-
export { stream };
|
|
27
|
-
export { NodeFileSystem as _NodeFileSystem } from './lib/filesystems/node-filesystem';
|
|
28
|
-
export { isFileProvider } from './lib/file-provider/file-provider';
|
|
29
|
-
export { FileHandle } from './lib/file-provider/file-handle';
|
|
30
|
-
export { FileHandleFile } from './lib/file-provider/file-handle-file';
|
|
31
|
-
export { DataViewFile } from './lib/file-provider/data-view-file';
|
|
32
|
-
export { makeReadableFile } from './lib/filesystems/readable-file';
|
|
33
|
-
export { makeWritableFile } from './lib/filesystems/writable-file';
|
|
34
|
-
export { DataSource } from './lib/sources/data-source';
|
|
35
|
-
export { ImageSource } from './lib/sources/image-source';
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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","fs","stream","NodeFileSystem","_NodeFileSystem","isFileProvider","FileHandle","FileHandleFile","DataViewFile","makeReadableFile","makeWritableFile","DataSource","ImageSource"],"sources":["../../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\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 'fs' to avoid node dependencies`\nimport * as fs from './lib/node/fs';\nexport {fs};\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 {FileSystem, RandomAccessReadFileSystem} from './lib/filesystems/filesystem';\nexport {NodeFileSystem as _NodeFileSystem} from './lib/filesystems/node-filesystem';\n\nexport type {FileProvider} from './lib/file-provider/file-provider';\nexport {isFileProvider} from './lib/file-provider/file-provider';\n\nexport {FileHandle} from './lib/file-provider/file-handle';\nexport {FileHandleFile} from './lib/file-provider/file-handle-file';\nexport {DataViewFile} from './lib/file-provider/data-view-file';\n\nexport type {ReadableFile} from './lib/filesystems/readable-file';\nexport {makeReadableFile} from './lib/filesystems/readable-file';\n\nexport type {WritableFile} from './lib/filesystems/writable-file';\nexport {makeWritableFile} from './lib/filesystems/writable-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} 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":"AAgCA,SAAQA,gBAAgB,EAAEC,oBAAoB,EAAEC,yBAAyB,QAAO,gBAAgB;AAOhG,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,SACEC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,IAAI,EACJC,MAAM,EACNC,MAAM,EACNC,QAAQ,QACH,yBAAyB;AAEhC,SAAQC,kBAAkB,QAAO,yCAAyC;AAG1E,SAAQC,kBAAkB,QAAO,gDAAgD;AACjF,SAAQC,eAAe,EAAEC,kBAAkB,QAAO,6CAA6C;AAC/F,SAAQC,mBAAmB,QAAO,8CAA8C;AAGhF,SAAQC,SAAS,QAAO,+BAA+B;AAGvD,SACEC,gBAAgB,EAChBC,uBAAuB,EACvBC,sBAAsB,EACtBC,mBAAmB,QACd,uCAAuC;AAC9C,SAAQC,WAAW,EAAEC,WAAW,EAAEC,eAAe,QAAO,sCAAsC;AAC9F,SACEC,wBAAwB,EACxBC,oBAAoB,EACpBC,oBAAoB,EACpBC,+BAA+B,EAC/BC,0BAA0B,QACrB,wCAAwC;AAC/C,SAAQC,kBAAkB,EAAEC,cAAc,QAAO,yCAAyC;AAG1F,SACEC,uBAAuB,EACvBC,uBAAuB,EACvBC,gBAAgB,EAChBC,wBAAwB,QACnB,gCAAgC;AACvC,SAAQC,OAAO,EAAEC,4BAA4B,QAAO,iCAAiC;AAGrF,SAAQC,OAAO,IAAIC,gBAAgB,QAAO,uCAAuC;AAGjF,SAAQC,aAAa,EAAEC,aAAa,EAAEC,WAAW,QAAO,+BAA+B;AACvF,SAAQC,UAAU,IAAIC,WAAW,QAAO,+BAA+B;AAGvE,SAAQC,UAAU,QAAO,eAAe;AAOxC,SAAQC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,QAAO,4CAA4C;AAK5F,SAAQC,UAAU,EAAEC,UAAU,QAAO,sBAAsB;AAG3D,OAAO,KAAKC,IAAI,MAAM,uBAAuB;AAC7C,SAAQA,IAAI;AAGZ,OAAO,KAAKC,EAAE,MAAM,eAAe;AACnC,SAAQA,EAAE;AAGV,OAAO,KAAKC,MAAM,MAAM,mBAAmB;AAC3C,SAAQA,MAAM;AAKd,SAAQC,cAAc,IAAIC,eAAe,QAAO,mCAAmC;AAGnF,SAAQC,cAAc,QAAO,mCAAmC;AAEhE,SAAQC,UAAU,QAAO,iCAAiC;AAC1D,SAAQC,cAAc,QAAO,sCAAsC;AACnE,SAAQC,YAAY,QAAO,oCAAoC;AAG/D,SAAQC,gBAAgB,QAAO,iCAAiC;AAGhE,SAAQC,gBAAgB,QAAO,iCAAiC;AAMhE,SAAQC,UAAU,QAAO,2BAA2B;AAKpD,SAAQC,WAAW,QAAO,4BAA4B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-loader.js","names":["VERSION","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parseTextSync","parse","arrayBuffer","TextDecoder","decode","options","JSON"],"sources":["../../src/json-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from './loader-types';\nimport type {Table, TableBatch} from '@loaders.gl/schema';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type JSONLoaderOptions = LoaderOptions;\n\n/**\n * A JSON Micro loader (minimal bundle size)\n * Alternative to `@loaders.gl/json`\n */\nexport const JSONLoader: LoaderWithParser<Table, TableBatch, JSONLoaderOptions> = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\n category: 'json',\n text: true,\n parseTextSync,\n parse: async (arrayBuffer) => parseTextSync(new TextDecoder().decode(arrayBuffer)),\n options: {}\n};\n\n// TODO - deprecated\nfunction parseTextSync(text) {\n return JSON.parse(text);\n}\n"],"mappings":"AAKA,MAAMA,OAAO,GAAG,qBAAkB,KAAK,WAAW,oBAAiB,QAAQ;AAQ3E,OAAO,MAAMC,UAAkE,GAAG;EAChFC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;EAC/BC,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,QAAQ,EAAE,MAAM;EAChBC,IAAI,EAAE,IAAI;EACVC,aAAa;EACbC,KAAK,EAAE,MAAOC,WAAW,IAAKF,aAAa,CAAC,IAAIG,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,CAAC;EAClFG,OAAO,EAAE,CAAC;AACZ,CAAC;AAGD,SAASL,aAAaA,CAACD,IAAI,EAAE;EAC3B,OAAOO,IAAI,CAACL,KAAK,CAACF,IAAI,CAAC;AACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array-buffer-utils.js","names":["compareArrayBuffers","arrayBuffer1","arrayBuffer2","byteLength","array1","Uint8Array","array2","i","length","concatenateArrayBuffers","_len","arguments","sources","Array","_key","sourceArrays","map","source2","ArrayBuffer","reduce","typedArray","result","offset","sourceArray","set","buffer","concatenateTypedArrays","_len2","typedArrays","_key2","arrays","TypedArrayConstructor","constructor","Error","sumLength","acc","value","array","sliceArrayBuffer","arrayBuffer","byteOffset","subArray","undefined","subarray","arrayCopy"],"sources":["../../../../src/lib/binary-utils/array-buffer-utils.ts"],"sourcesContent":["import {TypedArray} from '../../types';\n\n/**\n * compare two binary arrays for equality\n * @param a\n * @param b\n * @param byteLength\n */\nexport function compareArrayBuffers(\n arrayBuffer1: ArrayBuffer,\n arrayBuffer2: ArrayBuffer,\n byteLength?: number\n): boolean {\n byteLength = byteLength || arrayBuffer1.byteLength;\n if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {\n return false;\n }\n const array1 = new Uint8Array(arrayBuffer1);\n const array2 = new Uint8Array(arrayBuffer2);\n for (let i = 0; i < array1.length; ++i) {\n if (array1[i] !== array2[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Concatenate a sequence of ArrayBuffers\n * @return A concatenated ArrayBuffer\n */\nexport function concatenateArrayBuffers(...sources: (ArrayBuffer | Uint8Array)[]): ArrayBuffer {\n // Make sure all inputs are wrapped in typed arrays\n const sourceArrays = sources.map((source2) =>\n source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2\n );\n\n // Get length of all inputs\n const byteLength = sourceArrays.reduce((length, typedArray) => length + typedArray.byteLength, 0);\n\n // Allocate array with space for all inputs\n const result = new Uint8Array(byteLength);\n\n // Copy the subarrays\n let offset = 0;\n for (const sourceArray of sourceArrays) {\n result.set(sourceArray, offset);\n offset += sourceArray.byteLength;\n }\n\n // We work with ArrayBuffers, discard the typed array wrapper\n return result.buffer;\n}\n\n/**\n * Concatenate arbitrary count of typed arrays\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays\n * @param - list of arrays. All arrays should be the same type\n * @return A concatenated TypedArray\n */\nexport function concatenateTypedArrays<T>(...typedArrays: T[]): T {\n // @ts-ignore\n const arrays = typedArrays as TypedArray[];\n // @ts-ignore\n const TypedArrayConstructor = (arrays && arrays.length > 1 && arrays[0].constructor) || null;\n if (!TypedArrayConstructor) {\n throw new Error(\n '\"concatenateTypedArrays\" - incorrect quantity of arguments or arguments have incompatible data types'\n );\n }\n\n const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);\n // @ts-ignore typescript does not like dynamic constructors\n const result = new TypedArrayConstructor(sumLength);\n let offset = 0;\n for (const array of arrays) {\n result.set(array, offset);\n offset += array.length;\n }\n return result;\n}\n\n/**\n * Copy a view of an ArrayBuffer into new ArrayBuffer with byteOffset = 0\n * @param arrayBuffer\n * @param byteOffset\n * @param byteLength\n */\nexport function sliceArrayBuffer(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n byteLength?: number\n): ArrayBuffer {\n const subArray =\n byteLength !== undefined\n ? new Uint8Array(arrayBuffer).subarray(byteOffset, byteOffset + byteLength)\n : new Uint8Array(arrayBuffer).subarray(byteOffset);\n const arrayCopy = new Uint8Array(subArray);\n return arrayCopy.buffer;\n}\n"],"mappings":"AAQA,OAAO,SAASA,mBAAmBA,CACjCC,YAAyB,EACzBC,YAAyB,EACzBC,UAAmB,EACV;EACTA,UAAU,GAAGA,UAAU,IAAIF,YAAY,CAACE,UAAU;EAClD,IAAIF,YAAY,CAACE,UAAU,GAAGA,UAAU,IAAID,YAAY,CAACC,UAAU,GAAGA,UAAU,EAAE;IAChF,OAAO,KAAK;EACd;EACA,MAAMC,MAAM,GAAG,IAAIC,UAAU,CAACJ,YAAY,CAAC;EAC3C,MAAMK,MAAM,GAAG,IAAID,UAAU,CAACH,YAAY,CAAC;EAC3C,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,MAAM,CAACI,MAAM,EAAE,EAAED,CAAC,EAAE;IACtC,IAAIH,MAAM,CAACG,CAAC,CAAC,KAAKD,MAAM,CAACC,CAAC,CAAC,EAAE;MAC3B,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb;AAMA,OAAO,SAASE,uBAAuBA,CAAA,EAAwD;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAH,MAAA,EAApDI,OAAO,OAAAC,KAAA,CAAAH,IAAA,GAAAI,IAAA,MAAAA,IAAA,GAAAJ,IAAA,EAAAI,IAAA;IAAPF,OAAO,CAAAE,IAAA,IAAAH,SAAA,CAAAG,IAAA;EAAA;EAEhD,MAAMC,YAAY,GAAGH,OAAO,CAACI,GAAG,CAAEC,OAAO,IACvCA,OAAO,YAAYC,WAAW,GAAG,IAAIb,UAAU,CAACY,OAAO,CAAC,GAAGA,OAC7D,CAAC;EAGD,MAAMd,UAAU,GAAGY,YAAY,CAACI,MAAM,CAAC,CAACX,MAAM,EAAEY,UAAU,KAAKZ,MAAM,GAAGY,UAAU,CAACjB,UAAU,EAAE,CAAC,CAAC;EAGjG,MAAMkB,MAAM,GAAG,IAAIhB,UAAU,CAACF,UAAU,CAAC;EAGzC,IAAImB,MAAM,GAAG,CAAC;EACd,KAAK,MAAMC,WAAW,IAAIR,YAAY,EAAE;IACtCM,MAAM,CAACG,GAAG,CAACD,WAAW,EAAED,MAAM,CAAC;IAC/BA,MAAM,IAAIC,WAAW,CAACpB,UAAU;EAClC;EAGA,OAAOkB,MAAM,CAACI,MAAM;AACtB;AAQA,OAAO,SAASC,sBAAsBA,CAAA,EAA4B;EAAA,SAAAC,KAAA,GAAAhB,SAAA,CAAAH,MAAA,EAArBoB,WAAW,OAAAf,KAAA,CAAAc,KAAA,GAAAE,KAAA,MAAAA,KAAA,GAAAF,KAAA,EAAAE,KAAA;IAAXD,WAAW,CAAAC,KAAA,IAAAlB,SAAA,CAAAkB,KAAA;EAAA;EAEtD,MAAMC,MAAM,GAAGF,WAA2B;EAE1C,MAAMG,qBAAqB,GAAID,MAAM,IAAIA,MAAM,CAACtB,MAAM,GAAG,CAAC,IAAIsB,MAAM,CAAC,CAAC,CAAC,CAACE,WAAW,IAAK,IAAI;EAC5F,IAAI,CAACD,qBAAqB,EAAE;IAC1B,MAAM,IAAIE,KAAK,CACb,sGACF,CAAC;EACH;EAEA,MAAMC,SAAS,GAAGJ,MAAM,CAACX,MAAM,CAAC,CAACgB,GAAG,EAAEC,KAAK,KAAKD,GAAG,GAAGC,KAAK,CAAC5B,MAAM,EAAE,CAAC,CAAC;EAEtE,MAAMa,MAAM,GAAG,IAAIU,qBAAqB,CAACG,SAAS,CAAC;EACnD,IAAIZ,MAAM,GAAG,CAAC;EACd,KAAK,MAAMe,KAAK,IAAIP,MAAM,EAAE;IAC1BT,MAAM,CAACG,GAAG,CAACa,KAAK,EAAEf,MAAM,CAAC;IACzBA,MAAM,IAAIe,KAAK,CAAC7B,MAAM;EACxB;EACA,OAAOa,MAAM;AACf;AAQA,OAAO,SAASiB,gBAAgBA,CAC9BC,WAAwB,EACxBC,UAAkB,EAClBrC,UAAmB,EACN;EACb,MAAMsC,QAAQ,GACZtC,UAAU,KAAKuC,SAAS,GACpB,IAAIrC,UAAU,CAACkC,WAAW,CAAC,CAACI,QAAQ,CAACH,UAAU,EAAEA,UAAU,GAAGrC,UAAU,CAAC,GACzE,IAAIE,UAAU,CAACkC,WAAW,CAAC,CAACI,QAAQ,CAACH,UAAU,CAAC;EACtD,MAAMI,SAAS,GAAG,IAAIvC,UAAU,CAACoC,QAAQ,CAAC;EAC1C,OAAOG,SAAS,CAACnB,MAAM;AACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dataview-copy-utils.js","names":["padToNBytes","padStringToByteAlignment","string","byteAlignment","length","paddedLength","Math","ceil","padding","whitespace","i","copyStringToDataView","dataView","byteOffset","byteLength","setUint8","charCodeAt","copyBinaryToDataView","binary","copyPaddedArrayBufferToDataView","sourceBuffer","padLength","targetArray","Uint8Array","buffer","sourceArray","set","copyPaddedStringToDataView","textEncoder","TextEncoder","stringBuffer","encode"],"sources":["../../../../src/lib/binary-utils/dataview-copy-utils.ts"],"sourcesContent":["// loaders./gl, MIT license\n\nimport {TypedArray} from '../../types';\nimport {padToNBytes} from './memory-copy-utils';\n\n/**\n * Helper function that pads a string with spaces to fit a certain byte alignment\n * @param string\n * @param byteAlignment\n * @returns\n *\n * @todo PERFORMANCE IDEA: No need to copy string twice...\n */\nexport function padStringToByteAlignment(string: string, byteAlignment: number): string {\n const length = string.length;\n const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment; // Round up to the required alignment\n const padding = paddedLength - length;\n let whitespace = '';\n for (let i = 0; i < padding; ++i) {\n whitespace += ' ';\n }\n return string + whitespace;\n}\n\n/**\n *\n * @param dataView\n * @param byteOffset\n * @param string\n * @param byteLength\n * @returns\n */\nexport function copyStringToDataView(\n dataView: DataView,\n byteOffset: number,\n string: string,\n byteLength: number\n): number {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, string.charCodeAt(i));\n }\n }\n return byteOffset + byteLength;\n}\n\nexport function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, binary[i]);\n }\n }\n return byteOffset + byteLength;\n}\n\n/**\n * Copy sourceBuffer to dataView with some padding\n *\n * @param dataView - destination data container. If null - only new offset is calculated\n * @param byteOffset - destination byte offset to copy to\n * @param sourceBuffer - source data buffer\n * @param padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedArrayBufferToDataView(\n dataView: DataView | null,\n byteOffset: number,\n sourceBuffer: TypedArray,\n padding: number\n): number {\n const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);\n const padLength = paddedLength - sourceBuffer.byteLength;\n\n if (dataView) {\n // Copy array\n const targetArray = new Uint8Array(\n dataView.buffer,\n dataView.byteOffset + byteOffset,\n sourceBuffer.byteLength\n );\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n\n // Add PADDING\n for (let i = 0; i < padLength; ++i) {\n // json chunk is padded with spaces (ASCII 0x20)\n dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 0x20);\n }\n }\n byteOffset += paddedLength;\n return byteOffset;\n}\n\n/**\n * Copy string to dataView with some padding\n *\n * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated\n * @param {number} byteOffset - destination byte offset to copy to\n * @param {string} string - source string\n * @param {number} padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedStringToDataView(\n dataView: DataView | null,\n byteOffset: number,\n string: string,\n padding: number\n): number {\n const textEncoder = new TextEncoder();\n // PERFORMANCE IDEA: We encode twice, once to get size and once to store\n // PERFORMANCE IDEA: Use TextEncoder.encodeInto() to avoid temporary copy\n const stringBuffer = textEncoder.encode(string);\n\n byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);\n\n return byteOffset;\n}\n"],"mappings":"AAGA,SAAQA,WAAW,QAAO,qBAAqB;AAU/C,OAAO,SAASC,wBAAwBA,CAACC,MAAc,EAAEC,aAAqB,EAAU;EACtF,MAAMC,MAAM,GAAGF,MAAM,CAACE,MAAM;EAC5B,MAAMC,YAAY,GAAGC,IAAI,CAACC,IAAI,CAACH,MAAM,GAAGD,aAAa,CAAC,GAAGA,aAAa;EACtE,MAAMK,OAAO,GAAGH,YAAY,GAAGD,MAAM;EACrC,IAAIK,UAAU,GAAG,EAAE;EACnB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,OAAO,EAAE,EAAEE,CAAC,EAAE;IAChCD,UAAU,IAAI,GAAG;EACnB;EACA,OAAOP,MAAM,GAAGO,UAAU;AAC5B;AAUA,OAAO,SAASE,oBAAoBA,CAClCC,QAAkB,EAClBC,UAAkB,EAClBX,MAAc,EACdY,UAAkB,EACV;EACR,IAAIF,QAAQ,EAAE;IACZ,KAAK,IAAIF,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGI,UAAU,EAAEJ,CAAC,EAAE,EAAE;MACnCE,QAAQ,CAACG,QAAQ,CAACF,UAAU,GAAGH,CAAC,EAAER,MAAM,CAACc,UAAU,CAACN,CAAC,CAAC,CAAC;IACzD;EACF;EACA,OAAOG,UAAU,GAAGC,UAAU;AAChC;AAEA,OAAO,SAASG,oBAAoBA,CAACL,QAAQ,EAAEC,UAAU,EAAEK,MAAM,EAAEJ,UAAU,EAAE;EAC7E,IAAIF,QAAQ,EAAE;IACZ,KAAK,IAAIF,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGI,UAAU,EAAEJ,CAAC,EAAE,EAAE;MACnCE,QAAQ,CAACG,QAAQ,CAACF,UAAU,GAAGH,CAAC,EAAEQ,MAAM,CAACR,CAAC,CAAC,CAAC;IAC9C;EACF;EACA,OAAOG,UAAU,GAAGC,UAAU;AAChC;AAYA,OAAO,SAASK,+BAA+BA,CAC7CP,QAAyB,EACzBC,UAAkB,EAClBO,YAAwB,EACxBZ,OAAe,EACP;EACR,MAAMH,YAAY,GAAGL,WAAW,CAACoB,YAAY,CAACN,UAAU,EAAEN,OAAO,CAAC;EAClE,MAAMa,SAAS,GAAGhB,YAAY,GAAGe,YAAY,CAACN,UAAU;EAExD,IAAIF,QAAQ,EAAE;IAEZ,MAAMU,WAAW,GAAG,IAAIC,UAAU,CAChCX,QAAQ,CAACY,MAAM,EACfZ,QAAQ,CAACC,UAAU,GAAGA,UAAU,EAChCO,YAAY,CAACN,UACf,CAAC;IACD,MAAMW,WAAW,GAAG,IAAIF,UAAU,CAACH,YAAY,CAAC;IAChDE,WAAW,CAACI,GAAG,CAACD,WAAW,CAAC;IAG5B,KAAK,IAAIf,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGW,SAAS,EAAE,EAAEX,CAAC,EAAE;MAElCE,QAAQ,CAACG,QAAQ,CAACF,UAAU,GAAGO,YAAY,CAACN,UAAU,GAAGJ,CAAC,EAAE,IAAI,CAAC;IACnE;EACF;EACAG,UAAU,IAAIR,YAAY;EAC1B,OAAOQ,UAAU;AACnB;AAYA,OAAO,SAASc,0BAA0BA,CACxCf,QAAyB,EACzBC,UAAkB,EAClBX,MAAc,EACdM,OAAe,EACP;EACR,MAAMoB,WAAW,GAAG,IAAIC,WAAW,CAAC,CAAC;EAGrC,MAAMC,YAAY,GAAGF,WAAW,CAACG,MAAM,CAAC7B,MAAM,CAAC;EAE/CW,UAAU,GAAGM,+BAA+B,CAACP,QAAQ,EAAEC,UAAU,EAAEiB,YAAY,EAAEtB,OAAO,CAAC;EAEzF,OAAOK,UAAU;AACnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-first-characters.js","names":["getFirstCharacters","data","length","arguments","undefined","slice","ArrayBuffer","isView","getMagicString","buffer","byteOffset","arrayBuffer","byteLength","dataView","DataView","magic","i","String","fromCharCode","getUint8"],"sources":["../../../../src/lib/binary-utils/get-first-characters.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/**\n * Get the first characters from a binary file (interpret the first bytes as an ASCII string)\n * @param data\n * @param length\n * @returns\n */\nexport function getFirstCharacters(data: string | ArrayBuffer, length: number = 5): string {\n if (typeof data === 'string') {\n return data.slice(0, length);\n } else if (ArrayBuffer.isView(data)) {\n // Typed Arrays can have offsets into underlying buffer\n return getMagicString(data.buffer, data.byteOffset, length);\n } else if (data instanceof ArrayBuffer) {\n const byteOffset = 0;\n return getMagicString(data, byteOffset, length);\n }\n return '';\n}\n\n/**\n * Gets a magic string from a \"file\"\n * Typically used to check or detect file format\n * @param arrayBuffer\n * @param byteOffset\n * @param length\n * @returns\n */\nexport function getMagicString(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n length: number\n): string {\n if (arrayBuffer.byteLength <= byteOffset + length) {\n return '';\n }\n const dataView = new DataView(arrayBuffer);\n let magic = '';\n for (let i = 0; i < length; i++) {\n magic += String.fromCharCode(dataView.getUint8(byteOffset + i));\n }\n return magic;\n}\n"],"mappings":"AAQA,OAAO,SAASA,kBAAkBA,CAACC,IAA0B,EAA8B;EAAA,IAA5BC,MAAc,GAAAC,SAAA,CAAAD,MAAA,QAAAC,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,CAAC;EAC/E,IAAI,OAAOF,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI,CAACI,KAAK,CAAC,CAAC,EAAEH,MAAM,CAAC;EAC9B,CAAC,MAAM,IAAII,WAAW,CAACC,MAAM,CAACN,IAAI,CAAC,EAAE;IAEnC,OAAOO,cAAc,CAACP,IAAI,CAACQ,MAAM,EAAER,IAAI,CAACS,UAAU,EAAER,MAAM,CAAC;EAC7D,CAAC,MAAM,IAAID,IAAI,YAAYK,WAAW,EAAE;IACtC,MAAMI,UAAU,GAAG,CAAC;IACpB,OAAOF,cAAc,CAACP,IAAI,EAAES,UAAU,EAAER,MAAM,CAAC;EACjD;EACA,OAAO,EAAE;AACX;AAUA,OAAO,SAASM,cAAcA,CAC5BG,WAAwB,EACxBD,UAAkB,EAClBR,MAAc,EACN;EACR,IAAIS,WAAW,CAACC,UAAU,IAAIF,UAAU,GAAGR,MAAM,EAAE;IACjD,OAAO,EAAE;EACX;EACA,MAAMW,QAAQ,GAAG,IAAIC,QAAQ,CAACH,WAAW,CAAC;EAC1C,IAAII,KAAK,GAAG,EAAE;EACd,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGd,MAAM,EAAEc,CAAC,EAAE,EAAE;IAC/BD,KAAK,IAAIE,MAAM,CAACC,YAAY,CAACL,QAAQ,CAACM,QAAQ,CAACT,UAAU,GAAGM,CAAC,CAAC,CAAC;EACjE;EACA,OAAOD,KAAK;AACd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-conversion-utils.js","names":["node","isBuffer","value","toBuffer","data","toArrayBuffer","ArrayBuffer","isView","byteOffset","byteLength","buffer","slice","text","uint8Array","TextEncoder","encode","_toArrayBuffer","Error"],"sources":["../../../../src/lib/binary-utils/memory-conversion-utils.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport * as node from '../node/buffer';\n\n/**\n * Check for Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n */\nexport function isBuffer(value: any): boolean {\n return value && typeof value === 'object' && value.isBuffer;\n}\n\n/**\n * Converts to Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toBuffer(data: any): Buffer {\n return node.toBuffer ? node.toBuffer(data) : data;\n}\n\n/**\n * Convert an object to an array buffer\n */\nexport function toArrayBuffer(data: unknown): ArrayBuffer {\n // Note: Should be called first, Buffers can trigger other detections below\n if (isBuffer(data)) {\n return node.toArrayBuffer(data);\n }\n\n if (data instanceof ArrayBuffer) {\n return data;\n }\n\n // Careful - Node Buffers look like Uint8Arrays (keep after isBuffer)\n if (ArrayBuffer.isView(data)) {\n if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {\n return data.buffer;\n }\n return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\n }\n\n if (typeof data === 'string') {\n const text = data;\n const uint8Array = new TextEncoder().encode(text);\n return uint8Array.buffer;\n }\n\n // HACK to support Blob polyfill\n if (data && typeof data === 'object' && (data as any)._toArrayBuffer) {\n return (data as any)._toArrayBuffer();\n }\n\n throw new Error('toArrayBuffer');\n}\n"],"mappings":"AAEA,OAAO,KAAKA,IAAI,MAAM,gBAAgB;AAKtC,OAAO,SAASC,QAAQA,CAACC,KAAU,EAAW;EAC5C,OAAOA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACD,QAAQ;AAC7D;AAMA,OAAO,SAASE,QAAQA,CAACC,IAAS,EAAU;EAC1C,OAAOJ,IAAI,CAACG,QAAQ,GAAGH,IAAI,CAACG,QAAQ,CAACC,IAAI,CAAC,GAAGA,IAAI;AACnD;AAKA,OAAO,SAASC,aAAaA,CAACD,IAAa,EAAe;EAExD,IAAIH,QAAQ,CAACG,IAAI,CAAC,EAAE;IAClB,OAAOJ,IAAI,CAACK,aAAa,CAACD,IAAI,CAAC;EACjC;EAEA,IAAIA,IAAI,YAAYE,WAAW,EAAE;IAC/B,OAAOF,IAAI;EACb;EAGA,IAAIE,WAAW,CAACC,MAAM,CAACH,IAAI,CAAC,EAAE;IAC5B,IAAIA,IAAI,CAACI,UAAU,KAAK,CAAC,IAAIJ,IAAI,CAACK,UAAU,KAAKL,IAAI,CAACM,MAAM,CAACD,UAAU,EAAE;MACvE,OAAOL,IAAI,CAACM,MAAM;IACpB;IACA,OAAON,IAAI,CAACM,MAAM,CAACC,KAAK,CAACP,IAAI,CAACI,UAAU,EAAEJ,IAAI,CAACI,UAAU,GAAGJ,IAAI,CAACK,UAAU,CAAC;EAC9E;EAEA,IAAI,OAAOL,IAAI,KAAK,QAAQ,EAAE;IAC5B,MAAMQ,IAAI,GAAGR,IAAI;IACjB,MAAMS,UAAU,GAAG,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACH,IAAI,CAAC;IACjD,OAAOC,UAAU,CAACH,MAAM;EAC1B;EAGA,IAAIN,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAKA,IAAI,CAASY,cAAc,EAAE;IACpE,OAAQZ,IAAI,CAASY,cAAc,CAAC,CAAC;EACvC;EAEA,MAAM,IAAIC,KAAK,CAAC,eAAe,CAAC;AAClC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-copy-utils.js","names":["assert","padToNBytes","byteLength","padding","copyArrayBuffer","targetBuffer","sourceBuffer","byteOffset","arguments","length","undefined","targetArray","Uint8Array","sourceArray","set","copyToArray","source","target","targetOffset","ArrayBuffer","srcByteOffset","srcByteLength","buffer","arrayBuffer"],"sources":["../../../../src/lib/binary-utils/memory-copy-utils.ts"],"sourcesContent":["import {assert} from '../env-utils/assert';\n\n/**\n * Calculate new size of an arrayBuffer to be aligned to an n-byte boundary\n * This function increases `byteLength` by the minimum delta,\n * allowing the total length to be divided by `padding`\n * @param byteLength\n * @param padding\n */\nexport function padToNBytes(byteLength: number, padding: number): number {\n assert(byteLength >= 0); // `Incorrect 'byteLength' value: ${byteLength}`\n assert(padding > 0); // `Incorrect 'padding' value: ${padding}`\n return (byteLength + (padding - 1)) & ~(padding - 1);\n}\n\n/**\n * Creates a new Uint8Array based on two different ArrayBuffers\n * @param targetBuffer The first buffer.\n * @param sourceBuffer The second buffer.\n * @return The new ArrayBuffer created out of the two.\n */\nexport function copyArrayBuffer(\n targetBuffer: ArrayBuffer,\n sourceBuffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number = sourceBuffer.byteLength\n): ArrayBuffer {\n const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n return targetBuffer;\n}\n\n/**\n * Copy from source to target at the targetOffset\n *\n * @param source - The data to copy\n * @param target - The destination to copy data into\n * @param targetOffset - The start offset into target to place the copied data\n * @returns the new offset taking into account proper padding\n */\nexport function copyToArray(source: ArrayBuffer | any, target: any, targetOffset: number): number {\n let sourceArray;\n\n if (source instanceof ArrayBuffer) {\n sourceArray = new Uint8Array(source);\n } else {\n // Pack buffer onto the big target array\n //\n // 'source.data.buffer' could be a view onto a larger buffer.\n // We MUST use this constructor to ensure the byteOffset and byteLength is\n // set to correct values from 'source.data' and not the underlying\n // buffer for target.set() to work properly.\n const srcByteOffset = source.byteOffset;\n const srcByteLength = source.byteLength;\n // In gltf parser it is set as \"arrayBuffer\" instead of \"buffer\"\n // https://github.com/visgl/loaders.gl/blob/1e3a82a0a65d7b6a67b1e60633453e5edda2960a/modules/gltf/src/lib/parse-gltf.js#L85\n sourceArray = new Uint8Array(source.buffer || source.arrayBuffer, srcByteOffset, srcByteLength);\n }\n\n // Pack buffer onto the big target array\n target.set(sourceArray, targetOffset);\n\n return targetOffset + padToNBytes(sourceArray.byteLength, 4);\n}\n"],"mappings":"AAAA,SAAQA,MAAM,QAAO,qBAAqB;AAS1C,OAAO,SAASC,WAAWA,CAACC,UAAkB,EAAEC,OAAe,EAAU;EACvEH,MAAM,CAACE,UAAU,IAAI,CAAC,CAAC;EACvBF,MAAM,CAACG,OAAO,GAAG,CAAC,CAAC;EACnB,OAAQD,UAAU,IAAIC,OAAO,GAAG,CAAC,CAAC,GAAI,EAAEA,OAAO,GAAG,CAAC,CAAC;AACtD;AAQA,OAAO,SAASC,eAAeA,CAC7BC,YAAyB,EACzBC,YAAyB,EACzBC,UAAkB,EAEL;EAAA,IADbL,UAAkB,GAAAM,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGF,YAAY,CAACJ,UAAU;EAE5C,MAAMS,WAAW,GAAG,IAAIC,UAAU,CAACP,YAAY,EAAEE,UAAU,EAAEL,UAAU,CAAC;EACxE,MAAMW,WAAW,GAAG,IAAID,UAAU,CAACN,YAAY,CAAC;EAChDK,WAAW,CAACG,GAAG,CAACD,WAAW,CAAC;EAC5B,OAAOR,YAAY;AACrB;AAUA,OAAO,SAASU,WAAWA,CAACC,MAAyB,EAAEC,MAAW,EAAEC,YAAoB,EAAU;EAChG,IAAIL,WAAW;EAEf,IAAIG,MAAM,YAAYG,WAAW,EAAE;IACjCN,WAAW,GAAG,IAAID,UAAU,CAACI,MAAM,CAAC;EACtC,CAAC,MAAM;IAOL,MAAMI,aAAa,GAAGJ,MAAM,CAACT,UAAU;IACvC,MAAMc,aAAa,GAAGL,MAAM,CAACd,UAAU;IAGvCW,WAAW,GAAG,IAAID,UAAU,CAACI,MAAM,CAACM,MAAM,IAAIN,MAAM,CAACO,WAAW,EAAEH,aAAa,EAAEC,aAAa,CAAC;EACjG;EAGAJ,MAAM,CAACH,GAAG,CAACD,WAAW,EAAEK,YAAY,CAAC;EAErC,OAAOA,YAAY,GAAGjB,WAAW,CAACY,WAAW,CAACX,UAAU,EAAE,CAAC,CAAC;AAC9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","names":["assert","condition","message","Error"],"sources":["../../../../src/lib/env-utils/assert.ts"],"sourcesContent":["/**\n * Throws an `Error` with the optional `message` if `condition` is falsy\n * @note Replacement for the external assert method to reduce bundle size\n */\nexport function assert(condition: any, message?: string): void {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}\n"],"mappings":"AAIA,OAAO,SAASA,MAAMA,CAACC,SAAc,EAAEC,OAAgB,EAAQ;EAC7D,IAAI,CAACD,SAAS,EAAE;IACd,MAAM,IAAIE,KAAK,CAACD,OAAO,IAAI,0BAA0B,CAAC;EACxD;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globals.js","names":["globals","self","window","global","document","self_","window_","global_","document_","isBrowser","Boolean","process","String","browser","isWorker","importScripts","matches","version","exec","nodeVersion","parseFloat"],"sources":["../../../../src/lib/env-utils/globals.ts"],"sourcesContent":["// Purpose: include this in your module to avoid\n// dependencies on micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst globals = {\n self: typeof self !== 'undefined' && self,\n window: typeof window !== 'undefined' && window,\n global: typeof global !== 'undefined' && global,\n document: typeof document !== 'undefined' && document\n};\n\ntype obj = {[key: string]: any};\nconst self_: obj = globals.self || globals.window || globals.global || {};\nconst window_: obj = globals.window || globals.self || globals.global || {};\nconst global_: obj = globals.global || globals.self || globals.window || {};\nconst document_: obj = globals.document || {};\n\nexport {self_ as self, window_ as window, global_ as global, document_ as document};\n\n/** true if running in a browser */\nexport const isBrowser: boolean =\n // @ts-ignore process does not exist on browser\n Boolean(typeof process !== 'object' || String(process) !== '[object process]' || process.browser);\n\n/** true if running in a worker thread */\nexport const isWorker: boolean = typeof importScripts === 'function';\n\n// Extract node major version\nconst matches =\n typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);\n/** Major Node version (as a number) */\nexport const nodeVersion: number = (matches && parseFloat(matches[1])) || 0;\n"],"mappings":"AAIA,MAAMA,OAAO,GAAG;EACdC,IAAI,EAAE,OAAOA,IAAI,KAAK,WAAW,IAAIA,IAAI;EACzCC,MAAM,EAAE,OAAOA,MAAM,KAAK,WAAW,IAAIA,MAAM;EAC/CC,MAAM,EAAE,OAAOA,MAAM,KAAK,WAAW,IAAIA,MAAM;EAC/CC,QAAQ,EAAE,OAAOA,QAAQ,KAAK,WAAW,IAAIA;AAC/C,CAAC;AAGD,MAAMC,KAAU,GAAGL,OAAO,CAACC,IAAI,IAAID,OAAO,CAACE,MAAM,IAAIF,OAAO,CAACG,MAAM,IAAI,CAAC,CAAC;AACzE,MAAMG,OAAY,GAAGN,OAAO,CAACE,MAAM,IAAIF,OAAO,CAACC,IAAI,IAAID,OAAO,CAACG,MAAM,IAAI,CAAC,CAAC;AAC3E,MAAMI,OAAY,GAAGP,OAAO,CAACG,MAAM,IAAIH,OAAO,CAACC,IAAI,IAAID,OAAO,CAACE,MAAM,IAAI,CAAC,CAAC;AAC3E,MAAMM,SAAc,GAAGR,OAAO,CAACI,QAAQ,IAAI,CAAC,CAAC;AAE7C,SAAQC,KAAK,IAAIJ,IAAI,EAAEK,OAAO,IAAIJ,MAAM,EAAEK,OAAO,IAAIJ,MAAM,EAAEK,SAAS,IAAIJ,QAAQ;AAGlF,OAAO,MAAMK,SAAkB,GAE7BC,OAAO,CAAC,OAAOC,OAAO,KAAK,QAAQ,IAAIC,MAAM,CAACD,OAAO,CAAC,KAAK,kBAAkB,IAAIA,OAAO,CAACE,OAAO,CAAC;AAGnG,OAAO,MAAMC,QAAiB,GAAG,OAAOC,aAAa,KAAK,UAAU;AAGpE,MAAMC,OAAO,GACX,OAAOL,OAAO,KAAK,WAAW,IAAIA,OAAO,CAACM,OAAO,IAAI,WAAW,CAACC,IAAI,CAACP,OAAO,CAACM,OAAO,CAAC;AAExF,OAAO,MAAME,WAAmB,GAAIH,OAAO,IAAII,UAAU,CAACJ,OAAO,CAAC,CAAC,CAAC,CAAC,IAAK,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-view-file.js","names":["toNumber","bigint","Number","MAX_SAFE_INTEGER","Error","DataViewFile","constructor","file","_defineProperty","destroy","getUint8","offset","getUint16","getUint32","getBigUint64","slice","startOffset","endOffset","buffer","length","BigInt","byteLength"],"sources":["../../../../src/lib/file-provider/data-view-file.ts"],"sourcesContent":["import {FileProvider} from './file-provider';\n\n/**\n * Checks if bigint can be converted to number and convert it if possible\n * @param bigint bigint to be converted\n * @returns number\n */\nconst toNumber = (bigint: bigint) => {\n if (bigint > Number.MAX_SAFE_INTEGER) {\n throw new Error('Offset is out of bounds');\n }\n return Number(bigint);\n};\n\n/** Provides file data using DataView */\nexport class DataViewFile implements FileProvider {\n /** The DataView from which data is provided */\n private file: DataView;\n\n constructor(file: DataView) {\n this.file = file;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n async destroy(): Promise<void> {}\n\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint8(offset: bigint): Promise<number> {\n return this.file.getUint8(toNumber(offset));\n }\n\n /**\n * Gets an unsigned 16-bit intege at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint16(offset: bigint): Promise<number> {\n return this.file.getUint16(toNumber(offset), true);\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint32(offset: bigint): Promise<number> {\n return this.file.getUint32(toNumber(offset), true);\n }\n\n /**\n * Gets an unsigned 64-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getBigUint64(offset: bigint): Promise<bigint> {\n return this.file.getBigUint64(toNumber(offset), true);\n }\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffset The offset, in bytes, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n async slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer> {\n return this.file.buffer.slice(toNumber(startOffset), toNumber(endOffset));\n }\n\n /** the length (in bytes) of the data. */\n get length() {\n return BigInt(this.file.byteLength);\n }\n}\n"],"mappings":";AAOA,MAAMA,QAAQ,GAAIC,MAAc,IAAK;EACnC,IAAIA,MAAM,GAAGC,MAAM,CAACC,gBAAgB,EAAE;IACpC,MAAM,IAAIC,KAAK,CAAC,yBAAyB,CAAC;EAC5C;EACA,OAAOF,MAAM,CAACD,MAAM,CAAC;AACvB,CAAC;AAGD,OAAO,MAAMI,YAAY,CAAyB;EAIhDC,WAAWA,CAACC,IAAc,EAAE;IAAAC,eAAA;IAC1B,IAAI,CAACD,IAAI,GAAGA,IAAI;EAClB;EAGA,MAAME,OAAOA,CAAA,EAAkB,CAAC;EAMhC,MAAMC,QAAQA,CAACC,MAAc,EAAmB;IAC9C,OAAO,IAAI,CAACJ,IAAI,CAACG,QAAQ,CAACV,QAAQ,CAACW,MAAM,CAAC,CAAC;EAC7C;EAMA,MAAMC,SAASA,CAACD,MAAc,EAAmB;IAC/C,OAAO,IAAI,CAACJ,IAAI,CAACK,SAAS,CAACZ,QAAQ,CAACW,MAAM,CAAC,EAAE,IAAI,CAAC;EACpD;EAMA,MAAME,SAASA,CAACF,MAAc,EAAmB;IAC/C,OAAO,IAAI,CAACJ,IAAI,CAACM,SAAS,CAACb,QAAQ,CAACW,MAAM,CAAC,EAAE,IAAI,CAAC;EACpD;EAMA,MAAMG,YAAYA,CAACH,MAAc,EAAmB;IAClD,OAAO,IAAI,CAACJ,IAAI,CAACO,YAAY,CAACd,QAAQ,CAACW,MAAM,CAAC,EAAE,IAAI,CAAC;EACvD;EAOA,MAAMI,KAAKA,CAACC,WAAmB,EAAEC,SAAiB,EAAwB;IACxE,OAAO,IAAI,CAACV,IAAI,CAACW,MAAM,CAACH,KAAK,CAACf,QAAQ,CAACgB,WAAW,CAAC,EAAEhB,QAAQ,CAACiB,SAAS,CAAC,CAAC;EAC3E;EAGA,IAAIE,MAAMA,CAAA,EAAG;IACX,OAAOC,MAAM,CAAC,IAAI,CAACb,IAAI,CAACc,UAAU,CAAC;EACrC;AACF"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { FileHandle } from './file-handle';
|
|
3
|
-
import { resolvePath } from '../path-utils/file-aliases';
|
|
4
|
-
export class FileHandleFile {
|
|
5
|
-
static async from(path) {
|
|
6
|
-
path = resolvePath(path);
|
|
7
|
-
const fileDescriptor = await FileHandle.open(path);
|
|
8
|
-
return new FileHandleFile(fileDescriptor, fileDescriptor.stat.size);
|
|
9
|
-
}
|
|
10
|
-
constructor(fileDescriptor, size) {
|
|
11
|
-
_defineProperty(this, "fileDescriptor", void 0);
|
|
12
|
-
_defineProperty(this, "size", void 0);
|
|
13
|
-
this.fileDescriptor = fileDescriptor;
|
|
14
|
-
this.size = size;
|
|
15
|
-
}
|
|
16
|
-
async destroy() {
|
|
17
|
-
await this.fileDescriptor.close();
|
|
18
|
-
}
|
|
19
|
-
async getUint8(offset) {
|
|
20
|
-
const val = new Uint8Array((await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer).at(0);
|
|
21
|
-
if (val === undefined) {
|
|
22
|
-
throw new Error('something went wrong');
|
|
23
|
-
}
|
|
24
|
-
return val;
|
|
25
|
-
}
|
|
26
|
-
async getUint16(offset) {
|
|
27
|
-
const val = new Uint16Array((await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer).at(0);
|
|
28
|
-
if (val === undefined) {
|
|
29
|
-
throw new Error('something went wrong');
|
|
30
|
-
}
|
|
31
|
-
return val;
|
|
32
|
-
}
|
|
33
|
-
async getUint32(offset) {
|
|
34
|
-
const val = new Uint32Array((await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer).at(0);
|
|
35
|
-
if (val === undefined) {
|
|
36
|
-
throw new Error('something went wrong');
|
|
37
|
-
}
|
|
38
|
-
return val;
|
|
39
|
-
}
|
|
40
|
-
async getBigUint64(offset) {
|
|
41
|
-
const val = new BigInt64Array((await this.fileDescriptor.read(Buffer.alloc(8), 0, 8, offset)).buffer.buffer).at(0);
|
|
42
|
-
if (val === undefined) {
|
|
43
|
-
throw new Error('something went wrong');
|
|
44
|
-
}
|
|
45
|
-
return val;
|
|
46
|
-
}
|
|
47
|
-
async slice(startOffsset, endOffset) {
|
|
48
|
-
const bigLength = endOffset - startOffsset;
|
|
49
|
-
if (bigLength > Number.MAX_SAFE_INTEGER) {
|
|
50
|
-
throw new Error('too big slice');
|
|
51
|
-
}
|
|
52
|
-
const length = Number(bigLength);
|
|
53
|
-
return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer.buffer;
|
|
54
|
-
}
|
|
55
|
-
get length() {
|
|
56
|
-
return this.size;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=file-handle-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-handle-file.js","names":["FileHandle","resolvePath","FileHandleFile","from","path","fileDescriptor","open","stat","size","constructor","_defineProperty","destroy","close","getUint8","offset","val","Uint8Array","read","Buffer","alloc","buffer","at","undefined","Error","getUint16","Uint16Array","getUint32","Uint32Array","getBigUint64","BigInt64Array","slice","startOffsset","endOffset","bigLength","Number","MAX_SAFE_INTEGER","length"],"sources":["../../../../src/lib/file-provider/file-handle-file.ts"],"sourcesContent":["import {FileProvider} from './file-provider';\nimport {FileHandle} from './file-handle';\nimport {resolvePath} from '../path-utils/file-aliases';\n\n/**\n * Provides file data using node fs library\n */\nexport class FileHandleFile implements FileProvider {\n /**\n * Returns a new copy of FileHandleFile\n * @param path The path to the file in file system\n */\n static async from(path: string): Promise<FileHandleFile> {\n path = resolvePath(path);\n const fileDescriptor = await FileHandle.open(path);\n return new FileHandleFile(fileDescriptor, fileDescriptor.stat.size);\n }\n\n /**\n * The FileHandle from which data is provided\n */\n private fileDescriptor: FileHandle;\n\n /**\n * The file length in bytes\n */\n private size: bigint;\n\n private constructor(fileDescriptor: FileHandle, size: bigint) {\n this.fileDescriptor = fileDescriptor;\n this.size = size;\n }\n\n /** Close file */\n async destroy(): Promise<void> {\n await this.fileDescriptor.close();\n }\n\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint8(offset: bigint): Promise<number> {\n const val = new Uint8Array(\n (await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint16(offset: bigint): Promise<number> {\n const val = new Uint16Array(\n (await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint32(offset: bigint): Promise<number> {\n const val = new Uint32Array(\n (await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getBigUint64(offset: bigint): Promise<bigint> {\n const val = new BigInt64Array(\n (await this.fileDescriptor.read(Buffer.alloc(8), 0, 8, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffsset The offset, in byte, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n async slice(startOffsset: bigint, endOffset: bigint): Promise<ArrayBuffer> {\n const bigLength = endOffset - startOffsset;\n if (bigLength > Number.MAX_SAFE_INTEGER) {\n throw new Error('too big slice');\n }\n const length = Number(bigLength);\n return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer\n .buffer;\n }\n\n /**\n * the length (in bytes) of the data.\n */\n get length(): bigint {\n return this.size;\n }\n}\n"],"mappings":";AACA,SAAQA,UAAU,QAAO,eAAe;AACxC,SAAQC,WAAW,QAAO,4BAA4B;AAKtD,OAAO,MAAMC,cAAc,CAAyB;EAKlD,aAAaC,IAAIA,CAACC,IAAY,EAA2B;IACvDA,IAAI,GAAGH,WAAW,CAACG,IAAI,CAAC;IACxB,MAAMC,cAAc,GAAG,MAAML,UAAU,CAACM,IAAI,CAACF,IAAI,CAAC;IAClD,OAAO,IAAIF,cAAc,CAACG,cAAc,EAAEA,cAAc,CAACE,IAAI,CAACC,IAAI,CAAC;EACrE;EAYQC,WAAWA,CAACJ,cAA0B,EAAEG,IAAY,EAAE;IAAAE,eAAA;IAAAA,eAAA;IAC5D,IAAI,CAACL,cAAc,GAAGA,cAAc;IACpC,IAAI,CAACG,IAAI,GAAGA,IAAI;EAClB;EAGA,MAAMG,OAAOA,CAAA,EAAkB;IAC7B,MAAM,IAAI,CAACN,cAAc,CAACO,KAAK,CAAC,CAAC;EACnC;EAMA,MAAMC,QAAQA,CAACC,MAAc,EAAmB;IAC9C,MAAMC,GAAG,GAAG,IAAIC,UAAU,CACxB,CAAC,MAAM,IAAI,CAACX,cAAc,CAACY,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEL,MAAM,CAAC,EAAEM,MAAM,CAACA,MACzE,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC;IACP,IAAIN,GAAG,KAAKO,SAAS,EAAE;MACrB,MAAM,IAAIC,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOR,GAAG;EACZ;EAMA,MAAMS,SAASA,CAACV,MAAc,EAAmB;IAC/C,MAAMC,GAAG,GAAG,IAAIU,WAAW,CACzB,CAAC,MAAM,IAAI,CAACpB,cAAc,CAACY,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEL,MAAM,CAAC,EAAEM,MAAM,CAACA,MACzE,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC;IACP,IAAIN,GAAG,KAAKO,SAAS,EAAE;MACrB,MAAM,IAAIC,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOR,GAAG;EACZ;EAMA,MAAMW,SAASA,CAACZ,MAAc,EAAmB;IAC/C,MAAMC,GAAG,GAAG,IAAIY,WAAW,CACzB,CAAC,MAAM,IAAI,CAACtB,cAAc,CAACY,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEL,MAAM,CAAC,EAAEM,MAAM,CAACA,MACzE,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC;IACP,IAAIN,GAAG,KAAKO,SAAS,EAAE;MACrB,MAAM,IAAIC,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOR,GAAG;EACZ;EAMA,MAAMa,YAAYA,CAACd,MAAc,EAAmB;IAClD,MAAMC,GAAG,GAAG,IAAIc,aAAa,CAC3B,CAAC,MAAM,IAAI,CAACxB,cAAc,CAACY,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEL,MAAM,CAAC,EAAEM,MAAM,CAACA,MACzE,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC;IACP,IAAIN,GAAG,KAAKO,SAAS,EAAE;MACrB,MAAM,IAAIC,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOR,GAAG;EACZ;EAOA,MAAMe,KAAKA,CAACC,YAAoB,EAAEC,SAAiB,EAAwB;IACzE,MAAMC,SAAS,GAAGD,SAAS,GAAGD,YAAY;IAC1C,IAAIE,SAAS,GAAGC,MAAM,CAACC,gBAAgB,EAAE;MACvC,MAAM,IAAIZ,KAAK,CAAC,eAAe,CAAC;IAClC;IACA,MAAMa,MAAM,GAAGF,MAAM,CAACD,SAAS,CAAC;IAChC,OAAO,CAAC,MAAM,IAAI,CAAC5B,cAAc,CAACY,IAAI,CAACC,MAAM,CAACC,KAAK,CAACiB,MAAM,CAAC,EAAE,CAAC,EAAEA,MAAM,EAAEL,YAAY,CAAC,EAAEX,MAAM,CAC1FA,MAAM;EACX;EAKA,IAAIgB,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAAC5B,IAAI;EAClB;AACF"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import * as fs from '../node/fs';
|
|
3
|
-
export class FileHandle {
|
|
4
|
-
constructor(fileDescriptor, stats) {
|
|
5
|
-
_defineProperty(this, "fileDescriptor", void 0);
|
|
6
|
-
_defineProperty(this, "stats", void 0);
|
|
7
|
-
_defineProperty(this, "read", (buffer, offset, length, position) => {
|
|
8
|
-
return new Promise(s => {
|
|
9
|
-
fs.read(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer) => s({
|
|
10
|
-
bytesRead,
|
|
11
|
-
buffer
|
|
12
|
-
}));
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
this.fileDescriptor = fileDescriptor;
|
|
16
|
-
this.stats = stats;
|
|
17
|
-
}
|
|
18
|
-
static async open(path) {
|
|
19
|
-
const [fd, stats] = await Promise.all([new Promise((resolve, reject) => {
|
|
20
|
-
fs.open(path, undefined, undefined, (_err, fd) => _err ? reject(_err) : resolve(fd));
|
|
21
|
-
}), fs.stat(path, {
|
|
22
|
-
bigint: true
|
|
23
|
-
})]);
|
|
24
|
-
return new FileHandle(fd, stats);
|
|
25
|
-
}
|
|
26
|
-
async close() {
|
|
27
|
-
return fs.close(this.fileDescriptor);
|
|
28
|
-
}
|
|
29
|
-
get stat() {
|
|
30
|
-
return this.stats;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=file-handle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-handle.js","names":["fs","FileHandle","constructor","fileDescriptor","stats","_defineProperty","buffer","offset","length","position","Promise","s","read","_err","bytesRead","open","path","fd","all","resolve","reject","undefined","stat","bigint","close"],"sources":["../../../../src/lib/file-provider/file-handle.ts"],"sourcesContent":["import * as fs from '../node/fs';\n\n/** file reading result */\nexport type FileReadResult = {\n /** amount of the bytes read */\n bytesRead: number;\n /** the buffer filled with data from file*/\n buffer: Buffer;\n};\n\n/** Object handling file info */\nexport class FileHandle {\n private fileDescriptor: number;\n private stats: fs.BigIntStats;\n\n private constructor(fileDescriptor: number, stats: fs.BigIntStats) {\n this.fileDescriptor = fileDescriptor;\n this.stats = stats;\n }\n /**\n * Opens a `FileHandle`.\n *\n * @param path path to the file\n * @return Fulfills with a {FileHandle} object.\n */\n\n static async open(path: string): Promise<FileHandle> {\n const [fd, stats] = await Promise.all([\n new Promise<number>((resolve, reject) => {\n fs.open(path, undefined, undefined, (_err, fd) => (_err ? reject(_err) : resolve(fd)));\n }),\n fs.stat(path, {bigint: true})\n // new Promise<fs.BigIntStats>((resolve, reject) => {\n // console.error(fs.stat)\n // fs.stat(path, {bigint: true}, (_err, stats) => (_err ? reject(_err) : resolve(stats)));\n // console.error(fs.open)\n // })\n ]);\n return new FileHandle(fd, stats);\n }\n\n /** Close file */\n async close(): Promise<void> {\n return fs.close(this.fileDescriptor);\n // return new Promise<void>((resolve) => {\n // // @ts-expect-error\n // fs.close(this.fileDescriptor, (_err) => resolve());\n // });\n }\n\n /**\n * Reads data from the file and stores that in the given buffer.\n *\n * If the file is not modified concurrently, the end-of-file is reached when the\n * number of bytes read is zero.\n * @param buffer A buffer that will be filled with the file data read.\n * @param offset The location in the buffer at which to start filling.\n * @param length The number of bytes to read.\n * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an\n * integer, the current file position will remain unchanged.\n * @return Fulfills upon success with a FileReadResult object\n */\n read = (\n buffer: Buffer,\n offset: number,\n length: number,\n position: number | bigint\n ): Promise<FileReadResult> => {\n return new Promise((s) => {\n fs.read(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer) =>\n s({bytesRead, buffer})\n );\n });\n };\n\n get stat(): fs.BigIntStats {\n return this.stats;\n }\n}\n"],"mappings":";AAAA,OAAO,KAAKA,EAAE,MAAM,YAAY;AAWhC,OAAO,MAAMC,UAAU,CAAC;EAIdC,WAAWA,CAACC,cAAsB,EAAEC,KAAqB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA,eA+C5D,CACLC,MAAc,EACdC,MAAc,EACdC,MAAc,EACdC,QAAyB,KACG;MAC5B,OAAO,IAAIC,OAAO,CAAEC,CAAC,IAAK;QACxBX,EAAE,CAACY,IAAI,CAAC,IAAI,CAACT,cAAc,EAAEG,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,EAAE,CAACI,IAAI,EAAEC,SAAS,EAAER,MAAM,KACrFK,CAAC,CAAC;UAACG,SAAS;UAAER;QAAM,CAAC,CACvB,CAAC;MACH,CAAC,CAAC;IACJ,CAAC;IAzDC,IAAI,CAACH,cAAc,GAAGA,cAAc;IACpC,IAAI,CAACC,KAAK,GAAGA,KAAK;EACpB;EAQA,aAAaW,IAAIA,CAACC,IAAY,EAAuB;IACnD,MAAM,CAACC,EAAE,EAAEb,KAAK,CAAC,GAAG,MAAMM,OAAO,CAACQ,GAAG,CAAC,CACpC,IAAIR,OAAO,CAAS,CAACS,OAAO,EAAEC,MAAM,KAAK;MACvCpB,EAAE,CAACe,IAAI,CAACC,IAAI,EAAEK,SAAS,EAAEA,SAAS,EAAE,CAACR,IAAI,EAAEI,EAAE,KAAMJ,IAAI,GAAGO,MAAM,CAACP,IAAI,CAAC,GAAGM,OAAO,CAACF,EAAE,CAAE,CAAC;IACxF,CAAC,CAAC,EACFjB,EAAE,CAACsB,IAAI,CAACN,IAAI,EAAE;MAACO,MAAM,EAAE;IAAI,CAAC,CAAC,CAM9B,CAAC;IACF,OAAO,IAAItB,UAAU,CAACgB,EAAE,EAAEb,KAAK,CAAC;EAClC;EAGA,MAAMoB,KAAKA,CAAA,EAAkB;IAC3B,OAAOxB,EAAE,CAACwB,KAAK,CAAC,IAAI,CAACrB,cAAc,CAAC;EAKtC;EA2BA,IAAImB,IAAIA,CAAA,EAAmB;IACzB,OAAO,IAAI,CAAClB,KAAK;EACnB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-provider.js","names":["isFileProvider","fileProvider","getUint8","slice","length"],"sources":["../../../../src/lib/file-provider/file-provider.ts"],"sourcesContent":["/**\n * Interface for providing file data\n */\nexport interface FileProvider {\n /**\n * Cleanup class data\n */\n destroy(): Promise<void>;\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint8(offset: bigint): Promise<number>;\n\n /**\n * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint16(offset: bigint): Promise<number>;\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the file of the view where to read the data.\n */\n getUint32(offset: bigint): Promise<number>;\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in byte, from the file of the view where to read the data.\n */\n getBigUint64(offset: bigint): Promise<bigint>;\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffset The offset, in bytes, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer>;\n\n /**\n * the length (in bytes) of the data.\n */\n length: bigint;\n}\n\n/**\n * Check is the object has FileProvider members\n * @param fileProvider - tested object\n */\nexport const isFileProvider = (fileProvider: unknown) => {\n return (\n (fileProvider as FileProvider)?.getUint8 &&\n (fileProvider as FileProvider)?.slice &&\n (fileProvider as FileProvider)?.length\n );\n};\n"],"mappings":"AAiDA,OAAO,MAAMA,cAAc,GAAIC,YAAqB,IAAK;EACvD,OACE,CAACA,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAmBC,QAAQ,MACvCD,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAmBE,KAAK,MACpCF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAmBG,MAAM;AAE1C,CAAC"}
|
|
@@ -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(fd: any, options?: ReadOptions): Promise<{bytesRead: number; buffer: Uint8Array}>;\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\n/**\n * A FileSystem interface can encapsulate a FileList, a ZipFile, a GoogleDrive etc.\n *\nexport interface IFileSystem {\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: string, options?: object): Promise<Response>;\n}\n\ntype ReadOptions = {buffer?: ArrayBuffer; offset?: number; length?: number; position?: number};\nexport interface IRandomAccessReadFileSystem extends IFileSystem {\n open(path: string, flags: string | number, mode?: any): Promise<any>;\n close(fd: any): Promise<void>;\n fstat(fd: any): Promise<object>;\n read(fd: any, options?: ReadOptions): Promise<{bytesRead: number; buffer: Buffer}>;\n}\n*/\n"],"mappings":""}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export class NodeFileSystem {
|
|
2
|
-
constructor(options) {
|
|
3
|
-
var _globalThis$loaders;
|
|
4
|
-
if ((_globalThis$loaders = globalThis.loaders) !== null && _globalThis$loaders !== void 0 && _globalThis$loaders.NodeFileSystem) {
|
|
5
|
-
return new globalThis.loaders.NodeFileSystem(options);
|
|
6
|
-
}
|
|
7
|
-
throw new Error('Can\'t instantiate NodeFileSystem in browser. Make sure to import @loaders.gl/polyfills first.');
|
|
8
|
-
}
|
|
9
|
-
async readdir() {
|
|
10
|
-
let dirname = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.';
|
|
11
|
-
let options = arguments.length > 1 ? arguments[1] : undefined;
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
async stat(path, options) {
|
|
15
|
-
return {
|
|
16
|
-
size: 0,
|
|
17
|
-
isDirectory: () => false
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
async fetch(path, options) {
|
|
21
|
-
return globalThis.fetch(path, options);
|
|
22
|
-
}
|
|
23
|
-
async open(path, flags, mode) {
|
|
24
|
-
return 0;
|
|
25
|
-
}
|
|
26
|
-
async close(fd) {}
|
|
27
|
-
async fstat(fd) {
|
|
28
|
-
return {
|
|
29
|
-
size: 0,
|
|
30
|
-
isDirectory: () => false
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
async read(fd, _ref) {
|
|
34
|
-
let {
|
|
35
|
-
buffer = null,
|
|
36
|
-
offset = 0,
|
|
37
|
-
length = buffer.byteLength,
|
|
38
|
-
position = null
|
|
39
|
-
} = _ref;
|
|
40
|
-
return {
|
|
41
|
-
bytesRead: 0,
|
|
42
|
-
buffer: new Uint8Array(0)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=node-filesystem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-filesystem.js","names":["NodeFileSystem","constructor","options","_globalThis$loaders","globalThis","loaders","Error","readdir","dirname","arguments","length","undefined","stat","path","size","isDirectory","fetch","open","flags","mode","close","fd","fstat","read","_ref","buffer","offset","byteLength","position","bytesRead","Uint8Array"],"sources":["../../../../src/lib/filesystems/node-filesystem.ts"],"sourcesContent":["import * as fs from '../node/fs';\nimport {FileSystem, RandomAccessReadFileSystem} from './filesystem';\n// import {fetchFile} from \"../fetch/fetch-file\"\n// import {selectLoader} from \"../api/select-loader\";\n\ntype Stat = {\n size: number;\n isDirectory: () => boolean;\n info?: fs.Stats;\n};\n\ntype ReadOptions = {\n buffer?: Buffer;\n offset?: number;\n length?: number;\n position?: number;\n};\n\n/**\n * FileSystem pass-through for Node.js\n * Compatible with BrowserFileSystem.\n * @param options\n */\nexport class NodeFileSystem implements FileSystem, RandomAccessReadFileSystem {\n // implements FileSystem\n constructor(options: {[key: string]: any}) {\n if (globalThis.loaders?.NodeFileSystem) {\n return new globalThis.loaders.NodeFileSystem(options);\n }\n throw new Error(\n 'Can\\'t instantiate NodeFileSystem in browser. Make sure to import @loaders.gl/polyfills first.'\n );\n }\n\n async readdir(dirname = '.', options?: {}): Promise<any[]> {\n return [];\n }\n\n async stat(path: string, options?: {}): Promise<Stat> {\n return {size: 0, isDirectory: () => false};\n }\n\n async fetch(path: string, options: {[key: string]: any}) {\n return globalThis.fetch(path, options);\n }\n\n // implements IRandomAccessFileSystem\n\n async open(path: string, flags: string | number, mode?: any): Promise<number> {\n return 0;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n async close(fd: number): Promise<void> {}\n\n async fstat(fd: number): Promise<Stat> {\n return {size: 0, isDirectory: () => false};\n }\n\n async read(\n fd: number,\n // @ts-ignore Possibly null\n {buffer = null, offset = 0, length = buffer.byteLength, position = null}: ReadOptions\n ): Promise<{bytesRead: number; buffer: Uint8Array}> {\n return {bytesRead: 0, buffer: new Uint8Array(0)};\n }\n}\n"],"mappings":"AAuBA,OAAO,MAAMA,cAAc,CAAmD;EAE5EC,WAAWA,CAACC,OAA6B,EAAE;IAAA,IAAAC,mBAAA;IACzC,KAAAA,mBAAA,GAAIC,UAAU,CAACC,OAAO,cAAAF,mBAAA,eAAlBA,mBAAA,CAAoBH,cAAc,EAAE;MACtC,OAAO,IAAII,UAAU,CAACC,OAAO,CAACL,cAAc,CAACE,OAAO,CAAC;IACvD;IACA,MAAM,IAAII,KAAK,CACb,gGACF,CAAC;EACH;EAEA,MAAMC,OAAOA,CAAA,EAA8C;IAAA,IAA7CC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;IAAA,IAAEP,OAAY,GAAAO,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IACvC,OAAO,EAAE;EACX;EAEA,MAAMC,IAAIA,CAACC,IAAY,EAAEX,OAAY,EAAiB;IACpD,OAAO;MAACY,IAAI,EAAE,CAAC;MAAEC,WAAW,EAAEA,CAAA,KAAM;IAAK,CAAC;EAC5C;EAEA,MAAMC,KAAKA,CAACH,IAAY,EAAEX,OAA6B,EAAE;IACvD,OAAOE,UAAU,CAACY,KAAK,CAACH,IAAI,EAAEX,OAAO,CAAC;EACxC;EAIA,MAAMe,IAAIA,CAACJ,IAAY,EAAEK,KAAsB,EAAEC,IAAU,EAAmB;IAC5E,OAAO,CAAC;EACV;EAGA,MAAMC,KAAKA,CAACC,EAAU,EAAiB,CAAC;EAExC,MAAMC,KAAKA,CAACD,EAAU,EAAiB;IACrC,OAAO;MAACP,IAAI,EAAE,CAAC;MAAEC,WAAW,EAAEA,CAAA,KAAM;IAAK,CAAC;EAC5C;EAEA,MAAMQ,IAAIA,CACRF,EAAU,EAAAG,IAAA,EAGwC;IAAA,IADlD;MAACC,MAAM,GAAG,IAAI;MAAEC,MAAM,GAAG,CAAC;MAAEhB,MAAM,GAAGe,MAAM,CAACE,UAAU;MAAEC,QAAQ,GAAG;IAAiB,CAAC,GAAAJ,IAAA;IAErF,OAAO;MAACK,SAAS,EAAE,CAAC;MAAEJ,MAAM,EAAE,IAAIK,UAAU,CAAC,CAAC;IAAC,CAAC;EAClD;AACF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export function makeReadableFile(data) {
|
|
2
|
-
if (data instanceof ArrayBuffer) {
|
|
3
|
-
const arrayBuffer = data;
|
|
4
|
-
return {
|
|
5
|
-
read: async (start, length) => Buffer.from(data, start, length),
|
|
6
|
-
close: async () => {},
|
|
7
|
-
size: arrayBuffer.byteLength
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
const blob = data;
|
|
11
|
-
return {
|
|
12
|
-
read: async (start, length) => {
|
|
13
|
-
const arrayBuffer = await blob.slice(start, start + length).arrayBuffer();
|
|
14
|
-
return Buffer.from(arrayBuffer);
|
|
15
|
-
},
|
|
16
|
-
close: async () => {},
|
|
17
|
-
size: blob.size
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=readable-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readable-file.js","names":["makeReadableFile","data","ArrayBuffer","arrayBuffer","read","start","length","Buffer","from","close","size","byteLength","blob","slice"],"sources":["../../../../src/lib/filesystems/readable-file.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type ReadableFile = {\n read: (position: number, length: number) => Promise<Buffer>;\n close: () => Promise<void>;\n /** Length of file in bytes */\n size: number;\n};\n\n/** Helper function to create an envelope reader for a binary memory input */\nexport function makeReadableFile(data: Blob | ArrayBuffer): ReadableFile {\n if (data instanceof ArrayBuffer) {\n const arrayBuffer: ArrayBuffer = data;\n return {\n read: async (start: number, length: number) => Buffer.from(data, start, length),\n close: async () => {},\n size: arrayBuffer.byteLength\n };\n }\n\n const blob: Blob = data;\n return {\n read: async (start: number, length: number) => {\n const arrayBuffer = await blob.slice(start, start + length).arrayBuffer();\n return Buffer.from(arrayBuffer);\n },\n close: async () => {},\n size: blob.size\n };\n}\n"],"mappings":"AAUA,OAAO,SAASA,gBAAgBA,CAACC,IAAwB,EAAgB;EACvE,IAAIA,IAAI,YAAYC,WAAW,EAAE;IAC/B,MAAMC,WAAwB,GAAGF,IAAI;IACrC,OAAO;MACLG,IAAI,EAAE,MAAAA,CAAOC,KAAa,EAAEC,MAAc,KAAKC,MAAM,CAACC,IAAI,CAACP,IAAI,EAAEI,KAAK,EAAEC,MAAM,CAAC;MAC/EG,KAAK,EAAE,MAAAA,CAAA,KAAY,CAAC,CAAC;MACrBC,IAAI,EAAEP,WAAW,CAACQ;IACpB,CAAC;EACH;EAEA,MAAMC,IAAU,GAAGX,IAAI;EACvB,OAAO;IACLG,IAAI,EAAE,MAAAA,CAAOC,KAAa,EAAEC,MAAc,KAAK;MAC7C,MAAMH,WAAW,GAAG,MAAMS,IAAI,CAACC,KAAK,CAACR,KAAK,EAAEA,KAAK,GAAGC,MAAM,CAAC,CAACH,WAAW,CAAC,CAAC;MACzE,OAAOI,MAAM,CAACC,IAAI,CAACL,WAAW,CAAC;IACjC,CAAC;IACDM,KAAK,EAAE,MAAAA,CAAA,KAAY,CAAC,CAAC;IACrBC,IAAI,EAAEE,IAAI,CAACF;EACb,CAAC;AACH"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { isBrowser } from '../env-utils/globals';
|
|
2
|
-
import * as fs from '../node/fs';
|
|
3
|
-
export function makeWritableFile(pathOrStream, options) {
|
|
4
|
-
if (isBrowser) {
|
|
5
|
-
return {
|
|
6
|
-
write: async () => {},
|
|
7
|
-
close: async () => {}
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
const outputStream = typeof pathOrStream === 'string' ? fs.createWriteStream(pathOrStream, options) : pathOrStream;
|
|
11
|
-
return {
|
|
12
|
-
write: async buffer => new Promise((resolve, reject) => {
|
|
13
|
-
outputStream.write(buffer, err => err ? reject(err) : resolve());
|
|
14
|
-
}),
|
|
15
|
-
close: () => new Promise((resolve, reject) => {
|
|
16
|
-
outputStream.close(err => err ? reject(err) : resolve());
|
|
17
|
-
})
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=writable-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writable-file.js","names":["isBrowser","fs","makeWritableFile","pathOrStream","options","write","close","outputStream","createWriteStream","buffer","Promise","resolve","reject","err"],"sources":["../../../../src/lib/filesystems/writable-file.ts"],"sourcesContent":["// Forked from https://github.com/kbajalc/parquets under MIT license (Copyright (c) 2017 ironSource Ltd.)\nimport {isBrowser} from '../env-utils/globals';\nimport * as fs from '../node/fs';\nimport type {Writable} from 'stream';\n\nexport type WritableFile = {\n write: (buf: Buffer) => Promise<void>;\n close: () => Promise<void>;\n};\n\nexport interface WriteStreamOptions {\n flags?: string;\n encoding?: 'utf8';\n fd?: number;\n mode?: number;\n autoClose?: boolean;\n start?: number;\n}\n\n/** Helper function to create an envelope reader for a binary memory input */\nexport function makeWritableFile(\n pathOrStream: string | Writable,\n options?: WriteStreamOptions\n): WritableFile {\n if (isBrowser) {\n return {\n write: async () => {},\n close: async () => {}\n };\n }\n\n const outputStream: Writable =\n typeof pathOrStream === 'string' ? fs.createWriteStream(pathOrStream, options) : pathOrStream;\n return {\n write: async (buffer: Buffer) =>\n new Promise((resolve, reject) => {\n outputStream.write(buffer, (err) => (err ? reject(err) : resolve()));\n }),\n close: () =>\n new Promise((resolve, reject) => {\n (outputStream as any).close((err) => (err ? reject(err) : resolve()));\n })\n };\n}\n"],"mappings":"AACA,SAAQA,SAAS,QAAO,sBAAsB;AAC9C,OAAO,KAAKC,EAAE,MAAM,YAAY;AAkBhC,OAAO,SAASC,gBAAgBA,CAC9BC,YAA+B,EAC/BC,OAA4B,EACd;EACd,IAAIJ,SAAS,EAAE;IACb,OAAO;MACLK,KAAK,EAAE,MAAAA,CAAA,KAAY,CAAC,CAAC;MACrBC,KAAK,EAAE,MAAAA,CAAA,KAAY,CAAC;IACtB,CAAC;EACH;EAEA,MAAMC,YAAsB,GAC1B,OAAOJ,YAAY,KAAK,QAAQ,GAAGF,EAAE,CAACO,iBAAiB,CAACL,YAAY,EAAEC,OAAO,CAAC,GAAGD,YAAY;EAC/F,OAAO;IACLE,KAAK,EAAE,MAAOI,MAAc,IAC1B,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC/BL,YAAY,CAACF,KAAK,CAACI,MAAM,EAAGI,GAAG,IAAMA,GAAG,GAAGD,MAAM,CAACC,GAAG,CAAC,GAAGF,OAAO,CAAC,CAAE,CAAC;IACtE,CAAC,CAAC;IACJL,KAAK,EAAEA,CAAA,KACL,IAAII,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC9BL,YAAY,CAASD,KAAK,CAAEO,GAAG,IAAMA,GAAG,GAAGD,MAAM,CAACC,GAAG,CAAC,GAAGF,OAAO,CAAC,CAAE,CAAC;IACvE,CAAC;EACL,CAAC;AACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async-iteration.js","names":["concatenateArrayBuffers","forEach","iterator","visitor","done","value","next","return","cancel","concatenateArrayBuffersAsync","asyncIterator","arrayBuffers","chunk","push","concatenateStringsAsync","strings","join"],"sources":["../../../../src/lib/iterators/async-iteration.ts"],"sourcesContent":["import {concatenateArrayBuffers} from '../binary-utils/array-buffer-utils';\n\n// GENERAL UTILITIES\n\n/**\n * Iterate over async iterator, without resetting iterator if end is not reached\n * - forEach intentionally does not reset iterator if exiting loop prematurely\n * so that iteration can continue in a second loop\n * - It is recommended to use a standard for-await as last loop to ensure\n * iterator gets properly reset\n *\n * TODO - optimize using sync iteration if argument is an Iterable?\n *\n * @param iterator\n * @param visitor\n */\nexport async function forEach(iterator, visitor) {\n // eslint-disable-next-line\n while (true) {\n const {done, value} = await iterator.next();\n if (done) {\n iterator.return();\n return;\n }\n const cancel = visitor(value);\n if (cancel) {\n return;\n }\n }\n}\n\n// Breaking big data into iterable chunks, concatenating iterable chunks into big data objects\n\n/**\n * Concatenates all data chunks yielded by an (async) iterator\n * This function can e.g. be used to enable atomic parsers to work on (async) iterator inputs\n */\n\nexport async function concatenateArrayBuffersAsync(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n): Promise<ArrayBuffer> {\n const arrayBuffers: ArrayBuffer[] = [];\n for await (const chunk of asyncIterator) {\n arrayBuffers.push(chunk);\n }\n return concatenateArrayBuffers(...arrayBuffers);\n}\n\nexport async function concatenateStringsAsync(\n asyncIterator: AsyncIterable<string> | Iterable<string>\n): Promise<string> {\n const strings: string[] = [];\n for await (const chunk of asyncIterator) {\n strings.push(chunk);\n }\n return strings.join('');\n}\n"],"mappings":"AAAA,SAAQA,uBAAuB,QAAO,oCAAoC;AAgB1E,OAAO,eAAeC,OAAOA,CAACC,QAAQ,EAAEC,OAAO,EAAE;EAE/C,OAAO,IAAI,EAAE;IACX,MAAM;MAACC,IAAI;MAAEC;IAAK,CAAC,GAAG,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;IAC3C,IAAIF,IAAI,EAAE;MACRF,QAAQ,CAACK,MAAM,CAAC,CAAC;MACjB;IACF;IACA,MAAMC,MAAM,GAAGL,OAAO,CAACE,KAAK,CAAC;IAC7B,IAAIG,MAAM,EAAE;MACV;IACF;EACF;AACF;AASA,OAAO,eAAeC,4BAA4BA,CAChDC,aAAiE,EAC3C;EACtB,MAAMC,YAA2B,GAAG,EAAE;EACtC,WAAW,MAAMC,KAAK,IAAIF,aAAa,EAAE;IACvCC,YAAY,CAACE,IAAI,CAACD,KAAK,CAAC;EAC1B;EACA,OAAOZ,uBAAuB,CAAC,GAAGW,YAAY,CAAC;AACjD;AAEA,OAAO,eAAeG,uBAAuBA,CAC3CJ,aAAuD,EACtC;EACjB,MAAMK,OAAiB,GAAG,EAAE;EAC5B,WAAW,MAAMH,KAAK,IAAIF,aAAa,EAAE;IACvCK,OAAO,CAACF,IAAI,CAACD,KAAK,CAAC;EACrB;EACA,OAAOG,OAAO,CAACC,IAAI,CAAC,EAAE,CAAC;AACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-iterators.js","names":["makeTextDecoderIterator","arrayBufferIterator","options","arguments","length","undefined","textDecoder","TextDecoder","arrayBuffer","decode","stream","e","Promise","reject","makeTextEncoderIterator","textIterator","textEncoder","TextEncoder","text","encode","makeLineIterator","previous","textChunk","eolIndex","indexOf","line","slice","makeNumberedLineIterator","lineIterator","counter"],"sources":["../../../../src/lib/iterators/text-iterators.ts"],"sourcesContent":["// TextDecoder iterators\n// TextDecoder will keep any partial undecoded bytes between calls to `decode`\n\nexport async function* makeTextDecoderIterator(\n arrayBufferIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options: TextDecoderOptions = {}\n): AsyncIterable<string> {\n const textDecoder = new TextDecoder(undefined, options);\n for await (const arrayBuffer of arrayBufferIterator) {\n yield typeof arrayBuffer === 'string'\n ? arrayBuffer\n : textDecoder.decode(arrayBuffer, {stream: true});\n }\n}\n\n// TextEncoder iterator\n// TODO - this is not useful unless min chunk size is given\n// TextEncoder will keep any partial undecoded bytes between calls to `encode`\n// If iterator does not yield strings, assume arrayBuffer and return unencoded\n\nexport async function* makeTextEncoderIterator(\n textIterator: AsyncIterable<string> | Iterable<ArrayBuffer>\n): AsyncIterable<ArrayBuffer> {\n const textEncoder = new TextEncoder();\n for await (const text of textIterator) {\n yield typeof text === 'string' ? textEncoder.encode(text) : text;\n }\n}\n\n/**\n * @param textIterator async iterable yielding strings\n * @returns an async iterable over lines\n * See http://2ality.com/2018/04/async-iter-nodejs.html\n */\n\nexport async function* makeLineIterator(\n textIterator: AsyncIterable<string>\n): AsyncIterable<string> {\n let previous = '';\n for await (const textChunk of textIterator) {\n previous += textChunk;\n let eolIndex;\n while ((eolIndex = previous.indexOf('\\n')) >= 0) {\n // line includes the EOL\n const line = previous.slice(0, eolIndex + 1);\n previous = previous.slice(eolIndex + 1);\n yield line;\n }\n }\n\n if (previous.length > 0) {\n yield previous;\n }\n}\n\n/**\n * @param lineIterator async iterable yielding lines\n * @returns async iterable yielding numbered lines\n *\n * See http://2ality.com/2018/04/async-iter-nodejs.html\n */\nexport async function* makeNumberedLineIterator(\n lineIterator: AsyncIterable<string>\n): AsyncIterable<{counter: number; line: string}> {\n let counter = 1;\n for await (const line of lineIterator) {\n yield {counter, line};\n counter++;\n }\n}\n"],"mappings":"AAGA,OAAO,SAAgBA,uBAAuBA,CAC5CC,mBAAuE;EAAA;IAAA,IACvEC,OAA2B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAA,0BACT;MACvB,MAAMG,WAAW,GAAG,IAAIC,WAAW,CAACF,SAAS,EAAEH,OAAO,CAAC;MACvD,WAAW,MAAMM,WAAW,IAAIP,mBAAmB,EAAE;QACnD,MAAM,OAAOO,WAAW,KAAK,QAAQ,GACjCA,WAAW,GACXF,WAAW,CAACG,MAAM,CAACD,WAAW,EAAE;UAACE,MAAM,EAAE;QAAI,CAAC,CAAC;MACrD;IACF,CAAC;EAAA,SAAAC,CAAA;IAAA,OAAAC,OAAA,CAAAC,MAAA,CAAAF,CAAA;EAAA;AAAA;AAOD,OAAO,gBAAgBG,uBAAuBA,CAC5CC,YAA2D,EAC/B;EAC5B,MAAMC,WAAW,GAAG,IAAIC,WAAW,CAAC,CAAC;EACrC,WAAW,MAAMC,IAAI,IAAIH,YAAY,EAAE;IACrC,MAAM,OAAOG,IAAI,KAAK,QAAQ,GAAGF,WAAW,CAACG,MAAM,CAACD,IAAI,CAAC,GAAGA,IAAI;EAClE;AACF;AAQA,OAAO,gBAAgBE,gBAAgBA,CACrCL,YAAmC,EACZ;EACvB,IAAIM,QAAQ,GAAG,EAAE;EACjB,WAAW,MAAMC,SAAS,IAAIP,YAAY,EAAE;IAC1CM,QAAQ,IAAIC,SAAS;IACrB,IAAIC,QAAQ;IACZ,OAAO,CAACA,QAAQ,GAAGF,QAAQ,CAACG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;MAE/C,MAAMC,IAAI,GAAGJ,QAAQ,CAACK,KAAK,CAAC,CAAC,EAAEH,QAAQ,GAAG,CAAC,CAAC;MAC5CF,QAAQ,GAAGA,QAAQ,CAACK,KAAK,CAACH,QAAQ,GAAG,CAAC,CAAC;MACvC,MAAME,IAAI;IACZ;EACF;EAEA,IAAIJ,QAAQ,CAACjB,MAAM,GAAG,CAAC,EAAE;IACvB,MAAMiB,QAAQ;EAChB;AACF;AAQA,OAAO,gBAAgBM,wBAAwBA,CAC7CC,YAAmC,EACa;EAChD,IAAIC,OAAO,GAAG,CAAC;EACf,WAAW,MAAMJ,IAAI,IAAIG,YAAY,EAAE;IACrC,MAAM;MAACC,OAAO;MAAEJ;IAAI,CAAC;IACrBI,OAAO,EAAE;EACX;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.browser.js","names":["toArrayBuffer","buffer","toBuffer","binaryData","Error"],"sources":["../../../../src/lib/node/buffer.browser.ts"],"sourcesContent":["// loaders.gl, MIT license\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 return buffer;\n}\n\n/**\n * Convert (copy) ArrayBuffer to Buffer\n */\nexport function toBuffer(binaryData: ArrayBuffer | ArrayBuffer | Buffer): Buffer {\n throw new Error('Buffer not supported in browser');\n}\n"],"mappings":"AAUA,OAAO,SAASA,aAAaA,CAACC,MAAM,EAAE;EACpC,OAAOA,MAAM;AACf;AAKA,OAAO,SAASC,QAAQA,CAACC,UAA8C,EAAU;EAC/E,MAAM,IAAIC,KAAK,CAAC,iCAAiC,CAAC;AACpD"}
|
|
@@ -1 +0,0 @@
|
|
|
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\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 | 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":"AAUA,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,UAA8C,EAAU;EAC/E,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs.browser.js","names":["isSupported"],"sources":["../../../../src/lib/node/fs.browser.ts"],"sourcesContent":["export const isSupported = false;\n"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG,KAAK"}
|
package/dist/esm/lib/node/fs.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as fsPromises from 'fs/promises';
|
|
3
|
-
import { toArrayBuffer } from './buffer';
|
|
4
|
-
import { promisify2, promisify3 } from './promisify';
|
|
5
|
-
export const readdir = promisify2(fs.readdir);
|
|
6
|
-
export const stat = fsPromises.stat;
|
|
7
|
-
export const statSync = fs.statSync;
|
|
8
|
-
export const readFile = fs.readFile;
|
|
9
|
-
export const readFileSync = fs.readFileSync;
|
|
10
|
-
export const writeFile = promisify3(fs.writeFile);
|
|
11
|
-
export const writeFileSync = fs.writeFileSync;
|
|
12
|
-
export const open = fs.open;
|
|
13
|
-
export const close = fd => new Promise((resolve, reject) => fs.close(fd, err => err ? reject(err) : resolve()));
|
|
14
|
-
export const read = fs.read;
|
|
15
|
-
export const fstat = fs.fstat;
|
|
16
|
-
export const createReadStream = fs.createReadStream;
|
|
17
|
-
export const createWriteStream = fs.createWriteStream;
|
|
18
|
-
export const isSupported = Boolean(fs);
|
|
19
|
-
export async function _readToArrayBuffer(fd, start, length) {
|
|
20
|
-
const buffer = Buffer.alloc(length);
|
|
21
|
-
const {
|
|
22
|
-
bytesRead
|
|
23
|
-
} = await read(fd, buffer, 0, length, start);
|
|
24
|
-
if (bytesRead !== length) {
|
|
25
|
-
throw new Error('fs.read failed');
|
|
26
|
-
}
|
|
27
|
-
return toArrayBuffer(buffer);
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=fs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","names":["fs","fsPromises","toArrayBuffer","promisify2","promisify3","readdir","stat","statSync","readFile","readFileSync","writeFile","writeFileSync","open","close","fd","Promise","resolve","reject","err","read","fstat","createReadStream","createWriteStream","isSupported","Boolean","_readToArrayBuffer","start","length","buffer","Buffer","alloc","bytesRead","Error"],"sources":["../../../../src/lib/node/fs.ts"],"sourcesContent":["// fs wrapper (promisified fs + avoids bundling fs in browsers)\nimport * as fs from 'fs';\nimport * as fsPromises from 'fs/promises';\nimport {toArrayBuffer} from './buffer';\nimport {promisify2, promisify3} from './promisify';\n\nexport type {BigIntStats, Stats} from 'fs';\nexport type {ReadStream, WriteStream} from 'fs';\n\n/** Wrapper for Node.js fs method */\nexport const readdir: any = promisify2(fs.readdir);\n/** Wrapper for Node.js fs method */\nexport const stat: any = fsPromises.stat;\nexport const statSync = fs.statSync;\n\n/** Wrapper for Node.js fs method */\nexport const readFile: any = fs.readFile;\n/** Wrapper for Node.js fs method */\nexport const readFileSync = fs.readFileSync;\n/** Wrapper for Node.js fs method */\nexport const writeFile: any = promisify3(fs.writeFile);\n/** Wrapper for Node.js fs method */\nexport const writeFileSync = fs.writeFileSync;\n\n// file descriptors\n\n/** Wrapper for Node.js fs method */\nexport const open: any = fs.open;\n/** Wrapper for Node.js fs method */\nexport const close = (fd: number) =>\n new Promise<void>((resolve, reject) => fs.close(fd, (err) => (err ? reject(err) : resolve())));\n/** Wrapper for Node.js fs method */\nexport const read: any = fs.read;\n/** Wrapper for Node.js fs method */\nexport const fstat: any = fs.fstat;\n\nexport const createReadStream = fs.createReadStream;\nexport const createWriteStream = fs.createWriteStream;\n\nexport const isSupported = Boolean(fs);\n\nexport async function _readToArrayBuffer(fd: number, start: number, length: number) {\n const buffer = Buffer.alloc(length);\n const {bytesRead} = await read(fd, buffer, 0, length, start);\n if (bytesRead !== length) {\n throw new Error('fs.read failed');\n }\n return toArrayBuffer(buffer);\n}\n"],"mappings":"AACA,OAAO,KAAKA,EAAE,MAAM,IAAI;AACxB,OAAO,KAAKC,UAAU,MAAM,aAAa;AACzC,SAAQC,aAAa,QAAO,UAAU;AACtC,SAAQC,UAAU,EAAEC,UAAU,QAAO,aAAa;AAMlD,OAAO,MAAMC,OAAY,GAAGF,UAAU,CAACH,EAAE,CAACK,OAAO,CAAC;AAElD,OAAO,MAAMC,IAAS,GAAGL,UAAU,CAACK,IAAI;AACxC,OAAO,MAAMC,QAAQ,GAAGP,EAAE,CAACO,QAAQ;AAGnC,OAAO,MAAMC,QAAa,GAAGR,EAAE,CAACQ,QAAQ;AAExC,OAAO,MAAMC,YAAY,GAAGT,EAAE,CAACS,YAAY;AAE3C,OAAO,MAAMC,SAAc,GAAGN,UAAU,CAACJ,EAAE,CAACU,SAAS,CAAC;AAEtD,OAAO,MAAMC,aAAa,GAAGX,EAAE,CAACW,aAAa;AAK7C,OAAO,MAAMC,IAAS,GAAGZ,EAAE,CAACY,IAAI;AAEhC,OAAO,MAAMC,KAAK,GAAIC,EAAU,IAC9B,IAAIC,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAKjB,EAAE,CAACa,KAAK,CAACC,EAAE,EAAGI,GAAG,IAAMA,GAAG,GAAGD,MAAM,CAACC,GAAG,CAAC,GAAGF,OAAO,CAAC,CAAE,CAAC,CAAC;AAEhG,OAAO,MAAMG,IAAS,GAAGnB,EAAE,CAACmB,IAAI;AAEhC,OAAO,MAAMC,KAAU,GAAGpB,EAAE,CAACoB,KAAK;AAElC,OAAO,MAAMC,gBAAgB,GAAGrB,EAAE,CAACqB,gBAAgB;AACnD,OAAO,MAAMC,iBAAiB,GAAGtB,EAAE,CAACsB,iBAAiB;AAErD,OAAO,MAAMC,WAAW,GAAGC,OAAO,CAACxB,EAAE,CAAC;AAEtC,OAAO,eAAeyB,kBAAkBA,CAACX,EAAU,EAAEY,KAAa,EAAEC,MAAc,EAAE;EAClF,MAAMC,MAAM,GAAGC,MAAM,CAACC,KAAK,CAACH,MAAM,CAAC;EACnC,MAAM;IAACI;EAAS,CAAC,GAAG,MAAMZ,IAAI,CAACL,EAAE,EAAEc,MAAM,EAAE,CAAC,EAAED,MAAM,EAAED,KAAK,CAAC;EAC5D,IAAIK,SAAS,KAAKJ,MAAM,EAAE;IACxB,MAAM,IAAIK,KAAK,CAAC,gBAAgB,CAAC;EACnC;EACA,OAAO9B,aAAa,CAAC0B,MAAM,CAAC;AAC9B"}
|