mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-05-15 16:01:07 -04:00
fix: update GitHub links with /scratchfoundation/
This commit is contained in:
parent
613e5cc823
commit
802d211f95
10 changed files with 26 additions and 27 deletions
10
.github/CONTRIBUTING.md
vendored
10
.github/CONTRIBUTING.md
vendored
|
@ -5,16 +5,16 @@ The development of Scratch is an ongoing process, and we love to have people in
|
||||||
|
|
||||||
* **Documenting bugs**
|
* **Documenting bugs**
|
||||||
* If you've identified a bug in Scratch you should first check to see if it's been filed as an issue, if not you can file one. Make sure you follow the issue template.
|
* If you've identified a bug in Scratch you should first check to see if it's been filed as an issue, if not you can file one. Make sure you follow the issue template.
|
||||||
* It's important that we can consistently reproduce issues. When writing an issue, be sure to follow our [reproduction step guidelines](https://github.com/LLK/scratch-gui/wiki/Writing-good-repro-steps).
|
* It's important that we can consistently reproduce issues. When writing an issue, be sure to follow our [reproduction step guidelines](https://github.com/scratchfoundation/scratch-gui/wiki/Writing-good-repro-steps).
|
||||||
* Some issues are marked "Needs Repro". Adding a comment with good reproduction steps to those issues is a great way to help.
|
* Some issues are marked "Needs Repro". Adding a comment with good reproduction steps to those issues is a great way to help.
|
||||||
* If you don't have an issue in mind already, you can look through the [Bugs & Glitches forum.](https://scratch.mit.edu/discuss/3/) Look for users reporting problems, reproduce the problem yourself, and file new issues following our guidelines.
|
* If you don't have an issue in mind already, you can look through the [Bugs & Glitches forum.](https://scratch.mit.edu/discuss/3/) Look for users reporting problems, reproduce the problem yourself, and file new issues following our guidelines.
|
||||||
|
|
||||||
* **Fixing bugs**
|
* **Fixing bugs**
|
||||||
* You can request to fix a bug in a comment on the issue if you at mention the repo coordinator, who for this repo is @ericrosenbaum.
|
* You can request to fix a bug in a comment on the issue if you at mention the repo coordinator, who for this repo is @ericrosenbaum.
|
||||||
* If the issue is marked "Help Wanted" you can go ahead and start working on it!
|
* If the issue is marked "Help Wanted" you can go ahead and start working on it!
|
||||||
* **We will only accept Pull Requests for bugs that have an issue filed that has a priority label**
|
* **We will only accept Pull Requests for bugs that have an issue filed that has a priority label**
|
||||||
* If you're interested in fixing a bug with no issue, file the issue first and wait for it to have a priority added to it.
|
* If you're interested in fixing a bug with no issue, file the issue first and wait for it to have a priority added to it.
|
||||||
|
|
||||||
* We are not looking for Pull Requests ("PR") for every issue and may deny a PR if it doesn't fit our criteria.
|
* We are not looking for Pull Requests ("PR") for every issue and may deny a PR if it doesn't fit our criteria.
|
||||||
* We are far more likely to accept a PR if it is for an issue marked with Help Wanted.
|
* We are far more likely to accept a PR if it is for an issue marked with Help Wanted.
|
||||||
* We will not accept PRs for issues marked with "Needs Discussion" or "Needs Design."
|
* We will not accept PRs for issues marked with "Needs Discussion" or "Needs Design."
|
||||||
|
@ -60,7 +60,7 @@ We welcome suggestions! If you want to suggest a feature, please post in our [su
|
||||||
|
|
||||||
### Other resources
|
### Other resources
|
||||||
Beyond this repo, there are also some other resources that you might want to take a look at:
|
Beyond this repo, there are also some other resources that you might want to take a look at:
|
||||||
* [Community Guidelines](https://github.com/LLK/scratch-www/wiki/Community-Guidelines) (we find it important to maintain a constructive and welcoming community, just like on Scratch)
|
* [Community Guidelines](https://github.com/scratchfoundation/scratch-www/wiki/Community-Guidelines) (we find it important to maintain a constructive and welcoming community, just like on Scratch)
|
||||||
* [Open Source forum](https://scratch.mit.edu/discuss/49/) on Scratch
|
* [Open Source forum](https://scratch.mit.edu/discuss/49/) on Scratch
|
||||||
* [Suggestions forum](https://scratch.mit.edu/discuss/1/) on Scratch
|
* [Suggestions forum](https://scratch.mit.edu/discuss/1/) on Scratch
|
||||||
* [Bugs & Glitches forum](https://scratch.mit.edu/discuss/3/) on Scratch
|
* [Bugs & Glitches forum](https://scratch.mit.edu/discuss/3/) on Scratch
|
||||||
|
|
11
README.md
11
README.md
|
@ -1,8 +1,7 @@
|
||||||
## scratch-vm
|
## 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).
|
#### Scratch VM is a library for representing, running, and maintaining the state of computer programs written using [Scratch Blocks](https://github.com/scratchfoundation/scratch-blocks).
|
||||||
|
|
||||||
[](https://travis-ci.org/LLK/scratch-vm)
|
[](https://github.com/scratchfoundation/scratch-vm/actions/workflows/ci-cd.yml)
|
||||||
[](https://coveralls.io/github/LLK/scratch-vm?branch=develop)
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
This requires you to have Git and Node.js installed.
|
This requires you to have Git and Node.js installed.
|
||||||
|
@ -13,7 +12,7 @@ npm install scratch-vm
|
||||||
```
|
```
|
||||||
To set up a development environment to edit scratch-vm yourself:
|
To set up a development environment to edit scratch-vm yourself:
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/LLK/scratch-vm.git
|
git clone https://github.com/scratchfoundation/scratch-vm.git
|
||||||
cd scratch-vm
|
cd scratch-vm
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
@ -21,7 +20,7 @@ npm install
|
||||||
## Development Server
|
## Development Server
|
||||||
This requires Node.js to be installed.
|
This requires Node.js to be installed.
|
||||||
|
|
||||||
For convenience, we've included a development server with the VM. This is sometimes useful when running in an environment that's loading remote resources (e.g., SVGs from the Scratch server). If you would like to use your modified VM with the full Scratch 3.0 GUI, [follow the instructions to link the VM to the GUI](https://github.com/LLK/scratch-gui/wiki/Getting-Started).
|
For convenience, we've included a development server with the VM. This is sometimes useful when running in an environment that's loading remote resources (e.g., SVGs from the Scratch server). If you would like to use your modified VM with the full Scratch 3.0 GUI, [follow the instructions to link the VM to the GUI](https://github.com/scratchfoundation/scratch-gui/wiki/Getting-Started).
|
||||||
|
|
||||||
## Running the Development Server
|
## Running the Development Server
|
||||||
Open a Command Prompt or Terminal in the repository and run:
|
Open a Command Prompt or Terminal in the repository and run:
|
||||||
|
@ -64,7 +63,7 @@ vm.start();
|
||||||
## Abstract Syntax Tree
|
## Abstract Syntax Tree
|
||||||
|
|
||||||
#### Overview
|
#### Overview
|
||||||
The Virtual Machine constructs and maintains the state of an [Abstract Syntax Tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (AST) by listening to events emitted by the [scratch-blocks](https://github.com/LLK/scratch-blocks) workspace via the `blockListener`. Each target (code-running object, for example, a sprite) keeps an AST for its blocks. At any time, the current state of an AST can be viewed by inspecting the `vm.runtime.targets[...].blocks` object.
|
The Virtual Machine constructs and maintains the state of an [Abstract Syntax Tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (AST) by listening to events emitted by the [scratch-blocks](https://github.com/scratchfoundation/scratch-blocks) workspace via the `blockListener`. Each target (code-running object, for example, a sprite) keeps an AST for its blocks. At any time, the current state of an AST can be viewed by inspecting the `vm.runtime.targets[...].blocks` object.
|
||||||
|
|
||||||
#### Anatomy of a Block
|
#### Anatomy of a Block
|
||||||
The VM's block representation contains all the important information for execution and storage. Here's an example representing the "when key pressed" script on a workspace:
|
The VM's block representation contains all the important information for execution and storage. Here's an example representing the "when key pressed" script on a workspace:
|
||||||
|
|
|
@ -48,7 +48,7 @@ ways.
|
||||||
## Defining an Extension
|
## Defining an Extension
|
||||||
|
|
||||||
Scratch extensions are defined as a single Javascript class which accepts either a reference to the Scratch
|
Scratch extensions are defined as a single Javascript class which accepts either a reference to the Scratch
|
||||||
[VM](https://github.com/llk/scratch-vm) runtime or a "runtime proxy" which handles communication with the Scratch VM
|
[VM](https://github.com/scratchfoundation/scratch-vm) runtime or a "runtime proxy" which handles communication with the Scratch VM
|
||||||
across a well defined worker boundary (i.e. the sandbox).
|
across a well defined worker boundary (i.e. the sandbox).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
"description": "Virtual Machine for Scratch 3.0",
|
"description": "Virtual Machine for Scratch 3.0",
|
||||||
"author": "Massachusetts Institute of Technology",
|
"author": "Massachusetts Institute of Technology",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"homepage": "https://github.com/LLK/scratch-vm#readme",
|
"homepage": "https://github.com/scratchfoundation/scratch-vm#readme",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/LLK/scratch-vm.git",
|
"url": "https://github.com/scratchfoundation/scratch-vm.git",
|
||||||
"sha": "6c2df37bed2cbda63a9de514ceb021e67f10a86a"
|
"sha": "6c2df37bed2cbda63a9de514ceb021e67f10a86a"
|
||||||
},
|
},
|
||||||
"main": "./dist/node/scratch-vm.js",
|
"main": "./dist/node/scratch-vm.js",
|
||||||
|
|
|
@ -250,7 +250,7 @@ class Scratch3LooksBlocks {
|
||||||
|
|
||||||
// Non-integers should be rounded to 2 decimal places (no more, no less), unless they're small enough that
|
// Non-integers should be rounded to 2 decimal places (no more, no less), unless they're small enough that
|
||||||
// rounding would display them as 0.00. This matches 2.0's behavior:
|
// rounding would display them as 0.00. This matches 2.0's behavior:
|
||||||
// https://github.com/LLK/scratch-flash/blob/2e4a402ceb205a042887f54b26eebe1c2e6da6c0/src/scratch/ScratchSprite.as#L579-L585
|
// https://github.com/scratchfoundation/scratch-flash/blob/2e4a402ceb205a042887f54b26eebe1c2e6da6c0/src/scratch/ScratchSprite.as#L579-L585
|
||||||
if (typeof text === 'number' &&
|
if (typeof text === 'number' &&
|
||||||
Math.abs(text) >= 0.01 && text % 1 !== 0) {
|
Math.abs(text) >= 0.01 && text % 1 !== 0) {
|
||||||
text = text.toFixed(2);
|
text = text.toFixed(2);
|
||||||
|
|
|
@ -15,7 +15,7 @@ const blockIconURI = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYA
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum for micro:bit BLE command protocol.
|
* Enum for micro:bit BLE command protocol.
|
||||||
* https://github.com/LLK/scratch-microbit-firmware/blob/master/protocol.md
|
* https://github.com/scratchfoundation/scratch-microbit-firmware/blob/master/protocol.md
|
||||||
* @readonly
|
* @readonly
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
|
@ -46,7 +46,7 @@ const BLEDataStoppedError = 'micro:bit extension stopped receiving data';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum for micro:bit protocol.
|
* Enum for micro:bit protocol.
|
||||||
* https://github.com/LLK/scratch-microbit-firmware/blob/master/protocol.md
|
* https://github.com/scratchfoundation/scratch-microbit-firmware/blob/master/protocol.md
|
||||||
* @readonly
|
* @readonly
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -198,7 +198,7 @@ class Scratch3Text2SpeechBlocks {
|
||||||
*
|
*
|
||||||
* SCRATCH LOCALE
|
* SCRATCH LOCALE
|
||||||
* Set by the editor, and used to store the language state in the project.
|
* Set by the editor, and used to store the language state in the project.
|
||||||
* Listed in l10n: https://github.com/LLK/scratch-l10n/blob/master/src/supported-locales.js
|
* Listed in l10n: https://github.com/scratchfoundation/scratch-l10n/blob/master/src/supported-locales.js
|
||||||
* SUPPORTED LOCALE
|
* SUPPORTED LOCALE
|
||||||
* A Scratch locale that has a corresponding extension locale.
|
* A Scratch locale that has a corresponding extension locale.
|
||||||
* EXTENSION LOCALE
|
* EXTENSION LOCALE
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
* Keep this up-to-date as 3.0 blocks are renamed, changed, etc.
|
* Keep this up-to-date as 3.0 blocks are renamed, changed, etc.
|
||||||
* Originally this was generated largely by a hand-guided scripting process.
|
* Originally this was generated largely by a hand-guided scripting process.
|
||||||
* The relevant data lives here:
|
* The relevant data lives here:
|
||||||
* https://github.com/LLK/scratch-flash/blob/master/src/Specs.as
|
* https://github.com/scratchfoundation/scratch-flash/blob/master/src/Specs.as
|
||||||
* (for the old opcode and argument order).
|
* (for the old opcode and argument order).
|
||||||
* and here:
|
* and here:
|
||||||
* https://github.com/LLK/scratch-blocks/tree/develop/blocks_vertical
|
* https://github.com/scratchfoundation/scratch-blocks/tree/develop/blocks_vertical
|
||||||
* (for the new opcodes and argument names).
|
* (for the new opcodes and argument names).
|
||||||
* and here:
|
* and here:
|
||||||
* https://github.com/LLK/scratch-blocks/blob/develop/tests/
|
* https://github.com/scratchfoundation/scratch-blocks/blob/develop/tests/
|
||||||
* (for the shadow blocks created for each block).
|
* (for the shadow blocks created for each block).
|
||||||
* I started with the `commands` array in Specs.as, and discarded irrelevant
|
* I started with the `commands` array in Specs.as, and discarded irrelevant
|
||||||
* properties. By hand, I matched the opcode name to the 3.0 opcode.
|
* properties. By hand, I matched the opcode name to the 3.0 opcode.
|
||||||
|
|
|
@ -351,16 +351,16 @@ const serializeCostume = function (costume) {
|
||||||
|
|
||||||
obj.bitmapResolution = costumeToSerialize.bitmapResolution;
|
obj.bitmapResolution = costumeToSerialize.bitmapResolution;
|
||||||
obj.dataFormat = costumeToSerialize.dataFormat.toLowerCase();
|
obj.dataFormat = costumeToSerialize.dataFormat.toLowerCase();
|
||||||
|
|
||||||
obj.assetId = costumeToSerialize.assetId;
|
obj.assetId = costumeToSerialize.assetId;
|
||||||
|
|
||||||
// serialize this property with the name 'md5ext' because that's
|
// serialize this property with the name 'md5ext' because that's
|
||||||
// what it's actually referring to. TODO runtime objects need to be
|
// what it's actually referring to. TODO runtime objects need to be
|
||||||
// updated to actually refer to this as 'md5ext' instead of 'md5'
|
// updated to actually refer to this as 'md5ext' instead of 'md5'
|
||||||
// but that change should be made carefully since it is very
|
// but that change should be made carefully since it is very
|
||||||
// pervasive
|
// pervasive
|
||||||
obj.md5ext = costumeToSerialize.md5;
|
obj.md5ext = costumeToSerialize.md5;
|
||||||
|
|
||||||
obj.rotationCenterX = costumeToSerialize.rotationCenterX;
|
obj.rotationCenterX = costumeToSerialize.rotationCenterX;
|
||||||
obj.rotationCenterY = costumeToSerialize.rotationCenterY;
|
obj.rotationCenterY = costumeToSerialize.rotationCenterY;
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ const serializeCostume = function (costume) {
|
||||||
const serializeSound = function (sound) {
|
const serializeSound = function (sound) {
|
||||||
const obj = Object.create(null);
|
const obj = Object.create(null);
|
||||||
obj.name = sound.name;
|
obj.name = sound.name;
|
||||||
|
|
||||||
const soundToSerialize = sound.broken || sound;
|
const soundToSerialize = sound.broken || sound;
|
||||||
|
|
||||||
obj.assetId = soundToSerialize.assetId;
|
obj.assetId = soundToSerialize.assetId;
|
||||||
|
@ -1115,7 +1115,7 @@ const deserializeMonitor = function (monitorData, runtime, targets, extensions)
|
||||||
// This will be undefined for extension blocks
|
// This will be undefined for extension blocks
|
||||||
const monitorBlockInfo = runtime.monitorBlockInfo[monitorData.opcode];
|
const monitorBlockInfo = runtime.monitorBlockInfo[monitorData.opcode];
|
||||||
|
|
||||||
// Due to a bug (see https://github.com/LLK/scratch-vm/pull/2322), renamed list monitors may have been serialized
|
// Due to a bug (see https://github.com/scratchfoundation/scratch-vm/pull/2322), renamed list monitors may have been serialized
|
||||||
// with an outdated/incorrect LIST parameter. Fix it up to use the current name of the actual corresponding list.
|
// with an outdated/incorrect LIST parameter. Fix it up to use the current name of the actual corresponding list.
|
||||||
if (monitorData.opcode === 'data_listcontents') {
|
if (monitorData.opcode === 'data_listcontents') {
|
||||||
const listTarget = monitorData.targetId ?
|
const listTarget = monitorData.targetId ?
|
||||||
|
|
|
@ -8,7 +8,7 @@ test('getPrimitives', t => {
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Originally inspired by https://github.com/LLK/scratch-gui/issues/809
|
// Originally inspired by https://github.com/scratchfoundation/scratch-gui/issues/809
|
||||||
test('calling a custom block with no definition does not throw', t => {
|
test('calling a custom block with no definition does not throw', t => {
|
||||||
const args = {
|
const args = {
|
||||||
mutation: {
|
mutation: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue