import Head from "next/head"; import { readFile } from "fs/promises"; import styles from "../styles/Home.module.css"; import React from "react"; if (typeof window !== "undefined") { globalThis.Scan = await import("../lib/scan"); await import("../lib/api"); } export async function getStaticProps(ctx) { return { props: { // not tested code: readFile( "/Users/jarred/Build/es-module-lexer/test/samples/magic-string.js", { encoding: "utf-8" }, ), defaultFile: "magic-string.js", }, }; } var textDecoder = new TextDecoder(); export default function Home({ code, defaultFile }) { const fileNameRef = React.useRef(null); const [lexer, setLexer] = React.useState(""); const [bunResult, setBunResult] = React.useState(""); const [file, setFile] = React.useState(defaultFile); React.useEffect(() => { globalThis.Scan.start(); }, []); const runBuild = React.useCallback( (event) => { globalThis.Scan.transform( event.target.value, fileNameRef?.current?.value, ).then((result) => { setLexer(JSON.stringify(result.lexer, null, 2)); setBunResult(JSON.stringify(result.bun, null, 2)); }, console.error); }, [fileNameRef, setBunResult, setLexer], ); return (
Next.js
setFile(event.target.value)} ref={fileNameRef} />
); } e/pnpm-10-and-catalogs Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/smoke/docs-main/src/pages/bn (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2023-07-11Filter out astro from `peerDependencies` in `astro add` (#7620)Gravatar Chris Swithinbank 2-1/+7
2023-07-11[ci] formatGravatar bluwy 1-1/+1
2023-07-11Refactor simple CLI commands (#7619)Gravatar Bjorn Lu 12-115/+123
2023-07-10fix: `astro info` command fallback for package manager (#7618)Gravatar Emanuele Stoppa 2-1/+7
2023-07-10Add CLI startup speed benchmark (#7617)Gravatar Bjorn Lu 5-11/+95
2023-07-10[ci] formatGravatar bluwy 1-1/+1