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/tests/__swc_snapshots__/tests/es2015_function_name.rs/let_complex.js
JavaScript
var TestClass = { name: "John Doe", testMethodFailure () { return new Promise(async function(resolve) { console.log(this); setTimeout(resolve, 1000); }); } };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/decorators.rs
Rust
#![cfg(all( feature = "swc_ecma_transforms_compat", feature = "swc_ecma_transforms_module", feature = "swc_ecma_transforms_optimization", feature = "swc_ecma_transforms_proposal", ))] use std::{fs, path::PathBuf}; use swc_common::Mark; use swc_ecma_ast::Pass; use swc_ecma_parser::{EsSyntax, Syntax, Ts...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/deno.rs
Rust
#![cfg(all( feature = "swc_ecma_transforms_proposal", feature = "swc_ecma_transforms_typescript", ))] use std::path::PathBuf; use swc_common::Mark; use swc_ecma_parser::Syntax; use swc_ecma_transforms::{fixer, helpers::inject_helpers, hygiene, resolver}; use swc_ecma_transforms_proposal::{ decorator_2022_0...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/es2015_function_name.rs
Rust
#![cfg(all( feature = "swc_ecma_transforms_compat", feature = "swc_ecma_transforms_module", feature = "swc_ecma_transforms_optimization", feature = "swc_ecma_transforms_proposal", ))] use swc_common::Mark; use swc_ecma_ast::Pass; use swc_ecma_parser::Syntax; use swc_ecma_transforms_base::resolver; use ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/decorator/.issue-2117/1/exec.ts
TypeScript
class TestClass2 { @deco public testProperty?: string; } function deco(target: any, key: string) { console.log(target, key); } const instance = new TestClass2(); expect(instance.hasOwnProperty("testProperty")).toBe(true);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/decorator/issue-2127/1/exec.ts
TypeScript
const returnValue = "asdasd"; class TestClass { public testProperty: Date; } Object.defineProperty(TestClass.prototype, "testProperty", { get: function () { return returnValue; }, enumerable: true, configurable: true, }); const instance = new TestClass(); expect(instance.testProperty).toBe(...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/decorator/issue-2127/2/exec.ts
TypeScript
const returnValue = "asdasd"; class TestClass2 { @deco public declare testProperty: Date; } function deco(target: any, key: string) { console.log(target, key); Object.defineProperty(target.constructor.prototype, key, { get: function () { return returnValue; }, enumerable:...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/decorator/issue-2127/3/exec.ts
TypeScript
const returnValue = "asdasd"; class TestClass2 { @deco public declare testProperty: Date; } function deco(target: any, key: string) { console.log(target, key); Object.defineProperty(target.constructor.prototype, key, { value: returnValue, enumerable: true, configurable: true, });...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/decorator/issue-3705/exec.ts
TypeScript
function field(host: any, field: any, descr?: any): any { return { ...descr, get: () => {}, set: () => {} }; } class TestMems { @field static some = 1; } expect(Object.keys(TestMems)).toEqual(["some"]); expect(TestMems.some).toBeUndefined();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/deno/stack-overflow/add-1/input.ts
TypeScript
console.log( 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/deno/stack-overflow/add-1/output.js
JavaScript
console.log(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/deno/stack-overflow/which/input.ts
TypeScript
export interface Environment { /** Gets an environment variable. */ env(key: string): string | undefined; /** Resolves the `Deno.FileInfo` for the specified * path following symlinks. */ stat(filePath: string): Promise<Pick<Deno.FileInfo, "isFile">>; /** Synchronously resolves the `Deno.Fi...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/deno/stack-overflow/which/output.js
JavaScript
export class RealEnvironment { env(key) { return Deno.env.get(key); } stat(path) { return Deno.stat(path); } statSync(path) { return Deno.statSync(path); } get os() { return Deno.build.os; } } /** Finds the path to the specified command asynchronously. */ ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/constructor/param/input.ts
TypeScript
class Foo { constructor(@dec1() p: string, @dec2() readonly p2: string) {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/constructor/param/output.ts
TypeScript
class Foo { constructor(p: string, readonly p2: string){} } Foo = _ts_decorate([ _ts_param(0, dec1()), _ts_param(1, dec2()), _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", [ String, String ]) ], Foo);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/1160/1/input.ts
TypeScript
enum MyEnum { x = "xxx", y = "yyy", } class Xpto { @Decorator() value!: MyEnum; } function Decorator() { return function (...args) {}; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/1160/1/output.ts
TypeScript
enum MyEnum { x = "xxx", y = "yyy" } class Xpto { value!: MyEnum; } _ts_decorate([ Decorator(), _ts_metadata("design:type", String) ], Xpto.prototype, "value", void 0); function Decorator() { return function(...args) {}; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/1278/1/input.ts
TypeScript
function MyDecorator(klass) { return () => { // do something console.log(klass); }; } class MyClass { @MyDecorator(MyClass) prop: ""; } console.log(new MyClass());
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/1278/1/output.ts
TypeScript
function MyDecorator(klass) { return ()=>{ // do something console.log(klass); }; } class MyClass { prop: ""; } _ts_decorate([ MyDecorator(MyClass), _ts_metadata("design:type", String) ], MyClass.prototype, "prop", void 0); console.log(new MyClass());
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/1421/1/input.ts
TypeScript
class User { @column() currency!: "usd" | "eur" | "yen"; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/1421/1/output.ts
TypeScript
class User { currency!: "usd" | "eur" | "yen"; } _ts_decorate([ column(), _ts_metadata("design:type", String) ], User.prototype, "currency", void 0);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/1456/1/input.ts
TypeScript
class MyClass { constructor(@Inject() param1: Injected) {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/1456/1/output.ts
TypeScript
class MyClass { constructor(param1: Injected){} } MyClass = _ts_decorate([ _ts_param(0, Inject()), _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", [ typeof Injected === "undefined" ? Object : Injected ]) ], MyClass);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/2461/input.ts
TypeScript
const ThingDecorator: PropertyDecorator = () => {}; class Thing { @ThingDecorator thing?: string | null; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/2461/output.ts
TypeScript
const ThingDecorator: PropertyDecorator = ()=>{}; class Thing { thing?: string | null; } _ts_decorate([ ThingDecorator, _ts_metadata("design:type", Object) ], Thing.prototype, "thing", void 0);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/3319/input.ts
TypeScript
import 'reflect-metadata' let returnType: unknown; function decorator(target: any, key: string | symbol, descriptor: PropertyDescriptor): void { returnType = Reflect.getMetadata('design:returntype', target, key); } enum NumericEnum { A, B, C, } enum StringEnum { A = "A", B = "B", C = "C"...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/3319/output.ts
TypeScript
import 'reflect-metadata'; let returnType: unknown; function decorator(target: any, key: string | symbol, descriptor: PropertyDescriptor): void { returnType = Reflect.getMetadata('design:returntype', target, key); } enum NumericEnum { A, B, C } enum StringEnum { A = "A", B = "B", C = "C" ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/3979/input.ts
TypeScript
class A { @foo x = 1; constructor(); constructor() { console.log(123); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/3979/output.ts
TypeScript
class A { x = 1; constructor(); constructor(){ console.log(123); } } _ts_decorate([ foo ], A.prototype, "x", void 0);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/6683/input.ts
TypeScript
function decorator(): PropertyDecorator { return () => null } class Example { @decorator() value?: `prefix${string}`; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/6683/output.ts
TypeScript
function decorator(): PropertyDecorator { return ()=>null; } class Example { value?: `prefix${string}`; } _ts_decorate([ decorator(), _ts_metadata("design:type", String) ], Example.prototype, "value", void 0);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/9435/input.ts
TypeScript
import { Entity, Column } from "typeorm"; import { Field, ObjectType, registerEnumType } from "type-graphql"; import { Enum1, Enum2 } from "./enum.js"; export enum Enum3 { A = "A", B = "B", C = "C", D = "D", } registerEnumType(Enum3, { name: "Enum3" }); @Entity("user", { schema: "public" }) @ObjectTy...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/issues/9435/output.ts
TypeScript
import { Entity, Column } from "typeorm"; import { Field, ObjectType, registerEnumType } from "type-graphql"; import { Enum1, Enum2 } from "./enum.js"; export enum Enum3 { A = "A", B = "B", C = "C", D = "D" } registerEnumType(Enum3, { name: "Enum3" }); export class User { firstName?: string; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/metadata/generics/1/input.ts
TypeScript
@Decorate class MyClass { constructor(private generic: Generic<A>, generic2: Generic<A, B>) {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/metadata/generics/1/output.ts
TypeScript
class MyClass { constructor(private generic: Generic<A>, generic2: Generic<A, B>){} } MyClass = _ts_decorate([ Decorate, _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", [ typeof Generic === "undefined" ? Object : Generic, typeof Generic === "undefined" ? Object :...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/metadata/generics/base/input.ts
TypeScript
@Decorate class MyClass { constructor(private generic: Generic<A>, generic2: Generic<A, B>) {} @Run method(generic: Inter<A>, @Arg() generic2: InterGen<A, B>) {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/metadata/generics/base/output.ts
TypeScript
class MyClass { constructor(private generic: Generic<A>, generic2: Generic<A, B>){} method(generic: Inter<A>, generic2: InterGen<A, B>) {} } _ts_decorate([ Run, _ts_param(1, Arg()), _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", [ typeof Inter === "undefined" ? ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/metadata/nest/injection/input.ts
TypeScript
import { AppService } from "./app.service"; import { Session, Res } from "@nestjs/common"; import * as express from "express"; @Controller() export class AppController { constructor(private appService: AppService) {} @Inject() appService: AppService; @Inject() private appService2: AppService; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/metadata/nest/injection/output.ts
TypeScript
import { AppService } from "./app.service"; import { Session, Res } from "@nestjs/common"; import * as express from "express"; export class AppController { constructor(private appService: AppService){} appService: AppService; private appService2: AppService; getHello(): string { return this.appS...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/metadata/paramters/decorated-types/input.ts
TypeScript
class Injected {} class MyClass { constructor(@inject() parameter: Injected) {} } class MyOtherClass { constructor( @inject() private readonly parameter: Injected, @inject("KIND") otherParam: Injected ) {} methodUndecorated(@demo() param: string, otherParam) {} @decorate("named")...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/metadata/paramters/decorated-types/output.ts
TypeScript
class Injected { } class MyClass { constructor(parameter: Injected){} } MyClass = _ts_decorate([ _ts_param(0, inject()), _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", [ typeof Injected === "undefined" ? Object : Injected ]) ], MyClass); class MyOtherClass { con...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/metadata/type/serialization/input.ts
TypeScript
import { Service } from "./service"; import { Decorate } from "./Decorate"; const sym = Symbol(); @Decorate() class Sample { constructor( private p0: String, p1: Number, p2: 10, p3: "ABC", p4: boolean, p5: string, p6: number, p7: Object, p8: ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/metadata/type/serialization/output.ts
TypeScript
import { Service } from "./service"; import { Decorate } from "./Decorate"; const sym = Symbol(); class Sample { constructor(private p0: String, p1: Number, p2: 10, p3: "ABC", p4: boolean, p5: string, p6: number, p7: Object, p8: () => any, p9: "abc" | "def", p10: String | Number, p11: Function, p12: null, p13: unde...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/method/param/input.ts
TypeScript
class Foo { foo(@dec1() p: string, @dec2() p2: string) {} static bar(@dec1() p: string, @dec2() p2: string) {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-metadata/method/param/output.ts
TypeScript
class Foo { foo(p: string, p2: string) {} static bar(p: string, p2: string) {} } _ts_decorate([ _ts_param(0, dec1()), _ts_param(1, dec2()), _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", [ String, String ]), _ts_metadata("design:returntype", void...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/decl-to-expression/class-decorators/input.ts
TypeScript
export default @dec class A { } @dec class B { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/decl-to-expression/class-decorators/output.ts
TypeScript
export default class A { } A = _ts_decorate([ dec ], A); class B { } B = _ts_decorate([ dec ], B);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/decl-to-expression/method-decorators/input.ts
TypeScript
export default class A { @dec foo() {} } class B { @dec foo() {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/decl-to-expression/method-decorators/output.ts
TypeScript
export default class A { foo() {} } _ts_decorate([ dec ], A.prototype, "foo", null); class B { foo() {} } _ts_decorate([ dec ], B.prototype, "foo", null);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/1869/1/input.ts
TypeScript
@someClassDecorator class TestClass { static Something = "hello"; static SomeProperties = { firstProp: TestClass.Something, }; } function someClassDecorator(c) { return c; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/1869/1/output.ts
TypeScript
class TestClass { static Something = "hello"; static SomeProperties = { firstProp: TestClass.Something }; } TestClass = _ts_decorate([ someClassDecorator ], TestClass); function someClassDecorator(c) { return c; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/1913/1/input.ts
TypeScript
class Store { constructor() { this.doSomething(); } @action doSomething = () => { console.log("run"); }; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/1913/1/output.ts
TypeScript
class Store { constructor(){ this.doSomething(); } doSomething = ()=>{ console.log("run"); }; } _ts_decorate([ action ], Store.prototype, "doSomething", void 0);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/1913/2/input.ts
TypeScript
class Store extends BaseStore { constructor() { super(); this.doSomething(); } @action doSomething = () => { console.log("run"); }; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/1913/2/output.ts
TypeScript
class Store extends BaseStore { constructor(){ super(); this.doSomething(); } doSomething = ()=>{ console.log("run"); }; } _ts_decorate([ action ], Store.prototype, "doSomething", void 0);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/591/1/input.ts
TypeScript
export class Example { @foo() bar = "1"; @foo() baz = "2"; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/591/1/output.ts
TypeScript
export class Example { bar = "1"; baz = "2"; } _ts_decorate([ foo() ], Example.prototype, "bar", void 0); _ts_decorate([ foo() ], Example.prototype, "baz", void 0);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/591/2/input.ts
TypeScript
class Example { @foo() bar = "1"; @foo() baz = "2"; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/591/2/output.ts
TypeScript
class Example { bar = "1"; baz = "2"; } _ts_decorate([ foo() ], Example.prototype, "bar", void 0); _ts_decorate([ foo() ], Example.prototype, "baz", void 0);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/823/1/input.ts
TypeScript
import { Debounce } from "lodash-decorators"; class Person { private static debounceTime: number = 500 as const; @Debounce(Person.debounceTime) save() { console.log("Hello World!"); } } const p = new Person(); p.save();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/823/1/output.ts
TypeScript
import { Debounce } from "lodash-decorators"; class Person { private static debounceTime: number = 500 as const; save() { console.log("Hello World!"); } } _ts_decorate([ Debounce(Person.debounceTime) ], Person.prototype, "save", null); const p = new Person(); p.save();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/823/2/input.ts
TypeScript
import { Debounce } from "lodash-decorators"; class Person { private static debounceTime: number = 500 as const; @Debounce(Person.debounceTime) save() { console.log("Hello World!"); } } const p = new Person(); p.save();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/823/2/output.ts
TypeScript
import { Debounce } from "lodash-decorators"; class Person { private static debounceTime: number = 500 as const; save() { console.log("Hello World!"); } } _ts_decorate([ Debounce(Person.debounceTime) ], Person.prototype, "save", null); const p = new Person(); p.save();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/823/3/input.ts
TypeScript
import { Debounce } from "lodash-decorators"; class Person { private static debounceTime: number = 500 as const; @Debounce(Person.debounceTime) save() { console.log("Hello World!"); } } const p = new Person(); p.save();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/823/3/output.ts
TypeScript
import { Debounce } from "lodash-decorators"; class Person { private static debounceTime: number = 500 as const; save() { console.log("Hello World!"); } } _ts_decorate([ Debounce(Person.debounceTime) ], Person.prototype, "save", null); const p = new Person(); p.save();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/862/1/input.ts
TypeScript
@Entity() export class Product extends TimestampedEntity { @PrimaryGeneratedColumn("uuid") public id!: string; @Column() public price!: number; @Column({ enum: ProductType }) public type!: ProductType; @Column() public productEntityId!: string; /* ANCHOR: Relations --------------...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/862/1/output.ts
TypeScript
export class Product extends TimestampedEntity { public id!: string; public price!: number; public type!: ProductType; public productEntityId!: string; /* ANCHOR: Relations ------------------------------------------------------ */ public orders!: Order[]; public discounts!: Discount[]; } _ts_dec...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/862/2/input.ts
TypeScript
@Entity() export class Product extends TimestampedEntity { @PrimaryGeneratedColumn("uuid") public id!: string; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/862/2/output.ts
TypeScript
export class Product extends TimestampedEntity { public id!: string; } _ts_decorate([ PrimaryGeneratedColumn("uuid") ], Product.prototype, "id", void 0); Product = _ts_decorate([ Entity() ], Product);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/863/1/input.ts
TypeScript
class ProductController { @bar() findById( @foo() id: number ) { // ... } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/863/1/output.ts
TypeScript
class ProductController { findById(id: number) { // ... } } _ts_decorate([ bar(), _ts_param(0, foo()) ], ProductController.prototype, "findById", null);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/879/1/input.ts
TypeScript
export default class X { @networked prop: string = ""; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/879/1/output.ts
TypeScript
export default class X { prop: string = ""; } _ts_decorate([ networked ], X.prototype, "prop", void 0);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/swc-node-210/input.ts
TypeScript
class Foo { @dec [foo]() {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/issues/swc-node-210/output.ts
TypeScript
var _key; _key = foo; class Foo { [_key]() {} } _ts_decorate([ dec ], Foo.prototype, _key, null);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/regression-10264/input.ts
TypeScript
function myDecorator(decoratee) {} @myDecorator export default class {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/regression-10264/output.ts
TypeScript
function myDecorator(decoratee) {} export default class _class { } _class = _ts_decorate([ myDecorator ], _class);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/regression-8041/input.ts
TypeScript
export default class { @foo bar() {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms/tests/fixture/legacy-only/regression-8041/output.ts
TypeScript
export default class _class { bar() {} } _ts_decorate([ foo ], _class.prototype, "bar", null);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_antidro/src/lib.rs
Rust
#![allow(warnings)] use std::{ collections::{BTreeSet, HashMap, HashSet}, sync::{ atomic::{AtomicUsize, Ordering}, Mutex, OnceLock, }, }; use bimap::BiMap; use maplit::hashmap; use petgraph::{ algo::toposort, graph::{DiGraph, NodeIndex}, Direction, }; use swc_atoms::Atom; use sw...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_antidro/src/tests.rs
Rust
use swc_ecma_ast::Pass; use swc_ecma_transforms_testing::{test, Tester}; use crate::antidro; fn tr(_t: &mut Tester) -> impl Pass { // let unresolved_mark = Mark::new(); antidro() } test!( module, ::swc_ecma_parser::Syntax::Es(::swc_ecma_parser::EsSyntax { ..Default::default() }), tr, ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_antidro/tests/__swc_snapshots__/src/tests.rs/antidro_map.js
JavaScript
function App() { let l = []; let onClick = ()=>{ push(l, "Hello"); appendChild(el0, ((s)=>element("li", {}, [ text(s) ]))("Hello")); }; var el0 = element("ul", {}, map(l, (s)=>element("li", {}, [ text(s) ]))); return el0; } ;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_antidro/tests/__swc_snapshots__/src/tests.rs/antidro_map_set.js
JavaScript
function App() { let l = [ "Foo" ]; let onClick = ()=>{ l[0] = "Bar"; }; var map0 = map(l, (s)=>element("li", {}, [ text(s) ])); var element0 = element("ul", {}, map0); return element0; } ;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_antidro/tests/__swc_snapshots__/src/tests.rs/antidro_simple.js
JavaScript
function App() { let n = 0; let onClick = ()=>{ n = n + 1; setInnerText(text1, toString(n)); }; var text0 = text("+"); var element0 = element("button", { onClick: onClick }, [ text0 ]); var text1 = text(toString(n)); var element1 = element("span", {}, ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/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_ecma_transforms_base/benches/base.rs
Rust
#![allow(clippy::redundant_closure_call)] extern crate swc_malloc; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; use swc_common::{errors::HANDLER, FileName, Mark}; use swc_ecma_ast::Program; use swc_ecma_parser::{Parser, StringInput, Syntax}; use swc_ecma_transforms_...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/benches/parallel.rs
Rust
#![allow(clippy::redundant_closure_call)] extern crate swc_malloc; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; use rayon::prelude::*; use swc_common::{errors::HANDLER, FileName, Mark, GLOBALS}; use swc_ecma_ast::Program; use swc_ecma_parser::{Parser, StringInput, S...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/assumptions.rs
Rust
use serde::{Deserialize, Serialize}; /// Alternative for https://babeljs.io/docs/en/assumptions /// /// All fields default to `false`. #[derive( Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, )] #[non_exhaustive] #[serde(rename_all = "camelCase", deny_unknown_fields)] pu...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/ext.rs
Rust
//! Do not use: This is not a public api and it can be changed without a version //! bump. use swc_ecma_ast::*; use swc_ecma_utils::ExprExt; pub trait ExprRefExt: ExprExt { fn as_ident(&self) -> Option<&Ident> { match self.as_expr() { Expr::Ident(ref i) => Some(i), _ => None, ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/feature.rs
Rust
#![allow(non_upper_case_globals)] use bitflags::bitflags; use swc_ecma_ast::EsVersion::{self, *}; bitflags! { #[derive(Default, Clone, Copy)] pub struct FeatureFlag: u64 { /// `transform-template-literals` const TemplateLiterals = 1 << 0; /// `transform-literals` const Literals...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/fixer.rs
Rust
use std::{hash::BuildHasherDefault, mem, ops::RangeFull}; use indexmap::IndexMap; use rustc_hash::FxHasher; use swc_common::{comments::Comments, util::take::Take, Span, Spanned, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::stack_size::maybe_grow_default; use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass,...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/helpers/_apply_decorated_descriptor.js
JavaScript
function _apply_decorated_descriptor(target, property, decorators, descriptor, context) { var desc = {}; Object["ke" + "ys"](descriptor).forEach(function(key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ("value" in d...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/helpers/_apply_decs_2203_r.js
JavaScript
/* @minVersion 7.20.0 */ /** Enums are used in this file, but not assigned to vars to avoid non-hoistable values CONSTRUCTOR = 0; PUBLIC = 1; PRIVATE = 2; FIELD = 0; ACCESSOR = 1; METHOD = 2; GETTER = 3; SETTER = 4; STATIC = 5; CLASS = 10; // only used in assertValidReturnValue */ function a...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/helpers/_array_like_to_array.js
JavaScript
function _array_like_to_array(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/helpers/_array_with_holes.js
JavaScript
function _array_with_holes(arr) { if (Array.isArray(arr)) return arr; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/helpers/_array_without_holes.js
JavaScript
function _array_without_holes(arr) { if (Array.isArray(arr)) return _array_like_to_array(arr); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/helpers/_assert_this_initialized.js
JavaScript
function _assert_this_initialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/helpers/_async_generator.js
JavaScript
function _async_generator(gen) { var front, back; function send(key, arg) { return new Promise(function(resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } els...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/helpers/_async_generator_delegate.js
JavaScript
function _async_generator_delegate(inner, awaitWrap) { var iter = {}, waiting = false; function pump(key, value) { waiting = true; value = new Promise(function(resolve) { resolve(inner[key](value)); }); return { done: false, value: awaitWrap(value) }; } if (ty...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_base/src/helpers/_async_iterator.js
JavaScript
function _async_iterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University