scratch-vm 4.5.382 → 4.5.384
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
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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.5.384](https://github.com/scratchfoundation/scratch-vm/compare/v4.5.383...v4.5.384) (2024-07-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **deps:** update dependency scratch-l10n to v3.18.241 ([61645a3](https://github.com/scratchfoundation/scratch-vm/commit/61645a35046b03b5a655fd44a59d2864f178c5a5))
|
|
12
|
+
|
|
13
|
+
## [4.5.383](https://github.com/scratchfoundation/scratch-vm/compare/v4.5.382...v4.5.383) (2024-07-30)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **deps:** lock file maintenance ([479e5d8](https://github.com/scratchfoundation/scratch-vm/commit/479e5d871164679c816b5e67fb0cc492b8b921ee))
|
|
19
|
+
|
|
6
20
|
## [4.5.382](https://github.com/scratchfoundation/scratch-vm/compare/v4.5.381...v4.5.382) (2024-07-29)
|
|
7
21
|
|
|
8
22
|
|
package/dist/node/scratch-vm.js
CHANGED
|
@@ -2838,7 +2838,7 @@ const uid = __webpack_require__(/*! ../util/uid */ "./src/util/uid.js");
|
|
|
2838
2838
|
* @param {?string} parent Parent block ID.
|
|
2839
2839
|
* @return {undefined}
|
|
2840
2840
|
*/
|
|
2841
|
-
const
|
|
2841
|
+
const _domToBlock = function domToBlock(blockDOM, blocks, isTopBlock, parent) {
|
|
2842
2842
|
if (!blockDOM.attribs.id) {
|
|
2843
2843
|
blockDOM.attribs.id = uid();
|
|
2844
2844
|
}
|
|
@@ -2931,10 +2931,10 @@ const domToBlock = function domToBlock(blockDOM, blocks, isTopBlock, parent) {
|
|
|
2931
2931
|
case 'statement':
|
|
2932
2932
|
{
|
|
2933
2933
|
// Recursively generate block structure for input block.
|
|
2934
|
-
|
|
2934
|
+
_domToBlock(childBlockNode, blocks, false, block.id);
|
|
2935
2935
|
if (childShadowNode && childBlockNode !== childShadowNode) {
|
|
2936
2936
|
// Also generate the shadow block.
|
|
2937
|
-
|
|
2937
|
+
_domToBlock(childShadowNode, blocks, false, block.id);
|
|
2938
2938
|
}
|
|
2939
2939
|
// Link this block's input to the child block.
|
|
2940
2940
|
const inputName = xmlChild.attribs.name;
|
|
@@ -2952,7 +2952,7 @@ const domToBlock = function domToBlock(blockDOM, blocks, isTopBlock, parent) {
|
|
|
2952
2952
|
continue;
|
|
2953
2953
|
}
|
|
2954
2954
|
// Recursively generate block structure for next block.
|
|
2955
|
-
|
|
2955
|
+
_domToBlock(childBlockNode, blocks, false, block.id);
|
|
2956
2956
|
// Link next block to this block.
|
|
2957
2957
|
block.next = childBlockNode.attribs.id;
|
|
2958
2958
|
break;
|
|
@@ -2983,7 +2983,7 @@ const domToBlocks = function domToBlocks(blocksDOM) {
|
|
|
2983
2983
|
}
|
|
2984
2984
|
const tagName = block.name.toLowerCase();
|
|
2985
2985
|
if (tagName === 'block' || tagName === 'shadow') {
|
|
2986
|
-
|
|
2986
|
+
_domToBlock(block, blocks, true, null);
|
|
2987
2987
|
}
|
|
2988
2988
|
}
|
|
2989
2989
|
// Flatten blocks object into a list.
|
|
@@ -5292,7 +5292,7 @@ const decodeHtml = __webpack_require__(/*! decode-html */ "decode-html");
|
|
|
5292
5292
|
* @param {object} dom DOM object for mutation tag.
|
|
5293
5293
|
* @return {object} Object representing useful parts of this mutation.
|
|
5294
5294
|
*/
|
|
5295
|
-
const
|
|
5295
|
+
const _mutatorTagToObject = function mutatorTagToObject(dom) {
|
|
5296
5296
|
const obj = Object.create(null);
|
|
5297
5297
|
obj.tagName = dom.name;
|
|
5298
5298
|
obj.children = [];
|
|
@@ -5307,7 +5307,7 @@ const mutatorTagToObject = function mutatorTagToObject(dom) {
|
|
|
5307
5307
|
}
|
|
5308
5308
|
}
|
|
5309
5309
|
for (let i = 0; i < dom.children.length; i++) {
|
|
5310
|
-
obj.children.push(
|
|
5310
|
+
obj.children.push(_mutatorTagToObject(dom.children[i]));
|
|
5311
5311
|
}
|
|
5312
5312
|
return obj;
|
|
5313
5313
|
};
|
|
@@ -5326,7 +5326,7 @@ const mutationAdpater = function mutationAdpater(mutation) {
|
|
|
5326
5326
|
} else {
|
|
5327
5327
|
mutationParsed = html.parseDOM(mutation)[0];
|
|
5328
5328
|
}
|
|
5329
|
-
return
|
|
5329
|
+
return _mutatorTagToObject(mutationParsed);
|
|
5330
5330
|
};
|
|
5331
5331
|
module.exports = mutationAdpater;
|
|
5332
5332
|
|
|
@@ -23651,13 +23651,13 @@ const parseProcedureArgIds = function parseProcedureArgIds(procCode) {
|
|
|
23651
23651
|
* @param {Array.<object>} blocks list generated by `parseBlockList`.
|
|
23652
23652
|
* @return {Array.<object>} Flattened list to be passed to `blocks.createBlock`.
|
|
23653
23653
|
*/
|
|
23654
|
-
const
|
|
23654
|
+
const _flatten = function flatten(blocks) {
|
|
23655
23655
|
let finalBlocks = [];
|
|
23656
23656
|
for (let i = 0; i < blocks.length; i++) {
|
|
23657
23657
|
const block = blocks[i];
|
|
23658
23658
|
finalBlocks.push(block);
|
|
23659
23659
|
if (block.children) {
|
|
23660
|
-
finalBlocks = finalBlocks.concat(
|
|
23660
|
+
finalBlocks = finalBlocks.concat(_flatten(block.children));
|
|
23661
23661
|
}
|
|
23662
23662
|
delete block.children;
|
|
23663
23663
|
}
|
|
@@ -23688,7 +23688,7 @@ const parseBlockList = function parseBlockList(blockList, addBroadcastMsg, getVa
|
|
|
23688
23688
|
for (let i = 0; i < blockList.length; i++) {
|
|
23689
23689
|
const block = blockList[i];
|
|
23690
23690
|
// eslint-disable-next-line no-use-before-define
|
|
23691
|
-
const parsedBlockAndComments =
|
|
23691
|
+
const parsedBlockAndComments = _parseBlock(block, addBroadcastMsg, getVariableId, extensions, parseState, comments, commentIndex);
|
|
23692
23692
|
const parsedBlock = parsedBlockAndComments[0];
|
|
23693
23693
|
// Update commentIndex
|
|
23694
23694
|
commentIndex = parsedBlockAndComments[1];
|
|
@@ -23732,7 +23732,7 @@ const parseScripts = function parseScripts(scripts, blocks, addBroadcastMsg, get
|
|
|
23732
23732
|
parsedBlockList[0].parent = null;
|
|
23733
23733
|
}
|
|
23734
23734
|
// Flatten children and create add the blocks.
|
|
23735
|
-
const convertedBlocks =
|
|
23735
|
+
const convertedBlocks = _flatten(parsedBlockList);
|
|
23736
23736
|
for (let j = 0; j < convertedBlocks.length; j++) {
|
|
23737
23737
|
blocks.createBlock(convertedBlocks[j]);
|
|
23738
23738
|
}
|
|
@@ -23854,7 +23854,7 @@ const parseMonitorObject = (object, runtime, targets, extensions) => {
|
|
|
23854
23854
|
// Create var id getter to make block naming/parsing easier, variables already created.
|
|
23855
23855
|
const getVariableId = generateVariableIdGetter(target.id, false);
|
|
23856
23856
|
// eslint-disable-next-line no-use-before-define
|
|
23857
|
-
const [block, _] =
|
|
23857
|
+
const [block, _] = _parseBlock([object.cmd, object.param],
|
|
23858
23858
|
// Scratch 2 monitor blocks only have one param.
|
|
23859
23859
|
null,
|
|
23860
23860
|
// `addBroadcastMsg`, not needed for monitor blocks.
|
|
@@ -23894,7 +23894,7 @@ const parseMonitorObject = (object, runtime, targets, extensions) => {
|
|
|
23894
23894
|
existingMonitorBlock.targetId = block.targetId;
|
|
23895
23895
|
} else {
|
|
23896
23896
|
// Blocks can be created with children, flatten and add to monitorBlocks.
|
|
23897
|
-
const newBlocks =
|
|
23897
|
+
const newBlocks = _flatten([block]);
|
|
23898
23898
|
for (let i = 0; i < newBlocks.length; i++) {
|
|
23899
23899
|
runtime.monitorBlocks.createBlock(newBlocks[i]);
|
|
23900
23900
|
}
|
|
@@ -23947,7 +23947,7 @@ const parseMonitorObject = (object, runtime, targets, extensions) => {
|
|
|
23947
23947
|
* Sprites. As well as a SoundBank for the sound assets. null for unsupported
|
|
23948
23948
|
* objects.
|
|
23949
23949
|
*/
|
|
23950
|
-
const
|
|
23950
|
+
const _parseScratchAssets = function parseScratchAssets(object, runtime, topLevel, zip) {
|
|
23951
23951
|
if (!Object.prototype.hasOwnProperty.call(object, 'objName')) {
|
|
23952
23952
|
// Skip parsing monitors. Or any other objects missing objName.
|
|
23953
23953
|
return null;
|
|
@@ -24043,7 +24043,7 @@ const parseScratchAssets = function parseScratchAssets(object, runtime, topLevel
|
|
|
24043
24043
|
const childrenAssets = assets.children;
|
|
24044
24044
|
if (object.children) {
|
|
24045
24045
|
for (let m = 0; m < object.children.length; m++) {
|
|
24046
|
-
childrenAssets.push(
|
|
24046
|
+
childrenAssets.push(_parseScratchAssets(object.children[m], runtime, false, zip));
|
|
24047
24047
|
}
|
|
24048
24048
|
}
|
|
24049
24049
|
return assets;
|
|
@@ -24061,7 +24061,7 @@ const parseScratchAssets = function parseScratchAssets(object, runtime, topLevel
|
|
|
24061
24061
|
* into costumes and sounds
|
|
24062
24062
|
* @return {!Promise.<Array.<Target>>} Promise for the loaded targets when ready, or null for unsupported objects.
|
|
24063
24063
|
*/
|
|
24064
|
-
const
|
|
24064
|
+
const _parseScratchObject = function parseScratchObject(object, runtime, extensions, topLevel, zip, assets) {
|
|
24065
24065
|
if (!Object.prototype.hasOwnProperty.call(object, 'objName')) {
|
|
24066
24066
|
if (Object.prototype.hasOwnProperty.call(object, 'listName')) {
|
|
24067
24067
|
// Shim these objects so they can be processed as monitors
|
|
@@ -24267,7 +24267,7 @@ const parseScratchObject = function parseScratchObject(object, runtime, extensio
|
|
|
24267
24267
|
const childrenPromises = [];
|
|
24268
24268
|
if (object.children) {
|
|
24269
24269
|
for (let m = 0; m < object.children.length; m++) {
|
|
24270
|
-
childrenPromises.push(
|
|
24270
|
+
childrenPromises.push(_parseScratchObject(object.children[m], runtime, extensions, false, zip, assets.children[m]));
|
|
24271
24271
|
}
|
|
24272
24272
|
}
|
|
24273
24273
|
return Promise.all(costumePromises.concat(soundPromises)).then(() => Promise.all(childrenPromises).then(children => {
|
|
@@ -24359,10 +24359,10 @@ const sb2import = function sb2import(json, runtime, optForceSprite, zip) {
|
|
|
24359
24359
|
extensionIDs: new Set(),
|
|
24360
24360
|
extensionURLs: new Map()
|
|
24361
24361
|
};
|
|
24362
|
-
return Promise.resolve(
|
|
24362
|
+
return Promise.resolve(_parseScratchAssets(json, runtime, !optForceSprite, zip))
|
|
24363
24363
|
// Force this promise to wait for the next loop in the js tick. Let
|
|
24364
24364
|
// storage have some time to send off asset requests.
|
|
24365
|
-
.then(assets => Promise.resolve(assets)).then(assets =>
|
|
24365
|
+
.then(assets => Promise.resolve(assets)).then(assets => _parseScratchObject(json, runtime, extensions, !optForceSprite, zip, assets)).then(reorderParsedTargets).then(targets => ({
|
|
24366
24366
|
targets,
|
|
24367
24367
|
extensions
|
|
24368
24368
|
}));
|
|
@@ -24401,7 +24401,7 @@ const specMapBlock = function specMapBlock(block) {
|
|
|
24401
24401
|
* @return {Array.<object|int>} Tuple where first item is the Scratch VM-format block (or null if unsupported object),
|
|
24402
24402
|
* and second item is the updated comment index (after this block and its children are parsed)
|
|
24403
24403
|
*/
|
|
24404
|
-
const
|
|
24404
|
+
const _parseBlock = function parseBlock(sb2block, addBroadcastMsg, getVariableId, extensions, parseState, comments, commentIndex) {
|
|
24405
24405
|
const commentsForParsedBlock = comments && typeof commentIndex === 'number' && !isNaN(commentIndex) ? comments[commentIndex] : null;
|
|
24406
24406
|
const blockMetadata = specMapBlock(sb2block);
|
|
24407
24407
|
if (!blockMetadata) {
|
|
@@ -24490,7 +24490,7 @@ const parseBlock = function parseBlock(sb2block, addBroadcastMsg, getVariableId,
|
|
|
24490
24490
|
[innerBlocks, commentIndex] = parseBlockList(providedArg, addBroadcastMsg, getVariableId, extensions, parseState, comments, commentIndex);
|
|
24491
24491
|
} else {
|
|
24492
24492
|
// Single block occupies the input.
|
|
24493
|
-
const parsedBlockDesc =
|
|
24493
|
+
const parsedBlockDesc = _parseBlock(providedArg, addBroadcastMsg, getVariableId, extensions, parseState, comments, commentIndex);
|
|
24494
24494
|
innerBlocks = parsedBlockDesc[0] ? [parsedBlockDesc[0]] : [];
|
|
24495
24495
|
// Update commentIndex
|
|
24496
24496
|
commentIndex = parsedBlockDesc[1];
|
|
@@ -32743,7 +32743,7 @@ module.exports = require("uuid");
|
|
|
32743
32743
|
/***/ ((module) => {
|
|
32744
32744
|
|
|
32745
32745
|
"use strict";
|
|
32746
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"scratch-vm","version":"4.5.
|
|
32746
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"scratch-vm","version":"4.5.383","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":"bd28210ee6f51dc9d56d5063a23418f58440335c"},"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.3.102","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.24.9","@babel/eslint-parser":"7.25.0","@babel/preset-env":"7.25.0","@commitlint/cli":"17.8.1","@commitlint/config-conventional":"17.8.1","adm-zip":"0.4.11","babel-loader":"9.1.3","callsite":"1.0.0","copy-webpack-plugin":"4.6.0","docdash":"1.2.0","eslint":"8.57.0","eslint-config-scratch":"9.0.8","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.201","scratch-l10n":"3.18.241","scratch-render-fonts":"1.0.79","scratch-semantic-release-config":"1.0.14","scratch-webpack-configuration":"1.4.0","script-loader":"0.7.2","semantic-release":"19.0.5","stats.js":"0.17.0","tap":"16.3.10","webpack":"5.93.0","webpack-cli":"4.10.0","webpack-dev-server":"3.11.3"}}');
|
|
32747
32747
|
|
|
32748
32748
|
/***/ })
|
|
32749
32749
|
|
package/dist/web/scratch-vm.js
CHANGED
|
@@ -14100,7 +14100,7 @@ const uid = __webpack_require__(/*! ../util/uid */ "./src/util/uid.js");
|
|
|
14100
14100
|
* @param {?string} parent Parent block ID.
|
|
14101
14101
|
* @return {undefined}
|
|
14102
14102
|
*/
|
|
14103
|
-
const
|
|
14103
|
+
const _domToBlock = function domToBlock(blockDOM, blocks, isTopBlock, parent) {
|
|
14104
14104
|
if (!blockDOM.attribs.id) {
|
|
14105
14105
|
blockDOM.attribs.id = uid();
|
|
14106
14106
|
}
|
|
@@ -14193,10 +14193,10 @@ const domToBlock = function domToBlock(blockDOM, blocks, isTopBlock, parent) {
|
|
|
14193
14193
|
case 'statement':
|
|
14194
14194
|
{
|
|
14195
14195
|
// Recursively generate block structure for input block.
|
|
14196
|
-
|
|
14196
|
+
_domToBlock(childBlockNode, blocks, false, block.id);
|
|
14197
14197
|
if (childShadowNode && childBlockNode !== childShadowNode) {
|
|
14198
14198
|
// Also generate the shadow block.
|
|
14199
|
-
|
|
14199
|
+
_domToBlock(childShadowNode, blocks, false, block.id);
|
|
14200
14200
|
}
|
|
14201
14201
|
// Link this block's input to the child block.
|
|
14202
14202
|
const inputName = xmlChild.attribs.name;
|
|
@@ -14214,7 +14214,7 @@ const domToBlock = function domToBlock(blockDOM, blocks, isTopBlock, parent) {
|
|
|
14214
14214
|
continue;
|
|
14215
14215
|
}
|
|
14216
14216
|
// Recursively generate block structure for next block.
|
|
14217
|
-
|
|
14217
|
+
_domToBlock(childBlockNode, blocks, false, block.id);
|
|
14218
14218
|
// Link next block to this block.
|
|
14219
14219
|
block.next = childBlockNode.attribs.id;
|
|
14220
14220
|
break;
|
|
@@ -14245,7 +14245,7 @@ const domToBlocks = function domToBlocks(blocksDOM) {
|
|
|
14245
14245
|
}
|
|
14246
14246
|
const tagName = block.name.toLowerCase();
|
|
14247
14247
|
if (tagName === 'block' || tagName === 'shadow') {
|
|
14248
|
-
|
|
14248
|
+
_domToBlock(block, blocks, true, null);
|
|
14249
14249
|
}
|
|
14250
14250
|
}
|
|
14251
14251
|
// Flatten blocks object into a list.
|
|
@@ -16554,7 +16554,7 @@ const decodeHtml = __webpack_require__(/*! decode-html */ "./node_modules/decode
|
|
|
16554
16554
|
* @param {object} dom DOM object for mutation tag.
|
|
16555
16555
|
* @return {object} Object representing useful parts of this mutation.
|
|
16556
16556
|
*/
|
|
16557
|
-
const
|
|
16557
|
+
const _mutatorTagToObject = function mutatorTagToObject(dom) {
|
|
16558
16558
|
const obj = Object.create(null);
|
|
16559
16559
|
obj.tagName = dom.name;
|
|
16560
16560
|
obj.children = [];
|
|
@@ -16569,7 +16569,7 @@ const mutatorTagToObject = function mutatorTagToObject(dom) {
|
|
|
16569
16569
|
}
|
|
16570
16570
|
}
|
|
16571
16571
|
for (let i = 0; i < dom.children.length; i++) {
|
|
16572
|
-
obj.children.push(
|
|
16572
|
+
obj.children.push(_mutatorTagToObject(dom.children[i]));
|
|
16573
16573
|
}
|
|
16574
16574
|
return obj;
|
|
16575
16575
|
};
|
|
@@ -16588,7 +16588,7 @@ const mutationAdpater = function mutationAdpater(mutation) {
|
|
|
16588
16588
|
} else {
|
|
16589
16589
|
mutationParsed = html.parseDOM(mutation)[0];
|
|
16590
16590
|
}
|
|
16591
|
-
return
|
|
16591
|
+
return _mutatorTagToObject(mutationParsed);
|
|
16592
16592
|
};
|
|
16593
16593
|
module.exports = mutationAdpater;
|
|
16594
16594
|
|
|
@@ -34896,13 +34896,13 @@ const parseProcedureArgIds = function parseProcedureArgIds(procCode) {
|
|
|
34896
34896
|
* @param {Array.<object>} blocks list generated by `parseBlockList`.
|
|
34897
34897
|
* @return {Array.<object>} Flattened list to be passed to `blocks.createBlock`.
|
|
34898
34898
|
*/
|
|
34899
|
-
const
|
|
34899
|
+
const _flatten = function flatten(blocks) {
|
|
34900
34900
|
let finalBlocks = [];
|
|
34901
34901
|
for (let i = 0; i < blocks.length; i++) {
|
|
34902
34902
|
const block = blocks[i];
|
|
34903
34903
|
finalBlocks.push(block);
|
|
34904
34904
|
if (block.children) {
|
|
34905
|
-
finalBlocks = finalBlocks.concat(
|
|
34905
|
+
finalBlocks = finalBlocks.concat(_flatten(block.children));
|
|
34906
34906
|
}
|
|
34907
34907
|
delete block.children;
|
|
34908
34908
|
}
|
|
@@ -34933,7 +34933,7 @@ const parseBlockList = function parseBlockList(blockList, addBroadcastMsg, getVa
|
|
|
34933
34933
|
for (let i = 0; i < blockList.length; i++) {
|
|
34934
34934
|
const block = blockList[i];
|
|
34935
34935
|
// eslint-disable-next-line no-use-before-define
|
|
34936
|
-
const parsedBlockAndComments =
|
|
34936
|
+
const parsedBlockAndComments = _parseBlock(block, addBroadcastMsg, getVariableId, extensions, parseState, comments, commentIndex);
|
|
34937
34937
|
const parsedBlock = parsedBlockAndComments[0];
|
|
34938
34938
|
// Update commentIndex
|
|
34939
34939
|
commentIndex = parsedBlockAndComments[1];
|
|
@@ -34977,7 +34977,7 @@ const parseScripts = function parseScripts(scripts, blocks, addBroadcastMsg, get
|
|
|
34977
34977
|
parsedBlockList[0].parent = null;
|
|
34978
34978
|
}
|
|
34979
34979
|
// Flatten children and create add the blocks.
|
|
34980
|
-
const convertedBlocks =
|
|
34980
|
+
const convertedBlocks = _flatten(parsedBlockList);
|
|
34981
34981
|
for (let j = 0; j < convertedBlocks.length; j++) {
|
|
34982
34982
|
blocks.createBlock(convertedBlocks[j]);
|
|
34983
34983
|
}
|
|
@@ -35099,7 +35099,7 @@ const parseMonitorObject = (object, runtime, targets, extensions) => {
|
|
|
35099
35099
|
// Create var id getter to make block naming/parsing easier, variables already created.
|
|
35100
35100
|
const getVariableId = generateVariableIdGetter(target.id, false);
|
|
35101
35101
|
// eslint-disable-next-line no-use-before-define
|
|
35102
|
-
const [block, _] =
|
|
35102
|
+
const [block, _] = _parseBlock([object.cmd, object.param],
|
|
35103
35103
|
// Scratch 2 monitor blocks only have one param.
|
|
35104
35104
|
null,
|
|
35105
35105
|
// `addBroadcastMsg`, not needed for monitor blocks.
|
|
@@ -35139,7 +35139,7 @@ const parseMonitorObject = (object, runtime, targets, extensions) => {
|
|
|
35139
35139
|
existingMonitorBlock.targetId = block.targetId;
|
|
35140
35140
|
} else {
|
|
35141
35141
|
// Blocks can be created with children, flatten and add to monitorBlocks.
|
|
35142
|
-
const newBlocks =
|
|
35142
|
+
const newBlocks = _flatten([block]);
|
|
35143
35143
|
for (let i = 0; i < newBlocks.length; i++) {
|
|
35144
35144
|
runtime.monitorBlocks.createBlock(newBlocks[i]);
|
|
35145
35145
|
}
|
|
@@ -35192,7 +35192,7 @@ const parseMonitorObject = (object, runtime, targets, extensions) => {
|
|
|
35192
35192
|
* Sprites. As well as a SoundBank for the sound assets. null for unsupported
|
|
35193
35193
|
* objects.
|
|
35194
35194
|
*/
|
|
35195
|
-
const
|
|
35195
|
+
const _parseScratchAssets = function parseScratchAssets(object, runtime, topLevel, zip) {
|
|
35196
35196
|
if (!Object.prototype.hasOwnProperty.call(object, 'objName')) {
|
|
35197
35197
|
// Skip parsing monitors. Or any other objects missing objName.
|
|
35198
35198
|
return null;
|
|
@@ -35288,7 +35288,7 @@ const parseScratchAssets = function parseScratchAssets(object, runtime, topLevel
|
|
|
35288
35288
|
const childrenAssets = assets.children;
|
|
35289
35289
|
if (object.children) {
|
|
35290
35290
|
for (let m = 0; m < object.children.length; m++) {
|
|
35291
|
-
childrenAssets.push(
|
|
35291
|
+
childrenAssets.push(_parseScratchAssets(object.children[m], runtime, false, zip));
|
|
35292
35292
|
}
|
|
35293
35293
|
}
|
|
35294
35294
|
return assets;
|
|
@@ -35306,7 +35306,7 @@ const parseScratchAssets = function parseScratchAssets(object, runtime, topLevel
|
|
|
35306
35306
|
* into costumes and sounds
|
|
35307
35307
|
* @return {!Promise.<Array.<Target>>} Promise for the loaded targets when ready, or null for unsupported objects.
|
|
35308
35308
|
*/
|
|
35309
|
-
const
|
|
35309
|
+
const _parseScratchObject = function parseScratchObject(object, runtime, extensions, topLevel, zip, assets) {
|
|
35310
35310
|
if (!Object.prototype.hasOwnProperty.call(object, 'objName')) {
|
|
35311
35311
|
if (Object.prototype.hasOwnProperty.call(object, 'listName')) {
|
|
35312
35312
|
// Shim these objects so they can be processed as monitors
|
|
@@ -35512,7 +35512,7 @@ const parseScratchObject = function parseScratchObject(object, runtime, extensio
|
|
|
35512
35512
|
const childrenPromises = [];
|
|
35513
35513
|
if (object.children) {
|
|
35514
35514
|
for (let m = 0; m < object.children.length; m++) {
|
|
35515
|
-
childrenPromises.push(
|
|
35515
|
+
childrenPromises.push(_parseScratchObject(object.children[m], runtime, extensions, false, zip, assets.children[m]));
|
|
35516
35516
|
}
|
|
35517
35517
|
}
|
|
35518
35518
|
return Promise.all(costumePromises.concat(soundPromises)).then(() => Promise.all(childrenPromises).then(children => {
|
|
@@ -35604,10 +35604,10 @@ const sb2import = function sb2import(json, runtime, optForceSprite, zip) {
|
|
|
35604
35604
|
extensionIDs: new Set(),
|
|
35605
35605
|
extensionURLs: new Map()
|
|
35606
35606
|
};
|
|
35607
|
-
return Promise.resolve(
|
|
35607
|
+
return Promise.resolve(_parseScratchAssets(json, runtime, !optForceSprite, zip))
|
|
35608
35608
|
// Force this promise to wait for the next loop in the js tick. Let
|
|
35609
35609
|
// storage have some time to send off asset requests.
|
|
35610
|
-
.then(assets => Promise.resolve(assets)).then(assets =>
|
|
35610
|
+
.then(assets => Promise.resolve(assets)).then(assets => _parseScratchObject(json, runtime, extensions, !optForceSprite, zip, assets)).then(reorderParsedTargets).then(targets => ({
|
|
35611
35611
|
targets,
|
|
35612
35612
|
extensions
|
|
35613
35613
|
}));
|
|
@@ -35646,7 +35646,7 @@ const specMapBlock = function specMapBlock(block) {
|
|
|
35646
35646
|
* @return {Array.<object|int>} Tuple where first item is the Scratch VM-format block (or null if unsupported object),
|
|
35647
35647
|
* and second item is the updated comment index (after this block and its children are parsed)
|
|
35648
35648
|
*/
|
|
35649
|
-
const
|
|
35649
|
+
const _parseBlock = function parseBlock(sb2block, addBroadcastMsg, getVariableId, extensions, parseState, comments, commentIndex) {
|
|
35650
35650
|
const commentsForParsedBlock = comments && typeof commentIndex === 'number' && !isNaN(commentIndex) ? comments[commentIndex] : null;
|
|
35651
35651
|
const blockMetadata = specMapBlock(sb2block);
|
|
35652
35652
|
if (!blockMetadata) {
|
|
@@ -35735,7 +35735,7 @@ const parseBlock = function parseBlock(sb2block, addBroadcastMsg, getVariableId,
|
|
|
35735
35735
|
[innerBlocks, commentIndex] = parseBlockList(providedArg, addBroadcastMsg, getVariableId, extensions, parseState, comments, commentIndex);
|
|
35736
35736
|
} else {
|
|
35737
35737
|
// Single block occupies the input.
|
|
35738
|
-
const parsedBlockDesc =
|
|
35738
|
+
const parsedBlockDesc = _parseBlock(providedArg, addBroadcastMsg, getVariableId, extensions, parseState, comments, commentIndex);
|
|
35739
35739
|
innerBlocks = parsedBlockDesc[0] ? [parsedBlockDesc[0]] : [];
|
|
35740
35740
|
// Update commentIndex
|
|
35741
35741
|
commentIndex = parsedBlockDesc[1];
|
|
@@ -79512,7 +79512,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"menuMap":{"cs":[{"code":"am","name":
|
|
|
79512
79512
|
/***/ ((module) => {
|
|
79513
79513
|
|
|
79514
79514
|
"use strict";
|
|
79515
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"scratch-vm","version":"4.5.
|
|
79515
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"scratch-vm","version":"4.5.383","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":"bd28210ee6f51dc9d56d5063a23418f58440335c"},"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.3.102","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.24.9","@babel/eslint-parser":"7.25.0","@babel/preset-env":"7.25.0","@commitlint/cli":"17.8.1","@commitlint/config-conventional":"17.8.1","adm-zip":"0.4.11","babel-loader":"9.1.3","callsite":"1.0.0","copy-webpack-plugin":"4.6.0","docdash":"1.2.0","eslint":"8.57.0","eslint-config-scratch":"9.0.8","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.201","scratch-l10n":"3.18.241","scratch-render-fonts":"1.0.79","scratch-semantic-release-config":"1.0.14","scratch-webpack-configuration":"1.4.0","script-loader":"0.7.2","semantic-release":"19.0.5","stats.js":"0.17.0","tap":"16.3.10","webpack":"5.93.0","webpack-cli":"4.10.0","webpack-dev-server":"3.11.3"}}');
|
|
79516
79516
|
|
|
79517
79517
|
/***/ })
|
|
79518
79518
|
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scratch-vm",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.384",
|
|
4
4
|
"description": "Virtual Machine for Scratch 3.0",
|
|
5
5
|
"author": "Massachusetts Institute of Technology",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/scratchfoundation/scratch-vm.git",
|
|
11
|
-
"sha": "
|
|
11
|
+
"sha": "f34509ef7be56e53b02a4e6f1f889ddf6f8b2b74"
|
|
12
12
|
},
|
|
13
13
|
"main": "./dist/node/scratch-vm.js",
|
|
14
14
|
"browser": "./dist/web/scratch-vm.js",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/core": "7.24.9",
|
|
81
|
-
"@babel/eslint-parser": "7.
|
|
82
|
-
"@babel/preset-env": "7.
|
|
81
|
+
"@babel/eslint-parser": "7.25.0",
|
|
82
|
+
"@babel/preset-env": "7.25.0",
|
|
83
83
|
"@commitlint/cli": "17.8.1",
|
|
84
84
|
"@commitlint/config-conventional": "17.8.1",
|
|
85
85
|
"adm-zip": "0.4.11",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"json": "^9.0.4",
|
|
100
100
|
"pngjs": "3.4.0",
|
|
101
101
|
"scratch-blocks": "1.1.201",
|
|
102
|
-
"scratch-l10n": "3.18.
|
|
102
|
+
"scratch-l10n": "3.18.241",
|
|
103
103
|
"scratch-render-fonts": "1.0.79",
|
|
104
104
|
"scratch-semantic-release-config": "1.0.14",
|
|
105
105
|
"scratch-webpack-configuration": "1.4.0",
|