From 799d61ac98cacbe760fcd43debee1b7624bad85f Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford Date: Mon, 4 Sep 2017 15:48:51 -0700 Subject: [PATCH] Cleanup --- src/engine/runtime.js | 12 +++++++----- src/extension-support/extension-manager.js | 2 +- src/index.js | 5 ----- src/virtual-machine.js | 7 ------- webpack.config.js | 19 ++++++------------- 5 files changed, 14 insertions(+), 31 deletions(-) diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 7c0fd1a8d..878aeaebb 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -43,6 +43,7 @@ const ArgumentTypeMap = (() => { shadowType: 'text', fieldType: 'TEXT' }; + // @TODO: talk to Rachel & co. to figure out what goes here. Make it OK to not have a field. Add `check` support. map[ArgumentType.BOOLEAN] = { shadowType: '' }; @@ -431,11 +432,12 @@ class Runtime extends EventEmitter { const argInfo = blockInfo.arguments[placeholder] || {}; const argTypeInfo = ArgumentTypeMap[argInfo.type] || {}; const defaultValue = (typeof argInfo.defaultValue === 'undefined' ? '' : argInfo.defaultValue.toString()); - inputList.push(`${defaultValue - }` + inputList.push( + `` + + `` + + `${defaultValue}` + + '' + + '' ); return `%${argNum}`; diff --git a/src/extension-support/extension-manager.js b/src/extension-support/extension-manager.js index c7c1487df..62a7a0cf8 100644 --- a/src/extension-support/extension-manager.js +++ b/src/extension-support/extension-manager.js @@ -28,7 +28,7 @@ const BlockType = require('./block-type'); * @property {string} color1 - the primary color for this category, in '#rrggbb' format * @property {string} color2 - the secondary color for this category, in '#rrggbb' format * @property {string} color3 - the tertiary color for this category, in '#rrggbb' format - * @property {Array. block - the blocks in this category + * @property {Array.} block - the blocks in this category */ /** diff --git a/src/index.js b/src/index.js index a54deefbc..dfb566329 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,3 @@ const VirtualMachine = require('./virtual-machine'); -const CentralDispatch = require('./dispatch/central-dispatch'); - -global.Scratch = global.Scratch || {}; -global.Scratch.dispatch = CentralDispatch; - module.exports = VirtualMachine; diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 55aba32a4..ffc182dbd 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -142,13 +142,6 @@ class VirtualMachine extends EventEmitter { }); } - /** - * Get the categorized list of all blocks currently available in the VM. - */ - getBlocks () { - - } - /** * Post I/O data to the virtual devices. * @param {?string} device Name of virtual I/O device. diff --git a/webpack.config.js b/webpack.config.js index d741b787c..571256800 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,15 +1,8 @@ const CopyWebpackPlugin = require('copy-webpack-plugin'); const defaultsDeep = require('lodash.defaultsdeep'); -const glob = require('glob'); const path = require('path'); const webpack = require('webpack'); -const extensionEntries = glob.sync('./src/extensions/*.js').reduce((bag, extensionPath) => { - const nameWithoutExtension = path.basename(extensionPath).replace(/\.[^/.]+$/, ''); - bag[`extensions/${nameWithoutExtension}`] = extensionPath; - return bag; -}, {}); - const base = { devServer: { contentBase: false, @@ -39,10 +32,10 @@ module.exports = [ // Web-compatible defaultsDeep({}, base, { target: 'web', - entry: defaultsDeep({}, extensionEntries, { + entry: { 'scratch-vm': './src/index.js', 'scratch-vm.min': './src/index.js' - }), + }, output: { path: path.resolve(__dirname, 'dist/web'), filename: '[name].js' @@ -59,9 +52,9 @@ module.exports = [ // Node-compatible defaultsDeep({}, base, { target: 'node', - entry: defaultsDeep({}, extensionEntries, { + entry: { 'scratch-vm': './src/index.js' - }), + }, output: { library: 'VirtualMachine', libraryTarget: 'commonjs2', @@ -72,7 +65,7 @@ module.exports = [ // Playground defaultsDeep({}, base, { target: 'web', - entry: defaultsDeep({}, extensionEntries, { + entry: { 'scratch-vm': './src/index.js', 'vendor': [ // FPS counter @@ -88,7 +81,7 @@ module.exports = [ // Storage 'scratch-storage' ] - }), + }, output: { path: path.resolve(__dirname, 'playground'), filename: '[name].js'