@loaders.gl/core 4.2.0-alpha.5 → 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.
Files changed (49) hide show
  1. package/dist/dist.dev.js +1946 -1868
  2. package/dist/dist.min.js +3 -3
  3. package/dist/index.cjs +115 -71
  4. package/dist/index.cjs.map +4 -4
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -0
  8. package/dist/lib/api/parse-in-batches.js +1 -0
  9. package/dist/lib/api/select-loader.d.ts.map +1 -1
  10. package/dist/lib/api/select-loader.js +3 -2
  11. package/dist/lib/fetch/fetch-error-message.d.ts.map +1 -1
  12. package/dist/lib/fetch/fetch-error-message.js +2 -0
  13. package/dist/lib/fetch/fetch-error.d.ts +14 -0
  14. package/dist/lib/fetch/fetch-error.d.ts.map +1 -0
  15. package/dist/lib/fetch/fetch-error.js +17 -0
  16. package/dist/lib/fetch/fetch-file.d.ts.map +1 -1
  17. package/dist/lib/fetch/fetch-file.js +1 -0
  18. package/dist/lib/filesystems/browser-filesystem.js +4 -3
  19. package/dist/lib/init.js +1 -1
  20. package/dist/lib/loader-utils/loggers.js +1 -0
  21. package/dist/lib/loader-utils/option-utils.d.ts +1 -1
  22. package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
  23. package/dist/lib/loader-utils/option-utils.js +3 -0
  24. package/dist/lib/utils/mime-type-utils.d.ts +8 -0
  25. package/dist/lib/utils/mime-type-utils.d.ts.map +1 -1
  26. package/dist/lib/utils/mime-type-utils.js +13 -0
  27. package/dist/lib/utils/response-utils.d.ts.map +1 -1
  28. package/dist/lib/utils/response-utils.js +16 -10
  29. package/dist/lib/utils/url-utils.d.ts +1 -0
  30. package/dist/lib/utils/url-utils.d.ts.map +1 -1
  31. package/dist/lib/utils/url-utils.js +8 -0
  32. package/dist/null-loader.d.ts +40 -3
  33. package/dist/null-loader.d.ts.map +1 -1
  34. package/dist/null-loader.js +5 -1
  35. package/dist/null-worker-node.js +6 -2
  36. package/dist/null-worker.js +6 -2
  37. package/package.json +9 -8
  38. package/src/index.ts +1 -0
  39. package/src/lib/api/parse-in-batches.ts +6 -5
  40. package/src/lib/api/select-loader.ts +3 -2
  41. package/src/lib/fetch/fetch-error-message.ts +2 -0
  42. package/src/lib/fetch/fetch-error.ts +18 -0
  43. package/src/lib/fetch/fetch-file.ts +1 -0
  44. package/src/lib/loader-utils/option-utils.ts +3 -1
  45. package/src/lib/utils/mime-type-utils.ts +14 -0
  46. package/src/lib/utils/resource-utils.ts +1 -1
  47. package/src/lib/utils/response-utils.ts +19 -11
  48. package/src/lib/utils/url-utils.ts +9 -0
  49. 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
- JSONLoader: () => import_loader_utils17.JSONLoader,
23
+ FetchError: () => FetchError,
24
+ JSONLoader: () => import_loader_utils18.JSONLoader,
24
25
  NullLoader: () => NullLoader,
25
26
  NullWorkerLoader: () => NullWorkerLoader,
26
- RequestScheduler: () => import_loader_utils16.RequestScheduler,
27
+ RequestScheduler: () => import_loader_utils17.RequestScheduler,
27
28
  _BrowserFileSystem: () => BrowserFileSystem,
28
29
  _fetchProgress: () => fetchProgress,
29
30
  _unregisterLoaders: () => _unregisterLoaders,
30
- assert: () => import_loader_utils19.assert,
31
- concatenateArrayBuffersAsync: () => import_loader_utils20.concatenateArrayBuffersAsync,
32
- document: () => import_loader_utils18.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: () => import_loader_utils20.forEach,
44
+ forEach: () => import_loader_utils21.forEach,
44
45
  getLoaderOptions: () => getGlobalLoaderOptions,
45
- getPathPrefix: () => import_loader_utils15.getPathPrefix,
46
- global: () => import_loader_utils18.global,
46
+ getPathPrefix: () => import_loader_utils16.getPathPrefix,
47
+ global: () => import_loader_utils19.global,
47
48
  isAsyncIterable: () => isAsyncIterable,
48
- isBrowser: () => import_loader_utils18.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: () => import_loader_utils18.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: () => import_loader_utils21.makeLineIterator,
61
- makeNumberedLineIterator: () => import_loader_utils21.makeNumberedLineIterator,
61
+ makeLineIterator: () => import_loader_utils22.makeLineIterator,
62
+ makeNumberedLineIterator: () => import_loader_utils22.makeNumberedLineIterator,
62
63
  makeStream: () => makeStream,
63
- makeTextDecoderIterator: () => import_loader_utils21.makeTextDecoderIterator,
64
- makeTextEncoderIterator: () => import_loader_utils21.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: () => import_loader_utils15.resolvePath,
71
+ resolvePath: () => import_loader_utils16.resolvePath,
71
72
  selectLoader: () => selectLoader,
72
73
  selectLoaderSync: () => selectLoaderSync,
73
- self: () => import_loader_utils18.self,
74
+ self: () => import_loader_utils19.self,
74
75
  setLoaderOptions: () => setGlobalOptions,
75
- setPathPrefix: () => import_loader_utils15.setPathPrefix,
76
- window: () => import_loader_utils18.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 message = await getResponseError(response);
211
- throw new Error(message);
241
+ const error = await getResponseError(response);
242
+ throw error;
212
243
  }
213
244
  }
214
245
  async function getResponseError(response) {
215
- let message = `Failed to fetch resource ${response.url} (${response.status}): `;
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
- let text = response.statusText;
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" });
@@ -323,6 +359,7 @@ var NullLog = class {
323
359
  }
324
360
  };
325
361
  var ConsoleLog = class {
362
+ console;
326
363
  constructor() {
327
364
  this.console = console;
328
365
  }
@@ -408,6 +445,7 @@ function setGlobalOptions(options) {
408
445
  const state = getGlobalLoaderState();
409
446
  const globalOptions = getGlobalLoaderOptions();
410
447
  state.globalOptions = normalizeOptionsInternal(globalOptions, options);
448
+ (0, import_loader_utils3.registerJSModules)(options.modules);
411
449
  }
412
450
  function normalizeOptions(options, loader, loaders, url) {
413
451
  loaders = loaders || [];
@@ -491,7 +529,7 @@ function addUrlOptions(options, url) {
491
529
  }
492
530
 
493
531
  // dist/lib/loader-utils/normalize-loader.js
494
- var import_loader_utils3 = require("@loaders.gl/loader-utils");
532
+ var import_loader_utils4 = require("@loaders.gl/loader-utils");
495
533
  function isLoaderObject(loader) {
496
534
  if (!loader) {
497
535
  return false;
@@ -503,8 +541,8 @@ function isLoaderObject(loader) {
503
541
  return hasExtensions;
504
542
  }
505
543
  function normalizeLoader(loader) {
506
- (0, import_loader_utils3.assert)(loader, "null loader");
507
- (0, import_loader_utils3.assert)(isLoaderObject(loader), "invalid loader");
544
+ (0, import_loader_utils4.assert)(loader, "null loader");
545
+ (0, import_loader_utils4.assert)(isLoaderObject(loader), "invalid loader");
508
546
  let options;
509
547
  if (Array.isArray(loader)) {
510
548
  options = loader[1];
@@ -548,7 +586,7 @@ function _unregisterLoaders() {
548
586
  }
549
587
 
550
588
  // dist/lib/api/select-loader.js
551
- var import_loader_utils4 = require("@loaders.gl/loader-utils");
589
+ var import_loader_utils5 = require("@loaders.gl/loader-utils");
552
590
 
553
591
  // dist/lib/utils/log.js
554
592
  var import_log2 = require("@probe.gl/log");
@@ -631,7 +669,7 @@ function getNoValidLoaderMessage(data) {
631
669
  const url = getResourceUrl(data);
632
670
  const type = getResourceMIMEType(data);
633
671
  let message = "No valid loader found (";
634
- message += url ? `${import_loader_utils4.path.filename(url)}, ` : "no url provided, ";
672
+ message += url ? `${import_loader_utils5.path.filename(url)}, ` : "no url provided, ";
635
673
  message += `MIME type: ${type ? `"${type}"` : "not provided"}, `;
636
674
  const firstCharacters = data ? getFirstCharacters(data) : "";
637
675
  message += firstCharacters ? ` first bytes: "${firstCharacters}"` : "first bytes: not available";
@@ -660,11 +698,12 @@ function findLoaderByExtension(loaders, extension) {
660
698
  return null;
661
699
  }
662
700
  function findLoaderByMIMEType(loaders, mimeType) {
701
+ var _a;
663
702
  for (const loader of loaders) {
664
- if (loader.mimeTypes && loader.mimeTypes.includes(mimeType)) {
703
+ if ((_a = loader.mimeTypes) == null ? void 0 : _a.some((mimeType1) => compareMIMETypes(mimeType, mimeType1))) {
665
704
  return loader;
666
705
  }
667
- if (mimeType === `application/x.${loader.id}`) {
706
+ if (compareMIMETypes(mimeType, `application/x.${loader.id}`)) {
668
707
  return loader;
669
708
  }
670
709
  }
@@ -705,7 +744,7 @@ function testDataAgainstBinary(data, byteOffset, loader) {
705
744
  }
706
745
  function testBinary(data, byteOffset, loader, test) {
707
746
  if (test instanceof ArrayBuffer) {
708
- return (0, import_loader_utils4.compareArrayBuffers)(test, data, test.byteLength);
747
+ return (0, import_loader_utils5.compareArrayBuffers)(test, data, test.byteLength);
709
748
  }
710
749
  switch (typeof test) {
711
750
  case "function":
@@ -741,12 +780,12 @@ function getMagicString(arrayBuffer, byteOffset, length) {
741
780
  }
742
781
 
743
782
  // dist/lib/api/parse.js
744
- var import_loader_utils8 = require("@loaders.gl/loader-utils");
745
- var import_worker_utils = require("@loaders.gl/worker-utils");
746
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");
747
786
 
748
787
  // dist/lib/loader-utils/get-data.js
749
- var import_loader_utils6 = require("@loaders.gl/loader-utils");
788
+ var import_loader_utils7 = require("@loaders.gl/loader-utils");
750
789
 
751
790
  // dist/iterators/make-iterator/make-string-iterator.js
752
791
  var DEFAULT_CHUNK_SIZE = 256 * 1024;
@@ -792,9 +831,9 @@ async function* makeBlobIterator(blob, options) {
792
831
  }
793
832
 
794
833
  // dist/iterators/make-iterator/make-stream-iterator.js
795
- var import_loader_utils5 = require("@loaders.gl/loader-utils");
834
+ var import_loader_utils6 = require("@loaders.gl/loader-utils");
796
835
  function makeStreamIterator(stream, options) {
797
- return import_loader_utils5.isBrowser ? makeBrowserStreamIterator(stream, options) : makeNodeStreamIterator(stream, options);
836
+ return import_loader_utils6.isBrowser ? makeBrowserStreamIterator(stream, options) : makeNodeStreamIterator(stream, options);
798
837
  }
799
838
  async function* makeBrowserStreamIterator(stream, options) {
800
839
  const reader = stream.getReader();
@@ -809,7 +848,7 @@ async function* makeBrowserStreamIterator(stream, options) {
809
848
  if (done) {
810
849
  return;
811
850
  }
812
- yield (0, import_loader_utils5.toArrayBuffer)(value);
851
+ yield (0, import_loader_utils6.toArrayBuffer)(value);
813
852
  }
814
853
  } catch (error) {
815
854
  reader.releaseLock();
@@ -817,7 +856,7 @@ async function* makeBrowserStreamIterator(stream, options) {
817
856
  }
818
857
  async function* makeNodeStreamIterator(stream, options) {
819
858
  for await (const chunk of stream) {
820
- yield (0, import_loader_utils5.toArrayBuffer)(chunk);
859
+ yield (0, import_loader_utils6.toArrayBuffer)(chunk);
821
860
  }
822
861
  }
823
862
 
@@ -890,7 +929,7 @@ async function getArrayBufferOrStringFromData(data, loader, options) {
890
929
  data = makeIterator(data, options);
891
930
  }
892
931
  if (isIterable(data) || isAsyncIterable(data)) {
893
- return (0, import_loader_utils6.concatenateArrayBuffersAsync)(data);
932
+ return (0, import_loader_utils7.concatenateArrayBuffersAsync)(data);
894
933
  }
895
934
  throw new Error(ERR_DATA);
896
935
  }
@@ -949,7 +988,7 @@ function getFetchFunction(options, context) {
949
988
  }
950
989
 
951
990
  // dist/lib/loader-utils/loader-context.js
952
- var import_loader_utils7 = require("@loaders.gl/loader-utils");
991
+ var import_loader_utils8 = require("@loaders.gl/loader-utils");
953
992
  function getLoaderContext(context, options, parentContext) {
954
993
  if (parentContext) {
955
994
  return parentContext;
@@ -962,8 +1001,8 @@ function getLoaderContext(context, options, parentContext) {
962
1001
  const baseUrl = stripQueryString(newContext.url);
963
1002
  newContext.baseUrl = baseUrl;
964
1003
  newContext.queryString = extractQueryString(newContext.url);
965
- newContext.filename = import_loader_utils7.path.filename(baseUrl);
966
- newContext.baseUrl = import_loader_utils7.path.dirname(baseUrl);
1004
+ newContext.filename = import_loader_utils8.path.filename(baseUrl);
1005
+ newContext.baseUrl = import_loader_utils8.path.dirname(baseUrl);
967
1006
  }
968
1007
  if (!Array.isArray(newContext.loaders)) {
969
1008
  newContext.loaders = null;
@@ -1012,7 +1051,7 @@ async function parse(data, loaders, options, context) {
1012
1051
  }
1013
1052
  async function parseWithLoader(loader, data, options, context) {
1014
1053
  (0, import_worker_utils.validateWorkerVersion)(loader);
1015
- options = (0, import_loader_utils9.mergeLoaderOptions)(loader.options, options);
1054
+ options = (0, import_loader_utils10.mergeLoaderOptions)(loader.options, options);
1016
1055
  if (isResponse(data)) {
1017
1056
  const response = data;
1018
1057
  const { ok, redirected, status, statusText, type, url } = response;
@@ -1024,8 +1063,8 @@ async function parseWithLoader(loader, data, options, context) {
1024
1063
  if (loaderWithParser.parseTextSync && typeof data === "string") {
1025
1064
  return loaderWithParser.parseTextSync(data, options, context);
1026
1065
  }
1027
- if ((0, import_loader_utils8.canParseWithWorker)(loader, options)) {
1028
- return await (0, import_loader_utils8.parseWithWorker)(loader, data, options, context, parse);
1066
+ if ((0, import_loader_utils9.canParseWithWorker)(loader, options)) {
1067
+ return await (0, import_loader_utils9.parseWithWorker)(loader, data, options, context, parse);
1029
1068
  }
1030
1069
  if (loaderWithParser.parseText && typeof data === "string") {
1031
1070
  return await loaderWithParser.parseText(data, options, context);
@@ -1072,7 +1111,7 @@ function parseWithLoaderSync(loader, data, options, context) {
1072
1111
 
1073
1112
  // dist/lib/api/parse-in-batches.js
1074
1113
  var import_schema = require("@loaders.gl/schema");
1075
- var import_loader_utils10 = require("@loaders.gl/loader-utils");
1114
+ var import_loader_utils11 = require("@loaders.gl/loader-utils");
1076
1115
  async function parseInBatches(data, loaders, options, context) {
1077
1116
  const loaderArray = Array.isArray(loaders) ? loaders : void 0;
1078
1117
  if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
@@ -1122,7 +1161,7 @@ async function parseToOutputIterator(loader, data, options, context) {
1122
1161
  return parseChunkInBatches(transformedIterator, loader, options, context);
1123
1162
  }
1124
1163
  async function* parseChunkInBatches(transformedIterator, loader, options, context) {
1125
- const arrayBuffer = await (0, import_loader_utils10.concatenateArrayBuffersAsync)(transformedIterator);
1164
+ const arrayBuffer = await (0, import_loader_utils11.concatenateArrayBuffersAsync)(transformedIterator);
1126
1165
  const parsedData = await parse(
1127
1166
  arrayBuffer,
1128
1167
  loader,
@@ -1201,7 +1240,7 @@ async function loadOneFileInBatches(file, loaders, options, fetch2) {
1201
1240
  }
1202
1241
 
1203
1242
  // dist/lib/api/encode-table.js
1204
- var import_loader_utils11 = require("@loaders.gl/loader-utils");
1243
+ var import_loader_utils12 = require("@loaders.gl/loader-utils");
1205
1244
  async function encodeTable(data, writer, options) {
1206
1245
  if (writer.encode) {
1207
1246
  return await writer.encode(data, options);
@@ -1216,7 +1255,7 @@ async function encodeTable(data, writer, options) {
1216
1255
  for await (const batch of batches) {
1217
1256
  chunks.push(batch);
1218
1257
  }
1219
- return (0, import_loader_utils11.concatenateArrayBuffers)(...chunks);
1258
+ return (0, import_loader_utils12.concatenateArrayBuffers)(...chunks);
1220
1259
  }
1221
1260
  throw new Error("Writer could not encode data");
1222
1261
  }
@@ -1243,16 +1282,16 @@ function getIterator(data) {
1243
1282
  }
1244
1283
 
1245
1284
  // dist/lib/api/encode.js
1246
- var import_loader_utils12 = require("@loaders.gl/loader-utils");
1247
- var import_worker_utils2 = require("@loaders.gl/worker-utils");
1248
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");
1249
1288
  async function encode(data, writer, options) {
1250
1289
  const globalOptions = getGlobalLoaderOptions();
1251
1290
  options = { ...globalOptions, ...options };
1252
1291
  if (writer.encodeURLtoURL) {
1253
1292
  return encodeWithCommandLineTool(writer, data, options);
1254
1293
  }
1255
- if ((0, import_loader_utils12.canEncodeWithWorker)(writer, options)) {
1294
+ if ((0, import_loader_utils13.canEncodeWithWorker)(writer, options)) {
1256
1295
  return await (0, import_worker_utils2.processOnWorker)(writer, data, options);
1257
1296
  }
1258
1297
  return await writer.encode(data, options);
@@ -1297,20 +1336,20 @@ function encodeInBatches(data, writer, options) {
1297
1336
  throw new Error(`Writer ${writer.name} could not encode in batches`);
1298
1337
  }
1299
1338
  async function encodeURLtoURL(inputUrl, outputUrl, writer, options) {
1300
- inputUrl = (0, import_loader_utils12.resolvePath)(inputUrl);
1301
- outputUrl = (0, import_loader_utils12.resolvePath)(outputUrl);
1302
- if (import_loader_utils13.isBrowser || !writer.encodeURLtoURL) {
1339
+ inputUrl = (0, import_loader_utils13.resolvePath)(inputUrl);
1340
+ outputUrl = (0, import_loader_utils13.resolvePath)(outputUrl);
1341
+ if (import_loader_utils14.isBrowser || !writer.encodeURLtoURL) {
1303
1342
  throw new Error();
1304
1343
  }
1305
1344
  const outputFilename = await writer.encodeURLtoURL(inputUrl, outputUrl, options);
1306
1345
  return outputFilename;
1307
1346
  }
1308
1347
  async function encodeWithCommandLineTool(writer, data, options) {
1309
- if (import_loader_utils13.isBrowser) {
1348
+ if (import_loader_utils14.isBrowser) {
1310
1349
  throw new Error(`Writer ${writer.name} not supported in browser`);
1311
1350
  }
1312
1351
  const tmpInputFilename = getTemporaryFilename("input");
1313
- const file = new import_loader_utils12.NodeFile(tmpInputFilename, "w");
1352
+ const file = new import_loader_utils13.NodeFile(tmpInputFilename, "w");
1314
1353
  await file.write(data);
1315
1354
  const tmpOutputFilename = getTemporaryFilename("output");
1316
1355
  const outputFilename = await encodeURLtoURL(tmpInputFilename, tmpOutputFilename, writer, options);
@@ -1326,8 +1365,8 @@ function getTemporaryFilename(filename) {
1326
1365
  }
1327
1366
 
1328
1367
  // dist/index.js
1329
- var import_loader_utils15 = require("@loaders.gl/loader-utils");
1330
1368
  var import_loader_utils16 = require("@loaders.gl/loader-utils");
1369
+ var import_loader_utils17 = require("@loaders.gl/loader-utils");
1331
1370
 
1332
1371
  // dist/iterators/make-stream/make-stream.js
1333
1372
  function makeStream(source, options) {
@@ -1369,8 +1408,10 @@ function makeStream(source, options) {
1369
1408
  }
1370
1409
 
1371
1410
  // dist/null-loader.js
1372
- var VERSION = true ? "4.2.0-alpha.4" : "latest";
1411
+ var VERSION = true ? "4.2.0-alpha.6" : "latest";
1373
1412
  var NullWorkerLoader = {
1413
+ dataType: null,
1414
+ batchType: null,
1374
1415
  name: "Null loader",
1375
1416
  id: "null",
1376
1417
  module: "core",
@@ -1384,6 +1425,8 @@ var NullWorkerLoader = {
1384
1425
  }
1385
1426
  };
1386
1427
  var NullLoader = {
1428
+ dataType: null,
1429
+ batchType: null,
1387
1430
  name: "Null loader",
1388
1431
  id: "null",
1389
1432
  module: "core",
@@ -1407,7 +1450,7 @@ function parseSync2(arrayBuffer, options, context) {
1407
1450
  }
1408
1451
 
1409
1452
  // dist/index.js
1410
- var import_loader_utils17 = require("@loaders.gl/loader-utils");
1453
+ var import_loader_utils18 = require("@loaders.gl/loader-utils");
1411
1454
 
1412
1455
  // dist/lib/progress/fetch-progress.js
1413
1456
  async function fetchProgress(response, onProgress, onDone = () => {
@@ -1457,17 +1500,18 @@ async function read(controller, reader, loadedBytes, totalBytes, onProgress, onD
1457
1500
  }
1458
1501
 
1459
1502
  // dist/lib/filesystems/browser-filesystem.js
1460
- var import_loader_utils14 = require("@loaders.gl/loader-utils");
1503
+ var import_loader_utils15 = require("@loaders.gl/loader-utils");
1461
1504
  var BrowserFileSystem = class {
1505
+ _fetch;
1506
+ files = {};
1507
+ lowerCaseFiles = {};
1508
+ usedFiles = {};
1462
1509
  /**
1463
1510
  * A FileSystem API wrapper around a list of browser 'File' objects
1464
1511
  * @param files
1465
1512
  * @param options
1466
1513
  */
1467
1514
  constructor(files, options) {
1468
- this.files = {};
1469
- this.lowerCaseFiles = {};
1470
- this.usedFiles = {};
1471
1515
  this._fetch = (options == null ? void 0 : options.fetch) || fetch;
1472
1516
  for (let i = 0; i < files.length; ++i) {
1473
1517
  const file = files[i];
@@ -1538,7 +1582,7 @@ var BrowserFileSystem = class {
1538
1582
  // implements IRandomAccessFileSystem
1539
1583
  // RANDOM ACCESS
1540
1584
  async openReadableFile(pathname, flags) {
1541
- return new import_loader_utils14.BlobFile(this.files[pathname]);
1585
+ return new import_loader_utils15.BlobFile(this.files[pathname]);
1542
1586
  }
1543
1587
  // PRIVATE
1544
1588
  // Supports case independent paths, and file usage tracking
@@ -1552,8 +1596,8 @@ var BrowserFileSystem = class {
1552
1596
  };
1553
1597
 
1554
1598
  // dist/index.js
1555
- var import_loader_utils18 = require("@loaders.gl/loader-utils");
1556
1599
  var import_loader_utils19 = require("@loaders.gl/loader-utils");
1557
1600
  var import_loader_utils20 = require("@loaders.gl/loader-utils");
1558
1601
  var import_loader_utils21 = require("@loaders.gl/loader-utils");
1602
+ var import_loader_utils22 = require("@loaders.gl/loader-utils");
1559
1603
  //# sourceMappingURL=index.cjs.map