@loaders.gl/loader-utils 4.2.0-alpha.3 → 4.2.0-alpha.5

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 (144) hide show
  1. package/dist/index.cjs +66 -84
  2. package/dist/index.cjs.map +7 -0
  3. package/dist/index.d.ts +46 -46
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +18 -1
  6. package/dist/json-loader.d.ts +1 -1
  7. package/dist/json-loader.d.ts.map +1 -1
  8. package/dist/json-loader.js +20 -14
  9. package/dist/lib/binary-utils/array-buffer-utils.js +75 -46
  10. package/dist/lib/binary-utils/dataview-copy-utils.d.ts +1 -1
  11. package/dist/lib/binary-utils/dataview-copy-utils.d.ts.map +1 -1
  12. package/dist/lib/binary-utils/dataview-copy-utils.js +75 -34
  13. package/dist/lib/binary-utils/get-first-characters.js +39 -21
  14. package/dist/lib/binary-utils/memory-conversion-utils.js +38 -23
  15. package/dist/lib/binary-utils/memory-copy-utils.js +49 -20
  16. package/dist/lib/env-utils/assert.js +7 -4
  17. package/dist/lib/env-utils/globals.js +15 -7
  18. package/dist/lib/file-provider/data-view-file.d.ts +1 -1
  19. package/dist/lib/file-provider/data-view-file.d.ts.map +1 -1
  20. package/dist/lib/file-provider/data-view-file.js +58 -29
  21. package/dist/lib/file-provider/file-handle-file.d.ts +1 -1
  22. package/dist/lib/file-provider/file-handle-file.d.ts.map +1 -1
  23. package/dist/lib/file-provider/file-handle-file.js +96 -58
  24. package/dist/lib/file-provider/file-provider.js +8 -3
  25. package/dist/lib/files/blob-file.d.ts +1 -1
  26. package/dist/lib/files/blob-file.d.ts.map +1 -1
  27. package/dist/lib/files/blob-file.js +24 -23
  28. package/dist/lib/files/file.js +3 -1
  29. package/dist/lib/files/http-file.d.ts +1 -1
  30. package/dist/lib/files/http-file.d.ts.map +1 -1
  31. package/dist/lib/files/http-file.js +91 -71
  32. package/dist/lib/files/node-file-facade.d.ts +1 -1
  33. package/dist/lib/files/node-file-facade.d.ts.map +1 -1
  34. package/dist/lib/files/node-file-facade.js +37 -29
  35. package/dist/lib/files/sources.js +150 -1
  36. package/dist/lib/filesystems/filesystem.d.ts +1 -1
  37. package/dist/lib/filesystems/filesystem.d.ts.map +1 -1
  38. package/dist/lib/filesystems/filesystem.js +3 -1
  39. package/dist/lib/filesystems/node-filesystem-facade.d.ts +3 -3
  40. package/dist/lib/filesystems/node-filesystem-facade.d.ts.map +1 -1
  41. package/dist/lib/filesystems/node-filesystem-facade.js +41 -31
  42. package/dist/lib/iterators/async-iteration.js +39 -24
  43. package/dist/lib/iterators/text-iterators.js +46 -39
  44. package/dist/lib/node/buffer.browser.js +15 -3
  45. package/dist/lib/node/buffer.js +30 -16
  46. package/dist/lib/node/fs.browser.js +0 -1
  47. package/dist/lib/node/promisify.js +10 -4
  48. package/dist/lib/node/stream.browser.js +0 -1
  49. package/dist/lib/node/stream.js +4 -1
  50. package/dist/lib/option-utils/merge-loader-options.d.ts +1 -1
  51. package/dist/lib/option-utils/merge-loader-options.d.ts.map +1 -1
  52. package/dist/lib/option-utils/merge-loader-options.js +25 -17
  53. package/dist/lib/parser-utils/parse-json.js +9 -6
  54. package/dist/lib/path-utils/file-aliases.js +29 -13
  55. package/dist/lib/path-utils/get-cwd.js +6 -7
  56. package/dist/lib/path-utils/path.js +149 -105
  57. package/dist/lib/request-utils/request-scheduler.d.ts +2 -1
  58. package/dist/lib/request-utils/request-scheduler.d.ts.map +1 -1
  59. package/dist/lib/request-utils/request-scheduler.js +130 -102
  60. package/dist/lib/sources/data-source.js +48 -38
  61. package/dist/lib/sources/image-source.d.ts +3 -3
  62. package/dist/lib/sources/image-source.d.ts.map +1 -1
  63. package/dist/lib/sources/image-source.js +11 -3
  64. package/dist/lib/sources/image-tile-source.d.ts +3 -3
  65. package/dist/lib/sources/image-tile-source.d.ts.map +1 -1
  66. package/dist/lib/sources/image-tile-source.js +3 -1
  67. package/dist/lib/sources/tile-source-adapter.d.ts +2 -2
  68. package/dist/lib/sources/tile-source-adapter.d.ts.map +1 -1
  69. package/dist/lib/sources/tile-source-adapter.js +43 -36
  70. package/dist/lib/sources/tile-source.js +3 -1
  71. package/dist/lib/sources/utils/image-type.js +0 -1
  72. package/dist/lib/sources/utils/utils.js +31 -17
  73. package/dist/lib/sources/vector-tile-source.d.ts +2 -2
  74. package/dist/lib/sources/vector-tile-source.d.ts.map +1 -1
  75. package/dist/lib/sources/vector-tile-source.js +3 -1
  76. package/dist/lib/worker-loader-utils/create-loader-worker.d.ts +1 -1
  77. package/dist/lib/worker-loader-utils/create-loader-worker.d.ts.map +1 -1
  78. package/dist/lib/worker-loader-utils/create-loader-worker.js +87 -87
  79. package/dist/lib/worker-loader-utils/encode-with-worker.d.ts +1 -1
  80. package/dist/lib/worker-loader-utils/encode-with-worker.d.ts.map +1 -1
  81. package/dist/lib/worker-loader-utils/encode-with-worker.js +13 -8
  82. package/dist/lib/worker-loader-utils/parse-with-worker.d.ts +1 -1
  83. package/dist/lib/worker-loader-utils/parse-with-worker.d.ts.map +1 -1
  84. package/dist/lib/worker-loader-utils/parse-with-worker.js +68 -55
  85. package/dist/loader-types.d.ts +2 -2
  86. package/dist/loader-types.d.ts.map +1 -1
  87. package/dist/loader-types.js +26 -10
  88. package/dist/service-types.d.ts +1 -1
  89. package/dist/service-types.d.ts.map +1 -1
  90. package/dist/service-types.js +3 -1
  91. package/dist/types.js +1 -1
  92. package/dist/workers/json-worker.js +0 -1
  93. package/dist/writer-types.js +3 -1
  94. package/package.json +6 -4
  95. package/src/lib/request-utils/request-scheduler.ts +17 -8
  96. package/dist/index.js.map +0 -1
  97. package/dist/json-loader.js.map +0 -1
  98. package/dist/lib/binary-utils/array-buffer-utils.js.map +0 -1
  99. package/dist/lib/binary-utils/dataview-copy-utils.js.map +0 -1
  100. package/dist/lib/binary-utils/get-first-characters.js.map +0 -1
  101. package/dist/lib/binary-utils/memory-conversion-utils.js.map +0 -1
  102. package/dist/lib/binary-utils/memory-copy-utils.js.map +0 -1
  103. package/dist/lib/env-utils/assert.js.map +0 -1
  104. package/dist/lib/env-utils/globals.js.map +0 -1
  105. package/dist/lib/file-provider/data-view-file.js.map +0 -1
  106. package/dist/lib/file-provider/file-handle-file.js.map +0 -1
  107. package/dist/lib/file-provider/file-provider.js.map +0 -1
  108. package/dist/lib/files/blob-file.js.map +0 -1
  109. package/dist/lib/files/file.js.map +0 -1
  110. package/dist/lib/files/http-file.js.map +0 -1
  111. package/dist/lib/files/node-file-facade.js.map +0 -1
  112. package/dist/lib/files/sources.js.map +0 -1
  113. package/dist/lib/filesystems/filesystem.js.map +0 -1
  114. package/dist/lib/filesystems/node-filesystem-facade.js.map +0 -1
  115. package/dist/lib/iterators/async-iteration.js.map +0 -1
  116. package/dist/lib/iterators/text-iterators.js.map +0 -1
  117. package/dist/lib/node/buffer.browser.js.map +0 -1
  118. package/dist/lib/node/buffer.js.map +0 -1
  119. package/dist/lib/node/fs.browser.js.map +0 -1
  120. package/dist/lib/node/promisify.js.map +0 -1
  121. package/dist/lib/node/stream.browser.js.map +0 -1
  122. package/dist/lib/node/stream.js.map +0 -1
  123. package/dist/lib/option-utils/merge-loader-options.js.map +0 -1
  124. package/dist/lib/parser-utils/parse-json.js.map +0 -1
  125. package/dist/lib/path-utils/file-aliases.js.map +0 -1
  126. package/dist/lib/path-utils/get-cwd.js.map +0 -1
  127. package/dist/lib/path-utils/path.js.map +0 -1
  128. package/dist/lib/request-utils/request-scheduler.js.map +0 -1
  129. package/dist/lib/sources/data-source.js.map +0 -1
  130. package/dist/lib/sources/image-source.js.map +0 -1
  131. package/dist/lib/sources/image-tile-source.js.map +0 -1
  132. package/dist/lib/sources/tile-source-adapter.js.map +0 -1
  133. package/dist/lib/sources/tile-source.js.map +0 -1
  134. package/dist/lib/sources/utils/image-type.js.map +0 -1
  135. package/dist/lib/sources/utils/utils.js.map +0 -1
  136. package/dist/lib/sources/vector-tile-source.js.map +0 -1
  137. package/dist/lib/worker-loader-utils/create-loader-worker.js.map +0 -1
  138. package/dist/lib/worker-loader-utils/encode-with-worker.js.map +0 -1
  139. package/dist/lib/worker-loader-utils/parse-with-worker.js.map +0 -1
  140. package/dist/loader-types.js.map +0 -1
  141. package/dist/service-types.js.map +0 -1
  142. package/dist/types.js.map +0 -1
  143. package/dist/workers/json-worker.js.map +0 -1
  144. package/dist/writer-types.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -17,9 +17,9 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
20
+ // dist/index.js
21
+ var dist_exports = {};
22
+ __export(dist_exports, {
23
23
  BlobFile: () => BlobFile,
24
24
  DataSource: () => DataSource,
25
25
  DataViewFile: () => DataViewFile,
@@ -81,9 +81,9 @@ __export(src_exports, {
81
81
  toBuffer: () => toBuffer2,
82
82
  window: () => window_
83
83
  });
84
- module.exports = __toCommonJS(src_exports);
84
+ module.exports = __toCommonJS(dist_exports);
85
85
 
86
- // src/loader-types.ts
86
+ // dist/loader-types.js
87
87
  async function parseFromContext(data, loaders, options, context) {
88
88
  return context._parse(data, loaders, options, context);
89
89
  }
@@ -100,14 +100,14 @@ async function parseInBatchesFromContext(data, loader, options, context) {
100
100
  return context._parseInBatches(data, loader, options, context);
101
101
  }
102
102
 
103
- // src/lib/env-utils/assert.ts
103
+ // dist/lib/env-utils/assert.js
104
104
  function assert(condition, message) {
105
105
  if (!condition) {
106
106
  throw new Error(message || "loader assertion failed.");
107
107
  }
108
108
  }
109
109
 
110
- // src/lib/env-utils/globals.ts
110
+ // dist/lib/env-utils/globals.js
111
111
  var globals = {
112
112
  self: typeof self !== "undefined" && self,
113
113
  window: typeof window !== "undefined" && window,
@@ -126,7 +126,7 @@ var isWorker = typeof importScripts === "function";
126
126
  var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
127
127
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
128
128
 
129
- // src/lib/option-utils/merge-loader-options.ts
129
+ // dist/lib/option-utils/merge-loader-options.js
130
130
  function mergeLoaderOptions(baseOptions, newOptions) {
131
131
  return mergeOptionsRecursively(baseOptions || {}, newOptions);
132
132
  }
@@ -137,11 +137,7 @@ function mergeOptionsRecursively(baseOptions, newOptions, level = 0) {
137
137
  const options = { ...baseOptions };
138
138
  for (const [key, newValue] of Object.entries(newOptions)) {
139
139
  if (newValue && typeof newValue === "object" && !Array.isArray(newValue)) {
140
- options[key] = mergeOptionsRecursively(
141
- options[key] || {},
142
- newOptions[key],
143
- level + 1
144
- );
140
+ options[key] = mergeOptionsRecursively(options[key] || {}, newOptions[key], level + 1);
145
141
  } else {
146
142
  options[key] = newOptions[key];
147
143
  }
@@ -149,7 +145,7 @@ function mergeOptionsRecursively(baseOptions, newOptions, level = 0) {
149
145
  return options;
150
146
  }
151
147
 
152
- // src/lib/worker-loader-utils/create-loader-worker.ts
148
+ // dist/lib/worker-loader-utils/create-loader-worker.js
153
149
  var import_worker_utils = require("@loaders.gl/worker-utils");
154
150
  var requestId = 0;
155
151
  async function createLoaderWorker(loader) {
@@ -205,12 +201,7 @@ function parseOnMainThread(arrayBuffer, loader, options, context) {
205
201
  import_worker_utils.WorkerBody.postMessage("process", payload);
206
202
  });
207
203
  }
208
- async function parseData({
209
- loader,
210
- arrayBuffer,
211
- options,
212
- context
213
- }) {
204
+ async function parseData({ loader, arrayBuffer, options, context }) {
214
205
  let data;
215
206
  let parser;
216
207
  if (loader.parseSync || loader.parse) {
@@ -231,7 +222,7 @@ async function parseData({
231
222
  return await parser(data, { ...options }, context, loader);
232
223
  }
233
224
 
234
- // src/lib/worker-loader-utils/parse-with-worker.ts
225
+ // dist/lib/worker-loader-utils/parse-with-worker.js
235
226
  var import_worker_utils2 = require("@loaders.gl/worker-utils");
236
227
  var import_worker_utils3 = require("@loaders.gl/worker-utils");
237
228
  function canParseWithWorker(loader, options) {
@@ -288,7 +279,7 @@ async function onMessage(parseOnMainThread2, job, type, payload) {
288
279
  }
289
280
  }
290
281
 
291
- // src/lib/worker-loader-utils/encode-with-worker.ts
282
+ // dist/lib/worker-loader-utils/encode-with-worker.js
292
283
  var import_worker_utils4 = require("@loaders.gl/worker-utils");
293
284
  function canEncodeWithWorker(writer, options) {
294
285
  if (!import_worker_utils4.WorkerFarm.isSupported()) {
@@ -300,7 +291,7 @@ function canEncodeWithWorker(writer, options) {
300
291
  return writer.worker && (options == null ? void 0 : options.worker);
301
292
  }
302
293
 
303
- // src/lib/binary-utils/get-first-characters.ts
294
+ // dist/lib/binary-utils/get-first-characters.js
304
295
  function getFirstCharacters(data, length = 5) {
305
296
  if (typeof data === "string") {
306
297
  return data.slice(0, length);
@@ -324,7 +315,7 @@ function getMagicString(arrayBuffer, byteOffset, length) {
324
315
  return magic;
325
316
  }
326
317
 
327
- // src/lib/parser-utils/parse-json.ts
318
+ // dist/lib/parser-utils/parse-json.js
328
319
  function parseJSON(string) {
329
320
  try {
330
321
  return JSON.parse(string);
@@ -333,7 +324,7 @@ function parseJSON(string) {
333
324
  }
334
325
  }
335
326
 
336
- // src/lib/binary-utils/array-buffer-utils.ts
327
+ // dist/lib/binary-utils/array-buffer-utils.js
337
328
  function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
338
329
  byteLength = byteLength || arrayBuffer1.byteLength;
339
330
  if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
@@ -352,9 +343,7 @@ function concatenateArrayBuffers(...sources) {
352
343
  return concatenateArrayBuffersFromArray(sources);
353
344
  }
354
345
  function concatenateArrayBuffersFromArray(sources) {
355
- const sourceArrays = sources.map(
356
- (source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2
357
- );
346
+ const sourceArrays = sources.map((source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2);
358
347
  const byteLength = sourceArrays.reduce((length, typedArray) => length + typedArray.byteLength, 0);
359
348
  const result = new Uint8Array(byteLength);
360
349
  let offset = 0;
@@ -368,9 +357,7 @@ function concatenateTypedArrays(...typedArrays) {
368
357
  const arrays = typedArrays;
369
358
  const TypedArrayConstructor = arrays && arrays.length > 1 && arrays[0].constructor || null;
370
359
  if (!TypedArrayConstructor) {
371
- throw new Error(
372
- '"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types'
373
- );
360
+ throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');
374
361
  }
375
362
  const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);
376
363
  const result = new TypedArrayConstructor(sumLength);
@@ -387,7 +374,7 @@ function sliceArrayBuffer(arrayBuffer, byteOffset, byteLength) {
387
374
  return arrayCopy.buffer;
388
375
  }
389
376
 
390
- // src/lib/binary-utils/memory-copy-utils.ts
377
+ // dist/lib/binary-utils/memory-copy-utils.js
391
378
  function padToNBytes(byteLength, padding) {
392
379
  assert(byteLength >= 0);
393
380
  assert(padding > 0);
@@ -412,7 +399,7 @@ function copyToArray(source, target, targetOffset) {
412
399
  return targetOffset + padToNBytes(sourceArray.byteLength, 4);
413
400
  }
414
401
 
415
- // src/lib/binary-utils/dataview-copy-utils.ts
402
+ // dist/lib/binary-utils/dataview-copy-utils.js
416
403
  function padStringToByteAlignment(string, byteAlignment) {
417
404
  const length = string.length;
418
405
  const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment;
@@ -443,11 +430,7 @@ function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, pad
443
430
  const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);
444
431
  const padLength = paddedLength - sourceBuffer.byteLength;
445
432
  if (dataView) {
446
- const targetArray = new Uint8Array(
447
- dataView.buffer,
448
- dataView.byteOffset + byteOffset,
449
- sourceBuffer.byteLength
450
- );
433
+ const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
451
434
  const sourceArray = new Uint8Array(sourceBuffer);
452
435
  targetArray.set(sourceArray);
453
436
  for (let i = 0; i < padLength; ++i) {
@@ -464,7 +447,7 @@ function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
464
447
  return byteOffset;
465
448
  }
466
449
 
467
- // src/lib/iterators/text-iterators.ts
450
+ // dist/lib/iterators/text-iterators.js
468
451
  async function* makeTextDecoderIterator(arrayBufferIterator, options = {}) {
469
452
  const textDecoder = new TextDecoder(void 0, options);
470
453
  for await (const arrayBuffer of arrayBufferIterator) {
@@ -500,7 +483,7 @@ async function* makeNumberedLineIterator(lineIterator) {
500
483
  }
501
484
  }
502
485
 
503
- // src/lib/iterators/async-iteration.ts
486
+ // dist/lib/iterators/async-iteration.js
504
487
  async function forEach(iterator, visitor) {
505
488
  while (true) {
506
489
  const { done, value } = await iterator.next();
@@ -522,7 +505,7 @@ async function concatenateArrayBuffersAsync(asyncIterator) {
522
505
  return concatenateArrayBuffers(...arrayBuffers);
523
506
  }
524
507
 
525
- // src/lib/request-utils/request-scheduler.ts
508
+ // dist/lib/request-utils/request-scheduler.js
526
509
  var import_stats = require("@probe.gl/stats");
527
510
  var STAT_QUEUED_REQUESTS = "Queued Requests";
528
511
  var STAT_ACTIVE_REQUESTS = "Active Requests";
@@ -531,18 +514,22 @@ var STAT_QUEUED_REQUESTS_EVER = "Queued Requests Ever";
531
514
  var STAT_ACTIVE_REQUESTS_EVER = "Active Requests Ever";
532
515
  var DEFAULT_PROPS = {
533
516
  id: "request-scheduler",
534
- // Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing
517
+ /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */
535
518
  throttleRequests: true,
536
- // The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit.
537
- maxRequests: 6
519
+ /** The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit. */
520
+ maxRequests: 6,
521
+ /**
522
+ * Specifies a debounce time, in milliseconds. All requests are queued, until no new requests have
523
+ * been added to the queue for this amount of time.
524
+ */
525
+ debounceTime: 0
538
526
  };
539
527
  var RequestScheduler = class {
540
528
  constructor(props = {}) {
541
529
  this.activeRequestCount = 0;
542
- /** Tracks the number of active requests and prioritizes/cancels queued requests. */
543
530
  this.requestQueue = [];
544
531
  this.requestMap = /* @__PURE__ */ new Map();
545
- this.deferredUpdate = null;
532
+ this.updateTimer = null;
546
533
  this.props = { ...DEFAULT_PROPS, ...props };
547
534
  this.stats = new import_stats.Stats({ id: this.props.id });
548
535
  this.stats.get(STAT_QUEUED_REQUESTS);
@@ -602,13 +589,17 @@ var RequestScheduler = class {
602
589
  }
603
590
  /** We check requests asynchronously, to prevent multiple updates */
604
591
  _issueNewRequests() {
605
- if (!this.deferredUpdate) {
606
- this.deferredUpdate = setTimeout(() => this._issueNewRequestsAsync(), 0);
592
+ if (this.updateTimer !== null) {
593
+ clearTimeout(this.updateTimer);
607
594
  }
595
+ this.updateTimer = setTimeout(() => this._issueNewRequestsAsync(), this.props.debounceTime);
608
596
  }
609
597
  /** Refresh all requests */
610
598
  _issueNewRequestsAsync() {
611
- this.deferredUpdate = null;
599
+ if (this.updateTimer !== null) {
600
+ clearTimeout(this.updateTimer);
601
+ }
602
+ this.updateTimer = null;
612
603
  const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);
613
604
  if (freeSlots === 0) {
614
605
  return;
@@ -645,7 +636,7 @@ var RequestScheduler = class {
645
636
  }
646
637
  };
647
638
 
648
- // src/lib/path-utils/file-aliases.ts
639
+ // dist/lib/path-utils/file-aliases.js
649
640
  var pathPrefix = "";
650
641
  var fileAliases = {};
651
642
  function setPathPrefix(prefix) {
@@ -670,8 +661,8 @@ function resolvePath(filename2) {
670
661
  return filename2;
671
662
  }
672
663
 
673
- // src/json-loader.ts
674
- var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
664
+ // dist/json-loader.js
665
+ var VERSION = true ? "4.2.0-alpha.4" : "latest";
675
666
  var JSONLoader = {
676
667
  name: "JSON",
677
668
  id: "json",
@@ -689,7 +680,7 @@ function parseTextSync(text) {
689
680
  return JSON.parse(text);
690
681
  }
691
682
 
692
- // src/lib/node/buffer.browser.ts
683
+ // dist/lib/node/buffer.browser.js
693
684
  function toArrayBuffer(buffer) {
694
685
  return buffer;
695
686
  }
@@ -697,7 +688,7 @@ function toBuffer(binaryData) {
697
688
  throw new Error("Buffer not supported in browser");
698
689
  }
699
690
 
700
- // src/lib/binary-utils/memory-conversion-utils.ts
691
+ // dist/lib/binary-utils/memory-conversion-utils.js
701
692
  function isBuffer(value) {
702
693
  return value && typeof value === "object" && value.isBuffer;
703
694
  }
@@ -728,19 +719,15 @@ function toArrayBuffer2(data) {
728
719
  throw new Error("toArrayBuffer");
729
720
  }
730
721
 
731
- // src/lib/node/promisify.ts
722
+ // dist/lib/node/promisify.js
732
723
  function promisify1(fn) {
733
- return (args) => new Promise(
734
- (resolve2, reject) => fn(args, (error, callbackArgs) => error ? reject(error) : resolve2(callbackArgs))
735
- );
724
+ return (args) => new Promise((resolve2, reject) => fn(args, (error, callbackArgs) => error ? reject(error) : resolve2(callbackArgs)));
736
725
  }
737
726
  function promisify2(fn) {
738
- return (arg1, arg2) => new Promise(
739
- (resolve2, reject) => fn(arg1, arg2, (error, callbackArgs) => error ? reject(error) : resolve2(callbackArgs))
740
- );
727
+ return (arg1, arg2) => new Promise((resolve2, reject) => fn(arg1, arg2, (error, callbackArgs) => error ? reject(error) : resolve2(callbackArgs)));
741
728
  }
742
729
 
743
- // src/lib/path-utils/path.ts
730
+ // dist/lib/path-utils/path.js
744
731
  var path_exports = {};
745
732
  __export(path_exports, {
746
733
  dirname: () => dirname,
@@ -749,7 +736,7 @@ __export(path_exports, {
749
736
  resolve: () => resolve
750
737
  });
751
738
 
752
- // src/lib/path-utils/get-cwd.ts
739
+ // dist/lib/path-utils/get-cwd.js
753
740
  function getCWD() {
754
741
  var _a;
755
742
  if (typeof process !== "undefined" && typeof process.cwd !== "undefined") {
@@ -759,7 +746,7 @@ function getCWD() {
759
746
  return (pathname == null ? void 0 : pathname.slice(0, pathname.lastIndexOf("/") + 1)) || "";
760
747
  }
761
748
 
762
- // src/lib/path-utils/path.ts
749
+ // dist/lib/path-utils/path.js
763
750
  function filename(url) {
764
751
  const slashIndex = url ? url.lastIndexOf("/") : -1;
765
752
  return slashIndex >= 0 ? url.substr(slashIndex + 1) : "";
@@ -884,14 +871,14 @@ function normalizeStringPosix(path, allowAboveRoot) {
884
871
  return res;
885
872
  }
886
873
 
887
- // src/lib/node/stream.browser.ts
874
+ // dist/lib/node/stream.browser.js
888
875
  var stream_browser_exports = {};
889
876
  __export(stream_browser_exports, {
890
877
  isSupported: () => isSupported
891
878
  });
892
879
  var isSupported = false;
893
880
 
894
- // src/lib/files/blob-file.ts
881
+ // dist/lib/files/blob-file.js
895
882
  var BlobFile = class {
896
883
  constructor(blob) {
897
884
  this.handle = blob instanceof ArrayBuffer ? new Blob([blob]) : blob;
@@ -914,7 +901,7 @@ var BlobFile = class {
914
901
  }
915
902
  };
916
903
 
917
- // src/lib/files/http-file.ts
904
+ // dist/lib/files/http-file.js
918
905
  var HttpFile = class {
919
906
  constructor(url) {
920
907
  this.size = 0;
@@ -972,9 +959,7 @@ var HttpFile = class {
972
959
  if (controller) {
973
960
  controller.abort();
974
961
  }
975
- throw Error(
976
- "content-length header missing or exceeding request. Server must support HTTP Byte Serving."
977
- );
962
+ throw Error("content-length header missing or exceeding request. Server must support HTTP Byte Serving.");
978
963
  }
979
964
  case 416:
980
965
  if (offset === 0) {
@@ -998,14 +983,14 @@ var HttpFile = class {
998
983
  }
999
984
  };
1000
985
 
1001
- // src/lib/files/node-file-facade.ts
986
+ // dist/lib/files/node-file-facade.js
1002
987
  var NOT_IMPLEMENTED = new Error("Not implemented");
1003
988
  var NodeFileFacade = class {
1004
989
  constructor(url, flags, mode) {
990
+ var _a;
1005
991
  this.size = 0;
1006
992
  this.bigsize = 0n;
1007
993
  this.url = "";
1008
- var _a;
1009
994
  if ((_a = globalThis.loaders) == null ? void 0 : _a.NodeFile) {
1010
995
  return new globalThis.loaders.NodeFile(url, flags, mode);
1011
996
  }
@@ -1039,25 +1024,21 @@ var NodeFileFacade = class {
1039
1024
  }
1040
1025
  };
1041
1026
 
1042
- // src/lib/filesystems/node-filesystem-facade.ts
1027
+ // dist/lib/filesystems/node-filesystem-facade.js
1043
1028
  var NOT_IMPLEMENTED2 = new Error("Not implemented");
1044
1029
  var NodeFileSystemFacade = class {
1045
1030
  // implements FileSystem
1046
1031
  constructor(options) {
1047
- // DUMMY IMPLEMENTATION, not used (constructor returns a real NodeFileSystem instance)
1048
- // implements RandomAccessReadFileSystem
1032
+ var _a;
1049
1033
  this.readable = true;
1050
1034
  this.writable = true;
1051
- var _a;
1052
1035
  if ((_a = globalThis.loaders) == null ? void 0 : _a.NodeFileSystem) {
1053
1036
  return new globalThis.loaders.NodeFileSystem(options);
1054
1037
  }
1055
1038
  if (isBrowser) {
1056
1039
  throw new Error("Can't instantiate NodeFileSystem in browser.");
1057
1040
  }
1058
- throw new Error(
1059
- "Can't instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first."
1060
- );
1041
+ throw new Error("Can't instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first.");
1061
1042
  }
1062
1043
  async openReadableFile(path, flags) {
1063
1044
  throw NOT_IMPLEMENTED2;
@@ -1081,12 +1062,12 @@ var NodeFileSystemFacade = class {
1081
1062
  }
1082
1063
  };
1083
1064
 
1084
- // src/lib/file-provider/file-provider.ts
1065
+ // dist/lib/file-provider/file-provider.js
1085
1066
  var isFileProvider = (fileProvider) => {
1086
1067
  return (fileProvider == null ? void 0 : fileProvider.getUint8) && (fileProvider == null ? void 0 : fileProvider.slice) && (fileProvider == null ? void 0 : fileProvider.length);
1087
1068
  };
1088
1069
 
1089
- // src/lib/file-provider/file-handle-file.ts
1070
+ // dist/lib/file-provider/file-handle-file.js
1090
1071
  var FileHandleFile = class {
1091
1072
  /** Create a new FileHandleFile */
1092
1073
  constructor(path, append = false) {
@@ -1179,7 +1160,7 @@ var FileHandleFile = class {
1179
1160
  }
1180
1161
  };
1181
1162
 
1182
- // src/lib/file-provider/data-view-file.ts
1163
+ // dist/lib/file-provider/data-view-file.js
1183
1164
  var toNumber = (bigint) => {
1184
1165
  if (bigint > Number.MAX_SAFE_INTEGER) {
1185
1166
  throw new Error("Offset is out of bounds");
@@ -1234,7 +1215,7 @@ var DataViewFile = class {
1234
1215
  }
1235
1216
  };
1236
1217
 
1237
- // src/lib/sources/data-source.ts
1218
+ // dist/lib/sources/data-source.js
1238
1219
  var DataSource = class {
1239
1220
  constructor(props) {
1240
1221
  this._needsRefresh = true;
@@ -1274,8 +1255,9 @@ function getFetchFunction(options) {
1274
1255
  return (url) => fetch(url);
1275
1256
  }
1276
1257
 
1277
- // src/lib/sources/image-source.ts
1258
+ // dist/lib/sources/image-source.js
1278
1259
  var ImageSource = class extends DataSource {
1279
1260
  };
1280
1261
  ImageSource.type = "template";
1281
1262
  ImageSource.testURL = (url) => false;
1263
+ //# sourceMappingURL=index.cjs.map