MCPcopy
hub / github.com/webpack/webpack / restore

Function restore

test/bun-sandbox-setup.js:10–22  ·  view source on GitHub ↗
(request, names)

Source from the content-addressed store, hash-verified

8// the framework loads); no-op on Node/Deno where the globals already exist.
9if (typeof URL === "undefined" || typeof setTimeout === "undefined") {
10 const restore = (request, names) => {
11 let mod;
12 try {
13 mod = require(request);
14 } catch (_err) {
15 return;
16 }
17 for (const name of names) {
18 if (typeof globalThis[name] === "undefined" && mod[name] !== undefined) {
19 globalThis[name] = mod[name];
20 }
21 }
22 };
23
24 restore("node:timers", [
25 "setTimeout",

Callers 2

applyMethod · 0.50

Calls 1

requireFunction · 0.70

Tested by

no test coverage detected