diff options
| author | 2021-05-08 18:12:54 -0700 | |
|---|---|---|
| committer | 2021-05-08 18:12:54 -0700 | |
| commit | ecabda3ced144698684717dccd067e2519def21d (patch) | |
| tree | 1504d6e829393b1e03b6bf8ae70ccff8ed61e2ed /src/test | |
| parent | 18794b18b32e5cfeb190f29fe29590d742a327e8 (diff) | |
| download | bun-ecabda3ced144698684717dccd067e2519def21d.tar.gz bun-ecabda3ced144698684717dccd067e2519def21d.tar.zst bun-ecabda3ced144698684717dccd067e2519def21d.zip | |
Fix exporting default twice
Former-commit-id: 2f4cd402e4f718d2ab89e4ae61582d95eae7cd97
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/fixtures/double-export-default-bug.jsx | 72 | ||||
| -rw-r--r-- | src/test/fixtures/function-scope-bug.jsx | 5 | ||||
| -rw-r--r-- | src/test/fixtures/simple-150x.jsx | 1 |
3 files changed, 77 insertions, 1 deletions
diff --git a/src/test/fixtures/double-export-default-bug.jsx b/src/test/fixtures/double-export-default-bug.jsx new file mode 100644 index 000000000..3db411bb0 --- /dev/null +++ b/src/test/fixtures/double-export-default-bug.jsx @@ -0,0 +1,72 @@ +import Head from "next/head"; +import Image from "next/image"; +import styles from "../styles/Home.module.css"; +import "../lib/api.ts"; + +// The bug: +// This function appears twice in the output. +export default function Home() { + return ( + <div className={styles.container}> + <Head> + <title>Create Next App</title> + <meta name="description" content="Generated by create next app" /> + <link rel="icon" href="/favicon.ico" /> + </Head> + + <main className={styles.main}> + <h1 className={styles.title}> + Welcome to <a href="https://nextjs.org">Next.js!</a> + </h1> + + <p className={styles.description}> + Get started by editing{" "} + <code className={styles.code}>pages/index.js</code> + </p> + + <div className={styles.grid}> + <a href="https://nextjs.org/docs" className={styles.card}> + <h2>Documentation →</h2> + <p>Find in-depth information about Next.js features and API.</p> + </a> + + <a href="https://nextjs.org/learn" className={styles.card}> + <h2>Learn →</h2> + <p>Learn about Next.js in an interactive course with quizzes!</p> + </a> + + <a + href="https://github.com/vercel/next.js/tree/master/examples" + className={styles.card} + > + <h2>Examples →</h2> + <p>Discover and deploy boilerplate example Next.js projects.</p> + </a> + + <a + href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app" + className={styles.card} + > + <h2>Deploy →</h2> + <p> + Instantly deploy your Next.js site to a public URL with Vercel. + </p> + </a> + </div> + </main> + + <footer className={styles.footer}> + <a + href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app" + target="_blank" + rel="noopener noreferrer" + > + Powered by{" "} + <span className={styles.logo}> + <Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} /> + </span> + </a> + </footer> + </div> + ); +} diff --git a/src/test/fixtures/function-scope-bug.jsx b/src/test/fixtures/function-scope-bug.jsx index 57c783d87..6c76e8fac 100644 --- a/src/test/fixtures/function-scope-bug.jsx +++ b/src/test/fixtures/function-scope-bug.jsx @@ -14,7 +14,10 @@ var Bar = () => { ); }; -// This is where it failed. +// It failed while parsing this function. +// The bug happened due to incorrectly modifying scopes_in_order +// The fix was using tombstoning instead of deleting +// The fix also resolved some performance issues. var Baz = () => { return ( <div prop={1}> diff --git a/src/test/fixtures/simple-150x.jsx b/src/test/fixtures/simple-150x.jsx index 920e84ea5..385d28bab 100644 --- a/src/test/fixtures/simple-150x.jsx +++ b/src/test/fixtures/simple-150x.jsx @@ -21,6 +21,7 @@ import LoginGate, { LOGIN_STATUSES } from "../components/LoginGate"; import Divider from "../components/Divider"; import { SPACING } from "../helpers/styles"; +// This is not saved in git 150x over because I don't want this repo to be huge. (function () { const FeaturedProfile = ({ profile }) => { return ( |
