1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use swc_common::{ast_node, Span};

use crate::{Declaration, Function, Ident, MediaQueryList, Str, SupportsCondition, Url};

#[ast_node]
pub enum ImportHref {
    #[tag("Url")]
    Url(Url),

    #[tag("Str")]
    Str(Str),
}

#[ast_node]
pub enum ImportLayerName {
    #[tag("Ident")]
    Ident(Ident),

    #[tag("Function")]
    Function(Function),
}

#[ast_node]
pub enum ImportSupportsType {
    #[tag("SupportsCondition")]
    SupportsCondition(SupportsCondition),
    #[tag("Declaration")]
    Declaration(Declaration),
}

#[ast_node("ImportRule")]
pub struct ImportRule {
    pub span: Span,
    pub href: ImportHref,
    pub layer_name: Option<ImportLayerName>,
    pub supports: Option<ImportSupportsType>,
    pub media: Option<MediaQueryList>,
}