scratch-vm 4.8.32 → 4.8.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/node/scratch-vm.js +28 -14
- package/dist/node/scratch-vm.js.map +1 -1
- package/dist/web/scratch-vm.js +28 -14
- package/dist/web/scratch-vm.js.map +1 -1
- package/package.json +8 -8
- package/src/engine/blocks.js +297 -109
- package/src/engine/runtime.js +398 -177
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.8.33](https://github.com/scratchfoundation/scratch-vm/compare/v4.8.32...v4.8.33) (2024-10-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **deps:** update dependency scratch-l10n to v3.18.339 ([51aa6bc](https://github.com/scratchfoundation/scratch-vm/commit/51aa6bc9b2e5b91a520a7a322f5667dc3ea526b4))
|
|
12
|
+
* **deps:** update dependency scratch-l10n to v3.18.341 ([e801215](https://github.com/scratchfoundation/scratch-vm/commit/e80121577f845620912f6f2734797020ae6f3e51))
|
|
13
|
+
* **deps:** update dependency scratch-render-fonts to v1.0.112 ([883ed15](https://github.com/scratchfoundation/scratch-vm/commit/883ed159b4c1f29eff0ed3ae7f15604ddd8ad7a7))
|
|
14
|
+
* **deps:** update dependency scratch-render-fonts to v1.0.113 ([55e9355](https://github.com/scratchfoundation/scratch-vm/commit/55e9355504ea25c7cc38a839723bbc201e37d685))
|
|
15
|
+
* **deps:** update dependency scratch-svg-renderer to v2.5.13 ([8b42e5e](https://github.com/scratchfoundation/scratch-vm/commit/8b42e5e4ae32840af82ed137edc66e4ff4d6bc2d))
|
|
16
|
+
* **deps:** update dependency scratch-svg-renderer to v2.5.14 ([05b03bf](https://github.com/scratchfoundation/scratch-vm/commit/05b03bfa5ba0c08d1c6f2fa5f9b01069c2ba215d))
|
|
17
|
+
* **deps:** update dependency scratch-svg-renderer to v2.5.15 ([a230323](https://github.com/scratchfoundation/scratch-vm/commit/a230323f1256fc3fa4741cd501de3c6abe84144a))
|
|
18
|
+
|
|
6
19
|
## [4.8.32](https://github.com/scratchfoundation/scratch-vm/compare/v4.8.31...v4.8.32) (2024-10-11)
|
|
7
20
|
|
|
8
21
|
|
package/dist/node/scratch-vm.js
CHANGED
|
@@ -4142,10 +4142,10 @@ class Blocks {
|
|
|
4142
4142
|
}
|
|
4143
4143
|
|
|
4144
4144
|
/**
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4145
|
+
* Get the next block for a particular block
|
|
4146
|
+
* @param {?string} id ID of block to get the next block for
|
|
4147
|
+
* @return {?string} ID of next block in the sequence
|
|
4148
|
+
*/
|
|
4149
4149
|
getNextBlock(id) {
|
|
4150
4150
|
const block = this._blocks[id];
|
|
4151
4151
|
return typeof block === 'undefined' ? null : block.next;
|
|
@@ -4245,7 +4245,9 @@ class Blocks {
|
|
|
4245
4245
|
return blockID;
|
|
4246
4246
|
}
|
|
4247
4247
|
for (const id in this._blocks) {
|
|
4248
|
-
if (!Object.prototype.hasOwnProperty.call(this._blocks, id))
|
|
4248
|
+
if (!Object.prototype.hasOwnProperty.call(this._blocks, id)) {
|
|
4249
|
+
continue;
|
|
4250
|
+
}
|
|
4249
4251
|
const block = this._blocks[id];
|
|
4250
4252
|
if (block.opcode === 'procedures_definition') {
|
|
4251
4253
|
const internal = this._getCustomBlockInternal(block);
|
|
@@ -4279,7 +4281,9 @@ class Blocks {
|
|
|
4279
4281
|
return cachedNames;
|
|
4280
4282
|
}
|
|
4281
4283
|
for (const id in this._blocks) {
|
|
4282
|
-
if (!Object.prototype.hasOwnProperty.call(this._blocks, id))
|
|
4284
|
+
if (!Object.prototype.hasOwnProperty.call(this._blocks, id)) {
|
|
4285
|
+
continue;
|
|
4286
|
+
}
|
|
4283
4287
|
const block = this._blocks[id];
|
|
4284
4288
|
if (block.opcode === 'procedures_prototype' && block.mutation.proccode === name) {
|
|
4285
4289
|
const names = JSON.parse(block.mutation.argumentnames);
|
|
@@ -4474,7 +4478,7 @@ class Blocks {
|
|
|
4474
4478
|
if (this.runtime.getEditingTarget()) {
|
|
4475
4479
|
const currTarget = this.runtime.getEditingTarget();
|
|
4476
4480
|
if (currTarget && !Object.prototype.hasOwnProperty.call(currTarget.comments, e.commentId)) {
|
|
4477
|
-
log.warn("Cannot
|
|
4481
|
+
log.warn("Cannot move comment with id ".concat(e.commentId, " because it does not exist."));
|
|
4478
4482
|
return;
|
|
4479
4483
|
}
|
|
4480
4484
|
const comment = currTarget.comments[e.commentId];
|
|
@@ -4564,7 +4568,9 @@ class Blocks {
|
|
|
4564
4568
|
*/
|
|
4565
4569
|
changeBlock(args) {
|
|
4566
4570
|
// Validate
|
|
4567
|
-
if (['field', 'mutation', 'checkbox'].indexOf(args.element) === -1)
|
|
4571
|
+
if (['field', 'mutation', 'checkbox'].indexOf(args.element) === -1) {
|
|
4572
|
+
return;
|
|
4573
|
+
}
|
|
4568
4574
|
let block = this._blocks[args.id];
|
|
4569
4575
|
if (typeof block === 'undefined') return;
|
|
4570
4576
|
switch (args.element) {
|
|
@@ -4622,9 +4628,9 @@ class Blocks {
|
|
|
4622
4628
|
if (block.fields && Object.keys(block.fields).length > 0 && block.opcode !== 'data_variable' && block.opcode !== 'data_listcontents') {
|
|
4623
4629
|
// This block has an argument which needs to get separated out into
|
|
4624
4630
|
// multiple monitor blocks with ids based on the selected argument
|
|
4625
|
-
const newId = getMonitorIdForBlockWithArgs(block.id, block.fields);
|
|
4626
4631
|
// Note: we're not just constantly creating a longer and longer id everytime we check
|
|
4627
4632
|
// the checkbox because we're using the id of the block in the flyout as the base
|
|
4633
|
+
const newId = getMonitorIdForBlockWithArgs(block.id, block.fields);
|
|
4628
4634
|
|
|
4629
4635
|
// check if a block with the new id already exists, otherwise create
|
|
4630
4636
|
let newBlock = this.runtime.monitorBlocks.getBlock(newId);
|
|
@@ -5075,7 +5081,9 @@ class Blocks {
|
|
|
5075
5081
|
}
|
|
5076
5082
|
// Add any inputs on this block.
|
|
5077
5083
|
for (const input in block.inputs) {
|
|
5078
|
-
if (!Object.prototype.hasOwnProperty.call(block.inputs, input))
|
|
5084
|
+
if (!Object.prototype.hasOwnProperty.call(block.inputs, input)) {
|
|
5085
|
+
continue;
|
|
5086
|
+
}
|
|
5079
5087
|
const blockInput = block.inputs[input];
|
|
5080
5088
|
// Only encode a value tag if the value input is occupied.
|
|
5081
5089
|
if (blockInput.block || blockInput.shadow) {
|
|
@@ -5092,7 +5100,9 @@ class Blocks {
|
|
|
5092
5100
|
}
|
|
5093
5101
|
// Add any fields on this block.
|
|
5094
5102
|
for (const field in block.fields) {
|
|
5095
|
-
if (!Object.prototype.hasOwnProperty.call(block.fields, field))
|
|
5103
|
+
if (!Object.prototype.hasOwnProperty.call(block.fields, field)) {
|
|
5104
|
+
continue;
|
|
5105
|
+
}
|
|
5096
5106
|
const blockField = block.fields[field];
|
|
5097
5107
|
xmlString += "<field name=\"".concat(blockField.name, "\"");
|
|
5098
5108
|
const fieldId = blockField.id;
|
|
@@ -8105,7 +8115,9 @@ class Runtime extends EventEmitter {
|
|
|
8105
8115
|
// Look up metadata for the relevant hat.
|
|
8106
8116
|
const hatMeta = instance._hats[requestedHatOpcode];
|
|
8107
8117
|
for (const opts in optMatchFields) {
|
|
8108
|
-
if (!Object.prototype.hasOwnProperty.call(optMatchFields, opts))
|
|
8118
|
+
if (!Object.prototype.hasOwnProperty.call(optMatchFields, opts)) {
|
|
8119
|
+
continue;
|
|
8120
|
+
}
|
|
8109
8121
|
optMatchFields[opts] = optMatchFields[opts].toUpperCase();
|
|
8110
8122
|
}
|
|
8111
8123
|
|
|
@@ -8365,7 +8377,9 @@ class Runtime extends EventEmitter {
|
|
|
8365
8377
|
|
|
8366
8378
|
// Find all edge-activated hats, and add them to threads to be evaluated.
|
|
8367
8379
|
for (const hatType in this._hats) {
|
|
8368
|
-
if (!Object.prototype.hasOwnProperty.call(this._hats, hatType))
|
|
8380
|
+
if (!Object.prototype.hasOwnProperty.call(this._hats, hatType)) {
|
|
8381
|
+
continue;
|
|
8382
|
+
}
|
|
8369
8383
|
const hat = this._hats[hatType];
|
|
8370
8384
|
if (hat.edgeActivated) {
|
|
8371
8385
|
this.startHats(hatType);
|
|
@@ -32707,7 +32721,7 @@ module.exports = require("uuid");
|
|
|
32707
32721
|
/***/ ((module) => {
|
|
32708
32722
|
|
|
32709
32723
|
"use strict";
|
|
32710
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"scratch-vm","version":"4.8.
|
|
32724
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"scratch-vm","version":"4.8.32","description":"Virtual Machine for Scratch 3.0","author":"Massachusetts Institute of Technology","license":"BSD-3-Clause","homepage":"https://github.com/scratchfoundation/scratch-vm#readme","repository":{"type":"git","url":"https://github.com/scratchfoundation/scratch-vm.git","sha":"960584cefab4f3708b6675d51c5eb94320e626c5"},"main":"./dist/node/scratch-vm.js","browser":"./dist/web/scratch-vm.js","exports":{"webpack":"./src/index.js","browser":"./dist/web/scratch-vm.js","node":"./dist/node/scratch-vm.js","default":"./src/index.js"},"scripts":{"build":"npm run docs && webpack --progress","coverage":"tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov","docs":"jsdoc -c .jsdoc.json","i18n:src":"mkdirp translations/core && format-message extract --out-file translations/core/en.json src/extensions/**/index.js","i18n:push":"tx-push-src scratch-editor extensions translations/core/en.json","lint":"eslint . && format-message lint src/**/*.js","prepare":"husky install","prepublish":"in-publish && npm run build || not-in-publish","start":"webpack serve","tap":"tap ./test/{unit,integration}/*.js","tap:unit":"tap ./test/unit/*.js","tap:integration":"tap ./test/integration/*.js","test":"npm run lint && npm run tap","watch":"webpack --progress --watch","version":"json -f package.json -I -e \\"this.repository.sha = \'$(git log -n1 --pretty=format:%H)\'\\""},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"browserslist":["Chrome >= 63","Edge >= 15","Firefox >= 57","Safari >= 11"],"tap":{"branches":60,"functions":70,"lines":70,"statements":70},"dependencies":{"@vernier/godirect":"^1.5.0","arraybuffer-loader":"^1.0.6","atob":"^2.1.2","btoa":"^1.2.1","canvas-toBlob":"^1.0.0","decode-html":"^2.0.0","diff-match-patch":"^1.0.4","format-message":"^6.2.1","htmlparser2":"^3.10.0","immutable":"^3.8.1","jszip":"^3.1.5","minilog":"^3.1.0","scratch-audio":"^1.0.6","scratch-parser":"^5.1.1","scratch-render":"^1.0.232","scratch-sb1-converter":"^1.0.0","scratch-storage":"^2.3.5","scratch-svg-renderer":"2.5.15","scratch-translate-extension-languages":"^1.0.0","text-encoding":"^0.7.0","uuid":"^8.3.2","web-worker":"^1.3.0"},"devDependencies":{"@babel/core":"7.25.8","@babel/eslint-parser":"7.25.8","@babel/preset-env":"7.25.8","@commitlint/cli":"17.8.1","@commitlint/config-conventional":"17.8.1","adm-zip":"0.4.11","babel-loader":"9.2.1","callsite":"1.0.0","copy-webpack-plugin":"4.6.0","docdash":"1.2.0","eslint":"8.57.1","eslint-config-scratch":"9.0.9","expose-loader":"1.0.3","file-loader":"6.2.0","format-message-cli":"6.2.4","husky":"8.0.3","in-publish":"2.0.1","js-md5":"0.7.3","jsdoc":"3.6.11","json":"^9.0.4","pngjs":"3.4.0","scratch-blocks":"1.1.206","scratch-l10n":"3.18.341","scratch-render-fonts":"1.0.113","scratch-semantic-release-config":"1.0.16","scratch-webpack-configuration":"1.6.0","script-loader":"0.7.2","semantic-release":"19.0.5","stats.js":"0.17.0","tap":"16.3.10","webpack":"5.95.0","webpack-cli":"4.10.0","webpack-dev-server":"3.11.3"}}');
|
|
32711
32725
|
|
|
32712
32726
|
/***/ })
|
|
32713
32727
|
|