@versatiles/style
    Preparing search index...

    Function inlineSources

    • Resolve every url-referencing source in a style into an inlined, self-contained one.

      This is the asynchronous half of the API: osm() and satellite() build a style with no I/O, and this fetches whatever those styles left as a reference. It is orthogonal to style building — it works on any style, including guessStyle() output and hand-written documents.

      Use it when the style must stand on its own: published style.json artifacts, offline or air-gapped deployments, and anywhere the first tile request should not wait for a TileJSON round-trip. It is also the only place that can set the two properties MapLibre cannot infer from a TileJSON — raster tileSize and raster-dem encoding.

      Every fetched document is checked before it is inlined: it must be a valid TileJSON, and it must describe the kind of tiles the source claims — a type: "vector" source needs a TileJSON with vector_layers, a raster or raster-dem source one without. A url pointing at the wrong tileset fails here, naming the offending source, rather than turning into an empty map later.

      Returns a new style; the input is not mutated. Sources without a url are left alone.

      Parameters

      • style: StyleSpecification
      • Optionaloptions: {
            fetch?: {
                (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
                (input: string | URL | Request, init?: RequestInit): Promise<Response>;
            };
        }
        • Optionalfetch?: {
              (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
              (input: string | URL | Request, init?: RequestInit): Promise<Response>;
          }

      Returns Promise<StyleSpecification>