Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify web worker registry to reduce bundle size #11511

Merged
merged 3 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions src/data/array_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class StructArrayLayout2i4 extends StructArray {
}

StructArrayLayout2i4.prototype.bytesPerElement = 4;
register('StructArrayLayout2i4', StructArrayLayout2i4);
register(StructArrayLayout2i4);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -70,7 +70,7 @@ class StructArrayLayout4i8 extends StructArray {
}

StructArrayLayout4i8.prototype.bytesPerElement = 8;
register('StructArrayLayout4i8', StructArrayLayout4i8);
register(StructArrayLayout4i8);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -113,7 +113,7 @@ class StructArrayLayout2i4ub1f12 extends StructArray {
}

StructArrayLayout2i4ub1f12.prototype.bytesPerElement = 12;
register('StructArrayLayout2i4ub1f12', StructArrayLayout2i4ub1f12);
register(StructArrayLayout2i4ub1f12);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -146,7 +146,7 @@ class StructArrayLayout3f12 extends StructArray {
}

StructArrayLayout3f12.prototype.bytesPerElement = 12;
register('StructArrayLayout3f12', StructArrayLayout3f12);
register(StructArrayLayout3f12);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -186,7 +186,7 @@ class StructArrayLayout10ui20 extends StructArray {
}

StructArrayLayout10ui20.prototype.bytesPerElement = 20;
register('StructArrayLayout10ui20', StructArrayLayout10ui20);
register(StructArrayLayout10ui20);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -224,7 +224,7 @@ class StructArrayLayout8ui16 extends StructArray {
}

StructArrayLayout8ui16.prototype.bytesPerElement = 16;
register('StructArrayLayout8ui16', StructArrayLayout8ui16);
register(StructArrayLayout8ui16);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -275,7 +275,7 @@ class StructArrayLayout4i4ui4i4i32 extends StructArray {
}

StructArrayLayout4i4ui4i4i32.prototype.bytesPerElement = 32;
register('StructArrayLayout4i4ui4i4i32', StructArrayLayout4i4ui4i4i32);
register(StructArrayLayout4i4ui4i4i32);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -306,7 +306,7 @@ class StructArrayLayout1ul4 extends StructArray {
}

StructArrayLayout1ul4.prototype.bytesPerElement = 4;
register('StructArrayLayout1ul4', StructArrayLayout1ul4);
register(StructArrayLayout1ul4);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -360,7 +360,7 @@ class StructArrayLayout5i4f1i1ul2ui40 extends StructArray {
}

StructArrayLayout5i4f1i1ul2ui40.prototype.bytesPerElement = 40;
register('StructArrayLayout5i4f1i1ul2ui40', StructArrayLayout5i4f1i1ul2ui40);
register(StructArrayLayout5i4f1i1ul2ui40);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -399,7 +399,7 @@ class StructArrayLayout3i2i2i16 extends StructArray {
}

StructArrayLayout3i2i2i16.prototype.bytesPerElement = 16;
register('StructArrayLayout3i2i2i16', StructArrayLayout3i2i2i16);
register(StructArrayLayout3i2i2i16);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -439,7 +439,7 @@ class StructArrayLayout2f1f2i16 extends StructArray {
}

StructArrayLayout2f1f2i16.prototype.bytesPerElement = 16;
register('StructArrayLayout2f1f2i16', StructArrayLayout2f1f2i16);
register(StructArrayLayout2f1f2i16);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -475,7 +475,7 @@ class StructArrayLayout2ub2f12 extends StructArray {
}

StructArrayLayout2ub2f12.prototype.bytesPerElement = 12;
register('StructArrayLayout2ub2f12', StructArrayLayout2ub2f12);
register(StructArrayLayout2ub2f12);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -508,7 +508,7 @@ class StructArrayLayout3ui6 extends StructArray {
}

StructArrayLayout3ui6.prototype.bytesPerElement = 6;
register('StructArrayLayout3ui6', StructArrayLayout3ui6);
register(StructArrayLayout3ui6);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -576,7 +576,7 @@ class StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60 extends StructArray {
}

StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60.prototype.bytesPerElement = 60;
register('StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60', StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60);
register(StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -648,7 +648,7 @@ class StructArrayLayout3i2f6i15ui1ul3f76 extends StructArray {
}

StructArrayLayout3i2f6i15ui1ul3f76.prototype.bytesPerElement = 76;
register('StructArrayLayout3i2f6i15ui1ul3f76', StructArrayLayout3i2f6i15ui1ul3f76);
register(StructArrayLayout3i2f6i15ui1ul3f76);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -679,7 +679,7 @@ class StructArrayLayout1f4 extends StructArray {
}

StructArrayLayout1f4.prototype.bytesPerElement = 4;
register('StructArrayLayout1f4', StructArrayLayout1f4);
register(StructArrayLayout1f4);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -712,7 +712,7 @@ class StructArrayLayout3i6 extends StructArray {
}

StructArrayLayout3i6.prototype.bytesPerElement = 6;
register('StructArrayLayout3i6', StructArrayLayout3i6);
register(StructArrayLayout3i6);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -749,7 +749,7 @@ class StructArrayLayout7f28 extends StructArray {
}

StructArrayLayout7f28.prototype.bytesPerElement = 28;
register('StructArrayLayout7f28', StructArrayLayout7f28);
register(StructArrayLayout7f28);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -787,7 +787,7 @@ class StructArrayLayout1ul3ui12 extends StructArray {
}

StructArrayLayout1ul3ui12.prototype.bytesPerElement = 12;
register('StructArrayLayout1ul3ui12', StructArrayLayout1ul3ui12);
register(StructArrayLayout1ul3ui12);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -819,7 +819,7 @@ class StructArrayLayout2ui4 extends StructArray {
}

StructArrayLayout2ui4.prototype.bytesPerElement = 4;
register('StructArrayLayout2ui4', StructArrayLayout2ui4);
register(StructArrayLayout2ui4);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -850,7 +850,7 @@ class StructArrayLayout1ui2 extends StructArray {
}

StructArrayLayout1ui2.prototype.bytesPerElement = 2;
register('StructArrayLayout1ui2', StructArrayLayout1ui2);
register(StructArrayLayout1ui2);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -882,7 +882,7 @@ class StructArrayLayout2f8 extends StructArray {
}

StructArrayLayout2f8.prototype.bytesPerElement = 8;
register('StructArrayLayout2f8', StructArrayLayout2f8);
register(StructArrayLayout2f8);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -916,7 +916,7 @@ class StructArrayLayout4f16 extends StructArray {
}

StructArrayLayout4f16.prototype.bytesPerElement = 16;
register('StructArrayLayout4f16', StructArrayLayout4f16);
register(StructArrayLayout4f16);

/**
* Implementation of the StructArray layout:
Expand Down Expand Up @@ -957,7 +957,7 @@ class StructArrayLayout6i1f16 extends StructArray {
}

StructArrayLayout6i1f16.prototype.bytesPerElement = 16;
register('StructArrayLayout6i1f16', StructArrayLayout6i1f16);
register(StructArrayLayout6i1f16);

class CollisionBoxStruct extends Struct {
_structArray: CollisionBoxArray;
Expand Down Expand Up @@ -1008,7 +1008,7 @@ export class CollisionBoxArray extends StructArrayLayout5i4f1i1ul2ui40 {
}
}

register('CollisionBoxArray', CollisionBoxArray);
register(CollisionBoxArray);

class PlacedSymbolStruct extends Struct {
_structArray: PlacedSymbolArray;
Expand Down Expand Up @@ -1079,7 +1079,7 @@ export class PlacedSymbolArray extends StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1
}
}

register('PlacedSymbolArray', PlacedSymbolArray);
register(PlacedSymbolArray);

class SymbolInstanceStruct extends Struct {
_structArray: SymbolInstanceArray;
Expand Down Expand Up @@ -1165,7 +1165,7 @@ export class SymbolInstanceArray extends StructArrayLayout3i2f6i15ui1ul3f76 {
}
}

register('SymbolInstanceArray', SymbolInstanceArray);
register(SymbolInstanceArray);

/**
* @private
Expand All @@ -1174,7 +1174,7 @@ export class GlyphOffsetArray extends StructArrayLayout1f4 {
getoffsetX(index: number): number { return this.float32[index * 1 + 0]; }
}

register('GlyphOffsetArray', GlyphOffsetArray);
register(GlyphOffsetArray);

/**
* @private
Expand All @@ -1185,7 +1185,7 @@ export class SymbolLineVertexArray extends StructArrayLayout3i6 {
gettileUnitDistanceFromAnchor(index: number): number { return this.int16[index * 3 + 2]; }
}

register('SymbolLineVertexArray', SymbolLineVertexArray);
register(SymbolLineVertexArray);

class FeatureIndexStruct extends Struct {
_structArray: FeatureIndexArray;
Expand Down Expand Up @@ -1218,7 +1218,7 @@ export class FeatureIndexArray extends StructArrayLayout1ul3ui12 {
}
}

register('FeatureIndexArray', FeatureIndexArray);
register(FeatureIndexArray);

class FillExtrusionCentroidStruct extends Struct {
_structArray: FillExtrusionCentroidArray;
Expand Down Expand Up @@ -1247,7 +1247,7 @@ export class FillExtrusionCentroidArray extends StructArrayLayout2ui4 {
}
}

register('FillExtrusionCentroidArray', FillExtrusionCentroidArray);
register(FillExtrusionCentroidArray);

class CircleGlobeExtStruct extends Struct {
_structArray: CircleGlobeExtArray;
Expand Down Expand Up @@ -1286,7 +1286,7 @@ export class CircleGlobeExtArray extends StructArrayLayout6i1f16 {
}
}

register('CircleGlobeExtArray', CircleGlobeExtArray);
register(CircleGlobeExtArray);

export {
StructArrayLayout2i4,
Expand Down
2 changes: 1 addition & 1 deletion src/data/bucket/circle_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,6 @@ class CircleBucket<Layer: CircleStyleLayer | HeatmapStyleLayer> implements Bucke
}
}

register('CircleBucket', CircleBucket, {omit: ['layers']});
register(CircleBucket, {omit: ['layers']});

export default CircleBucket;
2 changes: 1 addition & 1 deletion src/data/bucket/fill_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,6 @@ class FillBucket implements Bucket {
}
}

register('FillBucket', FillBucket, {omit: ['layers', 'patternFeatures']});
register(FillBucket, {omit: ['layers', 'patternFeatures']});

export default FillBucket;
4 changes: 2 additions & 2 deletions src/data/bucket/fill_extrusion_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@ class FillExtrusionBucket implements Bucket {
}
}

register('FillExtrusionBucket', FillExtrusionBucket, {omit: ['layers', 'features']});
register('PartMetadata', PartMetadata);
register(FillExtrusionBucket, {omit: ['layers', 'features']});
register(PartMetadata);

export default FillExtrusionBucket;

Expand Down
2 changes: 1 addition & 1 deletion src/data/bucket/heatmap_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class HeatmapBucket extends CircleBucket<HeatmapStyleLayer> {
layers: Array<HeatmapStyleLayer>;
}

register('HeatmapBucket', HeatmapBucket, {omit: ['layers']});
register(HeatmapBucket, {omit: ['layers']});

export default HeatmapBucket;
2 changes: 1 addition & 1 deletion src/data/bucket/line_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,6 @@ class LineBucket implements Bucket {
}
}

register('LineBucket', LineBucket, {omit: ['layers', 'patternFeatures']});
register(LineBucket, {omit: ['layers', 'patternFeatures']});

export default LineBucket;
6 changes: 3 additions & 3 deletions src/data/bucket/symbol_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export class SymbolBuffers {
}
}

register('SymbolBuffers', SymbolBuffers);
register(SymbolBuffers);

class CollisionBuffers {
layoutVertexArray: StructArray;
Expand Down Expand Up @@ -280,7 +280,7 @@ class CollisionBuffers {
}
}

register('CollisionBuffers', CollisionBuffers);
register(CollisionBuffers);

/**
* Unlike other buckets, which simply implement #addFeature with type-specific
Expand Down Expand Up @@ -1035,7 +1035,7 @@ class SymbolBucket implements Bucket {
}
}

register('SymbolBucket', SymbolBucket, {
register(SymbolBucket, {
omit: ['layers', 'collisionBoxArray', 'features', 'compareText']
});

Expand Down
4 changes: 2 additions & 2 deletions src/data/dem_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,5 @@ export default class DEMData {
}
}

register('DEMData', DEMData);
register('DemMinMaxQuadTree', DemMinMaxQuadTree, {omit: ['dem']});
register(DEMData);
register(DemMinMaxQuadTree, {omit: ['dem']});
6 changes: 1 addition & 5 deletions src/data/feature_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,7 @@ class FeatureIndex {
}
}

register(
'FeatureIndex',
FeatureIndex,
{omit: ['rawTileData', 'sourceLayerCoder']}
);
register(FeatureIndex, {omit: ['rawTileData', 'sourceLayerCoder']});

export default FeatureIndex;

Expand Down
2 changes: 1 addition & 1 deletion src/data/feature_position_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ function swap(arr, i, j) {
arr[j] = tmp;
}

register('FeaturePositionMap', FeaturePositionMap);
register(FeaturePositionMap);
Loading