repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_utils/src/node_ignore_span.rs | crates/swc_ecma_utils/src/node_ignore_span.rs | use std::{borrow::Cow, fmt::Debug, hash::Hash};
use swc_common::EqIgnoreSpan;
use swc_ecma_ast::{Expr, MemberProp};
/// A newtype that will ignore Span while doing `eq` or `hash`.
pub struct NodeIgnoringSpan<'a, Node: ToOwned + Debug>(Cow<'a, Node>);
impl<Node: ToOwned + Debug> Debug for NodeIgnoringSpan<'_, Node> {... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_utils/src/factory.rs | crates/swc_ecma_utils/src/factory.rs | use std::iter;
use swc_atoms::atom;
use swc_common::{util::take::Take, Span, Spanned, DUMMY_SP};
use swc_ecma_ast::*;
/// Extension methods for [Expr].
///
/// Note that many types implements `Into<Expr>` and you can do like
///
/// ```rust
/// use swc_ecma_utils::ExprFactory;
///
/// let _args = vec![0f64.as_arg()];... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_utils/src/str.rs | crates/swc_ecma_utils/src/str.rs | pub const EOF: char = '\0';
// 11.1 Unicode Format-Control Characters
/// U+200C ZERO WIDTH NON-JOINER, abbreviated in the spec as `<ZWNJ>`.
/// Specially permitted in identifiers.
pub const ZWNJ: char = '\u{200c}';
/// U+200D ZERO WIDTH JOINER, abbreviated as `<ZWJ>`.
/// Specially permitted in identifiers.
pub con... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_utils/src/var.rs | crates/swc_ecma_utils/src/var.rs | use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
use crate::ident::IdentLike;
/// This collects variables bindings while ignoring if it's nested in
/// expression.
pub struct VarCollector<'a, I: IdentLike> {
pub to: &'a mut Vec<I>,
}
impl<I: IdentLike> Visit for VarCollector<'_, I> {... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_utils/src/function/fn_env_hoister.rs | crates/swc_ecma_utils/src/function/fn_env_hoister.rs | use std::mem;
use indexmap::IndexMap;
use rustc_hash::FxBuildHasher;
use swc_atoms::{atom, Atom};
use swc_common::{util::take::Take, Span, Spanned, SyntaxContext, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
use crate::ExprFactory;
#[derive(Default)]
struct Super... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_utils/src/function/mod.rs | crates/swc_ecma_utils/src/function/mod.rs | mod fn_env_hoister;
pub use fn_env_hoister::*;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ts_fast_strip/src/lib.rs | crates/swc_ts_fast_strip/src/lib.rs | use std::fmt::Display;
use anyhow::Context;
use bytes_str::BytesStr;
use serde::{Deserialize, Serialize};
use swc_common::{
comments::SingleThreadedComments,
errors::{DiagnosticId, Handler, HANDLER},
source_map::DefaultSourceMapGenConfig,
sync::Lrc,
BytePos, FileName, Mark, SourceMap, Span, Spanned... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ts_fast_strip/tests/fixture.rs | crates/swc_ts_fast_strip/tests/fixture.rs | use std::path::PathBuf;
use swc_common::{
comments::SingleThreadedComments, errors::Handler, sync::Lrc, FileName, SourceMap,
};
use swc_ecma_ast::EsVersion;
use swc_ecma_parser::{
lexer::Lexer, unstable::Capturing, EsSyntax, Parser, StringInput, Syntax, TsSyntax,
};
use swc_ts_fast_strip::{operate, Mode, Optio... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ts_fast_strip/benches/assets.rs | crates/swc_ts_fast_strip/benches/assets.rs | use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion};
use swc_ts_fast_strip::{operate, Options};
static SOURCE: &str = include_str!("assets/test.ts");
fn fast_ts(c: &mut Criterion) {
c.bench_function("typescript/fast-strip", fast_typescript);
}
fn fast_typescript(b: &mut... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_node_comments/src/lib.rs | crates/swc_node_comments/src/lib.rs | #![cfg_attr(test, deny(warnings))]
use std::sync::Arc;
use dashmap::DashMap;
use rustc_hash::FxBuildHasher;
use swc_atoms::atom;
use swc_common::{
comments::{Comment, CommentKind, Comments},
BytePos, DUMMY_SP,
};
type CommentMap = Arc<DashMap<BytePos, Vec<Comment>, FxBuildHasher>>;
/// Multi-threaded implem... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_macro/src/lib.rs | crates/swc_plugin_macro/src/lib.rs | extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro2::{Ident, Span};
use quote::quote;
use syn::{Item as SynItem, ItemFn};
#[proc_macro_attribute]
pub fn plugin_transform(
_args: proc_macro::TokenStream,
input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let token = proc_macro2... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_compiler_base/src/lib.rs | crates/swc_compiler_base/src/lib.rs | use std::{
env,
path::{Path, PathBuf},
};
use anyhow::{Context, Error};
use base64::prelude::{Engine, BASE64_STANDARD};
use bytes_str::BytesStr;
use once_cell::sync::Lazy;
use rustc_hash::FxHashMap;
#[allow(unused)]
use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::{
comments::{Comm... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_ext_transforms/src/lib.rs | crates/swc_ecma_ext_transforms/src/lib.rs | pub mod jest;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_ext_transforms/src/jest.rs | crates/swc_ecma_ext_transforms/src/jest.rs | use phf::phf_set;
use swc_common::util::take::Take;
use swc_ecma_ast::*;
use swc_ecma_utils::{prepend_stmts, StmtLike};
use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass, VisitMut, VisitMutWith};
static HOIST_METHODS: phf::Set<&str> = phf_set![
"mock",
"unmock",
"enableAutomock",
"disableAutomoc... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_xml_visit/src/lib.rs | crates/swc_xml_visit/src/lib.rs | #![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(clippy::all)]
#![allow(clippy::ptr_arg)]
pub use crate::generated::*;
mod generated;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_xml_visit/src/generated.rs | crates/swc_xml_visit/src/generated.rs | #![doc = r" This file is generated by `tools/generate-code`. DO NOT MODIFY."]
#![allow(unused_variables)]
#![allow(clippy::all)]
pub use ::swc_visit::All;
use swc_xml_ast::*;
#[doc = r" A visitor trait for traversing the AST."]
pub trait Visit {
#[doc = "Visit a node of type `swc_atoms :: Atom`.\n\nBy default, this... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2021/src/lib.rs | crates/swc_ecma_compat_es2021/src/lib.rs | use swc_ecma_ast::Pass;
pub use self::logical_assignments::logical_assignments;
mod logical_assignments;
pub fn es2021() -> impl Pass {
logical_assignments()
}
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2021/src/logical_assignments.rs | crates/swc_ecma_compat_es2021/src/logical_assignments.rs | use swc_ecma_ast::Pass;
/// Creates a logical assignments transformation pass.
///
/// This enables both:
/// - ES2021 logical assignment operators (&&=, ||=, ??=)
/// - ES2020 nullish coalescing (to transform the ?? operator generated from
/// ??=)
pub fn logical_assignments() -> impl Pass {
let mut options = s... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/merge.rs | crates/swc_config/src/merge.rs | use std::{collections::HashMap, path::PathBuf};
use indexmap::IndexMap;
pub use swc_config_macro::Merge;
/// Deriavable trait for overrding configurations.
///
/// Typically, correct implementation of this trait for a struct is calling
/// merge for all fields, and `#[derive(Merge)]` will do it for you.
pub trait Mer... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/source_map.rs | crates/swc_config/src/source_map.rs | use anyhow::{bail, Context, Result};
use bytes_str::BytesStr;
use serde::{Deserialize, Serialize};
use swc_sourcemap::{vlq::parse_vlq_segment, RawToken, SourceMap};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SourceMapContent {
Json(String),
#[serde(rename_all = "camelCase")]
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/lib.rs | crates/swc_config/src/lib.rs | //! Configuration for swc
#![cfg_attr(docsrs, feature(doc_cfg))]
#[cfg_attr(docsrs, doc(cfg(feature = "file_pattern")))]
#[cfg(feature = "file_pattern")]
pub mod file_pattern;
#[cfg_attr(docsrs, doc(cfg(feature = "glob")))]
#[cfg(feature = "glob")]
pub mod glob;
pub mod is_module;
pub mod merge;
#[cfg_attr(docsrs, doc... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/regex_js.rs | crates/swc_config/src/regex_js.rs | //! Regex cache
use std::{ops::Deref, sync::Arc};
pub use anyhow::Error;
use anyhow::{Context, Result};
use dashmap::DashMap;
use once_cell::sync::Lazy;
use regress::Regex;
use rustc_hash::FxBuildHasher;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone)]
pub struct CachedJsRegex {
regex: Arc<Regex>,
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/is_module.rs | crates/swc_config/src/is_module.rs | use std::fmt;
use serde::{
de::{Unexpected, Visitor},
Deserialize, Deserializer, Serialize, Serializer,
};
use crate::merge::Merge;
#[derive(Clone, Debug, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum IsModule {
Bool(bool),
Unknown,
CommonJS,
}
impl Default for IsModule {
fn default(... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/glob.rs | crates/swc_config/src/glob.rs | use std::sync::Arc;
use anyhow::{Context, Result};
use dashmap::DashMap;
use globset::{Glob, GlobMatcher};
use once_cell::sync::Lazy;
use rustc_hash::FxBuildHasher;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone)]
pub struct CachedGlob {
glob: Arc<GlobMatcher>,
}
impl CachedGlob {
pub fn new(glob... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/regex.rs | crates/swc_config/src/regex.rs | //! Regex cache
use std::{ops::Deref, str::FromStr, sync::Arc};
pub use anyhow::Error;
use anyhow::{Context, Result};
use dashmap::DashMap;
use once_cell::sync::Lazy;
use regex::Regex;
use rustc_hash::FxBuildHasher;
use serde::{Deserialize, Serialize};
/// A regex which can be used as a configuration.
///
/// While ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/file_pattern.rs | crates/swc_config/src/file_pattern.rs | use serde::{Deserialize, Serialize};
use crate::{glob::CachedGlob, regex::CachedRegex};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FilePattern {
Regex(CachedRegex),
Glob { glob: CachedGlob },
}
impl FilePattern {
pub fn is_match(&self, path: &str) -> bool {
match ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/types/bool_config.rs | crates/swc_config/src/types/bool_config.rs | use serde::{Deserialize, Serialize};
use crate::merge::Merge;
/// You can create this type like `true.into()` or `false.into()`.
#[derive(
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize,
)]
pub struct BoolConfig<const DEFAULT: bool>(#[serde(default)] Option<bool>);
impl... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/types/option.rs | crates/swc_config/src/types/option.rs | use serde::{Deserialize, Serialize};
use crate::merge::Merge;
/// You can create this type like `Some(...).into()` or `None.into()`.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct MergingOption<T>(Option<T>)
where
T: Merge + Default;
impl<T> MergingOption<T>
where
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/types/mod.rs | crates/swc_config/src/types/mod.rs | pub use self::{
bool_config::BoolConfig,
bool_or_data::{BoolOr, BoolOrDataConfig},
option::MergingOption,
};
mod bool_config;
mod bool_or_data;
mod option;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/src/types/bool_or_data.rs | crates/swc_config/src/types/bool_or_data.rs | use serde::{Deserialize, Serialize};
use serde_json::Value;
use crate::merge::Merge;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct BoolOrDataConfig<T>(#[serde(default)] Option<BoolOr<T>>);
impl<T> BoolOrDataConfig<T> {
pub fn from_bool(v: bool) -> Self {
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/tests/config_types.rs | crates/swc_config/tests/config_types.rs | use serde_json::Value;
use swc_config::types::BoolConfig;
fn bool_config(v: Value) -> BoolConfig<false> {
serde_json::from_value(v).unwrap()
}
#[test]
fn test_bool_config_serde() {
assert_eq!(bool_config(Value::Null), BoolConfig::new(None));
assert_eq!(bool_config(Value::Bool(true)), BoolConfig::new(Some... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_config/tests/derive_merge.rs | crates/swc_config/tests/derive_merge.rs | use swc_config::merge::Merge;
#[derive(Merge)]
struct Fields {
a: Option<()>,
}
#[test]
fn test_fields() {
let mut fields = Fields { a: None };
fields.merge(Fields { a: Some(()) });
assert_eq!(fields.a, Some(()));
}
#[derive(Merge)]
struct Tuple(Option<()>);
#[test]
fn test_tuple() {
let mut tup... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2022/src/static_blocks.rs | crates/swc_ecma_compat_es2022/src/static_blocks.rs | use swc_ecma_ast::*;
pub fn static_blocks() -> impl Pass {
let mut options = swc_ecma_transformer::Options::default();
options.env.es2022.class_static_block = true;
options.into_pass()
}
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2022/src/lib.rs | crates/swc_ecma_compat_es2022/src/lib.rs | #![allow(clippy::vec_box)]
use swc_common::Mark;
use swc_ecma_ast::Pass;
pub use self::{
class_properties::class_properties, private_in_object::private_in_object,
static_blocks::static_blocks,
};
pub mod class_properties;
pub mod optional_chaining_impl;
pub mod private_in_object;
pub mod static_blocks;
pub ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2022/src/optional_chaining_impl.rs | crates/swc_ecma_compat_es2022/src/optional_chaining_impl.rs | use std::mem;
use swc_common::{util::take::Take, Mark, SyntaxContext, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_utils::{alias_ident_for, prepend_stmt, quote_ident, ExprFactory, StmtLike};
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
/// Not a public API and may break any time. Don't use it di... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2022/src/private_in_object.rs | crates/swc_ecma_compat_es2022/src/private_in_object.rs | use swc_ecma_ast::Pass;
/// https://github.com/tc39/proposal-private-fields-in-in
pub fn private_in_object() -> impl Pass {
let mut options = swc_ecma_transformer::Options::default();
options.env.es2022.private_property_in_object = true;
options.into_pass()
}
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2022/src/class_properties/private_field.rs | crates/swc_ecma_compat_es2022/src/class_properties/private_field.rs | use std::iter;
use rustc_hash::FxHashMap;
use swc_atoms::Atom;
use swc_common::{errors::HANDLER, util::take::Take, Mark, Span, Spanned, SyntaxContext, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_transforms_base::helper;
use swc_ecma_utils::{alias_ident_for, alias_if_required, prepend_stmt, quote_ident, ExprFactory};
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2022/src/class_properties/class_name_tdz.rs | crates/swc_ecma_compat_es2022/src/class_properties/class_name_tdz.rs | use swc_common::DUMMY_SP;
use swc_ecma_ast::*;
use swc_ecma_transforms_base::helper;
use swc_ecma_utils::ExprFactory;
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
use swc_trace_macro::swc_trace;
pub(super) struct ClassNameTdzFolder<'a> {
pub class_name: &'a Ident,
}
#[swc_trace]
impl VisitMu... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2022/src/class_properties/used_name.rs | crates/swc_ecma_compat_es2022/src/class_properties/used_name.rs | use swc_atoms::Atom;
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
use swc_trace_macro::swc_trace;
pub(super) struct UsedNameCollector<'a> {
pub used_names: &'a mut Vec<Atom>,
}
macro_rules! noop {
($name:ident, $T:path) => {
/// no-op
fn $name(&mut self, _: &$T... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2022/src/class_properties/mod.rs | crates/swc_ecma_compat_es2022/src/class_properties/mod.rs | use rustc_hash::FxHashMap;
use swc_atoms::{atom, Atom};
use swc_common::{
errors::HANDLER, source_map::PURE_SP, util::take::Take, Mark, Span, Spanned, SyntaxContext,
DUMMY_SP,
};
use swc_ecma_ast::*;
use swc_ecma_transforms_base::{helper, perf::Check};
use swc_ecma_transforms_classes::super_field::SuperFieldAcc... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | true |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2022/src/class_properties/this_in_static.rs | crates/swc_ecma_compat_es2022/src/class_properties/this_in_static.rs | use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
use swc_trace_macro::swc_trace;
pub(super) struct ThisInStaticFolder {
pub ident: Ident,
}
#[swc_trace]
impl VisitMut for ThisInStaticFolder {
noop_visit_mut_type!(fail);
// once again, for computed props
fn visit... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_compat_es2022/src/class_properties/member_init.rs | crates/swc_ecma_compat_es2022/src/class_properties/member_init.rs | use swc_common::{Span, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_transforms_base::helper;
use swc_ecma_utils::{prop_name_to_expr, prop_name_to_expr_value, quote_ident, ExprFactory};
use swc_trace_macro::swc_trace;
use super::Config;
pub(super) enum MemberInit {
PubProp(PubProp),
PrivProp(PrivProp),
Pri... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_loader/src/lib.rs | crates/swc_ecma_loader/src/lib.rs | #![cfg_attr(docsrs, feature(doc_cfg))]
use serde::{Deserialize, Serialize};
pub mod resolve;
pub mod resolvers;
/// List of built in packages for latest stable node with LTS (node@16).
///
/// Run `node -p "require('module').builtinModules"`
pub const NODE_BUILTINS: &[&str] = &[
"_http_agent",
"_http_client"... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_loader/src/resolve.rs | crates/swc_ecma_loader/src/resolve.rs | use std::sync::Arc;
use anyhow::Error;
use swc_atoms::Atom;
#[allow(unused_imports)]
use swc_common::{
sync::{Send, Sync},
FileName,
};
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Resolution {
pub filename: FileName,
pub slug: Option<Atom>,
}
pub trait Resolve: Send + Sync {
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_loader/src/resolvers/node.rs | crates/swc_ecma_loader/src/resolvers/node.rs | //! Faster version of node-resolve.
//!
//! See: https://github.com/goto-bus-stop/node-resolve
use std::{
env::current_dir,
fs::File,
io::BufReader,
path::{Component, Path, PathBuf},
};
use anyhow::{bail, Context, Error};
use dashmap::DashMap;
#[cfg(windows)]
use normpath::BasePath;
use once_cell::syn... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_loader/src/resolvers/lru.rs | crates/swc_ecma_loader/src/resolvers/lru.rs | use std::num::NonZeroUsize;
use anyhow::Error;
use lru::LruCache;
use parking_lot::Mutex;
use swc_common::FileName;
use crate::resolve::{Resolution, Resolve};
#[derive(Debug)]
pub struct CachingResolver<R>
where
R: Resolve,
{
cache: Mutex<LruCache<(FileName, String), Resolution>>,
inner: R,
}
impl<R> De... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_loader/src/resolvers/mod.rs | crates/swc_ecma_loader/src/resolvers/mod.rs | #[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;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_loader/src/resolvers/tsc.rs | crates/swc_ecma_loader/src/resolvers/tsc.rs | use std::{
cmp::Ordering,
path::{Component, Path, PathBuf},
};
use anyhow::{bail, Context, Error};
use swc_common::FileName;
use tracing::{debug, info, trace, warn, Level};
use crate::resolve::{Resolution, Resolve};
#[derive(Debug)]
enum Pattern {
Wildcard {
prefix: String,
},
/// No wild... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_loader/tests/node_resolver.rs | crates/swc_ecma_loader/tests/node_resolver.rs | #![deny(warnings)]
#![cfg(feature = "node")]
use std::{
env::{current_dir, set_current_dir},
path::PathBuf,
sync::{Arc, Mutex},
};
use lazy_static::lazy_static;
use swc_common::FileName;
extern crate swc_ecma_loader;
use swc_ecma_loader::{resolve::Resolve, resolvers::node::NodeModulesResolver, TargetEnv};... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_loader/tests/tsc_resolver.rs | crates/swc_ecma_loader/tests/tsc_resolver.rs | #![cfg(feature = "tsc")]
use std::collections::HashMap;
use anyhow::{anyhow, Error};
use rustc_hash::FxHashMap;
use swc_atoms::atom;
use swc_common::FileName;
use swc_ecma_loader::{
resolve::{Resolution, Resolve},
resolvers::tsc::TsConfigResolver,
};
#[test]
fn base_dir_exact() {}
#[test]
fn base_dir_wildca... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/bench.rs | xtask/src/bench.rs | use std::process::Command;
use anyhow::Result;
use clap::Args;
use crate::util::{repository_root, run_cmd};
/// Run one or more benchmarks
#[derive(Debug, Args)]
pub(super) struct BenchCmd {
#[clap(long, short = 'p')]
package: String,
/// Build benchmarks in debug mode.
#[clap(long)]
debug: bool... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/main.rs | xtask/src/main.rs | use anyhow::Result;
use clap::{Parser, Subcommand};
use npm::NpmCmd;
use crate::{bench::BenchCmd, clean::CleanCmd, es::EsCmd, git::GitCmd};
mod bench;
mod clean;
mod es;
mod git;
mod npm;
mod util;
#[derive(Debug, Parser)]
struct CliArgs {
#[clap(subcommand)]
cmd: Cmd,
}
#[derive(Debug, Subcommand)]
enum Cm... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/clean.rs | xtask/src/clean.rs | use std::path::Path;
use anyhow::Result;
use clap::Args;
use walkdir::WalkDir;
use crate::util::{repository_root, run_cmd};
/// Clean cargo target directories
#[derive(Debug, Args)]
pub(super) struct CleanCmd {}
impl CleanCmd {
pub fn run(self) -> Result<()> {
let root_dir = repository_root()?;
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/util/mod.rs | xtask/src/util/mod.rs | use std::{
env,
path::{Path, PathBuf},
process::{Command, Stdio},
};
use anyhow::{bail, Context, Result};
use serde_derive::Deserialize;
pub fn wrap<F, Ret>(op: F) -> Result<Ret>
where
F: FnOnce() -> Result<Ret>,
{
op()
}
pub fn repository_root() -> Result<PathBuf> {
let dir = env::var("CARGO... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/git/mod.rs | xtask/src/git/mod.rs | use anyhow::Result;
use clap::{Args, Subcommand};
use self::reduce::ReduceCmd;
mod reduce;
#[derive(Debug, Args)]
pub(super) struct GitCmd {
#[clap(subcommand)]
cmd: Inner,
}
#[derive(Debug, Subcommand)]
enum Inner {
Reduce(ReduceCmd),
}
impl GitCmd {
pub fn run(self) -> Result<()> {
match ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/git/reduce/core_ver.rs | xtask/src/git/reduce/core_ver.rs | use anyhow::Result;
use clap::Args;
use crate::util::get_commit_for_core_version;
/// Reduce the difference of the versions of `swc_core`s to the list of commits
/// and pull requests.
#[derive(Debug, Args)]
pub(super) struct CoreVerCmd {
from: String,
to: String,
}
impl CoreVerCmd {
pub fn run(self) ->... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/git/reduce/mod.rs | xtask/src/git/reduce/mod.rs | use anyhow::Result;
use clap::{Args, Subcommand};
use self::core_ver::CoreVerCmd;
mod core_ver;
#[derive(Debug, Args)]
pub(super) struct ReduceCmd {
#[clap(subcommand)]
cmd: Inner,
}
#[derive(Debug, Subcommand)]
enum Inner {
CoreVer(CoreVerCmd),
}
impl ReduceCmd {
pub fn run(self) -> Result<()> {
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/npm/util.rs | xtask/src/npm/util.rs | use std::process::{Command, Stdio};
use anyhow::{Context, Result};
use semver::Version;
use crate::util::{repository_root, wrap};
pub fn set_version(version: &Version) -> Result<()> {
wrap(|| {
let mut c = Command::new("npm");
c.current_dir(repository_root()?).stderr(Stdio::inherit());
c.... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/npm/mod.rs | xtask/src/npm/mod.rs | use anyhow::Result;
use clap::{Args, Subcommand};
use self::nightly::NightlyCmd;
mod nightly;
mod util;
#[derive(Debug, Args)]
pub(super) struct NpmCmd {
#[clap(subcommand)]
cmd: Inner,
}
#[derive(Debug, Subcommand)]
enum Inner {
Nightly(NightlyCmd),
}
impl NpmCmd {
pub fn run(self) -> Result<()> {... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/npm/nightly.rs | xtask/src/npm/nightly.rs | use std::process::{Command, Stdio};
use anyhow::{ensure, Context, Result};
use chrono::Utc;
use clap::Args;
use semver::{Prerelease, Version};
use crate::{
npm::util::{bump_swc_cli, set_version},
util::{repository_root, wrap},
};
#[derive(Debug, Args)]
pub(super) struct NightlyCmd {}
impl NightlyCmd {
p... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/es/minifier.rs | xtask/src/es/minifier.rs | use anyhow::Result;
use clap::{Args, Subcommand};
#[derive(Debug, Args)]
pub(super) struct MinifierCmd {
#[clap(subcommand)]
cmd: Cmd,
}
impl MinifierCmd {
pub fn run(self) -> Result<()> {
match self.cmd {}
}
}
#[derive(Debug, Subcommand)]
enum Cmd {}
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/xtask/src/es/mod.rs | xtask/src/es/mod.rs | use anyhow::Result;
use clap::{Args, Subcommand};
use self::minifier::MinifierCmd;
mod minifier;
/// Commands for ECMAScript crates.
#[derive(Debug, Args)]
pub(super) struct EsCmd {
#[clap(subcommand)]
cmd: Cmd,
}
impl EsCmd {
pub fn run(self) -> Result<()> {
match self.cmd {
Cmd::Mi... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/packages/core/e2e/fixtures/plugin_transform_schema_v1/src/lib.rs | packages/core/e2e/fixtures/plugin_transform_schema_v1/src/lib.rs | use swc_plugin::{
ast::*, metadata::TransformPluginProgramMetadata, plugin_transform, syntax_pos::DUMMY_SP,
};
struct ConsoleOutputReplacer;
impl VisitMut for ConsoleOutputReplacer {
fn visit_mut_call_expr(&mut self, call: &mut CallExpr) {
if let Callee::Expr(expr) = &call.callee {
if let ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/packages/core/e2e/fixtures/plugin_transform_schema_vtest/src/lib.rs | packages/core/e2e/fixtures/plugin_transform_schema_vtest/src/lib.rs | use swc_core::{
ast::*,
atoms::*,
common::DUMMY_SP,
plugin::{metadata::TransformPluginProgramMetadata, plugin_transform},
visit::*,
};
struct ConsoleOutputReplacer;
impl VisitMut for ConsoleOutputReplacer {
fn visit_mut_call_expr(&mut self, call: &mut CallExpr) {
if let Callee::Expr(ex... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/packages/core/e2e/fixtures/plugin_analyze/src/lib.rs | packages/core/e2e/fixtures/plugin_analyze/src/lib.rs | use swc_core::{
ecma::ast::Program,
plugin::{plugin_transform, proxies::TransformPluginProgramMetadata},
transform_common::output::experimental_emit,
};
#[plugin_transform]
pub fn process(program: Program, _metadata: TransformPluginProgramMetadata) -> Program {
experimental_emit("test".into(), "test".i... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/stream.rs | actix/src/stream.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use futures_core::{ready, stream::Stream};
use log::error;
use pin_project_lite::pin_project;
use crate::{
actor::{Actor, ActorContext, ActorState, AsyncContext, SpawnHandle},
fut::ActorFuture,
};
/// Stream handling for Actors.
///
/// This is helper tr... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/mailbox.rs | actix/src/mailbox.rs | use std::{fmt, pin::Pin, task, task::Poll};
use futures_core::stream::Stream;
use crate::{
actor::{Actor, AsyncContext},
address::{channel, Addr, AddressReceiver, AddressSenderProducer, EnvelopeProxy},
};
/// Default address channel capacity
pub const DEFAULT_CAPACITY: usize = 16;
pub struct Mailbox<A>
wher... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/lib.rs | actix/src/lib.rs | //! Actix is an actor framework.
//!
//! [Actors](Actor) are objects which encapsulate state and behavior, they communicate exclusively
//! by exchanging messages. Actix actors are implemented on top of [Tokio](https://tokio.rs).
//!
//! Multiple actors can run in same thread. Actors can run in multiple threads using t... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/io.rs | actix/src/io.rs | use std::{
cell::RefCell,
collections::VecDeque,
io,
marker::PhantomData,
ops::DerefMut,
pin::Pin,
rc::Rc,
task,
task::{Context, Poll},
};
use bitflags::bitflags;
use bytes::BytesMut;
use futures_sink::Sink;
use tokio::io::{AsyncWrite, AsyncWriteExt};
use tokio_util::codec::Encoder;... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/sync.rs | actix/src/sync.rs | //! Sync Actors support
//!
//! Sync Actors are actors that run multiple instances on a thread pool.
//! This is useful for CPU bound, or concurrent workloads. There can only be
//! a single Sync Actor type on a `SyncArbiter`. This means you can't have
//! Actor type A and B, sharing the same thread pool. You need to c... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/context_impl.rs | actix/src/context_impl.rs | use std::{
fmt,
future::Future,
pin::Pin,
task::{Context, Poll},
};
use bitflags::bitflags;
use futures_core::ready;
use smallvec::SmallVec;
use crate::{
actor::{Actor, ActorContext, ActorState, AsyncContext, Running, SpawnHandle, Supervised},
address::{Addr, AddressSenderProducer},
contex... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/actor.rs | actix/src/actor.rs | use std::time::Duration;
use actix_rt::ArbiterHandle;
use futures_core::stream::Stream;
use log::error;
use crate::{
address::{channel, Addr},
context::Context,
context_items::{ActorDelayedMessageItem, ActorMessageItem, ActorMessageStreamItem},
fut::{ActorFuture, ActorStreamExt},
handler::{Handler... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/clock.rs | actix/src/clock.rs | //! Utilities for tracking time.
//!
//! This module provides a number of types for executing code after a set period of time.
//!
//! See [`tokio::time` module] for full documentation.
//!
//! [`tokio::time` module]: https://docs.rs/tokio/1.0.1/tokio/time/index.html
pub use actix_rt::time::*;
| rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/utils.rs | actix/src/utils.rs | use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
time::Duration,
};
use futures_core::ready;
use pin_project_lite::pin_project;
use tokio::{
sync::oneshot,
time::{sleep_until, Instant},
};
use crate::{
actor::Actor,
clock::{sleep, Sleep},
fut::{ActorFuture, ActorStream},... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/registry.rs | actix/src/registry.rs | //! Actors registry
//!
//! An Actor can register itself as a service. A Service can be defined as an
//! `ArbiterService`, which is unique per arbiter, or a `SystemService`, which
//! is unique per system.
use std::{
any::{Any, TypeId},
cell::RefCell,
collections::HashMap,
rc::Rc,
};
use actix_rt::{Ar... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/supervisor.rs | actix/src/supervisor.rs | use std::{
future::Future,
pin::Pin,
task::{self, Poll},
};
use actix_rt::ArbiterHandle;
use pin_project_lite::pin_project;
use crate::{
actor::{Actor, AsyncContext, Supervised},
address::{channel, Addr},
context::Context,
context_impl::ContextFut,
mailbox::DEFAULT_CAPACITY,
};
pin_pr... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/context_items.rs | actix/src/context_items.rs | use std::{
future::Future,
pin::Pin,
task::{self, Poll},
time::Duration,
};
use futures_core::{ready, stream::Stream};
use pin_project_lite::pin_project;
use crate::{
actor::{Actor, ActorContext, AsyncContext},
clock::Sleep,
fut::ActorFuture,
handler::{Handler, Message, MessageResponse... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/context.rs | actix/src/context.rs | use std::fmt;
use crate::{
actor::{Actor, ActorContext, ActorState, AsyncContext, SpawnHandle},
address::{Addr, AddressReceiver},
context_impl::{AsyncContextParts, ContextFut, ContextParts},
fut::ActorFuture,
mailbox::Mailbox,
};
/// An actor execution context.
pub struct Context<A>
where
A: A... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/handler.rs | actix/src/handler.rs | use std::{fmt, future::Future, pin::Pin, sync::Arc};
pub use tokio::sync::oneshot::Sender as OneshotSender;
use crate::{
actor::{Actor, AsyncContext},
address::Addr,
fut::{ActorFuture, ActorFutureExt, LocalBoxActorFuture},
};
/// Describes how to handle messages of a specific type.
///
/// Implementing `... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/address/envelope.rs | actix/src/address/envelope.rs | use tokio::sync::oneshot::Sender;
use crate::{
actor::{Actor, AsyncContext},
context::Context,
handler::{Handler, Message, MessageResponse},
};
/// Converter trait, packs message into a suitable envelope.
pub trait ToEnvelope<A, M: Message>
where
A: Actor + Handler<M>,
A::Context: ToEnvelope<A, M>... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/address/mod.rs | actix/src/address/mod.rs | use std::{
error, fmt,
hash::{Hash, Hasher},
};
pub(crate) mod channel;
mod envelope;
mod message;
mod queue;
pub(crate) use self::channel::{AddressReceiver, AddressSenderProducer};
use self::channel::{AddressSender, Sender, WeakAddressSender, WeakSender};
pub use self::{
envelope::{Envelope, EnvelopeProx... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/address/channel.rs | actix/src/address/channel.rs | //! This is copy of [sync/mpsc/](https://github.com/rust-lang/futures-rs)
use std::{
fmt,
hash::{Hash, Hasher},
pin::Pin,
sync::{
atomic::{
AtomicBool, AtomicUsize,
Ordering::{Relaxed, SeqCst},
},
Arc, Weak,
},
task::{self, Poll},
thread,
};
... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/address/message.rs | actix/src/address/message.rs | use std::{
future::Future,
pin::Pin,
task::{self, Poll},
time::Duration,
};
use pin_project_lite::pin_project;
use tokio::sync::oneshot;
use super::{
channel::{AddressSender, Sender},
MailboxError, SendError,
};
use crate::{clock::Sleep, handler::Message};
pub type Request<A, M> = MsgRequest<... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/address/queue.rs | actix/src/address/queue.rs | /* Copyright (c) 2010-2011 Dmitry Vyukov. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of con... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/mod.rs | actix/src/fut/mod.rs | //! Custom `Future` and `Stream` implementation with `actix` support.
pub mod future;
pub mod stream;
pub mod try_future;
pub use self::{
future::{
result::{err, ok, ready, result, Ready},
wrap_future, ActorFuture, ActorFutureExt, LocalBoxActorFuture, WrapFuture,
},
stream::{wrap_stream, A... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/stream/fold.rs | actix/src/fut/stream/fold.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use futures_core::ready;
use pin_project_lite::pin_project;
use crate::{
actor::Actor,
fut::{ActorFuture, ActorStream},
};
pin_project! {
/// Stream for the [`fold`](super::ActorStreamExt::fold) method.
#[derive(Debug)]
#[must_use = "streams ... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/stream/timeout.rs | actix/src/fut/stream/timeout.rs | use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
time::Duration,
};
use pin_project_lite::pin_project;
use crate::{
actor::Actor,
clock::{sleep, Instant, Sleep},
fut::ActorStream,
};
pin_project! {
/// Stream for the [`timeout`](super::ActorStreamExt::timeout) method.
#... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/stream/collect.rs | actix/src/fut/stream/collect.rs | use std::{
mem,
pin::Pin,
task::{Context, Poll},
};
use futures_core::ready;
use pin_project_lite::pin_project;
use super::ActorStream;
use crate::{actor::Actor, fut::future::ActorFuture};
pin_project! {
/// Future for the [`collect`](super::ActorStreamExt::collect) method.
#[derive(Debug)]
#... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/stream/map.rs | actix/src/fut/stream/map.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use futures_core::ready;
use pin_project_lite::pin_project;
use crate::{actor::Actor, fut::ActorStream};
pin_project! {
/// Stream for the [`map`](super::ActorStreamExt::map) method.
#[derive(Debug)]
#[must_use = "streams do nothing unless polled"]
... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/stream/skip_while.rs | actix/src/fut/stream/skip_while.rs | use std::{
pin::Pin,
task::{self, Poll},
};
use futures_core::ready;
use pin_project_lite::pin_project;
use crate::{
actor::Actor,
fut::{ActorFuture, ActorStream},
};
pin_project! {
/// Stream for the [`skip_while`](super::ActorStreamExt::skip_while) method.
#[derive(Debug)]
#[must_use = ... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/stream/mod.rs | actix/src/fut/stream/mod.rs | use std::{
marker::PhantomData,
pin::Pin,
task::{Context, Poll},
time::Duration,
};
pub use collect::Collect;
pub use finish::Finish;
pub use fold::Fold;
use futures_core::stream::Stream;
pub use map::Map;
use pin_project_lite::pin_project;
pub use skip_while::SkipWhile;
pub use take_while::TakeWhile;
... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/stream/then.rs | actix/src/fut/stream/then.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use futures_core::ready;
use pin_project_lite::pin_project;
use crate::{
actor::Actor,
fut::{ActorFuture, ActorStream},
};
pin_project! {
/// Stream for the [`then`](super::ActorStreamExt::then) method.
#[derive(Debug)]
#[must_use = "streams ... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/stream/take_while.rs | actix/src/fut/stream/take_while.rs | use std::{
pin::Pin,
task::{self, Poll},
};
use futures_core::ready;
use pin_project_lite::pin_project;
use crate::{
actor::Actor,
fut::{ActorFuture, ActorStream},
};
pin_project! {
/// Stream for the [`take_while`](super::ActorStreamExt::take_while) method.
#[must_use = "streams do nothing u... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/stream/finish.rs | actix/src/fut/stream/finish.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use futures_core::ready;
use pin_project_lite::pin_project;
use crate::{
actor::Actor,
fut::{ActorFuture, ActorStream},
};
pin_project! {
/// Future for the [`finish`](super::ActorStreamExt::finish) method.
#[derive(Debug)]
#[must_use = "stre... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/try_future/map_ok.rs | actix/src/fut/try_future/map_ok.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use futures_core::ready;
use pin_project_lite::pin_project;
use crate::{
fut::{future::ActorFuture, try_future::ActorTryFuture},
Actor,
};
pin_project! {
/// Future for the [`map`](super::ActorTryFutureExt::map_ok) method.
#[project = MapProj]
... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/try_future/and_then.rs | actix/src/fut/try_future/and_then.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use futures_util::ready;
use pin_project_lite::pin_project;
use crate::{
actor::Actor,
fut::{future::ActorFuture, try_future::ActorTryFuture},
};
pin_project! {
/// Future for the `and_then` combinator, chaining computations
/// on the end of ano... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/try_future/mod.rs | actix/src/fut/try_future/mod.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use crate::{actor::Actor, fut::future::ActorFuture};
mod and_then;
mod map_err;
mod map_ok;
pub use and_then::AndThen;
pub use map_err::MapErr;
pub use map_ok::MapOk;
mod private_try_act_future {
use super::{Actor, ActorFuture};
pub trait Sealed<A> {}
... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/try_future/map_err.rs | actix/src/fut/try_future/map_err.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use futures_core::ready;
use pin_project_lite::pin_project;
use crate::{
fut::{future::ActorFuture, try_future::ActorTryFuture},
Actor,
};
pin_project! {
/// Future for the [`map`](super::ActorTryFutureExt::map_err) method.
#[project = MapProj]
... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/future/timeout.rs | actix/src/fut/future/timeout.rs | use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
time::Duration,
};
use pin_project_lite::pin_project;
use crate::{
actor::Actor,
clock::{sleep, Sleep},
fut::ActorFuture,
};
pin_project! {
/// Future for the [`timeout`](super::ActorFutureExt::timeout) combinator, interrupts... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
actix/actix | https://github.com/actix/actix/blob/2c5f02d92e2b799d75f726953c21ca6792e977df/actix/src/fut/future/map.rs | actix/src/fut/future/map.rs | use std::{
pin::Pin,
task::{Context, Poll},
};
use futures_core::ready;
use pin_project_lite::pin_project;
use crate::{actor::Actor, fut::ActorFuture};
pin_project! {
/// Future for the [`map`](super::ActorFutureExt::map) method.
#[project = MapProj]
#[project_replace = MapProjReplace]
#[deri... | rust | Apache-2.0 | 2c5f02d92e2b799d75f726953c21ca6792e977df | 2026-01-04T15:46:08.097085Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.