Skip to content
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
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,9 @@ making changes that affect the usage of regl shaders, you would need to run
npm run regl-codegen
```

to regenerate the regl code. This opens a browser window, runs through all
traces with 'regl' in the tags, and stores the captured code into
[src/generated/regl-codegen](https://github.com/plotly/plotly.js/blob/master/src/generated/regl-codegen). If no updates are necessary, it would be a no-op, but
if there are changes, you would need to commit them.
to regenerate the regl code. This will prompt you to open a browser window. This will then run through all
traces with 'regl' in the tags, and store the captured code into
[src/generated/regl-codegen](https://github.com/plotly/plotly.js/blob/master/src/generated/regl-codegen). If no updates are necessary, it will be a no-op, but if there are changes, you will need to commit them.

This is needed because regl performs codegen in runtime which breaks CSP
compliance, and so for strict builds we pre-generate regl shader code here.
Expand Down
11 changes: 8 additions & 3 deletions devtools/regl_codegen/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<!DOCTYPE html>
<html>

<head>
<title>REGL Codegen</title>
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Droid+Sans|PT+Sans+Narrow|Gravitas+One|Droid+Sans+Mono|Droid+Serif|Raleway|Old+Standard+TT"/>
<title>Plotly.js Devtools- REGL Codegen</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css"
href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Droid+Sans|PT+Sans+Narrow|Gravitas+One|Droid+Sans+Mono|Droid+Serif|Raleway|Old+Standard+TT" />
<link rel="stylesheet" type="text/css" href="../test_dashboard/style.css">
</head>

<body>
<section id="mocks-list"></section>
<div id="plots">
Expand All @@ -13,7 +17,8 @@
<div id="snapshot"></div>

<script src="../../node_modules/mathjax/MathJax.js?config=TeX-AMS-MML_SVG"></script>
<script charset="utf-8" id="source" type="module">import "../../build/plotly.js"</script>
<script charset="utf-8" id="source" src="../../build/plotly.js"></script>
<script charset="utf-8" src="../../build/regl_codegen-bundle.js"></script>
</body>

</html>
7 changes: 4 additions & 3 deletions devtools/regl_codegen/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { build } from 'esbuild';
import fs from 'fs';
import http from 'http';
import minimist from 'minimist';
import open from 'open';
import path from 'path';
import { localDevReglCodegenConfig as config } from '../../esbuild-config.js';
import constants from '../../tasks/util/constants.js';
Expand All @@ -17,7 +16,6 @@ import {

var args = minimist(process.argv.slice(2), {});
var PORT = args.port || 3000;
var strict = args.strict;

var reglTraceList = ['parcoords', 'scattergl', 'scatterpolargl', 'splom'];

Expand Down Expand Up @@ -68,7 +66,10 @@ await getMockFiles()
server.listen(PORT);

// open up browser window
open('http://localhost:' + PORT + '/devtools/regl_codegen/index' + (strict ? '-strict' : '') + '.html');
const serverUrl = `http://localhost:${PORT}/devtools/regl_codegen/index.html`;
console.log('\x1b[31mOpen the following link to launch a browser window and precompile the regl shaders.');
console.log('This can be processor and memory intensive.\x1b[0m\n');
console.log(` \x1b[1m\x1b[32m➜\x1b[0m \x1b[1mLocal:\x1b[0m \x1b[1m\x1b[36m${serverUrl}\x1b[0m\n`);

await build(config);

Expand Down
8 changes: 6 additions & 2 deletions devtools/test_dashboard/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<!DOCTYPE html>
<html>

<head>
<title>Plotly.js Devtools</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Droid+Sans|PT+Sans+Narrow|Gravitas+One|Droid+Sans+Mono|Droid+Serif|Raleway|Old+Standard+TT"/>
<link rel="stylesheet" type="text/css"
href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Droid+Sans|PT+Sans+Narrow|Gravitas+One|Droid+Sans+Mono|Droid+Serif|Raleway|Old+Standard+TT" />
<link rel="stylesheet" type="text/css" href="./style.css">
</head>

<body>
<header>
<img src="http://images.plot.ly/logo/plotlyjs-logo@2x.png" onClick="Tabs.reload();" />
Expand All @@ -23,9 +26,10 @@

<!-- Update UI elements if strict mode is enabled -->
<script src="./strict.js"></script>

<script src="../../node_modules/@plotly/mathjax-v2/MathJax.js?config=TeX-AMS-MML_SVG"></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>
4 changes: 2 additions & 2 deletions devtools/test_dashboard/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import ecstatic from 'ecstatic';
import { build, context } from 'esbuild';
import http from 'http';
import minimist from 'minimist';
import open from 'open';
import { devtoolsConfig, localDevConfig } from '../../esbuild-config.js';
import constants from '../../tasks/util/constants.js';
import { createMocksList, getMockFiles, readFiles, saveMockListToFile } from '../dashboard_utilities.mjs';
Expand Down Expand Up @@ -64,5 +63,6 @@ function devServer() {
indexName += '.html';

// open up browser window
open(`http://localhost:${PORT}/devtools/test_dashboard/${indexName}${strict ? '?strict=true' : ''}`);
const serverUrl = `http://localhost:${PORT}/devtools/test_dashboard/${indexName}${strict ? '?strict=true' : ''}`;
console.log(` \x1b[1m\x1b[32m➜\x1b[0m \x1b[1mLocal:\x1b[0m \x1b[1m\x1b[36m${serverUrl}\x1b[0m\n`);
}
6 changes: 2 additions & 4 deletions esbuild-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ const localDevConfig = {

// Config used when building bundle to serve regl
const localDevReglCodegenConfig = {
...esbuildConfig,
...devtoolsConfig,
entryPoints: [path.join(constants.pathToRoot, 'devtools/regl_codegen', 'devtools.js')],
outfile: './build/regl_codegen-bundle.js',
sourcemap: false,
minify: false
outfile: './build/regl_codegen-bundle.js'
};

module.exports = {
Expand Down
27 changes: 0 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
"madge": "^8.0.0",
"minify-stream": "^2.1.0",
"npm-link-check": "^5.0.1",
"open": "^8.4.2",
"pixelmatch": "^7.1.0",
"prepend-file": "^2.0.1",
"prettysize": "^2.0.0",
Expand Down
Loading