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:
21
scratch-vm/test/fixtures/dispatch-test-worker-shim.js
vendored
Normal file
21
scratch-vm/test/fixtures/dispatch-test-worker-shim.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
const Module = require('module');
|
||||
|
||||
const callsite = require('callsite');
|
||||
const path = require('path');
|
||||
|
||||
const oldRequire = Module.prototype.require;
|
||||
Module.prototype.require = function (target) {
|
||||
if (target.indexOf('/') === -1 || target.startsWith('@')) {
|
||||
// we really do just want to forward the arguments here
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
return oldRequire.apply(this, arguments);
|
||||
}
|
||||
|
||||
const stack = callsite();
|
||||
const callerFile = stack[2].getFileName();
|
||||
const callerDir = path.dirname(callerFile);
|
||||
target = path.resolve(callerDir, target);
|
||||
return oldRequire.call(this, target);
|
||||
};
|
||||
|
||||
oldRequire(path.resolve(__dirname, 'dispatch-test-worker'));
|
||||
Reference in New Issue
Block a user