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

Switch to esbuild for faster builds and also to allow using more modern JavaScript syntax and features #6909

Merged
merged 112 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 104 commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
24876d8
esbuild first cut
alexcjohnson Feb 2, 2024
8d6d9ee
put output name back to plotly.js
alexcjohnson Feb 2, 2024
fd7e445
update package-lock diff
archmoj Feb 14, 2024
59af538
uninstall webpack
archmoj Feb 14, 2024
9481fe5
uninstall webpack-cli
archmoj Feb 14, 2024
b70ad83
uninstall node-polyfill-webpack-plugin
archmoj Feb 14, 2024
ab7abd5
uninstall karma-webpack
archmoj Feb 14, 2024
63d3de8
drop webpack from devtools/test_dashboard/server.mjs
archmoj Feb 14, 2024
55c03d8
remove webpack.config.js
archmoj Feb 14, 2024
2b8d93a
install buffer
archmoj Feb 14, 2024
cf5633e
install assert
archmoj Feb 14, 2024
ca525fd
rename devtools/regl_codegen/server from js to mjs
archmoj Feb 14, 2024
390b0f1
remove unused purgeGeneratedCode function
archmoj Feb 14, 2024
2a04743
replace esbuild with webpack in devtools/regl_codegen/server
archmoj Feb 14, 2024
0d6fd10
rename tasks/bundle.js to tasks/bundle.mjs
archmoj Feb 16, 2024
abc4532
es6 imports in tasks/bundle.mjs
archmoj Feb 16, 2024
687276a
bundle_wrapper.js > bundle_wrapper.mjs
archmoj Feb 16, 2024
5701b7e
rename cibundle.js & partial_bundle.js to .mjs
archmoj Feb 16, 2024
34f564e
es6 import _bundle function
archmoj Feb 16, 2024
80f0547
replace webpack with esbuild in bundle_wrapper
archmoj Feb 16, 2024
ea7b866
use esbuild to make bundles
archmoj Feb 16, 2024
ad00767
rewrite custom_bundle and extra_bundles in es6
archmoj Feb 16, 2024
c2c21d9
js > mjs
archmoj Feb 16, 2024
1ebbfad
adjust export in partial_bundle.mjs
archmoj Feb 16, 2024
a6d1437
do not provide sourcemap for now
archmoj Feb 16, 2024
bf75f64
fix bundle_wrapper
archmoj Feb 16, 2024
1ccaec5
skip no-new-func test for now
archmoj Feb 16, 2024
867ba0d
delete node12 tests
archmoj Feb 16, 2024
e2b52c6
set minimum node16 in package.json
archmoj Feb 16, 2024
d529e2a
update package-lock for node 16 minimum
archmoj Feb 16, 2024
885438f
install esbuild-plugin-browserify-adapter
archmoj Feb 16, 2024
32aa650
compress attributes
archmoj Feb 16, 2024
6825cd3
add noCompress true to geo assets
archmoj Feb 16, 2024
785c131
tasks/schema.js -> tasks/schema.mjs
archmoj Feb 16, 2024
80763d9
use es6 in tasks/schema.mjs
archmoj Feb 16, 2024
6916369
tasks/util/plotly_node.js > tasks/util/plotly_node.mjs
archmoj Feb 16, 2024
d14cd90
use es6 in tasks/util/plotly_node.mjs
archmoj Feb 16, 2024
9762041
use es6 in tasks/test_plain_obj.js
archmoj Feb 16, 2024
ae00d3c
tasks/test_plain_obj.js > tasks/test_plain_obj.mjs
archmoj Feb 16, 2024
f0baa3e
tasks/test_requirejs.js > tasks/test_requirejs.mjs
archmoj Feb 16, 2024
7177040
use es6 in tasks/test_requirejs.mjs
archmoj Feb 16, 2024
6488c80
use plotly_node.mjs in tasks/schema.mjs
archmoj Feb 16, 2024
b8468cc
use es6 in tasks/test_mock.js
archmoj Feb 16, 2024
39fd544
tasks/test_mock.js > tasks/test_mock.mjs
archmoj Feb 16, 2024
c75eeb5
fix bundle to generate both minified & unmininified
archmoj Feb 20, 2024
523359a
fix bundle_wrapper to not clear plugins
archmoj Feb 21, 2024
0c935b1
install esbuild-plugin-babel
archmoj Feb 20, 2024
e96dc01
use esbuild-plugin-babel in esbuild-config
archmoj Feb 20, 2024
b8fc583
fx-config
archmoj Feb 21, 2024
f400d1c
no plugins to bundle geo assests
archmoj Feb 21, 2024
cd0c603
improve name of _bundle option
archmoj Feb 21, 2024
5ba702d
fix empty plugins
archmoj Feb 21, 2024
4b50e9a
fix esbuild config setup
archmoj Feb 21, 2024
05b3940
adjust esbuild config
archmoj Feb 21, 2024
4bf46a2
skip requirejs and amdefine tests for now
archmoj Feb 27, 2024
faaff88
drop babel step
archmoj Feb 27, 2024
70f6ef0
fix disabling attribute meta compression
archmoj Feb 27, 2024
7e69158
fix __dirname in test_mock
archmoj Feb 27, 2024
8498c54
install karma-esbuild
archmoj Feb 27, 2024
13c9a5e
use esbuild with karma and jasmine
archmoj Feb 27, 2024
7ab0faf
drop babel
archmoj Feb 28, 2024
dc0dcbe
drop amdefine test
archmoj Feb 28, 2024
204a20d
simplify minified_bundle case
archmoj Feb 28, 2024
6004bd5
clear IE option in karma config
archmoj Feb 28, 2024
1aa9dba
fx
archmoj Feb 28, 2024
4e49206
reduce parallelism for jasmine tests
archmoj Feb 28, 2024
0d3d915
Merge branch 'master' into build-with-esbuild
archmoj Mar 7, 2024
d74aee5
bring back amdefine test
archmoj Mar 8, 2024
0561f4c
drop babel deps
archmoj Mar 8, 2024
5795d71
install esbuild-plugin-umd-wrapper
archmoj Mar 8, 2024
e83406b
add umd wrapper
archmoj Mar 8, 2024
c699c40
revise adjusting plugins
archmoj Mar 11, 2024
3903e1e
fix bundle wrapper
archmoj Mar 11, 2024
01db669
fix second bundles
archmoj Mar 11, 2024
96a5e7e
revise bundles
archmoj Mar 11, 2024
1c10191
Merge remote-tracking branch 'origin/master' into build-with-esbuild
archmoj Mar 20, 2024
8ec3eaf
Merge remote-tracking branch 'origin/master' into build-with-esbuild
archmoj May 8, 2024
776c0ac
Merge remote-tracking branch 'origin/master' into build-with-esbuild
archmoj May 16, 2024
bbbfb4a
Merge remote-tracking branch 'origin/master' into build-with-esbuild
archmoj May 24, 2024
e10ab24
inline d3.round in drawing/symbol_defs.js
archmoj May 29, 2024
003383f
Merge remote-tracking branch 'origin/master' into build-with-esbuild
archmoj Aug 20, 2024
81d103d
update package-lock
archmoj Aug 20, 2024
8ba1116
convert map/styles/arcgis from json to js - fix esbuild
archmoj Aug 20, 2024
5d326d8
Merge branch 'master' into build-with-esbuild_dev
archmoj Aug 20, 2024
4909b42
amdWrapper
birkskyum Aug 20, 2024
76fe186
note meta
birkskyum Aug 20, 2024
d1a806a
Merge pull request #7122 from birkskyum/add-amdWrapper
archmoj Aug 21, 2024
acff993
add UMD wrapper in bundle_wrapper
archmoj Aug 21, 2024
d7fd65c
Revert "inline d3.round in drawing/symbol_defs.js"
archmoj Aug 21, 2024
935be96
Revert "Revert "inline d3.round in drawing/symbol_defs.js""
archmoj Aug 21, 2024
9f0267b
uninstall unused assert
archmoj Aug 21, 2024
8457dd5
Revert "uninstall unused assert"
archmoj Aug 21, 2024
a4778cd
Use esbuild 23.1
birkskyum Aug 21, 2024
c148acf
fix lock
birkskyum Aug 21, 2024
38d6cd4
draftlog
birkskyum Aug 21, 2024
0c724cf
Merge pull request #7124 from birkskyum/esbuild-23
archmoj Aug 21, 2024
9e4d9d4
fix regl_codegen
birkskyum Aug 21, 2024
dca267a
launch server after files are generated
birkskyum Aug 21, 2024
ab8d688
do not add Plotly to window in case of AMD
archmoj Aug 21, 2024
e0faf1d
Merge pull request #7125 from birkskyum/fix-regl-codegen
archmoj Aug 22, 2024
108b6f7
Merge remote-tracking branch 'origin/master' into build-with-esbuild
archmoj Aug 22, 2024
d0dd957
fix import path in custom bundle script
archmoj Aug 22, 2024
46723a8
adjust custom bundle script - fast creation of both minified and unmi…
archmoj Aug 22, 2024
c2776aa
correct node 18 version in package files
archmoj Aug 22, 2024
8bb92f8
bring back unminified arg for custom bundles
archmoj Aug 22, 2024
04ce6ee
draft log
archmoj Aug 23, 2024
48ed832
revert changes to CUSTOM_BUNDLE.md
archmoj Aug 23, 2024
b7189bd
Add .css loader to esbuild
birkskyum Sep 6, 2024
6275c72
trailing comma
birkskyum Sep 6, 2024
3328875
Merge pull request #7142 from birkskyum/add-style-plugin
archmoj Sep 7, 2024
53f896c
Merge remote-tracking branch 'origin/master' into build-with-esbuild
archmoj Sep 7, 2024
1b48536
Merge remote-tracking branch 'origin/master' into build-with-esbuild
archmoj Sep 11, 2024
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: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
environment:
# Alaska time (arbitrary timezone to test date logic)
TZ: "America/Anchorage"
parallelism: 12
parallelism: 4
archmoj marked this conversation as resolved.
Show resolved Hide resolved
working_directory: ~/plotly.js
steps:
- run: sudo apt-get update
Expand Down
12 changes: 3 additions & 9 deletions CUSTOM_BUNDLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,20 @@ npm run custom-bundle -- --traces scatter,scattergl --strict
```

Use the `out` option to change the bundle filename (default `custom`).
The new bundle will be created in the `dist/` directory and named `plotly-<out>.min.js` or `plotly-<out>.js` if unminified.
The new bundle will be created in the `dist/` directory and named `plotly-<out>.js` and `plotly-<out>.min.js` for minified.
```sh
npm run custom-bundle -- --out myBundleName
```

Use the `unminified` option to disable compression.
```sh
npm run custom-bundle -- --unminified
```

# Example illustrating use of different options together
To create an unminified custom bundle named `myScatters` including `scatter`, `scattergl` and `scatter3d` traces without any transforms:
To create a custom bundle named `myScatters` including `scatter`, `scattergl` and `scatter3d` traces without any transforms:
```sh
npm run custom-bundle -- \
--unminified \
--out myScatters \
--traces scatter,scattergl,scatter3d \
--transforms none
```
Or simply on one line:
```sh
npm run custom-bundle -- --unminified --out myScatters --traces scatter,scattergl,scatter3d --transforms none
npm run custom-bundle -- --out myScatters --traces scatter,scattergl,scatter3d --transforms none
archmoj marked this conversation as resolved.
Show resolved Hide resolved
```
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
var fs = require('fs');
var path = require('path');
var http = require('http');
var ecstatic = require('ecstatic');
var open = require('open');
var webpack = require('webpack');
var minimist = require('minimist');

var constants = require('../../tasks/util/constants');
var config = require('../../webpack.config.js');
config.optimization = { minimize: false };
import fs from 'fs';
import path from 'path';
import http from 'http';
import ecstatic from 'ecstatic';
import open from 'open';
import minimist from 'minimist';

import constants from '../../tasks/util/constants.js';
import { build } from 'esbuild';
import config from '../../esbuild-config.js';

var args = minimist(process.argv.slice(2), {});
var PORT = args.port || 3000;
Expand All @@ -21,6 +20,8 @@ var reglTraceList = [
'splom'
];



// Create server
var _static = ecstatic({
root: constants.pathToRoot,
Expand Down Expand Up @@ -57,55 +58,25 @@ var server = http.createServer(function(req, res) {
}
});


// Start the server up!
server.listen(PORT);

// open up browser window
open('http://localhost:' + PORT + '/devtools/regl_codegen/index' + (strict ? '-strict' : '') + '.html');

// Build and bundle all the things!
getMockFiles()
await getMockFiles()
.then(readFiles)
.then(createMocksList)
.then(saveMockListToFile)
.then(saveReglTracesToFile.bind(null, reglTraceList));

// Devtools config
var devtoolsConfig = {};

var devtoolsPath = path.join(constants.pathToRoot, 'devtools/regl_codegen');
devtoolsConfig.entry = path.join(devtoolsPath, 'devtools.js');

devtoolsConfig.output = {
path: config.output.path,
filename: 'regl_codegen-bundle.js',
library: {
name: 'Tabs',
type: 'umd'
}
};

devtoolsConfig.target = config.target;
devtoolsConfig.plugins = config.plugins;
devtoolsConfig.optimization = config.optimization;
devtoolsConfig.mode = 'production';

var compiler;

compiler = webpack(devtoolsConfig);
compiler.run(function(devtoolsErr, devtoolsStats) {
if(devtoolsErr) {
console.log('err:', devtoolsErr);
} else if(devtoolsStats.errors && devtoolsStats.errors.length) {
console.log('stats.errors:', devtoolsStats.errors);
} else {
console.log('success:', devtoolsConfig.output.path + '/' + devtoolsConfig.output.filename);
// Start the server up!
server.listen(PORT);

purgeGeneratedCode(reglTraceList);
}
});
// open up browser window
open('http://localhost:' + PORT + '/devtools/regl_codegen/index' + (strict ? '-strict' : '') + '.html');

var devtoolsPath = path.join(constants.pathToRoot, 'devtools/regl_codegen');
config.entryPoints = [path.join(devtoolsPath, 'devtools.js')];
config.outfile = './build/regl_codegen-bundle.js';
config.sourcemap = false;
config.minify = false;
await build(config);

function getMockFiles() {
return new Promise(function(resolve, reject) {
Expand Down Expand Up @@ -240,18 +211,3 @@ function handleCodegen(data) {
var precompiled = header + imports + exports;
fs.writeFileSync(pathToReglPrecompiledSrc, precompiled);
}


function purgeGeneratedCode(traces) {
var pathToReglCodegenSrc = constants.pathToReglCodegenSrc;

var files = fs.readdirSync(pathToReglCodegenSrc);
files.forEach(function(file) {
fs.unlinkSync(path.join(pathToReglCodegenSrc, file));
});

traces.forEach(function(trace) {
var pathToReglPrecompiledSrc = path.join(constants.pathToSrc, 'traces', trace, 'regl_precompiled.js');
fs.writeFileSync(pathToReglPrecompiledSrc, 'module.exports = {};\n');
});
}
2 changes: 1 addition & 1 deletion devtools/test_dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div id="snapshot"></div>

<script src="../../node_modules/mathjax-v2/MathJax.js?config=TeX-AMS-MML_SVG"></script>
<script charset="utf-8" id="source" src="../../build/plotly.js" type="module"></script>
<script charset="utf-8" id="source" src="../../build/plotly.js"></script>
<script charset="utf-8" src="../../build/test_dashboard-bundle.js"></script>
</body>
</html>
190 changes: 0 additions & 190 deletions devtools/test_dashboard/server.js

This file was deleted.

Loading