mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Format wasm/ according to prettier rules
This commit is contained in:
8 files changed
+47
-42
No files matched your search
+2
-2
@@ -49,8 +49,8 @@ print(js_vars['a'] * 9)
|
||||
`,
|
||||
{
|
||||
vars: {
|
||||
a: 9
|
||||
}
|
||||
a: 9,
|
||||
},
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
+10
-10
@@ -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');
|
||||
|
||||
+12
-12
@@ -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'),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
@@ -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',
|
||||
};
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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',
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user