file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
crates/swc_bundler/tests/fixture/issue-5642/output/entry.inlined.ts
TypeScript
await Promise.resolve(true); const mod = await async function() { return { starExport: 1 }; }(); console.log(mod);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/issue-5642/output/entry.ts
TypeScript
const starExport = 1; await Promise.resolve(true); const mod = await async function() { return { starExport }; }(); console.log(mod);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/idnex-style/input/a.ts
TypeScript
export class A {} export function utilForA() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/idnex-style/input/b.ts
TypeScript
export class B {} export function utilForB() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/idnex-style/input/c.ts
TypeScript
export class C {} export function utilForC() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/idnex-style/input/entry.ts
TypeScript
import { A } from "./lib"; console.log(A);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/idnex-style/input/lib.ts
TypeScript
export * from "./a"; export * from "./b"; export * from "./c";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/idnex-style/output/entry.inlined.ts
TypeScript
class A { } console.log(A);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/idnex-style/output/entry.ts
TypeScript
class A { } console.log(A);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/nested/input/a.js
JavaScript
export * from "./b";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/nested/input/b.js
JavaScript
export * from "./c";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/nested/input/c.js
JavaScript
export const a = 1; export function foo() {} export class Class {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/nested/input/entry.js
JavaScript
export * from "./a";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/nested/output/entry.inlined.js
JavaScript
const a = 1; function foo() {} class Class { } export { a as a }; export { foo as foo }; export { Class as Class };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/reexport/nested/output/entry.js
JavaScript
const a = 1; function foo() {} class Class { } export { a as a }; export { foo as foo }; export { Class as Class };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/sort/enum-access/input/a.ts
TypeScript
export enum A { b = 5, c = 28, }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/sort/enum-access/input/b.ts
TypeScript
import { A } from "./a"; export function foo() { console.log(A); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/sort/enum-access/input/entry.ts
TypeScript
import { foo } from "./b"; function lazy() { foo(); } lazy();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/sort/enum-access/output/entry.inlined.ts
TypeScript
var A = /*#__PURE__*/ function(A) { A[A["b"] = 5] = "b"; A[A["c"] = 28] = "c"; return A; }({}); function foo() { console.log(A); } function lazy() { foo(); } lazy();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/sort/enum-access/output/entry.ts
TypeScript
var A = /*#__PURE__*/ function(A) { A[A["b"] = 5] = "b"; A[A["c"] = 28] = "c"; return A; }({}); function foo() { console.log(A); } function lazy() { foo(); } lazy();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/sort/enum-reexport/input/a.ts
TypeScript
export * from "./http_status";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/sort/enum-reexport/input/entry.ts
TypeScript
export { Status } from "./a";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/sort/enum-reexport/input/http_status.ts
TypeScript
export enum Status { Continue = 100, }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/sort/enum-reexport/output/entry.inlined.ts
TypeScript
var Status = /*#__PURE__*/ function(Status) { Status[Status["Continue"] = 100] = "Continue"; return Status; }({}); export { Status as Status };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/sort/enum-reexport/output/entry.ts
TypeScript
var Status = /*#__PURE__*/ function(Status) { Status[Status["Continue"] = 100] = "Continue"; return Status; }({}); export { Status as Status };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/wrapped/export-named/input/a.ts
TypeScript
export { b } from "./b";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/wrapped/export-named/input/b.ts
TypeScript
export const [a, b, c] = [1, 2, 3];
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/wrapped/export-named/input/entry.ts
TypeScript
import * as foo from "./a"; console.log(foo);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/wrapped/export-named/output/entry.inlined.ts
TypeScript
const [a, b, c] = [ 1, 2, 3 ]; const mod = { b: b }; console.log(mod);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/wrapped/export-named/output/entry.ts
TypeScript
const [a, b, c] = [ 1, 2, 3 ]; const mod = { b: b }; console.log(mod);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/wrapped/export-star-1/input/a.ts
TypeScript
export * from "./b";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/wrapped/export-star-1/input/b.ts
TypeScript
export const [a, b, c] = [1, 2, 3];
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/wrapped/export-star-1/input/entry.ts
TypeScript
import * as foo from "./a"; console.log(foo);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/wrapped/export-star-1/output/entry.inlined.ts
TypeScript
const [a, b, c] = [ 1, 2, 3 ]; const mod = { a, b, c }; console.log(mod);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/fixture/wrapped/export-star-1/output/entry.ts
TypeScript
const [a, b, c] = [ 1, 2, 3 ]; const mod = { a, b, c }; console.log(mod);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cached/src/lib.rs
Rust
//! Cached configuration for swc. #![deny(missing_docs)] #![deny(warnings)] pub mod regex; pub use anyhow::Error;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cached/src/regex.rs
Rust
//! Regex cache use std::{ops::Deref, str::FromStr, sync::Arc}; pub use anyhow::Error; use anyhow::{Context, Result}; use dashmap::DashMap; use once_cell::sync::Lazy; use regex::Regex; use rustc_hash::FxBuildHasher; use serde::{Deserialize, Serialize}; /// A regex which can be used as a configuration. /// /// While ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/examples/cli.rs
Rust
fn main() -> anyhow::Result<()> { swc_cli_impl::run() }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/src/commands/bundle.rs
Rust
use clap::Parser; use swc_core::trace_macro::swc_trace; #[derive(Parser)] pub struct BundleOptions {} #[swc_trace] impl super::CommandRunner for BundleOptions { fn execute(&self) -> anyhow::Result<()> { unimplemented!("Bundle command is not yet implemented") } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/src/commands/compile.rs
Rust
use std::{ fs::{self, File}, io::{self, IsTerminal, Read, Write}, path::{Component, Path, PathBuf}, sync::Arc, }; use anyhow::Context; use clap::Parser; use glob::glob; use path_absolutize::Absolutize; use rayon::prelude::*; use relative_path::RelativePath; use swc_core::{ base::{ config::{...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/src/commands/lint.rs
Rust
use clap::Parser; use swc_core::trace_macro::swc_trace; #[derive(Parser)] pub struct LintOptions {} #[swc_trace] impl super::CommandRunner for LintOptions { fn execute(&self) -> anyhow::Result<()> { unimplemented!("Lint command is not yet implemented") } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/src/commands/minify.rs
Rust
use clap::Parser; use swc_core::trace_macro::swc_trace; #[derive(Parser)] pub struct MinifyOptions {} #[swc_trace] impl super::CommandRunner for MinifyOptions { fn execute(&self) -> anyhow::Result<()> { unimplemented!("Minify command is not yet implemented") } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/src/commands/mod.rs
Rust
use clap::{Parser, Subcommand}; mod bundle; mod compile; mod lint; mod minify; mod plugin; pub use bundle::*; pub use compile::*; pub use lint::*; pub use minify::*; pub use plugin::PluginSubcommand; // Set of subcommands supported by the `swc` command. #[derive(Subcommand)] pub enum Command { /// Commandline ut...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/src/commands/plugin.rs
Rust
use std::{ fs::{self, create_dir_all, File, OpenOptions}, io::{BufRead, BufReader, ErrorKind, Write}, path::{Path, PathBuf}, }; use anyhow::{Context, Result}; use clap::{ArgEnum, Parser, Subcommand}; use swc_core::diagnostics::get_core_engine_diagnostics; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, O...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/src/lib.rs
Rust
use clap::Parser; use commands::{Command, CommandRunner, PluginSubcommand, SwcCliOptions}; mod commands; mod util; pub fn run() -> anyhow::Result<()> { let command = SwcCliOptions::parse().command; match &command { Command::Plugin(PluginSubcommand::New(options)) => options.execute(), Command:...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/src/main.rs
Rust
//! Used for testing fn main() -> anyhow::Result<()> { swc_cli_impl::run() }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/src/util/mod.rs
Rust
pub(crate) mod trace;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/src/util/trace.rs
Rust
use tracing_chrome::{ChromeLayerBuilder, FlushGuard}; use tracing_subscriber::{ filter, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt, Layer, }; /// Register a tracing subscriber generated event trace format output. pub(crate) fn init_trace(out_file: &Option<String>) -> Option<FlushGuard> { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/tests/fixture-manual/8265/src/index.ts
TypeScript
import { moduleA } from "@modules/moduleA"; moduleA();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/tests/fixture-manual/8265/src/modules/moduleA/index.ts
TypeScript
import { moduleB } from "@modules/moduleB"; export const moduleA = () => { console.log("This is module A"); moduleB(); };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/tests/fixture-manual/8265/src/modules/moduleB/index.ts
TypeScript
export const moduleB = () => console.log("This is module B!");
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/tests/fixture-manual/8495/src/input.ts
TypeScript
import type { AnimationConfigWithData, AnimationConfigWithPath, } from "lottie-web"; import type { CSSProperties } from "react"; type Without<T, U> = { // For each `K` in the keys of `T` excluding keys of `U` // map `K` to an optional `never` type. // // See: https://www.typescriptlang.org/docs...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_cli_impl/tests/issues.rs
Rust
use std::{ fs::{self, create_dir_all, hard_link}, path::Path, process::{Command, Stdio}, }; use anyhow::{Context, Result}; use assert_cmd::prelude::*; use assert_fs::TempDir; fn cli() -> Result<Command> { let mut cmd = Command::cargo_bin("swc").context("Failed to get swc binary")?; cmd.stderr(Stdi...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/benches/serde.rs
Rust
use ast_node::ast_node; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Criterion}; use serde::{Deserialize, Serialize}; use swc_common::{Span, DUMMY_SP}; #[derive(Serialize, Deserialize)] pub struct SerdeStr { span: Span, value: String, } #[ast_node("String")] pub struct Str { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/cache.rs
Rust
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> {...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/comments.rs
Rust
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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/eq.rs
Rust
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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/errors/diagnostic.rs
Rust
// 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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/errors/diagnostic_builder.rs
Rust
// 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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/errors/emitter.rs
Rust
// 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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/errors/lock.rs
Rust
// 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 ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/errors/mod.rs
Rust
// 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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/errors/snippet.rs
Rust
// 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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/errors/styled_buffer.rs
Rust
// 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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/errors/tests.rs
Rust
use super::*; use crate::{FileLoader, FilePathMapping, SourceMap}; use std::{ io, path::{Path, PathBuf}, }; use sync::Lrc; use BytePos; use Span; struct MyFileLoader; impl FileLoader for MyFileLoader { /// Query the existence of a file. fn file_exists(&self, path: &Path) -> bool { println!("Fil...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/input.rs
Rust
use std::str; use debug_unreachable::debug_unreachable; use crate::syntax_pos::{BytePos, SourceFile}; pub type SourceFileInput<'a> = StringInput<'a>; /// Implementation of [Input]. #[derive(Clone)] pub struct StringInput<'a> { last_pos: BytePos, /// Current cursor iter: str::Chars<'a>, orig: &'a str...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/iter.rs
Rust
/// 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(); ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/lib.rs
Rust
//! 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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/pass.rs
Rust
//! 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>...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/plugin/diagnostics.rs
Rust
/// 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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/plugin/metadata.rs
Rust
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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/plugin/mod.rs
Rust
pub mod diagnostics; 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 properties witho...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/plugin/serialized.rs
Rust
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))] /// ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/pos.rs
Rust
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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/private/mod.rs
Rust
//! This module is private module and can be changed without notice. pub use serde::__private as serde;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/rustc_data_structures.rs
Rust
#![allow(clippy::all)] pub mod stable_hasher;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/rustc_data_structures/stable_hasher.rs
Rust
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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/serializer.rs
Rust
#![allow(deprecated)] #![deprecated = "Not used by swc, and this will be removed with next breaking change"] 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: Strin...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/source_map.rs
Rust
// 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 ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/sync.rs
Rust
// 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 ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/syntax_pos.rs
Rust
#[cfg(not(feature = "parking_lot"))] use std::sync::Mutex; use std::{ borrow::Cow, cmp, fmt, hash::{Hash, Hasher}, ops::{Add, Sub}, path::PathBuf, sync::atomic::AtomicU32, }; #[cfg(feature = "parking_lot")] use parking_lot::Mutex; use serde::{Deserialize, Serialize}; use url::Url; use self::hy...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/syntax_pos/analyze_source_file.rs
Rust
// 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 ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/syntax_pos/hygiene.rs
Rust
// 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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/util/iter.rs
Rust
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,...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/util/map.rs
Rust
/// Moved pub use swc_visit::util::map::Map;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/util/mod.rs
Rust
pub mod iter; pub mod map; pub mod move_map; pub mod take;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/util/move_map.rs
Rust
pub use swc_visit::util::move_map::MoveMap;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/src/util/take.rs
Rust
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...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/tests/ast_serde.rs
Rust
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)] pub struct B {} #[test] fn d...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/tests/attr_interop.rs
Rust
//! Test that `#[span]` and `#[fold]` can be used at same time. 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: String, } #[ast_node("Tuple")]...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/tests/concurrent.js
JavaScript
const foo = 1;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/tests/concurrent.rs
Rust
#![cfg(feature = "concurrent")] use std::{env, path::PathBuf, sync::Arc}; use rayon::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) ....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/tests/empty.rs
Rust
use swc_common::*; pub struct Struct {} #[derive(FromVariant)] pub enum Enum {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/tests/issue_3159.rs
Rust
use swc_common::ast_serde; #[ast_serde] pub enum Message { #[tag("Request")] Request(String), #[tag("Response")] Response(u8), }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/tests/source_map.rs
Rust
#![cfg(feature = "concurrent")] use rayon::{prelude::*, ThreadPoolBuilder}; use swc_common::{sync::Lrc, FileName, FilePathMapping, SourceMap}; #[test] fn stress() { let _ = ThreadPoolBuilder::new().num_threads(100).build_global(); let fm = SourceMap::new(FilePathMapping::empty()); (0..10000).into_par_ite...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_common/tests/spanned_attr.rs
Rust
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,)); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_compiler_base/src/lib.rs
Rust
use std::{ env, path::{Path, PathBuf}, }; use anyhow::{Context, Error}; use base64::prelude::{Engine, BASE64_STANDARD}; use once_cell::sync::Lazy; use rustc_hash::FxHashMap; #[allow(unused)] use serde::{Deserialize, Serialize}; use swc_atoms::Atom; use swc_common::{ comments::{Comment, CommentKind, Comment...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_config/src/config_types/bool_config.rs
Rust
use serde::{Deserialize, Serialize}; use crate::merge::Merge; /// You can create this type like `true.into()` or `false.into()`. #[derive( Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, )] pub struct BoolConfig<const DEFAULT: bool>(#[serde(default)] Option<bool>); impl...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_config/src/config_types/bool_or_data.rs
Rust
use serde::{Deserialize, Serialize}; use crate::merge::Merge; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct BoolOrDataConfig<T>(#[serde(default)] Option<BoolOr<T>>); impl<T> BoolOrDataConfig<T> { pub fn from_bool(v: bool) -> Self { Self(Some(BoolOr...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_config/src/config_types/mod.rs
Rust
pub use self::{ bool_config::BoolConfig, bool_or_data::{BoolOr, BoolOrDataConfig}, option::MergingOption, }; mod bool_config; mod bool_or_data; mod option;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University