/
githubmirror
/
deno
Обзор
Документация
Войти
/
githubmirror
/
deno
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/specs/node/require_compile_hook/main.cjs
14 строк
455 B
David Sherret
fix(node): unconditionally call `Module.prototype._compile` with the file content in `loadMaybeCjs` (#32131)
12 фев 2026, 00:08
Не верифицирован
12 фев 2026, 00:08
133d02e
Код
Авторство
О чём код?
const Module = require("module"); // simulate what pirates/esbuild-register does: hook _compile const originalCompile = Module.prototype._compile; Module.prototype._compile = function (content, filename, format) { if (typeof content !== "string") { throw new TypeError( "content passed to _compile should be a string, got " + typeof content, ); } return originalCompile.call(this, content, filename, format); }; require("./lib.ts");