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/tests/vercel/full/react-autowhatever/1/input/index.js
JavaScript
import React, { Component } from "react"; import PropTypes from "prop-types"; export default class ItemsList extends Component { static propTypes = { items: PropTypes.array.isRequired, itemProps: PropTypes.oneOfType([PropTypes.object, PropTypes.func]), renderItem: PropTypes.func.isRequired,...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/react-autowhatever/1/output/index.js
JavaScript
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), Object.defineProperty(exports, "default", { enumerable: !0, get: function() { return o; } }); var e = require("@swc/helpers/_/_call_super"), t = require("@swc/helpers/_/_class_call_check"), r = require("@swc/helpers/_/_cr...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/react-autowhatever/2/input/index.js
JavaScript
import React, { Component } from "react"; export default class ItemsList extends Component { static propTypes = { items: 500, }; static defaultProps = { sectionIndex: null, }; shouldComponentUpdate(nextProps) { return compareObjects(nextProps, this.props, ["itemProps"]); ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/react-autowhatever/2/output/index.js
JavaScript
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), Object.defineProperty(exports, "default", { enumerable: !0, get: function() { return l; } }); var e = require("@swc/helpers/_/_call_super"), t = require("@swc/helpers/_/_class_call_check"), r = require("@swc/helpers/_/_cr...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/react-hooks/1/input/index.js
JavaScript
import React from "react"; import { useRouter } from "next/router"; import { useProject } from "@swr/use-project"; import useTeam from "@swr/use-team"; export default function MyComp() { const { project: projectName } = useRouter().query; const { data: projectInfo } = useProject(projectName); const { team...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/react-hooks/1/output/index.js
JavaScript
import { jsx as r, Fragment as t } from "react/jsx-runtime"; import "react"; import { useRouter as e } from "next/router"; import { useProject as o } from "@swr/use-project"; import a from "@swr/use-team"; export default function m() { var m = o(e().query.project).data; return a().teamSlug, useProjectBranches(n...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/react-instantsearch/1/input/index.js
JavaScript
export default function createStore(initialState) { let state = initialState; const listeners = []; return { getState() { return state; }, setState(nextState) { state = nextState; listeners.forEach((listener) => listener()); }, subs...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/react-instantsearch/1/output/index.js
JavaScript
export default function t(t) { var n = t, e = []; return { getState: function() { return n; }, setState: function(t) { n = t, e.forEach(function(t) { return t(); }); }, subscribe: function(t) { return e.push(...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/react-instantsearch/2/input/index.js
JavaScript
import algoliasearchHelper from "algoliasearch-helper"; import createWidgetsManager from "./createWidgetsManager"; import { HIGHLIGHT_TAGS } from "./highlight"; import { hasMultipleIndices } from "./indexUtils"; import { version as ReactVersion } from "react"; import version from "./version"; function addAlgoliaAgents...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/react-instantsearch/2/output/index.js
JavaScript
import { _ as e } from "@swc/helpers/_/_define_property"; import { _ as t } from "@swc/helpers/_/_object_spread"; import { _ as r } from "@swc/helpers/_/_object_spread_props"; import { _ as a } from "@swc/helpers/_/_object_without_properties"; import { _ as n } from "@swc/helpers/_/_to_consumable_array"; import s from ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/regexp/1/input/index.js
JavaScript
export default function () { return new RegExp(`{.[^}]+}\n*`, "g"); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/regexp/1/output/index.js
JavaScript
export default function() { return RegExp("{.[^}]+}\n*", "g"); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/utf8-1/input/index.js
JavaScript
/* globals __webpack_hash__ */ import { displayContent } from './fouc' import initOnDemandEntries from './on-demand-entries-client' import { addMessageListener, connectHMR } from './error-overlay/websocket' const data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent) window.__NEXT_DATA__ = data let {...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/utf8-1/output/index.js
JavaScript
import { _ as e } from "@swc/helpers/_/_async_to_generator"; import { _ as t } from "@swc/helpers/_/_ts_generator"; import { displayContent as a } from './fouc'; import n from './on-demand-entries-client'; import { addMessageListener as r, connectHMR as c } from './error-overlay/websocket'; var o = JSON.parse(document....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/utf8-2/input/index.js
JavaScript
const source = `${100}testing`;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/var-scpoing/1/input/index.js
JavaScript
for (let i = 0; i < points.length; i++) { const point = points[i]; for (let key_ in keys) { for (let i = 0; i < keys[key].length; i++) { console.log(i); } console.log(i); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/full/var-scpoing/1/output/index.js
JavaScript
for(var o = 0; o < points.length; o++)for(var e in points[o], keys){ for(var n = 0; n < keys[key].length; n++)console.log(n); console.log(o); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/2/input/index.js
JavaScript
import React from "react"; import { useRouter } from "next/router"; import { useProject } from "@swr/use-project"; import useTeam from "@swr/use-team"; export default function MyComp() { const { project: projectName } = useRouter().query; const { data: projectInfo } = useProject(projectName); const { team...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/2/output/index.js
JavaScript
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; import React from "react"; import { useRouter } from "next/router"; import { useProject } from "@swr/use-project"; import useTeam from "@swr/use-team"; export default function MyComp() { var _useRouter_query = useRouter().query, projectName = _...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/issue-3347/1/input/index.js
JavaScript
const myFunction = () => { for (let j = 0; j <= 3; j++) { for (const _ of []) { } if (j === 1) { console.log("before set timeout, j is:", j); setTimeout(() => { console.log("in timeout: j is", j); }, 50); } } return null;...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/issue-3347/1/output/index.js
JavaScript
var myFunction = function() { var _loop = function(j) { for(var _i = 0, _iter = []; _i < _iter.length; _i++){ var _ = _iter[_i]; } if (j === 1) { console.log("before set timeout, j is:", j); setTimeout(function() { console.log("in timeout: ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-30592/1/input/index.js
JavaScript
const navigation = (path) => [ { name: "Home", href: `/`, get current() { return this.href === path; }, }, { name: "Dashboard", href: `/dashboard`, get current() { return this.href === path; }, }, ];
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-30592/1/output/index.js
JavaScript
var navigation = function(path) { return [ { name: "Home", href: "/", get current () { return this.href === path; } }, { name: "Dashboard", href: "/dashboard", get current () { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-31627/1/input/index.js
JavaScript
import { useEffect } from "react"; import { select, selectAll } from "d3-selection"; export default function Home() { useEffect(() => { new MyClass(); }, []); return ( <svg> <g className="group"> <path /> <path /> </g> <g...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-31627/1/output/index.js
JavaScript
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useEffect } from "react"; import { select, selectAll } from "d3-selection"; export default function Home() { useEffect(function() { new MyClass(); }, []); ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-33291/1-automatic/input/index.js
JavaScript
import Head from "next/head"; import Image from "next/image"; import styles from "../styles/Home.module.css"; export default function Home() { const icon = [16, 32, 96, 192].map((s) => ({ href: `/favicon.svg`, sizes: `${s}x${s}`, })); return ( <div className={styles.container}> ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-33291/1-automatic/output/index.js
JavaScript
import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; import { createEle...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-33291/2-classic/input/index.js
JavaScript
import Head from "next/head"; import Image from "next/image"; import styles from "../styles/Home.module.css"; export default function Home() { const icon = [16, 32, 96, 192].map((s) => ({ href: `/favicon.svg`, sizes: `${s}x${s}`, })); return ( <div className={styles.container}> ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-33291/2-classic/output/index.js
JavaScript
import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; import Head from "next/head"; import Image from "next/image"; import styles f...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-36251/1/input/index.tsx
TypeScript (TSX)
type ü = { name: string; value: string; }; export const SomeComponent = ({ name, value }: ü) => { return ( <div> {name} {value} </div> ); };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-36251/1/output/index.tsx
TypeScript (TSX)
import { jsxs as _jsxs } from "react/jsx-runtime"; export var SomeComponent = function(param) { var name = param.name, value = param.value; return /*#__PURE__*/ _jsxs("div", { children: [ name, " ", value ] }); };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-39460/input/snippetSession.js
JavaScript
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js
JavaScript
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/react-autowhatever/1/input/index.js
JavaScript
import React, { Component } from "react"; import PropTypes from "prop-types"; import Item from "./Item"; import compareObjects from "./compareObjects"; export default class ItemsList extends Component { static propTypes = { items: PropTypes.array.isRequired, itemProps: PropTypes.oneOfType([PropType...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/react-autowhatever/1/output/index.js
JavaScript
import { _ as _call_super } from "@swc/helpers/_/_call_super"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; import { _ as _define_property } from "@swc/helpers/_/_define_property"; import { _ as _inherits } from "@swc/helpe...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/react-instantsearch/1/input/index.js
JavaScript
import algoliasearchHelper from "algoliasearch-helper"; import createWidgetsManager from "./createWidgetsManager"; import { HIGHLIGHT_TAGS } from "./highlight"; import { hasMultipleIndices } from "./indexUtils"; import { version as ReactVersion } from "react"; import version from "./version"; function addAlgoliaAgents...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/react-instantsearch/1/output/index.js
JavaScript
import { _ as _define_property } from "@swc/helpers/_/_define_property"; import { _ as _object_spread } from "@swc/helpers/_/_object_spread"; import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props"; import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties"; impo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/regexp/1/input/index.js
JavaScript
export default function () { return new RegExp(`{.[^}]+}\n*`, "g"); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/regexp/1/output/index.js
JavaScript
export default function() { return new RegExp("{.[^}]+}\n*", "g"); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/regressions/1/full/input/index.js
JavaScript
import { useEffect } from "react"; class Test { constructor(name) { this.name = name; } print = async (arg) => { console.log(this.name, arg); }; } export default function Parent() { useEffect(() => { new Test("name").print("test"); }, []); return <></>; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/regressions/1/full/output/index.js
JavaScript
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _define_property } from "@swc/helpers/_/_define_property"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; import { jsx as _jsx, Frag...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/regressions/1/simplified/input/index.js
JavaScript
class Test { constructor(name) { this.name = name; } print = async (arg) => { console.log(this.name, arg); }; } function Parent() { new Test("name").print("test"); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc/tests/vercel/loader-only/regressions/1/simplified/output/index.js
JavaScript
var _async_to_generator = require("@swc/helpers/_/_async_to_generator"); var _class_call_check = require("@swc/helpers/_/_class_call_check"); var _define_property = require("@swc/helpers/_/_define_property"); var _ts_generator = require("@swc/helpers/_/_ts_generator"); var Test = function Test(name) { "use strict";...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_allocator/benches/bench.rs
Rust
extern crate swc_malloc; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; use swc_allocator::{boxed::Box as SwcBox, vec::Vec as SwcVec, Allocator, FastAlloc}; fn bench_alloc(c: &mut Criterion) { fn direct_alloc_std(b: &mut Bencher, times: usize) { b.iter(|| ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_allocator/src/allocators/arena.rs
Rust
use std::ops::{Deref, DerefMut}; use bumpalo::Bump; /// Arena allocator #[derive(Default)] pub struct Arena { inner: Bump, } impl Deref for Arena { type Target = Bump; fn deref(&self) -> &Self::Target { &self.inner } } impl DerefMut for Arena { fn deref_mut(&mut self) -> &mut Self::Targ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_allocator/src/allocators/global.rs
Rust
#[cfg(feature = "nightly")] pub use std::alloc::Global; #[cfg(not(feature = "nightly"))] pub use allocator_api2::alloc::Global;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_allocator/src/allocators/mod.rs
Rust
//! Various flavors of allocators pub use self::{arena::Arena, global::Global, scoped::Scoped}; mod arena; mod global; mod scoped;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_allocator/src/allocators/scoped.rs
Rust
/// Scoped allocator pub struct Scoped; #[cfg(feature = "nightly")] unsafe impl std::alloc::Allocator for Scoped { fn allocate( &self, _layout: std::alloc::Layout, ) -> Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError> { todo!() } unsafe fn deallocate(&self, _ptr: std::pt...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_allocator/src/api/mod.rs
Rust
//! Various flavors of allocator. /// Re-export for convenience. #[cfg(feature = "hashbrown")] pub extern crate hashbrown; /// Types for arena allocator pub mod arena { #[allow(unused_imports)] use crate::allocators::Arena; /// See [`hashbrown::HashMap`]. #[cfg(feature = "hashbrown")] pub type Ha...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_allocator/src/lib.rs
Rust
//! Allocator for swc. //! //! # Features //! //! - `scoped`: Enable `scoped` mode. //! //! # Modes //! //! ## Default mode //! //! In default mode, [crate::boxed::Box] and [crate::vec::Vec] are identical to //! the original types in [std]. //! //! ## Scoped mode //! //! - You need to enable `scoped` feature to use thi...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_allocator/src/types/mod.rs
Rust
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_allocator/src/util.rs
Rust
#![allow(unused_imports)] #[cfg(feature = "nightly")] pub use std::alloc::Allocator; #[cfg(not(feature = "nightly"))] pub use allocator_api2::alloc::Allocator;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_allocator/tests/alloction.rs
Rust
#![cfg(feature = "nightly")] use criterion::black_box; use swc_allocator::{boxed::Box, Allocator, FastAlloc}; #[test] fn direct_alloc_std() { let mut buf = std::vec::Vec::new(); for i in 0..1000 { let item: std::boxed::Box<usize> = black_box(std::boxed::Box::new(black_box(i))); buf.push(item);...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_atoms/scripts/_/sort.py
Python
#!/usr/bin/env python3 import sys lines = sys.stdin.readlines() lines.sort() for line in lines: print(line,end='')
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_atoms/scripts/add-from-cargo-check.sh
Shell
#!/usr/bin/env bash set -eu export CARGO_TERM_COLOR=never cargo check 2>&1 | grep 'no rules expected the token' | sed -e 's/error: no rules expected the token `"//' | sed -e 's/"`//'
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_atoms/scripts/sort.sh
Shell
#!/usr/bin/env bash set -eu cat words.txt | sed '/^[[:space:]]*$/d' | awk '{$1=$1};1' | uniq | ./scripts/_/sort.py > words_sorted.txt mv words_sorted.txt words.txt
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_atoms/src/fast.rs
Rust
use std::{ mem::{transmute_copy, ManuallyDrop}, ops::Deref, }; use crate::Atom; /// UnsafeAtom is a wrapper around [Atom] that does not allocate, but extremely /// unsafe. /// /// Do not use this unless you know what you are doing. /// /// **Currently, it's considered as a unstable API and may be changed in t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_atoms/src/lib.rs
Rust
//! See [Atom] and [UnsafeAtom] #![allow(clippy::unreadable_literal)] #[doc(hidden)] /// Not a public API. pub extern crate hstr; #[doc(hidden)] /// Not a public API. pub extern crate once_cell; use std::{ borrow::Cow, cell::UnsafeCell, fmt::{self, Display, Formatter}, hash::Hash, ops::Deref, ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/assets/a.js
JavaScript
export const FOO = 1; export class A { foo() {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/assets/main.js
JavaScript
import { A, FOO } from "./a"; console.log(A, FOO);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/build.rs
Rust
fn main() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/examples/bundle.rs
Rust
#![allow(clippy::needless_update)] /// Use memory allocator extern crate swc_malloc; use std::{ collections::HashMap, env, fs, path::Path, time::{Duration, Instant}, }; use anyhow::Error; use swc_bundler::{Bundle, Bundler, Load, ModuleData, ModuleRecord}; use swc_common::{ errors::{ColorConfig, H...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/examples/path.rs
Rust
use std::{collections::HashMap, io::stdout}; use anyhow::Error; use swc_bundler::{BundleKind, Bundler, Config, Hook, Load, ModuleData, ModuleRecord, Resolve}; use swc_common::{sync::Lrc, FileName, FilePathMapping, Globals, SourceMap, Span}; use swc_ecma_ast::KeyValueProp; use swc_ecma_codegen::{text_writer::JsWriter, ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/scripts/minifier.sh
Shell
#!/usr/bin/env bash set -eu export RUST_LOG=swc_ecma_minifier=debug export RUST_BACKTRACE=1 cargo test --test deno $@
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/scripts/test.sh
Shell
#!/usr/bin/env bash set -eux cargo test --lib cargo test --test fixture (cd ../spack && cargo test --test fixture) cargo test --test deno $@ -- --nocapture
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/chunk/cjs.rs
Rust
use std::{collections::HashMap, sync::atomic::Ordering}; use anyhow::Error; use rustc_hash::FxHashMap; use swc_common::{Span, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::{quote_ident, ExprFactory}; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; use crate::{ bundler::{chu...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/chunk/computed_key.rs
Rust
use std::mem::take; use anyhow::{bail, Error}; use swc_common::{SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::{contains_top_level_await, find_pat_ids, private_ident, ExprFactory}; use swc_ecma_visit::{noop_fold_type, Fold}; use crate::{ bundler::chunk::merge::Ctx, modules::Modules, ut...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/chunk/merge.rs
Rust
use std::sync::atomic::Ordering; use anyhow::Error; use indexmap::IndexSet; use petgraph::EdgeDirection; use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet}; use swc_common::{sync::Lock, FileName, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_transforms_base::helpers::Helpers; use swc_ecma_utils::{find...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/chunk/mod.rs
Rust
use std::time::Instant; use anyhow::{Context, Error}; #[cfg(feature = "rayon")] use rayon::iter::ParallelIterator; use rustc_hash::FxHashMap; use super::{load::TransformedModule, Bundler}; use crate::{ bundler::chunk::merge::Ctx, load::Load, resolve::Resolve, util::IntoParallelIterator, Bundle, }; mod cjs; mod c...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/chunk/plan/mod.rs
Rust
use anyhow::{bail, Error}; use rustc_hash::FxHashMap; use swc_graph_analyzer::{DepGraph, GraphAnalyzer}; use crate::{ bundler::{load::TransformedModule, scope::Scope}, dep_graph::ModuleGraph, BundleKind, Bundler, Load, ModuleId, Resolve, }; #[cfg(test)] mod tests; #[derive(Debug, Default)] struct PlanBui...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/chunk/plan/tests.rs
Rust
use std::collections::HashMap; use rustc_hash::{FxHashMap, FxHashSet}; use crate::bundler::tests::suite; fn assert_cycles(map: FxHashMap<String, String>, cycle_entries: Vec<&str>) { let mut tester = suite(); for (k, v) in map { tester = tester.file(&k, &v); } tester.run(|tester| { l...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/export.rs
Rust
use indexmap::IndexMap; use rustc_hash::FxBuildHasher; use swc_atoms::Atom; use swc_common::{FileName, SyntaxContext}; use swc_ecma_ast::*; use swc_ecma_utils::find_pat_ids; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; use super::{ load::{Source, Specifier}, Bundler, }; use crate::{id::Id...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/finalize.rs
Rust
use std::path::{Path, PathBuf}; use anyhow::Error; use relative_path::RelativePath; use rustc_hash::FxHashMap; use swc_common::{util::move_map::MoveMap, FileName, Mark, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_transforms_base::{ fixer::fixer, helpers::{inject_helpers, Helpers, HELPERS}, hygiene::hygien...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/helpers/_require.js
JavaScript
function __swcpack_require__(mod) { // Ported from _interopRequireWildcard function interop(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prot...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/helpers/mod.rs
Rust
use std::sync::atomic::{AtomicBool, Ordering::SeqCst}; use once_cell::sync::Lazy; use swc_common::{FileName, FilePathMapping, SourceMap}; use swc_ecma_ast::*; use swc_ecma_parser::parse_file_as_module; use swc_ecma_utils::{drop_span, prepend_stmts}; #[derive(Debug, Default)] pub(crate) struct Helpers { /// `__swc...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/import/mod.rs
Rust
use anyhow::{Context, Error}; use rustc_hash::{FxHashMap, FxHashSet}; use swc_atoms::Atom; use swc_common::{sync::Lrc, FileName, Mark, Spanned, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::find_pat_ids; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; use super::Bundler; use cra...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/import/tests.rs
Rust
// use super::ImportHandler; // use crate::bundler::tests::suite; // use std::path::Path; // use swc_common::{FileName, Mark, SyntaxContext}; // use swc_ecma_visit::FoldWith; // #[test] // #[ignore] // fn ns_import_deglob_simple() { // suite().run(|t| { // let m = t.parse( // " // import * as n...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/keywords.rs
Rust
use rustc_hash::FxHashMap; use swc_common::util::take::Take; use swc_ecma_ast::*; use swc_ecma_utils::private_ident; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; use crate::id::Id; #[derive(Default)] pub struct KeywordRenamer { renamed: FxHashMap<Id, Ident>, } impl KeywordRenamer { /// ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/load.rs
Rust
#![allow(dead_code)] use anyhow::{Context, Error}; use is_macro::Is; #[cfg(feature = "rayon")] use rayon::iter::ParallelIterator; use swc_common::{ sync::{Lock, Lrc}, FileName, SourceFile, SyntaxContext, }; use swc_ecma_ast::{ CallExpr, Callee, Expr, Ident, ImportDecl, ImportSpecifier, MemberExpr, MemberPr...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/mod.rs
Rust
use std::collections::HashMap; use anyhow::{Context, Error}; use rustc_hash::FxHashMap; use swc_atoms::Atom; use swc_common::{sync::Lrc, FileName, Globals, Mark, SourceMap, SyntaxContext, GLOBALS}; use swc_ecma_ast::Module; use self::scope::Scope; use crate::{Hook, Load, ModuleId, Resolve}; mod chunk; mod export; mo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/optimize.rs
Rust
use swc_common::pass::Repeat; use swc_ecma_ast::*; use swc_ecma_transforms_optimization::simplify::{const_propagation::constant_propagation, dce}; use swc_ecma_visit::VisitMutWith; use crate::{Bundler, Load, Resolve}; impl<L, R> Bundler<'_, L, R> where L: Load, R: Resolve, { /// If used_exports is [None],...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/scope.rs
Rust
use std::sync::atomic::{AtomicBool, Ordering}; use swc_common::{sync::Lrc, FileName}; use super::load::TransformedModule; use crate::{ id::{Id, ModuleId, ModuleIdGenerator}, util::CloneMap, }; #[derive(Debug, Default)] pub(super) struct Scope { pub module_id_gen: ModuleIdGenerator, loaded_modules: C...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/bundler/tests.rs
Rust
//! Utilities for testing. use std::path::PathBuf; use anyhow::Error; use indexmap::IndexMap; use rustc_hash::FxBuildHasher; use swc_common::{sync::Lrc, FileName, SourceMap, Span, GLOBALS}; use swc_ecma_ast::*; use swc_ecma_loader::resolve::Resolution; use swc_ecma_parser::{lexer::Lexer, Parser, StringInput}; use swc_...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/debug/mod.rs
Rust
#![allow(dead_code)] use std::io::{stderr, Write}; use swc_common::{sync::Lrc, SourceMap, SyntaxContext}; use swc_ecma_ast::{Ident, Module}; use swc_ecma_codegen::{text_writer::JsWriter, Emitter}; use swc_ecma_visit::{noop_fold_type, Fold, FoldWith}; #[cfg(not(debug_assertions))] pub(crate) fn print_hygiene(_: &str,...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/dep_graph.rs
Rust
use swc_fast_graph::digraph::FastDiGraphMap; use crate::ModuleId; pub(crate) type ModuleGraph = FastDiGraphMap<ModuleId, ()>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/hash.rs
Rust
use std::io; use anyhow::{Context, Error}; use crc::{Crc, Digest, CRC_64_ECMA_182}; use swc_common::{sync::Lrc, BytePos, SourceMap, Span}; use swc_ecma_ast::Module; use swc_ecma_codegen::{text_writer::WriteJs, Emitter}; pub(crate) fn calc_hash(cm: Lrc<SourceMap>, m: &Module) -> Result<String, Error> { let crc = C...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/hook.rs
Rust
use anyhow::Error; use swc_common::{FileName, Span}; use swc_ecma_ast::KeyValueProp; #[non_exhaustive] pub struct ModuleRecord { pub file_name: FileName, pub is_entry: bool, } pub trait Hook: swc_common::sync::Sync + swc_common::sync::Send { fn get_import_meta_props( &self, span: Span, ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/id.rs
Rust
use std::{ fmt, sync::atomic::{AtomicU32, Ordering::SeqCst}, }; use rustc_hash::FxHashMap; use swc_atoms::Atom; use swc_common::{sync::Lock, FileName, Mark, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::{Expr, Ident}; use swc_ecma_utils::ident::IdentLike; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Ha...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/inline.rs
Rust
use rustc_hash::FxHashMap; use swc_common::{SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_visit::{ noop_visit_mut_type, noop_visit_type, visit_mut_obj_and_computed, Visit, VisitMut, VisitMutWith, VisitWith, }; use crate::{id::Id, modules::Modules, util::Readonly}; #[derive(Debug, Default)] pub(c...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/lib.rs
Rust
#![deny(clippy::all)] #![allow(unstable_name_collisions)] #![allow(clippy::mutable_key_type)] #![cfg_attr(not(test), allow(unused))] pub use self::{ bundler::{Bundle, BundleKind, Bundler, Config, ModuleType}, hook::{Hook, ModuleRecord}, id::ModuleId, load::{Load, ModuleData}, resolve::Resolve, }; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/load.rs
Rust
use anyhow::Error; use swc_common::{sync::Lrc, FileName, SourceFile}; use swc_ecma_ast::Module; use swc_ecma_transforms_base::helpers::Helpers; #[derive(Debug)] pub struct ModuleData { pub fm: Lrc<SourceFile>, pub module: Module, /// Used helpers /// /// # Example /// /// ```rust,ignore ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/modules/mod.rs
Rust
use std::mem::take; use rustc_hash::FxHashMap; use swc_common::{SourceMap, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_visit::{Fold, FoldWith, Visit, VisitMut, VisitMutWith, VisitWith}; use crate::ModuleId; mod sort; #[derive(Debug, Clone)] pub struct Modules { /// Indicates that a statement is ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/modules/sort/chunk.rs
Rust
use std::{collections::VecDeque, iter::from_fn, mem::take, time::Instant}; use indexmap::IndexSet; use petgraph::EdgeDirection::Outgoing; use rustc_hash::{FxBuildHasher, FxHashSet}; use swc_common::{sync::Lrc, SourceMap, SyntaxContext}; use swc_ecma_ast::*; use swc_ecma_utils::prepend_stmts; use super::stmt::sort_stm...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/modules/sort/graph.rs
Rust
use std::{collections::VecDeque, iter::repeat}; use petgraph::{ EdgeDirection, EdgeDirection::{Incoming, Outgoing}, }; use rustc_hash::FxHashSet; use swc_fast_graph::digraph::FastDiGraphMap; /// Is dependency between nodes hard? #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub(super) enum Required { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/modules/sort/mod.rs
Rust
use std::time::Instant; use swc_common::{sync::Lrc, SourceMap, DUMMY_SP}; use swc_ecma_ast::*; use super::Modules; use crate::{dep_graph::ModuleGraph, ModuleId}; mod chunk; mod graph; mod stmt; #[cfg(test)] mod tests; impl Modules { /// If module graph proves that one module can com before other module, it ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/modules/sort/stmt.rs
Rust
use std::{collections::VecDeque, iter::from_fn, ops::Range}; use indexmap::IndexSet; use petgraph::EdgeDirection::{Incoming as Dependants, Outgoing as Dependencies}; use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet}; use swc_common::{sync::Lrc, util::take::Take, SourceMap, SyntaxContext}; use swc_ecma_ast::*; use ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/modules/sort/tests.rs
Rust
use swc_common::{SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::drop_span; use testing::assert_eq; use super::stmt::sort_stmts; use crate::{bundler::tests::suite, debug::print_hygiene}; fn assert_sorted(src: &[&str], res: &str) { assert_sorted_with_free(src, "", res) } fn assert_sorted_with_f...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/resolve.rs
Rust
pub use swc_ecma_loader::resolve::Resolve;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/src/util.rs
Rust
#![allow(dead_code)] use std::hash::Hash; use rustc_hash::FxBuildHasher; #[cfg(not(feature = "concurrent"))] use rustc_hash::FxHashMap; use swc_common::{SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::ident::IdentLike; use swc_ecma_visit::{noop_visit_mut_type, VisitMut}; #[cfg(feature = "concurren...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_bundler/tests/.cache/deno/00011a1bcca0c2e5d1dc3fcc4164a67b715dcf43.ts
TypeScript
// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/interactions/interaction_guild_member.ts import { GuildMemberWithUser } from "../members/guild_member.ts"; /** https://discord.com/developers/docs/resources/guild#guild-member-object */ export interface InteractionGuildMember extends GuildMemberWith...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University