@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.
- package/GEOARROW-README.md +1 -1
- package/README.md +4 -2
- package/SCAN-README.md +3 -3
- package/SCHEMA-UTILS-README.md +1 -1
- package/dist/arrow-geometry/binary-geometry-to-wkb.cjs +2 -2
- package/dist/arrow-geometry/binary-geometry-to-wkb.cjs.map +2 -2
- package/dist/arrow-geometry/binary-geometry-to-wkb.js +1 -1
- package/dist/arrow-geometry/binary-geometry-to-wkb.js.map +1 -1
- package/dist/arrow-geometry/feature-collection-to-arrow.cjs.map +2 -2
- package/dist/arrow-geometry/feature-collection-to-arrow.d.ts +4 -3
- package/dist/arrow-geometry/feature-collection-to-arrow.d.ts.map +1 -1
- package/dist/arrow-geometry/feature-collection-to-arrow.js +1 -1
- package/dist/arrow-geometry/feature-collection-to-arrow.js.map +1 -1
- package/dist/arrow-geometry/feature-table.cjs +2 -6
- package/dist/arrow-geometry/feature-table.cjs.map +2 -2
- package/dist/arrow-geometry/feature-table.d.ts +6 -5
- package/dist/arrow-geometry/feature-table.d.ts.map +1 -1
- package/dist/arrow-geometry/feature-table.js +5 -9
- package/dist/arrow-geometry/feature-table.js.map +1 -1
- package/dist/arrow-geometry/geojson-table.cjs +295 -18
- package/dist/arrow-geometry/geojson-table.cjs.map +3 -3
- package/dist/arrow-geometry/geojson-table.d.ts +10 -3
- package/dist/arrow-geometry/geojson-table.d.ts.map +1 -1
- package/dist/arrow-geometry/geojson-table.js +23 -13
- package/dist/arrow-geometry/geojson-table.js.map +1 -1
- package/dist/arrow-geometry/geometry-codecs.cjs +6 -6
- package/dist/arrow-geometry/geometry-codecs.cjs.map +2 -2
- package/dist/arrow-geometry/geometry-codecs.js +1 -1
- package/dist/arrow-geometry/geometry-codecs.js.map +1 -1
- package/dist/arrow-geometry/geometry-to-wkt.cjs +2 -2
- package/dist/arrow-geometry/geometry-to-wkt.cjs.map +2 -2
- package/dist/arrow-geometry/geometry-to-wkt.js +1 -1
- package/dist/arrow-geometry/geometry-to-wkt.js.map +1 -1
- package/dist/arrow-geometry/index.cjs +0 -11
- package/dist/arrow-geometry/index.cjs.map +2 -2
- package/dist/arrow-geometry/index.d.ts +0 -1
- package/dist/arrow-geometry/index.d.ts.map +1 -1
- package/dist/arrow-geometry/index.js +0 -1
- package/dist/arrow-geometry/index.js.map +1 -1
- package/dist/arrow-geometry/wkb-arrow-utils.cjs +1 -5
- package/dist/arrow-geometry/wkb-arrow-utils.cjs.map +2 -2
- package/dist/arrow-geometry/wkb-arrow-utils.d.ts +7 -7
- package/dist/arrow-geometry/wkb-arrow-utils.d.ts.map +1 -1
- package/dist/arrow-geometry/wkb-arrow-utils.js +4 -8
- package/dist/arrow-geometry/wkb-arrow-utils.js.map +1 -1
- package/dist/arrow-geometry/wkb-builder.cjs +3 -3
- package/dist/arrow-geometry/wkb-builder.cjs.map +2 -2
- package/dist/arrow-geometry/wkb-builder.d.ts +1 -1
- package/dist/arrow-geometry/wkb-builder.d.ts.map +1 -1
- package/dist/arrow-geometry/wkb-builder.js +1 -1
- package/dist/arrow-geometry/wkb-builder.js.map +1 -1
- package/dist/arrow-geometry/wkb-statistics.cjs +2 -2
- package/dist/arrow-geometry/wkb-statistics.cjs.map +2 -2
- package/dist/arrow-geometry/wkb-statistics.js +1 -1
- package/dist/arrow-geometry/wkb-statistics.js.map +1 -1
- package/dist/arrow-worker-transport.cjs +105 -0
- package/dist/arrow-worker-transport.cjs.map +6 -0
- package/dist/arrow-worker-transport.d.ts +11 -0
- package/dist/arrow-worker-transport.d.ts.map +1 -0
- package/dist/arrow-worker-transport.js +77 -0
- package/dist/arrow-worker-transport.js.map +1 -0
- package/dist/cluster-source.cjs +6874 -0
- package/dist/cluster-source.cjs.map +6 -0
- package/dist/cluster-source.d.ts +2 -0
- package/dist/cluster-source.d.ts.map +1 -0
- package/dist/cluster-source.js +2 -0
- package/dist/cluster-source.js.map +1 -0
- package/dist/dist.dev.js +3040 -817
- package/dist/dist.min.js +3 -3
- package/dist/federated-table-scan-source.cjs +2409 -0
- package/dist/federated-table-scan-source.cjs.map +6 -0
- package/dist/federated-table-scan-source.d.ts +2 -0
- package/dist/federated-table-scan-source.d.ts.map +1 -0
- package/dist/federated-table-scan-source.js +2 -0
- package/dist/federated-table-scan-source.js.map +1 -0
- package/dist/geoarrow/binary-polygon-to-geoarrow.cjs +2 -2
- package/dist/geoarrow/binary-polygon-to-geoarrow.cjs.map +2 -2
- package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts.map +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.js +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.js.map +1 -1
- package/dist/geoarrow/clustering/cluster-source.cjs +16 -19
- package/dist/geoarrow/clustering/cluster-source.cjs.map +2 -2
- package/dist/geoarrow/clustering/cluster-source.d.ts +3 -2
- package/dist/geoarrow/clustering/cluster-source.d.ts.map +1 -1
- package/dist/geoarrow/clustering/cluster-source.js +13 -18
- package/dist/geoarrow/clustering/cluster-source.js.map +1 -1
- package/dist/geoarrow/convert-table-to-geoarrow.cjs +5 -12
- package/dist/geoarrow/convert-table-to-geoarrow.cjs.map +2 -2
- package/dist/geoarrow/convert-table-to-geoarrow.d.ts +6 -6
- package/dist/geoarrow/convert-table-to-geoarrow.d.ts.map +1 -1
- package/dist/geoarrow/convert-table-to-geoarrow.js +8 -14
- package/dist/geoarrow/convert-table-to-geoarrow.js.map +1 -1
- package/dist/geoarrow/geoarrow-bounds.cjs +7 -7
- package/dist/geoarrow/geoarrow-bounds.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-bounds.js +3 -3
- package/dist/geoarrow/geoarrow-bounds.js.map +1 -1
- package/dist/geoarrow/geoarrow-capabilities.cjs +2 -2
- package/dist/geoarrow/geoarrow-capabilities.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-capabilities.js +1 -1
- package/dist/geoarrow/geoarrow-capabilities.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs +8 -8
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs +6 -4
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts +3 -3
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts.map +1 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js +9 -4
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs +5 -4
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +3 -3
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts.map +1 -1
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js +5 -4
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js.map +1 -1
- package/dist/geoarrow/geoarrow-inspection.cjs +2 -2
- package/dist/geoarrow/geoarrow-inspection.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-inspection.js +1 -1
- package/dist/geoarrow/geoarrow-inspection.js.map +1 -1
- package/dist/geoarrow/geoarrow-stream.cjs +11 -12
- package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-stream.d.ts +2 -2
- package/dist/geoarrow/geoarrow-stream.d.ts.map +1 -1
- package/dist/geoarrow/geoarrow-stream.js +10 -13
- package/dist/geoarrow/geoarrow-stream.js.map +1 -1
- package/dist/geoarrow/get-geoarrow-vertex-count.cjs +2 -2
- package/dist/geoarrow/get-geoarrow-vertex-count.cjs.map +2 -2
- package/dist/geoarrow/get-geoarrow-vertex-count.js +1 -1
- package/dist/geoarrow/get-geoarrow-vertex-count.js.map +1 -1
- package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.cjs.map +1 -1
- package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.js +3 -3
- package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.js.map +1 -1
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs +4 -8
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs.map +2 -2
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.d.ts.map +1 -1
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js +4 -8
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js.map +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs +4 -4
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs.map +2 -2
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js.map +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs +3 -3
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs.map +2 -2
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js.map +1 -1
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs +3 -3
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs.map +2 -2
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js +1 -1
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js.map +1 -1
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs +0 -6
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs.map +2 -2
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts +5 -3
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts.map +1 -1
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js +0 -6
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js.map +1 -1
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs +3 -2
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs.map +2 -2
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.d.ts.map +1 -1
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js +3 -2
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js.map +1 -1
- package/dist/geoarrow/metadata/geoarrow-metadata.cjs +44 -2
- package/dist/geoarrow/metadata/geoarrow-metadata.cjs.map +4 -4
- package/dist/geoarrow/metadata/geoarrow-metadata.d.ts.map +1 -1
- package/dist/geoarrow/metadata/geoarrow-metadata.js +3 -4
- package/dist/geoarrow/metadata/geoarrow-metadata.js.map +1 -1
- package/dist/index.cjs +746 -1365
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/api/create-data-source.d.ts +20 -9
- package/dist/lib/api/create-data-source.d.ts.map +1 -1
- package/dist/lib/api/create-data-source.js +55 -45
- package/dist/lib/api/create-data-source.js.map +1 -1
- package/dist/lib/api/encode.d.ts +1 -1
- package/dist/lib/api/encode.d.ts.map +1 -1
- package/dist/lib/api/encode.js +11 -2
- package/dist/lib/api/encode.js.map +1 -1
- package/dist/lib/api/load-in-batches.d.ts +3 -2
- package/dist/lib/api/load-in-batches.d.ts.map +1 -1
- package/dist/lib/api/load-in-batches.js.map +1 -1
- package/dist/lib/api/load-loader.d.ts +3 -3
- package/dist/lib/api/load-loader.d.ts.map +1 -1
- package/dist/lib/api/load-loader.js +15 -19
- package/dist/lib/api/load-loader.js.map +1 -1
- package/dist/lib/api/load.d.ts +7 -3
- package/dist/lib/api/load.d.ts.map +1 -1
- package/dist/lib/api/load.js +15 -67
- package/dist/lib/api/load.js.map +1 -1
- package/dist/lib/api/loader-options.d.ts +6 -0
- package/dist/lib/api/loader-options.d.ts.map +1 -1
- package/dist/lib/api/loader-options.js +48 -0
- package/dist/lib/api/loader-options.js.map +1 -1
- package/dist/lib/api/parse-file.d.ts +5 -3
- package/dist/lib/api/parse-file.d.ts.map +1 -1
- package/dist/lib/api/parse-file.js +8 -6
- package/dist/lib/api/parse-file.js.map +1 -1
- package/dist/lib/api/parse-in-batches.d.ts +5 -3
- package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
- package/dist/lib/api/parse-in-batches.js +60 -9
- package/dist/lib/api/parse-in-batches.js.map +1 -1
- package/dist/lib/api/parse-sync.d.ts +5 -3
- package/dist/lib/api/parse-sync.d.ts.map +1 -1
- package/dist/lib/api/parse-sync.js +3 -4
- package/dist/lib/api/parse-sync.js.map +1 -1
- package/dist/lib/api/parse.d.ts +5 -3
- package/dist/lib/api/parse.d.ts.map +1 -1
- package/dist/lib/api/parse.js +22 -14
- package/dist/lib/api/parse.js.map +1 -1
- package/dist/lib/api/select-loader.d.ts +4 -2
- package/dist/lib/api/select-loader.d.ts.map +1 -1
- package/dist/lib/api/select-loader.js +47 -53
- package/dist/lib/api/select-loader.js.map +1 -1
- package/dist/lib/api/select-source.d.ts.map +1 -1
- package/dist/lib/api/select-source.js +1 -1
- package/dist/lib/api/select-source.js.map +1 -1
- package/dist/lib/init.js +1 -1
- package/dist/lib/init.js.map +1 -1
- package/dist/lib/loader-utils/get-fetch-function.js +2 -2
- package/dist/lib/loader-utils/get-fetch-function.js.map +1 -1
- package/dist/lib/loader-utils/loggers.d.ts +2 -37
- package/dist/lib/loader-utils/loggers.d.ts.map +1 -1
- package/dist/lib/loader-utils/loggers.js +2 -63
- package/dist/lib/loader-utils/loggers.js.map +1 -1
- package/dist/lib/loader-utils/native-arrow.d.ts +13 -0
- package/dist/lib/loader-utils/native-arrow.d.ts.map +1 -0
- package/dist/lib/loader-utils/native-arrow.js +66 -0
- package/dist/lib/loader-utils/native-arrow.js.map +1 -0
- package/dist/lib/loader-utils/option-defaults.d.ts +3 -2
- package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -1
- package/dist/lib/loader-utils/option-defaults.js +9 -10
- package/dist/lib/loader-utils/option-defaults.js.map +1 -1
- package/dist/lib/loader-utils/option-utils.d.ts +0 -6
- package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
- package/dist/lib/loader-utils/option-utils.js +31 -114
- package/dist/lib/loader-utils/option-utils.js.map +1 -1
- package/dist/loader-utils/format-types.d.ts +3 -0
- package/dist/loader-utils/format-types.d.ts.map +1 -1
- package/dist/loader-utils/index.cjs +854 -1295
- package/dist/loader-utils/index.cjs.map +3 -3
- package/dist/loader-utils/index.d.ts +17 -8
- package/dist/loader-utils/index.d.ts.map +1 -1
- package/dist/loader-utils/index.js +9 -5
- package/dist/loader-utils/index.js.map +1 -1
- package/dist/loader-utils/json-loader.js +1 -1
- package/dist/loader-utils/json-loader.js.map +1 -1
- package/dist/loader-utils/lib/files/http-file-transport.d.ts +4 -0
- package/dist/loader-utils/lib/files/http-file-transport.d.ts.map +1 -1
- package/dist/loader-utils/lib/files/http-file-transport.js +45 -1
- package/dist/loader-utils/lib/files/http-file-transport.js.map +1 -1
- package/dist/loader-utils/lib/files/http-file-types.d.ts +2 -0
- package/dist/loader-utils/lib/files/http-file-types.d.ts.map +1 -1
- package/dist/loader-utils/lib/files/read-range-response.d.ts +3 -0
- package/dist/loader-utils/lib/files/read-range-response.d.ts.map +1 -0
- package/dist/loader-utils/lib/files/read-range-response.js +62 -0
- package/dist/loader-utils/lib/files/read-range-response.js.map +1 -0
- package/dist/loader-utils/lib/log-utils/log.d.ts +23 -1
- package/dist/loader-utils/lib/log-utils/log.d.ts.map +1 -1
- package/dist/loader-utils/lib/log-utils/log.js +32 -1
- package/dist/loader-utils/lib/log-utils/log.js.map +1 -1
- package/dist/loader-utils/lib/pace-batch-iterator.d.ts +14 -0
- package/dist/loader-utils/lib/pace-batch-iterator.d.ts.map +1 -0
- package/dist/loader-utils/lib/pace-batch-iterator.js +51 -0
- package/dist/loader-utils/lib/pace-batch-iterator.js.map +1 -0
- package/dist/loader-utils/lib/request-utils/request-credentials.js +1 -1
- package/dist/loader-utils/lib/request-utils/request-credentials.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts +43 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts.map +1 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.js +104 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.js.map +1 -0
- package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.d.ts → query-options.d.ts} +5 -8
- package/dist/loader-utils/lib/scan-utils/query-options.d.ts.map +1 -0
- package/dist/{schema-utils/lib/table/batch-builder/table-batch-aggregator.js → loader-utils/lib/scan-utils/query-options.js} +1 -1
- package/dist/loader-utils/lib/scan-utils/query-options.js.map +1 -0
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +58 -18
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +17 -6
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-query.d.ts +54 -3
- package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-query.js +6 -0
- package/dist/loader-utils/lib/scan-utils/table-query.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +18 -12
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +58 -29
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -1
- package/dist/loader-utils/lib/sources/data-source.d.ts +4 -0
- package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/sources/data-source.js +53 -14
- package/dist/loader-utils/lib/sources/data-source.js.map +1 -1
- package/dist/loader-utils/lib/sources/image-source.d.ts +1 -1
- package/dist/loader-utils/lib/sources/table-source-collection.d.ts +31 -0
- package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -0
- package/dist/loader-utils/lib/{scan-utils/experimental-scan-options.js → sources/table-source-collection.js} +1 -1
- package/dist/loader-utils/lib/sources/table-source-collection.js.map +1 -0
- package/dist/loader-utils/lib/sources/utils/utils.js +1 -1
- package/dist/loader-utils/lib/sources/utils/utils.js.map +1 -1
- package/dist/loader-utils/lib/sources/vector-source.d.ts +4 -3
- package/dist/loader-utils/lib/sources/vector-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/sources/vector-tile-source.d.ts +4 -3
- package/dist/loader-utils/lib/sources/vector-tile-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.d.ts.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js +2 -5
- package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.d.ts.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js +40 -21
- package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
- package/dist/loader-utils/loader-types.d.ts +118 -91
- package/dist/loader-utils/loader-types.d.ts.map +1 -1
- package/dist/loader-utils/loader-types.js.map +1 -1
- package/dist/loader-utils/source-types.d.ts +7 -5
- package/dist/loader-utils/source-types.d.ts.map +1 -1
- package/dist/loader-utils/source-types.js +9 -1
- package/dist/loader-utils/source-types.js.map +1 -1
- package/dist/null-loader.d.ts +0 -18
- package/dist/null-loader.d.ts.map +1 -1
- package/dist/null-loader.js +1 -19
- package/dist/null-loader.js.map +1 -1
- package/dist/null-worker-node.js +771 -82
- package/dist/null-worker.js +742 -81
- package/dist/polyfills/images/encode-image-node.d.ts +18 -15
- package/dist/polyfills/images/encode-image-node.d.ts.map +1 -1
- package/dist/polyfills/images/encode-image-node.js +19 -33
- package/dist/polyfills/images/encode-image-node.js.map +1 -1
- package/dist/polyfills/images/image-codecs-node.d.ts +2 -6
- package/dist/polyfills/images/image-codecs-node.d.ts.map +1 -1
- package/dist/polyfills/images/image-codecs-node.js +2 -24
- package/dist/polyfills/images/image-codecs-node.js.map +1 -1
- package/dist/polyfills/images/load-sharp.d.ts +3 -0
- package/dist/polyfills/images/load-sharp.d.ts.map +1 -0
- package/dist/polyfills/images/load-sharp.js +11 -0
- package/dist/polyfills/images/load-sharp.js.map +1 -0
- package/dist/polyfills/images/node-image-bitmap.d.ts +1 -1
- package/dist/polyfills/images/node-image-bitmap.js +1 -1
- package/dist/polyfills/images/node-image-formats.d.ts +1 -1
- package/dist/polyfills/images/node-image-formats.d.ts.map +1 -1
- package/dist/polyfills/images/node-image-formats.js +10 -4
- package/dist/polyfills/images/node-image-formats.js.map +1 -1
- package/dist/polyfills/images/parse-image-node.d.ts +10 -2
- package/dist/polyfills/images/parse-image-node.d.ts.map +1 -1
- package/dist/polyfills/images/parse-image-node.js +20 -32
- package/dist/polyfills/images/parse-image-node.js.map +1 -1
- package/dist/polyfills/index.cjs +76 -151
- package/dist/polyfills/index.d.ts.map +1 -1
- package/dist/polyfills/index.js +2 -2
- package/dist/polyfills/index.js.map +1 -1
- package/dist/scan/arrow-execution/expressions.cjs +134 -0
- package/dist/scan/arrow-execution/expressions.cjs.map +7 -0
- package/dist/scan/arrow-execution/expressions.d.ts +11 -0
- package/dist/scan/arrow-execution/expressions.d.ts.map +1 -0
- package/dist/scan/arrow-execution/expressions.js +86 -0
- package/dist/scan/arrow-execution/expressions.js.map +1 -0
- package/dist/scan/arrow-execution/filter-arrow-table.cjs +255 -0
- package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +7 -0
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts +18 -0
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -0
- package/dist/scan/arrow-execution/filter-arrow-table.js +224 -0
- package/dist/scan/arrow-execution/filter-arrow-table.js.map +1 -0
- package/dist/scan/arrow-execution/project-arrow-table.cjs +70 -0
- package/dist/scan/arrow-execution/project-arrow-table.cjs.map +7 -0
- package/dist/scan/arrow-execution/project-arrow-table.d.ts +8 -0
- package/dist/scan/arrow-execution/project-arrow-table.d.ts.map +1 -0
- package/dist/scan/arrow-execution/project-arrow-table.js +39 -0
- package/dist/scan/arrow-execution/project-arrow-table.js.map +1 -0
- package/dist/scan/arrow-execution.cjs +34 -0
- package/dist/scan/arrow-execution.cjs.map +7 -0
- package/dist/scan/arrow-execution.d.ts +4 -0
- package/dist/scan/arrow-execution.d.ts.map +1 -0
- package/dist/scan/arrow-execution.js +6 -0
- package/dist/scan/arrow-execution.js.map +1 -0
- package/dist/scan/arrow-query-worker-entry.cjs +121 -0
- package/dist/scan/arrow-query-worker-entry.cjs.map +7 -0
- package/dist/scan/arrow-query-worker-entry.d.ts +2 -0
- package/dist/scan/arrow-query-worker-entry.d.ts.map +1 -0
- package/dist/scan/arrow-query-worker-entry.js +7 -0
- package/dist/scan/arrow-query-worker-entry.js.map +1 -0
- package/dist/scan/arrow-query-worker.cjs +197 -0
- package/dist/scan/arrow-query-worker.cjs.map +7 -0
- package/dist/scan/arrow-query-worker.d.ts +47 -0
- package/dist/scan/arrow-query-worker.d.ts.map +1 -0
- package/dist/scan/arrow-query-worker.js +101 -0
- package/dist/scan/arrow-query-worker.js.map +1 -0
- package/dist/scan/arrow-query.cjs.map +1 -1
- package/dist/scan/arrow-query.d.ts +1 -1
- package/dist/scan/arrow-query.d.ts.map +1 -1
- package/dist/scan/catalog-query-source.cjs +122 -0
- package/dist/scan/catalog-query-source.cjs.map +7 -0
- package/dist/scan/catalog-query-source.d.ts +6 -0
- package/dist/scan/catalog-query-source.d.ts.map +1 -0
- package/dist/scan/catalog-query-source.js +115 -0
- package/dist/scan/catalog-query-source.js.map +1 -0
- package/dist/scan/federated-table-scan-source.cjs +42 -43
- package/dist/scan/federated-table-scan-source.cjs.map +2 -2
- package/dist/scan/federated-table-scan-source.d.ts +6 -10
- package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
- package/dist/scan/federated-table-scan-source.js +39 -40
- package/dist/scan/federated-table-scan-source.js.map +1 -1
- package/dist/scan/index.cjs +213 -6
- package/dist/scan/index.cjs.map +4 -4
- package/dist/scan/index.d.ts +15 -4
- package/dist/scan/index.d.ts.map +1 -1
- package/dist/scan/index.js +8 -2
- package/dist/scan/index.js.map +1 -1
- package/dist/scan/parse-sql-predicate.cjs +3 -294
- package/dist/scan/parse-sql-predicate.cjs.map +3 -3
- package/dist/scan/parse-sql-predicate.d.ts +6 -9
- package/dist/scan/parse-sql-predicate.d.ts.map +1 -1
- package/dist/scan/parse-sql-predicate.js +5 -314
- package/dist/scan/parse-sql-predicate.js.map +1 -1
- package/dist/scan/query-arrow-table-in-batches.cjs +75 -0
- package/dist/scan/query-arrow-table-in-batches.cjs.map +7 -0
- package/dist/scan/query-arrow-table-in-batches.d.ts +8 -0
- package/dist/scan/query-arrow-table-in-batches.d.ts.map +1 -0
- package/dist/scan/query-arrow-table-in-batches.js +54 -0
- package/dist/scan/query-arrow-table-in-batches.js.map +1 -0
- package/dist/scan/query-arrow-table.cjs +65 -202
- package/dist/scan/query-arrow-table.cjs.map +3 -3
- package/dist/scan/query-arrow-table.d.ts +7 -40
- package/dist/scan/query-arrow-table.d.ts.map +1 -1
- package/dist/scan/query-arrow-table.js +51 -211
- package/dist/scan/query-arrow-table.js.map +1 -1
- package/dist/scan/query-open-source.cjs +52 -0
- package/dist/scan/query-open-source.cjs.map +7 -0
- package/dist/scan/query-open-source.d.ts +4 -0
- package/dist/scan/query-open-source.d.ts.map +1 -0
- package/dist/scan/query-open-source.js +26 -0
- package/dist/scan/query-open-source.js.map +1 -0
- package/dist/scan/query-progressive.cjs +190 -0
- package/dist/scan/query-progressive.cjs.map +7 -0
- package/dist/scan/query-progressive.d.ts +39 -0
- package/dist/scan/query-progressive.d.ts.map +1 -0
- package/dist/scan/query-progressive.js +173 -0
- package/dist/scan/query-progressive.js.map +1 -0
- package/dist/scan/query-pushdown.cjs +140 -0
- package/dist/scan/query-pushdown.cjs.map +7 -0
- package/dist/scan/query-pushdown.d.ts +14 -0
- package/dist/scan/query-pushdown.d.ts.map +1 -0
- package/dist/scan/query-pushdown.js +133 -0
- package/dist/scan/query-pushdown.js.map +1 -0
- package/dist/scan/query-scales.cjs +140 -0
- package/dist/scan/query-scales.cjs.map +7 -0
- package/dist/scan/query-scales.d.ts +35 -0
- package/dist/scan/query-scales.d.ts.map +1 -0
- package/dist/scan/query-scales.js +120 -0
- package/dist/scan/query-scales.js.map +1 -0
- package/dist/scan/query.cjs +385 -0
- package/dist/scan/query.cjs.map +7 -0
- package/dist/scan/query.d.ts +67 -0
- package/dist/scan/query.d.ts.map +1 -0
- package/dist/scan/query.js +402 -0
- package/dist/scan/query.js.map +1 -0
- package/dist/scan/resolve-query-source.cjs +59 -0
- package/dist/scan/resolve-query-source.cjs.map +7 -0
- package/dist/scan/resolve-query-source.d.ts +6 -0
- package/dist/scan/resolve-query-source.d.ts.map +1 -0
- package/dist/scan/resolve-query-source.js +37 -0
- package/dist/scan/resolve-query-source.js.map +1 -0
- package/dist/scan/rows-to-arrow.cjs +1 -28
- package/dist/scan/rows-to-arrow.cjs.map +2 -2
- package/dist/scan/rows-to-arrow.d.ts +3 -3
- package/dist/scan/rows-to-arrow.d.ts.map +1 -1
- package/dist/scan/rows-to-arrow.js +2 -32
- package/dist/scan/rows-to-arrow.js.map +1 -1
- package/dist/scan/scan-engine.cjs.map +2 -2
- package/dist/scan/scan-engine.d.ts +5 -5
- package/dist/scan/scan-engine.d.ts.map +1 -1
- package/dist/scan/scan-engine.js.map +1 -1
- package/dist/scan/sql-catalog.cjs +110 -0
- package/dist/scan/sql-catalog.cjs.map +7 -0
- package/dist/scan/sql-catalog.d.ts +47 -0
- package/dist/scan/sql-catalog.d.ts.map +1 -0
- package/dist/scan/sql-catalog.js +97 -0
- package/dist/scan/sql-catalog.js.map +1 -0
- package/dist/scan/table-query.cjs.map +2 -2
- package/dist/scan/table-query.d.ts +4 -1
- package/dist/scan/table-query.d.ts.map +1 -1
- package/dist/scan/table-query.js.map +1 -1
- package/dist/scan/vector-table-scan-source.cjs +24 -17
- package/dist/scan/vector-table-scan-source.cjs.map +4 -4
- package/dist/scan/vector-table-scan-source.d.ts +8 -8
- package/dist/scan/vector-table-scan-source.d.ts.map +1 -1
- package/dist/scan/vector-table-scan-source.js +19 -17
- package/dist/scan/vector-table-scan-source.js.map +1 -1
- package/dist/schema/categories/category-mesh.d.ts +3 -10
- package/dist/schema/categories/category-mesh.d.ts.map +1 -1
- package/dist/schema/categories/category-mesh.js.map +1 -1
- package/dist/schema/categories/category-table.d.ts +2 -19
- package/dist/schema/categories/category-table.d.ts.map +1 -1
- package/dist/schema/geometry/arrow-binary-features.d.ts +1 -1
- package/dist/schema/geometry/arrow-binary-features.d.ts.map +1 -1
- package/dist/schema/geometry/geoarrow.d.ts +3 -6
- package/dist/schema/geometry/geoarrow.d.ts.map +1 -1
- package/dist/schema/index.cjs +11 -7
- package/dist/schema/index.cjs.map +2 -2
- package/dist/schema/index.d.ts +4 -4
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +2 -2
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/types/batch.d.ts +0 -4
- package/dist/schema/types/batch.d.ts.map +1 -1
- package/dist/schema-utils/index.cjs +404 -620
- package/dist/schema-utils/index.cjs.map +3 -3
- package/dist/schema-utils/index.d.ts +6 -6
- package/dist/schema-utils/index.d.ts.map +1 -1
- package/dist/schema-utils/index.js +6 -5
- package/dist/schema-utils/index.js.map +1 -1
- package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts +16 -0
- package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts.map +1 -0
- package/dist/schema-utils/lib/arrow/arrow-metadata.js +109 -0
- package/dist/schema-utils/lib/arrow/arrow-metadata.js.map +1 -0
- package/dist/schema-utils/lib/converters/convert.js +9 -2
- package/dist/schema-utils/lib/converters/convert.js.map +1 -1
- package/dist/schema-utils/lib/converters/types.d.ts +2 -0
- package/dist/schema-utils/lib/converters/types.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts +8 -12
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js +8 -21
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts +5 -4
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js +18 -13
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js.map +1 -1
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts +14 -0
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts.map +1 -0
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js +39 -0
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js.map +1 -0
- package/dist/schema-utils/lib/mesh/mesh-utils.d.ts +2 -14
- package/dist/schema-utils/lib/mesh/mesh-utils.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/mesh-utils.js +1 -35
- package/dist/schema-utils/lib/mesh/mesh-utils.js.map +1 -1
- package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/point-cloud-tiler.js +6 -5
- package/dist/schema-utils/lib/mesh/point-cloud-tiler.js.map +1 -1
- package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts +2 -1
- package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts.map +1 -1
- package/dist/schema-utils/lib/schema/deduce-table-schema.js +7 -3
- package/dist/schema-utils/lib/schema/deduce-table-schema.js.map +1 -1
- package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts +6 -5
- package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js +6 -5
- package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts +9 -9
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js +13 -46
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts +9 -20
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js +61 -73
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js.map +1 -1
- package/dist/schema-utils/lib/table/batches/convert-batches.d.ts +4 -3
- package/dist/schema-utils/lib/table/batches/convert-batches.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batches/convert-batches.js +27 -9
- package/dist/schema-utils/lib/table/batches/convert-batches.js.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts +6 -9
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js +22 -15
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts +4 -1
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.js +13 -9
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.js.map +1 -1
- package/dist/schema-utils/lib/table/query-arrow-table.d.ts +3 -3
- package/dist/schema-utils/lib/table/query-arrow-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/query-arrow-table.js +9 -23
- package/dist/schema-utils/lib/table/query-arrow-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts +9 -10
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.js +13 -75
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-table.d.ts +6 -36
- package/dist/schema-utils/lib/table/tables/convert-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-table.js +5 -42
- package/dist/schema-utils/lib/table/tables/convert-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/make-table.d.ts +3 -55
- package/dist/schema-utils/lib/table/tables/make-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/make-table.js +3 -59
- package/dist/schema-utils/lib/table/tables/make-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/row-utils.js +2 -2
- package/dist/schema-utils/lib/table/tables/row-utils.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-accessors.d.ts +18 -16
- package/dist/schema-utils/lib/table/tables/table-accessors.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-accessors.js +36 -39
- package/dist/schema-utils/lib/table/tables/table-accessors.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts +6 -5
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js +2 -2
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js +8 -5
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-types.d.ts +1 -3
- package/dist/schema-utils/lib/table/tables/table-types.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-types.js +0 -4
- package/dist/schema-utils/lib/table/tables/table-types.js.map +1 -1
- package/dist/vector-table-scan-source.cjs +1766 -0
- package/dist/vector-table-scan-source.cjs.map +6 -0
- package/dist/vector-table-scan-source.d.ts +2 -0
- package/dist/vector-table-scan-source.d.ts.map +1 -0
- package/dist/vector-table-scan-source.js +2 -0
- package/dist/vector-table-scan-source.js.map +1 -0
- package/dist/worker-utils/index.cjs +407 -1184
- package/dist/worker-utils/index.cjs.map +3 -3
- package/dist/worker-utils/index.d.ts +2 -8
- package/dist/worker-utils/index.d.ts.map +1 -1
- package/dist/worker-utils/index.js +1 -10
- package/dist/worker-utils/index.js.map +1 -1
- package/dist/worker-utils/lib/env-utils/version.js +1 -1
- package/dist/worker-utils/lib/env-utils/version.js.map +1 -1
- package/dist/worker-utils/lib/library-utils/library-utils.d.ts.map +1 -1
- package/dist/worker-utils/lib/library-utils/library-utils.js +3 -2
- package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -1
- package/dist/worker-utils/lib/process-utils/child-process-proxy.d.ts.map +1 -1
- package/dist/worker-utils/lib/process-utils/child-process-proxy.js +8 -7
- package/dist/worker-utils/lib/process-utils/child-process-proxy.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/create-worker.d.ts +5 -7
- package/dist/worker-utils/lib/worker-api/create-worker.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/create-worker.js +76 -146
- package/dist/worker-utils/lib/worker-api/create-worker.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/get-worker-url.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/get-worker-url.js +5 -2
- package/dist/worker-utils/lib/worker-api/get-worker-url.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +17 -45
- package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.js +214 -312
- package/dist/worker-utils/lib/worker-api/process-on-worker.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/task-runtime.d.ts +36 -0
- package/dist/worker-utils/lib/worker-api/task-runtime.d.ts.map +1 -0
- package/dist/worker-utils/lib/worker-api/task-runtime.js +23 -0
- package/dist/worker-utils/lib/worker-api/task-runtime.js.map +1 -0
- package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js +1 -6
- package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js.map +1 -1
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts +1 -0
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.js +3 -1
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.js.map +1 -1
- package/dist/worker-utils/null-worker-node.js +836 -147
- package/dist/worker-utils/null-worker-node.js.map +4 -4
- package/dist/worker-utils/null-worker.js +804 -143
- package/dist/worker-utils/null-worker.js.map +4 -4
- package/dist/worker-utils/types.d.ts +55 -72
- package/dist/worker-utils/types.d.ts.map +1 -1
- package/package.json +141 -35
- package/src/arrow-geometry/binary-geometry-to-wkb.ts +1 -1
- package/src/arrow-geometry/feature-collection-to-arrow.ts +4 -3
- package/src/arrow-geometry/feature-table.ts +8 -17
- package/src/arrow-geometry/geojson-table.ts +32 -21
- package/src/arrow-geometry/geometry-codecs.ts +2 -2
- package/src/arrow-geometry/geometry-to-wkt.ts +2 -2
- package/src/arrow-geometry/index.ts +0 -9
- package/src/arrow-geometry/wkb-arrow-utils.ts +8 -12
- package/src/arrow-geometry/wkb-builder.ts +2 -2
- package/src/arrow-geometry/wkb-statistics.ts +2 -2
- package/src/arrow-worker-transport.ts +126 -0
- package/src/cluster-source.ts +1 -0
- package/src/federated-table-scan-source.ts +1 -0
- package/src/geoarrow/binary-polygon-to-geoarrow.ts +2 -2
- package/src/geoarrow/clustering/cluster-source.ts +20 -30
- package/src/geoarrow/convert-table-to-geoarrow.ts +14 -24
- package/src/geoarrow/geoarrow-bounds.ts +3 -3
- package/src/geoarrow/geoarrow-capabilities.ts +1 -1
- package/src/geoarrow/geoarrow-converter/convert-geoarrow-geometry.ts +3 -3
- package/src/geoarrow/geoarrow-converter/convert-geoarrow.ts +14 -9
- package/src/geoarrow/geoarrow-converter/geoarrow-converter.ts +7 -6
- package/src/geoarrow/geoarrow-inspection.ts +2 -2
- package/src/geoarrow/geoarrow-stream.ts +16 -16
- package/src/geoarrow/get-geoarrow-vertex-count.ts +1 -1
- package/src/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.ts +3 -3
- package/src/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.ts +4 -11
- package/src/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.ts +1 -1
- package/src/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts +2 -2
- package/src/geoarrow/lib/kernels/encode-geoarrow-box.ts +1 -1
- package/src/geoarrow/lib/table-converters/convert-geoarrow-table.ts +11 -11
- package/src/geoarrow/mesharrow/arrow-fixed-size-list-utils.ts +3 -2
- package/src/geoarrow/metadata/geoarrow-metadata.ts +3 -4
- package/src/index.ts +2 -6
- package/src/lib/api/create-data-source.ts +148 -58
- package/src/lib/api/encode.ts +14 -3
- package/src/lib/api/load-in-batches.ts +15 -7
- package/src/lib/api/load-loader.ts +22 -21
- package/src/lib/api/load.ts +51 -127
- package/src/lib/api/loader-options.ts +69 -0
- package/src/lib/api/parse-file.ts +32 -22
- package/src/lib/api/parse-in-batches.ts +121 -20
- package/src/lib/api/parse-sync.ts +30 -16
- package/src/lib/api/parse.ts +46 -29
- package/src/lib/api/select-loader.ts +54 -69
- package/src/lib/api/select-source.ts +7 -1
- package/src/lib/loader-utils/get-fetch-function.ts +2 -2
- package/src/lib/loader-utils/loggers.ts +2 -70
- package/src/lib/loader-utils/native-arrow.ts +83 -0
- package/src/lib/loader-utils/option-defaults.ts +9 -10
- package/src/lib/loader-utils/option-utils.ts +33 -122
- package/src/loader-utils/format-types.ts +4 -0
- package/src/loader-utils/index.ts +50 -10
- package/src/loader-utils/lib/files/http-file-transport.ts +65 -1
- package/src/loader-utils/lib/files/http-file-types.ts +2 -0
- package/src/loader-utils/lib/files/read-range-response.ts +66 -0
- package/src/loader-utils/lib/log-utils/log.ts +36 -1
- package/src/loader-utils/lib/pace-batch-iterator.ts +66 -0
- package/src/loader-utils/lib/request-utils/request-credentials.ts +1 -1
- package/src/loader-utils/lib/scan-utils/logical-table-query.ts +174 -0
- package/src/loader-utils/lib/scan-utils/query-options.ts +44 -0
- package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +81 -28
- package/src/loader-utils/lib/scan-utils/table-query.ts +76 -8
- package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +101 -53
- package/src/loader-utils/lib/sources/data-source.ts +57 -16
- package/src/loader-utils/lib/sources/image-source.ts +1 -1
- package/src/loader-utils/lib/sources/table-source-collection.ts +39 -0
- package/src/loader-utils/lib/sources/utils/utils.ts +1 -1
- package/src/loader-utils/lib/sources/vector-source.ts +3 -3
- package/src/loader-utils/lib/sources/vector-tile-source.ts +4 -9
- package/src/loader-utils/lib/worker-loader-utils/encode-with-worker.ts +5 -6
- package/src/loader-utils/lib/worker-loader-utils/parse-with-worker.ts +41 -24
- package/src/loader-utils/loader-types.ts +190 -111
- package/src/loader-utils/source-types.ts +17 -6
- package/src/null-loader.ts +1 -20
- package/src/polyfills/README.md +2 -2
- package/src/polyfills/images/encode-image-node.ts +44 -37
- package/src/polyfills/images/image-codecs-node.ts +2 -37
- package/src/polyfills/images/load-sharp.ts +13 -0
- package/src/polyfills/images/node-image-bitmap.ts +1 -1
- package/src/polyfills/images/node-image-formats.ts +10 -4
- package/src/polyfills/images/parse-image-node.ts +31 -40
- package/src/polyfills/index.ts +3 -3
- package/src/scan/arrow-execution/expressions.ts +116 -0
- package/src/scan/arrow-execution/filter-arrow-table.ts +298 -0
- package/src/scan/arrow-execution/project-arrow-table.ts +53 -0
- package/src/scan/arrow-execution.ts +7 -0
- package/src/scan/arrow-query-worker-entry.ts +8 -0
- package/src/scan/arrow-query-worker.ts +158 -0
- package/src/scan/arrow-query.ts +3 -0
- package/src/scan/catalog-query-source.ts +132 -0
- package/src/scan/federated-table-scan-source.ts +67 -78
- package/src/scan/index.ts +64 -6
- package/src/scan/parse-sql-predicate.ts +14 -367
- package/src/scan/query-arrow-table-in-batches.ts +55 -0
- package/src/scan/query-arrow-table.ts +81 -271
- package/src/scan/query-open-source.ts +39 -0
- package/src/scan/query-progressive.ts +229 -0
- package/src/scan/query-pushdown.ts +184 -0
- package/src/scan/query-scales.ts +199 -0
- package/src/scan/query.ts +594 -0
- package/src/scan/resolve-query-source.ts +47 -0
- package/src/scan/rows-to-arrow.ts +3 -39
- package/src/scan/scan-engine.ts +6 -6
- package/src/scan/sql-catalog.ts +167 -0
- package/src/scan/table-query.ts +6 -1
- package/src/scan/vector-table-scan-source.ts +25 -26
- package/src/schema/categories/category-mesh.ts +3 -11
- package/src/schema/categories/category-table.ts +2 -28
- package/src/schema/geometry/arrow-binary-features.ts +1 -1
- package/src/schema/geometry/geoarrow.ts +8 -19
- package/src/schema/index.ts +4 -5
- package/src/schema/types/batch.ts +0 -5
- package/src/schema-utils/index.ts +19 -10
- package/src/schema-utils/lib/arrow/arrow-metadata.ts +139 -0
- package/src/schema-utils/lib/converters/convert.ts +7 -2
- package/src/schema-utils/lib/converters/types.ts +2 -0
- package/src/schema-utils/lib/mesh/convert-mesh-to-table.ts +15 -43
- package/src/schema-utils/lib/mesh/convert-table-to-mesh.ts +19 -16
- package/src/schema-utils/lib/mesh/get-mesh-bounding-box.ts +52 -0
- package/src/schema-utils/lib/mesh/mesh-utils.ts +3 -49
- package/src/schema-utils/lib/mesh/point-cloud-tiler.ts +6 -5
- package/src/schema-utils/lib/schema/deduce-table-schema.ts +8 -4
- package/src/schema-utils/lib/table/arrow-api/arrow-like-table.ts +10 -9
- package/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts +21 -51
- package/src/schema-utils/lib/table/batch-builder/table-batch-builder.ts +68 -83
- package/src/schema-utils/lib/table/batches/convert-batches.ts +38 -21
- package/src/schema-utils/lib/table/batches/make-arrow-batch-iterator.ts +29 -19
- package/src/schema-utils/lib/table/batches/make-table-from-batches.ts +26 -7
- package/src/schema-utils/lib/table/query-arrow-table.ts +14 -32
- package/src/schema-utils/lib/table/tables/convert-arrow-table.ts +27 -95
- package/src/schema-utils/lib/table/tables/convert-table.ts +11 -57
- package/src/schema-utils/lib/table/tables/make-table.ts +6 -70
- package/src/schema-utils/lib/table/tables/row-utils.ts +2 -2
- package/src/schema-utils/lib/table/tables/table-accessors.ts +60 -63
- package/src/schema-utils/lib/table/tables/table-converter/convert-tables.ts +12 -14
- package/src/schema-utils/lib/table/tables/table-converter/table-converter.ts +12 -9
- package/src/schema-utils/lib/table/tables/table-types.ts +1 -7
- package/src/vector-table-scan-source.ts +1 -0
- package/src/worker-utils/index.ts +2 -18
- package/src/worker-utils/lib/library-utils/library-utils.ts +3 -2
- package/src/worker-utils/lib/process-utils/child-process-proxy.ts +8 -7
- package/src/worker-utils/lib/worker-api/create-worker.ts +89 -188
- package/src/worker-utils/lib/worker-api/get-worker-url.ts +4 -3
- package/src/worker-utils/lib/worker-api/process-on-worker.ts +246 -402
- package/src/worker-utils/lib/worker-api/task-runtime.ts +66 -0
- package/src/worker-utils/lib/worker-utils/get-loadable-worker-url.ts +1 -6
- package/src/worker-utils/lib/worker-utils/get-transfer-list.ts +2 -0
- package/src/worker-utils/types.ts +74 -109
- package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs +0 -477
- package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs.map +0 -7
- package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts +0 -29
- package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts.map +0 -1
- package/dist/arrow-geometry/arrow-geoarrow-adapter.js +0 -434
- package/dist/arrow-geometry/arrow-geoarrow-adapter.js.map +0 -1
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs +0 -39
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs.map +0 -7
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts +0 -2
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts.map +0 -1
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.js +0 -5
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/data-view-file.d.ts +0 -40
- package/dist/loader-utils/lib/file-provider/data-view-file.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/data-view-file.js +0 -68
- package/dist/loader-utils/lib/file-provider/data-view-file.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts +0 -54
- package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-handle-file.js +0 -102
- package/dist/loader-utils/lib/file-provider/file-handle-file.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts +0 -45
- package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider-interface.js +0 -13
- package/dist/loader-utils/lib/file-provider/file-provider-interface.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider.d.ts +0 -57
- package/dist/loader-utils/lib/file-provider/file-provider.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider.js +0 -114
- package/dist/loader-utils/lib/file-provider/file-provider.js.map +0 -1
- package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts.map +0 -1
- package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js.map +0 -1
- package/dist/schema/deprecated/mesh-utils.d.ts +0 -12
- package/dist/schema/deprecated/mesh-utils.d.ts.map +0 -1
- package/dist/schema/deprecated/mesh-utils.js +0 -37
- package/dist/schema/deprecated/mesh-utils.js.map +0 -1
- package/dist/schema-utils/arrow-transport.cjs +0 -691
- package/dist/schema-utils/arrow-transport.cjs.map +0 -6
- package/dist/schema-utils/arrow-transport.d.ts +0 -4
- package/dist/schema-utils/arrow-transport.d.ts.map +0 -1
- package/dist/schema-utils/arrow-transport.js +0 -7
- package/dist/schema-utils/arrow-transport.js.map +0 -1
- package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts +0 -76
- package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts.map +0 -1
- package/dist/schema-utils/lib/arrow/arrow-table-transport.js +0 -182
- package/dist/schema-utils/lib/arrow/arrow-table-transport.js.map +0 -1
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts +0 -33
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts.map +0 -1
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.js +0 -134
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts +0 -10
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js +0 -71
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts +0 -19
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js +0 -64
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts +0 -20
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js +0 -83
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts +0 -21
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js +0 -86
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts +0 -24
- package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.js.map +0 -1
- package/dist/worker-utils/lib/async-queue/async-queue.d.ts +0 -32
- package/dist/worker-utils/lib/async-queue/async-queue.d.ts.map +0 -1
- package/dist/worker-utils/lib/async-queue/async-queue.js +0 -91
- package/dist/worker-utils/lib/async-queue/async-queue.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-body.d.ts +0 -20
- package/dist/worker-utils/lib/worker-farm/worker-body.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-body.js +0 -131
- package/dist/worker-utils/lib/worker-farm/worker-body.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts +0 -58
- package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-farm.js +0 -116
- package/dist/worker-utils/lib/worker-farm/worker-farm.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-job.d.ts +0 -34
- package/dist/worker-utils/lib/worker-farm/worker-job.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-job.js +0 -74
- package/dist/worker-utils/lib/worker-farm/worker-job.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts +0 -94
- package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-pool.js +0 -246
- package/dist/worker-utils/lib/worker-farm/worker-pool.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts +0 -67
- package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-thread.js +0 -175
- package/dist/worker-utils/lib/worker-farm/worker-thread.js.map +0 -1
- package/src/arrow-geometry/arrow-geoarrow-adapter.ts +0 -568
- package/src/geoarrow/lib/arrow-geoarrow-adapter.ts +0 -12
- package/src/loader-utils/lib/file-provider/data-view-file.ts +0 -83
- package/src/loader-utils/lib/file-provider/file-handle-file.ts +0 -114
- package/src/loader-utils/lib/file-provider/file-provider-interface.ts +0 -60
- package/src/loader-utils/lib/file-provider/file-provider.ts +0 -130
- package/src/loader-utils/lib/scan-utils/experimental-scan-options.ts +0 -46
- package/src/polyfills/images/encode-image.node.ts.disabled +0 -41
- package/src/polyfills/images/parse-image.node.ts.disabled +0 -55
- package/src/schema/deprecated/mesh-utils.ts +0 -46
- package/src/schema-utils/arrow-transport.ts +0 -7
- package/src/schema-utils/lib/arrow/arrow-table-transport.ts +0 -282
- package/src/schema-utils/lib/arrow/split-arrow-buffers.ts +0 -247
- package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator-builders.ts.disabled +0 -190
- package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.ts +0 -85
- package/src/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.ts +0 -82
- package/src/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.ts +0 -103
- package/src/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.ts +0 -108
- package/src/schema-utils/lib/table/batch-builder/table-batch-aggregator.ts +0 -28
- package/src/worker-utils/lib/async-queue/async-queue.ts +0 -100
- package/src/worker-utils/lib/worker-farm/worker-body.ts +0 -145
- package/src/worker-utils/lib/worker-farm/worker-farm.ts +0 -144
- package/src/worker-utils/lib/worker-farm/worker-job.ts +0 -85
- package/src/worker-utils/lib/worker-farm/worker-pool.ts +0 -316
- 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
|
|
119
|
+
const log3 = new import_log.Log({ id: "loaders.gl" });
|
|
119
120
|
globalThis.loaders ||= {};
|
|
120
|
-
globalThis.loaders.log =
|
|
121
|
+
globalThis.loaders.log = log3;
|
|
121
122
|
globalThis.loaders.version = version;
|
|
122
123
|
globalThis.probe ||= {};
|
|
123
|
-
globalThis.probe.loaders =
|
|
124
|
-
return
|
|
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
|
|
217
|
+
const version3 = typeof __VERSION__ === "undefined" ? NPM_TAG : __VERSION__;
|
|
187
218
|
globalThis._loadersgl_ = globalThis._loadersgl_ || {};
|
|
188
|
-
globalThis._loadersgl_.version ||=
|
|
189
|
-
return
|
|
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-
|
|
220
|
-
var
|
|
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/
|
|
292
|
-
var
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
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
|
-
|
|
303
|
-
|
|
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
|
-
|
|
308
|
-
|
|
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
|
-
|
|
323
|
-
return workerURL;
|
|
293
|
+
return url;
|
|
324
294
|
}
|
|
325
|
-
function
|
|
326
|
-
if (
|
|
327
|
-
return
|
|
295
|
+
function warnIfUsingNpmTagFallback(worker, url) {
|
|
296
|
+
if (worker.version !== "latest") {
|
|
297
|
+
return;
|
|
328
298
|
}
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
const
|
|
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 || (
|
|
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
|
-
|
|
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
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
options
|
|
1143
|
-
|
|
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
|
-
|
|
1158
|
-
|
|
1159
|
-
await job.result;
|
|
390
|
+
);
|
|
391
|
+
return result.value;
|
|
1160
392
|
} finally {
|
|
1161
|
-
|
|
1162
|
-
job.abort(createAbortError2("Worker batch iterator was closed"));
|
|
1163
|
-
}
|
|
1164
|
-
closeJobInput();
|
|
393
|
+
await session.close();
|
|
1165
394
|
}
|
|
1166
395
|
}
|
|
1167
|
-
function
|
|
1168
|
-
|
|
1169
|
-
|
|
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
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
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
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
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
|
|
1190
|
-
|
|
1191
|
-
|
|
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
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
if (
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
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
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
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
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
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
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
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
|
|
569
|
+
function createModuleWorker(url) {
|
|
1249
570
|
var _a;
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
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" &&
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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 ? {
|
|
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
|
-
|
|
1442
|
-
|
|
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
|
-
|
|
786
|
+
serializedOptions._workerLoaderId = loader.id;
|
|
1450
787
|
}
|
|
1451
|
-
return
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 = { ...
|
|
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/
|
|
2403
|
-
function
|
|
2404
|
-
|
|
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
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
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
|
-
/**
|
|
2037
|
+
/** Discards informational messages. */
|
|
2640
2038
|
info() {
|
|
2641
|
-
return
|
|
2642
|
-
};
|
|
2039
|
+
return ignoreMessage2;
|
|
2643
2040
|
}
|
|
2644
|
-
/**
|
|
2041
|
+
/** Discards messages marked to be emitted once. */
|
|
2645
2042
|
once() {
|
|
2646
|
-
return
|
|
2647
|
-
};
|
|
2043
|
+
return ignoreMessage2;
|
|
2648
2044
|
}
|
|
2649
|
-
/**
|
|
2045
|
+
/** Discards warnings. */
|
|
2650
2046
|
warn() {
|
|
2651
|
-
return
|
|
2652
|
-
};
|
|
2047
|
+
return ignoreMessage2;
|
|
2653
2048
|
}
|
|
2654
|
-
/**
|
|
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:
|
|
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
|
-
|
|
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
|
-
//
|
|
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.
|
|
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.
|
|
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
|
|
2219
|
+
return cloneLoaderOptions(state.globalOptions);
|
|
2844
2220
|
}
|
|
2845
2221
|
function setGlobalOptions(options) {
|
|
2846
2222
|
const state = getGlobalLoaderState();
|
|
2847
2223
|
const globalOptions = getGlobalLoaderOptions();
|
|
2848
|
-
|
|
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 =
|
|
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
|
|
2260
|
+
const isLifecycleOption = !id && ["signal", "onProgress"].includes(key);
|
|
2895
2261
|
const isWorkerUrlOption = key === "workerUrl" && id;
|
|
2896
|
-
if (!(key in defaultOptions) && !
|
|
2262
|
+
if (!(key in defaultOptions) && !isLifecycleOption && !isWorkerUrlOption) {
|
|
2897
2263
|
if (key in deprecatedOptions) {
|
|
2898
|
-
if (
|
|
2899
|
-
|
|
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 (
|
|
2268
|
+
if (log2.level > 0) {
|
|
2903
2269
|
const suggestion = findSimilarOption(key, loaders);
|
|
2904
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
|
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()[
|
|
2330
|
+
const globalLoaderScopedOptions = getGlobalLoaderOptions()[shapeOptionKey];
|
|
2957
2331
|
if (isPureObject(globalLoaderScopedOptions) && "shape" in globalLoaderScopedOptions) {
|
|
2958
2332
|
return;
|
|
2959
2333
|
}
|
|
2960
|
-
const userLoaderScopedOptions = userOptions[
|
|
2334
|
+
const userLoaderScopedOptions = userOptions[shapeOptionKey];
|
|
2961
2335
|
if (isPureObject(userLoaderScopedOptions) && "shape" in userLoaderScopedOptions) {
|
|
2962
2336
|
return;
|
|
2963
2337
|
}
|
|
2964
|
-
const loaderScopedOptions = mergedOptions[
|
|
2965
|
-
mergedOptions[
|
|
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
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
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
|
-
|
|
3011
|
-
|
|
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
|
|
3021
|
-
if (
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
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
|
-
|
|
3029
|
-
|
|
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
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
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
|
-
|
|
3103
|
-
|
|
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
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
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
|
-
|
|
3120
|
-
|
|
3121
|
-
loader =
|
|
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 && !
|
|
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
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
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
|
-
|
|
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
|
|
3172
|
-
|
|
3173
|
-
|
|
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
|
|
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(
|
|
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(
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 =
|
|
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 (
|
|
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 = (
|
|
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
|
-
"
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
3927
|
-
|
|
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
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
if (
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
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
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
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
|
|
3461
|
+
const { parseUrl } = loaderImplementation;
|
|
4121
3462
|
if (parseUrl) {
|
|
4122
3463
|
const requestUrl = applySearchParamsToUrl(url, resolvedOptions);
|
|
4123
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
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
|
|
4156
|
-
|
|
4157
|
-
|
|
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
|
|
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
|
|
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 (
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4385
|
-
|
|
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,
|
|
4420
|
-
var _a, _b, _c
|
|
4421
|
-
|
|
4422
|
-
const
|
|
4423
|
-
const
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
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
|
|
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
|
-
...
|
|
3831
|
+
...options,
|
|
4440
3832
|
core: {
|
|
4441
|
-
...
|
|
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
|
-
} :
|
|
4448
|
-
return
|
|
3836
|
+
} : options);
|
|
3837
|
+
return constructSource(implementation, data, authenticatedOptions);
|
|
4449
3838
|
}
|
|
4450
|
-
function
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
|
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
|
|
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:
|
|
3925
|
+
version: VERSION5,
|
|
4545
3926
|
mimeTypes: ["application/x.empty"],
|
|
4546
3927
|
extensions: ["null"],
|
|
4547
3928
|
parse: async (arrayBuffer, options, context) => parseSync2(arrayBuffer, options || {}, context),
|