@loaders.gl/core 5.0.0-beta.1 → 5.0.0-beta.11

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 (910) hide show
  1. package/GEOARROW-README.md +1 -1
  2. package/README.md +4 -2
  3. package/SCAN-README.md +3 -3
  4. package/SCHEMA-UTILS-README.md +1 -1
  5. package/dist/arrow-geometry/binary-geometry-to-wkb.cjs +2 -2
  6. package/dist/arrow-geometry/binary-geometry-to-wkb.cjs.map +2 -2
  7. package/dist/arrow-geometry/binary-geometry-to-wkb.js +1 -1
  8. package/dist/arrow-geometry/binary-geometry-to-wkb.js.map +1 -1
  9. package/dist/arrow-geometry/feature-collection-to-arrow.cjs.map +2 -2
  10. package/dist/arrow-geometry/feature-collection-to-arrow.d.ts +4 -3
  11. package/dist/arrow-geometry/feature-collection-to-arrow.d.ts.map +1 -1
  12. package/dist/arrow-geometry/feature-collection-to-arrow.js +1 -1
  13. package/dist/arrow-geometry/feature-collection-to-arrow.js.map +1 -1
  14. package/dist/arrow-geometry/feature-table.cjs +2 -6
  15. package/dist/arrow-geometry/feature-table.cjs.map +2 -2
  16. package/dist/arrow-geometry/feature-table.d.ts +6 -5
  17. package/dist/arrow-geometry/feature-table.d.ts.map +1 -1
  18. package/dist/arrow-geometry/feature-table.js +5 -9
  19. package/dist/arrow-geometry/feature-table.js.map +1 -1
  20. package/dist/arrow-geometry/geojson-table.cjs +295 -18
  21. package/dist/arrow-geometry/geojson-table.cjs.map +3 -3
  22. package/dist/arrow-geometry/geojson-table.d.ts +10 -3
  23. package/dist/arrow-geometry/geojson-table.d.ts.map +1 -1
  24. package/dist/arrow-geometry/geojson-table.js +23 -13
  25. package/dist/arrow-geometry/geojson-table.js.map +1 -1
  26. package/dist/arrow-geometry/geometry-codecs.cjs +6 -6
  27. package/dist/arrow-geometry/geometry-codecs.cjs.map +2 -2
  28. package/dist/arrow-geometry/geometry-codecs.js +1 -1
  29. package/dist/arrow-geometry/geometry-codecs.js.map +1 -1
  30. package/dist/arrow-geometry/geometry-to-wkt.cjs +2 -2
  31. package/dist/arrow-geometry/geometry-to-wkt.cjs.map +2 -2
  32. package/dist/arrow-geometry/geometry-to-wkt.js +1 -1
  33. package/dist/arrow-geometry/geometry-to-wkt.js.map +1 -1
  34. package/dist/arrow-geometry/index.cjs +0 -11
  35. package/dist/arrow-geometry/index.cjs.map +2 -2
  36. package/dist/arrow-geometry/index.d.ts +0 -1
  37. package/dist/arrow-geometry/index.d.ts.map +1 -1
  38. package/dist/arrow-geometry/index.js +0 -1
  39. package/dist/arrow-geometry/index.js.map +1 -1
  40. package/dist/arrow-geometry/wkb-arrow-utils.cjs +1 -5
  41. package/dist/arrow-geometry/wkb-arrow-utils.cjs.map +2 -2
  42. package/dist/arrow-geometry/wkb-arrow-utils.d.ts +7 -7
  43. package/dist/arrow-geometry/wkb-arrow-utils.d.ts.map +1 -1
  44. package/dist/arrow-geometry/wkb-arrow-utils.js +4 -8
  45. package/dist/arrow-geometry/wkb-arrow-utils.js.map +1 -1
  46. package/dist/arrow-geometry/wkb-builder.cjs +3 -3
  47. package/dist/arrow-geometry/wkb-builder.cjs.map +2 -2
  48. package/dist/arrow-geometry/wkb-builder.d.ts +1 -1
  49. package/dist/arrow-geometry/wkb-builder.d.ts.map +1 -1
  50. package/dist/arrow-geometry/wkb-builder.js +1 -1
  51. package/dist/arrow-geometry/wkb-builder.js.map +1 -1
  52. package/dist/arrow-geometry/wkb-statistics.cjs +2 -2
  53. package/dist/arrow-geometry/wkb-statistics.cjs.map +2 -2
  54. package/dist/arrow-geometry/wkb-statistics.js +1 -1
  55. package/dist/arrow-geometry/wkb-statistics.js.map +1 -1
  56. package/dist/arrow-worker-transport.cjs +105 -0
  57. package/dist/arrow-worker-transport.cjs.map +6 -0
  58. package/dist/arrow-worker-transport.d.ts +11 -0
  59. package/dist/arrow-worker-transport.d.ts.map +1 -0
  60. package/dist/arrow-worker-transport.js +77 -0
  61. package/dist/arrow-worker-transport.js.map +1 -0
  62. package/dist/cluster-source.cjs +6874 -0
  63. package/dist/cluster-source.cjs.map +6 -0
  64. package/dist/cluster-source.d.ts +2 -0
  65. package/dist/cluster-source.d.ts.map +1 -0
  66. package/dist/cluster-source.js +2 -0
  67. package/dist/cluster-source.js.map +1 -0
  68. package/dist/dist.dev.js +3040 -817
  69. package/dist/dist.min.js +3 -3
  70. package/dist/federated-table-scan-source.cjs +2409 -0
  71. package/dist/federated-table-scan-source.cjs.map +6 -0
  72. package/dist/federated-table-scan-source.d.ts +2 -0
  73. package/dist/federated-table-scan-source.d.ts.map +1 -0
  74. package/dist/federated-table-scan-source.js +2 -0
  75. package/dist/federated-table-scan-source.js.map +1 -0
  76. package/dist/geoarrow/binary-polygon-to-geoarrow.cjs +2 -2
  77. package/dist/geoarrow/binary-polygon-to-geoarrow.cjs.map +2 -2
  78. package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts +1 -1
  79. package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts.map +1 -1
  80. package/dist/geoarrow/binary-polygon-to-geoarrow.js +1 -1
  81. package/dist/geoarrow/binary-polygon-to-geoarrow.js.map +1 -1
  82. package/dist/geoarrow/clustering/cluster-source.cjs +16 -19
  83. package/dist/geoarrow/clustering/cluster-source.cjs.map +2 -2
  84. package/dist/geoarrow/clustering/cluster-source.d.ts +3 -2
  85. package/dist/geoarrow/clustering/cluster-source.d.ts.map +1 -1
  86. package/dist/geoarrow/clustering/cluster-source.js +13 -18
  87. package/dist/geoarrow/clustering/cluster-source.js.map +1 -1
  88. package/dist/geoarrow/convert-table-to-geoarrow.cjs +5 -12
  89. package/dist/geoarrow/convert-table-to-geoarrow.cjs.map +2 -2
  90. package/dist/geoarrow/convert-table-to-geoarrow.d.ts +6 -6
  91. package/dist/geoarrow/convert-table-to-geoarrow.d.ts.map +1 -1
  92. package/dist/geoarrow/convert-table-to-geoarrow.js +8 -14
  93. package/dist/geoarrow/convert-table-to-geoarrow.js.map +1 -1
  94. package/dist/geoarrow/geoarrow-bounds.cjs +7 -7
  95. package/dist/geoarrow/geoarrow-bounds.cjs.map +2 -2
  96. package/dist/geoarrow/geoarrow-bounds.js +3 -3
  97. package/dist/geoarrow/geoarrow-bounds.js.map +1 -1
  98. package/dist/geoarrow/geoarrow-capabilities.cjs +2 -2
  99. package/dist/geoarrow/geoarrow-capabilities.cjs.map +2 -2
  100. package/dist/geoarrow/geoarrow-capabilities.js +1 -1
  101. package/dist/geoarrow/geoarrow-capabilities.js.map +1 -1
  102. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs +8 -8
  103. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs.map +2 -2
  104. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js +2 -2
  105. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js.map +1 -1
  106. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs +6 -4
  107. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs.map +2 -2
  108. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts +3 -3
  109. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts.map +1 -1
  110. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js +9 -4
  111. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js.map +1 -1
  112. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs +5 -4
  113. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs.map +2 -2
  114. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +3 -3
  115. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts.map +1 -1
  116. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js +5 -4
  117. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js.map +1 -1
  118. package/dist/geoarrow/geoarrow-inspection.cjs +2 -2
  119. package/dist/geoarrow/geoarrow-inspection.cjs.map +2 -2
  120. package/dist/geoarrow/geoarrow-inspection.js +1 -1
  121. package/dist/geoarrow/geoarrow-inspection.js.map +1 -1
  122. package/dist/geoarrow/geoarrow-stream.cjs +11 -12
  123. package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
  124. package/dist/geoarrow/geoarrow-stream.d.ts +2 -2
  125. package/dist/geoarrow/geoarrow-stream.d.ts.map +1 -1
  126. package/dist/geoarrow/geoarrow-stream.js +10 -13
  127. package/dist/geoarrow/geoarrow-stream.js.map +1 -1
  128. package/dist/geoarrow/get-geoarrow-vertex-count.cjs +2 -2
  129. package/dist/geoarrow/get-geoarrow-vertex-count.cjs.map +2 -2
  130. package/dist/geoarrow/get-geoarrow-vertex-count.js +1 -1
  131. package/dist/geoarrow/get-geoarrow-vertex-count.js.map +1 -1
  132. package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.cjs.map +1 -1
  133. package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.js +3 -3
  134. package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.js.map +1 -1
  135. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs +4 -8
  136. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs.map +2 -2
  137. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.d.ts.map +1 -1
  138. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js +4 -8
  139. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js.map +1 -1
  140. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs +4 -4
  141. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs.map +2 -2
  142. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js +1 -1
  143. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js.map +1 -1
  144. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs +3 -3
  145. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs.map +2 -2
  146. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js +1 -1
  147. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js.map +1 -1
  148. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs +3 -3
  149. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs.map +2 -2
  150. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js +1 -1
  151. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js.map +1 -1
  152. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs +0 -6
  153. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs.map +2 -2
  154. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts +5 -3
  155. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts.map +1 -1
  156. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js +0 -6
  157. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js.map +1 -1
  158. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs +3 -2
  159. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs.map +2 -2
  160. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.d.ts.map +1 -1
  161. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js +3 -2
  162. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js.map +1 -1
  163. package/dist/geoarrow/metadata/geoarrow-metadata.cjs +44 -2
  164. package/dist/geoarrow/metadata/geoarrow-metadata.cjs.map +4 -4
  165. package/dist/geoarrow/metadata/geoarrow-metadata.d.ts.map +1 -1
  166. package/dist/geoarrow/metadata/geoarrow-metadata.js +3 -4
  167. package/dist/geoarrow/metadata/geoarrow-metadata.js.map +1 -1
  168. package/dist/index.cjs +746 -1365
  169. package/dist/index.cjs.map +3 -3
  170. package/dist/index.d.ts +2 -4
  171. package/dist/index.d.ts.map +1 -1
  172. package/dist/index.js +2 -5
  173. package/dist/index.js.map +1 -1
  174. package/dist/lib/api/create-data-source.d.ts +20 -9
  175. package/dist/lib/api/create-data-source.d.ts.map +1 -1
  176. package/dist/lib/api/create-data-source.js +55 -45
  177. package/dist/lib/api/create-data-source.js.map +1 -1
  178. package/dist/lib/api/encode.d.ts +1 -1
  179. package/dist/lib/api/encode.d.ts.map +1 -1
  180. package/dist/lib/api/encode.js +11 -2
  181. package/dist/lib/api/encode.js.map +1 -1
  182. package/dist/lib/api/load-in-batches.d.ts +3 -2
  183. package/dist/lib/api/load-in-batches.d.ts.map +1 -1
  184. package/dist/lib/api/load-in-batches.js.map +1 -1
  185. package/dist/lib/api/load-loader.d.ts +3 -3
  186. package/dist/lib/api/load-loader.d.ts.map +1 -1
  187. package/dist/lib/api/load-loader.js +15 -19
  188. package/dist/lib/api/load-loader.js.map +1 -1
  189. package/dist/lib/api/load.d.ts +7 -3
  190. package/dist/lib/api/load.d.ts.map +1 -1
  191. package/dist/lib/api/load.js +15 -67
  192. package/dist/lib/api/load.js.map +1 -1
  193. package/dist/lib/api/loader-options.d.ts +6 -0
  194. package/dist/lib/api/loader-options.d.ts.map +1 -1
  195. package/dist/lib/api/loader-options.js +48 -0
  196. package/dist/lib/api/loader-options.js.map +1 -1
  197. package/dist/lib/api/parse-file.d.ts +5 -3
  198. package/dist/lib/api/parse-file.d.ts.map +1 -1
  199. package/dist/lib/api/parse-file.js +8 -6
  200. package/dist/lib/api/parse-file.js.map +1 -1
  201. package/dist/lib/api/parse-in-batches.d.ts +5 -3
  202. package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
  203. package/dist/lib/api/parse-in-batches.js +60 -9
  204. package/dist/lib/api/parse-in-batches.js.map +1 -1
  205. package/dist/lib/api/parse-sync.d.ts +5 -3
  206. package/dist/lib/api/parse-sync.d.ts.map +1 -1
  207. package/dist/lib/api/parse-sync.js +3 -4
  208. package/dist/lib/api/parse-sync.js.map +1 -1
  209. package/dist/lib/api/parse.d.ts +5 -3
  210. package/dist/lib/api/parse.d.ts.map +1 -1
  211. package/dist/lib/api/parse.js +22 -14
  212. package/dist/lib/api/parse.js.map +1 -1
  213. package/dist/lib/api/select-loader.d.ts +4 -2
  214. package/dist/lib/api/select-loader.d.ts.map +1 -1
  215. package/dist/lib/api/select-loader.js +47 -53
  216. package/dist/lib/api/select-loader.js.map +1 -1
  217. package/dist/lib/api/select-source.d.ts.map +1 -1
  218. package/dist/lib/api/select-source.js +1 -1
  219. package/dist/lib/api/select-source.js.map +1 -1
  220. package/dist/lib/init.js +1 -1
  221. package/dist/lib/init.js.map +1 -1
  222. package/dist/lib/loader-utils/get-fetch-function.js +2 -2
  223. package/dist/lib/loader-utils/get-fetch-function.js.map +1 -1
  224. package/dist/lib/loader-utils/loggers.d.ts +2 -37
  225. package/dist/lib/loader-utils/loggers.d.ts.map +1 -1
  226. package/dist/lib/loader-utils/loggers.js +2 -63
  227. package/dist/lib/loader-utils/loggers.js.map +1 -1
  228. package/dist/lib/loader-utils/native-arrow.d.ts +13 -0
  229. package/dist/lib/loader-utils/native-arrow.d.ts.map +1 -0
  230. package/dist/lib/loader-utils/native-arrow.js +66 -0
  231. package/dist/lib/loader-utils/native-arrow.js.map +1 -0
  232. package/dist/lib/loader-utils/option-defaults.d.ts +3 -2
  233. package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -1
  234. package/dist/lib/loader-utils/option-defaults.js +9 -10
  235. package/dist/lib/loader-utils/option-defaults.js.map +1 -1
  236. package/dist/lib/loader-utils/option-utils.d.ts +0 -6
  237. package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
  238. package/dist/lib/loader-utils/option-utils.js +31 -114
  239. package/dist/lib/loader-utils/option-utils.js.map +1 -1
  240. package/dist/loader-utils/format-types.d.ts +3 -0
  241. package/dist/loader-utils/format-types.d.ts.map +1 -1
  242. package/dist/loader-utils/index.cjs +854 -1295
  243. package/dist/loader-utils/index.cjs.map +3 -3
  244. package/dist/loader-utils/index.d.ts +17 -8
  245. package/dist/loader-utils/index.d.ts.map +1 -1
  246. package/dist/loader-utils/index.js +9 -5
  247. package/dist/loader-utils/index.js.map +1 -1
  248. package/dist/loader-utils/json-loader.js +1 -1
  249. package/dist/loader-utils/json-loader.js.map +1 -1
  250. package/dist/loader-utils/lib/files/http-file-transport.d.ts +4 -0
  251. package/dist/loader-utils/lib/files/http-file-transport.d.ts.map +1 -1
  252. package/dist/loader-utils/lib/files/http-file-transport.js +45 -1
  253. package/dist/loader-utils/lib/files/http-file-transport.js.map +1 -1
  254. package/dist/loader-utils/lib/files/http-file-types.d.ts +2 -0
  255. package/dist/loader-utils/lib/files/http-file-types.d.ts.map +1 -1
  256. package/dist/loader-utils/lib/files/read-range-response.d.ts +3 -0
  257. package/dist/loader-utils/lib/files/read-range-response.d.ts.map +1 -0
  258. package/dist/loader-utils/lib/files/read-range-response.js +62 -0
  259. package/dist/loader-utils/lib/files/read-range-response.js.map +1 -0
  260. package/dist/loader-utils/lib/log-utils/log.d.ts +23 -1
  261. package/dist/loader-utils/lib/log-utils/log.d.ts.map +1 -1
  262. package/dist/loader-utils/lib/log-utils/log.js +32 -1
  263. package/dist/loader-utils/lib/log-utils/log.js.map +1 -1
  264. package/dist/loader-utils/lib/pace-batch-iterator.d.ts +14 -0
  265. package/dist/loader-utils/lib/pace-batch-iterator.d.ts.map +1 -0
  266. package/dist/loader-utils/lib/pace-batch-iterator.js +51 -0
  267. package/dist/loader-utils/lib/pace-batch-iterator.js.map +1 -0
  268. package/dist/loader-utils/lib/request-utils/request-credentials.js +1 -1
  269. package/dist/loader-utils/lib/request-utils/request-credentials.js.map +1 -1
  270. package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts +43 -0
  271. package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts.map +1 -0
  272. package/dist/loader-utils/lib/scan-utils/logical-table-query.js +104 -0
  273. package/dist/loader-utils/lib/scan-utils/logical-table-query.js.map +1 -0
  274. package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.d.ts → query-options.d.ts} +5 -8
  275. package/dist/loader-utils/lib/scan-utils/query-options.d.ts.map +1 -0
  276. package/dist/{schema-utils/lib/table/batch-builder/table-batch-aggregator.js → loader-utils/lib/scan-utils/query-options.js} +1 -1
  277. package/dist/loader-utils/lib/scan-utils/query-options.js.map +1 -0
  278. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +58 -18
  279. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -1
  280. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +17 -6
  281. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -1
  282. package/dist/loader-utils/lib/scan-utils/table-query.d.ts +54 -3
  283. package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -1
  284. package/dist/loader-utils/lib/scan-utils/table-query.js +6 -0
  285. package/dist/loader-utils/lib/scan-utils/table-query.js.map +1 -1
  286. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +18 -12
  287. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -1
  288. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +58 -29
  289. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -1
  290. package/dist/loader-utils/lib/sources/data-source.d.ts +4 -0
  291. package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -1
  292. package/dist/loader-utils/lib/sources/data-source.js +53 -14
  293. package/dist/loader-utils/lib/sources/data-source.js.map +1 -1
  294. package/dist/loader-utils/lib/sources/image-source.d.ts +1 -1
  295. package/dist/loader-utils/lib/sources/table-source-collection.d.ts +31 -0
  296. package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -0
  297. package/dist/loader-utils/lib/{scan-utils/experimental-scan-options.js → sources/table-source-collection.js} +1 -1
  298. package/dist/loader-utils/lib/sources/table-source-collection.js.map +1 -0
  299. package/dist/loader-utils/lib/sources/utils/utils.js +1 -1
  300. package/dist/loader-utils/lib/sources/utils/utils.js.map +1 -1
  301. package/dist/loader-utils/lib/sources/vector-source.d.ts +4 -3
  302. package/dist/loader-utils/lib/sources/vector-source.d.ts.map +1 -1
  303. package/dist/loader-utils/lib/sources/vector-tile-source.d.ts +4 -3
  304. package/dist/loader-utils/lib/sources/vector-tile-source.d.ts.map +1 -1
  305. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.d.ts.map +1 -1
  306. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js +2 -5
  307. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js.map +1 -1
  308. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.d.ts.map +1 -1
  309. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js +40 -21
  310. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
  311. package/dist/loader-utils/loader-types.d.ts +118 -91
  312. package/dist/loader-utils/loader-types.d.ts.map +1 -1
  313. package/dist/loader-utils/loader-types.js.map +1 -1
  314. package/dist/loader-utils/source-types.d.ts +7 -5
  315. package/dist/loader-utils/source-types.d.ts.map +1 -1
  316. package/dist/loader-utils/source-types.js +9 -1
  317. package/dist/loader-utils/source-types.js.map +1 -1
  318. package/dist/null-loader.d.ts +0 -18
  319. package/dist/null-loader.d.ts.map +1 -1
  320. package/dist/null-loader.js +1 -19
  321. package/dist/null-loader.js.map +1 -1
  322. package/dist/null-worker-node.js +771 -82
  323. package/dist/null-worker.js +742 -81
  324. package/dist/polyfills/images/encode-image-node.d.ts +18 -15
  325. package/dist/polyfills/images/encode-image-node.d.ts.map +1 -1
  326. package/dist/polyfills/images/encode-image-node.js +19 -33
  327. package/dist/polyfills/images/encode-image-node.js.map +1 -1
  328. package/dist/polyfills/images/image-codecs-node.d.ts +2 -6
  329. package/dist/polyfills/images/image-codecs-node.d.ts.map +1 -1
  330. package/dist/polyfills/images/image-codecs-node.js +2 -24
  331. package/dist/polyfills/images/image-codecs-node.js.map +1 -1
  332. package/dist/polyfills/images/load-sharp.d.ts +3 -0
  333. package/dist/polyfills/images/load-sharp.d.ts.map +1 -0
  334. package/dist/polyfills/images/load-sharp.js +11 -0
  335. package/dist/polyfills/images/load-sharp.js.map +1 -0
  336. package/dist/polyfills/images/node-image-bitmap.d.ts +1 -1
  337. package/dist/polyfills/images/node-image-bitmap.js +1 -1
  338. package/dist/polyfills/images/node-image-formats.d.ts +1 -1
  339. package/dist/polyfills/images/node-image-formats.d.ts.map +1 -1
  340. package/dist/polyfills/images/node-image-formats.js +10 -4
  341. package/dist/polyfills/images/node-image-formats.js.map +1 -1
  342. package/dist/polyfills/images/parse-image-node.d.ts +10 -2
  343. package/dist/polyfills/images/parse-image-node.d.ts.map +1 -1
  344. package/dist/polyfills/images/parse-image-node.js +20 -32
  345. package/dist/polyfills/images/parse-image-node.js.map +1 -1
  346. package/dist/polyfills/index.cjs +76 -151
  347. package/dist/polyfills/index.d.ts.map +1 -1
  348. package/dist/polyfills/index.js +2 -2
  349. package/dist/polyfills/index.js.map +1 -1
  350. package/dist/scan/arrow-execution/expressions.cjs +134 -0
  351. package/dist/scan/arrow-execution/expressions.cjs.map +7 -0
  352. package/dist/scan/arrow-execution/expressions.d.ts +11 -0
  353. package/dist/scan/arrow-execution/expressions.d.ts.map +1 -0
  354. package/dist/scan/arrow-execution/expressions.js +86 -0
  355. package/dist/scan/arrow-execution/expressions.js.map +1 -0
  356. package/dist/scan/arrow-execution/filter-arrow-table.cjs +255 -0
  357. package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +7 -0
  358. package/dist/scan/arrow-execution/filter-arrow-table.d.ts +18 -0
  359. package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -0
  360. package/dist/scan/arrow-execution/filter-arrow-table.js +224 -0
  361. package/dist/scan/arrow-execution/filter-arrow-table.js.map +1 -0
  362. package/dist/scan/arrow-execution/project-arrow-table.cjs +70 -0
  363. package/dist/scan/arrow-execution/project-arrow-table.cjs.map +7 -0
  364. package/dist/scan/arrow-execution/project-arrow-table.d.ts +8 -0
  365. package/dist/scan/arrow-execution/project-arrow-table.d.ts.map +1 -0
  366. package/dist/scan/arrow-execution/project-arrow-table.js +39 -0
  367. package/dist/scan/arrow-execution/project-arrow-table.js.map +1 -0
  368. package/dist/scan/arrow-execution.cjs +34 -0
  369. package/dist/scan/arrow-execution.cjs.map +7 -0
  370. package/dist/scan/arrow-execution.d.ts +4 -0
  371. package/dist/scan/arrow-execution.d.ts.map +1 -0
  372. package/dist/scan/arrow-execution.js +6 -0
  373. package/dist/scan/arrow-execution.js.map +1 -0
  374. package/dist/scan/arrow-query-worker-entry.cjs +121 -0
  375. package/dist/scan/arrow-query-worker-entry.cjs.map +7 -0
  376. package/dist/scan/arrow-query-worker-entry.d.ts +2 -0
  377. package/dist/scan/arrow-query-worker-entry.d.ts.map +1 -0
  378. package/dist/scan/arrow-query-worker-entry.js +7 -0
  379. package/dist/scan/arrow-query-worker-entry.js.map +1 -0
  380. package/dist/scan/arrow-query-worker.cjs +197 -0
  381. package/dist/scan/arrow-query-worker.cjs.map +7 -0
  382. package/dist/scan/arrow-query-worker.d.ts +47 -0
  383. package/dist/scan/arrow-query-worker.d.ts.map +1 -0
  384. package/dist/scan/arrow-query-worker.js +101 -0
  385. package/dist/scan/arrow-query-worker.js.map +1 -0
  386. package/dist/scan/arrow-query.cjs.map +1 -1
  387. package/dist/scan/arrow-query.d.ts +1 -1
  388. package/dist/scan/arrow-query.d.ts.map +1 -1
  389. package/dist/scan/catalog-query-source.cjs +122 -0
  390. package/dist/scan/catalog-query-source.cjs.map +7 -0
  391. package/dist/scan/catalog-query-source.d.ts +6 -0
  392. package/dist/scan/catalog-query-source.d.ts.map +1 -0
  393. package/dist/scan/catalog-query-source.js +115 -0
  394. package/dist/scan/catalog-query-source.js.map +1 -0
  395. package/dist/scan/federated-table-scan-source.cjs +42 -43
  396. package/dist/scan/federated-table-scan-source.cjs.map +2 -2
  397. package/dist/scan/federated-table-scan-source.d.ts +6 -10
  398. package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
  399. package/dist/scan/federated-table-scan-source.js +39 -40
  400. package/dist/scan/federated-table-scan-source.js.map +1 -1
  401. package/dist/scan/index.cjs +213 -6
  402. package/dist/scan/index.cjs.map +4 -4
  403. package/dist/scan/index.d.ts +15 -4
  404. package/dist/scan/index.d.ts.map +1 -1
  405. package/dist/scan/index.js +8 -2
  406. package/dist/scan/index.js.map +1 -1
  407. package/dist/scan/parse-sql-predicate.cjs +3 -294
  408. package/dist/scan/parse-sql-predicate.cjs.map +3 -3
  409. package/dist/scan/parse-sql-predicate.d.ts +6 -9
  410. package/dist/scan/parse-sql-predicate.d.ts.map +1 -1
  411. package/dist/scan/parse-sql-predicate.js +5 -314
  412. package/dist/scan/parse-sql-predicate.js.map +1 -1
  413. package/dist/scan/query-arrow-table-in-batches.cjs +75 -0
  414. package/dist/scan/query-arrow-table-in-batches.cjs.map +7 -0
  415. package/dist/scan/query-arrow-table-in-batches.d.ts +8 -0
  416. package/dist/scan/query-arrow-table-in-batches.d.ts.map +1 -0
  417. package/dist/scan/query-arrow-table-in-batches.js +54 -0
  418. package/dist/scan/query-arrow-table-in-batches.js.map +1 -0
  419. package/dist/scan/query-arrow-table.cjs +65 -202
  420. package/dist/scan/query-arrow-table.cjs.map +3 -3
  421. package/dist/scan/query-arrow-table.d.ts +7 -40
  422. package/dist/scan/query-arrow-table.d.ts.map +1 -1
  423. package/dist/scan/query-arrow-table.js +51 -211
  424. package/dist/scan/query-arrow-table.js.map +1 -1
  425. package/dist/scan/query-open-source.cjs +52 -0
  426. package/dist/scan/query-open-source.cjs.map +7 -0
  427. package/dist/scan/query-open-source.d.ts +4 -0
  428. package/dist/scan/query-open-source.d.ts.map +1 -0
  429. package/dist/scan/query-open-source.js +26 -0
  430. package/dist/scan/query-open-source.js.map +1 -0
  431. package/dist/scan/query-progressive.cjs +190 -0
  432. package/dist/scan/query-progressive.cjs.map +7 -0
  433. package/dist/scan/query-progressive.d.ts +39 -0
  434. package/dist/scan/query-progressive.d.ts.map +1 -0
  435. package/dist/scan/query-progressive.js +173 -0
  436. package/dist/scan/query-progressive.js.map +1 -0
  437. package/dist/scan/query-pushdown.cjs +140 -0
  438. package/dist/scan/query-pushdown.cjs.map +7 -0
  439. package/dist/scan/query-pushdown.d.ts +14 -0
  440. package/dist/scan/query-pushdown.d.ts.map +1 -0
  441. package/dist/scan/query-pushdown.js +133 -0
  442. package/dist/scan/query-pushdown.js.map +1 -0
  443. package/dist/scan/query-scales.cjs +140 -0
  444. package/dist/scan/query-scales.cjs.map +7 -0
  445. package/dist/scan/query-scales.d.ts +35 -0
  446. package/dist/scan/query-scales.d.ts.map +1 -0
  447. package/dist/scan/query-scales.js +120 -0
  448. package/dist/scan/query-scales.js.map +1 -0
  449. package/dist/scan/query.cjs +385 -0
  450. package/dist/scan/query.cjs.map +7 -0
  451. package/dist/scan/query.d.ts +67 -0
  452. package/dist/scan/query.d.ts.map +1 -0
  453. package/dist/scan/query.js +402 -0
  454. package/dist/scan/query.js.map +1 -0
  455. package/dist/scan/resolve-query-source.cjs +59 -0
  456. package/dist/scan/resolve-query-source.cjs.map +7 -0
  457. package/dist/scan/resolve-query-source.d.ts +6 -0
  458. package/dist/scan/resolve-query-source.d.ts.map +1 -0
  459. package/dist/scan/resolve-query-source.js +37 -0
  460. package/dist/scan/resolve-query-source.js.map +1 -0
  461. package/dist/scan/rows-to-arrow.cjs +1 -28
  462. package/dist/scan/rows-to-arrow.cjs.map +2 -2
  463. package/dist/scan/rows-to-arrow.d.ts +3 -3
  464. package/dist/scan/rows-to-arrow.d.ts.map +1 -1
  465. package/dist/scan/rows-to-arrow.js +2 -32
  466. package/dist/scan/rows-to-arrow.js.map +1 -1
  467. package/dist/scan/scan-engine.cjs.map +2 -2
  468. package/dist/scan/scan-engine.d.ts +5 -5
  469. package/dist/scan/scan-engine.d.ts.map +1 -1
  470. package/dist/scan/scan-engine.js.map +1 -1
  471. package/dist/scan/sql-catalog.cjs +110 -0
  472. package/dist/scan/sql-catalog.cjs.map +7 -0
  473. package/dist/scan/sql-catalog.d.ts +47 -0
  474. package/dist/scan/sql-catalog.d.ts.map +1 -0
  475. package/dist/scan/sql-catalog.js +97 -0
  476. package/dist/scan/sql-catalog.js.map +1 -0
  477. package/dist/scan/table-query.cjs.map +2 -2
  478. package/dist/scan/table-query.d.ts +4 -1
  479. package/dist/scan/table-query.d.ts.map +1 -1
  480. package/dist/scan/table-query.js.map +1 -1
  481. package/dist/scan/vector-table-scan-source.cjs +24 -17
  482. package/dist/scan/vector-table-scan-source.cjs.map +4 -4
  483. package/dist/scan/vector-table-scan-source.d.ts +8 -8
  484. package/dist/scan/vector-table-scan-source.d.ts.map +1 -1
  485. package/dist/scan/vector-table-scan-source.js +19 -17
  486. package/dist/scan/vector-table-scan-source.js.map +1 -1
  487. package/dist/schema/categories/category-mesh.d.ts +3 -10
  488. package/dist/schema/categories/category-mesh.d.ts.map +1 -1
  489. package/dist/schema/categories/category-mesh.js.map +1 -1
  490. package/dist/schema/categories/category-table.d.ts +2 -19
  491. package/dist/schema/categories/category-table.d.ts.map +1 -1
  492. package/dist/schema/geometry/arrow-binary-features.d.ts +1 -1
  493. package/dist/schema/geometry/arrow-binary-features.d.ts.map +1 -1
  494. package/dist/schema/geometry/geoarrow.d.ts +3 -6
  495. package/dist/schema/geometry/geoarrow.d.ts.map +1 -1
  496. package/dist/schema/index.cjs +11 -7
  497. package/dist/schema/index.cjs.map +2 -2
  498. package/dist/schema/index.d.ts +4 -4
  499. package/dist/schema/index.d.ts.map +1 -1
  500. package/dist/schema/index.js +2 -2
  501. package/dist/schema/index.js.map +1 -1
  502. package/dist/schema/types/batch.d.ts +0 -4
  503. package/dist/schema/types/batch.d.ts.map +1 -1
  504. package/dist/schema-utils/index.cjs +404 -620
  505. package/dist/schema-utils/index.cjs.map +3 -3
  506. package/dist/schema-utils/index.d.ts +6 -6
  507. package/dist/schema-utils/index.d.ts.map +1 -1
  508. package/dist/schema-utils/index.js +6 -5
  509. package/dist/schema-utils/index.js.map +1 -1
  510. package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts +16 -0
  511. package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts.map +1 -0
  512. package/dist/schema-utils/lib/arrow/arrow-metadata.js +109 -0
  513. package/dist/schema-utils/lib/arrow/arrow-metadata.js.map +1 -0
  514. package/dist/schema-utils/lib/converters/convert.js +9 -2
  515. package/dist/schema-utils/lib/converters/convert.js.map +1 -1
  516. package/dist/schema-utils/lib/converters/types.d.ts +2 -0
  517. package/dist/schema-utils/lib/converters/types.d.ts.map +1 -1
  518. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts +8 -12
  519. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts.map +1 -1
  520. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js +8 -21
  521. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js.map +1 -1
  522. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts +5 -4
  523. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts.map +1 -1
  524. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js +18 -13
  525. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js.map +1 -1
  526. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts +14 -0
  527. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts.map +1 -0
  528. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js +39 -0
  529. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js.map +1 -0
  530. package/dist/schema-utils/lib/mesh/mesh-utils.d.ts +2 -14
  531. package/dist/schema-utils/lib/mesh/mesh-utils.d.ts.map +1 -1
  532. package/dist/schema-utils/lib/mesh/mesh-utils.js +1 -35
  533. package/dist/schema-utils/lib/mesh/mesh-utils.js.map +1 -1
  534. package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts.map +1 -1
  535. package/dist/schema-utils/lib/mesh/point-cloud-tiler.js +6 -5
  536. package/dist/schema-utils/lib/mesh/point-cloud-tiler.js.map +1 -1
  537. package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts +2 -1
  538. package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts.map +1 -1
  539. package/dist/schema-utils/lib/schema/deduce-table-schema.js +7 -3
  540. package/dist/schema-utils/lib/schema/deduce-table-schema.js.map +1 -1
  541. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts +6 -5
  542. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -1
  543. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js +6 -5
  544. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js.map +1 -1
  545. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts +9 -9
  546. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts.map +1 -1
  547. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js +13 -46
  548. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js.map +1 -1
  549. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts +9 -20
  550. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts.map +1 -1
  551. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js +61 -73
  552. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js.map +1 -1
  553. package/dist/schema-utils/lib/table/batches/convert-batches.d.ts +4 -3
  554. package/dist/schema-utils/lib/table/batches/convert-batches.d.ts.map +1 -1
  555. package/dist/schema-utils/lib/table/batches/convert-batches.js +27 -9
  556. package/dist/schema-utils/lib/table/batches/convert-batches.js.map +1 -1
  557. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts +6 -9
  558. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts.map +1 -1
  559. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js +22 -15
  560. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js.map +1 -1
  561. package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts +4 -1
  562. package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts.map +1 -1
  563. package/dist/schema-utils/lib/table/batches/make-table-from-batches.js +13 -9
  564. package/dist/schema-utils/lib/table/batches/make-table-from-batches.js.map +1 -1
  565. package/dist/schema-utils/lib/table/query-arrow-table.d.ts +3 -3
  566. package/dist/schema-utils/lib/table/query-arrow-table.d.ts.map +1 -1
  567. package/dist/schema-utils/lib/table/query-arrow-table.js +9 -23
  568. package/dist/schema-utils/lib/table/query-arrow-table.js.map +1 -1
  569. package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts +9 -10
  570. package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts.map +1 -1
  571. package/dist/schema-utils/lib/table/tables/convert-arrow-table.js +13 -75
  572. package/dist/schema-utils/lib/table/tables/convert-arrow-table.js.map +1 -1
  573. package/dist/schema-utils/lib/table/tables/convert-table.d.ts +6 -36
  574. package/dist/schema-utils/lib/table/tables/convert-table.d.ts.map +1 -1
  575. package/dist/schema-utils/lib/table/tables/convert-table.js +5 -42
  576. package/dist/schema-utils/lib/table/tables/convert-table.js.map +1 -1
  577. package/dist/schema-utils/lib/table/tables/make-table.d.ts +3 -55
  578. package/dist/schema-utils/lib/table/tables/make-table.d.ts.map +1 -1
  579. package/dist/schema-utils/lib/table/tables/make-table.js +3 -59
  580. package/dist/schema-utils/lib/table/tables/make-table.js.map +1 -1
  581. package/dist/schema-utils/lib/table/tables/row-utils.js +2 -2
  582. package/dist/schema-utils/lib/table/tables/row-utils.js.map +1 -1
  583. package/dist/schema-utils/lib/table/tables/table-accessors.d.ts +18 -16
  584. package/dist/schema-utils/lib/table/tables/table-accessors.d.ts.map +1 -1
  585. package/dist/schema-utils/lib/table/tables/table-accessors.js +36 -39
  586. package/dist/schema-utils/lib/table/tables/table-accessors.js.map +1 -1
  587. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts +6 -5
  588. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts.map +1 -1
  589. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js +2 -2
  590. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js.map +1 -1
  591. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts +1 -1
  592. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts.map +1 -1
  593. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js +8 -5
  594. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js.map +1 -1
  595. package/dist/schema-utils/lib/table/tables/table-types.d.ts +1 -3
  596. package/dist/schema-utils/lib/table/tables/table-types.d.ts.map +1 -1
  597. package/dist/schema-utils/lib/table/tables/table-types.js +0 -4
  598. package/dist/schema-utils/lib/table/tables/table-types.js.map +1 -1
  599. package/dist/vector-table-scan-source.cjs +1766 -0
  600. package/dist/vector-table-scan-source.cjs.map +6 -0
  601. package/dist/vector-table-scan-source.d.ts +2 -0
  602. package/dist/vector-table-scan-source.d.ts.map +1 -0
  603. package/dist/vector-table-scan-source.js +2 -0
  604. package/dist/vector-table-scan-source.js.map +1 -0
  605. package/dist/worker-utils/index.cjs +407 -1184
  606. package/dist/worker-utils/index.cjs.map +3 -3
  607. package/dist/worker-utils/index.d.ts +2 -8
  608. package/dist/worker-utils/index.d.ts.map +1 -1
  609. package/dist/worker-utils/index.js +1 -10
  610. package/dist/worker-utils/index.js.map +1 -1
  611. package/dist/worker-utils/lib/env-utils/version.js +1 -1
  612. package/dist/worker-utils/lib/env-utils/version.js.map +1 -1
  613. package/dist/worker-utils/lib/library-utils/library-utils.d.ts.map +1 -1
  614. package/dist/worker-utils/lib/library-utils/library-utils.js +3 -2
  615. package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -1
  616. package/dist/worker-utils/lib/process-utils/child-process-proxy.d.ts.map +1 -1
  617. package/dist/worker-utils/lib/process-utils/child-process-proxy.js +8 -7
  618. package/dist/worker-utils/lib/process-utils/child-process-proxy.js.map +1 -1
  619. package/dist/worker-utils/lib/worker-api/create-worker.d.ts +5 -7
  620. package/dist/worker-utils/lib/worker-api/create-worker.d.ts.map +1 -1
  621. package/dist/worker-utils/lib/worker-api/create-worker.js +76 -146
  622. package/dist/worker-utils/lib/worker-api/create-worker.js.map +1 -1
  623. package/dist/worker-utils/lib/worker-api/get-worker-url.d.ts.map +1 -1
  624. package/dist/worker-utils/lib/worker-api/get-worker-url.js +5 -2
  625. package/dist/worker-utils/lib/worker-api/get-worker-url.js.map +1 -1
  626. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +17 -45
  627. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts.map +1 -1
  628. package/dist/worker-utils/lib/worker-api/process-on-worker.js +214 -312
  629. package/dist/worker-utils/lib/worker-api/process-on-worker.js.map +1 -1
  630. package/dist/worker-utils/lib/worker-api/task-runtime.d.ts +36 -0
  631. package/dist/worker-utils/lib/worker-api/task-runtime.d.ts.map +1 -0
  632. package/dist/worker-utils/lib/worker-api/task-runtime.js +23 -0
  633. package/dist/worker-utils/lib/worker-api/task-runtime.js.map +1 -0
  634. package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js +1 -6
  635. package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js.map +1 -1
  636. package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts +1 -0
  637. package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts.map +1 -1
  638. package/dist/worker-utils/lib/worker-utils/get-transfer-list.js +3 -1
  639. package/dist/worker-utils/lib/worker-utils/get-transfer-list.js.map +1 -1
  640. package/dist/worker-utils/null-worker-node.js +836 -147
  641. package/dist/worker-utils/null-worker-node.js.map +4 -4
  642. package/dist/worker-utils/null-worker.js +804 -143
  643. package/dist/worker-utils/null-worker.js.map +4 -4
  644. package/dist/worker-utils/types.d.ts +55 -72
  645. package/dist/worker-utils/types.d.ts.map +1 -1
  646. package/package.json +141 -35
  647. package/src/arrow-geometry/binary-geometry-to-wkb.ts +1 -1
  648. package/src/arrow-geometry/feature-collection-to-arrow.ts +4 -3
  649. package/src/arrow-geometry/feature-table.ts +8 -17
  650. package/src/arrow-geometry/geojson-table.ts +32 -21
  651. package/src/arrow-geometry/geometry-codecs.ts +2 -2
  652. package/src/arrow-geometry/geometry-to-wkt.ts +2 -2
  653. package/src/arrow-geometry/index.ts +0 -9
  654. package/src/arrow-geometry/wkb-arrow-utils.ts +8 -12
  655. package/src/arrow-geometry/wkb-builder.ts +2 -2
  656. package/src/arrow-geometry/wkb-statistics.ts +2 -2
  657. package/src/arrow-worker-transport.ts +126 -0
  658. package/src/cluster-source.ts +1 -0
  659. package/src/federated-table-scan-source.ts +1 -0
  660. package/src/geoarrow/binary-polygon-to-geoarrow.ts +2 -2
  661. package/src/geoarrow/clustering/cluster-source.ts +20 -30
  662. package/src/geoarrow/convert-table-to-geoarrow.ts +14 -24
  663. package/src/geoarrow/geoarrow-bounds.ts +3 -3
  664. package/src/geoarrow/geoarrow-capabilities.ts +1 -1
  665. package/src/geoarrow/geoarrow-converter/convert-geoarrow-geometry.ts +3 -3
  666. package/src/geoarrow/geoarrow-converter/convert-geoarrow.ts +14 -9
  667. package/src/geoarrow/geoarrow-converter/geoarrow-converter.ts +7 -6
  668. package/src/geoarrow/geoarrow-inspection.ts +2 -2
  669. package/src/geoarrow/geoarrow-stream.ts +16 -16
  670. package/src/geoarrow/get-geoarrow-vertex-count.ts +1 -1
  671. package/src/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.ts +3 -3
  672. package/src/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.ts +4 -11
  673. package/src/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.ts +1 -1
  674. package/src/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts +2 -2
  675. package/src/geoarrow/lib/kernels/encode-geoarrow-box.ts +1 -1
  676. package/src/geoarrow/lib/table-converters/convert-geoarrow-table.ts +11 -11
  677. package/src/geoarrow/mesharrow/arrow-fixed-size-list-utils.ts +3 -2
  678. package/src/geoarrow/metadata/geoarrow-metadata.ts +3 -4
  679. package/src/index.ts +2 -6
  680. package/src/lib/api/create-data-source.ts +148 -58
  681. package/src/lib/api/encode.ts +14 -3
  682. package/src/lib/api/load-in-batches.ts +15 -7
  683. package/src/lib/api/load-loader.ts +22 -21
  684. package/src/lib/api/load.ts +51 -127
  685. package/src/lib/api/loader-options.ts +69 -0
  686. package/src/lib/api/parse-file.ts +32 -22
  687. package/src/lib/api/parse-in-batches.ts +121 -20
  688. package/src/lib/api/parse-sync.ts +30 -16
  689. package/src/lib/api/parse.ts +46 -29
  690. package/src/lib/api/select-loader.ts +54 -69
  691. package/src/lib/api/select-source.ts +7 -1
  692. package/src/lib/loader-utils/get-fetch-function.ts +2 -2
  693. package/src/lib/loader-utils/loggers.ts +2 -70
  694. package/src/lib/loader-utils/native-arrow.ts +83 -0
  695. package/src/lib/loader-utils/option-defaults.ts +9 -10
  696. package/src/lib/loader-utils/option-utils.ts +33 -122
  697. package/src/loader-utils/format-types.ts +4 -0
  698. package/src/loader-utils/index.ts +50 -10
  699. package/src/loader-utils/lib/files/http-file-transport.ts +65 -1
  700. package/src/loader-utils/lib/files/http-file-types.ts +2 -0
  701. package/src/loader-utils/lib/files/read-range-response.ts +66 -0
  702. package/src/loader-utils/lib/log-utils/log.ts +36 -1
  703. package/src/loader-utils/lib/pace-batch-iterator.ts +66 -0
  704. package/src/loader-utils/lib/request-utils/request-credentials.ts +1 -1
  705. package/src/loader-utils/lib/scan-utils/logical-table-query.ts +174 -0
  706. package/src/loader-utils/lib/scan-utils/query-options.ts +44 -0
  707. package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +81 -28
  708. package/src/loader-utils/lib/scan-utils/table-query.ts +76 -8
  709. package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +101 -53
  710. package/src/loader-utils/lib/sources/data-source.ts +57 -16
  711. package/src/loader-utils/lib/sources/image-source.ts +1 -1
  712. package/src/loader-utils/lib/sources/table-source-collection.ts +39 -0
  713. package/src/loader-utils/lib/sources/utils/utils.ts +1 -1
  714. package/src/loader-utils/lib/sources/vector-source.ts +3 -3
  715. package/src/loader-utils/lib/sources/vector-tile-source.ts +4 -9
  716. package/src/loader-utils/lib/worker-loader-utils/encode-with-worker.ts +5 -6
  717. package/src/loader-utils/lib/worker-loader-utils/parse-with-worker.ts +41 -24
  718. package/src/loader-utils/loader-types.ts +190 -111
  719. package/src/loader-utils/source-types.ts +17 -6
  720. package/src/null-loader.ts +1 -20
  721. package/src/polyfills/README.md +2 -2
  722. package/src/polyfills/images/encode-image-node.ts +44 -37
  723. package/src/polyfills/images/image-codecs-node.ts +2 -37
  724. package/src/polyfills/images/load-sharp.ts +13 -0
  725. package/src/polyfills/images/node-image-bitmap.ts +1 -1
  726. package/src/polyfills/images/node-image-formats.ts +10 -4
  727. package/src/polyfills/images/parse-image-node.ts +31 -40
  728. package/src/polyfills/index.ts +3 -3
  729. package/src/scan/arrow-execution/expressions.ts +116 -0
  730. package/src/scan/arrow-execution/filter-arrow-table.ts +298 -0
  731. package/src/scan/arrow-execution/project-arrow-table.ts +53 -0
  732. package/src/scan/arrow-execution.ts +7 -0
  733. package/src/scan/arrow-query-worker-entry.ts +8 -0
  734. package/src/scan/arrow-query-worker.ts +158 -0
  735. package/src/scan/arrow-query.ts +3 -0
  736. package/src/scan/catalog-query-source.ts +132 -0
  737. package/src/scan/federated-table-scan-source.ts +67 -78
  738. package/src/scan/index.ts +64 -6
  739. package/src/scan/parse-sql-predicate.ts +14 -367
  740. package/src/scan/query-arrow-table-in-batches.ts +55 -0
  741. package/src/scan/query-arrow-table.ts +81 -271
  742. package/src/scan/query-open-source.ts +39 -0
  743. package/src/scan/query-progressive.ts +229 -0
  744. package/src/scan/query-pushdown.ts +184 -0
  745. package/src/scan/query-scales.ts +199 -0
  746. package/src/scan/query.ts +594 -0
  747. package/src/scan/resolve-query-source.ts +47 -0
  748. package/src/scan/rows-to-arrow.ts +3 -39
  749. package/src/scan/scan-engine.ts +6 -6
  750. package/src/scan/sql-catalog.ts +167 -0
  751. package/src/scan/table-query.ts +6 -1
  752. package/src/scan/vector-table-scan-source.ts +25 -26
  753. package/src/schema/categories/category-mesh.ts +3 -11
  754. package/src/schema/categories/category-table.ts +2 -28
  755. package/src/schema/geometry/arrow-binary-features.ts +1 -1
  756. package/src/schema/geometry/geoarrow.ts +8 -19
  757. package/src/schema/index.ts +4 -5
  758. package/src/schema/types/batch.ts +0 -5
  759. package/src/schema-utils/index.ts +19 -10
  760. package/src/schema-utils/lib/arrow/arrow-metadata.ts +139 -0
  761. package/src/schema-utils/lib/converters/convert.ts +7 -2
  762. package/src/schema-utils/lib/converters/types.ts +2 -0
  763. package/src/schema-utils/lib/mesh/convert-mesh-to-table.ts +15 -43
  764. package/src/schema-utils/lib/mesh/convert-table-to-mesh.ts +19 -16
  765. package/src/schema-utils/lib/mesh/get-mesh-bounding-box.ts +52 -0
  766. package/src/schema-utils/lib/mesh/mesh-utils.ts +3 -49
  767. package/src/schema-utils/lib/mesh/point-cloud-tiler.ts +6 -5
  768. package/src/schema-utils/lib/schema/deduce-table-schema.ts +8 -4
  769. package/src/schema-utils/lib/table/arrow-api/arrow-like-table.ts +10 -9
  770. package/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts +21 -51
  771. package/src/schema-utils/lib/table/batch-builder/table-batch-builder.ts +68 -83
  772. package/src/schema-utils/lib/table/batches/convert-batches.ts +38 -21
  773. package/src/schema-utils/lib/table/batches/make-arrow-batch-iterator.ts +29 -19
  774. package/src/schema-utils/lib/table/batches/make-table-from-batches.ts +26 -7
  775. package/src/schema-utils/lib/table/query-arrow-table.ts +14 -32
  776. package/src/schema-utils/lib/table/tables/convert-arrow-table.ts +27 -95
  777. package/src/schema-utils/lib/table/tables/convert-table.ts +11 -57
  778. package/src/schema-utils/lib/table/tables/make-table.ts +6 -70
  779. package/src/schema-utils/lib/table/tables/row-utils.ts +2 -2
  780. package/src/schema-utils/lib/table/tables/table-accessors.ts +60 -63
  781. package/src/schema-utils/lib/table/tables/table-converter/convert-tables.ts +12 -14
  782. package/src/schema-utils/lib/table/tables/table-converter/table-converter.ts +12 -9
  783. package/src/schema-utils/lib/table/tables/table-types.ts +1 -7
  784. package/src/vector-table-scan-source.ts +1 -0
  785. package/src/worker-utils/index.ts +2 -18
  786. package/src/worker-utils/lib/library-utils/library-utils.ts +3 -2
  787. package/src/worker-utils/lib/process-utils/child-process-proxy.ts +8 -7
  788. package/src/worker-utils/lib/worker-api/create-worker.ts +89 -188
  789. package/src/worker-utils/lib/worker-api/get-worker-url.ts +4 -3
  790. package/src/worker-utils/lib/worker-api/process-on-worker.ts +246 -402
  791. package/src/worker-utils/lib/worker-api/task-runtime.ts +66 -0
  792. package/src/worker-utils/lib/worker-utils/get-loadable-worker-url.ts +1 -6
  793. package/src/worker-utils/lib/worker-utils/get-transfer-list.ts +2 -0
  794. package/src/worker-utils/types.ts +74 -109
  795. package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs +0 -477
  796. package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs.map +0 -7
  797. package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts +0 -29
  798. package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts.map +0 -1
  799. package/dist/arrow-geometry/arrow-geoarrow-adapter.js +0 -434
  800. package/dist/arrow-geometry/arrow-geoarrow-adapter.js.map +0 -1
  801. package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs +0 -39
  802. package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs.map +0 -7
  803. package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts +0 -2
  804. package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts.map +0 -1
  805. package/dist/geoarrow/lib/arrow-geoarrow-adapter.js +0 -5
  806. package/dist/geoarrow/lib/arrow-geoarrow-adapter.js.map +0 -1
  807. package/dist/loader-utils/lib/file-provider/data-view-file.d.ts +0 -40
  808. package/dist/loader-utils/lib/file-provider/data-view-file.d.ts.map +0 -1
  809. package/dist/loader-utils/lib/file-provider/data-view-file.js +0 -68
  810. package/dist/loader-utils/lib/file-provider/data-view-file.js.map +0 -1
  811. package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts +0 -54
  812. package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts.map +0 -1
  813. package/dist/loader-utils/lib/file-provider/file-handle-file.js +0 -102
  814. package/dist/loader-utils/lib/file-provider/file-handle-file.js.map +0 -1
  815. package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts +0 -45
  816. package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts.map +0 -1
  817. package/dist/loader-utils/lib/file-provider/file-provider-interface.js +0 -13
  818. package/dist/loader-utils/lib/file-provider/file-provider-interface.js.map +0 -1
  819. package/dist/loader-utils/lib/file-provider/file-provider.d.ts +0 -57
  820. package/dist/loader-utils/lib/file-provider/file-provider.d.ts.map +0 -1
  821. package/dist/loader-utils/lib/file-provider/file-provider.js +0 -114
  822. package/dist/loader-utils/lib/file-provider/file-provider.js.map +0 -1
  823. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts.map +0 -1
  824. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js.map +0 -1
  825. package/dist/schema/deprecated/mesh-utils.d.ts +0 -12
  826. package/dist/schema/deprecated/mesh-utils.d.ts.map +0 -1
  827. package/dist/schema/deprecated/mesh-utils.js +0 -37
  828. package/dist/schema/deprecated/mesh-utils.js.map +0 -1
  829. package/dist/schema-utils/arrow-transport.cjs +0 -691
  830. package/dist/schema-utils/arrow-transport.cjs.map +0 -6
  831. package/dist/schema-utils/arrow-transport.d.ts +0 -4
  832. package/dist/schema-utils/arrow-transport.d.ts.map +0 -1
  833. package/dist/schema-utils/arrow-transport.js +0 -7
  834. package/dist/schema-utils/arrow-transport.js.map +0 -1
  835. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts +0 -76
  836. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts.map +0 -1
  837. package/dist/schema-utils/lib/arrow/arrow-table-transport.js +0 -182
  838. package/dist/schema-utils/lib/arrow/arrow-table-transport.js.map +0 -1
  839. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts +0 -33
  840. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts.map +0 -1
  841. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js +0 -134
  842. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js.map +0 -1
  843. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts +0 -10
  844. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts.map +0 -1
  845. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js +0 -71
  846. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js.map +0 -1
  847. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts +0 -19
  848. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts.map +0 -1
  849. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js +0 -64
  850. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js.map +0 -1
  851. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts +0 -20
  852. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts.map +0 -1
  853. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js +0 -83
  854. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js.map +0 -1
  855. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts +0 -21
  856. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts.map +0 -1
  857. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js +0 -86
  858. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js.map +0 -1
  859. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts +0 -24
  860. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts.map +0 -1
  861. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.js.map +0 -1
  862. package/dist/worker-utils/lib/async-queue/async-queue.d.ts +0 -32
  863. package/dist/worker-utils/lib/async-queue/async-queue.d.ts.map +0 -1
  864. package/dist/worker-utils/lib/async-queue/async-queue.js +0 -91
  865. package/dist/worker-utils/lib/async-queue/async-queue.js.map +0 -1
  866. package/dist/worker-utils/lib/worker-farm/worker-body.d.ts +0 -20
  867. package/dist/worker-utils/lib/worker-farm/worker-body.d.ts.map +0 -1
  868. package/dist/worker-utils/lib/worker-farm/worker-body.js +0 -131
  869. package/dist/worker-utils/lib/worker-farm/worker-body.js.map +0 -1
  870. package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts +0 -58
  871. package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts.map +0 -1
  872. package/dist/worker-utils/lib/worker-farm/worker-farm.js +0 -116
  873. package/dist/worker-utils/lib/worker-farm/worker-farm.js.map +0 -1
  874. package/dist/worker-utils/lib/worker-farm/worker-job.d.ts +0 -34
  875. package/dist/worker-utils/lib/worker-farm/worker-job.d.ts.map +0 -1
  876. package/dist/worker-utils/lib/worker-farm/worker-job.js +0 -74
  877. package/dist/worker-utils/lib/worker-farm/worker-job.js.map +0 -1
  878. package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts +0 -94
  879. package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts.map +0 -1
  880. package/dist/worker-utils/lib/worker-farm/worker-pool.js +0 -246
  881. package/dist/worker-utils/lib/worker-farm/worker-pool.js.map +0 -1
  882. package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts +0 -67
  883. package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts.map +0 -1
  884. package/dist/worker-utils/lib/worker-farm/worker-thread.js +0 -175
  885. package/dist/worker-utils/lib/worker-farm/worker-thread.js.map +0 -1
  886. package/src/arrow-geometry/arrow-geoarrow-adapter.ts +0 -568
  887. package/src/geoarrow/lib/arrow-geoarrow-adapter.ts +0 -12
  888. package/src/loader-utils/lib/file-provider/data-view-file.ts +0 -83
  889. package/src/loader-utils/lib/file-provider/file-handle-file.ts +0 -114
  890. package/src/loader-utils/lib/file-provider/file-provider-interface.ts +0 -60
  891. package/src/loader-utils/lib/file-provider/file-provider.ts +0 -130
  892. package/src/loader-utils/lib/scan-utils/experimental-scan-options.ts +0 -46
  893. package/src/polyfills/images/encode-image.node.ts.disabled +0 -41
  894. package/src/polyfills/images/parse-image.node.ts.disabled +0 -55
  895. package/src/schema/deprecated/mesh-utils.ts +0 -46
  896. package/src/schema-utils/arrow-transport.ts +0 -7
  897. package/src/schema-utils/lib/arrow/arrow-table-transport.ts +0 -282
  898. package/src/schema-utils/lib/arrow/split-arrow-buffers.ts +0 -247
  899. package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator-builders.ts.disabled +0 -190
  900. package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.ts +0 -85
  901. package/src/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.ts +0 -82
  902. package/src/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.ts +0 -103
  903. package/src/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.ts +0 -108
  904. package/src/schema-utils/lib/table/batch-builder/table-batch-aggregator.ts +0 -28
  905. package/src/worker-utils/lib/async-queue/async-queue.ts +0 -100
  906. package/src/worker-utils/lib/worker-farm/worker-body.ts +0 -145
  907. package/src/worker-utils/lib/worker-farm/worker-farm.ts +0 -144
  908. package/src/worker-utils/lib/worker-farm/worker-job.ts +0 -85
  909. package/src/worker-utils/lib/worker-farm/worker-pool.ts +0 -316
  910. package/src/worker-utils/lib/worker-farm/worker-thread.ts +0 -206
package/dist/index.cjs CHANGED
@@ -23,16 +23,17 @@ __export(index_exports, {
23
23
  FetchError: () => FetchError,
24
24
  JSONLoader: () => JSONLoader,
25
25
  NullLoader: () => NullLoader,
26
- NullWorkerLoader: () => NullWorkerLoader,
27
26
  RequestScheduler: () => RequestScheduler,
28
27
  _BrowserFileSystem: () => BrowserFileSystem,
29
28
  _fetchProgress: () => fetchProgress,
30
29
  _selectSource: () => selectSource,
31
30
  _unregisterLoaders: () => _unregisterLoaders,
32
31
  assert: () => assert,
32
+ compareLoaderOptions: () => compareLoaderOptions,
33
33
  concatenateArrayBuffersAsync: () => concatenateArrayBuffersAsync,
34
34
  coreApi: () => coreApi,
35
35
  createDataSource: () => createDataSource,
36
+ createDataSourceSync: () => createDataSourceSync,
36
37
  document: () => document_,
37
38
  encode: () => encode,
38
39
  encodeInBatches: () => encodeInBatches,
@@ -115,15 +116,45 @@ var import_log = require("probe.gl/log");
115
116
  var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
116
117
  var version = VERSION[0] >= "0" && VERSION[0] <= "9" ? `v${VERSION}` : "";
117
118
  function createLog() {
118
- const log2 = new import_log.Log({ id: "loaders.gl" });
119
+ const log3 = new import_log.Log({ id: "loaders.gl" });
119
120
  globalThis.loaders ||= {};
120
- globalThis.loaders.log = log2;
121
+ globalThis.loaders.log = log3;
121
122
  globalThis.loaders.version = version;
122
123
  globalThis.probe ||= {};
123
- globalThis.probe.loaders = log2;
124
- return log2;
124
+ globalThis.probe.loaders = log3;
125
+ return log3;
125
126
  }
126
127
  var log = createLog();
128
+ var NullLog = class {
129
+ /** Discards debug messages. */
130
+ log() {
131
+ return ignoreMessage;
132
+ }
133
+ /** Discards informational messages. */
134
+ info() {
135
+ return ignoreMessage;
136
+ }
137
+ /** Discards messages marked to be emitted once. */
138
+ once() {
139
+ return ignoreMessage;
140
+ }
141
+ /** Discards warnings. */
142
+ warn() {
143
+ return ignoreMessage;
144
+ }
145
+ /** Discards errors. */
146
+ error() {
147
+ return ignoreMessage;
148
+ }
149
+ };
150
+ function ignoreMessage() {
151
+ }
152
+ var nullLog = new NullLog();
153
+ function getLoaderLog(options) {
154
+ var _a;
155
+ const logger = (_a = options == null ? void 0 : options.core) == null ? void 0 : _a.log;
156
+ return logger === null ? nullLog : logger || log;
157
+ }
127
158
 
128
159
  // src/loader-utils/lib/javascript-utils/is-type.ts
129
160
  var isBoolean = (value) => typeof value === "boolean";
@@ -183,10 +214,10 @@ var NPM_TAG = "beta";
183
214
 
184
215
  // src/worker-utils/lib/env-utils/version.ts
185
216
  function getVersion() {
186
- const version2 = typeof __VERSION__ === "undefined" ? NPM_TAG : __VERSION__;
217
+ const version3 = typeof __VERSION__ === "undefined" ? NPM_TAG : __VERSION__;
187
218
  globalThis._loadersgl_ = globalThis._loadersgl_ || {};
188
- globalThis._loadersgl_.version ||= version2;
189
- return version2;
219
+ globalThis._loadersgl_.version ||= version3;
220
+ return version3;
190
221
  }
191
222
  var VERSION2 = getVersion();
192
223
 
@@ -216,130 +247,69 @@ var isMobile = typeof window !== "undefined" && typeof window.orientation !== "u
216
247
  var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
217
248
  var nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
218
249
 
219
- // src/worker-utils/lib/worker-farm/worker-job.ts
220
- var WorkerJob = class {
221
- name;
222
- workerThread;
223
- isRunning = true;
224
- /** Promise that resolves when Job is done */
225
- result;
226
- _resolve = () => {
227
- };
228
- _reject = () => {
229
- };
230
- constructor(jobName, workerThread) {
231
- this.name = jobName;
232
- this.workerThread = workerThread;
233
- this.result = new Promise((resolve2, reject) => {
234
- this._resolve = resolve2;
235
- this._reject = reject;
236
- });
237
- }
238
- /**
239
- * Send a message to the job's worker thread
240
- * @param data any data structure, ideally consisting mostly of transferrable objects
241
- */
242
- postMessage(type, payload) {
243
- if (!this.isRunning) return;
244
- this.workerThread.postMessage({
245
- source: "loaders.gl",
246
- // Lets worker ignore unrelated messages
247
- type,
248
- payload
249
- });
250
- }
251
- /**
252
- * Call to resolve the `result` Promise with the supplied value
253
- */
254
- done(value) {
255
- if (!this.isRunning) {
256
- return;
257
- }
258
- this.isRunning = false;
259
- this._resolve(value);
260
- }
261
- /**
262
- * Call to reject the `result` Promise with the supplied error
263
- */
264
- error(error) {
265
- if (!this.isRunning) {
266
- return;
267
- }
268
- this.isRunning = false;
269
- this._reject(error);
270
- }
271
- /**
272
- * Terminates the worker executing this job and rejects its result.
273
- * @param reason Abort reason supplied by the caller, or a cross-runtime `AbortError`.
274
- */
275
- abort(reason) {
276
- if (!this.isRunning) {
277
- return;
278
- }
279
- this.workerThread.destroy();
280
- this.error(
281
- arguments.length ? reason : createAbortError(`Worker job "${this.name}" was aborted`)
282
- );
283
- }
284
- };
285
- function createAbortError(message) {
286
- const error = new Error(message);
287
- error.name = "AbortError";
288
- return error;
289
- }
250
+ // src/worker-utils/lib/worker-api/process-on-worker.ts
251
+ var import_tasks2 = require("@math.gl/tasks");
290
252
 
291
- // src/worker-utils/lib/node/worker_threads-browser.ts
292
- var NodeWorker = class {
293
- /** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
294
- constructor(...arguments_) {
295
- var _a;
296
- const runtimeProcess = globalThis.process;
297
- const WorkerConstructor = (_a = runtimeProcess == null ? void 0 : runtimeProcess.getBuiltinModule) == null ? void 0 : _a.call(runtimeProcess, "node:worker_threads").Worker;
298
- if (WorkerConstructor) {
299
- return new WorkerConstructor(...arguments_);
253
+ // src/worker-utils/lib/worker-api/get-worker-url.ts
254
+ var warnedWorkerVersionFallbacks = /* @__PURE__ */ new Set();
255
+ function getCustomWorkerURL(worker, options = {}) {
256
+ var _a, _b;
257
+ const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
258
+ let url = getConfiguredWorkerURL(worker, options);
259
+ const workerType = options._workerType || ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._workerType);
260
+ if (!url && workerType === "test") {
261
+ if (isBrowser2) {
262
+ url = `modules/${worker.module}/dist/${workerFile}`;
263
+ } else {
264
+ const workerSourceDirectory = worker.module === "core" && ((_b = worker.workerNode) == null ? void 0 : _b.startsWith("worker-utils/")) ? "worker-utils/workers" : "workers";
265
+ const workerSourceNode = worker.workerSourceNode || `${workerSourceDirectory}/${worker.id}-worker-node.ts`;
266
+ url = `modules/${worker.module}/src/${workerSourceNode}`;
300
267
  }
301
268
  }
302
- /** No-op browser fallback matching the native Worker API. */
303
- terminate() {
269
+ return url || null;
270
+ }
271
+ function getConfiguredWorkerURL(worker, options = {}) {
272
+ const workerOptions = options[worker.id] || {};
273
+ return workerOptions.workerUrl || (worker.id === "compression" ? options.workerUrl : null) || null;
274
+ }
275
+ function getWorkerURL(worker, options = {}) {
276
+ const customWorkerUrl = getCustomWorkerURL(worker, options);
277
+ const descriptorWorkerUrl = typeof worker.worker === "string" ? worker.worker : null;
278
+ const url = customWorkerUrl || descriptorWorkerUrl || getDefaultWorkerURL(worker, true);
279
+ assert2(url);
280
+ return url;
281
+ }
282
+ function getDefaultWorkerURL(worker, warn = false) {
283
+ const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
284
+ let version3 = worker.version;
285
+ if (version3 === "latest") {
286
+ version3 = NPM_TAG;
304
287
  }
305
- };
306
-
307
- // src/worker-utils/lib/worker-utils/get-loadable-worker-url.ts
308
- var workerURLCache = /* @__PURE__ */ new Map();
309
- function getLoadableWorkerURL(props) {
310
- assert2(props.source && !props.url || !props.source && props.url);
311
- let workerURL = workerURLCache.get(props.source || props.url);
312
- if (!workerURL) {
313
- if (props.url) {
314
- workerURL = getLoadableWorkerURLFromURL(props.url);
315
- workerURLCache.set(props.url, workerURL);
316
- }
317
- if (props.source) {
318
- workerURL = getLoadableWorkerURLFromSource(props.source);
319
- workerURLCache.set(props.source, workerURL);
320
- }
288
+ const versionTag = version3 ? `@${version3}` : "";
289
+ const url = `https://unpkg.com/@loaders.gl/${worker.module}${versionTag}/dist/${workerFile}`;
290
+ if (warn) {
291
+ warnIfUsingNpmTagFallback(worker, url);
321
292
  }
322
- assert2(workerURL);
323
- return workerURL;
293
+ return url;
324
294
  }
325
- function getLoadableWorkerURLFromURL(url) {
326
- if (!url.startsWith("http")) {
327
- return url;
295
+ function warnIfUsingNpmTagFallback(worker, url) {
296
+ if (worker.version !== "latest") {
297
+ return;
328
298
  }
329
- const workerSource = buildScriptSource(url);
330
- return getLoadableWorkerURLFromSource(workerSource);
331
- }
332
- function getLoadableWorkerURLFromSource(workerSource) {
333
- const blob = new Blob([workerSource], { type: "application/javascript" });
334
- return URL.createObjectURL(blob);
299
+ const workerId = `${worker.module}:${worker.id}`;
300
+ if (warnedWorkerVersionFallbacks.has(workerId)) {
301
+ return;
302
+ }
303
+ warnedWorkerVersionFallbacks.add(workerId);
304
+ log.warn(
305
+ `loaders.gl: ${worker.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${url} from CDN.`
306
+ )();
335
307
  }
336
- function buildScriptSource(workerUrl) {
337
- return `try {
338
- importScripts('${workerUrl}');
339
- } catch (error) {
340
- console.error(error);
341
- throw error;
342
- }`;
308
+
309
+ // src/worker-utils/lib/worker-api/task-runtime.ts
310
+ var import_tasks = require("@math.gl/tasks");
311
+ function normalizeTaskProgress(progress) {
312
+ return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
343
313
  }
344
314
 
345
315
  // src/worker-utils/lib/worker-utils/get-transfer-list.ts
@@ -382,7 +352,7 @@ function getTransferListForWriter(object) {
382
352
  }
383
353
  const clone = Object.assign({}, object);
384
354
  Object.keys(clone).forEach((key) => {
385
- if (typeof object[key] === "object" && !ArrayBuffer.isView(object[key]) && !(object[key] instanceof Array)) {
355
+ if (object[key] !== null && typeof object[key] === "object" && !ArrayBuffer.isView(object[key]) && !(object[key] instanceof Array)) {
386
356
  clone[key] = getTransferListForWriter(object[key]);
387
357
  } else if (typeof clone[key] === "function" || clone[key] instanceof RegExp) {
388
358
  clone[key] = {};
@@ -393,866 +363,224 @@ function getTransferListForWriter(object) {
393
363
  return clone;
394
364
  }
395
365
 
396
- // src/worker-utils/lib/worker-farm/worker-thread.ts
397
- var NOOP = () => {
398
- };
399
- var WorkerThread = class {
400
- name;
401
- source;
402
- url;
403
- /** Lazily resolves the classic worker URL used as a fallback. */
404
- getUrl;
405
- /** Creates a browser Worker directly. */
406
- loadWorker;
407
- terminated = false;
408
- worker;
409
- onMessage;
410
- onError;
411
- _loadableURL = "";
412
- /** Checks if workers are supported on this platform */
413
- static isSupported() {
414
- return typeof Worker !== "undefined" && isBrowser2 || typeof NodeWorker !== "undefined" && !isBrowser2;
415
- }
416
- constructor(props) {
417
- const { name, source, url, getUrl, loadWorker } = props;
418
- assert2(source || url || getUrl || loadWorker);
419
- this.name = name;
420
- this.source = source;
421
- this.url = url;
422
- this.getUrl = getUrl;
423
- this.loadWorker = loadWorker;
424
- this.onMessage = NOOP;
425
- this.onError = (error) => console.log(error);
426
- this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
427
- }
428
- /**
429
- * Terminate this worker thread
430
- * @note Can free up significant memory
431
- */
432
- destroy() {
433
- this.onMessage = NOOP;
434
- this.onError = NOOP;
435
- this.worker.terminate();
436
- this.terminated = true;
437
- }
438
- /** Keeps this worker from preventing Node.js process exit while idle. */
439
- unref() {
440
- if (!isBrowser2 && typeof this.worker.unref === "function") {
441
- this.worker.unref();
442
- }
443
- }
444
- /** Keeps this worker alive while it is actively processing a job. */
445
- ref() {
446
- if (!isBrowser2 && typeof this.worker.ref === "function") {
447
- this.worker.ref();
448
- }
449
- }
450
- get isRunning() {
451
- return Boolean(this.onMessage);
452
- }
453
- /**
454
- * Send a message to this worker thread
455
- * @param data any data structure, ideally consisting mostly of transferrable objects
456
- * @param transferList If not supplied, calculated automatically by traversing data
457
- */
458
- postMessage(data, transferList) {
459
- transferList = transferList || getTransferList(data);
460
- this.worker.postMessage(data, transferList);
461
- }
462
- // PRIVATE
463
- /**
464
- * Generate a standard Error from an ErrorEvent
465
- * @param event
466
- */
467
- _getErrorFromErrorEvent(event) {
468
- let message = "Failed to load ";
469
- message += `worker ${this.name} from ${this.url || "built-in worker factory"}. `;
470
- if (event.message) {
471
- message += `${event.message} in `;
472
- }
473
- if (event.lineno) {
474
- message += `:${event.lineno}:${event.colno}`;
475
- }
476
- return new Error(message);
477
- }
478
- /**
479
- * Creates a worker thread on the browser
480
- */
481
- _createBrowserWorker() {
482
- var _a;
483
- if (this.loadWorker) {
484
- try {
485
- const worker2 = this.loadWorker();
486
- if (worker2) {
487
- return this._initializeBrowserWorker(worker2);
488
- }
489
- } catch (error) {
490
- if (!this.source && !this.url && !this.getUrl) {
491
- throw error;
492
- }
493
- }
494
- }
495
- const url = this.url || ((_a = this.getUrl) == null ? void 0 : _a.call(this));
496
- this._loadableURL = getLoadableWorkerURL({ source: this.source, url });
497
- const worker = new Worker(this._loadableURL, { name: this.name });
498
- return this._initializeBrowserWorker(worker);
499
- }
500
- /** Attaches protocol handlers to a browser worker. */
501
- _initializeBrowserWorker(worker) {
502
- worker.onmessage = (event) => {
503
- if (!event.data) {
504
- this.onError(new Error("No data received"));
505
- } else {
506
- this.onMessage(event.data);
507
- }
508
- };
509
- worker.onerror = (error) => {
510
- this.onError(this._getErrorFromErrorEvent(error));
511
- this.terminated = true;
512
- };
513
- worker.onmessageerror = (event) => console.error(event);
514
- return worker;
515
- }
516
- /**
517
- * Creates a worker thread in node.js
518
- * @todo https://nodejs.org/api/async_hooks.html#async-resource-worker-pool
519
- */
520
- _createNodeWorker() {
521
- let worker;
522
- if (this.url) {
523
- const absolute = this.url.includes(":/") || this.url.startsWith("/");
524
- const url = absolute ? this.url : `./${this.url}`;
525
- const workerUrl = url.startsWith("file:") ? new URL(url) : url;
526
- const type = this.url.endsWith(".ts") || this.url.endsWith(".mjs") ? "module" : "commonjs";
527
- worker = new NodeWorker(workerUrl, { eval: false, type });
528
- } else if (this.source) {
529
- worker = new NodeWorker(this.source, { eval: true });
530
- } else {
531
- throw new Error("no worker");
532
- }
533
- worker.on("message", (data) => {
534
- this.onMessage(data);
535
- });
536
- worker.on("error", (error) => {
537
- this.onError(error);
538
- });
539
- worker.on("exit", (_code) => {
540
- });
541
- return worker;
542
- }
543
- };
544
-
545
- // src/worker-utils/lib/worker-farm/worker-pool.ts
546
- var WorkerPool = class {
547
- name = "unnamed";
548
- source;
549
- // | Function;
550
- url;
551
- /** Lazily resolves a classic worker fallback URL. */
552
- getUrl;
553
- /** Creates a browser Worker directly. */
554
- loadWorker;
555
- maxConcurrency = 1;
556
- maxMobileConcurrency = 1;
557
- onDebug = () => {
558
- };
559
- reuseWorkers = true;
560
- props = {};
561
- jobQueue = [];
562
- idleQueue = [];
563
- activeJobs = /* @__PURE__ */ new Set();
564
- count = 0;
565
- isDestroyed = false;
566
- /** Checks if workers are supported on this platform */
567
- static isSupported() {
568
- return WorkerThread.isSupported();
569
- }
570
- /**
571
- * @param processor - worker function
572
- * @param maxConcurrency - max count of workers
573
- */
574
- constructor(props) {
575
- this.source = props.source;
576
- this.url = props.url;
577
- this.getUrl = props.getUrl;
578
- this.loadWorker = props.loadWorker;
579
- this.setProps(props);
580
- }
581
- /**
582
- * Terminates all workers in the pool and aborts active jobs.
583
- * @param reason Optional error delivered to active jobs.
584
- * @note Can free up significant memory
585
- */
586
- destroy(reason = new Error("Worker pool was destroyed")) {
587
- this.isDestroyed = true;
588
- this.activeJobs.forEach((job) => job.abort(reason));
589
- const queuedJobs = this.jobQueue.splice(0);
590
- queuedJobs.forEach((queuedJob) => {
591
- queuedJob.removeAbortListener();
592
- queuedJob.onReject(reason);
593
- });
594
- this.idleQueue.forEach((worker) => worker.destroy());
595
- this.isDestroyed = true;
596
- }
597
- setProps(props) {
598
- this.props = { ...this.props, ...props };
599
- if (props.name !== void 0) {
600
- this.name = props.name;
601
- }
602
- if (props.maxConcurrency !== void 0) {
603
- this.maxConcurrency = props.maxConcurrency;
604
- }
605
- if (props.maxMobileConcurrency !== void 0) {
606
- this.maxMobileConcurrency = props.maxMobileConcurrency;
607
- }
608
- if (props.reuseWorkers !== void 0) {
609
- this.reuseWorkers = props.reuseWorkers;
610
- }
611
- if (props.onDebug !== void 0) {
612
- this.onDebug = props.onDebug;
613
- }
614
- }
615
- async startJob(name, onMessage2 = (job, type, data) => job.done(data), onError = (job, error) => job.error(error), signal) {
616
- if (signal == null ? void 0 : signal.aborted) {
617
- throw signal.reason;
618
- }
619
- if (this.isDestroyed) {
620
- return Promise.reject(new Error("Worker pool was destroyed"));
621
- }
622
- const startPromise = new Promise((onStart, onReject) => {
623
- const abortQueuedJob = () => {
624
- const index = this.jobQueue.indexOf(queuedJob);
625
- if (index >= 0) {
626
- this.jobQueue.splice(index, 1);
627
- queuedJob.removeAbortListener();
628
- onReject(signal == null ? void 0 : signal.reason);
629
- }
630
- };
631
- const queuedJob = {
632
- name,
633
- onMessage: onMessage2,
634
- onError,
635
- onStart,
636
- onReject,
637
- signal,
638
- removeAbortListener: () => signal == null ? void 0 : signal.removeEventListener("abort", abortQueuedJob)
639
- };
640
- this.jobQueue.push(queuedJob);
641
- signal == null ? void 0 : signal.addEventListener("abort", abortQueuedJob, { once: true });
642
- return this;
643
- });
644
- this._startQueuedJob();
645
- return await startPromise;
646
- }
647
- // PRIVATE
648
- /**
649
- * Starts first queued job if worker is available or can be created
650
- * Called when job is started and whenever a worker returns to the idleQueue
651
- */
652
- async _startQueuedJob() {
653
- var _a, _b, _c;
654
- if (!this.jobQueue.length) {
655
- return;
656
- }
657
- let workerThread;
658
- try {
659
- workerThread = this._getAvailableWorker();
660
- } catch (error) {
661
- const queuedJob2 = this.jobQueue.shift();
662
- queuedJob2 == null ? void 0 : queuedJob2.removeAbortListener();
663
- queuedJob2 == null ? void 0 : queuedJob2.onReject(error);
664
- void this._startQueuedJob();
665
- return;
666
- }
667
- if (!workerThread) {
668
- return;
669
- }
670
- const queuedJob = this.jobQueue.shift();
671
- if (queuedJob) {
672
- this.onDebug({
673
- message: "Starting job",
674
- name: queuedJob.name,
675
- workerThread,
676
- backlog: this.jobQueue.length
677
- });
678
- const job = new WorkerJob(queuedJob.name, workerThread);
679
- queuedJob.removeAbortListener();
680
- const abortJob = () => {
681
- var _a2;
682
- return job.abort((_a2 = queuedJob.signal) == null ? void 0 : _a2.reason);
683
- };
684
- (_a = queuedJob.signal) == null ? void 0 : _a.addEventListener("abort", abortJob, { once: true });
685
- if ((_b = queuedJob.signal) == null ? void 0 : _b.aborted) abortJob();
686
- this.activeJobs.add(job);
687
- workerThread.ref();
688
- workerThread.onMessage = (data) => {
689
- if (job.isRunning) queuedJob.onMessage(job, data.type, data.payload);
690
- };
691
- workerThread.onError = (error) => queuedJob.onError(job, error);
692
- queuedJob.onStart(job);
693
- try {
694
- await job.result;
695
- } catch {
696
- } finally {
697
- (_c = queuedJob.signal) == null ? void 0 : _c.removeEventListener("abort", abortJob);
698
- this.activeJobs.delete(job);
699
- this.returnWorkerToQueue(workerThread);
700
- }
701
- } else {
702
- this.returnWorkerToQueue(workerThread);
703
- }
704
- }
705
- /**
706
- * Returns a worker to the idle queue
707
- * Destroys the worker if
708
- * - pool is destroyed
709
- * - if this pool doesn't reuse workers
710
- * - if maxConcurrency has been lowered
711
- * @param worker
712
- */
713
- returnWorkerToQueue(worker) {
714
- const shouldDestroyWorker = (
715
- // Aborted jobs terminate their worker immediately.
716
- worker.terminated || // If the pool is destroyed, there is no reason to keep the worker around
717
- this.isDestroyed || // If the app has disabled worker reuse, any completed workers should be destroyed
718
- !this.reuseWorkers || // If concurrency has been lowered, this worker might be surplus to requirements
719
- this.count > this._getMaxConcurrency()
720
- );
721
- if (shouldDestroyWorker) {
722
- if (!worker.terminated) {
723
- worker.destroy();
724
- }
725
- this.count--;
726
- } else {
727
- worker.unref();
728
- this.idleQueue.push(worker);
729
- }
730
- if (!this.isDestroyed) {
731
- this._startQueuedJob();
732
- }
733
- }
734
- /**
735
- * Returns idle worker or creates new worker if maxConcurrency has not been reached
736
- */
737
- _getAvailableWorker() {
738
- if (this.idleQueue.length > 0) {
739
- return this.idleQueue.shift() || null;
740
- }
741
- if (this.count < this._getMaxConcurrency()) {
742
- this.count++;
743
- const name = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;
744
- try {
745
- return new WorkerThread({
746
- name,
747
- source: this.source,
748
- url: this.url,
749
- getUrl: this.getUrl,
750
- loadWorker: this.loadWorker
751
- });
752
- } catch (error) {
753
- this.count--;
754
- throw error;
755
- }
756
- }
757
- return null;
758
- }
759
- _getMaxConcurrency() {
760
- return isMobile ? this.maxMobileConcurrency : this.maxConcurrency;
761
- }
762
- };
763
-
764
- // src/worker-utils/lib/worker-farm/worker-farm.ts
765
- var DEFAULT_PROPS = {
766
- maxConcurrency: 3,
767
- maxMobileConcurrency: 1,
768
- reuseWorkers: true,
769
- onDebug: () => {
770
- }
771
- };
772
- var loadWorkerIds = /* @__PURE__ */ new WeakMap();
773
- var nextLoadWorkerId = 1;
774
- var WorkerFarm = class _WorkerFarm {
775
- props;
776
- workerPools = /* @__PURE__ */ new Map();
777
- // singleton
778
- static _workerFarm;
779
- /** Checks if workers are supported on this platform */
780
- static isSupported() {
781
- return WorkerThread.isSupported();
782
- }
783
- /** Get the singleton instance of the global worker farm */
784
- static getWorkerFarm(props = {}) {
785
- _WorkerFarm._workerFarm = _WorkerFarm._workerFarm || new _WorkerFarm({});
786
- _WorkerFarm._workerFarm.setProps(props);
787
- return _WorkerFarm._workerFarm;
788
- }
789
- /** get global instance with WorkerFarm.getWorkerFarm() */
790
- constructor(props) {
791
- this.props = { ...DEFAULT_PROPS };
792
- this.setProps(props);
793
- this.workerPools = /* @__PURE__ */ new Map();
794
- }
795
- /**
796
- * Terminate all workers in the farm and abort active jobs.
797
- * @param reason Optional error delivered to active jobs.
798
- * @note Can free up significant memory
799
- */
800
- destroy(reason) {
801
- for (const workerPool of this.workerPools.values()) {
802
- workerPool.destroy(reason);
803
- }
804
- this.workerPools = /* @__PURE__ */ new Map();
805
- }
806
- /**
807
- * Set props used when initializing worker pools
808
- * @param props
809
- */
810
- setProps(props) {
811
- this.props = { ...this.props, ...props };
812
- for (const workerPool of this.workerPools.values()) {
813
- workerPool.setProps(this._getWorkerPoolProps());
814
- }
815
- }
816
- /**
817
- * Returns a worker pool for the specified worker
818
- * @param options Worker target used to identify and initialize the pool.
819
- * @param options.name Worker name used as the base pool identity.
820
- * @param options.url Worker script URL.
821
- * @param options.source Inline worker source.
822
- * @param options.loadWorker Built-in browser worker factory.
823
- * @example
824
- * const job = WorkerFarm.getWorkerFarm().getWorkerPool({name, url}).startJob(...);
825
- */
826
- getWorkerPool(options) {
827
- const { name, source, url, getUrl, loadWorker } = options;
828
- const workerPoolKey = getWorkerPoolKey(options);
829
- let workerPool = this.workerPools.get(workerPoolKey);
830
- if (!workerPool) {
831
- workerPool = new WorkerPool({
832
- name,
833
- source,
834
- url,
835
- getUrl,
836
- loadWorker
837
- });
838
- workerPool.setProps(this._getWorkerPoolProps());
839
- this.workerPools.set(workerPoolKey, workerPool);
840
- }
841
- return workerPool;
842
- }
843
- _getWorkerPoolProps() {
844
- return {
845
- maxConcurrency: this.props.maxConcurrency,
846
- maxMobileConcurrency: this.props.maxMobileConcurrency,
847
- reuseWorkers: this.props.reuseWorkers,
848
- onDebug: this.props.onDebug
849
- };
850
- }
851
- };
852
- function getWorkerPoolKey(options) {
853
- const { name, source, url, urlKey, loadWorker } = options;
854
- const sourceKey = source ? `source:${source}` : "";
855
- const urlKeyPart = url || urlKey ? `url:${url || urlKey}` : "";
856
- const loadWorkerKey = loadWorker ? `loadWorker:${getLoadWorkerId(loadWorker)}` : "";
857
- return [name, sourceKey, urlKeyPart, loadWorkerKey].filter(Boolean).join("|");
858
- }
859
- function getLoadWorkerId(loadWorker) {
860
- let loadWorkerId = loadWorkerIds.get(loadWorker);
861
- if (!loadWorkerId) {
862
- loadWorkerId = nextLoadWorkerId++;
863
- loadWorkerIds.set(loadWorker, loadWorkerId);
864
- }
865
- return loadWorkerId;
866
- }
867
-
868
- // src/worker-utils/lib/async-queue/async-queue.ts
869
- var AsyncQueue = class {
870
- _values;
871
- _settlers;
872
- _closed;
873
- constructor() {
874
- this._values = [];
875
- this._settlers = [];
876
- this._closed = false;
877
- }
878
- /** Return an async iterator for this queue */
879
- [Symbol.asyncIterator]() {
880
- return this;
881
- }
882
- /** Push a new value - the async iterator will yield a promise resolved to this value */
883
- push(value) {
884
- return this.enqueue(value);
885
- }
886
- /**
887
- * Push a new value - the async iterator will yield a promise resolved to this value
888
- * Add an error - the async iterator will yield a promise rejected with this value
889
- */
890
- enqueue(value) {
891
- if (this._closed) {
892
- throw new Error("Closed");
893
- }
894
- if (this._settlers.length > 0) {
895
- if (this._values.length > 0) {
896
- throw new Error("Illegal internal state");
897
- }
898
- const settler = this._settlers.shift();
899
- if (value instanceof Error) {
900
- settler.reject(value);
901
- } else {
902
- settler.resolve({ value });
903
- }
904
- } else {
905
- this._values.push(value);
906
- }
907
- }
908
- /** Indicate that we not waiting for more values - The async iterator will be done */
909
- close() {
910
- while (this._settlers.length > 0) {
911
- const settler = this._settlers.shift();
912
- settler.resolve({ done: true });
913
- }
914
- this._closed = true;
915
- }
916
- // ITERATOR IMPLEMENTATION
917
- /** @returns a Promise for an IteratorResult */
918
- next() {
919
- if (this._values.length > 0) {
920
- const value = this._values.shift();
921
- if (value instanceof Error) {
922
- return Promise.reject(value);
923
- }
924
- return Promise.resolve({ done: false, value });
925
- }
926
- if (this._closed) {
927
- if (this._settlers.length > 0) {
928
- throw new Error("Illegal internal state");
929
- }
930
- return Promise.resolve({ done: true, value: void 0 });
931
- }
932
- return new Promise((resolve2, reject) => {
933
- this._settlers.push({ resolve: resolve2, reject });
934
- });
935
- }
936
- };
937
-
938
- // src/worker-utils/lib/worker-api/get-worker-url.ts
939
- var warnedWorkerVersionFallbacks = /* @__PURE__ */ new Set();
940
- function getWorkerName(worker) {
941
- const warning = worker.version !== VERSION2 ? ` (worker-utils@${VERSION2})` : "";
942
- return `${worker.name}@${worker.version}${warning}`;
943
- }
944
- function getCustomWorkerURL(worker, options = {}) {
945
- var _a, _b;
946
- const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
947
- let url = getConfiguredWorkerURL(worker, options);
948
- const workerType = options._workerType || ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._workerType);
949
- if (!url && workerType === "test") {
950
- if (isBrowser2) {
951
- url = `modules/${worker.module}/dist/${workerFile}`;
952
- } else {
953
- const workerSourceDirectory = worker.module === "core" && ((_b = worker.workerNode) == null ? void 0 : _b.startsWith("worker-utils/")) ? "worker-utils/workers" : "workers";
954
- const workerSourceNode = worker.workerSourceNode || `${workerSourceDirectory}/${worker.id}-worker-node.ts`;
955
- url = `modules/${worker.module}/src/${workerSourceNode}`;
956
- }
957
- }
958
- return url || null;
959
- }
960
- function getConfiguredWorkerURL(worker, options = {}) {
961
- const workerOptions = options[worker.id] || {};
962
- return workerOptions.workerUrl || (worker.id === "compression" ? options.workerUrl : null) || null;
963
- }
964
- function getWorkerURL(worker, options = {}) {
965
- const customWorkerUrl = getCustomWorkerURL(worker, options);
966
- const descriptorWorkerUrl = typeof worker.worker === "string" ? worker.worker : null;
967
- const url = customWorkerUrl || descriptorWorkerUrl || getDefaultWorkerURL(worker, true);
968
- assert2(url);
969
- return url;
970
- }
971
- function getDefaultWorkerURL(worker, warn = false) {
972
- const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
973
- let version2 = worker.version;
974
- if (version2 === "latest") {
975
- version2 = NPM_TAG;
976
- }
977
- const versionTag = version2 ? `@${version2}` : "";
978
- const url = `https://unpkg.com/@loaders.gl/${worker.module}${versionTag}/dist/${workerFile}`;
979
- if (warn) {
980
- warnIfUsingNpmTagFallback(worker, url);
981
- }
982
- return url;
983
- }
984
- function warnIfUsingNpmTagFallback(worker, url) {
985
- if (worker.version !== "latest") {
986
- return;
987
- }
988
- const workerId = `${worker.module}:${worker.id}`;
989
- if (warnedWorkerVersionFallbacks.has(workerId)) {
990
- return;
991
- }
992
- warnedWorkerVersionFallbacks.add(workerId);
993
- console.warn(
994
- `loaders.gl: ${worker.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${url} from CDN.`
995
- );
996
- }
997
-
998
366
  // src/worker-utils/lib/worker-api/process-on-worker.ts
999
- function canProcessOnWorker(worker, options) {
1000
- if (!WorkerFarm.isSupported()) {
1001
- return false;
1002
- }
1003
- const workerOptions = options == null ? void 0 : options[worker.id];
367
+ var runners = /* @__PURE__ */ new WeakMap();
368
+ var activeRunners = /* @__PURE__ */ new Set();
369
+ var moduleWorkerUrls = /* @__PURE__ */ new Map();
370
+ function canProcessOnWorker(worker, options = {}) {
371
+ const supported = isBrowser2 ? typeof Worker !== "undefined" : Boolean(options._nodeWorkers);
1004
372
  return Boolean(
1005
- (worker.worker || worker.loadWorker || (workerOptions == null ? void 0 : workerOptions.workerUrl)) && (options == null ? void 0 : options.worker)
373
+ supported && options.worker && (worker.worker || worker.loadWorker || getConfiguredWorkerURL(worker, options))
1006
374
  );
1007
375
  }
1008
376
  function canProcessOnWorkerInBatches(worker, options = {}) {
1009
377
  if (!canProcessOnWorker(worker, options)) return false;
1010
378
  if (options.workerInBatches !== void 0) return options.workerInBatches;
1011
- return Boolean(
1012
- worker.workerInBatches && !options.source && !getConfiguredWorkerURL(worker, options)
1013
- );
379
+ return Boolean(worker.workerInBatches && !getConfiguredWorkerURL(worker, options));
1014
380
  }
1015
381
  async function processOnWorker(worker, data, options = {}, context = {}, jobContext = {}) {
1016
- var _a;
1017
- throwIfAborted(options.signal);
1018
- const name = getWorkerName(worker);
1019
- const workerFarm = WorkerFarm.getWorkerFarm(options);
1020
- const workerPool = workerFarm.getWorkerPool(getWorkerPoolTarget(worker, options, name));
1021
- const jobName = options.jobName || worker.name;
1022
- const job = await workerPool.startJob(
1023
- jobName,
1024
- // eslint-disable-next-line
1025
- onMessage.bind(null, context, options),
1026
- void 0,
1027
- options.signal
1028
- );
1029
- try {
1030
- if ((_a = options.signal) == null ? void 0 : _a.aborted) job.abort(getAbortReason(options.signal));
1031
- const { signal: _signal, onProgress: _onProgress, ...workerOptions } = options;
1032
- const transferableOptions = getTransferListForWriter(workerOptions);
1033
- const transferableContext = getTransferListForWriter(jobContext);
1034
- if (job.isRunning) {
1035
- job.postMessage("process", {
1036
- input: data,
1037
- options: transferableOptions,
1038
- context: transferableContext
1039
- });
1040
- }
1041
- const result = await job.result;
1042
- return result.result;
1043
- } catch (error) {
1044
- job.abort(error);
1045
- throw error;
1046
- }
1047
- }
1048
- function processOnWorkerInBatches(worker, input, options = {}, context = {}, jobContext = {}) {
1049
- return processOnWorkerInBatchesIterator(worker, input, options, context, jobContext);
1050
- }
1051
- async function* processOnWorkerInBatchesIterator(worker, input, options, context, jobContext) {
1052
- throwIfAborted(options.signal);
1053
- const name = getWorkerName(worker);
1054
- const workerFarm = WorkerFarm.getWorkerFarm(options);
1055
- const workerPool = workerFarm.getWorkerPool(getWorkerPoolTarget(worker, options, name));
1056
- const outputBatches = new AsyncQueue();
1057
- const inputIterator = getAsyncIterator(input);
1058
- let outputFinished = false;
1059
- let inputFinished = false;
1060
- let inputCleanupRequested = false;
1061
- let inputRequest = Promise.resolve();
1062
- const batchJobFailed = new Error("Worker batch job failed");
1063
- const closeJobInput = () => {
1064
- if (!inputFinished && !inputCleanupRequested) {
1065
- inputCleanupRequested = true;
1066
- closeInputIterator(inputIterator);
1067
- }
1068
- };
1069
- const finishOutput = () => {
1070
- if (!outputFinished) {
1071
- outputFinished = true;
1072
- outputBatches.close();
1073
- }
1074
- };
1075
- const failOutput = (_error) => {
1076
- if (!outputFinished) {
1077
- outputFinished = true;
1078
- outputBatches.enqueue(batchJobFailed);
1079
- outputBatches.close();
1080
- }
1081
- };
1082
- const job = await workerPool.startJob(
1083
- options.jobName || worker.name,
1084
- (activeJob, type, payload) => {
1085
- switch (type) {
1086
- case "progress":
1087
- reportProgress(activeJob, options, payload);
1088
- break;
1089
- case "input-request":
1090
- inputRequest = inputRequest.then(async () => {
1091
- if (!activeJob.isRunning) return;
1092
- const nextBatch = await inputIterator.next();
1093
- if (!activeJob.isRunning) {
1094
- return;
1095
- }
1096
- if (nextBatch.done) {
1097
- inputFinished = true;
1098
- activeJob.postMessage("input-done", {});
1099
- } else {
1100
- activeJob.postMessage("input-batch", { input: nextBatch.value });
1101
- }
1102
- }).catch((error) => activeJob.abort(error));
1103
- break;
1104
- case "output-batch":
1105
- outputBatches.push(payload.result);
1106
- break;
1107
- case "done":
1108
- activeJob.done(payload);
1109
- finishOutput();
1110
- break;
1111
- case "error": {
1112
- const error = new Error(payload.error || "Worker batch processing failed");
1113
- activeJob.error(error);
1114
- failOutput(error);
1115
- break;
1116
- }
1117
- case "process":
1118
- void onMessage(context, options, activeJob, type, payload);
1119
- break;
1120
- default: {
1121
- const error = new Error(`Unexpected worker batch message: ${type}`);
1122
- activeJob.error(error);
1123
- failOutput(error);
1124
- break;
1125
- }
1126
- }
1127
- },
1128
- void 0,
1129
- options.signal
1130
- ).catch((error) => {
1131
- closeJobInput();
1132
- throw error;
1133
- });
1134
- void job.result.catch((error) => {
1135
- failOutput(error);
1136
- closeJobInput();
1137
- });
382
+ const session = await openSession(worker, options, context, jobContext);
1138
383
  try {
1139
- const { signal: _signal, onProgress: _onProgress, ...workerOptions } = options;
1140
- if (job.isRunning) {
1141
- job.postMessage("process-in-batches", {
1142
- options: getTransferListForWriter(workerOptions),
1143
- context: getTransferListForWriter(jobContext)
1144
- });
1145
- }
1146
- try {
1147
- for await (const outputBatch of outputBatches) {
1148
- yield outputBatch;
1149
- if (job.isRunning) {
1150
- job.postMessage("output-ack", {});
1151
- }
1152
- }
1153
- } catch (error) {
1154
- if (error === batchJobFailed) {
1155
- await job.result;
384
+ const result = await session.handle.runTask(
385
+ { value: data },
386
+ {
387
+ ...getControls(options),
388
+ options: getParserOptions(options)
1156
389
  }
1157
- throw error;
1158
- }
1159
- await job.result;
390
+ );
391
+ return result.value;
1160
392
  } finally {
1161
- if (job.isRunning) {
1162
- job.abort(createAbortError2("Worker batch iterator was closed"));
1163
- }
1164
- closeJobInput();
393
+ await session.close();
1165
394
  }
1166
395
  }
1167
- function throwIfAborted(signal) {
1168
- if (!(signal == null ? void 0 : signal.aborted)) {
1169
- return;
396
+ async function* processOnWorkerInBatches(worker, input, options = {}, context = {}, jobContext = {}) {
397
+ var _a;
398
+ const taskInput = wrapInput(input);
399
+ let session;
400
+ try {
401
+ session = await openSession(worker, options, context, jobContext);
402
+ for await (const result of session.handle.runTaskInBatches(taskInput, {
403
+ ...getControls(options),
404
+ options: getParserOptions(options)
405
+ }))
406
+ yield result.value;
407
+ } finally {
408
+ const closingInput = (_a = taskInput.return) == null ? void 0 : _a.call(taskInput);
409
+ void (closingInput == null ? void 0 : closingInput.catch(() => {
410
+ }));
411
+ await (session == null ? void 0 : session.close());
1170
412
  }
1171
- throw getAbortReason(signal);
1172
- }
1173
- function getAbortReason(signal) {
1174
- return signal ? signal.reason : createAbortError2("Worker job was aborted");
1175
413
  }
1176
- function createAbortError2(message) {
1177
- const error = new Error(message);
1178
- error.name = "AbortError";
1179
- return error;
414
+ function getTask(worker, options) {
415
+ var _a;
416
+ if (options.source || ((_a = options.core) == null ? void 0 : _a.source))
417
+ throw new Error(
418
+ "Inline legacy worker source is unsupported; use a TaskRunner worker URL or factory"
419
+ );
420
+ const create = !getCustomWorkerURL(worker, options) && isBrowser2 ? worker.loadWorker : void 0;
421
+ const url = getWorkerURL(worker, options);
422
+ return {
423
+ id: `${worker.module}:${worker.id}`,
424
+ initialize: (state) => state,
425
+ worker: {
426
+ ...create ? { create: () => create() ?? createModuleWorker(url) } : { url },
427
+ capabilities: { atomic: true, streaming: true }
428
+ }
429
+ };
1180
430
  }
1181
- function getAsyncIterator(input) {
1182
- if (Symbol.asyncIterator in input) {
1183
- return input[Symbol.asyncIterator]();
1184
- }
1185
- return (async function* iterateSynchronously() {
1186
- yield* input;
1187
- })();
431
+ function getControls(options) {
432
+ return {
433
+ execution: "worker",
434
+ signal: options.signal,
435
+ inputOwnership: options.inputOwnership ?? "transfer",
436
+ outputOwnership: options.outputOwnership ?? "transfer",
437
+ onProgress: options.onProgress ? (progress) => {
438
+ var _a;
439
+ return (_a = options.onProgress) == null ? void 0 : _a.call(options, normalizeTaskProgress(progress));
440
+ } : void 0
441
+ };
1188
442
  }
1189
- function closeInputIterator(inputIterator) {
1190
- var _a;
1191
- try {
1192
- void Promise.resolve((_a = inputIterator.return) == null ? void 0 : _a.call(inputIterator)).catch(() => void 0);
1193
- } catch {
1194
- }
443
+ function getParserOptions(options) {
444
+ const { signal, onProgress, parserOptions, ...workerOptions } = options;
445
+ return getTransferListForWriter(parserOptions ?? workerOptions);
1195
446
  }
1196
- function getWorkerPoolTarget(worker, options, name) {
1197
- if (options.source) {
1198
- return { name, source: options.source };
1199
- }
1200
- const customWorkerUrl = getCustomWorkerURL(worker, options);
1201
- if (customWorkerUrl) {
1202
- return { name, url: customWorkerUrl };
1203
- }
1204
- if (isBrowser2 && worker.loadWorker) {
1205
- return {
1206
- name,
1207
- loadWorker: worker.loadWorker,
1208
- getUrl: () => getWorkerURL(worker, options),
1209
- urlKey: getDefaultWorkerURL(worker)
447
+ async function openSession(worker, options, context, jobContext) {
448
+ var _a, _b;
449
+ (_a = options.signal) == null ? void 0 : _a.throwIfAborted();
450
+ const task = getTask(worker, options);
451
+ let state = runners.get(worker);
452
+ if (!state) {
453
+ state = {
454
+ runner: new import_tasks2.TaskRunner({
455
+ maxConcurrency: isMobile ? options.maxMobileConcurrency ?? 1 : options.maxConcurrency ?? 3
456
+ }),
457
+ requests: 0
1210
458
  };
1211
- }
1212
- return { name, url: getWorkerURL(worker, options) };
1213
- }
1214
- async function onMessage(context, options, job, type, payload) {
1215
- switch (type) {
1216
- case "progress":
1217
- reportProgress(job, options, payload);
1218
- break;
1219
- case "done":
1220
- job.done(payload);
1221
- break;
1222
- case "error":
1223
- job.error(new Error(payload.error));
1224
- break;
1225
- case "process":
1226
- const { id, input, options: processOptions } = payload;
459
+ runners.set(worker, state);
460
+ }
461
+ const runnerState = state;
462
+ const channel = context.process ? new MessageChannel() : void 0;
463
+ const callbackController = new AbortController();
464
+ let channelClosed = false;
465
+ const abortCallbacks = () => {
466
+ var _a2;
467
+ return callbackController.abort((_a2 = options.signal) == null ? void 0 : _a2.reason);
468
+ };
469
+ (_b = options.signal) == null ? void 0 : _b.addEventListener("abort", abortCallbacks, { once: true });
470
+ const closeChannel = () => {
471
+ var _a2;
472
+ channelClosed = true;
473
+ (_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortCallbacks);
474
+ callbackController.abort();
475
+ channel == null ? void 0 : channel.port1.close();
476
+ channel == null ? void 0 : channel.port2.close();
477
+ };
478
+ if (channel) {
479
+ channel.port1.onmessage = async ({ data }) => {
480
+ try {
481
+ const value = await context.process(
482
+ data.input,
483
+ data.options,
484
+ {
485
+ signal: callbackController.signal,
486
+ throwIfAborted: () => callbackController.signal.throwIfAborted()
487
+ },
488
+ data.context
489
+ );
490
+ if (!channelClosed && !callbackController.signal.aborted)
491
+ channel.port1.postMessage({ identifier: data.identifier, value }, getTransferList(value));
492
+ } catch (error) {
493
+ if (channelClosed || callbackController.signal.aborted) return;
494
+ channel.port1.postMessage({
495
+ identifier: data.identifier,
496
+ error: {
497
+ name: error instanceof Error ? error.name : "Error",
498
+ message: error instanceof Error ? error.message : String(error)
499
+ }
500
+ });
501
+ }
502
+ };
503
+ channel.port1.start();
504
+ }
505
+ runnerState.requests++;
506
+ activeRunners.add(runnerState);
507
+ let released = false;
508
+ const releaseRunner = () => {
509
+ if (released) return;
510
+ released = true;
511
+ runnerState.requests--;
512
+ if (!runnerState.requests) activeRunners.delete(runnerState);
513
+ };
514
+ let handle;
515
+ try {
516
+ handle = await runnerState.runner.initializeTask(
517
+ task,
518
+ {
519
+ context: structuredClone(jobContext),
520
+ ...channel ? { port: channel.port2 } : {}
521
+ },
522
+ // The callback port is setup state, independent of the caller's payload ownership.
523
+ { ...getControls(options), inputOwnership: "transfer" }
524
+ );
525
+ } catch (error) {
526
+ releaseRunner();
527
+ closeChannel();
528
+ throw error;
529
+ }
530
+ return {
531
+ handle,
532
+ /** Releases the worker and callback channel on success, failure, and early stream return. */
533
+ async close() {
1227
534
  try {
1228
- if (!context.process) {
1229
- job.postMessage("error", { id, error: "Worker not set up to process on main thread" });
1230
- return;
1231
- }
1232
- const result = await context.process(
1233
- input,
1234
- { ...processOptions, signal: options.signal, onProgress: options.onProgress },
1235
- void 0,
1236
- payload.context || {}
1237
- );
1238
- job.postMessage("done", { id, result });
1239
- } catch (error) {
1240
- const message = error instanceof Error ? error.message : "unknown error";
1241
- job.postMessage("error", { id, error: message });
535
+ await handle.close();
536
+ } finally {
537
+ closeChannel();
538
+ releaseRunner();
1242
539
  }
1243
- break;
1244
- default:
1245
- console.warn(`process-on-worker: unknown message ${type}`);
1246
- }
540
+ }
541
+ };
542
+ }
543
+ function wrapInput(input) {
544
+ const iterator = Symbol.asyncIterator in input ? input[Symbol.asyncIterator]() : input[Symbol.iterator]();
545
+ let inputClosed = false;
546
+ return {
547
+ [Symbol.asyncIterator]() {
548
+ return this;
549
+ },
550
+ async next() {
551
+ if (inputClosed) return { done: true, value: void 0 };
552
+ const next = await iterator.next();
553
+ if (next.done || inputClosed) {
554
+ inputClosed = true;
555
+ return { done: true, value: void 0 };
556
+ }
557
+ return { done: false, value: { value: next.value } };
558
+ },
559
+ async return() {
560
+ var _a;
561
+ if (!inputClosed) {
562
+ inputClosed = true;
563
+ await ((_a = iterator.return) == null ? void 0 : _a.call(iterator));
564
+ }
565
+ return { done: true, value: void 0 };
566
+ }
567
+ };
1247
568
  }
1248
- function reportProgress(job, options, payload) {
569
+ function createModuleWorker(url) {
1249
570
  var _a;
1250
- if (!job.isRunning || !payload.progress) return;
1251
- try {
1252
- (_a = options.onProgress) == null ? void 0 : _a.call(options, payload.progress);
1253
- } catch (error) {
1254
- job.abort(error);
571
+ const resolved = new URL(url, ((_a = globalThis.document) == null ? void 0 : _a.baseURI) ?? globalThis.location.href);
572
+ let workerUrl = resolved.href;
573
+ if (/^https?:$/.test(resolved.protocol) && resolved.origin !== globalThis.location.origin) {
574
+ let shimUrl = moduleWorkerUrls.get(resolved.href);
575
+ if (!shimUrl) {
576
+ shimUrl = URL.createObjectURL(
577
+ new Blob([`import ${JSON.stringify(resolved.href)};`], { type: "application/javascript" })
578
+ );
579
+ moduleWorkerUrls.set(resolved.href, shimUrl);
580
+ }
581
+ workerUrl = shimUrl;
1255
582
  }
583
+ return new Worker(workerUrl, { type: "module" });
1256
584
  }
1257
585
 
1258
586
  // src/worker-utils/lib/worker-api/validate-worker-version.ts
@@ -1275,8 +603,7 @@ function canParseWithWorker(loader, options) {
1275
603
  (credential) => credential.type === "request" || "token" in credential && typeof credential.token === "function"
1276
604
  ))
1277
605
  return false;
1278
- if (loader.id === "shapefile" && (typeof (options == null ? void 0 : options.fetch) === "function" || typeof ((_e = options == null ? void 0 : options.core) == null ? void 0 : _e.fetch) === "function"))
1279
- return false;
606
+ if (loader.id === "shapefile" && typeof ((_e = options == null ? void 0 : options.core) == null ? void 0 : _e.fetch) === "function") return false;
1280
607
  const workerOptions = getWorkerOptions(options);
1281
608
  const nodeWorkers = workerOptions._nodeWorkers;
1282
609
  if (!isBrowser2 && !nodeWorkers) {
@@ -1325,12 +652,16 @@ async function parseWithWorker(loader, data, options, context, parseOnMainThread
1325
652
  onProgress: (options == null ? void 0 : options.onProgress) || (context == null ? void 0 : context.reportProgress)
1326
653
  },
1327
654
  {
1328
- process: async (input, processOptions, _workerContext, parseContext) => {
655
+ process: async (input, processOptions, workerContext, parseContext) => {
1329
656
  if (!parseOnMainThread) {
1330
657
  throw new Error("Worker not set up to parse on main thread");
1331
658
  }
1332
659
  const { _loaderIds, _loaderIsArray, ...workerParseContext } = parseContext || {};
1333
- const mainThreadContext = context || parseContext ? { ...context, ...workerParseContext } : void 0;
660
+ const mainThreadContext = context || parseContext || (workerContext == null ? void 0 : workerContext.signal) ? {
661
+ ...context,
662
+ ...workerParseContext,
663
+ signal: (workerContext == null ? void 0 : workerContext.signal) ?? (context == null ? void 0 : context.signal)
664
+ } : void 0;
1334
665
  return await callParseOnMainThread(
1335
666
  parseOnMainThread,
1336
667
  input,
@@ -1355,12 +686,16 @@ async function* parseWithWorkerInBatches(loader, inputIterator, options, context
1355
686
  onProgress: (options == null ? void 0 : options.onProgress) || (context == null ? void 0 : context.reportProgress)
1356
687
  },
1357
688
  {
1358
- process: async (input, processOptions, _workerContext, parseContext) => {
689
+ process: async (input, processOptions, workerContext, parseContext) => {
1359
690
  if (!parseOnMainThread) {
1360
691
  throw new Error("Worker not set up to parse on main thread");
1361
692
  }
1362
693
  const { _loaderIds, _loaderIsArray, ...workerParseContext } = parseContext || {};
1363
- const mainThreadContext = context || parseContext ? { ...context, ...workerParseContext } : void 0;
694
+ const mainThreadContext = context || parseContext || (workerContext == null ? void 0 : workerContext.signal) ? {
695
+ ...context,
696
+ ...workerParseContext,
697
+ signal: (workerContext == null ? void 0 : workerContext.signal) ?? (context == null ? void 0 : context.signal)
698
+ } : void 0;
1364
699
  return await callParseOnMainThread(
1365
700
  parseOnMainThread,
1366
701
  input,
@@ -1421,13 +756,19 @@ function resolveWorkerLoaders(loader, loaderIds, loaderIsArray, context, options
1421
756
  }
1422
757
  }
1423
758
  function getWorkerOptions(options = {}, loader) {
1424
- var _a;
759
+ var _a, _b;
1425
760
  const portableOptions = ((_a = loader == null ? void 0 : loader.serializeWorkerOptions) == null ? void 0 : _a.call(loader, options)) || options;
1426
761
  const optionsToSerialize = {
1427
762
  ...portableOptions,
1428
763
  signal: void 0,
1429
764
  onProgress: void 0,
1430
- ...portableOptions.core ? { core: { ...portableOptions.core, authentications: void 0 } } : {}
765
+ ...portableOptions.core ? {
766
+ core: {
767
+ ...portableOptions.core,
768
+ authentications: void 0,
769
+ log: isDisabledLog(portableOptions.core.log) ? null : void 0
770
+ }
771
+ } : {}
1431
772
  };
1432
773
  const serializedOptions = JSON.parse(
1433
774
  JSON.stringify(optionsToSerialize, (_key, value) => {
@@ -1438,17 +779,17 @@ function getWorkerOptions(options = {}, loader) {
1438
779
  })
1439
780
  );
1440
781
  restoreBigIntOptions(optionsToSerialize, serializedOptions);
1441
- const workerOptions = {
1442
- ...serializedOptions.core,
1443
- ...serializedOptions
1444
- };
1445
- if (workerOptions.worker === "auto") {
1446
- workerOptions.worker = true;
782
+ if (((_b = serializedOptions.core) == null ? void 0 : _b.worker) === "auto") {
783
+ serializedOptions.core.worker = true;
1447
784
  }
1448
785
  if (loader) {
1449
- workerOptions._workerLoaderId = loader.id;
786
+ serializedOptions._workerLoaderId = loader.id;
1450
787
  }
1451
- return workerOptions;
788
+ return {
789
+ ...serializedOptions,
790
+ ...serializedOptions.core,
791
+ parserOptions: serializedOptions
792
+ };
1452
793
  }
1453
794
  function restoreBigIntOptions(original, serialized) {
1454
795
  if (!serialized || typeof serialized !== "object") return;
@@ -1467,7 +808,7 @@ function getSerializableLoaderContext(context) {
1467
808
  loaders,
1468
809
  coreApi: coreApi2,
1469
810
  signal,
1470
- reportProgress: reportProgress2,
811
+ reportProgress,
1471
812
  _parse,
1472
813
  _parseSync,
1473
814
  _parseInBatches,
@@ -1478,24 +819,27 @@ function getSerializableLoaderContext(context) {
1478
819
  function shouldParseCSVWithWorker(options) {
1479
820
  var _a, _b;
1480
821
  const csvOptions = options;
1481
- return (((_a = csvOptions == null ? void 0 : csvOptions.csv) == null ? void 0 : _a.shape) ?? ((_b = csvOptions == null ? void 0 : csvOptions.core) == null ? void 0 : _b.shape)) === "arrow-table";
822
+ return (((_a = csvOptions == null ? void 0 : csvOptions.csv) == null ? void 0 : _a.shape) ?? ((_b = csvOptions == null ? void 0 : csvOptions.core) == null ? void 0 : _b.shape)) === "arrow";
1482
823
  }
1483
824
  function isLoaderWithWorkerResultDeserializer(loader) {
1484
825
  return typeof loader.deserializeWorkerResult === "function";
1485
826
  }
827
+ function isDisabledLog(logger) {
828
+ return logger === null || logger instanceof NullLog;
829
+ }
1486
830
 
1487
831
  // src/loader-utils/lib/worker-loader-utils/encode-with-worker.ts
1488
832
  function canEncodeWithWorker(writer, options) {
1489
833
  var _a, _b;
1490
- if (!WorkerFarm.isSupported()) {
1491
- return false;
1492
- }
1493
834
  const nodeWorkers = (options == null ? void 0 : options._nodeWorkers) ?? ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._nodeWorkers);
1494
835
  const useWorkers = (options == null ? void 0 : options.worker) ?? ((_b = options == null ? void 0 : options.core) == null ? void 0 : _b.worker);
1495
836
  if (!isBrowser && !nodeWorkers) {
1496
837
  return false;
1497
838
  }
1498
- return Boolean(writer.worker && useWorkers);
839
+ return canProcessOnWorker(
840
+ { ...writer, options: writer.options || {} },
841
+ { worker: Boolean(useWorkers), _nodeWorkers: Boolean(nodeWorkers) }
842
+ );
1499
843
  }
1500
844
 
1501
845
  // src/loader-utils/lib/binary-utils/array-buffer-utils.ts
@@ -1658,7 +1002,7 @@ var STAT_ACTIVE_REQUESTS = "Active Requests";
1658
1002
  var STAT_CANCELLED_REQUESTS = "Cancelled Requests";
1659
1003
  var STAT_QUEUED_REQUESTS_EVER = "Queued Requests Ever";
1660
1004
  var STAT_ACTIVE_REQUESTS_EVER = "Active Requests Ever";
1661
- var DEFAULT_PROPS2 = {
1005
+ var DEFAULT_PROPS = {
1662
1006
  id: "request-scheduler",
1663
1007
  /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */
1664
1008
  throttleRequests: true,
@@ -1680,7 +1024,7 @@ var RequestScheduler = class {
1680
1024
  /** Pending arrival debounce or next-tick refill; only new arrivals replace this timer. */
1681
1025
  updateTimer = null;
1682
1026
  constructor(props = {}) {
1683
- this.props = { ...DEFAULT_PROPS2, ...props };
1027
+ this.props = { ...DEFAULT_PROPS, ...props };
1684
1028
  this.stats = new import_stats.Stats({ id: this.props.id });
1685
1029
  this.stats.get(STAT_QUEUED_REQUESTS);
1686
1030
  this.stats.get(STAT_ACTIVE_REQUESTS);
@@ -2399,9 +1743,50 @@ var NodeFileFacade = class {
2399
1743
  }
2400
1744
  };
2401
1745
 
2402
- // src/loader-utils/source-types.ts
2403
- function isSourceLoader(loader) {
2404
- return Boolean(loader && typeof loader === "object" && "createDataSource" in loader);
1746
+ // src/loader-utils/lib/pace-batch-iterator.ts
1747
+ function validateBatchDeliveryRate(rate) {
1748
+ if (!Number.isFinite(rate) || rate < 0) {
1749
+ throw new RangeError("core.batchMaxRowsPerSecond must be a finite nonnegative number");
1750
+ }
1751
+ }
1752
+ async function* paceBatchIterator(batches, { batchMaxRowsPerSecond = 0, getRowCount, signal }) {
1753
+ validateBatchDeliveryRate(batchMaxRowsPerSecond);
1754
+ signal == null ? void 0 : signal.throwIfAborted();
1755
+ if (batchMaxRowsPerSecond === 0) {
1756
+ yield* batches;
1757
+ return;
1758
+ }
1759
+ let deadline = 0;
1760
+ for await (const batch of batches) {
1761
+ signal == null ? void 0 : signal.throwIfAborted();
1762
+ const rowCount = getRowCount(batch);
1763
+ if (rowCount !== void 0 && rowCount > 0) {
1764
+ let remaining = deadline - performance.now();
1765
+ while (remaining > 0) {
1766
+ await waitForBatch(Math.min(Math.ceil(remaining), 2 ** 31 - 1), signal);
1767
+ remaining = deadline - performance.now();
1768
+ }
1769
+ signal == null ? void 0 : signal.throwIfAborted();
1770
+ deadline = performance.now() + rowCount / batchMaxRowsPerSecond * 1e3;
1771
+ }
1772
+ yield batch;
1773
+ signal == null ? void 0 : signal.throwIfAborted();
1774
+ }
1775
+ }
1776
+ function waitForBatch(delay, signal) {
1777
+ signal == null ? void 0 : signal.throwIfAborted();
1778
+ return new Promise((resolve2, reject) => {
1779
+ const timer = setTimeout(() => {
1780
+ signal == null ? void 0 : signal.removeEventListener("abort", abort);
1781
+ resolve2();
1782
+ }, delay);
1783
+ function abort() {
1784
+ clearTimeout(timer);
1785
+ signal == null ? void 0 : signal.removeEventListener("abort", abort);
1786
+ reject(signal == null ? void 0 : signal.reason);
1787
+ }
1788
+ signal == null ? void 0 : signal.addEventListener("abort", abort, { once: true });
1789
+ });
2405
1790
  }
2406
1791
 
2407
1792
  // dist/lib/fetch/fetch-error.js
@@ -2628,71 +2013,47 @@ async function readBlob(blob) {
2628
2013
  }
2629
2014
 
2630
2015
  // dist/lib/loader-utils/loggers.js
2631
- var import_log3 = require("probe.gl/log");
2632
- var probeLog = new import_log3.Log({ id: "loaders.gl" });
2633
- var NullLog = class {
2634
- /** Drops a log message. */
2016
+ var import_log6 = require("probe.gl/log");
2017
+
2018
+ // dist/loader-utils/lib/log-utils/log.js
2019
+ var import_log5 = require("probe.gl/log");
2020
+ var VERSION4 = true ? "5.0.0-beta.11" : "latest";
2021
+ var version2 = VERSION4[0] >= "0" && VERSION4[0] <= "9" ? `v${VERSION4}` : "";
2022
+ function createLog2() {
2023
+ const log3 = new import_log5.Log({ id: "loaders.gl" });
2024
+ globalThis.loaders ||= {};
2025
+ globalThis.loaders.log = log3;
2026
+ globalThis.loaders.version = version2;
2027
+ globalThis.probe ||= {};
2028
+ globalThis.probe.loaders = log3;
2029
+ return log3;
2030
+ }
2031
+ var log2 = createLog2();
2032
+ var NullLog2 = class {
2033
+ /** Discards debug messages. */
2635
2034
  log() {
2636
- return () => {
2637
- };
2035
+ return ignoreMessage2;
2638
2036
  }
2639
- /** Drops an info message. */
2037
+ /** Discards informational messages. */
2640
2038
  info() {
2641
- return () => {
2642
- };
2039
+ return ignoreMessage2;
2643
2040
  }
2644
- /** Logs one message once; no-op for the null logger. */
2041
+ /** Discards messages marked to be emitted once. */
2645
2042
  once() {
2646
- return () => {
2647
- };
2043
+ return ignoreMessage2;
2648
2044
  }
2649
- /** Drops a warning message. */
2045
+ /** Discards warnings. */
2650
2046
  warn() {
2651
- return () => {
2652
- };
2047
+ return ignoreMessage2;
2653
2048
  }
2654
- /** Drops an error message. */
2049
+ /** Discards errors. */
2655
2050
  error() {
2656
- return () => {
2657
- };
2658
- }
2659
- };
2660
- var ConsoleLog = class {
2661
- /** Console-like object used for message output. */
2662
- console;
2663
- /** Messages already emitted through `once`. */
2664
- onceMessages = /* @__PURE__ */ new Set();
2665
- /** Creates a console-backed logger. */
2666
- constructor() {
2667
- this.console = console;
2668
- }
2669
- /** Logs a message to the console. */
2670
- log(...args) {
2671
- return this.console.log.bind(this.console, ...args);
2672
- }
2673
- /** Logs an informational message to the console. */
2674
- info(...args) {
2675
- return this.console.info.bind(this.console, ...args);
2676
- }
2677
- /** Logs one message once to the console. */
2678
- once(...args) {
2679
- const message = String(args[0]);
2680
- if (this.onceMessages.has(message)) {
2681
- return () => {
2682
- };
2683
- }
2684
- this.onceMessages.add(message);
2685
- return this.console.info.bind(this.console, ...args);
2686
- }
2687
- /** Logs a warning message to the console. */
2688
- warn(...args) {
2689
- return this.console.warn.bind(this.console, ...args);
2690
- }
2691
- /** Logs an error message to the console. */
2692
- error(...args) {
2693
- return this.console.error.bind(this.console, ...args);
2051
+ return ignoreMessage2;
2694
2052
  }
2695
2053
  };
2054
+ function ignoreMessage2() {
2055
+ }
2056
+ var nullLog2 = new NullLog2();
2696
2057
 
2697
2058
  // dist/lib/loader-utils/option-defaults.js
2698
2059
  var DEFAULT_LOADER_OPTIONS = {
@@ -2706,8 +2067,7 @@ var DEFAULT_LOADER_OPTIONS = {
2706
2067
  ignoreRegisteredLoaders: void 0,
2707
2068
  nothrow: false,
2708
2069
  shape: void 0,
2709
- log: new ConsoleLog(),
2710
- // A probe.gl compatible (`log.log()()` syntax) that just logs to console
2070
+ log: log2,
2711
2071
  useLocalLibraries: false,
2712
2072
  subloaders: void 0,
2713
2073
  CDN: "https://unpkg.com/@loaders.gl",
@@ -2725,18 +2085,17 @@ var DEFAULT_LOADER_OPTIONS = {
2725
2085
  // By default do not support node workers
2726
2086
  _workerType: "",
2727
2087
  // 'test' to use locally generated workers
2728
- limit: 0,
2729
- _limitMB: 0,
2730
2088
  batchSize: "auto",
2731
- batchDebounceMs: 0,
2089
+ batchMaxRowsPerSecond: 0,
2732
2090
  metadata: false,
2733
2091
  // TODO - currently only implemented for parseInBatches, adds initial metadata batch,
2734
2092
  transforms: []
2735
2093
  }
2736
2094
  };
2737
2095
  var REMOVED_LOADER_OPTIONS = {
2738
- // deprecated top-level alias
2096
+ // Removed top-level aliases
2739
2097
  baseUri: "core.baseUrl",
2098
+ baseUrl: "core.baseUrl",
2740
2099
  fetch: "core.fetch",
2741
2100
  mimeType: "core.mimeType",
2742
2101
  fallbackMimeType: "core.fallbackMimeType",
@@ -2746,17 +2105,17 @@ var REMOVED_LOADER_OPTIONS = {
2746
2105
  useLocalLibraries: "core.useLocalLibraries",
2747
2106
  CDN: "core.CDN",
2748
2107
  worker: "core.worker",
2108
+ workerThreshold: "core.workerThreshold",
2109
+ workerTransferBufferCopy: "core.workerTransferBufferCopy",
2749
2110
  maxConcurrency: "core.maxConcurrency",
2750
2111
  maxMobileConcurrency: "core.maxMobileConcurrency",
2751
2112
  reuseWorkers: "core.reuseWorkers",
2752
- _nodeWorkers: "core.nodeWorkers",
2113
+ _nodeWorkers: "core._nodeWorkers",
2753
2114
  _workerType: "core._workerType",
2754
2115
  _worker: "core._workerType",
2755
- limit: "core.limit",
2756
- _limitMB: "core._limitMB",
2757
2116
  shape: "core.shape",
2758
2117
  batchSize: "core.batchSize",
2759
- batchDebounceMs: "core.batchDebounceMs",
2118
+ batchDebounceMs: "(removed; use core.batchMaxRowsPerSecond)",
2760
2119
  metadata: "core.metadata",
2761
2120
  transforms: "core.transforms",
2762
2121
  // Older deprecations
@@ -2778,33 +2137,50 @@ var REMOVED_LOADER_OPTIONS = {
2778
2137
  signal: "core.fetch.signal"
2779
2138
  };
2780
2139
 
2140
+ // dist/lib/loader-utils/native-arrow.js
2141
+ function getShapeOptionKey(loader) {
2142
+ const keys = Object.keys(loader.options || {}).filter((key) => {
2143
+ var _a;
2144
+ const value = (_a = loader.options) == null ? void 0 : _a[key];
2145
+ return key !== "core" && value && typeof value === "object" && "shape" in value;
2146
+ });
2147
+ return keys.includes(loader.id) ? loader.id : keys.length === 1 ? keys[0] : void 0;
2148
+ }
2149
+ function usesNativeArrowBatches(loader, options) {
2150
+ var _a;
2151
+ const key = getShapeOptionKey(loader);
2152
+ const scopedOptions = key && options[key];
2153
+ if (!scopedOptions || typeof scopedOptions !== "object" || !("shape" in scopedOptions) || scopedOptions.shape !== "arrow") {
2154
+ return false;
2155
+ }
2156
+ if ((_a = options.core) == null ? void 0 : _a.metadata) {
2157
+ throw new Error('shape: "arrow" carries metadata in the Arrow schema and does not support core.metadata envelopes');
2158
+ }
2159
+ return true;
2160
+ }
2161
+ async function* normalizeNativeArrowBatches(batches) {
2162
+ for await (const batch of batches) {
2163
+ const batchType = batch == null ? void 0 : batch.batchType;
2164
+ if (batchType === "metadata" || batchType === "partial-result" || batchType === "final-result") {
2165
+ continue;
2166
+ }
2167
+ if (isArrowRecordBatch(batch)) {
2168
+ yield batch;
2169
+ } else if (isArrowTable(batch)) {
2170
+ yield* batch.batches;
2171
+ } else {
2172
+ throw new Error('shape: "arrow" requires a native Arrow table or record batch');
2173
+ }
2174
+ }
2175
+ }
2176
+ function isArrowTable(value) {
2177
+ return Boolean(value && typeof value === "object" && "schema" in value && "batches" in value && Array.isArray(value.batches) && "numRows" in value && typeof value.numRows === "number" && "getChildAt" in value && typeof value.getChildAt === "function");
2178
+ }
2179
+ function isArrowRecordBatch(value) {
2180
+ return Boolean(value && typeof value === "object" && value[/* @__PURE__ */ Symbol.for("apache-arrow/RecordBatch")] === true);
2181
+ }
2182
+
2781
2183
  // dist/lib/loader-utils/option-utils.js
2782
- var CORE_LOADER_OPTION_KEYS = [
2783
- "baseUrl",
2784
- "fetch",
2785
- "mimeType",
2786
- "fallbackMimeType",
2787
- "ignoreRegisteredLoaders",
2788
- "nothrow",
2789
- "log",
2790
- "useLocalLibraries",
2791
- "CDN",
2792
- "worker",
2793
- "workerThreshold",
2794
- "maxConcurrency",
2795
- "maxMobileConcurrency",
2796
- "reuseWorkers",
2797
- "workerTransferBufferCopy",
2798
- "_nodeWorkers",
2799
- "_workerType",
2800
- "limit",
2801
- "_limitMB",
2802
- "shape",
2803
- "batchSize",
2804
- "batchDebounceMs",
2805
- "metadata",
2806
- "transforms"
2807
- ];
2808
2184
  function applySearchParamsToUrl(url, options) {
2809
2185
  const searchParams = options == null ? void 0 : options.searchParams;
2810
2186
  if (!searchParams || Object.keys(searchParams).length === 0 || /^(?:data|blob):/i.test(url)) {
@@ -2840,12 +2216,15 @@ function getGlobalLoaderOptions() {
2840
2216
  ...DEFAULT_LOADER_OPTIONS,
2841
2217
  core: { ...DEFAULT_LOADER_OPTIONS.core }
2842
2218
  };
2843
- return normalizeLoaderOptions(state.globalOptions);
2219
+ return cloneLoaderOptions(state.globalOptions);
2844
2220
  }
2845
2221
  function setGlobalOptions(options) {
2846
2222
  const state = getGlobalLoaderState();
2847
2223
  const globalOptions = getGlobalLoaderOptions();
2848
- state.globalOptions = normalizeOptionsInternal(globalOptions, options);
2224
+ validateOptions(options, []);
2225
+ validateWorkerThreshold(options);
2226
+ mergeNestedFields(globalOptions, options);
2227
+ state.globalOptions = globalOptions;
2849
2228
  registerJSModules(options.modules);
2850
2229
  }
2851
2230
  function normalizeOptions(options, loader, loaders, url) {
@@ -2853,23 +2232,10 @@ function normalizeOptions(options, loader, loaders, url) {
2853
2232
  loaders = Array.isArray(loaders) ? loaders : [loaders];
2854
2233
  validateOptions(options, loaders);
2855
2234
  validateWorkerThreshold(options);
2856
- const normalizedOptions = normalizeLoaderOptions(normalizeOptionsInternal(loader, options, url));
2235
+ const normalizedOptions = normalizeOptionsInternal(loader, options, url);
2857
2236
  validateWorkerThreshold(normalizedOptions);
2858
2237
  return normalizedOptions;
2859
2238
  }
2860
- function normalizeLoaderOptions(options) {
2861
- const normalized = cloneLoaderOptions(options);
2862
- moveDeprecatedTopLevelOptionsToCore(normalized);
2863
- for (const key of CORE_LOADER_OPTION_KEYS) {
2864
- if (normalized.core && normalized.core[key] !== void 0) {
2865
- delete normalized[key];
2866
- }
2867
- }
2868
- if (normalized.core && normalized.core._workerType !== void 0) {
2869
- delete normalized._worker;
2870
- }
2871
- return normalized;
2872
- }
2873
2239
  function validateOptions(options, loaders) {
2874
2240
  validateOptionsObject(options, null, DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS, loaders);
2875
2241
  for (const loader of loaders) {
@@ -2891,17 +2257,17 @@ function validateOptionsObject(options, id, defaultOptions, deprecatedOptions, l
2891
2257
  const prefix = id ? `${id}.` : "";
2892
2258
  for (const key in options) {
2893
2259
  const isSubOptions = !id && isObject(options[key]);
2894
- const isBaseUriOption = !id && ["baseUri", "signal", "onProgress"].includes(key);
2260
+ const isLifecycleOption = !id && ["signal", "onProgress"].includes(key);
2895
2261
  const isWorkerUrlOption = key === "workerUrl" && id;
2896
- if (!(key in defaultOptions) && !isBaseUriOption && !isWorkerUrlOption) {
2262
+ if (!(key in defaultOptions) && !isLifecycleOption && !isWorkerUrlOption) {
2897
2263
  if (key in deprecatedOptions) {
2898
- if (probeLog.level > 0) {
2899
- probeLog.warn(`${loaderName} loader option '${prefix}${key}' no longer supported, use '${deprecatedOptions[key]}'`)();
2264
+ if (log2.level > 0) {
2265
+ log2.warn(`${loaderName} loader option '${prefix}${key}' no longer supported, use '${deprecatedOptions[key]}'`)();
2900
2266
  }
2901
2267
  } else if (!isSubOptions) {
2902
- if (probeLog.level > 0) {
2268
+ if (log2.level > 0) {
2903
2269
  const suggestion = findSimilarOption(key, loaders);
2904
- probeLog.warn(`${loaderName} loader option '${prefix}${key}' not recognized. ${suggestion}`)();
2270
+ log2.warn(`${loaderName} loader option '${prefix}${key}' not recognized. ${suggestion}`)();
2905
2271
  }
2906
2272
  }
2907
2273
  }
@@ -2931,16 +2297,20 @@ function normalizeOptionsInternal(loader, options, url) {
2931
2297
  if (loaderDefaultOptions.core) {
2932
2298
  mergedOptions.core = { ...loaderDefaultOptions.core };
2933
2299
  }
2934
- moveDeprecatedTopLevelOptionsToCore(mergedOptions);
2300
+ const shapeKey = loader.defaultShape && getShapeOptionKey(loader);
2301
+ if (shapeKey) {
2302
+ mergedOptions[shapeKey] = {
2303
+ ...loaderDefaultOptions[shapeKey],
2304
+ shape: loader.defaultShape
2305
+ };
2306
+ }
2307
+ mergeNestedFields(mergedOptions, getGlobalLoaderOptions());
2308
+ mergeNestedFields(mergedOptions, options);
2309
+ applyCoreShapeDefault(mergedOptions, options, loader);
2935
2310
  if (((_a = mergedOptions.core) == null ? void 0 : _a.log) === null) {
2936
- mergedOptions.core = { ...mergedOptions.core, log: new NullLog() };
2311
+ mergedOptions.core = { ...mergedOptions.core, log: getLoaderLog(mergedOptions) };
2937
2312
  }
2938
- mergeNestedFields(mergedOptions, normalizeLoaderOptions(getGlobalLoaderOptions()));
2939
- const userOptions = normalizeLoaderOptions(options);
2940
- mergeNestedFields(mergedOptions, userOptions);
2941
- applyCoreShapeDefault(mergedOptions, userOptions, loader);
2942
2313
  addUrlOptions(mergedOptions, url);
2943
- addDeprecatedTopLevelOptions(mergedOptions);
2944
2314
  return mergedOptions;
2945
2315
  }
2946
2316
  function applyCoreShapeDefault(mergedOptions, userOptions, loader) {
@@ -2949,20 +2319,24 @@ function applyCoreShapeDefault(mergedOptions, userOptions, loader) {
2949
2319
  if (coreShape === void 0) {
2950
2320
  return;
2951
2321
  }
2952
- const loaderScopedDefaults = (_b = loader.options) == null ? void 0 : _b[loader.id];
2322
+ const shapeOptionKey = getShapeOptionKey(loader);
2323
+ if (!shapeOptionKey) {
2324
+ return;
2325
+ }
2326
+ const loaderScopedDefaults = (_b = loader.options) == null ? void 0 : _b[shapeOptionKey];
2953
2327
  if (!isPureObject(loaderScopedDefaults) || !("shape" in loaderScopedDefaults)) {
2954
2328
  return;
2955
2329
  }
2956
- const globalLoaderScopedOptions = getGlobalLoaderOptions()[loader.id];
2330
+ const globalLoaderScopedOptions = getGlobalLoaderOptions()[shapeOptionKey];
2957
2331
  if (isPureObject(globalLoaderScopedOptions) && "shape" in globalLoaderScopedOptions) {
2958
2332
  return;
2959
2333
  }
2960
- const userLoaderScopedOptions = userOptions[loader.id];
2334
+ const userLoaderScopedOptions = userOptions[shapeOptionKey];
2961
2335
  if (isPureObject(userLoaderScopedOptions) && "shape" in userLoaderScopedOptions) {
2962
2336
  return;
2963
2337
  }
2964
- const loaderScopedOptions = mergedOptions[loader.id];
2965
- mergedOptions[loader.id] = {
2338
+ const loaderScopedOptions = mergedOptions[shapeOptionKey];
2339
+ mergedOptions[shapeOptionKey] = {
2966
2340
  ...isPureObject(loaderScopedOptions) ? loaderScopedOptions : {},
2967
2341
  shape: coreShape
2968
2342
  };
@@ -3000,41 +2374,46 @@ function cloneLoaderOptions(options) {
3000
2374
  }
3001
2375
  return clonedOptions;
3002
2376
  }
3003
- function moveDeprecatedTopLevelOptionsToCore(options) {
3004
- if (options.baseUri !== void 0) {
3005
- options.core ||= {};
3006
- if (options.core.baseUrl === void 0) {
3007
- options.core.baseUrl = options.baseUri;
3008
- }
2377
+
2378
+ // dist/lib/api/loader-options.js
2379
+ function compareLoaderOptions(left, right) {
2380
+ return Object.is(left, right) || compareOptionValues(left, right, /* @__PURE__ */ new WeakMap());
2381
+ }
2382
+ function compareOptionValues(left, right, visited) {
2383
+ if (Object.is(left, right)) {
2384
+ return true;
3009
2385
  }
3010
- for (const key of CORE_LOADER_OPTION_KEYS) {
3011
- if (options[key] !== void 0) {
3012
- options.core ||= {};
3013
- const coreOptions = options.core;
3014
- const coreRecord = coreOptions;
3015
- if (coreRecord[key] === void 0) {
3016
- coreRecord[key] = options[key];
3017
- }
3018
- }
2386
+ if (!left || !right || typeof left !== "object" || typeof right !== "object") {
2387
+ return false;
3019
2388
  }
3020
- const workerTypeAlias = options._worker;
3021
- if (workerTypeAlias !== void 0) {
3022
- options.core ||= {};
3023
- if (options.core._workerType === void 0) {
3024
- options.core._workerType = workerTypeAlias;
2389
+ const leftPrototype = Object.getPrototypeOf(left);
2390
+ if (leftPrototype !== Object.getPrototypeOf(right)) {
2391
+ return false;
2392
+ }
2393
+ if (Array.isArray(left)) {
2394
+ if (!Array.isArray(right) || left.length !== right.length) {
2395
+ return false;
3025
2396
  }
2397
+ } else if (leftPrototype !== Object.prototype && leftPrototype !== null) {
2398
+ return false;
3026
2399
  }
3027
- }
3028
- function addDeprecatedTopLevelOptions(options) {
3029
- const coreOptions = options.core;
3030
- if (!coreOptions) {
3031
- return;
2400
+ let rightValues = visited.get(left);
2401
+ if (rightValues == null ? void 0 : rightValues.has(right)) {
2402
+ return true;
3032
2403
  }
3033
- for (const key of CORE_LOADER_OPTION_KEYS) {
3034
- if (coreOptions[key] !== void 0) {
3035
- options[key] = coreOptions[key];
3036
- }
2404
+ if (!rightValues) {
2405
+ rightValues = /* @__PURE__ */ new WeakSet();
2406
+ visited.set(left, rightValues);
3037
2407
  }
2408
+ rightValues.add(right);
2409
+ const leftKeys = getEnumerableKeys(left);
2410
+ const rightKeys = getEnumerableKeys(right);
2411
+ const leftOptions = left;
2412
+ const rightOptions = right;
2413
+ return leftKeys.length === rightKeys.length && leftKeys.every((key) => Object.prototype.propertyIsEnumerable.call(right, key) && compareOptionValues(leftOptions[key], rightOptions[key], visited));
2414
+ }
2415
+ function getEnumerableKeys(value) {
2416
+ return Reflect.ownKeys(value).filter((key) => Object.prototype.propertyIsEnumerable.call(value, key));
3038
2417
  }
3039
2418
 
3040
2419
  // dist/lib/loader-utils/normalize-loader.js
@@ -3095,32 +2474,30 @@ function _unregisterLoaders() {
3095
2474
 
3096
2475
  // dist/lib/api/select-loader.js
3097
2476
  var EXT_PATTERN = /\.([^.]+)$/;
3098
- async function selectLoader(data, loaders = [], options, context) {
2477
+ async function selectLoader(data, loaders = [], options, context, operation = "parse") {
2478
+ var _a, _b;
3099
2479
  if (!validHTTPResponse(data)) {
3100
2480
  return null;
3101
2481
  }
3102
- const normalizedOptions = normalizeLoaderOptions(options || {});
3103
- normalizedOptions.core ||= {};
3104
- if (data instanceof Response && mayContainText(data)) {
3105
- const text = await data.clone().text();
3106
- const textLoader = selectLoaderSync(text, loaders, { ...normalizedOptions, core: { ...normalizedOptions.core, nothrow: true } }, context);
3107
- if (textLoader) {
3108
- return textLoader;
3109
- }
3110
- }
3111
- let loader = selectLoaderSync(data, loaders, { ...normalizedOptions, core: { ...normalizedOptions.core, nothrow: true } }, context);
3112
- if (loader) {
3113
- return loader;
2482
+ if (loaders && !Array.isArray(loaders)) {
2483
+ return normalizeLoader(loaders);
3114
2484
  }
3115
- if (isBlob(data)) {
3116
- data = await data.slice(0, 10).arrayBuffer();
3117
- loader = selectLoaderSync(data, loaders, normalizedOptions, context);
2485
+ const text = data instanceof Response && mayContainText(data) ? await data.clone().text() : null;
2486
+ let initialBytes;
2487
+ async function matchCandidates(candidates) {
2488
+ normalizeLoaders(candidates);
2489
+ const loader2 = text !== null && selectLoaderInternal(text, candidates, options, context, operation) || selectLoaderInternal(data, candidates, options, context, operation);
2490
+ if (!loader2 && isBlob(data) && candidates.length) {
2491
+ initialBytes ??= await data.slice(0, 10).arrayBuffer();
2492
+ return selectLoaderInternal(initialBytes, candidates, options, context, operation);
2493
+ }
2494
+ return loader2;
3118
2495
  }
3119
- if (!loader && data instanceof Response && mayContainText(data)) {
3120
- const text = await data.clone().text();
3121
- loader = selectLoaderSync(text, loaders, normalizedOptions, context);
2496
+ let loader = await matchCandidates(loaders || []);
2497
+ if (!loader && !((_a = options == null ? void 0 : options.core) == null ? void 0 : _a.ignoreRegisteredLoaders)) {
2498
+ loader = await matchCandidates(getRegisteredLoaders());
3122
2499
  }
3123
- if (!loader && !normalizedOptions.core.nothrow) {
2500
+ if (!loader && !((_b = options == null ? void 0 : options.core) == null ? void 0 : _b.nothrow)) {
3124
2501
  throw new Error(getNoValidLoaderMessage(data));
3125
2502
  }
3126
2503
  return loader;
@@ -3129,30 +2506,26 @@ function mayContainText(response) {
3129
2506
  const mimeType = getResourceMIMEType(response);
3130
2507
  return Boolean(mimeType && (mimeType.startsWith("text/") || mimeType === "application/json" || mimeType.endsWith("+json")));
3131
2508
  }
3132
- function selectLoaderSync(data, loaders = [], options, context) {
2509
+ function selectLoaderSync(data, loaders = [], options, context, operation = "parse") {
2510
+ var _a, _b;
3133
2511
  if (!validHTTPResponse(data)) {
3134
2512
  return null;
3135
2513
  }
3136
- const normalizedOptions = normalizeLoaderOptions(options || {});
3137
- normalizedOptions.core ||= {};
3138
2514
  if (loaders && !Array.isArray(loaders)) {
3139
2515
  return normalizeLoader(loaders);
3140
2516
  }
3141
- let candidateLoaders = [];
3142
- if (loaders) {
3143
- candidateLoaders = candidateLoaders.concat(loaders);
3144
- }
3145
- if (!normalizedOptions.core.ignoreRegisteredLoaders) {
3146
- candidateLoaders.push(...getRegisteredLoaders());
2517
+ const candidates = loaders || [];
2518
+ normalizeLoaders(candidates);
2519
+ let loader = selectLoaderInternal(data, candidates, options, context, operation);
2520
+ if (!loader && !((_a = options == null ? void 0 : options.core) == null ? void 0 : _a.ignoreRegisteredLoaders)) {
2521
+ loader = selectLoaderInternal(data, getRegisteredLoaders(), options, context, operation);
3147
2522
  }
3148
- normalizeLoaders(candidateLoaders);
3149
- const loader = selectLoaderInternal(data, candidateLoaders, normalizedOptions, context);
3150
- if (!loader && !normalizedOptions.core.nothrow) {
2523
+ if (!loader && !((_b = options == null ? void 0 : options.core) == null ? void 0 : _b.nothrow)) {
3151
2524
  throw new Error(getNoValidLoaderMessage(data));
3152
2525
  }
3153
2526
  return loader;
3154
2527
  }
3155
- function selectLoaderInternal(data, loaders, options, context) {
2528
+ function selectLoaderInternal(data, loaders, options, context, operation = "parse") {
3156
2529
  var _a, _b, _c, _d, _e;
3157
2530
  const url = getResourceUrl(data);
3158
2531
  const type = getResourceMIMEType(data);
@@ -3168,20 +2541,27 @@ function selectLoaderInternal(data, loaders, options, context) {
3168
2541
  loader = findLoaderByMIMEType(loaders, (_b = options == null ? void 0 : options.core) == null ? void 0 : _b.mimeType);
3169
2542
  reason = `match forced by supplied MIME type ${(_c = options == null ? void 0 : options.core) == null ? void 0 : _c.mimeType}`;
3170
2543
  }
3171
- loader = loader || findSourceLoaderByTestURL(loaders, testUrl);
3172
- reason = reason || (loader ? `matched source url ${testUrl}` : "");
3173
- loader = loader || findLoaderByUrl(loaders, testUrl);
2544
+ if (!loader && operation === "source") {
2545
+ loader = findSourceLoaderByTestURL(loaders, testUrl);
2546
+ reason = loader ? `matched source url ${testUrl}` : "";
2547
+ }
2548
+ const fallbackLoaders = operation === "source" && testUrl ? loaders.filter((candidate) => !candidate.testURL) : loaders;
2549
+ loader = loader || findLoaderByUrl(fallbackLoaders, testUrl);
3174
2550
  reason = reason || (loader ? `matched url ${testUrl}` : "");
3175
- loader = loader || findLoaderByMIMEType(loaders, type);
2551
+ if (!loader && operation === "parse") {
2552
+ loader = findSourceLoaderByTestURL(loaders, testUrl);
2553
+ reason = loader ? `matched source url ${testUrl}` : "";
2554
+ }
2555
+ loader = loader || findLoaderByMIMEType(fallbackLoaders, type);
3176
2556
  reason = reason || (loader ? `matched MIME type ${type}` : "");
3177
- loader = loader || findLoaderByInitialBytes(loaders, data);
2557
+ loader = loader || findLoaderByInitialBytes(fallbackLoaders, data);
3178
2558
  reason = reason || (loader ? `matched initial data ${getFirstCharacters(data)}` : "");
3179
2559
  if (!loader && isBlob(data)) {
3180
2560
  loader = findSourceLoaderByTestData(loaders, data);
3181
2561
  reason = reason || (loader ? "matched source testData" : "");
3182
2562
  }
3183
2563
  if ((_d = options == null ? void 0 : options.core) == null ? void 0 : _d.fallbackMimeType) {
3184
- loader = loader || findLoaderByMIMEType(loaders, (_e = options == null ? void 0 : options.core) == null ? void 0 : _e.fallbackMimeType);
2564
+ loader = loader || findLoaderByMIMEType(fallbackLoaders, (_e = options == null ? void 0 : options.core) == null ? void 0 : _e.fallbackMimeType);
3185
2565
  reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
3186
2566
  }
3187
2567
  if (reason) {
@@ -3231,18 +2611,19 @@ function findLoaderByExtension(loaders, extension) {
3231
2611
  }
3232
2612
  function findSourceLoaderByType(loaders, type) {
3233
2613
  for (const loader of loaders) {
3234
- if (isSourceLoader(loader) && loader.type === type) {
2614
+ if ((loader.type ?? loader.id) === type) {
3235
2615
  return loader;
3236
2616
  }
3237
2617
  }
3238
2618
  return null;
3239
2619
  }
3240
2620
  function findSourceLoaderByTestURL(loaders, url) {
2621
+ var _a;
3241
2622
  if (!url) {
3242
2623
  return null;
3243
2624
  }
3244
2625
  for (const loader of loaders) {
3245
- if (isSourceLoader(loader) && loader.testURL(url)) {
2626
+ if ((_a = loader.testURL) == null ? void 0 : _a.call(loader, url)) {
3246
2627
  return loader;
3247
2628
  }
3248
2629
  }
@@ -3251,7 +2632,7 @@ function findSourceLoaderByTestURL(loaders, url) {
3251
2632
  function findSourceLoaderByTestData(loaders, data) {
3252
2633
  var _a;
3253
2634
  for (const loader of loaders) {
3254
- if (isSourceLoader(loader)) {
2635
+ if (loader.testData) {
3255
2636
  if ((_a = loader.testData) == null ? void 0 : _a.call(loader, data)) {
3256
2637
  return loader;
3257
2638
  }
@@ -3585,7 +2966,7 @@ function getFetchFunction(options, context) {
3585
2966
  var _a, _b, _c;
3586
2967
  const globalOptions = getGlobalLoaderOptions();
3587
2968
  const loaderOptions = options || globalOptions;
3588
- const fetchOption = loaderOptions.fetch ?? ((_a = loaderOptions.core) == null ? void 0 : _a.fetch);
2969
+ const fetchOption = (_a = loaderOptions.core) == null ? void 0 : _a.fetch;
3589
2970
  let fetchFunction;
3590
2971
  if (typeof fetchOption === "function") {
3591
2972
  fetchFunction = fetchOption;
@@ -3611,14 +2992,7 @@ var loaderImplementationPromises = /* @__PURE__ */ new Map();
3611
2992
  var loaderImplementations = /* @__PURE__ */ new Map();
3612
2993
  async function getLoaderImplementation(loader, options, url) {
3613
2994
  var _a;
3614
- if (isSourceLoader(loader)) {
3615
- const source = loader.preload ? await loader.preload(url || "", options) : loader;
3616
- if (!isSourceLoader(source)) {
3617
- throw new Error(`${loader.id} source loader preload() did not return a runtime source loader`);
3618
- }
3619
- return source;
3620
- }
3621
- if (isLoaderWithParser(loader)) {
2995
+ if (isLoaderWithParser(loader) || !loader.preload && loader.createDataSourceSync) {
3622
2996
  return loader;
3623
2997
  }
3624
2998
  const implementationCacheKey = getLoaderImplementationCacheKey(loader, options);
@@ -3652,7 +3026,7 @@ async function getLoaderImplementation(loader, options, url) {
3652
3026
  }
3653
3027
  return await loaderImplementationPromise;
3654
3028
  }
3655
- function getLoaderImplementationSync(loader) {
3029
+ function getLoaderImplementationSync(loader, options) {
3656
3030
  var _a;
3657
3031
  if (loader.subloaders && !preparedLoaders.has(loader)) {
3658
3032
  const prepared = preparedDefaults.get(loader);
@@ -3661,30 +3035,30 @@ function getLoaderImplementationSync(loader) {
3661
3035
  if (!isLoaderWithParser(loader))
3662
3036
  return null;
3663
3037
  }
3664
- if (isLoaderWithParser(loader)) {
3038
+ if (isLoaderWithParser(loader) || !loader.preload && loader.createDataSourceSync) {
3665
3039
  return loader;
3666
3040
  }
3667
- const implementationCacheKey = getLoaderImplementationCacheKey(loader);
3041
+ const implementationCacheKey = getLoaderImplementationCacheKey(loader, options);
3668
3042
  return ((_a = loaderImplementations.get(loader)) == null ? void 0 : _a.get(implementationCacheKey)) || null;
3669
3043
  }
3670
3044
  function isLoaderWithParser(loader) {
3671
3045
  const candidate = loader;
3672
- return Boolean(candidate.parse || candidate.parseSync || candidate.parseInBatches || candidate.parseText || candidate.parseTextSync || candidate.parseFile || candidate.parseFileInBatches);
3046
+ return Boolean(candidate.parse || candidate.parseBlob || candidate.parseUrl || candidate.parseSync || candidate.parseInBatches || candidate.parseText || candidate.parseTextSync || candidate.parseFile || candidate.parseFileInBatches);
3673
3047
  }
3674
3048
  async function resolveLoaderImplementation(loader, options, url) {
3675
3049
  if (loader.preload) {
3676
3050
  const preloadedLoader = await loader.preload(url || "", options);
3677
- if (isLoaderWithParser(preloadedLoader)) {
3051
+ if (preloadedLoader && (isLoaderWithParser(preloadedLoader) || preloadedLoader.createDataSourceSync)) {
3678
3052
  return preloadedLoader;
3679
3053
  }
3680
- throw new Error(`${loader.id} loader preload() did not return a parser-bearing loader`);
3054
+ throw new Error(`${loader.id} loader preload() did not return a parser-bearing loader or a source factory`);
3681
3055
  }
3682
3056
  const implementationSpecifier = getLoaderImplementationSpecifier(loader, options);
3683
3057
  return await importLoaderImplementation(implementationSpecifier, loader.id);
3684
3058
  }
3685
3059
  function getLoaderImplementationSpecifier(loader, options) {
3686
3060
  var _a;
3687
- const workerType = (options == null ? void 0 : options._workerType) || ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._workerType);
3061
+ const workerType = (_a = options == null ? void 0 : options.core) == null ? void 0 : _a._workerType;
3688
3062
  if (workerType === "test") {
3689
3063
  const sourcePath = `modules/${loader.module}/src/${loader.id}-loader.ts`;
3690
3064
  if (typeof window !== "undefined") {
@@ -3773,7 +3147,7 @@ async function bindSubloaders(loader, options, url) {
3773
3147
  prepared.worker = false;
3774
3148
  for (const method of [
3775
3149
  "parseBlob",
3776
- "createDataSource",
3150
+ "createDataSourceSync",
3777
3151
  "parse",
3778
3152
  "parseSync",
3779
3153
  "parseText",
@@ -3821,9 +3195,6 @@ async function parseFile(file, loaders, options, context) {
3821
3195
  if (!loader) {
3822
3196
  return null;
3823
3197
  }
3824
- if (isSourceLoader(loader)) {
3825
- throw new Error(`${loader.id} is a SourceLoader. Use load() to create a runtime source object instead of parseFile().`);
3826
- }
3827
3198
  const normalizedOptions = normalizeOptions(options, loader, candidateLoaders, url);
3828
3199
  const authenticationLoader = !loader.getAuthentications && ((_c = (_b = normalizedOptions.core) == null ? void 0 : _b.credentials) == null ? void 0 : _c.length) ? await getLoaderImplementation(loader, normalizedOptions, url || (context == null ? void 0 : context.url)) : loader;
3829
3200
  const strictOptions = await resolveLoaderAuthenticationOptions(authenticationLoader, url, normalizedOptions);
@@ -3833,16 +3204,18 @@ async function parseFile(file, loaders, options, context) {
3833
3204
  strictOptions,
3834
3205
  context || null
3835
3206
  );
3836
- return await parseFileWithLoader(loader, file, strictOptions, context);
3207
+ return parseFileWithLoader(loader, file, strictOptions, context);
3837
3208
  }
3838
3209
  async function parseFileWithLoader(loader, file, options, context) {
3839
- var _a;
3210
+ var _a, _b;
3840
3211
  (_a = options.signal || context.signal) == null ? void 0 : _a.throwIfAborted();
3841
3212
  validateWorkerVersion(loader);
3842
3213
  options = mergeOptions(loader.options, options);
3843
3214
  const loaderWithParser = await getLoaderImplementation(loader, options, context.url);
3844
3215
  if (loaderWithParser.parseFile) {
3845
- return await loaderWithParser.parseFile(file, options, context);
3216
+ const output = (_b = loaderWithParser.prepareParseOutput) == null ? void 0 : _b.call(loaderWithParser, options);
3217
+ const result = await loaderWithParser.parseFile(file, (output == null ? void 0 : output.options) ?? options, context);
3218
+ return output ? output.convert(result) : result;
3846
3219
  }
3847
3220
  const parseFunction = loaderWithParser.parse;
3848
3221
  if (parseFunction) {
@@ -3853,6 +3226,9 @@ async function parseFileWithLoader(loader, file, options, context) {
3853
3226
  const data = await file.read(0n, length);
3854
3227
  return await parse(data, loaderWithParser, options, context);
3855
3228
  }
3229
+ if (loaderWithParser.createDataSourceSync) {
3230
+ throw new Error(`${loader.id} has no file parser. Use createDataSource() to open a source.`);
3231
+ }
3856
3232
  throw new Error(`${loader.id} loader - no file parser found`);
3857
3233
  }
3858
3234
 
@@ -3870,9 +3246,6 @@ function parseSync(data, loaders, options, context) {
3870
3246
  if (!loader) {
3871
3247
  return null;
3872
3248
  }
3873
- if (isSourceLoader(loader)) {
3874
- throw new Error(`${loader.id} is a SourceLoader. Use load() to create a runtime source object instead of parseSync().`);
3875
- }
3876
3249
  const strictOptions = normalizeOptions(options, loader, candidateLoaders);
3877
3250
  const url = getResourceUrl(data);
3878
3251
  const parse2 = () => {
@@ -3893,6 +3266,9 @@ function parseWithLoaderSync(loader, data, options, context) {
3893
3266
  if (loader.preload) {
3894
3267
  throw new Error(`${loader.name} loader: 'parseSync' requires a parser-bearing loader. Import the loader implementation directly, or call preload(loader) before parseSync(). ${context.url || ""}`);
3895
3268
  }
3269
+ if (loader.createDataSourceSync) {
3270
+ throw new Error(`${loader.id} has no synchronous parser. Use createDataSource() to open a source.`);
3271
+ }
3896
3272
  throw new Error(`${loader.name} loader: 'parseSync' not supported by this loader, use 'parse' instead. ${context.url || ""}`);
3897
3273
  }
3898
3274
 
@@ -3917,14 +3293,29 @@ async function parseInBatches(data, loaders, options, context) {
3917
3293
  const normalizedOptions = normalizeOptions(options, loader, loaderArray, url);
3918
3294
  const authenticationLoader = !loader.getAuthentications && ((_d = (_c = normalizedOptions.core) == null ? void 0 : _c.credentials) == null ? void 0 : _d.length) ? await getLoaderImplementation(loader, normalizedOptions, url || (context == null ? void 0 : context.url)) : loader;
3919
3295
  const strictOptions = await resolveLoaderAuthenticationOptions(authenticationLoader, url || "", normalizedOptions);
3296
+ const nativeArrow = usesNativeArrowBatches(loader, strictOptions);
3920
3297
  context = getLoaderContext({ url, _parseInBatches: parseInBatches, _parse: parse, loaders: loaderArray }, strictOptions, context || null);
3921
3298
  const loaderWithParser = await getLoaderImplementation(loader, strictOptions, context.url);
3922
- return await parseWithLoaderInBatches(loader, loaderWithParser, data, strictOptions, context);
3299
+ const batches = await parseWithLoaderInBatches(loader, loaderWithParser, data, strictOptions, context);
3300
+ return nativeArrow ? normalizeNativeArrowBatches(batches) : batches;
3923
3301
  }
3924
3302
  async function parseWithLoaderInBatches(originalLoader, loader, data, options, context) {
3925
- var _a;
3926
- const outputIterator = await parseToOutputIterator(loader, data, options, context);
3927
- if (!((_a = options == null ? void 0 : options.core) == null ? void 0 : _a.metadata)) {
3303
+ var _a, _b;
3304
+ const { batchMaxRowsPerSecond = 0, batchSize } = options.core ?? {};
3305
+ validateBatchDeliveryRate(batchMaxRowsPerSecond);
3306
+ if (batchSize !== void 0 && batchSize !== "auto" && (!Number.isSafeInteger(batchSize) || batchSize < 1)) {
3307
+ throw new RangeError('core.batchSize must be a positive integer or "auto"');
3308
+ }
3309
+ const parserOptions = batchMaxRowsPerSecond ? { ...options, core: { ...options.core, batchMaxRowsPerSecond: 0 } } : options;
3310
+ const output = loader.parseInBatches ? (_a = loader.prepareParseBatchOutput) == null ? void 0 : _a.call(loader, parserOptions) : null;
3311
+ const decoded = await parseToOutputIterator(loader, data, (output == null ? void 0 : output.options) ?? parserOptions, context);
3312
+ const batches = output ? convertOutputBatches(decoded, output.convert) : decoded;
3313
+ const outputIterator = batchMaxRowsPerSecond ? paceBatchIterator(batches, {
3314
+ batchMaxRowsPerSecond,
3315
+ getRowCount: (batch) => getBatchRowCount(batch, loader.module),
3316
+ signal: options.signal ?? context.signal
3317
+ }) : batches;
3318
+ if (!((_b = options == null ? void 0 : options.core) == null ? void 0 : _b.metadata)) {
3928
3319
  return outputIterator;
3929
3320
  }
3930
3321
  const metadataBatch = {
@@ -3944,6 +3335,11 @@ async function parseWithLoaderInBatches(originalLoader, loader, data, options, c
3944
3335
  }
3945
3336
  return makeMetadataBatchIterator(outputIterator);
3946
3337
  }
3338
+ async function* convertOutputBatches(batches, convert) {
3339
+ for await (const batch of batches) {
3340
+ yield convert(batch);
3341
+ }
3342
+ }
3947
3343
  async function parseToOutputIterator(loader, data, options, context) {
3948
3344
  var _a;
3949
3345
  const inputIterator = await getAsyncIterableFromData(data, options);
@@ -3965,6 +3361,10 @@ async function* parseChunkInBatches(transformedIterator, loader, options, contex
3965
3361
  { ...options, core: { ...options == null ? void 0 : options.core, mimeType: loader.mimeTypes[0] } },
3966
3362
  context
3967
3363
  );
3364
+ if (isArrowTable(parsedData)) {
3365
+ yield* parsedData.batches;
3366
+ return;
3367
+ }
3968
3368
  const batch = convertDataToBatch(parsedData, loader);
3969
3369
  yield batch;
3970
3370
  }
@@ -3991,8 +3391,6 @@ function isTable(value) {
3991
3391
  return Array.isArray(table.features);
3992
3392
  case "columnar-table":
3993
3393
  return Boolean(table.data && typeof table.data === "object");
3994
- case "arrow-table":
3995
- return Boolean(table.data && typeof table.data === "object" && "numRows" in table.data);
3996
3394
  default:
3997
3395
  return false;
3998
3396
  }
@@ -4004,8 +3402,6 @@ function getTableLength(table) {
4004
3402
  return table.data.length;
4005
3403
  case "geojson-table":
4006
3404
  return table.features.length;
4007
- case "arrow-table":
4008
- return table.data.numRows;
4009
3405
  case "columnar-table":
4010
3406
  for (const column of Object.values(table.data)) {
4011
3407
  return column.length || 0;
@@ -4020,38 +3416,21 @@ async function applyInputTransforms(inputIterator, transforms = []) {
4020
3416
  }
4021
3417
  return iteratorChain;
4022
3418
  }
4023
-
4024
- // dist/lib/api/load-in-batches.js
4025
- function loadInBatches(files, loaders, options, context) {
4026
- let loadersArray;
4027
- if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
4028
- context = void 0;
4029
- options = loaders;
4030
- loadersArray = void 0;
4031
- } else {
4032
- loadersArray = loaders;
4033
- }
4034
- if (!Array.isArray(files)) {
4035
- return loadOneFileInBatches(files, loadersArray, options || {});
4036
- }
4037
- const promises = files.map((file) => loadOneFileInBatches(file, loadersArray, options || {}));
4038
- return promises;
4039
- }
4040
- async function loadOneFileInBatches(file, loaders, options) {
4041
- var _a, _b;
4042
- if (typeof file === "string") {
4043
- const url = file;
4044
- const loader = await selectLoader(url, loaders, {
4045
- ...options,
4046
- core: { ...options.core, nothrow: true }
4047
- });
4048
- const authenticationLoader = loader && !loader.getAuthentications && ((_b = (_a = options.core) == null ? void 0 : _a.credentials) == null ? void 0 : _b.length) ? await getLoaderImplementation(loader, options, url) : loader;
4049
- options = await resolveLoaderAuthenticationOptions(authenticationLoader, url, options);
4050
- const fetch2 = getFetchFunction(options);
4051
- const response = await fetch2(applySearchParamsToUrl(url, options));
4052
- return Array.isArray(loaders) ? await parseInBatches(response, loaders, options) : await parseInBatches(response, loaders, options);
4053
- }
4054
- return Array.isArray(loaders) ? await parseInBatches(file, loaders, options) : await parseInBatches(file, loaders, options);
3419
+ function getBatchRowCount(batch, module2) {
3420
+ var _a, _b, _c;
3421
+ if (!batch || typeof batch !== "object")
3422
+ return void 0;
3423
+ if (module2 === "geospatial" && Array.isArray(batch))
3424
+ return batch.length;
3425
+ const result = batch;
3426
+ if (module2 === "traces" && result.table !== void 0 && result.table !== "spans" && result.table !== "slices") {
3427
+ return void 0;
3428
+ }
3429
+ if (result.batchType !== void 0 && result.batchType !== "data")
3430
+ return void 0;
3431
+ if (result.shape === "unknown")
3432
+ return void 0;
3433
+ return ((_a = result.data) == null ? void 0 : _a.numRows) ?? result.numRows ?? ((_b = result.header) == null ? void 0 : _b.vertexCount) ?? ((_c = result.features) == null ? void 0 : _c.length) ?? result.length;
4055
3434
  }
4056
3435
 
4057
3436
  // dist/lib/api/load.js
@@ -4068,59 +3447,22 @@ async function load(url, loaders, options, context) {
4068
3447
  resolvedOptions = options;
4069
3448
  }
4070
3449
  resolvedOptions ||= getGlobalLoaderOptions();
4071
- if (!Array.isArray(resolvedLoaders) && isSourceLoader(resolvedLoaders)) {
4072
- const sourceLoader = await resolveSourceLoader(resolvedLoaders, url, resolvedOptions);
4073
- resolvedOptions = await resolveLoaderAuthenticationOptions(resolvedLoaders.getAuthentications ? resolvedLoaders : sourceLoader, typeof url === "string" ? url : "", resolvedOptions || {});
4074
- const runtimeCoreApi = {
4075
- fetchFile,
4076
- parse,
4077
- parseFile,
4078
- parseSync,
4079
- parseInBatches,
4080
- load,
4081
- loadInBatches
4082
- };
4083
- return sourceLoader.createDataSource(url, resolvedOptions || {}, runtimeCoreApi);
4084
- }
4085
- if (Array.isArray(resolvedLoaders) && resolvedLoaders.length === 1 && isSourceLoader(resolvedLoaders[0])) {
4086
- const sourceLoader = await resolveSourceLoader(resolvedLoaders[0], url, resolvedOptions);
4087
- resolvedOptions = await resolveLoaderAuthenticationOptions(resolvedLoaders[0].getAuthentications ? resolvedLoaders[0] : sourceLoader, typeof url === "string" ? url : "", resolvedOptions || {});
4088
- const runtimeCoreApi = {
4089
- fetchFile,
4090
- parse,
4091
- parseFile,
4092
- parseSync,
4093
- parseInBatches,
4094
- load,
4095
- loadInBatches
4096
- };
4097
- return sourceLoader.createDataSource(url, resolvedOptions || {}, runtimeCoreApi);
4098
- }
4099
3450
  if (typeof url === "string" || isBlob(url)) {
4100
3451
  const selectedLoader = await selectLoader(url, resolvedLoaders, {
4101
3452
  ...resolvedOptions,
4102
3453
  core: { ...resolvedOptions == null ? void 0 : resolvedOptions.core, nothrow: true }
4103
3454
  });
4104
- if (selectedLoader && isSourceLoader(selectedLoader)) {
4105
- const sourceLoader = await resolveSourceLoader(selectedLoader, url, resolvedOptions);
4106
- resolvedOptions = await resolveLoaderAuthenticationOptions(selectedLoader.getAuthentications ? selectedLoader : sourceLoader, typeof url === "string" ? url : "", resolvedOptions || {});
4107
- return sourceLoader.createDataSource(url, resolvedOptions || {}, {
4108
- fetchFile,
4109
- parse,
4110
- parseFile,
4111
- parseSync,
4112
- parseInBatches,
4113
- load,
4114
- loadInBatches
4115
- });
3455
+ const loaderImplementation = selectedLoader && (typeof url === "string" || selectedLoader.createDataSourceSync) ? await getLoaderImplementation(selectedLoader, resolvedOptions, typeof url === "string" ? url : void 0) : null;
3456
+ if (selectedLoader && (loaderImplementation == null ? void 0 : loaderImplementation.createDataSourceSync) && !isLoaderWithParser(loaderImplementation)) {
3457
+ throw new Error(`${selectedLoader.id} creates sources. Use createDataSource() instead of load().`);
4116
3458
  }
4117
- if (selectedLoader && typeof url === "string") {
4118
- const loaderImplementation = await getLoaderImplementation(selectedLoader, resolvedOptions, url);
3459
+ if (selectedLoader && loaderImplementation && typeof url === "string") {
4119
3460
  resolvedOptions = await resolveLoaderAuthenticationOptions(selectedLoader.getAuthentications ? selectedLoader : loaderImplementation, url, resolvedOptions || {});
4120
- const parseUrl = loaderImplementation.parseUrl;
3461
+ const { parseUrl } = loaderImplementation;
4121
3462
  if (parseUrl) {
4122
3463
  const requestUrl = applySearchParamsToUrl(url, resolvedOptions);
4123
- return await parseUrl(requestUrl, resolvedOptions, context);
3464
+ const options2 = normalizeOptions(resolvedOptions, selectedLoader, [selectedLoader], url);
3465
+ return parseUrl(requestUrl, options2, context);
4124
3466
  }
4125
3467
  }
4126
3468
  }
@@ -4135,8 +3477,7 @@ async function load(url, loaders, options, context) {
4135
3477
  data = await fetch2(url);
4136
3478
  }
4137
3479
  if (typeof url === "string") {
4138
- const normalizedOptions = normalizeLoaderOptions(resolvedOptions || {});
4139
- if (!((_a = normalizedOptions.core) == null ? void 0 : _a.baseUrl)) {
3480
+ if (!((_a = resolvedOptions == null ? void 0 : resolvedOptions.core) == null ? void 0 : _a.baseUrl)) {
4140
3481
  resolvedOptions = {
4141
3482
  ...resolvedOptions,
4142
3483
  core: {
@@ -4148,15 +3489,38 @@ async function load(url, loaders, options, context) {
4148
3489
  }
4149
3490
  return Array.isArray(resolvedLoaders) ? await parse(data, resolvedLoaders, resolvedOptions, context) : await parse(data, resolvedLoaders, resolvedOptions, context);
4150
3491
  }
4151
- async function resolveSourceLoader(loader, url, options) {
4152
- if (!loader.preload) {
4153
- return loader;
3492
+
3493
+ // dist/lib/api/load-in-batches.js
3494
+ function loadInBatches(files, loaders, options, context) {
3495
+ let loadersArray;
3496
+ if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
3497
+ context = void 0;
3498
+ options = loaders;
3499
+ loadersArray = void 0;
3500
+ } else {
3501
+ loadersArray = loaders;
3502
+ }
3503
+ if (!Array.isArray(files)) {
3504
+ return loadOneFileInBatches(files, loadersArray, options || {});
4154
3505
  }
4155
- const sourceLoader = await loader.preload(typeof url === "string" ? url : "", options);
4156
- if (!isSourceLoader(sourceLoader)) {
4157
- throw new Error(`${loader.id} source loader preload() did not return a runtime source loader`);
3506
+ const promises = files.map((file) => loadOneFileInBatches(file, loadersArray, options || {}));
3507
+ return promises;
3508
+ }
3509
+ async function loadOneFileInBatches(file, loaders, options) {
3510
+ var _a, _b;
3511
+ if (typeof file === "string") {
3512
+ const url = file;
3513
+ const loader = await selectLoader(url, loaders, {
3514
+ ...options,
3515
+ core: { ...options.core, nothrow: true }
3516
+ });
3517
+ const authenticationLoader = loader && !loader.getAuthentications && ((_b = (_a = options.core) == null ? void 0 : _a.credentials) == null ? void 0 : _b.length) ? await getLoaderImplementation(loader, options, url) : loader;
3518
+ options = await resolveLoaderAuthenticationOptions(authenticationLoader, url, options);
3519
+ const fetch2 = getFetchFunction(options);
3520
+ const response = await fetch2(applySearchParamsToUrl(url, options));
3521
+ return Array.isArray(loaders) ? await parseInBatches(response, loaders, options) : await parseInBatches(response, loaders, options);
4158
3522
  }
4159
- return sourceLoader;
3523
+ return Array.isArray(loaders) ? await parseInBatches(file, loaders, options) : await parseInBatches(file, loaders, options);
4160
3524
  }
4161
3525
 
4162
3526
  // dist/lib/api/core-api.js
@@ -4235,9 +3599,6 @@ async function parse(data, loaders, options, context) {
4235
3599
  if (!loader) {
4236
3600
  return null;
4237
3601
  }
4238
- if (isSourceLoader(loader)) {
4239
- throw new Error(`${loader.id} is a SourceLoader. Use load() to create a runtime source object instead of parse().`);
4240
- }
4241
3602
  const normalizedOptions = normalizeOptions(options, loader, candidateLoaders, url);
4242
3603
  const authenticationLoader = !loader.getAuthentications && ((_d = (_c = normalizedOptions.core) == null ? void 0 : _c.credentials) == null ? void 0 : _d.length) ? await getLoaderImplementation(loader, normalizedOptions, url || (context == null ? void 0 : context.url)) : loader;
4243
3604
  const strictOptions = await resolveLoaderAuthenticationOptions(authenticationLoader, url || "", normalizedOptions);
@@ -4247,10 +3608,10 @@ async function parse(data, loaders, options, context) {
4247
3608
  strictOptions,
4248
3609
  context || null
4249
3610
  );
4250
- return await parseWithLoader(loader, data, strictOptions, context);
3611
+ return parseWithLoader(loader, data, strictOptions, context);
4251
3612
  }
4252
3613
  async function parseWithLoader(loader, data, options, context) {
4253
- var _a;
3614
+ var _a, _b;
4254
3615
  (_a = options.signal || context.signal) == null ? void 0 : _a.throwIfAborted();
4255
3616
  validateWorkerVersion(loader);
4256
3617
  options = mergeOptions(loader.options, options);
@@ -4260,15 +3621,22 @@ async function parseWithLoader(loader, data, options, context) {
4260
3621
  context.response = { headers, ok, redirected, status, statusText, type, url };
4261
3622
  }
4262
3623
  const loaderWithParser = await getLoaderImplementation(loader, options, context.url);
4263
- if (shouldParseWithWorker(loaderWithParser, data, options, context, loader)) {
4264
- data = await getArrayBufferFromData(data, options);
4265
- return await parseWithWorker(loaderWithParser, data, options, context, parse);
4266
- }
4267
- if (isBlob(data) && loaderWithParser.parseBlob) {
4268
- return await loaderWithParser.parseBlob(data, options, context);
3624
+ if (loaderWithParser.createDataSourceSync && !isLoaderWithParser(loaderWithParser)) {
3625
+ throw new Error(`${loader.id} creates sources. Use createDataSource() to open a source.`);
3626
+ }
3627
+ const output = (_b = loaderWithParser.prepareParseOutput) == null ? void 0 : _b.call(loaderWithParser, options);
3628
+ const parseOptions = (output == null ? void 0 : output.options) ?? options;
3629
+ let result;
3630
+ if (shouldParseWithWorker(loaderWithParser, data, parseOptions, context, loader)) {
3631
+ data = await getArrayBufferFromData(data, parseOptions);
3632
+ result = await parseWithWorker(loaderWithParser, data, parseOptions, context, parse);
3633
+ } else if (isBlob(data) && loaderWithParser.parseBlob) {
3634
+ result = await loaderWithParser.parseBlob(data, parseOptions, context);
3635
+ } else {
3636
+ data = await getArrayBufferOrStringFromData(data, loader, parseOptions);
3637
+ result = await parseWithLoaderImplementation(loaderWithParser, data, parseOptions, context);
4269
3638
  }
4270
- data = await getArrayBufferOrStringFromData(data, loader, options);
4271
- return await parseWithLoaderImplementation(loaderWithParser, data, options, context);
3639
+ return output ? output.convert(result) : result;
4272
3640
  }
4273
3641
  async function parseWithLoaderImplementation(loader, data, options, context) {
4274
3642
  if (loader.parseText && typeof data === "string") {
@@ -4283,6 +3651,9 @@ async function parseWithLoaderImplementation(loader, data, options, context) {
4283
3651
  if (loader.parseSync) {
4284
3652
  throw new Error(`${loader.name} loader: 'parse' not available on parser-bearing sync loader. Add an async 'parse' function to this loader, or call preload(loader) before parseSync(). ${context.url || ""}`);
4285
3653
  }
3654
+ if (loader.createDataSourceSync) {
3655
+ throw new Error(`${loader.id} creates sources. Use createDataSource() to open a source.`);
3656
+ }
4286
3657
  throw new Error(`${loader.id} loader - no parser found and worker is disabled`);
4287
3658
  }
4288
3659
 
@@ -4381,8 +3752,15 @@ function encodeTextSync(data, writer, options) {
4381
3752
  }
4382
3753
  function encodeInBatches(data, writer, options) {
4383
3754
  if (writer.encodeInBatches) {
4384
- const dataIterator = getIterator2(data);
4385
- return writer.encodeInBatches(dataIterator, options);
3755
+ let dataIterator;
3756
+ if (data && typeof data === "object") {
3757
+ if ("numRows" in data && "schema" in data) {
3758
+ dataIterator = [data];
3759
+ } else if (Symbol.iterator in data || Symbol.asyncIterator in data) {
3760
+ dataIterator = data;
3761
+ }
3762
+ }
3763
+ return writer.encodeInBatches(dataIterator ?? getIterator2(data), options);
4386
3764
  }
4387
3765
  throw new Error(`Writer ${writer.name} could not encode in batches`);
4388
3766
  }
@@ -4416,44 +3794,62 @@ function getTemporaryFilename(filename2) {
4416
3794
  }
4417
3795
 
4418
3796
  // dist/lib/api/create-data-source.js
4419
- function createDataSource(data, sources, options = {}) {
4420
- var _a, _b, _c, _d, _e;
4421
- const resolvedOptions = options || {};
4422
- const type = ((_a = resolvedOptions == null ? void 0 : resolvedOptions.core) == null ? void 0 : _a.type) || resolvedOptions.type || "auto";
4423
- const source = sources.length === 1 ? sources[0] : type === "auto" ? selectLoaderSync(data, sources, {
4424
- // `createDataSource` supports non-fetch inputs such as in-memory tables.
4425
- // Selection remains best-effort for those cases.
4426
- ...resolvedOptions,
4427
- core: { ...resolvedOptions == null ? void 0 : resolvedOptions.core, type: "auto" }
4428
- }) : getSourceOfType(type, sources);
4429
- if (!source) {
4430
- throw new Error("Not a valid source type");
4431
- }
4432
- const contributions = ((_c = (_b = resolvedOptions.core) == null ? void 0 : _b.credentials) == null ? void 0 : _c.length) ? (_d = source.getAuthentications) == null ? void 0 : _d.call(source, typeof data === "string" ? data : "", resolvedOptions) : void 0;
3797
+ async function createDataSource(data, loaders, options = {}) {
3798
+ var _a, _b, _c;
3799
+ (_a = options.signal) == null ? void 0 : _a.throwIfAborted();
3800
+ const candidates = getCandidates(loaders, options);
3801
+ const loader = candidates.length === 1 ? candidates[0] : await selectLoader(data, candidates, getSelectionOptions(options), void 0, "source");
3802
+ if (!loader) {
3803
+ throw new Error("No explicit source loader matches the input");
3804
+ }
3805
+ const url = typeof data === "string" ? data : "";
3806
+ const implementation = await preload(loader, options, url);
3807
+ (_b = options.signal) == null ? void 0 : _b.throwIfAborted();
3808
+ const authenticatedOptions = await resolveLoaderAuthenticationOptions(loader.getAuthentications ? loader : implementation, url, options);
3809
+ (_c = options.signal) == null ? void 0 : _c.throwIfAborted();
3810
+ return constructSource(implementation, data, authenticatedOptions);
3811
+ }
3812
+ function createDataSourceSync(data, loaders, options = {}) {
3813
+ var _a, _b, _c, _d;
3814
+ const candidates = getCandidates(loaders, options);
3815
+ const loader = candidates.length === 1 ? candidates[0] : selectLoaderSync(data, candidates, getSelectionOptions(options), void 0, "source");
3816
+ if (!loader) {
3817
+ throw new Error("No explicit source loader matches the input");
3818
+ }
3819
+ const implementation = getLoaderImplementationSync(loader, options);
3820
+ if (!implementation) {
3821
+ throw new Error(`${loader.id} has no synchronous source factory available. Call preload() first.`);
3822
+ }
3823
+ const authenticationLoader = loader.getAuthentications ? loader : implementation;
3824
+ const contributions = ((_b = (_a = options.core) == null ? void 0 : _a.credentials) == null ? void 0 : _b.length) ? (_c = authenticationLoader.getAuthentications) == null ? void 0 : _c.call(authenticationLoader, typeof data === "string" ? data : "", options) : void 0;
4433
3825
  if (contributions && "then" in contributions) {
4434
3826
  void contributions.catch(() => {
4435
3827
  });
4436
- throw new Error("Use load() with an asynchronous getAuthentications() hook.");
3828
+ throw new Error("Use createDataSource() with an asynchronous getAuthentications() hook.");
4437
3829
  }
4438
3830
  const authenticatedOptions = resolveAuthenticationOptions((contributions == null ? void 0 : contributions.length) ? {
4439
- ...resolvedOptions,
3831
+ ...options,
4440
3832
  core: {
4441
- ...resolvedOptions.core,
4442
- authentications: [
4443
- ...((_e = resolvedOptions.core) == null ? void 0 : _e.authentications) || [],
4444
- ...contributions || []
4445
- ]
3833
+ ...options.core,
3834
+ authentications: [...((_d = options.core) == null ? void 0 : _d.authentications) || [], ...contributions]
4446
3835
  }
4447
- } : resolvedOptions);
4448
- return source.createDataSource(data, authenticatedOptions, coreApi);
3836
+ } : options);
3837
+ return constructSource(implementation, data, authenticatedOptions);
4449
3838
  }
4450
- function getSourceOfType(type, sources) {
4451
- for (const service of sources) {
4452
- if (service.type === type) {
4453
- return service;
4454
- }
3839
+ function getCandidates(loaders, options) {
3840
+ var _a;
3841
+ const candidates = Array.isArray(loaders) ? [...loaders] : [loaders];
3842
+ const type = ((_a = options.core) == null ? void 0 : _a.type) || options.type;
3843
+ return candidates.length > 1 && type && type !== "auto" ? candidates.filter((loader) => (loader.type ?? loader.id) === type) : candidates;
3844
+ }
3845
+ function getSelectionOptions(options) {
3846
+ return { ...options, core: { ...options.core, ignoreRegisteredLoaders: true, nothrow: true } };
3847
+ }
3848
+ function constructSource(loader, data, options) {
3849
+ if (loader.createDataSourceSync) {
3850
+ return loader.createDataSourceSync(data, options, coreApi);
4455
3851
  }
4456
- return null;
3852
+ throw new Error(`${loader.id} has no synchronous source factory. Use createDataSource() to preload the loader.`);
4457
3853
  }
4458
3854
 
4459
3855
  // dist/lib/api/select-source.js
@@ -4461,16 +3857,16 @@ function selectSource(url, sources, options) {
4461
3857
  const type = (options == null ? void 0 : options.type) || "auto";
4462
3858
  let selectedSource = null;
4463
3859
  if (type === "auto") {
4464
- selectedSource = selectLoaderSync(url, sources, { core: { nothrow: true } });
3860
+ selectedSource = selectLoaderSync(url, sources, { core: { nothrow: true } }, void 0, "source");
4465
3861
  } else {
4466
- selectedSource = getSourceOfType2(type, sources);
3862
+ selectedSource = getSourceOfType(type, sources);
4467
3863
  }
4468
3864
  if (!selectedSource && !(options == null ? void 0 : options.nothrow)) {
4469
3865
  throw new Error("Not a valid image source type");
4470
3866
  }
4471
3867
  return selectedSource;
4472
3868
  }
4473
- function getSourceOfType2(type, sources) {
3869
+ function getSourceOfType(type, sources) {
4474
3870
  for (const service of sources) {
4475
3871
  if (service.type === type) {
4476
3872
  return service;
@@ -4519,29 +3915,14 @@ function makeStream(source, options) {
4519
3915
  }
4520
3916
 
4521
3917
  // dist/null-loader.js
4522
- var VERSION4 = true ? "5.0.0-beta.1" : "latest";
4523
- var NullWorkerLoader = {
4524
- dataType: null,
4525
- batchType: null,
4526
- name: "Null loader",
4527
- id: "null",
4528
- module: "core",
4529
- version: VERSION4,
4530
- worker: true,
4531
- mimeTypes: ["application/x.empty"],
4532
- extensions: ["null"],
4533
- tests: [() => false],
4534
- options: {
4535
- null: {}
4536
- }
4537
- };
3918
+ var VERSION5 = true ? "5.0.0-beta.11" : "latest";
4538
3919
  var NullLoader = {
4539
3920
  dataType: null,
4540
3921
  batchType: null,
4541
3922
  name: "Null loader",
4542
3923
  id: "null",
4543
3924
  module: "core",
4544
- version: VERSION4,
3925
+ version: VERSION5,
4545
3926
  mimeTypes: ["application/x.empty"],
4546
3927
  extensions: ["null"],
4547
3928
  parse: async (arrayBuffer, options, context) => parseSync2(arrayBuffer, options || {}, context),