Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[chore] Fix and update examples to v3.1.10 (#3182)
Igor Dykhta751148111243
diff --git a/examples/custom-map-style/README.md b/examples/custom-map-style/README.mdindex d12f7ce5e..f1b15d846 100644--- a/examples/custom-map-style/README.md+++ b/examples/custom-map-style/README.md@@ -1,20 +1,14 @@-# Custom Map Style+# Custom Map Style-+Demo how to use kepler.gl with other basemap services other than Mapbox.Read more about [Custom Map Style][custom-map-styles]-### Run Example-#### 1. Install-```sh-npm install-```--or+#### 1. Install```shyarn@@ -23,8 +17,7 @@ yarn#### 2. Start the app```sh-npm start+yarn start```--[custom-map-styles]: ./docs/api-reference/advanced-usages/custom-map-styles.md\ No newline at end of file+[custom-map-styles]: ./docs/api-reference/advanced-usages/custom-map-styles.mddiff --git a/examples/custom-map-style/esbuild.config.mjs b/examples/custom-map-style/esbuild.config.mjsnew file mode 100644index 000000000..b6c67f4fb--- /dev/null+++ b/examples/custom-map-style/esbuild.config.mjs@@ -0,0 +1,134 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import esbuild from 'esbuild';+import {replace} from 'esbuild-plugin-replace';+import {dotenvRun} from '@dotenv-run/esbuild';+import copyPlugin from 'esbuild-plugin-copy';++import process from 'node:process';+import fs from 'node:fs';+import {spawn} from 'node:child_process';+import {join} from 'node:path';++const args = process.argv;++const port = 8080;++const NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'production');++// Ensure a single instance of React and friends to avoid invalid hook calls+const ROOT_NODE_MODULES = join('..', '..', 'node_modules');+const thirdPartyAliases = {+ react: join(ROOT_NODE_MODULES, 'react'),+ 'react-dom': join(ROOT_NODE_MODULES, 'react-dom'),+ 'react-redux': join(ROOT_NODE_MODULES, 'react-redux', 'lib'),+ 'styled-components': join(ROOT_NODE_MODULES, 'styled-components'),+ 'apache-arrow': join(ROOT_NODE_MODULES, 'apache-arrow')+};++const config = {+ platform: 'browser',+ format: 'iife',+ logLevel: 'info',+ loader: {+ '.js': 'jsx',+ '.ts': 'ts',+ '.tsx': 'tsx',+ '.css': 'css',+ '.ttf': 'file',+ '.woff': 'file',+ '.woff2': 'file'+ },+ entryPoints: ['src/main.tsx'],+ outfile: 'dist/bundle.js',+ bundle: true,+ define: {+ NODE_ENV,+ 'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken || '')+ },+ plugins: [+ dotenvRun({+ verbose: true,+ environment: NODE_ENV,+ root: '../../.env'+ }),+ replace({+ __PACKAGE_VERSION__: '3.1.10',+ include: /constants\/src\/default-settings\.ts/+ }),+ copyPlugin({+ resolveFrom: 'cwd',+ assets: {+ from: ['index.html'],+ to: ['dist/index.html']+ }+ })+ ]+};++function openURL(url) {+ const cmd = {+ darwin: ['open'],+ linux: ['xdg-open'],+ win32: ['cmd', '/c', 'start']+ };+ const command = cmd[process.platform];+ if (command) {+ spawn(command[0], [...command.slice(1), url]);+ }+}++(async () => {+ if (args.includes('--build')) {+ const result = await esbuild+ .build({+ ...config,+ alias: thirdPartyAliases,+ minify: true,+ sourcemap: false,+ metafile: true,+ define: {+ ...config.define,+ 'process.env.NODE_ENV': '"production"'+ },+ drop: ['console', 'debugger'],+ treeShaking: true+ })+ .catch(e => {+ console.error(e);+ process.exit(1);+ });+ fs.writeFileSync('dist/esbuild-metadata.json', JSON.stringify(result.metafile));+ }++ if (args.includes('--start')) {+ await esbuild+ .context({+ ...config,+ alias: thirdPartyAliases,+ minify: false,+ sourcemap: true,+ banner: {+ js: `new EventSource('/esbuild').addEventListener('change', () => location.reload());`+ }+ })+ .then(async ctx => {+ await ctx.watch();+ await ctx.serve({+ servedir: 'dist',+ port,+ fallback: 'dist/index.html',+ onRequest: ({remoteAddress, method, path, status, timeInMS}) => {+ console.info(remoteAddress, status, `"${method} ${path}" [${timeInMS}ms]`);+ }+ });+ console.info(`kepler.gl custom-map-style example running at ${`http://localhost:${port}`}`);+ openURL(`http://localhost:${port}`);+ })+ .catch(e => {+ console.error(e);+ process.exit(1);+ });+ }+})();diff --git a/examples/custom-map-style/package.json b/examples/custom-map-style/package.jsonindex 19eb1b663..5391373b7 100644--- a/examples/custom-map-style/package.json+++ b/examples/custom-map-style/package.json@@ -1,11 +1,12 @@{"scripts": {- "start": "webpack-dev-server --progress --hot --open",- "start-local": "webpack-dev-server --env.es6 --progress --hot --open"+ "start": "node esbuild.config.mjs --start",+ "build": "node esbuild.config.mjs --build",+ "start-local": "NODE_ENV=local node esbuild.config.mjs --start"},"dependencies": {- "@kepler.gl/components": "^3.0.0-alpha.1",- "@kepler.gl/reducers": "^3.0.0-alpha.1",+ "@kepler.gl/components": "^3.1.10",+ "@kepler.gl/reducers": "^3.1.10","global": "^4.3.0","react": "^18.2.0","react-dom": "^18.2.0",@@ -16,21 +17,9 @@"styled-components": "6.1.8"},"devDependencies": {- "@babel/core": "^7.12.1",- "@babel/plugin-transform-class-properties": "^7.12.1",- "@babel/plugin-transform-export-namespace-from": "^7.12.1",- "@babel/plugin-transform-modules-commonjs": "^7.12.1",- "@babel/plugin-transform-optional-chaining": "^7.12.1",- "@babel/plugin-transform-runtime": "^7.12.1",- "@babel/plugin-transform-typescript": "^7.16.8",- "@babel/preset-env": "^7.0.0",- "@babel/preset-react": "^7.0.0",- "@babel/preset-typescript": "^7.16.7",- "babel-loader": "^8.0.0",- "webpack": "^4.29.0",- "webpack-cli": "^3.2.1",- "webpack-dev-middleware": "^3.5.1",- "webpack-dev-server": "^3.1.14",- "webpack-hot-middleware": "^2.24.3"+ "@dotenv-run/esbuild": "^1.5.0",+ "esbuild": "^0.25.0",+ "esbuild-plugin-copy": "^2.1.1",+ "esbuild-plugin-replace": "^1.4.0"}}diff --git a/examples/custom-map-style/webpack.config.js b/examples/custom-map-style/webpack.config.jsdeleted file mode 100644index 9ed4848d8..000000000--- a/examples/custom-map-style/webpack.config.js+++ /dev/null@@ -1,53 +0,0 @@-// SPDX-License-Identifier: MIT-// Copyright contributors to the kepler.gl project--// NOTE: To use this example standalone (e.g. outside of deck.gl repo)-// delete the local development overrides at the bottom of this file--// avoid destructuring for older Node version support-const resolve = require('path').resolve;-const join = require('path').join;-const webpack = require('webpack');--const CONFIG = {- // bundle app.js and everything it imports, recursively.- entry: {- app: resolve('./src/main.tsx')- },- output: {- path: resolve(__dirname, 'build'),- filename: 'bundle.js',- publicPath: '/'- },-- devtool: 'source-map',-- module: {- rules: [- {- test: /\.(js|ts|tsx)$/,- loader: 'babel-loader',- include: join(__dirname, 'src'),- exclude: [/node_modules/]- },- // fix for arrow-related errors- {- test: /\.mjs$/,- include: /node_modules/,- type: 'javascript/auto'- }- ]- },-- node: {- fs: 'empty'- },-- // Optional: Enables reading mapbox token from environment variable- plugins: [new webpack.EnvironmentPlugin(['MapboxAccessToken'])]-};--// This line enables bundling against src in this repo rather than installed deck.gl module-module.exports = env => {- return env ? require('../webpack.config.local')(CONFIG, __dirname)(env) : CONFIG;-};diff --git a/examples/custom-reducer/README.md b/examples/custom-reducer/README.mdindex f38d0552d..f0ea50381 100644--- a/examples/custom-reducer/README.md+++ b/examples/custom-reducer/README.md@@ -1,24 +1,24 @@# Customize kepler.gl ReducerThis example demos how to customize kepler.gl reducer- 1. Customize reducer initialState by `keplerGlReducer.initialState`- 2. Adding custom actions by `keplerGlReducer.plugins`++1. Customize reducer initialState by `keplerGlReducer.initialState`+2. Adding custom actions by `keplerGlReducer.plugins`### Local dev-```-npm install-```-or+```yarn```add mapbox access token to node env+```export MapboxAccessToken=<your_mapbox_token>```then+```-npm start+yarn start```diff --git a/examples/custom-reducer/esbuild.config.mjs b/examples/custom-reducer/esbuild.config.mjsnew file mode 100644index 000000000..a706ac8d8--- /dev/null+++ b/examples/custom-reducer/esbuild.config.mjs@@ -0,0 +1,132 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import esbuild from 'esbuild';+import {replace} from 'esbuild-plugin-replace';+import {dotenvRun} from '@dotenv-run/esbuild';+import copyPlugin from 'esbuild-plugin-copy';++import process from 'node:process';+import fs from 'node:fs';+import {spawn} from 'node:child_process';+import {join} from 'node:path';++const args = process.argv;++const port = 8080;++const NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'production');++// Ensure a single instance of React and friends to avoid invalid hook calls+const ROOT_NODE_MODULES = join('..', '..', 'node_modules');+const thirdPartyAliases = {+ react: join(ROOT_NODE_MODULES, 'react'),+ 'react-dom': join(ROOT_NODE_MODULES, 'react-dom'),+ 'react-redux': join(ROOT_NODE_MODULES, 'react-redux', 'lib'),+ 'styled-components': join(ROOT_NODE_MODULES, 'styled-components'),+ 'apache-arrow': join(ROOT_NODE_MODULES, 'apache-arrow')+};++const config = {+ platform: 'browser',+ format: 'iife',+ logLevel: 'info',+ loader: {+ '.js': 'jsx',+ '.css': 'css',+ '.ttf': 'file',+ '.woff': 'file',+ '.woff2': 'file'+ },+ entryPoints: ['src/main.js'],+ outfile: 'dist/bundle.js',+ bundle: true,+ define: {+ NODE_ENV,+ 'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken || '')+ },+ plugins: [+ dotenvRun({+ verbose: true,+ environment: NODE_ENV,+ root: '../../.env'+ }),+ replace({+ __PACKAGE_VERSION__: '3.1.10',+ include: /constants\/src\/default-settings\.ts/+ }),+ copyPlugin({+ resolveFrom: 'cwd',+ assets: {+ from: ['index.html'],+ to: ['dist/index.html']+ }+ })+ ]+};++function openURL(url) {+ const cmd = {+ darwin: ['open'],+ linux: ['xdg-open'],+ win32: ['cmd', '/c', 'start']+ };+ const command = cmd[process.platform];+ if (command) {+ spawn(command[0], [...command.slice(1), url]);+ }+}++(async () => {+ if (args.includes('--build')) {+ const result = await esbuild+ .build({+ ...config,+ alias: thirdPartyAliases,+ minify: true,+ sourcemap: false,+ metafile: true,+ define: {+ ...config.define,+ 'process.env.NODE_ENV': '"production"'+ },+ drop: ['console', 'debugger'],+ treeShaking: true+ })+ .catch(e => {+ console.error(e);+ process.exit(1);+ });+ fs.writeFileSync('dist/esbuild-metadata.json', JSON.stringify(result.metafile));+ }++ if (args.includes('--start')) {+ await esbuild+ .context({+ ...config,+ alias: thirdPartyAliases,+ minify: false,+ sourcemap: true,+ banner: {+ js: `new EventSource('/esbuild').addEventListener('change', () => location.reload());`+ }+ })+ .then(async ctx => {+ await ctx.watch();+ await ctx.serve({+ servedir: 'dist',+ port,+ fallback: 'dist/index.html',+ onRequest: ({remoteAddress, method, path, status, timeInMS}) => {+ console.info(remoteAddress, status, `"${method} ${path}" [${timeInMS}ms]`);+ }+ });+ console.info(`kepler.gl custom-reducer example running at ${`http://localhost:${port}`}`);+ openURL(`http://localhost:${port}`);+ })+ .catch(e => {+ console.error(e);+ process.exit(1);+ });+ }+})();diff --git a/examples/custom-reducer/package.json b/examples/custom-reducer/package.jsonindex c0d7688c9..dc770c26a 100644--- a/examples/custom-reducer/package.json+++ b/examples/custom-reducer/package.json@@ -1,12 +1,13 @@{"scripts": {- "start": "webpack-dev-server --progress --hot --open",- "start-local": "webpack-dev-server --env.es6 --progress --hot --open"+ "start": "node esbuild.config.mjs --start",+ "build": "node esbuild.config.mjs --build",+ "start-local": "NODE_ENV=local node esbuild.config.mjs --start"},"dependencies": {- "@kepler.gl/actions": "^3.0.0-alpha.1",- "@kepler.gl/components": "^3.0.0-alpha.1",- "@kepler.gl/reducers": "^3.0.0-alpha.1",+ "@kepler.gl/actions": "^3.1.10",+ "@kepler.gl/components": "^3.1.10",+ "@kepler.gl/reducers": "^3.1.10","global": "^4.3.0","react": "^18.2.0","react-dom": "^18.2.0",@@ -17,21 +18,9 @@"styled-components": "6.1.8"},"devDependencies": {- "@babel/core": "^7.12.1",- "@babel/plugin-transform-class-properties": "^7.12.1",- "@babel/plugin-transform-export-namespace-from": "^7.12.1",- "@babel/plugin-transform-modules-commonjs": "^7.12.1",- "@babel/plugin-transform-optional-chaining": "^7.12.1",- "@babel/plugin-transform-runtime": "^7.12.1",- "@babel/plugin-transform-typescript": "^7.16.8",- "@babel/preset-env": "^7.12.1",- "@babel/preset-react": "^7.12.1",- "@babel/preset-typescript": "^7.16.7",- "babel-loader": "^8.0.0",- "webpack": "^4.29.0",- "webpack-cli": "^3.2.1",- "webpack-dev-middleware": "^3.5.1",- "webpack-dev-server": "^3.1.14",- "webpack-hot-middleware": "^2.24.3"+ "@dotenv-run/esbuild": "^1.5.0",+ "esbuild": "^0.25.0",+ "esbuild-plugin-copy": "^2.1.1",+ "esbuild-plugin-replace": "^1.4.0"}}diff --git a/examples/custom-reducer/src/main.js b/examples/custom-reducer/src/main.jsindex e18e32fad..3cab5a4de 100644--- a/examples/custom-reducer/src/main.js+++ b/examples/custom-reducer/src/main.js@@ -4,10 +4,13 @@import React from 'react';import ReactDOM from 'react-dom/client';import document from 'global/document';+import Modal from 'react-modal';import {Provider} from 'react-redux';import store from './store';import App from './app';+Modal.setAppElement('#root');+const Root = () => (<Provider store={store}><App />diff --git a/examples/custom-reducer/webpack.config.js b/examples/custom-reducer/webpack.config.jsdeleted file mode 100644index 9478149e7..000000000--- a/examples/custom-reducer/webpack.config.js+++ /dev/null@@ -1,53 +0,0 @@-// SPDX-License-Identifier: MIT-// Copyright contributors to the kepler.gl project--// NOTE: To use this example standalone (e.g. outside of deck.gl repo)-// delete the local development overrides at the bottom of this file--// avoid destructuring for older Node version support-const resolve = require('path').resolve;-const join = require('path').join;-const webpack = require('webpack');--const CONFIG = {- // bundle app.js and everything it imports, recursively.- entry: {- app: resolve('./src/main.js')- },- output: {- path: resolve(__dirname, 'build'),- filename: 'bundle.js',- publicPath: '/'- },-- devtool: 'source-map',-- module: {- rules: [- {- test: /\.(js|ts|tsx)$/,- loader: 'babel-loader',- include: join(__dirname, 'src'),- exclude: [/node_modules/]- },- // fix for arrow-related errors- {- test: /\.mjs$/,- include: /node_modules/,- type: 'javascript/auto'- }- ]- },-- node: {- fs: 'empty'- },-- // Optional: Enables reading mapbox token from environment variable- plugins: [new webpack.EnvironmentPlugin(['MapboxAccessToken'])]-};--// This line enables bundling against src in this repo rather than installed deck.gl module-module.exports = env => {- return env ? require('../webpack.config.local')(CONFIG, __dirname)(env) : CONFIG;-};diff --git a/examples/custom-theme/README.md b/examples/custom-theme/README.mdindex f727d0b9a..9a6acf8d0 100644--- a/examples/custom-theme/README.md+++ b/examples/custom-theme/README.md@@ -6,12 +6,6 @@ This example show how to customize Kepler.gl theme#### 1. Install-```sh-npm install-```--or-```shyarn```@@ -27,5 +21,5 @@ export MapboxAccessToken=<your_mapbox_token>#### 3. Start the app```sh-npm start+yarn start```diff --git a/examples/custom-theme/esbuild.config.mjs b/examples/custom-theme/esbuild.config.mjsnew file mode 100644index 000000000..eddbc7e6c--- /dev/null+++ b/examples/custom-theme/esbuild.config.mjs@@ -0,0 +1,132 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import esbuild from 'esbuild';+import {replace} from 'esbuild-plugin-replace';+import {dotenvRun} from '@dotenv-run/esbuild';+import copyPlugin from 'esbuild-plugin-copy';++import process from 'node:process';+import fs from 'node:fs';+import {spawn} from 'node:child_process';+import {join} from 'node:path';++const args = process.argv;++const port = 8080;++const NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'production');++// Ensure a single instance of React and friends to avoid invalid hook calls+const ROOT_NODE_MODULES = join('..', '..', 'node_modules');+const thirdPartyAliases = {+ react: join(ROOT_NODE_MODULES, 'react'),+ 'react-dom': join(ROOT_NODE_MODULES, 'react-dom'),+ 'react-redux': join(ROOT_NODE_MODULES, 'react-redux', 'lib'),+ 'styled-components': join(ROOT_NODE_MODULES, 'styled-components'),+ 'apache-arrow': join(ROOT_NODE_MODULES, 'apache-arrow')+};++const config = {+ platform: 'browser',+ format: 'iife',+ logLevel: 'info',+ loader: {+ '.js': 'jsx',+ '.css': 'css',+ '.ttf': 'file',+ '.woff': 'file',+ '.woff2': 'file'+ },+ entryPoints: ['src/main.js'],+ outfile: 'dist/bundle.js',+ bundle: true,+ define: {+ NODE_ENV,+ 'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken || '')+ },+ plugins: [+ dotenvRun({+ verbose: true,+ environment: NODE_ENV,+ root: '../../.env'+ }),+ replace({+ __PACKAGE_VERSION__: '3.1.10',+ include: /constants\/src\/default-settings\.ts/+ }),+ copyPlugin({+ resolveFrom: 'cwd',+ assets: {+ from: ['index.html'],+ to: ['dist/index.html']+ }+ })+ ]+};++function openURL(url) {+ const cmd = {+ darwin: ['open'],+ linux: ['xdg-open'],+ win32: ['cmd', '/c', 'start']+ };+ const command = cmd[process.platform];+ if (command) {+ spawn(command[0], [...command.slice(1), url]);+ }+}++(async () => {+ if (args.includes('--build')) {+ const result = await esbuild+ .build({+ ...config,+ alias: thirdPartyAliases,+ minify: true,+ sourcemap: false,+ metafile: true,+ define: {+ ...config.define,+ 'process.env.NODE_ENV': '"production"'+ },+ drop: ['console', 'debugger'],+ treeShaking: true+ })+ .catch(e => {+ console.error(e);+ process.exit(1);+ });+ fs.writeFileSync('dist/esbuild-metadata.json', JSON.stringify(result.metafile));+ }++ if (args.includes('--start')) {+ await esbuild+ .context({+ ...config,+ alias: thirdPartyAliases,+ minify: false,+ sourcemap: true,+ banner: {+ js: `new EventSource('/esbuild').addEventListener('change', () => location.reload());`+ }+ })+ .then(async ctx => {+ await ctx.watch();+ await ctx.serve({+ servedir: 'dist',+ port,+ fallback: 'dist/index.html',+ onRequest: ({remoteAddress, method, path, status, timeInMS}) => {+ console.info(remoteAddress, status, `"${method} ${path}" [${timeInMS}ms]`);+ }+ });+ console.info(`kepler.gl custom-theme example running at ${`http://localhost:${port}`}`);+ openURL(`http://localhost:${port}`);+ })+ .catch(e => {+ console.error(e);+ process.exit(1);+ });+ }+})();diff --git a/examples/custom-theme/package.json b/examples/custom-theme/package.jsonindex f184d880c..5391373b7 100644--- a/examples/custom-theme/package.json+++ b/examples/custom-theme/package.json@@ -1,11 +1,12 @@{"scripts": {- "start": "webpack-dev-server --progress --hot --open",- "start-local": "webpack-dev-server --mode development --env.es6 --progress --hot --open"+ "start": "node esbuild.config.mjs --start",+ "build": "node esbuild.config.mjs --build",+ "start-local": "NODE_ENV=local node esbuild.config.mjs --start"},"dependencies": {- "@kepler.gl/components": "^3.0.0-alpha.1",- "@kepler.gl/reducers": "^3.0.0-alpha.1",+ "@kepler.gl/components": "^3.1.10",+ "@kepler.gl/reducers": "^3.1.10","global": "^4.3.0","react": "^18.2.0","react-dom": "^18.2.0",@@ -16,21 +17,9 @@"styled-components": "6.1.8"},"devDependencies": {- "@babel/core": "^7.12.1",- "@babel/plugin-transform-class-properties": "^7.12.1",- "@babel/plugin-transform-export-namespace-from": "^7.12.1",- "@babel/plugin-transform-modules-commonjs": "^7.12.1",- "@babel/plugin-transform-optional-chaining": "^7.12.1",- "@babel/plugin-transform-runtime": "^7.12.1",- "@babel/plugin-transform-typescript": "^7.16.8",- "@babel/preset-env": "^7.12.1",- "@babel/preset-react": "^7.12.1",- "@babel/preset-typescript": "^7.16.7",- "babel-loader": "^8.0.0",- "webpack": "^4.29.0",- "webpack-cli": "^3.2.1",- "webpack-dev-middleware": "^3.5.1",- "webpack-dev-server": "^3.1.14",- "webpack-hot-middleware": "^2.24.3"+ "@dotenv-run/esbuild": "^1.5.0",+ "esbuild": "^0.25.0",+ "esbuild-plugin-copy": "^2.1.1",+ "esbuild-plugin-replace": "^1.4.0"}}diff --git a/examples/custom-theme/src/main.js b/examples/custom-theme/src/main.jsindex e18e32fad..3cab5a4de 100644--- a/examples/custom-theme/src/main.js+++ b/examples/custom-theme/src/main.js@@ -4,10 +4,13 @@import React from 'react';import ReactDOM from 'react-dom/client';import document from 'global/document';+import Modal from 'react-modal';import {Provider} from 'react-redux';import store from './store';import App from './app';+Modal.setAppElement('#root');+const Root = () => (<Provider store={store}><App />diff --git a/examples/custom-theme/webpack.config.js b/examples/custom-theme/webpack.config.jsdeleted file mode 100644index c43f6d48f..000000000--- a/examples/custom-theme/webpack.config.js+++ /dev/null@@ -1,53 +0,0 @@-// SPDX-License-Identifier: MIT-// Copyright contributors to the kepler.gl project--// NOTE: To use this example standalone (e.g. outside of deck.gl repo)-// delete the local development overrides at the bottom of this file--// avoid destructuring for older Node version support-const resolve = require('path').resolve;-const join = require('path').join;-const webpack = require('webpack');--const CONFIG = {- // bundle app.js and everything it imports, recursively.- entry: {- app: resolve('./src/main.js')- },- output: {- path: resolve(__dirname, 'build'),- filename: 'bundle.js',- publicPath: '/'- },-- devtool: 'source-map',-- module: {- rules: [- {- test: /\.(js|ts|tsx)$/,- loader: 'babel-loader',- include: join(__dirname, 'src'),- exclude: [/node_modules/]- },- // fix for arrow-related errors- {- test: /\.mjs$/,- include: /node_modules/,- type: 'javascript/auto'- }- ]- },-- node: {- fs: 'empty'- },-- // Optional: Enables reading mapbox and dropbox client token from environment variable- plugins: [new webpack.EnvironmentPlugin(['MapboxAccessToken'])]-};--// This line enables bundling against src in this repo rather than installed deck.gl module-module.exports = env => {- return env ? require('../webpack.config.local')(CONFIG, __dirname)(env) : CONFIG;-};diff --git a/examples/get-started/package.json b/examples/get-started/package.jsonindex f159bbcc8..2046cbca4 100644--- a/examples/get-started/package.json+++ b/examples/get-started/package.json@@ -8,8 +8,8 @@"start": "node esbuild.config.mjs --start"},"dependencies": {- "@kepler.gl/components": "3.1.1",- "@kepler.gl/reducers": "3.1.1",+ "@kepler.gl/components": "^3.1.10",+ "@kepler.gl/reducers": "^3.1.10","react": "^18.2.0","react-dom": "^18.2.0","react-redux": "^8.0.5",diff --git a/examples/node-app/README.md b/examples/node-app/README.mdindex 9edfb3e04..7a3d09a5c 100644--- a/examples/node-app/README.md+++ b/examples/node-app/README.md@@ -1,21 +1,15 @@# Node/Express-This example shows how to embed Kepler.gl in a node/express/webpack application.+This example shows how to embed Kepler.gl in a node/express/webpack application.#### 1. Install-```sh-npm install-```--or-```shyarn```-#### 2. Mapbox Token+add mapbox access token to node env```sh@@ -25,5 +19,5 @@ export MapboxAccessToken=<your_mapbox_token>#### 3. Start the app```sh-npm start+yarn start```diff --git a/examples/node-app/esbuild.config.mjs b/examples/node-app/esbuild.config.mjsnew file mode 100644index 000000000..0786d69f9--- /dev/null+++ b/examples/node-app/esbuild.config.mjs@@ -0,0 +1,132 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import esbuild from 'esbuild';+import {replace} from 'esbuild-plugin-replace';+import {dotenvRun} from '@dotenv-run/esbuild';+import copyPlugin from 'esbuild-plugin-copy';++import process from 'node:process';+import fs from 'node:fs';+import {spawn} from 'node:child_process';+import {join} from 'node:path';++const args = process.argv;++const port = 3000;++const NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'production');++// Ensure a single instance of React and friends to avoid invalid hook calls+const ROOT_NODE_MODULES = join('..', '..', 'node_modules');+const thirdPartyAliases = {+ react: join(ROOT_NODE_MODULES, 'react'),+ 'react-dom': join(ROOT_NODE_MODULES, 'react-dom'),+ 'react-redux': join(ROOT_NODE_MODULES, 'react-redux', 'lib'),+ 'styled-components': join(ROOT_NODE_MODULES, 'styled-components'),+ 'apache-arrow': join(ROOT_NODE_MODULES, 'apache-arrow')+};++const config = {+ platform: 'browser',+ format: 'iife',+ logLevel: 'info',+ loader: {+ '.js': 'jsx',+ '.css': 'css',+ '.ttf': 'file',+ '.woff': 'file',+ '.woff2': 'file'+ },+ entryPoints: ['src/main.js'],+ outfile: 'dist/bundle.js',+ bundle: true,+ define: {+ NODE_ENV,+ 'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken || '')+ },+ plugins: [+ dotenvRun({+ verbose: true,+ environment: NODE_ENV,+ root: '../../.env'+ }),+ replace({+ __PACKAGE_VERSION__: '3.1.10',+ include: /constants\/src\/default-settings\.ts/+ }),+ copyPlugin({+ resolveFrom: 'cwd',+ assets: {+ from: ['index.html'],+ to: ['dist/index.html']+ }+ })+ ]+};++function openURL(url) {+ const cmd = {+ darwin: ['open'],+ linux: ['xdg-open'],+ win32: ['cmd', '/c', 'start']+ };+ const command = cmd[process.platform];+ if (command) {+ spawn(command[0], [...command.slice(1), url]);+ }+}++(async () => {+ if (args.includes('--build')) {+ const result = await esbuild+ .build({+ ...config,+ alias: thirdPartyAliases,+ minify: true,+ sourcemap: false,+ metafile: true,+ define: {+ ...config.define,+ 'process.env.NODE_ENV': '"production"'+ },+ drop: ['console', 'debugger'],+ treeShaking: true+ })+ .catch(e => {+ console.error(e);+ process.exit(1);+ });+ fs.writeFileSync('dist/esbuild-metadata.json', JSON.stringify(result.metafile));+ }++ if (args.includes('--start')) {+ await esbuild+ .context({+ ...config,+ alias: thirdPartyAliases,+ minify: false,+ sourcemap: true,+ banner: {+ js: `new EventSource('/esbuild').addEventListener('change', () => location.reload());`+ }+ })+ .then(async ctx => {+ await ctx.watch();+ await ctx.serve({+ servedir: 'dist',+ port,+ fallback: 'dist/index.html',+ onRequest: ({remoteAddress, method, path, status, timeInMS}) => {+ console.info(remoteAddress, status, `"${method} ${path}" [${timeInMS}ms]`);+ }+ });+ console.info(`kepler.gl node-app example running at ${`http://localhost:${port}`}`);+ openURL(`http://localhost:${port}`);+ })+ .catch(e => {+ console.error(e);+ process.exit(1);+ });+ }+})();diff --git a/examples/node-app/package.json b/examples/node-app/package.jsonindex 9356878f5..1e9101c3d 100644--- a/examples/node-app/package.json+++ b/examples/node-app/package.json@@ -1,11 +1,12 @@{"scripts": {- "start": "NODE_OPTIONS=--openssl-legacy-provider node server.js",- "start-local": "NODE_OPTIONS=--openssl-legacy-provider WEBPACK_ENV=es6 node server.js"+ "start": "node esbuild.config.mjs --start",+ "build": "node esbuild.config.mjs --build",+ "start-local": "NODE_ENV=local node esbuild.config.mjs --start"},"dependencies": {- "@kepler.gl/components": "^3.0.0-alpha.1",- "@kepler.gl/reducers": "^3.0.0-alpha.1",+ "@kepler.gl/components": "^3.1.10",+ "@kepler.gl/reducers": "^3.1.10","express": "^4.17.1","global": "^4.3.0","react": "^18.2.0",@@ -17,21 +18,9 @@"styled-components": "6.1.8"},"devDependencies": {- "@babel/core": "^7.12.1",- "@babel/plugin-transform-class-properties": "^7.12.1",- "@babel/plugin-transform-export-namespace-from": "^7.12.1",- "@babel/plugin-transform-modules-commonjs": "^7.12.1",- "@babel/plugin-transform-optional-chaining": "^7.12.1",- "@babel/plugin-transform-runtime": "^7.12.1",- "@babel/plugin-transform-typescript": "^7.16.8",- "@babel/preset-env": "^7.12.1",- "@babel/preset-react": "^7.12.1",- "@babel/preset-typescript": "^7.16.7",- "babel-loader": "^8.0.0",- "webpack": "^4.29.0",- "webpack-cli": "^3.2.1",- "webpack-dev-middleware": "^3.7.0",- "webpack-dev-server": "^3.1.14",- "webpack-hot-middleware": "^2.25.0"+ "@dotenv-run/esbuild": "^1.5.0",+ "esbuild": "^0.25.0",+ "esbuild-plugin-copy": "^2.1.1",+ "esbuild-plugin-replace": "^1.4.0"}}diff --git a/examples/node-app/server.js b/examples/node-app/server.jsindex a57183129..e11bcc585 100644--- a/examples/node-app/server.js+++ b/examples/node-app/server.js@@ -1,57 +1,28 @@// SPDX-License-Identifier: MIT// Copyright contributors to the kepler.gl project-const path = require('path');const express = require('express');-const webpack = require('webpack');-const webpackMiddleware = require('webpack-dev-middleware');-const webpackHotMiddleware = require('webpack-hot-middleware');-const webpackENV = process.env.WEBPACK_ENV;-const config = require('./webpack.config.js')(webpackENV);+const path = require('path');-const isDeveloping = process.env.NODE_ENV !== 'production';const ADDRESS = '0.0.0.0';-const DEV_PORT = 3000;-const port = isDeveloping ? DEV_PORT : process.env.PORT;+const PORT = process.env.PORT || 3000;const app = express();-const HTML_FILE = path.join(__dirname, 'index.html');-/* eslint-disable no-console */-if (isDeveloping) {- const compiler = webpack(config);- const middleware = webpackMiddleware(compiler, {- publicPath: config.output.publicPath,- contentBase: 'src',- stats: {- colors: true,- hash: false,- timings: true,- chunks: false,- chunkModules: false,- modules: false- }- });+// Serve static files from dist+app.use(express.static(path.join(__dirname, 'dist')));- app.use(middleware);- app.use(webpackHotMiddleware(compiler));- app.get('*', function response(req, res) {- console.log('indexPath', HTML_FILE);- res.sendFile(HTML_FILE);- });-} else {- app.use(express.static(__dirname));- app.get('*', function response(req, res) {- res.sendFile(HTML_FILE);- });-}+// Always return index.html for any route (SPA)+app.get('*', function response(req, res) {+ res.sendFile(path.join(__dirname, 'dist', 'index.html'));+});-app.listen(port, ADDRESS, function onStart(err) {+/* eslint-disable no-console */+app.listen(PORT, ADDRESS, function onStart(err) {if (err) {- console.log(err);+ console.error(err);+ return;}- console.info(- `==> 🌎 Listening on port ${port}. Open up http://${ADDRESS}:${port}/ in your browser.`- );+ console.info(`==> 🌎 Listening on port ${PORT}. Open up http://${ADDRESS}:${PORT}/`);});/* eslint-enable no-console */diff --git a/examples/node-app/src/main.js b/examples/node-app/src/main.jsindex e18e32fad..3cab5a4de 100644--- a/examples/node-app/src/main.js+++ b/examples/node-app/src/main.js@@ -4,10 +4,13 @@import React from 'react';import ReactDOM from 'react-dom/client';import document from 'global/document';+import Modal from 'react-modal';import {Provider} from 'react-redux';import store from './store';import App from './app';+Modal.setAppElement('#root');+const Root = () => (<Provider store={store}><App />diff --git a/examples/node-app/webpack.config.js b/examples/node-app/webpack.config.jsdeleted file mode 100644index 04113aac9..000000000--- a/examples/node-app/webpack.config.js+++ /dev/null@@ -1,62 +0,0 @@-// SPDX-License-Identifier: MIT-// Copyright contributors to the kepler.gl project--// NOTE: To use this example standalone (e.g. outside of deck.gl repo)-// delete the local development overrides at the bottom of this file--// avoid destructuring for older Node version support-const resolve = require('path').resolve;-const join = require('path').join;-const webpack = require('webpack');--const CONFIG = {- // bundle app.js and everything it imports, recursively.- entry: {- app: resolve('./src/main.js')- },- output: {- path: resolve(__dirname, 'build'),- filename: 'bundle.js',- publicPath: '/'- },- resolve: {- extensions: ['.tsx', '.ts', '.js', '.json']- },-- devtool: 'source-map',-- module: {- rules: [- {- test: /\.(js|ts|tsx)$/,- loader: 'babel-loader',- include: join(__dirname, 'src'),- exclude: [/node_modules/]- },- {- // The example has some JSON data- test: /\.json$/,- loader: 'json-loader',- exclude: [/node_modules/]- },- {- // fix for arrow-related errors- test: /\.mjs$/,- include: /node_modules/,- type: 'javascript/auto'- }- ]- },-- node: {- fs: 'empty'- },-- // Optional: Enables reading mapbox token from environment variable- plugins: [new webpack.EnvironmentPlugin(['MapboxAccessToken'])]-};--// This line enables bundling against src in this repo rather than installed deck.gl module-module.exports = env => {- return env ? require('../webpack.config.local')(CONFIG, __dirname)(env) : CONFIG;-};diff --git a/examples/open-modal/README.md b/examples/open-modal/README.mdindex 3ed2ecfdc..10a5b42e0 100644--- a/examples/open-modal/README.md+++ b/examples/open-modal/README.md@@ -4,18 +4,12 @@ Example showing how to open kepler.gl in a modal.#### 1. Install-```sh-npm install-```--or-```shyarn```-#### 2. Mapbox Token+add mapbox access token to node env```sh@@ -25,5 +19,5 @@ export MapboxAccessToken=<your_mapbox_token>#### 3. Start the app```sh-npm start+yarn start```diff --git a/examples/open-modal/esbuild.config.mjs b/examples/open-modal/esbuild.config.mjsnew file mode 100644index 000000000..4b12db095--- /dev/null+++ b/examples/open-modal/esbuild.config.mjs@@ -0,0 +1,110 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import esbuild from 'esbuild';+import {replace} from 'esbuild-plugin-replace';+import {dotenvRun} from '@dotenv-run/esbuild';+import copyPlugin from 'esbuild-plugin-copy';++import process from 'node:process';+import fs from 'node:fs';+import {spawn} from 'node:child_process';+import {join} from 'node:path';++const args = process.argv;++const port = 8080;++const NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'production');++// Ensure a single instance of React and friends to avoid invalid hook calls+const ROOT_NODE_MODULES = join('..', '..', 'node_modules');+const thirdPartyAliases = {+ react: join(ROOT_NODE_MODULES, 'react'),+ 'react-dom': join(ROOT_NODE_MODULES, 'react-dom'),+ 'react-redux': join(ROOT_NODE_MODULES, 'react-redux', 'lib'),+ 'styled-components': join(ROOT_NODE_MODULES, 'styled-components'),+ 'apache-arrow': join(ROOT_NODE_MODULES, 'apache-arrow')+};++const config = {+ platform: 'browser',+ format: 'iife',+ logLevel: 'info',+ loader: {+ '.js': 'jsx',+ '.css': 'css',+ '.ttf': 'file',+ '.woff': 'file',+ '.woff2': 'file'+ },+ entryPoints: ['src/main.js'],+ outfile: 'dist/bundle.js',+ bundle: true,+ define: {+ NODE_ENV,+ 'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken || '')+ },+ plugins: [+ dotenvRun({+ verbose: true,+ environment: NODE_ENV,+ root: '../../.env'+ }),+ replace({+ __PACKAGE_VERSION__: '3.1.10',+ include: /constants\/src\/default-settings\.ts/+ }),+ copyPlugin({+ resolveFrom: 'cwd',+ assets: {+ from: ['index.html'],+ to: ['dist/index.html']+ }+ })+ ]+};++function openURL(url) {+ const cmd = {+ darwin: ['open'],+ linux: ['xdg-open'],+ win32: ['cmd', '/c', 'start']+ };+ const command = cmd[process.platform];+ if (command) {+ spawn(command[0], [...command.slice(1), url]);+ }+}++(async () => {+ if (args.includes('--start')) {+ await esbuild+ .context({+ ...config,+ alias: thirdPartyAliases,+ minify: false,+ sourcemap: true,+ banner: {+ js: `new EventSource('/esbuild').addEventListener('change', () => location.reload());`+ }+ })+ .then(async ctx => {+ await ctx.watch();+ await ctx.serve({+ servedir: 'dist',+ port,+ fallback: 'dist/index.html',+ onRequest: ({remoteAddress, method, path, status, timeInMS}) => {+ console.info(remoteAddress, status, `"${method} ${path}" [${timeInMS}ms]`);+ }+ });+ console.info(`kepler.gl open-modal example running at ${`http://localhost:${port}`}`);+ openURL(`http://localhost:${port}`);+ })+ .catch(e => {+ console.error(e);+ process.exit(1);+ });+ }+})();diff --git a/examples/open-modal/package.json b/examples/open-modal/package.jsonindex 1c16a766e..eaa921d2a 100644--- a/examples/open-modal/package.json+++ b/examples/open-modal/package.json@@ -1,12 +1,12 @@{"scripts": {- "start": "webpack-dev-server --progress --hot --open",- "start-local": "webpack-dev-server --env.es6 --progress --hot --open"+ "start": "node esbuild.config.mjs --start",+ "start-local": "NODE_ENV=local node esbuild.config.mjs --start"},"dependencies": {- "@kepler.gl/actions": "^3.0.0-alpha.1",- "@kepler.gl/components": "^3.0.0-alpha.1",- "@kepler.gl/reducers": "^3.0.0-alpha.1",+ "@kepler.gl/actions": "^3.1.9",+ "@kepler.gl/components": "^3.1.9",+ "@kepler.gl/reducers": "^3.1.9","global": "^4.3.0","react": "^18.2.0","react-dom": "^18.2.0",@@ -18,21 +18,9 @@"styled-components": "6.1.8"},"devDependencies": {- "@babel/core": "^7.12.1",- "@babel/plugin-transform-class-properties": "^7.12.1",- "@babel/plugin-transform-export-namespace-from": "^7.12.1",- "@babel/plugin-transform-modules-commonjs": "^7.12.1",- "@babel/plugin-transform-optional-chaining": "^7.12.1",- "@babel/plugin-transform-runtime": "^7.12.1",- "@babel/plugin-transform-typescript": "^7.16.8",- "@babel/preset-env": "^7.12.1",- "@babel/preset-react": "^7.12.1",- "@babel/preset-typescript": "^7.16.7",- "babel-loader": "^8.0.0",- "webpack": "^4.29.0",- "webpack-cli": "^3.2.1",- "webpack-dev-middleware": "^3.5.1",- "webpack-dev-server": "^3.1.14",- "webpack-hot-middleware": "^2.24.3"+ "@dotenv-run/esbuild": "^1.5.0",+ "esbuild": "^0.25.0",+ "esbuild-plugin-copy": "^2.1.1",+ "esbuild-plugin-replace": "^1.4.0"}}diff --git a/examples/open-modal/src/main.js b/examples/open-modal/src/main.jsindex e18e32fad..5477c658d 100644--- a/examples/open-modal/src/main.js+++ b/examples/open-modal/src/main.js@@ -4,10 +4,14 @@import React from 'react';import ReactDOM from 'react-dom/client';import document from 'global/document';+import Modal from 'react-modal';import {Provider} from 'react-redux';import store from './store';import App from './app';+// Ensure screen readers don't see main content when modal is open+Modal.setAppElement('#root');+const Root = () => (<Provider store={store}><App />diff --git a/examples/open-modal/webpack.config.js b/examples/open-modal/webpack.config.jsdeleted file mode 100644index 9478149e7..000000000--- a/examples/open-modal/webpack.config.js+++ /dev/null@@ -1,53 +0,0 @@-// SPDX-License-Identifier: MIT-// Copyright contributors to the kepler.gl project--// NOTE: To use this example standalone (e.g. outside of deck.gl repo)-// delete the local development overrides at the bottom of this file--// avoid destructuring for older Node version support-const resolve = require('path').resolve;-const join = require('path').join;-const webpack = require('webpack');--const CONFIG = {- // bundle app.js and everything it imports, recursively.- entry: {- app: resolve('./src/main.js')- },- output: {- path: resolve(__dirname, 'build'),- filename: 'bundle.js',- publicPath: '/'- },-- devtool: 'source-map',-- module: {- rules: [- {- test: /\.(js|ts|tsx)$/,- loader: 'babel-loader',- include: join(__dirname, 'src'),- exclude: [/node_modules/]- },- // fix for arrow-related errors- {- test: /\.mjs$/,- include: /node_modules/,- type: 'javascript/auto'- }- ]- },-- node: {- fs: 'empty'- },-- // Optional: Enables reading mapbox token from environment variable- plugins: [new webpack.EnvironmentPlugin(['MapboxAccessToken'])]-};--// This line enables bundling against src in this repo rather than installed deck.gl module-module.exports = env => {- return env ? require('../webpack.config.local')(CONFIG, __dirname)(env) : CONFIG;-};diff --git a/examples/replace-component/esbuild.config.mjs b/examples/replace-component/esbuild.config.mjsindex 4ca8c066d..8ebbf010a 100644--- a/examples/replace-component/esbuild.config.mjs+++ b/examples/replace-component/esbuild.config.mjs@@ -3,6 +3,8 @@import esbuild from 'esbuild';import {replace} from 'esbuild-plugin-replace';+import {dotenvRun} from '@dotenv-run/esbuild';+import copyPlugin from 'esbuild-plugin-copy';import process from 'node:process';import fs from 'node:fs';@@ -25,6 +27,7 @@ const EXTERNAL_LOADERS_SRC = join(LIB_DIR, 'loaders.gl');const EXTERNAL_HUBBLE_SRC = join(LIB_DIR, '../../hubble.gl');const port = 8080;+const NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'production');// add alias to serve from kepler src, resolve libraries so there is only one copy of themconst RESOLVE_LOCAL_ALIASES = {@@ -44,26 +47,45 @@ const config = {platform: 'browser',format: 'iife',logLevel: 'info',- loader: {'.js': 'jsx'},+ loader: {+ '.js': 'jsx',+ '.css': 'css',+ '.ttf': 'file',+ '.woff': 'file',+ '.woff2': 'file'+ },entryPoints: ['src/main.js'],outfile: 'dist/bundle.js',bundle: true,define: {- NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'production'),- 'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken), // eslint-disable-line- 'process.env.DropboxClientId': JSON.stringify(process.env.DropboxClientId), // eslint-disable-line- 'process.env.MapboxExportToken': JSON.stringify(process.env.MapboxExportToken), // eslint-disable-line- 'process.env.CartoClientId': JSON.stringify(process.env.CartoClientId), // eslint-disable-line- 'process.env.FoursquareClientId': JSON.stringify(process.env.FoursquareClientId), // eslint-disable-line- 'process.env.FoursquareDomain': JSON.stringify(process.env.FoursquareDomain), // eslint-disable-line- 'process.env.FoursquareAPIURL': JSON.stringify(process.env.FoursquareAPIURL), // eslint-disable-line- 'process.env.FoursquareUserMapsURL': JSON.stringify(process.env.FoursquareUserMapsURL) // eslint-disable-line+ NODE_ENV,+ 'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken || ''),+ 'process.env.DropboxClientId': JSON.stringify(process.env.DropboxClientId || ''),+ 'process.env.MapboxExportToken': JSON.stringify(process.env.MapboxExportToken || ''),+ 'process.env.CartoClientId': JSON.stringify(process.env.CartoClientId || ''),+ 'process.env.FoursquareClientId': JSON.stringify(process.env.FoursquareClientId || ''),+ 'process.env.FoursquareDomain': JSON.stringify(process.env.FoursquareDomain || ''),+ 'process.env.FoursquareAPIURL': JSON.stringify(process.env.FoursquareAPIURL || ''),+ 'process.env.FoursquareUserMapsURL': JSON.stringify(process.env.FoursquareUserMapsURL || ''),+ 'process.env.NODE_DEBUG': JSON.stringify(false)},plugins: [+ dotenvRun({+ verbose: true,+ environment: NODE_ENV,+ root: '../../.env'+ }),// automatically injected kepler.gl package version into the bundlereplace({__PACKAGE_VERSION__: KeplerPackage.version,include: /constants\/src\/default-settings\.ts/+ }),+ copyPlugin({+ resolveFrom: 'cwd',+ assets: {+ from: ['index.html'],+ to: ['dist/index.html']+ }})]};@@ -179,9 +201,14 @@ function openURL(url) {await esbuild.build({...config,-minify: true,- sourcemap: false+ sourcemap: false,+ define: {+ ...config.define,+ 'process.env.NODE_ENV': '"production"'+ },+ drop: ['console', 'debugger'],+ treeShaking: true}).catch(e => {console.error(e);@@ -196,7 +223,8 @@ function openURL(url) {minify: false,sourcemap: true,// add alias to resolve libraries so there is only one copy of them- ...(process.env.NODE_ENV === 'local' ? {alias: localAliases} : {}),+ // always alias to avoid duplicate Reacts+ alias: localAliases,banner: {js: `new EventSource('/esbuild').addEventListener('change', () => location.reload());`}diff --git a/examples/replace-component/index.html b/examples/replace-component/index.htmlnew file mode 100644index 000000000..4cf003570--- /dev/null+++ b/examples/replace-component/index.html@@ -0,0 +1,24 @@+<!DOCTYPE html>+<html>+ <head>+ <meta charset="UTF-8" />+ <title>kepler.gl demo</title>+ <link+ rel="stylesheet"+ href="//d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css"+ />+ <link href="//api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css" rel="stylesheet" />+ <link href="https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css" rel="stylesheet" />+ <style type="text/css">+ body {+ margin: 0;+ padding: 0;+ overflow: hidden;+ }+ </style>+ </head>+ <body>+ <div id="root"></div>+ <script src="bundle.js"></script>+ </body>+</html>diff --git a/examples/replace-component/package.json b/examples/replace-component/package.jsonindex d59832799..1e8a17c95 100644--- a/examples/replace-component/package.json+++ b/examples/replace-component/package.json@@ -1,15 +1,16 @@{"scripts": {"start": "node esbuild.config.mjs --start",+ "build": "node esbuild.config.mjs --build","start:local": "NODE_ENV=local node esbuild.config.mjs --start"},"dependencies": {- "@kepler.gl/actions": "^3.0.0-alpha.1",- "@kepler.gl/components": "^3.0.0-alpha.1",- "@kepler.gl/reducers": "^3.0.0-alpha.1",- "@kepler.gl/schemas": "^3.0.0-alpha.1",- "@kepler.gl/styles": "^3.0.0-alpha.1",- "esbuild": "^0.23.1",+ "@kepler.gl/actions": "^3.1.9",+ "@kepler.gl/components": "^3.1.9",+ "@kepler.gl/reducers": "^3.1.9",+ "@kepler.gl/schemas": "^3.1.9",+ "@kepler.gl/styles": "^3.1.9",+ "esbuild": "^0.25.0","global": "^4.3.0","react": "^18.2.0","react-dom": "^18.2.0",@@ -20,6 +21,8 @@"styled-components": "6.1.8"},"devDependencies": {+ "@dotenv-run/esbuild": "^1.5.0",+ "esbuild-plugin-copy": "^2.1.1","esbuild-plugin-replace": "^1.4.0"},"engines": {diff --git a/examples/replace-component/src/components/custom-panel.js b/examples/replace-component/src/components/custom-panel.jsindex ca54a9ea2..d7739fb21 100644--- a/examples/replace-component/src/components/custom-panel.js+++ b/examples/replace-component/src/components/custom-panel.js@@ -9,7 +9,7 @@ function CustomSidePanelsFactory() {{id: 'rocket',label: 'Rocket',- iconComponent: Icons.Rocket+ iconComponent: Icons.Globe},{id: 'chart',diff --git a/examples/replace-component/src/main.js b/examples/replace-component/src/main.jsindex e18e32fad..3cab5a4de 100644--- a/examples/replace-component/src/main.js+++ b/examples/replace-component/src/main.js@@ -4,10 +4,13 @@import React from 'react';import ReactDOM from 'react-dom/client';import document from 'global/document';+import Modal from 'react-modal';import {Provider} from 'react-redux';import store from './store';import App from './app';+Modal.setAppElement('#root');+const Root = () => (<Provider store={store}><App />diff --git a/examples/umd-client/index.html b/examples/umd-client/index.htmlindex a6bee8989..0c4637bd4 100644--- a/examples/umd-client/index.html+++ b/examples/umd-client/index.html@@ -28,7 +28,7 @@></script><!-- Load Kepler.gl-->- <script src="https://unpkg.com/[email protected]/umd/keplergl.min.js"></script>+ <script src="https://unpkg.com/[email protected]/umd/keplergl.min.js"></script><!--If you want to load the build from filepath --><!--<script src="../../umd/keplergl.min.js"></script>-->