652 Commits
Author SHA1 Message Date
Thomas Weber ce39f140de Improve extension error handling (#399)
* Improve extension error handling
* Allow loading the extension again if it fails
2026-10-31 14:15:08 -05:00
Thomas Weber f26ff67e95 Fix some limited prototype pollution 2026-10-23 23:46:39 -05:00
Thomas Weber 7387fa0883 Replace tap with node:test (#393) 2026-10-18 14:43:49 -05:00
Thomas Weber 3aca9363a3 Optimize jsexecute helpers (#389)
* replace Number.isNaN -> x !== x (see https://github.com/TurboWarp/scratch-vm/pull/367 for background on this though it matters less than expected)
 * optimize listGet for numbers
 * optimize listReplace for numbers
 * optimize listDelete for first and last items
 * optimize listContains / listIndexOf by hoisting work that would previously happened inside compareEqual many times
2026-10-18 13:29:37 -05:00
Thomas Weber cb8a394fca Actually delete assets when unloaded (#382) 2026-10-11 17:17:55 -05:00
Thomas Weber 87e13f8012 Fix target hidden class falling back to dictionary mode (#385)
Significant performance improvement in Chrome
2026-10-11 17:07:44 -05:00
Thomas Weber 1fd83b48dd Use new hidden class per variable (#378) 2026-10-03 20:03:38 -05:00
Thomas Weber c4823421cb Fix toggleScript confusion when block ID is reused across targets (#347) 2026-07-11 23:29:37 -05:00
Thomas Weber 925f113400 Don't start monitors if there are no targets
Fixes https://github.com/TurboWarp/sb3fix/issues/125 in the safest way that
hopefully has no unforseen breakages on weird behaviors
2026-05-16 01:42:59 -05:00
Thomas Weber 9f2106a290 Remove variable value safe stringification
I thought this may have been part of fixing a sb2 -> sb3 corruption issue.
But from commit log, it seems this was added to prevent extensions from making mistakes.
With the scratch-parser change, those mistakes are now considered features.
Seems safe to just do remove these checks all the time.
Closes https://github.com/TurboWarp/scratch-vm/pull/332
2026-03-02 22:43:29 -06:00
Thomas Weber d825b5017f add sensing_online 2026-01-24 14:01:42 -06:00
Thomas Weber 464a9c68dd Support JS Map in externalDeltaToJS for extension compatibility
Nothing in Scratch uses this
2026-01-13 19:09:49 -06:00
Thomas Weber 6abc33d787 Remove immutable.js (#329)
Why:
* We use immutable.js 3.8.2 which is ancient and not getting updates
* immutable.js adds 55KB to the bundle, of which we use almost nothing
* immutable.js's treatment of 0 and -0 is nonsensical and would require weird workarounds like https://github.com/TurboWarp/scratch-vm/pull/320
* We don't benefit from the whole immutability thing

What we're doing instead:
* We have our own MonitorState and MonitorRecord classes
* We track dirty-ness at modification time instead of equality checking every tick
* scratch-gui and packager can continue to think we use immutable.js without causing issues in either direction
  * our objects have enough stubs that immutable.js-expecting consumers are ok
  * when receiving an object, we check if it looks like an immutable.js one and ask for the plain JS version so that works okay too
2026-01-09 22:30:18 -06:00
Thomas Weber 553a2a434d Use safe stringify from -gui for visual reports
Fixes stringifying -0, objects, arrays
2026-01-09 22:23:46 -06:00
8to16 36bf998aee Fix evalAndReturn with comments at the bottom of a script (#322)
This is because beepbox's script:
https://cdn.jsdelivr.net/npm/beepbox@4.2.0/global/beepbox_synth.min.js
has a sourceMappingURL comment at the bottom for whatever
reason, causing it to become
//# sourceMappingURL=beepbox_synth.min.js.map;return beepbox;
This is obviously going to break and might also be the case with
other libraries too, hot just beepbox.

Ported from AmpMod:
https://codeberg.org/ampmod/ampmod/commit/0daf1021bdc8e67a1f0d08b91ce500605fcaa711
2025-12-15 18:51:13 -06:00
Thomas Weber 4187f550a0 Record which keys the project has used
Related to https://github.com/TurboWarp/scratch-gui/issues/1106
2025-11-15 19:00:15 -06:00
Thomas Weber 92adc762d9 Merge pull request #313 from TurboWarp/update-languages
Update scratch-translate-extension-languages to 1.0.7
2025-11-01 20:36:39 -05:00
Thomas Weber 475ffd0cb4 Update scratch-translate-extension-languages to 1.0.7 2025-11-01 19:18:12 -05:00
Thomas Weber 55674f82ee Implement Scratch.external - VM part (#308) 2025-10-18 23:43:22 -05:00
ghost 5bc497aabb Add blockShape option to extensions (#210) 2025-05-20 21:48:52 -05:00
Thomas Weber f957e1c6c1 Fix Mouse.postData error if called before project loads 2025-05-20 13:29:44 -05:00
Thomas Weber c3b60f6fb6 Add Scratch.download API 2024-12-22 17:46:17 -06:00
Thomas Weber fdd954c012 Add URL argument to Scratch.canDownload
This lets us filter out javascript: URLs
2024-12-22 17:46:09 -06:00
Thomas Weber 1a578aa44e Add canDownload API
https://github.com/TurboWarp/scratch-gui/issues/969
2024-12-22 11:51:26 -06:00
Muffin 9e6993de27 Add restricted fonts and case insensitivity to font manager (#231) 2024-11-02 21:39:44 -05:00
Muffin 99ff662f7f Don't emit STAGE_SIZE_CHANGED if stage size didn't change
and also fix the other STAGE_SIZE_CHANGED event test to
actually test that it is being fired when there is a change
2024-07-31 15:16:44 -05:00
Muffin d69256aa2d Replace jszip with @turbowarp/jszip 2024-05-19 21:58:36 -05:00
KyleKartandMuffin ce04eafec0 Add boolean argument support to ScratchX compatibility layer (#208)
Co-authored-by: Muffin <muffin@muffin.ink>
2024-05-09 00:46:18 -05:00
Muffin 11eec6604d Allow scratch-gui (and others) to extend unsandboxed extension APIs 2024-04-06 16:01:31 -05:00
GarboMuffin 20f25f252c interpreter: Do not re-evaluate procedure arguments after stop this script or return (#202)
"stop this script" and "return" would previously cause all the procedure
arguments to be re-evaluated and then discarded. In vanilla Scratch the
worst case is a performance penalty, but with our custom reporters it
can cause infinite loops.

Fixes https://github.com/TurboWarp/scratch-vm/issues/201
2024-03-30 17:53:13 -05:00
Muffin 9657efb1d4 Shorten Base64Util test cases
1000000 items is very slow; the tests take about 4 seconds on my machine.
2024-02-10 01:42:16 -06:00
tpsntandMuffin 845c374f72 Fix WeDo2.send sends empty message (#192)
* Fix WeDo2.send sends empty message

WeDo2.send invokes Base64Util.uint8ArrayToBase64(message). However message.arrayLength === undefined. This causes Base64Util.uint8ArrayToBase64 always returning empty string ''.

* Move the fix to base64-util instead

---------

Co-authored-by: Muffin <muffin@mailbox.org>
2024-02-10 01:40:36 -06:00
Muffin 96225163c1 Fix tests in Node 21 and later 2024-02-02 21:25:58 -06:00
Muffin 9511cc4000 Remove note/drum concurrency limit when misc limits are removed 2024-01-13 21:58:18 -06:00
Muffin b7e9016c56 Apply new TurboWarp/scratch-blocks extensions 2024-01-11 02:41:28 -06:00
Muffin 088b0c1780 Experiment with staticFetch to improve reliability of large data: URLs 2024-01-09 03:45:27 -06:00
GarboMuffin 8297dd4cc9 Add native loading progress tracking (#180) 2024-01-03 00:56:54 -06:00
LilyMakesThingsandMuffin 7f9c8f759c Add per-block extensions and colors (#177)
Co-authored-by: Muffin <muffin@mailbox.org>
2023-12-31 02:24:31 -06:00
CubesterandMuffin b27142a012 Allow removing loop icon using branchIconURI (#176)
Co-authored-by: Muffin <muffin@mailbox.org>
2023-12-31 01:32:22 -06:00
Muffin c309c42894 Use media:// for default loop icon (requires scratch-blocks change)
They have always been subtly broken, but the high contrast changes finally the old path for good.
https://github.com/TurboWarp/scratch-blocks/commit/7413542d3731b58381e05fddf6913fbc494f9cd9
2023-12-31 00:24:20 -06:00
Muffin 051c310ff3 merge-upstream: Fix broken test 2023-12-25 14:54:21 -06:00
Muffin 9f26069ad6 merge-upstream: Fix ESLint errors 2023-12-22 17:56:40 -06:00
Muffin 5d52268ace merge-upstream: Fix test errors 2023-12-22 17:49:05 -06:00
Muffin 81a0382e0f merge-upstream: initial merge of upstream/develop
installs & compiles but has test errors

aside from expected merge conflicts, notable changes from upstream:
 - removed husky, commitlint, etc.
 - removed semantic-release etc.
2023-12-22 17:25:21 -06:00
CubesterandMuffin bd0cf91d85 Add branchIconURI (#174)
Co-authored-by: Muffin <muffin@mailbox.org>
2023-12-22 16:47:48 -06:00
Muffin 24b6036825 Add Scratch.translate.language extension API
Requested by https://github.com/TurboWarp/extensions/pull/1172
2023-12-21 00:20:36 -06:00
Muffin d386082d5b Allow BOOLEAN blocks to be monitors
This will cause issues if the booleans have side-effects.

Closes https://github.com/TurboWarp/extensions/issues/201
2023-08-28 14:13:49 -05:00
Muffin 56a1b141e1 Allow Scratch.fetch() to follow redirects 2023-08-25 16:30:03 -05:00
Muffin 621ccefcb0 Add SecurityManager.canEmbed() 2023-08-24 15:40:27 -05:00
Muffin 6f335eccb4 Add SecurityManager.rewriteExtensionURL() 2023-08-24 15:40:20 -05:00