mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 22:56:11 +03:00
feat(preset-env/base): Implement more traits for BrowserData
and Version
(#5879)
**Description:** This derives additional common traits for these public structs.
This commit is contained in:
parent
52c17f3056
commit
73c48a8e6e
@ -4,7 +4,7 @@
|
|||||||
//! something usable.
|
//! something usable.
|
||||||
|
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use serde::Deserialize;
|
use serde::{Deserialize, Serialize};
|
||||||
use st_map::StaticMap;
|
use st_map::StaticMap;
|
||||||
|
|
||||||
use self::version::Version;
|
use self::version::Version;
|
||||||
@ -13,7 +13,7 @@ pub mod query;
|
|||||||
pub mod version;
|
pub mod version;
|
||||||
|
|
||||||
/// A map without allocation.
|
/// A map without allocation.
|
||||||
#[derive(Debug, Default, Deserialize, Clone, Copy, StaticMap)]
|
#[derive(Debug, Default, Deserialize, Clone, Copy, Serialize, StaticMap, PartialEq, Eq)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct BrowserData<T: Default> {
|
pub struct BrowserData<T: Default> {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use std::{cmp, cmp::Ordering, fmt, str::FromStr};
|
use std::{cmp, cmp::Ordering, fmt, str::FromStr};
|
||||||
|
|
||||||
use serde::{de, de::Visitor, Deserialize, Deserializer};
|
use serde::{de, de::Visitor, Deserialize, Deserializer, Serialize};
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
use crate::Versions;
|
use crate::Versions;
|
||||||
@ -11,7 +11,7 @@ use crate::Versions;
|
|||||||
///
|
///
|
||||||
/// This is similar to semver, but this assumes a production build. (No tag like
|
/// This is similar to semver, but this assumes a production build. (No tag like
|
||||||
/// `alpha`)
|
/// `alpha`)
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize)]
|
||||||
pub struct Version {
|
pub struct Version {
|
||||||
/// `a` in `a.b.c`
|
/// `a` in `a.b.c`
|
||||||
pub major: u32,
|
pub major: u32,
|
||||||
|
Loading…
Reference in New Issue
Block a user