Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[AssetMapper] Add integrity hashes to import maps #60362

Open
@javiereguiluz

Description

@javiereguiluz

Description

A few days ago, Firefox 138 added support for integrity hashes in import maps, so this feature is now widely supported. See https://caniuse.com/mdn-html_elements_script_type_importmap_integrity

We could add this feature to the import map generated by AssetMapper.

Example

See https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap#integrity_metadata_map

This is how it looks in action. Today, AssetMapper generates the imports key and we'd need to also generate the integrity key of this hash:

<script type="importmap">
  {
    "imports": {
      "square": "./modules/shapes/square.js"
    },
    "integrity": {
      "./modules/shapes/square.js": "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
    }
  }
</script>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions