Initial commit of 001code-html Scratch frontend project.

Includes scratch-gui, scratch-vm, scratch-blocks, scratch-render, scratch-l10n, and deployment config.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-16 15:37:45 +08:00
commit 6e0a1fbcbb
11350 changed files with 965674 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
const {test} = require('tap');
const Runtime = require('../../src/engine/runtime');
const BlockType = require('../../src/extension-support/block-type');
const ArgumentType = require('../../src/extension-support/argument-type');
const extension = {
id: 'costumesoundtest',
name: 'Costume & Sound',
blocks: [
{
blockType: BlockType.COMMAND,
opcode: 'costume',
text: 'costume [a] [b]',
arguments: {
a: {
type: ArgumentType.COSTUME
},
b: {
type: ArgumentType.COSTUME,
defaultValue: 'default costume'
}
}
},
{
blockType: BlockType.COMMAND,
opcode: 'sound',
text: 'sound [a] [b]',
arguments: {
a: {
type: ArgumentType.SOUND
},
b: {
type: ArgumentType.SOUND,
defaultValue: 'default sound'
}
}
}
]
};
test('COSTUME and SOUND inputs generate correct scratch-blocks XML', t => {
const rt = new Runtime();
rt.on('EXTENSION_ADDED', info => {
/* eslint-disable max-len */
t.equal(
info.blocks[0].xml,
'<block type="costumesoundtest_costume"><value name="a"><shadow type="looks_costume"></shadow></value><value name="b"><shadow type="looks_costume"><field name="COSTUME">default costume</field></shadow></value></block>'
);
t.equal(
info.blocks[1].xml,
'<block type="costumesoundtest_sound"><value name="a"><shadow type="sound_sounds_menu"></shadow></value><value name="b"><shadow type="sound_sounds_menu"><field name="SOUND_MENU">default sound</field></shadow></value></block>'
);
/* eslint-enable max-len */
t.end();
});
rt._registerExtensionPrimitives(extension);
});