chore: Document features (#2890)

This commit is contained in:
Donny/강동윤 2021-11-27 16:55:42 +09:00 committed by GitHub
parent 7bccbcc880
commit f5af22ef71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 60 additions and 14 deletions

12
Cargo.lock generated
View File

@ -2538,7 +2538,7 @@ dependencies = [
[[package]]
name = "swc_common"
version = "0.14.6"
version = "0.14.7"
dependencies = [
"abi_stable",
"ahash",
@ -2670,7 +2670,7 @@ dependencies = [
[[package]]
name = "swc_ecma_ast"
version = "0.58.0"
version = "0.58.1"
dependencies = [
"arbitrary",
"is-macro",
@ -2739,7 +2739,7 @@ dependencies = [
[[package]]
name = "swc_ecma_loader"
version = "0.24.3"
version = "0.24.4"
dependencies = [
"ahash",
"anyhow",
@ -2792,7 +2792,7 @@ dependencies = [
[[package]]
name = "swc_ecma_parser"
version = "0.78.9"
version = "0.78.10"
dependencies = [
"either",
"enum_kind",
@ -2862,7 +2862,7 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms"
version = "0.95.1"
version = "0.95.2"
dependencies = [
"pretty_assertions 0.6.1",
"sourcemap",
@ -3133,7 +3133,7 @@ dependencies = [
[[package]]
name = "swc_ecmascript"
version = "0.88.1"
version = "0.88.2"
dependencies = [
"swc_ecma_ast",
"swc_ecma_codegen",

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_common"
repository = "https://github.com/swc-project/swc.git"
version = "0.14.6"
version = "0.14.7"
[package.metadata.docs.rs]
all-features = true

View File

@ -150,6 +150,7 @@ struct FileWithAnnotatedLines {
}
#[cfg(feature = "tty-emitter")]
#[cfg_attr(docsrs, doc(cfg(feature = "tty-emitter")))]
impl EmitterWriter {
pub fn stderr(
color_config: ColorConfig,

View File

@ -349,6 +349,7 @@ impl Drop for Handler {
impl Handler {
#[cfg(feature = "tty-emitter")]
#[cfg_attr(docsrs, doc(cfg(feature = "tty-emitter")))]
pub fn with_tty_emitter(
color_config: ColorConfig,
can_emit_warnings: bool,
@ -367,6 +368,7 @@ impl Handler {
}
#[cfg(feature = "tty-emitter")]
#[cfg_attr(docsrs, doc(cfg(feature = "tty-emitter")))]
pub fn with_tty_emitter_and_flags(
color_config: ColorConfig,
cm: Option<Lrc<SourceMapperDyn>>,

View File

@ -27,7 +27,7 @@
//!
//! Allows replacing operations related to thread-local variables with a trait.
#![deny(unused)]
#![cfg_attr(docsrs, feature(doc_cfg))]
pub use self::{
eq::{EqIgnoreSpan, TypeEq},
errors::{SourceMapper, SourceMapperDyn},
@ -62,6 +62,7 @@ pub mod iter;
pub mod macros;
pub mod pass;
#[cfg(feature = "plugin-base")]
#[cfg_attr(docsrs, doc(cfg(any(feature = "plugin-rt", feature = "plugin-mode"))))]
pub mod plugin;
mod pos;
mod rustc_data_structures;

View File

@ -74,6 +74,7 @@ impl crate::errors::Emitter for PluginEmitter {
}
}
#[cfg_attr(docsrs, doc(cfg(feature = "plugin-mode")))]
#[cfg(feature = "plugin-mode")]
pub fn with_runtime<F, Ret>(rt: &Runtime, op: F) -> Ret
where
@ -168,6 +169,7 @@ impl RuntimeImpl for PluginRt {
}
}
#[cfg_attr(docsrs, doc(cfg(feature = "plugin-rt")))]
#[cfg(feature = "plugin-rt")]
pub fn get_runtime_for_plugin(plugin_name: String) -> Runtime {
use abi_stable::erased_types::TD_Opaque;

View File

@ -1070,12 +1070,14 @@ impl SourceMap {
///
#[cfg(feature = "sourcemap")]
#[cfg_attr(docsrs, doc(cfg(feature = "sourcemap")))]
pub fn build_source_map(&self, mappings: &mut Vec<(BytePos, LineCol)>) -> sourcemap::SourceMap {
self.build_source_map_from(mappings, None)
}
/// Creates a `.map` file.
#[cfg(feature = "sourcemap")]
#[cfg_attr(docsrs, doc(cfg(feature = "sourcemap")))]
pub fn build_source_map_from(
&self,
mappings: &mut Vec<(BytePos, LineCol)>,
@ -1085,6 +1087,7 @@ impl SourceMap {
}
#[cfg(feature = "sourcemap")]
#[cfg_attr(docsrs, doc(cfg(feature = "sourcemap")))]
pub fn build_source_map_with_config(
&self,
mappings: &mut Vec<(BytePos, LineCol)>,

View File

@ -39,6 +39,7 @@ pub struct Span {
}
#[cfg(feature = "arbitrary")]
#[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))]
impl<'a> arbitrary::Arbitrary<'a> for Span {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let lo = u.arbitrary::<BytePos>()?;

View File

@ -32,6 +32,7 @@ use std::{
pub struct SyntaxContext(u32);
#[cfg(feature = "arbitrary")]
#[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))]
impl<'a> arbitrary::Arbitrary<'a> for SyntaxContext {
fn arbitrary(_: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
Ok(SyntaxContext::empty())

View File

@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(unused_must_use)]
use crate::{

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_ast"
repository = "https://github.com/swc-project/swc.git"
version = "0.58.0"
version = "0.58.1"
[package.metadata.docs.rs]
all-features = true

View File

@ -85,6 +85,7 @@ impl Display for Ident {
}
#[cfg(feature = "arbitrary")]
#[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))]
impl<'a> arbitrary::Arbitrary<'a> for Ident {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let span = u.arbitrary()?;

View File

@ -201,6 +201,7 @@ pub struct JSXText {
}
#[cfg(feature = "arbitrary")]
#[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))]
impl<'a> arbitrary::Arbitrary<'a> for JSXText {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let span = u.arbitrary()?;

View File

@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(unreachable_patterns)]
#![deny(missing_copy_implementations)]
#![deny(missing_debug_implementations)]

View File

@ -43,6 +43,7 @@ pub struct BigInt {
}
#[cfg(feature = "arbitrary")]
#[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))]
impl<'a> arbitrary::Arbitrary<'a> for BigInt {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let span = u.arbitrary()?;
@ -116,6 +117,7 @@ impl Default for StrKind {
}
#[cfg(feature = "arbitrary")]
#[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))]
impl<'a> arbitrary::Arbitrary<'a> for Str {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let span = u.arbitrary()?;
@ -180,6 +182,7 @@ pub struct Regex {
}
#[cfg(feature = "arbitrary")]
#[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))]
impl<'a> arbitrary::Arbitrary<'a> for Regex {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let span = u.arbitrary()?;

View File

@ -1,4 +1,5 @@
/// Creates a corresponding operator.
/// Creates a corresponding operator. This macro is used to make code more
/// readable.
///
/// This can used to represent [UnaryOp](crate::UnaryOp),
/// [BinaryOp](crate::BinaryOp), or [AssignOp](crate::AssignOp).

View File

@ -25,6 +25,7 @@ pub struct Module {
}
#[cfg(feature = "arbitrary")]
#[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))]
impl<'a> arbitrary::Arbitrary<'a> for Module {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let span = u.arbitrary()?;
@ -59,6 +60,7 @@ pub struct Script {
}
#[cfg(feature = "arbitrary")]
#[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))]
impl<'a> arbitrary::Arbitrary<'a> for Script {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let span = u.arbitrary()?;

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_loader"
repository = "https://github.com/swc-project/swc.git"
version = "0.24.3"
version = "0.24.4"
[package.metadata.docs.rs]
all-features = true

View File

@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
use serde::{Deserialize, Serialize};
pub mod resolve;

View File

@ -1,6 +1,9 @@
#[cfg(feature = "lru")]
#[cfg_attr(docsrs, doc(cfg(feature = "lru")))]
pub mod lru;
#[cfg(feature = "node")]
#[cfg_attr(docsrs, doc(cfg(feature = "node")))]
pub mod node;
#[cfg(feature = "tsc")]
#[cfg_attr(docsrs, doc(cfg(feature = "tsc")))]
pub mod tsc;

View File

@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"]
license = "Apache-2.0/MIT"
name = "swc_ecma_parser"
repository = "https://github.com/swc-project/swc.git"
version = "0.78.9"
version = "0.78.10"
[package.metadata.docs.rs]
all-features = true

View File

@ -103,6 +103,7 @@
//!
//! [tc39/test262]:https://github.com/tc39/test262
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(test, feature(bench_black_box))]
#![cfg_attr(test, feature(test))]
#![deny(unused)]
@ -131,6 +132,7 @@ pub enum Syntax {
Es(EsConfig),
/// This variant requires the cargo feature `typescript` to be enabled.
#[cfg(feature = "typescript")]
#[cfg_attr(docsrs, doc(cfg(feature = "typescript")))]
#[serde(rename = "typescript")]
Typescript(TsConfig),
}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms"
repository = "https://github.com/swc-project/swc.git"
version = "0.95.1"
version = "0.95.2"
[package.metadata.docs.rs]
all-features = true

View File

@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(unused)]
pub use self::{
@ -7,16 +8,23 @@ pub use self::{
};
pub use swc_ecma_transforms_base::{fixer, helpers, hygiene, pass, perf, resolver};
#[cfg(feature = "swc_ecma_transforms_compat")]
#[cfg_attr(docsrs, doc(cfg(feature = "compat")))]
pub use swc_ecma_transforms_compat as compat;
#[cfg(feature = "swc_ecma_transforms_module")]
#[cfg_attr(docsrs, doc(cfg(feature = "module")))]
pub use swc_ecma_transforms_module as modules;
#[cfg(feature = "swc_ecma_transforms_optimization")]
#[cfg_attr(docsrs, doc(cfg(feature = "optimization")))]
pub use swc_ecma_transforms_optimization as optimization;
#[cfg(feature = "swc_ecma_transforms_optimization")]
#[cfg_attr(docsrs, doc(cfg(feature = "optimization")))]
pub use swc_ecma_transforms_optimization::const_modules;
#[cfg(feature = "swc_ecma_transforms_proposal")]
#[cfg_attr(docsrs, doc(cfg(feature = "proposal")))]
pub use swc_ecma_transforms_proposal as proposals;
#[cfg(feature = "swc_ecma_transforms_react")]
pub use swc_ecma_transforms_react as react;
#[cfg_attr(docsrs, doc(cfg(feature = "react")))]
#[cfg(feature = "swc_ecma_transforms_typescript")]
#[cfg_attr(docsrs, doc(cfg(feature = "typescript")))]
pub use swc_ecma_transforms_typescript as typescript;

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecmascript"
repository = "https://github.com/swc-project/swc.git"
version = "0.88.1"
version = "0.88.2"
[package.metadata.docs.rs]
all-features = true

View File

@ -1,17 +1,27 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
pub use swc_ecma_ast as ast;
#[cfg(feature = "codegen")]
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
pub use swc_ecma_codegen as codegen;
#[cfg(feature = "dep_graph")]
#[cfg_attr(docsrs, doc(cfg(feature = "dep_graph")))]
pub use swc_ecma_dep_graph as dep_graph;
#[cfg(feature = "minifier")]
#[cfg_attr(docsrs, doc(cfg(feature = "minifier")))]
pub use swc_ecma_minifier as minifier;
#[cfg(feature = "parser")]
#[cfg_attr(docsrs, doc(cfg(feature = "parser")))]
pub use swc_ecma_parser as parser;
#[cfg(feature = "preset_env")]
#[cfg_attr(docsrs, doc(cfg(feature = "preset_env")))]
pub use swc_ecma_preset_env as preset_env;
#[cfg(feature = "transforms")]
#[cfg_attr(docsrs, doc(cfg(feature = "transforms")))]
pub use swc_ecma_transforms as transforms;
#[cfg(feature = "utils")]
#[cfg_attr(docsrs, doc(cfg(feature = "utils")))]
pub use swc_ecma_utils as utils;
#[cfg(feature = "visit")]
#[cfg_attr(docsrs, doc(cfg(feature = "visit")))]
pub use swc_ecma_visit as visit;