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_html_parser/tests/html5lib_tests.rs
crates/swc_html_parser/tests/html5lib_tests.rs
#![allow(clippy::redundant_clone)] #![allow(clippy::while_let_on_iterator)] use std::{fs, mem::take, path::PathBuf}; use common::{document_span_visualizer, DomVisualizer}; use rustc_hash::FxHashSet; use serde_json::Value; use swc_atoms::{atom, Atom}; use swc_common::{ input::{SourceFileInput, StringInput}, By...
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_html_parser/tests/recovery.rs
crates/swc_html_parser/tests/recovery.rs
use std::path::PathBuf; use common::{document_dom_visualizer, document_span_visualizer}; use swc_common::input::SourceFileInput; use swc_html_ast::Document; use swc_html_parser::{ lexer::Lexer, parser::{PResult, Parser, ParserConfig}, }; use testing::NormalizedOutput; #[path = "common/mod.rs"] mod common; 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_html_parser/tests/common/mod.rs
crates/swc_html_parser/tests/common/mod.rs
use std::path::PathBuf; use swc_common::{errors::Handler, input::SourceFileInput, Spanned}; use swc_html_ast::*; use swc_html_parser::{ lexer::Lexer, parser::{PResult, Parser, ParserConfig}, }; use swc_html_visit::{Visit, VisitMut, VisitMutWith, VisitWith}; use testing::NormalizedOutput; #[allow(dead_code)] 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_html_parser/benches/lexer.rs
crates/swc_html_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_html_parser::lexer::Lexer; fn bench_document(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_html_parser/benches/parser.rs
crates/swc_html_parser/benches/parser.rs
extern crate swc_malloc; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; use swc_atoms::atom; use swc_common::{input::StringInput, FileName}; use swc_html_ast::{DocumentMode, Element, Namespace}; use swc_html_parser::{lexer::Lexer, parser::Parser}; fn bench_document(b:...
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_html_parser/benches/compare.rs
crates/swc_html_parser/benches/compare.rs
extern crate swc_malloc; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; use swc_atoms::atom; use swc_common::{input::StringInput, FileName, Span, DUMMY_SP}; use swc_html_ast::{Document, DocumentFragment, DocumentMode, Element, Namespace}; use swc_html_parser::{lexer::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/dbg-swc/src/bundle.rs
crates/dbg-swc/src/bundle.rs
use std::{ process::{Command, Stdio}, sync::Arc, }; use anyhow::{bail, Context, Result}; use swc_common::{FileName, SourceMap}; use swc_timer::timer; use crate::util::{parse_js, wrap_task, ModuleRecord}; pub fn bundle(cm: Arc<SourceMap>, entry_url: &str) -> Result<ModuleRecord> { wrap_task(|| { 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/dbg-swc/src/main.rs
crates/dbg-swc/src/main.rs
use std::{env, path::PathBuf, str::FromStr, sync::Arc}; use anyhow::{bail, Error, Result}; use clap::{StructOpt, Subcommand}; use es::EsCommand; use swc_common::{ errors::{ColorConfig, HANDLER}, Globals, SourceMap, GLOBALS, }; use swc_error_reporters::handler::{try_with_handler, HandlerOpts}; use tracing_subsc...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/dbg-swc/src/util/minifier.rs
crates/dbg-swc/src/util/minifier.rs
use std::{ path::Path, process::{Command, Stdio}, sync::Arc, }; use anyhow::{bail, Context, Result}; use swc_common::{FileName, SourceMap}; use swc_ecma_ast::*; use swc_ecma_minifier::option::{CompressOptions, MangleOptions, MinifyOptions}; use swc_ecma_transforms_base::fixer::fixer; use swc_ecma_visit::{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/dbg-swc/src/util/mod.rs
crates/dbg-swc/src/util/mod.rs
use std::{ io::Write, path::{Path, PathBuf}, process::{Child, Command, Stdio}, sync::Arc, }; use anyhow::{bail, Context, Result}; use flate2::{write::ZlibEncoder, Compression}; use swc_common::{comments::SingleThreadedComments, errors::HANDLER, Mark, SourceFile, SourceMap}; use swc_ecma_ast::{EsVersion...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/dbg-swc/src/es/mod.rs
crates/dbg-swc/src/es/mod.rs
use std::sync::Arc; use anyhow::Result; use clap::Subcommand; use swc_common::SourceMap; use self::{exec_test::ExecForTestingCommand, minifier::MinifierCommand}; mod exec_test; mod minifier; /// Debug modules related to ECMAScript #[derive(Debug, Subcommand)] pub(crate) enum EsCommand { #[clap(subcommand)] ...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/dbg-swc/src/es/exec_test.rs
crates/dbg-swc/src/es/exec_test.rs
use std::{ fs, path::{Path, PathBuf}, process::{Command, Stdio}, sync::Arc, }; use anyhow::{bail, Context, Result}; use clap::{Args, Subcommand}; use swc_common::SourceMap; use swc_ecma_minifier::option::MinifyOptions; use swc_ecma_transforms_base::fixer::fixer; use swc_ecma_visit::VisitMutWith; 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/dbg-swc/src/es/minifier/compare_opts.rs
crates/dbg-swc/src/es/minifier/compare_opts.rs
use std::{path::PathBuf, sync::Arc}; use anyhow::{Context, Result}; use clap::Args; use swc_common::SourceMap; use swc_ecma_minifier::option::{CompressOptions, MangleOptions}; use crate::util::{ all_js_files, minifier::{get_minified, get_minified_with_opts}, print_js, }; /// [Experimental] Internal comma...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/dbg-swc/src/es/minifier/ensure_size.rs
crates/dbg-swc/src/es/minifier/ensure_size.rs
use std::{ path::{Path, PathBuf}, sync::Arc, }; use anyhow::{Context, Result}; use clap::Args; use par_iter::prelude::*; use swc_common::{ errors::{ColorConfig, Handler, HANDLER}, SourceFile, SourceMap, GLOBALS, }; use tracing::info; use crate::util::{ all_js_files, gzipped_size, minifier::{ge...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/dbg-swc/src/es/minifier/reduce.rs
crates/dbg-swc/src/es/minifier/reduce.rs
use std::{ env::current_exe, fs::{self, create_dir_all, read_to_string}, path::{Path, PathBuf}, process::Command, sync::Arc, }; use anyhow::{Context, Result}; use clap::{ArgEnum, Args}; use par_iter::prelude::*; use sha1::{Digest, Sha1}; use swc_common::{SourceMap, GLOBALS}; use tempfile::TempDir; ...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/dbg-swc/src/es/minifier/mod.rs
crates/dbg-swc/src/es/minifier/mod.rs
use std::sync::Arc; use anyhow::Result; use clap::Subcommand; use swc_common::SourceMap; use self::{ compare::CompareCommand, compare_opts::CompareOptsCommand, ensure_size::EnsureSize, next::NextCommand, reduce::ReduceCommand, }; mod compare; mod compare_opts; mod ensure_size; mod next; mod reduce; /// Debu...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/dbg-swc/src/es/minifier/compare.rs
crates/dbg-swc/src/es/minifier/compare.rs
use std::{path::PathBuf, process::Command, sync::Arc}; use anyhow::{Context, Result}; use clap::Args; use swc_common::SourceMap; use crate::util::{ make_pretty, minifier::{get_minified, get_terser_output}, print_js, }; /// [Experimental] Opens vscode for diffing output of swc minifier and /// terser/esbu...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/dbg-swc/src/es/minifier/next/check_size.rs
crates/dbg-swc/src/es/minifier/next/check_size.rs
use std::{ cmp::Reverse, env::current_dir, fs::{self, create_dir_all, read_dir, remove_dir_all}, path::{Path, PathBuf}, process::{Command, Stdio}, sync::Arc, }; use anyhow::{bail, Context, Result}; use clap::Args; use dialoguer::{console::Term, theme::ColorfulTheme, Select}; use rayon::{ pr...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/dbg-swc/src/es/minifier/next/mod.rs
crates/dbg-swc/src/es/minifier/next/mod.rs
use std::sync::Arc; use anyhow::Result; use clap::Subcommand; use swc_common::SourceMap; use self::check_size::CheckSizeCommand; mod check_size; /// [Experimental] Debug the minifier issue related to next.js application. #[derive(Debug, Subcommand)] pub enum NextCommand { CheckSize(CheckSizeCommand), } impl Ne...
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_common/src/lib.rs
crates/swc_ecma_compat_common/src/lib.rs
pub mod macros; pub mod regexp;
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_common/src/macros.rs
crates/swc_ecma_compat_common/src/macros.rs
/// Not a public API #[macro_export] macro_rules! impl_visit_mut_fn { () => { fn visit_mut_function(&mut self, f: &mut Function) { if f.body.is_none() { return; } f.visit_mut_children_with(self); let (params, body) = self.visit_mut_fn_like(&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_ecma_compat_common/src/regexp.rs
crates/swc_ecma_compat_common/src/regexp.rs
use swc_ecma_ast::Pass; pub fn regexp(config: Config) -> impl Pass { let mut options = swc_ecma_transformer::Options::default(); let t = &mut options.env.regexp; t.dot_all_regex = config.dot_all_regex; t.has_indices = config.has_indices; t.lookbehind_assertion = config.lookbehind_assertion; 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_core/build.rs
crates/swc_core/build.rs
use std::{ env, fs::File, io::{BufWriter, Write}, path::Path, }; use vergen::{CargoBuilder, Emitter}; // Validate conflict between host / plugin features #[cfg(all( feature = "ecma_plugin_transform", any( feature = "plugin_transform_host_native", feature = "plugin_transform_hos...
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_core/src/lib.rs
crates/swc_core/src/lib.rs
#![cfg_attr(docsrs, feature(doc_cfg))] pub extern crate swc_allocator as alloc; #[cfg(feature = "swc_atoms")] #[cfg_attr(docsrs, doc(cfg(feature = "swc_atoms")))] pub use swc_atoms as atoms; // Quote #[cfg(feature = "ecma_quote")] #[cfg_attr(docsrs, doc(cfg(feature = "ecma_quote")))] pub mod quote; /// Not a public...
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_core/src/__diagnostics.rs
crates/swc_core/src/__diagnostics.rs
// This is auto-generated when publish. // A fallback semver version set via cargo build script. pub(crate) static PKG_SEMVER_FALLBACK: &str = include_str!(concat!(env!("OUT_DIR"), "/core_pkg_version.txt")); pub(crate) static GIT_SHA: &str = "dev";
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_core/src/quote.rs
crates/swc_core/src/quote.rs
/// # Supported output types /// /// - `Expr` /// - `Pat` /// - `Stmt` /// - `ModuleItem` /// /// - Option<T> where T is supported type /// - Box<T> where T is supported type /// /// For example, `Box<Expr>` and `Option<Box<Expr>>` are supported. /// /// # Variable substitution /// /// If an identifier starts wit...
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_core/src/plugin.rs
crates/swc_core/src/plugin.rs
// #[plugin_transform] macro #[cfg(any( all( docsrs, any( feature = "__common_plugin_transform", feature = "__ecma_plugin_transform" ) ), feature = "__common_plugin_transform", feature = "__ecma_plugin_transform" ))] #[cfg_attr( docsrs, doc(cfg(any...
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_core/tests/integration.rs
crates/swc_core/tests/integration.rs
use std::{ env, path::{Path, PathBuf}, process::{Command, Stdio}, }; use anyhow::{anyhow, Error}; fn build_fixture_binary(dir: &Path, target: Option<&str>) -> Result<(), Error> { let mut args = vec!["build".to_string()]; if let Some(target) = target { args.push(format!("--target={target}")...
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_core/tests/quote.rs
crates/swc_core/tests/quote.rs
#[cfg(feature = "ecma_quote")] use swc_core::{ common::DUMMY_SP, ecma::ast::Ident, ecma::atoms::atom, ecma::utils::private_ident, quote, quote_expr, }; #[cfg(feature = "ecma_quote")] #[test] fn quote_expr_call_1() { let _expr = quote_expr!("call(arg1, typeof arg2, arg3)"); } #[cfg(feature = "ecma_quote")]...
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_core/tests/fixture/stub_napi/build.rs
crates/swc_core/tests/fixture/stub_napi/build.rs
use std::{ env, fs::File, io::{BufWriter, Write}, path::Path, }; extern crate napi_build; #[cfg(all(not(feature = "swc_v1"), not(feature = "swc_v2")))] compile_error!("Please enable swc_v1 or swc_v2 feature"); #[cfg(all(feature = "swc_v1", feature = "swc_v2"))] compile_error!("Features swc_v1 and 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_core/tests/fixture/stub_napi/src/lib.rs
crates/swc_core/tests/fixture/stub_napi/src/lib.rs
#![recursion_limit = "2048"] #![allow(dead_code)] #[macro_use] extern crate napi_derive; use std::{env, panic::set_hook, sync::Arc}; use backtrace::Backtrace; use swc_core::{ base::Compiler, common::{sync::Lazy, FilePathMapping, SourceMap}, }; static COMPILER: Lazy<Arc<Compiler>> = Lazy::new(|| { let 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_core/tests/fixture/stub_wasm/src/lib.rs
crates/swc_core/tests/fixture/stub_wasm/src/lib.rs
use swc_core::binding_macros::{ build_minify, build_minify_sync, build_parse, build_parse_sync, build_print, build_print_sync, build_transform, build_transform_sync, }; use wasm_bindgen::prelude::*; build_minify_sync!(#[wasm_bindgen(js_name = "minifySync")]); build_minify!(#[wasm_bindgen(js_name = "minify")]);...
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_utils/src/lib.rs
crates/swc_css_utils/src/lib.rs
#![deny(clippy::all)] use std::{borrow::Cow, f64::consts::PI, str}; use once_cell::sync::Lazy; use rustc_hash::FxHashMap; use serde::{Deserialize, Serialize}; use swc_atoms::{Atom, StaticString}; use swc_css_ast::*; use swc_css_visit::{VisitMut, VisitMutWith}; pub struct IdentReplacer<'a> { from: &'a str, to...
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_compat/src/feature.rs
crates/swc_css_compat/src/feature.rs
use bitflags::bitflags; bitflags! { #[derive(Debug, Clone, Copy)] pub struct Features: u64 { const NESTING = 1 << 0; const CUSTOM_MEDIA = 1 << 1; const MEDIA_QUERY_RANGES = 1 << 2; const COLOR_HEX_ALPHA = 1 << 3; const COLOR_ALPHA_PARAMETER = 1 << 4; const COLOR_...
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_compat/src/lib.rs
crates/swc_css_compat/src/lib.rs
#![allow(clippy::boxed_local)] #![allow(clippy::vec_box)] pub mod compiler; pub mod feature;
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_compat/src/compiler/color_hwb.rs
crates/swc_css_compat/src/compiler/color_hwb.rs
use swc_atoms::atom; use swc_css_ast::{ AbsoluteColorBase, AlphaValue, Angle, ComponentValue, Delimiter, DelimiterValue, FunctionName, Hue, Ident, Number, Percentage, }; use swc_css_utils::{angle_to_deg, hwb_to_rgb, to_rgb255}; use crate::compiler::Compiler; impl Compiler { fn get_hue(&self, hue: Option<&...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_css_compat/src/compiler/color_hex_alpha.rs
crates/swc_css_compat/src/compiler/color_hex_alpha.rs
use swc_atoms::atom; use swc_common::DUMMY_SP; use swc_css_ast::{ AbsoluteColorBase, AlphaValue, Color, ComponentValue, Delimiter, DelimiterValue, Function, FunctionName, Ident, Number, }; use swc_css_utils::{hex_to_rgba, round_alpha}; use crate::compiler::Compiler; fn shorten_hex_color(value: &str) -> Option...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_css_compat/src/compiler/legacy_rgb_and_hsl.rs
crates/swc_css_compat/src/compiler/legacy_rgb_and_hsl.rs
use std::f64::consts::PI; use swc_css_ast::{ matches_eq_ignore_ascii_case, AbsoluteColorBase, AlphaValue, Angle, ComponentValue, Number, Percentage, }; use swc_css_utils::{clamp_unit_f64, round_alpha}; use crate::compiler::Compiler; impl Compiler { pub(crate) fn process_rgb_and_hsl(&mut self, n: &mut Abs...
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_compat/src/compiler/media_query_ranges.rs
crates/swc_css_compat/src/compiler/media_query_ranges.rs
use swc_common::DUMMY_SP; use swc_css_ast::{ Dimension, Ident, MediaFeature, MediaFeatureName, MediaFeaturePlain, MediaFeatureRange, MediaFeatureRangeComparison, MediaFeatureRangeInterval, MediaFeatureValue, }; use crate::compiler::Compiler; impl Compiler { pub(crate) fn get_legacy_media_feature( ...
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_compat/src/compiler/selector_not.rs
crates/swc_css_compat/src/compiler/selector_not.rs
use swc_css_ast::{ CompoundSelector, PseudoClassSelector, PseudoClassSelectorChildren, SelectorList, SubclassSelector, }; use crate::compiler::Compiler; impl Compiler { pub(crate) fn process_selector_not(&mut self, n: &mut CompoundSelector) { let has_not = n.subclass_selectors.iter().any(|n| match...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_css_compat/src/compiler/mod.rs
crates/swc_css_compat/src/compiler/mod.rs
use swc_common::{util::take::Take, Spanned, DUMMY_SP}; use swc_css_ast::{ AbsoluteColorBase, AtRule, ComponentValue, CompoundSelector, MediaAnd, MediaCondition, MediaConditionAllType, MediaConditionWithoutOr, MediaInParens, MediaQuery, Rule, SupportsCondition, }; use swc_css_visit::{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_css_compat/src/compiler/nesting.rs
crates/swc_css_compat/src/compiler/nesting.rs
use std::iter::once; use swc_common::{util::take::Take, DUMMY_SP}; use swc_css_ast::*; use crate::compiler::Compiler; impl Compiler { fn process_subclass_selectors( &mut self, prelude: &SelectorList, subclass: &mut Vec<SubclassSelector>, ) { for sel in subclass { 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_css_compat/src/compiler/color_space_separated_parameters.rs
crates/swc_css_compat/src/compiler/color_space_separated_parameters.rs
use std::mem::take; use swc_common::DUMMY_SP; use swc_css_ast::{ matches_eq_ignore_ascii_case, AbsoluteColorBase, ComponentValue, Delimiter, DelimiterValue, }; use crate::compiler::Compiler; impl Compiler { pub(crate) fn process_color_space_separated_function_notation( &mut self, n: &mut Abso...
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_compat/src/compiler/custom_media.rs
crates/swc_css_compat/src/compiler/custom_media.rs
use std::mem::take; use swc_common::{util::take::Take, DUMMY_SP}; use swc_css_ast::{ AtRule, AtRuleName, AtRulePrelude, CustomMediaQuery, CustomMediaQueryMediaType, Ident, MediaCondition, MediaConditionAllType, MediaConditionType, MediaConditionWithoutOr, MediaConditionWithoutOrType, MediaFeatureBoolean, 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_css_compat/src/compiler/color_alpha_parameter.rs
crates/swc_css_compat/src/compiler/color_alpha_parameter.rs
use swc_atoms::atom; use swc_css_ast::{AbsoluteColorBase, ComponentValue, FunctionName}; use crate::compiler::Compiler; impl Compiler { pub(crate) fn process_color_alpha_parameter(&mut self, n: &mut AbsoluteColorBase) { if let AbsoluteColorBase::Function(function) = n { if let Some(ComponentVa...
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_compat/tests/fixture.rs
crates/swc_css_compat/tests/fixture.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_common::{errors::HANDLER, sync::Lrc, Sou...
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_atoms/src/lib.rs
crates/swc_atoms/src/lib.rs
//! See [Atom] and [UnsafeAtom] #![allow(clippy::unreadable_literal)] #[doc(hidden)] /// Not a public API. pub extern crate hstr; #[doc(hidden)] /// Not a public API. pub extern crate once_cell; use std::{ borrow::{Borrow, Cow}, cell::UnsafeCell, fmt::{self, Display, Formatter}, hash::Hash, mem::...
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_atoms/src/fast.rs
crates/swc_atoms/src/fast.rs
use std::{ mem::{transmute_copy, ManuallyDrop}, ops::Deref, }; use crate::Atom; /// UnsafeAtom is a wrapper around [Atom] that does not allocate, but extremely /// unsafe. /// /// Do not use this unless you know what you are doing. /// /// **Currently, it's considered as a unstable API and may be changed in 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_atoms/src/wtf8_atom.rs
crates/swc_atoms/src/wtf8_atom.rs
use std::{ borrow::Cow, fmt::{self, Formatter}, ops::Deref, }; use hstr::wtf8::{Wtf8, Wtf8Buf}; use serde::Serializer; use crate::Atom; /// Clone-on-write WTF-8 string. /// /// /// See [tendril] for more details. #[derive(Clone, Default, PartialEq, Eq, Hash)] #[cfg_attr(feature = "rkyv-impl", derive(byte...
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_error_reporters/src/lib.rs
crates/swc_error_reporters/src/lib.rs
use std::fmt::{Debug, Display}; use anyhow::anyhow; use handler::{to_pretty_handler, HandlerOpts, ThreadSafetyDiagnostics}; pub use miette::{GraphicalReportHandler, GraphicalTheme}; use swc_common::{ errors::{Diagnostic, DiagnosticBuilder, Emitter}, sync::Lrc, }; mod diagnostic; pub mod handler; pub use diagn...
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_error_reporters/src/handler.rs
crates/swc_error_reporters/src/handler.rs
use std::{ env, fmt::Debug, mem::take, sync::{Arc, Mutex}, }; use miette::{GraphicalReportHandler, GraphicalTheme}; use once_cell::sync::Lazy; use swc_common::{ errors::{ColorConfig, Diagnostic, Emitter, Handler, HANDLER}, sync::Lrc, SourceMap, }; use crate::{diagnostic::ToPrettyDiagnostic...
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_error_reporters/src/diagnostic.rs
crates/swc_error_reporters/src/diagnostic.rs
use std::{fmt, mem::transmute}; use miette::{GraphicalReportHandler, Severity, SourceOffset, SourceSpan}; use swc_common::{ errors::{Diagnostic, DiagnosticId, Level, SubDiagnostic}, BytePos, FileName, SourceMap, Span, }; pub struct PrettyDiagnostic<'a> { source_code: PrettySourceCode<'a>, d: &'a Diagn...
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_error_reporters/tests/fixture.rs
crates/swc_error_reporters/tests/fixture.rs
// #![deny(warnings)] use std::{fs, path::Path}; use anyhow::bail; use swc_common::{ errors::{Handler, Level}, sync::Lrc, BytePos, FileName, SourceMap, Span, }; use swc_error_reporters::handler::try_with_handler; fn output<F>(file: &str, op: F) where F: FnOnce(Lrc<SourceMap>, &Handler), { let 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_error_reporters/examples/swc_try.rs
crates/swc_error_reporters/examples/swc_try.rs
//! This is actual code used by swc. use std::sync::{Arc, Mutex}; use swc_common::{ errors::{Diagnostic, Emitter, Handler}, sync::Lrc, BytePos, FileName, SourceFile, SourceMap, Span, }; use swc_error_reporters::{GraphicalReportHandler, ToPrettyDiagnostic}; fn main() { let cm = Lrc::<SourceMap>::defau...
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_html/src/lib.rs
crates/swc_html/src/lib.rs
pub extern crate swc_html_ast as ast; pub extern crate swc_html_codegen as codegen; pub extern crate swc_html_parser as parser; pub extern crate swc_html_visit as visit;
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false
swc-project/swc
https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_nodejs_common/src/lib.rs
crates/swc_nodejs_common/src/lib.rs
#![deny(warnings)] use std::any::type_name; use anyhow::Context; use napi::Status; use serde::de::DeserializeOwned; pub trait MapErr<T>: Into<Result<T, anyhow::Error>> { fn convert_err(self) -> napi::Result<T> { self.into() .map_err(|err| napi::Error::new(Status::GenericFailure, format!("{err...
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_common/src/syntax_pos.rs
crates/swc_common/src/syntax_pos.rs
use std::{ borrow::Cow, cmp, fmt, hash::{Hash, Hasher}, ops::{Add, Sub}, path::PathBuf, sync::{atomic::AtomicU32, Mutex}, }; use bytes_str::BytesStr; use serde::{Deserialize, Serialize}; use url::Url; use self::hygiene::MarkData; pub use self::hygiene::{Mark, SyntaxContext}; use crate::{cache:...
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_common/src/source_map.rs
crates/swc_common/src/source_map.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
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_common/src/lib.rs
crates/swc_common/src/lib.rs
//! Utilities for the swc project //! //! //! # Cargo features //! //! ## `tty-emitter` //! //! Adds default implementation of Emitter. //! Enabling this feature will add tty-related dependencies. //! //! ## `sourcemap` //! //! Adds methods to generate web sourcemap. //! //! ## `plugin-base` //! //! Base mode for plugi...
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_common/src/comments.rs
crates/swc_common/src/comments.rs
use std::{ cell::{Ref, RefCell, RefMut}, rc::Rc, sync::Arc, }; use rustc_hash::FxHashMap; use swc_atoms::{atom, Atom}; use crate::{ pos::Spanned, syntax_pos::{BytePos, Span, DUMMY_SP}, }; /// Stores comment. /// /// ## Implementation notes /// /// Methods uses `(&self)` instead of `(&mut self)` f...
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_common/src/unknown.rs
crates/swc_common/src/unknown.rs
use cbor4ii::core::{dec, enc}; use crate::eq::EqIgnoreSpan; #[derive(Clone)] pub struct Unknown(cbor4ii::core::BoxedRawValue); impl enc::Encode for Unknown { fn encode<W: enc::Write>(&self, writer: &mut W) -> Result<(), enc::Error<W::Error>> { self.0.encode(writer) } } impl<'de> dec::Decode<'de> for...
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_common/src/serializer.rs
crates/swc_common/src/serializer.rs
#![allow(deprecated)] use serde::Deserialize; #[derive(Deserialize)] #[deprecated = "Not used by swc, and this will be removed with next breaking change"] pub struct Node<T> { #[serde(default, rename = "type")] pub ty: String, #[serde(flatten)] pub node: T, } #[derive(Deserialize)] pub struct Type { ...
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_common/src/sync.rs
crates/swc_common/src/sync.rs
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
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_common/src/eq.rs
crates/swc_common/src/eq.rs
use std::{cell::RefCell, rc::Rc, sync::Arc}; use num_bigint::BigInt; use crate::{BytePos, Span}; /// Derive with `#[derive(EqIgnoreSpan)]`. pub trait EqIgnoreSpan { fn eq_ignore_span(&self, other: &Self) -> bool; } impl EqIgnoreSpan for Span { /// Always returns true #[inline] fn eq_ignore_span(&sel...
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_common/src/rustc_data_structures.rs
crates/swc_common/src/rustc_data_structures.rs
#![allow(clippy::all)] pub mod stable_hasher;
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_common/src/cache.rs
crates/swc_common/src/cache.rs
use std::ops::Deref; use once_cell::sync::OnceCell; /// Wrapper for [OnceCell] with support for [rkyv]. #[derive(Clone, Debug)] pub struct CacheCell<T>(OnceCell<T>); impl<T> Deref for CacheCell<T> { type Target = OnceCell<T>; fn deref(&self) -> &Self::Target { &self.0 } } impl<T> CacheCell<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_common/src/pass.rs
crates/swc_common/src/pass.rs
//! This module reexports items from `swc_visit` with some swc-specific traits. use std::borrow::Cow; pub use swc_visit::*; /// A named compiler pass. pub trait CompilerPass { /// /// - name should follow hyphen-case. /// - an implementation should return same name fn name(&self) -> Cow<'static, 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_common/src/iter.rs
crates/swc_common/src/iter.rs
/// Copied from https://users.rust-lang.org/t/iterator-need-to-identify-the-last-element/8836/3 pub trait IdentifyLast: Iterator + Sized { fn identify_last(self) -> Iter<Self>; } impl<It> IdentifyLast for It where It: Iterator, { fn identify_last(mut self) -> Iter<Self> { let e = self.next(); ...
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_common/src/pos.rs
crates/swc_common/src/pos.rs
use std::{borrow::Cow, rc::Rc, sync::Arc}; pub use crate::syntax_pos::{ hygiene, BytePos, CharPos, FileName, Globals, Loc, LocWithOpt, Mark, MultiSpan, SourceFile, SourceFileAndBytePos, SourceFileAndLine, Span, SpanLinesError, SyntaxContext, DUMMY_SP, GLOBALS, NO_EXPANSION, }; /// /// # Derive /// This 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_common/src/input.rs
crates/swc_common/src/input.rs
use std::str; use crate::syntax_pos::{BytePos, SourceFile}; pub type SourceFileInput<'a> = StringInput<'a>; /// Implementation of [Input]. #[derive(Clone)] pub struct StringInput<'a> { last_pos: BytePos, /// Remaining input as str - we slice this as we consume bytes remaining: &'a str, orig: &'a 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_common/src/util/take.rs
crates/swc_common/src/util/take.rs
use std::mem::replace; use crate::{Span, DUMMY_SP}; /// Helper for people who are working on `VisitMut`. /// /// /// This trait is implemented for ast nodes. If not and you need it, please file /// an issue. pub trait Take: Sized { fn take(&mut self) -> Self { replace(self, Self::dummy()) } /// C...
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_common/src/util/map.rs
crates/swc_common/src/util/map.rs
/// Moved pub use swc_visit::util::map::Map;
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_common/src/util/mod.rs
crates/swc_common/src/util/mod.rs
pub mod iter; pub mod map; pub mod move_map; pub mod 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_common/src/util/move_map.rs
crates/swc_common/src/util/move_map.rs
pub use swc_visit::util::move_map::MoveMap;
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_common/src/util/iter.rs
crates/swc_common/src/util/iter.rs
pub trait IteratorExt: Iterator { /// Copied from https://stackoverflow.com/a/49456265/6193633 fn chain_with<F, I>(self, f: F) -> ChainWith<Self, F, I::IntoIter> where Self: Sized, F: FnOnce() -> I, I: IntoIterator<Item = Self::Item>, { ChainWith { base: 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_common/src/plugin/diagnostics.rs
crates/swc_common/src/plugin/diagnostics.rs
/// A serializable, wrapped struct for the diagnostics information /// included in plugin binaries. /// TODO: Must implement bytecheck with forward-compatible schema changes to /// prevent handshake failure. #[derive(Debug, Clone, PartialEq, Eq)] #[cfg_attr( any(feature = "rkyv-impl"), derive(rkyv::Archive, rky...
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_common/src/plugin/emit.rs
crates/swc_common/src/plugin/emit.rs
#[derive(Debug, Clone, PartialEq, Eq)] #[cfg_attr( feature = "encoding-impl", derive(::ast_node::Encode, ::ast_node::Decode) )] pub struct PluginEmitOutput { pub key: String, pub value: 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_common/src/plugin/serialized.rs
crates/swc_common/src/plugin/serialized.rs
use std::any::type_name; use anyhow::Error; #[derive(Debug, Clone, PartialEq, Eq)] #[non_exhaustive] #[cfg_attr( feature = "__plugin", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] #[cfg_attr(feature = "__plugin", derive(bytecheck::CheckBytes))] #[cfg_attr(feature = "__plugin", repr(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_common/src/plugin/mod.rs
crates/swc_common/src/plugin/mod.rs
pub mod diagnostics; pub mod emit; pub mod metadata; #[cfg(feature = "__plugin")] #[cfg_attr(docsrs, doc(cfg(feature = "__plugin")))] pub mod serialized; /** * Compile-time version constant for the AST struct schema's version. * * NOTE: this is for PARTIAL compatibility only, supporting if AST struct * adds new pr...
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_common/src/plugin/metadata.rs
crates/swc_common/src/plugin/metadata.rs
use std::env; use once_cell::sync::Lazy; use rustc_hash::FxHashMap; /// Indexable key to the metadata context for a transform plugin. /// /// Avoiding serialization & allocation to the host by using incremental number. /// TransformPluginMetadataContext does not implement Index trait, instead /// host does manual mat...
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_common/src/errors/styled_buffer.rs
crates/swc_common/src/errors/styled_buffer.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
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_common/src/errors/diagnostic_builder.rs
crates/swc_common/src/errors/diagnostic_builder.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
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_common/src/errors/tests.rs
crates/swc_common/src/errors/tests.rs
use std::{ io, path::{Path, PathBuf}, }; use sync::Lrc; use BytePos; use Span; use super::*; use crate::{FileLoader, FilePathMapping, SourceMap}; struct MyFileLoader; impl FileLoader for MyFileLoader { /// Query the existence of a file. fn file_exists(&self, path: &Path) -> bool { println!("F...
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_common/src/errors/snippet.rs
crates/swc_common/src/errors/snippet.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
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_common/src/errors/emitter.rs
crates/swc_common/src/errors/emitter.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
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_common/src/errors/lock.rs
crates/swc_common/src/errors/lock.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
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_common/src/errors/mod.rs
crates/swc_common/src/errors/mod.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
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_common/src/errors/diagnostic.rs
crates/swc_common/src/errors/diagnostic.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
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_common/src/private/content.rs
crates/swc_common/src/private/content.rs
//! Custom Content enum implementation for AST node deserialization. //! This replaces the use of serde's private Content enum which is not stable //! API. use std::{fmt, marker::PhantomData}; use serde::{ de::{self, IntoDeserializer, VariantAccess}, Deserializer, }; /// Content holds a buffered representati...
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_common/src/private/mod.rs
crates/swc_common/src/private/mod.rs
//! This module is private module and can be changed without notice. pub mod content; // Re-export serde utilities that we need pub mod serde { pub type Result<T, E = String> = std::result::Result<T, E>; pub type Formatter<'a> = std::fmt::Formatter<'a>; pub use std::fmt; // Re-export Result constructo...
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_common/src/rustc_data_structures/stable_hasher.rs
crates/swc_common/src/rustc_data_structures/stable_hasher.rs
use std::{ hash::{BuildHasher, Hash, Hasher}, mem, }; use siphasher::sip128::{Hash128, Hasher128, SipHasher24}; /// When hashing something that ends up affecting properties like symbol names, /// we want these symbol names to be calculated independently of other factors /// like what architecture you're compi...
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_common/src/syntax_pos/analyze_source_file.rs
crates/swc_common/src/syntax_pos/analyze_source_file.rs
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
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_common/src/syntax_pos/hygiene.rs
crates/swc_common/src/syntax_pos/hygiene.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
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_common/tests/attr_interop.rs
crates/swc_common/tests/attr_interop.rs
//! Test that `#[span]` and `#[fold]` can be used at same time. #![allow(unexpected_cfgs)] use serde::{Deserialize, Serialize}; use swc_common::{ast_node, Span, Spanned}; #[ast_node("Class")] // See https://github.com/rust-lang/rust/issues/44925 pub struct Class { #[span] pub has_span: HasSpan, pub s: 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_common/tests/spanned_attr.rs
crates/swc_common/tests/spanned_attr.rs
use swc_common::{BytePos, Span, Spanned}; #[test] fn lo_hi() { #[derive(Spanned)] struct LoHi { #[span(lo)] pub lo: BytePos, #[span(hi)] pub hi: BytePos, } let lo = BytePos(0); let hi = BytePos(5); assert_eq!(LoHi { lo, hi }.span(), Span::new(lo, hi,)); }
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_common/tests/empty.rs
crates/swc_common/tests/empty.rs
use swc_common::*; pub struct Struct {} #[derive(FromVariant)] pub enum Enum {}
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_common/tests/ast_serde.rs
crates/swc_common/tests/ast_serde.rs
#![allow(unexpected_cfgs)] use serde_json::from_str; use swc_common::ast_serde; #[ast_serde] #[derive(Debug, PartialEq, Eq)] pub enum Ambiguous { #[tag("A")] A(A), #[tag("B")] B(B), } #[ast_serde("B")] #[derive(Debug, PartialEq, Eq)] pub struct A {} #[ast_serde("B")] #[derive(Debug, PartialEq, Eq)] 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_common/tests/issue_3159.rs
crates/swc_common/tests/issue_3159.rs
#![allow(unexpected_cfgs)] use swc_common::ast_serde; #[ast_serde] pub enum Message { #[tag("Request")] Request(String), #[tag("Response")] Response(u8), }
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_common/tests/concurrent.rs
crates/swc_common/tests/concurrent.rs
#![cfg(feature = "concurrent")] use std::{env, path::PathBuf, sync::Arc}; use par_iter::prelude::*; use swc_common::{sync::Lrc, FilePathMapping, SourceFile, SourceMap}; #[test] fn no_overlap() { let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let files: Vec<Lrc<SourceFile>> = (0..100000) ...
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_transformer/src/lib.rs
crates/swc_ecma_transformer/src/lib.rs
#![allow(dead_code)] use swc_ecma_ast::*; use swc_ecma_hooks::{VisitMutHook, VisitMutWithHook}; use swc_ecma_visit::visit_mut_pass; use crate::hook_utils::{HookBuilder, NoopHook}; pub use crate::options::*; mod bugfix; mod common; mod decorators; mod es2015; mod es2016; mod es2017; mod es2018; mod es2019; mod es2020...
rust
Apache-2.0
1faa4a57454ef3932c75a1aca7dd36e37bb215d3
2026-01-04T15:32:21.773776Z
false