From 82acfddeb5bcd5f08dc7436861e319ef076e5a9a Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Wed, 1 Feb 2017 15:19:46 +0000 Subject: [PATCH 1/5] chore(package): update dependencies https://greenkeeper.io/ --- package.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 663e19e310..287f8eb10d 100644 --- a/package.json +++ b/package.json @@ -25,27 +25,27 @@ }, "devDependencies": { "adm-zip": "0.4.7", - "babel-eslint": "7.0.0", - "copy-webpack-plugin": "3.0.1", - "eslint": "3.8.1", - "eslint-config-scratch": "^2.0.0", + "babel-eslint": "7.1.1", + "copy-webpack-plugin": "4.0.1", + "eslint": "3.14.1", + "eslint-config-scratch": "^3.1.0", "expose-loader": "0.7.1", - "gh-pages": "0.11.0", - "highlightjs": "8.7.0", - "htmlparser2": "3.9.0", + "gh-pages": "0.12.0", + "highlightjs": "9.8.0", + "htmlparser2": "3.9.2", "json": "9.0.4", "json-loader": "0.5.4", "lodash.defaultsdeep": "4.6.0", - "minilog": "3.0.1", + "minilog": "3.1.0", "promise": "7.1.1", "scratch-audio": "latest", "scratch-blocks": "latest", "scratch-render": "latest", "script-loader": "0.7.0", - "stats.js": "0.16.0", - "tap": "5.7.1", + "stats.js": "0.17.0", + "tap": "10.0.0", "travis-after-all": "1.4.4", - "webpack": "1.13.0", - "webpack-dev-server": "1.14.1" + "webpack": "2.2.1", + "webpack-dev-server": "1.16.3" } } From 0d38d1d245fa922b8857e7d604badb148040b566 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Wed, 1 Feb 2017 15:19:47 +0000 Subject: [PATCH 2/5] docs(readme): add Greenkeeper badge https://greenkeeper.io/ --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cd14f003f5..8ef811d299 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ ## scratch-vm #### Scratch VM is a library for representing, running, and maintaining the state of computer programs written using [Scratch Blocks](https://github.com/LLK/scratch-blocks). +[![Greenkeeper badge](https://badges.greenkeeper.io/LLK/scratch-vm.svg)](https://greenkeeper.io/) + [![Build Status](https://travis-ci.org/LLK/scratch-vm.svg?branch=develop)](https://travis-ci.org/LLK/scratch-vm) [![Coverage Status](https://coveralls.io/repos/github/LLK/scratch-vm/badge.svg?branch=develop)](https://coveralls.io/github/LLK/scratch-vm?branch=develop) [![Dependency Status](https://david-dm.org/LLK/scratch-vm.svg)](https://david-dm.org/LLK/scratch-vm) From a6568c4bf2e3479e9ee6c80d3f8e64854ab1cd4c Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Wed, 1 Feb 2017 15:30:27 -0500 Subject: [PATCH 3/5] Update webpack config for webpack 2 * `module.loaders` -> `module.rules` * loaders need `-loader` suffix * `json-loader` is enabled by default * `UglifyJsPlugin`'s `compress.warning` setting is false by default --- package.json | 1 - webpack.config.js | 35 ++++++++++++----------------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 287f8eb10d..ab5359949e 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "highlightjs": "9.8.0", "htmlparser2": "3.9.2", "json": "9.0.4", - "json-loader": "0.5.4", "lodash.defaultsdeep": "4.6.0", "minilog": "3.1.0", "promise": "7.1.1", diff --git a/webpack.config.js b/webpack.config.js index d01c7d7a6a..f58b7a1bf8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,21 +10,10 @@ var base = { port: process.env.PORT || 8073 }, devtool: 'source-map', - module: { - loaders: [ - { - test: /\.json$/, - loader: 'json-loader' - } - ] - }, plugins: [ new webpack.optimize.UglifyJsPlugin({ include: /\.min\.js$/, - minimize: true, - compress: { - warnings: false - } + minimize: true }) ] }; @@ -42,12 +31,12 @@ module.exports = [ filename: '[name].js' }, module: { - loaders: base.module.loaders.concat([ + rules: [ { test: require.resolve('./src/index.js'), - loader: 'expose?VirtualMachine' + loader: 'expose-loader?VirtualMachine' } - ]) + ] } }), // Node-compatible @@ -86,32 +75,32 @@ module.exports = [ filename: '[name].js' }, module: { - loaders: base.module.loaders.concat([ + loaders: [ { test: require.resolve('./src/index.js'), - loader: 'expose?VirtualMachine' + loader: 'expose-loader?VirtualMachine' }, { test: require.resolve('stats.js/build/stats.min.js'), - loader: 'script' + loader: 'script-loader' }, { test: require.resolve('highlightjs/highlight.pack.min.js'), - loader: 'script' + loader: 'script-loader' }, { test: require.resolve('scratch-blocks/dist/vertical.js'), - loader: 'expose?Blockly' + loader: 'expose-loader?Blockly' }, { test: require.resolve('scratch-render'), - loader: 'expose?RenderWebGL' + loader: 'expose-loader?RenderWebGL' }, { test: require.resolve('scratch-audio'), - loader: 'expose?AudioEngine' + loader: 'expose-loader?AudioEngine' } - ]) + ] }, plugins: base.plugins.concat([ new CopyWebpackPlugin([{ From 727fcc7875cf222a6b47f8aba8e113e822bf3b92 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Wed, 1 Feb 2017 15:59:50 -0500 Subject: [PATCH 4/5] Lint for eslint-config-scratch@3 --- src/blocks/scratch3_control.js | 2 +- src/blocks/scratch3_data.js | 2 +- src/blocks/scratch3_event.js | 2 +- src/blocks/scratch3_looks.js | 2 +- src/blocks/scratch3_motion.js | 2 +- src/blocks/scratch3_operators.js | 2 +- src/blocks/scratch3_pen.js | 2 +- src/blocks/scratch3_procedures.js | 2 +- src/blocks/scratch3_sensing.js | 2 +- src/blocks/scratch3_sound.js | 2 +- src/engine/adapter.js | 10 +++++----- src/engine/blocks.js | 18 +++++++++--------- src/engine/execute.js | 2 +- src/engine/mutation-adapter.js | 8 ++++---- src/engine/runtime.js | 8 ++++---- src/engine/sequencer.js | 4 ++-- src/engine/thread.js | 6 +++--- src/engine/variable.js | 2 +- src/import/sb2import.js | 20 ++++++++++---------- src/sprites/rendered-target.js | 20 ++++++++++---------- src/util/cast.js | 2 +- src/virtual-machine.js | 10 +++++----- 22 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/blocks/scratch3_control.js b/src/blocks/scratch3_control.js index cbfe61a240..28737b3619 100644 --- a/src/blocks/scratch3_control.js +++ b/src/blocks/scratch3_control.js @@ -11,7 +11,7 @@ var Scratch3ControlBlocks = function (runtime) { /** * Retrieve the block primitives implemented by this package. - * @return {Object.} Mapping of opcode to Function. + * @return {object.} Mapping of opcode to Function. */ Scratch3ControlBlocks.prototype.getPrimitives = function () { return { diff --git a/src/blocks/scratch3_data.js b/src/blocks/scratch3_data.js index 55a6b8bb70..b178356382 100644 --- a/src/blocks/scratch3_data.js +++ b/src/blocks/scratch3_data.js @@ -10,7 +10,7 @@ var Scratch3DataBlocks = function (runtime) { /** * Retrieve the block primitives implemented by this package. - * @return {Object.} Mapping of opcode to Function. + * @return {object.} Mapping of opcode to Function. */ Scratch3DataBlocks.prototype.getPrimitives = function () { return { diff --git a/src/blocks/scratch3_event.js b/src/blocks/scratch3_event.js index 8bfef42c26..b4c40116ef 100644 --- a/src/blocks/scratch3_event.js +++ b/src/blocks/scratch3_event.js @@ -10,7 +10,7 @@ var Scratch3EventBlocks = function (runtime) { /** * Retrieve the block primitives implemented by this package. - * @return {Object.} Mapping of opcode to Function. + * @return {object.} Mapping of opcode to Function. */ Scratch3EventBlocks.prototype.getPrimitives = function () { return { diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index 60d95fd507..c7a9fcadfe 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -10,7 +10,7 @@ var Scratch3LooksBlocks = function (runtime) { /** * Retrieve the block primitives implemented by this package. - * @return {Object.} Mapping of opcode to Function. + * @return {object.} Mapping of opcode to Function. */ Scratch3LooksBlocks.prototype.getPrimitives = function () { return { diff --git a/src/blocks/scratch3_motion.js b/src/blocks/scratch3_motion.js index be96e9cd8d..857644dd54 100644 --- a/src/blocks/scratch3_motion.js +++ b/src/blocks/scratch3_motion.js @@ -12,7 +12,7 @@ var Scratch3MotionBlocks = function (runtime) { /** * Retrieve the block primitives implemented by this package. - * @return {Object.} Mapping of opcode to Function. + * @return {object.} Mapping of opcode to Function. */ Scratch3MotionBlocks.prototype.getPrimitives = function () { return { diff --git a/src/blocks/scratch3_operators.js b/src/blocks/scratch3_operators.js index d51e308943..fce7fb3a7e 100644 --- a/src/blocks/scratch3_operators.js +++ b/src/blocks/scratch3_operators.js @@ -11,7 +11,7 @@ var Scratch3OperatorsBlocks = function (runtime) { /** * Retrieve the block primitives implemented by this package. - * @return {Object.} Mapping of opcode to Function. + * @return {object.} Mapping of opcode to Function. */ Scratch3OperatorsBlocks.prototype.getPrimitives = function () { return { diff --git a/src/blocks/scratch3_pen.js b/src/blocks/scratch3_pen.js index 6ef00cf713..c8f98341e7 100644 --- a/src/blocks/scratch3_pen.js +++ b/src/blocks/scratch3_pen.js @@ -163,7 +163,7 @@ Scratch3PenBlocks.prototype._wrapHueOrShade = function (value) { /** * Retrieve the block primitives implemented by this package. - * @return {Object.} Mapping of opcode to Function. + * @return {object.} Mapping of opcode to Function. */ Scratch3PenBlocks.prototype.getPrimitives = function () { return { diff --git a/src/blocks/scratch3_procedures.js b/src/blocks/scratch3_procedures.js index 62c7b8dbec..471205f489 100644 --- a/src/blocks/scratch3_procedures.js +++ b/src/blocks/scratch3_procedures.js @@ -8,7 +8,7 @@ var Scratch3ProcedureBlocks = function (runtime) { /** * Retrieve the block primitives implemented by this package. - * @return {Object.} Mapping of opcode to Function. + * @return {object.} Mapping of opcode to Function. */ Scratch3ProcedureBlocks.prototype.getPrimitives = function () { return { diff --git a/src/blocks/scratch3_sensing.js b/src/blocks/scratch3_sensing.js index c940c50681..1601fc650b 100644 --- a/src/blocks/scratch3_sensing.js +++ b/src/blocks/scratch3_sensing.js @@ -10,7 +10,7 @@ var Scratch3SensingBlocks = function (runtime) { /** * Retrieve the block primitives implemented by this package. - * @return {Object.} Mapping of opcode to Function. + * @return {object.} Mapping of opcode to Function. */ Scratch3SensingBlocks.prototype.getPrimitives = function () { return { diff --git a/src/blocks/scratch3_sound.js b/src/blocks/scratch3_sound.js index f1a16f1792..7e1e466a06 100644 --- a/src/blocks/scratch3_sound.js +++ b/src/blocks/scratch3_sound.js @@ -11,7 +11,7 @@ var Scratch3SoundBlocks = function (runtime) { /** * Retrieve the block primitives implemented by this package. - * @return {Object.} Mapping of opcode to Function. + * @return {object.} Mapping of opcode to Function. */ Scratch3SoundBlocks.prototype.getPrimitives = function () { return { diff --git a/src/engine/adapter.js b/src/engine/adapter.js index e68cd3ea52..56275e1cb7 100644 --- a/src/engine/adapter.js +++ b/src/engine/adapter.js @@ -6,7 +6,7 @@ var html = require('htmlparser2'); * to a usable form for the Scratch runtime. * This structure is based on Blockly xml.js:`domToWorkspace` and `domToBlock`. * @param {Element} blocksDOM DOM tree for this event. - * @return {Array.} Usable list of blocks from this CREATE event. + * @return {Array.} Usable list of blocks from this CREATE event. */ var domToBlocks = function (blocksDOM) { // At this level, there could be multiple blocks adjacent in the DOM tree. @@ -32,8 +32,8 @@ var domToBlocks = function (blocksDOM) { /** * Adapter between block creation events and block representation which can be * used by the Scratch runtime. - * @param {Object} e `Blockly.events.create` - * @return {Array.} List of blocks from this CREATE event. + * @param {object} e `Blockly.events.create` + * @return {Array.} List of blocks from this CREATE event. */ var adapter = function (e) { // Validate input @@ -47,8 +47,8 @@ var adapter = function (e) { * Convert and an individual block DOM to the representation tree. * Based on Blockly's `domToBlockHeadless_`. * @param {Element} blockDOM DOM tree for an individual block. - * @param {Object} blocks Collection of blocks to add to. - * @param {Boolean} isTopBlock Whether blocks at this level are "top blocks." + * @param {object} blocks Collection of blocks to add to. + * @param {boolean} isTopBlock Whether blocks at this level are "top blocks." * @param {?string} parent Parent block ID. * @return {undefined} */ diff --git a/src/engine/blocks.js b/src/engine/blocks.js index d2215a2cc6..ed03be324e 100644 --- a/src/engine/blocks.js +++ b/src/engine/blocks.js @@ -34,7 +34,7 @@ Blocks.BRANCH_INPUT_PREFIX = 'SUBSTACK'; /** * Provide an object with metadata for the requested block ID. * @param {!string} blockId ID of block we have stored. - * @return {?Object} Metadata about the block, if it exists. + * @return {?object} Metadata about the block, if it exists. */ Blocks.prototype.getBlock = function (blockId) { return this._blocks[blockId]; @@ -92,7 +92,7 @@ Blocks.prototype.getOpcode = function (id) { /** * Get all fields and their values for a block. * @param {?string} id ID of block to query. - * @return {!Object} All fields and their values. + * @return {!object} All fields and their values. */ Blocks.prototype.getFields = function (id) { var block = this._blocks[id]; @@ -102,7 +102,7 @@ Blocks.prototype.getFields = function (id) { /** * Get all non-branch inputs for a block. * @param {?string} id ID of block to query. - * @return {!Object} All non-branch inputs and their associated blocks. + * @return {!object} All non-branch inputs and their associated blocks. */ Blocks.prototype.getInputs = function (id) { var block = this._blocks[id]; @@ -121,7 +121,7 @@ Blocks.prototype.getInputs = function (id) { /** * Get mutation data for a block. * @param {?string} id ID of block to query. - * @return {!Object} Mutation for the block. + * @return {!object} Mutation for the block. */ Blocks.prototype.getMutation = function (id) { var block = this._blocks[id]; @@ -247,7 +247,7 @@ Blocks.prototype.blocklyListen = function (e, optRuntime) { /** * Block management: create blocks and scripts from a `create` event - * @param {!Object} block Blockly create event to be processed + * @param {!object} block Blockly create event to be processed */ Blocks.prototype.createBlock = function (block) { // Does the block already exist? @@ -267,7 +267,7 @@ Blocks.prototype.createBlock = function (block) { /** * Block management: change block field values - * @param {!Object} args Blockly change event to be processed + * @param {!object} args Blockly change event to be processed */ Blocks.prototype.changeBlock = function (args) { // Validate @@ -286,7 +286,7 @@ Blocks.prototype.changeBlock = function (args) { /** * Block management: move blocks from parent to parent - * @param {!Object} e Blockly move event to be processed + * @param {!object} e Blockly move event to be processed */ Blocks.prototype.moveBlock = function (e) { if (!this._blocks.hasOwnProperty(e.id)) { @@ -342,7 +342,7 @@ Blocks.prototype.moveBlock = function (e) { /** * Block management: delete blocks and their associated scripts. - * @param {!Object} e Blockly delete event to be processed. + * @param {!object} e Blockly delete event to be processed. */ Blocks.prototype.deleteBlock = function (e) { // @todo In runtime, stop threads running on this script. @@ -449,7 +449,7 @@ Blocks.prototype.blockToXML = function (blockId) { /** * Recursively encode a mutation object to XML. - * @param {!Object} mutation Object representing a mutation. + * @param {!object} mutation Object representing a mutation. * @return {string} XML string representing a mutation. */ Blocks.prototype.mutationToXML = function (mutation) { diff --git a/src/engine/execute.js b/src/engine/execute.js index a8967eb1f2..44951aba38 100644 --- a/src/engine/execute.js +++ b/src/engine/execute.js @@ -4,7 +4,7 @@ var Thread = require('./thread'); /** * Utility function to determine if a value is a Promise. * @param {*} value Value to check for a Promise. - * @return {Boolean} True if the value appears to be a Promise. + * @return {boolean} True if the value appears to be a Promise. */ var isPromise = function (value) { return value && value.then && typeof value.then === 'function'; diff --git a/src/engine/mutation-adapter.js b/src/engine/mutation-adapter.js index 9277cc1500..54bf7b4ee1 100644 --- a/src/engine/mutation-adapter.js +++ b/src/engine/mutation-adapter.js @@ -2,8 +2,8 @@ var html = require('htmlparser2'); /** * Convert a part of a mutation DOM to a mutation VM object, recursively. - * @param {Object} dom DOM object for mutation tag. - * @return {Object} Object representing useful parts of this mutation. + * @param {object} dom DOM object for mutation tag. + * @return {object} Object representing useful parts of this mutation. */ var mutatorTagToObject = function (dom) { var obj = Object.create(null); @@ -24,8 +24,8 @@ var mutatorTagToObject = function (dom) { /** * Adapter between mutator XML or DOM and block representation which can be * used by the Scratch runtime. - * @param {(Object|string)} mutation Mutation XML string or DOM. - * @return {Object} Object representing the mutation. + * @param {(object|string)} mutation Mutation XML string or DOM. + * @return {object} Object representing the mutation. */ var mutationAdpater = function (mutation) { var mutationParsed; diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 3a1967baac..f196a6a69d 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -276,7 +276,7 @@ Runtime.prototype.getOpcodeFunction = function (opcode) { /** * Return whether an opcode represents a hat block. * @param {!string} opcode The opcode to look up. - * @return {Boolean} True if the op is known to be a hat. + * @return {boolean} True if the op is known to be a hat. */ Runtime.prototype.getIsHat = function (opcode) { return this._hats.hasOwnProperty(opcode); @@ -285,7 +285,7 @@ Runtime.prototype.getIsHat = function (opcode) { /** * Return whether an opcode represents an edge-activated hat block. * @param {!string} opcode The opcode to look up. - * @return {Boolean} True if the op is known to be a edge-activated hat. + * @return {boolean} True if the op is known to be a edge-activated hat. */ Runtime.prototype.getIsEdgeActivatedHat = function (opcode) { return this._hats.hasOwnProperty(opcode) && @@ -379,7 +379,7 @@ Runtime.prototype._restartThread = function (thread) { /** * Return whether a thread is currently active/running. * @param {?Thread} thread Thread object to check. - * @return {Boolean} True if the thread is active/running. + * @return {boolean} True if the thread is active/running. */ Runtime.prototype.isActiveThread = function (thread) { return this.threads.indexOf(thread) > -1; @@ -427,7 +427,7 @@ Runtime.prototype.allScriptsDo = function (f, optTarget) { /** * Start all relevant hats. * @param {!string} requestedHatOpcode Opcode of hats to start. - * @param {Object=} optMatchFields Optionally, fields to match on the hat. + * @param {object=} optMatchFields Optionally, fields to match on the hat. * @param {Target=} optTarget Optionally, a target to restrict to. * @return {Array.} List of threads started by this function. */ diff --git a/src/engine/sequencer.js b/src/engine/sequencer.js index 79476ba6fd..06deb38f97 100644 --- a/src/engine/sequencer.js +++ b/src/engine/sequencer.js @@ -171,8 +171,8 @@ Sequencer.prototype.stepThread = function (thread) { /** * Step a thread into a block's branch. * @param {!Thread} thread Thread object to step to branch. - * @param {Number} branchNum Which branch to step to (i.e., 1, 2). - * @param {Boolean} isLoop Whether this block is a loop. + * @param {number} branchNum Which branch to step to (i.e., 1, 2). + * @param {boolean} isLoop Whether this block is a loop. */ Sequencer.prototype.stepToBranch = function (thread, branchNum, isLoop) { if (!branchNum) { diff --git a/src/engine/thread.js b/src/engine/thread.js index 8bef974964..9693b26f1c 100644 --- a/src/engine/thread.js +++ b/src/engine/thread.js @@ -151,7 +151,7 @@ Thread.prototype.peekStack = function () { /** * Get top stack frame. - * @return {?Object} Last stack frame stored on this thread. + * @return {?object} Last stack frame stored on this thread. */ Thread.prototype.peekStackFrame = function () { return this.stackFrames.length > 0 ? this.stackFrames[this.stackFrames.length - 1] : null; @@ -159,7 +159,7 @@ Thread.prototype.peekStackFrame = function () { /** * Get stack frame above the current top. - * @return {?Object} Second to last stack frame stored on this thread. + * @return {?object} Second to last stack frame stored on this thread. */ Thread.prototype.peekParentStackFrame = function () { return this.stackFrames.length > 1 ? this.stackFrames[this.stackFrames.length - 2] : null; @@ -205,7 +205,7 @@ Thread.prototype.getParam = function (paramName) { /** * Whether the current execution of a thread is at the top of the stack. - * @return {Boolean} True if execution is at top of the stack. + * @return {boolean} True if execution is at top of the stack. */ Thread.prototype.atStackTop = function () { return this.peekStack() === this.topBlock; diff --git a/src/engine/variable.js b/src/engine/variable.js index 65fc21c451..3f2dcc5de2 100644 --- a/src/engine/variable.js +++ b/src/engine/variable.js @@ -5,7 +5,7 @@ /** * @param {!string} name Name of the variable. - * @param {(string|Number)} value Value of the variable. + * @param {(string|number)} value Value of the variable. * @param {boolean} isCloud Whether the variable is stored in the cloud. * @constructor */ diff --git a/src/import/sb2import.js b/src/import/sb2import.js index 13983d5693..40c17e309a 100644 --- a/src/import/sb2import.js +++ b/src/import/sb2import.js @@ -17,7 +17,7 @@ var List = require('../engine/list'); /** * Parse a single "Scratch object" and create all its in-memory VM objects. - * @param {!Object} object From-JSON "Scratch object:" sprite, stage, watcher. + * @param {!object} object From-JSON "Scratch object:" sprite, stage, watcher. * @param {!Runtime} runtime Runtime object to load all structures into. * @param {boolean} topLevel Whether this is the top-level object (stage). * @return {?Target} Target created (stage or sprite). @@ -138,7 +138,7 @@ var parseScratchObject = function (object, runtime, topLevel) { * and process the top-level object (the stage object). * @param {!string} json SB2-format JSON to load. * @param {!Runtime} runtime Runtime object to load all structures into. - * @param {Boolean=} optForceSprite If set, treat as sprite (Sprite2). + * @param {boolean=} optForceSprite If set, treat as sprite (Sprite2). * @return {?Target} Top-level target created (stage or sprite). */ var sb2import = function (json, runtime, optForceSprite) { @@ -152,7 +152,7 @@ var sb2import = function (json, runtime, optForceSprite) { /** * Parse a Scratch object's scripts into VM blocks. * This should only handle top-level scripts that include X, Y coordinates. - * @param {!Object} scripts Scripts object from SB2 JSON. + * @param {!object} scripts Scripts object from SB2 JSON. * @param {!Blocks} blocks Blocks object to load parsed blocks into. */ var parseScripts = function (scripts, blocks) { @@ -184,8 +184,8 @@ var parseScripts = function (scripts, blocks) { * Could be used to parse a top-level script, * a list of blocks in a branch (e.g., in forever), * or a list of blocks in an argument (e.g., move [pick random...]). - * @param {Array.} blockList SB2 JSON-format block list. - * @return {Array.} Scratch VM-format block list. + * @param {Array.} blockList SB2 JSON-format block list. + * @return {Array.} Scratch VM-format block list. */ var parseBlockList = function (blockList) { var resultingList = []; @@ -207,8 +207,8 @@ var parseBlockList = function (blockList) { /** * Flatten a block tree into a block list. * Children are temporarily stored on the `block.children` property. - * @param {Array.} blocks list generated by `parseBlockList`. - * @return {Array.} Flattened list to be passed to `blocks.createBlock`. + * @param {Array.} blocks list generated by `parseBlockList`. + * @return {Array.} Flattened list to be passed to `blocks.createBlock`. */ var flatten = function (blocks) { var finalBlocks = []; @@ -228,7 +228,7 @@ var flatten = function (blocks) { * into an argument map. This allows us to provide the expected inputs * to a mutated procedure call. * @param {string} procCode Scratch 2.0 procedure string. - * @return {Object} Argument map compatible with those in sb2specmap. + * @return {object} Argument map compatible with those in sb2specmap. */ var parseProcedureArgMap = function (procCode) { var argMap = [ @@ -259,8 +259,8 @@ var parseProcedureArgMap = function (procCode) { /** * Parse a single SB2 JSON-formatted block and its children. - * @param {!Object} sb2block SB2 JSON-formatted block. - * @return {Object} Scratch VM format block. + * @param {!object} sb2block SB2 JSON-formatted block. + * @return {object} Scratch VM format block. */ var parseBlock = function (sb2block) { // First item in block object is the old opcode (e.g., 'forward:'). diff --git a/src/sprites/rendered-target.js b/src/sprites/rendered-target.js index 9eb8956b2f..b82afa8468 100644 --- a/src/sprites/rendered-target.js +++ b/src/sprites/rendered-target.js @@ -184,7 +184,7 @@ RenderedTarget.prototype.setXY = function (x, y) { /** * Get the rendered direction and scale, after applying rotation style. - * @return {Object} Direction and scale to render. + * @return {object} Direction and scale to render. */ RenderedTarget.prototype._getRenderedDirectionAndScale = function () { // Default: no changes to `this.direction` or `this.scale`. @@ -480,7 +480,7 @@ RenderedTarget.prototype.isSprite = function () { /** * Return the rendered target's tight bounding box. * Includes top, left, bottom, right attributes in Scratch coordinates. - * @return {?Object} Tight bounding box, or null. + * @return {?object} Tight bounding box, or null. */ RenderedTarget.prototype.getBounds = function () { if (this.renderer) { @@ -493,7 +493,7 @@ RenderedTarget.prototype.getBounds = function () { * Return whether touching a point. * @param {number} x X coordinate of test point. * @param {number} y Y coordinate of test point. - * @return {Boolean} True iff the rendered target is touching the point. + * @return {boolean} True iff the rendered target is touching the point. */ RenderedTarget.prototype.isTouchingPoint = function (x, y) { if (this.renderer) { @@ -513,7 +513,7 @@ RenderedTarget.prototype.isTouchingPoint = function (x, y) { /** * Return whether touching a stage edge. - * @return {Boolean} True iff the rendered target is touching the stage edge. + * @return {boolean} True iff the rendered target is touching the stage edge. */ RenderedTarget.prototype.isTouchingEdge = function () { if (this.renderer) { @@ -533,7 +533,7 @@ RenderedTarget.prototype.isTouchingEdge = function () { /** * Return whether touching any of a named sprite's clones. * @param {string} spriteName Name of the sprite. - * @return {Boolean} True iff touching a clone of the sprite. + * @return {boolean} True iff touching a clone of the sprite. */ RenderedTarget.prototype.isTouchingSprite = function (spriteName) { var firstClone = this.runtime.getSpriteTargetByName(spriteName); @@ -550,7 +550,7 @@ RenderedTarget.prototype.isTouchingSprite = function (spriteName) { /** * Return whether touching a color. * @param {Array.} rgb [r,g,b], values between 0-255. - * @return {Promise.} True iff the rendered target is touching the color. + * @return {Promise.} True iff the rendered target is touching the color. */ RenderedTarget.prototype.isTouchingColor = function (rgb) { if (this.renderer) { @@ -561,9 +561,9 @@ RenderedTarget.prototype.isTouchingColor = function (rgb) { /** * Return whether rendered target's color is touching a color. - * @param {Object} targetRgb {Array.} [r,g,b], values between 0-255. - * @param {Object} maskRgb {Array.} [r,g,b], values between 0-255. - * @return {Promise.} True iff the color is touching the color. + * @param {object} targetRgb {Array.} [r,g,b], values between 0-255. + * @param {object} maskRgb {Array.} [r,g,b], values between 0-255. + * @return {Promise.} True iff the color is touching the color. */ RenderedTarget.prototype.colorIsTouchingColor = function (targetRgb, maskRgb) { if (this.renderer) { @@ -611,7 +611,7 @@ RenderedTarget.prototype.goBehindOther = function (other) { * Keep a desired position within a fence. * @param {number} newX New desired X position. * @param {number} newY New desired Y position. - * @param {Object=} optFence Optional fence with left, right, top bottom. + * @param {object=} optFence Optional fence with left, right, top bottom. * @return {Array.} Fenced X and Y coordinates. */ RenderedTarget.prototype.keepInFence = function (newX, newY, optFence) { diff --git a/src/util/cast.js b/src/util/cast.js index 0723b5ecdc..a8a1535b87 100644 --- a/src/util/cast.js +++ b/src/util/cast.js @@ -95,7 +95,7 @@ Cast.toRgbColorObject = function (value) { * In Scratch 2.0, this is captured by `interp.compare.` * @param {*} v1 First value to compare. * @param {*} v2 Second value to compare. - * @returns {Number} Negative number if v1 < v2; 0 if equal; positive otherwise. + * @returns {number} Negative number if v1 < v2; 0 if equal; positive otherwise. */ Cast.compare = function (v1, v2) { var n1 = Number(v1); diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 8e9b4a9402..003c80e9f9 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -75,7 +75,7 @@ VirtualMachine.prototype.greenFlag = function () { /** * Set whether the VM is in "turbo mode." * When true, loops don't yield to redraw. - * @param {Boolean} turboModeOn Whether turbo mode should be set. + * @param {boolean} turboModeOn Whether turbo mode should be set. */ VirtualMachine.prototype.setTurboMode = function (turboModeOn) { this.runtime.turboMode = !!turboModeOn; @@ -84,7 +84,7 @@ VirtualMachine.prototype.setTurboMode = function (turboModeOn) { /** * Set whether the VM is in 2.0 "compatibility mode." * When true, ticks go at 2.0 speed (30 TPS). - * @param {Boolean} compatibilityModeOn Whether compatibility mode is set. + * @param {boolean} compatibilityModeOn Whether compatibility mode is set. */ VirtualMachine.prototype.setCompatibilityMode = function (compatibilityModeOn) { this.runtime.setCompatibilityMode(!!compatibilityModeOn); @@ -129,7 +129,7 @@ VirtualMachine.prototype.getPlaygroundData = function () { /** * Post I/O data to the virtual devices. * @param {?string} device Name of virtual I/O device. - * @param {Object} data Any data object to post to the I/O device. + * @param {object} data Any data object to post to the I/O device. */ VirtualMachine.prototype.postIOData = function (device, data) { if (this.runtime.ioDevices[device]) { @@ -168,7 +168,7 @@ VirtualMachine.prototype.addSprite2 = function (json) { /** * Add a costume to the current editing target. - * @param {!Object} costumeObject Object representing the costume. + * @param {!object} costumeObject Object representing the costume. */ VirtualMachine.prototype.addCostume = function (costumeObject) { this.editingTarget.sprite.costumes.push(costumeObject); @@ -180,7 +180,7 @@ VirtualMachine.prototype.addCostume = function (costumeObject) { /** * Add a backdrop to the stage. - * @param {!Object} backdropObject Object representing the backdrop. + * @param {!object} backdropObject Object representing the backdrop. */ VirtualMachine.prototype.addBackdrop = function (backdropObject) { var stage = this.runtime.getTargetForStage(); From 98a12f1388277e12e7be0ebaecd12ed512dbc63f Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Wed, 1 Feb 2017 16:11:06 -0500 Subject: [PATCH 5/5] Replace broken DavidDM badges with Greenkeeper --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 8ef811d299..2888fc6c0b 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,9 @@ ## scratch-vm #### Scratch VM is a library for representing, running, and maintaining the state of computer programs written using [Scratch Blocks](https://github.com/LLK/scratch-blocks). -[![Greenkeeper badge](https://badges.greenkeeper.io/LLK/scratch-vm.svg)](https://greenkeeper.io/) - [![Build Status](https://travis-ci.org/LLK/scratch-vm.svg?branch=develop)](https://travis-ci.org/LLK/scratch-vm) [![Coverage Status](https://coveralls.io/repos/github/LLK/scratch-vm/badge.svg?branch=develop)](https://coveralls.io/github/LLK/scratch-vm?branch=develop) -[![Dependency Status](https://david-dm.org/LLK/scratch-vm.svg)](https://david-dm.org/LLK/scratch-vm) -[![devDependency Status](https://david-dm.org/LLK/scratch-vm/dev-status.svg)](https://david-dm.org/LLK/scratch-vm#info=devDependencies) +[![Greenkeeper badge](https://badges.greenkeeper.io/LLK/scratch-vm.svg)](https://greenkeeper.io/) ## Installation This requires you to have Git and Node.js installed.