@loaders.gl/core 4.4.0-alpha.2 → 4.4.0-alpha.9
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/README.md +4 -0
- package/dist/core-addons/write-file-browser.js +1 -0
- package/dist/core-addons/write-file-browser.js.map +1 -0
- package/dist/dist.dev.js +368 -146
- package/dist/dist.min.js +3 -3
- package/dist/index.cjs +339 -227
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -0
- package/dist/iterators/batch-iterators/timed-batch-iterator.js +1 -0
- package/dist/iterators/batch-iterators/timed-batch-iterator.js.map +1 -0
- package/dist/iterators/make-iterator/make-array-buffer-iterator.js +1 -0
- package/dist/iterators/make-iterator/make-array-buffer-iterator.js.map +1 -0
- package/dist/iterators/make-iterator/make-blob-iterator.js +1 -0
- package/dist/iterators/make-iterator/make-blob-iterator.js.map +1 -0
- package/dist/iterators/make-iterator/make-iterator.d.ts.map +1 -1
- package/dist/iterators/make-iterator/make-iterator.js +7 -3
- package/dist/iterators/make-iterator/make-iterator.js.map +1 -0
- package/dist/iterators/make-iterator/make-stream-iterator.js +1 -0
- package/dist/iterators/make-iterator/make-stream-iterator.js.map +1 -0
- package/dist/iterators/make-iterator/make-string-iterator.d.ts.map +1 -1
- package/dist/iterators/make-iterator/make-string-iterator.js +3 -1
- package/dist/iterators/make-iterator/make-string-iterator.js.map +1 -0
- package/dist/iterators/make-stream/make-stream.js +1 -0
- package/dist/iterators/make-stream/make-stream.js.map +1 -0
- package/dist/lib/api/create-data-source.js +1 -0
- package/dist/lib/api/create-data-source.js.map +1 -0
- package/dist/lib/api/encode-table.d.ts.map +1 -1
- package/dist/lib/api/encode-table.js +3 -2
- package/dist/lib/api/encode-table.js.map +1 -0
- package/dist/lib/api/encode.d.ts.map +1 -1
- package/dist/lib/api/encode.js +3 -2
- package/dist/lib/api/encode.js.map +1 -0
- package/dist/lib/api/load-in-batches.js +1 -0
- package/dist/lib/api/load-in-batches.js.map +1 -0
- package/dist/lib/api/load.js +2 -1
- package/dist/lib/api/load.js.map +1 -0
- package/dist/lib/api/loader-options.js +1 -0
- package/dist/lib/api/loader-options.js.map +1 -0
- package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
- package/dist/lib/api/parse-in-batches.js +7 -6
- package/dist/lib/api/parse-in-batches.js.map +1 -0
- package/dist/lib/api/parse-sync.d.ts.map +1 -1
- package/dist/lib/api/parse-sync.js +4 -3
- package/dist/lib/api/parse-sync.js.map +1 -0
- package/dist/lib/api/parse.d.ts.map +1 -1
- package/dist/lib/api/parse.js +8 -9
- package/dist/lib/api/parse.js.map +1 -0
- package/dist/lib/api/register-loaders.js +1 -0
- package/dist/lib/api/register-loaders.js.map +1 -0
- package/dist/lib/api/select-loader.d.ts +3 -3
- package/dist/lib/api/select-loader.d.ts.map +1 -1
- package/dist/lib/api/select-loader.js +20 -15
- package/dist/lib/api/select-loader.js.map +1 -0
- package/dist/lib/api/select-source.js +1 -0
- package/dist/lib/api/select-source.js.map +1 -0
- package/dist/lib/common.js +1 -0
- package/dist/lib/common.js.map +1 -0
- package/dist/lib/fetch/fetch-error-message.js +1 -0
- package/dist/lib/fetch/fetch-error-message.js.map +1 -0
- package/dist/lib/fetch/fetch-error.js +1 -0
- package/dist/lib/fetch/fetch-error.js.map +1 -0
- package/dist/lib/fetch/fetch-file.js +1 -0
- package/dist/lib/fetch/fetch-file.js.map +1 -0
- package/dist/lib/fetch/read-array-buffer.js +1 -0
- package/dist/lib/fetch/read-array-buffer.js.map +1 -0
- package/dist/lib/filesystems/browser-filesystem.js +1 -0
- package/dist/lib/filesystems/browser-filesystem.js.map +1 -0
- package/dist/lib/filesystems/read-array-buffer.js +1 -0
- package/dist/lib/filesystems/read-array-buffer.js.map +1 -0
- package/dist/lib/init.js +2 -1
- package/dist/lib/init.js.map +1 -0
- package/dist/lib/loader-utils/check-errors.js +1 -0
- package/dist/lib/loader-utils/check-errors.js.map +1 -0
- package/dist/lib/loader-utils/get-data.d.ts +18 -1
- package/dist/lib/loader-utils/get-data.d.ts.map +1 -1
- package/dist/lib/loader-utils/get-data.js +47 -38
- package/dist/lib/loader-utils/get-data.js.map +1 -0
- package/dist/lib/loader-utils/get-fetch-function.d.ts.map +1 -1
- package/dist/lib/loader-utils/get-fetch-function.js +7 -5
- package/dist/lib/loader-utils/get-fetch-function.js.map +1 -0
- package/dist/lib/loader-utils/loader-context.d.ts +2 -2
- package/dist/lib/loader-utils/loader-context.d.ts.map +1 -1
- package/dist/lib/loader-utils/loader-context.js +1 -0
- package/dist/lib/loader-utils/loader-context.js.map +1 -0
- package/dist/lib/loader-utils/loggers.js +1 -0
- package/dist/lib/loader-utils/loggers.js.map +1 -0
- package/dist/lib/loader-utils/normalize-loader.js +1 -0
- package/dist/lib/loader-utils/normalize-loader.js.map +1 -0
- package/dist/lib/loader-utils/option-defaults.d.ts +22 -0
- package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -1
- package/dist/lib/loader-utils/option-defaults.js +50 -20
- package/dist/lib/loader-utils/option-defaults.js.map +1 -0
- package/dist/lib/loader-utils/option-utils.d.ts +9 -3
- package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
- package/dist/lib/loader-utils/option-utils.js +108 -13
- package/dist/lib/loader-utils/option-utils.js.map +1 -0
- package/dist/lib/progress/fetch-progress.js +1 -0
- package/dist/lib/progress/fetch-progress.js.map +1 -0
- package/dist/lib/utils/mime-type-utils.js +1 -0
- package/dist/lib/utils/mime-type-utils.js.map +1 -0
- package/dist/lib/utils/resource-utils.d.ts.map +1 -1
- package/dist/lib/utils/resource-utils.js +8 -10
- package/dist/lib/utils/resource-utils.js.map +1 -0
- package/dist/lib/utils/response-utils.js +2 -1
- package/dist/lib/utils/response-utils.js.map +1 -0
- package/dist/lib/utils/url-utils.js +1 -0
- package/dist/lib/utils/url-utils.js.map +1 -0
- package/dist/null-loader.d.ts +3 -3
- package/dist/null-loader.d.ts.map +1 -1
- package/dist/null-loader.js +2 -1
- package/dist/null-loader.js.map +1 -0
- package/dist/null-worker-node.js +5 -2
- package/dist/null-worker.js +5 -2
- package/dist/workers/null-worker-node.js +1 -0
- package/dist/workers/null-worker-node.js.map +1 -0
- package/dist/workers/null-worker.js +1 -0
- package/dist/workers/null-worker.js.map +1 -0
- package/package.json +12 -6
- package/src/index.ts +1 -1
- package/src/iterators/make-iterator/make-iterator.ts +8 -5
- package/src/iterators/make-iterator/make-string-iterator.ts +2 -1
- package/src/lib/api/encode-table.ts +2 -1
- package/src/lib/api/encode.ts +8 -2
- package/src/lib/api/load.ts +1 -1
- package/src/lib/api/parse-in-batches.ts +26 -19
- package/src/lib/api/parse-sync.ts +6 -5
- package/src/lib/api/parse.ts +15 -11
- package/src/lib/api/select-loader.ts +42 -24
- package/src/lib/loader-utils/get-data.ts +62 -48
- package/src/lib/loader-utils/get-fetch-function.ts +6 -5
- package/src/lib/loader-utils/loader-context.ts +2 -2
- package/src/lib/loader-utils/option-defaults.ts +54 -22
- package/src/lib/loader-utils/option-utils.ts +125 -19
- package/src/lib/utils/resource-utils.ts +9 -12
- package/src/lib/utils/response-utils.ts +2 -2
- package/src/null-loader.ts +6 -3
- package/dist/javascript-utils/is-type.d.ts +0 -21
- package/dist/javascript-utils/is-type.d.ts.map +0 -1
- package/dist/javascript-utils/is-type.js +0 -25
- package/src/javascript-utils/is-type.ts +0 -51
package/dist/index.cjs
CHANGED
|
@@ -21,18 +21,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var dist_exports = {};
|
|
22
22
|
__export(dist_exports, {
|
|
23
23
|
FetchError: () => FetchError,
|
|
24
|
-
JSONLoader: () =>
|
|
24
|
+
JSONLoader: () => import_loader_utils22.JSONLoader,
|
|
25
25
|
NullLoader: () => NullLoader,
|
|
26
26
|
NullWorkerLoader: () => NullWorkerLoader,
|
|
27
|
-
RequestScheduler: () =>
|
|
27
|
+
RequestScheduler: () => import_loader_utils21.RequestScheduler,
|
|
28
28
|
_BrowserFileSystem: () => BrowserFileSystem,
|
|
29
29
|
_fetchProgress: () => fetchProgress,
|
|
30
30
|
_selectSource: () => selectSource2,
|
|
31
31
|
_unregisterLoaders: () => _unregisterLoaders,
|
|
32
|
-
assert: () =>
|
|
33
|
-
concatenateArrayBuffersAsync: () =>
|
|
32
|
+
assert: () => import_loader_utils24.assert,
|
|
33
|
+
concatenateArrayBuffersAsync: () => import_loader_utils25.concatenateArrayBuffersAsync,
|
|
34
34
|
createDataSource: () => createDataSource,
|
|
35
|
-
document: () =>
|
|
35
|
+
document: () => import_loader_utils23.document,
|
|
36
36
|
encode: () => encode,
|
|
37
37
|
encodeInBatches: () => encodeInBatches,
|
|
38
38
|
encodeSync: () => encodeSync,
|
|
@@ -43,64 +43,48 @@ __export(dist_exports, {
|
|
|
43
43
|
encodeTextSync: () => encodeTextSync,
|
|
44
44
|
encodeURLtoURL: () => encodeURLtoURL,
|
|
45
45
|
fetchFile: () => fetchFile,
|
|
46
|
-
forEach: () =>
|
|
46
|
+
forEach: () => import_loader_utils25.forEach,
|
|
47
47
|
getLoaderOptions: () => getGlobalLoaderOptions,
|
|
48
|
-
getPathPrefix: () =>
|
|
49
|
-
global: () =>
|
|
50
|
-
isAsyncIterable: () => isAsyncIterable,
|
|
51
|
-
isBrowser: () =>
|
|
52
|
-
isIterable: () => isIterable,
|
|
53
|
-
isIterator: () => isIterator,
|
|
54
|
-
isPromise: () => isPromise,
|
|
55
|
-
isPureObject: () => isPureObject,
|
|
56
|
-
isReadableStream: () => isReadableStream,
|
|
57
|
-
isResponse: () => isResponse,
|
|
58
|
-
isWorker: () =>
|
|
59
|
-
isWritableStream: () => isWritableStream,
|
|
48
|
+
getPathPrefix: () => import_loader_utils20.getPathPrefix,
|
|
49
|
+
global: () => import_loader_utils23.global,
|
|
50
|
+
isAsyncIterable: () => import_loader_utils27.isAsyncIterable,
|
|
51
|
+
isBrowser: () => import_loader_utils23.isBrowser,
|
|
52
|
+
isIterable: () => import_loader_utils27.isIterable,
|
|
53
|
+
isIterator: () => import_loader_utils27.isIterator,
|
|
54
|
+
isPromise: () => import_loader_utils27.isPromise,
|
|
55
|
+
isPureObject: () => import_loader_utils27.isPureObject,
|
|
56
|
+
isReadableStream: () => import_loader_utils27.isReadableStream,
|
|
57
|
+
isResponse: () => import_loader_utils27.isResponse,
|
|
58
|
+
isWorker: () => import_loader_utils23.isWorker,
|
|
59
|
+
isWritableStream: () => import_loader_utils27.isWritableStream,
|
|
60
60
|
load: () => load,
|
|
61
61
|
loadInBatches: () => loadInBatches,
|
|
62
62
|
makeIterator: () => makeIterator,
|
|
63
|
-
makeLineIterator: () =>
|
|
64
|
-
makeNumberedLineIterator: () =>
|
|
63
|
+
makeLineIterator: () => import_loader_utils26.makeLineIterator,
|
|
64
|
+
makeNumberedLineIterator: () => import_loader_utils26.makeNumberedLineIterator,
|
|
65
65
|
makeStream: () => makeStream,
|
|
66
|
-
makeTextDecoderIterator: () =>
|
|
67
|
-
makeTextEncoderIterator: () =>
|
|
66
|
+
makeTextDecoderIterator: () => import_loader_utils26.makeTextDecoderIterator,
|
|
67
|
+
makeTextEncoderIterator: () => import_loader_utils26.makeTextEncoderIterator,
|
|
68
68
|
parse: () => parse,
|
|
69
69
|
parseInBatches: () => parseInBatches,
|
|
70
70
|
parseSync: () => parseSync,
|
|
71
71
|
readArrayBuffer: () => readArrayBuffer,
|
|
72
72
|
registerLoaders: () => registerLoaders,
|
|
73
|
-
resolvePath: () =>
|
|
73
|
+
resolvePath: () => import_loader_utils20.resolvePath,
|
|
74
74
|
selectLoader: () => selectLoader,
|
|
75
75
|
selectLoaderSync: () => selectLoaderSync,
|
|
76
|
-
self: () =>
|
|
76
|
+
self: () => import_loader_utils23.self,
|
|
77
77
|
setLoaderOptions: () => setGlobalOptions,
|
|
78
|
-
setPathPrefix: () =>
|
|
79
|
-
window: () =>
|
|
78
|
+
setPathPrefix: () => import_loader_utils20.setPathPrefix,
|
|
79
|
+
window: () => import_loader_utils23.window
|
|
80
80
|
});
|
|
81
81
|
module.exports = __toCommonJS(dist_exports);
|
|
82
82
|
|
|
83
83
|
// dist/lib/fetch/fetch-file.js
|
|
84
|
-
var
|
|
84
|
+
var import_loader_utils3 = require("@loaders.gl/loader-utils");
|
|
85
85
|
|
|
86
|
-
// dist/
|
|
87
|
-
var
|
|
88
|
-
var isFunction = (x) => typeof x === "function";
|
|
89
|
-
var isObject = (x) => x !== null && typeof x === "object";
|
|
90
|
-
var isPureObject = (x) => isObject(x) && x.constructor === {}.constructor;
|
|
91
|
-
var isPromise = (x) => isObject(x) && isFunction(x.then);
|
|
92
|
-
var isIterable = (x) => Boolean(x) && typeof x[Symbol.iterator] === "function";
|
|
93
|
-
var isAsyncIterable = (x) => x && typeof x[Symbol.asyncIterator] === "function";
|
|
94
|
-
var isIterator = (x) => x && isFunction(x.next);
|
|
95
|
-
var isResponse = (x) => typeof Response !== "undefined" && x instanceof Response || x && x.arrayBuffer && x.text && x.json;
|
|
96
|
-
var isBlob = (x) => typeof Blob !== "undefined" && x instanceof Blob;
|
|
97
|
-
var isBuffer = (x) => x && typeof x === "object" && x.isBuffer;
|
|
98
|
-
var isWritableDOMStream = (x) => isObject(x) && isFunction(x.abort) && isFunction(x.getWriter);
|
|
99
|
-
var isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject(x) && isFunction(x.tee) && isFunction(x.cancel) && isFunction(x.getReader);
|
|
100
|
-
var isWritableNodeStream = (x) => isObject(x) && isFunction(x.end) && isFunction(x.write) && isBoolean(x.writable);
|
|
101
|
-
var isReadableNodeStream = (x) => isObject(x) && isFunction(x.read) && isFunction(x.pipe) && isBoolean(x.readable);
|
|
102
|
-
var isReadableStream = (x) => isReadableDOMStream(x) || isReadableNodeStream(x);
|
|
103
|
-
var isWritableStream = (x) => isWritableDOMStream(x) || isWritableNodeStream(x);
|
|
86
|
+
// dist/lib/utils/response-utils.js
|
|
87
|
+
var import_loader_utils2 = require("@loaders.gl/loader-utils");
|
|
104
88
|
|
|
105
89
|
// dist/lib/fetch/fetch-error.js
|
|
106
90
|
var FetchError = class extends Error {
|
|
@@ -118,6 +102,9 @@ var FetchError = class extends Error {
|
|
|
118
102
|
response;
|
|
119
103
|
};
|
|
120
104
|
|
|
105
|
+
// dist/lib/utils/resource-utils.js
|
|
106
|
+
var import_loader_utils = require("@loaders.gl/loader-utils");
|
|
107
|
+
|
|
121
108
|
// dist/lib/utils/mime-type-utils.js
|
|
122
109
|
var DATA_URL_PATTERN = /^data:([-\w.]+\/[-\w.+]+)(;|,)/;
|
|
123
110
|
var MIME_TYPE_PATTERN = /^([-\w.]+\/[-\w.+]+)/;
|
|
@@ -162,13 +149,12 @@ function shortenUrlForDisplay(url) {
|
|
|
162
149
|
|
|
163
150
|
// dist/lib/utils/resource-utils.js
|
|
164
151
|
function getResourceUrl(resource) {
|
|
165
|
-
if (isResponse(resource)) {
|
|
166
|
-
|
|
167
|
-
return response.url;
|
|
152
|
+
if ((0, import_loader_utils.isResponse)(resource)) {
|
|
153
|
+
return resource.url;
|
|
168
154
|
}
|
|
169
|
-
if (isBlob(resource)) {
|
|
170
|
-
const
|
|
171
|
-
return
|
|
155
|
+
if ((0, import_loader_utils.isBlob)(resource)) {
|
|
156
|
+
const fileName = "name" in resource ? resource.name : "";
|
|
157
|
+
return fileName || "";
|
|
172
158
|
}
|
|
173
159
|
if (typeof resource === "string") {
|
|
174
160
|
return resource;
|
|
@@ -176,15 +162,13 @@ function getResourceUrl(resource) {
|
|
|
176
162
|
return "";
|
|
177
163
|
}
|
|
178
164
|
function getResourceMIMEType(resource) {
|
|
179
|
-
if (isResponse(resource)) {
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
const noQueryUrl = stripQueryString(response.url);
|
|
165
|
+
if ((0, import_loader_utils.isResponse)(resource)) {
|
|
166
|
+
const contentTypeHeader = resource.headers.get("content-type") || "";
|
|
167
|
+
const noQueryUrl = stripQueryString(resource.url);
|
|
183
168
|
return parseMIMEType(contentTypeHeader) || parseMIMETypeFromURL(noQueryUrl);
|
|
184
169
|
}
|
|
185
|
-
if (isBlob(resource)) {
|
|
186
|
-
|
|
187
|
-
return blob.type || "";
|
|
170
|
+
if ((0, import_loader_utils.isBlob)(resource)) {
|
|
171
|
+
return resource.type || "";
|
|
188
172
|
}
|
|
189
173
|
if (typeof resource === "string") {
|
|
190
174
|
return parseMIMETypeFromURL(resource);
|
|
@@ -192,11 +176,11 @@ function getResourceMIMEType(resource) {
|
|
|
192
176
|
return "";
|
|
193
177
|
}
|
|
194
178
|
function getResourceContentLength(resource) {
|
|
195
|
-
if (isResponse(resource)) {
|
|
179
|
+
if ((0, import_loader_utils.isResponse)(resource)) {
|
|
196
180
|
const response = resource;
|
|
197
181
|
return response.headers["content-length"] || -1;
|
|
198
182
|
}
|
|
199
|
-
if (isBlob(resource)) {
|
|
183
|
+
if ((0, import_loader_utils.isBlob)(resource)) {
|
|
200
184
|
const blob = resource;
|
|
201
185
|
return blob.size;
|
|
202
186
|
}
|
|
@@ -214,7 +198,7 @@ function getResourceContentLength(resource) {
|
|
|
214
198
|
|
|
215
199
|
// dist/lib/utils/response-utils.js
|
|
216
200
|
async function makeResponse(resource) {
|
|
217
|
-
if (isResponse(resource)) {
|
|
201
|
+
if ((0, import_loader_utils2.isResponse)(resource)) {
|
|
218
202
|
return resource;
|
|
219
203
|
}
|
|
220
204
|
const headers = {};
|
|
@@ -305,7 +289,7 @@ function isDataURL(url) {
|
|
|
305
289
|
async function fetchFile(urlOrData, fetchOptions) {
|
|
306
290
|
var _a, _b;
|
|
307
291
|
if (typeof urlOrData === "string") {
|
|
308
|
-
const url = (0,
|
|
292
|
+
const url = (0, import_loader_utils3.resolvePath)(urlOrData);
|
|
309
293
|
if (isNodePath(url)) {
|
|
310
294
|
if ((_a = globalThis.loaders) == null ? void 0 : _a.fetchNode) {
|
|
311
295
|
return (_b = globalThis.loaders) == null ? void 0 : _b.fetchNode(url, fetchOptions);
|
|
@@ -337,7 +321,7 @@ async function readBlob(blob) {
|
|
|
337
321
|
}
|
|
338
322
|
|
|
339
323
|
// dist/lib/loader-utils/option-utils.js
|
|
340
|
-
var
|
|
324
|
+
var import_loader_utils5 = require("@loaders.gl/loader-utils");
|
|
341
325
|
|
|
342
326
|
// dist/lib/loader-utils/loggers.js
|
|
343
327
|
var import_log = require("@probe.gl/log");
|
|
@@ -380,41 +364,70 @@ var ConsoleLog = class {
|
|
|
380
364
|
};
|
|
381
365
|
|
|
382
366
|
// dist/lib/loader-utils/option-defaults.js
|
|
383
|
-
var
|
|
367
|
+
var import_loader_utils4 = require("@loaders.gl/loader-utils");
|
|
384
368
|
var DEFAULT_LOADER_OPTIONS = {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
369
|
+
core: {
|
|
370
|
+
baseUri: void 0,
|
|
371
|
+
// baseUri
|
|
372
|
+
fetch: null,
|
|
373
|
+
mimeType: void 0,
|
|
374
|
+
fallbackMimeType: void 0,
|
|
375
|
+
ignoreRegisteredLoaders: void 0,
|
|
376
|
+
nothrow: false,
|
|
377
|
+
log: new ConsoleLog(),
|
|
378
|
+
// A probe.gl compatible (`log.log()()` syntax) that just logs to console
|
|
379
|
+
useLocalLibraries: false,
|
|
380
|
+
CDN: "https://unpkg.com/@loaders.gl",
|
|
381
|
+
worker: true,
|
|
382
|
+
// By default, use worker if provided by loader.
|
|
383
|
+
maxConcurrency: 3,
|
|
384
|
+
// How many worker instances should be created for each loader.
|
|
385
|
+
maxMobileConcurrency: 1,
|
|
386
|
+
// How many worker instances should be created for each loader on mobile devices.
|
|
387
|
+
reuseWorkers: import_loader_utils4.isBrowser,
|
|
388
|
+
// By default reuse workers in browser (Node.js refuses to terminate if browsers are running)
|
|
389
|
+
_nodeWorkers: false,
|
|
390
|
+
// By default do not support node workers
|
|
391
|
+
_workerType: "",
|
|
392
|
+
// 'test' to use locally generated workers
|
|
393
|
+
limit: 0,
|
|
394
|
+
_limitMB: 0,
|
|
395
|
+
batchSize: "auto",
|
|
396
|
+
batchDebounceMs: 0,
|
|
397
|
+
metadata: false,
|
|
398
|
+
// TODO - currently only implemented for parseInBatches, adds initial metadata batch,
|
|
399
|
+
transforms: []
|
|
400
|
+
}
|
|
412
401
|
};
|
|
413
402
|
var REMOVED_LOADER_OPTIONS = {
|
|
403
|
+
// baseUri
|
|
404
|
+
baseUri: "core.baseUri",
|
|
405
|
+
fetch: "core.fetch",
|
|
406
|
+
mimeType: "core.mimeType",
|
|
407
|
+
fallbackMimeType: "core.fallbackMimeType",
|
|
408
|
+
ignoreRegisteredLoaders: "core.ignoreRegisteredLoaders",
|
|
409
|
+
nothrow: "core.nothrow",
|
|
410
|
+
log: "core.log",
|
|
411
|
+
useLocalLibraries: "core.useLocalLibraries",
|
|
412
|
+
CDN: "core.CDN",
|
|
413
|
+
worker: "core.worker",
|
|
414
|
+
maxConcurrency: "core.maxConcurrency",
|
|
415
|
+
maxMobileConcurrency: "core.maxMobileConcurrency",
|
|
416
|
+
reuseWorkers: "core.reuseWorkers",
|
|
417
|
+
_nodeWorkers: "core.nodeWorkers",
|
|
418
|
+
_workerType: "core._workerType",
|
|
419
|
+
_worker: "core._workerType",
|
|
420
|
+
limit: "core.limit",
|
|
421
|
+
_limitMB: "core._limitMB",
|
|
422
|
+
batchSize: "core.batchSize",
|
|
423
|
+
batchDebounceMs: "core.batchDebounceMs",
|
|
424
|
+
metadata: "core.metadata",
|
|
425
|
+
transforms: "core.transforms",
|
|
426
|
+
// Older deprecations
|
|
414
427
|
throws: "nothrow",
|
|
415
428
|
dataType: "(no longer used)",
|
|
416
429
|
uri: "baseUri",
|
|
417
|
-
// Warn if fetch options are used on
|
|
430
|
+
// Warn if fetch options are used on toplevel
|
|
418
431
|
method: "fetch.method",
|
|
419
432
|
headers: "fetch.headers",
|
|
420
433
|
body: "fetch.body",
|
|
@@ -430,6 +443,29 @@ var REMOVED_LOADER_OPTIONS = {
|
|
|
430
443
|
};
|
|
431
444
|
|
|
432
445
|
// dist/lib/loader-utils/option-utils.js
|
|
446
|
+
var CORE_LOADER_OPTION_KEYS = [
|
|
447
|
+
"baseUri",
|
|
448
|
+
"fetch",
|
|
449
|
+
"mimeType",
|
|
450
|
+
"fallbackMimeType",
|
|
451
|
+
"ignoreRegisteredLoaders",
|
|
452
|
+
"nothrow",
|
|
453
|
+
"log",
|
|
454
|
+
"useLocalLibraries",
|
|
455
|
+
"CDN",
|
|
456
|
+
"worker",
|
|
457
|
+
"maxConcurrency",
|
|
458
|
+
"maxMobileConcurrency",
|
|
459
|
+
"reuseWorkers",
|
|
460
|
+
"_nodeWorkers",
|
|
461
|
+
"_workerType",
|
|
462
|
+
"limit",
|
|
463
|
+
"_limitMB",
|
|
464
|
+
"batchSize",
|
|
465
|
+
"batchDebounceMs",
|
|
466
|
+
"metadata",
|
|
467
|
+
"transforms"
|
|
468
|
+
];
|
|
433
469
|
function getGlobalLoaderState() {
|
|
434
470
|
globalThis.loaders = globalThis.loaders || {};
|
|
435
471
|
const { loaders } = globalThis;
|
|
@@ -440,20 +476,36 @@ function getGlobalLoaderState() {
|
|
|
440
476
|
}
|
|
441
477
|
function getGlobalLoaderOptions() {
|
|
442
478
|
const state = getGlobalLoaderState();
|
|
443
|
-
state.globalOptions = state.globalOptions || {
|
|
444
|
-
|
|
479
|
+
state.globalOptions = state.globalOptions || {
|
|
480
|
+
...DEFAULT_LOADER_OPTIONS,
|
|
481
|
+
core: { ...DEFAULT_LOADER_OPTIONS.core }
|
|
482
|
+
};
|
|
483
|
+
return normalizeLoaderOptions(state.globalOptions);
|
|
445
484
|
}
|
|
446
485
|
function setGlobalOptions(options) {
|
|
447
486
|
const state = getGlobalLoaderState();
|
|
448
487
|
const globalOptions = getGlobalLoaderOptions();
|
|
449
488
|
state.globalOptions = normalizeOptionsInternal(globalOptions, options);
|
|
450
|
-
(0,
|
|
489
|
+
(0, import_loader_utils5.registerJSModules)(options.modules);
|
|
451
490
|
}
|
|
452
491
|
function normalizeOptions(options, loader, loaders, url) {
|
|
453
492
|
loaders = loaders || [];
|
|
454
493
|
loaders = Array.isArray(loaders) ? loaders : [loaders];
|
|
455
494
|
validateOptions(options, loaders);
|
|
456
|
-
return normalizeOptionsInternal(loader, options, url);
|
|
495
|
+
return normalizeLoaderOptions(normalizeOptionsInternal(loader, options, url));
|
|
496
|
+
}
|
|
497
|
+
function normalizeLoaderOptions(options) {
|
|
498
|
+
const normalized = cloneLoaderOptions(options);
|
|
499
|
+
moveDeprecatedTopLevelOptionsToCore(normalized);
|
|
500
|
+
for (const key of CORE_LOADER_OPTION_KEYS) {
|
|
501
|
+
if (normalized.core && normalized.core[key] !== void 0) {
|
|
502
|
+
delete normalized[key];
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
if (normalized.core && normalized.core._workerType !== void 0) {
|
|
506
|
+
delete normalized._worker;
|
|
507
|
+
}
|
|
508
|
+
return normalized;
|
|
457
509
|
}
|
|
458
510
|
function validateOptions(options, loaders) {
|
|
459
511
|
validateOptionsObject(options, null, DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS, loaders);
|
|
@@ -468,7 +520,7 @@ function validateOptionsObject(options, id, defaultOptions, deprecatedOptions, l
|
|
|
468
520
|
const loaderName = id || "Top level";
|
|
469
521
|
const prefix = id ? `${id}.` : "";
|
|
470
522
|
for (const key in options) {
|
|
471
|
-
const isSubOptions = !id && isObject(options[key]);
|
|
523
|
+
const isSubOptions = !id && (0, import_loader_utils5.isObject)(options[key]);
|
|
472
524
|
const isBaseUriOption = key === "baseUri" && !id;
|
|
473
525
|
const isWorkerUrlOption = key === "workerUrl" && id;
|
|
474
526
|
if (!(key in defaultOptions) && !isBaseUriOption && !isWorkerUrlOption) {
|
|
@@ -499,21 +551,28 @@ function findSimilarOption(optionKey, loaders) {
|
|
|
499
551
|
return bestSuggestion;
|
|
500
552
|
}
|
|
501
553
|
function normalizeOptionsInternal(loader, options, url) {
|
|
554
|
+
var _a;
|
|
502
555
|
const loaderDefaultOptions = loader.options || {};
|
|
503
556
|
const mergedOptions = { ...loaderDefaultOptions };
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
557
|
+
if (loaderDefaultOptions.core) {
|
|
558
|
+
mergedOptions.core = { ...loaderDefaultOptions.core };
|
|
559
|
+
}
|
|
560
|
+
moveDeprecatedTopLevelOptionsToCore(mergedOptions);
|
|
561
|
+
if (((_a = mergedOptions.core) == null ? void 0 : _a.log) === null) {
|
|
562
|
+
mergedOptions.core = { ...mergedOptions.core, log: new NullLog() };
|
|
507
563
|
}
|
|
508
|
-
mergeNestedFields(mergedOptions, getGlobalLoaderOptions());
|
|
509
|
-
|
|
564
|
+
mergeNestedFields(mergedOptions, normalizeLoaderOptions(getGlobalLoaderOptions()));
|
|
565
|
+
const userOptions = normalizeLoaderOptions(options);
|
|
566
|
+
mergeNestedFields(mergedOptions, userOptions);
|
|
567
|
+
addUrlOptions(mergedOptions, url);
|
|
568
|
+
addDeprecatedTopLevelOptions(mergedOptions);
|
|
510
569
|
return mergedOptions;
|
|
511
570
|
}
|
|
512
571
|
function mergeNestedFields(mergedOptions, options) {
|
|
513
572
|
for (const key in options) {
|
|
514
573
|
if (key in options) {
|
|
515
574
|
const value = options[key];
|
|
516
|
-
if (isPureObject(value) && isPureObject(mergedOptions[key])) {
|
|
575
|
+
if ((0, import_loader_utils5.isPureObject)(value) && (0, import_loader_utils5.isPureObject)(mergedOptions[key])) {
|
|
517
576
|
mergedOptions[key] = {
|
|
518
577
|
...mergedOptions[key],
|
|
519
578
|
...options[key]
|
|
@@ -525,13 +584,56 @@ function mergeNestedFields(mergedOptions, options) {
|
|
|
525
584
|
}
|
|
526
585
|
}
|
|
527
586
|
function addUrlOptions(options, url) {
|
|
528
|
-
|
|
529
|
-
|
|
587
|
+
var _a;
|
|
588
|
+
if (!url) {
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
const hasTopLevelBaseUri = options.baseUri !== void 0;
|
|
592
|
+
const hasCoreBaseUri = ((_a = options.core) == null ? void 0 : _a.baseUri) !== void 0;
|
|
593
|
+
if (!hasTopLevelBaseUri && !hasCoreBaseUri) {
|
|
594
|
+
options.core ||= {};
|
|
595
|
+
options.core.baseUri = url;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function cloneLoaderOptions(options) {
|
|
599
|
+
const clonedOptions = { ...options };
|
|
600
|
+
if (options.core) {
|
|
601
|
+
clonedOptions.core = { ...options.core };
|
|
602
|
+
}
|
|
603
|
+
return clonedOptions;
|
|
604
|
+
}
|
|
605
|
+
function moveDeprecatedTopLevelOptionsToCore(options) {
|
|
606
|
+
for (const key of CORE_LOADER_OPTION_KEYS) {
|
|
607
|
+
if (options[key] !== void 0) {
|
|
608
|
+
const coreOptions = options.core = options.core || {};
|
|
609
|
+
const coreRecord = coreOptions;
|
|
610
|
+
if (coreRecord[key] === void 0) {
|
|
611
|
+
coreRecord[key] = options[key];
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
const workerTypeAlias = options._worker;
|
|
616
|
+
if (workerTypeAlias !== void 0) {
|
|
617
|
+
options.core ||= {};
|
|
618
|
+
if (options.core._workerType === void 0) {
|
|
619
|
+
options.core._workerType = workerTypeAlias;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function addDeprecatedTopLevelOptions(options) {
|
|
624
|
+
const coreOptions = options.core;
|
|
625
|
+
if (!coreOptions) {
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
for (const key of CORE_LOADER_OPTION_KEYS) {
|
|
629
|
+
if (coreOptions[key] !== void 0) {
|
|
630
|
+
options[key] = coreOptions[key];
|
|
631
|
+
}
|
|
530
632
|
}
|
|
531
633
|
}
|
|
532
634
|
|
|
533
635
|
// dist/lib/loader-utils/normalize-loader.js
|
|
534
|
-
var
|
|
636
|
+
var import_loader_utils6 = require("@loaders.gl/loader-utils");
|
|
535
637
|
function isLoaderObject(loader) {
|
|
536
638
|
if (!loader) {
|
|
537
639
|
return false;
|
|
@@ -543,8 +645,8 @@ function isLoaderObject(loader) {
|
|
|
543
645
|
return hasExtensions;
|
|
544
646
|
}
|
|
545
647
|
function normalizeLoader(loader) {
|
|
546
|
-
(0,
|
|
547
|
-
(0,
|
|
648
|
+
(0, import_loader_utils6.assert)(loader, "null loader");
|
|
649
|
+
(0, import_loader_utils6.assert)(isLoaderObject(loader), "invalid loader");
|
|
548
650
|
let options;
|
|
549
651
|
if (Array.isArray(loader)) {
|
|
550
652
|
options = loader[1];
|
|
@@ -588,21 +690,23 @@ function _unregisterLoaders() {
|
|
|
588
690
|
}
|
|
589
691
|
|
|
590
692
|
// dist/lib/api/select-loader.js
|
|
591
|
-
var
|
|
693
|
+
var import_loader_utils7 = require("@loaders.gl/loader-utils");
|
|
592
694
|
var EXT_PATTERN = /\.([^.]+)$/;
|
|
593
695
|
async function selectLoader(data, loaders = [], options, context) {
|
|
594
696
|
if (!validHTTPResponse(data)) {
|
|
595
697
|
return null;
|
|
596
698
|
}
|
|
597
|
-
|
|
699
|
+
const normalizedOptions = normalizeLoaderOptions(options || {});
|
|
700
|
+
normalizedOptions.core ||= {};
|
|
701
|
+
let loader = selectLoaderSync(data, loaders, { ...normalizedOptions, core: { ...normalizedOptions.core, nothrow: true } }, context);
|
|
598
702
|
if (loader) {
|
|
599
703
|
return loader;
|
|
600
704
|
}
|
|
601
|
-
if (isBlob(data)) {
|
|
705
|
+
if ((0, import_loader_utils7.isBlob)(data)) {
|
|
602
706
|
data = await data.slice(0, 10).arrayBuffer();
|
|
603
|
-
loader = selectLoaderSync(data, loaders,
|
|
707
|
+
loader = selectLoaderSync(data, loaders, normalizedOptions, context);
|
|
604
708
|
}
|
|
605
|
-
if (!loader && !
|
|
709
|
+
if (!loader && !normalizedOptions.core.nothrow) {
|
|
606
710
|
throw new Error(getNoValidLoaderMessage(data));
|
|
607
711
|
}
|
|
608
712
|
return loader;
|
|
@@ -611,6 +715,8 @@ function selectLoaderSync(data, loaders = [], options, context) {
|
|
|
611
715
|
if (!validHTTPResponse(data)) {
|
|
612
716
|
return null;
|
|
613
717
|
}
|
|
718
|
+
const normalizedOptions = normalizeLoaderOptions(options || {});
|
|
719
|
+
normalizedOptions.core ||= {};
|
|
614
720
|
if (loaders && !Array.isArray(loaders)) {
|
|
615
721
|
return normalizeLoader(loaders);
|
|
616
722
|
}
|
|
@@ -618,25 +724,26 @@ function selectLoaderSync(data, loaders = [], options, context) {
|
|
|
618
724
|
if (loaders) {
|
|
619
725
|
candidateLoaders = candidateLoaders.concat(loaders);
|
|
620
726
|
}
|
|
621
|
-
if (!
|
|
727
|
+
if (!normalizedOptions.core.ignoreRegisteredLoaders) {
|
|
622
728
|
candidateLoaders.push(...getRegisteredLoaders());
|
|
623
729
|
}
|
|
624
730
|
normalizeLoaders(candidateLoaders);
|
|
625
|
-
const loader = selectLoaderInternal(data, candidateLoaders,
|
|
626
|
-
if (!loader && !
|
|
731
|
+
const loader = selectLoaderInternal(data, candidateLoaders, normalizedOptions, context);
|
|
732
|
+
if (!loader && !normalizedOptions.core.nothrow) {
|
|
627
733
|
throw new Error(getNoValidLoaderMessage(data));
|
|
628
734
|
}
|
|
629
735
|
return loader;
|
|
630
736
|
}
|
|
631
737
|
function selectLoaderInternal(data, loaders, options, context) {
|
|
738
|
+
var _a, _b, _c, _d, _e;
|
|
632
739
|
const url = getResourceUrl(data);
|
|
633
740
|
const type = getResourceMIMEType(data);
|
|
634
741
|
const testUrl = stripQueryString(url) || (context == null ? void 0 : context.url);
|
|
635
742
|
let loader = null;
|
|
636
743
|
let reason = "";
|
|
637
|
-
if (options == null ? void 0 : options.mimeType) {
|
|
638
|
-
loader = findLoaderByMIMEType(loaders, options == null ? void 0 : options.mimeType);
|
|
639
|
-
reason = `match forced by supplied MIME type ${options == null ? void 0 : options.mimeType}`;
|
|
744
|
+
if ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a.mimeType) {
|
|
745
|
+
loader = findLoaderByMIMEType(loaders, (_b = options == null ? void 0 : options.core) == null ? void 0 : _b.mimeType);
|
|
746
|
+
reason = `match forced by supplied MIME type ${(_c = options == null ? void 0 : options.core) == null ? void 0 : _c.mimeType}`;
|
|
640
747
|
}
|
|
641
748
|
loader = loader || findLoaderByUrl(loaders, testUrl);
|
|
642
749
|
reason = reason || (loader ? `matched url ${testUrl}` : "");
|
|
@@ -644,12 +751,12 @@ function selectLoaderInternal(data, loaders, options, context) {
|
|
|
644
751
|
reason = reason || (loader ? `matched MIME type ${type}` : "");
|
|
645
752
|
loader = loader || findLoaderByInitialBytes(loaders, data);
|
|
646
753
|
reason = reason || (loader ? `matched initial data ${getFirstCharacters(data)}` : "");
|
|
647
|
-
if (options == null ? void 0 : options.fallbackMimeType) {
|
|
648
|
-
loader = loader || findLoaderByMIMEType(loaders, options == null ? void 0 : options.fallbackMimeType);
|
|
754
|
+
if ((_d = options == null ? void 0 : options.core) == null ? void 0 : _d.fallbackMimeType) {
|
|
755
|
+
loader = loader || findLoaderByMIMEType(loaders, (_e = options == null ? void 0 : options.core) == null ? void 0 : _e.fallbackMimeType);
|
|
649
756
|
reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
|
|
650
757
|
}
|
|
651
758
|
if (reason) {
|
|
652
|
-
|
|
759
|
+
import_loader_utils7.log.log(1, `selectLoader selected ${loader == null ? void 0 : loader.name}: ${reason}.`);
|
|
653
760
|
}
|
|
654
761
|
return loader;
|
|
655
762
|
}
|
|
@@ -665,7 +772,7 @@ function getNoValidLoaderMessage(data) {
|
|
|
665
772
|
const url = getResourceUrl(data);
|
|
666
773
|
const type = getResourceMIMEType(data);
|
|
667
774
|
let message = "No valid loader found (";
|
|
668
|
-
message += url ? `${
|
|
775
|
+
message += url ? `${import_loader_utils7.path.filename(url)}, ` : "no url provided, ";
|
|
669
776
|
message += `MIME type: ${type ? `"${type}"` : "not provided"}, `;
|
|
670
777
|
const firstCharacters = data ? getFirstCharacters(data) : "";
|
|
671
778
|
message += firstCharacters ? ` first bytes: "${firstCharacters}"` : "first bytes: not available";
|
|
@@ -739,12 +846,12 @@ function testDataAgainstBinary(data, byteOffset, loader) {
|
|
|
739
846
|
return tests.some((test) => testBinary(data, byteOffset, loader, test));
|
|
740
847
|
}
|
|
741
848
|
function testBinary(data, byteOffset, loader, test) {
|
|
742
|
-
if (
|
|
743
|
-
return (0,
|
|
849
|
+
if ((0, import_loader_utils7.isArrayBufferLike)(test)) {
|
|
850
|
+
return (0, import_loader_utils7.compareArrayBuffers)(test, data, test.byteLength);
|
|
744
851
|
}
|
|
745
852
|
switch (typeof test) {
|
|
746
853
|
case "function":
|
|
747
|
-
return test(data);
|
|
854
|
+
return test((0, import_loader_utils7.ensureArrayBuffer)(data));
|
|
748
855
|
case "string":
|
|
749
856
|
const magic = getMagicString(data, byteOffset, test.length);
|
|
750
857
|
return test === magic;
|
|
@@ -776,13 +883,14 @@ function getMagicString(arrayBuffer, byteOffset, length) {
|
|
|
776
883
|
}
|
|
777
884
|
|
|
778
885
|
// dist/lib/api/parse.js
|
|
779
|
-
var
|
|
886
|
+
var import_loader_utils14 = require("@loaders.gl/loader-utils");
|
|
780
887
|
var import_worker_utils = require("@loaders.gl/worker-utils");
|
|
781
888
|
|
|
782
889
|
// dist/lib/loader-utils/get-data.js
|
|
783
|
-
var
|
|
890
|
+
var import_loader_utils11 = require("@loaders.gl/loader-utils");
|
|
784
891
|
|
|
785
892
|
// dist/iterators/make-iterator/make-string-iterator.js
|
|
893
|
+
var import_loader_utils8 = require("@loaders.gl/loader-utils");
|
|
786
894
|
var DEFAULT_CHUNK_SIZE = 256 * 1024;
|
|
787
895
|
function* makeStringIterator(string, options) {
|
|
788
896
|
const chunkSize = (options == null ? void 0 : options.chunkSize) || DEFAULT_CHUNK_SIZE;
|
|
@@ -792,7 +900,7 @@ function* makeStringIterator(string, options) {
|
|
|
792
900
|
const chunkLength = Math.min(string.length - offset, chunkSize);
|
|
793
901
|
const chunk = string.slice(offset, offset + chunkLength);
|
|
794
902
|
offset += chunkLength;
|
|
795
|
-
yield textEncoder.encode(chunk);
|
|
903
|
+
yield (0, import_loader_utils8.ensureArrayBuffer)(textEncoder.encode(chunk));
|
|
796
904
|
}
|
|
797
905
|
}
|
|
798
906
|
|
|
@@ -826,9 +934,9 @@ async function* makeBlobIterator(blob, options) {
|
|
|
826
934
|
}
|
|
827
935
|
|
|
828
936
|
// dist/iterators/make-iterator/make-stream-iterator.js
|
|
829
|
-
var
|
|
937
|
+
var import_loader_utils9 = require("@loaders.gl/loader-utils");
|
|
830
938
|
function makeStreamIterator(stream, options) {
|
|
831
|
-
return
|
|
939
|
+
return import_loader_utils9.isBrowser ? makeBrowserStreamIterator(stream, options) : makeNodeStreamIterator(stream, options);
|
|
832
940
|
}
|
|
833
941
|
async function* makeBrowserStreamIterator(stream, options) {
|
|
834
942
|
const reader = stream.getReader();
|
|
@@ -843,7 +951,7 @@ async function* makeBrowserStreamIterator(stream, options) {
|
|
|
843
951
|
if (done) {
|
|
844
952
|
return;
|
|
845
953
|
}
|
|
846
|
-
yield (0,
|
|
954
|
+
yield (0, import_loader_utils9.toArrayBuffer)(value);
|
|
847
955
|
}
|
|
848
956
|
} catch (error) {
|
|
849
957
|
reader.releaseLock();
|
|
@@ -851,11 +959,12 @@ async function* makeBrowserStreamIterator(stream, options) {
|
|
|
851
959
|
}
|
|
852
960
|
async function* makeNodeStreamIterator(stream, options) {
|
|
853
961
|
for await (const chunk of stream) {
|
|
854
|
-
yield (0,
|
|
962
|
+
yield (0, import_loader_utils9.toArrayBuffer)(chunk);
|
|
855
963
|
}
|
|
856
964
|
}
|
|
857
965
|
|
|
858
966
|
// dist/iterators/make-iterator/make-iterator.js
|
|
967
|
+
var import_loader_utils10 = require("@loaders.gl/loader-utils");
|
|
859
968
|
function makeIterator(data, options) {
|
|
860
969
|
if (typeof data === "string") {
|
|
861
970
|
return makeStringIterator(data, options);
|
|
@@ -863,15 +972,18 @@ function makeIterator(data, options) {
|
|
|
863
972
|
if (data instanceof ArrayBuffer) {
|
|
864
973
|
return makeArrayBufferIterator(data, options);
|
|
865
974
|
}
|
|
866
|
-
if (isBlob(data)) {
|
|
975
|
+
if ((0, import_loader_utils10.isBlob)(data)) {
|
|
867
976
|
return makeBlobIterator(data, options);
|
|
868
977
|
}
|
|
869
|
-
if (isReadableStream(data)) {
|
|
978
|
+
if ((0, import_loader_utils10.isReadableStream)(data)) {
|
|
870
979
|
return makeStreamIterator(data, options);
|
|
871
980
|
}
|
|
872
|
-
if (isResponse(data)) {
|
|
873
|
-
const
|
|
874
|
-
|
|
981
|
+
if ((0, import_loader_utils10.isResponse)(data)) {
|
|
982
|
+
const responseBody = data.body;
|
|
983
|
+
if (!responseBody) {
|
|
984
|
+
throw new Error("Readable stream not available on Response");
|
|
985
|
+
}
|
|
986
|
+
return makeStreamIterator(responseBody, options);
|
|
875
987
|
}
|
|
876
988
|
throw new Error("makeIterator");
|
|
877
989
|
}
|
|
@@ -882,66 +994,60 @@ function getArrayBufferOrStringFromDataSync(data, loader, options) {
|
|
|
882
994
|
if (loader.text && typeof data === "string") {
|
|
883
995
|
return data;
|
|
884
996
|
}
|
|
885
|
-
if (isBuffer(data)) {
|
|
997
|
+
if ((0, import_loader_utils11.isBuffer)(data)) {
|
|
886
998
|
data = data.buffer;
|
|
887
999
|
}
|
|
888
|
-
if (
|
|
889
|
-
const
|
|
1000
|
+
if ((0, import_loader_utils11.isArrayBufferLike)(data)) {
|
|
1001
|
+
const bufferSource = (0, import_loader_utils11.toArrayBufferView)(data);
|
|
890
1002
|
if (loader.text && !loader.binary) {
|
|
891
1003
|
const textDecoder = new TextDecoder("utf8");
|
|
892
|
-
return textDecoder.decode(
|
|
1004
|
+
return textDecoder.decode(bufferSource);
|
|
893
1005
|
}
|
|
894
|
-
return
|
|
895
|
-
}
|
|
896
|
-
if (ArrayBuffer.isView(data)) {
|
|
897
|
-
if (loader.text && !loader.binary) {
|
|
898
|
-
const textDecoder = new TextDecoder("utf8");
|
|
899
|
-
return textDecoder.decode(data);
|
|
900
|
-
}
|
|
901
|
-
let arrayBuffer = data.buffer;
|
|
902
|
-
const byteLength = data.byteLength || data.length;
|
|
903
|
-
if (data.byteOffset !== 0 || byteLength !== arrayBuffer.byteLength) {
|
|
904
|
-
arrayBuffer = arrayBuffer.slice(data.byteOffset, data.byteOffset + byteLength);
|
|
905
|
-
}
|
|
906
|
-
return arrayBuffer;
|
|
1006
|
+
return (0, import_loader_utils11.toArrayBuffer)(bufferSource);
|
|
907
1007
|
}
|
|
908
1008
|
throw new Error(ERR_DATA);
|
|
909
1009
|
}
|
|
910
1010
|
async function getArrayBufferOrStringFromData(data, loader, options) {
|
|
911
|
-
|
|
912
|
-
if (typeof data === "string" || isArrayBuffer) {
|
|
1011
|
+
if (typeof data === "string" || (0, import_loader_utils11.isArrayBufferLike)(data)) {
|
|
913
1012
|
return getArrayBufferOrStringFromDataSync(data, loader, options);
|
|
914
1013
|
}
|
|
915
|
-
if (isBlob(data)) {
|
|
1014
|
+
if ((0, import_loader_utils11.isBlob)(data)) {
|
|
916
1015
|
data = await makeResponse(data);
|
|
917
1016
|
}
|
|
918
|
-
if (isResponse(data)) {
|
|
919
|
-
|
|
920
|
-
await
|
|
921
|
-
return loader.binary ? await response.arrayBuffer() : await response.text();
|
|
1017
|
+
if ((0, import_loader_utils11.isResponse)(data)) {
|
|
1018
|
+
await checkResponse(data);
|
|
1019
|
+
return loader.binary ? await data.arrayBuffer() : await data.text();
|
|
922
1020
|
}
|
|
923
|
-
if (isReadableStream(data)) {
|
|
1021
|
+
if ((0, import_loader_utils11.isReadableStream)(data)) {
|
|
924
1022
|
data = makeIterator(data, options);
|
|
925
1023
|
}
|
|
926
|
-
if (isIterable(data) || isAsyncIterable(data)) {
|
|
927
|
-
return (0,
|
|
1024
|
+
if ((0, import_loader_utils11.isIterable)(data) || (0, import_loader_utils11.isAsyncIterable)(data)) {
|
|
1025
|
+
return (0, import_loader_utils11.concatenateArrayBuffersAsync)(data);
|
|
928
1026
|
}
|
|
929
1027
|
throw new Error(ERR_DATA);
|
|
930
1028
|
}
|
|
931
1029
|
async function getAsyncIterableFromData(data, options) {
|
|
932
|
-
if (
|
|
1030
|
+
if ((0, import_loader_utils11.isPromise)(data)) {
|
|
1031
|
+
data = await data;
|
|
1032
|
+
}
|
|
1033
|
+
if ((0, import_loader_utils11.isIterator)(data)) {
|
|
933
1034
|
return data;
|
|
934
1035
|
}
|
|
935
|
-
if (isResponse(data)) {
|
|
936
|
-
|
|
937
|
-
await
|
|
938
|
-
|
|
1036
|
+
if ((0, import_loader_utils11.isResponse)(data)) {
|
|
1037
|
+
await checkResponse(data);
|
|
1038
|
+
const body = await data.body;
|
|
1039
|
+
if (!body) {
|
|
1040
|
+
throw new Error(ERR_DATA);
|
|
1041
|
+
}
|
|
939
1042
|
return makeIterator(body, options);
|
|
940
1043
|
}
|
|
941
|
-
if (isBlob(data) || isReadableStream(data)) {
|
|
1044
|
+
if ((0, import_loader_utils11.isBlob)(data) || (0, import_loader_utils11.isReadableStream)(data)) {
|
|
942
1045
|
return makeIterator(data, options);
|
|
943
1046
|
}
|
|
944
|
-
if (isAsyncIterable(data)) {
|
|
1047
|
+
if ((0, import_loader_utils11.isAsyncIterable)(data)) {
|
|
1048
|
+
return data;
|
|
1049
|
+
}
|
|
1050
|
+
if ((0, import_loader_utils11.isIterable)(data)) {
|
|
945
1051
|
return data;
|
|
946
1052
|
}
|
|
947
1053
|
return getIterableFromData(data);
|
|
@@ -949,32 +1055,35 @@ async function getAsyncIterableFromData(data, options) {
|
|
|
949
1055
|
function getIterableFromData(data) {
|
|
950
1056
|
if (ArrayBuffer.isView(data)) {
|
|
951
1057
|
return function* oneChunk() {
|
|
952
|
-
yield data
|
|
1058
|
+
yield (0, import_loader_utils11.toArrayBuffer)(data);
|
|
953
1059
|
}();
|
|
954
1060
|
}
|
|
955
|
-
if (
|
|
1061
|
+
if ((0, import_loader_utils11.isArrayBufferLike)(data)) {
|
|
956
1062
|
return function* oneChunk() {
|
|
957
|
-
yield data;
|
|
1063
|
+
yield (0, import_loader_utils11.toArrayBuffer)(data);
|
|
958
1064
|
}();
|
|
959
1065
|
}
|
|
960
|
-
if (isIterator(data)) {
|
|
1066
|
+
if ((0, import_loader_utils11.isIterator)(data)) {
|
|
961
1067
|
return data;
|
|
962
1068
|
}
|
|
963
|
-
if (isIterable(data)) {
|
|
1069
|
+
if ((0, import_loader_utils11.isIterable)(data)) {
|
|
964
1070
|
return data[Symbol.iterator]();
|
|
965
1071
|
}
|
|
966
1072
|
throw new Error(ERR_DATA);
|
|
967
1073
|
}
|
|
968
1074
|
|
|
969
1075
|
// dist/lib/loader-utils/get-fetch-function.js
|
|
1076
|
+
var import_loader_utils12 = require("@loaders.gl/loader-utils");
|
|
970
1077
|
function getFetchFunction(options, context) {
|
|
1078
|
+
var _a;
|
|
971
1079
|
const globalOptions = getGlobalLoaderOptions();
|
|
972
1080
|
const loaderOptions = options || globalOptions;
|
|
973
|
-
|
|
974
|
-
|
|
1081
|
+
const fetchOption = loaderOptions.fetch ?? ((_a = loaderOptions.core) == null ? void 0 : _a.fetch);
|
|
1082
|
+
if (typeof fetchOption === "function") {
|
|
1083
|
+
return fetchOption;
|
|
975
1084
|
}
|
|
976
|
-
if (
|
|
977
|
-
return (url) => fetchFile(url,
|
|
1085
|
+
if ((0, import_loader_utils12.isObject)(fetchOption)) {
|
|
1086
|
+
return (url) => fetchFile(url, fetchOption);
|
|
978
1087
|
}
|
|
979
1088
|
if (context == null ? void 0 : context.fetch) {
|
|
980
1089
|
return context == null ? void 0 : context.fetch;
|
|
@@ -983,7 +1092,7 @@ function getFetchFunction(options, context) {
|
|
|
983
1092
|
}
|
|
984
1093
|
|
|
985
1094
|
// dist/lib/loader-utils/loader-context.js
|
|
986
|
-
var
|
|
1095
|
+
var import_loader_utils13 = require("@loaders.gl/loader-utils");
|
|
987
1096
|
function getLoaderContext(context, options, parentContext) {
|
|
988
1097
|
if (parentContext) {
|
|
989
1098
|
return parentContext;
|
|
@@ -996,8 +1105,8 @@ function getLoaderContext(context, options, parentContext) {
|
|
|
996
1105
|
const baseUrl = stripQueryString(newContext.url);
|
|
997
1106
|
newContext.baseUrl = baseUrl;
|
|
998
1107
|
newContext.queryString = extractQueryString(newContext.url);
|
|
999
|
-
newContext.filename =
|
|
1000
|
-
newContext.baseUrl =
|
|
1108
|
+
newContext.filename = import_loader_utils13.path.filename(baseUrl);
|
|
1109
|
+
newContext.baseUrl = import_loader_utils13.path.dirname(baseUrl);
|
|
1001
1110
|
}
|
|
1002
1111
|
if (!Array.isArray(newContext.loaders)) {
|
|
1003
1112
|
newContext.loaders = null;
|
|
@@ -1035,22 +1144,21 @@ async function parse(data, loaders, options, context) {
|
|
|
1035
1144
|
if (!loader) {
|
|
1036
1145
|
return null;
|
|
1037
1146
|
}
|
|
1038
|
-
|
|
1147
|
+
const strictOptions = normalizeOptions(options, loader, candidateLoaders, url);
|
|
1039
1148
|
context = getLoaderContext(
|
|
1040
1149
|
// @ts-expect-error
|
|
1041
1150
|
{ url, _parse: parse, loaders: candidateLoaders },
|
|
1042
|
-
|
|
1151
|
+
strictOptions,
|
|
1043
1152
|
context || null
|
|
1044
1153
|
);
|
|
1045
|
-
return await parseWithLoader(loader, data,
|
|
1154
|
+
return await parseWithLoader(loader, data, strictOptions, context);
|
|
1046
1155
|
}
|
|
1047
1156
|
async function parseWithLoader(loader, data, options, context) {
|
|
1048
1157
|
(0, import_worker_utils.validateWorkerVersion)(loader);
|
|
1049
|
-
options = (0,
|
|
1050
|
-
if (isResponse(data)) {
|
|
1051
|
-
const
|
|
1052
|
-
const
|
|
1053
|
-
const headers = Object.fromEntries(response.headers.entries());
|
|
1158
|
+
options = (0, import_loader_utils14.mergeOptions)(loader.options, options);
|
|
1159
|
+
if ((0, import_loader_utils14.isResponse)(data)) {
|
|
1160
|
+
const { ok, redirected, status, statusText, type, url } = data;
|
|
1161
|
+
const headers = Object.fromEntries(data.headers.entries());
|
|
1054
1162
|
context.response = { headers, ok, redirected, status, statusText, type, url };
|
|
1055
1163
|
}
|
|
1056
1164
|
data = await getArrayBufferOrStringFromData(data, loader, options);
|
|
@@ -1058,8 +1166,8 @@ async function parseWithLoader(loader, data, options, context) {
|
|
|
1058
1166
|
if (loaderWithParser.parseTextSync && typeof data === "string") {
|
|
1059
1167
|
return loaderWithParser.parseTextSync(data, options, context);
|
|
1060
1168
|
}
|
|
1061
|
-
if ((0,
|
|
1062
|
-
return await (0,
|
|
1169
|
+
if ((0, import_loader_utils14.canParseWithWorker)(loader, options)) {
|
|
1170
|
+
return await (0, import_loader_utils14.parseWithWorker)(loader, data, options, context, parse);
|
|
1063
1171
|
}
|
|
1064
1172
|
if (loaderWithParser.parseText && typeof data === "string") {
|
|
1065
1173
|
return await loaderWithParser.parseText(data, options, context);
|
|
@@ -1085,13 +1193,13 @@ function parseSync(data, loaders, options, context) {
|
|
|
1085
1193
|
if (!loader) {
|
|
1086
1194
|
return null;
|
|
1087
1195
|
}
|
|
1088
|
-
|
|
1196
|
+
const strictOptions = normalizeOptions(options, loader, candidateLoaders);
|
|
1089
1197
|
const url = getResourceUrl(data);
|
|
1090
1198
|
const parse2 = () => {
|
|
1091
1199
|
throw new Error("parseSync called parse (which is async");
|
|
1092
1200
|
};
|
|
1093
|
-
context = getLoaderContext({ url, _parseSync: parse2, _parse: parse2, loaders },
|
|
1094
|
-
return parseWithLoaderSync(loader, data,
|
|
1201
|
+
context = getLoaderContext({ url, _parseSync: parse2, _parse: parse2, loaders }, strictOptions, context || null);
|
|
1202
|
+
return parseWithLoaderSync(loader, data, strictOptions, context);
|
|
1095
1203
|
}
|
|
1096
1204
|
function parseWithLoaderSync(loader, data, options, context) {
|
|
1097
1205
|
data = getArrayBufferOrStringFromDataSync(data, loader, options);
|
|
@@ -1106,7 +1214,7 @@ function parseWithLoaderSync(loader, data, options, context) {
|
|
|
1106
1214
|
|
|
1107
1215
|
// dist/lib/api/parse-in-batches.js
|
|
1108
1216
|
var import_schema_utils = require("@loaders.gl/schema-utils");
|
|
1109
|
-
var
|
|
1217
|
+
var import_loader_utils15 = require("@loaders.gl/loader-utils");
|
|
1110
1218
|
async function parseInBatches(data, loaders, options, context) {
|
|
1111
1219
|
const loaderArray = Array.isArray(loaders) ? loaders : void 0;
|
|
1112
1220
|
if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
|
|
@@ -1121,13 +1229,14 @@ async function parseInBatches(data, loaders, options, context) {
|
|
|
1121
1229
|
if (!loader) {
|
|
1122
1230
|
return [];
|
|
1123
1231
|
}
|
|
1124
|
-
|
|
1125
|
-
context = getLoaderContext({ url, _parseInBatches: parseInBatches, _parse: parse, loaders: loaderArray },
|
|
1126
|
-
return await parseWithLoaderInBatches(loader, data,
|
|
1232
|
+
const strictOptions = normalizeOptions(options, loader, loaderArray, url);
|
|
1233
|
+
context = getLoaderContext({ url, _parseInBatches: parseInBatches, _parse: parse, loaders: loaderArray }, strictOptions, context || null);
|
|
1234
|
+
return await parseWithLoaderInBatches(loader, data, strictOptions, context);
|
|
1127
1235
|
}
|
|
1128
1236
|
async function parseWithLoaderInBatches(loader, data, options, context) {
|
|
1237
|
+
var _a;
|
|
1129
1238
|
const outputIterator = await parseToOutputIterator(loader, data, options, context);
|
|
1130
|
-
if (!options.metadata) {
|
|
1239
|
+
if (!((_a = options == null ? void 0 : options.core) == null ? void 0 : _a.metadata)) {
|
|
1131
1240
|
return outputIterator;
|
|
1132
1241
|
}
|
|
1133
1242
|
const metadataBatch = {
|
|
@@ -1148,20 +1257,21 @@ async function parseWithLoaderInBatches(loader, data, options, context) {
|
|
|
1148
1257
|
return makeMetadataBatchIterator(outputIterator);
|
|
1149
1258
|
}
|
|
1150
1259
|
async function parseToOutputIterator(loader, data, options, context) {
|
|
1260
|
+
var _a;
|
|
1151
1261
|
const inputIterator = await getAsyncIterableFromData(data, options);
|
|
1152
|
-
const transformedIterator = await applyInputTransforms(inputIterator, (options == null ? void 0 : options.transforms) || []);
|
|
1262
|
+
const transformedIterator = await applyInputTransforms(inputIterator, ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a.transforms) || []);
|
|
1153
1263
|
if (loader.parseInBatches) {
|
|
1154
1264
|
return loader.parseInBatches(transformedIterator, options, context);
|
|
1155
1265
|
}
|
|
1156
1266
|
return parseChunkInBatches(transformedIterator, loader, options, context);
|
|
1157
1267
|
}
|
|
1158
1268
|
async function* parseChunkInBatches(transformedIterator, loader, options, context) {
|
|
1159
|
-
const arrayBuffer = await (0,
|
|
1269
|
+
const arrayBuffer = await (0, import_loader_utils15.concatenateArrayBuffersAsync)(transformedIterator);
|
|
1160
1270
|
const parsedData = await parse(
|
|
1161
1271
|
arrayBuffer,
|
|
1162
1272
|
loader,
|
|
1163
1273
|
// TODO - Hack: supply loaders MIME type to ensure we match it
|
|
1164
|
-
{ ...options, mimeType: loader.mimeTypes[0] },
|
|
1274
|
+
{ ...options, core: { ...options == null ? void 0 : options.core, mimeType: loader.mimeTypes[0] } },
|
|
1165
1275
|
context
|
|
1166
1276
|
);
|
|
1167
1277
|
const batch = convertDataToBatch(parsedData, loader);
|
|
@@ -1186,6 +1296,7 @@ async function applyInputTransforms(inputIterator, transforms = []) {
|
|
|
1186
1296
|
}
|
|
1187
1297
|
|
|
1188
1298
|
// dist/lib/api/load.js
|
|
1299
|
+
var import_loader_utils16 = require("@loaders.gl/loader-utils");
|
|
1189
1300
|
async function load(url, loaders, options, context) {
|
|
1190
1301
|
let resolvedLoaders;
|
|
1191
1302
|
let resolvedOptions;
|
|
@@ -1202,7 +1313,7 @@ async function load(url, loaders, options, context) {
|
|
|
1202
1313
|
if (typeof url === "string") {
|
|
1203
1314
|
data = await fetch2(url);
|
|
1204
1315
|
}
|
|
1205
|
-
if (isBlob(url)) {
|
|
1316
|
+
if ((0, import_loader_utils16.isBlob)(url)) {
|
|
1206
1317
|
data = await fetch2(url);
|
|
1207
1318
|
}
|
|
1208
1319
|
return Array.isArray(resolvedLoaders) ? await parse(data, resolvedLoaders, resolvedOptions) : await parse(data, resolvedLoaders, resolvedOptions);
|
|
@@ -1235,14 +1346,14 @@ async function loadOneFileInBatches(file, loaders, options, fetch2) {
|
|
|
1235
1346
|
}
|
|
1236
1347
|
|
|
1237
1348
|
// dist/lib/api/encode-table.js
|
|
1238
|
-
var
|
|
1349
|
+
var import_loader_utils17 = require("@loaders.gl/loader-utils");
|
|
1239
1350
|
async function encodeTable(data, writer, options) {
|
|
1240
1351
|
if (writer.encode) {
|
|
1241
1352
|
return await writer.encode(data, options);
|
|
1242
1353
|
}
|
|
1243
1354
|
if (writer.encodeText) {
|
|
1244
1355
|
const text = await writer.encodeText(data, options);
|
|
1245
|
-
return new TextEncoder().encode(text);
|
|
1356
|
+
return (0, import_loader_utils17.ensureArrayBuffer)(new TextEncoder().encode(text));
|
|
1246
1357
|
}
|
|
1247
1358
|
if (writer.encodeInBatches) {
|
|
1248
1359
|
const batches = encodeTableInBatches(data, writer, options);
|
|
@@ -1250,7 +1361,7 @@ async function encodeTable(data, writer, options) {
|
|
|
1250
1361
|
for await (const batch of batches) {
|
|
1251
1362
|
chunks.push(batch);
|
|
1252
1363
|
}
|
|
1253
|
-
return (0,
|
|
1364
|
+
return (0, import_loader_utils17.concatenateArrayBuffers)(...chunks);
|
|
1254
1365
|
}
|
|
1255
1366
|
throw new Error("Writer could not encode data");
|
|
1256
1367
|
}
|
|
@@ -1277,7 +1388,7 @@ function getIterator(data) {
|
|
|
1277
1388
|
}
|
|
1278
1389
|
|
|
1279
1390
|
// dist/lib/api/encode.js
|
|
1280
|
-
var
|
|
1391
|
+
var import_loader_utils18 = require("@loaders.gl/loader-utils");
|
|
1281
1392
|
var import_worker_utils2 = require("@loaders.gl/worker-utils");
|
|
1282
1393
|
async function encode(data, writer, options_) {
|
|
1283
1394
|
const globalOptions = getGlobalLoaderOptions();
|
|
@@ -1285,7 +1396,7 @@ async function encode(data, writer, options_) {
|
|
|
1285
1396
|
if (writer.encodeURLtoURL) {
|
|
1286
1397
|
return encodeWithCommandLineTool(writer, data, options);
|
|
1287
1398
|
}
|
|
1288
|
-
if ((0,
|
|
1399
|
+
if ((0, import_loader_utils18.canEncodeWithWorker)(writer, options)) {
|
|
1289
1400
|
return await (0, import_worker_utils2.processOnWorker)(writer, data, options);
|
|
1290
1401
|
}
|
|
1291
1402
|
return await writer.encode(data, options);
|
|
@@ -1295,7 +1406,7 @@ function encodeSync(data, writer, options) {
|
|
|
1295
1406
|
return writer.encodeSync(data, options);
|
|
1296
1407
|
}
|
|
1297
1408
|
if (writer.encodeTextSync) {
|
|
1298
|
-
return new TextEncoder().encode(writer.encodeTextSync(data, options));
|
|
1409
|
+
return (0, import_loader_utils18.ensureArrayBuffer)(new TextEncoder().encode(writer.encodeTextSync(data, options)));
|
|
1299
1410
|
}
|
|
1300
1411
|
throw new Error(`Writer ${writer.name} could not synchronously encode data`);
|
|
1301
1412
|
}
|
|
@@ -1330,20 +1441,20 @@ function encodeInBatches(data, writer, options) {
|
|
|
1330
1441
|
throw new Error(`Writer ${writer.name} could not encode in batches`);
|
|
1331
1442
|
}
|
|
1332
1443
|
async function encodeURLtoURL(inputUrl, outputUrl, writer, options) {
|
|
1333
|
-
inputUrl = (0,
|
|
1334
|
-
outputUrl = (0,
|
|
1335
|
-
if (
|
|
1444
|
+
inputUrl = (0, import_loader_utils18.resolvePath)(inputUrl);
|
|
1445
|
+
outputUrl = (0, import_loader_utils18.resolvePath)(outputUrl);
|
|
1446
|
+
if (import_loader_utils18.isBrowser || !writer.encodeURLtoURL) {
|
|
1336
1447
|
throw new Error();
|
|
1337
1448
|
}
|
|
1338
1449
|
const outputFilename = await writer.encodeURLtoURL(inputUrl, outputUrl, options);
|
|
1339
1450
|
return outputFilename;
|
|
1340
1451
|
}
|
|
1341
1452
|
async function encodeWithCommandLineTool(writer, data, options) {
|
|
1342
|
-
if (
|
|
1453
|
+
if (import_loader_utils18.isBrowser) {
|
|
1343
1454
|
throw new Error(`Writer ${writer.name} not supported in browser`);
|
|
1344
1455
|
}
|
|
1345
1456
|
const tmpInputFilename = getTemporaryFilename("input");
|
|
1346
|
-
const file = new
|
|
1457
|
+
const file = new import_loader_utils18.NodeFile(tmpInputFilename, "w");
|
|
1347
1458
|
await file.write(data);
|
|
1348
1459
|
const tmpOutputFilename = getTemporaryFilename("output");
|
|
1349
1460
|
const outputFilename = await encodeURLtoURL(tmpInputFilename, tmpOutputFilename, writer, options);
|
|
@@ -1413,8 +1524,8 @@ function getSourceOfType2(type, sources) {
|
|
|
1413
1524
|
}
|
|
1414
1525
|
|
|
1415
1526
|
// dist/index.js
|
|
1416
|
-
var
|
|
1417
|
-
var
|
|
1527
|
+
var import_loader_utils20 = require("@loaders.gl/loader-utils");
|
|
1528
|
+
var import_loader_utils21 = require("@loaders.gl/loader-utils");
|
|
1418
1529
|
|
|
1419
1530
|
// dist/iterators/make-stream/make-stream.js
|
|
1420
1531
|
function makeStream(source, options) {
|
|
@@ -1456,7 +1567,7 @@ function makeStream(source, options) {
|
|
|
1456
1567
|
}
|
|
1457
1568
|
|
|
1458
1569
|
// dist/null-loader.js
|
|
1459
|
-
var VERSION = true ? "4.4.0-alpha.
|
|
1570
|
+
var VERSION = true ? "4.4.0-alpha.9" : "latest";
|
|
1460
1571
|
var NullWorkerLoader = {
|
|
1461
1572
|
dataType: null,
|
|
1462
1573
|
batchType: null,
|
|
@@ -1498,7 +1609,7 @@ function parseSync2(arrayBuffer, options, context) {
|
|
|
1498
1609
|
}
|
|
1499
1610
|
|
|
1500
1611
|
// dist/index.js
|
|
1501
|
-
var
|
|
1612
|
+
var import_loader_utils22 = require("@loaders.gl/loader-utils");
|
|
1502
1613
|
|
|
1503
1614
|
// dist/lib/progress/fetch-progress.js
|
|
1504
1615
|
async function fetchProgress(response, onProgress, onDone = () => {
|
|
@@ -1548,7 +1659,7 @@ async function read(controller, reader, loadedBytes, totalBytes, onProgress, onD
|
|
|
1548
1659
|
}
|
|
1549
1660
|
|
|
1550
1661
|
// dist/lib/filesystems/browser-filesystem.js
|
|
1551
|
-
var
|
|
1662
|
+
var import_loader_utils19 = require("@loaders.gl/loader-utils");
|
|
1552
1663
|
var BrowserFileSystem = class {
|
|
1553
1664
|
_fetch;
|
|
1554
1665
|
files = {};
|
|
@@ -1630,7 +1741,7 @@ var BrowserFileSystem = class {
|
|
|
1630
1741
|
// implements IRandomAccessFileSystem
|
|
1631
1742
|
// RANDOM ACCESS
|
|
1632
1743
|
async openReadableFile(pathname, flags) {
|
|
1633
|
-
return new
|
|
1744
|
+
return new import_loader_utils19.BlobFile(this.files[pathname]);
|
|
1634
1745
|
}
|
|
1635
1746
|
// PRIVATE
|
|
1636
1747
|
// Supports case independent paths, and file usage tracking
|
|
@@ -1644,8 +1755,9 @@ var BrowserFileSystem = class {
|
|
|
1644
1755
|
};
|
|
1645
1756
|
|
|
1646
1757
|
// dist/index.js
|
|
1647
|
-
var
|
|
1648
|
-
var
|
|
1649
|
-
var
|
|
1650
|
-
var
|
|
1758
|
+
var import_loader_utils23 = require("@loaders.gl/loader-utils");
|
|
1759
|
+
var import_loader_utils24 = require("@loaders.gl/loader-utils");
|
|
1760
|
+
var import_loader_utils25 = require("@loaders.gl/loader-utils");
|
|
1761
|
+
var import_loader_utils26 = require("@loaders.gl/loader-utils");
|
|
1762
|
+
var import_loader_utils27 = require("@loaders.gl/loader-utils");
|
|
1651
1763
|
//# sourceMappingURL=index.cjs.map
|