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_node_bundler/src/v1/resolve.rs | Rust | use std::{collections::HashMap, path::PathBuf};
use serde::Deserialize;
use swc_atoms::Atom;
/// https://webpack.js.org/configuration/resolve/
#[derive(Debug, Deserialize)]
#[serde(rename = "Resolve", rename_all = "camelCase")]
pub struct ResolveConfig {
#[serde(default)]
pub alias: Option<AliasConfig>,
#[serde(default)]
pub alias_fields: Vec<Atom>,
#[serde(default)]
pub description_files: Vec<Atom>,
#[serde(default)]
pub enforce_extension: bool,
#[serde(default = "default_extensions")]
pub extensions: Vec<Atom>,
#[serde(default)]
pub main_fields: Vec<Atom>,
#[serde(default = "default_symlinks")]
pub symlinks: bool,
}
fn default_extensions() -> Vec<Atom> {
vec![
".wasm".into(),
".mjs".into(),
".js".into(),
".json".into(),
".ts".into(),
".tsc".into(),
]
}
fn default_symlinks() -> bool {
true
}
#[derive(Debug, Deserialize)]
#[serde(rename = "Resolve.Alias", rename_all = "camelCase")]
pub struct AliasConfig {
#[serde(flatten)]
pub map: HashMap<Atom, PathBuf>,
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/src/v2/mod.rs | Rust | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | ||
crates/swc_node_bundler/tests/fixture.rs | Rust | use std::{
collections::HashMap,
fs::{create_dir_all, read_dir},
io::{self},
path::PathBuf,
sync::Arc,
};
use anyhow::Error;
use swc::{resolver::environment_resolver, PrintArgs};
use swc_bundler::{BundleKind, Bundler, Config, ModuleRecord};
use swc_common::{errors::HANDLER, FileName, Globals, Span, GLOBALS};
use swc_ecma_ast::{
Bool, EsVersion, Expr, IdentName, KeyValueProp, Lit, MemberExpr, MemberProp, MetaPropExpr,
MetaPropKind, Program, PropName, Str,
};
use swc_ecma_loader::{TargetEnv, NODE_BUILTINS};
use swc_ecma_transforms::fixer;
use swc_node_bundler::loaders::swc::SwcLoader;
use testing::NormalizedOutput;
#[testing::fixture("tests/pass/**/input")]
fn pass(input_dir: PathBuf) {
let entry = input_dir.parent().unwrap().to_path_buf();
let _ = create_dir_all(entry.join("output"));
let entries = read_dir(&input_dir)
.unwrap()
.filter(|e| match e {
Ok(e) => e
.path()
.file_name()
.unwrap()
.to_string_lossy()
.starts_with("entry"),
_ => false,
})
.map(|e| -> Result<_, io::Error> {
let e = e?;
Ok((
e.file_name().to_string_lossy().to_string(),
FileName::Real(e.path()),
))
})
.collect::<Result<HashMap<_, _>, _>>()
.unwrap();
testing::run_test2(false, |cm, handler| {
HANDLER.set(&handler, || {
let compiler = Arc::new(swc::Compiler::new(cm.clone()));
let globals = Globals::new();
GLOBALS.set(&globals, || {
let loader = SwcLoader::new(
compiler.clone(),
swc::config::Options {
swcrc: true,
..Default::default()
},
);
let mut bundler = Bundler::new(
&globals,
cm.clone(),
&loader,
environment_resolver(TargetEnv::Node, Default::default(), false),
Config {
require: true,
disable_inliner: true,
module: Default::default(),
external_modules: NODE_BUILTINS.iter().copied().map(From::from).collect(),
..Default::default()
},
Box::new(Hook),
);
let modules = bundler
.bundle(entries)
.map_err(|err| println!("{:?}", err))?;
println!("Bundled as {} modules", modules.len());
let mut error = false;
for bundled in modules {
let comments = compiler.comments().clone();
let code = compiler
.print(
&Program::Module(bundled.module).apply(&mut fixer(None)),
PrintArgs {
comments: Some(&comments),
codegen_config: swc_ecma_codegen::Config::default()
.with_target(EsVersion::Es2020),
..Default::default()
},
)
.expect("failed to print?")
.code;
let name = match bundled.kind {
BundleKind::Named { name } | BundleKind::Lib { name } => {
PathBuf::from(name)
}
BundleKind::Dynamic => format!("dynamic.{}.js", bundled.id).into(),
};
let output_path = entry
.join("output")
.join(name.file_name().unwrap())
.with_extension("js");
println!("Printing {}", output_path.display());
// {
// let status = Command::new("node")
// .arg(&output_path)
// .stdout(Stdio::inherit())
// .stderr(Stdio::inherit())
// .status()
// .unwrap();
// assert!(status.success());
// }
let s = NormalizedOutput::from(code);
match s.compare_to_file(&output_path) {
Ok(_) => {}
Err(err) => {
println!("Diff: {:?}", err);
error = true;
}
}
}
if error {
return Err(());
}
Ok(())
})
})
})
.expect("failed to process a module");
}
struct Hook;
impl swc_bundler::Hook for Hook {
fn get_import_meta_props(
&self,
span: Span,
module_record: &ModuleRecord,
) -> Result<Vec<KeyValueProp>, Error> {
let file_name = module_record.file_name.to_string();
Ok(vec![
KeyValueProp {
key: PropName::Ident(IdentName::new("url".into(), span)),
value: Box::new(Expr::Lit(Lit::Str(Str {
span,
raw: None,
value: file_name.into(),
}))),
},
KeyValueProp {
key: PropName::Ident(IdentName::new("main".into(), span)),
value: Box::new(if module_record.is_entry {
Expr::Member(MemberExpr {
span,
obj: Box::new(Expr::MetaProp(MetaPropExpr {
span,
kind: MetaPropKind::ImportMeta,
})),
prop: MemberProp::Ident(IdentName::new("main".into(), span)),
})
} else {
Expr::Lit(Lit::Bool(Bool { span, value: false }))
}),
},
])
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/integration/react/spack.config.js | JavaScript | module.exports = {
entry: {
web: __dirname + "/src/index.tsx",
},
output: {
path: __dirname + "/lib",
},
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/integration/react/src/index.tsx | TypeScript (TSX) | import React from "react";
import ReactDom from "react-dom";
function App() {
return <div></div>;
}
ReactDom.render(<App />, document.getElementById("root"));
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-default/input/a.js | JavaScript | const foo = 1;
export default foo;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-default/input/entry.js | JavaScript | import a from "./a";
console.log(a);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-default/output/entry.js | JavaScript | const foo = 1;
console.log(foo);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-named-1/input/a.js | JavaScript | const foo = 1;
export { foo as bar };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-named-1/input/entry.js | JavaScript | import { bar } from "./a";
console.log(bar);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-named-1/output/entry.js | JavaScript | const foo = 1;
console.log(foo);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-named-optimization/input/a.js | JavaScript | const foo = 1;
export { foo };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-named-optimization/input/entry.js | JavaScript | import { foo } from "./a";
console.log(foo);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-named-optimization/output/entry.js | JavaScript | const foo = 1;
console.log(foo);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-named-same-name/input/a.js | JavaScript | const foo = 1;
const bar = 2;
export { foo as bar };
export { bar as baz };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-named-same-name/input/entry.js | JavaScript | import { bar, baz } from "./a";
console.log(bar);
console.log(baz);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/export-named-same-name/output/entry.js | JavaScript | const foo = 1;
const bar = 2;
console.log(foo);
console.log(bar);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/import/multi/input/a.js | JavaScript | export function a() {
console.log("a()");
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/import/multi/input/b.js | JavaScript | export function b() {
console.log("a()");
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/import/multi/input/entry.js | JavaScript | import { a as foo } from "./a";
import { b as bar } from "./b";
function a() {}
function b() {}
console.log(a(), foo(), b(), bar());
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/import/multi/output/entry.js | JavaScript | function a() {
console.log("a()");
}
function b() {
console.log("a()");
}
function a1() {}
function b1() {}
console.log(a1(), a(), b1(), b());
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/import/simple/input/a.js | JavaScript | export function a() {
console.log("a()");
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/import/simple/input/entry.js | JavaScript | import { a as foo } from "./a";
function a() {}
console.log(a(), foo());
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/alias/import/simple/output/entry.js | JavaScript | function a() {
console.log("a()");
}
function a1() {}
console.log(a1(), a());
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/class-inheritance/input/a.js | JavaScript | import { B } from "./b";
export class A extends B {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/class-inheritance/input/b.js | JavaScript | export class B {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/extends/input/a.js | JavaScript | import { B } from "./b";
export class A extends B {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/extends/input/b.js | JavaScript | export class B {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/extends/input/entry.js | JavaScript | import { A } from "./a";
import { B } from "./b";
console.log(A, B);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/extends/output/entry.js | JavaScript | class B {
}
class A extends B {
}
console.log(A, B);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/no-import/input/entry.js | JavaScript | console.log("Foo");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/no-import/output/entry.js | JavaScript | console.log("Foo");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/relative-import-const/input/a.js | JavaScript | export const FOO = "string";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/relative-import-const/input/entry.js | JavaScript | import { FOO } from "./a";
console.log(FOO);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/basic/relative-import-const/output/entry.js | JavaScript | const FOO = "string";
console.log(FOO);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/complex-class-function/input/a.js | JavaScript | import { getC } from "./c";
export function a() {
return new A();
}
export class A extends getC() {}
export function getA() {
return A;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/complex-class-function/input/b.js | JavaScript | import { A, getA, a } from "./a";
export { A, getA, a };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/complex-class-function/input/c.js | JavaScript | import "./b";
export function getC() {
return C;
}
export class C {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/complex-class-function/input/entry.js | JavaScript | import { a } from "./a";
console.log(a, a());
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/complex-class-function/output/entry.js | JavaScript | function a() {
return new A();
}
function getC() {
return C;
}
class A extends getC() {
}
class C {
}
console.log(a, a());
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/hygiene/class-inheritance/input/a.js | JavaScript | import { B } from "./b";
export class A extends B {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/hygiene/class-inheritance/input/b.js | JavaScript | import { A } from "./a";
import { C } from "./c";
export class B extends C {
a() {
return new A();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/hygiene/class-inheritance/input/c.js | JavaScript | import { B } from "./b";
export class C {
a() {
throw new Error("Unimplemented");
}
b() {
return new B();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/hygiene/class-inheritance/input/entry.js | JavaScript | import { A } from "./a";
import "./b";
import "./c";
console.log(A, "Loaded!");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/hygiene/class-inheritance/output/entry.js | JavaScript | class C {
a() {
throw new Error("Unimplemented");
}
b() {
return new B();
}
}
class B extends C {
a() {
return new A();
}
}
class A extends B {
}
console.log(A, "Loaded!");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/imports-same/input/a.js | JavaScript | import { foo } from "./common";
console.log("a", foo);
export const a = foo + 1;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/imports-same/input/b.js | JavaScript | import { foo } from "./common";
console.log("b", foo);
export const b = foo + 2;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/imports-same/input/common-foo.js | JavaScript | export const foo = 1;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/imports-same/input/common.js | JavaScript | export { foo } from "./common-foo";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/imports-same/input/entry.js | JavaScript | export * from "./a";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/imports-same/output/entry.js | JavaScript | const foo = 1;
console.log("a", foo);
const a = foo + 1;
export { a as a };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/many/input/a.js | JavaScript | import "./b";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/many/input/b.js | JavaScript | import "./c";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/many/input/c.js | JavaScript | import "./d";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/many/input/d.js | JavaScript | import "./a";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/many/input/entry.js | JavaScript | import "./a";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/mixed/input/a.js | JavaScript | import { B } from "./b";
import "./c";
export class A {
method() {
return new B();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/mixed/input/b.js | JavaScript | import { A } from "./a";
import "./c";
export class B extends A {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/mixed/input/c.js | JavaScript | console.log("c");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/mixed/input/entry.js | JavaScript | import { A } from "./a";
import { B } from "./b";
console.log(A, B);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/mixed/output/entry.js | JavaScript | console.log("c");
class A {
method() {
return new B();
}
}
class B extends A {
}
console.log(A, B);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/simple/input/a.js | JavaScript | import { B } from "./b";
export class A {
method() {
return new B();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/simple/input/b.js | JavaScript | import { A } from "./a";
export class B extends A {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/simple/input/entry.js | JavaScript | import { A } from "./a";
import { B } from "./b";
console.log(A, B);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/simple/output/entry.js | JavaScript | class A {
method() {
return new B();
}
}
class B extends A {
}
console.log(A, B);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/top-level-idents/input/a.js | JavaScript | import "./b";
console.log("a");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/top-level-idents/input/b.js | JavaScript | import "./c";
console.log("b");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/top-level-idents/input/c.js | JavaScript | import "./a";
console.log("c");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/top-level-idents/input/entry.js | JavaScript | import "./a";
console.log("entry");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/circular/top-level-idents/output/entry.js | JavaScript | console.log("a");
console.log("b");
console.log("c");
console.log("entry");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/common-library/input/a.js | JavaScript | const Common = require("./common");
module.exports = class A extends Common {};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/common-library/input/b.js | JavaScript | const Common = require("./common");
module.exports = class B extends Common {};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/common-library/input/common.js | JavaScript | module.exports = class Common {};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/common-library/input/entry.js | JavaScript | import A from "./a";
import B from "./b";
console.log(A, B);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/common-library/output/entry.js | JavaScript | function __swcpack_require__(mod) {
function interop(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
var cache;
if (cache) {
return cache;
}
var module = {
exports: {}
};
mod(module, module.exports);
cache = interop(module.exports);
return cache;
}
var load = __swcpack_require__.bind(void 0, function(module, exports) {
module.exports = class Common {
};
});
var load1 = __swcpack_require__.bind(void 0, function(module, exports) {
const Common = load();
module.exports = class A extends Common {
};
});
var load2 = __swcpack_require__.bind(void 0, function(module, exports) {
const Common = load();
module.exports = class B extends Common {
};
});
var { default: A } = load1();
var { default: B } = load2();
console.log(A, B);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/conditional/input/common.js | JavaScript | console.log("foo");
console.log("bar");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/conditional/input/entry.js | JavaScript | if (foo()) {
require("./common");
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/conditional/output/entry.js | JavaScript | function __swcpack_require__(mod) {
function interop(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
var cache;
if (cache) {
return cache;
}
var module = {
exports: {}
};
mod(module, module.exports);
cache = interop(module.exports);
return cache;
}
var load = __swcpack_require__.bind(void 0, function(module, exports) {
console.log("foo");
console.log("bar");
});
if (foo()) load();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-no-recursive-require/input/a.js | JavaScript | console.log("a");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-no-recursive-require/input/b.js | JavaScript | console.log("b");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-no-recursive-require/input/c.js | JavaScript | console.log("c");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-no-recursive-require/input/entry.js | JavaScript | require("./a");
require("./b");
require("./c");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-no-recursive-require/output/entry.js | JavaScript | function __swcpack_require__(mod) {
function interop(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
var cache;
if (cache) {
return cache;
}
var module = {
exports: {}
};
mod(module, module.exports);
cache = interop(module.exports);
return cache;
}
var load = __swcpack_require__.bind(void 0, function(module, exports) {
console.log("a");
});
var load1 = __swcpack_require__.bind(void 0, function(module, exports) {
console.log("b");
});
var load2 = __swcpack_require__.bind(void 0, function(module, exports) {
console.log("c");
});
load();
load1();
load2();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-recursive-require/input/a-a-a.js | JavaScript | module.exports = {
default: "a-a-a",
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-recursive-require/input/a-a.js | JavaScript | module.exports = require("./a-a-a");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-recursive-require/input/a-b.js | JavaScript | console.log("a-b");
exports.default = "ab";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-recursive-require/input/a.js | JavaScript | const aa = require("./a-a");
const bb = require("./a-b");
require("./b");
module.exports = { aa, bb };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-recursive-require/input/b.js | JavaScript | console.log("b");
module.exports = "b";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-recursive-require/input/c.js | JavaScript | console.log("c");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-recursive-require/input/entry.js | JavaScript | require("./a");
const b = require("./b");
require("./c");
console.log(b);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/issue-967-recursive-require/output/entry.js | JavaScript | function __swcpack_require__(mod) {
function interop(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
var cache;
if (cache) {
return cache;
}
var module = {
exports: {}
};
mod(module, module.exports);
cache = interop(module.exports);
return cache;
}
var load = __swcpack_require__.bind(void 0, function(module, exports) {
module.exports = {
default: "a-a-a"
};
});
var load1 = __swcpack_require__.bind(void 0, function(module, exports) {
module.exports = load();
});
var load2 = __swcpack_require__.bind(void 0, function(module, exports) {
console.log("a-b");
exports.default = "ab";
});
var load3 = __swcpack_require__.bind(void 0, function(module, exports) {
console.log("b");
module.exports = "b";
});
var load4 = __swcpack_require__.bind(void 0, function(module, exports) {
var aa = load1();
var bb = load2();
load3();
module.exports = {
aa: aa,
bb: bb
};
});
var load5 = __swcpack_require__.bind(void 0, function(module, exports) {
console.log("c");
});
load4();
var b = load3();
load5();
console.log(b);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/mixed/input/a.js | JavaScript | module.exports = require("./b");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/mixed/input/b.js | JavaScript | module.exports = 1;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/mixed/input/entry.js | JavaScript | import a from "./a";
console.log(a);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/mixed/output/entry.js | JavaScript | function __swcpack_require__(mod) {
function interop(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
var cache;
if (cache) {
return cache;
}
var module = {
exports: {}
};
mod(module, module.exports);
cache = interop(module.exports);
return cache;
}
var load = __swcpack_require__.bind(void 0, function(module, exports) {
module.exports = 1;
});
var load1 = __swcpack_require__.bind(void 0, function(module, exports) {
module.exports = load();
});
var { default: a } = load1();
console.log(a);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/nested/input/a.js | JavaScript | module.exports = require("./b");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/nested/input/b.js | JavaScript | module.exports = 1;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/nested/input/entry.js | JavaScript | const a = require("./a");
console.log(a);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/cjs/nested/output/entry.js | JavaScript | function __swcpack_require__(mod) {
function interop(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
var cache;
if (cache) {
return cache;
}
var module = {
exports: {}
};
mod(module, module.exports);
cache = interop(module.exports);
return cache;
}
var load = __swcpack_require__.bind(void 0, function(module, exports) {
module.exports = 1;
});
var load1 = __swcpack_require__.bind(void 0, function(module, exports) {
module.exports = load();
});
const a = load1();
console.log(a);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_node_bundler/tests/pass/deno-001/full/input/_util/assert.ts | TypeScript | // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
export class DenoStdInternalError extends Error {
constructor(message: string) {
super(message);
this.name = "DenoStdInternalError";
}
}
/** Make an assertion, if not `true`, then throw. */
export function assert(expr: unknown, msg = ""): asserts expr {
if (!expr) {
throw new DenoStdInternalError(msg);
}
}
| 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.