Variable uriProtocolSchemeMapConst

uriProtocolSchemeMap: [protocol: string, scheme: UriScheme][] = ...

this is global mapping of uri-protocol schemes that are identifiable by getUriScheme and resolveAsUrl. you may mutate this 2-tuple array to add or remove custom identifiable uri-schemes.

adding a new uri protocol scheme named "inline-scheme" to our registry:

import { assertEquals, assertThrows } from "jsr:@std/assert"

// aliasing our functions for brevity
const eq = assertEquals, err = assertThrows

// initially, our custom "inline" scheme is unidentifiable, and cannot be used in `resolveAsUrl` as a base url
eq(getUriScheme("inline://a/b/c.txt"), "relative")
err(() => resolveAsUrl("./w.xyz", "inline://a/b/c.txt")) // "inline://a/b/c.txt" is identified as a relative path, and cannot be used as a base path

// registering the custom protocol-scheme mapping.
// note that you will have to declare `as any`, since the schemes are tightly defined by the type `UriScheme`.
uriProtocolSchemeMap.push(["inline://", "inline-scheme" as any])

// and now, our custom "inline" scheme becomes identifiable
eq(getUriScheme("inline://a/b/c.txt"), "inline-scheme")

// it is also now accepted by `resolveAsUrl` as a base uri
eq(resolveAsUrl("./w.xyz", "inline://a/b/c.txt"), new URL("inline://a/b/w.xyz"))