Commit Graph
6964 Commits
Author SHA1 Message Date
Tacodiva 1dc9aadf3f Fix issue when setting variables to InputType.ANY and add test 2024-06-25 18:25:47 +10:00
Tacodiva 02806b654a Linty linty code 2024-06-17 10:37:37 +10:00
Tacodiva 41e8167573 Fix snapshot tests falling back to "script" instead of the procedure variant 2024-06-17 10:06:33 +10:00
Tacodiva 71b75aad51 Add type assertion checking 2024-06-16 13:50:39 +10:00
Tacodiva 9d28fccb99 Add operator type testing 2024-06-16 13:50:30 +10:00
Tacodiva d3ed93cdfc Make tests happy :3 2024-06-16 13:49:53 +10:00
Tacodiva fffb72b09d Upgraded Type Analysis 2024-06-16 13:10:14 +10:00
Muffin 30a614dfc4 Expose compatibility layer stack frame on thread
For https://github.com/TurboWarp/scratch-vm/issues/212
2024-06-14 14:32:35 -05:00
Muffin dff3c2f6ba Optimize _keyArgToScratchKey
The special key name list is now a set instead of an array.
In the most common case of a simple letter, a search is skipped entirely.
Test coverage already exists.
2024-05-31 17:11:20 -05:00
Muffin 16415ba5cd Use procedure variant in snapshots instead of just procedure code 2024-05-23 14:22:43 -05:00
Muffin 6ce931b60a Add test for behavior of self-restarting scripts
The behavior is non-trivial as it will keep running the old thread
unti it yields.

I briefly tested putting `thread.status = 4` at the start of _restartThread
and all the old execution tests still passed, so let's just add a bit more
coverage. This was nearly regressed by f548d1b33c.
2024-05-23 14:16:57 -05:00
Muffin d39a30fb23 Replace wrapAssetRequest promise argument with a callback
The flexibility may be useful later
2024-05-22 20:36:25 -05:00
Muffin d69256aa2d Replace jszip with @turbowarp/jszip 2024-05-19 21:58:36 -05:00
Muffin 976309704f Update TurboWarp/scratch-parser 2024-05-19 21:58:16 -05:00
Muffin 847088ca00 Remove unused thread.isKilled check
This check only makes sense if isKilled === true implies that it was already
removed from threads, however that is not the case in the VM itself and
especially in some extensions.
2024-05-15 15:00:42 -05:00
Muffin f548d1b33c Fix stopping a thread from inside of its blocks
Works in command or reporter after yielding or not.
These snippets are covered by the tests:
thread.status = Thread.STATUS_DONE;
thread.status = 4; (indirectly)
sequencer.retireThread(thread);
2024-05-15 14:46:23 -05:00
Muffin 73d71c0720 Fix benchmark playground
- added project token support
- option checkbox to enable compiler
2024-05-13 14:30:42 -05:00
Muffin 216b5b65d2 Add execute.js to unsupported exports 2024-05-09 18:55:20 -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
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
Muffin 60f974057b Update scratch-parser 2024-03-30 18:10:23 -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 064155fe0d Update TurboWarp/scratch-parser 2024-03-17 00:47:18 -05:00
Muffin bb4bc02ee4 Bump GitHub Actions 2024-03-15 22:11:14 -05:00
Muffin 63267aecec Deploy the correct folder, whoops! 2024-03-15 21:58:27 -05:00
Muffin 79250a7a27 Enable npm cache in GitHub Actions 2024-03-15 21:55:14 -05:00
Muffin 50700010ab Ignore errors building jsdoc 2024-03-15 21:54:28 -05:00
Muffin e5097da366 Deploy playground to GitHub Pages 2024-03-15 21:51:17 -05:00
Muffin e7332fc846 Mozilla Public License 2.0
The GPL family of licenses are not perfect. Notably they are incompatible with
the SIL OFL 1.1 used by the fonts in scratch-render-fonts. In the packager we
'statically link' all of this those fonts into one HTML file. Is that legal?
Seems like you can make an argument that it's not. Who knows. I'm not a lawyer.

MPL 2.0 is a good alternative: It's still copyleft, used by real projects,
backed by a real organization, and GPL compatible.

Before 9a4afe2864 all changes were either by me
or under BSD3c. The only third-party LGPL commit is b6c42081b0
which is trivial if any copyright dispute should arise. Thus we can make this
switch.

Related: https://github.com/TurboWarp/scratch-gui/pull/909
2024-03-15 21:25:37 -05:00
tpsnt b6c42081b0 fix: wedo2 stop motor when power set to 0 (#198) 2024-02-28 19:21:10 -06:00
Muffin 9a4afe2864 Open source should stay open source. 2024-02-23 13:42:01 -06:00
Muffin f220d941a5 Update @turbowarp/nanolog 2024-02-17 12:46:52 -06:00
Muffin fe5fad5e5c Simplify 845c374f72 without array copy
Classic 1:40 AM merge moment
2024-02-12 11:47:19 -06: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
GarboMuffin f201364407 Merge pull request #189 from CST1229/tw-pen-clarity
Pen: "Stage selected: less pen blocks" label on the stage
2024-02-10 01:40:14 -06:00
Muffin 96225163c1 Fix tests in Node 21 and later 2024-02-02 21:25:58 -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
Muffin a15c069ac6 Improve promise-like extension block test
notably, fail on compiler errors, and run the test block several times
2024-01-26 20:39:05 -06:00
Muffin 696cda7c63 merge-upstream: re-merge ae75a7bdf8
something went wrong on the original merge, and we didn't actually
bring in all the old commits. with this we should have all the commits
brought into our tree with no actual changes as we already did the
merge.
2024-01-21 14:18:01 -06:00
GarboMuffin 08eb39975e Merge pull request #185 from FurryR/develop
Fix compiler's waitPromise implementation
2024-01-21 13:49:26 -06:00
Muffin b3e621c61b Add test for promise-like blocks 2024-01-21 13:44:54 -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