Commit Graph
3626 Commits
Author SHA1 Message Date
AshimeeAltandMuffin 6d94ef1672 Add JSGenerator.unstable_exports (#209)
Co-authored-by: Muffin <muffin@muffin.ink>
2024-05-09 00:23:30 -05:00
Muffin 5d30745cf8 Remove redundant sandboxed extension block error handling
Interpreter/compiler do this by default since
0593628e24
2024-05-09 00:21:24 -05:00
Muffin 0593628e24 Fix rejected promise behavior in interpreter and compiler
Before this command:
- Interpreter would popStack() and continue. Inside a loop this was like JS continue, outside it was like return
- Compiler would return literal undefined and keep going.

After this commit:
Both return the error as a string and then continue as normal.
This has several benefits:
- Users can actually see the error messages
- Logical execution flow
- Consistent behavior
- Blocks aren't even supposed to return rejected promises anyways
- No vanilla blocks return rejected promises so no compatibility concerns

Supersedes https://github.com/TurboWarp/scratch-vm/pull/207
2024-05-09 00:18:18 -05:00
JeremyGamer13andMuffin 31c9eba1aa Add platform info (#205)
- Platform info is now stored in project.json.
- Available to extensions on vm.runtime.platform.
- When loading a project with a different platform, emit an event and wait for callbacks before continuing.

Co-authored-by: Muffin <muffin@muffin.ink>
2024-05-08 23:01:26 -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
tpsnt b6c42081b0 fix: wedo2 stop motor when power set to 0 (#198) 2024-02-28 19:21:10 -06:00
Muffin fe5fad5e5c Simplify 845c374f72 without array copy
Classic 1:40 AM merge moment
2024-02-12 11:47:19 -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
CST1229 58dbb21221 "Stage selected: less pen blocks" label on the stage
The motion category already does this, so this is for parity
2024-01-29 19:31:55 +01:00
GarboMuffin ec1f7dea0c Add vm.exports.i_will_not_ask_for_help_when_these_break() (#181) 2024-01-28 16:30:48 -06:00
FurryR 72cdbc26b3 Avoid using promise.catch in waitPromise
`promise.catch` is not included in PromiseLike
2024-01-17 19:22:57 +08:00
FurryR 46b9766b71 Fix compiler's waitPromise implementation
`waitPromise()` now finally allows PromiseLike
2024-01-17 18:50:21 +08:00
Muffin 03cd07ff11 Replace usage of log.warning with log.warn 2024-01-14 01:57:03 -06:00
Muffin cd9782a64c Replace minilog with nanolog 2024-01-14 01:48:32 -06:00
Muffin 9511cc4000 Remove note/drum concurrency limit when misc limits are removed 2024-01-13 21:58:18 -06:00
CST1229 d47a0964b7 compiler: don't use branchCount for substack compilation
This fixes a minor parity issue with the interpreter where if the number of SUBSTACK inputs in a block was more than its branchCount (e.g for blocks with mutators), the extra substacks didn't compile.
2024-01-13 21:09:44 -06:00
Muffin 74129b770a Log the complete error when refreshBlocks() fails 2024-01-11 19:52:31 -06:00
Muffin bb246c218f Fix typo in comment 2024-01-11 12:44:52 -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
Muffin e4e461ac84 Reset runtime's extension storage when loading a new project 2024-01-03 03:35:39 -06:00
GarboMuffin 8297dd4cc9 Add native loading progress tracking (#180) 2024-01-03 00:56:54 -06:00
GarboMuffin dd848dbbf6 Extension storage (#179) 2024-01-02 23:19:51 -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 7e9dab88f4 Allow serializing and deserializing infinite length comments
Goes along with https://github.com/TurboWarp/scratch-blocks/commit/78177be01aab589a6cbd9844d530df02258d09c2
2023-12-31 01:09:00 -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 66cbf13a7b Replace scratch-svg-renderer with @turbowarp/scratch-svg-renderer 2023-12-30 00:13:22 -06:00
Muffin ed487bd33e merge-upstream: cli: use quit() instead of stop() 2023-12-24 21:44:15 -06:00
Muffin 9f26069ad6 merge-upstream: Fix ESLint errors 2023-12-22 17:56:40 -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 c9f93b9de7 Resolve relative Scratch.canEmbed() URLs before sending to security manager 2023-12-03 18:03:53 -06:00
GarboMuffin b90d1bc7ef Optimize counter blocks in compiler (#170) 2023-10-08 14:13:49 -05: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 ec25b30c4a Fix compiler regression when last block in loop returns a Promise 2023-08-26 21:45:53 -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
Muffin 810692824a Expose block ID in compiler's compatibility layer 2023-08-23 19:36:25 -05:00
Muffin 2adf5ce38e Implement startBranch() in compiler 2023-08-23 15:50:57 -05:00
Muffin 1e88fad562 Remove rouding from CONDITIONAL in compiler
It is the block's job to round if needed.
2023-08-23 14:55:36 -05:00
Muffin 1decd331ad Alow LOOP and CONDITION blocks to use startBranch in interpreter and remove rounding 2023-08-23 14:50:42 -05:00
Muffin 8b43eae4de Make addBuiltinExtension per-VM, not global 2023-08-23 13:37:04 -05:00
Muffin 9acb696d5a Implement LOOP blocks in compiler 2023-08-22 16:34:47 -05:00
Muffin e9f0a3686c Implement LOOP blocks in interpreter 2023-08-22 16:34:47 -05:00
Muffin 87119eadb7 Implement CONDITIONAL blocks in interpreter 2023-08-22 16:34:47 -05:00
Muffin db0776711f Implement CONDITIONAL blocks in compiler 2023-08-22 16:34:47 -05:00