Skip to content

Latest commit

 

History

History
111 lines (87 loc) · 4.18 KB

Module-Map-Schema.md

File metadata and controls

111 lines (87 loc) · 4.18 KB

👈 Return to Overview

Module Map Schema

Holocron Modules may be developed and versioned in isolation as if they were their own frontend applications. The one-app Server relies on a module-map.json configuration file to orchestrate all these versioned web experiences together to form a single application. A Module Map contains an object of the following information:

  • Holocron Module Name
  • URLs to Holocron Module Bundles
  • Subresource Integrity Hash to verify contents of the Holocron Module Bundle

Contents

Shape

({
  clientCacheRevision: String, // optional
  modules: {
    [moduleName]: { // required
      browser: {
        url: String, // required
        integrity: String, // SRI String required
      },
      legacyBrowser: {
        url: String, // required
        integrity: String, // SRI String required
      },
      node: {
        url: String, // required
        integrity: String, // SRI String required
      },
    },
    // ... more module entries allowed
  },
});

Example

{
  "clientCacheRevision": "<any-string>",
  "modules": {
    "cultured-frankie": {
      "browser": {
        "url": "https://one-app-statics.surge.sh/modules/f16a872/cultured-frankie/0.0.0/cultured-frankie.browser.js",
        "integrity": "sha256-CGgTIe7x19CK+Z7G7YAjwPMstd/gpWNd4FRce7csbNA= sha384-8QStyVD+275LwFA2Zlgyh3fnt5chqPMpJjD9Yn8AF1dybM297+lFid40gZ+JCBqY"
      },
      "legacyBrowser": {
        "url": "https://one-app-statics.surge.sh/modules/f16a872/cultured-frankie/0.0.0/cultured-frankie.legacy.browser.js",
        "integrity": "sha256-7xmKAgHKfrK4WVdRDW5i2NHauPd79NWa/XJ5yKiKhpo= sha384-MsQDrDBAK3KfG/svpk7C3wHy+Ht7G6D99NbjZjBcfxdhPbZFeIQgsBtKkCVXzR1P"
      },
      "node": {
        "url": "https://one-app-statics.surge.sh/modules/f16a872/cultured-frankie/0.0.0/cultured-frankie.node.js",
        "integrity": "sha256-fQT5PYOExfnv/b6tMAoWdp8lyJK1XPHloKfjNQUfySk= sha384-LhjPddGOg6KcGbs2IhVWvZRnyNrEasr01aVhOPXmwlTzg3n2QQqxJHdx93aucRby"
      }
    }
  }
}

Field Annotations

clientCacheRevision Field

This optional value is used to bust the client-side caching of Modules in the Holocron Module Registry.

[moduleName] Field

By convention, the moduleName is the key mapping where Holocron Module bundles are stored in the Holocron Module Registry.

browser Field

Includes an object of url and integrity pointing to the location of the modern browser bundle (e.g. last two major versions of currently used browsers) for a Holocron Module.

legacyBrowser Field

Includes an object of url and integrity pointing to the legacyBrowser bundle (e.g. more transpilation for older browsers like Internet Explorer) for a Holocron Module.

node Field

Includes an object of url and integrity pointing to the location of the node bundle (e.g. Serverside compatible) for a Holocron Module.

url Field

Contains a fully qualified url to a Holocron Module bundle location.

integrity Field

Contains a hash SRI integrity string to validate the contents of a Holocron Module bundle.

📘 More Information

☝️ Return To Top