@maplibre/mlt 1.1.5 → 1.1.7
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/dist/decoding/bigEndianDecode.d.ts +13 -0
- package/dist/decoding/bigEndianDecode.js +50 -0
- package/dist/decoding/bigEndianDecode.js.map +1 -0
- package/dist/decoding/decodingTestUtils.d.ts +1 -1
- package/dist/decoding/decodingTestUtils.js.map +1 -1
- package/dist/decoding/decodingUtils.js +4 -2
- package/dist/decoding/decodingUtils.js.map +1 -1
- package/dist/decoding/fastPforDecoder.d.ts +48 -0
- package/dist/decoding/fastPforDecoder.js +482 -0
- package/dist/decoding/fastPforDecoder.js.map +1 -0
- package/dist/decoding/fastPforShared.d.ts +9 -0
- package/dist/decoding/fastPforShared.js +29 -0
- package/dist/decoding/fastPforShared.js.map +1 -0
- package/dist/decoding/fastPforUnpack.d.ts +23 -0
- package/dist/decoding/fastPforUnpack.js +910 -0
- package/dist/decoding/fastPforUnpack.js.map +1 -0
- package/dist/decoding/geometryDecoder.d.ts +2 -2
- package/dist/decoding/geometryDecoder.js +11 -8
- package/dist/decoding/geometryDecoder.js.map +1 -1
- package/dist/decoding/integerDecodingUtils.d.ts +14 -10
- package/dist/decoding/integerDecodingUtils.js +44 -22
- package/dist/decoding/integerDecodingUtils.js.map +1 -1
- package/dist/decoding/integerStreamDecoder.d.ts +1 -1
- package/dist/decoding/integerStreamDecoder.js +13 -6
- package/dist/decoding/integerStreamDecoder.js.map +1 -1
- package/dist/decoding/propertyDecoder.js +10 -14
- package/dist/decoding/propertyDecoder.js.map +1 -1
- package/dist/decoding/stringDecoder.js +2 -11
- package/dist/decoding/stringDecoder.js.map +1 -1
- package/dist/encoding/bigEndianEncode.d.ts +7 -0
- package/dist/encoding/bigEndianEncode.js +16 -0
- package/dist/encoding/bigEndianEncode.js.map +1 -0
- package/dist/encoding/constGeometryVectorEncoder.d.ts +19 -0
- package/dist/encoding/constGeometryVectorEncoder.js +248 -0
- package/dist/encoding/constGeometryVectorEncoder.js.map +1 -0
- package/dist/encoding/encodingUtils.d.ts +1 -1
- package/dist/encoding/encodingUtils.js +2 -2
- package/dist/encoding/encodingUtils.js.map +1 -1
- package/dist/encoding/fastPforEncoder.d.ts +19 -0
- package/dist/encoding/fastPforEncoder.js +310 -0
- package/dist/encoding/fastPforEncoder.js.map +1 -0
- package/dist/encoding/integerEncodingUtils.d.ts +7 -7
- package/dist/encoding/integerEncodingUtils.js +25 -17
- package/dist/encoding/integerEncodingUtils.js.map +1 -1
- package/dist/encoding/integerStreamEncoder.d.ts +1 -1
- package/dist/encoding/integerStreamEncoder.js +5 -5
- package/dist/encoding/integerStreamEncoder.js.map +1 -1
- package/dist/encoding/packNullableUtils.d.ts +1 -1
- package/dist/encoding/packNullableUtils.js.map +1 -1
- package/dist/encoding/propertyEncoder.d.ts +1 -1
- package/dist/encoding/propertyEncoder.js +8 -8
- package/dist/encoding/propertyEncoder.js.map +1 -1
- package/dist/encoding/stringEncoder.js +3 -3
- package/dist/encoding/stringEncoder.js.map +1 -1
- package/dist/encoding/zOrderCurveEncoder.js +1 -1
- package/dist/encoding/zOrderCurveEncoder.js.map +1 -1
- package/dist/metadata/tile/logicalStreamType.d.ts +3 -3
- package/dist/metadata/tile/logicalStreamType.js.map +1 -1
- package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.d.ts +1 -1
- package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.js.map +1 -1
- package/dist/metadata/tileset/typeMap.d.ts +10 -2
- package/dist/metadata/tileset/typeMap.js +25 -15
- package/dist/metadata/tileset/typeMap.js.map +1 -1
- package/dist/mltDecoder.js +29 -26
- package/dist/mltDecoder.js.map +1 -1
- package/dist/mltMetadata.js.map +1 -1
- package/dist/vector/constant/intConstVector.d.ts +1 -1
- package/dist/vector/constant/intConstVector.js +1 -1
- package/dist/vector/constant/intConstVector.js.map +1 -1
- package/dist/vector/constant/longConstVector.d.ts +1 -1
- package/dist/vector/constant/longConstVector.js +1 -1
- package/dist/vector/constant/longConstVector.js.map +1 -1
- package/dist/vector/dictionary/stringDictionaryVector.d.ts +0 -1
- package/dist/vector/dictionary/stringDictionaryVector.js +0 -2
- package/dist/vector/dictionary/stringDictionaryVector.js.map +1 -1
- package/dist/vector/featureTable.d.ts +4 -5
- package/dist/vector/featureTable.js +2 -29
- package/dist/vector/featureTable.js.map +1 -1
- package/dist/vector/filter/flatSelectionVector.d.ts +1 -1
- package/dist/vector/filter/flatSelectionVector.js.map +1 -1
- package/dist/vector/filter/selectionVectorUtils.d.ts +1 -1
- package/dist/vector/filter/selectionVectorUtils.js.map +1 -1
- package/dist/vector/filter/sequenceSelectionVector.d.ts +1 -1
- package/dist/vector/filter/sequenceSelectionVector.js.map +1 -1
- package/dist/vector/flat/stringFlatVector.d.ts +0 -1
- package/dist/vector/flat/stringFlatVector.js +0 -2
- package/dist/vector/flat/stringFlatVector.js.map +1 -1
- package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.d.ts +0 -2
- package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.js +0 -36
- package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.js.map +1 -1
- package/dist/vector/geometry/constGeometryVector.d.ts +2 -2
- package/dist/vector/geometry/constGeometryVector.js +1 -1
- package/dist/vector/geometry/constGeometryVector.js.map +1 -1
- package/dist/vector/geometry/constGpuVector.d.ts +2 -2
- package/dist/vector/geometry/constGpuVector.js +1 -1
- package/dist/vector/geometry/constGpuVector.js.map +1 -1
- package/dist/vector/geometry/flatGeometryVector.d.ts +1 -1
- package/dist/vector/geometry/flatGeometryVector.js.map +1 -1
- package/dist/vector/geometry/flatGpuVector.d.ts +1 -1
- package/dist/vector/geometry/flatGpuVector.js.map +1 -1
- package/dist/vector/geometry/geometryType.js.map +1 -1
- package/dist/vector/geometry/geometryVector.d.ts +4 -5
- package/dist/vector/geometry/geometryVector.js +0 -8
- package/dist/vector/geometry/geometryVector.js.map +1 -1
- package/dist/vector/geometry/geometryVectorConverter.d.ts +1 -1
- package/dist/vector/geometry/geometryVectorConverter.js +167 -211
- package/dist/vector/geometry/geometryVectorConverter.js.map +1 -1
- package/dist/vector/geometry/gpuVector.d.ts +2 -2
- package/dist/vector/geometry/gpuVector.js.map +1 -1
- package/dist/vector/geometry/topologyVector.d.ts +5 -9
- package/dist/vector/geometry/topologyVector.js +1 -19
- package/dist/vector/geometry/topologyVector.js.map +1 -1
- package/dist/vector/geometry/vertexBufferType.js.map +1 -1
- package/dist/vector/intVector.d.ts +7 -7
- package/dist/vector/intVector.js.map +1 -1
- package/dist/vector/vector.js +1 -1
- package/dist/vector/vector.js.map +1 -1
- package/dist/vector/vectorType.js.map +1 -1
- package/package.json +9 -10
- package/dist/decoding/decodingUtils.spec.d.ts +0 -1
- package/dist/decoding/decodingUtils.spec.js +0 -141
- package/dist/decoding/decodingUtils.spec.js.map +0 -1
- package/dist/decoding/fsstDecoder.spec.d.ts +0 -1
- package/dist/decoding/fsstDecoder.spec.js +0 -57
- package/dist/decoding/fsstDecoder.spec.js.map +0 -1
- package/dist/decoding/integerDecodingUtils.spec.d.ts +0 -1
- package/dist/decoding/integerDecodingUtils.spec.js +0 -300
- package/dist/decoding/integerDecodingUtils.spec.js.map +0 -1
- package/dist/decoding/integerStreamDecoder.spec.d.ts +0 -1
- package/dist/decoding/integerStreamDecoder.spec.js +0 -402
- package/dist/decoding/integerStreamDecoder.spec.js.map +0 -1
- package/dist/decoding/propertyDecoder.spec.d.ts +0 -1
- package/dist/decoding/propertyDecoder.spec.js +0 -448
- package/dist/decoding/propertyDecoder.spec.js.map +0 -1
- package/dist/decoding/stringDecoder.spec.d.ts +0 -1
- package/dist/decoding/stringDecoder.spec.js +0 -387
- package/dist/decoding/stringDecoder.spec.js.map +0 -1
- package/dist/decoding/unpackNullableUtils.spec.d.ts +0 -1
- package/dist/decoding/unpackNullableUtils.spec.js +0 -71
- package/dist/decoding/unpackNullableUtils.spec.js.map +0 -1
- package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.spec.d.ts +0 -1
- package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.spec.js +0 -142
- package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.spec.js.map +0 -1
- package/dist/mltDecoder.spec.d.ts +0 -1
- package/dist/mltDecoder.spec.js +0 -152
- package/dist/mltDecoder.spec.js.map +0 -1
- package/dist/vector/filter/flatSelectionVector.spec.d.ts +0 -1
- package/dist/vector/filter/flatSelectionVector.spec.js +0 -51
- package/dist/vector/filter/flatSelectionVector.spec.js.map +0 -1
- package/dist/vector/filter/selectionVectorUtil.spec.d.ts +0 -1
- package/dist/vector/filter/selectionVectorUtil.spec.js +0 -154
- package/dist/vector/filter/selectionVectorUtil.spec.js.map +0 -1
- package/dist/vector/filter/sequenceSelectionVector.spec.d.ts +0 -1
- package/dist/vector/filter/sequenceSelectionVector.spec.js +0 -115
- package/dist/vector/filter/sequenceSelectionVector.spec.js.map +0 -1
- package/dist/vector/flat/floatFlatVector.spec.d.ts +0 -1
- package/dist/vector/flat/floatFlatVector.spec.js +0 -14
- package/dist/vector/flat/floatFlatVector.spec.js.map +0 -1
- package/dist/vector/flat/intFlatVector.spec.d.ts +0 -1
- package/dist/vector/flat/intFlatVector.spec.js +0 -15
- package/dist/vector/flat/intFlatVector.spec.js.map +0 -1
- package/dist/vector/flat/longFlatVector.spec.d.ts +0 -1
- package/dist/vector/flat/longFlatVector.spec.js +0 -14
- package/dist/vector/flat/longFlatVector.spec.js.map +0 -1
- package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.spec.d.ts +0 -1
- package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.spec.js +0 -28
- package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.spec.js.map +0 -1
- package/dist/vector/geometry/zOrderCurve.spec.d.ts +0 -1
- package/dist/vector/geometry/zOrderCurve.spec.js +0 -25
- package/dist/vector/geometry/zOrderCurve.spec.js.map +0 -1
- package/dist/vector/sequence/longSequenceVektor.spec.d.ts +0 -1
- package/dist/vector/sequence/longSequenceVektor.spec.js +0 -11
- package/dist/vector/sequence/longSequenceVektor.spec.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpuVector.js","sourceRoot":"","sources":["../../../src/vector/geometry/gpuVector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,MAAM,OAAgB,SAAS;IAEN;IACA;IACA;IACA;IAJrB,YACqB,gBAA6B,EAC7B,YAAwB,EACxB,aAAyB,EACzB,eAAuC;QAHvC,qBAAgB,GAAhB,gBAAgB,CAAa;QAC7B,iBAAY,GAAZ,YAAY,CAAY;QACxB,kBAAa,GAAb,aAAa,CAAY;QACzB,oBAAe,GAAf,eAAe,CAAwB;IACzD,CAAC;IAQJ,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,aAAa;QACT,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;QAC5F,CAAC;QAED,MAAM,UAAU,GAAuB,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACrE,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC;QACtC,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QACzC,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QACzC,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;QAEjD,6EAA6E;QAC7E,IAAI,kBA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G,IAAI,CAAC,aAAa,CAAC,kBAAkB,EAAE,CAAC,CAAC;oCACnD,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gCAC/B,CAAC;gCACD,0EAA0E;gCAC1E,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oCAClB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gCACvB,CAAC;gCACD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;4BACxB,CAAC;wBACL,CAAC;wBAED,UAAU,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;oBAC7B,CAAC;oBACD,MAAM;YACd,CAAC;QACL,CAAC;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACb;;;;;;;;WAQG;QAEH,qEAAqE;QACrE,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import Point from \"@mapbox/point-geometry\";\nimport { GEOMETRY_TYPE } from \"./geometryType\";\nimport {
|
|
1
|
+
{"version":3,"file":"gpuVector.js","sourceRoot":"","sources":["../../../src/vector/geometry/gpuVector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,MAAM,OAAgB,SAAS;IAEN;IACA;IACA;IACA;IAJrB,YACqB,gBAA6B,EAC7B,YAAwB,EACxB,aAAyB,EACzB,eAAuC;QAHvC,qBAAgB,GAAhB,gBAAgB,CAAa;QAC7B,iBAAY,GAAZ,YAAY,CAAY;QACxB,kBAAa,GAAb,aAAa,CAAY;QACzB,oBAAe,GAAf,eAAe,CAAwB;IACzD,CAAC;IAQJ,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,IAAI,WAAW;QACX,OAAO,IAA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["import Point from \"@mapbox/point-geometry\";\nimport { GEOMETRY_TYPE } from \"./geometryType\";\nimport type { CoordinatesArray } from \"./geometryVector\";\nimport type { TopologyVector } from \"./topologyVector\";\n\nexport abstract class GpuVector implements Iterable<CoordinatesArray> {\n protected constructor(\n private readonly _triangleOffsets: Uint32Array,\n private readonly _indexBuffer: Int32Array,\n private readonly _vertexBuffer: Int32Array,\n private readonly _topologyVector?: TopologyVector | null,\n ) {}\n\n abstract geometryType(index: number): number;\n\n abstract get numGeometries(): number;\n\n abstract containsSingleGeometryType(): boolean;\n\n get triangleOffsets(): Uint32Array {\n return this._triangleOffsets;\n }\n\n get indexBuffer(): Int32Array {\n return this._indexBuffer;\n }\n\n get vertexBuffer(): Int32Array {\n return this._vertexBuffer;\n }\n\n get topologyVector(): TopologyVector | null {\n return this._topologyVector;\n }\n\n /**\n * Returns geometries as coordinate arrays by extracting polygon outlines from topology.\n * The vertexBuffer contains the outline vertices, separate from the tessellated triangles.\n */\n getGeometries(): CoordinatesArray[] {\n if (!this._topologyVector) {\n throw new Error(\"Cannot convert GpuVector to coordinates without topology information\");\n }\n\n const geometries: CoordinatesArray[] = new Array(this.numGeometries);\n const topology = this._topologyVector;\n const partOffsets = topology.partOffsets;\n const ringOffsets = topology.ringOffsets;\n const geometryOffsets = topology.geometryOffsets;\n\n // Use counters to track position in offset arrays (like Java implementation)\n let vertexBufferOffset = 0;\n let partOffsetCounter = 1;\n let ringOffsetsCounter = 1;\n let geometryOffsetsCounter = 1;\n\n for (let i = 0; i < this.numGeometries; i++) {\n const geometryType = this.geometryType(i);\n\n switch (geometryType) {\n case GEOMETRY_TYPE.POLYGON:\n {\n // Get number of rings for this polygon\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: Point[][] = [];\n\n for (let j = 0; j < numRings; j++) {\n // Get number of vertices in this ring\n const numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n const ring: Point[] = [];\n\n for (let k = 0; k < numVertices; k++) {\n const x = this._vertexBuffer[vertexBufferOffset++];\n const y = this._vertexBuffer[vertexBufferOffset++];\n ring.push(new Point(x, y));\n }\n // Close the ring by duplicating the first vertex (MVT format requirement)\n if (ring.length > 0) {\n ring.push(ring[0]);\n }\n rings.push(ring);\n }\n\n geometries[i] = rings;\n if (geometryOffsets) geometryOffsetsCounter++;\n }\n break;\n case GEOMETRY_TYPE.MULTIPOLYGON:\n {\n // Get number of polygons in this multipolygon\n const numPolygons =\n geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const allRings: Point[][] = [];\n\n for (let p = 0; p < numPolygons; p++) {\n // Get number of rings in this polygon\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n\n for (let j = 0; j < numRings; j++) {\n // Get number of vertices in this ring\n const numVertices =\n ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n const ring: Point[] = [];\n\n for (let k = 0; k < numVertices; k++) {\n const x = this._vertexBuffer[vertexBufferOffset++];\n const y = this._vertexBuffer[vertexBufferOffset++];\n ring.push(new Point(x, y));\n }\n // Close the ring by duplicating the first vertex (MVT format requirement)\n if (ring.length > 0) {\n ring.push(ring[0]);\n }\n allRings.push(ring);\n }\n }\n\n geometries[i] = allRings;\n }\n break;\n }\n }\n return geometries;\n }\n\n [Symbol.iterator](): Iterator<CoordinatesArray> {\n /*for(let i = 1; i < this.triangleOffsets.length; i++) {\n const numTriangles = this.triangleOffsets[i] - this.triangleOffsets[i-1];\n const startIndex = this.triangleOffsets[i-1] * 3;\n const endIndex = this.triangleOffsets[i] * 3;\n }\n\n while (index < this.numGeometries) {\n yield geometries[index++];\n }*/\n\n //throw new Error(\"Iterator on a GpuVector is not implemented yet.\");\n return null;\n }\n}\n"]}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
get geometryOffsets(): Uint32Array;
|
|
7
|
-
get partOffsets(): Uint32Array;
|
|
8
|
-
get ringOffsets(): Uint32Array;
|
|
9
|
-
}
|
|
1
|
+
export type TopologyVector = {
|
|
2
|
+
readonly geometryOffsets: Uint32Array;
|
|
3
|
+
readonly partOffsets: Uint32Array;
|
|
4
|
+
readonly ringOffsets: Uint32Array;
|
|
5
|
+
};
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
_geometryOffsets;
|
|
3
|
-
_partOffsets;
|
|
4
|
-
_ringOffsets;
|
|
5
|
-
constructor(_geometryOffsets, _partOffsets, _ringOffsets) {
|
|
6
|
-
this._geometryOffsets = _geometryOffsets;
|
|
7
|
-
this._partOffsets = _partOffsets;
|
|
8
|
-
this._ringOffsets = _ringOffsets;
|
|
9
|
-
}
|
|
10
|
-
get geometryOffsets() {
|
|
11
|
-
return this._geometryOffsets;
|
|
12
|
-
}
|
|
13
|
-
get partOffsets() {
|
|
14
|
-
return this._partOffsets;
|
|
15
|
-
}
|
|
16
|
-
get ringOffsets() {
|
|
17
|
-
return this._ringOffsets;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
export {};
|
|
20
2
|
//# sourceMappingURL=topologyVector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topologyVector.js","sourceRoot":"","sources":["../../../src/vector/geometry/topologyVector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"topologyVector.js","sourceRoot":"","sources":["../../../src/vector/geometry/topologyVector.ts"],"names":[],"mappings":"","sourcesContent":["export type TopologyVector = {\n readonly geometryOffsets: Uint32Array;\n readonly partOffsets: Uint32Array;\n readonly ringOffsets: Uint32Array;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertexBufferType.js","sourceRoot":"","sources":["../../../src/vector/geometry/vertexBufferType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,
|
|
1
|
+
{"version":3,"file":"vertexBufferType.js","sourceRoot":"","sources":["../../../src/vector/geometry/vertexBufferType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,2DAAU,CAAA;IACV,yDAAS,CAAA;IACT,yDAAS,CAAA;AACb,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B","sourcesContent":["export enum VertexBufferType {\n MORTON = 0,\n VEC_2 = 1,\n VEC_3 = 2,\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import type { IntFlatVector } from "./flat/intFlatVector";
|
|
2
|
+
import type { LongFlatVector } from "./flat/longFlatVector";
|
|
3
|
+
import type { IntConstVector } from "./constant/intConstVector";
|
|
4
|
+
import type { LongConstVector } from "./constant/longConstVector";
|
|
5
|
+
import type { IntSequenceVector } from "./sequence/intSequenceVector";
|
|
6
|
+
import type { LongSequenceVector } from "./sequence/longSequenceVector";
|
|
7
|
+
import type { DoubleFlatVector } from "./flat/doubleFlatVector";
|
|
8
8
|
export type IntVector = IntFlatVector | LongFlatVector | DoubleFlatVector | IntSequenceVector | LongSequenceVector | IntConstVector | LongConstVector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intVector.js","sourceRoot":"","sources":["../../src/vector/intVector.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"intVector.js","sourceRoot":"","sources":["../../src/vector/intVector.ts"],"names":[],"mappings":"","sourcesContent":["import type { IntFlatVector } from \"./flat/intFlatVector\";\nimport type { LongFlatVector } from \"./flat/longFlatVector\";\nimport type { IntConstVector } from \"./constant/intConstVector\";\nimport type { LongConstVector } from \"./constant/longConstVector\";\nimport type { IntSequenceVector } from \"./sequence/intSequenceVector\";\nimport type { LongSequenceVector } from \"./sequence/longSequenceVector\";\nimport type { DoubleFlatVector } from \"./flat/doubleFlatVector\";\n\nexport type IntVector =\n | IntFlatVector\n | LongFlatVector\n | DoubleFlatVector\n | IntSequenceVector\n | LongSequenceVector\n | IntConstVector\n | LongConstVector;\n"]}
|
package/dist/vector/vector.js
CHANGED
|
@@ -18,7 +18,7 @@ export default class Vector {
|
|
|
18
18
|
return this.nullabilityBuffer && !this.nullabilityBuffer.get(index) ? null : this.getValueFromBuffer(index);
|
|
19
19
|
}
|
|
20
20
|
has(index) {
|
|
21
|
-
return
|
|
21
|
+
return this.nullabilityBuffer?.get(index) || !this.nullabilityBuffer;
|
|
22
22
|
}
|
|
23
23
|
get name() {
|
|
24
24
|
return this._name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector.js","sourceRoot":"","sources":["../../src/vector/vector.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAgB,MAAM;IAKX;IACE;IALb,iBAAiB,CAAmB;IACpC,KAAK,CAAS;IAExB,YACqB,KAAa,EACX,UAAa,EAChC,uBAA2C;QAF1B,UAAK,GAAL,KAAK,CAAQ;QACX,eAAU,GAAV,UAAU,CAAG;QAGhC,IAAI,OAAO,uBAAuB,KAAK,QAAQ,EAAE,CAAC;YAC9C,IAAI,CAAC,KAAK,GAAG,uBAAuB,CAAC;QACzC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,iBAAiB,GAAG,uBAAuB,CAAC;YACjD,IAAI,CAAC,KAAK,GAAG,uBAAuB,CAAC,IAAI,EAAE,CAAC;QAChD,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,KAAa;QAClB,OAAO,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAChH,CAAC;IAED,GAAG,CAAC,KAAa;QACb,OAAO,
|
|
1
|
+
{"version":3,"file":"vector.js","sourceRoot":"","sources":["../../src/vector/vector.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAgB,MAAM;IAKX;IACE;IALb,iBAAiB,CAAmB;IACpC,KAAK,CAAS;IAExB,YACqB,KAAa,EACX,UAAa,EAChC,uBAA2C;QAF1B,UAAK,GAAL,KAAK,CAAQ;QACX,eAAU,GAAV,UAAU,CAAG;QAGhC,IAAI,OAAO,uBAAuB,KAAK,QAAQ,EAAE,CAAC;YAC9C,IAAI,CAAC,KAAK,GAAG,uBAAuB,CAAC;QACzC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,iBAAiB,GAAG,uBAAuB,CAAC;YACjD,IAAI,CAAC,KAAK,GAAG,uBAAuB,CAAC,IAAI,EAAE,CAAC;QAChD,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,KAAa;QAClB,OAAO,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAChH,CAAC;IAED,GAAG,CAAC,KAAa;QACb,OAAO,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC;IACzE,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;CAGJ","sourcesContent":["import type BitVector from \"./flat/bitVector\";\n\nexport default abstract class Vector<T extends ArrayBufferView = ArrayBufferView, K = unknown> {\n protected nullabilityBuffer: BitVector | null;\n protected _size: number;\n\n constructor(\n private readonly _name: string,\n protected readonly dataBuffer: T,\n sizeOrNullabilityBuffer: number | BitVector,\n ) {\n if (typeof sizeOrNullabilityBuffer === \"number\") {\n this._size = sizeOrNullabilityBuffer;\n } else {\n this.nullabilityBuffer = sizeOrNullabilityBuffer;\n this._size = sizeOrNullabilityBuffer.size();\n }\n }\n\n getValue(index: number): K | null {\n return this.nullabilityBuffer && !this.nullabilityBuffer.get(index) ? null : this.getValueFromBuffer(index);\n }\n\n has(index: number): boolean {\n return this.nullabilityBuffer?.get(index) || !this.nullabilityBuffer;\n }\n\n get name(): string {\n return this._name;\n }\n\n get size(): number {\n return this._size;\n }\n\n protected abstract getValueFromBuffer(index: number): K;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vectorType.js","sourceRoot":"","sources":["../../src/vector/vectorType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IAClB,
|
|
1
|
+
{"version":3,"file":"vectorType.js","sourceRoot":"","sources":["../../src/vector/vectorType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IAClB,2CAAQ,CAAA;IACR,6CAAS,CAAA;IACT,mDAAY,CAAA;IACZ,uDAAc,CAAA;IACd,iEAAmB,CAAA;AACvB,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB","sourcesContent":["export enum VectorType {\n FLAT = 0,\n CONST = 1,\n SEQUENCE = 2,\n DICTIONARY = 3,\n FSST_DICTIONARY = 4,\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maplibre/mlt",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc",
|
|
18
|
-
"test": "vitest
|
|
19
|
-
"lint": "eslint"
|
|
20
|
-
"format": "prettier --write \"**/*.ts\""
|
|
18
|
+
"test": "vitest --coverage --coverage.reportOnFailure",
|
|
19
|
+
"lint": "eslint"
|
|
21
20
|
},
|
|
22
21
|
"repository": {
|
|
23
22
|
"type": "git",
|
|
@@ -27,20 +26,20 @@
|
|
|
27
26
|
"url": "https://github.com/maplibre/maplibre-tile-spec/issues"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
29
|
+
"@eslint/js": "^10.0.1",
|
|
30
30
|
"@mapbox/vector-tile": "^2.0.4",
|
|
31
|
-
"@maplibre/maplibre-gl-style-spec": "^24.
|
|
31
|
+
"@maplibre/maplibre-gl-style-spec": "^24.6.0",
|
|
32
32
|
"@types/bytebuffer": "^5.0.49",
|
|
33
33
|
"@types/earcut": "^3.0.0",
|
|
34
|
-
"@types/node": "^
|
|
34
|
+
"@types/node": "^25.3.5",
|
|
35
35
|
"@types/pbf": "^3.0.5",
|
|
36
|
-
"@vitest/coverage-v8": "^4.0.
|
|
36
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
37
37
|
"bytebuffer": "^5.0.1",
|
|
38
38
|
"earcut": "^3.0.2",
|
|
39
|
-
"eslint": "^
|
|
39
|
+
"eslint": "^10.0.2",
|
|
40
40
|
"pbf": "^4.0.1",
|
|
41
|
-
"prettier": "^3.7.4",
|
|
42
41
|
"typescript": "^5.9.3",
|
|
43
|
-
"typescript-eslint": "^8.
|
|
42
|
+
"typescript-eslint": "^8.56.1",
|
|
44
43
|
"vitest": "^4.0.1"
|
|
45
44
|
},
|
|
46
45
|
"dependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { decodeFloatsLE, decodeDoublesLE, decodeBooleanRle, decodeString, decodeByteRle } from "./decodingUtils";
|
|
3
|
-
import IntWrapper from "./intWrapper";
|
|
4
|
-
import BitVector from "../vector/flat/bitVector";
|
|
5
|
-
import { encodeFloatsLE, encodeDoubleLE, encodeBooleanRle, encodeByteRle, encodeStrings, } from "../encoding/encodingUtils";
|
|
6
|
-
describe("decodingUtils", () => {
|
|
7
|
-
describe("decodeFloatsLE", () => {
|
|
8
|
-
it("should decode float values from little-endian bytes", () => {
|
|
9
|
-
const data = new Float32Array([1.5, 2.5]);
|
|
10
|
-
const encoded = encodeFloatsLE(data);
|
|
11
|
-
const offset = new IntWrapper(0);
|
|
12
|
-
const result = decodeFloatsLE(encoded, offset, 2);
|
|
13
|
-
expect(result).toEqual(data);
|
|
14
|
-
expect(offset.get()).toBe(8);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
describe("decodeDoublesLE", () => {
|
|
18
|
-
it("should decode double values from little-endian bytes", () => {
|
|
19
|
-
const data = new Float32Array([3.14159, 2.71828]);
|
|
20
|
-
const encoded = encodeDoubleLE(data);
|
|
21
|
-
const offset = new IntWrapper(0);
|
|
22
|
-
const result = decodeDoublesLE(encoded, offset, 2);
|
|
23
|
-
expect(result[0]).toBeCloseTo(3.14159);
|
|
24
|
-
expect(result[1]).toBeCloseTo(2.71828);
|
|
25
|
-
expect(offset.get()).toBe(16);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
describe("decodeFloatsLE with nullability", () => {
|
|
29
|
-
it("should decode nullable float values with nullability buffer", () => {
|
|
30
|
-
const data = new Float32Array([1.5, 2.5]);
|
|
31
|
-
const encoded = encodeFloatsLE(data);
|
|
32
|
-
const offset = new IntWrapper(0);
|
|
33
|
-
const bitVectorData = new Uint8Array([0b00000101]);
|
|
34
|
-
const nullabilityBuffer = new BitVector(bitVectorData, 3);
|
|
35
|
-
const result = decodeFloatsLE(encoded, offset, 2, nullabilityBuffer);
|
|
36
|
-
expect(result.length).toBe(3);
|
|
37
|
-
expect(result[0]).toBeCloseTo(1.5);
|
|
38
|
-
expect(result[1]).toBe(0);
|
|
39
|
-
expect(result[2]).toBeCloseTo(2.5);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe("decodeDoublesLE with nullability", () => {
|
|
43
|
-
it("should decode nullable double values with nullability buffer", () => {
|
|
44
|
-
const data = new Float32Array([3.14159, 2.71828]);
|
|
45
|
-
const encoded = encodeDoubleLE(data);
|
|
46
|
-
const offset = new IntWrapper(0);
|
|
47
|
-
const bitVectorData = new Uint8Array([0b00000011]);
|
|
48
|
-
const nullabilityBuffer = new BitVector(bitVectorData, 2);
|
|
49
|
-
const result = decodeDoublesLE(encoded, offset, 2, nullabilityBuffer);
|
|
50
|
-
expect(result.length).toBe(2);
|
|
51
|
-
expect(result[0]).toBeCloseTo(3.14159);
|
|
52
|
-
expect(result[1]).toBeCloseTo(2.71828);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
describe("decodeBooleanRle", () => {
|
|
56
|
-
it("should decode boolean RLE", () => {
|
|
57
|
-
// Create 8 true boolean values
|
|
58
|
-
const data = [true, true, true, true, true, true, true, true];
|
|
59
|
-
const encoded = encodeBooleanRle(data);
|
|
60
|
-
const offset = new IntWrapper(0);
|
|
61
|
-
const result = decodeBooleanRle(encoded, 8, encoded.length, offset);
|
|
62
|
-
// All 8 bits should be set in the first byte
|
|
63
|
-
expect(result[0]).toBe(0xff);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
describe("decodeByteRle", () => {
|
|
67
|
-
it("should decode byte RLE with runs", () => {
|
|
68
|
-
// Encode 5 identical bytes
|
|
69
|
-
const data = new Uint8Array([42, 42, 42, 42, 42]);
|
|
70
|
-
const encoded = encodeByteRle(data);
|
|
71
|
-
const offset = new IntWrapper(0);
|
|
72
|
-
const result = decodeByteRle(encoded, 5, encoded.length, offset);
|
|
73
|
-
expect(result).toEqual(data);
|
|
74
|
-
});
|
|
75
|
-
it("should decode byte RLE with literals", () => {
|
|
76
|
-
// Encode 3 different bytes (will be encoded as literals)
|
|
77
|
-
const data = new Uint8Array([1, 2, 3]);
|
|
78
|
-
const encoded = encodeByteRle(data);
|
|
79
|
-
const offset = new IntWrapper(0);
|
|
80
|
-
const result = decodeByteRle(encoded, 3, encoded.length, offset);
|
|
81
|
-
expect(result).toEqual(data);
|
|
82
|
-
expect(offset.get()).toBe(encoded.length);
|
|
83
|
-
});
|
|
84
|
-
it("should handle truncated stream when byteLength runs out before numBytes", () => {
|
|
85
|
-
// Request 10 bytes but byteLength only allows 2 bytes (header + value)
|
|
86
|
-
// header=0 means numRuns=3, but stream ends after value byte
|
|
87
|
-
const data = new Uint8Array([0, 42]);
|
|
88
|
-
const offset = new IntWrapper(0);
|
|
89
|
-
const result = decodeByteRle(data, 10, 2, offset);
|
|
90
|
-
// Should only fill 3 bytes (what the run specified) then stop at stream boundary
|
|
91
|
-
expect(result.length).toBe(10);
|
|
92
|
-
expect(result[0]).toBe(42);
|
|
93
|
-
expect(result[1]).toBe(42);
|
|
94
|
-
expect(result[2]).toBe(42);
|
|
95
|
-
// Remaining bytes should be 0
|
|
96
|
-
expect(result[3]).toBe(0);
|
|
97
|
-
expect(result[9]).toBe(0);
|
|
98
|
-
expect(offset.get()).toBe(2); // Should stop at byteLength boundary
|
|
99
|
-
});
|
|
100
|
-
it("should decode mixed literals and runs", () => {
|
|
101
|
-
const data = new Uint8Array([1, 2, 5, 5, 5, 5, 5, 7, 8]);
|
|
102
|
-
const encoded = encodeByteRle(data);
|
|
103
|
-
const offset = new IntWrapper(0);
|
|
104
|
-
const result = decodeByteRle(encoded, 9, encoded.length, offset);
|
|
105
|
-
expect(result).toEqual(data);
|
|
106
|
-
});
|
|
107
|
-
it("should handle 128 literal max", () => {
|
|
108
|
-
const data = new Uint8Array(130);
|
|
109
|
-
for (let i = 0; i < 130; i++) {
|
|
110
|
-
data[i] = i % 256;
|
|
111
|
-
}
|
|
112
|
-
const encoded = encodeByteRle(data);
|
|
113
|
-
const offset = new IntWrapper(0);
|
|
114
|
-
const result = decodeByteRle(encoded, 130, encoded.length, offset);
|
|
115
|
-
expect(result).toEqual(data);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
describe("decodeString", () => {
|
|
119
|
-
it("should decode short string", () => {
|
|
120
|
-
const data = "Hello";
|
|
121
|
-
const encoded = encodeStrings([data]);
|
|
122
|
-
const result = decodeString(encoded, 0, encoded.length);
|
|
123
|
-
expect(result).toBe(data);
|
|
124
|
-
});
|
|
125
|
-
it("should decode long string", () => {
|
|
126
|
-
const data = "This is a longer string for testing TextDecoder path";
|
|
127
|
-
const encoded = encodeStrings([data]);
|
|
128
|
-
const result = decodeString(encoded, 0, encoded.length);
|
|
129
|
-
expect(result).toBe(data);
|
|
130
|
-
});
|
|
131
|
-
it("should handle string with offset", () => {
|
|
132
|
-
const prefix = "Hello";
|
|
133
|
-
const expectedText = "World";
|
|
134
|
-
const encoded = encodeStrings([prefix, expectedText]);
|
|
135
|
-
const prefixLength = new TextEncoder().encode(prefix).length;
|
|
136
|
-
const result = decodeString(encoded, prefixLength, encoded.length);
|
|
137
|
-
expect(result).toBe(expectedText);
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
//# sourceMappingURL=decodingUtils.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decodingUtils.spec.js","sourceRoot":"","sources":["../../src/decoding/decodingUtils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAA8B,MAAM,iBAAiB,CAAC;AAC7I,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,EACH,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,GAChB,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Y,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YAExD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YACxC,MAAM,MAAM,GAAG,OAAO,CAAC;YACvB,MAAM,YAAY,GAAG,OAAO,CAAC;YAC7B,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;YACtD,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;YAE7D,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YAEnE,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect } from \"vitest\";\nimport { decodeFloatsLE, decodeDoublesLE, decodeBooleanRle, decodeString, decodeByteRle, getVectorTypeBooleanStream } from \"./decodingUtils\";\nimport IntWrapper from \"./intWrapper\";\nimport BitVector from \"../vector/flat/bitVector\";\nimport {\n encodeFloatsLE,\n encodeDoubleLE,\n encodeBooleanRle,\n encodeByteRle,\n encodeStrings,\n} from \"../encoding/encodingUtils\";\n\ndescribe(\"decodingUtils\", () => {\n describe(\"decodeFloatsLE\", () => {\n it(\"should decode float values from little-endian bytes\", () => {\n const data = new Float32Array([1.5, 2.5]);\n const encoded = encodeFloatsLE(data);\n const offset = new IntWrapper(0);\n const result = decodeFloatsLE(encoded, offset, 2);\n\n expect(result).toEqual(data);\n expect(offset.get()).toBe(8);\n });\n });\n\n describe(\"decodeDoublesLE\", () => {\n it(\"should decode double values from little-endian bytes\", () => {\n const data = new Float32Array([3.14159, 2.71828]);\n const encoded = encodeDoubleLE(data);\n const offset = new IntWrapper(0);\n const result = decodeDoublesLE(encoded, offset, 2);\n\n expect(result[0]).toBeCloseTo(3.14159);\n expect(result[1]).toBeCloseTo(2.71828);\n expect(offset.get()).toBe(16);\n });\n });\n\n describe(\"decodeFloatsLE with nullability\", () => {\n it(\"should decode nullable float values with nullability buffer\", () => {\n const data = new Float32Array([1.5, 2.5]);\n const encoded = encodeFloatsLE(data);\n const offset = new IntWrapper(0);\n const bitVectorData = new Uint8Array([0b00000101]);\n const nullabilityBuffer = new BitVector(bitVectorData, 3);\n\n const result = decodeFloatsLE(encoded, offset, 2, nullabilityBuffer);\n\n expect(result.length).toBe(3);\n expect(result[0]).toBeCloseTo(1.5);\n expect(result[1]).toBe(0);\n expect(result[2]).toBeCloseTo(2.5);\n });\n });\n\n describe(\"decodeDoublesLE with nullability\", () => {\n it(\"should decode nullable double values with nullability buffer\", () => {\n const data = new Float32Array([3.14159, 2.71828]);\n const encoded = encodeDoubleLE(data);\n const offset = new IntWrapper(0);\n const bitVectorData = new Uint8Array([0b00000011]);\n const nullabilityBuffer = new BitVector(bitVectorData, 2);\n\n const result = decodeDoublesLE(encoded, offset, 2, nullabilityBuffer);\n\n expect(result.length).toBe(2);\n expect(result[0]).toBeCloseTo(3.14159);\n expect(result[1]).toBeCloseTo(2.71828);\n });\n });\n\n describe(\"decodeBooleanRle\", () => {\n it(\"should decode boolean RLE\", () => {\n // Create 8 true boolean values\n const data = [true, true, true, true, true, true, true, true];\n const encoded = encodeBooleanRle(data);\n const offset = new IntWrapper(0);\n const result = decodeBooleanRle(encoded, 8, encoded.length, offset);\n\n // All 8 bits should be set in the first byte\n expect(result[0]).toBe(0xff);\n });\n });\n\n describe(\"decodeByteRle\", () => {\n it(\"should decode byte RLE with runs\", () => {\n // Encode 5 identical bytes\n const data = new Uint8Array([42, 42, 42, 42, 42]);\n const encoded = encodeByteRle(data);\n const offset = new IntWrapper(0);\n const result = decodeByteRle(encoded, 5, encoded.length, offset);\n\n expect(result).toEqual(data);\n });\n\n it(\"should decode byte RLE with literals\", () => {\n // Encode 3 different bytes (will be encoded as literals)\n const data = new Uint8Array([1, 2, 3]);\n const encoded = encodeByteRle(data);\n const offset = new IntWrapper(0);\n const result = decodeByteRle(encoded, 3, encoded.length, offset);\n\n expect(result).toEqual(data);\n expect(offset.get()).toBe(encoded.length);\n });\n\n it(\"should handle truncated stream when byteLength runs out before numBytes\", () => {\n // Request 10 bytes but byteLength only allows 2 bytes (header + value)\n // header=0 means numRuns=3, but stream ends after value byte\n const data = new Uint8Array([0, 42]);\n const offset = new IntWrapper(0);\n const result = decodeByteRle(data, 10, 2, offset);\n\n // Should only fill 3 bytes (what the run specified) then stop at stream boundary\n expect(result.length).toBe(10);\n expect(result[0]).toBe(42);\n expect(result[1]).toBe(42);\n expect(result[2]).toBe(42);\n // Remaining bytes should be 0\n expect(result[3]).toBe(0);\n expect(result[9]).toBe(0);\n expect(offset.get()).toBe(2); // Should stop at byteLength boundary\n });\n\n it(\"should decode mixed literals and runs\", () => {\n const data = new Uint8Array([1, 2, 5, 5, 5, 5, 5, 7, 8]);\n const encoded = encodeByteRle(data);\n const offset = new IntWrapper(0);\n const result = decodeByteRle(encoded, 9, encoded.length, offset);\n\n expect(result).toEqual(data);\n });\n\n it(\"should handle 128 literal max\", () => {\n const data = new Uint8Array(130);\n for (let i = 0; i < 130; i++) {\n data[i] = i % 256;\n }\n const encoded = encodeByteRle(data);\n const offset = new IntWrapper(0);\n const result = decodeByteRle(encoded, 130, encoded.length, offset);\n\n expect(result).toEqual(data);\n });\n });\n\n describe(\"decodeString\", () => {\n it(\"should decode short string\", () => {\n const data = \"Hello\";\n const encoded = encodeStrings([data]);\n const result = decodeString(encoded, 0, encoded.length);\n\n expect(result).toBe(data);\n });\n\n it(\"should decode long string\", () => {\n const data = \"This is a longer string for testing TextDecoder path\";\n const encoded = encodeStrings([data]);\n const result = decodeString(encoded, 0, encoded.length);\n\n expect(result).toBe(data);\n });\n\n it(\"should handle string with offset\", () => {\n const prefix = \"Hello\";\n const expectedText = \"World\";\n const encoded = encodeStrings([prefix, expectedText]);\n const prefixLength = new TextEncoder().encode(prefix).length;\n\n const result = decodeString(encoded, prefixLength, encoded.length);\n\n expect(result).toBe(expectedText);\n });\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { decodeFsst } from "./fsstDecoder";
|
|
3
|
-
import { encodeFsst, createSymbolTable } from "../encoding/fsstEncoder";
|
|
4
|
-
const textEncoder = new TextEncoder();
|
|
5
|
-
describe("decodeFsst", () => {
|
|
6
|
-
describe("basic functionality", () => {
|
|
7
|
-
it("should decode FSST compressed string data", () => {
|
|
8
|
-
const inputString = "HelloWorld !";
|
|
9
|
-
const originalBytes = textEncoder.encode(inputString);
|
|
10
|
-
const { symbols, symbolLengths } = createSymbolTable(["Hello", "World", "!"]);
|
|
11
|
-
const encoded = encodeFsst(symbols, symbolLengths, originalBytes);
|
|
12
|
-
const decoded = decodeFsst(symbols, symbolLengths, encoded);
|
|
13
|
-
expect(decoded).toEqual(originalBytes);
|
|
14
|
-
expect(new TextDecoder().decode(decoded)).toBe(inputString);
|
|
15
|
-
});
|
|
16
|
-
it("should handle empty string", () => {
|
|
17
|
-
const inputString = "";
|
|
18
|
-
const originalBytes = textEncoder.encode(inputString);
|
|
19
|
-
const { symbols, symbolLengths } = createSymbolTable(["A"]);
|
|
20
|
-
const encoded = encodeFsst(symbols, symbolLengths, originalBytes);
|
|
21
|
-
const decoded = decodeFsst(symbols, symbolLengths, encoded);
|
|
22
|
-
expect(decoded).toEqual(originalBytes);
|
|
23
|
-
expect(decoded.length).toBe(0);
|
|
24
|
-
});
|
|
25
|
-
it("should handle string with no matching symbols", () => {
|
|
26
|
-
const inputString = "12345";
|
|
27
|
-
const originalBytes = textEncoder.encode(inputString);
|
|
28
|
-
const { symbols, symbolLengths } = createSymbolTable(["abc", "def", "xyz"]);
|
|
29
|
-
const encoded = encodeFsst(symbols, symbolLengths, originalBytes);
|
|
30
|
-
const decoded = decodeFsst(symbols, symbolLengths, encoded);
|
|
31
|
-
expect(decoded).toEqual(originalBytes);
|
|
32
|
-
expect(new TextDecoder().decode(decoded)).toBe(inputString);
|
|
33
|
-
});
|
|
34
|
-
it("should handle string with all matching symbols", () => {
|
|
35
|
-
const inputString = "AAAA";
|
|
36
|
-
const originalBytes = textEncoder.encode(inputString);
|
|
37
|
-
const { symbols, symbolLengths } = createSymbolTable(["A"]);
|
|
38
|
-
const encoded = encodeFsst(symbols, symbolLengths, originalBytes);
|
|
39
|
-
const decoded = decodeFsst(symbols, symbolLengths, encoded);
|
|
40
|
-
expect(decoded).toEqual(originalBytes);
|
|
41
|
-
expect(new TextDecoder().decode(decoded)).toBe(inputString);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
describe("compression verification", () => {
|
|
45
|
-
it("should handle repeated strings efficiently", () => {
|
|
46
|
-
const inputString = "HelloWorldHelloWorld";
|
|
47
|
-
const originalBytes = textEncoder.encode(inputString);
|
|
48
|
-
const { symbols, symbolLengths } = createSymbolTable(["Hello", "World"]);
|
|
49
|
-
const encoded = encodeFsst(symbols, symbolLengths, originalBytes);
|
|
50
|
-
const decoded = decodeFsst(symbols, symbolLengths, encoded);
|
|
51
|
-
expect(decoded).toEqual(originalBytes);
|
|
52
|
-
expect(new TextDecoder().decode(decoded)).toBe(inputString);
|
|
53
|
-
expect(encoded.length).toBeLessThan(originalBytes.length);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=fsstDecoder.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fsstDecoder.spec.js","sourceRoot":"","sources":["../../src/decoding/fsstDecoder.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAA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OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;YAE5D,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACvC,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACtC,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;YAClD,MAAM,WAAW,GAAG,sBAAsB,CAAC;YAC3C,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YAEtD,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,iBAAiB,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;YACzE,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;YAClE,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;YAE5D,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACvC,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC5D,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect } from \"vitest\";\nimport { decodeFsst } from \"./fsstDecoder\";\nimport { encodeFsst, createSymbolTable } from \"../encoding/fsstEncoder\";\n\nconst textEncoder = new TextEncoder();\n\ndescribe(\"decodeFsst\", () => {\n describe(\"basic functionality\", () => {\n it(\"should decode FSST compressed string data\", () => {\n const inputString = \"HelloWorld !\";\n const originalBytes = textEncoder.encode(inputString);\n\n const { symbols, symbolLengths } = createSymbolTable([\"Hello\", \"World\", \"!\"]);\n const encoded = encodeFsst(symbols, symbolLengths, originalBytes);\n const decoded = decodeFsst(symbols, symbolLengths, encoded);\n\n expect(decoded).toEqual(originalBytes);\n expect(new TextDecoder().decode(decoded)).toBe(inputString);\n });\n\n it(\"should handle empty string\", () => {\n const inputString = \"\";\n const originalBytes = textEncoder.encode(inputString);\n\n const { symbols, symbolLengths } = createSymbolTable([\"A\"]);\n const encoded = encodeFsst(symbols, symbolLengths, originalBytes);\n const decoded = decodeFsst(symbols, symbolLengths, encoded);\n\n expect(decoded).toEqual(originalBytes);\n expect(decoded.length).toBe(0);\n });\n\n it(\"should handle string with no matching symbols\", () => {\n const inputString = \"12345\";\n const originalBytes = textEncoder.encode(inputString);\n\n const { symbols, symbolLengths } = createSymbolTable([\"abc\", \"def\", \"xyz\"]);\n const encoded = encodeFsst(symbols, symbolLengths, originalBytes);\n const decoded = decodeFsst(symbols, symbolLengths, encoded);\n\n expect(decoded).toEqual(originalBytes);\n expect(new TextDecoder().decode(decoded)).toBe(inputString);\n });\n\n it(\"should handle string with all matching symbols\", () => {\n const inputString = \"AAAA\";\n const originalBytes = textEncoder.encode(inputString);\n\n const { symbols, symbolLengths } = createSymbolTable([\"A\"]);\n const encoded = encodeFsst(symbols, symbolLengths, originalBytes);\n const decoded = decodeFsst(symbols, symbolLengths, encoded);\n\n expect(decoded).toEqual(originalBytes);\n expect(new TextDecoder().decode(decoded)).toBe(inputString);\n });\n });\n\n describe(\"compression verification\", () => {\n it(\"should handle repeated strings efficiently\", () => {\n const inputString = \"HelloWorldHelloWorld\";\n const originalBytes = textEncoder.encode(inputString);\n\n const { symbols, symbolLengths } = createSymbolTable([\"Hello\", \"World\"]);\n const encoded = encodeFsst(symbols, symbolLengths, originalBytes);\n const decoded = decodeFsst(symbols, symbolLengths, encoded);\n\n expect(decoded).toEqual(originalBytes);\n expect(new TextDecoder().decode(decoded)).toBe(inputString);\n expect(encoded.length).toBeLessThan(originalBytes.length);\n });\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|