Coverage Report

Created: 2025-12-18 07:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibJS/Runtime/ModuleRequest.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2021-2022, David Tuin <davidot@serenityos.org>
3
 * Copyright (c) 2023, networkException <networkexception@serenityos.org>
4
 *
5
 * SPDX-License-Identifier: BSD-2-Clause
6
 */
7
8
#pragma once
9
10
#include <AK/DeprecatedFlyString.h>
11
#include <AK/Vector.h>
12
#include <LibJS/Module.h>
13
14
namespace JS {
15
16
struct ModuleWithSpecifier {
17
    ByteString specifier;        // [[Specifier]]
18
    NonnullGCPtr<Module> module; // [[Module]]
19
};
20
21
// https://tc39.es/proposal-import-attributes/#importattribute-record
22
struct ImportAttribute {
23
    ByteString key;
24
    ByteString value;
25
};
26
27
// https://tc39.es/proposal-import-attributes/#modulerequest-record
28
struct ModuleRequest {
29
    ModuleRequest() = default;
30
31
    explicit ModuleRequest(DeprecatedFlyString specifier)
32
0
        : module_specifier(move(specifier))
33
0
    {
34
0
    }
35
36
    ModuleRequest(DeprecatedFlyString specifier, Vector<ImportAttribute> attributes);
37
38
    void add_attribute(ByteString key, ByteString value)
39
0
    {
40
0
        attributes.empend(move(key), move(value));
41
0
    }
42
43
    DeprecatedFlyString module_specifier; // [[Specifier]]
44
    Vector<ImportAttribute> attributes;   // [[Attributes]]
45
};
46
47
}