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,41 @@
const fs = require('fs');
const VirtualMachine = require('../index');
/* eslint-env node */
/* eslint-disable no-console */
const file = process.argv[2];
if (!file) {
throw new Error('Invalid file');
}
const runProject = async buffer => {
const vm = new VirtualMachine();
vm.runtime.on('SAY', (target, type, text) => {
console.log(text);
});
vm.setCompatibilityMode(true);
vm.clear();
await vm.loadProject(buffer);
vm.start();
vm.greenFlag();
await new Promise(resolve => {
const interval = setInterval(() => {
let active = 0;
const threads = vm.runtime.threads;
for (let i = 0; i < threads.length; i++) {
if (!threads[i].updateMonitor) {
active += 1;
}
}
if (active === 0) {
clearInterval(interval);
resolve();
}
}, 50);
});
vm.stopAll();
vm.quit();
};
runProject(fs.readFileSync(file));