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_lexer/src/parser/mod.rs
crates/swc_ecma_lexer/src/parser/mod.rs
#![allow(clippy::let_unit_value)] #![deny(non_snake_case)] use swc_ecma_ast::*; use crate::{ common::{ input::Tokens, parser::{ buffer::Buffer as BufferTrait, expr::{parse_lhs_expr, parse_primary_expr, parse_tagged_tpl, parse_unary_expr}, jsx::parse_jsx_element,...
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_lexer/src/lexer/number.rs
crates/swc_ecma_lexer/src/lexer/number.rs
#[cfg(test)] mod tests { use std::panic; use num_bigint::BigInt as BigIntValue; use swc_atoms::Atom; use super::super::*; fn lex<F, Ret>(s: &'static str, f: F) -> Ret where F: FnOnce(&mut Lexer<'_>) -> Ret, { crate::with_test_sess(s, |_, input| { let mut l = Le...
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_lexer/src/lexer/tests.rs
crates/swc_ecma_lexer/src/lexer/tests.rs
extern crate test; use std::{ops::Range, str}; use swc_atoms::{ atom, wtf8::{CodePoint, Wtf8Buf}, Atom, }; use swc_common::{BytePos, Span}; use swc_ecma_ast::{AssignOp, AssignOp::*}; use test::{black_box, Bencher}; use super::state::{lex, lex_module_errors, lex_tokens, with_lexer}; use crate::{ commo...
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_lexer/src/lexer/table.rs
crates/swc_ecma_lexer/src/lexer/table.rs
//! Lookup table for byte handlers. //! //! Idea is taken from ratel. //! //! https://github.com/ratel-rust/ratel-core/blob/e55a1310ba69a3f5ce2a9a6eef643feced02ac08/ratel/src/lexer/mod.rs#L665 use either::Either; use swc_common::input::Input; use swc_ecma_ast::AssignOp; use super::{LexResult, Lexer, LexerTrait}; use ...
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_lexer/src/lexer/state.rs
crates/swc_ecma_lexer/src/lexer/state.rs
use std::mem::take; use smallvec::{smallvec, SmallVec}; use swc_common::{BytePos, Span}; use swc_ecma_ast::EsVersion; use tracing::trace; use super::{Context, Input, Lexer, LexerTrait}; use crate::{ common::{ input::Tokens, lexer::{ char::CharExt, comments_buffer::{Buffered...
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_lexer/src/lexer/mod.rs
crates/swc_ecma_lexer/src/lexer/mod.rs
//! ECMAScript lexer. use std::{cell::RefCell, char, iter::FusedIterator, rc::Rc}; use swc_atoms::{wtf8::Wtf8, AtomStoreCell}; use swc_common::{ comments::Comments, input::{Input, StringInput}, BytePos, Span, }; use swc_ecma_ast::{AssignOp, EsVersion}; pub use self::state::{TokenContext, TokenContexts, 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_lexer/src/lexer/comments_buffer.rs
crates/swc_ecma_lexer/src/lexer/comments_buffer.rs
use std::{iter::Rev, rc::Rc, vec::IntoIter}; use swc_common::{comments::Comment, BytePos}; use crate::common::lexer::comments_buffer::{ BufferedComment, BufferedCommentKind, CommentsBufferTrait, }; #[derive(Clone)] pub struct CommentsBuffer { comments: OneDirectionalList<BufferedComment>, pending_leading...
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_lexer/src/lexer/jsx.rs
crates/swc_ecma_lexer/src/lexer/jsx.rs
use either::Either; use super::*; impl Lexer<'_> { pub(super) fn read_jsx_token(&mut self) -> LexResult<Token> { debug_assert!(self.syntax.jsx()); let start = self.input.cur_pos(); let mut chunk_start = self.input.cur_pos(); let mut value = String::new(); loop { ...
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_lexer/examples/lexer.rs
crates/swc_ecma_lexer/examples/lexer.rs
use std::{ffi::OsStr, path::Path}; use swc_common::{ errors::{ColorConfig, Handler}, input::StringInput, sync::Lrc, SourceMap, }; use swc_ecma_lexer::{lexer, lexer::Lexer, EsSyntax, Syntax, TsSyntax}; fn main() { let cm: Lrc<SourceMap> = Default::default(); let handler = Handler::with_tty_emit...
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_transforms/src/lib.rs
crates/swc_ecma_transforms/src/lib.rs
#![deny(clippy::all)] #![cfg_attr(docsrs, feature(doc_cfg))] #![deny(unused)] pub use swc_ecma_transforms_base::{ assumptions::Assumptions, fixer, helpers, hygiene, perf, resolver, }; // TODO: May remove these reexports once swc_core directly reexports all #[cfg(feature = "swc_ecma_transforms_compat")] #[cfg_attr(...
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_transforms/tests/deno.rs
crates/swc_ecma_transforms/tests/deno.rs
#![cfg(all( feature = "swc_ecma_transforms_proposal", feature = "swc_ecma_transforms_typescript", ))] use std::path::PathBuf; use swc_common::Mark; use swc_ecma_parser::Syntax; use swc_ecma_transforms::{fixer, helpers::inject_helpers, hygiene, resolver}; use swc_ecma_transforms_proposal::{ decorator_2022_0...
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_transforms/tests/decorators.rs
crates/swc_ecma_transforms/tests/decorators.rs
#![cfg(all( feature = "swc_ecma_transforms_compat", feature = "swc_ecma_transforms_module", feature = "swc_ecma_transforms_optimization", feature = "swc_ecma_transforms_proposal", ))] use std::{fs, path::PathBuf}; use swc_common::Mark; use swc_ecma_ast::Pass; use swc_ecma_parser::{EsSyntax, Syntax, Ts...
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_transforms/tests/es2015_function_name.rs
crates/swc_ecma_transforms/tests/es2015_function_name.rs
#![cfg(all( feature = "swc_ecma_transforms_compat", feature = "swc_ecma_transforms_module", feature = "swc_ecma_transforms_optimization", feature = "swc_ecma_transforms_proposal", ))] use swc_common::Mark; use swc_ecma_ast::Pass; use swc_ecma_parser::Syntax; use swc_ecma_transforms_base::resolver; use ...
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_transforms_macros/src/lib.rs
crates/swc_ecma_transforms_macros/src/lib.rs
#![deny(clippy::all)] #![recursion_limit = "2048"] use proc_macro::TokenStream; use quote::ToTokens; use swc_macros_common::print; mod common; mod fast; mod parallel; /// This macro adds fast-path to the `swc_ecma_visit::Fold` and /// `swc_ecma_visit::Visit`. /// /// Currently this macro modifies handler of `Expr`, ...
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_transforms_macros/src/parallel.rs
crates/swc_ecma_transforms_macros/src/parallel.rs
#![allow(non_snake_case)] use proc_macro2::{Span, TokenStream}; use syn::{parse_quote, Expr, Ident, ImplItem, ImplItemFn, ItemImpl, Meta, Type}; use crate::common::Mode; pub fn expand(attr: TokenStream, mut item: ItemImpl) -> ItemImpl { let mode = { let p = &item.trait_.as_ref().unwrap().1; if p....
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_transforms_macros/src/fast.rs
crates/swc_ecma_transforms_macros/src/fast.rs
use proc_macro2::TokenStream; use quote::quote; use swc_macros_common::call_site; use syn::{parse_quote, FnArg, Ident, ImplItem, ImplItemFn, ItemImpl, Pat, Path}; use crate::common::Mode; pub fn expand(attr: TokenStream, item: ItemImpl) -> ItemImpl { let expander = Expander { handler: syn::parse2(attr).ex...
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_transforms_macros/src/common.rs
crates/swc_ecma_transforms_macros/src/common.rs
/// Type of the visitor. #[derive(Debug, Clone, Copy)] pub enum Mode { Fold, VisitMut, } impl Mode { pub fn prefix(self) -> &'static str { match self { Mode::Fold => "fold", Mode::VisitMut => "visit_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_bundler/build.rs
crates/swc_node_bundler/build.rs
//! We need OUT_DIR fn main() {}
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_bundler/src/lib.rs
crates/swc_node_bundler/src/lib.rs
#![cfg_attr(test, feature(test))] #[cfg(test)] extern crate test; /// Explicit extern crate to use allocator. extern crate swc_malloc; pub mod loaders; #[cfg(feature = "swc_v1")] pub mod v1; #[cfg(feature = "swc_v2")] pub mod v2; #[cfg(all(not(feature = "swc_v1"), not(feature = "swc_v2")))] compile_error!("Please e...
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_bundler/src/v1/mod.rs
crates/swc_node_bundler/src/v1/mod.rs
use std::{collections::HashMap, fmt, marker::PhantomData, path::PathBuf}; use rustc_hash::FxHashMap; use serde::Deserialize; use string_enum::StringEnum; use swc_atoms::Atom; use swc_common::FileName; use swc_ecma_ast::EsVersion; use swc_ecma_loader::TargetEnv; pub use self::{ module::ModuleConfig, optimizati...
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_bundler/src/v1/resolve.rs
crates/swc_node_bundler/src/v1/resolve.rs
use std::{collections::HashMap, path::PathBuf}; use serde::Deserialize; use swc_atoms::{atom, Atom}; /// https://webpack.js.org/configuration/resolve/ #[derive(Debug, Deserialize)] #[serde(rename = "Resolve", rename_all = "camelCase")] pub struct ResolveConfig { #[serde(default)] pub alias: Option<AliasConfig...
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_bundler/src/v1/output.rs
crates/swc_node_bundler/src/v1/output.rs
use std::path::PathBuf; use serde::Deserialize; #[derive(Debug, Deserialize)] #[serde(rename = "Output")] #[serde(rename_all = "camelCase")] pub struct OutputConfig { pub path: PathBuf, #[serde(default)] pub name: String, }
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_bundler/src/v1/optimization.rs
crates/swc_node_bundler/src/v1/optimization.rs
use serde::Deserialize; use crate::v1::JsCallback; #[derive(Debug, Deserialize)] #[serde(rename = "Optimization", rename_all = "camelCase")] pub struct OptimizationConfig { #[serde(default)] pub minimize: bool, #[serde(skip)] pub minimizer: Option<JsCallback<String, String>>, #[serde(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_node_bundler/src/v1/module/mod.rs
crates/swc_node_bundler/src/v1/module/mod.rs
use serde::Deserialize; #[derive(Debug, Default, Deserialize)] #[serde(rename = "Module", rename_all = "camelCase")] pub struct ModuleConfig {}
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_bundler/src/v2/mod.rs
crates/swc_node_bundler/src/v2/mod.rs
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_bundler/src/loaders/swc.rs
crates/swc_node_bundler/src/loaders/swc.rs
use std::{collections::HashMap, env, sync::Arc}; use anyhow::{bail, Context, Error}; use helpers::Helpers; use rustc_hash::FxHashMap; use swc::{ config::{GlobalInliningPassEnvs, InputSourceMap, IsModule, JscConfig, TransformConfig}, try_with_handler, }; use swc_atoms::Atom; use swc_bundler::{Load, ModuleData};...
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_bundler/src/loaders/json.rs
crates/swc_node_bundler/src/loaders/json.rs
use std::sync::Arc; use anyhow::{anyhow, Error}; use swc_atoms::atom; use swc_common::{SourceFile, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_parser::{parse_file_as_expr, Syntax}; pub(super) fn load_json_as_module(fm: &Arc<SourceFile>) -> Result<Module, Error> { let expr = parse_file_as_expr( fm, ...
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_bundler/src/loaders/mod.rs
crates/swc_node_bundler/src/loaders/mod.rs
mod json; pub mod swc;
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_bundler/tests/fixture.rs
crates/swc_node_bundler/tests/fixture.rs
use std::{ collections::HashMap, fs::{create_dir_all, read_dir}, io::{self}, path::PathBuf, sync::Arc, }; use anyhow::Error; use swc::{resolver::environment_resolver, PrintArgs}; use swc_bundler::{BundleKind, Bundler, Config, ModuleRecord}; use swc_common::{errors::HANDLER, FileName, Globals, Span,...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/preset_env_base/src/lib.rs
crates/preset_env_base/src/lib.rs
//! Base crate for `preset-env`-like crates. //! //! This crate provides an interface to convert `browserslist` query to //! something usable. use anyhow::Error; use serde::{Deserialize, Serialize}; use st_map::StaticMap; use self::version::Version; pub mod query; pub mod version; /// A map without allocation. #[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/preset_env_base/src/version.rs
crates/preset_env_base/src/version.rs
//! Module for browser versions use std::{cmp, cmp::Ordering, fmt, str::FromStr}; use serde::{de, de::Visitor, Deserialize, Deserializer, Serialize}; use tracing::warn; use crate::Versions; /// A version of a browser. /// /// This is similar to semver, but this assumes a production build. (No tag like /// `alpha`) ...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/preset_env_base/src/query.rs
crates/preset_env_base/src/query.rs
//! Module for `browserslist` queries. #![deny(clippy::all)] use std::{collections::HashMap, path::PathBuf, sync::Arc}; use anyhow::{anyhow, Context, Error}; use dashmap::DashMap; use from_variant::FromVariant; use once_cell::sync::Lazy; use rustc_hash::FxBuildHasher; use serde::Deserialize; use crate::{version::Ver...
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_css_codegen/src/lib.rs
crates/swc_css_codegen/src/lib.rs
#![deny(clippy::all)] #![allow(clippy::needless_update)] #![allow(non_local_definitions)] pub use std::fmt::Result; use std::{borrow::Cow, str, str::from_utf8}; use serde::{Deserialize, Serialize}; use swc_atoms::atom; use swc_common::{BytePos, Span, Spanned, DUMMY_SP}; use swc_css_ast::*; use swc_css_codegen_macros:...
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_css_codegen/src/list.rs
crates/swc_css_codegen/src/list.rs
#![allow(non_upper_case_globals)] use bitflags::bitflags; bitflags! { #[derive(PartialEq, Eq, Copy, Clone)] pub struct ListFormat: u16 { const None = 0; // Line separators /// Prints the list on a single line (default). const SingleLine = 0; /// Prints the list on multi...
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_css_codegen/src/emit.rs
crates/swc_css_codegen/src/emit.rs
use std::fmt::Result; use swc_common::Spanned; /// /// # Type parameters /// /// ## `T` /// /// The type of the ast node. pub trait Emit<T> where T: Spanned, { fn emit(&mut self, node: &T) -> Result; } impl<T, E> Emit<&'_ T> for E where E: Emit<T>, T: Spanned, { #[allow(clippy::only_used_in_recur...
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_css_codegen/src/macros.rs
crates/swc_css_codegen/src/macros.rs
macro_rules! emit { ($g:expr,$n:expr) => {{ use crate::Emit; $g.emit(&$n)?; }}; } macro_rules! write_raw { ($g:expr,$span:expr,$n:expr) => {{ $g.wr.write_raw(Some($span), $n)?; }}; ($g:expr,$n:expr) => {{ $g.wr.write_raw(None, $n)?; }}; } macro_rules! write_st...
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_css_codegen/src/ctx.rs
crates/swc_css_codegen/src/ctx.rs
use std::ops::{Deref, DerefMut}; use crate::{writer::CssWriter, CodeGenerator}; impl<W> CodeGenerator<W> where W: CssWriter, { /// Original context is restored when returned guard is dropped. #[inline] pub(super) fn with_ctx(&mut self, ctx: Ctx) -> WithCtx<W> { let orig_ctx = self.ctx; ...
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_css_codegen/src/writer/mod.rs
crates/swc_css_codegen/src/writer/mod.rs
use std::fmt::Result; use auto_impl::auto_impl; use swc_common::Span; pub mod basic; #[auto_impl(&mut, Box)] pub trait CssWriter { fn write_space(&mut self) -> Result; fn write_newline(&mut self) -> Result; fn write_raw(&mut self, span: Option<Span>, text: &str) -> Result; fn write_str(&mut 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_css_codegen/src/writer/basic.rs
crates/swc_css_codegen/src/writer/basic.rs
use std::fmt::{Result, Write}; use rustc_hash::FxHashSet; use swc_common::{BytePos, LineCol, Span}; use super::CssWriter; #[derive(Clone, Default, Copy, PartialEq, Eq, Debug)] pub enum IndentType { Tab, #[default] Space, } #[derive(Clone, Default, Copy, PartialEq, Eq, Debug)] pub enum LineFeed { #[d...
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_css_codegen/tests/fixture.rs
crates/swc_css_codegen/tests/fixture.rs
use std::{ mem::take, path::{Path, PathBuf}, }; use swc_atoms::atom; use swc_common::{comments::SingleThreadedComments, sync::Lrc, FileName, Span}; use swc_css_ast::*; use swc_css_codegen::{ writer::basic::{BasicCssWriter, BasicCssWriterConfig, IndentType, LineFeed}, CodeGenerator, CodegenConfig, Emit,...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/testing_macros/src/lib.rs
crates/testing_macros/src/lib.rs
use proc_macro::TokenStream; use quote::{quote, ToTokens}; use syn::ItemFn; mod fixture; /// Create tests from files. /// /// **NOTE: Path should be relative to the directory of `Cargo.toml` file**. /// This is limitation of current proc macro api. /// /// # Why /// /// If you create test dynamically, running a speci...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/testing_macros/src/fixture.rs
crates/testing_macros/src/fixture.rs
use std::{ env, path::{Component, PathBuf}, }; use anyhow::{Context, Error}; use glob::glob; use once_cell::sync::Lazy; use proc_macro2::{Span, TokenStream}; use quote::quote; use regex::Regex; use relative_path::RelativePath; use syn::{ parse::{Parse, ParseStream}, parse2, punctuated::Punctuated, ...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/testing_macros/tests/test.rs
crates/testing_macros/tests/test.rs
#![deny(unused)] use std::path::PathBuf; use testing_macros::fixture; #[fixture("tests/simple/*.ts")] fn simple(_path: PathBuf) {} #[fixture("tests/ignore/**/*.ts")] fn ignored(_path: PathBuf) {} #[fixture("tests/simple/**/*.ts")] #[fixture("tests/simple/**/*.tsx")] fn multiple(_path: PathBuf) {} #[fixture("tests...
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_es2018/src/object_rest_spread.rs
crates/swc_ecma_compat_es2018/src/object_rest_spread.rs
use serde::Deserialize; use swc_ecma_ast::Pass; // TODO: currently swc behaves like babel with // `ignoreFunctionLength` on /// `@babel/plugin-proposal-object-rest-spread` pub fn object_rest_spread(config: Config) -> impl Pass { let mut options = swc_ecma_transformer::Options::default(); options.assumptions....
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_es2018/src/lib.rs
crates/swc_ecma_compat_es2018/src/lib.rs
#![allow(clippy::vec_box)] #![allow(clippy::boxed_local)] use serde::Deserialize; use swc_ecma_ast::Pass; pub use self::object_rest_spread::object_rest_spread; pub mod object_rest_spread; pub fn es2018(config: Config) -> impl Pass { let mut options = swc_ecma_transformer::Options::default(); { opti...
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_cli_impl/src/lib.rs
crates/swc_cli_impl/src/lib.rs
use clap::Parser; use commands::{Command, CommandRunner, PluginSubcommand, SwcCliOptions}; mod commands; mod util; pub fn run() -> anyhow::Result<()> { let command = SwcCliOptions::parse().command; match &command { Command::Plugin(PluginSubcommand::New(options)) => options.execute(), Command:...
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_cli_impl/src/main.rs
crates/swc_cli_impl/src/main.rs
//! Used for testing fn main() -> anyhow::Result<()> { swc_cli_impl::run() }
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_cli_impl/src/util/trace.rs
crates/swc_cli_impl/src/util/trace.rs
use tracing_chrome::{ChromeLayerBuilder, FlushGuard}; use tracing_subscriber::{ filter, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt, Layer, }; /// Register a tracing subscriber generated event trace format output. pub(crate) fn init_trace(out_file: &Option<String>) -> Option<FlushGuard> { ...
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_cli_impl/src/util/mod.rs
crates/swc_cli_impl/src/util/mod.rs
pub(crate) mod trace;
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_cli_impl/src/commands/bundle.rs
crates/swc_cli_impl/src/commands/bundle.rs
use clap::Parser; use swc_core::trace_macro::swc_trace; #[derive(Parser)] pub struct BundleOptions {} #[swc_trace] impl super::CommandRunner for BundleOptions { fn execute(&self) -> anyhow::Result<()> { unimplemented!("Bundle command is not yet implemented") } }
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_cli_impl/src/commands/compile.rs
crates/swc_cli_impl/src/commands/compile.rs
use std::{ fs::{self, File}, io::{self, IsTerminal, Read, Write}, path::{Component, Path, PathBuf}, sync::Arc, }; use anyhow::Context; use clap::Parser; use glob::glob; use par_iter::prelude::*; use path_absolutize::Absolutize; use relative_path::RelativePath; use swc_core::{ base::{ config...
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_cli_impl/src/commands/lint.rs
crates/swc_cli_impl/src/commands/lint.rs
use clap::Parser; use swc_core::trace_macro::swc_trace; #[derive(Parser)] pub struct LintOptions {} #[swc_trace] impl super::CommandRunner for LintOptions { fn execute(&self) -> anyhow::Result<()> { unimplemented!("Lint command is not yet implemented") } }
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_cli_impl/src/commands/mod.rs
crates/swc_cli_impl/src/commands/mod.rs
use clap::{Parser, Subcommand}; mod bundle; mod compile; mod lint; mod minify; mod plugin; pub use bundle::*; pub use compile::*; pub use lint::*; pub use minify::*; pub use plugin::PluginSubcommand; // Set of subcommands supported by the `swc` command. #[derive(Subcommand)] pub enum Command { /// Commandline ut...
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_cli_impl/src/commands/minify.rs
crates/swc_cli_impl/src/commands/minify.rs
use clap::Parser; use swc_core::trace_macro::swc_trace; #[derive(Parser)] pub struct MinifyOptions {} #[swc_trace] impl super::CommandRunner for MinifyOptions { fn execute(&self) -> anyhow::Result<()> { unimplemented!("Minify command is not yet implemented") } }
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_cli_impl/src/commands/plugin.rs
crates/swc_cli_impl/src/commands/plugin.rs
use std::{ fs::{self, create_dir_all, File, OpenOptions}, io::{BufRead, BufReader, ErrorKind, Write}, path::{Path, PathBuf}, }; use anyhow::{Context, Result}; use clap::{ArgEnum, Parser, Subcommand}; use swc_core::diagnostics::get_core_engine_diagnostics; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, O...
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_cli_impl/tests/issues.rs
crates/swc_cli_impl/tests/issues.rs
use std::{ fs::{self, create_dir_all, hard_link}, path::Path, process::{Command, Stdio}, }; use anyhow::{Context, Result}; use assert_cmd::prelude::*; use assert_fs::TempDir; fn cli() -> Result<Command> { let mut cmd = Command::cargo_bin("swc").context("Failed to get swc binary")?; cmd.stderr(Stdi...
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_cli_impl/examples/cli.rs
crates/swc_cli_impl/examples/cli.rs
fn main() -> anyhow::Result<()> { swc_cli_impl::run() }
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_trace_macro/src/lib.rs
crates/swc_trace_macro/src/lib.rs
extern crate proc_macro; use quote::ToTokens; use syn::{parse_quote, AttrStyle, Attribute, ImplItem, ItemImpl}; /// Utility proc macro to add `#[tracing::instrument(level = "info", /// skip_all)]` to all methods in an impl block. /// /// This attribute macro is typically applied on an `VisitMut` impl block. /// If th...
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_es2019/src/lib.rs
crates/swc_ecma_compat_es2019/src/lib.rs
use swc_ecma_ast::Pass; pub use self::optional_catch_binding::optional_catch_binding; mod optional_catch_binding; pub fn es2019() -> impl Pass { optional_catch_binding() }
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_es2019/src/optional_catch_binding.rs
crates/swc_ecma_compat_es2019/src/optional_catch_binding.rs
use swc_ecma_ast::*; pub fn optional_catch_binding() -> impl Pass { let mut options = swc_ecma_transformer::Options::default(); options.env.es2019.optional_catch_binding = true; options.into_pass() } #[cfg(test)] mod tests { use swc_common::Mark; use swc_ecma_ast::Pass; use swc_ecma_transforms...
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_css_parser/src/lib.rs
crates/swc_css_parser/src/lib.rs
#![cfg_attr(docsrs, feature(doc_cfg))] #![deny(unused_must_use)] #![deny(clippy::all)] #![allow(clippy::needless_return)] #![allow(clippy::nonminimal_bool)] #![allow(clippy::wrong_self_convention)] use swc_common::{comments::Comments, input::StringInput, SourceFile}; use crate::{ error::Error, lexer::Lexer, ...
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_css_parser/src/tests.rs
crates/swc_css_parser/src/tests.rs
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_css_parser/src/error.rs
crates/swc_css_parser/src/error.rs
use std::borrow::Cow; use swc_atoms::Atom; use swc_common::{ errors::{DiagnosticBuilder, Handler}, Span, }; /// Size is same as a size of a pointer. #[derive(Debug, Clone, PartialEq, Eq)] pub struct Error { inner: Box<(Span, ErrorKind)>, } impl Error { pub fn kind(&self) -> &ErrorKind { &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_css_parser/src/macros.rs
crates/swc_css_parser/src/macros.rs
macro_rules! tok { ("number") => { swc_css_ast::Token::Number { .. } }; ("dimension") => { swc_css_ast::Token::Dimension { .. } }; ("percentage") => { swc_css_ast::Token::Percentage { .. } }; ("function") => { swc_css_ast::Token::Function { .. } }; ...
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_css_parser/src/parser/tests.rs
crates/swc_css_parser/src/parser/tests.rs
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_css_parser/src/parser/util.rs
crates/swc_css_parser/src/parser/util.rs
use std::ops::{Deref, DerefMut}; use swc_common::{Span, Spanned, DUMMY_SP}; use swc_css_ast::*; use super::{ input::{Input, InputType, ParserInput}, Ctx, Error, PResult, Parse, Parser, }; use crate::{error::ErrorKind, parser::BlockContentsGrammar}; impl<I> Parser<I> where I: ParserInput, { /// Origin...
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_css_parser/src/parser/macros.rs
crates/swc_css_parser/src/parser/macros.rs
macro_rules! span { ($parser:expr, $start:expr) => {{ let last_pos = $parser.input.last_pos(); swc_common::Span::new($start, last_pos) }}; } macro_rules! tok_pat { (Ident) => { swc_css_ast::Token::Ident { .. } }; (Percentage) => { swc_css_ast::Token::Percentage { .....
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_css_parser/src/parser/mod.rs
crates/swc_css_parser/src/parser/mod.rs
use std::mem::take; use serde::{Deserialize, Serialize}; use swc_css_ast::*; use self::input::{Buffer, ParserInput}; use crate::{error::Error, Parse}; #[macro_use] mod macros; mod at_rules; pub mod input; mod selectors; mod syntax; #[cfg(test)] mod tests; mod util; mod values_and_units; pub type PResult<T> = Result...
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_css_parser/src/parser/input.rs
crates/swc_css_parser/src/parser/input.rs
use std::{borrow::Cow, cell::RefCell, fmt::Debug, mem::take, rc::Rc}; use swc_atoms::{Atom, AtomStore}; use swc_common::{BytePos, Span, Spanned}; use swc_css_ast::{ComponentValue, FunctionName, ListOfComponentValues, Token, TokenAndSpan}; use super::PResult; use crate::error::{Error, ErrorKind}; pub trait ParserInpu...
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_css_parser/src/parser/selectors/mod.rs
crates/swc_css_parser/src/parser/selectors/mod.rs
use swc_atoms::Atom; use swc_common::{BytePos, Span, Spanned}; use swc_css_ast::*; use super::{input::ParserInput, PResult, Parser}; use crate::{ error::{Error, ErrorKind}, parser::Ctx, Parse, }; impl<I> Parse<SelectorList> for Parser<I> where I: ParserInput, { fn parse(&mut self) -> PResult<Selec...
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_css_parser/src/parser/syntax/mod.rs
crates/swc_css_parser/src/parser/syntax/mod.rs
use swc_common::{BytePos, Span, Spanned}; use swc_css_ast::*; use super::{input::ParserInput, PResult, Parser}; use crate::{ error::{Error, ErrorKind}, parser::{BlockContentsGrammar, Ctx}, Parse, }; impl<I> Parse<Stylesheet> for Parser<I> where I: ParserInput, { fn parse(&mut self) -> PResult<Styl...
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_css_parser/src/parser/at_rules/mod.rs
crates/swc_css_parser/src/parser/at_rules/mod.rs
use swc_common::{Span, Spanned}; use swc_css_ast::*; use super::{input::ParserInput, PResult, Parser}; use crate::{ error::{Error, ErrorKind}, parser::{values_and_units::is_math_function, BlockContentsGrammar, Ctx}, Parse, }; impl<I> Parser<I> where I: ParserInput, { pub(super) fn parse_at_rule_pr...
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_css_parser/src/parser/values_and_units/mod.rs
crates/swc_css_parser/src/parser/values_and_units/mod.rs
use swc_atoms::Atom; use swc_common::{BytePos, Span}; use swc_css_ast::*; use super::{input::ParserInput, PResult, Parser}; use crate::{ error::{Error, ErrorKind}, Parse, }; impl<I> Parser<I> where I: ParserInput, { pub(super) fn parse_generic_values(&mut self) -> PResult<Vec<ComponentValue>> { ...
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_css_parser/src/lexer/mod.rs
crates/swc_css_parser/src/lexer/mod.rs
use std::{borrow::Cow, cell::RefCell, char::REPLACEMENT_CHARACTER, rc::Rc}; use swc_atoms::{Atom, AtomStoreCell}; use swc_common::{ comments::{Comment, CommentKind, Comments}, input::Input, util::take::Take, BytePos, Span, }; use swc_css_ast::{ matches_eq_ignore_ascii_case, DimensionToken, NumberTy...
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_css_parser/tests/fixture.rs
crates/swc_css_parser/tests/fixture.rs
#![deny(warnings)] #![allow(clippy::needless_update)] use std::{path::PathBuf, rc::Rc}; use swc_common::{ comments::SingleThreadedComments, errors::Handler, input::SourceFileInput, Span, Spanned, }; use swc_css_ast::*; use swc_css_parser::{ lexer::Lexer, parse_input, parser::{ input::{InputTyp...
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_css_parser/benches/lexer.rs
crates/swc_css_parser/benches/lexer.rs
extern crate swc_malloc; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; use swc_common::{input::StringInput, FileName}; use swc_css_parser::lexer::Lexer; fn bench_stylesheet(b: &mut Bencher, src: &'static str) { let _ = ::testing::run_test(false, |cm, _| { ...
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_css_parser/benches/parser.rs
crates/swc_css_parser/benches/parser.rs
extern crate swc_malloc; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; use swc_common::{input::StringInput, FileName}; use swc_css_parser::{lexer::Lexer, parser::Parser}; fn bench_stylesheet(b: &mut Bencher, src: &'static str) { let _ = ::testing::run_test(false,...
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_css_parser/benches/compare.rs
crates/swc_css_parser/benches/compare.rs
extern crate swc_malloc; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; use swc_common::{comments::SingleThreadedComments, input::StringInput, FileName, Span, DUMMY_SP}; use swc_css_ast::Stylesheet; use swc_css_parser::{lexer::Lexer, parser::Parser}; use swc_css_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/better_scoped_tls/src/lib.rs
crates/better_scoped_tls/src/lib.rs
//! Better scoped thread local storage. #[doc(hidden)] pub extern crate scoped_tls; /// See [scoped_tls::scoped_thread_local] for actual documentation. /// /// This is identical as [scoped_tls::scoped_thread_local] on release builds. #[macro_export] macro_rules! scoped_tls { ($(#[$attrs:meta])* $vis:vis static $n...
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_transforms_typescript/src/config.rs
crates/swc_ecma_transforms_typescript/src/config.rs
use bytes_str::BytesStr; use serde::{Deserialize, Serialize}; #[derive(Debug, Default, Serialize, Deserialize, Clone, Copy)] #[serde(rename_all = "camelCase")] pub struct Config { /// https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax #[serde(default)] pub verbatim_module_syntax: bool, /// N...
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_transforms_typescript/src/strip_type.rs
crates/swc_ecma_transforms_typescript/src/strip_type.rs
use std::mem; use swc_common::util::take::Take; use swc_ecma_ast::*; use swc_ecma_utils::stack_size::maybe_grow_default; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; use crate::type_to_none; pub fn strip_type() -> impl VisitMut { StripType::default() } /// This Module will strip all types/...
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_transforms_typescript/src/strip_import_export.rs
crates/swc_ecma_transforms_typescript/src/strip_import_export.rs
use rustc_hash::{FxHashMap, FxHashSet}; use swc_ecma_ast::*; use swc_ecma_utils::stack_size::maybe_grow_default; use swc_ecma_visit::{noop_visit_type, Visit, VisitMut, VisitMutWith, VisitWith}; use crate::{strip_type::IsConcrete, ImportsNotUsedAsValues}; #[derive(Debug, Default)] pub(crate) struct UsageCollect { ...
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_transforms_typescript/src/lib.rs
crates/swc_ecma_transforms_typescript/src/lib.rs
#![deny(clippy::all)] #![allow(clippy::vec_box)] #![allow(clippy::mutable_key_type)] pub use self::{strip_type::*, typescript::*}; mod config; mod macros; mod strip_import_export; mod strip_type; mod transform; mod ts_enum; pub mod typescript; mod utils;
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_transforms_typescript/src/typescript.rs
crates/swc_ecma_transforms_typescript/src/typescript.rs
use std::mem; use rustc_hash::FxHashSet; use swc_atoms::atom; use swc_common::{comments::Comments, sync::Lrc, util::take::Take, Mark, SourceMap, Span, Spanned}; use swc_ecma_ast::*; use swc_ecma_transforms_react::{parse_expr_for_jsx, JsxDirectives}; use swc_ecma_visit::{visit_mut_pass, VisitMut, VisitMutWith}; pub us...
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_transforms_typescript/src/transform.rs
crates/swc_ecma_transforms_typescript/src/transform.rs
use std::{iter, mem}; use rustc_hash::{FxHashMap, FxHashSet}; use swc_atoms::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_utils::{ alias_ident_for, constructor::inject_after_super, find_pat...
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_transforms_typescript/src/utils.rs
crates/swc_ecma_transforms_typescript/src/utils.rs
use swc_common::DUMMY_SP; use swc_ecma_ast::*; use swc_ecma_utils::ExprFactory; /// /// this.prop = value pub(crate) fn assign_value_to_this_prop(prop_name: PropName, value: Expr) -> Box<Expr> { let target = MemberExpr { obj: ThisExpr { span: DUMMY_SP }.into(), span: DUMMY_SP, prop: prop_na...
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_transforms_typescript/src/macros.rs
crates/swc_ecma_transforms_typescript/src/macros.rs
#[macro_export] macro_rules! type_to_none { ($name:ident, $T:ty) => { fn $name(&mut self, node: &mut Option<$T>) { *node = None; } }; }
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_transforms_typescript/src/ts_enum.rs
crates/swc_ecma_transforms_typescript/src/ts_enum.rs
use rustc_hash::FxHashMap; use swc_atoms::{atom, Atom, Wtf8Atom}; use swc_common::{SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::{ number::{JsNumber, ToJsString}, ExprFactory, }; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; #[inline] fn atom_from_wtf8_atom(value: &Wtf...
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_transforms_typescript/tests/strip_correctness.rs
crates/swc_ecma_transforms_typescript/tests/strip_correctness.rs
use std::path::PathBuf; use swc_common::{FileName, Mark}; use swc_ecma_ast::*; use swc_ecma_codegen::to_code_default; use swc_ecma_parser::{lexer::Lexer, EsSyntax, Parser, Syntax, TsSyntax}; use swc_ecma_transforms_base::{fixer::fixer, hygiene::hygiene, resolver}; use swc_ecma_transforms_typescript::typescript; #[tes...
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_transforms_typescript/tests/strip.rs
crates/swc_ecma_transforms_typescript/tests/strip.rs
use std::path::PathBuf; use swc_common::{comments::NoopComments, pass::Optional, Mark}; use swc_ecma_ast::Pass; use swc_ecma_parser::{Syntax, TsSyntax}; use swc_ecma_transforms_base::resolver; use swc_ecma_transforms_compat::{ class_fields_use_set::class_fields_use_set, es2015::{block_scoping, destructuring, p...
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_transforms_typescript/benches/compat.rs
crates/swc_ecma_transforms_typescript/benches/compat.rs
use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; use swc_common::{comments::SingleThreadedComments, sync::Lrc, FileName, Mark, SourceMap}; use swc_ecma_ast::{Module, Pass, Program}; use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax}; use swc_ecma_transforms_...
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_transforms_typescript/examples/ts_to_js.rs
crates/swc_ecma_transforms_typescript/examples/ts_to_js.rs
//! Usage: cargo run --example ts_to_js path/to/ts //! //! This program will emit output to stdout. use std::{env, path::Path}; use swc_common::{ comments::SingleThreadedComments, errors::{ColorConfig, Handler}, sync::Lrc, Globals, Mark, SourceMap, GLOBALS, }; use swc_ecma_codegen::to_code_default; us...
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_transforms_module/src/system_js.rs
crates/swc_ecma_transforms_module/src/system_js.rs
use anyhow::Context; use rustc_hash::FxHashMap; use serde::{Deserialize, Serialize}; use swc_atoms::Atom; use swc_common::{Mark, Span, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::{ member_expr, private_ident, quote_ident, quote_str, var::VarCollector, ExprFactory, }; use swc_ecma_visit::{fold...
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_transforms_module/src/umd.rs
crates/swc_ecma_transforms_module/src/umd.rs
use anyhow::Context; use swc_atoms::Atom; use swc_common::{ source_map::PURE_SP, sync::Lrc, util::take::Take, Mark, SourceMap, Span, SyntaxContext, DUMMY_SP, }; use swc_ecma_ast::*; use swc_ecma_transforms_base::helper_expr; use swc_ecma_utils::{ is_valid_prop_ident, private_ident, quote_ident, quote_str, E...
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_transforms_module/src/path.rs
crates/swc_ecma_transforms_module/src/path.rs
use std::{ borrow::Cow, env::current_dir, fs::canonicalize, io, path::{Component, Path, PathBuf}, sync::Arc, }; use anyhow::{anyhow, Context, Error}; use path_clean::PathClean; use pathdiff::diff_paths; use swc_atoms::Atom; use swc_common::{FileName, Mark, Span, SyntaxContext, DUMMY_SP}; use sw...
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_transforms_module/src/wtf8.rs
crates/swc_ecma_transforms_module/src/wtf8.rs
use std::borrow::Cow; use swc_atoms::{Atom, Wtf8Atom}; use swc_ecma_ast::Str; /// Convert a WTF-8 atom into a UTF-8 [`Atom`] by either reusing the original /// UTF-8 bytes or falling back to Rust's lossy conversion, which replaces only /// ill-formed code units with the replacement character. #[inline] pub(crate) fn ...
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_transforms_module/src/lib.rs
crates/swc_ecma_transforms_module/src/lib.rs
#![deny(clippy::all)] #![allow(clippy::needless_lifetimes)] #![allow(clippy::vec_box)] #![allow(clippy::mutable_key_type)] use serde::{Deserialize, Serialize}; use swc_common::{Span, SyntaxContext}; use util::Config; pub use self::{amd::amd, common_js::common_js, system_js::system_js, umd::umd}; #[macro_use] pub mod...
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_transforms_module/src/module_decl_strip.rs
crates/swc_ecma_transforms_module/src/module_decl_strip.rs
use indexmap::IndexMap; use rustc_hash::{FxHashMap, FxHashSet}; use swc_atoms::{atom, Atom}; use swc_common::{util::take::Take, Mark, Span, SyntaxContext}; use swc_ecma_ast::*; use swc_ecma_utils::{find_pat_ids, private_ident, quote_ident, ExprFactory}; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};...
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_transforms_module/src/import_analysis.rs
crates/swc_ecma_transforms_module/src/import_analysis.rs
use rustc_hash::FxHashMap; use swc_atoms::Atom; use swc_ecma_ast::*; use swc_ecma_transforms_base::enable_helper; use swc_ecma_visit::{ noop_visit_mut_type, noop_visit_type, visit_mut_pass, Visit, VisitMut, VisitWith, }; use crate::{module_decl_strip::LinkFlag, util::ImportInterop, wtf8::str_to_atom}; pub fn impo...
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_transforms_module/src/top_level_this.rs
crates/swc_ecma_transforms_module/src/top_level_this.rs
use swc_ecma_ast::*; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; pub struct TopLevelThis { found: bool, this: Expr, } pub(crate) fn top_level_this<V>(node: &mut V, replace_with: Expr) -> bool where V: VisitMutWith<TopLevelThis>, { let mut v = TopLevelThis { this: replace...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false