From 75209e12f19ca5d4a2a7c9008fba63a487ad8e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 15 Feb 2023 19:44:52 +0100 Subject: feat: wire up ext/node to the Node compatibility layer (#17785) This PR changes Node.js/npm compatibility layer to use polyfills for built-in Node.js embedded in the snapshot (that are coming from "ext/node" extension). As a result loading `std/node`, either from "https://deno.land/std@/" or from "DENO_NODE_COMPAT_URL" env variable were removed. All code that is imported via "npm:" specifiers now uses code embedded in the snapshot. Several fixes were applied to various modules in "ext/node" to make tests pass. --------- Co-authored-by: Yoshiya Hinosawa Co-authored-by: Divy Srivastava --- ext/node/polyfills/internal/timers.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ext/node/polyfills/internal/timers.mjs') diff --git a/ext/node/polyfills/internal/timers.mjs b/ext/node/polyfills/internal/timers.mjs index 648fb1bc1..6796885ce 100644 --- a/ext/node/polyfills/internal/timers.mjs +++ b/ext/node/polyfills/internal/timers.mjs @@ -5,10 +5,11 @@ import { inspect } from "internal:deno_node/polyfills/internal/util/inspect.mjs" import { validateFunction, validateNumber } from "internal:deno_node/polyfills/internal/validators.mjs"; import { ERR_OUT_OF_RANGE } from "internal:deno_node/polyfills/internal/errors.ts"; import { emitWarning } from "internal:deno_node/polyfills/process.ts"; - -const setTimeout_ = globalThis.setTimeout; -const clearTimeout_ = globalThis.clearTimeout; -const setInterval_ = globalThis.setInterval; +import { + setTimeout as setTimeout_, + clearTimeout as clearTimeout_, + setInterval as setInterval_, +} from "internal:deno_web/02_timers.js"; // Timeout values > TIMEOUT_MAX are set to 1. export const TIMEOUT_MAX = 2 ** 31 - 1; -- cgit v1.2.3