From d7947995d955705b10c152545e9dfad200f95dd2 Mon Sep 17 00:00:00 2001 From: networkException Date: Sun, 23 Oct 2022 04:05:11 +0200 Subject: [PATCH] LibWeb: Add the ImportMap struct --- .../LibWeb/HTML/Scripting/ImportMap.h | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Userland/Libraries/LibWeb/HTML/Scripting/ImportMap.h diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ImportMap.h b/Userland/Libraries/LibWeb/HTML/Scripting/ImportMap.h new file mode 100644 index 0000000000..9f8d4d6d01 --- /dev/null +++ b/Userland/Libraries/LibWeb/HTML/Scripting/ImportMap.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022, networkException + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +namespace Web::HTML { + +using ModuleSpecifierMap = HashMap>; + +// https://html.spec.whatwg.org/multipage/webappapis.html#import-map +class ImportMap { +public: + ImportMap() = default; + + ModuleSpecifierMap const& imports() const { return m_imports; } + ModuleSpecifierMap& imports() { return m_imports; } + + HashMap const& scopes() const { return m_scopes; } + HashMap& scopes() { return m_scopes; } + +private: + ModuleSpecifierMap m_imports; + HashMap m_scopes; +}; + +}