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_bundler/src/bundler/import/tests.rs
crates/swc_bundler/src/bundler/import/tests.rs
// use super::ImportHandler; // use crate::bundler::tests::suite; // use std::path::Path; // use swc_common::{FileName, Mark, SyntaxContext}; // use swc_ecma_visit::FoldWith; // #[test] // #[ignore] // fn ns_import_deglob_simple() { // suite().run(|t| { // let m = t.parse( // " // import * as 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_bundler/src/bundler/import/mod.rs
crates/swc_bundler/src/bundler/import/mod.rs
use anyhow::{Context, Error}; use rustc_hash::{FxHashMap, FxHashSet}; use swc_atoms::Atom; use swc_common::{sync::Lrc, FileName, Mark, Spanned, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::find_pat_ids; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; use super::Bundler; use cra...
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_bundler/src/debug/mod.rs
crates/swc_bundler/src/debug/mod.rs
#![allow(dead_code)] use std::io::{stderr, Write}; use swc_common::{sync::Lrc, SourceMap, SyntaxContext}; use swc_ecma_ast::{Ident, Module}; use swc_ecma_codegen::{text_writer::JsWriter, Emitter}; use swc_ecma_visit::{noop_fold_type, Fold, FoldWith}; #[cfg(not(debug_assertions))] pub(crate) fn print_hygiene(_: &str,...
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_bundler/tests/deno.rs
crates/swc_bundler/tests/deno.rs
//! In-tree testing for deno integration. //! //! This module exists because this is way easier than using copying requires //! files. use std::{collections::HashMap, fs::write, path::PathBuf, process::Command}; use anyhow::Error; use ntest::timeout; use rustc_hash::FxHashSet; use swc_atoms::atom; use swc_bundler::{B...
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_bundler/tests/fixture.rs
crates/swc_bundler/tests/fixture.rs
use std::{ collections::HashMap, fs::read_dir, io, path::{Path, PathBuf}, }; use anyhow::Error; use swc_atoms::atom; use swc_bundler::{BundleKind, Bundler, Config, ModuleRecord}; use swc_common::{errors::HANDLER, FileName, Globals, Span}; use swc_ecma_ast::{ Bool, Expr, IdentName, KeyValueProp, Lit...
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_bundler/tests/common/mod.rs
crates/swc_bundler/tests/common/mod.rs
use std::{ env::current_dir, fs::{create_dir_all, read_to_string, write}, io::Write, path::{Path, PathBuf}, }; use anyhow::{bail, Context, Error}; use path_clean::PathClean; use reqwest::Url; use sha1::{Digest, Sha1}; use swc_bundler::{Load, ModuleData, Resolve}; use swc_common::{ comments::SingleT...
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_bundler/examples/path.rs
crates/swc_bundler/examples/path.rs
use std::{collections::HashMap, io::stdout}; use anyhow::Error; use swc_bundler::{BundleKind, Bundler, Config, Hook, Load, ModuleData, ModuleRecord, Resolve}; use swc_common::{sync::Lrc, FileName, FilePathMapping, Globals, SourceMap, Span}; use swc_ecma_ast::KeyValueProp; use swc_ecma_codegen::{text_writer::JsWriter, ...
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_bundler/examples/bundle.rs
crates/swc_bundler/examples/bundle.rs
#![allow(clippy::needless_update)] /// Use memory allocator extern crate swc_malloc; use std::{ collections::HashMap, env, fs, path::Path, time::{Duration, Instant}, }; use anyhow::Error; use swc_atoms::atom; use swc_bundler::{Bundle, Bundler, Load, ModuleData, ModuleRecord}; use swc_common::{ er...
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_codegen_macros/src/lib.rs
crates/swc_ecma_codegen_macros/src/lib.rs
extern crate proc_macro; use proc_macro2::TokenStream; use swc_macros_common::prelude::*; use syn::{ fold::Fold, parse::{Parse, Parser}, token::Token, *, }; /// /// /// # Example /// /// ```ignore /// impl MacroNode for ParamOrTsParamProp { /// fn emit(&mut self, emitter: &mut Macro) -> 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_ecma_transforms_classes/src/lib.rs
crates/swc_ecma_transforms_classes/src/lib.rs
#![deny(clippy::all)] use swc_common::DUMMY_SP; use swc_ecma_ast::*; use swc_ecma_transforms_base::helper; use swc_ecma_utils::ExprFactory; #[macro_use] pub mod macros; pub mod super_field; /// Creates /// /// ```js /// Child.__proto__ || Object.getPrototypeOf(Child) /// ``` pub fn get_prototype_of(obj: Box<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_classes/src/macros.rs
crates/swc_ecma_transforms_classes/src/macros.rs
/// Not intended for public use. #[macro_export] macro_rules! visit_mut_only_key { () => { fn visit_mut_class_member(&mut self, m: &mut ClassMember) { match m { ClassMember::Method(m) => m.key.visit_mut_with(self), ClassMember::PrivateMethod(m) => m.key.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_ecma_transforms_classes/src/super_field.rs
crates/swc_ecma_transforms_classes/src/super_field.rs
use std::iter; use swc_common::{util::take::Take, Mark, Span, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_transforms_base::helper; use swc_ecma_utils::{is_rest_arguments, quote_ident, ExprFactory}; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; use super::get_prototype_of; /// Pro...
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_modules/src/imports.rs
crates/swc_css_modules/src/imports.rs
//! Import/export analyzer use swc_atoms::Atom; use swc_css_ast::{ ComponentValue, Declaration, DeclarationName, ImportHref, ImportPrelude, Stylesheet, UrlValue, }; use swc_css_visit::{Visit, VisitWith}; pub fn analyze_imports(ss: &Stylesheet) -> Vec<Atom> { let mut v = Analyzer { imports: Default::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_css_modules/src/lib.rs
crates/swc_css_modules/src/lib.rs
use rustc_hash::FxHashMap; use swc_atoms::Atom; use swc_common::{util::take::Take, Span}; use swc_css_ast::{ ComplexSelector, ComplexSelectorChildren, ComponentValue, Declaration, DeclarationName, Delimiter, DelimiterValue, FunctionName, Ident, KeyframesName, PseudoClassSelectorChildren, QualifiedRule, Qual...
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_modules/tests/fixture.rs
crates/swc_css_modules/tests/fixture.rs
use std::path::PathBuf; use indexmap::IndexMap; use serde::Serialize; use swc_atoms::Atom; use swc_css_codegen::{ writer::basic::{BasicCssWriter, BasicCssWriterConfig, IndentType}, CodeGenerator, Emit, }; use swc_css_modules::CssClassName; use swc_css_parser::parser::ParserConfig; use testing::NormalizedOutput...
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_modules/tests/with_compat.rs
crates/swc_css_modules/tests/with_compat.rs
//! Tests ported from https://github.com/thysultan/stylis.js //! //! License is MIT, which is original license at the time of copying. //! Original test authors have copyright for their work. #![deny(warnings)] #![allow(clippy::needless_update)] use std::path::PathBuf; use swc_atoms::Atom; use swc_css_ast::Stylesheet...
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_regexp_visit/src/lib.rs
crates/swc_ecma_regexp_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_ecma_regexp_visit/src/generated.rs
crates/swc_ecma_regexp_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_ecma_regexp_ast::*; #[doc = r" A visitor trait for traversing the AST."] pub trait Visit { #[doc = "Visit a node of type `Alternative`.\n\nBy default, th...
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_regexp/src/ast.rs
crates/swc_ecma_regexp/src/ast.rs
pub use swc_ecma_regexp_ast::*;
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_regexp/src/diagnostics.rs
crates/swc_ecma_regexp/src/diagnostics.rs
use std::{ borrow::Cow, fmt::{self, Display}, }; use swc_common::Span; type Either<T, E> = std::result::Result<T, E>; #[derive(Debug)] pub struct RegexpDiagnostic { message: Cow<'static, str>, label: Option<Either<Span, Vec<Span>>>, help: Option<Cow<'static, str>>, } impl RegexpDiagnostic { ...
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_regexp/src/lib.rs
crates/swc_ecma_regexp/src/lib.rs
pub mod ast; mod diagnostics; mod options; mod parser; mod surrogate_pair; pub use crate::{ options::Options, parser::{ConstructorParser, LiteralParser}, }; #[cfg(test)] mod test { use crate::{LiteralParser, Options}; type Case<'a> = ( &'a str, /* expected display, None means expect ...
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_regexp/src/options.rs
crates/swc_ecma_regexp/src/options.rs
#[derive(Clone, Copy, Debug, Default)] pub struct Options { /// Used to adjust `Span` positions to fit the global source code. pub pattern_span_offset: u32, /// Used to adjust `Span` positions to fit the global source code. pub flags_span_offset: u32, }
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_regexp/src/surrogate_pair.rs
crates/swc_ecma_regexp/src/surrogate_pair.rs
pub use swc_ecma_regexp_common::*;
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_regexp/src/parser/parser_impl.rs
crates/swc_ecma_regexp/src/parser/parser_impl.rs
use super::{ flags_parser::FlagsParser, pattern_parser::PatternParser, reader::Reader, span_factory::SpanFactory, }; use crate::{ ast, diagnostics::{self, Result}, options::Options, }; /// Regular expression parser for `/literal/` usage. /// - `pattern_text`: the text between `/` and `/` /// - `fla...
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_regexp/src/parser/span_factory.rs
crates/swc_ecma_regexp/src/parser/span_factory.rs
use swc_common::{BytePos, Span}; pub struct SpanFactory { span_offset: u32, } impl SpanFactory { pub fn new(span_offset: u32) -> Self { Self { span_offset } } /// Add base offset to `Span`. /// Span { start: 4, end: 12 } => Span { start: 4 + N, end: 12 + N } pub fn create(&self, start...
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_regexp/src/parser/mod.rs
crates/swc_ecma_regexp/src/parser/mod.rs
mod flags_parser; mod parser_impl; mod pattern_parser; mod reader; mod span_factory; pub use parser_impl::{ConstructorParser, LiteralParser}; #[cfg(test)] mod test { use crate::{ConstructorParser, LiteralParser, Options}; #[test] fn should_pass() { for (pattern_text, flags_text) in &[ ...
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_regexp/src/parser/flags_parser.rs
crates/swc_ecma_regexp/src/parser/flags_parser.rs
use rustc_hash::FxHashSet; use crate::{ diagnostics::{self, Result}, parser::{reader::Reader, span_factory::SpanFactory}, }; pub struct FlagsParser<'a> { reader: Reader<'a>, span_factory: SpanFactory, } impl<'a> FlagsParser<'a> { pub fn new(reader: Reader<'a>, span_offset: u32) -> 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_ecma_regexp/src/parser/reader/mod.rs
crates/swc_ecma_regexp/src/parser/reader/mod.rs
mod reader_impl; mod string_literal_parser; pub use reader_impl::Reader; #[cfg(test)] mod test { use crate::parser::reader::Reader; #[test] fn should_fail() { for reader in [ Reader::initialize(r#""Unterminated"#, true, true), Reader::initialize(r#""Unterminated"#, 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_ecma_regexp/src/parser/reader/reader_impl.rs
crates/swc_ecma_regexp/src/parser/reader/reader_impl.rs
use swc_atoms::Atom; use crate::{ diagnostics::Result, parser::reader::string_literal_parser::{ ast as StringLiteralAst, parse_regexp_literal, Options as StringLiteralParserOptions, Parser as StringLiteralParser, }, }; pub struct Reader<'a> { source_text: &'a str, units: Vec<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_ecma_regexp/src/parser/reader/string_literal_parser/parser_impl.rs
crates/swc_ecma_regexp/src/parser/reader/string_literal_parser/parser_impl.rs
use super::{ ast, characters::{ is_line_terminator, is_non_escape_character, is_single_escape_character, CR, LF, LS, PS, }, diagnostics, options::Options, }; use crate::{diagnostics::Result, parser::span_factory::SpanFactory}; // Internal representation of escape sequence resolved unit in a...
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_regexp/src/parser/reader/string_literal_parser/ast.rs
crates/swc_ecma_regexp/src/parser/reader/string_literal_parser/ast.rs
use swc_common::Span; #[derive(Debug)] pub struct StringLiteral { #[allow(unused, clippy::allow_attributes)] pub span: Span, #[allow(unused, clippy::allow_attributes)] pub kind: StringLiteralKind, pub body: Vec<CodePoint>, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum StringLiteralKind {...
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_regexp/src/parser/reader/string_literal_parser/diagnostics.rs
crates/swc_ecma_regexp/src/parser/reader/string_literal_parser/diagnostics.rs
use swc_common::Span; use crate::diagnostics::RegexpDiagnostic; #[cold] pub fn invalid_input(span: Span) -> RegexpDiagnostic { RegexpDiagnostic::error( "String literal should be wrapped with ' or \", or escaped properly".to_string(), ) .with_label(span) } #[cold] pub fn legacy_in_strict_mode(kind...
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_regexp/src/parser/reader/string_literal_parser/options.rs
crates/swc_ecma_regexp/src/parser/reader/string_literal_parser/options.rs
#[derive(Clone, Copy, Debug, Default)] pub struct Options { /// Used to adjust `Span` positions to fit the global source code. pub span_offset: u32, /// In JavaScript, internal representation of strings is UTF-16. /// But for our usage in Rust, it is more convenient to work with /// UTF-32(char) uni...
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_regexp/src/parser/reader/string_literal_parser/mod.rs
crates/swc_ecma_regexp/src/parser/reader/string_literal_parser/mod.rs
pub mod ast; mod characters; mod diagnostics; mod options; mod parser_impl; pub use options::Options; pub use parser_impl::{parse_regexp_literal, Parser}; #[cfg(test)] mod test { use swc_common::Span; use super::{ast, parse_regexp_literal, Options, Parser}; trait SpanExt { fn source_text(self, 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_ecma_regexp/src/parser/reader/string_literal_parser/characters.rs
crates/swc_ecma_regexp/src/parser/reader/string_literal_parser/characters.rs
pub const LF: char = '\n'; pub const CR: char = '\r'; pub const LS: char = '\u{2028}'; pub const PS: char = '\u{2029}'; // ``` // LineTerminator :: // <LF> // <CR> // <LS> // <PS> // ``` pub fn is_line_terminator(ch: char) -> bool { matches!(ch, LF | CR | LS | PS) } // ``` // SingleEscapeCharacter :: one ...
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_regexp/src/parser/pattern_parser/pattern_parser_impl.rs
crates/swc_ecma_regexp/src/parser/pattern_parser/pattern_parser_impl.rs
use std::vec; use diagnostics::Result; use swc_atoms::{atom, Atom as SpanAtom}; use crate::{ ast, diagnostics, parser::{ pattern_parser::{character, state::State, unicode_property}, reader::Reader, span_factory::SpanFactory, }, surrogate_pair, }; pub struct PatternParser<'a> {...
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_regexp/src/parser/pattern_parser/state.rs
crates/swc_ecma_regexp/src/parser/pattern_parser/state.rs
use rustc_hash::{FxHashMap, FxHashSet}; use swc_atoms::Atom; use crate::parser::reader::Reader; /// Currently all of properties are read only from outside of this module. /// Even inside of this module, it is not changed after initialized. #[derive(Debug)] pub struct State { // Mode flags pub unicode_mode: bo...
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_regexp/src/parser/pattern_parser/mod.rs
crates/swc_ecma_regexp/src/parser/pattern_parser/mod.rs
mod character; mod pattern_parser_impl; mod state; mod unicode_property; pub use pattern_parser_impl::PatternParser;
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_regexp/src/parser/pattern_parser/character.rs
crates/swc_ecma_regexp/src/parser/pattern_parser/character.rs
// ``` // SyntaxCharacter :: one of // ^ $ \ . * + ? ( ) [ ] { } | // ``` pub fn is_syntax_character(cp: u32) -> bool { char::from_u32(cp).is_some_and(|ch| { matches!( ch, '^' | '$' | '\\' | '.' | '*' | '+' | '?' | '(' | ')' | '[' | ']' | '{' | '}' | '|' ) }) } // ``` ...
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_regexp/src/parser/pattern_parser/unicode_property.rs
crates/swc_ecma_regexp/src/parser/pattern_parser/unicode_property.rs
use phf::{phf_set, Set}; // https://tc39.es/ecma262/2024/multipage/text-processing.html#table-nonbinary-unicode-properties pub fn is_valid_unicode_property(name: &str, value: &str) -> bool { if matches!(name, "General_Category" | "gc") { return GC_PROPERTY_VALUES.contains(value); } if matches!(name...
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_regexp/examples/parse_literal.rs
crates/swc_ecma_regexp/examples/parse_literal.rs
#![expect(clippy::print_stdout)] use swc_ecma_regexp::{LiteralParser, Options}; fn main() { for (pattern_text, flags_text) in [ (r"ab", ""), (r"abc", "i"), (r"abcd", "igv"), (r"emo👈🏻ji", "u"), (r"ab|c", "i"), (r"a|b+|c", "i"), (r"a{0}|b{1,2}|c{3,}", "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_regexp/examples/regex_visitor.rs
crates/swc_ecma_regexp/examples/regex_visitor.rs
#![expect(clippy::print_stdout)] use swc_ecma_regexp::{LiteralParser, Options}; use swc_ecma_regexp_ast::*; use swc_ecma_regexp_visit::{Visit, VisitWith}; struct TestVisitor; impl Visit for TestVisitor { fn visit_capturing_group(&mut self, node: &CapturingGroup) { println!("Visiting capturing group: {nod...
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_minifier/src/lib.rs
crates/swc_css_minifier/src/lib.rs
#![deny(clippy::all)] #![allow(clippy::match_like_matches_macro)] #![allow(clippy::needless_update)] #![allow(clippy::mutable_key_type)] use swc_atoms::Atom; use swc_css_ast::*; use swc_css_visit::VisitMutWith; use self::{compressor::compressor, options::MinifyOptions}; mod compressor; pub mod options; pub(crate) mo...
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_minifier/src/util.rs
crates/swc_css_minifier/src/util.rs
use std::mem::take; use swc_common::EqIgnoreSpan; pub(crate) fn dedup<T>(v: &mut Vec<T>) where T: EqIgnoreSpan, { let mut remove_list = Vec::new(); for (i, i1) in v.iter().enumerate() { for (j, j1) in v.iter().enumerate() { if i < j && i1.eq_ignore_span(j1) { remove_li...
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_minifier/src/options.rs
crates/swc_css_minifier/src/options.rs
use serde::{Deserialize, Serialize}; #[derive(Debug, Default, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] #[serde(deny_unknown_fields)] pub struct MinifyOptions {}
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_minifier/src/compressor/declaration.rs
crates/swc_css_minifier/src/compressor/declaration.rs
use swc_atoms::atom; use swc_common::{util::take::Take, Span, DUMMY_SP}; use swc_css_ast::*; use super::Compressor; impl Compressor { pub(super) fn compress_declaration(&self, declaration: &mut Declaration) { if let DeclarationName::Ident(Ident { value: name, .. }) = &mut declaration.name { *n...
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_minifier/src/compressor/calc_sum.rs
crates/swc_css_minifier/src/compressor/calc_sum.rs
use rustc_hash::FxHashMap; use swc_atoms::{atom, Atom}; use swc_common::Span; use swc_css_ast::*; use super::Compressor; use crate::compressor::math::{is_calc_function_name, transform_calc_value_into_component_value}; // Calc-operator node of the calculation tree // https://www.w3.org/TR/css-values-4/#calculation-tre...
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_minifier/src/compressor/easing_function.rs
crates/swc_css_minifier/src/compressor/easing_function.rs
use swc_atoms::atom; use swc_css_ast::*; use super::Compressor; impl Compressor { pub(super) fn compress_easing_function(&mut self, component_value: &mut ComponentValue) { match component_value { ComponentValue::Function(function) if function.name == "cubic-bezier" && 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_minifier/src/compressor/container.rs
crates/swc_css_minifier/src/compressor/container.rs
use swc_css_ast::*; use super::Compressor; use crate::compressor::math::{is_calc_function_name, transform_calc_value_into_component_value}; impl Compressor { pub(super) fn compress_calc_sum_in_size_feature_value(&mut self, n: &mut SizeFeatureValue) { match n { SizeFeatureValue::Function(Functi...
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_minifier/src/compressor/time.rs
crates/swc_css_minifier/src/compressor/time.rs
use swc_atoms::atom; use swc_css_ast::*; use super::Compressor; impl Compressor { pub(super) fn compress_time(&self, time: &mut Time) { match &*time.unit.value { "ms" if time.value.value == 0.0 || time.value.value >= 100.0 => { let new_value = time.value.value / 1000.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_css_minifier/src/compressor/media.rs
crates/swc_css_minifier/src/compressor/media.rs
use std::mem::take; use swc_common::DUMMY_SP; use swc_css_ast::*; use super::Compressor; use crate::{ compressor::math::{is_calc_function_name, transform_calc_value_into_component_value}, util::dedup, }; impl Compressor { fn is_first_media_in_parens(&self, media_condition: &MediaCondition) -> bool { ...
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_minifier/src/compressor/url.rs
crates/swc_css_minifier/src/compressor/url.rs
use swc_css_ast::*; use super::Compressor; impl Compressor { pub(super) fn compress_url(&self, url: &mut Url) { if url.name.value != "url" { return; } if let Some(modifiers) = &url.modifiers { if !modifiers.is_empty() { return; } ...
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_minifier/src/compressor/unicode_range.rs
crates/swc_css_minifier/src/compressor/unicode_range.rs
use swc_css_ast::*; use super::Compressor; impl Compressor { pub(super) fn compress_unicode_range(&self, unicode_range: &mut UnicodeRange) { unicode_range.start = unicode_range.start.to_ascii_lowercase(); if let Some(end) = &mut unicode_range.end { *end = end.to_ascii_lowercase(); ...
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_minifier/src/compressor/angle.rs
crates/swc_css_minifier/src/compressor/angle.rs
use swc_atoms::atom; use swc_css_ast::*; use swc_css_utils::angle_to_deg; use super::Compressor; impl Compressor { pub(super) fn compress_angle_in_component_value( &mut self, component_value: &mut ComponentValue, ) { if !self.ctx.in_transform_function { return; } ...
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_minifier/src/compressor/transform_function.rs
crates/swc_css_minifier/src/compressor/transform_function.rs
use swc_atoms::atom; use swc_common::Spanned; use swc_css_ast::*; use super::Compressor; impl Compressor { pub(super) fn compress_transform_function(&self, component_value: &mut ComponentValue) { match component_value { ComponentValue::Function(function) if function.name == "tr...
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_minifier/src/compressor/mod.rs
crates/swc_css_minifier/src/compressor/mod.rs
use swc_css_ast::*; use swc_css_utils::serialize_ident; use swc_css_visit::{VisitMut, VisitMutWith}; use self::ctx::Ctx; mod alpha_value; mod angle; mod calc_sum; mod color; mod container; mod ctx; mod declaration; mod easing_function; mod frequency; mod import; mod keyframes; mod length; mod math; mod media; mod rul...
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_minifier/src/compressor/supports.rs
crates/swc_css_minifier/src/compressor/supports.rs
use std::mem::take; use swc_common::DUMMY_SP; use swc_css_ast::*; use super::Compressor; use crate::util::dedup; impl Compressor { fn is_first_supports_in_parens(&self, supports_condition: &SupportsCondition) -> bool { if let Some(SupportsConditionType::SupportsInParens(_)) = supports_conditi...
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_minifier/src/compressor/alpha_value.rs
crates/swc_css_minifier/src/compressor/alpha_value.rs
use swc_common::DUMMY_SP; use swc_css_ast::*; use super::Compressor; pub(super) fn compress_alpha_value(alpha_value: &mut AlphaValue) { match alpha_value { AlphaValue::Percentage(Percentage { value: number, span, .. }) if number.value % 10.0 == 0.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_css_minifier/src/compressor/frequency.rs
crates/swc_css_minifier/src/compressor/frequency.rs
use swc_atoms::atom; use swc_css_ast::*; use super::Compressor; impl Compressor { pub(super) fn compress_frequency(&mut self, frequency: &mut Frequency) { match &*frequency.unit.value { "hz" if frequency.value.value > 0.0 && frequency.value.value % 1000.0 == 0.0 => { let new_va...
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_minifier/src/compressor/ctx.rs
crates/swc_css_minifier/src/compressor/ctx.rs
use std::ops::{Deref, DerefMut}; use super::Compressor; #[derive(Clone, Copy)] pub(super) struct Ctx { pub in_math_function: bool, pub in_logic_combinator_selector: bool, pub in_transform_function: bool, pub in_keyframe_block: bool, pub preserve_alpha_value: bool, } impl Default for 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_minifier/src/compressor/length.rs
crates/swc_css_minifier/src/compressor/length.rs
use swc_atoms::atom; use swc_css_ast::*; use super::Compressor; impl Compressor { fn convert_length(&mut self, value: f64, from_unit: &str, to_unit: &str) -> f64 { match to_unit { "cm" => match from_unit { "cm" => value, "mm" => value / 10.0, "q"...
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_minifier/src/compressor/rules.rs
crates/swc_css_minifier/src/compressor/rules.rs
use std::mem::take; use rustc_hash::FxHashMap; use swc_atoms::Atom; use swc_common::{util::take::Take, EqIgnoreSpan, Span, Spanned}; use swc_css_ast::*; use swc_css_visit::{Visit, VisitMutWith, VisitWith}; use super::Compressor; enum ParentNode<'a> { Stylesheet(&'a mut Stylesheet), SimpleBlock(&'a mut Simple...
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_minifier/src/compressor/selector.rs
crates/swc_css_minifier/src/compressor/selector.rs
use swc_atoms::atom; use swc_common::DUMMY_SP; use swc_css_ast::*; use super::Compressor; use crate::util::dedup; impl Compressor { pub(super) fn compress_selector_list(&mut self, selector_list: &mut SelectorList) { dedup(&mut selector_list.children); } pub(super) fn compress_forgiving_selector_l...
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_minifier/src/compressor/import.rs
crates/swc_css_minifier/src/compressor/import.rs
use swc_css_ast::*; use super::Compressor; impl Compressor { pub(super) fn compress_import_href(&mut self, import_href: &mut ImportHref) { if let ImportHref::Url(Url { value: Some(value), modifiers, span, .. }) = import_href { if ...
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_minifier/src/compressor/color.rs
crates/swc_css_minifier/src/compressor/color.rs
use swc_atoms::{atom, Atom}; use swc_common::DUMMY_SP; use swc_css_ast::*; use swc_css_utils::{angle_to_deg, hsl_to_rgb, hwb_to_rgb, to_rgb255, NAMED_COLORS}; use super::Compressor; use crate::compressor::alpha_value::compress_alpha_value; fn compress_alpha_in_hex(value: &Atom) -> Option<&str> { let length = valu...
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_minifier/src/compressor/keyframes.rs
crates/swc_css_minifier/src/compressor/keyframes.rs
use swc_atoms::atom; use swc_common::DUMMY_SP; use swc_css_ast::*; use super::Compressor; use crate::is_css_wide_keyword; impl Compressor { pub(super) fn compress_keyframes_at_rule(&mut self, at_rule: &mut AtRule) { match at_rule.prelude.as_deref() { Some(AtRulePrelude::KeyframesPrelude(Keyfra...
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_minifier/src/compressor/math/mod.rs
crates/swc_css_minifier/src/compressor/math/mod.rs
use swc_css_ast::*; pub fn is_calc_function_name(function_name: &FunctionName) -> bool { *function_name == "calc" || *function_name == "-webkit-calc" || *function_name == "-moz-calc" } pub fn transform_calc_value_into_component_value(calc_value: &CalcValue) -> Option<ComponentValue> { match &calc_value { ...
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_minifier/tests/fixture.rs
crates/swc_css_minifier/tests/fixture.rs
use std::path::PathBuf; use swc_css_ast::Stylesheet; use swc_css_codegen::{ writer::basic::{BasicCssWriter, BasicCssWriterConfig}, CodeGenerator, CodegenConfig, Emit, }; use swc_css_minifier::minify; use swc_css_parser::parse_file; use testing::NormalizedOutput; #[testing::fixture("tests/fixture/**/input.css"...
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_typescript/src/lib.rs
crates/swc_typescript/src/lib.rs
#![allow(clippy::boxed_local)] pub mod diagnostic; pub mod fast_dts;
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_typescript/src/diagnostic.rs
crates/swc_typescript/src/diagnostic.rs
//! References //! * <https://github.com/oxc-project/oxc/blob/main/crates/oxc_isolated_declarations/src/diagnostics.rs> use std::{borrow::Cow, sync::Arc}; use swc_common::{FileName, Span}; use crate::fast_dts::FastDts; #[derive(Debug, Clone)] pub struct SourceRange { pub filename: Arc<FileName>, pub span: 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_typescript/src/fast_dts/decl.rs
crates/swc_typescript/src/fast_dts/decl.rs
use swc_common::Spanned; use swc_ecma_ast::{ Decl, DefaultDecl, Expr, Lit, Pat, TsNamespaceBody, VarDeclKind, VarDeclarator, }; use swc_ecma_visit::VisitMutWith; use super::{ type_ann, util::{ast_ext::PatExt, types::any_type_ann}, visitors::internal_annotation::InternalAnnotationTransformer, FastDt...
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_typescript/src/fast_dts/class.rs
crates/swc_typescript/src/fast_dts/class.rs
use rustc_hash::FxHashMap; use swc_atoms::atom; use swc_common::{util::take::Take, Spanned, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::{ Accessibility, BindingIdent, Class, ClassMember, ClassProp, Expr, Key, Lit, MethodKind, Param, ParamOrTsParamProp, Pat, PrivateName, PrivateProp, PropName, TsParamProp, TsPar...
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_typescript/src/fast_dts/inferrer.rs
crates/swc_typescript/src/fast_dts/inferrer.rs
use swc_common::{Spanned, DUMMY_SP}; use swc_ecma_ast::{ ArrowExpr, BindingIdent, BlockStmtOrExpr, Class, Expr, Function, Ident, Lit, ReturnStmt, Stmt, TsKeywordTypeKind, TsParenthesizedType, TsType, TsTypeAliasDecl, TsTypeAnn, TsUnionOrIntersectionType, TsUnionType, UnaryExpr, UnaryOp, }; use swc_ecma_visi...
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_typescript/src/fast_dts/function.rs
crates/swc_typescript/src/fast_dts/function.rs
use std::mem; use swc_atoms::Atom; use swc_common::{Span, Spanned, DUMMY_SP}; use swc_ecma_ast::{ AssignPat, Decl, ExportDecl, Function, ModuleDecl, ModuleItem, Param, Pat, Script, Stmt, TsKeywordTypeKind, TsParenthesizedType, TsType, TsTypeAnn, TsUnionOrIntersectionType, TsUnionType, }; use 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_typescript/src/fast_dts/types.rs
crates/swc_typescript/src/fast_dts/types.rs
use rustc_hash::{FxHashMap, FxHashSet}; use swc_common::{BytePos, Span, Spanned, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::{ ArrayLit, ArrowExpr, Expr, Function, GetterProp, Lit, MemberExpr, ObjectLit, Param, Pat, Prop, PropName, PropOrSpread, Str, Tpl, TsFnOrConstructorType, TsFnParam, TsFnType, TsKeywor...
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_typescript/src/fast_dts/mod.rs
crates/swc_typescript/src/fast_dts/mod.rs
use std::{borrow::Cow, mem::take, sync::Arc}; use rustc_hash::{FxHashMap, FxHashSet}; use swc_atoms::Atom; use swc_common::{ comments::SingleThreadedComments, util::take::Take, BytePos, FileName, Mark, Span, Spanned, DUMMY_SP, }; use swc_ecma_ast::{ BindingIdent, Decl, DefaultDecl, ExportDefaultExpr, Ident...
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_typescript/src/fast_dts/enum.rs
crates/swc_typescript/src/fast_dts/enum.rs
use core::f64; use rustc_hash::FxHashMap; use swc_atoms::{atom, Atom}; use swc_common::{Spanned, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::{ BinExpr, BinaryOp, Expr, Ident, Lit, Number, Str, TsEnumDecl, TsEnumMemberId, UnaryExpr, UnaryOp, }; use swc_ecma_utils::number::JsNumber; use super::{util::ast_ext::M...
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_typescript/src/fast_dts/util/types.rs
crates/swc_typescript/src/fast_dts/util/types.rs
use swc_common::DUMMY_SP; use swc_ecma_ast::{TsKeywordType, TsKeywordTypeKind, TsLit, TsLitType, TsType, TsTypeAnn}; pub fn any_type_ann() -> Box<TsTypeAnn> { type_ann(ts_keyword_type(TsKeywordTypeKind::TsAnyKeyword)) } pub fn type_ann(ts_type: Box<TsType>) -> Box<TsTypeAnn> { Box::new(TsTypeAnn { spa...
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_typescript/src/fast_dts/util/mod.rs
crates/swc_typescript/src/fast_dts/util/mod.rs
pub mod ast_ext; pub mod expando_function_collector; pub mod 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_typescript/src/fast_dts/util/expando_function_collector.rs
crates/swc_typescript/src/fast_dts/util/expando_function_collector.rs
use rustc_hash::FxHashSet; use swc_atoms::Atom; use swc_ecma_ast::{FnDecl, FnExpr, VarDecl}; use super::ast_ext::PatExt; use crate::fast_dts::visitors::type_usage::UsedRefs; pub(crate) struct ExpandoFunctionCollector<'a> { declared_function_names: FxHashSet<Atom>, used_refs: &'a UsedRefs, } impl<'a> ExpandoF...
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_typescript/src/fast_dts/util/ast_ext.rs
crates/swc_typescript/src/fast_dts/util/ast_ext.rs
use std::borrow::Cow; use swc_atoms::Atom; use swc_common::Mark; use swc_ecma_ast::{ BindingIdent, ComputedPropName, Expr, Ident, Lit, MemberProp, ObjectPatProp, Pat, Prop, PropName, TsTypeAnn, }; pub trait ExprExit { fn get_root_ident(&self) -> Option<&Ident>; fn get_global_symbol_prop(&self, unresol...
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_typescript/src/fast_dts/visitors/type_usage.rs
crates/swc_typescript/src/fast_dts/visitors/type_usage.rs
use std::collections::hash_map::Entry; use bitflags::bitflags; use petgraph::{ graph::{DiGraph, NodeIndex}, visit::Bfs, Graph, }; use rustc_hash::{FxHashMap, FxHashSet}; use swc_common::{BytePos, Spanned, SyntaxContext}; use swc_ecma_ast::{ Accessibility, ArrowExpr, Class, ClassMember, Decl, ExportDecl...
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_typescript/src/fast_dts/visitors/mod.rs
crates/swc_typescript/src/fast_dts/visitors/mod.rs
pub(crate) mod internal_annotation; pub(crate) mod type_usage;
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_typescript/src/fast_dts/visitors/internal_annotation.rs
crates/swc_typescript/src/fast_dts/visitors/internal_annotation.rs
use rustc_hash::FxHashSet; use swc_common::{BytePos, Spanned}; use swc_ecma_ast::TsTypeElement; use swc_ecma_visit::VisitMut; pub struct InternalAnnotationTransformer<'a> { internal_annotations: &'a FxHashSet<BytePos>, } impl<'a> InternalAnnotationTransformer<'a> { pub fn new(internal_annotations: &'a FxHashS...
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_typescript/tests/deno_test.rs
crates/swc_typescript/tests/deno_test.rs
//! Tests copied from deno //! Make some changes to align with tsc use swc_common::Mark; use swc_ecma_ast::EsVersion; use swc_ecma_codegen::to_code; use swc_ecma_parser::{parse_file_as_program, Syntax, TsSyntax}; use swc_ecma_transforms_base::resolver; use swc_typescript::fast_dts::FastDts; #[track_caller] fn transfo...
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_typescript/tests/typescript.rs
crates/swc_typescript/tests/typescript.rs
use std::path::PathBuf; use swc_common::{comments::SingleThreadedComments, Mark}; use swc_ecma_codegen::to_code_with_comments; use swc_ecma_parser::{parse_file_as_program, Syntax, TsSyntax}; use swc_ecma_transforms_base::{fixer::paren_remover, resolver}; use swc_typescript::fast_dts::{FastDts, FastDtsOptions}; use 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_typescript/examples/isolated_declarations.rs
crates/swc_typescript/examples/isolated_declarations.rs
use std::{env, path::Path}; use swc_common::{comments::SingleThreadedComments, Mark}; use swc_ecma_codegen::to_code_with_comments; use swc_ecma_parser::{parse_file_as_program, Syntax, TsSyntax}; use swc_ecma_transforms_base::{fixer::paren_remover, resolver}; use swc_typescript::fast_dts::{FastDts, FastDtsOptions}; pu...
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_optimization/src/const_modules.rs
crates/swc_ecma_transforms_optimization/src/const_modules.rs
use std::{ collections::{HashMap, HashSet}, sync::Arc, }; use bytes_str::BytesStr; use dashmap::DashMap; use once_cell::sync::Lazy; use rustc_hash::{FxBuildHasher, FxHashMap}; use swc_atoms::{atom, Atom, Wtf8Atom}; use swc_common::{ errors::HANDLER, sync::Lrc, util::{move_map::MoveMap, take::Take},...
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_optimization/src/lib.rs
crates/swc_ecma_transforms_optimization/src/lib.rs
#![deny(clippy::all)] #![deny(unused)] #![allow(clippy::match_like_matches_macro)] pub use self::{ const_modules::const_modules, debug::{debug_assert_valid, AssertValid}, inline_globals::{inline_globals, GlobalExprMap}, json_parse::json_parse, simplify::simplifier, }; mod const_modules; mod debug;...
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_optimization/src/debug.rs
crates/swc_ecma_transforms_optimization/src/debug.rs
#![allow(unused)] use swc_ecma_ast::*; use swc_ecma_visit::{noop_visit_type, Visit, VisitWith}; /// Assert in debug mode. This is noop in release build. #[cfg_attr(not(debug_assertions), inline(always))] pub fn debug_assert_valid<N>(node: &N) where N: VisitWith<AssertValid>, { #[cfg(debug_assertions)] nod...
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_optimization/src/inline_globals.rs
crates/swc_ecma_transforms_optimization/src/inline_globals.rs
use rustc_hash::{FxHashMap, FxHashSet}; use swc_atoms::{Atom, Wtf8Atom}; use swc_common::sync::Lrc; use swc_ecma_ast::*; use swc_ecma_transforms_base::perf::{ParVisitMut, Parallel}; use swc_ecma_utils::{collect_decls, parallel::cpu_count, NodeIgnoringSpan}; use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass, Visi...
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_optimization/src/json_parse.rs
crates/swc_ecma_transforms_optimization/src/json_parse.rs
use serde_json::Value; use swc_atoms::Wtf8Atom; use swc_common::{util::take::Take, Spanned, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_transforms_base::perf::Parallel; use swc_ecma_utils::{calc_literal_cost, member_expr, ExprFactory}; use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass, 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_optimization/src/simplify/const_propagation.rs
crates/swc_ecma_transforms_optimization/src/simplify/const_propagation.rs
#![allow(clippy::borrowed_box)] use rustc_hash::FxHashMap; use swc_common::util::take::Take; use swc_ecma_ast::*; use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass, VisitMut, VisitMutWith}; /// This pass is kind of inliner, but it's far faster. pub fn constant_propagation() -> impl 'static + Pass + VisitMut { ...
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_optimization/src/simplify/mod.rs
crates/swc_ecma_transforms_optimization/src/simplify/mod.rs
//! Ported from closure compiler. use swc_common::{ pass::{CompilerPass, Repeat, Repeated}, Mark, }; use swc_ecma_ast::Pass; pub use self::{ branch::dead_branch_remover, expr::{expr_simplifier, Config as ExprSimplifierConfig}, }; mod branch; pub mod const_propagation; pub mod dce; pub mod expr; pub mo...
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_optimization/src/simplify/inlining/scope.rs
crates/swc_ecma_transforms_optimization/src/simplify/inlining/scope.rs
#![allow(dead_code)] use std::{ borrow::Cow, cell::{Cell, RefCell}, collections::VecDeque, }; use indexmap::map::{Entry, IndexMap}; use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet}; use swc_ecma_ast::*; use swc_ecma_transforms_base::ext::ExprRefExt; use tracing::{span, Level}; use super::{Inlining, ...
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_optimization/src/simplify/inlining/mod.rs
crates/swc_ecma_transforms_optimization/src/simplify/inlining/mod.rs
use std::borrow::Cow; use swc_common::{ pass::{CompilerPass, Repeated}, util::take::Take, }; use swc_ecma_ast::*; use swc_ecma_transforms_base::scope::IdentType; use swc_ecma_utils::{contains_this_expr, find_pat_ids}; use swc_ecma_visit::{ noop_visit_mut_type, noop_visit_type, visit_mut_pass, visit_obj_and...
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_optimization/src/simplify/branch/tests.rs
crates/swc_ecma_transforms_optimization/src/simplify/branch/tests.rs
use swc_common::{Mark, SyntaxContext}; use swc_ecma_transforms_base::{fixer::paren_remover, resolver}; use swc_ecma_utils::ExprCtx; use swc_ecma_visit::visit_mut_pass; use super::super::expr_simplifier; macro_rules! test_stmt { ($l:expr, $r:expr) => { swc_ecma_transforms_testing::test_transform( ...
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_optimization/src/simplify/branch/mod.rs
crates/swc_ecma_transforms_optimization/src/simplify/branch/mod.rs
use std::{borrow::Cow, iter::once, mem::take}; use swc_common::{ pass::{CompilerPass, Repeated}, util::{move_map::MoveMap, take::Take}, Mark, Spanned, SyntaxContext, DUMMY_SP, }; use swc_ecma_ast::*; use swc_ecma_transforms_base::perf::{cpu_count, Parallel, ParallelExt}; use swc_ecma_utils::{ extract_v...
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_optimization/src/simplify/dce/mod.rs
crates/swc_ecma_transforms_optimization/src/simplify/dce/mod.rs
use std::borrow::Cow; use indexmap::IndexSet; use petgraph::{algo::tarjan_scc, prelude::GraphMap, Directed, Direction::Incoming}; use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet}; use swc_atoms::{atom, Atom}; use swc_common::{ pass::{CompilerPass, Repeated}, util::take::Take, Mark, SyntaxContext, DUMM...
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_optimization/src/simplify/expr/tests.rs
crates/swc_ecma_transforms_optimization/src/simplify/expr/tests.rs
use swc_common::{Mark, SyntaxContext}; use swc_ecma_transforms_base::{fixer::paren_remover, resolver}; use swc_ecma_transforms_testing::test_transform; use swc_ecma_utils::ExprCtx; use swc_ecma_visit::visit_mut_pass; use super::SimplifyExpr; fn fold(src: &str, expected: &str) { test_transform( ::swc_ecma_...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
true