Skip to content

Commit

Permalink
[Chore]: Technical: Isolate deckgl-layers (#1851)
Browse files Browse the repository at this point in the history
* Deckgl isolated

Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>

* Imports updated

Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>

* Merge changes

Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>

* Prettier corrections

Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>

* Review corrections

Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>

* Removed unused imports

Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
  • Loading branch information
dariaterekhova-actionengine committed Jul 11, 2022
1 parent 9feddc6 commit b668fd2
Show file tree
Hide file tree
Showing 32 changed files with 373 additions and 50 deletions.
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -17,7 +17,8 @@
"private": true,
"workspaces": [
"./src/constants",
"./src/types"
"./src/types",
"./src/deckgl-layers"
],
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,7 +49,7 @@
"start:web": "npm run install-and-start -- website start",
"start:https": "npm run install-and-start -- examples/demo-app start-local-https",
"start:e2e": "npm run install-and-start -- examples/demo-app start-local-e2e",
"build": "rm -fr dist && babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
"build": "rm -fr dist && babel src/{actions,components,layers,middleware,reducers,styles,templates,utils,cloud-providers,connect,localization,processors,schemas,tasks} --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
"build:umd": "webpack --config ./webpack/umd.js --progress --env.prod",
"build:types": "tsc --project tsconfig.production.json",
"analyze": "npm run analyze:bundle",
Expand Down
2 changes: 1 addition & 1 deletion src/components/map-container.tsx
Expand Up @@ -50,7 +50,7 @@ import {
} from 'utils/layer-utils';

// default-settings
import ThreeDBuildingLayer from 'deckgl-layers/3d-building-layer/3d-building-layer';
import {ThreeDBuildingLayer} from '@kepler.gl/deckgl-layers';
import {FILTER_TYPES, GEOCODER_LAYER_ID, THROTTLE_NOTIFICATION_TIME} from '@kepler.gl/constants';

import ErrorBoundary from 'components/common/error-boundary';
Expand Down
4 changes: 3 additions & 1 deletion src/constants/package.json
Expand Up @@ -29,11 +29,13 @@
"umd"
],
"dependencies": {
"@babel/runtime": "^7.12.1",
"colorbrewer": "^1.5.0",
"d3-scale": "^3.2.3",
"global": "^4.3.0",
"keymirror": "^0.1.1",
"react-map-gl-draw": "0.14.8"
"react-map-gl-draw": "0.14.8",
"@kepler.gl/types": "2.5.5"
},
"exports": {
".": "./dist/index.js",
Expand Down
64 changes: 64 additions & 0 deletions src/deckgl-layers/babel.config.js
@@ -0,0 +1,64 @@
// Copyright (c) 2022 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

const KeplerPackage = require('./package');

const PRESETS = ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'];
const PLUGINS = [
['@babel/plugin-transform-typescript', {isTSX: true, allowDeclareFields: true}],
'@babel/plugin-transform-modules-commonjs',
'@babel/plugin-proposal-optional-chaining',
[
'@babel/transform-runtime',
{
regenerator: true
}
],
[
'search-and-replace',
{
rules: [
{
search: '__PACKAGE_VERSION__',
replace: KeplerPackage.version
}
]
}
]
];
const ENV = {
test: {
plugins: ['istanbul']
},
debug: {
sourceMaps: 'inline',
retainLines: true
}
};

module.exports = function babel(api) {
api.cache(true);

return {
presets: PRESETS,
plugins: PLUGINS,
env: ENV
};
};
66 changes: 66 additions & 0 deletions src/deckgl-layers/package.json
@@ -0,0 +1,66 @@
{
"name": "@kepler.gl/deckgl-layers",
"author": "Shan He <shan@uber.com>",
"version": "2.5.5",
"description": "kepler.gl constants used by kepler.gl components, actions and reducers",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/deckgl-layers/src/index.d.ts",
"keywords": [
"babel",
"es6",
"react",
"webgl",
"visualization",
"deck.gl"
],
"repository": {
"type": "git",
"url": "https://github.com/keplergl/kepler.gl.git"
},
"scripts": {
"build": "rm -fr dist && babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
"build:umd": "webpack --config ./webpack/umd.js --progress --env.prod",
"build:types": "tsc --project ./tsconfig.production.json",
"prepublish": "uber-licence && yarn build && yarn build:types"
},
"files": [
"dist",
"umd"
],
"dependencies": {
"@danmarshall/deckgl-typings": "4.9.22",
"@deck.gl/aggregation-layers": "8.2.0",
"@deck.gl/core": "8.2.0",
"@deck.gl/extensions": "8.2.0",
"@deck.gl/geo-layers": "8.2.0",
"@deck.gl/layers": "8.2.0",
"@deck.gl/mesh-layers": "8.2.0",
"@deck.gl/react": "8.2.0",
"@luma.gl/constants": "^8.2.0",
"@luma.gl/core": "^8.2.0",
"@mapbox/geo-viewport": "^0.4.1",
"@mapbox/vector-tile": "^1.3.1",
"@types/geojson": "^7946.0.7",
"d3-array": "^2.8.0",
"global": "^4.3.0",
"keymirror": "^0.1.1",
"@kepler.gl/constants": "2.5.5",
"lodash.memoize": "^4.1.2"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"engines": {
"node": ">=12.0.0"
},
"maintainers": [
"Shan He <heshan0131@gmail.com>",
"Giuseppe Macri <gmacri@uber.com>"
],
"volta": {
"node": "12.22.0",
"yarn": "1.22.17"
}
}
Expand Up @@ -31,7 +31,7 @@ import CPUAggregator, {
import {getDistanceScales} from 'viewport-mercator-project';
import {max} from 'd3-array';

import {LAYER_VIS_CONFIGS} from 'layers/layer-factory';
import {LAYER_VIS_CONFIGS} from '../../../layers/layer-factory';
import {SCALE_TYPES, DEFAULT_COLOR_RANGE} from '@kepler.gl/constants';
import ClusterBuilder, {getGeoJSON} from '../layer-utils/cluster-utils';
import {RGBAColor} from '@kepler.gl/types';
Expand Down
Expand Up @@ -19,7 +19,7 @@
// THE SOFTWARE.

import {ColumnLayer} from '@deck.gl/layers';
import {editShader} from '../../deckgl-layers/layer-utils/shader-utils';
import {editShader} from '../';

function addInstanceCoverage(vs) {
const addDecl = editShader(
Expand Down
16 changes: 16 additions & 0 deletions src/deckgl-layers/src/index.ts
@@ -0,0 +1,16 @@
export {default as ThreeDBuildingLayer} from './3d-building-layer/3d-building-layer';

export {default as DeckGLClusterLayer} from './cluster-layer/cluster-layer';

export {default as EnhancedColumnLayer} from './column-layer/enhanced-column-layer';

export {default as EnhancedGridLayer} from './grid-layer/enhanced-cpu-grid-layer';

export {default as EnhancedHexagonLayer} from './hexagon-layer/enhanced-hexagon-layer';
export {default as EnhancedLineLayer} from './line-layer/line-layer';
export {default as SvgIconLayer} from './svg-icon-layer/svg-icon-layer';

export * from './layer-utils/shader-utils';

export * from './3d-building-layer/types';
export * from './3d-building-layer/3d-building-utils';
Expand Up @@ -22,7 +22,7 @@
import {AGGREGATION_OPERATION, _BinSorter as BinSorter} from '@deck.gl/aggregation-layers';
import {console as Console} from 'global/window';

import {aggregate} from '../../utils/aggregate-utils';
import {aggregate} from '../../../utils/aggregate-utils';
import {AGGREGATION_TYPES, SCALE_FUNC} from '@kepler.gl/constants';
import {RGBAColor} from '@kepler.gl/types';

Expand Down Expand Up @@ -380,7 +380,7 @@ export const defaultElevationDimension: DimensionType<number> = {

export const defaultDimensions = [defaultColorDimension, defaultElevationDimension];

export type CPUAggregatorState = {layerData: {data?}; dimensions: {}; geoJSON?, clusterBuilder?};
export type CPUAggregatorState = {layerData: {data?}; dimensions: {}; geoJSON?; clusterBuilder?};

export default class CPUAggregator {
static getDimensionScale: any;
Expand Down
Expand Up @@ -21,7 +21,7 @@
import {LineLayer, LineLayerProps} from '@deck.gl/layers';
import GL from '@luma.gl/constants';
import {RGBAColor} from 'deck.gl';
import {editShader} from '../../deckgl-layers/layer-utils/shader-utils';
import {editShader} from '../';

const defaultProps = {
...LineLayer.defaultProps,
Expand Down
25 changes: 25 additions & 0 deletions src/deckgl-layers/src/typedefs/deckgl.d.ts
@@ -0,0 +1,25 @@
// Copyright (c) 2022 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import * as DeckTypings from '@danmarshall/deckgl-typings';

declare module 'deck.gl' {
export namespace DeckTypings {}
}
33 changes: 33 additions & 0 deletions src/deckgl-layers/tsconfig.production.json
@@ -0,0 +1,33 @@
{
"compilerOptions": {
"target": "es2020",
"allowJs": false,
"checkJs": false,
"jsx": "react",
"module": "esnext",
"moduleResolution": "node",
"declaration":true,
"emitDeclarationOnly":true,
"noImplicitAny": false,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"outDir": "dist",
"sourceMap": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": false,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"baseUrl": "../../src", //TODO change once all dependencies are isolated
"paths": {
"@kepler.gl/deckgl-layers": ["deckgl-layers/src"] //TODO change once all dependencies are isolated
}
},
"include": [
"src"
]
}

0 comments on commit b668fd2

Please sign in to comment.