Commit graph

303 commits

Author SHA1 Message Date
Christopher Willis-Ford
4f213015bf Revert "fix!: export extension support types"
This reverts commit 4ebcd1f894.
2024-03-11 11:09:33 -07:00
Christopher Willis-Ford
4ebcd1f894 fix!: export extension support types 2024-03-11 10:05:50 -07:00
Christopher Willis-Ford
7d5a780638 style: fix the other lint complaints 2023-12-15 17:40:25 -08:00
Christopher Willis-Ford
8dbcc1fc8f style: fix hasOwnProperty lint complaints 2023-12-15 17:40:05 -08:00
Christopher Willis-Ford
9fca9ee583 feat: use scratchFetch
BREAKING CHANGE: servers must accept new header x-projectid
2023-03-31 09:07:06 -07:00
Andy O'Neill
2581446907 feat: ability to clear flyout blocks when language changes 2022-12-14 11:03:12 -05:00
Christopher Willis-Ford
840ffb5df0 test: don't use process.exit to end tests
Newer versions of `tap` run more asynchronously, so sometimes using `process.nextTick(process.exit)`
to end a test would prevent the test from completing correctly. Removing all instances of
`process.nextTick(process.exit)` put tests into three categories:
* the test still worked correctly -- no fixup needed.
* the test would hang because the VM's `_steppingInterval` was keeping
  Node alive. These tests call a new `quit()` method which ends the
  stepping interval.
* the `load-extensions` test needed special attention because the "Video
  Sensing" extension starts its own loop using `setTimeout`. I added a
  `_stopLoop()` method on the extension and directly call that from the
  test. I'm not completely happy with this solution but anything more
  general would likely require a change to the extension spec, so I'm
  leaving that as a followup task.
2022-06-07 11:44:06 -07:00
Karishma Chadha
f7e5272618 Delete sound.broken when updating the sound buffer 2022-05-25 18:23:23 -04:00
Karishma Chadha
3e193565ee Hook up error handling to bitmap loading flow and add tests for loading missing and corrupt bitmpas from sb2 and sprite2 files 2022-05-23 19:54:45 -04:00
Karishma Chadha
36849c9f40
Fix lint error
Co-authored-by: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com>
2022-05-19 12:55:09 -04:00
Karishma Chadha
4679d06ac0 Update storage and update 'loadSound' to handle null asset from storage. Track additional metadata for broken costumes: 'bitmapResolution' and 'dataFormat'. 2022-05-18 21:26:36 -04:00
Karishma Chadha
11f938f8a9 Update to latest version of storage which fixes issue where an HTML 404 page was being returned for missing asset data. Update VM to handle null assets properly. 2022-05-18 16:55:46 -04:00
Karishma Chadha
fd31a777e2
Code clean up from code review
Co-authored-by: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com>
2022-05-16 16:07:08 -04:00
Karishma Chadha
70a78cf7db Add tests for load costume error handling. Fix issue where asset data was not getting saved out properly. 2022-05-13 19:07:34 -04:00
Karishma Chadha
deadce3bc6 Let GQM replace broken costume data but explicitly save and serialize broken costume data before finishing loading the costume. 2022-05-11 10:57:24 -04:00
Christopher Willis-Ford
d119ca2477
Merge pull request #2903 from cwillisf/performance-mark-deserialize
use performance.mark to measure deserialize time
2021-10-29 07:32:14 -07:00
DD Liu
62e7dde84e Put back deprecated function to not break gui 2021-04-01 18:28:15 -04:00
DD Liu
e5560b067b Merge branch 'develop' into removev2SvgAdapter 2021-03-16 16:53:40 -04:00
DD Liu
627e62a339 Remove v2SvgAdapter 2021-03-04 15:32:14 -05:00
Christopher Willis-Ford
6dda5c4963 use performance.mark to measure deserialize time 2021-02-23 13:26:49 -08:00
DD Liu
04b6963788 Pass on event type from CDM 2020-10-15 19:56:24 -04:00
chrisgarrity
5adf5ba8fc
Merge pull request #2252 from chrisgarrity/custom-mimetype
Add custom mime-type to exported sb3 and sprite
2019-08-13 15:22:10 -04:00
Chris Garrity
40be416c9f Add custom mime-type to exported sb3 and sprite 2019-08-07 13:52:30 +01:00
Karishma Chadha
9af2e4c086
Merge pull request #2161 from LLK/e16n
Supporting VM changes for extensionification
2019-06-18 18:53:20 -04:00
Eric Rosenbaum
8243d0f53a Update sound sampleCount and rate 2019-06-05 17:06:27 -04:00
Paul Kaplan
5e626eb7e9 Initial prototype of configurable scratch link socket 2019-05-24 12:51:58 -04:00
Karishma Chadha
92a73fef55 Add a runtime event to track when the toolbox extension blocks need updating. 2019-04-24 11:28:02 -04:00
Christopher Willis-Ford
bd1aaecdf3 add category info to extension add & update events 2019-04-19 16:06:11 -07:00
Katie Broida
eedc0b16e0
Merge pull request #2041 from ktbee/use-empty-bitmap-size
Set height and width to zero for the canvas and costume size if bitmap's sourceHeight or sourceWidth are zero
2019-04-16 14:50:42 -04:00
Karishma Chadha
0e710ba3d9 Allow loading extensions synchronously. Add example extension to list of known internal extensions. 2019-03-22 12:20:06 -04:00
Michael "Z" Goddard
882a83db9a
do not evaluate text-encoding until it is needed
text-encoding has about ~700KB of data that is great to skip decoding
for systems that have a browser provided TextDecoder.
2019-03-06 11:11:44 -05:00
Michael "Z" Goddard
bc5605cf80
lazy evaluate project loading related code 2019-03-06 11:11:44 -05:00
Katie Broida
aeea9c1a51 Use bitmap source width 2019-03-05 16:05:07 -05:00
Michael "Z" Goddard
146e93e4ec
start loading sb2 sounds before handling sb2 data 2019-02-15 17:43:55 -05:00
Karishma Chadha
59f58b0284
Merge pull request #1933 from ErikMejerHansen/feature/field_type_support
Feature/field type support
2019-02-12 09:59:22 -05:00
Paul Kaplan
6deab79903
Merge pull request #1979 from paulkaplan/share-blocks-new-ids
Add a utility for giving blocks new IDs, use it for sharing blocks.
2019-02-07 08:31:25 -05:00
Paul Kaplan
31fbcfa4d7 Add a utility for giving blocks new IDs, use it for sharing blocks. 2019-02-06 10:16:22 -05:00
Karishma Chadha
13e69bad7b Code cleanup -- move out duplicate .then statements after the next .then (at the higher level) 2019-01-30 16:45:38 -05:00
Karishma Chadha
dfcd09fedc Stop emitting project changes within 'runtime._step()'. Emit project changes in scenarios that were previously taking advantage of runtime._step() 2019-01-30 10:59:25 -05:00
Karishma Chadha
a9cf509a55
Merge pull request #1941 from kchadha/add-runtime-to-blocks
Add reference for `runtime` to blocks container
2019-01-30 10:57:45 -05:00
Karishma Chadha
0bf5d8ab90 Update VM getPlaygroundData function to remove circular dependency in blockContainer. It wasn't being used by the tests or the playground and it is not an issue with actual project serialization. Update test to stop passing in runtime to blocklyListen function. 2019-01-24 15:26:16 -05:00
Karishma Chadha
e5723e299a Add runtime to blocks container since it was getting passed in everywhere where it was being referenced. Update calls to blocks constructor. 2019-01-23 18:18:38 -05:00
Erik Mejer Hansen
ceaa3c7857 Add support extensions to define custom field types.
This is done by adding a new element "customFieldTypes" to the extension info structure. Ex:
```
customFieldTypes: {
   angleField: {
      implementation: { fromJson: options => new AngleField(options) },
      output: 'number',
      outputShape: 2,
   }
}
```
Field types are defined by an implementation that has to match what is expected by ScratchBlocks.Field.register and its output and shape.

src/engine/runtime.js has been updated to handle the new "customFieldTypes"-field:
- Existing (global) field types cannot be overridden
- New fields are "namespaced" to the extension in the same way as opcodes are.

Once the custom field type has been picked up by scratch-vm a "EXTENSION_FIELD_ADDED" event is emitted.
It is then up to the hosting app to call ScratchBlocks.Field.register to register the field type with ScratchBlocks. Ex:
```
vm.addListener('EXTENSION_FIELD_ADDED', fieldInfo => {
   this.ScratchBlocks.Field.register(fieldInfo.name, fieldInfo.implementation);
});
```
2019-01-20 21:24:32 +01:00
Evelyn Eastmond
7831256044 Change event names to be more descriptive. Fix some typos. 2019-01-16 20:17:19 -05:00
Evelyn Eastmond
156b1bc21a Adding new runtime event for intentional peripheral disconnects. 2019-01-16 15:22:58 -05:00
Karishma Chadha
59a865ef47 Create a new addTarget function on the runtime which populates the targets list as well as the executable targets list. 2019-01-14 11:48:11 -05:00
Karishma Chadha
fbee37e915 Populate executable targets when runtime.targets is populated so that scripts don't run before they are supposed to (e.g. before targets are done getting installed). 2019-01-11 14:52:34 -05:00
Karishma Chadha
4ad101f5d4
Apply suggestions from code review
Co-Authored-By: mzgoddard <mzgoddard@gmail.com>
2018-12-20 14:12:33 -05:00
Karishma Chadha
f1a24e3296
Update src/virtual-machine.js
Co-Authored-By: mzgoddard <mzgoddard@gmail.com>
2018-12-20 14:11:58 -05:00
Michael "Z" Goddard
5593b28984
try handling as a Scratch 1 file after scratch-parser validation fails 2018-12-20 13:55:49 -05:00