toEndoURL = (url) =>
  url instanceof URL
    ? url.href
    : url.startsWith('file://')
      ? url
      : nodeUrl.pathToFileURL(url).href
Converts a {@link URL} or `string` to a URL-like `string` starting with the
protocol.

If `url` is a `string`, it is expected to be a path.

@remarks
This is the format that `@endo/compartment-mapper` often expects.
@param {URL | string} url URL or path
@returns {string} URL-like string
@internal