summaryrefslogblamecommitdiffhomepage
path: root/src/nodejs/unit-http/loader.mjs
blob: 01fa29202ff8d81dc09e1f3a8e43455bd208b222 (plain) (tree)
1
2
3
4
5
6
7
8
9



                                                                    
                              

                                                                     

                                   


                    
                         

                                                                

                                   




                                                               
// must be ran as part of a --loader or --experimental-loader param
export async function resolve(specifier, context, defaultResolver) {
    switch (specifier) {
        case "websocket":
        case "node:websocket":
            return {
                url: new URL("./websocket.js", import.meta.url).href,
                format: "commonjs",
                shortCircuit: true,
            }

        case "http":
        case "node:http":
            return {
                url: new URL("./http.js", import.meta.url).href,
                format: "commonjs",
                shortCircuit: true,
            }
    }

    return defaultResolver(specifier, context, defaultResolver)
}