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

Remove flow globals TileJSON and Transferable #5668

Merged
merged 2 commits into from
Nov 21, 2017
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
2 changes: 2 additions & 0 deletions bench/benchmarks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const {
normalizeTileURL
} = require('../../src/util/mapbox');

import type {TileJSON} from '../../src/types/tilejson';

// Note: this class is extended in turn by the LayoutDDS benchmark.
module.exports = class Layout extends Benchmark {
glyphs: Object;
Expand Down
1 change: 0 additions & 1 deletion flow-typed/transferable.js

This file was deleted.

1 change: 1 addition & 0 deletions src/data/bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type CollisionBoxArray from '../symbol/collision_box';
import type Style from '../style/style';
import type StyleLayer from '../style/style_layer';
import type FeatureIndex from './feature_index';
import type {Transferable} from '../types/transferable';

export type BucketParameters = {
index: number,
Expand Down
1 change: 1 addition & 0 deletions src/data/bucket/circle_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {ProgramInterface} from '../program_configuration';
import type StyleLayer from '../../style/style_layer';
import type {StructArray} from '../../util/struct_array';
import type Point from '@mapbox/point-geometry';
import type {Transferable} from '../../types/transferable';

const circleInterface = {
layoutAttributes: [
Expand Down
1 change: 1 addition & 0 deletions src/data/bucket/fill_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {ProgramInterface} from '../program_configuration';
import type StyleLayer from '../../style/style_layer';
import type {StructArray} from '../../util/struct_array';
import type Point from '@mapbox/point-geometry';
import type {Transferable} from '../../types/transferable';

const fillInterface = {
layoutAttributes: [
Expand Down
1 change: 1 addition & 0 deletions src/data/bucket/fill_extrusion_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {ProgramInterface} from '../program_configuration';
import type StyleLayer from '../../style/style_layer';
import type {StructArray} from '../../util/struct_array';
import type Point from '@mapbox/point-geometry';
import type {Transferable} from '../../types/transferable';

const fillExtrusionInterface = {
layoutAttributes: [
Expand Down
1 change: 1 addition & 0 deletions src/data/bucket/line_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type LineStyleLayer from '../../style/style_layer/line_style_layer';
import type Point from '@mapbox/point-geometry';
import type {Segment} from '../segment';
import type {StructArray} from '../../util/struct_array';
import type {Transferable} from '../../types/transferable';

// NOTE ON EXTRUDE SCALE:
// scale the extrusion vector so that the normal length is this value.
Expand Down
1 change: 1 addition & 0 deletions src/data/bucket/symbol_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import type SymbolStyleLayer from '../../style/style_layer/symbol_style_layer';
import type {SymbolQuad} from '../../symbol/quads';
import type {SizeData} from '../../symbol/symbol_size';
import type {PossiblyEvaluatedPropertyValue} from '../../style/properties';
import type {Transferable} from '../../types/transferable';

export type SingleCollisionBox = {
x1: number;
Expand Down
1 change: 1 addition & 0 deletions src/data/feature_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type CollisionIndex from '../symbol/collision_index';
import type StyleLayer from '../style/style_layer';
import type {SerializedStructArray} from '../util/struct_array';
import type {FeatureFilter} from '../style-spec/feature_filter';
import type {Transferable} from '../types/transferable';

const FeatureIndexArray = createStructArrayType({
members: [
Expand Down
1 change: 1 addition & 0 deletions src/data/program_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {ViewType, StructArray, SerializedStructArray, StructArrayTypeParame
import type Program from '../render/program';
import type {Feature, SourceExpression, CompositeExpression} from '../style-spec/expression';
import type {PossiblyEvaluated, PossiblyEvaluatedPropertyValue} from '../style/properties';
import type {Transferable} from '../types/transferable';

type LayoutAttribute = {
name: string,
Expand Down
1 change: 1 addition & 0 deletions src/source/load_tilejson.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const normalizeURL = require('../util/mapbox').normalizeSourceURL;

import type {RequestTransformFunction} from '../ui/map';
import type {Callback} from '../types/callback';
import type {TileJSON} from '../types/tilejson';

module.exports = function(options: any, requestTransformFn: RequestTransformFunction, callback: Callback<TileJSON>) {
const loaded = function(err, tileJSON: any) {
Expand Down
1 change: 1 addition & 0 deletions src/source/worker_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {SerializedFeatureIndex} from '../data/feature_index';
import type {SerializedStructArray} from '../util/struct_array';
import type {RequestParameters} from '../util/ajax';
import type {RGBAImage, AlphaImage} from '../util/image';
import type {Transferable} from '../types/transferable';

export type TileParameters = {
source: string,
Expand Down
1 change: 1 addition & 0 deletions src/source/worker_tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
WorkerTileParameters,
WorkerTileCallback,
} from '../source/worker_source';
import type {Transferable} from '../types/transferable';

class WorkerTile {
coord: TileCoord;
Expand Down
4 changes: 3 additions & 1 deletion flow-typed/tilejson.js → src/types/tilejson.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
declare type TileJSON = {|
// @flow

export type TileJSON = {|
tilejson: '2.2.0' | '2.1.0' | '2.0.1' | '2.0.0' | '1.0.0',
name?: string,
description?: string,
Expand Down
3 changes: 3 additions & 0 deletions src/types/transferable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @flow

export type Transferable = ArrayBuffer | MessagePort | ImageBitmap;
2 changes: 2 additions & 0 deletions src/util/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

const util = require('./util');

import type {Transferable} from '../types/transferable';

/**
* An implementation of the [Actor design pattern](http://en.wikipedia.org/wiki/Actor_model)
* that maintains the relationship between asynchronous tasks and the objects
Expand Down
1 change: 1 addition & 0 deletions src/util/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const util = require('./util');
const Actor = require('./actor');

import type WorkerPool from './worker_pool';
import type {Transferable} from '../types/transferable';

/**
* Responsible for sending messages from a {@link Source} to an associated
Expand Down
2 changes: 2 additions & 0 deletions src/util/struct_array.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

const assert = require('assert');

import type {Transferable} from '../types/transferable';

module.exports = createStructArrayType;

const viewTypes = {
Expand Down