This commit is contained in:
Christopher Willis-Ford 2017-09-04 15:48:51 -07:00
parent d99c11ef91
commit 799d61ac98
5 changed files with 14 additions and 31 deletions

View file

@ -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}`;

View file

@ -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
*/
/**

View file

@ -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;

View file

@ -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.

View file

@ -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'