@mailwoman/core 9.3.0 → 10.0.0
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/lib/coarse-placer/tools/{build-dataset.ts → build/dataset.ts} +2 -1
- package/lib/coarse-placer/tools/{build-outlier-latin.ts → build/outlier/latin.ts} +4 -3
- package/lib/coarse-placer/tools/{eval-openset.ts → eval/openset.ts} +11 -7
- package/lib/coarse-placer/tools/{eval-quant-compare.ts → eval/quant-compare.ts} +2 -1
- package/lib/coarse-placer/tools/eval.ts +2 -2
- package/lib/coarse-placer/tools/index.ts +7 -7
- package/lib/coarse-placer/tools/train.ts +4 -6
- package/lib/decoder/build-tree.ts +2 -1
- package/lib/decoder/containment.ts +2 -1
- package/lib/decoder/index.ts +5 -5
- package/lib/decoder/parse-diff.ts +1 -1
- package/lib/decoder/proposals-to-tree.ts +3 -1
- package/lib/decoder/{serialize-json.ts → serialize/json.ts} +3 -2
- package/lib/decoder/{serialize-tuples.ts → serialize/tuples.ts} +2 -1
- package/lib/decoder/{tree-shape.ts → tree/shape.ts} +7 -10
- package/lib/decoder/types.ts +1 -3
- package/lib/decoder/unknown-spans.ts +1 -1
- package/lib/decoder/validate-tree.ts +2 -1
- package/lib/fs/readers/stat.ts +244 -0
- package/lib/fs/readers.ts +38 -270
- package/lib/fs/streams.ts +58 -0
- package/lib/fs/writers.ts +5 -5
- package/lib/fs/zip.ts +64 -8
- package/lib/git.ts +26 -0
- package/lib/layers/coverage.ts +3 -2
- package/lib/layers/manifest.ts +2 -4
- package/lib/layers/schema.ts +0 -1
- package/lib/license/configured.ts +2 -2
- package/lib/license/docs-site.ts +1 -15
- package/lib/license/index.ts +2 -2
- package/lib/license/obligations.ts +4 -1
- package/lib/license/stamp.ts +1 -1
- package/lib/license/status.ts +1 -1
- package/lib/locale/locale.ts +2 -1
- package/lib/locale/registry.ts +2 -1
- package/lib/module/resolve-from.ts +16 -4
- package/lib/objects.ts +9 -1
- package/lib/overture-pins.ts +24 -0
- package/lib/pipeline/client-result.ts +82 -0
- package/lib/pipeline/index.ts +1 -1
- package/lib/pipeline/preferences.ts +13 -0
- package/lib/pipeline/result.ts +84 -0
- package/lib/pipeline/runtime-pipeline.ts +10 -17
- package/lib/pipeline/types.ts +28 -88
- package/lib/policy/defaults.ts +2 -1
- package/lib/policy/policy.ts +3 -1
- package/lib/policy/registry.ts +3 -1
- package/lib/process.ts +3 -1
- package/lib/resolver/authoritative-provider.ts +1 -1
- package/lib/resolver/index.ts +1 -8
- package/lib/resolver/lookup-types.ts +8 -0
- package/lib/resolver/synthetic-id-ranges.ts +83 -0
- package/lib/resolver/types.ts +2 -9
- package/lib/resources/whosonfirst/placetypes/Placetype.ts +7 -6
- package/lib/scripting/arguments.ts +34 -0
- package/lib/scripting/utils/index.ts +1 -1
- package/lib/strings/case.ts +13 -2
- package/lib/strings/format.ts +15 -0
- package/lib/tokenization/Graph.ts +3 -4
- package/lib/tools/{download-libpostal-resources.ts → download/libpostal-resources.ts} +3 -2
- package/lib/tools/generate-language-types.ts +3 -4
- package/lib/tools/index.ts +2 -2
- package/lib/types/classifier.ts +2 -1
- package/lib/types/index.ts +0 -1
- package/lib/types/mapping.ts +2 -1
- package/lib/workspaces.ts +104 -0
- package/out/api/APIClient.d.ts.map +1 -1
- package/out/api/arcgis.d.ts.map +1 -1
- package/out/api/defaults.d.ts.map +1 -1
- package/out/api/headless.d.ts.map +1 -1
- package/out/api/ogc.d.ts.map +1 -1
- package/out/api/paced-client.js.map +1 -1
- package/out/api/pacer.d.ts.map +1 -1
- package/out/api/pacer.js.map +1 -1
- package/out/api/responses.d.ts.map +1 -1
- package/out/api/{test-clocks.d.ts → test/clocks.d.ts} +1 -1
- package/out/api/test/clocks.d.ts.map +1 -0
- package/out/api/{test-clocks.js → test/clocks.js} +1 -1
- package/out/api/test/clocks.js.map +1 -0
- package/out/api/{test-transport.d.ts → test/transport.d.ts} +1 -1
- package/out/api/test/transport.d.ts.map +1 -0
- package/out/api/{test-transport.js → test/transport.js} +1 -1
- package/out/api/test/transport.js.map +1 -0
- package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
- package/out/coarse-placer/coarse-placer.js.map +1 -1
- package/out/coarse-placer/featurize.d.ts.map +1 -1
- package/out/coarse-placer/tools/{build-dataset.d.ts → build/dataset.d.ts} +1 -1
- package/out/coarse-placer/tools/build/dataset.d.ts.map +1 -0
- package/out/coarse-placer/tools/{build-dataset.js → build/dataset.js} +3 -2
- package/out/coarse-placer/tools/build/dataset.js.map +1 -0
- package/out/coarse-placer/tools/{build-outlier-exposure.d.ts → build/outlier/exposure.d.ts} +1 -1
- package/out/coarse-placer/tools/build/outlier/exposure.d.ts.map +1 -0
- package/out/coarse-placer/tools/{build-outlier-exposure.js → build/outlier/exposure.js} +1 -1
- package/out/coarse-placer/tools/build/outlier/exposure.js.map +1 -0
- package/out/coarse-placer/tools/{build-outlier-latin.d.ts → build/outlier/latin.d.ts} +3 -3
- package/out/coarse-placer/tools/build/outlier/latin.d.ts.map +1 -0
- package/out/coarse-placer/tools/{build-outlier-latin.js → build/outlier/latin.js} +4 -3
- package/out/coarse-placer/tools/build/outlier/latin.js.map +1 -0
- package/out/coarse-placer/tools/{build-outlier-oa.d.ts → build/outlier/oa.d.ts} +1 -1
- package/out/coarse-placer/tools/build/outlier/oa.d.ts.map +1 -0
- package/out/coarse-placer/tools/{build-outlier-oa.js → build/outlier/oa.js} +1 -1
- package/out/coarse-placer/tools/build/outlier/oa.js.map +1 -0
- package/out/coarse-placer/tools/country-sets.d.ts.map +1 -1
- package/out/coarse-placer/tools/{eval-latin-offmap.d.ts → eval/latin-offmap.d.ts} +1 -1
- package/out/coarse-placer/tools/eval/latin-offmap.d.ts.map +1 -0
- package/out/coarse-placer/tools/{eval-latin-offmap.js → eval/latin-offmap.js} +1 -1
- package/out/coarse-placer/tools/eval/latin-offmap.js.map +1 -0
- package/out/coarse-placer/tools/{eval-openset.d.ts → eval/openset.d.ts} +1 -1
- package/out/coarse-placer/tools/eval/openset.d.ts.map +1 -0
- package/out/coarse-placer/tools/{eval-openset.js → eval/openset.js} +10 -7
- package/out/coarse-placer/tools/eval/openset.js.map +1 -0
- package/out/coarse-placer/tools/{eval-quant-compare.d.ts → eval/quant-compare.d.ts} +1 -1
- package/out/coarse-placer/tools/eval/quant-compare.d.ts.map +1 -0
- package/out/coarse-placer/tools/{eval-quant-compare.js → eval/quant-compare.js} +2 -2
- package/out/coarse-placer/tools/eval/quant-compare.js.map +1 -0
- package/out/coarse-placer/tools/eval.js +2 -2
- package/out/coarse-placer/tools/eval.js.map +1 -1
- package/out/coarse-placer/tools/index.d.ts +7 -7
- package/out/coarse-placer/tools/index.js +7 -7
- package/out/coarse-placer/tools/probe-frontier.js.map +1 -1
- package/out/coarse-placer/tools/quantize.js.map +1 -1
- package/out/coarse-placer/tools/train.d.ts.map +1 -1
- package/out/coarse-placer/tools/train.js +2 -3
- package/out/coarse-placer/tools/train.js.map +1 -1
- package/out/data-root.js.map +1 -1
- package/out/decoder/build-tree.d.ts.map +1 -1
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/containment.d.ts +2 -2
- package/out/decoder/containment.d.ts.map +1 -1
- package/out/decoder/containment.js.map +1 -1
- package/out/decoder/index.d.ts +5 -5
- package/out/decoder/index.js +5 -5
- package/out/decoder/parse-diff.js +1 -1
- package/out/decoder/parse-diff.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts +2 -1
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/{serialize-json.d.ts → serialize/json.d.ts} +2 -2
- package/out/decoder/serialize/json.d.ts.map +1 -0
- package/out/decoder/{serialize-json.js → serialize/json.js} +2 -2
- package/out/decoder/serialize/json.js.map +1 -0
- package/out/decoder/{serialize-tuples.d.ts → serialize/tuples.d.ts} +2 -2
- package/out/decoder/serialize/tuples.d.ts.map +1 -0
- package/out/decoder/{serialize-tuples.js → serialize/tuples.js} +1 -1
- package/out/decoder/serialize/tuples.js.map +1 -0
- package/out/decoder/{serialize-xml.d.ts → serialize/xml.d.ts} +1 -1
- package/out/decoder/serialize/xml.d.ts.map +1 -0
- package/out/decoder/{serialize-xml.js → serialize/xml.js} +1 -1
- package/out/decoder/serialize/xml.js.map +1 -0
- package/out/decoder/{tree-shape.d.ts → tree/shape.d.ts} +5 -9
- package/out/decoder/tree/shape.d.ts.map +1 -0
- package/out/decoder/{tree-shape.js → tree/shape.js} +6 -10
- package/out/decoder/tree/shape.js.map +1 -0
- package/out/decoder/{tree-walk.d.ts → tree/walk.d.ts} +1 -1
- package/out/decoder/tree/walk.d.ts.map +1 -0
- package/out/decoder/{tree-walk.js → tree/walk.js} +1 -1
- package/out/decoder/tree/walk.js.map +1 -0
- package/out/decoder/types.d.ts +1 -2
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +1 -1
- package/out/decoder/types.js.map +1 -1
- package/out/decoder/unknown-spans.js +1 -1
- package/out/decoder/validate-tree.d.ts +1 -1
- package/out/decoder/validate-tree.d.ts.map +1 -1
- package/out/decoder/validate-tree.js.map +1 -1
- package/out/env/index.d.ts +1 -1
- package/out/env/schema.d.ts +4 -4
- package/out/errors/schema.d.ts.map +1 -1
- package/out/errors/schema.js.map +1 -1
- package/out/fs/formatters.d.ts.map +1 -1
- package/out/fs/formatters.js.map +1 -1
- package/out/fs/readers/stat.d.ts +126 -0
- package/out/fs/readers/stat.d.ts.map +1 -0
- package/out/fs/readers/stat.js +202 -0
- package/out/fs/readers/stat.js.map +1 -0
- package/out/fs/readers.d.ts +16 -149
- package/out/fs/readers.d.ts.map +1 -1
- package/out/fs/readers.js +19 -230
- package/out/fs/readers.js.map +1 -1
- package/out/fs/streams.d.ts +33 -0
- package/out/fs/streams.d.ts.map +1 -1
- package/out/fs/streams.js +49 -0
- package/out/fs/streams.js.map +1 -1
- package/out/fs/writers.d.ts +5 -5
- package/out/fs/writers.js +5 -5
- package/out/fs/zip.d.ts +21 -2
- package/out/fs/zip.d.ts.map +1 -1
- package/out/fs/zip.js +36 -8
- package/out/fs/zip.js.map +1 -1
- package/out/git.d.ts +15 -0
- package/out/git.d.ts.map +1 -1
- package/out/git.js +22 -0
- package/out/git.js.map +1 -1
- package/out/html/document.js.map +1 -1
- package/out/json.d.ts.map +1 -1
- package/out/layers/coverage.d.ts +1 -1
- package/out/layers/coverage.d.ts.map +1 -1
- package/out/layers/coverage.js +1 -2
- package/out/layers/coverage.js.map +1 -1
- package/out/layers/manifest.d.ts +2 -2
- package/out/layers/manifest.d.ts.map +1 -1
- package/out/layers/manifest.js +2 -3
- package/out/layers/manifest.js.map +1 -1
- package/out/layers/schema.d.ts +0 -1
- package/out/layers/schema.d.ts.map +1 -1
- package/out/layers/schema.js +0 -3
- package/out/layers/schema.js.map +1 -1
- package/out/license/configured.d.ts +1 -1
- package/out/license/configured.d.ts.map +1 -1
- package/out/license/configured.js +2 -2
- package/out/license/configured.js.map +1 -1
- package/out/license/docs-site.d.ts +0 -6
- package/out/license/docs-site.d.ts.map +1 -1
- package/out/license/docs-site.js +1 -12
- package/out/license/docs-site.js.map +1 -1
- package/out/license/index.d.ts +2 -2
- package/out/license/index.d.ts.map +1 -1
- package/out/license/index.js +2 -2
- package/out/license/index.js.map +1 -1
- package/out/license/{key-file.d.ts → key/file.d.ts} +1 -1
- package/out/license/key/file.d.ts.map +1 -0
- package/out/license/{key-file.js → key/file.js} +1 -1
- package/out/license/key/file.js.map +1 -0
- package/out/license/{key.d.ts → key/index.d.ts} +1 -1
- package/out/license/key/index.d.ts.map +1 -0
- package/out/license/{key.js → key/index.js} +1 -1
- package/out/license/key/index.js.map +1 -0
- package/out/license/obligations.d.ts +1 -1
- package/out/license/obligations.d.ts.map +1 -1
- package/out/license/obligations.js +3 -0
- package/out/license/obligations.js.map +1 -1
- package/out/license/publication.js.map +1 -1
- package/out/license/register.d.ts.map +1 -1
- package/out/license/stamp.d.ts +1 -1
- package/out/license/stamp.d.ts.map +1 -1
- package/out/license/status.js +1 -1
- package/out/license/status.js.map +1 -1
- package/out/locale/locale.d.ts +1 -1
- package/out/locale/locale.d.ts.map +1 -1
- package/out/locale/registry.d.ts.map +1 -1
- package/out/locale/registry.js +1 -1
- package/out/locale/registry.js.map +1 -1
- package/out/locale/zh-cn-units.d.ts.map +1 -1
- package/out/logging/shared.d.ts.map +1 -1
- package/out/module/resolve-from.d.ts +12 -3
- package/out/module/resolve-from.d.ts.map +1 -1
- package/out/module/resolve-from.js.map +1 -1
- package/out/module/resolvers.js.map +1 -1
- package/out/objects.d.ts +6 -0
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +8 -1
- package/out/objects.js.map +1 -1
- package/out/overture-pins.d.ts +24 -0
- package/out/overture-pins.d.ts.map +1 -0
- package/out/overture-pins.js +24 -0
- package/out/overture-pins.js.map +1 -0
- package/out/paths.js.map +1 -1
- package/out/pipeline/client-result.d.ts +84 -0
- package/out/pipeline/client-result.d.ts.map +1 -0
- package/out/pipeline/client-result.js +12 -0
- package/out/pipeline/client-result.js.map +1 -0
- package/out/pipeline/index.d.ts +1 -1
- package/out/pipeline/index.d.ts.map +1 -1
- package/out/pipeline/preferences.d.ts +13 -0
- package/out/pipeline/preferences.d.ts.map +1 -0
- package/out/pipeline/preferences.js +7 -0
- package/out/pipeline/preferences.js.map +1 -0
- package/out/pipeline/result.d.ts +72 -0
- package/out/pipeline/result.d.ts.map +1 -0
- package/out/pipeline/result.js +7 -0
- package/out/pipeline/result.js.map +1 -0
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +7 -13
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/span-proposer.js.map +1 -1
- package/out/pipeline/types.d.ts +23 -85
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +2 -0
- package/out/pipeline/types.js.map +1 -1
- package/out/policy/defaults.d.ts +1 -1
- package/out/policy/defaults.d.ts.map +1 -1
- package/out/policy/defaults.js +1 -1
- package/out/policy/defaults.js.map +1 -1
- package/out/policy/policy.d.ts +2 -1
- package/out/policy/policy.d.ts.map +1 -1
- package/out/policy/proposal-collection.js.map +1 -1
- package/out/policy/registry.d.ts +2 -1
- package/out/policy/registry.d.ts.map +1 -1
- package/out/policy/registry.js.map +1 -1
- package/out/process.d.ts +2 -2
- package/out/process.d.ts.map +1 -1
- package/out/process.js.map +1 -1
- package/out/random.d.ts.map +1 -1
- package/out/release-config.js.map +1 -1
- package/out/resolver/authoritative-provider.d.ts +1 -1
- package/out/resolver/authoritative-provider.d.ts.map +1 -1
- package/out/resolver/fixture-authoritative-provider.js.map +1 -1
- package/out/resolver/index.d.ts +2 -2
- package/out/resolver/index.d.ts.map +1 -1
- package/out/resolver/index.js +1 -1
- package/out/resolver/index.js.map +1 -1
- package/out/resolver/lookup-types.d.ts +8 -0
- package/out/resolver/lookup-types.d.ts.map +1 -1
- package/out/resolver/synthetic-id-ranges.d.ts +66 -0
- package/out/resolver/synthetic-id-ranges.d.ts.map +1 -0
- package/out/resolver/synthetic-id-ranges.js +73 -0
- package/out/resolver/synthetic-id-ranges.js.map +1 -0
- package/out/resolver/types.d.ts +1 -2
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +0 -1
- package/out/resolver/types.js.map +1 -1
- package/out/resources/languages/index.js.map +1 -1
- package/out/resources/languages/types.gen.d.ts.map +1 -1
- package/out/resources/locale.d.ts.map +1 -1
- package/out/resources/set.d.ts.map +1 -1
- package/out/resources/set.js.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.js +7 -6
- package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/definition.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
- package/out/routing/index.d.ts.map +1 -1
- package/out/routing/index.js.map +1 -1
- package/out/scripting/arguments.d.ts +7 -0
- package/out/scripting/arguments.d.ts.map +1 -1
- package/out/scripting/arguments.js +29 -0
- package/out/scripting/arguments.js.map +1 -1
- package/out/scripting/command.d.ts.map +1 -1
- package/out/scripting/ingest-chunk-script.d.ts.map +1 -1
- package/out/scripting/utils/index.d.ts +1 -1
- package/out/scripting/utils/index.d.ts.map +1 -1
- package/out/scripting/utils/index.js +1 -1
- package/out/scripting/utils/index.js.map +1 -1
- package/out/strings/case.d.ts +3 -0
- package/out/strings/case.d.ts.map +1 -1
- package/out/strings/case.js +12 -2
- package/out/strings/case.js.map +1 -1
- package/out/strings/format.d.ts +6 -0
- package/out/strings/format.d.ts.map +1 -1
- package/out/strings/format.js +12 -0
- package/out/strings/format.js.map +1 -1
- package/out/strings/python-json.js.map +1 -1
- package/out/tokenization/Graph.d.ts +3 -0
- package/out/tokenization/Graph.d.ts.map +1 -1
- package/out/tokenization/Graph.js +0 -4
- package/out/tokenization/Graph.js.map +1 -1
- package/out/tokenization/Span.d.ts.map +1 -1
- package/out/tokenization/Span.js.map +1 -1
- package/out/tokenization/normalizer.d.ts.map +1 -1
- package/out/tokenization/normalizer.js.map +1 -1
- package/out/tools/{download-libpostal-resources.d.ts → download/libpostal-resources.d.ts} +1 -1
- package/out/tools/download/libpostal-resources.d.ts.map +1 -0
- package/out/tools/{download-libpostal-resources.js → download/libpostal-resources.js} +4 -3
- package/out/tools/download/libpostal-resources.js.map +1 -0
- package/out/tools/{download-ssl-address.d.ts → download/ssl-address.d.ts} +1 -1
- package/out/tools/download/ssl-address.d.ts.map +1 -0
- package/out/tools/{download-ssl-address.js → download/ssl-address.js} +1 -1
- package/out/tools/download/ssl-address.js.map +1 -0
- package/out/tools/generate-language-types.d.ts.map +1 -1
- package/out/tools/generate-language-types.js +3 -4
- package/out/tools/generate-language-types.js.map +1 -1
- package/out/tools/index.d.ts +2 -2
- package/out/tools/index.js +2 -2
- package/out/types/Classification.d.ts +2 -2
- package/out/types/Classification.d.ts.map +1 -1
- package/out/types/classifier.d.ts +1 -1
- package/out/types/classifier.d.ts.map +1 -1
- package/out/types/index.d.ts +0 -1
- package/out/types/index.d.ts.map +1 -1
- package/out/types/index.js +0 -1
- package/out/types/index.js.map +1 -1
- package/out/types/mapping.d.ts +1 -1
- package/out/types/mapping.d.ts.map +1 -1
- package/out/types/mapping.js.map +1 -1
- package/out/utils/time.js.map +1 -1
- package/out/workspaces.d.ts +31 -0
- package/out/workspaces.d.ts.map +1 -0
- package/out/workspaces.js +72 -0
- package/out/workspaces.js.map +1 -0
- package/package.json +84 -55
- package/lib/resolver/placetype-map.ts +0 -130
- package/lib/types/component.ts +0 -96
- package/out/api/test-clocks.d.ts.map +0 -1
- package/out/api/test-clocks.js.map +0 -1
- package/out/api/test-transport.d.ts.map +0 -1
- package/out/api/test-transport.js.map +0 -1
- package/out/coarse-placer/tools/build-dataset.d.ts.map +0 -1
- package/out/coarse-placer/tools/build-dataset.js.map +0 -1
- package/out/coarse-placer/tools/build-outlier-exposure.d.ts.map +0 -1
- package/out/coarse-placer/tools/build-outlier-exposure.js.map +0 -1
- package/out/coarse-placer/tools/build-outlier-latin.d.ts.map +0 -1
- package/out/coarse-placer/tools/build-outlier-latin.js.map +0 -1
- package/out/coarse-placer/tools/build-outlier-oa.d.ts.map +0 -1
- package/out/coarse-placer/tools/build-outlier-oa.js.map +0 -1
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts.map +0 -1
- package/out/coarse-placer/tools/eval-latin-offmap.js.map +0 -1
- package/out/coarse-placer/tools/eval-openset.d.ts.map +0 -1
- package/out/coarse-placer/tools/eval-openset.js.map +0 -1
- package/out/coarse-placer/tools/eval-quant-compare.d.ts.map +0 -1
- package/out/coarse-placer/tools/eval-quant-compare.js.map +0 -1
- package/out/decoder/serialize-json.d.ts.map +0 -1
- package/out/decoder/serialize-json.js.map +0 -1
- package/out/decoder/serialize-tuples.d.ts.map +0 -1
- package/out/decoder/serialize-tuples.js.map +0 -1
- package/out/decoder/serialize-xml.d.ts.map +0 -1
- package/out/decoder/serialize-xml.js.map +0 -1
- package/out/decoder/tree-shape.d.ts.map +0 -1
- package/out/decoder/tree-shape.js.map +0 -1
- package/out/decoder/tree-walk.d.ts.map +0 -1
- package/out/decoder/tree-walk.js.map +0 -1
- package/out/license/key-file.d.ts.map +0 -1
- package/out/license/key-file.js.map +0 -1
- package/out/license/key.d.ts.map +0 -1
- package/out/license/key.js.map +0 -1
- package/out/resolver/placetype-map.d.ts +0 -76
- package/out/resolver/placetype-map.d.ts.map +0 -1
- package/out/resolver/placetype-map.js +0 -106
- package/out/resolver/placetype-map.js.map +0 -1
- package/out/tools/download-libpostal-resources.d.ts.map +0 -1
- package/out/tools/download-libpostal-resources.js.map +0 -1
- package/out/tools/download-ssl-address.d.ts.map +0 -1
- package/out/tools/download-ssl-address.js.map +0 -1
- package/out/types/component.d.ts +0 -50
- package/out/types/component.d.ts.map +0 -1
- package/out/types/component.js +0 -84
- package/out/types/component.js.map +0 -1
- /package/lib/api/{test-clocks.ts → test/clocks.ts} +0 -0
- /package/lib/api/{test-transport.ts → test/transport.ts} +0 -0
- /package/lib/coarse-placer/tools/{build-outlier-exposure.ts → build/outlier/exposure.ts} +0 -0
- /package/lib/coarse-placer/tools/{build-outlier-oa.ts → build/outlier/oa.ts} +0 -0
- /package/lib/coarse-placer/tools/{eval-latin-offmap.ts → eval/latin-offmap.ts} +0 -0
- /package/lib/decoder/{serialize-xml.ts → serialize/xml.ts} +0 -0
- /package/lib/decoder/{tree-walk.ts → tree/walk.ts} +0 -0
- /package/lib/license/{key-file.ts → key/file.ts} +0 -0
- /package/lib/license/{key.ts → key/index.ts} +0 -0
- /package/lib/tools/{download-ssl-address.ts → download/ssl-address.ts} +0 -0
package/out/fs/readers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readers.d.ts","sourceRoot":"","sources":["../../lib/fs/readers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"readers.d.ts","sourceRoot":"","sources":["../../lib/fs/readers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,KAAK,eAAe,EAAe,MAAM,SAAS,CAAA;AAK3D,cAAc,kBAAkB,CAAA;AAEhC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACtD,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAa3F;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAW1G;AAkBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,EAAE,GAAG,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAM7G;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,MAAM,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;AAE/G;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAChC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3B,CAAC,SAAS,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,EACpE,GAAG,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AASjC;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CACnC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3B,CAAC,SAAS,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,EACpE,GAAG,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAQvC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,EAAE,GAAG,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAM3G;AAMD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEzD;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAErF"}
|
package/out/fs/readers.js
CHANGED
|
@@ -7,177 +7,11 @@
|
|
|
7
7
|
* `node:fs` is reached from this directory alone, and every reader answers a promise: no executable repository
|
|
8
8
|
* code makes a blocking filesystem call, and the `debt` check in `packages/repo-health` counts any that appears.
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { readFile } from "node:fs/promises";
|
|
11
11
|
import { resolvePath } from "path-ts";
|
|
12
|
-
import {
|
|
12
|
+
import { open } from "#fs/readers/stat";
|
|
13
13
|
import { parseJSONStrict } from "#json";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Attempts to stat a file or directory.
|
|
17
|
-
*
|
|
18
|
-
* A `URL` is passed through rather than stringified: `node:fs` accepts a `file:` URL object, and rejects the string it
|
|
19
|
-
* prints — `stat("file:///etc/hostname")` is ENOENT, which this function reports as absence. Every caller that looks a
|
|
20
|
-
* file up by URL therefore read "not there" for everything, and `cli-native/command-router.ts` answered `Unknown
|
|
21
|
-
* command` for every command it has.
|
|
22
|
-
*
|
|
23
|
-
* @throws If the path exists but cannot be statted for some reason other than non-existence.
|
|
24
|
-
*/
|
|
25
|
-
export function tryStat(pathBuilderLike) {
|
|
26
|
-
const target = pathBuilderLike instanceof URL ? pathBuilderLike : pathBuilderLike.toString();
|
|
27
|
-
return stat(target).catch((error) => {
|
|
28
|
-
if (error.code === "ENOENT")
|
|
29
|
-
return null;
|
|
30
|
-
throw error;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Stat a file or directory, raising ENOENT when nothing is there.
|
|
35
|
-
*
|
|
36
|
-
* The throwing counterpart to {@linkcode tryStat}. Reach for this one where absence is a defect the caller wants
|
|
37
|
-
* reported, and for {@linkcode tryStat} where absence is an answer.
|
|
38
|
-
*/
|
|
39
|
-
export function statPath(path) {
|
|
40
|
-
return stat(path instanceof URL ? path : path.toString());
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Stat a path without following a symbolic link, so the answer describes the link itself.
|
|
44
|
-
*/
|
|
45
|
-
export function statLink(path) {
|
|
46
|
-
return lstat(path instanceof URL ? path : path.toString());
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Stat a path without following a symbolic link, answering `null` when nothing is there.
|
|
50
|
-
*
|
|
51
|
-
* The link-level counterpart to {@linkcode tryStat}.
|
|
52
|
-
*/
|
|
53
|
-
export function tryStatLink(path) {
|
|
54
|
-
return lstat(path instanceof URL ? path : path.toString()).catch((error) => {
|
|
55
|
-
if (error.code === "ENOENT")
|
|
56
|
-
return null;
|
|
57
|
-
throw error;
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Whether a path exists, whatever it is.
|
|
62
|
-
*
|
|
63
|
-
* The asynchronous answer to `existsSync`, which is the single most-called synchronous builtin in the repository.
|
|
64
|
-
* Prefer {@linkcode isFile} or {@linkcode isDirectory} where the caller goes on to assume one or the other: a directory
|
|
65
|
-
* where a file was expected passes this check and fails the next line.
|
|
66
|
-
*/
|
|
67
|
-
export function pathExists(path) {
|
|
68
|
-
return tryStat(path).then((stats) => stats !== null);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Whether a path exists and is a directory.
|
|
72
|
-
*/
|
|
73
|
-
export function isDirectory(path) {
|
|
74
|
-
return tryStat(path).then((stats) => stats?.isDirectory() ?? false);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Whether a path exists and is a file.
|
|
78
|
-
*/
|
|
79
|
-
export function isFile(path) {
|
|
80
|
-
return tryStat(path).then((stats) => stats?.isFile() ?? false);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Whether a path exists and is a symbolic link.
|
|
84
|
-
*/
|
|
85
|
-
export function isSymbolicLink(path) {
|
|
86
|
-
return tryStatLink(path).then((stats) => stats?.isSymbolicLink() ?? false);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Whether a directory entry leads to a directory, symbolic links included.
|
|
90
|
-
*
|
|
91
|
-
* `Dirent.isDirectory()` is FALSE for a symbolic link to a directory, so a walk keyed on it alone skips every linked
|
|
92
|
-
* tree — while a glob with `followSymbolicLinks` (the default) descends into them, and the two then describe different
|
|
93
|
-
* trees. A link is resolved through `stat`, which also answers `false` for a dangling one.
|
|
94
|
-
*/
|
|
95
|
-
export function entryLeadsToDirectory(entry) {
|
|
96
|
-
if (entry.isDirectory())
|
|
97
|
-
return Promise.resolve(true);
|
|
98
|
-
if (!entry.isSymbolicLink())
|
|
99
|
-
return Promise.resolve(false);
|
|
100
|
-
return isDirectory(resolvePath(entry.parentPath, entry.name));
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* The size of a file in bytes.
|
|
104
|
-
*
|
|
105
|
-
* @throws ENOENT when the file does not exist.
|
|
106
|
-
*/
|
|
107
|
-
export function readFileSize(path) {
|
|
108
|
-
return statPath(path).then((stats) => stats.size);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* The size of a file, rendered in IEC units (`12.3 MiB`) — the unit for anything a machine measured.
|
|
112
|
-
*
|
|
113
|
-
* @throws ENOENT when the file does not exist.
|
|
114
|
-
*/
|
|
115
|
-
export async function formatFileSize(path, options) {
|
|
116
|
-
return ByteFormatter.formatIEC(await readFileSize(path), options);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Resolve a path to its canonical location, following every symbolic link.
|
|
120
|
-
*
|
|
121
|
-
* @throws ENOENT when nothing is there. {@linkcode tryRealPath} answers `null` instead.
|
|
122
|
-
*/
|
|
123
|
-
export function realPath(path) {
|
|
124
|
-
return realpath(path.toString());
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Resolve a path to its canonical location, following every symbolic link.
|
|
128
|
-
*
|
|
129
|
-
* @returns The canonical path, or `null` when nothing is there.
|
|
130
|
-
*/
|
|
131
|
-
export function tryRealPath(path) {
|
|
132
|
-
return realpath(path.toString()).catch((error) => {
|
|
133
|
-
if (error.code === "ENOENT")
|
|
134
|
-
return null;
|
|
135
|
-
throw error;
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
export function open(path, flags, mode) {
|
|
139
|
-
return openNative(path instanceof URL ? path : path.toString(), flags, mode);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* The target a symbolic link points at, verbatim — relative if it was written relative.
|
|
143
|
-
*
|
|
144
|
-
* @throws EINVAL when the path is not a link, ENOENT when nothing is there.
|
|
145
|
-
*/
|
|
146
|
-
export function readLink(path) {
|
|
147
|
-
return readlink(path.toString());
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Whether the process may WRITE to a path.
|
|
151
|
-
*
|
|
152
|
-
* A permission question, not an existence one: `access` answers about the caller's credentials against the file as it
|
|
153
|
-
* stands, where a stat answers about the file. Absence reads as `false` here, which is what a caller checking "can I
|
|
154
|
-
* write here" means by it.
|
|
155
|
-
*/
|
|
156
|
-
export function isWritable(path) {
|
|
157
|
-
return access(path.toString(), constants.W_OK).then(() => true, () => false);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Whether the process may EXECUTE a path.
|
|
161
|
-
*/
|
|
162
|
-
export function isExecutable(path) {
|
|
163
|
-
return access(path.toString(), constants.X_OK).then(() => true, () => false);
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Every path matching a glob pattern.
|
|
167
|
-
*
|
|
168
|
-
* Sorted, because `glob` answers in directory order and a build that names its inputs in a receipt should name them the
|
|
169
|
-
* same way twice.
|
|
170
|
-
*/
|
|
171
|
-
export async function globPaths(pattern) {
|
|
172
|
-
return (await Array.fromAsync(glob(pattern))).toSorted();
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* A `file:` URL is passed through whole: `node:fs` accepts the object and rejects the string it prints.
|
|
176
|
-
*/
|
|
177
|
-
function asTarget(path) {
|
|
178
|
-
return path instanceof URL ? path : path.toString();
|
|
179
|
-
}
|
|
180
|
-
// #endregion
|
|
14
|
+
export * from "#fs/readers/stat";
|
|
181
15
|
// #region File Readers
|
|
182
16
|
/**
|
|
183
17
|
* Read the first `byteSize` bytes of a file, or the whole file if it is smaller.
|
|
@@ -239,8 +73,8 @@ function readTarget(pathSegments) {
|
|
|
239
73
|
/**
|
|
240
74
|
* Read a local text file.
|
|
241
75
|
*
|
|
242
|
-
* @category Node
|
|
243
76
|
* @category Files
|
|
77
|
+
* @runtime node
|
|
244
78
|
*/
|
|
245
79
|
export function readLocalTextFile(...pathSegments) {
|
|
246
80
|
if (!pathSegments.length) {
|
|
@@ -248,22 +82,31 @@ export function readLocalTextFile(...pathSegments) {
|
|
|
248
82
|
}
|
|
249
83
|
return readFile(readTarget(pathSegments), "utf8");
|
|
250
84
|
}
|
|
85
|
+
export function readLocalJSONFile(...pathSegments) {
|
|
86
|
+
return readLocalTextFile(...pathSegments).then((content) => parseJSONStrict(content));
|
|
87
|
+
}
|
|
251
88
|
/**
|
|
252
|
-
* Read a local JSON file.
|
|
89
|
+
* Read a local JSON file, answering `null` when the file does not exist.
|
|
253
90
|
*
|
|
254
|
-
* Parsing is strict: a file that is not JSON throws here rather than answering `
|
|
91
|
+
* Parsing is strict: a file that is not JSON throws here rather than answering `null` several frames later.
|
|
255
92
|
*
|
|
256
|
-
* @category Node
|
|
257
93
|
* @category Files
|
|
94
|
+
* @runtime node
|
|
258
95
|
*/
|
|
259
|
-
export function
|
|
260
|
-
return readLocalTextFile(...pathSegments)
|
|
96
|
+
export function tryReadLocalJSONFile(...pathSegments) {
|
|
97
|
+
return readLocalTextFile(...pathSegments)
|
|
98
|
+
.then((content) => parseJSONStrict(content))
|
|
99
|
+
.catch((error) => {
|
|
100
|
+
if (error.code === "ENOENT")
|
|
101
|
+
return null;
|
|
102
|
+
throw error;
|
|
103
|
+
});
|
|
261
104
|
}
|
|
262
105
|
/**
|
|
263
106
|
* Read a local file's bytes.
|
|
264
107
|
*
|
|
265
|
-
* @category Node
|
|
266
108
|
* @category Files
|
|
109
|
+
* @runtime node
|
|
267
110
|
*/
|
|
268
111
|
export function readLocalBuffer(...pathSegments) {
|
|
269
112
|
if (!pathSegments.length) {
|
|
@@ -271,60 +114,6 @@ export function readLocalBuffer(...pathSegments) {
|
|
|
271
114
|
}
|
|
272
115
|
return readFile(readTarget(pathSegments));
|
|
273
116
|
}
|
|
274
|
-
/**
|
|
275
|
-
* List the entry names directly inside a directory.
|
|
276
|
-
*
|
|
277
|
-
* @category Node
|
|
278
|
-
* @category Files
|
|
279
|
-
*/
|
|
280
|
-
export function readDirectory(path) {
|
|
281
|
-
return readdir(asTarget(path));
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* List a directory's entries with their types, so a caller can tell a file from a directory without a stat apiece.
|
|
285
|
-
*
|
|
286
|
-
* @category Node
|
|
287
|
-
* @category Files
|
|
288
|
-
*/
|
|
289
|
-
export function readDirectoryEntries(path) {
|
|
290
|
-
return readdir(asTarget(path), { withFileTypes: true });
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* List every entry under a directory, at any depth, as paths relative to it.
|
|
294
|
-
*
|
|
295
|
-
* The recursive counterpart to {@linkcode readDirectory}. It walks the whole tree before answering, so it is the wrong
|
|
296
|
-
* reader for a directory whose size is unknown — reach for it where the tree is a build artifact you produced.
|
|
297
|
-
*
|
|
298
|
-
* @category Node
|
|
299
|
-
* @category Files
|
|
300
|
-
*/
|
|
301
|
-
export function readDirectoryRecursive(path) {
|
|
302
|
-
return readdir(asTarget(path), { recursive: true });
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* List every entry under a directory, at any depth, WITH its type — `Dirent.parentPath` names the directory each was
|
|
306
|
-
* found in, which a plain recursive read leaves the caller to reconstruct.
|
|
307
|
-
*/
|
|
308
|
-
export function readDirectoryEntriesRecursive(path) {
|
|
309
|
-
return readdir(asTarget(path), { recursive: true, withFileTypes: true });
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* List a directory's entry names, answering an empty list when the directory does not exist.
|
|
313
|
-
*
|
|
314
|
-
* The distinction is the caller's to make and this function makes ONE of the two available: an absent directory and an
|
|
315
|
-
* empty one are the same answer here. Where absence means something — an unbuilt artifact, a missing extract — use
|
|
316
|
-
* {@linkcode readDirectory} and let the ENOENT reach you.
|
|
317
|
-
*
|
|
318
|
-
* @category Node
|
|
319
|
-
* @category Files
|
|
320
|
-
*/
|
|
321
|
-
export function tryReadDirectory(path) {
|
|
322
|
-
return readdir(asTarget(path)).catch((error) => {
|
|
323
|
-
if (error.code === "ENOENT")
|
|
324
|
-
return [];
|
|
325
|
-
throw error;
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
117
|
// #endregion
|
|
329
118
|
// #region Standard input
|
|
330
119
|
/**
|
package/out/fs/readers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readers.js","sourceRoot":"","sources":["../../lib/fs/readers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"readers.js","sourceRoot":"","sources":["../../lib/fs/readers.ts"],"names":[],"mappings":"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"}
|
package/out/fs/streams.d.ts
CHANGED
|
@@ -34,5 +34,38 @@ export declare function openReadStream(path: PathBuilderLike, options?: Paramete
|
|
|
34
34
|
* first chunk rather than at open time reports the missing directory somewhere the caller is no longer looking. Call
|
|
35
35
|
* `makeDirectories` first where the parent may be absent.
|
|
36
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* Re-encode a byte stream from a legacy encoding into UTF-8, so a UTF-8 reader can consume it.
|
|
39
|
+
*
|
|
40
|
+
* The national registers this repository reads are not all UTF-8: Korea's address portal ships CP949, Japan's postcode
|
|
41
|
+
* file Shift_JIS. `spliterator` splits UTF-8 bytes, so the decode happens upstream of the split rather than after it —
|
|
42
|
+
* a line boundary found in CP949 bytes is not a line boundary.
|
|
43
|
+
*
|
|
44
|
+
* NOT `TextDecoder`, AND THE DIFFERENCE IS NOT SMALL. Node's WHATWG `euc-kr` implements EUC-KR proper (KS X 1001) and
|
|
45
|
+
* not the UHC extension CP949 adds in lead bytes 0x81–0xA0. Of the 17,048 two-byte sequences Python's `cp949` accepts,
|
|
46
|
+
* `TextDecoder('euc-kr')` reads 8,824 differently: 6,475 become U+FFFD and 2,349 become a DIFFERENT character with no
|
|
47
|
+
* error raised. `iconv-lite` disagrees with `cp949` on none of the 17,048.
|
|
48
|
+
*
|
|
49
|
+
* It is not a rare corner. One row in 48,000 of the Korean address register carries such a sequence — `더샾오피스텔`, bytes
|
|
50
|
+
* `b4 f5 98 de bf c0 c7 c7 bd ba c5 da`, which `TextDecoder` reads as `더乍의퓰뵀�`.
|
|
51
|
+
*
|
|
52
|
+
* The decoder is STREAMING for the same reason a `TextDecoder` would need `{ stream: true }`: a multi-byte character
|
|
53
|
+
* split across two chunks must be held until its tail arrives, where a per-chunk decode emits a replacement character
|
|
54
|
+
* and corrupts the row. `iconv-lite`'s stream decoder holds that state, and `end()` flushes what is left.
|
|
55
|
+
*
|
|
56
|
+
* @category Files
|
|
57
|
+
* @param encoding An `iconv-lite` label — `cp949`, `shift_jis`, `gbk`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function decodeByteStream(source: AsyncIterable<Uint8Array>, encoding: string): AsyncGenerator<Uint8Array>;
|
|
60
|
+
/**
|
|
61
|
+
* Decode bytes already in memory from a legacy encoding, the one-shot sibling of {@link decodeByteStream}.
|
|
62
|
+
*
|
|
63
|
+
* Same reasoning, same reason not to reach for `TextDecoder`, and it lives here so a reader that finds one finds the
|
|
64
|
+
* other. Use this when the whole file is a bounded size the publisher fixes; use the stream when it is not.
|
|
65
|
+
*
|
|
66
|
+
* @category Files
|
|
67
|
+
* @param encoding An `iconv-lite` label — `cp949`, `cp932`, `gbk`.
|
|
68
|
+
*/
|
|
69
|
+
export declare function decodeBytes(bytes: Uint8Array, encoding: string): string;
|
|
37
70
|
export declare function openWriteStream(path: PathBuilderLike, options?: Parameters<typeof createWriteStream>[1]): WriteStream;
|
|
38
71
|
//# sourceMappingURL=streams.d.ts.map
|
package/out/fs/streams.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../../lib/fs/streams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../../lib/fs/streams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AAGhG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C;;GAEG;AACH,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAElH;AAED;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAuB,gBAAgB,CACtC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,EACjC,QAAQ,EAAE,MAAM,GACd,cAAc,CAAC,UAAU,CAAC,CAiB5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,CAErH"}
|
package/out/fs/streams.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* does not reach past them for a stream.
|
|
14
14
|
*/
|
|
15
15
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
16
|
+
import iconv from "iconv-lite";
|
|
16
17
|
export { Duplex, Readable, Transform, Writable } from "node:stream";
|
|
17
18
|
export { finished, pipeline } from "node:stream/promises";
|
|
18
19
|
/**
|
|
@@ -31,6 +32,54 @@ export function openReadStream(path, options) {
|
|
|
31
32
|
* first chunk rather than at open time reports the missing directory somewhere the caller is no longer looking. Call
|
|
32
33
|
* `makeDirectories` first where the parent may be absent.
|
|
33
34
|
*/
|
|
35
|
+
/**
|
|
36
|
+
* Re-encode a byte stream from a legacy encoding into UTF-8, so a UTF-8 reader can consume it.
|
|
37
|
+
*
|
|
38
|
+
* The national registers this repository reads are not all UTF-8: Korea's address portal ships CP949, Japan's postcode
|
|
39
|
+
* file Shift_JIS. `spliterator` splits UTF-8 bytes, so the decode happens upstream of the split rather than after it —
|
|
40
|
+
* a line boundary found in CP949 bytes is not a line boundary.
|
|
41
|
+
*
|
|
42
|
+
* NOT `TextDecoder`, AND THE DIFFERENCE IS NOT SMALL. Node's WHATWG `euc-kr` implements EUC-KR proper (KS X 1001) and
|
|
43
|
+
* not the UHC extension CP949 adds in lead bytes 0x81–0xA0. Of the 17,048 two-byte sequences Python's `cp949` accepts,
|
|
44
|
+
* `TextDecoder('euc-kr')` reads 8,824 differently: 6,475 become U+FFFD and 2,349 become a DIFFERENT character with no
|
|
45
|
+
* error raised. `iconv-lite` disagrees with `cp949` on none of the 17,048.
|
|
46
|
+
*
|
|
47
|
+
* It is not a rare corner. One row in 48,000 of the Korean address register carries such a sequence — `더샾오피스텔`, bytes
|
|
48
|
+
* `b4 f5 98 de bf c0 c7 c7 bd ba c5 da`, which `TextDecoder` reads as `더乍의퓰뵀�`.
|
|
49
|
+
*
|
|
50
|
+
* The decoder is STREAMING for the same reason a `TextDecoder` would need `{ stream: true }`: a multi-byte character
|
|
51
|
+
* split across two chunks must be held until its tail arrives, where a per-chunk decode emits a replacement character
|
|
52
|
+
* and corrupts the row. `iconv-lite`'s stream decoder holds that state, and `end()` flushes what is left.
|
|
53
|
+
*
|
|
54
|
+
* @category Files
|
|
55
|
+
* @param encoding An `iconv-lite` label — `cp949`, `shift_jis`, `gbk`.
|
|
56
|
+
*/
|
|
57
|
+
export async function* decodeByteStream(source, encoding) {
|
|
58
|
+
const decoder = iconv.getDecoder(encoding);
|
|
59
|
+
const encoder = new TextEncoder();
|
|
60
|
+
for await (const chunk of source) {
|
|
61
|
+
const text = decoder.write(Buffer.from(chunk));
|
|
62
|
+
if (text) {
|
|
63
|
+
yield encoder.encode(text);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const tail = decoder.end();
|
|
67
|
+
if (tail) {
|
|
68
|
+
yield encoder.encode(tail);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Decode bytes already in memory from a legacy encoding, the one-shot sibling of {@link decodeByteStream}.
|
|
73
|
+
*
|
|
74
|
+
* Same reasoning, same reason not to reach for `TextDecoder`, and it lives here so a reader that finds one finds the
|
|
75
|
+
* other. Use this when the whole file is a bounded size the publisher fixes; use the stream when it is not.
|
|
76
|
+
*
|
|
77
|
+
* @category Files
|
|
78
|
+
* @param encoding An `iconv-lite` label — `cp949`, `cp932`, `gbk`.
|
|
79
|
+
*/
|
|
80
|
+
export function decodeBytes(bytes, encoding) {
|
|
81
|
+
return iconv.decode(Buffer.from(bytes), encoding);
|
|
82
|
+
}
|
|
34
83
|
export function openWriteStream(path, options) {
|
|
35
84
|
return createWriteStream(path.toString(), options);
|
|
36
85
|
}
|
package/out/fs/streams.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streams.js","sourceRoot":"","sources":["../../lib/fs/streams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAqC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"streams.js","sourceRoot":"","sources":["../../lib/fs/streams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAqC,MAAM,SAAS,CAAA;AAEhG,OAAO,KAAK,MAAM,YAAY,CAAA;AAO9B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAqB,EAAE,OAAgD;IACrG,OAAO,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAA;AAClD,CAAC;AAED;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,gBAAgB,CACtC,MAAiC,EACjC,QAAgB;IAEhB,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC1C,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;IAEjC,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;QAE9C,IAAI,IAAI,EAAE,CAAC;YACV,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAC3B,CAAC;IACF,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IAE1B,IAAI,IAAI,EAAE,CAAC;QACV,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;AACF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,KAAiB,EAAE,QAAgB;IAC9D,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAqB,EAAE,OAAiD;IACvG,OAAO,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAA;AACnD,CAAC"}
|
package/out/fs/writers.d.ts
CHANGED
|
@@ -39,22 +39,22 @@ export type BufferLike = NodeJS.ArrayBufferView | Iterable<string | NodeJS.Array
|
|
|
39
39
|
/**
|
|
40
40
|
* Write a local text file, creating its parent directory first.
|
|
41
41
|
*
|
|
42
|
-
* @category Node
|
|
43
42
|
* @category Files
|
|
43
|
+
* @runtime node
|
|
44
44
|
*/
|
|
45
45
|
export declare function writeLocalTextFile<S extends PathBuilderLike[]>(content: string | Promise<string>, ...pathSegments: S): Promise<void>;
|
|
46
46
|
/**
|
|
47
47
|
* Write a local JSON file, tab-indented, creating its parent directory first.
|
|
48
48
|
*
|
|
49
|
-
* @category Node
|
|
50
49
|
* @category Files
|
|
50
|
+
* @runtime node
|
|
51
51
|
*/
|
|
52
52
|
export declare function writeLocalJSONFile<T = Record<string, unknown>, S extends PathBuilderLike[] = PathBuilderLike[]>(content: T, ...pathSegments: S): Promise<void>;
|
|
53
53
|
/**
|
|
54
54
|
* Write a local file's bytes, creating its parent directory first.
|
|
55
55
|
*
|
|
56
|
-
* @category Node
|
|
57
56
|
* @category Files
|
|
57
|
+
* @runtime node
|
|
58
58
|
*/
|
|
59
59
|
export declare function writeLocalBuffer<S extends PathBuilderLike[]>(content: BufferLike, ...pathSegments: S): Promise<void>;
|
|
60
60
|
/**
|
|
@@ -64,8 +64,8 @@ export declare function writeLocalBuffer<S extends PathBuilderLike[]>(content: B
|
|
|
64
64
|
* then says so, and a reader does not have to follow the value back to its producer. This overload exists for the sites
|
|
65
65
|
* where it genuinely does not: a payload that is a string on one branch and bytes on another.
|
|
66
66
|
*
|
|
67
|
-
* @category Node
|
|
68
67
|
* @category Files
|
|
68
|
+
* @runtime node
|
|
69
69
|
*/
|
|
70
70
|
/**
|
|
71
71
|
* Write a UTF-8 text file readable and writable by its owner alone (`0600`), creating the parent directory. The mode is
|
|
@@ -77,8 +77,8 @@ export declare function writeLocalFile<S extends PathBuilderLike[]>(content: str
|
|
|
77
77
|
/**
|
|
78
78
|
* Append text to a local file, creating it and its parent directory when neither exists.
|
|
79
79
|
*
|
|
80
|
-
* @category Node
|
|
81
80
|
* @category Files
|
|
81
|
+
* @runtime node
|
|
82
82
|
*/
|
|
83
83
|
export declare function appendLocalTextFile<S extends PathBuilderLike[]>(content: string, ...pathSegments: S): Promise<void>;
|
|
84
84
|
/**
|
package/out/fs/writers.js
CHANGED
|
@@ -39,8 +39,8 @@ export function makeDirectoryExclusive(path) {
|
|
|
39
39
|
/**
|
|
40
40
|
* Write a local text file, creating its parent directory first.
|
|
41
41
|
*
|
|
42
|
-
* @category Node
|
|
43
42
|
* @category Files
|
|
43
|
+
* @runtime node
|
|
44
44
|
*/
|
|
45
45
|
export async function writeLocalTextFile(content, ...pathSegments) {
|
|
46
46
|
if (!pathSegments.length) {
|
|
@@ -54,8 +54,8 @@ export async function writeLocalTextFile(content, ...pathSegments) {
|
|
|
54
54
|
/**
|
|
55
55
|
* Write a local JSON file, tab-indented, creating its parent directory first.
|
|
56
56
|
*
|
|
57
|
-
* @category Node
|
|
58
57
|
* @category Files
|
|
58
|
+
* @runtime node
|
|
59
59
|
*/
|
|
60
60
|
export function writeLocalJSONFile(content, ...pathSegments) {
|
|
61
61
|
const normalized = typeof content === "string" ? content : JSON.stringify(content, null, "\t") + "\n";
|
|
@@ -64,8 +64,8 @@ export function writeLocalJSONFile(content, ...pathSegments) {
|
|
|
64
64
|
/**
|
|
65
65
|
* Write a local file's bytes, creating its parent directory first.
|
|
66
66
|
*
|
|
67
|
-
* @category Node
|
|
68
67
|
* @category Files
|
|
68
|
+
* @runtime node
|
|
69
69
|
*/
|
|
70
70
|
export async function writeLocalBuffer(content, ...pathSegments) {
|
|
71
71
|
if (!pathSegments.length) {
|
|
@@ -82,8 +82,8 @@ export async function writeLocalBuffer(content, ...pathSegments) {
|
|
|
82
82
|
* then says so, and a reader does not have to follow the value back to its producer. This overload exists for the sites
|
|
83
83
|
* where it genuinely does not: a payload that is a string on one branch and bytes on another.
|
|
84
84
|
*
|
|
85
|
-
* @category Node
|
|
86
85
|
* @category Files
|
|
86
|
+
* @runtime node
|
|
87
87
|
*/
|
|
88
88
|
/**
|
|
89
89
|
* Write a UTF-8 text file readable and writable by its owner alone (`0600`), creating the parent directory. The mode is
|
|
@@ -114,8 +114,8 @@ export async function writeLocalFile(content, ...pathSegments) {
|
|
|
114
114
|
/**
|
|
115
115
|
* Append text to a local file, creating it and its parent directory when neither exists.
|
|
116
116
|
*
|
|
117
|
-
* @category Node
|
|
118
117
|
* @category Files
|
|
118
|
+
* @runtime node
|
|
119
119
|
*/
|
|
120
120
|
export async function appendLocalTextFile(content, ...pathSegments) {
|
|
121
121
|
if (!pathSegments.length) {
|
package/out/fs/zip.d.ts
CHANGED
|
@@ -16,6 +16,25 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import ADMZip from "adm-zip";
|
|
18
18
|
import { type PathBuilderLike } from "path-ts";
|
|
19
|
+
/**
|
|
20
|
+
* How to read member names that the archive does not declare an encoding for.
|
|
21
|
+
*
|
|
22
|
+
* A zip flags UTF-8 names with bit 11, and yauzl decodes those correctly. Without the flag the format says CP437, so a
|
|
23
|
+
* publisher writing CP949, Shift_JIS or GBK names produces bytes that decode to mojibake and match no selector —
|
|
24
|
+
* Korea's address portal writes `주소_서울특별시.txt` and the reader sees `┴╓╝╥_╝¡┐ïÆ╣▌╗π.txt`.
|
|
25
|
+
*
|
|
26
|
+
* Naming an encoding decodes the RAW bytes instead, which is not the same as recoding the mojibake back through CP437:
|
|
27
|
+
* that round trip needs a 256-entry table and silently mangles any byte CP437 maps to a character it cannot invert.
|
|
28
|
+
*
|
|
29
|
+
* @category Files
|
|
30
|
+
*/
|
|
31
|
+
export interface ZipNameOptions {
|
|
32
|
+
/**
|
|
33
|
+
* An `iconv-lite` label — `cp949`, `shift_jis`, `gbk`. Omit when the archive's names are ASCII or properly flagged
|
|
34
|
+
* UTF-8, which is every other archive this repository reads.
|
|
35
|
+
*/
|
|
36
|
+
filenameEncoding?: string;
|
|
37
|
+
}
|
|
19
38
|
export type ZipEntryContentPair = [entry: ADMZip.IZipEntry, content: Buffer];
|
|
20
39
|
/**
|
|
21
40
|
* Extract the contents of a zip file.
|
|
@@ -52,7 +71,7 @@ export interface ZipEntryInfo {
|
|
|
52
71
|
*
|
|
53
72
|
* @category Files
|
|
54
73
|
*/
|
|
55
|
-
export declare function listZipEntries(archivePath: PathBuilderLike): Promise<ZipEntryInfo[]>;
|
|
74
|
+
export declare function listZipEntries(archivePath: PathBuilderLike, options?: ZipNameOptions): Promise<ZipEntryInfo[]>;
|
|
56
75
|
/**
|
|
57
76
|
* Stream one member's decompressed bytes out of an archive on disk.
|
|
58
77
|
*
|
|
@@ -63,7 +82,7 @@ export declare function listZipEntries(archivePath: PathBuilderLike): Promise<Zi
|
|
|
63
82
|
* @category Files
|
|
64
83
|
* @throws If no member matches `selector`.
|
|
65
84
|
*/
|
|
66
|
-
export declare function readZipEntry(archivePath: PathBuilderLike, selector: ZipEntrySelector): AsyncGenerator<Uint8Array>;
|
|
85
|
+
export declare function readZipEntry(archivePath: PathBuilderLike, selector: ZipEntrySelector, options?: ZipNameOptions): AsyncGenerator<Uint8Array>;
|
|
67
86
|
/**
|
|
68
87
|
* Write one member's decompressed bytes to `destinationPath`.
|
|
69
88
|
*
|
package/out/fs/zip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../lib/fs/zip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,MAAM,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../lib/fs/zip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,MAAM,MAAM,SAAS,CAAA;AAE5B,OAAO,EAAkC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AA0B9E;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC9B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACzB;AA+CD,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AAE5E;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAcpF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBhF;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,CAAA;AAE9C;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,EAAE,MAAM,CAAA;CACxB;AAMD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAapH;AAED;;;;;;;;;GASG;AACH,wBAAuB,YAAY,CAClC,WAAW,EAAE,eAAe,EAC5B,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACtB,cAAc,CAAC,UAAU,CAAC,CAc5B;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACpC,WAAW,EAAE,eAAe,EAC5B,QAAQ,EAAE,gBAAgB,EAC1B,eAAe,EAAE,eAAe,GAC9B,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAA;IAC3B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACtC,WAAW,EAAE,eAAe,EAC5B,oBAAoB,EAAE,eAAe,EACrC,EAAE,QAAQ,EAAE,OAAe,EAAE,YAAoB,EAAE,GAAE,wBAA6B,GAChF,OAAO,CAAC,MAAM,EAAE,CAAC,CA0BnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAgCtF"}
|