mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
Cleanup
This commit is contained in:
parent
d99c11ef91
commit
799d61ac98
5 changed files with 14 additions and 31 deletions
|
@ -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(`<value name="${placeholder
|
||||
}"><shadow type="${argTypeInfo.shadowType
|
||||
}"><field name="${argTypeInfo.fieldType
|
||||
}">${defaultValue
|
||||
}</field></shadow></value>`
|
||||
inputList.push(
|
||||
`<value name="${placeholder}">` +
|
||||
`<shadow type="${argTypeInfo.shadowType}">` +
|
||||
`<field name="${argTypeInfo.fieldType}">${defaultValue}</field>` +
|
||||
'</shadow>' +
|
||||
'</value>'
|
||||
);
|
||||
|
||||
return `%${argNum}`;
|
||||
|
|
|
@ -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.<BlockInfo> block - the blocks in this category
|
||||
* @property {Array.<BlockInfo>} block - the blocks in this category
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue