repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/src/util.rs | crates/swc_ecma_transforms_module/src/util.rs | use is_macro::Is;
use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::DUMMY_SP;
use swc_config::file_pattern::FilePattern;
use swc_ecma_ast::*;
use swc_ecma_utils::{
is_valid_prop_ident, member_expr, private_ident, quote_ident, quote_str, ExprFactory,
FunctionFactory, IsDirective,
};
use ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/src/module_ref_rewriter.rs | crates/swc_ecma_transforms_module/src/module_ref_rewriter.rs | use rustc_hash::{FxHashMap, FxHashSet};
use swc_atoms::Atom;
use swc_common::SyntaxContext;
use swc_ecma_ast::*;
use swc_ecma_transforms_base::helpers::HELPERS;
use swc_ecma_utils::{ExprFactory, QueryRef, RefRewriter};
use swc_ecma_visit::VisitMutWith;
use crate::util::prop_name;
pub type ImportMap = FxHashMap<Id, (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_transforms_module/src/common_js.rs | crates/swc_ecma_transforms_module/src/common_js.rs | use std::borrow::Cow;
use rustc_hash::FxHashSet;
use swc_common::{
source_map::PURE_SP, util::take::Take, Mark, Span, Spanned, SyntaxContext, DUMMY_SP,
};
use swc_ecma_ast::*;
use swc_ecma_transforms_base::helper_expr;
use swc_ecma_utils::{
member_expr, private_ident, quote_expr, quote_ident, ExprFactory, Func... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/src/amd.rs | crates/swc_ecma_transforms_module/src/amd.rs | use std::borrow::Cow;
use anyhow::Context;
use regex::Regex;
use serde::{Deserialize, Serialize};
use swc_atoms::{atom, Atom};
use swc_common::{
comments::{CommentKind, Comments},
source_map::PURE_SP,
util::take::Take,
Mark, Span, Spanned, SyntaxContext, DUMMY_SP,
};
use swc_ecma_ast::*;
use swc_ecma_t... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/src/umd/config.rs | crates/swc_ecma_transforms_module/src/umd/config.rs | use std::collections::HashMap;
use inflector::Inflector;
use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::{errors::HANDLER, sync::Lrc, FileName, SourceMap};
use swc_ecma_ast::{Expr, Ident};
use swc_ecma_parser::{parse_file_as_expr, Syntax};
use swc_ecma_utils::quote_ident;
use super::super::u... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/src/rewriter/import_rewriter_swc.rs | crates/swc_ecma_transforms_module/src/rewriter/import_rewriter_swc.rs | use std::sync::Arc;
use anyhow::Context;
use swc_common::FileName;
use swc_ecma_ast::*;
use swc_ecma_visit::{visit_mut_pass, VisitMut, VisitMutWith};
use crate::{path::ImportResolver, wtf8::wtf8_to_cow_str};
/// Import rewriter, which rewrites imports as es modules.
pub fn swc_import_rewriter(base: FileName, resolve... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/src/rewriter/import_rewriter_typescript.rs | crates/swc_ecma_transforms_module/src/rewriter/import_rewriter_typescript.rs | use std::path::Path;
use swc_atoms::{Atom, Wtf8Atom};
use swc_common::{util::take::Take, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_transforms_base::helper;
use swc_ecma_visit::{visit_mut_pass, VisitMut, VisitMutWith};
/// This is the implementation of rewriteRelativeImportExtensions in TypeScript
pub fn typescript... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/src/rewriter/mod.rs | crates/swc_ecma_transforms_module/src/rewriter/mod.rs | mod import_rewriter_swc;
mod import_rewriter_typescript;
pub use import_rewriter_swc::swc_import_rewriter as import_rewriter;
pub use import_rewriter_typescript::typescript_import_rewriter;
| rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/tests/system_js.rs | crates/swc_ecma_transforms_module/tests/system_js.rs | #![deny(warnings)]
use std::path::PathBuf;
use swc_common::Mark;
use swc_ecma_ast::Pass;
use swc_ecma_parser::Syntax;
use swc_ecma_transforms_base::resolver;
use swc_ecma_transforms_module::system_js::{system_js, Config};
use swc_ecma_transforms_testing::{test, test_fixture, FixtureTestConfig, Tester};
fn syntax() -... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/tests/path_node.rs | crates/swc_ecma_transforms_module/tests/path_node.rs | use std::{
path::{Path, PathBuf},
sync::Arc,
};
use indexmap::IndexMap;
use serde::Deserialize;
use swc_common::FileName;
use swc_ecma_loader::resolvers::{node::NodeModulesResolver, tsc::TsConfigResolver};
use swc_ecma_parser::Syntax;
use swc_ecma_transforms_module::{
path::{ImportResolver, NodeImportResol... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/tests/umd.rs | crates/swc_ecma_transforms_module/tests/umd.rs | use std::{fs::File, path::PathBuf};
use swc_common::Mark;
use swc_ecma_ast::Pass;
use swc_ecma_parser::{Syntax, TsSyntax};
use swc_ecma_transforms_base::resolver;
use swc_ecma_transforms_module::umd::{umd, Config, FeatureFlag};
use swc_ecma_transforms_testing::{test_fixture, FixtureTestConfig, Tester};
use swc_ecma_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_ecma_transforms_module/tests/common_js.rs | crates/swc_ecma_transforms_module/tests/common_js.rs | use std::{fs::File, path::PathBuf};
use swc_common::Mark;
use swc_ecma_ast::Pass;
use swc_ecma_parser::{Syntax, TsSyntax};
use swc_ecma_transforms_base::resolver;
use swc_ecma_transforms_compat::es2015::for_of;
use swc_ecma_transforms_module::common_js::{self, common_js, FeatureFlag};
use swc_ecma_transforms_testing::... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_transforms_module/tests/amd.rs | crates/swc_ecma_transforms_module/tests/amd.rs | use std::{fs::File, path::PathBuf, rc::Rc};
use swc_common::{comments::SingleThreadedComments, Mark};
use swc_ecma_ast::Pass;
use swc_ecma_parser::{Syntax, TsSyntax};
use swc_ecma_transforms_base::resolver;
use swc_ecma_transforms_compat::es2015::for_of;
use swc_ecma_transforms_module::amd::{self, amd, FeatureFlag};
u... | rust | 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_prefixer/src/lib.rs | crates/swc_css_prefixer/src/lib.rs | #![allow(clippy::vec_box)]
pub use self::prefixer::prefixer;
pub mod options;
mod prefixer;
| rust | 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_prefixer/src/options.rs | crates/swc_css_prefixer/src/options.rs | use preset_env_base::query::Query;
pub use preset_env_base::query::Targets;
use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct Options {
#[serde(default = "default_targets")]
pub env: Option<Targets>,
}
fn default_targets() ... | rust | 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_prefixer/src/prefixer.rs | crates/swc_css_prefixer/src/prefixer.rs | #![allow(clippy::match_like_matches_macro)]
use core::f64::consts::PI;
use std::{mem::take, sync::Arc};
use once_cell::sync::Lazy;
use preset_env_base::{query::targets_to_versions, version::Version, BrowserData, Versions};
use rustc_hash::FxHashMap;
use swc_atoms::{atom, Atom};
use swc_common::{EqIgnoreSpan, DUMMY_SP... | 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_prefixer/tests/prefixer.rs | crates/swc_css_prefixer/tests/prefixer.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 preset_env_base::query::{Query, Targets};
us... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ts_fast_strip_binding/src/lib.rs | crates/swc_ts_fast_strip_binding/src/lib.rs | use std::{
iter::once,
mem::take,
sync::{Arc, Mutex},
};
use anyhow::Error;
use error_reporter::SwcReportHandler;
use miette::{GraphicalTheme, LabeledSpan, ThemeCharacters, ThemeStyles};
use serde::Serialize;
use swc_common::{
errors::{DiagnosticBuilder, DiagnosticId, Emitter, Handler, HANDLER},
sy... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ts_fast_strip_binding/src/error_reporter.rs | crates/swc_ts_fast_strip_binding/src/error_reporter.rs | use std::fmt::{self};
use miette::{
Diagnostic, GraphicalTheme, LabeledSpan, ReportHandler, SourceCode, SourceSpan, ThemeCharacters,
};
use owo_colors::{OwoColorize, Style};
use unicode_width::UnicodeWidthChar;
/**
A [`ReportHandler`] that displays a given [`Report`](crate::Report) in a
quasi-graphical way, using... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ts_fast_strip_binding/tests/transform.rs | crates/swc_ts_fast_strip_binding/tests/transform.rs | use swc_ecma_parser::TsSyntax;
use swc_ts_fast_strip::{Mode, Options, TransformConfig};
use swc_ts_fast_strip_binding::transform;
/// Helper function to create default options with a specific mode
fn opts(mode: Mode) -> Options {
Options {
module: None,
filename: Some("test.ts".into()),
par... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/build.rs | crates/swc_plugin_runner/build.rs | use std::error::Error;
use vergen::{BuildBuilder, CargoBuilder, Emitter};
fn main() -> Result<(), Box<dyn Error>> {
let build = BuildBuilder::all_build()?;
let cargo = CargoBuilder::default()
.dependencies(true)
.name_filter("*_ast")
.build()?;
Emitter::default()
.add_inst... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/lib.rs | crates/swc_plugin_runner/src/lib.rs | #![cfg_attr(not(feature = "encoding-impl"), allow(warnings))]
use std::sync::Arc;
use swc_common::{plugin::metadata::TransformPluginMetadataContext, SourceMap};
use transform_executor::TransformExecutor;
pub mod cache;
mod host_environment;
#[cfg(feature = "encoding-impl")]
mod imported_fn;
#[cfg(feature = "encoding... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/memory_interop.rs | crates/swc_plugin_runner/src/memory_interop.rs | use swc_common::plugin::serialized::PluginSerializedBytes;
use crate::runtime;
#[tracing::instrument(level = "info", skip_all)]
pub fn copy_bytes_into_host(
caller: &dyn runtime::Caller<'_>,
bytes_ptr: i32,
bytes_ptr_len: i32,
buf: &mut Vec<u8>,
) {
let len: usize = bytes_ptr_len.try_into().unwrap... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/transform_executor.rs | crates/swc_plugin_runner/src/transform_executor.rs | use std::{env, sync::Arc};
use anyhow::{anyhow, Context, Error};
use parking_lot::Mutex;
#[cfg(feature = "encoding-impl")]
use swc_common::plugin::serialized::{PluginError, PluginSerializedBytes};
#[cfg(any(
feature = "plugin_transform_schema_v1",
feature = "plugin_transform_schema_vtest"
))]
use swc_common::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_plugin_runner/src/runtime.rs | crates/swc_plugin_runner/src/runtime.rs | //! Plugin runtime abstract
use std::{any::Any, fmt, path::Path};
/// Runtime FFI Value
pub type Value = i32;
/// Opaque module cache
pub struct ModuleCache(pub Box<dyn Any + Send + Sync>);
/// Module cache or raw bytes module
pub enum Module {
Cache(ModuleCache),
Bytes(Box<[u8]>),
}
/// Plugin function 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_plugin_runner/src/cache.rs | crates/swc_plugin_runner/src/cache.rs | #![allow(unused)]
use std::{
env::current_dir,
path::{Path, PathBuf},
str::FromStr,
};
use anyhow::{Context, Error};
use parking_lot::Mutex;
use rustc_hash::FxHashMap;
use swc_common::sync::{Lazy, OnceCell};
use crate::{
plugin_module_bytes::{CompiledPluginModuleBytes, PluginModuleBytes, RawPluginMod... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/host_environment.rs | crates/swc_plugin_runner/src/host_environment.rs | /// An external environment state imported (declared in host, injected into
/// guest) fn can access. This'll allow host to read from updated state from
/// guest.
///
/// This is `base` environment exposes nothing. For other
/// calls requires additional data to be set in the host, separate
/// hostenvironments are 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_plugin_runner/src/plugin_module_bytes.rs | crates/swc_plugin_runner/src/plugin_module_bytes.rs | use serde::{Deserialize, Serialize};
use crate::runtime;
// A trait abstracts plugin's wasm compilation and instantiation.
// Depends on the caller, this could be a simple clone from existing module, or
// load from file system cache.
pub trait PluginModuleBytes {
// Returns a name to the module, typically either... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/imported_fn/source_map.rs | crates/swc_plugin_runner/src/imported_fn/source_map.rs | #![allow(dead_code)]
use std::sync::Arc;
use parking_lot::Mutex;
use swc_common::{
plugin::serialized::{PluginSerializedBytes, VersionedSerializable},
source_map::{PartialFileLines, PartialLoc},
BytePos, SourceMap, SourceMapper, Span,
};
use crate::{
memory_interop::{allocate_return_values_into_guest... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/imported_fn/diagnostics.rs | crates/swc_plugin_runner/src/imported_fn/diagnostics.rs | use std::sync::Arc;
use parking_lot::Mutex;
use crate::{memory_interop::copy_bytes_into_host, runtime};
/// External environment to read swc_core diagnostics from the host.
#[derive(Clone)]
pub struct DiagnosticContextHostEnvironment {
/// A buffer to store diagnostics data strings.
pub core_diag_buffer: Arc... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/imported_fn/comments.rs | crates/swc_plugin_runner/src/imported_fn/comments.rs | use std::sync::Arc;
use parking_lot::Mutex;
use swc_common::{
comments::{Comments, SingleThreadedComments},
plugin::serialized::{PluginSerializedBytes, VersionedSerializable},
BytePos,
};
use swc_plugin_proxy::COMMENTS;
use crate::{
memory_interop::{allocate_return_values_into_guest, copy_bytes_into_h... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/imported_fn/set_transform_result.rs | crates/swc_plugin_runner/src/imported_fn/set_transform_result.rs | use std::sync::Arc;
use parking_lot::Mutex;
use crate::{memory_interop::copy_bytes_into_host, runtime};
/// Environment states allow to return guest's transform result back to the
/// host, using a buffer `transform_result` attached to the environment.
///
/// When plugin performs its transform it'll fill in `transf... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/imported_fn/span.rs | crates/swc_plugin_runner/src/imported_fn/span.rs | pub fn span_dummy_with_cmt_proxy() -> u32 {
// Instead of trying to serialize whole span, send bytepos only
swc_common::Span::dummy_with_cmt().lo.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_plugin_runner/src/imported_fn/mod.rs | crates/swc_plugin_runner/src/imported_fn/mod.rs | //! Functions for syntax_pos::hygiene imported into the guests (plugin) runtime
//! allows interop between host's state to plugin. When guest calls these fn,
//! it'll be executed in host's memory space.
/*
* Below diagram shows one reference example how guest does trampoline between
* host's memory space.
*┌──────────... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/imported_fn/hygiene.rs | crates/swc_plugin_runner/src/imported_fn/hygiene.rs | use swc_common::{
hygiene::MutableMarkContext,
plugin::serialized::{PluginSerializedBytes, VersionedSerializable},
Mark, SyntaxContext,
};
use crate::{
host_environment::BaseHostEnvironment, memory_interop::write_into_memory_view, runtime,
};
/// A proxy to Mark::fresh() that can be used in plugin.
//... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/imported_fn/handler.rs | crates/swc_plugin_runner/src/imported_fn/handler.rs | use swc_common::{
errors::{Diagnostic, HANDLER},
plugin::serialized::PluginSerializedBytes,
};
use swc_transform_common::output::experimental_emit;
use crate::{host_environment::BaseHostEnvironment, memory_interop::copy_bytes_into_host, runtime};
#[tracing::instrument(level = "info", skip_all)]
pub fn emit_di... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_plugin_runner/src/imported_fn/metadata_context.rs | crates/swc_plugin_runner/src/imported_fn/metadata_context.rs | use std::sync::Arc;
use parking_lot::Mutex;
use swc_common::plugin::{
metadata::{TransformPluginMetadataContext, TransformPluginMetadataContextKind},
serialized::{PluginSerializedBytes, VersionedSerializable},
};
use crate::{
memory_interop::{allocate_return_values_into_guest, copy_bytes_into_host},
r... | rust | 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_ast/src/decl.rs | crates/swc_ecma_ast/src/decl.rs | use is_macro::Is;
use string_enum::StringEnum;
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, SyntaxContext, DUMMY_SP};
use crate::{
class::Class,
expr::Expr,
function::Function,
ident::Ident,
pat::Pat,
typescript::{TsEnumDecl, TsInterfaceDecl, TsModuleDecl, TsTypeAliasDecl},
... | rust | 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_ast/src/source_map.rs | crates/swc_ecma_ast/src/source_map.rs | use std::{rc::Rc, sync::Arc};
use swc_common::{BytePos, SourceMap, SourceMapper, SourceMapperDyn, Span, Spanned};
use crate::list::ListFormat;
pub trait SpanExt: Spanned {
#[inline]
fn is_synthesized(&self) -> bool {
false
}
fn starts_on_new_line(&self, format: ListFormat) -> 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_ecma_ast/src/expr.rs | crates/swc_ecma_ast/src/expr.rs | #![allow(clippy::vec_box)]
use std::mem::transmute;
use is_macro::Is;
use string_enum::StringEnum;
use swc_atoms::{Atom, Wtf8Atom};
use swc_common::{
ast_node, util::take::Take, BytePos, EqIgnoreSpan, Span, Spanned, SyntaxContext, DUMMY_SP,
};
use crate::{
class::Class,
function::Function,
ident::{Ide... | 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_ast/src/pat.rs | crates/swc_ecma_ast/src/pat.rs | use is_macro::Is;
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
use crate::{
expr::Expr,
ident::{BindingIdent, Ident},
prop::PropName,
typescript::TsTypeAnn,
Id, IdentName, Invalid,
};
#[ast_node(no_clone)]
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
#[cfg_attr(feature = "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_ast/src/lib.rs | crates/swc_ecma_ast/src/lib.rs | #![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(unreachable_patterns)]
#![deny(missing_copy_implementations)]
#![deny(trivial_casts)]
#![deny(trivial_numeric_casts)]
#![deny(unreachable_pub)]
#![deny(clippy::all)]
#![allow(clippy::enum_variant_names)]
#![allow(clippy::clone_on_copy)]
#![recursion_limit = "1024"]
pub us... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_ast/src/module.rs | crates/swc_ecma_ast/src/module.rs | use is_macro::Is;
use swc_atoms::Atom;
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
use crate::{module_decl::ModuleDecl, stmt::Stmt};
#[ast_node]
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "shrink-to-fit", ... | rust | 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_ast/src/operators.rs | crates/swc_ecma_ast/src/operators.rs | use string_enum::StringEnum;
use swc_common::EqIgnoreSpan;
#[derive(StringEnum, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash, EqIgnoreSpan, Default)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "shrink-to-fit", derive(shrink_to_fit::ShrinkToFit))]
#[cfg_attr(
any(feat... | rust | 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_ast/src/typescript.rs | crates/swc_ecma_ast/src/typescript.rs | #![allow(clippy::vec_box)]
#![allow(missing_copy_implementations)]
#[cfg(feature = "serde-impl")]
use std::fmt;
use is_macro::Is;
#[cfg(feature = "serde-impl")]
use serde::{
de::{self, Unexpected, Visitor},
Deserialize, Deserializer, Serialize,
};
use string_enum::StringEnum;
use swc_common::{ast_node, EqIgno... | 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_ast/src/list.rs | crates/swc_ecma_ast/src/list.rs | #![allow(non_upper_case_globals)]
use bitflags::bitflags;
bitflags! {
/// Represents the formatting rule for a list of nodes.
#[derive(PartialEq, Eq, Copy, Clone)]
pub struct ListFormat: u32 {
/// Default value.
const None = 0;
// Line separators
/// Prints the list on a si... | rust | 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_ast/src/class.rs | crates/swc_ecma_ast/src/class.rs | use is_macro::Is;
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, SyntaxContext, DUMMY_SP};
use crate::{
expr::Expr,
function::{Function, ParamOrTsParamProp},
ident::PrivateName,
prop::PropName,
stmt::BlockStmt,
typescript::{
Accessibility, TsExprWithTypeArgs, TsIndexSi... | rust | 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_ast/src/function.rs | crates/swc_ecma_ast/src/function.rs | use is_macro::Is;
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, SyntaxContext, DUMMY_SP};
use crate::{
class::Decorator,
pat::Pat,
stmt::BlockStmt,
typescript::{TsParamProp, TsTypeAnn, TsTypeParamDecl},
};
/// Common parts of function and method.
#[ast_node]
#[derive(Eq, Hash, EqIgn... | rust | 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_ast/src/lit.rs | crates/swc_ecma_ast/src/lit.rs | use std::{
borrow::Cow,
fmt::{self, Display, Formatter},
hash::{Hash, Hasher},
};
use is_macro::Is;
use num_bigint::BigInt as BigIntValue;
use swc_atoms::{Atom, Wtf8Atom};
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
use crate::jsx::JSXText;
#[ast_node]
#[derive(Eq, Hash, E... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_ast/src/prop.rs | crates/swc_ecma_ast/src/prop.rs | use is_macro::Is;
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
use crate::{
expr::Expr,
function::Function,
ident::Ident,
lit::{BigInt, Number, Str},
stmt::BlockStmt,
typescript::TsTypeAnn,
Id, IdentName, MemberProp, Pat,
};
#[ast_node]
#[derive(Eq, Hash, Is,... | rust | 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_ast/src/ident.rs | crates/swc_ecma_ast/src/ident.rs | use std::{
borrow::Cow,
fmt::Display,
ops::{Deref, DerefMut},
};
use once_cell::sync::Lazy;
use phf::phf_set;
use rustc_hash::FxHashSet;
use swc_atoms::{atom, Atom, UnsafeAtom};
use swc_common::{
ast_node, util::take::Take, BytePos, EqIgnoreSpan, Mark, Span, Spanned, SyntaxContext, DUMMY_SP,
};
use cr... | rust | 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_ast/src/macros.rs | crates/swc_ecma_ast/src/macros.rs | /// Creates a corresponding operator. This macro is used to make code more
/// readable.
///
/// This can used to represent [UnaryOp](crate::UnaryOp),
/// [BinaryOp](crate::BinaryOp), or [AssignOp](crate::AssignOp).
///
/// Actual type is determined by the input.
///
/// # Note about `+` and `-`
///
/// As this macro 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_ast/src/module_decl.rs | crates/swc_ecma_ast/src/module_decl.rs | use std::borrow::Cow;
use is_macro::Is;
use swc_atoms::Atom;
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
use crate::{
decl::Decl,
expr::{ClassExpr, Expr, FnExpr},
ident::Ident,
lit::Str,
typescript::{TsExportAssignment, TsImportEqualsDecl, TsInterfaceDecl, TsNamespa... | rust | 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_ast/src/jsx.rs | crates/swc_ecma_ast/src/jsx.rs | use is_macro::Is;
use swc_atoms::Atom;
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
use crate::{
expr::{Expr, SpreadElement},
ident::Ident,
typescript::TsTypeParamInstantiation,
IdentName, Str,
};
/// Used for `obj` property of `JSXMemberExpr`.
#[ast_node]
#[derive(Eq, H... | rust | 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_ast/src/stmt.rs | crates/swc_ecma_ast/src/stmt.rs | use is_macro::Is;
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, SyntaxContext, DUMMY_SP};
use crate::{
decl::{Decl, VarDecl},
expr::Expr,
pat::Pat,
Ident, Lit, Str, UsingDecl,
};
/// Use when only block statements are allowed.
#[ast_node("BlockStatement")]
#[derive(Eq, Hash, EqIgnor... | rust | 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_preset_env/build.rs | crates/swc_ecma_preset_env/build.rs | use std::{
collections::{BTreeMap, HashMap},
fs,
hash::Hash,
io::{self, Write},
path::Path,
};
use anyhow::Context;
use rustc_hash::FxHashSet;
fn main() -> anyhow::Result<()> {
let crate_dir = std::env::var("CARGO_MANIFEST_DIR")?;
let crate_dir = Path::new(&crate_dir);
let out_dir = 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_preset_env/src/lib.rs | crates/swc_ecma_preset_env/src/lib.rs | #![deny(clippy::all)]
#![allow(dead_code)]
#![recursion_limit = "256"]
use std::{path::PathBuf, sync::Arc};
use preset_env_base::query::targets_to_versions;
pub use preset_env_base::{query::Targets, version::Version, BrowserData, Versions};
use rustc_hash::FxHashSet;
use serde::Deserialize;
use swc_atoms::{atom, Atom... | rust | 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_preset_env/src/node_colon_prefix_strip.rs | crates/swc_ecma_preset_env/src/node_colon_prefix_strip.rs | use swc_common::{Mark, SyntaxContext};
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass, VisitMut, VisitMutWith};
pub fn strip_node_colon_prefix(unresolved_mark: Mark) -> impl Pass {
visit_mut_pass(NodeColonPrefixStrip {
unresolved_ctxt: SyntaxContext::empty().apply_mark(unreso... | rust | 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_preset_env/src/transform_data.rs | crates/swc_ecma_preset_env/src/transform_data.rs | use once_cell::sync::Lazy;
use preset_env_base::{
version::{should_enable, Version},
BrowserData, Versions,
};
use rustc_hash::FxHashMap;
use string_enum::StringEnum;
impl Feature {
pub fn should_enable(self, target: &Versions, bugfixes: bool, default: bool) -> bool {
let f = if bugfixes {
... | rust | 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_preset_env/src/util.rs | crates/swc_ecma_preset_env/src/util.rs | pub(crate) struct SwcFold;
impl precomputed_map::phf::HashOne for SwcFold {
fn hash_one<T: std::hash::Hash>(k: u64, v: T) -> u64 {
use std::hash::Hasher;
let mut hasher =
foldhash::fast::FoldHasher::with_seed(k, foldhash::SharedSeed::global_fixed());
v.hash(&mut 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_ecma_preset_env/src/corejs2/mod.rs | crates/swc_ecma_preset_env/src/corejs2/mod.rs | use std::sync::Arc;
use indexmap::IndexSet;
use preset_env_base::{version::should_enable, Versions};
use rustc_hash::FxBuildHasher;
use swc_atoms::Atom;
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
use self::builtin::BUILTINS;
pub(crate) use self::entry::Entry;
mod builtin;
mod data;... | rust | 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_preset_env/src/corejs2/data.rs | crates/swc_ecma_preset_env/src/corejs2/data.rs | use crate::util::{PooledStr, SwcFold};
include!(concat!(env!("OUT_DIR"), "/corejs2_data/lib.rs"));
pub struct StaticProperty(&'static [(PooledStr, u32, u32)]);
pub fn builtin_types_get(query: &str) -> Option<impl ExactSizeIterator<Item = &'static str>> {
let idx = BUILTIN_TYPES
.binary_search_by(|(k, ..)... | rust | 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_preset_env/src/corejs2/builtin.rs | crates/swc_ecma_preset_env/src/corejs2/builtin.rs | use once_cell::sync::Lazy;
use rustc_hash::FxHashMap;
use crate::{util::PooledStr, Versions};
include!(concat!(env!("OUT_DIR"), "/corejs2_builtin/lib.rs"));
pub(crate) static BUILTINS: Lazy<FxHashMap<&str, Versions>> = Lazy::new(|| {
// Since the `BrowserData` struct is large and has many empty slots,
// it ... | rust | 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_preset_env/src/corejs2/entry.rs | crates/swc_ecma_preset_env/src/corejs2/entry.rs | use std::sync::Arc;
use indexmap::IndexSet;
use preset_env_base::{version::should_enable, Versions};
use rustc_hash::FxBuildHasher;
use swc_atoms::atom;
use swc_common::DUMMY_SP;
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
use super::builtin::BUILTINS;
#[derive(Debug)]
pub... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_ecma_preset_env/src/corejs3/mod.rs | crates/swc_ecma_preset_env/src/corejs3/mod.rs | pub(crate) use self::{entry::Entry, usage::UsageVisitor};
mod builtin;
mod compat;
mod data;
mod entry;
mod 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_ecma_preset_env/src/corejs3/data.rs | crates/swc_ecma_preset_env/src/corejs3/data.rs | use preset_env_base::version::Version;
use crate::util::SwcFold;
pub static POSSIBLE_GLOBAL_OBJECTS: &[&str] = &["global", "globalThis", "self", "window"];
include!(concat!(env!("OUT_DIR"), "/corejs3_data/lib.rs"));
pub fn modules_by_version(query: &str) -> Option<Version> {
let idx = DATA_INDEX.get(query)?;
... | rust | 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_preset_env/src/corejs3/compat.rs | crates/swc_ecma_preset_env/src/corejs3/compat.rs | //! Ported from https://github.com/zloirock/core-js/tree/master/packages/core-js-compat
use once_cell::sync::Lazy;
use rustc_hash::FxHashMap;
use crate::{util::PooledStr, Versions};
include!(concat!(env!("OUT_DIR"), "/corejs3_compat/lib.rs"));
pub static DATA: Lazy<FxHashMap<&str, Versions>> = Lazy::new(|| {
//... | rust | 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_preset_env/src/corejs3/usage.rs | crates/swc_ecma_preset_env/src/corejs3/usage.rs | use std::sync::Arc;
use indexmap::IndexSet;
use preset_env_base::version::{should_enable, Version};
use rustc_hash::FxBuildHasher;
use swc_atoms::Atom;
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
use super::{
builtin::{self, CoreJSPolyfillDescriptor},
data,
};
use crate::{cor... | rust | 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_preset_env/src/corejs3/builtin.rs | crates/swc_ecma_preset_env/src/corejs3/builtin.rs | use std::fmt;
use crate::util::{PooledStr, SwcFold};
#[derive(Clone, Copy)]
pub(crate) struct CoreJSPolyfillDescriptor {
name: u32,
pure: u32,
global: u32,
exclude: u32,
}
include!(concat!(env!("OUT_DIR"), "/corejs3_builtin/lib.rs"));
pub struct StaticProperty(&'static [(PooledStr, (u32, u32, u32, u... | rust | 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_preset_env/src/corejs3/entry.rs | crates/swc_ecma_preset_env/src/corejs3/entry.rs | use std::{ops::Range, sync::Arc};
use indexmap::IndexSet;
use preset_env_base::{
version::{should_enable, Version},
Versions,
};
use rustc_hash::FxBuildHasher;
use swc_atoms::atom;
use swc_common::DUMMY_SP;
use swc_ecma_ast::*;
use swc_ecma_visit::VisitMut;
use super::{compat::DATA as CORE_JS_COMPAT_DATA, dat... | rust | 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_preset_env/src/regenerator/mod.rs | crates/swc_ecma_preset_env/src/regenerator/mod.rs | pub(super) fn is_required<T>(_: &T) -> bool {
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_preset_env/tests/test.rs | crates/swc_ecma_preset_env/tests/test.rs | #![allow(dead_code)]
use std::{
cmp::Ordering,
env,
fs::File,
io,
io::Read,
path::{Path, PathBuf},
};
use pretty_assertions::assert_eq;
use rustc_hash::FxHashMap;
use serde::Deserialize;
use serde_json::Value;
use swc_common::{
comments::SingleThreadedComments, errors::HANDLER, input::Stri... | rust | 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_preset_env/benches/polyfills.rs | crates/swc_ecma_preset_env/benches/polyfills.rs | use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion};
use swc_common::{comments::SingleThreadedComments, FileName, Mark};
use swc_ecma_ast::Program;
use swc_ecma_parser::{Parser, StringInput, Syntax};
use swc_ecma_preset_env::{transform_from_env, Config};
use swc_ecma_transfor... | rust | 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_quote/src/lib.rs | crates/swc_ecma_quote/src/lib.rs | /// Not a public API.
#[doc(hidden)]
pub extern crate swc_common;
/// Not a public API.
#[doc(hidden)]
pub extern crate swc_ecma_ast;
/// Not a public API.
#[doc(hidden)]
pub extern crate swc_ecma_quote_macros;
#[doc(hidden)]
pub use self::clone::ImplicitClone;
mod clone;
/// # Supported output types
///
/// - `Exp... | rust | 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_quote/src/clone.rs | crates/swc_ecma_quote/src/clone.rs | //! Module for implicitly copyable types.
/// Noop
pub trait ImplicitClone: Clone {
fn clone_quote_var(&self) -> Self {
self.clone()
}
}
impl<T: Clone> ImplicitClone for 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_xml/src/lib.rs | crates/swc_xml/src/lib.rs | pub extern crate swc_xml_ast as ast;
pub extern crate swc_xml_codegen as codegen;
pub extern crate swc_xml_parser as parser;
pub extern crate swc_xml_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_html_codegen/src/lib.rs | crates/swc_html_codegen/src/lib.rs | #![deny(clippy::all)]
#![allow(clippy::needless_update)]
#![allow(clippy::match_like_matches_macro)]
#![allow(non_local_definitions)]
pub use std::fmt::Result;
use std::{borrow::Cow, iter::Peekable, str::Chars};
use swc_atoms::Atom;
use swc_common::Spanned;
use swc_html_ast::*;
use swc_html_codegen_macros::emitter;
u... | 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_codegen/src/list.rs | crates/swc_html_codegen/src/list.rs | #![allow(non_upper_case_globals)]
use bitflags::bitflags;
bitflags! {
#[derive(PartialEq, Eq, Copy, Clone)]
pub struct ListFormat: u16 {
const None = 0;
// Line separators
/// Prints the list on a single line (default).
const SingleLine = 0;
/// Prints the list on multi... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_html_codegen/src/emit.rs | crates/swc_html_codegen/src/emit.rs | use std::fmt::Result;
use swc_common::Spanned;
///
/// # Type parameters
///
/// ## `T`
///
/// The type of the ast node.
pub trait Emit<T>
where
T: Spanned,
{
fn emit(&mut self, node: &T) -> Result;
}
impl<T, E> Emit<&'_ T> for E
where
E: Emit<T>,
T: Spanned,
{
#[allow(clippy::only_used_in_recur... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_html_codegen/src/macros.rs | crates/swc_html_codegen/src/macros.rs | macro_rules! emit {
($g:expr,$n:expr) => {{
use crate::Emit;
$g.emit(&$n)?;
}};
}
macro_rules! write_raw {
($g:expr,$span:expr,$n:expr) => {{
$g.wr.write_raw(Some($span), $n)?;
}};
($g:expr,$n:expr) => {{
$g.wr.write_raw(None, $n)?;
}};
}
macro_rules! write_mu... | rust | 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_codegen/src/ctx.rs | crates/swc_html_codegen/src/ctx.rs | use std::ops::{Deref, DerefMut};
use crate::{writer::HtmlWriter, CodeGenerator};
impl<'b, W> CodeGenerator<'b, W>
where
W: HtmlWriter,
{
/// Original context is restored when returned guard is dropped.
#[inline]
pub(super) fn with_ctx(&mut self, ctx: Ctx) -> WithCtx<'_, 'b, W> {
let orig_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_html_codegen/src/writer/mod.rs | crates/swc_html_codegen/src/writer/mod.rs | use std::fmt::Result;
use auto_impl::auto_impl;
use swc_common::Span;
pub mod basic;
#[auto_impl(&mut, Box)]
pub trait HtmlWriter {
fn write_space(&mut self) -> Result;
fn write_newline(&mut self) -> Result;
fn write_raw(&mut self, span: Option<Span>, text: &str) -> Result;
fn write_multiline_raw(... | rust | 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_codegen/src/writer/basic.rs | crates/swc_html_codegen/src/writer/basic.rs | use std::fmt::{Result, Write};
use rustc_hash::FxHashSet;
use swc_common::{BytePos, LineCol, Span};
use super::HtmlWriter;
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
pub enum IndentType {
Tab,
#[default]
Space,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
pub enum LineFeed {
#[... | rust | 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_codegen/tests/fixture.rs | crates/swc_html_codegen/tests/fixture.rs | #![allow(clippy::needless_update)]
use std::{
mem::take,
path::{Path, PathBuf},
};
use swc_atoms::atom;
use swc_common::{FileName, Span};
use swc_html_ast::*;
use swc_html_codegen::{
writer::basic::{BasicHtmlWriter, BasicHtmlWriterConfig, IndentType, LineFeed},
CodeGenerator, CodegenConfig, Emit,
};
u... | rust | 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_hooks/src/lib.rs | crates/swc_ecma_hooks/src/lib.rs | //! Composable hooks for SWC ECMAScript visitors.
//!
//! This crate provides a hook-based API for composing AST visitors,
//! allowing you to build complex visitors by combining simple hooks.
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(clippy::all)]
#![allow(clippy::ptr_arg)]
pub use swc_ecma_ast;
pub use swc_ecm... | rust | 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_hooks/src/generated.rs | crates/swc_ecma_hooks/src/generated.rs | #![doc = r" This file is generated by `tools/generate-code`. DO NOT MODIFY."]
#![allow(unused_variables)]
#![allow(clippy::all)]
use swc_ecma_ast::*;
use swc_ecma_visit::*;
#[doc = r" A hook trait for composable AST visitors."]
#[doc = r""]
#[doc = r" This trait provides `enter_xxx` and `exit_xxx` methods for each AST ... | 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_hooks/tests/compose.rs | crates/swc_ecma_hooks/tests/compose.rs | use swc_atoms::atom;
use swc_common::{Span, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_hooks::{CompositeHook, VisitMutHook, VisitMutWithHook};
use swc_ecma_visit::VisitMutWith;
#[derive(Debug, Default)]
struct Hook {
name: String,
depth: usize,
span_count: usize,
}
impl<C> VisitMutHook<C> for Hook {
... | rust | 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/src/lib.rs | crates/swc_html_parser/src/lib.rs | #![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(unused_must_use)]
#![deny(clippy::all)]
#![allow(clippy::needless_return)]
#![allow(clippy::nonminimal_bool)]
#![allow(clippy::wrong_self_convention)]
#![allow(clippy::match_like_matches_macro)]
use swc_common::{input::StringInput, SourceFile};
use swc_html_ast::{Document... | rust | 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/src/error.rs | crates/swc_html_parser/src/error.rs | use std::borrow::Cow;
use swc_atoms::Atom;
use swc_common::{
errors::{DiagnosticBuilder, Handler},
Span,
};
/// Size is same as a size of a pointer.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Error {
inner: Box<(Span, ErrorKind)>,
}
impl Error {
pub fn kind(&self) -> &ErrorKind {
&self... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_html_parser/src/macros.rs | crates/swc_html_parser/src/macros.rs | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false | |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_html_parser/src/parser/active_formatting_element_stack.rs | crates/swc_html_parser/src/parser/active_formatting_element_stack.rs | use swc_html_ast::Token;
use crate::parser::{is_same_node, RcNode, TokenAndInfo};
#[derive(Debug)]
pub enum ActiveFormattingElement {
Element(RcNode, TokenAndInfo),
Marker,
}
pub struct ActiveFormattingElementStack {
pub items: Vec<ActiveFormattingElement>,
}
impl ActiveFormattingElementStack {
pub ... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
swc-project/swc | https://github.com/swc-project/swc/blob/1faa4a57454ef3932c75a1aca7dd36e37bb215d3/crates/swc_html_parser/src/parser/node.rs | crates/swc_html_parser/src/parser/node.rs | use std::{
cell::{Cell, RefCell},
fmt, mem,
rc::{Rc, Weak},
};
use swc_atoms::Atom;
use swc_common::Span;
use swc_html_ast::*;
#[derive(Debug, Clone)]
pub struct TokenAndInfo {
pub span: Span,
pub acknowledged: bool,
pub token: Token,
}
#[derive(Debug, Clone)]
pub enum Data {
Document {
... | rust | 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/src/parser/doctypes.rs | crates/swc_html_parser/src/parser/doctypes.rs | pub static LIMITED_QUIRKY_PUBLIC_PREFIXES: &[&str] = &[
"-//w3c//dtd xhtml 1.0 frameset//",
"-//w3c//dtd xhtml 1.0 transitional//",
];
pub static HTML4_PUBLIC_PREFIXES: &[&str] = &[
"-//w3c//dtd html 4.01 frameset//",
"-//w3c//dtd html 4.01 transitional//",
];
pub static QUIRKY_PUBLIC_PREFIXES: &[&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_html_parser/src/parser/macros.rs | crates/swc_html_parser/src/parser/macros.rs | macro_rules! span {
($parser:expr, $start:expr) => {{
let last_pos = $parser.input.last_pos()?;
swc_common::Span::new($start, last_pos)
}};
}
macro_rules! bump {
($parser:expr) => {
$parser.input.bump()?.unwrap().token
};
}
macro_rules! get_tag_name {
($node: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_html_parser/src/parser/mod.rs | crates/swc_html_parser/src/parser/mod.rs | use std::{cell::RefCell, mem, rc::Rc};
use active_formatting_element_stack::*;
use doctypes::*;
use node::*;
use open_elements_stack::*;
use swc_atoms::{atom, Atom};
use swc_common::{Span, DUMMY_SP};
use swc_html_ast::*;
use self::input::{Buffer, ParserInput};
use crate::{
error::{Error, ErrorKind},
lexer::St... | 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/src/parser/open_elements_stack.rs | crates/swc_html_parser/src/parser/open_elements_stack.rs | use swc_html_ast::*;
use crate::parser::{
is_html_integration_point, is_mathml_text_integration_point, is_same_node, Data, RcNode,
};
static IMPLICIT_END_TAG_REQUIRED: &[&str] = &[
"dd", "dt", "li", "optgroup", "option", "p", "rb", "rp", "rt", "rtc",
];
static IMPLICIT_END_TAG_REQUIRED_THOROUGHLY: &[&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_html_parser/src/parser/input.rs | crates/swc_html_parser/src/parser/input.rs | use std::{fmt::Debug, mem::take};
use swc_atoms::Atom;
use swc_common::{BytePos, Span};
use swc_html_ast::{Token, TokenAndSpan};
use super::PResult;
use crate::{error::Error, lexer::State};
pub trait ParserInput: Iterator<Item = TokenAndSpan> {
fn start_pos(&mut self) -> BytePos;
fn last_pos(&mut self) -> 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/src/lexer/mod.rs | crates/swc_html_parser/src/lexer/mod.rs | use std::{cell::RefCell, char::REPLACEMENT_CHARACTER, collections::VecDeque, mem::take, rc::Rc};
use rustc_hash::FxHashSet;
use swc_atoms::{atom, Atom};
use swc_common::{input::Input, BytePos, Span};
use swc_html_ast::{AttributeToken, Raw, Token, TokenAndSpan};
use swc_html_utils::{Entity, HTML_ENTITIES};
use crate::... | 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/iframe_srcdoc.rs | crates/swc_html_parser/tests/iframe_srcdoc.rs | use std::path::PathBuf;
use common::{document_dom_visualizer, document_span_visualizer};
use swc_html_parser::parser::ParserConfig;
use crate::common::document_test;
#[path = "common/mod.rs"]
mod common;
#[testing::fixture("tests/iframe_srcdoc/**/*.html")]
fn pass_iframe_srcdoc(input: PathBuf) {
document_test(
... | rust | 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/fixture.rs | crates/swc_html_parser/tests/fixture.rs | #![deny(warnings)]
#![allow(clippy::if_same_then_else)]
#![allow(clippy::needless_update)]
#![allow(clippy::redundant_clone)]
#![allow(clippy::while_let_on_iterator)]
use std::path::PathBuf;
use common::{document_dom_visualizer, document_span_visualizer};
use crate::common::document_test;
#[path = "common/mod.rs"]
... | rust | Apache-2.0 | 1faa4a57454ef3932c75a1aca7dd36e37bb215d3 | 2026-01-04T15:32:21.773776Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.