diff --git a/wasm/README.md b/wasm/README.md index cd4c65d16..883424900 100644 --- a/wasm/README.md +++ b/wasm/README.md @@ -49,8 +49,8 @@ print(js_vars['a'] * 9) `, { vars: { - a: 9 - } + a: 9, + }, } ); ``` diff --git a/wasm/demo/src/index.js b/wasm/demo/src/index.js index 150fab739..cc604b1d4 100644 --- a/wasm/demo/src/index.js +++ b/wasm/demo/src/index.js @@ -11,13 +11,13 @@ let rp; // A dependency graph that contains any wasm must be imported asynchronously. import('rustpython') - .then(rustpy => { + .then((rustpy) => { rp = rustpy; // so people can play around with it window.rp = rustpy; onReady(); }) - .catch(e => { + .catch((e) => { console.error('Error importing `rustpython`:', e); document.getElementById('error').textContent = e; }); @@ -29,15 +29,15 @@ const editor = CodeMirror.fromTextArea(document.getElementById('code'), { 'Shift-Tab': 'indentLess', 'Ctrl-/': 'toggleComment', 'Cmd-/': 'toggleComment', - Tab: editor => { + Tab: (editor) => { var spaces = Array(editor.getOption('indentUnit') + 1).join(' '); editor.replaceSelection(spaces); - } + }, }, lineNumbers: true, mode: 'text/x-python', indentUnit: 4, - autofocus: true + autofocus: true, }); const consoleElement = document.getElementById('console'); @@ -51,7 +51,7 @@ function runCodeFromTextarea() { const code = editor.getValue(); try { rp.pyExec(code, { - stdout: output => { + stdout: (output) => { const shouldScroll = consoleElement.scrollHeight - consoleElement.scrollTop === consoleElement.clientHeight; @@ -59,7 +59,7 @@ function runCodeFromTextarea() { if (shouldScroll) { consoleElement.scrollTop = consoleElement.scrollHeight; } - } + }, }); } catch (err) { if (err instanceof WebAssembly.RuntimeError) { @@ -79,7 +79,7 @@ function updateSnippet() { // dynamically. // https://webpack.js.org/guides/dependency-management/ const { - default: snippet + default: snippet, } = require(`raw-loader!../snippets/${selected}.py`); editor.setValue(snippet); @@ -148,8 +148,8 @@ function onReady() { runCodeFromTextarea(); terminalVM = rp.vmStore.init('term_vm'); - terminalVM.setStdout(data => localEcho.print(data)); - readPrompts().catch(err => console.error(err)); + terminalVM.setStdout((data) => localEcho.print(data)); + readPrompts().catch((err) => console.error(err)); // so that the test knows that we're ready const readyElement = document.createElement('div'); diff --git a/wasm/demo/webpack.config.js b/wasm/demo/webpack.config.js index 05c9c5999..c431056a7 100644 --- a/wasm/demo/webpack.config.js +++ b/wasm/demo/webpack.config.js @@ -11,7 +11,7 @@ module.exports = (env = {}) => { entry: './src/index.js', output: { path: path.join(__dirname, 'dist'), - filename: 'index.js' + filename: 'index.js', }, mode: 'development', resolve: { @@ -19,16 +19,16 @@ module.exports = (env = {}) => { rustpython: path.resolve( __dirname, env.rustpythonPkg || '../lib/pkg' - ) - } + ), + }, }, module: { rules: [ { test: /\.css$/, - use: [MiniCssExtractPlugin.loader, 'css-loader'] - } - ] + use: [MiniCssExtractPlugin.loader, 'css-loader'], + }, + ], }, plugins: [ new CleanWebpackPlugin(), @@ -38,24 +38,24 @@ module.exports = (env = {}) => { templateParameters: { snippets: fs .readdirSync(path.join(__dirname, 'snippets')) - .map(filename => + .map((filename) => path.basename(filename, path.extname(filename)) ), defaultSnippetName: 'fibonacci', defaultSnippet: fs.readFileSync( path.join(__dirname, 'snippets/fibonacci.py') - ) - } + ), + }, }), new MiniCssExtractPlugin({ - filename: 'styles.css' + filename: 'styles.css', }), - ] + ], }; if (!env.noWasmPack) { config.plugins.push( new WasmPackPlugin({ - crateDirectory: path.join(__dirname, '../lib') + crateDirectory: path.join(__dirname, '../lib'), }) ); } diff --git a/wasm/example/src/index.js b/wasm/example/src/index.js index 6480aaf3e..68587d357 100644 --- a/wasm/example/src/index.js +++ b/wasm/example/src/index.js @@ -1,6 +1,6 @@ // A dependency graph that contains any wasm must all be imported // asynchronously. This `index.js` file does the single async import, so // that no one else needs to worry about it again. -import('./main.js').catch(e => { +import('./main.js').catch((e) => { console.error('Error importing `main.js`:', e); }); diff --git a/wasm/example/webpack.config.js b/wasm/example/webpack.config.js index 9a6f41e9e..4445c5acd 100644 --- a/wasm/example/webpack.config.js +++ b/wasm/example/webpack.config.js @@ -6,7 +6,7 @@ module.exports = { output: { path: path.join(__dirname, 'dist'), filename: 'app.js', - publicPath: '/dist/' + publicPath: '/dist/', }, - devtool: 'cheap-module-eval-source-map' + devtool: 'cheap-module-eval-source-map', }; diff --git a/wasm/notebook/snippets/python-js-css/css.css b/wasm/notebook/snippets/python-js-css/css.css index f35456128..dec37b8c9 100644 --- a/wasm/notebook/snippets/python-js-css/css.css +++ b/wasm/notebook/snippets/python-js-css/css.css @@ -6,14 +6,19 @@ h1 { font-family: 'Sen', 'sans-serif'; } -h2, h3, h4, button { +h2, +h3, +h4, +button { font-family: 'Turret Road', cursive; } h1 { font-size: 1.5rem; } -h2, h3, h4 { +h2, +h3, +h4 { padding-top: 1.25rem; } diff --git a/wasm/notebook/src/style.css b/wasm/notebook/src/style.css index ad1a9f73e..fc1700efd 100644 --- a/wasm/notebook/src/style.css +++ b/wasm/notebook/src/style.css @@ -140,7 +140,8 @@ ul.list-inline li { height: calc(90vh - 60px); } -.CodeMirror, .CodeMirror-wrap { +.CodeMirror, +.CodeMirror-wrap { height: 100% !important; } #rp-notebook { @@ -248,7 +249,6 @@ input[type='url'] { .md-flex-grow { flex-grow: 1; } - } @media screen and (max-width: 768px) { diff --git a/wasm/notebook/webpack.config.js b/wasm/notebook/webpack.config.js index f07239faf..e6e1aae0d 100644 --- a/wasm/notebook/webpack.config.js +++ b/wasm/notebook/webpack.config.js @@ -11,7 +11,7 @@ module.exports = (env = {}) => { entry: './src/index.js', output: { path: path.join(__dirname, 'dist'), - filename: 'index.js' + filename: 'index.js', }, mode: 'development', resolve: { @@ -19,23 +19,23 @@ module.exports = (env = {}) => { rustpython: path.resolve( __dirname, env.rustpythonPkg || '../lib/pkg' - ) - } + ), + }, }, module: { rules: [ { test: /\.css$/, - use: [MiniCssExtractPlugin.loader, 'css-loader'] + use: [MiniCssExtractPlugin.loader, 'css-loader'], }, { test: /\.(woff(2)?|ttf)$/, use: { - loader:"file-loader", - options: { name: "fonts/[name].[ext]" } + loader: 'file-loader', + options: { name: 'fonts/[name].[ext]' }, }, - } - ] + }, + ], }, plugins: [ new CleanWebpackPlugin(), @@ -55,15 +55,15 @@ module.exports = (env = {}) => { // } }), new MiniCssExtractPlugin({ - filename: 'styles.css' + filename: 'styles.css', }), - ] + ], }; if (!env.noWasmPack) { config.plugins.push( new WasmPackPlugin({ crateDirectory: path.join(__dirname, '../lib'), - forceMode: 'release' + forceMode: 'release', }) ); }