swc_ecma_compat_es2018/
lib.rs

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
#![allow(clippy::vec_box)]
#![allow(clippy::boxed_local)]

use serde::Deserialize;
use swc_ecma_ast::Pass;
use swc_ecma_compat_common::regexp::{self, regexp};

pub use self::object_rest_spread::object_rest_spread;

mod object_rest;
pub mod object_rest_spread;
mod object_spread;

pub fn es2018(c: Config) -> impl Pass {
    (
        regexp(regexp::Config {
            dot_all_regex: true,
            has_indices: false,
            lookbehind_assertion: true,
            named_capturing_groups_regex: true,
            sticky_regex: false,
            unicode_property_regex: true,
            unicode_regex: false,
            unicode_sets_regex: false,
        }),
        object_rest_spread(c.object_rest_spread),
    )
}

#[derive(Debug, Clone, Copy, Default, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Config {
    pub object_rest_spread: object_rest_spread::Config,
}