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_ecma_transforms_typescript/tests/fixture/namespace/2/input.ts | TypeScript | class X1 {}
namespace X1 {
console.log(1);
}
function X2() {}
namespace X2 {
console.log(2);
}
enum X3 {}
namespace X3 {
console.log(3);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/namespace/2/output.js | JavaScript | class X1 {
}
(function(X1) {
console.log(1);
})(X1 || (X1 = {}));
function X2() {}
(function(X2) {
console.log(2);
})(X2 || (X2 = {}));
var X3 = /*#__PURE__*/ function(X3) {
return X3;
}(X3 || {});
(function(X3) {
console.log(3);
})(X3 || (X3 = {}));
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/next-45561/1/input.tsx | TypeScript (TSX) | import path, { dirname } from "node:path";
export default function IndexPage(props: { abc: string }) {
return (
<div>
abc: {props.abc}
<svg viewBox="0 -85 600 600"></svg>
</div>
);
}
export function getServerSideProps() {
return {
props: {
abc: d... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/next-45561/1/output.js | JavaScript | import { dirname } from "node:path";
export default function IndexPage(props) {
return React.createElement("div", null, "abc: ", props.abc, React.createElement("svg", {
viewBox: "0 -85 600 600"
}));
}
export function getServerSideProps() {
return {
props: {
abc: dirname("/abc/def... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/next-45561/2/input.tsx | TypeScript (TSX) | import path, { dirname } from "node:path";
export default function IndexPage(props: { abc: string }) {
return (
<div>
abc: {props.abc}
<svg viewBox="0 -85 600 600">
<path
fillRule="evenodd"
d="M513 256.5C513 398.161 398.161 513... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/next-45561/2/output.js | JavaScript | import { dirname } from "node:path";
export default function IndexPage(props) {
return React.createElement("div", null, "abc: ", props.abc, React.createElement("svg", {
viewBox: "0 -85 600 600"
}, React.createElement("path", {
fillRule: "evenodd",
d: "M513 256.5C513 398.161 398.161 513 2... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/next/server/render/1/input.tsx | TypeScript (TSX) | import { IncomingMessage, ServerResponse } from "http";
import { ParsedUrlQuery } from "querystring";
import { Writable } from "stream";
import React from "react";
import * as ReactDOMServer from "react-dom/server";
import { StyleRegistry, createStyleRegistry } from "styled-jsx";
import { warn } from "../build/output/l... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/next/server/render/1/output.js | JavaScript | import { Writable } from "stream";
import * as ReactDOMServer from "react-dom/server";
import { StyleRegistry, createStyleRegistry } from "styled-jsx";
import { warn } from "../build/output/log";
import { GSP_NO_RETURNED_VALUE, GSSP_COMPONENT_MEMBER_ERROR, GSSP_NO_RETURNED_VALUE, STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ER... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/private-method-overload-and-abstract/input.ts | TypeScript | class test {
#test();
#test() {
}
abstract #test();
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/private-method-overload-and-abstract/output.js | JavaScript | var _test = /*#__PURE__*/ new WeakSet();
class test {
constructor(){
_class_private_method_init(this, _test);
}
}
function test1() {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/web-969/1/input.ts | TypeScript | import { NextResponse } from "next/server";
export async function GET(): Promise<Response> {
return NextResponse.json({ data: "hello" });
}
export type { NextResponse }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/fixture/web-969/1/output.js | JavaScript | import { NextResponse } from "next/server";
export async function GET() {
return NextResponse.json({
data: "hello"
});
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/strip.rs | Rust | use std::path::PathBuf;
use swc_common::{comments::NoopComments, pass::Optional, Mark};
use swc_ecma_ast::Pass;
use swc_ecma_parser::{Syntax, TsSyntax};
use swc_ecma_transforms_base::resolver;
use swc_ecma_transforms_compat::{
class_fields_use_set::class_fields_use_set,
es2015::{block_scoping, destructuring, p... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_typescript/tests/strip_correctness.rs | Rust | use std::path::PathBuf;
use swc_common::{FileName, Mark};
use swc_ecma_ast::*;
use swc_ecma_codegen::to_code_default;
use swc_ecma_parser::{lexer::Lexer, EsSyntax, Parser, Syntax, TsSyntax};
use swc_ecma_transforms_base::{fixer::fixer, hygiene::hygiene, resolver};
use swc_ecma_transforms_typescript::typescript;
#[tes... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_usage_analyzer/src/alias/ctx.rs | Rust | use std::ops::{Deref, DerefMut};
use super::InfectionCollector;
impl InfectionCollector {
pub(super) fn with_ctx(&mut self, ctx: Ctx) -> WithCtx {
let orig_ctx = self.ctx;
self.ctx = ctx;
WithCtx {
analyzer: self,
orig_ctx,
}
}
}
#[derive(Debug, Defaul... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_usage_analyzer/src/alias/mod.rs | Rust | #![allow(clippy::needless_update)]
use rustc_hash::FxHashSet;
use swc_common::SyntaxContext;
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
use self::ctx::Ctx;
use crate::{marks::Marks, util::is_global_var_with_pure_property_access};
mod ctx;
#[derive(Default)]
#[non_exhaustive]
pub s... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_usage_analyzer/src/analyzer/ctx.rs | Rust | #![allow(dead_code)]
use std::ops::{Deref, DerefMut};
use swc_ecma_ast::VarDeclKind;
use swc_ecma_utils::{Type, Value};
use super::{storage::Storage, UsageAnalyzer};
impl<S> UsageAnalyzer<S>
where
S: Storage,
{
pub(super) fn with_ctx(&mut self, ctx: Ctx) -> WithCtx<S> {
let orig_ctx = self.ctx;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs | Rust | use rustc_hash::FxHashMap;
use swc_common::SyntaxContext;
use swc_ecma_ast::*;
use swc_ecma_utils::{
find_pat_ids, ident::IdentLike, ExprCtx, ExprExt, IsEmpty, StmtExt, Type, Value,
};
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
use swc_timer::timer;
pub use self::ctx::Ctx;
use self::storage::*;
use c... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_usage_analyzer/src/analyzer/storage.rs | Rust | use swc_atoms::Atom;
use swc_common::SyntaxContext;
use swc_ecma_ast::*;
use swc_ecma_utils::{Type, Value};
use super::{ctx::Ctx, ScopeKind};
use crate::alias::Access;
pub trait Storage: Sized + Default {
type ScopeData: ScopeDataLike;
type VarData: VarDataLike;
fn scope(&mut self, ctxt: SyntaxContext) -... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_usage_analyzer/src/lib.rs | Rust | //! This crate is an internal crate that is extracted just to reduce compile
//! time. Do not use this crate directly, and this package does not follow
//! semver.
#![allow(clippy::mutable_key_type)]
pub mod alias;
pub mod analyzer;
pub mod marks;
pub mod util;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_usage_analyzer/src/marks.rs | Rust | #![allow(dead_code)]
use swc_common::{Mark, SyntaxContext};
#[derive(Debug, Clone, Copy)]
pub struct Marks {
/// `/** @const */`.
pub const_ann: Mark,
/// Check for `/*#__NOINLINE__*/`
pub noinline: Mark,
/// Check for `/*#__PURE__*/`
pub pure: Mark,
/// This is applied to [swc_ecma_as... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_usage_analyzer/src/util.rs | Rust | use swc_ecma_ast::Stmt;
pub fn is_global_var_with_pure_property_access(s: &str) -> bool {
match s {
"JSON" | "Array" | "Set" | "Map" | "String" | "Object" | "Number" | "Date" | "BigInt"
| "Boolean" | "Math" | "Error" | "Reflect" => return true,
_ => {}
}
matches!(
s,
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/constructor.rs | Rust | use std::{iter, mem};
use swc_common::{util::take::Take, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
use crate::ExprFactory;
pub fn inject_after_super(c: &mut Constructor, exprs: Vec<Box<Expr>>) {
if exprs.is_empty() {
return;
}
let body = c... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/factory.rs | Rust | use std::iter;
use swc_common::{util::take::Take, Span, Spanned, DUMMY_SP};
use swc_ecma_ast::*;
/// Extension methods for [Expr].
///
/// Note that many types implements `Into<Expr>` and you can do like
///
/// ```rust
/// use swc_ecma_utils::ExprFactory;
///
/// let _args = vec![0f64.as_arg()];
/// ```
///
/// to c... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/function/fn_env_hoister.rs | Rust | use std::mem;
use indexmap::IndexMap;
use rustc_hash::FxBuildHasher;
use swc_atoms::Atom;
use swc_common::{util::take::Take, Span, Spanned, SyntaxContext, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
use crate::ExprFactory;
#[derive(Default)]
struct SuperField {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/function/function_wrapper.rs | Rust | use std::marker::PhantomData;
use swc_common::{util::take::Take, Spanned, DUMMY_SP};
use swc_ecma_ast::*;
use crate::ExprFactory;
pub struct FunctionWrapper<T> {
pub binding_ident: Option<Ident>,
pub function: Expr,
pub ignore_function_name: bool,
pub ignore_function_length: bool,
function_iden... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/function/mod.rs | Rust | mod fn_env_hoister;
mod function_wrapper;
pub use fn_env_hoister::*;
pub use function_wrapper::*;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/ident.rs | Rust | use swc_atoms::Atom;
use swc_common::SyntaxContext;
use swc_ecma_ast::{unsafe_id_from_ident, BindingIdent, Id, Ident, UnsafeId};
pub trait IdentLike: Sized + Send + Sync + 'static {
fn from_ident(i: &Ident) -> Self;
fn to_id(&self) -> Id;
fn into_id(self) -> Id;
}
impl IdentLike for Atom {
fn from_ide... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/lib.rs | Rust | #![deny(clippy::all)]
#![allow(clippy::boxed_local)]
#![allow(clippy::mutable_key_type)]
#![allow(clippy::match_like_matches_macro)]
#![allow(clippy::vec_box)]
#![cfg_attr(not(feature = "concurrent"), allow(unused))]
#[doc(hidden)]
pub extern crate swc_atoms;
#[doc(hidden)]
pub extern crate swc_common;
#[doc(hidden)]
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/macros.rs | Rust | /// Shortcut for `quote_ident!(span.apply_mark(Mark::fresh(Mark::root())), s)`
#[macro_export]
macro_rules! private_ident {
($s:expr) => {
private_ident!($crate::swc_common::DUMMY_SP, $s)
};
($span:expr, $s:expr) => {{
let mark = $crate::swc_common::Mark::new();
let ctxt = $crate::sw... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/node_ignore_span.rs | Rust | use std::{borrow::Cow, fmt::Debug, hash::Hash};
use swc_common::EqIgnoreSpan;
use swc_ecma_ast::{Expr, MemberProp};
/// A newtype that will ignore Span while doing `eq` or `hash`.
pub struct NodeIgnoringSpan<'a, Node: ToOwned + Debug>(Cow<'a, Node>);
impl<Node: ToOwned + Debug> Debug for NodeIgnoringSpan<'_, Node> {... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/number.rs | Rust | /// <https://tc39.es/ecma262/#sec-numeric-types-number-tostring>
pub trait ToJsString {
fn to_js_string(&self) -> String;
}
impl ToJsString for f64 {
fn to_js_string(&self) -> String {
let mut buffer = ryu_js::Buffer::new();
buffer.format(*self).to_string()
}
}
#[derive(Debug, Clone, Copy,... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/parallel.rs | Rust | //! Module for parallel processing
use once_cell::sync::Lazy;
use swc_common::GLOBALS;
use swc_ecma_ast::*;
use swc_parallel::{
items::{IntoItems, Items},
join,
};
static CPU_COUNT: Lazy<usize> = Lazy::new(num_cpus::get);
pub fn cpu_count() -> usize {
*CPU_COUNT
}
pub trait Parallel: swc_common::sync::S... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/stack_size.rs | Rust | /// Calls `callback` with a larger stack size.
#[inline(always)]
#[cfg(any(
target_arch = "wasm32",
target_arch = "arm",
not(feature = "stacker"),
// miri does not work with stacker
miri
))]
pub fn maybe_grow<R, F: FnOnce() -> R>(_red_zone: usize, _stack_size: usize, callback: F) -> R {
callback... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/value.rs | Rust | use std::ops::Not;
use self::Value::{Known, Unknown};
/// Runtime value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Value<T> {
Known(T),
/// Not determined at compile time.`
Unknown,
}
/// Type of value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_utils/src/var.rs | Rust | use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
use crate::ident::IdentLike;
/// This collects variables bindings while ignoring if it's nested in
/// expression.
pub struct VarCollector<'a, I: IdentLike> {
pub to: &'a mut Vec<I>,
}
impl<I: IdentLike> Visit for VarCollector<'_, I> {... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_visit/src/lib.rs | Rust | // This is not a public api.
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(clippy::all)]
#![allow(clippy::ptr_arg)]
#[doc(hidden)]
pub extern crate swc_ecma_ast;
use std::{borrow::Cow, fmt::Debug};
use swc_common::{pass::CompilerPass, util::take::Take, Span, DUMMY_SP};
use swc_ecma_ast::*;
use swc_visit::{Repeat, R... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_visit/tests/main.rs | Rust | use swc_common::DUMMY_SP;
use swc_ecma_ast::*;
use swc_ecma_visit::NodeRef;
#[test]
fn traverse_lookup() {
let node = Expr::Call(CallExpr {
span: DUMMY_SP,
callee: Callee::Expr(
AwaitExpr {
span: DUMMY_SP,
arg: Ident::new_no_ctxt("foo".into(), DUMMY_SP).i... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_visit_std/src/lib.rs | Rust | #![cfg_attr(docsrs, feature(doc_cfg))]
#[doc(hidden)]
pub extern crate swc_ecma_ast;
pub use self::generated::*;
mod generated;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecmascript/src/lib.rs | Rust | #![deny(clippy::all)]
#![cfg_attr(docsrs, feature(doc_cfg))]
pub use swc_ecma_ast as ast;
#[cfg(feature = "codegen")]
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
pub use swc_ecma_codegen as codegen;
#[cfg(feature = "minifier")]
#[cfg_attr(docsrs, doc(cfg(feature = "minifier")))]
pub use swc_ecma_minifier as min... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_eq_ignore_macros/src/lib.rs | Rust | use proc_macro2::Span;
use quote::quote;
use syn::{
parse, parse_quote, punctuated::Punctuated, spanned::Spanned, Arm, BinOp, Block, Data,
DeriveInput, Expr, ExprBinary, ExprBlock, Field, FieldPat, Fields, Ident, Index, Member, Pat,
PatIdent, PatRest, PatStruct, PatTuple, Path, Stmt, Token,
};
/// Derives ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_error_reporters/examples/swc_try.rs | Rust | //! This is actual code used by swc.
use std::{
fmt,
sync::{Arc, Mutex},
};
use swc_common::{errors::Handler, sync::Lrc, BytePos, FileName, SourceFile, SourceMap, Span};
use swc_error_reporters::{GraphicalReportHandler, PrettyEmitter, PrettyEmitterConfig};
fn main() {
let cm = Lrc::<SourceMap>::default()... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_error_reporters/src/handler.rs | Rust | use std::{env, fmt, io::Write, mem::take, sync::Arc};
use anyhow::Error;
use miette::{GraphicalReportHandler, GraphicalTheme};
use once_cell::sync::Lazy;
use parking_lot::Mutex;
use swc_common::{
errors::{ColorConfig, Emitter, Handler, HANDLER},
sync::Lrc,
SourceMap,
};
use crate::{
json_emitter::{Jso... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_error_reporters/src/json_emitter.rs | Rust | use std::fmt::Write;
use serde_derive::Serialize;
use swc_common::{
errors::{DiagnosticBuilder, DiagnosticId, Emitter},
sync::Lrc,
SourceMap, SourceMapper,
};
use crate::WriterWrapper;
pub struct JsonEmitter {
cm: Lrc<SourceMap>,
wr: WriterWrapper,
config: JsonEmitterConfig,
diagnostic... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_error_reporters/src/lib.rs | Rust | use std::{
fmt::{self, Write},
intrinsics::transmute,
};
pub use miette::{GraphicalReportHandler, GraphicalTheme};
use miette::{
LabeledSpan, MietteError, Severity, SourceCode, SourceOffset, SourceSpan, SpanContents,
};
use swc_common::{
errors::{DiagnosticBuilder, DiagnosticId, Emitter, Level, SubDiag... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_error_reporters/tests/fixture.rs | Rust | #![deny(warnings)]
use std::{fmt, fmt::Write, fs, path::Path};
use swc_common::{
errors::{Handler, Level},
sync::{Lock, Lrc},
BytePos, FileName, SourceMap, Span,
};
use swc_error_reporters::PrettyEmitter;
#[derive(Clone, Default)]
struct Writer(Lrc<Lock<String>>);
impl Write for Writer {
fn write_st... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/class.rs | Rust | use serde::{ser::SerializeMap, Deserialize, Serialize};
use serde_json::Value;
use swc_common::ast_serde;
use crate::{
common::{
Access, BaseNode, Decorator, Identifier, Param, PrivateName, SuperTypeParams,
TypeAnnotOrNoop, TypeParamDeclOrNoop,
},
expr::{ClassExpression, Expression},
fl... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/comment.rs | Rust | use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::ast_serde;
use crate::common::Loc;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum CommentType {
#[serde(rename = "CommentLine")]
Line,
#[serde(rename = "CommentBlock")]
Block,
}
#[derive(Debug, Clo... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/common.rs | Rust | use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::ast_serde;
use crate::{
class::*, comment::Comment, decl::*, expr::*, flow::*, jsx::*, lit::*, module::*, object::*,
pat::*, stmt::*, typescript::*,
};
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/decl.rs | Rust | use serde::{Deserialize, Serialize};
use swc_common::ast_serde;
use crate::{
class::ClassDeclaration,
common::{BaseNode, Identifier, LVal, Param, TypeAnnotOrNoop, TypeParamDeclOrNoop},
expr::{Expression, FunctionExpression},
flow::{
DeclareClass, DeclareExportAllDeclaration, DeclareExportDeclar... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/expr.rs | Rust | use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::ast_serde;
use crate::{
class::{ClassBody, ClassImpl},
common::{
BaseNode, Decorator, Identifier, LVal, MetaProperty, Param, PrivateName, SpreadElement,
SuperTypeParams, TypeAnnotOrNoop, TypeParamDeclOrNoop,
},
fl... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/flavor.rs | Rust | better_scoped_tls::scoped_tls!(static FLAVOR: Flavor);
#[repr(u8)]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default)]
pub enum Flavor {
#[default]
Babel,
Acorn {
extra_comments: bool,
},
}
impl Flavor {
pub fn with<F, Ret>(self, op: F) -> Ret
where
F: FnOnce() -> Ret,
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/flow.rs | Rust | use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::ast_serde;
use crate::{
common::{BaseNode, IdOrQualifiedId, IdOrString, Identifier},
expr::TypeCastExpression,
lit::StringLiteral,
module::{ExportKind, ExportNamespaceSpecifier, ExportSpecifier},
stmt::BlockStatement,
};
#[d... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/jsx.rs | Rust | use swc_atoms::Atom;
use swc_common::ast_serde;
use crate::{
common::{BaseNode, Identifier, SuperTypeParams},
expr::Expression,
lit::StringLiteral,
};
#[derive(Debug, Clone, PartialEq)]
#[ast_serde]
pub enum JSX {
#[tag("JSXAttribute")]
Attr(JSXAttribute),
#[tag("JSXClosingElement")]
Closi... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/lib.rs | Rust | #![deny(clippy::all)]
#![allow(clippy::enum_variant_names)]
#![allow(clippy::large_enum_variant)]
pub use class::*;
pub use comment::*;
pub use common::*;
pub use decl::*;
pub use expr::*;
pub use flow::*;
pub use jsx::*;
pub use lit::*;
pub use module::*;
pub use object::*;
pub use pat::*;
pub use stmt::*;
pub use ty... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/lit.rs | Rust | use std::borrow::Cow;
use serde::{ser::SerializeMap, Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::ast_serde;
use crate::{common::BaseNode, expr::Expression, flavor::Flavor, typescript::TSType};
#[derive(Debug, Clone, PartialEq)]
pub enum Literal {
String(StringLiteral),
Numeric(NumericLitera... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/module.rs | Rust | use serde::{Deserialize, Serialize};
use serde_json::Value;
use swc_atoms::Atom;
use swc_common::ast_serde;
use crate::{
class::ClassDeclaration,
comment::Comment,
common::{BaseNode, Directive, IdOrString, Identifier},
decl::{Declaration, FunctionDeclaration},
expr::Expression,
lit::StringLiter... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/object.rs | Rust | use serde::{ser::SerializeMap, Deserialize, Serialize};
use swc_common::ast_serde;
use crate::{
common::{
BaseNode, Decorator, Identifier, Param, PatternLike, TypeAnnotOrNoop, TypeParamDeclOrNoop,
},
expr::Expression,
flavor::Flavor,
flow::{
ObjectTypeCallProperty, ObjectTypeIndexer... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/pat.rs | Rust | use serde::{Deserialize, Serialize};
use swc_common::ast_serde;
use crate::{
common::{BaseNode, Decorator, Identifier, PatternLike, RestElement, TypeAnnotOrNoop},
expr::{Expression, MemberExpression},
object::ObjectProperty,
};
#[derive(Debug, Clone, PartialEq)]
#[ast_serde]
pub enum Pattern {
#[tag("... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/ser.rs | Rust | use serde::Serializer;
use crate::flavor::Flavor;
pub(crate) fn serialize_optional<S>(o: &Option<bool>, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
s.serialize_some(&o.unwrap_or(false))
}
/// Always serializes as a boolean value.
pub(crate) fn serialize_as_bool<S>(o: &Option<bool>, s: S) -> Resul... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/stmt.rs | Rust | use serde::{Deserialize, Serialize};
use swc_common::ast_serde;
use crate::{
class::ClassDeclaration,
common::{BaseNode, Directive, Identifier, LVal},
decl::{EnumDeclaration, FunctionDeclaration, VariableDeclaration},
expr::Expression,
flow::{
DeclareClass, DeclareExportAllDeclaration, Decl... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_ast/src/typescript.rs | Rust | use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::ast_serde;
use crate::{
class::ClassMethodKind,
common::{Access, BaseNode, Decorator, IdOrRest, IdOrString, Identifier, Noop, Param},
expr::Expression,
lit::{BigIntLiteral, BooleanLiteral, NumericLiteral, StringLiteral},
obje... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/benches/assets/AjaxObservable.ts | TypeScript | /** @prettier */
import { Observable } from '../../Observable';
import { Subscriber } from '../../Subscriber';
import { TeardownLogic, PartialObserver } from '../../types';
export interface AjaxRequest {
url?: string;
body?: any;
user?: string;
async?: boolean;
method?: string;
headers?: object;
timeout?... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/benches/babelify.rs | Rust | use std::{io::stderr, sync::Arc};
use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion};
use swc::config::IsModule;
use swc_common::{
errors::Handler, FileName, FilePathMapping, Mark, SourceFile, SourceMap, GLOBALS,
};
use swc_ecma_ast::{EsVersion, Program};
use swc_ecma_p... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/scripts/test-acorn.js | JavaScript | // File to parse input as an AST using acorn
const parserOptions = {
ranges: true,
locations: true,
ecmaVersion: "latest",
// https://github.com/tc39/proposal-hashbang
allowHashBang: true,
};
const acorn = require("acorn");
const res = acorn.parse(process.argv[1], parserOptions);
console.log(JSON.... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/scripts/update.sh | Shell | #!/usr/bin/env bash
SCRIPT_DIR="`dirname "$0"`"
IFS='' # maintain whitespace
for filename in $SCRIPT_DIR/../src/ast/*.rs; do
while read -r line; do
[[ "$line" =~ ^[[:space:]]*$ ]] && continue
[[ "$line" =~ ^[[:space:]]*# ]] && continue
[[ "$line" =~ ^[[:space:]]*\/ ]] && continue
e... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/class.rs | Rust | use copyless::BoxHelper;
use serde_json::value::Value;
use swc_ecma_ast::{
Class, ClassMember, ClassMethod, ClassProp, Constructor, Decorator, MethodKind, PrivateMethod,
PrivateProp, StaticBlock,
};
use swc_estree_ast::{
ClassBody, ClassBodyEl, ClassExpression, ClassMethod as BabelClassMethod, ClassMethodKi... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/decl.rs | Rust | use copyless::BoxHelper;
use swc_ecma_ast::{ClassDecl, Decl, FnDecl, UsingDecl, VarDecl, VarDeclKind, VarDeclarator};
use swc_estree_ast::{
ClassBody, ClassDeclaration, Declaration, FunctionDeclaration, UsingDeclaration,
VariableDeclaration, VariableDeclarationKind, VariableDeclarator,
};
use crate::babelify::... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/expr.rs | Rust | use copyless::BoxHelper;
use serde::{Deserialize, Serialize};
use swc_common::{BytePos, Span, Spanned};
use swc_ecma_ast::{
ArrayLit, ArrowExpr, AssignExpr, AssignTarget, AssignTargetPat, AwaitExpr, BinExpr, BinaryOp,
BlockStmtOrExpr, CallExpr, Callee, ClassExpr, CondExpr, Expr, ExprOrSpread, FnExpr, Ident,
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/function.rs | Rust | use copyless::BoxHelper;
use swc_ecma_ast::{Function, Param, ParamOrTsParamProp, Pat};
use swc_estree_ast::{
ArrayPattern, AssignmentPattern, FunctionExpression, Identifier, ObjectPattern,
Param as BabelParam, Pattern, RestElement,
};
use crate::babelify::{Babelify, Context};
impl Babelify for Function {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/ident.rs | Rust | use copyless::BoxHelper;
use swc_ecma_ast::{BindingIdent, Ident, IdentName, PrivateName};
use swc_estree_ast::{Identifier, PrivateName as BabelPrivateName};
use crate::babelify::{Babelify, Context};
impl Babelify for BindingIdent {
type Output = Identifier;
fn babelify(self, ctx: &Context) -> Self::Output {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/jsx.rs | Rust | use copyless::BoxHelper;
use swc_common::{BytePos, Span, Spanned};
use swc_ecma_ast::{
JSXAttr, JSXAttrName, JSXAttrOrSpread, JSXAttrValue, JSXClosingElement, JSXClosingFragment,
JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpr, JSXExpr, JSXExprContainer,
JSXFragment, JSXMemberExpr, JSXNamespacedNa... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/lit.rs | Rust | use serde::{Deserialize, Serialize};
use swc_ecma_ast::{BigInt, Bool, Lit, Null, Number, Regex, Str};
use swc_estree_ast::{
BigIntLiteral, BooleanLiteral, JSXText as BabelJSXText, Literal, NullLiteral, NumericLiteral,
RegExpLiteral, StringLiteral,
};
use crate::babelify::{Babelify, Context};
#[derive(Debug, C... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/mod.rs | Rust | use serde::{de::DeserializeOwned, Serialize};
use swc_common::{
comments::{CommentKind, Comments},
sync::Lrc,
BytePos, SourceFile, SourceMap, Span,
};
use swc_ecma_ast::Class;
use swc_estree_ast::{flavor::Flavor, BaseComment, BaseNode, Comment, CommentType, LineCol, Loc};
use swc_node_comments::SwcComments;... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/module.rs | Rust | use serde::{Deserialize, Serialize};
use swc_common::{comments::Comment, Span};
use swc_ecma_ast::{Module, ModuleItem, Program, Script};
use swc_ecma_visit::{Visit, VisitWith};
use swc_estree_ast::{
flavor::Flavor, BaseNode, File, InterpreterDirective, LineCol, Loc, ModuleDeclaration,
Program as BabelProgram, S... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/module_decl.rs | Rust | use copyless::BoxHelper;
use serde::{Deserialize, Serialize};
use swc_ecma_ast::{
DefaultDecl, ExportAll, ExportDecl, ExportDefaultDecl, ExportDefaultExpr,
ExportDefaultSpecifier, ExportNamedSpecifier, ExportNamespaceSpecifier, ExportSpecifier, Expr,
ImportDecl, ImportDefaultSpecifier, ImportNamedSpecifier,... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/operators.rs | Rust | use serde::{Deserialize, Serialize};
use swc_ecma_ast::{AssignOp, BinaryOp, UnaryOp, UpdateOp};
use swc_estree_ast::{BinaryExprOp, LogicalExprOp, UnaryExprOp, UpdateExprOp};
use crate::babelify::{Babelify, Context};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum BinaryOpOutput {
BinOp(BinaryExprOp),
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/pat.rs | Rust | use copyless::BoxHelper;
use serde::{Deserialize, Serialize};
use swc_common::Spanned;
use swc_ecma_ast::{
ArrayPat, AssignPat, AssignPatProp, KeyValuePatProp, ObjectPat, ObjectPatProp, Pat, RestPat,
};
use swc_estree_ast::{
ArrayPattern, AssignmentPattern, AssignmentPatternLeft, CatchClauseParam, Expression,
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/prop.rs | Rust | use copyless::BoxHelper;
use swc_common::Spanned;
use swc_ecma_ast::{
AssignProp, ComputedPropName, GetterProp, KeyValueProp, MethodProp, Prop, PropName, SetterProp,
};
use swc_estree_ast::{
AssignmentPattern, AssignmentPatternLeft, Expression, FunctionExpression, ObjectKey,
ObjectMember, ObjectMethod, Obje... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/stmt.rs | Rust | use copyless::BoxHelper;
use swc_ecma_ast::{
BlockStmt, BreakStmt, CatchClause, ContinueStmt, DebuggerStmt, Decl, DoWhileStmt, EmptyStmt,
ExprStmt, ForHead, ForInStmt, ForOfStmt, ForStmt, IfStmt, LabeledStmt, ReturnStmt, Stmt,
SwitchCase, SwitchStmt, ThrowStmt, TryStmt, VarDeclOrExpr, WhileStmt, WithStmt,
}... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/babelify/typescript.rs | Rust | use copyless::BoxHelper;
use serde::{Deserialize, Serialize};
use swc_atoms::Atom;
use swc_common::Spanned;
use swc_ecma_ast::{
Accessibility, Expr, MemberProp, Pat, TruePlusMinus, TsArrayType, TsAsExpr,
TsCallSignatureDecl, TsConditionalType, TsConstAssertion, TsConstructSignatureDecl,
TsConstructorType, T... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/lib.rs | Rust | #![deny(clippy::all)]
#![allow(clippy::large_enum_variant)]
#![allow(clippy::upper_case_acronyms)]
use std::convert::Infallible;
pub mod babelify;
pub mod swcify;
pub type Never = Infallible;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/swcify/class.rs | Rust | use swc_ecma_ast::{
ClassMember, Expr, Function, MemberExpr, MemberProp, MethodKind, ParamOrTsParamProp,
TsExprWithTypeArgs,
};
use swc_estree_ast::{
ClassBody, ClassBodyEl, ClassImpl, ClassMethodKind, TSEntityName,
TSExpressionWithTypeArguments, TSQualifiedName,
};
use super::Context;
use crate::swcif... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/swcify/ctx.rs | Rust | use swc_common::{sync::Lrc, BytePos, FileName, SourceFile, SourceMap, Span, DUMMY_SP};
use swc_estree_ast::{BaseNode, LineCol, Loc};
use swc_node_comments::SwcComments;
pub struct Context {
#[allow(unused)]
pub(crate) cm: Lrc<SourceMap>,
pub(crate) fm: Lrc<SourceFile>,
#[allow(unused)]
pub(crate) c... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/swcify/expr.rs | Rust | use swc_common::Spanned;
use swc_ecma_ast::{
op, ArrayLit, ArrowExpr, AssignExpr, AwaitExpr, BinExpr, BinaryOp, BindingIdent,
BlockStmtOrExpr, CallExpr, Callee, ClassExpr, ComputedPropName, CondExpr, Expr, ExprOrSpread,
FnExpr, Function, Ident, Import, JSXAttr, JSXAttrOrSpread, JSXAttrValue, JSXEmptyExpr, J... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/swcify/jsx.rs | Rust | use swc_ecma_ast::Ident;
use crate::swcify::{Context, Swcify};
impl Swcify for swc_estree_ast::JSXNamespacedName {
type Output = swc_ecma_ast::JSXNamespacedName;
fn swcify(self, ctx: &Context) -> Self::Output {
swc_ecma_ast::JSXNamespacedName {
span: ctx.span(&self.base),
ns: ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/swcify/lit.rs | Rust | use swc_ecma_ast::{BigInt, Bool, Expr, Lit, Null, Number, Regex, Str, Tpl, TplElement};
use swc_estree_ast::{
BigIntLiteral, BooleanLiteral, DecimalLiteral, Literal, NullLiteral, NumberLiteral,
NumericLiteral, RegExpLiteral, StringLiteral, TemplateElement, TemplateLiteral,
TemplateLiteralExpr,
};
use super... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/swcify/mod.rs | Rust | use std::fmt::Debug;
pub use self::ctx::Context;
mod class;
mod ctx;
mod expr;
mod jsx;
mod lit;
mod pat;
mod program;
mod stmt;
mod typescript;
/// Used to convert a babel ast node to
pub trait Swcify {
type Output: Debug + Send + Sync;
fn swcify(self, ctx: &Context) -> Self::Output;
}
impl<T> Swcify for ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/swcify/pat.rs | Rust | use swc_common::Spanned;
use swc_ecma_ast::*;
use swc_estree_ast::{
ArrayPattern, AssignmentPattern, AssignmentPatternLeft, LVal, ObjectPattern, ObjectPatternProp,
PatternLike, RestElement,
};
use crate::swcify::{Context, Swcify};
impl Swcify for LVal {
type Output = Pat;
fn swcify(self, ctx: &Contex... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/swcify/program.rs | Rust | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | ||
crates/swc_estree_compat/src/swcify/stmt.rs | Rust | use swc_common::DUMMY_SP;
use swc_ecma_ast::{
BlockStmt, BreakStmt, ClassDecl, ClassExpr, ContinueStmt, DebuggerStmt, DefaultDecl,
DoWhileStmt, EmptyStmt, ExportAll, ExportDecl, ExportDefaultDecl, ExportDefaultExpr,
ExportNamedSpecifier, ExprStmt, FnDecl, FnExpr, ForHead, ForInStmt, ForOfStmt, ForStmt, IfSt... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/src/swcify/typescript.rs | Rust | use swc_ecma_ast::{
Accessibility, Ident, TsEntityName, TsQualifiedName, TsType, TsTypeAnn, TsTypeParam,
TsTypeParamDecl, TsTypeParamInstantiation,
};
use swc_estree_ast::{
Access, FlowType, SuperTypeParams, TSEntityName, TSQualifiedName, TSType, TSTypeAnnotation,
TSTypeParameter, TSTypeParameterDeclara... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/tests/babelgen.js | JavaScript | // Helper for generating Babel fixture JSON.
// USAGE: node babelgen.js path/to/input.js > path/to/output.json
const {readFileSync} = require("fs");
const {parse} = require("@babel/parser");
const inputFile = process.argv[2];
if (!inputFile) {
console.error("Missing input file. Hint: `node babelgen.js path/to/inpu... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/tests/compare.sh | Shell | #!/usr/bin/env bash
# Print a side by side comparison of Babel and SWC AST.
SCRIPT_DIR=`dirname "$0"`
paste <(node "$SCRIPT_DIR/babelgen.js" $1) <(node "$SCRIPT_DIR/swcgen.js" $1) | column -s $'\t' -t
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/tests/convert.rs | Rust | #![feature(test)]
extern crate test;
use std::{
env, fs,
path::{Path, PathBuf},
sync::Arc,
};
use anyhow::{Context as AnyhowContext, Error};
use copyless::BoxHelper;
use pretty_assertions::assert_eq;
use serde_json::{Number, Value};
use swc::{config::IsModule, Compiler};
use swc_common::{
errors::{Col... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/tests/fixtures/array-destructuring/input.js | JavaScript | const arr = [ 1, 2, 3 ];
const [ a, b, ...other ] = arr;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/tests/fixtures/array-simple/input.js | JavaScript | const arr = [ 1, 2, 3 ];
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/tests/fixtures/class-extends/input.js | JavaScript | class Animal {
constructor(name) {
this.name = name;
}
speak() {
console.log(`${this.name} makes a noise.`);
}
}
class Dog extends Animal {
constructor(name) {
super(name);
}
speak() {
console.log(`${this.name} barks.`);
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/tests/fixtures/class-getter-setter/input.js | JavaScript | class Rectangle {
constructor(height, width) {
this.height = height;
this.width = width;
}
set height(height) { this.height = height; }
set width(width) { this.width = width; }
get area() {
return this.calcArea();
}
calcArea() {
return this.height * this.w... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_estree_compat/tests/fixtures/class-method-no-body/input.js | JavaScript | class None {
stub() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.