@loaders.gl/core 4.2.0-alpha.6 → 4.2.0-beta.1
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/dist.dev.js +1941 -1894
- package/dist/dist.min.js +3 -3
- package/dist/index.cjs +110 -68
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lib/api/select-loader.d.ts.map +1 -1
- package/dist/lib/api/select-loader.js +3 -2
- package/dist/lib/fetch/fetch-error-message.d.ts.map +1 -1
- package/dist/lib/fetch/fetch-error-message.js +2 -0
- package/dist/lib/fetch/fetch-error.d.ts +14 -0
- package/dist/lib/fetch/fetch-error.d.ts.map +1 -0
- package/dist/lib/fetch/fetch-error.js +17 -0
- package/dist/lib/fetch/fetch-file.d.ts.map +1 -1
- package/dist/lib/fetch/fetch-file.js +1 -0
- package/dist/lib/init.js +1 -1
- package/dist/lib/loader-utils/option-utils.d.ts +1 -1
- package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
- package/dist/lib/loader-utils/option-utils.js +3 -0
- package/dist/lib/utils/mime-type-utils.d.ts +8 -0
- package/dist/lib/utils/mime-type-utils.d.ts.map +1 -1
- package/dist/lib/utils/mime-type-utils.js +13 -0
- package/dist/lib/utils/response-utils.d.ts.map +1 -1
- package/dist/lib/utils/response-utils.js +16 -10
- package/dist/lib/utils/url-utils.d.ts +1 -0
- package/dist/lib/utils/url-utils.d.ts.map +1 -1
- package/dist/lib/utils/url-utils.js +8 -0
- package/dist/null-loader.d.ts +40 -3
- package/dist/null-loader.d.ts.map +1 -1
- package/dist/null-loader.js +5 -1
- package/dist/null-worker-node.js +3 -1
- package/dist/null-worker.js +3 -1
- package/package.json +5 -5
- package/src/index.ts +1 -0
- package/src/lib/api/select-loader.ts +3 -2
- package/src/lib/fetch/fetch-error-message.ts +2 -0
- package/src/lib/fetch/fetch-error.ts +18 -0
- package/src/lib/fetch/fetch-file.ts +1 -0
- package/src/lib/loader-utils/option-utils.ts +3 -1
- package/src/lib/utils/mime-type-utils.ts +14 -0
- package/src/lib/utils/response-utils.ts +19 -11
- package/src/lib/utils/url-utils.ts +9 -0
- package/src/null-loader.ts +9 -4
package/dist/index.cjs
CHANGED
|
@@ -20,16 +20,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// dist/index.js
|
|
21
21
|
var dist_exports = {};
|
|
22
22
|
__export(dist_exports, {
|
|
23
|
-
|
|
23
|
+
FetchError: () => FetchError,
|
|
24
|
+
JSONLoader: () => import_loader_utils18.JSONLoader,
|
|
24
25
|
NullLoader: () => NullLoader,
|
|
25
26
|
NullWorkerLoader: () => NullWorkerLoader,
|
|
26
|
-
RequestScheduler: () =>
|
|
27
|
+
RequestScheduler: () => import_loader_utils17.RequestScheduler,
|
|
27
28
|
_BrowserFileSystem: () => BrowserFileSystem,
|
|
28
29
|
_fetchProgress: () => fetchProgress,
|
|
29
30
|
_unregisterLoaders: () => _unregisterLoaders,
|
|
30
|
-
assert: () =>
|
|
31
|
-
concatenateArrayBuffersAsync: () =>
|
|
32
|
-
document: () =>
|
|
31
|
+
assert: () => import_loader_utils20.assert,
|
|
32
|
+
concatenateArrayBuffersAsync: () => import_loader_utils21.concatenateArrayBuffersAsync,
|
|
33
|
+
document: () => import_loader_utils19.document,
|
|
33
34
|
encode: () => encode,
|
|
34
35
|
encodeInBatches: () => encodeInBatches,
|
|
35
36
|
encodeSync: () => encodeSync,
|
|
@@ -40,40 +41,40 @@ __export(dist_exports, {
|
|
|
40
41
|
encodeTextSync: () => encodeTextSync,
|
|
41
42
|
encodeURLtoURL: () => encodeURLtoURL,
|
|
42
43
|
fetchFile: () => fetchFile,
|
|
43
|
-
forEach: () =>
|
|
44
|
+
forEach: () => import_loader_utils21.forEach,
|
|
44
45
|
getLoaderOptions: () => getGlobalLoaderOptions,
|
|
45
|
-
getPathPrefix: () =>
|
|
46
|
-
global: () =>
|
|
46
|
+
getPathPrefix: () => import_loader_utils16.getPathPrefix,
|
|
47
|
+
global: () => import_loader_utils19.global,
|
|
47
48
|
isAsyncIterable: () => isAsyncIterable,
|
|
48
|
-
isBrowser: () =>
|
|
49
|
+
isBrowser: () => import_loader_utils19.isBrowser,
|
|
49
50
|
isIterable: () => isIterable,
|
|
50
51
|
isIterator: () => isIterator,
|
|
51
52
|
isPromise: () => isPromise,
|
|
52
53
|
isPureObject: () => isPureObject,
|
|
53
54
|
isReadableStream: () => isReadableStream,
|
|
54
55
|
isResponse: () => isResponse,
|
|
55
|
-
isWorker: () =>
|
|
56
|
+
isWorker: () => import_loader_utils19.isWorker,
|
|
56
57
|
isWritableStream: () => isWritableStream,
|
|
57
58
|
load: () => load,
|
|
58
59
|
loadInBatches: () => loadInBatches,
|
|
59
60
|
makeIterator: () => makeIterator,
|
|
60
|
-
makeLineIterator: () =>
|
|
61
|
-
makeNumberedLineIterator: () =>
|
|
61
|
+
makeLineIterator: () => import_loader_utils22.makeLineIterator,
|
|
62
|
+
makeNumberedLineIterator: () => import_loader_utils22.makeNumberedLineIterator,
|
|
62
63
|
makeStream: () => makeStream,
|
|
63
|
-
makeTextDecoderIterator: () =>
|
|
64
|
-
makeTextEncoderIterator: () =>
|
|
64
|
+
makeTextDecoderIterator: () => import_loader_utils22.makeTextDecoderIterator,
|
|
65
|
+
makeTextEncoderIterator: () => import_loader_utils22.makeTextEncoderIterator,
|
|
65
66
|
parse: () => parse,
|
|
66
67
|
parseInBatches: () => parseInBatches,
|
|
67
68
|
parseSync: () => parseSync,
|
|
68
69
|
readArrayBuffer: () => readArrayBuffer,
|
|
69
70
|
registerLoaders: () => registerLoaders,
|
|
70
|
-
resolvePath: () =>
|
|
71
|
+
resolvePath: () => import_loader_utils16.resolvePath,
|
|
71
72
|
selectLoader: () => selectLoader,
|
|
72
73
|
selectLoaderSync: () => selectLoaderSync,
|
|
73
|
-
self: () =>
|
|
74
|
+
self: () => import_loader_utils19.self,
|
|
74
75
|
setLoaderOptions: () => setGlobalOptions,
|
|
75
|
-
setPathPrefix: () =>
|
|
76
|
-
window: () =>
|
|
76
|
+
setPathPrefix: () => import_loader_utils16.setPathPrefix,
|
|
77
|
+
window: () => import_loader_utils19.window
|
|
77
78
|
});
|
|
78
79
|
module.exports = __toCommonJS(dist_exports);
|
|
79
80
|
|
|
@@ -99,9 +100,31 @@ var isReadableNodeStream = (x) => isObject(x) && isFunction(x.read) && isFunctio
|
|
|
99
100
|
var isReadableStream = (x) => isReadableDOMStream(x) || isReadableNodeStream(x);
|
|
100
101
|
var isWritableStream = (x) => isWritableDOMStream(x) || isWritableNodeStream(x);
|
|
101
102
|
|
|
103
|
+
// dist/lib/fetch/fetch-error.js
|
|
104
|
+
var FetchError = class extends Error {
|
|
105
|
+
constructor(message, info) {
|
|
106
|
+
super(message);
|
|
107
|
+
this.reason = info.reason;
|
|
108
|
+
this.url = info.url;
|
|
109
|
+
this.response = info.response;
|
|
110
|
+
}
|
|
111
|
+
/** A best effort reason for why the fetch failed */
|
|
112
|
+
reason;
|
|
113
|
+
/** The URL that failed to load. Empty string if not available. */
|
|
114
|
+
url;
|
|
115
|
+
/** The Response object, if any. */
|
|
116
|
+
response;
|
|
117
|
+
};
|
|
118
|
+
|
|
102
119
|
// dist/lib/utils/mime-type-utils.js
|
|
103
120
|
var DATA_URL_PATTERN = /^data:([-\w.]+\/[-\w.+]+)(;|,)/;
|
|
104
121
|
var MIME_TYPE_PATTERN = /^([-\w.]+\/[-\w.+]+)/;
|
|
122
|
+
function compareMIMETypes(mimeType1, mimeType2) {
|
|
123
|
+
if (mimeType1.toLowerCase() === mimeType2.toLowerCase()) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
105
128
|
function parseMIMEType(mimeString) {
|
|
106
129
|
const matches = MIME_TYPE_PATTERN.exec(mimeString);
|
|
107
130
|
if (matches) {
|
|
@@ -126,6 +149,14 @@ function extractQueryString(url) {
|
|
|
126
149
|
function stripQueryString(url) {
|
|
127
150
|
return url.replace(QUERY_STRING_PATTERN, "");
|
|
128
151
|
}
|
|
152
|
+
function shortenUrlForDisplay(url) {
|
|
153
|
+
if (url.length < 50) {
|
|
154
|
+
return url;
|
|
155
|
+
}
|
|
156
|
+
const urlEnd = url.slice(url.length - 15);
|
|
157
|
+
const urlStart = url.substr(0, 32);
|
|
158
|
+
return `${urlStart}...${urlEnd}`;
|
|
159
|
+
}
|
|
129
160
|
|
|
130
161
|
// dist/lib/utils/resource-utils.js
|
|
131
162
|
function getResourceUrl(resource) {
|
|
@@ -207,23 +238,25 @@ async function makeResponse(resource) {
|
|
|
207
238
|
}
|
|
208
239
|
async function checkResponse(response) {
|
|
209
240
|
if (!response.ok) {
|
|
210
|
-
const
|
|
211
|
-
throw
|
|
241
|
+
const error = await getResponseError(response);
|
|
242
|
+
throw error;
|
|
212
243
|
}
|
|
213
244
|
}
|
|
214
245
|
async function getResponseError(response) {
|
|
215
|
-
|
|
246
|
+
const shortUrl = shortenUrlForDisplay(response.url);
|
|
247
|
+
let message = `Failed to fetch resource (${response.status}) ${response.statusText}: ${shortUrl}`;
|
|
248
|
+
message = message.length > 100 ? `${message.slice(0, 100)}...` : message;
|
|
249
|
+
const info = {
|
|
250
|
+
reason: response.statusText,
|
|
251
|
+
url: response.url,
|
|
252
|
+
response
|
|
253
|
+
};
|
|
216
254
|
try {
|
|
217
255
|
const contentType = response.headers.get("Content-Type");
|
|
218
|
-
|
|
219
|
-
if (contentType == null ? void 0 : contentType.includes("application/json")) {
|
|
220
|
-
text += ` ${await response.text()}`;
|
|
221
|
-
}
|
|
222
|
-
message += text;
|
|
223
|
-
message = message.length > 60 ? `${message.slice(0, 60)}...` : message;
|
|
256
|
+
info.reason = (contentType == null ? void 0 : contentType.includes("application/json")) ? await response.json() : response.text();
|
|
224
257
|
} catch (error) {
|
|
225
258
|
}
|
|
226
|
-
return message;
|
|
259
|
+
return new FetchError(message, info);
|
|
227
260
|
}
|
|
228
261
|
async function getInitialDataUrl(resource) {
|
|
229
262
|
const INITIAL_DATA_LENGTH = 5;
|
|
@@ -301,6 +334,9 @@ async function readBlob(blob) {
|
|
|
301
334
|
});
|
|
302
335
|
}
|
|
303
336
|
|
|
337
|
+
// dist/lib/loader-utils/option-utils.js
|
|
338
|
+
var import_loader_utils3 = require("@loaders.gl/loader-utils");
|
|
339
|
+
|
|
304
340
|
// dist/lib/loader-utils/loggers.js
|
|
305
341
|
var import_log = require("@probe.gl/log");
|
|
306
342
|
var probeLog = new import_log.Log({ id: "loaders.gl" });
|
|
@@ -409,6 +445,7 @@ function setGlobalOptions(options) {
|
|
|
409
445
|
const state = getGlobalLoaderState();
|
|
410
446
|
const globalOptions = getGlobalLoaderOptions();
|
|
411
447
|
state.globalOptions = normalizeOptionsInternal(globalOptions, options);
|
|
448
|
+
(0, import_loader_utils3.registerJSModules)(options.modules);
|
|
412
449
|
}
|
|
413
450
|
function normalizeOptions(options, loader, loaders, url) {
|
|
414
451
|
loaders = loaders || [];
|
|
@@ -492,7 +529,7 @@ function addUrlOptions(options, url) {
|
|
|
492
529
|
}
|
|
493
530
|
|
|
494
531
|
// dist/lib/loader-utils/normalize-loader.js
|
|
495
|
-
var
|
|
532
|
+
var import_loader_utils4 = require("@loaders.gl/loader-utils");
|
|
496
533
|
function isLoaderObject(loader) {
|
|
497
534
|
if (!loader) {
|
|
498
535
|
return false;
|
|
@@ -504,8 +541,8 @@ function isLoaderObject(loader) {
|
|
|
504
541
|
return hasExtensions;
|
|
505
542
|
}
|
|
506
543
|
function normalizeLoader(loader) {
|
|
507
|
-
(0,
|
|
508
|
-
(0,
|
|
544
|
+
(0, import_loader_utils4.assert)(loader, "null loader");
|
|
545
|
+
(0, import_loader_utils4.assert)(isLoaderObject(loader), "invalid loader");
|
|
509
546
|
let options;
|
|
510
547
|
if (Array.isArray(loader)) {
|
|
511
548
|
options = loader[1];
|
|
@@ -549,7 +586,7 @@ function _unregisterLoaders() {
|
|
|
549
586
|
}
|
|
550
587
|
|
|
551
588
|
// dist/lib/api/select-loader.js
|
|
552
|
-
var
|
|
589
|
+
var import_loader_utils5 = require("@loaders.gl/loader-utils");
|
|
553
590
|
|
|
554
591
|
// dist/lib/utils/log.js
|
|
555
592
|
var import_log2 = require("@probe.gl/log");
|
|
@@ -632,7 +669,7 @@ function getNoValidLoaderMessage(data) {
|
|
|
632
669
|
const url = getResourceUrl(data);
|
|
633
670
|
const type = getResourceMIMEType(data);
|
|
634
671
|
let message = "No valid loader found (";
|
|
635
|
-
message += url ? `${
|
|
672
|
+
message += url ? `${import_loader_utils5.path.filename(url)}, ` : "no url provided, ";
|
|
636
673
|
message += `MIME type: ${type ? `"${type}"` : "not provided"}, `;
|
|
637
674
|
const firstCharacters = data ? getFirstCharacters(data) : "";
|
|
638
675
|
message += firstCharacters ? ` first bytes: "${firstCharacters}"` : "first bytes: not available";
|
|
@@ -661,11 +698,12 @@ function findLoaderByExtension(loaders, extension) {
|
|
|
661
698
|
return null;
|
|
662
699
|
}
|
|
663
700
|
function findLoaderByMIMEType(loaders, mimeType) {
|
|
701
|
+
var _a;
|
|
664
702
|
for (const loader of loaders) {
|
|
665
|
-
if (loader.mimeTypes
|
|
703
|
+
if ((_a = loader.mimeTypes) == null ? void 0 : _a.some((mimeType1) => compareMIMETypes(mimeType, mimeType1))) {
|
|
666
704
|
return loader;
|
|
667
705
|
}
|
|
668
|
-
if (mimeType
|
|
706
|
+
if (compareMIMETypes(mimeType, `application/x.${loader.id}`)) {
|
|
669
707
|
return loader;
|
|
670
708
|
}
|
|
671
709
|
}
|
|
@@ -706,7 +744,7 @@ function testDataAgainstBinary(data, byteOffset, loader) {
|
|
|
706
744
|
}
|
|
707
745
|
function testBinary(data, byteOffset, loader, test) {
|
|
708
746
|
if (test instanceof ArrayBuffer) {
|
|
709
|
-
return (0,
|
|
747
|
+
return (0, import_loader_utils5.compareArrayBuffers)(test, data, test.byteLength);
|
|
710
748
|
}
|
|
711
749
|
switch (typeof test) {
|
|
712
750
|
case "function":
|
|
@@ -742,12 +780,12 @@ function getMagicString(arrayBuffer, byteOffset, length) {
|
|
|
742
780
|
}
|
|
743
781
|
|
|
744
782
|
// dist/lib/api/parse.js
|
|
745
|
-
var import_loader_utils8 = require("@loaders.gl/loader-utils");
|
|
746
|
-
var import_worker_utils = require("@loaders.gl/worker-utils");
|
|
747
783
|
var import_loader_utils9 = require("@loaders.gl/loader-utils");
|
|
784
|
+
var import_worker_utils = require("@loaders.gl/worker-utils");
|
|
785
|
+
var import_loader_utils10 = require("@loaders.gl/loader-utils");
|
|
748
786
|
|
|
749
787
|
// dist/lib/loader-utils/get-data.js
|
|
750
|
-
var
|
|
788
|
+
var import_loader_utils7 = require("@loaders.gl/loader-utils");
|
|
751
789
|
|
|
752
790
|
// dist/iterators/make-iterator/make-string-iterator.js
|
|
753
791
|
var DEFAULT_CHUNK_SIZE = 256 * 1024;
|
|
@@ -793,9 +831,9 @@ async function* makeBlobIterator(blob, options) {
|
|
|
793
831
|
}
|
|
794
832
|
|
|
795
833
|
// dist/iterators/make-iterator/make-stream-iterator.js
|
|
796
|
-
var
|
|
834
|
+
var import_loader_utils6 = require("@loaders.gl/loader-utils");
|
|
797
835
|
function makeStreamIterator(stream, options) {
|
|
798
|
-
return
|
|
836
|
+
return import_loader_utils6.isBrowser ? makeBrowserStreamIterator(stream, options) : makeNodeStreamIterator(stream, options);
|
|
799
837
|
}
|
|
800
838
|
async function* makeBrowserStreamIterator(stream, options) {
|
|
801
839
|
const reader = stream.getReader();
|
|
@@ -810,7 +848,7 @@ async function* makeBrowserStreamIterator(stream, options) {
|
|
|
810
848
|
if (done) {
|
|
811
849
|
return;
|
|
812
850
|
}
|
|
813
|
-
yield (0,
|
|
851
|
+
yield (0, import_loader_utils6.toArrayBuffer)(value);
|
|
814
852
|
}
|
|
815
853
|
} catch (error) {
|
|
816
854
|
reader.releaseLock();
|
|
@@ -818,7 +856,7 @@ async function* makeBrowserStreamIterator(stream, options) {
|
|
|
818
856
|
}
|
|
819
857
|
async function* makeNodeStreamIterator(stream, options) {
|
|
820
858
|
for await (const chunk of stream) {
|
|
821
|
-
yield (0,
|
|
859
|
+
yield (0, import_loader_utils6.toArrayBuffer)(chunk);
|
|
822
860
|
}
|
|
823
861
|
}
|
|
824
862
|
|
|
@@ -891,7 +929,7 @@ async function getArrayBufferOrStringFromData(data, loader, options) {
|
|
|
891
929
|
data = makeIterator(data, options);
|
|
892
930
|
}
|
|
893
931
|
if (isIterable(data) || isAsyncIterable(data)) {
|
|
894
|
-
return (0,
|
|
932
|
+
return (0, import_loader_utils7.concatenateArrayBuffersAsync)(data);
|
|
895
933
|
}
|
|
896
934
|
throw new Error(ERR_DATA);
|
|
897
935
|
}
|
|
@@ -950,7 +988,7 @@ function getFetchFunction(options, context) {
|
|
|
950
988
|
}
|
|
951
989
|
|
|
952
990
|
// dist/lib/loader-utils/loader-context.js
|
|
953
|
-
var
|
|
991
|
+
var import_loader_utils8 = require("@loaders.gl/loader-utils");
|
|
954
992
|
function getLoaderContext(context, options, parentContext) {
|
|
955
993
|
if (parentContext) {
|
|
956
994
|
return parentContext;
|
|
@@ -963,8 +1001,8 @@ function getLoaderContext(context, options, parentContext) {
|
|
|
963
1001
|
const baseUrl = stripQueryString(newContext.url);
|
|
964
1002
|
newContext.baseUrl = baseUrl;
|
|
965
1003
|
newContext.queryString = extractQueryString(newContext.url);
|
|
966
|
-
newContext.filename =
|
|
967
|
-
newContext.baseUrl =
|
|
1004
|
+
newContext.filename = import_loader_utils8.path.filename(baseUrl);
|
|
1005
|
+
newContext.baseUrl = import_loader_utils8.path.dirname(baseUrl);
|
|
968
1006
|
}
|
|
969
1007
|
if (!Array.isArray(newContext.loaders)) {
|
|
970
1008
|
newContext.loaders = null;
|
|
@@ -1013,7 +1051,7 @@ async function parse(data, loaders, options, context) {
|
|
|
1013
1051
|
}
|
|
1014
1052
|
async function parseWithLoader(loader, data, options, context) {
|
|
1015
1053
|
(0, import_worker_utils.validateWorkerVersion)(loader);
|
|
1016
|
-
options = (0,
|
|
1054
|
+
options = (0, import_loader_utils10.mergeLoaderOptions)(loader.options, options);
|
|
1017
1055
|
if (isResponse(data)) {
|
|
1018
1056
|
const response = data;
|
|
1019
1057
|
const { ok, redirected, status, statusText, type, url } = response;
|
|
@@ -1025,8 +1063,8 @@ async function parseWithLoader(loader, data, options, context) {
|
|
|
1025
1063
|
if (loaderWithParser.parseTextSync && typeof data === "string") {
|
|
1026
1064
|
return loaderWithParser.parseTextSync(data, options, context);
|
|
1027
1065
|
}
|
|
1028
|
-
if ((0,
|
|
1029
|
-
return await (0,
|
|
1066
|
+
if ((0, import_loader_utils9.canParseWithWorker)(loader, options)) {
|
|
1067
|
+
return await (0, import_loader_utils9.parseWithWorker)(loader, data, options, context, parse);
|
|
1030
1068
|
}
|
|
1031
1069
|
if (loaderWithParser.parseText && typeof data === "string") {
|
|
1032
1070
|
return await loaderWithParser.parseText(data, options, context);
|
|
@@ -1073,7 +1111,7 @@ function parseWithLoaderSync(loader, data, options, context) {
|
|
|
1073
1111
|
|
|
1074
1112
|
// dist/lib/api/parse-in-batches.js
|
|
1075
1113
|
var import_schema = require("@loaders.gl/schema");
|
|
1076
|
-
var
|
|
1114
|
+
var import_loader_utils11 = require("@loaders.gl/loader-utils");
|
|
1077
1115
|
async function parseInBatches(data, loaders, options, context) {
|
|
1078
1116
|
const loaderArray = Array.isArray(loaders) ? loaders : void 0;
|
|
1079
1117
|
if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
|
|
@@ -1123,7 +1161,7 @@ async function parseToOutputIterator(loader, data, options, context) {
|
|
|
1123
1161
|
return parseChunkInBatches(transformedIterator, loader, options, context);
|
|
1124
1162
|
}
|
|
1125
1163
|
async function* parseChunkInBatches(transformedIterator, loader, options, context) {
|
|
1126
|
-
const arrayBuffer = await (0,
|
|
1164
|
+
const arrayBuffer = await (0, import_loader_utils11.concatenateArrayBuffersAsync)(transformedIterator);
|
|
1127
1165
|
const parsedData = await parse(
|
|
1128
1166
|
arrayBuffer,
|
|
1129
1167
|
loader,
|
|
@@ -1202,7 +1240,7 @@ async function loadOneFileInBatches(file, loaders, options, fetch2) {
|
|
|
1202
1240
|
}
|
|
1203
1241
|
|
|
1204
1242
|
// dist/lib/api/encode-table.js
|
|
1205
|
-
var
|
|
1243
|
+
var import_loader_utils12 = require("@loaders.gl/loader-utils");
|
|
1206
1244
|
async function encodeTable(data, writer, options) {
|
|
1207
1245
|
if (writer.encode) {
|
|
1208
1246
|
return await writer.encode(data, options);
|
|
@@ -1217,7 +1255,7 @@ async function encodeTable(data, writer, options) {
|
|
|
1217
1255
|
for await (const batch of batches) {
|
|
1218
1256
|
chunks.push(batch);
|
|
1219
1257
|
}
|
|
1220
|
-
return (0,
|
|
1258
|
+
return (0, import_loader_utils12.concatenateArrayBuffers)(...chunks);
|
|
1221
1259
|
}
|
|
1222
1260
|
throw new Error("Writer could not encode data");
|
|
1223
1261
|
}
|
|
@@ -1244,16 +1282,16 @@ function getIterator(data) {
|
|
|
1244
1282
|
}
|
|
1245
1283
|
|
|
1246
1284
|
// dist/lib/api/encode.js
|
|
1247
|
-
var import_loader_utils12 = require("@loaders.gl/loader-utils");
|
|
1248
|
-
var import_worker_utils2 = require("@loaders.gl/worker-utils");
|
|
1249
1285
|
var import_loader_utils13 = require("@loaders.gl/loader-utils");
|
|
1286
|
+
var import_worker_utils2 = require("@loaders.gl/worker-utils");
|
|
1287
|
+
var import_loader_utils14 = require("@loaders.gl/loader-utils");
|
|
1250
1288
|
async function encode(data, writer, options) {
|
|
1251
1289
|
const globalOptions = getGlobalLoaderOptions();
|
|
1252
1290
|
options = { ...globalOptions, ...options };
|
|
1253
1291
|
if (writer.encodeURLtoURL) {
|
|
1254
1292
|
return encodeWithCommandLineTool(writer, data, options);
|
|
1255
1293
|
}
|
|
1256
|
-
if ((0,
|
|
1294
|
+
if ((0, import_loader_utils13.canEncodeWithWorker)(writer, options)) {
|
|
1257
1295
|
return await (0, import_worker_utils2.processOnWorker)(writer, data, options);
|
|
1258
1296
|
}
|
|
1259
1297
|
return await writer.encode(data, options);
|
|
@@ -1298,20 +1336,20 @@ function encodeInBatches(data, writer, options) {
|
|
|
1298
1336
|
throw new Error(`Writer ${writer.name} could not encode in batches`);
|
|
1299
1337
|
}
|
|
1300
1338
|
async function encodeURLtoURL(inputUrl, outputUrl, writer, options) {
|
|
1301
|
-
inputUrl = (0,
|
|
1302
|
-
outputUrl = (0,
|
|
1303
|
-
if (
|
|
1339
|
+
inputUrl = (0, import_loader_utils13.resolvePath)(inputUrl);
|
|
1340
|
+
outputUrl = (0, import_loader_utils13.resolvePath)(outputUrl);
|
|
1341
|
+
if (import_loader_utils14.isBrowser || !writer.encodeURLtoURL) {
|
|
1304
1342
|
throw new Error();
|
|
1305
1343
|
}
|
|
1306
1344
|
const outputFilename = await writer.encodeURLtoURL(inputUrl, outputUrl, options);
|
|
1307
1345
|
return outputFilename;
|
|
1308
1346
|
}
|
|
1309
1347
|
async function encodeWithCommandLineTool(writer, data, options) {
|
|
1310
|
-
if (
|
|
1348
|
+
if (import_loader_utils14.isBrowser) {
|
|
1311
1349
|
throw new Error(`Writer ${writer.name} not supported in browser`);
|
|
1312
1350
|
}
|
|
1313
1351
|
const tmpInputFilename = getTemporaryFilename("input");
|
|
1314
|
-
const file = new
|
|
1352
|
+
const file = new import_loader_utils13.NodeFile(tmpInputFilename, "w");
|
|
1315
1353
|
await file.write(data);
|
|
1316
1354
|
const tmpOutputFilename = getTemporaryFilename("output");
|
|
1317
1355
|
const outputFilename = await encodeURLtoURL(tmpInputFilename, tmpOutputFilename, writer, options);
|
|
@@ -1327,8 +1365,8 @@ function getTemporaryFilename(filename) {
|
|
|
1327
1365
|
}
|
|
1328
1366
|
|
|
1329
1367
|
// dist/index.js
|
|
1330
|
-
var import_loader_utils15 = require("@loaders.gl/loader-utils");
|
|
1331
1368
|
var import_loader_utils16 = require("@loaders.gl/loader-utils");
|
|
1369
|
+
var import_loader_utils17 = require("@loaders.gl/loader-utils");
|
|
1332
1370
|
|
|
1333
1371
|
// dist/iterators/make-stream/make-stream.js
|
|
1334
1372
|
function makeStream(source, options) {
|
|
@@ -1370,8 +1408,10 @@ function makeStream(source, options) {
|
|
|
1370
1408
|
}
|
|
1371
1409
|
|
|
1372
1410
|
// dist/null-loader.js
|
|
1373
|
-
var VERSION = true ? "4.2.0-alpha.
|
|
1411
|
+
var VERSION = true ? "4.2.0-alpha.6" : "latest";
|
|
1374
1412
|
var NullWorkerLoader = {
|
|
1413
|
+
dataType: null,
|
|
1414
|
+
batchType: null,
|
|
1375
1415
|
name: "Null loader",
|
|
1376
1416
|
id: "null",
|
|
1377
1417
|
module: "core",
|
|
@@ -1385,6 +1425,8 @@ var NullWorkerLoader = {
|
|
|
1385
1425
|
}
|
|
1386
1426
|
};
|
|
1387
1427
|
var NullLoader = {
|
|
1428
|
+
dataType: null,
|
|
1429
|
+
batchType: null,
|
|
1388
1430
|
name: "Null loader",
|
|
1389
1431
|
id: "null",
|
|
1390
1432
|
module: "core",
|
|
@@ -1408,7 +1450,7 @@ function parseSync2(arrayBuffer, options, context) {
|
|
|
1408
1450
|
}
|
|
1409
1451
|
|
|
1410
1452
|
// dist/index.js
|
|
1411
|
-
var
|
|
1453
|
+
var import_loader_utils18 = require("@loaders.gl/loader-utils");
|
|
1412
1454
|
|
|
1413
1455
|
// dist/lib/progress/fetch-progress.js
|
|
1414
1456
|
async function fetchProgress(response, onProgress, onDone = () => {
|
|
@@ -1458,7 +1500,7 @@ async function read(controller, reader, loadedBytes, totalBytes, onProgress, onD
|
|
|
1458
1500
|
}
|
|
1459
1501
|
|
|
1460
1502
|
// dist/lib/filesystems/browser-filesystem.js
|
|
1461
|
-
var
|
|
1503
|
+
var import_loader_utils15 = require("@loaders.gl/loader-utils");
|
|
1462
1504
|
var BrowserFileSystem = class {
|
|
1463
1505
|
_fetch;
|
|
1464
1506
|
files = {};
|
|
@@ -1540,7 +1582,7 @@ var BrowserFileSystem = class {
|
|
|
1540
1582
|
// implements IRandomAccessFileSystem
|
|
1541
1583
|
// RANDOM ACCESS
|
|
1542
1584
|
async openReadableFile(pathname, flags) {
|
|
1543
|
-
return new
|
|
1585
|
+
return new import_loader_utils15.BlobFile(this.files[pathname]);
|
|
1544
1586
|
}
|
|
1545
1587
|
// PRIVATE
|
|
1546
1588
|
// Supports case independent paths, and file usage tracking
|
|
@@ -1554,8 +1596,8 @@ var BrowserFileSystem = class {
|
|
|
1554
1596
|
};
|
|
1555
1597
|
|
|
1556
1598
|
// dist/index.js
|
|
1557
|
-
var import_loader_utils18 = require("@loaders.gl/loader-utils");
|
|
1558
1599
|
var import_loader_utils19 = require("@loaders.gl/loader-utils");
|
|
1559
1600
|
var import_loader_utils20 = require("@loaders.gl/loader-utils");
|
|
1560
1601
|
var import_loader_utils21 = require("@loaders.gl/loader-utils");
|
|
1602
|
+
var import_loader_utils22 = require("@loaders.gl/loader-utils");
|
|
1561
1603
|
//# sourceMappingURL=index.cjs.map
|