From c160ea11e4ece4db52731ac8b83dd09ca2d1ef11 Mon Sep 17 00:00:00 2001 From: Oisin Canty Date: Mon, 24 May 2021 09:01:42 +0000 Subject: Node.js: renamed "require_shim" to "loader". --- src/nodejs/unit-http/loader.mjs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/nodejs/unit-http/loader.mjs (limited to 'src/nodejs/unit-http/loader.mjs') diff --git a/src/nodejs/unit-http/loader.mjs b/src/nodejs/unit-http/loader.mjs new file mode 100644 index 00000000..067d63d4 --- /dev/null +++ b/src/nodejs/unit-http/loader.mjs @@ -0,0 +1,18 @@ +// must be ran as part of a --loader or --experimental-loader param +export async function resolve(specifier, context, defaultResolver) { + switch (specifier) { + case "websocket": + return { + url: new URL("./websocket.js", import.meta.url).href, + format: "cjs" + } + + case "http": + return { + url: new URL("./http.js", import.meta.url).href, + format: "cjs" + } + } + + return defaultResolver(specifier, context, defaultResolver) +} -- cgit