@loaders.gl/loader-utils 4.2.0-alpha.4 → 4.2.0-alpha.6

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 (145) hide show
  1. package/dist/index.cjs +103 -95
  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 +60 -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 +98 -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 +28 -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 +93 -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 +38 -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 +132 -102
  60. package/dist/lib/sources/data-source.js +53 -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 +12 -4
  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 +3 -3
  68. package/dist/lib/sources/tile-source-adapter.d.ts.map +1 -1
  69. package/dist/lib/sources/tile-source-adapter.js +44 -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 +10 -8
  95. package/src/lib/request-utils/request-scheduler.ts +17 -8
  96. package/src/lib/sources/tile-source-adapter.ts +1 -1
  97. package/dist/index.js.map +0 -1
  98. package/dist/json-loader.js.map +0 -1
  99. package/dist/lib/binary-utils/array-buffer-utils.js.map +0 -1
  100. package/dist/lib/binary-utils/dataview-copy-utils.js.map +0 -1
  101. package/dist/lib/binary-utils/get-first-characters.js.map +0 -1
  102. package/dist/lib/binary-utils/memory-conversion-utils.js.map +0 -1
  103. package/dist/lib/binary-utils/memory-copy-utils.js.map +0 -1
  104. package/dist/lib/env-utils/assert.js.map +0 -1
  105. package/dist/lib/env-utils/globals.js.map +0 -1
  106. package/dist/lib/file-provider/data-view-file.js.map +0 -1
  107. package/dist/lib/file-provider/file-handle-file.js.map +0 -1
  108. package/dist/lib/file-provider/file-provider.js.map +0 -1
  109. package/dist/lib/files/blob-file.js.map +0 -1
  110. package/dist/lib/files/file.js.map +0 -1
  111. package/dist/lib/files/http-file.js.map +0 -1
  112. package/dist/lib/files/node-file-facade.js.map +0 -1
  113. package/dist/lib/files/sources.js.map +0 -1
  114. package/dist/lib/filesystems/filesystem.js.map +0 -1
  115. package/dist/lib/filesystems/node-filesystem-facade.js.map +0 -1
  116. package/dist/lib/iterators/async-iteration.js.map +0 -1
  117. package/dist/lib/iterators/text-iterators.js.map +0 -1
  118. package/dist/lib/node/buffer.browser.js.map +0 -1
  119. package/dist/lib/node/buffer.js.map +0 -1
  120. package/dist/lib/node/fs.browser.js.map +0 -1
  121. package/dist/lib/node/promisify.js.map +0 -1
  122. package/dist/lib/node/stream.browser.js.map +0 -1
  123. package/dist/lib/node/stream.js.map +0 -1
  124. package/dist/lib/option-utils/merge-loader-options.js.map +0 -1
  125. package/dist/lib/parser-utils/parse-json.js.map +0 -1
  126. package/dist/lib/path-utils/file-aliases.js.map +0 -1
  127. package/dist/lib/path-utils/get-cwd.js.map +0 -1
  128. package/dist/lib/path-utils/path.js.map +0 -1
  129. package/dist/lib/request-utils/request-scheduler.js.map +0 -1
  130. package/dist/lib/sources/data-source.js.map +0 -1
  131. package/dist/lib/sources/image-source.js.map +0 -1
  132. package/dist/lib/sources/image-tile-source.js.map +0 -1
  133. package/dist/lib/sources/tile-source-adapter.js.map +0 -1
  134. package/dist/lib/sources/tile-source.js.map +0 -1
  135. package/dist/lib/sources/utils/image-type.js.map +0 -1
  136. package/dist/lib/sources/utils/utils.js.map +0 -1
  137. package/dist/lib/sources/vector-tile-source.js.map +0 -1
  138. package/dist/lib/worker-loader-utils/create-loader-worker.js.map +0 -1
  139. package/dist/lib/worker-loader-utils/encode-with-worker.js.map +0 -1
  140. package/dist/lib/worker-loader-utils/parse-with-worker.js.map +0 -1
  141. package/dist/loader-types.js.map +0 -1
  142. package/dist/service-types.js.map +0 -1
  143. package/dist/types.js.map +0 -1
  144. package/dist/workers/json-worker.js.map +0 -1
  145. package/dist/writer-types.js.map +0 -1
@@ -1,63 +1,76 @@
1
1
  import { isBrowser } from '@loaders.gl/worker-utils';
2
2
  import { WorkerFarm, getWorkerURL } from '@loaders.gl/worker-utils';
3
+ /**
4
+ * Determines if a loader can parse with worker
5
+ * @param loader
6
+ * @param options
7
+ */
3
8
  export function canParseWithWorker(loader, options) {
4
- if (!WorkerFarm.isSupported()) {
5
- return false;
6
- }
7
- if (!isBrowser && !(options !== null && options !== void 0 && options._nodeWorkers)) {
8
- return false;
9
- }
10
- return loader.worker && (options === null || options === void 0 ? void 0 : options.worker);
9
+ if (!WorkerFarm.isSupported()) {
10
+ return false;
11
+ }
12
+ // Node workers are still experimental
13
+ if (!isBrowser && !options?._nodeWorkers) {
14
+ return false;
15
+ }
16
+ return loader.worker && options?.worker;
11
17
  }
18
+ /**
19
+ * this function expects that the worker function sends certain messages,
20
+ * this can be automated if the worker is wrapper by a call to createLoaderWorker in @loaders.gl/loader-utils.
21
+ */
12
22
  export async function parseWithWorker(loader, data, options, context, parseOnMainThread) {
13
- const name = loader.id;
14
- const url = getWorkerURL(loader, options);
15
- const workerFarm = WorkerFarm.getWorkerFarm(options);
16
- const workerPool = workerFarm.getWorkerPool({
17
- name,
18
- url
19
- });
20
- options = JSON.parse(JSON.stringify(options));
21
- context = JSON.parse(JSON.stringify(context || {}));
22
- const job = await workerPool.startJob('process-on-worker', onMessage.bind(null, parseOnMainThread));
23
- job.postMessage('process', {
24
- input: data,
25
- options,
26
- context
27
- });
28
- const result = await job.result;
29
- return await result.result;
23
+ const name = loader.id; // TODO
24
+ const url = getWorkerURL(loader, options);
25
+ const workerFarm = WorkerFarm.getWorkerFarm(options);
26
+ const workerPool = workerFarm.getWorkerPool({ name, url });
27
+ // options.log object contains functions which cannot be transferred
28
+ // context.fetch & context.parse functions cannot be transferred
29
+ // TODO - decide how to handle logging on workers
30
+ options = JSON.parse(JSON.stringify(options));
31
+ context = JSON.parse(JSON.stringify(context || {}));
32
+ const job = await workerPool.startJob('process-on-worker',
33
+ // @ts-expect-error
34
+ onMessage.bind(null, parseOnMainThread) // eslint-disable-line @typescript-eslint/no-misused-promises
35
+ );
36
+ job.postMessage('process', {
37
+ // @ts-ignore
38
+ input: data,
39
+ options,
40
+ context
41
+ });
42
+ const result = await job.result;
43
+ // TODO - what is going on here?
44
+ return await result.result;
30
45
  }
46
+ /**
47
+ * Handle worker's responses to the main thread
48
+ * @param job
49
+ * @param type
50
+ * @param payload
51
+ */
31
52
  async function onMessage(parseOnMainThread, job, type, payload) {
32
- switch (type) {
33
- case 'done':
34
- job.done(payload);
35
- break;
36
- case 'error':
37
- job.error(new Error(payload.error));
38
- break;
39
- case 'process':
40
- const {
41
- id,
42
- input,
43
- options
44
- } = payload;
45
- try {
46
- const result = await parseOnMainThread(input, options);
47
- job.postMessage('done', {
48
- id,
49
- result
50
- });
51
- } catch (error) {
52
- const message = error instanceof Error ? error.message : 'unknown error';
53
- job.postMessage('error', {
54
- id,
55
- error: message
56
- });
57
- }
58
- break;
59
- default:
60
- console.warn(`parse-with-worker unknown message ${type}`);
61
- }
53
+ switch (type) {
54
+ case 'done':
55
+ job.done(payload);
56
+ break;
57
+ case 'error':
58
+ job.error(new Error(payload.error));
59
+ break;
60
+ case 'process':
61
+ // Worker is asking for main thread to parseO
62
+ const { id, input, options } = payload;
63
+ try {
64
+ const result = await parseOnMainThread(input, options);
65
+ job.postMessage('done', { id, result });
66
+ }
67
+ catch (error) {
68
+ const message = error instanceof Error ? error.message : 'unknown error';
69
+ job.postMessage('error', { id, error: message });
70
+ }
71
+ break;
72
+ default:
73
+ // eslint-disable-next-line
74
+ console.warn(`parse-with-worker unknown message ${type}`);
75
+ }
62
76
  }
63
- //# sourceMappingURL=parse-with-worker.js.map
@@ -1,5 +1,5 @@
1
- import { FetchLike, TransformBatches } from './types';
2
- import { ReadableFile } from './lib/files/file';
1
+ import { FetchLike, TransformBatches } from "./types.js";
2
+ import { ReadableFile } from "./lib/files/file.js";
3
3
  /**
4
4
  * Core Loader Options
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"loader-types.d.ts","sourceRoot":"","sources":["../src/loader-types.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,SAAS,EACT,gBAAgB,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAI9C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI,CAAC;IACtD,6BAA6B;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAGlC,kDAAkD;IAClD,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAI5B,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,6CAA6C;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,gDAAgD;IAChD,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,gBAAgB,EA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AE,WAAW,EACjB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEtC;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,aAAa,GAAG,SAAS,EAClC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,OAAO,CAAC,CAAC;AAmBpB;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAE3D,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,aAAa,GACrB,gBAAgB,CAAC,OAAO,CAAC,CAK3B;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAE3D,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,EACnE,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAKlD"}
@@ -1,16 +1,32 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ /**
5
+ * Parses `data` using a specified loader
6
+ * @param data
7
+ * @param loaders
8
+ * @param options
9
+ * @param context
10
+ */
11
+ // implementation signature
1
12
  export async function parseFromContext(data, loaders, options, context) {
2
- return context._parse(data, loaders, options, context);
13
+ return context._parse(data, loaders, options, context);
3
14
  }
15
+ /**
16
+ * Parses `data` synchronously using the specified loader, parse function provided via the loader context
17
+ */
4
18
  export function parseSyncFromContext(data, loader, options, context) {
5
- if (!context._parseSync) {
6
- throw new Error('parseSync');
7
- }
8
- return context._parseSync(data, loader, options, context);
19
+ if (!context._parseSync) {
20
+ throw new Error('parseSync');
21
+ }
22
+ return context._parseSync(data, loader, options, context);
9
23
  }
24
+ /**
25
+ * Parses `data` synchronously using a specified loader, parse function provided via the loader context
26
+ */
10
27
  export async function parseInBatchesFromContext(data, loader, options, context) {
11
- if (!context._parseInBatches) {
12
- throw new Error('parseInBatches');
13
- }
14
- return context._parseInBatches(data, loader, options, context);
28
+ if (!context._parseInBatches) {
29
+ throw new Error('parseInBatches');
30
+ }
31
+ return context._parseInBatches(data, loader, options, context);
15
32
  }
16
- //# sourceMappingURL=loader-types.js.map
@@ -1,4 +1,4 @@
1
- import type { ImageSource, ImageSourceProps } from './lib/sources/image-source';
1
+ import type { ImageSource, ImageSourceProps } from "./lib/sources/image-source.js";
2
2
  /** Export interface source */
3
3
  export interface Service<SourceT = ImageSource, SourcePropsT = ImageSourceProps> {
4
4
  source?: SourceT;
@@ -1 +1 @@
1
- {"version":3,"file":"service-types.d.ts","sourceRoot":"","sources":["../src/service-types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAE9E,8BAA8B;AAC9B,MAAM,WAAW,OAAO,CAAC,OAAO,GAAG,WAAW,EAAE,YAAY,GAAG,gBAAgB;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;CACtC"}
1
+ {"version":3,"file":"service-types.d.ts","sourceRoot":"","sources":["../src/service-types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,sCAAmC;AAE9E,8BAA8B;AAC9B,MAAM,WAAW,OAAO,CAAC,OAAO,GAAG,WAAW,EAAE,YAAY,GAAG,gBAAgB;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;CACtC"}
@@ -1,2 +1,4 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  export {};
2
- //# sourceMappingURL=service-types.js.map
package/dist/types.js CHANGED
@@ -1,2 +1,2 @@
1
+ // Typed arrays
1
2
  export {};
2
- //# sourceMappingURL=types.js.map
@@ -1,4 +1,3 @@
1
1
  import { createLoaderWorker } from "../lib/worker-loader-utils/create-loader-worker.js";
2
2
  import { JSONLoader } from "../json-loader.js";
3
3
  createLoaderWorker(JSONLoader);
4
- //# sourceMappingURL=json-worker.js.map
@@ -1,2 +1,4 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  export {};
2
- //# sourceMappingURL=writer-types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/loader-utils",
3
- "version": "4.2.0-alpha.4",
3
+ "version": "4.2.0-alpha.6",
4
4
  "description": "Framework-independent loaders for 3D graphics formats",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,20 +35,22 @@
35
35
  "README.md"
36
36
  ],
37
37
  "browser": {
38
- "./src/lib/node/buffer.ts": "./src/lib/node/buffer.browser.ts",
39
38
  "./dist/lib/node/buffer.js": "./dist/lib/node/buffer.browser.js",
40
- "./src/lib/node/fs.ts": "./src/lib/node/fs.browser.ts",
41
39
  "./dist/lib/node/fs.js": "./dist/lib/node/fs.browser.js",
42
- "./src/lib/node/stream.ts": "./src/lib/node/stream.browser.ts",
43
40
  "./dist/lib/node/stream.js": "./dist/lib/node/stream.browser.js",
41
+ "./src/lib/node/buffer.ts": "./src/lib/node/buffer.browser.ts",
42
+ "./src/lib/node/fs.ts": "./src/lib/node/fs.browser.ts",
43
+ "./src/lib/node/stream.ts": "./src/lib/node/stream.browser.ts",
44
44
  "fs": false,
45
45
  "stream": false
46
46
  },
47
- "scripts": {},
48
47
  "dependencies": {
49
- "@babel/runtime": "^7.3.1",
50
- "@loaders.gl/worker-utils": "4.2.0-alpha.4",
48
+ "@loaders.gl/schema": "4.2.0-alpha.6",
49
+ "@loaders.gl/worker-utils": "4.2.0-alpha.6",
51
50
  "@probe.gl/stats": "^4.0.2"
52
51
  },
53
- "gitHead": "6c52dee5c3f005648a394cc4aee7fc37005c8e83"
52
+ "peerDependencies": {
53
+ "@loaders.gl/core": "^4.0.0"
54
+ },
55
+ "gitHead": "37bd8ca71763529f18727ee4bf29dd176aa914ca"
54
56
  }
@@ -12,6 +12,7 @@ export type RequestSchedulerProps = {
12
12
  id?: string;
13
13
  throttleRequests?: boolean;
14
14
  maxRequests?: number;
15
+ debounceTime?: number;
15
16
  };
16
17
 
17
18
  const STAT_QUEUED_REQUESTS = 'Queued Requests';
@@ -22,10 +23,15 @@ const STAT_ACTIVE_REQUESTS_EVER = 'Active Requests Ever';
22
23
 
23
24
  const DEFAULT_PROPS: Required<RequestSchedulerProps> = {
24
25
  id: 'request-scheduler',
25
- // Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing
26
+ /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */
26
27
  throttleRequests: true,
27
- // The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit.
28
- maxRequests: 6
28
+ /** The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit. */
29
+ maxRequests: 6,
30
+ /**
31
+ * Specifies a debounce time, in milliseconds. All requests are queued, until no new requests have
32
+ * been added to the queue for this amount of time.
33
+ */
34
+ debounceTime: 0
29
35
  };
30
36
 
31
37
  /** Tracks one request */
@@ -48,7 +54,7 @@ export default class RequestScheduler {
48
54
  /** Tracks the number of active requests and prioritizes/cancels queued requests. */
49
55
  private requestQueue: Request[] = [];
50
56
  private requestMap: Map<Handle, Promise<RequestResult>> = new Map();
51
- private deferredUpdate: any = null;
57
+ private updateTimer: ReturnType<typeof setTimeout> | null = null;
52
58
 
53
59
  constructor(props: RequestSchedulerProps = {}) {
54
60
  this.props = {...DEFAULT_PROPS, ...props};
@@ -132,15 +138,18 @@ export default class RequestScheduler {
132
138
 
133
139
  /** We check requests asynchronously, to prevent multiple updates */
134
140
  _issueNewRequests(): void {
135
- if (!this.deferredUpdate) {
136
- this.deferredUpdate = setTimeout(() => this._issueNewRequestsAsync(), 0);
141
+ if (this.updateTimer !== null) {
142
+ clearTimeout(this.updateTimer);
137
143
  }
144
+ this.updateTimer = setTimeout(() => this._issueNewRequestsAsync(), this.props.debounceTime);
138
145
  }
139
146
 
140
147
  /** Refresh all requests */
141
148
  _issueNewRequestsAsync() {
142
- // TODO - shouldn't we clear the timeout?
143
- this.deferredUpdate = null;
149
+ if (this.updateTimer !== null) {
150
+ clearTimeout(this.updateTimer);
151
+ }
152
+ this.updateTimer = null;
144
153
 
145
154
  const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);
146
155
 
@@ -9,7 +9,7 @@ import {ImageSource, ImageSourceMetadata} from './image-source';
9
9
  * @note
10
10
  * - If geospatial, bounding box is expected to be in web mercator coordinates
11
11
  */
12
- export class TileSourceAdapter<MetadataT> implements TileSource<ImageSourceMetadata> {
12
+ export class TileSourceAdapter implements TileSource<ImageSourceMetadata> {
13
13
  readonly viewportSource: ImageSource;
14
14
  constructor(source: ImageSource) {
15
15
  this.viewportSource = source;
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["parseFromContext","parseSyncFromContext","parseInBatchesFromContext","assert","isBrowser","isWorker","nodeVersion","self","window","global","document","mergeLoaderOptions","createLoaderWorker","parseWithWorker","canParseWithWorker","canEncodeWithWorker","parseJSON","sliceArrayBuffer","concatenateArrayBuffers","concatenateArrayBuffersFromArray","concatenateTypedArrays","compareArrayBuffers","padToNBytes","copyToArray","copyArrayBuffer","padStringToByteAlignment","copyStringToDataView","copyBinaryToDataView","copyPaddedArrayBufferToDataView","copyPaddedStringToDataView","getFirstCharacters","getMagicString","makeTextEncoderIterator","makeTextDecoderIterator","makeLineIterator","makeNumberedLineIterator","forEach","concatenateArrayBuffersAsync","default","RequestScheduler","setPathPrefix","getPathPrefix","resolvePath","addAliases","_addAliases","JSONLoader","isBuffer","toBuffer","toArrayBuffer","promisify1","promisify2","path","stream","BlobFile","HttpFile","NodeFileFacade","NodeFile","NodeFileSystemFacade","NodeFilesystem","isFileProvider","FileHandleFile","DataViewFile","DataSource","ImageSource"],"sources":["../src/index.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// TYPES\n\nexport type {\n // misc\n DataType,\n SyncDataType,\n BatchableDataType,\n // numeric array types\n TypedArray,\n BigTypedArray,\n TypedArrayConstructor,\n BigTypedArrayConstructor,\n NumberArray,\n NumericArray,\n // fetch\n FetchLike\n} from './types';\n\n// loaders\n\nexport type {\n Loader,\n LoaderWithParser,\n LoaderContext,\n LoaderOptions,\n LoaderOptionsType,\n LoaderReturnType,\n LoaderBatchType\n} from './loader-types';\n\nexport {parseFromContext, parseSyncFromContext, parseInBatchesFromContext} from './loader-types';\n\n// writers\n\nexport type {Writer, WriterWithEncoder, WriterOptions, WriterOptionsType} from './writer-types';\n\n// GENERAL UTILS\nexport {assert} from './lib/env-utils/assert';\nexport {\n isBrowser,\n isWorker,\n nodeVersion,\n self,\n window,\n global,\n document\n} from './lib/env-utils/globals';\n\nexport {mergeLoaderOptions} from './lib/option-utils/merge-loader-options';\n\n// LOADERS.GL-SPECIFIC WORKER UTILS\nexport {createLoaderWorker} from './lib/worker-loader-utils/create-loader-worker';\nexport {parseWithWorker, canParseWithWorker} from './lib/worker-loader-utils/parse-with-worker';\nexport {canEncodeWithWorker} from './lib/worker-loader-utils/encode-with-worker';\n\n// PARSER UTILS\nexport {parseJSON} from './lib/parser-utils/parse-json';\n\n// MEMORY COPY UTILS\nexport {\n sliceArrayBuffer,\n concatenateArrayBuffers,\n concatenateArrayBuffersFromArray,\n concatenateTypedArrays,\n compareArrayBuffers\n} from './lib/binary-utils/array-buffer-utils';\nexport {padToNBytes, copyToArray, copyArrayBuffer} from './lib/binary-utils/memory-copy-utils';\nexport {\n padStringToByteAlignment,\n copyStringToDataView,\n copyBinaryToDataView,\n copyPaddedArrayBufferToDataView,\n copyPaddedStringToDataView\n} from './lib/binary-utils/dataview-copy-utils';\nexport {getFirstCharacters, getMagicString} from './lib/binary-utils/get-first-characters';\n\n// ITERATOR UTILS\nexport {\n makeTextEncoderIterator,\n makeTextDecoderIterator,\n makeLineIterator,\n makeNumberedLineIterator\n} from './lib/iterators/text-iterators';\nexport {forEach, concatenateArrayBuffersAsync} from './lib/iterators/async-iteration';\n\n// REQUEST UTILS\nexport {default as RequestScheduler} from './lib/request-utils/request-scheduler';\n\n// PATH HELPERS\nexport {setPathPrefix, getPathPrefix, resolvePath} from './lib/path-utils/file-aliases';\nexport {addAliases as _addAliases} from './lib/path-utils/file-aliases';\n\n// MICRO LOADERS\nexport {JSONLoader} from './json-loader';\n\n// NODE support\n\n// Node.js emulation (can be used in browser)\n\n// Avoid direct use of `Buffer` which pulls in 50KB polyfill\nexport {isBuffer, toBuffer, toArrayBuffer} from './lib/binary-utils/memory-conversion-utils';\n\n// Note.js wrappers (can be safely imported, but not used in browser)\n\n// Use instead of importing 'util' to avoid node dependencies\nexport {promisify1, promisify2} from './lib/node/promisify';\n\n// `path` replacement (avoids bundling big path polyfill)\nimport * as path from './lib/path-utils/path';\nexport {path};\n\n// Use instead of importing 'stream' to avoid node dependencies`\nimport * as stream from './lib/node/stream';\nexport {stream};\n\n// EXPERIMENTAL: FILE SYSTEMS\n\nexport type {ReadableFile, WritableFile, Stat} from './lib/files/file';\nexport {BlobFile} from './lib/files/blob-file';\nexport {HttpFile} from './lib/files/http-file';\nexport {NodeFileFacade as NodeFile} from './lib/files/node-file-facade';\n\nexport type {FileSystem, RandomAccessFileSystem} from './lib/filesystems/filesystem';\nexport {NodeFileSystemFacade as NodeFilesystem} from './lib/filesystems/node-filesystem-facade';\n\n// TODO - replace with ReadableFile\nexport type {FileProvider} from './lib/file-provider/file-provider';\nexport {isFileProvider} from './lib/file-provider/file-provider';\nexport {FileHandleFile} from './lib/file-provider/file-handle-file';\nexport {DataViewFile} from './lib/file-provider/data-view-file';\n\n// EXPERIMENTAL: DATA SOURCES\nexport type {Service} from './service-types';\n\nexport type {DataSourceProps} from './lib/sources/data-source';\nexport {DataSource} from './lib/sources/data-source';\n\nexport type {ImageType} from './lib/sources/utils/image-type';\nexport type {ImageSourceProps, ImageSourceMetadata} from './lib/sources/image-source';\nexport type {GetImageParameters} from './lib/sources/image-source';\nexport {ImageSource} from './lib/sources/image-source';\n\nexport type {\n TileSourceProps,\n TileSourceMetadata,\n GetTileParameters,\n TileLoadParameters\n} from './lib/sources/tile-source';\nexport type {TileSource} from './lib/sources/tile-source';\n\nexport type {ImageTileSource} from './lib/sources/image-tile-source';\n\nexport type {VectorTileSource} from './lib/sources/vector-tile-source';\n"],"mappings":"SAkCQA,gBAAgB,EAAEC,oBAAoB,EAAEC,yBAAyB;AAAA,SAOjEC,MAAM;AAAA,SAEZC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,IAAI,EACJC,MAAM,EACNC,MAAM,EACNC,QAAQ;AAAA,SAGFC,kBAAkB;AAAA,SAGlBC,kBAAkB;AAAA,SAClBC,eAAe,EAAEC,kBAAkB;AAAA,SACnCC,mBAAmB;AAAA,SAGnBC,SAAS;AAAA,SAIfC,gBAAgB,EAChBC,uBAAuB,EACvBC,gCAAgC,EAChCC,sBAAsB,EACtBC,mBAAmB;AAAA,SAEbC,WAAW,EAAEC,WAAW,EAAEC,eAAe;AAAA,SAE/CC,wBAAwB,EACxBC,oBAAoB,EACpBC,oBAAoB,EACpBC,+BAA+B,EAC/BC,0BAA0B;AAAA,SAEpBC,kBAAkB,EAAEC,cAAc;AAAA,SAIxCC,uBAAuB,EACvBC,uBAAuB,EACvBC,gBAAgB,EAChBC,wBAAwB;AAAA,SAElBC,OAAO,EAAEC,4BAA4B;AAAA,SAGrCC,OAAO,IAAIC,gBAAgB;AAAA,SAG3BC,aAAa,EAAEC,aAAa,EAAEC,WAAW;AAAA,SACzCC,UAAU,IAAIC,WAAW;AAAA,SAGzBC,UAAU;AAAA,SAOVC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa;AAAA,SAKjCC,UAAU,EAAEC,UAAU;AAAA,OAGvB,KAAKC,IAAI;AAChB,SAAQA,IAAI;AAAE,OAGP,KAAKC,MAAM;AAClB,SAAQA,MAAM;AAAE,SAKRC,QAAQ;AAAA,SACRC,QAAQ;AAAA,SACRC,cAAc,IAAIC,QAAQ;AAAA,SAG1BC,oBAAoB,IAAIC,cAAc;AAAA,SAItCC,cAAc;AAAA,SACdC,cAAc;AAAA,SACdC,YAAY;AAAA,SAMZC,UAAU;AAAA,SAKVC,WAAW"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-loader.js","names":["VERSION","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parseTextSync","parse","arrayBuffer","TextDecoder","decode","options","JSON"],"sources":["../src/json-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from './loader-types';\nimport type {Table, TableBatch} from '@loaders.gl/schema';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type JSONLoaderOptions = LoaderOptions;\n\n/**\n * A JSON Micro loader (minimal bundle size)\n * Alternative to `@loaders.gl/json`\n */\nexport const JSONLoader: LoaderWithParser<Table, TableBatch, JSONLoaderOptions> = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\n category: 'json',\n text: true,\n parseTextSync,\n parse: async (arrayBuffer) => parseTextSync(new TextDecoder().decode(arrayBuffer)),\n options: {}\n};\n\n// TODO - Better error handling!\nfunction parseTextSync(text) {\n return JSON.parse(text);\n}\n"],"mappings":"AAKA,MAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAQ3E,OAAO,MAAMC,UAAkE,GAAG;EAChFC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;EAC/BC,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,QAAQ,EAAE,MAAM;EAChBC,IAAI,EAAE,IAAI;EACVC,aAAa;EACbC,KAAK,EAAE,MAAOC,WAAW,IAAKF,aAAa,CAAC,IAAIG,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,CAAC;EAClFG,OAAO,EAAE,CAAC;AACZ,CAAC;AAGD,SAASL,aAAaA,CAACD,IAAI,EAAE;EAC3B,OAAOO,IAAI,CAACL,KAAK,CAACF,IAAI,CAAC;AACzB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"array-buffer-utils.js","names":["compareArrayBuffers","arrayBuffer1","arrayBuffer2","byteLength","array1","Uint8Array","array2","i","length","concatenateArrayBuffers","_len","arguments","sources","Array","_key","concatenateArrayBuffersFromArray","sourceArrays","map","source2","ArrayBuffer","reduce","typedArray","result","offset","sourceArray","set","buffer","concatenateTypedArrays","_len2","typedArrays","_key2","arrays","TypedArrayConstructor","constructor","Error","sumLength","acc","value","array","sliceArrayBuffer","arrayBuffer","byteOffset","subArray","undefined","subarray","arrayCopy"],"sources":["../../../src/lib/binary-utils/array-buffer-utils.ts"],"sourcesContent":["import {TypedArray} from '../../types';\n\n/**\n * compare two binary arrays for equality\n * @param a\n * @param b\n * @param byteLength\n */\nexport function compareArrayBuffers(\n arrayBuffer1: ArrayBuffer,\n arrayBuffer2: ArrayBuffer,\n byteLength?: number\n): boolean {\n byteLength = byteLength || arrayBuffer1.byteLength;\n if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {\n return false;\n }\n const array1 = new Uint8Array(arrayBuffer1);\n const array2 = new Uint8Array(arrayBuffer2);\n for (let i = 0; i < array1.length; ++i) {\n if (array1[i] !== array2[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Concatenate a sequence of ArrayBuffers from arguments\n * @return A concatenated ArrayBuffer\n */\nexport function concatenateArrayBuffers(...sources: (ArrayBuffer | Uint8Array)[]): ArrayBuffer {\n return concatenateArrayBuffersFromArray(sources);\n}\n\n/**\n * Concatenate a sequence of ArrayBuffers from array\n * @return A concatenated ArrayBuffer\n */\nexport function concatenateArrayBuffersFromArray(\n sources: (ArrayBuffer | Uint8Array)[]\n): ArrayBuffer {\n // Make sure all inputs are wrapped in typed arrays\n const sourceArrays = sources.map((source2) =>\n source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2\n );\n\n // Get length of all inputs\n const byteLength = sourceArrays.reduce((length, typedArray) => length + typedArray.byteLength, 0);\n\n // Allocate array with space for all inputs\n const result = new Uint8Array(byteLength);\n\n // Copy the subarrays\n let offset = 0;\n for (const sourceArray of sourceArrays) {\n result.set(sourceArray, offset);\n offset += sourceArray.byteLength;\n }\n\n // We work with ArrayBuffers, discard the typed array wrapper\n return result.buffer;\n}\n\n/**\n * Concatenate arbitrary count of typed arrays\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays\n * @param - list of arrays. All arrays should be the same type\n * @return A concatenated TypedArray\n */\nexport function concatenateTypedArrays<T>(...typedArrays: T[]): T {\n // @ts-ignore\n const arrays = typedArrays as TypedArray[];\n // @ts-ignore\n const TypedArrayConstructor = (arrays && arrays.length > 1 && arrays[0].constructor) || null;\n if (!TypedArrayConstructor) {\n throw new Error(\n '\"concatenateTypedArrays\" - incorrect quantity of arguments or arguments have incompatible data types'\n );\n }\n\n const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);\n // @ts-ignore typescript does not like dynamic constructors\n const result = new TypedArrayConstructor(sumLength);\n let offset = 0;\n for (const array of arrays) {\n result.set(array, offset);\n offset += array.length;\n }\n return result;\n}\n\n/**\n * Copy a view of an ArrayBuffer into new ArrayBuffer with byteOffset = 0\n * @param arrayBuffer\n * @param byteOffset\n * @param byteLength\n */\nexport function sliceArrayBuffer(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n byteLength?: number\n): ArrayBuffer {\n const subArray =\n byteLength !== undefined\n ? new Uint8Array(arrayBuffer).subarray(byteOffset, byteOffset + byteLength)\n : new Uint8Array(arrayBuffer).subarray(byteOffset);\n const arrayCopy = new Uint8Array(subArray);\n return arrayCopy.buffer;\n}\n"],"mappings":"AAQA,OAAO,SAASA,mBAAmBA,CACjCC,YAAyB,EACzBC,YAAyB,EACzBC,UAAmB,EACV;EACTA,UAAU,GAAGA,UAAU,IAAIF,YAAY,CAACE,UAAU;EAClD,IAAIF,YAAY,CAACE,UAAU,GAAGA,UAAU,IAAID,YAAY,CAACC,UAAU,GAAGA,UAAU,EAAE;IAChF,OAAO,KAAK;EACd;EACA,MAAMC,MAAM,GAAG,IAAIC,UAAU,CAACJ,YAAY,CAAC;EAC3C,MAAMK,MAAM,GAAG,IAAID,UAAU,CAACH,YAAY,CAAC;EAC3C,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,MAAM,CAACI,MAAM,EAAE,EAAED,CAAC,EAAE;IACtC,IAAIH,MAAM,CAACG,CAAC,CAAC,KAAKD,MAAM,C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F,WAA2B;EAE1C,MAAMG,qBAAqB,GAAID,MAAM,IAAIA,MAAM,CAACvB,MAAM,GAAG,CAAC,IAAIuB,MAAM,CAAC,CAAC,CAAC,CAACE,WAAW,IAAK,IAAI;EAC5F,IAAI,CAACD,qBAAqB,EAAE;IAC1B,MAAM,IAAIE,KAAK,CACb,sGACF,CAAC;EACH;EAEA,MAAMC,SAAS,GAAGJ,MAAM,CAACX,MAAM,CAAC,CAACgB,GAAG,EAAEC,KAAK,KAAKD,GAAG,GAAGC,KAAK,CAAC7B,MAAM,EAAE,CAAC,CAAC;EAEtE,MAAMc,MAAM,GAAG,IAAIU,qBAAqB,CAACG,SAAS,CAAC;EACnD,IAAIZ,MAAM,GAAG,CAAC;EACd,KAAK,MAAMe,KAAK,IAAIP,MAAM,EAAE;IAC1BT,MAAM,CAACG,GAAG,CAACa,KAAK,EAAEf,MAAM,CAAC;IACzBA,MAAM,IAAIe,KAAK,CAAC9B,MAAM;EACxB;EACA,OAAOc,MAAM;AACf;AAQA,OAAO,SAASiB,gBAAgBA,CAC9BC,WAAwB,EACxBC,UAAkB,EAClBtC,UAAmB,EACN;EACb,MAAMuC,QAAQ,GACZvC,UAAU,KAAKwC,SAAS,GACpB,IAAItC,UAAU,CAACmC,WAAW,CAAC,CAACI,QAAQ,CAACH,UAAU,EAAEA,UAAU,GAAGtC,UAAU,CAAC,GACzE,IAAIE,UAAU,CAACmC,WAAW,CAAC,CAACI,QAAQ,CAACH,UAAU,CAAC;EACtD,MAAMI,SAAS,GAAG,IAAIxC,UAAU,CAACqC,QAAQ,CAAC;EAC1C,OAAOG,SAAS,CAACnB,MAAM;AACzB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataview-copy-utils.js","names":["padToNBytes","padStringToByteAlignment","string","byteAlignment","length","paddedLength","Math","ceil","padding","whitespace","i","copyStringToDataView","dataView","byteOffset","byteLength","setUint8","charCodeAt","copyBinaryToDataView","binary","copyPaddedArrayBufferToDataView","sourceBuffer","padLength","targetArray","Uint8Array","buffer","sourceArray","set","copyPaddedStringToDataView","textEncoder","TextEncoder","stringBuffer","encode"],"sources":["../../../src/lib/binary-utils/dataview-copy-utils.ts"],"sourcesContent":["// loaders./gl, MIT license\n\nimport {TypedArray} from '../../types';\nimport {padToNBytes} from './memory-copy-utils';\n\n/**\n * Helper function that pads a string with spaces to fit a certain byte alignment\n * @param string\n * @param byteAlignment\n * @returns\n *\n * @todo PERFORMANCE IDEA: No need to copy string twice...\n */\nexport function padStringToByteAlignment(string: string, byteAlignment: number): string {\n const length = string.length;\n const paddedLength = Math.ceil(length / byteAlignment) * byteAlignment; // Round up to the required alignment\n const padding = paddedLength - length;\n let whitespace = '';\n for (let i = 0; i < padding; ++i) {\n whitespace += ' ';\n }\n return string + whitespace;\n}\n\n/**\n *\n * @param dataView\n * @param byteOffset\n * @param string\n * @param byteLength\n * @returns\n */\nexport function copyStringToDataView(\n dataView: DataView,\n byteOffset: number,\n string: string,\n byteLength: number\n): number {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, string.charCodeAt(i));\n }\n }\n return byteOffset + byteLength;\n}\n\nexport function copyBinaryToDataView(dataView, byteOffset, binary, byteLength) {\n if (dataView) {\n for (let i = 0; i < byteLength; i++) {\n dataView.setUint8(byteOffset + i, binary[i]);\n }\n }\n return byteOffset + byteLength;\n}\n\n/**\n * Copy sourceBuffer to dataView with some padding\n *\n * @param dataView - destination data container. If null - only new offset is calculated\n * @param byteOffset - destination byte offset to copy to\n * @param sourceBuffer - source data buffer\n * @param padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedArrayBufferToDataView(\n dataView: DataView | null,\n byteOffset: number,\n sourceBuffer: TypedArray,\n padding: number\n): number {\n const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);\n const padLength = paddedLength - sourceBuffer.byteLength;\n\n if (dataView) {\n // Copy array\n const targetArray = new Uint8Array(\n dataView.buffer,\n dataView.byteOffset + byteOffset,\n sourceBuffer.byteLength\n );\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n\n // Add PADDING\n for (let i = 0; i < padLength; ++i) {\n // json chunk is padded with spaces (ASCII 0x20)\n dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 0x20);\n }\n }\n byteOffset += paddedLength;\n return byteOffset;\n}\n\n/**\n * Copy string to dataView with some padding\n *\n * @param {DataView | null} dataView - destination data container. If null - only new offset is calculated\n * @param {number} byteOffset - destination byte offset to copy to\n * @param {string} string - source string\n * @param {number} padding - pad the resulting array to multiple of \"padding\" bytes. Additional bytes are filled with 0x20 (ASCII space)\n *\n * @return new byteOffset of resulting dataView\n */\nexport function copyPaddedStringToDataView(\n dataView: DataView | null,\n byteOffset: number,\n string: string,\n padding: number\n): number {\n const textEncoder = new TextEncoder();\n // PERFORMANCE IDEA: We encode twice, once to get size and once to store\n // PERFORMANCE IDEA: Use TextEncoder.encodeInto() to avoid temporary copy\n const stringBuffer = textEncoder.encode(string);\n\n byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);\n\n return byteOffset;\n}\n"],"mappings":"SAGQA,WAAW;AAUnB,OAAO,SAASC,wBAAwBA,CAACC,MAAc,EAAEC,aAAqB,EAAU;EACtF,MAAMC,MAAM,GAAGF,MAAM,CAACE,MAAM;EAC5B,MAAMC,YAAY,GAAGC,IAAI,CAACC,IAAI,CAACH,MAAM,GAAGD,aAAa,CAAC,GAAGA,aAAa;EACtE,MAAMK,OAAO,GAAGH,YAAY,GAAGD,MAAM;EACrC,IAAIK,UAAU,GAAG,EAAE;EACnB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,OAAO,EAAE,EAAEE,CAAC,EAAE;IAChCD,UAAU,IAAI,GAAG;EACnB;EACA,OAAOP,MAAM,GAAGO,UAAU;AAC5B;AAUA,OAAO,SAASE,oBAAoBA,CAClCC,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AC,EAAE;MAElCE,QAAQ,CAACG,QAAQ,CAACF,UAAU,GAAGO,YAAY,CAACN,UAAU,GAAGJ,CAAC,EAAE,IAAI,CAAC;IACnE;EACF;EACAG,UAAU,IAAIR,YAAY;EAC1B,OAAOQ,UAAU;AACnB;AAYA,OAAO,SAASc,0BAA0BA,CACxCf,QAAyB,EACzBC,UAAkB,EAClBX,MAAc,EACdM,OAAe,EACP;EACR,MAAMoB,WAAW,GAAG,IAAIC,WAAW,CAAC,CAAC;EAGrC,MAAMC,YAAY,GAAGF,WAAW,CAACG,MAAM,CAAC7B,MAAM,CAAC;EAE/CW,UAAU,GAAGM,+BAA+B,CAACP,QAAQ,EAAEC,UAAU,EAAEiB,YAAY,EAAEtB,OAAO,CAAC;EAEzF,OAAOK,UAAU;AACnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-first-characters.js","names":["getFirstCharacters","data","length","arguments","undefined","slice","ArrayBuffer","isView","getMagicString","buffer","byteOffset","arrayBuffer","byteLength","dataView","DataView","magic","i","String","fromCharCode","getUint8"],"sources":["../../../src/lib/binary-utils/get-first-characters.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/**\n * Get the first characters from a binary file (interpret the first bytes as an ASCII string)\n * @param data\n * @param length\n * @returns\n */\nexport function getFirstCharacters(data: string | ArrayBuffer, length: number = 5): string {\n if (typeof data === 'string') {\n return data.slice(0, length);\n } else if (ArrayBuffer.isView(data)) {\n // Typed Arrays can have offsets into underlying buffer\n return getMagicString(data.buffer, data.byteOffset, length);\n } else if (data instanceof ArrayBuffer) {\n const byteOffset = 0;\n return getMagicString(data, byteOffset, length);\n }\n return '';\n}\n\n/**\n * Gets a magic string from a \"file\"\n * Typically used to check or detect file format\n * @param arrayBuffer\n * @param byteOffset\n * @param length\n * @returns\n */\nexport function getMagicString(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n length: number\n): string {\n if (arrayBuffer.byteLength <= byteOffset + length) {\n return '';\n }\n const dataView = new DataView(arrayBuffer);\n let magic = '';\n for (let i = 0; i < length; i++) {\n magic += String.fromCharCode(dataView.getUint8(byteOffset + i));\n }\n return magic;\n}\n"],"mappings":"AAUA,OAAO,SAASA,kBAAkBA,CAACC,IAA0B,EAA8B;EAAA,IAA5BC,MAAc,GAAAC,SAAA,CAAAD,MAAA,QAAAC,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,CAAC;EAC/E,IAAI,OAAOF,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI,CAACI,KAAK,CAAC,CAAC,EAAEH,MAAM,CAAC;EAC9B,CAAC,MAAM,IAAII,WAAW,CAACC,MAAM,CAACN,IAAI,CAAC,EAAE;IAEnC,OAAOO,cAAc,CAACP,IAAI,CAACQ,MAAM,EAAER,IAAI,CAACS,UAAU,EAAER,MAAM,CAAC;EAC7D,CAAC,MAAM,IAAID,IAAI,YAAYK,WAAW,EAAE;IACtC,MAAMI,UAAU,GAAG,CAAC;IACpB,OAAOF,cAAc,CAACP,IAAI,EAAES,UAAU,EAAER,MAAM,CAAC;EACjD;EACA,OAAO,EAAE;AACX;AAUA,OAAO,SAASM,cAAcA,CAC5BG,WAAwB,EACxBD,UAAkB,EAClBR,MAAc,EACN;EACR,IAAIS,WAAW,CAACC,UAAU,IAAIF,UAAU,GAAGR,MAAM,EAAE;IACjD,OAAO,EAAE;EACX;EACA,MAAMW,QAAQ,GAAG,IAAIC,QAAQ,CAACH,WAAW,CAAC;EAC1C,IAAII,KAAK,GAAG,EAAE;EACd,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGd,MAAM,EAAEc,CAAC,EAAE,EAAE;IAC/BD,KAAK,IAAIE,MAAM,CAACC,YAAY,CAACL,QAAQ,CAACM,QAAQ,CAACT,UAAU,GAAGM,CAAC,CAAC,CAAC;EACjE;EACA,OAAOD,KAAK;AACd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-conversion-utils.js","names":["node","isBuffer","value","toBuffer","data","toArrayBuffer","ArrayBuffer","isView","byteOffset","byteLength","buffer","slice","text","uint8Array","TextEncoder","encode","_toArrayBuffer","Error"],"sources":["../../../src/lib/binary-utils/memory-conversion-utils.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport * as node from '../node/buffer';\n\n/**\n * Check for Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n */\nexport function isBuffer(value: any): boolean {\n return value && typeof value === 'object' && value.isBuffer;\n}\n\n/**\n * Converts to Node.js `Buffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toBuffer(data: any): Buffer {\n return node.toBuffer ? node.toBuffer(data) : data;\n}\n\n/**\n * Convert an object to an array buffer\n */\nexport function toArrayBuffer(data: unknown): ArrayBuffer {\n // Note: Should be called first, Buffers can trigger other detections below\n if (isBuffer(data)) {\n return node.toArrayBuffer(data);\n }\n\n if (data instanceof ArrayBuffer) {\n return data;\n }\n\n // Careful - Node Buffers look like Uint8Arrays (keep after isBuffer)\n if (ArrayBuffer.isView(data)) {\n if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {\n return data.buffer;\n }\n return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\n }\n\n if (typeof data === 'string') {\n const text = data;\n const uint8Array = new TextEncoder().encode(text);\n return uint8Array.buffer;\n }\n\n // HACK to support Blob polyfill\n if (data && typeof data === 'object' && (data as any)._toArrayBuffer) {\n return (data as any)._toArrayBuffer();\n }\n\n throw new Error('toArrayBuffer');\n}\n"],"mappings":"OAIO,KAAKA,IAAI;AAKhB,OAAO,SAASC,QAAQA,CAACC,KAAU,EAAW;EAC5C,OAAOA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACD,QAAQ;AAC7D;AAMA,OAAO,SAASE,QAAQA,CAACC,IAAS,EAAU;EAC1C,OAAOJ,IAAI,CAACG,QAAQ,GAAGH,IAAI,CAACG,QAAQ,CAACC,IAAI,CAAC,GAAGA,IAAI;AACnD;AAKA,OAAO,SAASC,aAAaA,CAACD,IAAa,EAAe;EAExD,IAAIH,QAAQ,CAACG,IAAI,CAAC,EAAE;IAClB,OAAOJ,IAAI,CAACK,aAAa,CAACD,IAAI,CAAC;EACjC;EAEA,IAAIA,IAAI,YAAYE,WAAW,EAAE;IAC/B,OAAOF,IAAI;EACb;EAGA,IAAIE,WAAW,CAACC,MAAM,CAACH,IAAI,CAAC,EAAE;IAC5B,IAAIA,IAAI,CAACI,UAAU,KAAK,CAAC,IAAIJ,IAAI,CAACK,UAAU,KAAKL,IAAI,CAACM,MAAM,CAACD,UAAU,EAAE;MACvE,OAAOL,IAAI,CAACM,MAAM;IACpB;IACA,OAAON,IAAI,CAACM,MAAM,CAACC,KAAK,CAACP,IAAI,CAACI,UAAU,EAAEJ,IAAI,CAACI,UAAU,GAAGJ,IAAI,CAACK,UAAU,CAAC;EAC9E;EAEA,IAAI,OAAOL,IAAI,KAAK,QAAQ,EAAE;IAC5B,MAAMQ,IAAI,GAAGR,IAAI;IACjB,MAAMS,UAAU,GAAG,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACH,IAAI,CAAC;IACjD,OAAOC,UAAU,CAACH,MAAM;EAC1B;EAGA,IAAIN,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAKA,IAAI,CAASY,cAAc,EAAE;IACpE,OAAQZ,IAAI,CAASY,cAAc,CAAC,CAAC;EACvC;EAEA,MAAM,IAAIC,KAAK,CAAC,eAAe,CAAC;AAClC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-copy-utils.js","names":["assert","padToNBytes","byteLength","padding","copyArrayBuffer","targetBuffer","sourceBuffer","byteOffset","arguments","length","undefined","targetArray","Uint8Array","sourceArray","set","copyToArray","source","target","targetOffset","ArrayBuffer","srcByteOffset","srcByteLength","buffer","arrayBuffer"],"sources":["../../../src/lib/binary-utils/memory-copy-utils.ts"],"sourcesContent":["import {assert} from '../env-utils/assert';\n\n/**\n * Calculate new size of an arrayBuffer to be aligned to an n-byte boundary\n * This function increases `byteLength` by the minimum delta,\n * allowing the total length to be divided by `padding`\n * @param byteLength\n * @param padding\n */\nexport function padToNBytes(byteLength: number, padding: number): number {\n assert(byteLength >= 0); // `Incorrect 'byteLength' value: ${byteLength}`\n assert(padding > 0); // `Incorrect 'padding' value: ${padding}`\n return (byteLength + (padding - 1)) & ~(padding - 1);\n}\n\n/**\n * Creates a new Uint8Array based on two different ArrayBuffers\n * @param targetBuffer The first buffer.\n * @param sourceBuffer The second buffer.\n * @return The new ArrayBuffer created out of the two.\n */\nexport function copyArrayBuffer(\n targetBuffer: ArrayBuffer,\n sourceBuffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number = sourceBuffer.byteLength\n): ArrayBuffer {\n const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);\n const sourceArray = new Uint8Array(sourceBuffer);\n targetArray.set(sourceArray);\n return targetBuffer;\n}\n\n/**\n * Copy from source to target at the targetOffset\n *\n * @param source - The data to copy\n * @param target - The destination to copy data into\n * @param targetOffset - The start offset into target to place the copied data\n * @returns the new offset taking into account proper padding\n */\nexport function copyToArray(source: ArrayBuffer | any, target: any, targetOffset: number): number {\n let sourceArray;\n\n if (source instanceof ArrayBuffer) {\n sourceArray = new Uint8Array(source);\n } else {\n // Pack buffer onto the big target array\n //\n // 'source.data.buffer' could be a view onto a larger buffer.\n // We MUST use this constructor to ensure the byteOffset and byteLength is\n // set to correct values from 'source.data' and not the underlying\n // buffer for target.set() to work properly.\n const srcByteOffset = source.byteOffset;\n const srcByteLength = source.byteLength;\n // In gltf parser it is set as \"arrayBuffer\" instead of \"buffer\"\n // https://github.com/visgl/loaders.gl/blob/1e3a82a0a65d7b6a67b1e60633453e5edda2960a/modules/gltf/src/lib/parse-gltf.js#L85\n sourceArray = new Uint8Array(source.buffer || source.arrayBuffer, srcByteOffset, srcByteLength);\n }\n\n // Pack buffer onto the big target array\n target.set(sourceArray, targetOffset);\n\n return targetOffset + padToNBytes(sourceArray.byteLength, 4);\n}\n"],"mappings":"SAAQA,MAAM;AASd,OAAO,SAASC,WAAWA,CAACC,UAAkB,EAAEC,OAAe,EAAU;EACvEH,MAAM,CAACE,UAAU,IAAI,CAAC,CAAC;EACvBF,MAAM,CAACG,OAAO,GAAG,CAAC,CAAC;EACnB,OAAQD,UAAU,IAAIC,OAAO,GAAG,CAAC,CAAC,GAAI,EAAEA,OAAO,GAAG,CAAC,CAAC;AACtD;AAQA,OAAO,SAASC,eAAeA,CAC7BC,YAAyB,EACzBC,YAAyB,EACzBC,UAAkB,EAEL;EAAA,IADbL,UAAkB,GAAAM,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGF,YAAY,CAACJ,UAAU;EAE5C,MAAMS,WAAW,GAAG,IAAIC,UAAU,CAACP,YAAY,EAAEE,UAAU,EAAEL,UAAU,CAAC;EACxE,MAAMW,WAAW,GAAG,IAAID,UAAU,CAACN,YAAY,CAAC;EAChDK,WAAW,CAACG,GAAG,CAACD,WAAW,CAAC;EAC5B,OAAOR,YAAY;AACrB;AAUA,OAAO,SAASU,WAAWA,CAACC,MAAyB,EAAEC,MAAW,EAAEC,YAAoB,EAAU;EAChG,IAAIL,WAAW;EAEf,IAAIG,MAAM,YAAYG,WAAW,EAAE;IACjCN,WAAW,GAAG,IAAID,UAAU,CAACI,MAAM,CAAC;EACtC,CAAC,MAAM;IAOL,MAAMI,aAAa,GAAGJ,MAAM,CAACT,UAAU;IACvC,MAAMc,aAAa,GAAGL,MAAM,CAACd,UAAU;IAGvCW,WAAW,GAAG,IAAID,UAAU,CAACI,MAAM,CAACM,MAAM,IAAIN,MAAM,CAACO,WAAW,EAAEH,aAAa,EAAEC,aAAa,CAAC;EACjG;EAGAJ,MAAM,CAACH,GAAG,CAACD,WAAW,EAAEK,YAAY,CAAC;EAErC,OAAOA,YAAY,GAAGjB,WAAW,CAACY,WAAW,CAACX,UAAU,EAAE,CAAC,CAAC;AAC9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"assert.js","names":["assert","condition","message","Error"],"sources":["../../../src/lib/env-utils/assert.ts"],"sourcesContent":["/**\n * Throws an `Error` with the optional `message` if `condition` is falsy\n * @note Replacement for the external assert method to reduce bundle size\n */\nexport function assert(condition: any, message?: string): void {\n if (!condition) {\n throw new Error(message || 'loader assertion failed.');\n }\n}\n"],"mappings":"AAIA,OAAO,SAASA,MAAMA,CAACC,SAAc,EAAEC,OAAgB,EAAQ;EAC7D,IAAI,CAACD,SAAS,EAAE;IACd,MAAM,IAAIE,KAAK,CAACD,OAAO,IAAI,0BAA0B,CAAC;EACxD;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"globals.js","names":["globals","self","window","global","document","self_","window_","global_","document_","isBrowser","Boolean","process","String","browser","isWorker","importScripts","matches","version","exec","nodeVersion","parseFloat"],"sources":["../../../src/lib/env-utils/globals.ts"],"sourcesContent":["// Purpose: include this in your module to avoid\n// dependencies on micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst globals = {\n self: typeof self !== 'undefined' && self,\n window: typeof window !== 'undefined' && window,\n global: typeof global !== 'undefined' && global,\n document: typeof document !== 'undefined' && document\n};\n\ntype obj = {[key: string]: any};\nconst self_: obj = globals.self || globals.window || globals.global || {};\nconst window_: obj = globals.window || globals.self || globals.global || {};\nconst global_: obj = globals.global || globals.self || globals.window || {};\nconst document_: obj = globals.document || {};\n\nexport {self_ as self, window_ as window, global_ as global, document_ as document};\n\n/** true if running in a browser */\nexport const isBrowser: boolean =\n // @ts-ignore process does not exist on browser\n Boolean(typeof process !== 'object' || String(process) !== '[object process]' || process.browser);\n\n/** true if running in a worker thread */\nexport const isWorker: boolean = typeof importScripts === 'function';\n\n// Extract node major version\nconst matches =\n typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);\n/** Major Node version (as a number) */\nexport const nodeVersion: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AAC,CAAC,CAAC,CAAC,IAAK,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-view-file.js","names":["toNumber","bigint","Number","MAX_SAFE_INTEGER","Error","DataViewFile","constructor","file","destroy","getUint8","offset","getUint16","getUint32","getBigUint64","slice","startOffset","endOffset","buffer","length","BigInt","byteLength"],"sources":["../../../src/lib/file-provider/data-view-file.ts"],"sourcesContent":["import {FileProvider} from './file-provider';\n\n/**\n * Checks if bigint can be converted to number and convert it if possible\n * @param bigint bigint to be converted\n * @returns number\n */\nconst toNumber = (bigint: bigint) => {\n if (bigint > Number.MAX_SAFE_INTEGER) {\n throw new Error('Offset is out of bounds');\n }\n return Number(bigint);\n};\n\n/**\n * Provides file data using DataView\n * @deprecated - will be replaced with ReadableFile\n */\nexport class DataViewFile implements FileProvider {\n /** The DataView from which data is provided */\n private file: DataView;\n\n constructor(file: DataView) {\n this.file = file;\n }\n\n async destroy(): Promise<void> {}\n\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint8(offset: bigint): Promise<number> {\n return this.file.getUint8(toNumber(offset));\n }\n\n /**\n * Gets an unsigned 16-bit intege at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint16(offset: bigint): Promise<number> {\n return this.file.getUint16(toNumber(offset), true);\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint32(offset: bigint): Promise<number> {\n return this.file.getUint32(toNumber(offset), true);\n }\n\n /**\n * Gets an unsigned 64-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getBigUint64(offset: bigint): Promise<bigint> {\n return this.file.getBigUint64(toNumber(offset), true);\n }\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffset The offset, in bytes, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n async slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer> {\n return this.file.buffer.slice(toNumber(startOffset), toNumber(endOffset));\n }\n\n /** the length (in bytes) of the data. */\n get length() {\n return BigInt(this.file.byteLength);\n }\n}\n"],"mappings":"AAOA,MAAMA,QAAQ,GAAIC,MAAc,IAAK;EACnC,IAAIA,MAAM,GAAGC,MAAM,CAACC,gBAAgB,EAAE;IACpC,MAAM,IAAIC,KAAK,CAAC,yBAAyB,CAAC;EAC5C;EACA,OAAOF,MAAM,CAACD,MAAM,CAAC;AACvB,CAAC;AAMD,OAAO,MAAMI,YAAY,CAAyB;EAIhDC,WAAWA,CAACC,IAAc,EAAE;IAAA,KAFpBA,IAAI;IAGV,IAAI,CAACA,IAAI,GAAGA,IAAI;EAClB;EAEA,MAAMC,OAAOA,CAAA,EAAkB,CAAC;EAMhC,MAAMC,QAAQA,CAACC,MAAc,EAAmB;IAC9C,OAAO,IAAI,CAACH,IAAI,CAACE,QAAQ,CAACT,QAAQ,CAACU,MAAM,CAAC,CAAC;EAC7C;EAMA,MAAMC,SAASA,CAACD,MAAc,EAAmB;IAC/C,OAAO,IAAI,CAACH,IAAI,CAACI,SAAS,CAACX,QAAQ,CAACU,MAAM,CAAC,EAAE,IAAI,CAAC;EACpD;EAMA,MAAME,SAASA,CAACF,MAAc,EAAmB;IAC/C,OAAO,IAAI,CAACH,IAAI,CAACK,SAAS,CAACZ,QAAQ,CAACU,MAAM,CAAC,EAAE,IAAI,CAAC;EACpD;EAMA,MAAMG,YAAYA,CAACH,MAAc,EAAmB;IAClD,OAAO,IAAI,CAACH,IAAI,CAACM,YAAY,CAACb,QAAQ,CAACU,MAAM,CAAC,EAAE,IAAI,CAAC;EACvD;EAOA,MAAMI,KAAKA,CAACC,WAAmB,EAAEC,SAAiB,EAAwB;IACxE,OAAO,IAAI,CAACT,IAAI,CAACU,MAAM,CAACH,KAAK,CAACd,QAAQ,CAACe,WAAW,CAAC,EAAEf,QAAQ,CAACgB,SAAS,CAAC,CAAC;EAC3E;EAGA,IAAIE,MAAMA,CAAA,EAAG;IACX,OAAOC,MAAM,CAAC,IAAI,CAACZ,IAAI,CAACa,UAAU,CAAC;EACrC;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-handle-file.js","names":["NodeFileFacade","NodeFile","FileHandleFile","constructor","path","append","arguments","length","undefined","file","truncate","buffer","destroy","close","getUint8","offset","arrayBuffer","read","val","Uint8Array","at","Error","getUint16","Uint16Array","getUint32","Uint32Array","getBigUint64","BigInt64Array","slice","startOffset","endOffset","bigLength","Number","MAX_SAFE_INTEGER","bigsize"],"sources":["../../../src/lib/file-provider/file-handle-file.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {FileProvider} from './file-provider';\nimport {NodeFileFacade as NodeFile} from '../files/node-file-facade';\n\n/**\n * Provides file data using node fs library\n * @deprecated - will be replaced with ReadableFile\n */\nexport class FileHandleFile implements FileProvider {\n /** The FileHandle from which data is provided */\n private file: NodeFile;\n\n /** Create a new FileHandleFile */\n constructor(path: string, append: boolean = false) {\n this.file = new NodeFile(path, append ? 'a+' : 'r');\n }\n\n /**\n * Truncates the file descriptor.\n * @param length desired file lenght\n */\n async truncate(length: number): Promise<void> {\n await this.file.truncate(length);\n }\n\n /**\n * Append data to a file.\n * @param buffer data to append\n */\n async append(buffer: Uint8Array): Promise<void> {\n await this.file.append(buffer);\n }\n\n /** Close file */\n async destroy(): Promise<void> {\n await this.file.close();\n }\n\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint8(offset: number | bigint): Promise<number> {\n const arrayBuffer = await this.file.read(offset, 1);\n const val = new Uint8Array(arrayBuffer).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint16(offset: number | bigint): Promise<number> {\n const arrayBuffer = await this.file.read(offset, 2);\n const val = new Uint16Array(arrayBuffer).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint32(offset: number | bigint): Promise<number> {\n const arrayBuffer = await this.file.read(offset, 4);\n const val = new Uint32Array(arrayBuffer).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getBigUint64(offset: number | bigint): Promise<bigint> {\n const arrayBuffer = await this.file.read(offset, 8);\n const val = new BigInt64Array(arrayBuffer).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffset The offset, in byte, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n async slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer> {\n const bigLength = endOffset - startOffset;\n if (bigLength > Number.MAX_SAFE_INTEGER) {\n throw new Error('too big slice');\n }\n const length = Number(bigLength);\n return await this.file.read(startOffset, length);\n }\n\n /**\n * the length (in bytes) of the data.\n */\n get length(): bigint {\n return this.file.bigsize;\n }\n}\n"],"mappings":"SAKQA,cAAc,IAAIC,QAAQ;AAMlC,OAAO,MAAMC,cAAc,CAAyB;EAKlDC,WAAWA,CAACC,IAAY,EAA2B;IAAA,IAAzBC,MAAe,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;IAAA,K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C;IACnD,MAAMG,GAAG,GAAG,IAAIO,WAAW,CAACT,WAAW,CAAC,CAACI,EAAE,CAAC,CAAC,CAAC;IAC9C,IAAIF,GAAG,KAAKV,SAAS,EAAE;MACrB,MAAM,IAAIa,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOH,GAAG;EACZ;EAMA,MAAMQ,YAAYA,CAACX,MAAuB,EAAmB;IAC3D,MAAMC,WAAW,GAAG,MAAM,IAAI,CAACP,IAAI,CAACQ,IAAI,CAACF,MAAM,EAAE,CAAC,CAAC;IACnD,MAAMG,GAAG,GAAG,IAAIS,aAAa,CAACX,WAAW,CAAC,CAACI,EAAE,CAAC,CAAC,CAAC;IAChD,IAAIF,GAAG,KAAKV,SAAS,EAAE;MACrB,MAAM,IAAIa,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOH,GAAG;EACZ;EAOA,MAAMU,KAAKA,CAACC,WAAmB,EAAEC,SAAiB,EAAwB;IACxE,MAAMC,SAAS,GAAGD,SAAS,GAAGD,WAAW;IACzC,IAAIE,SAAS,GAAGC,MAAM,CAACC,gBAAgB,EAAE;MACvC,MAAM,IAAIZ,KAAK,CAAC,eAAe,CAAC;IAClC;IACA,MAAMd,MAAM,GAAGyB,MAAM,CAACD,SAAS,CAAC;IAChC,OAAO,MAAM,IAAI,CAACtB,IAAI,CAACQ,IAAI,CAACY,WAAW,EAAEtB,MAAM,CAAC;EAClD;EAKA,IAAIA,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAACE,IAAI,CAACyB,OAAO;EAC1B;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-provider.js","names":["isFileProvider","fileProvider","getUint8","slice","length"],"sources":["../../../src/lib/file-provider/file-provider.ts"],"sourcesContent":["/**\n * Interface for providing file data\n * @deprecated - will be replaced with ReadableFile\n */\nexport interface FileProvider {\n /**\n * Cleanup class data\n */\n destroy(): Promise<void>;\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint8(offset: bigint): Promise<number>;\n\n /**\n * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n getUint16(offset: bigint): Promise<number>;\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the file of the view where to read the data.\n */\n getUint32(offset: bigint): Promise<number>;\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in byte, from the file of the view where to read the data.\n */\n getBigUint64(offset: bigint): Promise<bigint>;\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffset The offset, in bytes, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n slice(startOffset: bigint, endOffset: bigint): Promise<ArrayBuffer>;\n\n /**\n * the length (in bytes) of the data.\n */\n length: bigint;\n}\n\n/**\n * Check is the object has FileProvider members\n * @param fileProvider - tested object\n */\nexport const isFileProvider = (fileProvider: unknown) => {\n return (\n (fileProvider as FileProvider)?.getUint8 &&\n (fileProvider as FileProvider)?.slice &&\n (fileProvider as FileProvider)?.length\n );\n};\n"],"mappings":"AAkDA,OAAO,MAAMA,cAAc,GAAIC,YAAqB,IAAK;EACvD,OACE,CAACA,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAmBC,QAAQ,MACvCD,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAmBE,KAAK,MACpCF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAmBG,MAAM;AAE1C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"blob-file.js","names":["BlobFile","constructor","blob","handle","size","bigsize","url","ArrayBuffer","Blob","byteLength","BigInt","File","name","close","stat","isDirectory","read","start","length","arrayBuffer","slice"],"sources":["../../../src/lib/files/blob-file.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ReadableFile} from './file';\n\n/**\n * BlobFile provides a \"file like interface\" to the data in a Blob or File object\n */\nexport class BlobFile implements ReadableFile {\n readonly handle: Blob;\n readonly size: number;\n readonly bigsize: bigint;\n readonly url: string;\n\n constructor(blob: Blob | File | ArrayBuffer) {\n this.handle = blob instanceof ArrayBuffer ? new Blob([blob]) : blob;\n this.size = blob instanceof ArrayBuffer ? blob.byteLength : blob.size;\n this.bigsize = BigInt(this.size);\n this.url = blob instanceof File ? blob.name : '';\n }\n\n async close() {}\n\n async stat() {\n return {\n size: this.handle.size,\n bigsize: BigInt(this.handle.size),\n isDirectory: false\n };\n }\n\n async read(start: number, length: number): Promise<ArrayBuffer> {\n const arrayBuffer = await this.handle.slice(start, start + length).arrayBuffer();\n return arrayBuffer;\n }\n}\n"],"mappings":"AASA,OAAO,MAAMA,QAAQ,CAAyB;EAM5CC,WAAWA,CAACC,IAA+B,EAAE;IAAA,KALpCC,MAAM;IAAA,KACNC,IAAI;IAAA,KACJC,OAAO;IAAA,KACPC,GAAG;IAGV,IAAI,CAACH,MAAM,GAAGD,IAAI,YAAYK,WAAW,GAAG,IAAIC,IAAI,CAAC,CAACN,IAAI,CAAC,CAAC,GAAGA,IAAI;IACnE,IAAI,CAACE,IAAI,GAAGF,IAAI,YAAYK,WAAW,GAAGL,IAAI,CAACO,UAAU,GAAGP,IAAI,CAACE,IAAI;IACrE,IAAI,CAACC,OAAO,GAAGK,MAAM,CAAC,IAAI,CAACN,IAAI,CAAC;IAChC,IAAI,CAACE,GAAG,GAAGJ,IAAI,YAAYS,IAAI,GAAGT,IAAI,CAACU,IAAI,GAAG,EAAE;EAClD;EAEA,MAAMC,KAAKA,CAAA,EAAG,CAAC;EAEf,MAAMC,IAAIA,CAAA,EAAG;IACX,OAAO;MACLV,IAAI,EAAE,IAAI,CAACD,MAAM,CAACC,IAAI;MACtBC,OAAO,EAAEK,MAAM,CAAC,IAAI,CAACP,MAAM,CAACC,IAAI,CAAC;MACjCW,WAAW,EAAE;IACf,CAAC;EACH;EAEA,MAAMC,IAAIA,CAACC,KAAa,EAAEC,MAAc,EAAwB;IAC9D,MAAMC,WAAW,GAAG,MAAM,IAAI,CAAChB,MAAM,CAACiB,KAAK,CAACH,KAAK,EAAEA,KAAK,GAAGC,MAAM,CAAC,CAACC,WAAW,CAAC,CAAC;IAChF,OAAOA,WAAW;EACpB;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","names":[],"sources":["../../../src/lib/files/file.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport type Stat = {\n size: number;\n bigsize: bigint;\n isDirectory: boolean;\n};\n\nexport interface ReadableFile {\n /** The underlying file handle (Blob, Node.js file descriptor etc) */\n readonly handle: unknown;\n /** Length of file in bytes, if available */\n readonly size: number;\n /** Length of file in bytes, if available */\n readonly bigsize: bigint;\n /** Url, if available */\n readonly url: string;\n\n /** Read data */\n read(start?: number | bigint, length?: number): Promise<ArrayBuffer>;\n /** Read data */\n fetchRange?(offset: number | bigint, length: number, signal?: AbortSignal): Promise<Response>;\n /** Get information about file */\n stat?(): Promise<Stat>;\n /** Close the file */\n close(): Promise<void>;\n}\n\nexport interface WritableFile {\n handle: unknown;\n /** Write to file. The number of bytes written will be returned */\n write: (arrayBuffer: ArrayBuffer, offset?: number | bigint, length?: number) => Promise<number>;\n /** Get information about the file */\n stat?(): Promise<Stat>;\n /** Close the file */\n close(): Promise<void>;\n}\n"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"http-file.js","names":["HttpFile","constructor","url","handle","size","bigsize","close","stat","response","fetch","method","ok","Error","parseInt","headers","get","BigInt","isDirectory","read","offset","length","fetchRange","arrayBuffer","signal","nOffset","Number","nLength","controller","AbortController","Range","status","contentLength","abort","contentRange","startsWith","actualLength","substr"],"sources":["../../../src/lib/files/http-file.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ReadableFile, Stat} from './file';\n\nexport class HttpFile implements ReadableFile {\n readonly handle: string;\n readonly size: number = 0;\n readonly bigsize: bigint = 0n;\n readonly url: string;\n\n constructor(url: string) {\n this.handle = url;\n this.url = url;\n }\n\n async close(): Promise<void> {}\n\n async stat(): Promise<Stat> {\n const response = await fetch(this.handle, {method: 'HEAD'});\n if (!response.ok) {\n throw new Error(`Failed to fetch HEAD ${this.handle}`);\n }\n const size = parseInt(response.headers.get('Content-Length') || '0');\n return {\n size,\n bigsize: BigInt(size),\n isDirectory: false\n };\n }\n\n async read(offset: number | bigint, length: number): Promise<ArrayBuffer> {\n const response = await this.fetchRange(offset, length);\n const arrayBuffer = await response.arrayBuffer();\n return arrayBuffer;\n }\n\n /**\n *\n * @param offset\n * @param length\n * @param signal\n * @returns\n * @see https://github.com/protomaps/PMTiles\n */\n // eslint-disable-next-line complexity\n async fetchRange(\n offset: number | bigint,\n length: number,\n signal?: AbortSignal\n ): Promise<Response> {\n const nOffset = Number(offset);\n const nLength = Number(length);\n\n let controller: AbortController | undefined;\n if (!signal) {\n // ToDO why is it so important to abort in case 200?\n // TODO check this works or assert 206\n controller = new AbortController();\n signal = controller.signal;\n }\n\n const url = this.handle;\n let response = await fetch(url, {\n signal,\n headers: {Range: `bytes=${nOffset}-${nOffset + nLength - 1}`}\n });\n\n switch (response.status) {\n case 206: // Partial Content success\n // This is the expected success code for a range request\n break;\n\n case 200:\n // some well-behaved backends, e.g. DigitalOcean CDN, respond with 200 instead of 206\n // but we also need to detect no support for Byte Serving which is returning the whole file\n const contentLength = response.headers.get('Content-Length');\n if (!contentLength || Number(contentLength) > length) {\n if (controller) {\n controller.abort();\n }\n throw Error(\n 'content-length header missing or exceeding request. Server must support HTTP Byte Serving.'\n );\n }\n\n // @eslint-disable-next-line no-fallthrough\n case 416: // \"Range Not Satisfiable\"\n // some HTTP servers don't accept ranges beyond the end of the resource.\n // Retry with the exact length\n // TODO: can return 416 with offset > 0 if content changed, which will have a blank etag.\n // See https://github.com/protomaps/PMTiles/issues/90\n if (offset === 0) {\n const contentRange = response.headers.get('Content-Range');\n if (!contentRange || !contentRange.startsWith('bytes *')) {\n throw Error('Missing content-length on 416 response');\n }\n const actualLength = Number(contentRange.substr(8));\n response = await fetch(this.url, {\n signal,\n headers: {Range: `bytes=0-${actualLength - 1}`}\n });\n }\n break;\n\n default:\n if (response.status >= 300) {\n throw Error(`Bad response code: ${response.status}`);\n }\n }\n\n return response;\n // const data = await response.arrayBuffer();\n // return {\n // data,\n // etag: response.headers.get('ETag') || undefined,\n // cacheControl: response.headers.get('Cache-Control') || undefined,\n // expires: response.headers.get('Expires') || undefined\n // };\n }\n}\n"],"mappings":"AAMA,OAAO,MAAMA,QAAQ,CAAyB;EAM5CC,WAAWA,CAACC,GAAW,EAAE;IAAA,KALhBC,MAAM;IAAA,KACNC,IAAI,GAAW,CAAC;IAAA,KAChBC,OAAO,GAAW,EAAE;IAAA,KACpBH,GAAG;IAGV,IAAI,CAACC,MAAM,GAAGD,GAAG;IACjB,IAAI,CAACA,GAAG,GAAGA,GAAG;EAChB;EAEA,MAAMI,KAAKA,CAAA,EAAkB,CAAC;EAE9B,MAAMC,IAAIA,CAAA,EAAkB;IAC1B,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAAC,IAAI,CAACN,MAAM,EAAE;MAACO,MAAM,EAAE;IAAM,CAAC,CAAC;IAC3D,IAAI,CAACF,QAAQ,CAACG,EAAE,EAAE;MAChB,MAAM,IAAIC,KAAK,CAAE,wBAAuB,IAAI,CAACT,MAAO,EAAC,CAAC;IACxD;IACA,MAAMC,IAAI,GAAGS,QAAQ,CAACL,QAAQ,CAACM,OAAO,CAACC,GAAG,CAAC,gBAAgB,CAAC,IAAI,GAAG,CAAC;IACpE,OAAO;MACLX,IAAI;MACJC,OAAO,EAAEW,MAAM,CAACZ,IAAI,CAAC;MACrBa,WAAW,EAAE;IACf,CAA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,CAAC,eAAe,CAAC;UAC1D,IAAI,CAACkB,YAAY,IAAI,CAACA,YAAY,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;YACxD,MAAMtB,KAAK,CAAC,wCAAwC,CAAC;UACvD;UACA,MAAMuB,YAAY,GAAGV,MAAM,CAACQ,YAAY,CAACG,MAAM,CAAC,CAAC,CAAC,CAAC;UACnD5B,QAAQ,GAAG,MAAMC,KAAK,CAAC,IAAI,CAACP,GAAG,EAAE;YAC/BqB,MAAM;YACNT,OAAO,EAAE;cAACe,KAAK,EAAG,WAAUM,YAAY,GAAG,CAAE;YAAC;UAChD,CAAC,CAAC;QACJ;QACA;MAEF;QACE,IAAI3B,QAAQ,CAACsB,MAAM,IAAI,GAAG,EAAE;UAC1B,MAAMlB,KAAK,CAAE,sBAAqBJ,QAAQ,CAACsB,MAAO,EAAC,CAAC;QACtD;IACJ;IAEA,OAAOtB,QAAQ;EAQjB;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"node-file-facade.js","names":["isBrowser","NOT_IMPLEMENTED","Error","NodeFileFacade","constructor","url","flags","mode","_globalThis$loaders","handle","size","bigsize","globalThis","loaders","NodeFile","read","start","end","write","arrayBuffer","offset","length","stat","truncate","append","data","close"],"sources":["../../../src/lib/files/node-file-facade.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {isBrowser} from '../env-utils/globals';\nimport {ReadableFile, WritableFile, Stat} from './file';\n\nconst NOT_IMPLEMENTED = new Error('Not implemented');\n\n/** This class is a facade that gets replaced with an actual NodeFile instance */\nexport class NodeFileFacade implements ReadableFile, WritableFile {\n handle: unknown;\n size: number = 0;\n bigsize: bigint = 0n;\n url: string = '';\n\n constructor(url: string, flags?: 'r' | 'w' | 'wx' | 'a+', mode?: number) {\n // Return the actual implementation instance\n if (globalThis.loaders?.NodeFile) {\n return new globalThis.loaders.NodeFile(url, flags, mode);\n }\n if (isBrowser) {\n throw new Error('Can\\'t instantiate NodeFile in browser.');\n }\n throw new Error('Can\\'t instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.');\n }\n /** Read data */\n async read(start?: number | bigint, end?: number | bigint): Promise<ArrayBuffer> {\n throw NOT_IMPLEMENTED;\n }\n /** Write to file. The number of bytes written will be returned */\n async write(arrayBuffer: ArrayBuffer, offset?: number | bigint, length?: number | bigint): Promise<number> {\n throw NOT_IMPLEMENTED;\n }\n /** Get information about file */\n async stat(): Promise<Stat> {\n throw NOT_IMPLEMENTED;\n }\n\n /** Truncates the file descriptor. Only available on NodeFile. */\n async truncate(length: number): Promise<void> {\n throw NOT_IMPLEMENTED;\n }\n\n /** Append data to a file. Only available on NodeFile. */\n async append(data: Uint8Array): Promise<void> {\n throw NOT_IMPLEMENTED;\n }\n /** Close the file */\n async close(): Promise<void> {}\n}\n"],"mappings":"SAIQA,SAAS;AAGjB,MAAMC,eAAe,GAAG,IAAIC,KAAK,CAAC,iBAAiB,CAAC;AAGpD,OAAO,MAAMC,cAAc,CAAuC;EAMhEC,WAAWA,CAACC,GAAW,EAAEC,KAA+B,EAAEC,IAAa,EAAE;IAAA,IAAAC,mBAAA;IAAA,KALzEC,MAAM;IAAA,KACNC,IAAI,GAAW,CAAC;IAAA,KAChBC,OAAO,GAAW,EAAE;IAAA,KACpBN,GAAG,GAAW,EAAE;IAId,KAAAG,mBAAA,GAAII,UAAU,CAACC,OAAO,cAAAL,mBAAA,eAAlBA,mBAAA,CAAoBM,QAAQ,EAAE;MAChC,OAAO,IAAIF,UAAU,CAACC,OAAO,CAACC,QAAQ,CAACT,GAAG,EAAEC,KAAK,EAAEC,IAAI,CAAC;IAC1D;IACA,IAAIP,SAAS,EAAE;MACb,MAAM,IAAIE,KAAK,CAAC,yCAAyC,CAAC;IAC5D;IACA,MAAM,IAAIA,KAAK,CAAC,+EAA+E,CAAC;EAClG;EAEA,MAAMa,IAAIA,CAACC,KAAuB,EAAEC,GAAqB,EAAwB;IAC/E,MAAMhB,eAAe;EACvB;EAEA,MAAMiB,KAAKA,CAACC,WAAwB,EAAEC,MAAwB,EAAEC,MAAwB,EAAmB;IACzG,MAAMpB,eAAe;EACvB;EAEA,MAAMqB,IAAIA,CAAA,EAAkB;IAC1B,MAAMrB,eAAe;EACvB;EAGA,MAAMsB,QAAQA,CAACF,MAAc,EAAiB;IAC5C,MAAMpB,eAAe;EACvB;EAGA,MAAMuB,MAAMA,CAACC,IAAgB,EAAiB;IAC5C,MAAMxB,eAAe;EACvB;EAEA,MAAMyB,KAAKA,CAAA,EAAkB,CAAC;AAChC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sources.js","names":[],"sources":["../../../src/lib/files/sources.ts"],"sourcesContent":["/*\nimport {fetchFile} from '@loaders.gl/core';\n\nimport {Source as PMTilesSource, RangeResponse} from 'pmtiles';\n\n/** @note \"source\" here is a PMTiles library type, referring to *\nexport function makeSource(data: string | Blob, fetch?) {\n if (typeof data === 'string') {\n return new FetchSource(data, fetch);\n }\n if (data instanceof Blob) {\n const url = '';\n return new BlobSource(data, url);\n }\n}\n\nexport class BlobSource implements PMTilesSource {\n blob: Blob;\n key: string;\n\n constructor(blob: Blob, key: string) {\n this.blob = blob;\n this.key = key;\n }\n\n // TODO - how is this used?\n getKey() {\n return this.blob.url || '';\n }\n\n async getBytes(offset: number, length: number, signal?: AbortSignal): Promise<RangeResponse> {\n const data = await this.blob.arrayBuffer();\n return {\n data\n // etag: response.headers.get('ETag') || undefined,\n // cacheControl: response.headers.get('Cache-Control') || undefined,\n // expires: response.headers.get('Expires') || undefined\n };\n }\n}\n\nexport class FetchSource implements PMTilesSource {\n url: string;\n fetch;\n\n constructor(url: string, fetch = fetchFile) {\n this.url = url;\n this.fetch = fetch;\n }\n\n // TODO - how is this used?\n getKey() {\n return this.url;\n }\n\n async getBytes(offset: number, length: number, signal?: AbortSignal): Promise<RangeResponse> {\n let controller;\n if (!signal) {\n // ToDO why is it so important to abort in case 200?\n // TODO check this works or assert 206\n controller = new AbortController();\n signal = controller.signal;\n }\n\n let response = await fetch(this.url, {\n signal,\n headers: {Range: `bytes=${offset}-${offset + length - 1}`}\n });\n\n switch (response.status) {\n case 206: // Partial Content success\n // This is the expected success code for a range request\n break;\n\n case 200:\n // some well-behaved backends, e.g. DigitalOcean CDN, respond with 200 instead of 206\n // but we also need to detect no support for Byte Serving which is returning the whole file\n const content_length = response.headers.get('Content-Length');\n if (!content_length || Number(content_length) > length) {\n if (controller) {\n controller.abort();\n }\n throw Error(\n 'content-length header missing or exceeding request. Server must support HTTP Byte Serving.'\n );\n }\n\n case 416: // \"Range Not Satisfiable\"\n // some HTTP servers don't accept ranges beyond the end of the resource.\n // Retry with the exact length\n // TODO: can return 416 with offset > 0 if content changed, which will have a blank etag.\n // See https://github.com/protomaps/PMTiles/issues/90\n if (offset === 0) {\n const content_range = response.headers.get('Content-Range');\n if (!content_range || !content_range.startsWith('bytes *')) {\n throw Error('Missing content-length on 416 response');\n }\n const actual_length = Number(content_range.substr(8));\n response = await fetch(this.url, {\n signal,\n headers: {Range: `bytes=0-${actual_length - 1}`}\n });\n }\n break;\n\n default:\n if (response.status >= 300) {\n throw Error(`Bad response code: ${response.status}`);\n }\n }\n\n const data = await response.arrayBuffer();\n return {\n data,\n etag: response.headers.get('ETag') || undefined,\n cacheControl: response.headers.get('Cache-Control') || undefined,\n expires: response.headers.get('Expires') || undefined\n };\n }\n}\n\n/*\nclass TestNodeFileSource implements Source {\n buffer: ArrayBuffer;\n path: string;\n key: string;\n etag?: string;\n\n constructor(path: string, key: string) {\n this.path = path;\n this.buffer = fs.readFileSync(path);\n this.key = key;\n }\n\n getKey() {\n return this.key;\n }\n\n replaceData(path: string) {\n this.path = path;\n this.buffer = fs.readFileSync(path);\n }\n\n async getBytes(offset: number, length: number): Promise<RangeResponse> {\n const slice = new Uint8Array(this.buffer.slice(offset, offset + length))\n .buffer;\n return { data: slice, etag: this.etag };\n }\n}\n*/\n"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"filesystem.js","names":[],"sources":["../../../src/lib/filesystems/filesystem.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ReadableFile, WritableFile} from '../files/file';\n\n/**\n * A FileSystem interface can encapsulate various file sources,\n * a FileList, a Node.js filesystem, a ZipFile, a GoogleDrive etc.\n */\nexport interface FileSystem {\n /** Return a list of file names in a \"directory\" */\n readdir(dirname?: string, options?: {recursive?: boolean}): Promise<string[]>;\n\n /** Gets information from a local file from the filesystem */\n stat(filename: string, options?: object): Promise<{size: number}>;\n\n /** Removes a file from the file system */\n unlink?(path: string): Promise<void>;\n\n /** Fetches the full contents of a file from the filesystem (or a URL) */\n fetch(path: string, options?: RequestInit): Promise<Response>;\n}\n\n/**\n * A random access file system, open readable and/or writable files\n */\nexport interface RandomAccessFileSystem extends FileSystem {\n /** Can open readable files */\n readonly readable: boolean;\n\n /** Can open writable files */\n readonly writable: boolean;\n\n /** Open a readable file */\n openReadableFile(path: string, flags?: 'r'): Promise<ReadableFile>;\n\n /** Open a writable file */\n openWritableFile(path: string, flags?: 'w' | 'wx', mode?: number): Promise<WritableFile>;\n}\n"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"node-filesystem-facade.js","names":["isBrowser","NOT_IMPLEMENTED","Error","NodeFileSystemFacade","constructor","options","_globalThis$loaders","readable","writable","globalThis","loaders","NodeFileSystem","openReadableFile","path","flags","openWritableFile","mode","readdir","dirname","arguments","length","undefined","stat","unlink","fetch"],"sources":["../../../src/lib/filesystems/node-filesystem-facade.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {isBrowser} from '../env-utils/globals';\nimport {Stat} from '../files/file';\nimport {NodeFileFacade as NodeFile} from '../files/node-file-facade';\nimport {RandomAccessFileSystem} from './filesystem';\n\nconst NOT_IMPLEMENTED = new Error('Not implemented');\n\n/**\n * FileSystem pass-through for Node.js\n * Compatible with BrowserFileSystem.\n * @note Dummy implementation, not used (constructor returns a real NodeFileSystem instance)\n * @param options\n */\nexport class NodeFileSystemFacade implements RandomAccessFileSystem {\n // implements FileSystem\n constructor(options: {[key: string]: any}) {\n if (globalThis.loaders?.NodeFileSystem) {\n return new globalThis.loaders.NodeFileSystem(options);\n }\n if (isBrowser) {\n throw new Error('Can\\'t instantiate NodeFileSystem in browser.');\n }\n throw new Error(\n 'Can\\'t instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first.'\n );\n }\n\n // DUMMY IMPLEMENTATION, not used (constructor returns a real NodeFileSystem instance)\n\n // implements RandomAccessReadFileSystem\n\n readonly readable = true;\n readonly writable = true;\n\n async openReadableFile(path: string, flags): Promise<NodeFile> {\n throw NOT_IMPLEMENTED;\n }\n\n // implements RandomAccessWriteFileSystem\n async openWritableFile(path: string, flags, mode): Promise<NodeFile> {\n throw NOT_IMPLEMENTED;\n }\n\n // Implements file system\n\n async readdir(dirname = '.', options?: {}): Promise<string[]> {\n throw NOT_IMPLEMENTED;\n }\n\n async stat(path: string, options?: {}): Promise<Stat> {\n throw NOT_IMPLEMENTED;\n }\n\n async unlink(path: string): Promise<void> {\n throw NOT_IMPLEMENTED;\n }\n\n async fetch(path: RequestInfo, options?: RequestInit): Promise<Response> {\n throw NOT_IMPLEMENTED;\n }\n}\n"],"mappings":"SAIQA,SAAS;AAKjB,MAAMC,eAAe,GAAG,IAAIC,KAAK,CAAC,iBAAiB,CAAC;AAQpD,OAAO,MAAMC,oBAAoB,CAAmC;EAElEC,WAAWA,CAACC,OAA6B,EAAE;IAAA,IAAAC,mBAAA;IAAA,KAgBlCC,QAAQ,GAAG,IAAI;IAAA,KACfC,QAAQ,GAAG,IAAI;IAhBtB,KAAAF,mBAAA,GAAIG,UAAU,CAACC,OAAO,cAAAJ,mBAAA,eAAlBA,mBAAA,CAAoBK,cAAc,EAAE;MACtC,OAAO,IAAIF,UAAU,CAACC,OAAO,CAACC,cAAc,CAACN,OAAO,CAAC;IACvD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