mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 22:01:47 +00:00
* oooooh magic * stuff * run format * ok * yippee * run the formatter back * finish things up * fix webkit * more * [autofix.ci] apply automated fixes * fix compile * fix compilation on windows, it seems to not work though :( * update * a * v * ok * [autofix.ci] apply automated fixes * OOPS * bump bun to reduce ci bugs * a * js2native is done! * improve array binding * rebase * some final stuff * wasi fixes * os --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
55 lines
1.0 KiB
TypeScript
55 lines
1.0 KiB
TypeScript
// Hardcoded module "node:vm"
|
|
const { throwNotImplemented } = require("internal/shared");
|
|
|
|
const vm = $cpp("NodeVM.cpp", "Bun::createNodeVMBinding");
|
|
|
|
const { createContext, isContext, Script, runInNewContext, runInThisContext } = vm;
|
|
|
|
function runInContext(code, context, options) {
|
|
return new Script(code, options).runInContext(context);
|
|
}
|
|
|
|
function createScript(code, options) {
|
|
return new Script(code, options);
|
|
}
|
|
|
|
function compileFunction() {
|
|
throwNotImplemented("node:vm compileFunction");
|
|
}
|
|
function measureMemory() {
|
|
throwNotImplemented("node:vm measureMemory");
|
|
}
|
|
|
|
class Module {
|
|
constructor() {
|
|
throwNotImplemented("node:vm Module");
|
|
}
|
|
}
|
|
|
|
class SourceTextModule {
|
|
constructor() {
|
|
throwNotImplemented("node:vm Module");
|
|
}
|
|
}
|
|
|
|
class SyntheticModule {
|
|
constructor() {
|
|
throwNotImplemented("node:vm Module");
|
|
}
|
|
}
|
|
|
|
export default {
|
|
createContext,
|
|
runInContext,
|
|
runInNewContext,
|
|
runInThisContext,
|
|
isContext,
|
|
compileFunction,
|
|
measureMemory,
|
|
Script,
|
|
Module,
|
|
SourceTextModule,
|
|
SyntheticModule,
|
|
createScript,
|
|
};
|