How to specify http/https resolver from spectral TypeScript API?

I’m integrating Spectal 5.4.0 into our tooling pipeline. In development, we share schemas and $ref them as JSON schema files from our OpenAPI source. Spectral reports

    code: 'invalid-ref',
    path: [ ... ],
    message: "No resolver defined for scheme 'https' in ref https://hostname/.../path/model.json",
    severity: 0,
    range: { start: [Object], end: [Object] }

Looks like Spectral is using
I can’t find doc on extending Spectral’s URI resolver on custom functions.
It works OK from the CLI, but not when I call Spectral from the JavaScript API.

I see there is a { resolver: Resolver } option, but spectral does not seem to export its httpAndFileResolver, so I had to recreate it myself (and add additional npm dependencies).
I suggest that the the default Spectral constructor should be the same as used in linter.ts and default to

My code:

npm i @stoplight/json-ref-readers @stoplight/json-ref-resolvers

function httpAndFileResolver(): Resolver {
  // this code was lifted from @stoplight/spectral src/resolvers/http-and-file.ts since it does not export this
  const resolveHttp = createResolveHttp({});
  const httpAndFileResolver = new Resolver({
    resolvers: {
      https: { resolve: resolveHttp },
      http: { resolve: resolveHttp },
      file: { resolve: resolveFile },
  return httpAndFileResolver;

const spectral = new Spectral({ resolver: httpAndFileResolver() });;

(however, when I add json-ref-resolver to my project, I get a bunch of Typescript compiler errors in node_modules/@stoplight/json-ref-resolver/types.d.ts ; @stoplight/json-ref-resolver is marked Deprecated)

This support request has been answered on GitHub