diff --git a/.github/workflows/prettier-fmt.yml b/.github/workflows/prettier-fmt.yml new file mode 100644 index 0000000000..877b34a6fd --- /dev/null +++ b/.github/workflows/prettier-fmt.yml @@ -0,0 +1,76 @@ +name: prettier + +on: + pull_request: + branches: + - main + - jarred/test-actions + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + prettier-fmt: + name: prettier + runs-on: ubuntu-latest + outputs: + prettier_fmt_errs: ${{ steps.fmt.outputs.prettier_fmt_errs }} + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - id: setup + name: Setup + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + - id: install + name: Install prettier + run: bun install + - name: Run prettier + id: fmt + run: | + rm -f .failed + bun prettier --check "./bench/**/*.{ts,tsx,js,jsx,mjs}" "./test/**/*.{ts,tsx,js,jsx,mjs}" "./src/**/*.{ts,tsx,js,jsx}" --config .prettierrc.cjs 2> prettier-fmt.err > prettier-fmt1.err || echo 'failed' > .failed + + if [ -s .failed ]; then + delimiter="$(openssl rand -hex 8)" + echo "prettier_fmt_errs<<${delimiter}" >> "${GITHUB_OUTPUT}" + cat prettier-fmt.err >> "${GITHUB_OUTPUT}" + cat prettier-fmt1.err >> "${GITHUB_OUTPUT}" + echo "${delimiter}" >> "${GITHUB_OUTPUT}" + fi + - name: Comment on PR + if: steps.fmt.outputs.prettier_fmt_errs != '' + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: prettier-fmt + message: | + ❌ @${{ github.actor }} `prettier` reported errors + + ```js + ${{ steps.fmt.outputs.prettier_fmt_errs }} + ``` + + To one-off fix this manually, run: + ```sh + bun fmt + ``` + + You might need to run `bun install` locally and configure your text editor to [auto-format on save](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode). + + [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) + - name: Uncomment on PR + if: steps.fmt.outputs.prettier_fmt_errs == '' + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: prettier-fmt + mode: upsert + create_if_not_exists: false + message: | + ✅ `prettier` errors have been resolved. Thank you. + + [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) + - name: Fail the job + if: steps.fmt.outputs.prettier_fmt_errs != '' + run: exit 1 diff --git a/.github/workflows/zig-fmt.yml b/.github/workflows/zig-fmt.yml new file mode 100644 index 0000000000..9f4e2207a5 --- /dev/null +++ b/.github/workflows/zig-fmt.yml @@ -0,0 +1,87 @@ +name: zig-fmt + +env: + ZIG_VERSION: 0.11.0-dev.1783+436e99d13 + +on: + pull_request: + branches: + - main + - jarred/test-actions + paths: + - "src/**/*.zig" + - "src/*.zig" + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + zig-fmt: + name: zig fmt + runs-on: ubuntu-latest + outputs: + zig_fmt_errs: ${{ steps.fmt.outputs.zig_fmt_errs }} + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Install zig + run: | + curl https://ziglang.org/builds/zig-linux-x86_64-${{env.ZIG_VERSION}}.tar.xz -L -o zig.tar.xz + tar -xf zig.tar.xz + sudo mv zig-linux-x86_64-${{env.ZIG_VERSION}}/zig /usr/local/bin + - name: Run zig fmt + id: fmt + run: | + zig fmt --check src/*.zig src/**/*.zig 2> zig-fmt.err > zig-fmt.err2 || echo "Failed" + delimiter="$(openssl rand -hex 8)" + echo "zig_fmt_errs<<${delimiter}" >> "${GITHUB_OUTPUT}" + + if [ -s zig-fmt.err ]; then + echo "// The following errors occurred:" >> "${GITHUB_OUTPUT}" + cat zig-fmt.err >> "${GITHUB_OUTPUT}" + fi + + if [ -s zig-fmt.err2 ]; then + echo "// The following files were not formatted:" >> "${GITHUB_OUTPUT}" + cat zig-fmt.err2 >> "${GITHUB_OUTPUT}" + fi + + echo "${delimiter}" >> "${GITHUB_OUTPUT}" + - name: Comment on PR + if: steps.fmt.outputs.zig_fmt_errs != '' + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: zig-fmt + message: | + ❌ @${{ github.actor }} `zig fmt` reported errors. Consider configuring your text editor to [auto-format on save](https://github.com/ziglang/vscode-zig) + + ```zig + // # zig fmt --check src/*.zig src/**/*.zig + ${{ steps.fmt.outputs.zig_fmt_errs }} + ``` + + To one-off fix this manually, run: + + ```sh + zig fmt src/*.zig src/**/*.zig + ``` + + [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) + zig v${{env.ZIG_VERSION}} + + - name: Uncomment on PR + if: steps.fmt.outputs.zig_fmt_errs == '' + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: zig-fmt + mode: upsert + create_if_not_exists: false + message: | + ✅ `zig fmt` errors have been resolved. Thank you. + + [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) + zig v${{env.ZIG_VERSION}} + + - name: Fail the job + if: steps.fmt.outputs.zig_fmt_errs != '' + run: exit 1 diff --git a/.prettierignore b/.prettierignore index 1283490d0b..b9249b91c4 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,3 +6,10 @@ test/bun.js/bundled # src/api/demo test/snapshots test/snapshots-no-hmr +src/bun.js/WebKit +src/bun.js/builtins/js +src/*.out.js +src/*out.*.js +src/deps +src/test/fixtures +src/react-refresh.js diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index eab23fd801..0000000000 --- a/.prettierrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "arrowParens": "avoid", - "printWidth": 120, - "trailingComma": "all", - "useTabs": false, - "overrides": [ - { - "files": "README.md", - "options": { - "printWidth": 80 - } - } - ] -} diff --git a/bench/cat/cat.mjs b/bench/cat/cat.mjs index fc87198291..1dd8186fd6 100644 --- a/bench/cat/cat.mjs +++ b/bench/cat/cat.mjs @@ -6,7 +6,4 @@ const arg = process.argv.slice(1); // TODO: remove Buffer.from() when readFileSync() returns Buffer -for (let i = 0; i < count; i++) - console.log( - arg.map((file) => Buffer.from(readFileSync(file, "utf8"))).join("") - ); +for (let i = 0; i < count; i++) console.log(arg.map(file => Buffer.from(readFileSync(file, "utf8"))).join("")); diff --git a/bench/copyfile/node.mitata.mjs b/bench/copyfile/node.mitata.mjs index aa77245e1b..379150487f 100644 --- a/bench/copyfile/node.mitata.mjs +++ b/bench/copyfile/node.mitata.mjs @@ -7,14 +7,8 @@ function runner(ready) { for (let i = 0; i < size; i++) { rand[i] = (Math.random() * 1024 * 1024) | 0; } - const dest = `/tmp/fs-test-copy-file-${( - (Math.random() * 10000000 + 100) | - 0 - ).toString(32)}`; - const src = `/tmp/fs-test-copy-file-${( - (Math.random() * 10000000 + 100) | - 0 - ).toString(32)}`; + const dest = `/tmp/fs-test-copy-file-${((Math.random() * 10000000 + 100) | 0).toString(32)}`; + const src = `/tmp/fs-test-copy-file-${((Math.random() * 10000000 + 100) | 0).toString(32)}`; writeFileSync(src, Buffer.from(rand.buffer), { encoding: "buffer" }); const { size: fileSize } = statSync(src); if (fileSize !== rand.byteLength) { @@ -35,6 +29,6 @@ runner((src, dest, rand) => // ); // } // } - }) + }), ); await run(); diff --git a/bench/expect-to-equal/index.ts b/bench/expect-to-equal/index.ts index f67b2c6454..2a5e4b80cc 100644 --- a/bench/expect-to-equal/index.ts +++ b/bench/expect-to-equal/index.ts @@ -1 +1 @@ -console.log("Hello via Bun!"); \ No newline at end of file +console.log("Hello via Bun!"); diff --git a/bench/fetch/bun.js b/bench/fetch/bun.js index 7559b467e8..96e7275a85 100644 --- a/bench/fetch/bun.js +++ b/bench/fetch/bun.js @@ -6,9 +6,7 @@ bench(`fetch(https://example.com) x ${count}`, async () => { const requests = new Array(count); for (let i = 0; i < requests.length; i++) { - requests[i] = fetch(`https://www.example.com/?cachebust=${i}`).then((r) => - r.text(), - ); + requests[i] = fetch(`https://www.example.com/?cachebust=${i}`).then(r => r.text()); } await Promise.all(requests); diff --git a/bench/fetch/deno.js b/bench/fetch/deno.js index 3eef416981..1117a38df6 100644 --- a/bench/fetch/deno.js +++ b/bench/fetch/deno.js @@ -6,9 +6,7 @@ bench(`fetch(https://example.com) x ${count}`, async () => { const requests = new Array(count); for (let i = 0; i < requests.length; i++) { - requests[i] = fetch(`https://www.example.com/?cachebust=${i}`).then((r) => - r.text(), - ); + requests[i] = fetch(`https://www.example.com/?cachebust=${i}`).then(r => r.text()); } await Promise.all(requests); diff --git a/bench/fetch/node.mjs b/bench/fetch/node.mjs index f61eeb0c62..96e7275a85 100644 --- a/bench/fetch/node.mjs +++ b/bench/fetch/node.mjs @@ -6,9 +6,7 @@ bench(`fetch(https://example.com) x ${count}`, async () => { const requests = new Array(count); for (let i = 0; i < requests.length; i++) { - requests[i] = fetch(`https://www.example.com/?cachebust=${i}`).then((r) => - r.text() - ); + requests[i] = fetch(`https://www.example.com/?cachebust=${i}`).then(r => r.text()); } await Promise.all(requests); diff --git a/bench/ffi/deno.js b/bench/ffi/deno.js index 8f4c76ca2e..63ba6358c8 100644 --- a/bench/ffi/deno.js +++ b/bench/ffi/deno.js @@ -1,10 +1,7 @@ import { run, bench, group } from "../node_modules/mitata/src/cli.mjs"; const extension = "darwin" !== Deno.build.os ? "so" : "dylib"; -const path = new URL( - "src/target/release/libffi_napi_bench." + extension, - import.meta.url, -).pathname; +const path = new URL("src/target/release/libffi_napi_bench." + extension, import.meta.url).pathname; const { symbols: { ffi_noop, ffi_hash, ffi_string }, diff --git a/bench/hot-module-reloading/css-stress-test/browser.js b/bench/hot-module-reloading/css-stress-test/browser.js index 15938dff22..d6bce108fe 100644 --- a/bench/hot-module-reloading/css-stress-test/browser.js +++ b/bench/hot-module-reloading/css-stress-test/browser.js @@ -24,7 +24,7 @@ if (process.env.PROJECT === "bun") { // bunProcess.stderr.pipe(process.stderr); // bunProcess.stdout.pipe(process.stdout); - bunProcess.once("error", (err) => { + bunProcess.once("error", err => { console.error("❌ bun error", err); process.exit(1); }); @@ -32,19 +32,15 @@ if (process.env.PROJECT === "bun") { bunProcess?.kill(0); }); } else if (process.env.PROJECT === "next") { - const bunProcess = child_process.spawn( - "./node_modules/.bin/next", - ["--port", "8080"], - { - cwd: process.cwd(), - stdio: "ignore", - env: { - ...process.env, - }, - - shell: false, + const bunProcess = child_process.spawn("./node_modules/.bin/next", ["--port", "8080"], { + cwd: process.cwd(), + stdio: "ignore", + env: { + ...process.env, }, - ); + + shell: false, + }); } const delay = new Promise((resolve, reject) => { @@ -111,7 +107,7 @@ async function main() { return runPage(); } -main().catch((error) => +main().catch(error => setTimeout(() => { throw error; }), diff --git a/bench/hot-module-reloading/css-stress-test/read-frames.js b/bench/hot-module-reloading/css-stress-test/read-frames.js index 9e264b4dfa..089e97e83d 100644 --- a/bench/hot-module-reloading/css-stress-test/read-frames.js +++ b/bench/hot-module-reloading/css-stress-test/read-frames.js @@ -4,9 +4,7 @@ const path = require("path"); const PROJECT = process.env.PROJECT || "bun"; const percentile = require("percentile"); const PACKAGE_NAME = process.env.PACKAGE_NAME; -const label = `${PACKAGE_NAME}@${ - require(PACKAGE_NAME + "/package.json").version -}`; +const label = `${PACKAGE_NAME}@${require(PACKAGE_NAME + "/package.json").version}`; const BASEFOLDER = path.resolve(PROJECT); const OUTFILE = path.join(process.cwd(), process.env.OUTFILE); @@ -20,10 +18,10 @@ const TOTAL_FRAMES = VALID_TIMES.length; const timings = fs .readFileSync(BASEFOLDER + "/frames.all.clean", "utf8") .split("\n") - .map((a) => a.replace(/[Ran:'\.]?/gm, "").trim()) - .filter((a) => parseInt(a, 10)) - .filter((a) => a.length > 0 && VALID_TIMES.includes(BigInt(parseInt(a, 10)))) - .map((num) => BigInt(num)); + .map(a => a.replace(/[Ran:'\.]?/gm, "").trim()) + .filter(a => parseInt(a, 10)) + .filter(a => a.length > 0 && VALID_TIMES.includes(BigInt(parseInt(a, 10)))) + .map(num => BigInt(num)); timings.sort(); @@ -47,7 +45,7 @@ const report = { name: PACKAGE_NAME, version: require(PACKAGE_NAME + "/package.json").version, }, - timestamps: timings.map((a) => Number(a)), + timestamps: timings.map(a => Number(a)), frameTimes: frameTime, percentileMs: { 50: percentile(50, frameTime) / 10, @@ -67,9 +65,7 @@ fs.writeFileSync( "." + process.env.SLEEP_INTERVAL + "ms." + - `${process.platform}-${ - process.arch === "arm64" ? "aarch64" : process.arch - }` + + `${process.platform}-${process.arch === "arm64" ? "aarch64" : process.arch}` + ".json", ), JSON.stringify(report, null, 2), @@ -99,9 +95,5 @@ console.log( timings.length, "/", TOTAL_FRAMES, - "(" + - Math.round( - Math.max(Math.min(1.0, timings.length / TOTAL_FRAMES), 0) * 100, - ) + - "%)", + "(" + Math.round(Math.max(Math.min(1.0, timings.length / TOTAL_FRAMES), 0) * 100) + "%)", ); diff --git a/bench/hot-module-reloading/css-stress-test/src/index.tsx b/bench/hot-module-reloading/css-stress-test/src/index.tsx index 35e7fceab5..7ca290f48a 100644 --- a/bench/hot-module-reloading/css-stress-test/src/index.tsx +++ b/bench/hot-module-reloading/css-stress-test/src/index.tsx @@ -3,10 +3,7 @@ import classNames from "classnames"; import ReactDOM from "react-dom"; const Base = ({}) => { - const name = - typeof location !== "undefined" - ? decodeURIComponent(location.search.substring(1)) - : null; + const name = typeof location !== "undefined" ? decodeURIComponent(location.search.substring(1)) : null; return
; }; diff --git a/bench/hot-module-reloading/css-stress-test/src/main.tsx b/bench/hot-module-reloading/css-stress-test/src/main.tsx index 2093d924f5..9707deaae1 100644 --- a/bench/hot-module-reloading/css-stress-test/src/main.tsx +++ b/bench/hot-module-reloading/css-stress-test/src/main.tsx @@ -4,8 +4,8 @@ export const Main = (props: { productName: string; cssInJS?: string }) => {
CSS HMR Stress Test!

- This page visually tests how quickly a bundler can update{" "} - {props.cssInJS ? "CSS-in-JS" : "CSS"} over Hot Module Reloading. + This page visually tests how quickly a bundler can update {props.cssInJS ? "CSS-in-JS" : "CSS"} over Hot + Module Reloading.

@@ -19,9 +19,7 @@ export const Main = (props: { productName: string; cssInJS?: string }) => {
-
- The progress bar should move from left to right smoothly. -
+
The progress bar should move from left to right smoothly.
@@ -42,21 +40,15 @@ export const Main = (props: { productName: string; cssInJS?: string }) => {
-
- The spinners should rotate & change color smoothly. -
+
The spinners should rotate & change color smoothly.
diff --git a/bench/json-stringify/bun.js b/bench/json-stringify/bun.js index 8c98937944..22f29deb40 100644 --- a/bench/json-stringify/bun.js +++ b/bench/json-stringify/bun.js @@ -1,12 +1,8 @@ import { bench, run } from "mitata"; -bench("JSON.stringify({hello: 'world'})", () => - JSON.stringify({ hello: "world" }), -); +bench("JSON.stringify({hello: 'world'})", () => JSON.stringify({ hello: "world" })); const otherUint8Array = new Uint8Array(1024); -bench("Uint8Array.from(otherUint8Array)", () => - Uint8Array.from(otherUint8Array), -); +bench("Uint8Array.from(otherUint8Array)", () => Uint8Array.from(otherUint8Array)); run(); diff --git a/bench/log/bun.js b/bench/log/bun.js index a2f5dd73e0..43728fd648 100644 --- a/bench/log/bun.js +++ b/bench/log/bun.js @@ -1,7 +1,5 @@ import { bench, run } from "mitata"; bench("console.log('hello')", () => console.log("hello")); -bench("console.log({ hello: 'object' })", () => - console.log({ hello: "object" }), -); +bench("console.log({ hello: 'object' })", () => console.log({ hello: "object" })); await run(); diff --git a/bench/module-loader/create.js b/bench/module-loader/create.js index 8c20307af2..a26e2a61ed 100644 --- a/bench/module-loader/create.js +++ b/bench/module-loader/create.js @@ -47,11 +47,7 @@ fs.writeFileSync( output + `/file${count}.mjs`, ` export const THE_END = true; - ${ - saveStack - ? `globalThis.evaluationOrder.push("${output}/file${count}.mjs");` - : "" - } + ${saveStack ? `globalThis.evaluationOrder.push("${output}/file${count}.mjs");` : ""} `, "utf8", ); @@ -60,11 +56,7 @@ fs.writeFileSync( output + `/file${count}.js`, ` module.exports.THE_END = true; - ${ - saveStack - ? `globalThis.evaluationOrder.push("${output}/file${count}.js");` - : "" - } + ${saveStack ? `globalThis.evaluationOrder.push("${output}/file${count}.js");` : ""} `, "utf8", ); diff --git a/bench/modules/node_os/bun.js b/bench/modules/node_os/bun.js index 0047b77e71..217fae47da 100644 --- a/bench/modules/node_os/bun.js +++ b/bench/modules/node_os/bun.js @@ -1,5 +1,24 @@ import { bench, run } from "mitata"; -import { cpus, endianness, arch, uptime, networkInterfaces, getPriority, totalmem, freemem, homedir, hostname, loadavg, platform, release, setPriority, tmpdir, type, userInfo, version } from "node:os"; +import { + cpus, + endianness, + arch, + uptime, + networkInterfaces, + getPriority, + totalmem, + freemem, + homedir, + hostname, + loadavg, + platform, + release, + setPriority, + tmpdir, + type, + userInfo, + version, +} from "node:os"; bench("cpus()", () => cpus()); bench("networkInterfaces()", () => networkInterfaces()); diff --git a/bench/modules/node_os/node.mjs b/bench/modules/node_os/node.mjs index 0047b77e71..217fae47da 100644 --- a/bench/modules/node_os/node.mjs +++ b/bench/modules/node_os/node.mjs @@ -1,5 +1,24 @@ import { bench, run } from "mitata"; -import { cpus, endianness, arch, uptime, networkInterfaces, getPriority, totalmem, freemem, homedir, hostname, loadavg, platform, release, setPriority, tmpdir, type, userInfo, version } from "node:os"; +import { + cpus, + endianness, + arch, + uptime, + networkInterfaces, + getPriority, + totalmem, + freemem, + homedir, + hostname, + loadavg, + platform, + release, + setPriority, + tmpdir, + type, + userInfo, + version, +} from "node:os"; bench("cpus()", () => cpus()); bench("networkInterfaces()", () => networkInterfaces()); diff --git a/bench/react-hello-world/react-hello-world.deno.jsx b/bench/react-hello-world/react-hello-world.deno.jsx index fabbfcfcb9..0bea2574a2 100644 --- a/bench/react-hello-world/react-hello-world.deno.jsx +++ b/bench/react-hello-world/react-hello-world.deno.jsx @@ -18,8 +18,8 @@ const headers = { }; Deno.serve( - async (req) => { + async req => { return new Response(await renderToReadableStream(), headers); }, - { port: 8080 } + { port: 8080 }, ); diff --git a/bench/react-hello-world/react-hello-world.node.js b/bench/react-hello-world/react-hello-world.node.js index df9f0eaee2..f2c7ae635b 100644 --- a/bench/react-hello-world/react-hello-world.node.js +++ b/bench/react-hello-world/react-hello-world.node.js @@ -17,15 +17,9 @@ var Kd = (e, n, i, s) => { return e; }; var Dc = (e, n, i) => ( - (i = e != null ? Gd(Jd(e)) : {}), - Kd( - n || !e || !e.__esModule - ? Ac(i, "default", { value: e, enumerable: !0 }) - : i, - e - ) + (i = e != null ? Gd(Jd(e)) : {}), Kd(n || !e || !e.__esModule ? Ac(i, "default", { value: e, enumerable: !0 }) : i, e) ); -var Nc = an(($) => { +var Nc = an($ => { "use strict"; var Ai = Symbol.for("react.element"), qd = Symbol.for("react.portal"), @@ -42,8 +36,7 @@ var Nc = an(($) => { function up(e) { return e === null || typeof e != "object" ? null - : ((e = (Oc && e[Oc]) || e["@@iterator"]), - typeof e == "function" ? e : null); + : ((e = (Oc && e[Oc]) || e["@@iterator"]), typeof e == "function" ? e : null); } var Bc = { isMounted: function () { @@ -56,16 +49,13 @@ var Nc = an(($) => { Uc = Object.assign, jc = {}; function sa(e, n, i) { - (this.props = e), - (this.context = n), - (this.refs = jc), - (this.updater = i || Bc); + (this.props = e), (this.context = n), (this.refs = jc), (this.updater = i || Bc); } sa.prototype.isReactComponent = {}; sa.prototype.setState = function (e, n) { if (typeof e != "object" && typeof e != "function" && e != null) throw Error( - "setState(...): takes an object of state variables to update or a function which returns an object of state variables." + "setState(...): takes an object of state variables to update or a function which returns an object of state variables.", ); this.updater.enqueueSetState(this, e, n, "setState"); }; @@ -75,10 +65,7 @@ var Nc = an(($) => { function Hc() {} Hc.prototype = sa.prototype; function Hu(e, n, i) { - (this.props = e), - (this.context = n), - (this.refs = jc), - (this.updater = i || Bc); + (this.props = e), (this.context = n), (this.refs = jc), (this.updater = i || Bc); } var Wu = (Hu.prototype = new Hc()); Wu.constructor = Hu; @@ -94,9 +81,7 @@ var Nc = an(($) => { c = null, m = null; if (n != null) - for (s in (n.ref !== void 0 && (m = n.ref), - n.key !== void 0 && (c = "" + n.key), - n)) + for (s in (n.ref !== void 0 && (m = n.ref), n.key !== void 0 && (c = "" + n.key), n)) Wc.call(n, s) && !zc.hasOwnProperty(s) && (v[s] = n[s]); var S = arguments.length - 2; if (S === 1) v.children = i; @@ -104,8 +89,7 @@ var Nc = an(($) => { for (var E = Array(S), x = 0; x < S; x++) E[x] = arguments[x + 2]; v.children = E; } - if (e && e.defaultProps) - for (s in ((S = e.defaultProps), S)) v[s] === void 0 && (v[s] = S[s]); + if (e && e.defaultProps) for (s in ((S = e.defaultProps), S)) v[s] === void 0 && (v[s] = S[s]); return { $$typeof: Ai, type: e, @@ -139,9 +123,7 @@ var Nc = an(($) => { } var Lc = /\/+/g; function ju(e, n) { - return typeof e == "object" && e !== null && e.key != null - ? fp("" + e.key) - : n.toString(36); + return typeof e == "object" && e !== null && e.key != null ? fp("" + e.key) : n.toString(36); } function Ml(e, n, i, s, v) { var c = typeof e; @@ -174,14 +156,7 @@ var Nc = an(($) => { })) : v != null && ($u(v) && - (v = cp( - v, - i + - (!v.key || (m && m.key === v.key) - ? "" - : ("" + v.key).replace(Lc, "$&/") + "/") + - e - )), + (v = cp(v, i + (!v.key || (m && m.key === v.key) ? "" : ("" + v.key).replace(Lc, "$&/") + "/") + e)), n.push(v)), 1 ); @@ -192,17 +167,14 @@ var Nc = an(($) => { m += Ml(c, n, i, E, v); } else if (((E = up(e)), typeof E == "function")) - for (e = E.call(e), S = 0; !(c = e.next()).done; ) - (c = c.value), (E = s + ju(c, S++)), (m += Ml(c, n, i, E, v)); + for (e = E.call(e), S = 0; !(c = e.next()).done; ) (c = c.value), (E = s + ju(c, S++)), (m += Ml(c, n, i, E, v)); else if (c === "object") throw ( ((n = String(e)), Error( "Objects are not valid as a React child (found: " + - (n === "[object Object]" - ? "object with keys {" + Object.keys(e).join(", ") + "}" - : n) + - "). If you meant to render a collection of children, use an array instead." + (n === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : n) + + "). If you meant to render a collection of children, use an array instead.", )) ); return m; @@ -224,13 +196,11 @@ var Nc = an(($) => { (n = n()), n.then( function (i) { - (e._status === 0 || e._status === -1) && - ((e._status = 1), (e._result = i)); + (e._status === 0 || e._status === -1) && ((e._status = 1), (e._result = i)); }, function (i) { - (e._status === 0 || e._status === -1) && - ((e._status = 2), (e._result = i)); - } + (e._status === 0 || e._status === -1) && ((e._status = 2), (e._result = i)); + }, ), e._status === -1 && ((e._status = 0), (e._result = n)); } @@ -252,7 +222,7 @@ var Nc = an(($) => { function () { n.apply(this, arguments); }, - i + i, ); }, count: function (e) { @@ -272,10 +242,7 @@ var Nc = an(($) => { ); }, only: function (e) { - if (!$u(e)) - throw Error( - "React.Children.only expected to receive a single React element child." - ); + if (!$u(e)) throw Error("React.Children.only expected to receive a single React element child."); return e; }, }; @@ -288,11 +255,7 @@ var Nc = an(($) => { $.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = pp; $.cloneElement = function (e, n, i) { if (e == null) - throw Error( - "React.cloneElement(...): The argument must be a React element, but you passed " + - e + - "." - ); + throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + e + "."); var s = Uc({}, e.props), v = e.key, c = e.ref, @@ -304,10 +267,7 @@ var Nc = an(($) => { e.type && e.type.defaultProps) ) var S = e.type.defaultProps; - for (E in n) - Wc.call(n, E) && - !zc.hasOwnProperty(E) && - (s[E] = n[E] === void 0 && S !== void 0 ? S[E] : n[E]); + for (E in n) Wc.call(n, E) && !zc.hasOwnProperty(E) && (s[E] = n[E] === void 0 && S !== void 0 ? S[E] : n[E]); } var E = arguments.length - 2; if (E === 1) s.children = i; @@ -415,8 +375,7 @@ var Vc = an((N, Bl) => { (function () { "use strict"; typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == - "function" && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); var e = "18.2.0", n = Symbol.for("react.element"), @@ -475,23 +434,13 @@ var Vc = an((N, Bl) => { (ft.ReactDebugCurrentFrame = _e), (ft.ReactCurrentActQueue = q); function Me(h) { { - for ( - var b = arguments.length, k = new Array(b > 1 ? b - 1 : 0), T = 1; - T < b; - T++ - ) - k[T - 1] = arguments[T]; + for (var b = arguments.length, k = new Array(b > 1 ? b - 1 : 0), T = 1; T < b; T++) k[T - 1] = arguments[T]; Er("warn", h, k); } } function B(h) { { - for ( - var b = arguments.length, k = new Array(b > 1 ? b - 1 : 0), T = 1; - T < b; - T++ - ) - k[T - 1] = arguments[T]; + for (var b = arguments.length, k = new Array(b > 1 ? b - 1 : 0), T = 1; T < b; T++) k[T - 1] = arguments[T]; Er("error", h, k); } } @@ -503,8 +452,7 @@ var Vc = an((N, Bl) => { var U = k.map(function (M) { return String(M); }); - U.unshift("Warning: " + b), - Function.prototype.apply.call(console[h], console, U); + U.unshift("Warning: " + b), Function.prototype.apply.call(console[h], console, U); } } var tt = {}; @@ -517,7 +465,7 @@ var Vc = an((N, Bl) => { B( "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", b, - T + T, ), (tt[I] = !0); } @@ -540,16 +488,13 @@ var Vc = an((N, Bl) => { er = {}; Object.freeze(er); function re(h, b, k) { - (this.props = h), - (this.context = b), - (this.refs = er), - (this.updater = k || bt); + (this.props = h), (this.context = b), (this.refs = er), (this.updater = k || bt); } (re.prototype.isReactComponent = {}), (re.prototype.setState = function (h, b) { if (typeof h != "object" && typeof h != "function" && h != null) throw new Error( - "setState(...): takes an object of state variables to update or a function which returns an object of state variables." + "setState(...): takes an object of state variables to update or a function which returns an object of state variables.", ); this.updater.enqueueSetState(this, h, b, "setState"); }), @@ -570,11 +515,7 @@ var Vc = an((N, Bl) => { tr = function (h, b) { Object.defineProperty(re.prototype, h, { get: function () { - Me( - "%s(...) is deprecated in plain JavaScript React classes. %s", - b[0], - b[1] - ); + Me("%s(...) is deprecated in plain JavaScript React classes. %s", b[0], b[1]); }, }); }; @@ -583,15 +524,10 @@ var Vc = an((N, Bl) => { function nr() {} nr.prototype = re.prototype; function Rr(h, b, k) { - (this.props = h), - (this.context = b), - (this.refs = er), - (this.updater = k || bt); + (this.props = h), (this.context = b), (this.refs = er), (this.updater = k || bt); } var St = (Rr.prototype = new nr()); - (St.constructor = Rr), - Le(St, re.prototype), - (St.isPureReactComponent = !0); + (St.constructor = Rr), Le(St, re.prototype), (St.isPureReactComponent = !0); function so() { var h = { current: null }; return Object.seal(h), h; @@ -622,7 +558,7 @@ var Vc = an((N, Bl) => { return ( B( "The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", - ve(h) + ve(h), ), or(h) ); @@ -641,7 +577,7 @@ var Vc = an((N, Bl) => { if ( (typeof h.tag == "number" && B( - "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.", ), typeof h == "function") ) @@ -713,11 +649,10 @@ var Vc = an((N, Bl) => { ((lr = !0), B( "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", - b + b, )); }; - (k.isReactWarning = !0), - Object.defineProperty(h, "key", { get: k, configurable: !0 }); + (k.isReactWarning = !0), Object.defineProperty(h, "key", { get: k, configurable: !0 }); } function va(h, b) { var k = function () { @@ -725,25 +660,19 @@ var Vc = an((N, Bl) => { ((fn = !0), B( "%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", - b + b, )); }; - (k.isReactWarning = !0), - Object.defineProperty(h, "ref", { get: k, configurable: !0 }); + (k.isReactWarning = !0), Object.defineProperty(h, "ref", { get: k, configurable: !0 }); } function ga(h) { - if ( - typeof h.ref == "string" && - xe.current && - h.__self && - xe.current.stateNode !== h.__self - ) { + if (typeof h.ref == "string" && xe.current && h.__self && xe.current.stateNode !== h.__self) { var b = dt(xe.current.type); sr[b] || (B( 'Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', b, - h.ref + h.ref, ), (sr[b] = !0)); } @@ -799,8 +728,7 @@ var Vc = an((N, Bl) => { for (T in ee) I[T] === void 0 && (I[T] = ee[T]); } if (U || M) { - var fe = - typeof h == "function" ? h.displayName || h.name || "Unknown" : h; + var fe = typeof h == "function" ? h.displayName || h.name || "Unknown" : h; U && po(I, fe), M && va(I, fe); } return dn(h, U, M, H, z, xe.current, I); @@ -811,11 +739,7 @@ var Vc = an((N, Bl) => { } function pn(h, b, k) { if (h == null) - throw new Error( - "React.cloneElement(...): The argument must be a React element, but you passed " + - h + - "." - ); + throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + h + "."); var T, I = Le({}, h.props), U = h.key, @@ -824,20 +748,16 @@ var Vc = an((N, Bl) => { z = h._source, Y = h._owner; if (b != null) { - pt(b) && ((M = b.ref), (Y = xe.current)), - ke(b) && (je(b.key), (U = "" + b.key)); + pt(b) && ((M = b.ref), (Y = xe.current)), ke(b) && (je(b.key), (U = "" + b.key)); var Q; h.type && h.type.defaultProps && (Q = h.type.defaultProps); for (T in b) - ir.call(b, T) && - !fo.hasOwnProperty(T) && - (b[T] === void 0 && Q !== void 0 ? (I[T] = Q[T]) : (I[T] = b[T])); + ir.call(b, T) && !fo.hasOwnProperty(T) && (b[T] === void 0 && Q !== void 0 ? (I[T] = Q[T]) : (I[T] = b[T])); } var K = arguments.length - 2; if (K === 1) I.children = k; else if (K > 1) { - for (var ee = Array(K), fe = 0; fe < K; fe++) - ee[fe] = arguments[fe + 2]; + for (var ee = Array(K), fe = 0; fe < K; fe++) ee[fe] = arguments[fe + 2]; I.children = ee; } return dn(h.type, U, M, H, z, Y, I); @@ -861,9 +781,7 @@ var Vc = an((N, Bl) => { return h.replace(hn, "$&/"); } function Ir(h, b) { - return typeof h == "object" && h !== null && h.key != null - ? (je(h.key), go("" + h.key)) - : b.toString(36); + return typeof h == "object" && h !== null && h.key != null ? (je(h.key), go("" + h.key)) : b.toString(36); } function ur(h, b, k, T, I) { var U = typeof h; @@ -897,14 +815,7 @@ var Vc = an((N, Bl) => { z != null && (wt(z) && (z.key && (!H || H.key !== z.key) && je(z.key), - (z = ma( - z, - k + - (z.key && (!H || H.key !== z.key) - ? vn("" + z.key) + "/" - : "") + - Y - ))), + (z = ma(z, k + (z.key && (!H || H.key !== z.key) ? vn("" + z.key) + "/" : "") + Y))), b.push(z)); return 1; } @@ -912,31 +823,22 @@ var Vc = an((N, Bl) => { ee, fe = 0, Se = T === "" ? Te : T + vo; - if (ye(h)) - for (var yr = 0; yr < h.length; yr++) - (K = h[yr]), (ee = Se + Ir(K, yr)), (fe += ur(K, b, k, ee, I)); + if (ye(h)) for (var yr = 0; yr < h.length; yr++) (K = h[yr]), (ee = Se + Ir(K, yr)), (fe += ur(K, b, k, ee, I)); else { var Pn = P(h); if (typeof Pn == "function") { var Wr = h; Pn === Wr.entries && - (xt || - Me( - "Using Maps as children is not supported. Use an array of keyed ReactElements instead." - ), + (xt || Me("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), (xt = !0)); for (var Co = Pn.call(Wr), zr, Oa = 0; !(zr = Co.next()).done; ) - (K = zr.value), - (ee = Se + Ir(K, Oa++)), - (fe += ur(K, b, k, ee, I)); + (K = zr.value), (ee = Se + Ir(K, Oa++)), (fe += ur(K, b, k, ee, I)); } else if (U === "object") { var Eo = String(h); throw new Error( "Objects are not valid as a React child (found: " + - (Eo === "[object Object]" - ? "object with keys {" + Object.keys(h).join(", ") + "}" - : Eo) + - "). If you meant to render a collection of children, use an array instead." + (Eo === "[object Object]" ? "object with keys {" + Object.keys(h).join(", ") + "}" : Eo) + + "). If you meant to render a collection of children, use an array instead.", ); } } @@ -968,7 +870,7 @@ var Vc = an((N, Bl) => { function () { b.apply(this, arguments); }, - k + k, ); } function mo(h) { @@ -979,10 +881,7 @@ var Vc = an((N, Bl) => { ); } function Ut(h) { - if (!wt(h)) - throw new Error( - "React.Children.only expected to receive a single React element child." - ); + if (!wt(h)) throw new Error("React.Children.only expected to receive a single React element child."); return h; } function gn(h) { @@ -1009,7 +908,7 @@ var Vc = an((N, Bl) => { T || ((T = !0), B( - "Rendering is not supported and will be removed in a future major release. Did you mean to render instead?" + "Rendering is not supported and will be removed in a future major release. Did you mean to render instead?", )), b.Provider ); @@ -1048,7 +947,7 @@ var Vc = an((N, Bl) => { k || ((k = !0), B( - "Rendering is not supported and will be removed in a future major release. Did you mean to render instead?" + "Rendering is not supported and will be removed in a future major release. Did you mean to render instead?", )), b.Consumer ); @@ -1062,7 +961,7 @@ var Vc = an((N, Bl) => { I || (Me( "Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", - M + M, ), (I = !0)); }, @@ -1093,7 +992,7 @@ var Vc = an((N, Bl) => { var M = h; (M._status = Sa), (M._result = U); } - } + }, ), h._status === jt) ) { @@ -1112,7 +1011,7 @@ Your code should look like: const MyComponent = lazy(() => import('./MyComponent')) Did you accidentally put curly braces around the import?`, - I + I, ), "default" in I || B( @@ -1120,7 +1019,7 @@ Did you accidentally put curly braces around the import?`, Your code should look like: const MyComponent = lazy(() => import('./MyComponent'))`, - I + I, ), I.default ); @@ -1139,7 +1038,7 @@ Your code should look like: }, set: function (U) { B( - "React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it." + "React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.", ), (T = U), Object.defineProperty(k, "defaultProps", { enumerable: !0 }); @@ -1152,7 +1051,7 @@ Your code should look like: }, set: function (U) { B( - "React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it." + "React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.", ), (I = U), Object.defineProperty(k, "propTypes", { enumerable: !0 }); @@ -1165,25 +1064,22 @@ Your code should look like: function ka(h) { h != null && h.$$typeof === D ? B( - "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))." + "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).", ) : typeof h != "function" - ? B( - "forwardRef requires a render function but was given %s.", - h === null ? "null" : typeof h - ) + ? B("forwardRef requires a render function but was given %s.", h === null ? "null" : typeof h) : h.length !== 0 && h.length !== 2 && B( "forwardRef render functions accept exactly two parameters: props and ref. %s", h.length === 1 ? "Did you forget to use the ref parameter?" - : "Any additional parameter will be undefined." + : "Any additional parameter will be undefined.", ), h != null && (h.defaultProps != null || h.propTypes != null) && B( - "forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?" + "forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?", ); var b = { $$typeof: E, render: h }; { @@ -1231,10 +1127,7 @@ Your code should look like: } function Ta(h, b) { yo(h) || - B( - "memo: The first argument must be a component. Instead received: %s", - h === null ? "null" : typeof h - ); + B("memo: The first argument must be a component. Instead received: %s", h === null ? "null" : typeof h); var k = { $$typeof: D, type: h, compare: b === void 0 ? null : b }; { var T; @@ -1269,11 +1162,11 @@ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and f var k = h._context; k.Consumer === h ? B( - "Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?" + "Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?", ) : k.Provider === h && B( - "Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?" + "Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?", ); } return b.useContext(h); @@ -1389,10 +1282,7 @@ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and f groupEnd: Le({}, h, { value: Et }), }); } - Tt < 0 && - B( - "disabledDepth fell below zero. This is a bug in React. Please file an issue." - ); + Tt < 0 && B("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var Ee = ft.ReactCurrentDispatcher, @@ -1489,9 +1379,7 @@ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and f ` ` + H[Y].replace(" at new ", " at "); return ( - h.displayName && - K.includes("") && - (K = K.replace("", h.displayName)), + h.displayName && K.includes("") && (K = K.replace("", h.displayName)), typeof h == "function" && Br.set(h, K), K ); @@ -1566,18 +1454,11 @@ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and f M + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[M] + - "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`." + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.", ); throw ((z.name = "Invariant Violation"), z); } - H = h[M]( - b, - M, - T, - k, - null, - "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED" - ); + H = h[M](b, M, T, k, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (Y) { H = Y; } @@ -1589,15 +1470,12 @@ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and f T || "React class", k, M, - typeof H + typeof H, ), pr(null)), H instanceof Error && !(H.message in Ce) && - ((Ce[H.message] = !0), - pr(I), - B("Failed %s type: %s", k, H.message), - pr(null)); + ((Ce[H.message] = !0), pr(I), B("Failed %s type: %s", k, H.message), pr(null)); } } } @@ -1665,15 +1543,12 @@ Check the top-level render call using <` + if (!Ur[k]) { Ur[k] = !0; var T = ""; - h && - h._owner && - h._owner !== xe.current && - (T = " It was passed a child from " + dt(h._owner.type) + "."), + h && h._owner && h._owner !== xe.current && (T = " It was passed a child from " + dt(h._owner.type) + "."), It(h), B( 'Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', k, - T + T, ), It(null); } @@ -1690,8 +1565,7 @@ Check the top-level render call using <` + else if (h) { var I = P(h); if (typeof I == "function" && I !== h.entries) - for (var U = I.call(h), M; !(M = U.next()).done; ) - wt(M.value) && Je(M.value, b); + for (var U = I.call(h), M; !(M = U.next()).done; ) wt(M.value) && Je(M.value, b); } } } @@ -1701,11 +1575,7 @@ Check the top-level render call using <` + if (b == null || typeof b == "string") return; var k; if (typeof b == "function") k = b.propTypes; - else if ( - typeof b == "object" && - (b.$$typeof === E || b.$$typeof === D) - ) - k = b.propTypes; + else if (typeof b == "object" && (b.$$typeof === E || b.$$typeof === D)) k = b.propTypes; else return; if (k) { var T = dt(b); @@ -1715,13 +1585,13 @@ Check the top-level render call using <` + var I = dt(b); B( "Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", - I || "Unknown" + I || "Unknown", ); } typeof b.getDefaultProps == "function" && !b.getDefaultProps.isReactClassApproved && B( - "getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead." + "getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.", ); } } @@ -1733,26 +1603,20 @@ Check the top-level render call using <` + It(h), B( "Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", - T + T, ), It(null); break; } } - h.ref !== null && - (It(h), - B("Invalid attribute `ref` supplied to `React.Fragment`."), - It(null)); + h.ref !== null && (It(h), B("Invalid attribute `ref` supplied to `React.Fragment`."), It(null)); } } function kn(h, b, k) { var T = yo(h); if (!T) { var I = ""; - (h === void 0 || - (typeof h == "object" && - h !== null && - Object.keys(h).length === 0)) && + (h === void 0 || (typeof h == "object" && h !== null && Object.keys(h).length === 0)) && (I += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var U = vt(b); @@ -1764,13 +1628,12 @@ Check the top-level render call using <` + ? (M = "array") : h !== void 0 && h.$$typeof === n ? ((M = "<" + (dt(h.type) || "Unknown") + " />"), - (I = - " Did you accidentally export a JSX literal instead of a component?")) + (I = " Did you accidentally export a JSX literal instead of a component?")) : (M = typeof h), B( "React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", M, - I + I, ); } var H = ho.apply(this, arguments); @@ -1786,15 +1649,13 @@ Check the top-level render call using <` + Tn || ((Tn = !0), Me( - "React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead." + "React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.", )), Object.defineProperty(b, "type", { enumerable: !1, get: function () { return ( - Me( - "Factory.type is deprecated. Access the class directly before passing it to createFactory." - ), + Me("Factory.type is deprecated. Access the class directly before passing it to createFactory."), Object.defineProperty(this, "type", { value: h }), h ); @@ -1804,12 +1665,7 @@ Check the top-level render call using <` + ); } function ko(h, b, k) { - for ( - var T = pn.apply(this, arguments), I = 2; - I < arguments.length; - I++ - ) - xn(arguments[I], T.type); + for (var T = pn.apply(this, arguments), I = 2; I < arguments.length; I++) xn(arguments[I], T.type); return gr(T), T; } function To(h, b) { @@ -1824,7 +1680,7 @@ Check the top-level render call using <` + var I = T._updatedFibers.size; I > 10 && Me( - "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table." + "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.", ), T._updatedFibers.clear(); } @@ -1844,7 +1700,7 @@ Check the top-level render call using <` + ((Cn = !0), typeof MessageChannel > "u" && B( - "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning." + "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning.", )); var U = new MessageChannel(); (U.port1.onmessage = I), U.port2.postMessage(void 0); @@ -1861,11 +1717,7 @@ Check the top-level render call using <` + var k = q.isBatchingLegacy, T; try { - if ( - ((q.isBatchingLegacy = !0), - (T = h()), - !k && q.didScheduleLegacyUpdate) - ) { + if (((q.isBatchingLegacy = !0), (T = h()), !k && q.didScheduleLegacyUpdate)) { var I = q.current; I !== null && ((q.didScheduleLegacyUpdate = !1), Rn(I)); } @@ -1874,11 +1726,7 @@ Check the top-level render call using <` + } finally { q.isBatchingLegacy = k; } - if ( - T !== null && - typeof T == "object" && - typeof T.then == "function" - ) { + if (T !== null && typeof T == "object" && typeof T.then == "function") { var U = T, M = !1, H = { @@ -1890,7 +1738,7 @@ Check the top-level render call using <` + }, function (Se) { mr(b), fe(Se); - } + }, ); }, }; @@ -1903,7 +1751,7 @@ Check the top-level render call using <` + M || ((Hr = !0), B( - "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);" + "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);", )); }), H @@ -1915,9 +1763,7 @@ Check the top-level render call using <` + Y !== null && (Rn(Y), (q.current = null)); var Q = { then: function (ee, fe) { - q.current === null - ? ((q.current = []), Be(z, ee, fe)) - : ee(z); + q.current === null ? ((q.current = []), Be(z, ee, fe)) : ee(z); }, }; return Q; @@ -1935,7 +1781,7 @@ Check the top-level render call using <` + function mr(h) { h !== gt - 1 && B( - "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. " + "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ", ), (gt = h); } @@ -2013,20 +1859,15 @@ Check the top-level render call using <` + (N.useTransition = Ar), (N.version = e), typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == - "function" && - __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop( - new Error() - ); + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); })(); }); var ua = an((_v, Nu) => { "use strict"; - process.env.NODE_ENV === "production" - ? (Nu.exports = Nc()) - : (Nu.exports = Vc()); + process.env.NODE_ENV === "production" ? (Nu.exports = Nc()) : (Nu.exports = Vc()); }); -var Wf = an((ca) => { +var Wf = an(ca => { "use strict"; var pf = ua(), hp = require("stream"), @@ -2036,13 +1877,7 @@ var Wf = an((ca) => { Yc = {}, Gc = {}; function hf(e) { - return qe.call(Gc, e) - ? !0 - : qe.call(Yc, e) - ? !1 - : vp.test(e) - ? (Gc[e] = !0) - : ((Yc[e] = !0), !1); + return qe.call(Gc, e) ? !0 : qe.call(Yc, e) ? !1 : vp.test(e) ? (Gc[e] = !0) : ((Yc[e] = !0), !1); } function Ge(e, n, i, s, v, c, m) { (this.acceptsBooleans = n === 2 || n === 3 || n === 4), @@ -2072,12 +1907,7 @@ var Wf = an((ca) => { ["contentEditable", "draggable", "spellCheck", "value"].forEach(function (e) { Fe[e] = new Ge(e, 2, !1, e.toLowerCase(), null, !1, !1); }); - [ - "autoReverse", - "externalResourcesRequired", - "focusable", - "preserveAlpha", - ].forEach(function (e) { + ["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function (e) { Fe[e] = new Ge(e, 2, !1, e, null, !1, !1); }); "allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope" @@ -2107,12 +1937,10 @@ var Wf = an((ca) => { var n = e.replace(qu, ec); Fe[n] = new Ge(n, 1, !1, e, null, !1, !1); }); - "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type" - .split(" ") - .forEach(function (e) { - var n = e.replace(qu, ec); - Fe[n] = new Ge(n, 1, !1, e, "http://www.w3.org/1999/xlink", !1, !1); - }); + "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function (e) { + var n = e.replace(qu, ec); + Fe[n] = new Ge(n, 1, !1, e, "http://www.w3.org/1999/xlink", !1, !1); + }); ["xml:base", "xml:lang", "xml:space"].forEach(function (e) { var n = e.replace(qu, ec); Fe[n] = new Ge(n, 1, !1, e, "http://www.w3.org/XML/1998/namespace", !1, !1); @@ -2120,15 +1948,7 @@ var Wf = an((ca) => { ["tabIndex", "crossOrigin"].forEach(function (e) { Fe[e] = new Ge(e, 1, !1, e.toLowerCase(), null, !1, !1); }); - Fe.xlinkHref = new Ge( - "xlinkHref", - 1, - !1, - "xlink:href", - "http://www.w3.org/1999/xlink", - !0, - !1 - ); + Fe.xlinkHref = new Ge("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1); ["src", "href", "action", "formAction"].forEach(function (e) { Fe[e] = new Ge(e, 1, !1, e.toLowerCase(), null, !0, !0); }); @@ -2251,7 +2071,7 @@ var Wf = an((ca) => { function vf(e, n, i) { if (typeof i != "object") throw Error( - "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.", ); n = !0; for (var s in i) @@ -2264,20 +2084,11 @@ var Wf = an((ca) => { } else { c = s; var m = Xc.get(c); - m !== void 0 || - ((m = Ye(c.replace(yp, "-$1").toLowerCase().replace(bp, "-ms-"))), - Xc.set(c, m)), + m !== void 0 || ((m = Ye(c.replace(yp, "-$1").toLowerCase().replace(bp, "-ms-"))), Xc.set(c, m)), (c = m), - (v = - typeof v == "number" - ? v === 0 || qe.call(Hl, s) - ? "" + v - : v + "px" - : Ye(("" + v).trim())); + (v = typeof v == "number" ? (v === 0 || qe.call(Hl, s) ? "" + v : v + "px") : Ye(("" + v).trim())); } - n - ? ((n = !1), e.push(' style="', c, ":", v)) - : e.push(";", c, ":", v); + n ? ((n = !1), e.push(' style="', c, ":", v)) : e.push(";", c, ":", v); } } n || e.push('"'); @@ -2294,11 +2105,7 @@ var Wf = an((ca) => { case "suppressHydrationWarning": return; } - if ( - !(2 < i.length) || - (i[0] !== "o" && i[0] !== "O") || - (i[1] !== "n" && i[1] !== "N") - ) { + if (!(2 < i.length) || (i[0] !== "o" && i[0] !== "O") || (i[1] !== "n" && i[1] !== "N")) { if (((n = Fe.hasOwnProperty(i) ? Fe[i] : null), n !== null)) { switch (typeof s) { case "function": @@ -2312,9 +2119,7 @@ var Wf = an((ca) => { s && e.push(" ", i, '=""'); break; case 4: - s === !0 - ? e.push(" ", i, '=""') - : s !== !1 && e.push(" ", i, '="', Ye(s), '"'); + s === !0 ? e.push(" ", i, '=""') : s !== !1 && e.push(" ", i, '="', Ye(s), '"'); break; case 5: isNaN(s) || e.push(" ", i, '="', Ye(s), '"'); @@ -2331,11 +2136,7 @@ var Wf = an((ca) => { case "symbol": return; case "boolean": - if ( - ((n = i.toLowerCase().slice(0, 5)), - n !== "data-" && n !== "aria-") - ) - return; + if (((n = i.toLowerCase().slice(0, 5)), n !== "data-" && n !== "aria-")) return; } e.push(" ", i, '="', Ye(s), '"'); } @@ -2343,13 +2144,10 @@ var Wf = an((ca) => { } function Wl(e, n, i) { if (n != null) { - if (i != null) - throw Error( - "Can only set one of `children` or `props.dangerouslySetInnerHTML`." - ); + if (i != null) throw Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`."); if (typeof n != "object" || !("__html" in n)) throw Error( - "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://reactjs.org/link/dangerously-set-inner-html for more information." + "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://reactjs.org/link/dangerously-set-inner-html for more information.", ); (n = n.__html), n != null && e.push("" + n); } @@ -2382,9 +2180,7 @@ var Wf = an((ca) => { it(e, s, c, m); } } - return ( - e.push(">"), Wl(e, v, i), typeof i == "string" ? (e.push(Ye(i)), null) : i - ); + return e.push(">"), Wl(e, v, i), typeof i == "string" ? (e.push(Ye(i)), null) : i; } var xp = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/, Zc = new Map(); @@ -2471,19 +2267,13 @@ var Wf = an((ca) => { m = E; break; case "dangerouslySetInnerHTML": - throw Error( - "`dangerouslySetInnerHTML` does not make sense on diff --git a/src/api/demo/schema.d.ts b/src/api/demo/schema.d.ts index ae45511285..6f3949c77f 100644 --- a/src/api/demo/schema.d.ts +++ b/src/api/demo/schema.d.ts @@ -683,228 +683,90 @@ export interface BunInstall { global_bin_dir?: string; } -export declare function encodeStackFrame( - message: StackFrame, - bb: ByteBuffer, -): void; +export declare function encodeStackFrame(message: StackFrame, bb: ByteBuffer): void; export declare function decodeStackFrame(buffer: ByteBuffer): StackFrame; -export declare function encodeStackFramePosition( - message: StackFramePosition, - bb: ByteBuffer, -): void; -export declare function decodeStackFramePosition( - buffer: ByteBuffer, -): StackFramePosition; -export declare function encodeSourceLine( - message: SourceLine, - bb: ByteBuffer, -): void; +export declare function encodeStackFramePosition(message: StackFramePosition, bb: ByteBuffer): void; +export declare function decodeStackFramePosition(buffer: ByteBuffer): StackFramePosition; +export declare function encodeSourceLine(message: SourceLine, bb: ByteBuffer): void; export declare function decodeSourceLine(buffer: ByteBuffer): SourceLine; -export declare function encodeStackTrace( - message: StackTrace, - bb: ByteBuffer, -): void; +export declare function encodeStackTrace(message: StackTrace, bb: ByteBuffer): void; export declare function decodeStackTrace(buffer: ByteBuffer): StackTrace; -export declare function encodeJSException( - message: JSException, - bb: ByteBuffer, -): void; +export declare function encodeJSException(message: JSException, bb: ByteBuffer): void; export declare function decodeJSException(buffer: ByteBuffer): JSException; export declare function encodeProblems(message: Problems, bb: ByteBuffer): void; export declare function decodeProblems(buffer: ByteBuffer): Problems; export declare function encodeRouter(message: Router, bb: ByteBuffer): void; export declare function decodeRouter(buffer: ByteBuffer): Router; -export declare function encodeFallbackMessageContainer( - message: FallbackMessageContainer, - bb: ByteBuffer, -): void; -export declare function decodeFallbackMessageContainer( - buffer: ByteBuffer, -): FallbackMessageContainer; +export declare function encodeFallbackMessageContainer(message: FallbackMessageContainer, bb: ByteBuffer): void; +export declare function decodeFallbackMessageContainer(buffer: ByteBuffer): FallbackMessageContainer; export declare function encodeJSX(message: JSX, bb: ByteBuffer): void; export declare function decodeJSX(buffer: ByteBuffer): JSX; -export declare function encodeStringPointer( - message: StringPointer, - bb: ByteBuffer, -): void; +export declare function encodeStringPointer(message: StringPointer, bb: ByteBuffer): void; export declare function decodeStringPointer(buffer: ByteBuffer): StringPointer; -export declare function encodeJavascriptBundledModule( - message: JavascriptBundledModule, - bb: ByteBuffer, -): void; -export declare function decodeJavascriptBundledModule( - buffer: ByteBuffer, -): JavascriptBundledModule; -export declare function encodeJavascriptBundledPackage( - message: JavascriptBundledPackage, - bb: ByteBuffer, -): void; -export declare function decodeJavascriptBundledPackage( - buffer: ByteBuffer, -): JavascriptBundledPackage; -export declare function encodeJavascriptBundle( - message: JavascriptBundle, - bb: ByteBuffer, -): void; -export declare function decodeJavascriptBundle( - buffer: ByteBuffer, -): JavascriptBundle; -export declare function encodeJavascriptBundleContainer( - message: JavascriptBundleContainer, - bb: ByteBuffer, -): void; -export declare function decodeJavascriptBundleContainer( - buffer: ByteBuffer, -): JavascriptBundleContainer; -export declare function encodeModuleImportRecord( - message: ModuleImportRecord, - bb: ByteBuffer, -): void; -export declare function decodeModuleImportRecord( - buffer: ByteBuffer, -): ModuleImportRecord; +export declare function encodeJavascriptBundledModule(message: JavascriptBundledModule, bb: ByteBuffer): void; +export declare function decodeJavascriptBundledModule(buffer: ByteBuffer): JavascriptBundledModule; +export declare function encodeJavascriptBundledPackage(message: JavascriptBundledPackage, bb: ByteBuffer): void; +export declare function decodeJavascriptBundledPackage(buffer: ByteBuffer): JavascriptBundledPackage; +export declare function encodeJavascriptBundle(message: JavascriptBundle, bb: ByteBuffer): void; +export declare function decodeJavascriptBundle(buffer: ByteBuffer): JavascriptBundle; +export declare function encodeJavascriptBundleContainer(message: JavascriptBundleContainer, bb: ByteBuffer): void; +export declare function decodeJavascriptBundleContainer(buffer: ByteBuffer): JavascriptBundleContainer; +export declare function encodeModuleImportRecord(message: ModuleImportRecord, bb: ByteBuffer): void; +export declare function decodeModuleImportRecord(buffer: ByteBuffer): ModuleImportRecord; export declare function encodeModule(message: Module, bb: ByteBuffer): void; export declare function decodeModule(buffer: ByteBuffer): Module; -export declare function encodeStringMap( - message: StringMap, - bb: ByteBuffer, -): void; +export declare function encodeStringMap(message: StringMap, bb: ByteBuffer): void; export declare function decodeStringMap(buffer: ByteBuffer): StringMap; -export declare function encodeLoaderMap( - message: LoaderMap, - bb: ByteBuffer, -): void; +export declare function encodeLoaderMap(message: LoaderMap, bb: ByteBuffer): void; export declare function decodeLoaderMap(buffer: ByteBuffer): LoaderMap; -export declare function encodeEnvConfig( - message: EnvConfig, - bb: ByteBuffer, -): void; +export declare function encodeEnvConfig(message: EnvConfig, bb: ByteBuffer): void; export declare function decodeEnvConfig(buffer: ByteBuffer): EnvConfig; -export declare function encodeLoadedEnvConfig( - message: LoadedEnvConfig, - bb: ByteBuffer, -): void; -export declare function decodeLoadedEnvConfig( - buffer: ByteBuffer, -): LoadedEnvConfig; -export declare function encodeFrameworkConfig( - message: FrameworkConfig, - bb: ByteBuffer, -): void; -export declare function decodeFrameworkConfig( - buffer: ByteBuffer, -): FrameworkConfig; -export declare function encodeFrameworkEntryPoint( - message: FrameworkEntryPoint, - bb: ByteBuffer, -): void; -export declare function decodeFrameworkEntryPoint( - buffer: ByteBuffer, -): FrameworkEntryPoint; -export declare function encodeFrameworkEntryPointMap( - message: FrameworkEntryPointMap, - bb: ByteBuffer, -): void; -export declare function decodeFrameworkEntryPointMap( - buffer: ByteBuffer, -): FrameworkEntryPointMap; -export declare function encodeFrameworkEntryPointMessage( - message: FrameworkEntryPointMessage, - bb: ByteBuffer, -): void; -export declare function decodeFrameworkEntryPointMessage( - buffer: ByteBuffer, -): FrameworkEntryPointMessage; -export declare function encodeLoadedFramework( - message: LoadedFramework, - bb: ByteBuffer, -): void; -export declare function decodeLoadedFramework( - buffer: ByteBuffer, -): LoadedFramework; -export declare function encodeLoadedRouteConfig( - message: LoadedRouteConfig, - bb: ByteBuffer, -): void; -export declare function decodeLoadedRouteConfig( - buffer: ByteBuffer, -): LoadedRouteConfig; -export declare function encodeRouteConfig( - message: RouteConfig, - bb: ByteBuffer, -): void; +export declare function encodeLoadedEnvConfig(message: LoadedEnvConfig, bb: ByteBuffer): void; +export declare function decodeLoadedEnvConfig(buffer: ByteBuffer): LoadedEnvConfig; +export declare function encodeFrameworkConfig(message: FrameworkConfig, bb: ByteBuffer): void; +export declare function decodeFrameworkConfig(buffer: ByteBuffer): FrameworkConfig; +export declare function encodeFrameworkEntryPoint(message: FrameworkEntryPoint, bb: ByteBuffer): void; +export declare function decodeFrameworkEntryPoint(buffer: ByteBuffer): FrameworkEntryPoint; +export declare function encodeFrameworkEntryPointMap(message: FrameworkEntryPointMap, bb: ByteBuffer): void; +export declare function decodeFrameworkEntryPointMap(buffer: ByteBuffer): FrameworkEntryPointMap; +export declare function encodeFrameworkEntryPointMessage(message: FrameworkEntryPointMessage, bb: ByteBuffer): void; +export declare function decodeFrameworkEntryPointMessage(buffer: ByteBuffer): FrameworkEntryPointMessage; +export declare function encodeLoadedFramework(message: LoadedFramework, bb: ByteBuffer): void; +export declare function decodeLoadedFramework(buffer: ByteBuffer): LoadedFramework; +export declare function encodeLoadedRouteConfig(message: LoadedRouteConfig, bb: ByteBuffer): void; +export declare function decodeLoadedRouteConfig(buffer: ByteBuffer): LoadedRouteConfig; +export declare function encodeRouteConfig(message: RouteConfig, bb: ByteBuffer): void; export declare function decodeRouteConfig(buffer: ByteBuffer): RouteConfig; -export declare function encodeTransformOptions( - message: TransformOptions, - bb: ByteBuffer, -): void; -export declare function decodeTransformOptions( - buffer: ByteBuffer, -): TransformOptions; -export declare function encodeFileHandle( - message: FileHandle, - bb: ByteBuffer, -): void; +export declare function encodeTransformOptions(message: TransformOptions, bb: ByteBuffer): void; +export declare function decodeTransformOptions(buffer: ByteBuffer): TransformOptions; +export declare function encodeFileHandle(message: FileHandle, bb: ByteBuffer): void; export declare function decodeFileHandle(buffer: ByteBuffer): FileHandle; -export declare function encodeTransform( - message: Transform, - bb: ByteBuffer, -): void; +export declare function encodeTransform(message: Transform, bb: ByteBuffer): void; export declare function decodeTransform(buffer: ByteBuffer): Transform; export declare function encodeScan(message: Scan, bb: ByteBuffer): void; export declare function decodeScan(buffer: ByteBuffer): Scan; -export declare function encodeScanResult( - message: ScanResult, - bb: ByteBuffer, -): void; +export declare function encodeScanResult(message: ScanResult, bb: ByteBuffer): void; export declare function decodeScanResult(buffer: ByteBuffer): ScanResult; -export declare function encodeScannedImport( - message: ScannedImport, - bb: ByteBuffer, -): void; +export declare function encodeScannedImport(message: ScannedImport, bb: ByteBuffer): void; export declare function decodeScannedImport(buffer: ByteBuffer): ScannedImport; -export declare function encodeOutputFile( - message: OutputFile, - bb: ByteBuffer, -): void; +export declare function encodeOutputFile(message: OutputFile, bb: ByteBuffer): void; export declare function decodeOutputFile(buffer: ByteBuffer): OutputFile; -export declare function encodeTransformResponse( - message: TransformResponse, - bb: ByteBuffer, -): void; -export declare function decodeTransformResponse( - buffer: ByteBuffer, -): TransformResponse; +export declare function encodeTransformResponse(message: TransformResponse, bb: ByteBuffer): void; +export declare function decodeTransformResponse(buffer: ByteBuffer): TransformResponse; export declare function encodeLocation(message: Location, bb: ByteBuffer): void; export declare function decodeLocation(buffer: ByteBuffer): Location; -export declare function encodeMessageData( - message: MessageData, - bb: ByteBuffer, -): void; +export declare function encodeMessageData(message: MessageData, bb: ByteBuffer): void; export declare function decodeMessageData(buffer: ByteBuffer): MessageData; -export declare function encodeMessageMeta( - message: MessageMeta, - bb: ByteBuffer, -): void; +export declare function encodeMessageMeta(message: MessageMeta, bb: ByteBuffer): void; export declare function decodeMessageMeta(buffer: ByteBuffer): MessageMeta; export declare function encodeMessage(message: Message, bb: ByteBuffer): void; export declare function decodeMessage(buffer: ByteBuffer): Message; export declare function encodeLog(message: Log, bb: ByteBuffer): void; export declare function decodeLog(buffer: ByteBuffer): Log; -export declare function encodeWebsocketMessage( - message: WebsocketMessage, - bb: ByteBuffer, -): void; -export declare function decodeWebsocketMessage( - buffer: ByteBuffer, -): WebsocketMessage; -export declare function encodeWebsocketMessageWelcome( - message: WebsocketMessageWelcome, - bb: ByteBuffer, -): void; -export declare function decodeWebsocketMessageWelcome( - buffer: ByteBuffer, -): WebsocketMessageWelcome; +export declare function encodeWebsocketMessage(message: WebsocketMessage, bb: ByteBuffer): void; +export declare function decodeWebsocketMessage(buffer: ByteBuffer): WebsocketMessage; +export declare function encodeWebsocketMessageWelcome(message: WebsocketMessageWelcome, bb: ByteBuffer): void; +export declare function decodeWebsocketMessageWelcome(buffer: ByteBuffer): WebsocketMessageWelcome; export declare function encodeWebsocketMessageFileChangeNotification( message: WebsocketMessageFileChangeNotification, bb: ByteBuffer, @@ -912,69 +774,26 @@ export declare function encodeWebsocketMessageFileChangeNotification( export declare function decodeWebsocketMessageFileChangeNotification( buffer: ByteBuffer, ): WebsocketMessageFileChangeNotification; -export declare function encodeWebsocketCommand( - message: WebsocketCommand, - bb: ByteBuffer, -): void; -export declare function decodeWebsocketCommand( - buffer: ByteBuffer, -): WebsocketCommand; -export declare function encodeWebsocketCommandBuild( - message: WebsocketCommandBuild, - bb: ByteBuffer, -): void; -export declare function decodeWebsocketCommandBuild( - buffer: ByteBuffer, -): WebsocketCommandBuild; -export declare function encodeWebsocketCommandManifest( - message: WebsocketCommandManifest, - bb: ByteBuffer, -): void; -export declare function decodeWebsocketCommandManifest( - buffer: ByteBuffer, -): WebsocketCommandManifest; -export declare function encodeWebsocketMessageBuildSuccess( - message: WebsocketMessageBuildSuccess, - bb: ByteBuffer, -): void; -export declare function decodeWebsocketMessageBuildSuccess( - buffer: ByteBuffer, -): WebsocketMessageBuildSuccess; -export declare function encodeWebsocketMessageBuildFailure( - message: WebsocketMessageBuildFailure, - bb: ByteBuffer, -): void; -export declare function decodeWebsocketMessageBuildFailure( - buffer: ByteBuffer, -): WebsocketMessageBuildFailure; +export declare function encodeWebsocketCommand(message: WebsocketCommand, bb: ByteBuffer): void; +export declare function decodeWebsocketCommand(buffer: ByteBuffer): WebsocketCommand; +export declare function encodeWebsocketCommandBuild(message: WebsocketCommandBuild, bb: ByteBuffer): void; +export declare function decodeWebsocketCommandBuild(buffer: ByteBuffer): WebsocketCommandBuild; +export declare function encodeWebsocketCommandManifest(message: WebsocketCommandManifest, bb: ByteBuffer): void; +export declare function decodeWebsocketCommandManifest(buffer: ByteBuffer): WebsocketCommandManifest; +export declare function encodeWebsocketMessageBuildSuccess(message: WebsocketMessageBuildSuccess, bb: ByteBuffer): void; +export declare function decodeWebsocketMessageBuildSuccess(buffer: ByteBuffer): WebsocketMessageBuildSuccess; +export declare function encodeWebsocketMessageBuildFailure(message: WebsocketMessageBuildFailure, bb: ByteBuffer): void; +export declare function decodeWebsocketMessageBuildFailure(buffer: ByteBuffer): WebsocketMessageBuildFailure; export declare function encodeWebsocketCommandBuildWithFilePath( message: WebsocketCommandBuildWithFilePath, bb: ByteBuffer, ): void; -export declare function decodeWebsocketCommandBuildWithFilePath( - buffer: ByteBuffer, -): WebsocketCommandBuildWithFilePath; -export declare function encodeWebsocketMessageResolveID( - message: WebsocketMessageResolveID, - bb: ByteBuffer, -): void; -export declare function decodeWebsocketMessageResolveID( - buffer: ByteBuffer, -): WebsocketMessageResolveID; -export declare function encodeNPMRegistry( - message: NPMRegistry, - bb: ByteBuffer, -): void; +export declare function decodeWebsocketCommandBuildWithFilePath(buffer: ByteBuffer): WebsocketCommandBuildWithFilePath; +export declare function encodeWebsocketMessageResolveID(message: WebsocketMessageResolveID, bb: ByteBuffer): void; +export declare function decodeWebsocketMessageResolveID(buffer: ByteBuffer): WebsocketMessageResolveID; +export declare function encodeNPMRegistry(message: NPMRegistry, bb: ByteBuffer): void; export declare function decodeNPMRegistry(buffer: ByteBuffer): NPMRegistry; -export declare function encodeNPMRegistryMap( - message: NPMRegistryMap, - bb: ByteBuffer, -): void; -export declare function decodeNPMRegistryMap( - buffer: ByteBuffer, -): NPMRegistryMap; -export declare function encodeBunInstall( - message: BunInstall, - bb: ByteBuffer, -): void; +export declare function encodeNPMRegistryMap(message: NPMRegistryMap, bb: ByteBuffer): void; +export declare function decodeNPMRegistryMap(buffer: ByteBuffer): NPMRegistryMap; +export declare function encodeBunInstall(message: BunInstall, bb: ByteBuffer): void; export declare function decodeBunInstall(buffer: ByteBuffer): BunInstall; diff --git a/src/api/demo/schema.js b/src/api/demo/schema.js index 2c31d95127..7bdd13b65e 100644 --- a/src/api/demo/schema.js +++ b/src/api/demo/schema.js @@ -118,12 +118,7 @@ function encodeStackFrame(message, bb) { var value = message["scope"]; if (value != null) { var encoded = StackFrameScope[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + - JSON.stringify(value) + - ' for enum "StackFrameScope"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "StackFrameScope"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "scope"'); @@ -500,10 +495,7 @@ function encodeFallbackMessageContainer(message, bb) { if (value != null) { bb.writeByte(3); var encoded = FallbackStep[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "FallbackStep"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "FallbackStep"'); bb.writeByte(encoded); } @@ -612,10 +604,7 @@ function encodeJSX(message, bb) { var value = message["runtime"]; if (value != null) { var encoded = JSXRuntime[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "JSXRuntime"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "JSXRuntime"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "runtime"'); @@ -775,12 +764,10 @@ function decodeJavascriptBundle(bb) { var length = bb.readVarUint(); var values = (result["modules"] = Array(length)); - for (var i = 0; i < length; i++) - values[i] = decodeJavascriptBundledModule(bb); + for (var i = 0; i < length; i++) values[i] = decodeJavascriptBundledModule(bb); var length = bb.readVarUint(); var values = (result["packages"] = Array(length)); - for (var i = 0; i < length; i++) - values[i] = decodeJavascriptBundledPackage(bb); + for (var i = 0; i < length; i++) values[i] = decodeJavascriptBundledPackage(bb); result["etag"] = bb.readByteArray(); result["generated_at"] = bb.readUint32(); result["app_package_json_dependencies_hash"] = bb.readByteArray(); @@ -834,9 +821,7 @@ function encodeJavascriptBundle(message, bb) { if (value != null) { bb.writeByteArray(value); } else { - throw new Error( - 'Missing required field "app_package_json_dependencies_hash"', - ); + throw new Error('Missing required field "app_package_json_dependencies_hash"'); } var value = message["import_from_name"]; @@ -958,12 +943,7 @@ function encodeModuleImportRecord(message, bb) { var value = message["kind"]; if (value != null) { var encoded = ModuleImportType[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + - JSON.stringify(value) + - ' for enum "ModuleImportType"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "ModuleImportType"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "kind"'); @@ -1090,10 +1070,7 @@ function encodeLoaderMap(message, bb) { for (var i = 0; i < n; i++) { value = values[i]; var encoded = Loader[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "Loader"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"'); bb.writeByte(encoded); } } else { @@ -1167,10 +1144,7 @@ function encodeLoadedEnvConfig(message, bb) { var value = message["dotenv"]; if (value != null) { var encoded = DotEnvBehavior[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "DotEnvBehavior"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "DotEnvBehavior"'); bb.writeVarUint(encoded); } else { throw new Error('Missing required field "dotenv"'); @@ -1272,12 +1246,7 @@ function encodeFrameworkConfig(message, bb) { if (value != null) { bb.writeByte(6); var encoded = CSSInJSBehavior[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + - JSON.stringify(value) + - ' for enum "CSSInJSBehavior"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "CSSInJSBehavior"'); bb.writeByte(encoded); } @@ -1309,11 +1278,7 @@ function encodeFrameworkEntryPoint(message, bb) { if (value != null) { var encoded = FrameworkEntryPointType[value]; if (encoded === void 0) - throw new Error( - "Invalid value " + - JSON.stringify(value) + - ' for enum "FrameworkEntryPointType"', - ); + throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "FrameworkEntryPointType"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "kind"'); @@ -1462,12 +1427,7 @@ function encodeLoadedFramework(message, bb) { var value = message["client_css_in_js"]; if (value != null) { var encoded = CSSInJSBehavior[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + - JSON.stringify(value) + - ' for enum "CSSInJSBehavior"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "CSSInJSBehavior"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "client_css_in_js"'); @@ -1747,10 +1707,7 @@ function encodeTransformOptions(message, bb) { if (value != null) { bb.writeByte(3); var encoded = ResolveMode[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "ResolveMode"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "ResolveMode"'); bb.writeByte(encoded); } @@ -1848,10 +1805,7 @@ function encodeTransformOptions(message, bb) { if (value != null) { bb.writeByte(15); var encoded = Platform[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "Platform"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Platform"'); bb.writeByte(encoded); } @@ -1925,10 +1879,7 @@ function encodeTransformOptions(message, bb) { if (value != null) { bb.writeByte(26); var encoded = MessageLevel[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "MessageLevel"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "MessageLevel"'); bb.writeVarUint(encoded); } bb.writeByte(0); @@ -2023,10 +1974,7 @@ function encodeTransform(message, bb) { if (value != null) { bb.writeByte(4); var encoded = Loader[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "Loader"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"'); bb.writeByte(encoded); } @@ -2081,10 +2029,7 @@ function encodeScan(message, bb) { if (value != null) { bb.writeByte(3); var encoded = Loader[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "Loader"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"'); bb.writeByte(encoded); } bb.writeByte(0); @@ -2149,10 +2094,7 @@ function encodeScannedImport(message, bb) { var value = message["kind"]; if (value != null) { var encoded = ImportKind[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "ImportKind"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "ImportKind"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "kind"'); @@ -2249,11 +2191,7 @@ function encodeTransformResponse(message, bb) { if (value != null) { var encoded = TransformResponseStatus[value]; if (encoded === void 0) - throw new Error( - "Invalid value " + - JSON.stringify(value) + - ' for enum "TransformResponseStatus"', - ); + throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "TransformResponseStatus"'); bb.writeVarUint(encoded); } else { throw new Error('Missing required field "status"'); @@ -2464,10 +2402,7 @@ function encodeMessage(message, bb) { var value = message["level"]; if (value != null) { var encoded = MessageLevel[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "MessageLevel"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "MessageLevel"'); bb.writeVarUint(encoded); } else { throw new Error('Missing required field "level"'); @@ -2629,11 +2564,7 @@ function encodeWebsocketMessage(message, bb) { if (value != null) { var encoded = WebsocketMessageKind[value]; if (encoded === void 0) - throw new Error( - "Invalid value " + - JSON.stringify(value) + - ' for enum "WebsocketMessageKind"', - ); + throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "WebsocketMessageKind"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "kind"'); @@ -2660,10 +2591,7 @@ function encodeWebsocketMessageWelcome(message, bb) { var value = message["javascriptReloader"]; if (value != null) { var encoded = Reloader[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "Reloader"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Reloader"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "javascriptReloader"'); @@ -2696,10 +2624,7 @@ function encodeWebsocketMessageFileChangeNotification(message, bb) { var value = message["loader"]; if (value != null) { var encoded = Loader[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "Loader"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "loader"'); @@ -2719,11 +2644,7 @@ function encodeWebsocketCommand(message, bb) { if (value != null) { var encoded = WebsocketCommandKind[value]; if (encoded === void 0) - throw new Error( - "Invalid value " + - JSON.stringify(value) + - ' for enum "WebsocketCommandKind"', - ); + throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "WebsocketCommandKind"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "kind"'); @@ -2798,10 +2719,7 @@ function encodeWebsocketMessageBuildSuccess(message, bb) { var value = message["loader"]; if (value != null) { var encoded = Loader[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "Loader"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "loader"'); @@ -2851,10 +2769,7 @@ function encodeWebsocketMessageBuildFailure(message, bb) { var value = message["loader"]; if (value != null) { var encoded = Loader[value]; - if (encoded === void 0) - throw new Error( - "Invalid value " + JSON.stringify(value) + ' for enum "Loader"', - ); + if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + ' for enum "Loader"'); bb.writeByte(encoded); } else { throw new Error('Missing required field "loader"'); diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 0ecd684bd6..bb2f251a2a 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -1877,7 +1877,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp resp.body.value = .{ .Used = {} }; } } - + streamLog("onResolve({any})", .{wrote_anything}); //aborted so call finalizeForAbort diff --git a/src/bun.js/node-dns.exports.js b/src/bun.js/node-dns.exports.js index 025728eb60..f7516923ac 100644 --- a/src/bun.js/node-dns.exports.js +++ b/src/bun.js/node-dns.exports.js @@ -169,9 +169,9 @@ function lookupService(address, port, callback) { } var InternalResolver = class Resolver { - constructor(options) { } + constructor(options) {} - cancel() { } + cancel() {} getServers() { return []; @@ -192,11 +192,7 @@ var InternalResolver = class Resolver { switch (rrtype?.toLowerCase()) { case "a": case "aaaa": - callback( - null, - hostname, - results.map(mapResolveX), - ); + callback(null, hostname, results.map(mapResolveX)); break; default: callback(null, results); @@ -221,10 +217,7 @@ var InternalResolver = class Resolver { dns.lookup(hostname, { family: 4 }).then( addresses => { - callback( - null, - options?.ttl ? addresses : addresses.map(mapResolveX), - ); + callback(null, options?.ttl ? addresses : addresses.map(mapResolveX)); }, error => { callback(error); @@ -244,10 +237,7 @@ var InternalResolver = class Resolver { dns.lookup(hostname, { family: 6 }).then( addresses => { - callback( - null, - options?.ttl ? addresses : addresses.map(({ address }) => address), - ); + callback(null, options?.ttl ? addresses : addresses.map(({ address }) => address)); }, error => { callback(error); @@ -397,7 +387,7 @@ var InternalResolver = class Resolver { callback(null, []); } - setServers(servers) { } + setServers(servers) {} }; function resolve(hostname, rrtype, callback) { @@ -454,8 +444,8 @@ export var { resolveTxt, } = InternalResolver.prototype; -function setDefaultResultOrder() { } -function setServers() { } +function setDefaultResultOrder() {} +function setServers() {} const promisifyLookup = res => { res.sort((a, b) => a.family - b.family); @@ -467,8 +457,7 @@ const mapResolveX = a => a.address; const promisifyResolveX = res => { return res?.map(mapResolveX); -} - +}; // promisified versions export const promises = { @@ -497,14 +486,14 @@ export const promises = { if (options?.ttl) { return dns.lookup(hostname, { family: 4 }); } - return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX) + return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX); }, resolve6(hostname, options) { if (options?.ttl) { return dns.lookup(hostname, { family: 6 }); } - return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX) + return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX); }, resolveSrv(hostname) { @@ -537,9 +526,9 @@ export const promises = { }, Resolver: class Resolver { - constructor(options) { } + constructor(options) {} - cancel() { } + cancel() {} getServers() { return []; @@ -562,14 +551,14 @@ export const promises = { if (options?.ttl) { return dns.lookup(hostname, { family: 4 }); } - return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX) + return dns.lookup(hostname, { family: 4 }).then(promisifyResolveX); } resolve6(hostname, options) { if (options?.ttl) { return dns.lookup(hostname, { family: 6 }); } - return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX) + return dns.lookup(hostname, { family: 6 }).then(promisifyResolveX); } resolveAny(hostname) { @@ -616,7 +605,7 @@ export const promises = { return Promise.resolve([]); } - setServers(servers) { } + setServers(servers) {} }, }; for (const key of ["resolveAny", "reverse"]) { diff --git a/src/bun.js/node-tls.exports.js b/src/bun.js/node-tls.exports.js index 74a64cca48..46301ae777 100644 --- a/src/bun.js/node-tls.exports.js +++ b/src/bun.js/node-tls.exports.js @@ -154,4 +154,5 @@ var exports = { }; export default exports; + export { createSecureContext, parseCertString, TLSSocket, SecureContext }; diff --git a/src/bun.js/wasi-runner.js b/src/bun.js/wasi-runner.js index 24ff0a6782..6a89510b1d 100644 --- a/src/bun.js/wasi-runner.js +++ b/src/bun.js/wasi-runner.js @@ -3,21 +3,14 @@ const filePath = process.argv.at(1); if (!filePath) { - var err = new Error( - "To run a wasm file with Bun, the first argument must be a path to a .wasm file", - ); + var err = new Error("To run a wasm file with Bun, the first argument must be a path to a .wasm file"); err.name = "WasmFileNotFound"; throw err; } // The module specifier is the resolved path to the wasm file -var { - WASM_CWD = process.cwd(), - WASM_ROOT_DIR = "/", - WASM_ENV_STR = undefined, - WASM_USE_ASYNC_INIT = "", -} = process.env; +var { WASM_CWD = process.cwd(), WASM_ROOT_DIR = "/", WASM_ENV_STR = undefined, WASM_USE_ASYNC_INIT = "" } = process.env; var env = process.env; if (WASM_ENV_STR?.length) { diff --git a/src/darwin_c.zig b/src/darwin_c.zig index d62e665b9c..313ecc368b 100644 --- a/src/darwin_c.zig +++ b/src/darwin_c.zig @@ -559,13 +559,11 @@ pub const CPU_STATE_MAX = 4; pub const processor_cpu_load_info = extern struct { cpu_ticks: [CPU_STATE_MAX]c_uint, }; -pub const PROCESSOR_CPU_LOAD_INFO_COUNT = @as(std.c.mach_msg_type_number_t, - @sizeOf(processor_cpu_load_info)/@sizeOf(std.c.natural_t)); +pub const PROCESSOR_CPU_LOAD_INFO_COUNT = @as(std.c.mach_msg_type_number_t, @sizeOf(processor_cpu_load_info) / @sizeOf(std.c.natural_t)); pub const processor_info_array_t = [*]c_int; pub const PROCESSOR_INFO_MAX = 1024; -pub extern fn host_processor_info(host: std.c.host_t , flavor: processor_flavor_t , out_processor_count: *std.c.natural_t , out_processor_info: *processor_info_array_t, out_processor_infoCnt: *std.c.mach_msg_type_number_t) std.c.E; - +pub extern fn host_processor_info(host: std.c.host_t, flavor: processor_flavor_t, out_processor_count: *std.c.natural_t, out_processor_info: *processor_info_array_t, out_processor_infoCnt: *std.c.mach_msg_type_number_t) std.c.E; pub extern fn getuid(...) std.os.uid_t; pub extern fn getgid(...) std.os.gid_t; @@ -754,30 +752,32 @@ pub extern fn removefileat(fd: c_int, path: [*c]const u8, state: ?*removefile_st // As of Zig v0.11.0-dev.1393+38eebf3c4, ifaddrs.h is not included in the headers pub const ifaddrs = extern struct { - ifa_next: ?*ifaddrs, - ifa_name: [*:0]u8, - ifa_flags: c_uint, - ifa_addr: ?*std.os.sockaddr, - ifa_netmask: ?*std.os.sockaddr, - ifa_dstaddr: ?*std.os.sockaddr, - ifa_data: *anyopaque, + ifa_next: ?*ifaddrs, + ifa_name: [*:0]u8, + ifa_flags: c_uint, + ifa_addr: ?*std.os.sockaddr, + ifa_netmask: ?*std.os.sockaddr, + ifa_dstaddr: ?*std.os.sockaddr, + ifa_data: *anyopaque, }; pub extern fn getifaddrs(*?*ifaddrs) c_int; pub extern fn freeifaddrs(?*ifaddrs) void; -const net_if_h = @cImport({ @cInclude("net/if.h"); }); +const net_if_h = @cImport({ + @cInclude("net/if.h"); +}); pub const IFF_RUNNING = net_if_h.IFF_RUNNING; pub const IFF_UP = net_if_h.IFF_UP; pub const IFF_LOOPBACK = net_if_h.IFF_LOOPBACK; pub const sockaddr_dl = extern struct { - sdl_len: u8, // Total length of sockaddr */ - sdl_family: u8, // AF_LINK */ - sdl_index: u16, // if != 0, system given index for interface */ - sdl_type: u8, // interface type */ - sdl_nlen: u8, // interface name length, no trailing 0 reqd. */ - sdl_alen: u8, // link level address length */ - sdl_slen: u8, // link layer selector length */ - sdl_data: [12]u8, // minimum work area, can be larger; contains both if name and ll address */ + sdl_len: u8, // Total length of sockaddr */ + sdl_family: u8, // AF_LINK */ + sdl_index: u16, // if != 0, system given index for interface */ + sdl_type: u8, // interface type */ + sdl_nlen: u8, // interface name length, no trailing 0 reqd. */ + sdl_alen: u8, // link level address length */ + sdl_slen: u8, // link layer selector length */ + sdl_data: [12]u8, // minimum work area, can be larger; contains both if name and ll address */ //#ifndef __APPLE__ // /* For TokenRing */ // u_short sdl_rcf; /* source routing control */ diff --git a/src/deps/uws.zig b/src/deps/uws.zig index 58a5b1b936..5ebbfcc514 100644 --- a/src/deps/uws.zig +++ b/src/deps/uws.zig @@ -319,9 +319,7 @@ pub fn NewSocketHandler(comptime ssl: bool) type { } pub fn from(socket: *Socket) ThisSocket { - return ThisSocket { - .socket = socket - }; + return ThisSocket{ .socket = socket }; } pub fn adopt( diff --git a/src/fallback.ts b/src/fallback.ts index 964ed4e929..1893fde366 100644 --- a/src/fallback.ts +++ b/src/fallback.ts @@ -1,15 +1,10 @@ declare var document: any; import { ByteBuffer } from "peechy"; import { FallbackStep } from "./api/schema"; -import { - decodeFallbackMessageContainer, - FallbackMessageContainer, -} from "./api/schema"; +import { decodeFallbackMessageContainer, FallbackMessageContainer } from "./api/schema"; function getFallbackInfo(): FallbackMessageContainer { - const binary_string = globalThis.atob( - document.getElementById("__bunfallback").textContent.trim(), - ); + const binary_string = globalThis.atob(document.getElementById("__bunfallback").textContent.trim()); var len = binary_string.length; var bytes = new Uint8Array(len); diff --git a/src/http_client_async.zig b/src/http_client_async.zig index 0f6045bbb7..9454064484 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -1029,13 +1029,13 @@ aborted: ?*std.atomic.Atomic(bool) = null, async_http_id: u32 = 0, pub fn init(allocator: std.mem.Allocator, method: Method, url: URL, header_entries: Headers.Entries, header_buf: string, signal: ?*std.atomic.Atomic(bool)) HTTPClient { - return HTTPClient { - .allocator = allocator, - .method = method, - .url = url, - .header_entries = header_entries, - .header_buf = header_buf, - .aborted = signal, + return HTTPClient{ + .allocator = allocator, + .method = method, + .url = url, + .header_entries = header_entries, + .header_buf = header_buf, + .aborted = signal, }; } diff --git a/src/linux_c.zig b/src/linux_c.zig index ae93004779..1291615790 100644 --- a/src/linux_c.zig +++ b/src/linux_c.zig @@ -481,10 +481,9 @@ pub fn posix_spawn_file_actions_addchdir_np(actions: *posix_spawn_file_actions_t pub extern fn vmsplice(fd: c_int, iovec: [*]const std.os.iovec, iovec_count: usize, flags: u32) isize; - const net_c = @cImport({ @cInclude("ifaddrs.h"); // getifaddrs, freeifaddrs - @cInclude("net/if.h"); // IFF_RUNNING, IFF_UP + @cInclude("net/if.h"); // IFF_RUNNING, IFF_UP }); pub const ifaddrs = net_c.ifaddrs; pub const getifaddrs = net_c.getifaddrs; diff --git a/src/node-fallbacks/@vercel_fetch.js b/src/node-fallbacks/@vercel_fetch.js index f75604b2be..a8de45222a 100644 --- a/src/node-fallbacks/@vercel_fetch.js +++ b/src/node-fallbacks/@vercel_fetch.js @@ -1,15 +1,11 @@ // This is just a no-op. Intent is to prevent importing a bunch of stuff that isn't relevant. -module.exports = ( - wrapper = "Bun" in globalThis ? Bun.fetch : globalThis.fetch, -) => { +module.exports = (wrapper = "Bun" in globalThis ? Bun.fetch : globalThis.fetch) => { async function vercelFetch(url, opts = {}) { // Convert Object bodies to JSON if they are JS objects if ( opts.body && typeof opts.body === "object" && - (!("buffer" in opts.body) || - typeof opts.body.buffer !== "object" || - !(opts.body.buffer instanceof ArrayBuffer)) + (!("buffer" in opts.body) || typeof opts.body.buffer !== "object" || !(opts.body.buffer instanceof ArrayBuffer)) ) { opts.body = JSON.stringify(opts.body); // Content length will automatically be set diff --git a/src/node-fallbacks/crypto.js b/src/node-fallbacks/crypto.js index 4a0e4c7357..8c83b6c879 100644 --- a/src/node-fallbacks/crypto.js +++ b/src/node-fallbacks/crypto.js @@ -3,7 +3,7 @@ export * from "crypto-browserify"; export var DEFAULT_ENCODING = "buffer"; // we deliberately reference crypto. directly here because we want to preserve the This binding -export const getRandomValues = (array) => { +export const getRandomValues = array => { return crypto.getRandomValues(array); }; @@ -16,10 +16,7 @@ export const timingSafeEqual = ? (a, b) => { const { byteLength: byteLengthA } = a; const { byteLength: byteLengthB } = b; - if ( - typeof byteLengthA !== "number" || - typeof byteLengthB !== "number" - ) { + if (typeof byteLengthA !== "number" || typeof byteLengthB !== "number") { throw new TypeError("Input must be an array buffer view"); } @@ -37,9 +34,7 @@ export const scryptSync = "scryptSync" in crypto ? (password, salt, keylen, options) => { const res = crypto.scryptSync(password, salt, keylen, options); - return DEFAULT_ENCODING !== "buffer" - ? new Buffer(res).toString(DEFAULT_ENCODING) - : new Buffer(res); + return DEFAULT_ENCODING !== "buffer" ? new Buffer(res).toString(DEFAULT_ENCODING) : new Buffer(res); } : undefined; @@ -62,9 +57,7 @@ export const scrypt = process.nextTick( callback, null, - DEFAULT_ENCODING !== "buffer" - ? new Buffer(result).toString(DEFAULT_ENCODING) - : new Buffer(result), + DEFAULT_ENCODING !== "buffer" ? new Buffer(result).toString(DEFAULT_ENCODING) : new Buffer(result), ); } catch (err) { throw err; diff --git a/src/node-fallbacks/events.js b/src/node-fallbacks/events.js index 738bf1f153..70f47eb539 100644 --- a/src/node-fallbacks/events.js +++ b/src/node-fallbacks/events.js @@ -34,9 +34,7 @@ if (R && typeof R.ownKeys === "function") { ReflectOwnKeys = R.ownKeys; } else if (Object.getOwnPropertySymbols) { ReflectOwnKeys = function ReflectOwnKeys(target) { - return Object.getOwnPropertyNames(target).concat( - Object.getOwnPropertySymbols(target), - ); + return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); }; } else { ReflectOwnKeys = function ReflectOwnKeys(target) { @@ -71,10 +69,7 @@ var defaultMaxListeners = 10; function checkListener(listener) { if (typeof listener !== "function") { - throw new TypeError( - 'The "listener" argument must be of type Function. Received type ' + - typeof listener, - ); + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); } } @@ -86,9 +81,7 @@ Object.defineProperty(EventEmitter, "defaultMaxListeners", { set: function (arg) { if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) { throw new RangeError( - 'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + - arg + - ".", + 'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + ".", ); } defaultMaxListeners = arg; @@ -96,10 +89,7 @@ Object.defineProperty(EventEmitter, "defaultMaxListeners", { }); EventEmitter.init = function () { - if ( - this._events === undefined || - this._events === Object.getPrototypeOf(this)._events - ) { + if (this._events === undefined || this._events === Object.getPrototypeOf(this)._events) { this._events = Object.create(null); this._eventsCount = 0; } @@ -111,11 +101,7 @@ EventEmitter.init = function () { // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) { - throw new RangeError( - 'The value of "n" is out of range. It must be a non-negative number. Received ' + - n + - ".", - ); + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + "."); } this._maxListeners = n; return this; @@ -149,9 +135,7 @@ EventEmitter.prototype.emit = function emit(type) { throw er; // Unhandled 'error' event } // At least give some kind of context to the user - var err = new Error( - "Unhandled error." + (er ? " (" + er.message + ")" : ""), - ); + var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : "")); err.context = er; throw err; // Unhandled 'error' event } @@ -186,11 +170,7 @@ function _addListener(target, type, listener, prepend) { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". if (events.newListener !== undefined) { - target.emit( - "newListener", - type, - listener.listener ? listener.listener : listener, - ); + target.emit("newListener", type, listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object @@ -206,9 +186,7 @@ function _addListener(target, type, listener, prepend) { } else { if (typeof existing === "function") { // Adding the second element, need to change to array. - existing = events[type] = prepend - ? [listener, existing] - : [existing, listener]; + existing = events[type] = prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. } else if (prepend) { existing.unshift(listener); @@ -248,10 +226,7 @@ EventEmitter.prototype.addListener = function addListener(type, listener) { EventEmitter.prototype.on = EventEmitter.prototype.addListener; -EventEmitter.prototype.prependListener = function prependListener( - type, - listener, -) { +EventEmitter.prototype.prependListener = function prependListener(type, listener) { return _addListener(this, type, listener, true); }; @@ -284,20 +259,14 @@ EventEmitter.prototype.once = function once(type, listener) { return this; }; -EventEmitter.prototype.prependOnceListener = function prependOnceListener( - type, - listener, -) { +EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; // Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener = function removeListener( - type, - listener, -) { +EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; checkListener(listener); @@ -312,8 +281,7 @@ EventEmitter.prototype.removeListener = function removeListener( if (--this._eventsCount === 0) this._events = Object.create(null); else { delete events[type]; - if (events.removeListener) - this.emit("removeListener", type, list.listener || listener); + if (events.removeListener) this.emit("removeListener", type, list.listener || listener); } } else if (typeof list !== "function") { position = -1; @@ -335,8 +303,7 @@ EventEmitter.prototype.removeListener = function removeListener( if (list.length === 1) events[type] = list[0]; - if (events.removeListener !== undefined) - this.emit("removeListener", type, originalListener || listener); + if (events.removeListener !== undefined) this.emit("removeListener", type, originalListener || listener); } return this; @@ -399,12 +366,9 @@ function _listeners(target, type, unwrap) { var evlistener = events[type]; if (evlistener === undefined) return []; - if (typeof evlistener === "function") - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + if (typeof evlistener === "function") return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap - ? unwrapListeners(evlistener) - : arrayClone(evlistener, evlistener.length); + return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { @@ -509,10 +473,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) { listener(arg); }); } else { - throw new TypeError( - 'The "emitter" argument must be of type EventEmitter. Received type ' + - typeof emitter, - ); + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); } } diff --git a/src/node-fallbacks/url.js b/src/node-fallbacks/url.js index 10f1b889ad..81c78001db 100644 --- a/src/node-fallbacks/url.js +++ b/src/node-fallbacks/url.js @@ -203,10 +203,7 @@ Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) { } } - if ( - !hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto])) - ) { + if (!hostlessProtocol[proto] && (slashes || (proto && !slashedProtocol[proto]))) { // there's a hostname. // the first instance of /, ?, ;, or # ends the host. // @@ -270,9 +267,7 @@ Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) { // if hostname begins with [ and ends with ] // assume that it's an IPv6 address. - var ipv6Hostname = - this.hostname[0] === "[" && - this.hostname[this.hostname.length - 1] === "]"; + var ipv6Hostname = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]"; // validate a little. if (!ipv6Hostname) { @@ -423,21 +418,13 @@ Url.prototype.format = function () { if (this.host) { host = auth + this.host; } else if (this.hostname) { - host = - auth + - (this.hostname.indexOf(":") === -1 - ? this.hostname - : "[" + this.hostname + "]"); + host = auth + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]"); if (this.port) { host += ":" + this.port; } } - if ( - this.query && - util_isObject(this.query) && - Object.keys(this.query).length - ) { + if (this.query && util_isObject(this.query) && Object.keys(this.query).length) { query = querystring.stringify(this.query); } @@ -447,10 +434,7 @@ Url.prototype.format = function () { // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. // unless they had them to begin with. - if ( - this.slashes || - ((!protocol || slashedProtocol[protocol]) && host !== false) - ) { + if (this.slashes || ((!protocol || slashedProtocol[protocol]) && host !== false)) { host = "//" + (host || ""); if (pathname && pathname.charAt(0) !== "/") pathname = "/" + pathname; } else if (!host) { @@ -515,11 +499,7 @@ Url.prototype.resolveObject = function (relative) { } //urlParse appends trailing / to urls like http://www.example.com - if ( - slashedProtocol[result.protocol] && - result.hostname && - !result.pathname - ) { + if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) { result.path = result.pathname = "/"; } @@ -576,9 +556,7 @@ Url.prototype.resolveObject = function (relative) { } var isSourceAbs = result.pathname && result.pathname.charAt(0) === "/", - isRelAbs = - relative.host || - (relative.pathname && relative.pathname.charAt(0) === "/"), + isRelAbs = relative.host || (relative.pathname && relative.pathname.charAt(0) === "/"), mustEndAbs = isRelAbs || isSourceAbs || (result.host && relative.pathname), removeAllDots = mustEndAbs, srcPath = (result.pathname && result.pathname.split("/")) || [], @@ -612,12 +590,8 @@ Url.prototype.resolveObject = function (relative) { if (isRelAbs) { // it's absolute. - result.host = - relative.host || relative.host === "" ? relative.host : result.host; - result.hostname = - relative.hostname || relative.hostname === "" - ? relative.hostname - : result.hostname; + result.host = relative.host || relative.host === "" ? relative.host : result.host; + result.hostname = relative.hostname || relative.hostname === "" ? relative.hostname : result.hostname; result.search = relative.search; result.query = relative.query; srcPath = relPath; @@ -639,10 +613,7 @@ Url.prototype.resolveObject = function (relative) { //occationaly the auth can get stuck only in host //this especially happens in cases like //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = - result.host && result.host.indexOf("@") > 0 - ? result.host.split("@") - : false; + var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false; if (authInHost) { result.auth = authInHost.shift(); result.host = result.hostname = authInHost.shift(); @@ -652,9 +623,7 @@ Url.prototype.resolveObject = function (relative) { result.query = relative.query; //to support http.request if (!util_isNull(result.pathname) || !util_isNull(result.search)) { - result.path = - (result.pathname ? result.pathname : "") + - (result.search ? result.search : ""); + result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : ""); } result.href = result.format(); return result; @@ -679,9 +648,7 @@ Url.prototype.resolveObject = function (relative) { // then it must NOT get a trailing slash. var last = srcPath.slice(-1)[0]; var hasTrailingSlash = - ((result.host || relative.host || srcPath.length > 1) && - (last === "." || last === "..")) || - last === ""; + ((result.host || relative.host || srcPath.length > 1) && (last === "." || last === "..")) || last === ""; // strip single dots, resolve double dots to parent dir // if the path tries to go above the root, `up` ends up > 0 @@ -706,11 +673,7 @@ Url.prototype.resolveObject = function (relative) { } } - if ( - mustEndAbs && - srcPath[0] !== "" && - (!srcPath[0] || srcPath[0].charAt(0) !== "/") - ) { + if (mustEndAbs && srcPath[0] !== "" && (!srcPath[0] || srcPath[0].charAt(0) !== "/")) { srcPath.unshift(""); } @@ -718,23 +681,15 @@ Url.prototype.resolveObject = function (relative) { srcPath.push(""); } - var isAbsolute = - srcPath[0] === "" || (srcPath[0] && srcPath[0].charAt(0) === "/"); + var isAbsolute = srcPath[0] === "" || (srcPath[0] && srcPath[0].charAt(0) === "/"); // put the host back if (psychotic) { - result.hostname = result.host = isAbsolute - ? "" - : srcPath.length - ? srcPath.shift() - : ""; + result.hostname = result.host = isAbsolute ? "" : srcPath.length ? srcPath.shift() : ""; //occationaly the auth can get stuck only in host //this especially happens in cases like //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = - result.host && result.host.indexOf("@") > 0 - ? result.host.split("@") - : false; + var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false; if (authInHost) { result.auth = authInHost.shift(); result.host = result.hostname = authInHost.shift(); @@ -756,9 +711,7 @@ Url.prototype.resolveObject = function (relative) { //to support request.http if (!util_isNull(result.pathname) || !util_isNull(result.search)) { - result.path = - (result.pathname ? result.pathname : "") + - (result.search ? result.search : ""); + result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : ""); } result.auth = relative.auth || result.auth; result.slashes = result.slashes || relative.slashes; diff --git a/src/runtime.footer.bun.js b/src/runtime.footer.bun.js index 0c83ebc496..56da601b45 100644 --- a/src/runtime.footer.bun.js +++ b/src/runtime.footer.bun.js @@ -14,8 +14,7 @@ export var __merge = BUN_RUNTIME.__merge; export var __decorateClass = BUN_RUNTIME.__decorateClass; export var __decorateParam = BUN_RUNTIME.__decorateParam; export var $$bun_runtime_json_parse = JSON.parse; -export var __internalIsCommonJSNamespace = - BUN_RUNTIME.__internalIsCommonJSNamespace; +export var __internalIsCommonJSNamespace = BUN_RUNTIME.__internalIsCommonJSNamespace; export var __require = (globalThis.require ||= function (moduleId) { if (typeof moduleId === "string") { @@ -25,5 +24,4 @@ export var __require = (globalThis.require ||= function (moduleId) { return BUN_RUNTIME.__require(moduleId); }); __require.d ||= BUN_RUNTIME.__require.d; -globalThis.__internalIsCommonJSNamespace ||= - BUN_RUNTIME.__internalIsCommonJSNamespace; +globalThis.__internalIsCommonJSNamespace ||= BUN_RUNTIME.__internalIsCommonJSNamespace; diff --git a/src/runtime.footer.js b/src/runtime.footer.js index 062961b1f6..ceeab055db 100644 --- a/src/runtime.footer.js +++ b/src/runtime.footer.js @@ -1,8 +1,7 @@ // --- // Public exports from runtime // Compatible with bun's Runtime Environment and web browsers. -export var $$m = - "$primordials" in globalThis ? $primordials.require : BUN_RUNTIME.$$m; +export var $$m = "$primordials" in globalThis ? $primordials.require : BUN_RUNTIME.$$m; export var __HMRModule = BUN_RUNTIME.__HMRModule; export var __FastRefreshModule = BUN_RUNTIME.__FastRefreshModule; export var __HMRClient = BUN_RUNTIME.__HMRClient; @@ -22,8 +21,7 @@ export var __merge = BUN_RUNTIME.__merge; export var __decorateClass = BUN_RUNTIME.__decorateClass; export var __decorateParam = BUN_RUNTIME.__decorateParam; export var $$bun_runtime_json_parse = JSON.parse; -export var __internalIsCommonJSNamespace = - BUN_RUNTIME.__internalIsCommonJSNamespace; +export var __internalIsCommonJSNamespace = BUN_RUNTIME.__internalIsCommonJSNamespace; globalThis.__internalIsCommonJSNamespace ||= __internalIsCommonJSNamespace; globalThis.require ||= BUN_RUNTIME.__require; diff --git a/src/runtime.footer.node.js b/src/runtime.footer.node.js index b32dc78fa8..ef28d3b314 100644 --- a/src/runtime.footer.node.js +++ b/src/runtime.footer.node.js @@ -15,8 +15,7 @@ export var __exportDefault = BUN_RUNTIME.__exportDefault; export var __decorateClass = BUN_RUNTIME.__decorateClass; export var __decorateParam = BUN_RUNTIME.__decorateParam; export var $$bun_runtime_json_parse = JSON.parse; -export var __internalIsCommonJSNamespace = - BUN_RUNTIME.__internalIsCommonJSNamespace; +export var __internalIsCommonJSNamespace = BUN_RUNTIME.__internalIsCommonJSNamespace; var require = __$module.createRequire(import.meta.url); var process = globalThis.process || diff --git a/src/runtime.footer.with-refresh.js b/src/runtime.footer.with-refresh.js index a5b5a3b79b..784f5f8fa6 100644 --- a/src/runtime.footer.with-refresh.js +++ b/src/runtime.footer.with-refresh.js @@ -1,8 +1,7 @@ // --- // Public exports from runtime // Compatible with bun's Runtime Environment and web browsers. -export var $$m = - "$primordials" in globalThis ? $primordials.require : BUN_RUNTIME.$$m; +export var $$m = "$primordials" in globalThis ? $primordials.require : BUN_RUNTIME.$$m; export var __HMRModule = BUN_RUNTIME.__HMRModule; export var __FastRefreshModule = BUN_RUNTIME.__FastRefreshModule; export var __HMRClient = BUN_RUNTIME.__HMRClient; @@ -22,8 +21,7 @@ export var __decorateClass = BUN_RUNTIME.__decorateClass; export var __decorateParam = BUN_RUNTIME.__decorateParam; export var $$bun_runtime_json_parse = JSON.parse; export var __FastRefreshRuntime = BUN_RUNTIME.__FastRefreshRuntime; -export var __internalIsCommonJSNamespace = - BUN_RUNTIME.__internalIsCommonJSNamespace; +export var __internalIsCommonJSNamespace = BUN_RUNTIME.__internalIsCommonJSNamespace; globalThis.__internalIsCommonJSNamespace ||= __internalIsCommonJSNamespace; globalThis.require ||= BUN_RUNTIME.__require; diff --git a/src/runtime.js b/src/runtime.js index b39eaed9d3..537ea9eed0 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -21,8 +21,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor; // return __objectFreezePolyfill.has(obj); // }; -export var __markAsModule = (target) => - __defProp(target, "__esModule", { value: true, configurable: true }); +export var __markAsModule = target => __defProp(target, "__esModule", { value: true, configurable: true }); // lazy require to prevent loading one icon from a design system export var $$lzy = (target, module, props) => { @@ -37,7 +36,7 @@ export var $$lzy = (target, module, props) => { return target; }; -export var __toModule = (module) => { +export var __toModule = module => { return __reExport( __markAsModule( __defProp( @@ -81,15 +80,9 @@ export var __commonJS = (cb, name) => { return origExports.apply(this, arguments); }; Object.setPrototypeOf(mod_exports, __getProtoOf(origExports)); - Object.defineProperties( - mod_exports, - Object.getOwnPropertyDescriptors(origExports), - ); + Object.defineProperties(mod_exports, Object.getOwnPropertyDescriptors(origExports)); } else { - mod_exports = __create( - __getProtoOf(mod_exports), - Object.getOwnPropertyDescriptors(mod_exports), - ); + mod_exports = __create(__getProtoOf(mod_exports), Object.getOwnPropertyDescriptors(mod_exports)); } } @@ -134,14 +127,13 @@ export var __commonJS = (cb, name) => { export var __cJS2eSM = __commonJS; -export var __internalIsCommonJSNamespace = (namespace) => +export var __internalIsCommonJSNamespace = namespace => namespace != null && typeof namespace === "object" && - ((namespace.default && namespace.default[cjsRequireSymbol]) || - namespace[cjsRequireSymbol]); + ((namespace.default && namespace.default[cjsRequireSymbol]) || namespace[cjsRequireSymbol]); // require() -export var __require = (namespace) => { +export var __require = namespace => { if (__internalIsCommonJSNamespace(namespace)) { return namespace.default(); } @@ -152,7 +144,7 @@ export var __require = (namespace) => { // require().default // this currently does nothing // get rid of this wrapper once we're more confident we do not need special handling for default -__require.d = (namespace) => { +__require.d = namespace => { return namespace; }; @@ -176,7 +168,7 @@ export var __export = (target, all) => { get: all[name], enumerable: true, configurable: true, - set: (newValue) => (all[name] = () => newValue), + set: newValue => (all[name] = () => newValue), }); }; @@ -184,7 +176,7 @@ export var __exportValue = (target, all) => { for (var name in all) { __defProp(target, name, { get: () => all[name], - set: (newValue) => (all[name] = newValue), + set: newValue => (all[name] = newValue), enumerable: true, configurable: true, }); @@ -194,7 +186,7 @@ export var __exportValue = (target, all) => { export var __exportDefault = (target, value) => { __defProp(target, "default", { get: () => value, - set: (newValue) => (value = newValue), + set: newValue => (value = newValue), enumerable: true, configurable: true, }); @@ -207,8 +199,7 @@ export var __reExport = (target, module, desc) => { __defProp(target, key, { get: () => module[key], configurable: true, - enumerable: - !(desc = __getOwnPropDesc(module, key)) || desc.enumerable, + enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable, }); return target; }; @@ -237,15 +228,11 @@ export var __merge = (props, defaultProps) => { }; export var __decorateClass = (decorators, target, key, kind) => { - var result = - kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; + var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) - if ((decorator = decorators[i])) - result = - (kind ? decorator(target, key, result) : decorator(result)) || result; + if ((decorator = decorators[i])) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; -export var __decorateParam = (index, decorator) => (target, key) => - decorator(target, key, index); +export var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index); diff --git a/src/runtime/errors.ts b/src/runtime/errors.ts index 5affd14f15..e2973db911 100644 --- a/src/runtime/errors.ts +++ b/src/runtime/errors.ts @@ -76,8 +76,4 @@ var __ImportKind; __ImportKind = ImportKind; } -export { - __ResolveError as ResolveError, - __BuildError as BuildError, - __ImportKind as ImportKind, -}; +export { __ResolveError as ResolveError, __BuildError as BuildError, __ImportKind as ImportKind }; diff --git a/src/runtime/hmr.ts b/src/runtime/hmr.ts index 96122feba1..5aff4389dc 100644 --- a/src/runtime/hmr.ts +++ b/src/runtime/hmr.ts @@ -79,8 +79,7 @@ if (typeof window !== "undefined") { // if they set a CSP header, that could cause this to fail try { let linkTag = document.querySelector("link[rel='icon']"); - BunError.previousFavicon = - (linkTag && linkTag.getAttribute("href")) || "/favicon.ico"; + BunError.previousFavicon = (linkTag && linkTag.getAttribute("href")) || "/favicon.ico"; if (!linkTag) { linkTag = document.createElement("link"); linkTag.setAttribute("rel", "icon"); @@ -119,19 +118,15 @@ if (typeof window !== "undefined") { if (!BunError.module) { if (BunError.prom) return; - BunError.prom = import("/bun:error.js").then((mod) => { + BunError.prom = import("/bun:error.js").then(mod => { BunError.module = mod; - !BunError.cancel && - BunError.render(BunError.lastError[0], BunError.lastError[1]); + !BunError.cancel && BunError.render(BunError.lastError[0], BunError.lastError[1]); }); return; } const { renderBuildFailure, renderRuntimeError } = BunError.module; - if ( - typeof BunError.lastError[0] === "string" || - BunError.lastError[0] instanceof Error - ) { + if (typeof BunError.lastError[0] === "string" || BunError.lastError[0] instanceof Error) { renderRuntimeError(BunError.lastError[0], BunError.lastError[1]); } else { renderBuildFailure(BunError.lastError[0], BunError.lastError[1]); @@ -192,26 +187,17 @@ if (typeof window !== "undefined") { const endIDRegion = rule.conditionText.indexOf(")", startIndex); if (endIDRegion === -1) return null; - const int = parseInt( - rule.conditionText.substring(startIndex, endIDRegion), - 10, - ); + const int = parseInt(rule.conditionText.substring(startIndex, endIDRegion), 10); if (int !== id) { return null; } - let startFileRegion = rule.conditionText.indexOf( - '(hmr-file:"', - endIDRegion, - ); + let startFileRegion = rule.conditionText.indexOf('(hmr-file:"', endIDRegion); if (startFileRegion === -1) return null; startFileRegion += '(hmr-file:"'.length + 1; - const endFileRegion = rule.conditionText.indexOf( - '"', - startFileRegion, - ); + const endFileRegion = rule.conditionText.indexOf('"', startFileRegion); if (endFileRegion === -1) return null; // Empty file strings are invalid if (endFileRegion - startFileRegion <= 0) return null; @@ -219,10 +205,7 @@ if (typeof window !== "undefined") { CSSLoader.cssLoadId.id = int; CSSLoader.cssLoadId.node = sheet.ownerNode as HTMLStylableElement; CSSLoader.cssLoadId.sheet = sheet; - CSSLoader.cssLoadId.file = rule.conditionText.substring( - startFileRegion - 1, - endFileRegion, - ); + CSSLoader.cssLoadId.file = rule.conditionText.substring(startFileRegion - 1, endFileRegion); return CSSLoader.cssLoadId; } @@ -265,33 +248,20 @@ if (typeof window !== "undefined") { } const bundleIdRule = cssRules[0] as CSSSupportsRule; - if ( - bundleIdRule.type !== 12 || - !bundleIdRule.conditionText.startsWith("(hmr-bid:") - ) { + if (bundleIdRule.type !== 12 || !bundleIdRule.conditionText.startsWith("(hmr-bid:")) { continue; } - const bundleIdEnd = bundleIdRule.conditionText.indexOf( - ")", - "(hmr-bid:".length + 1, - ); + const bundleIdEnd = bundleIdRule.conditionText.indexOf(")", "(hmr-bid:".length + 1); if (bundleIdEnd === -1) continue; CSSLoader.cssLoadId.bundle_id = parseInt( - bundleIdRule.conditionText.substring( - "(hmr-bid:".length, - bundleIdEnd, - ), + bundleIdRule.conditionText.substring("(hmr-bid:".length, bundleIdEnd), 10, ); for (let j = 1; j < ruleCount && match === null; j++) { - match = this.findMatchingSupportsRule( - cssRules[j] as CSSSupportsRule, - id, - sheet, - ); + match = this.findMatchingSupportsRule(cssRules[j] as CSSSupportsRule, id, sheet); } } } @@ -318,17 +288,11 @@ if (typeof window !== "undefined") { } const bundleIdRule = cssRules[0] as CSSSupportsRule; - if ( - bundleIdRule.type !== 12 || - !bundleIdRule.conditionText.startsWith("(hmr-bid:") - ) { + if (bundleIdRule.type !== 12 || !bundleIdRule.conditionText.startsWith("(hmr-bid:")) { continue; } - const bundleIdEnd = bundleIdRule.conditionText.indexOf( - ")", - "(hmr-bid:".length + 1, - ); + const bundleIdEnd = bundleIdRule.conditionText.indexOf(")", "(hmr-bid:".length + 1); if (bundleIdEnd === -1) continue; CSSLoader.cssLoadId.bundle_id = parseInt( @@ -337,11 +301,7 @@ if (typeof window !== "undefined") { ); for (let j = 1; j < ruleCount && match === null; j++) { - match = this.findMatchingSupportsRule( - cssRules[j] as CSSSupportsRule, - id, - sheet, - ); + match = this.findMatchingSupportsRule(cssRules[j] as CSSSupportsRule, id, sheet); } } @@ -356,11 +316,7 @@ if (typeof window !== "undefined") { return match; } - handleBuildSuccess( - bytes: Uint8Array, - build: API.WebsocketMessageBuildSuccess, - timestamp: number, - ) { + handleBuildSuccess(bytes: Uint8Array, build: API.WebsocketMessageBuildSuccess, timestamp: number) { const start = performance.now(); var update = this.findCSSLinkTag(build.id); // The last 4 bytes of the build message are the hash of the module @@ -386,12 +342,7 @@ if (typeof window !== "undefined") { function onLoadHandler() { const localDuration = formatDuration(performance.now() - start); const fsDuration = _timestamp - from_timestamp; - __hmrlog.log( - "Reloaded in", - `${localDuration + fsDuration}ms`, - "-", - filepath, - ); + __hmrlog.log("Reloaded in", `${localDuration + fsDuration}ms`, "-", filepath); update = null; filepath = null; @@ -421,10 +372,7 @@ if (typeof window !== "undefined") { // This is an adoptedStyleSheet, call replaceSync and be done with it. if (!update.node || update.node.tagName === "HTML") { update.sheet.replaceSync(this.decoder.decode(bytes)); - } else if ( - update.node.tagName === "LINK" || - update.node.tagName === "STYLE" - ) { + } else if (update.node.tagName === "LINK" || update.node.tagName === "STYLE") { // This might cause CSS specifity issues.... // I'm not 100% sure this is a safe operation const sheet = new CSSStyleSheet(); @@ -433,10 +381,7 @@ if (typeof window !== "undefined") { sheet.replaceSync(decoded); update.node.remove(); - document.adoptedStyleSheets = [ - ...document.adoptedStyleSheets, - sheet, - ]; + document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet]; } break; } @@ -445,9 +390,7 @@ if (typeof window !== "undefined") { bytes = null; } - filePath( - file_change_notification: API.WebsocketMessageFileChangeNotification, - ): string | null { + filePath(file_change_notification: API.WebsocketMessageFileChangeNotification): string | null { if (file_change_notification.loader !== API.Loader.css) return null; const tag = this.findCSSLinkTag(file_change_notification.id); @@ -481,9 +424,7 @@ if (typeof window !== "undefined") { start() { if (runOnce) { - __hmrlog.warn( - "Attempted to start HMR client multiple times. This may be a bug.", - ); + __hmrlog.warn("Attempted to start HMR client multiple times. This may be a bug."); return; } @@ -508,23 +449,18 @@ if (typeof window !== "undefined") { debouncedReconnect = () => { if ( this.socket && - (this.socket.readyState == this.socket.OPEN || - this.socket.readyState == this.socket.CONNECTING) + (this.socket.readyState == this.socket.OPEN || this.socket.readyState == this.socket.CONNECTING) ) return; - this.nextReconnectAttempt = setTimeout( - this.attemptReconnect, - this.reconnectDelay, - ); + this.nextReconnectAttempt = setTimeout(this.attemptReconnect, this.reconnectDelay); }; attemptReconnect = () => { globalThis.clearTimeout(this.nextReconnectAttempt); if ( this.socket && - (this.socket.readyState == this.socket.OPEN || - this.socket.readyState == this.socket.CONNECTING) + (this.socket.readyState == this.socket.OPEN || this.socket.readyState == this.socket.CONNECTING) ) return; this.connect(); @@ -534,8 +470,7 @@ if (typeof window !== "undefined") { connect() { if ( this.socket && - (this.socket.readyState == this.socket.OPEN || - this.socket.readyState == this.socket.CONNECTING) + (this.socket.readyState == this.socket.OPEN || this.socket.readyState == this.socket.CONNECTING) ) return; @@ -583,10 +518,7 @@ if (typeof window !== "undefined") { case CSSImportState.Pending: { this.cssState = CSSImportState.Loading; // This means we can import without risk of FOUC - if ( - document.documentElement.innerText === "" && - !HMRClient.cssAutoFOUC - ) { + if (document.documentElement.innerText === "" && !HMRClient.cssAutoFOUC) { if (document.body) document.body.style.visibility = "hidden"; HMRClient.cssAutoFOUC = true; } @@ -670,11 +602,8 @@ if (typeof window !== "undefined") { resolve(); }; - link.onerror = (evt) => { - console.error( - `[CSS Importer] Error loading CSS file: ${urlString}\n`, - evt.toString(), - ); + link.onerror = evt => { + console.error(`[CSS Importer] Error loading CSS file: ${urlString}\n`, evt.toString()); reject(); }; document.head.appendChild(link); @@ -683,21 +612,14 @@ if (typeof window !== "undefined") { } static onError(event: ErrorEvent) { if ("error" in event && !!event.error) { - BunError.render( - event.error, - HMRClient.client ? HMRClient.client.cwd : "", - ); + BunError.render(event.error, HMRClient.client ? HMRClient.client.cwd : ""); } } static activate(verboseOrFastRefresh: boolean = false) { // Support browser-like envirnments where location and WebSocket exist // Maybe it'll work in Deno! Who knows. - if ( - this.client || - !("location" in globalThis) || - !("WebSocket" in globalThis) - ) { + if (this.client || !("location" in globalThis) || !("WebSocket" in globalThis)) { return; } @@ -757,9 +679,7 @@ if (typeof window !== "undefined") { reportBuildFailure(failure: API.WebsocketMessageBuildFailure) { BunError.render(failure, this.cwd); - console.group( - `Build failed: ${failure.module_path} (${failure.log.errors} errors)`, - ); + console.group(`Build failed: ${failure.module_path} (${failure.log.errors} errors)`); this.needsConsoleClear = true; for (let msg of failure.log.msgs) { var logFunction; @@ -830,13 +750,8 @@ if (typeof window !== "undefined") { return; } var bytes = - buffer.data.byteOffset + buffer.index + build.blob_length <= - buffer.data.buffer.byteLength - ? new Uint8Array( - buffer.data.buffer, - buffer.data.byteOffset + buffer.index, - build.blob_length, - ) + buffer.data.byteOffset + buffer.index + build.blob_length <= buffer.data.buffer.byteLength + ? new Uint8Array(buffer.data.buffer, buffer.data.byteOffset + buffer.index, build.blob_length) : (empty ||= new Uint8Array(0)); if (build.loader === API.Loader.css) { @@ -876,22 +791,13 @@ if (typeof window !== "undefined") { } if (end > 4 && buffer.data.length >= end + 4) { - new Uint8Array(this.hashBuffer.buffer).set( - buffer.data.subarray(end, end + 4), - ); + new Uint8Array(this.hashBuffer.buffer).set(buffer.data.subarray(end, end + 4)); hash = this.hashBuffer[0]; } // These are the bytes!! - var reload = new HotReload( - build.id, - index, - build, - bytes, - ReloadBehavior.hotReload, - hash || 0, - ); + var reload = new HotReload(build.id, index, build, bytes, ReloadBehavior.hotReload, hash || 0); bytes = null; reload.timings.notify = timestamp - build.from_timestamp; @@ -910,17 +816,10 @@ if (typeof window !== "undefined") { this.needsConsoleClear = false; } - __hmrlog.log( - `[${formatDuration(timings.total)}ms] Reloaded`, - filepath, - ); + __hmrlog.log(`[${formatDuration(timings.total)}ms] Reloaded`, filepath); }, - (err) => { - if ( - typeof err === "object" && - err && - err instanceof ThrottleModuleUpdateError - ) { + err => { + if (typeof err === "object" && err && err instanceof ThrottleModuleUpdateError) { return; } __hmrlog.error("Hot Module Reload failed!", err); @@ -940,13 +839,8 @@ if (typeof window !== "undefined") { } } - handleFileChangeNotification( - buffer: ByteBuffer, - timestamp: number, - copy_file_path: boolean, - ) { - const notification = - API.decodeWebsocketMessageFileChangeNotification(buffer); + handleFileChangeNotification(buffer: ByteBuffer, timestamp: number, copy_file_path: boolean) { + const notification = API.decodeWebsocketMessageFileChangeNotification(buffer); let file_path = ""; switch (notification.loader) { case API.Loader.css: { @@ -974,12 +868,7 @@ if (typeof window !== "undefined") { } } - return this.handleFileChangeNotificationBase( - timestamp, - notification, - file_path, - copy_file_path, - ); + return this.handleFileChangeNotificationBase(timestamp, notification, file_path, copy_file_path); } private handleFileChangeNotificationBase( @@ -1052,9 +941,7 @@ if (typeof window !== "undefined") { this.buildCommandBufWithFilePath = new Uint8Array(4096 + 256); } - const writeBuffer = !copy_file_path - ? this.buildCommandBuf - : this.buildCommandBufWithFilePath; + const writeBuffer = !copy_file_path ? this.buildCommandBuf : this.buildCommandBufWithFilePath; writeBuffer[0] = !copy_file_path ? API.WebsocketCommandKind.build : API.WebsocketCommandKind.build_with_file_path; @@ -1071,13 +958,8 @@ if (typeof window !== "undefined") { this.buildCommandUArray[0] = file_path.length; writeBuffer.set(this.buildCommandUArrayEight, 9); - const out = textEncoder.encodeInto( - file_path, - writeBuffer.subarray(13), - ); - this.socket.send( - this.buildCommandBufWithFilePath.subarray(0, 13 + out.written), - ); + const out = textEncoder.encodeInto(file_path, writeBuffer.subarray(13)); + this.socket.send(this.buildCommandBufWithFilePath.subarray(0, 13 + out.written)); } else { this.socket.send(this.buildCommandBuf); } @@ -1118,9 +1000,7 @@ if (typeof window !== "undefined") { const data = new Uint8Array(event.data); const message_header_byte_buffer = new ByteBuffer(data); const header = API.decodeWebsocketMessage(message_header_byte_buffer); - const buffer = new ByteBuffer( - data.subarray(message_header_byte_buffer.index), - ); + const buffer = new ByteBuffer(data.subarray(message_header_byte_buffer.index)); switch (header.kind) { case API.WebsocketMessageKind.build_fail: { @@ -1141,9 +1021,7 @@ if (typeof window !== "undefined") { return; } - const index = HMRModule.dependencies.graph - .subarray(0, HMRModule.dependencies.graph_used) - .indexOf(id); + const index = HMRModule.dependencies.graph.subarray(0, HMRModule.dependencies.graph_used).indexOf(id); var file_path: string = ""; var loader = API.Loader.js; if (index > -1) { @@ -1203,12 +1081,7 @@ if (typeof window !== "undefined") { } } - this.handleFileChangeNotificationBase( - timestamp, - { id, loader }, - file_path, - true, - ); + this.handleFileChangeNotificationBase(timestamp, { id, loader }, file_path, true); break; } case API.WebsocketMessageKind.file_change_notification: { @@ -1231,27 +1104,15 @@ if (typeof window !== "undefined") { switch (this.javascriptReloader) { case API.Reloader.fast_refresh: { - __hmrlog.log( - "HMR connected in", - formatDuration(now - clientStartTime), - "ms", - ); + __hmrlog.log("HMR connected in", formatDuration(now - clientStartTime), "ms"); break; } case API.Reloader.live: { - __hmrlog.log( - "Live reload connected in", - formatDuration(now - clientStartTime), - "ms", - ); + __hmrlog.log("Live reload connected in", formatDuration(now - clientStartTime), "ms"); break; } default: { - __hmrlog.log( - "Bun connected in", - formatDuration(now - clientStartTime), - "ms", - ); + __hmrlog.log("Bun connected in", formatDuration(now - clientStartTime), "ms"); break; } } @@ -1339,8 +1200,7 @@ if (typeof window !== "undefined") { const oldGraphUsed = HMRModule.dependencies.graph_used; var oldModule = - HMRModule.dependencies.modules.length > this.module_index && - HMRModule.dependencies.modules[this.module_index]; + HMRModule.dependencies.modules.length > this.module_index && HMRModule.dependencies.modules[this.module_index]; HMRModule.dependencies = orig_deps.fork(this.module_index); var blobURL = ""; @@ -1361,10 +1221,9 @@ if (typeof window !== "undefined") { : ""; try { - const blob = new Blob( - sourceMapURL.length > 0 ? [this.bytes, sourceMapURL] : [this.bytes], - { type: "text/javascript" }, - ); + const blob = new Blob(sourceMapURL.length > 0 ? [this.bytes, sourceMapURL] : [this.bytes], { + type: "text/javascript", + }); blobURL = URL.createObjectURL(blob); HMRModule.dependencies.blobToID.set(blobURL, this.module_id); await import(blobURL); @@ -1378,11 +1237,7 @@ if (typeof window !== "undefined") { this.bytes = null; if ("__BunRenderHMRError" in globalThis) { - globalThis.__BunRenderHMRError( - exception, - oldModule.file_path, - oldModule.id, - ); + globalThis.__BunRenderHMRError(exception, oldModule.file_path, oldModule.id); } oldModule = null; @@ -1436,26 +1291,18 @@ if (typeof window !== "undefined") { if (!isOldModuleDead) { oldModule.boundUpdate ||= oldModule.update.bind(oldModule); - if (thisMod.additional_updaters) - thisMod.additional_updaters.add(oldModule.boundUpdate); - else - thisMod.additional_updaters = new Set([ - oldModule.boundUpdate, - ]); + if (thisMod.additional_updaters) thisMod.additional_updaters.add(oldModule.boundUpdate); + else thisMod.additional_updaters = new Set([oldModule.boundUpdate]); thisMod.previousVersion = oldModule; } else { - if (oldModule.previousVersion) - thisMod.previousVersion = oldModule.previousVersion; + if (oldModule.previousVersion) thisMod.previousVersion = oldModule.previousVersion; thisMod.additional_updaters = origUpdaters; } } - const end = Math.min( - this.module_index + 1, - HMRModule.dependencies.graph_used, - ); + const end = Math.min(this.module_index + 1, HMRModule.dependencies.graph_used); // -- For generic hot reloading -- // ES Modules delay execution until all imports are parsed // They execute depth-first @@ -1505,10 +1352,7 @@ if (typeof window !== "undefined") { // By the time we get here, it's entirely possible that another update is waiting // Instead of scheduling it, we are going to just ignore this update. // But we still need to re-initialize modules regardless because otherwise a dependency may not reload properly - if ( - pendingUpdateCount === currentPendingUpdateCount && - foundBoundary - ) { + if (pendingUpdateCount === currentPendingUpdateCount && foundBoundary) { FastRefreshLoader.RefreshRuntime.performReactRefresh(); // Remove potential memory leak if (isOldModuleDead) oldModule.previousVersion = null; @@ -1527,8 +1371,7 @@ if (typeof window !== "undefined") { } } catch (exception) { HMRModule.dependencies = orig_deps; - HMRModule.dependencies.modules[this.module_index].additional_updaters = - origUpdaters; + HMRModule.dependencies.modules[this.module_index].additional_updaters = origUpdaters; throw exception; } this.timings.callbacks = performance.now() - callbacksStart; @@ -1544,12 +1387,8 @@ if (typeof window !== "undefined") { } orig_deps = null; - this.timings.total = - this.timings.import + this.timings.callbacks + this.timings.notify; - return Promise.resolve([ - HMRModule.dependencies.modules[this.module_index], - this.timings, - ]); + this.timings.total = this.timings.import + this.timings.callbacks + this.timings.notify; + return Promise.resolve([HMRModule.dependencies.modules[this.module_index], this.timings]); } } @@ -1625,9 +1464,7 @@ if (typeof window !== "undefined") { // Grow the dependencies graph if (HMRModule.dependencies.graph.length <= this.graph_index) { - const new_graph = new Uint32Array( - HMRModule.dependencies.graph.length * 4, - ); + const new_graph = new Uint32Array(HMRModule.dependencies.graph.length * 4); new_graph.set(HMRModule.dependencies.graph); HMRModule.dependencies.graph = new_graph; @@ -1712,11 +1549,8 @@ if (typeof window !== "undefined") { // 4,000,000,000 in base36 occupies 7 characters // file path is probably longer // small strings are better strings - this.refreshRuntimeBaseID = - (this.file_path.length > 7 ? this.id.toString(36) : this.file_path) + - "/"; - FastRefreshLoader.RefreshRuntime = - FastRefreshLoader.RefreshRuntime || RefreshRuntime; + this.refreshRuntimeBaseID = (this.file_path.length > 7 ? this.id.toString(36) : this.file_path) + "/"; + FastRefreshLoader.RefreshRuntime = FastRefreshLoader.RefreshRuntime || RefreshRuntime; if (!FastRefreshLoader.hasInjectedFastRefresh) { RefreshRuntime.injectIntoGlobalHook(globalThis); @@ -1729,10 +1563,7 @@ if (typeof window !== "undefined") { // $RefreshReg$ $r_(Component: any, id: string) { - FastRefreshLoader.RefreshRuntime.register( - Component, - this.refreshRuntimeBaseID + id, - ); + FastRefreshLoader.RefreshRuntime.register(Component, this.refreshRuntimeBaseID + id); } // $RefreshReg$(Component, Component.name || Component.displayName) $r(Component: any) { @@ -1767,12 +1598,7 @@ if (typeof window !== "undefined") { // Ensure exported React components always have names // This is for simpler debugging - if ( - Component && - typeof Component === "function" && - !("name" in Component) && - Object.isExtensible(Component) - ) { + if (Component && typeof Component === "function" && !("name" in Component) && Object.isExtensible(Component)) { const named = { get() { return key; @@ -1791,9 +1617,7 @@ if (typeof window !== "undefined") { } catch (exception) {} } - if ( - !FastRefreshLoader.RefreshRuntime.isLikelyComponentType(Component) - ) { + if (!FastRefreshLoader.RefreshRuntime.isLikelyComponentType(Component)) { onlyExportsComponents = false; // We can't stop here because we may have other exports which are components that need to be registered. continue; diff --git a/src/runtime/regenerator.ts b/src/runtime/regenerator.ts index 0940fb9f1e..a3a7ba75ed 100644 --- a/src/runtime/regenerator.ts +++ b/src/runtime/regenerator.ts @@ -37,8 +37,7 @@ var runtime = (function (exports) { function wrap(innerFn, outerFn, self, tryLocsList) { // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. - var protoGenerator = - outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context = new Context(tryLocsList || []); @@ -104,18 +103,11 @@ var runtime = (function (exports) { IteratorPrototype = NativeIteratorPrototype; } - var Gp = - (GeneratorFunctionPrototype.prototype = - Generator.prototype = - Object.create(IteratorPrototype)); + var Gp = (GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype)); GeneratorFunction.prototype = GeneratorFunctionPrototype; define(Gp, "constructor", GeneratorFunctionPrototype); define(GeneratorFunctionPrototype, "constructor", GeneratorFunction); - GeneratorFunction.displayName = define( - GeneratorFunctionPrototype, - toStringTagSymbol, - "GeneratorFunction", - ); + GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the // Iterator interface in terms of a single ._invoke method. @@ -164,11 +156,7 @@ var runtime = (function (exports) { } else { var result = record.arg; var value = result.value; - if ( - value && - typeof value === "object" && - hasOwn.call(value, "__await") - ) { + if (value && typeof value === "object" && hasOwn.call(value, "__await")) { return PromiseImpl.resolve(value.__await).then( function (value) { invoke("next", value, resolve, reject); @@ -245,10 +233,7 @@ var runtime = (function (exports) { exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { if (PromiseImpl === void 0) PromiseImpl = Promise; - var iter = new AsyncIterator( - wrap(innerFn, outerFn, self, tryLocsList), - PromiseImpl, - ); + var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. @@ -358,9 +343,7 @@ var runtime = (function (exports) { } context.method = "throw"; - context.arg = new TypeError( - "The iterator does not provide a 'throw' method", - ); + context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; @@ -551,11 +534,7 @@ var runtime = (function (exports) { if (!skipTempReset) { for (var name in this) { // Not sure about the optimal order of these conditions: - if ( - name.charAt(0) === "t" && - hasOwn.call(this, name) && - !isNaN(+name.slice(1)) - ) { + if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { this[name] = undefined; } } @@ -634,11 +613,7 @@ var runtime = (function (exports) { abrupt: function (type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; - if ( - entry.tryLoc <= this.prev && - hasOwn.call(entry, "finallyLoc") && - this.prev < entry.finallyLoc - ) { + if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } diff --git a/src/string_immutable.zig b/src/string_immutable.zig index e5a37006ae..e85fc4ef81 100644 --- a/src/string_immutable.zig +++ b/src/string_immutable.zig @@ -588,7 +588,7 @@ pub inline fn endsWithChar(self: string, char: u8) bool { pub fn withoutTrailingSlash(this: string) []const u8 { var href = this; while (href.len > 1 and href[href.len - 1] == '/') { - href = href[0 .. href.len - 1]; + href.len -= 1; } return href; diff --git a/src/test/fixtures/double-export-default-bug.jsx b/src/test/fixtures/double-export-default-bug.jsx index 3db411bb06..18f5165f91 100644 --- a/src/test/fixtures/double-export-default-bug.jsx +++ b/src/test/fixtures/double-export-default-bug.jsx @@ -20,8 +20,7 @@ export default function Home() {

- Get started by editing{" "} - pages/index.js + Get started by editing pages/index.js

@@ -35,10 +34,7 @@ export default function Home() {

Learn about Next.js in an interactive course with quizzes!

- +

Examples →

Discover and deploy boilerplate example Next.js projects.

@@ -48,9 +44,7 @@ export default function Home() { className={styles.card} >

Deploy →

-

- Instantly deploy your Next.js site to a public URL with Vercel. -

+

Instantly deploy your Next.js site to a public URL with Vercel.

diff --git a/src/test/fixtures/simple-150x.jsx b/src/test/fixtures/simple-150x.jsx index 64cb88b1b8..3ec65431c0 100644 --- a/src/test/fixtures/simple-150x.jsx +++ b/src/test/fixtures/simple-150x.jsx @@ -27,19 +27,10 @@ import { SPACING } from "../helpers/styles"; return ( - +
- + {profile.name}
@@ -111,18 +102,16 @@ import { SPACING } from "../helpers/styles"; }; } - setEmail = (evt) => this.setState({ email: evt.target.value }); + setEmail = evt => this.setState({ email: evt.target.value }); componentDidMount() { Router.prefetchRoute(`/sign-up/verify`); } - handleSubmit = (evt) => { + handleSubmit = evt => { evt.preventDefault(); - Router.pushRoute( - `/sign-up/verify?${qs.stringify({ email: this.state.email })}`, - ); + Router.pushRoute(`/sign-up/verify?${qs.stringify({ email: this.state.email })}`); }; render() { @@ -223,24 +212,15 @@ import { SPACING } from "../helpers/styles";
- +
- + Your own game of The Bachelor(ette)
- Create a page where people apply to go on a date with you. - You pick the winners. + Create a page where people apply to go on a date with you. You pick the winners.
@@ -282,9 +262,7 @@ import { SPACING } from "../helpers/styles"; {this.state.isLoadingProfiles &&
}
{!_.isEmpty(this.state.profiles) && - this.state.profiles.map((profile) => ( - - ))} + this.state.profiles.map(profile => )}
@@ -438,7 +416,7 @@ import { SPACING } from "../helpers/styles"; } } - const HomepageWithStore = withRedux(initStore, null, (dispatch) => + const HomepageWithStore = withRedux(initStore, null, dispatch => bindActionCreators({ updateEntities, setCurrentUser }, dispatch), )(LoginGate(Homepage)); })(); diff --git a/src/test/fixtures/simple.jsx b/src/test/fixtures/simple.jsx index 63873fe8d4..98d01235bb 100644 --- a/src/test/fixtures/simple.jsx +++ b/src/test/fixtures/simple.jsx @@ -25,19 +25,10 @@ const FeaturedProfile = ({ profile }) => { return (
- +
- + {profile.name}
@@ -109,18 +100,16 @@ class SignupForm extends React.Component { }; } - setEmail = (evt) => this.setState({ email: evt.target.value }); + setEmail = evt => this.setState({ email: evt.target.value }); componentDidMount() { Router.prefetchRoute(`/sign-up/verify`); } - handleSubmit = (evt) => { + handleSubmit = evt => { evt.preventDefault(); - Router.pushRoute( - `/sign-up/verify?${qs.stringify({ email: this.state.email })}`, - ); + Router.pushRoute(`/sign-up/verify?${qs.stringify({ email: this.state.email })}`); }; render() { @@ -229,8 +218,7 @@ class Homepage extends React.Component {
- Create a page where people apply to go on a date with you. You - pick the winners. + Create a page where people apply to go on a date with you. You pick the winners.
@@ -272,9 +260,7 @@ class Homepage extends React.Component { {this.state.isLoadingProfiles &&
}
{!_.isEmpty(this.state.profiles) && - this.state.profiles.map((profile) => ( - - ))} + this.state.profiles.map(profile => )}
@@ -428,7 +414,7 @@ class Homepage extends React.Component { } } -const HomepageWithStore = withRedux(initStore, null, (dispatch) => +const HomepageWithStore = withRedux(initStore, null, dispatch => bindActionCreators({ updateEntities, setCurrentUser }, dispatch), )(LoginGate(Homepage)); diff --git a/test/bun.js/.prettierignore b/test/bun.js/.prettierignore new file mode 100644 index 0000000000..91b589eb2a --- /dev/null +++ b/test/bun.js/.prettierignore @@ -0,0 +1,2 @@ +node_modules +third-party diff --git a/test/bun.js/baz.js b/test/bun.js/baz.js index 5837bb3bbb..58a9bb4b04 100644 --- a/test/bun.js/baz.js +++ b/test/bun.js/baz.js @@ -1,2 +1,3 @@ // this file is used in resolve.test.js +// export default {}; diff --git a/test/bun.js/buffer.test.js b/test/bun.js/buffer.test.js index 0dcf96816b..b8fade4d23 100644 --- a/test/bun.js/buffer.test.js +++ b/test/bun.js/buffer.test.js @@ -2552,7 +2552,10 @@ it("should not perform out-of-bound access on invalid UTF-8 byte sequence", () = }); it("repro #2063", () => { - const buf = Buffer.from("eyJlbWFpbCI6Ijg3MTg4NDYxN0BxcS5jb20iLCJpZCI6OCwicm9sZSI6Im5vcm1hbCIsImlhdCI6MTY3NjI4NDQyMSwiZXhwIjoxNjc2ODg5MjIxfQ", 'base64'); + const buf = Buffer.from( + "eyJlbWFpbCI6Ijg3MTg4NDYxN0BxcS5jb20iLCJpZCI6OCwicm9sZSI6Im5vcm1hbCIsImlhdCI6MTY3NjI4NDQyMSwiZXhwIjoxNjc2ODg5MjIxfQ", + "base64", + ); expect(buf.length).toBe(85); expect(buf[82]).toBe(50); expect(buf[83]).toBe(49); diff --git a/test/bun.js/bun-server.test.ts b/test/bun.js/bun-server.test.ts index 6e0eab6fd1..52574d2a38 100644 --- a/test/bun.js/bun-server.test.ts +++ b/test/bun.js/bun-server.test.ts @@ -131,14 +131,16 @@ describe("Server", () => { return new Response( new ReadableStream({ async pull(controller) { + console.trace("here"); abortController.abort(); const buffer = await Bun.file(import.meta.dir + "/fixture.html.gz").arrayBuffer(); + console.trace("here"); controller.enqueue(buffer); + console.trace("here"); //wait to detect the connection abortion await Bun.sleep(15); - controller.close(); }, }), @@ -155,11 +157,15 @@ describe("Server", () => { }); try { + console.trace("here"); await fetch(`http://${server.hostname}:${server.port}`, { signal: abortController.signal }); } catch {} await Bun.sleep(10); + console.trace("here"); expect(signalOnServer).toBe(true); + console.trace("here"); server.stop(true); + console.trace("here"); } }); }); diff --git a/test/bun.js/bun-write.test.js b/test/bun.js/bun-write.test.js index 68e221d519..c324d36a04 100644 --- a/test/bun.js/bun-write.test.js +++ b/test/bun.js/bun-write.test.js @@ -142,7 +142,7 @@ it("Bun.file", async () => { it("Bun.file empty file", async () => { const file = path.join(import.meta.dir, "emptyFile"); await gcTick(); - const buffer = await Bun.file(file).arrayBuffer() + const buffer = await Bun.file(file).arrayBuffer(); expect(buffer.byteLength).toBe(0); await gcTick(); }); diff --git a/test/bun.js/disabled-module.test.js b/test/bun.js/disabled-module.test.js index c12676959c..61411aa447 100644 --- a/test/bun.js/disabled-module.test.js +++ b/test/bun.js/disabled-module.test.js @@ -1,38 +1,72 @@ import { expect, test } from "bun:test"; -test("not implemented yet module masquerades as undefined and throws an error", () => { - const worker_threads = import.meta.require("worker_threads"); +// test("not implemented yet module masquerades as undefined and throws an error", () => { +// const worker_threads = import.meta.require("worker_threads"); - expect(typeof worker_threads).toBe("undefined"); - expect(typeof worker_threads.getEnvironmentData).toBe("undefined"); +// expect(typeof worker_threads).toBe("undefined"); +// expect(typeof worker_threads.getEnvironmentData).toBe("undefined"); +// }); + +test("AsyncContext", async done => { + const { AsyncContext } = import.meta.require("async_hooks"); + console.log("here"); + const ctx = new AsyncContext(); + ctx + .run(1234, async () => { + expect(ctx.get()).toBe(1234); + console.log("here"); + await 1; + console.log("ctx", ctx.get()); + const setTimeoutResult = await ctx.run( + 2345, + () => + new Promise(resolve => { + queueMicrotask(() => { + console.log("queueMicrotask", ctx.get()); + resolve(ctx.get()); + }); + }), + ); + expect(setTimeoutResult).toBe(2345); + expect(ctx.get()).toBe(1234); + return "final result"; + }) + .then(result => { + expect(result).toBe("final result"); + // The code that generated the Promise has access to the 1234 + // value provided to ctx.run above, but consumers of the Promise + // do not automatically inherit it. + expect(ctx.get()).toBeUndefined(); + done(); + }); }); -test("AsyncLocalStorage polyfill", () => { - const { AsyncLocalStorage } = import.meta.require("async_hooks"); +// test("AsyncLocalStorage polyfill", () => { +// const { AsyncLocalStorage } = import.meta.require("async_hooks"); - const store = new AsyncLocalStorage(); - var called = false; - expect(store.getStore()).toBe(null); - store.run({ foo: "bar" }, () => { - expect(store.getStore()).toEqual({ foo: "bar" }); - called = true; - }); - expect(store.getStore()).toBe(null); - expect(called).toBe(true); -}); +// const store = new AsyncLocalStorage(); +// var called = false; +// expect(store.getStore()).toBe(null); +// store.run({ foo: "bar" }, () => { +// expect(store.getStore()).toEqual({ foo: "bar" }); +// called = true; +// }); +// expect(store.getStore()).toBe(null); +// expect(called).toBe(true); +// }); -test("AsyncResource polyfill", () => { - const { AsyncResource } = import.meta.require("async_hooks"); +// test("AsyncResource polyfill", () => { +// const { AsyncResource } = import.meta.require("async_hooks"); - const resource = new AsyncResource("test"); - var called = false; - resource.runInAsyncScope( - () => { - called = true; - }, - null, - "foo", - "bar", - ); - expect(called).toBe(true); -}); +// const resource = new AsyncResource("test"); +// var called = false; +// resource.runInAsyncScope( +// () => { +// called = true; +// }, +// null, +// "foo", +// "bar", +// ); +// expect(called).toBe(true); +// }); diff --git a/test/bun.js/fetch.test.js b/test/bun.js/fetch.test.js index e0f4c7d433..be64a01093 100644 --- a/test/bun.js/fetch.test.js +++ b/test/bun.js/fetch.test.js @@ -554,7 +554,7 @@ describe("Bun.file", () => { testBlobInterface(data => { const blob = new Blob([data]); const buffer = Bun.peek(blob.arrayBuffer()); - const path = join(tempdir , "tmp-" + callCount++ + ".bytes"); + const path = join(tempdir, "tmp-" + callCount++ + ".bytes"); require("fs").writeFileSync(path, buffer); const file = Bun.file(path); expect(blob.size).toBe(file.size); diff --git a/test/bun.js/fetch_headers.test.js b/test/bun.js/fetch_headers.test.js index 7f8fab1888..2e5b9fa52b 100644 --- a/test/bun.js/fetch_headers.test.js +++ b/test/bun.js/fetch_headers.test.js @@ -19,17 +19,17 @@ describe("Headers", async () => { }); it("Headers should work", async () => { - expect(await fetchContent({"x-test": "header 1"})).toBe("header 1"); + expect(await fetchContent({ "x-test": "header 1" })).toBe("header 1"); }); it("Header names must be valid", async () => { - expect(() => fetch(url, {headers: {"a\tb:c": "foo" }})).toThrow("Invalid header name: 'a\tb:c'"); - expect(() => fetch(url, {headers: {"❤️": "foo" }})).toThrow("Invalid header name: '❤️'"); + expect(() => fetch(url, { headers: { "a\tb:c": "foo" } })).toThrow("Invalid header name: 'a\tb:c'"); + expect(() => fetch(url, { headers: { "❤️": "foo" } })).toThrow("Invalid header name: '❤️'"); }); it("Header values must be valid", async () => { - expect(() => fetch(url, {headers: {"x-test": "\0" }})).toThrow("Header 'x-test' has invalid value: '\0'"); - expect(() => fetch(url, {headers: {"x-test": "❤️" }})).toThrow("Header 'x-test' has invalid value: '❤️'"); + expect(() => fetch(url, { headers: { "x-test": "\0" } })).toThrow("Header 'x-test' has invalid value: '\0'"); + expect(() => fetch(url, { headers: { "x-test": "❤️" } })).toThrow("Header 'x-test' has invalid value: '❤️'"); }); it("repro 1602", async () => { @@ -42,17 +42,13 @@ describe("Headers", async () => { expect(roundTripString).toBe(origString); // This one will pass - expect(await fetchContent({"x-test": roundTripString})).toBe(roundTripString); + expect(await fetchContent({ "x-test": roundTripString })).toBe(roundTripString); // This would hang - expect(await fetchContent({"x-test": origString})).toBe(origString); + expect(await fetchContent({ "x-test": origString })).toBe(origString); }); }); async function fetchContent(headers) { - const res = await fetch( - url, - { headers: headers }, - { verbose: true } - ); + const res = await fetch(url, { headers: headers }, { verbose: true }); return await res.text(); } diff --git a/test/bun.js/repro_2005.test.js b/test/bun.js/repro_2005.test.js index bd80ab7dd9..dc0cd9a975 100644 --- a/test/bun.js/repro_2005.test.js +++ b/test/bun.js/repro_2005.test.js @@ -8,5 +8,4 @@ it("regex literal with non-Latin1 should work", () => { //Incorrect result: 这是一段要替换的文字 expect(text.replace(/要替换/, "")).toBe("这是一段的文字"); - }); diff --git a/test/snippets/code-simplification-neql-define.js b/test/snippets/code-simplification-neql-define.js index c7676dc9b6..bd7ab92072 100644 --- a/test/snippets/code-simplification-neql-define.js +++ b/test/snippets/code-simplification-neql-define.js @@ -2,7 +2,7 @@ var testFailed = false; const invariant = () => { testFailed = true; }; -var $$m = (arg) => { +var $$m = arg => { var module = { exports: {} }, exports = module.exports; return arg(module, exports); @@ -12,31 +12,19 @@ var size = 100, export var $f332019d = $$m( { - "relay-runtime/lib/network/RelayQueryResponseCache.js": ( - module, - exports, - ) => { + "relay-runtime/lib/network/RelayQueryResponseCache.js": (module, exports) => { var RelayQueryResponseCache = function () { var foo = function RelayQueryResponseCache(_ref) { var size = _ref.size, ttl = _ref.ttl; !(size > 0) ? process.env.NODE_ENV !== "production" - ? invariant( - false, - "RelayQueryResponseCache: Expected the max cache size to be > 0, got " + - "`%s`.", - size, - ) + ? invariant(false, "RelayQueryResponseCache: Expected the max cache size to be > 0, got " + "`%s`.", size) : invariant(false) : void 0; !(ttl > 0) ? process.env.NODE_ENV !== "production" - ? invariant( - false, - "RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.", - ttl, - ) + ? invariant(false, "RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.", ttl) : invariant(false) : void 0; }; diff --git a/test/snippets/export.js b/test/snippets/export.js index 2a757269fe..bf334f025f 100644 --- a/test/snippets/export.js +++ b/test/snippets/export.js @@ -21,9 +21,6 @@ export function test() { if (where.default !== "hi") { throw new Error(`_auth import is incorrect.`); } - console.assert( - powerLevel.description === "9001", - "Symbol is not exported correctly", - ); + console.assert(powerLevel.description === "9001", "Symbol is not exported correctly"); return testDone(import.meta.url); } diff --git a/test/snippets/jsx-entities.jsx b/test/snippets/jsx-entities.jsx index ac5d32225e..7123fd6745 100644 --- a/test/snippets/jsx-entities.jsx +++ b/test/snippets/jsx-entities.jsx @@ -926,10 +926,7 @@ export function test() { key = txt.value; } - console.assert( - elements[rawKey] === key.codePointAt(0), - `${key} is not ${elements[rawKey]}`, - ); + console.assert(elements[rawKey] === key.codePointAt(0), `${key} is not ${elements[rawKey]}`); } return testDone(import.meta.url); diff --git a/test/snippets/latin1-chars-in-regexp.js b/test/snippets/latin1-chars-in-regexp.js index 1a533b1e18..0ba85d1000 100644 --- a/test/snippets/latin1-chars-in-regexp.js +++ b/test/snippets/latin1-chars-in-regexp.js @@ -10,40 +10,24 @@ export var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; export var re_btou = new RegExp( - [ - "[\xC0-\xDF][\x80-\xBF]", - "[\xE0-\xEF][\x80-\xBF]{2}", - "[\xF0-\xF7][\x80-\xBF]{3}", - ].join("|"), + ["[\xC0-\xDF][\x80-\xBF]", "[\xE0-\xEF][\x80-\xBF]{2}", "[\xF0-\xF7][\x80-\xBF]{3}"].join("|"), "g", ); const encoder = new TextEncoder(); -const realLines = [ - "[\xC0-\xDF][\x80-\xBF]", - "[\xE0-\xEF][\x80-\xBF]{2}", - "[\xF0-\xF7][\x80-\xBF]{3}", -]; -const real = realLines.map((input) => Array.from(encoder.encode(input))); +const realLines = ["[\xC0-\xDF][\x80-\xBF]", "[\xE0-\xEF][\x80-\xBF]{2}", "[\xF0-\xF7][\x80-\xBF]{3}"]; +const real = realLines.map(input => Array.from(encoder.encode(input))); const expected = [ [91, 195, 128, 45, 195, 159, 93, 91, 194, 128, 45, 194, 191, 93], - [ - 91, 195, 160, 45, 195, 175, 93, 91, 194, 128, 45, 194, 191, 93, 123, 50, - 125, - ], - [ - 91, 195, 176, 45, 195, 183, 93, 91, 194, 128, 45, 194, 191, 93, 123, 51, - 125, - ], + [91, 195, 160, 45, 195, 175, 93, 91, 194, 128, 45, 194, 191, 93, 123, 50, 125], + [91, 195, 176, 45, 195, 183, 93, 91, 194, 128, 45, 194, 191, 93, 123, 51, 125], ]; const newlinePreserved = `\n`; export function test() { - if ( - !real.every((point, i) => point.every((val, j) => val === expected[i][j])) - ) { + if (!real.every((point, i) => point.every((val, j) => val === expected[i][j]))) { throw new Error( `test failed ${JSON.stringify({ expected, real }, null, 2)}`, @@ -55,11 +39,7 @@ ${JSON.stringify({ expected, real }, null, 2)}`, } const decoder = new TextDecoder("utf8"); - if ( - !realLines.every( - (line, i) => decoder.decode(Uint8Array.from(expected[i])) === line, - ) - ) { + if (!realLines.every((line, i) => decoder.decode(Uint8Array.from(expected[i])) === line)) { throw new Error( `test failed. Lines did not match. ${JSON.stringify({ expected, real }, null, 2)}`, diff --git a/test/snippets/optional-chain-with-function.js b/test/snippets/optional-chain-with-function.js index 82ad51d465..841c8a5848 100644 --- a/test/snippets/optional-chain-with-function.js +++ b/test/snippets/optional-chain-with-function.js @@ -3,10 +3,10 @@ export function test() { const multipleSecondaryValues = undefined; const ratings = ["123"]; - var bar = multipleSecondaryValues?.map((value) => false); - bar = bar?.multipleSecondaryValues?.map((value) => false); - bar = bar?.bar?.multipleSecondaryValues?.map((value) => false); - bar = {}?.bar?.multipleSecondaryValues?.map((value) => false); + var bar = multipleSecondaryValues?.map(value => false); + bar = bar?.multipleSecondaryValues?.map(value => false); + bar = bar?.bar?.multipleSecondaryValues?.map(value => false); + bar = {}?.bar?.multipleSecondaryValues?.map(value => false); } catch (e) { throw e; } diff --git a/test/snippets/react-context-value-func.tsx b/test/snippets/react-context-value-func.tsx index e7ced1292e..800ad428d7 100644 --- a/test/snippets/react-context-value-func.tsx +++ b/test/snippets/react-context-value-func.tsx @@ -12,7 +12,7 @@ const ContextProvider = ({ children }) => { const ContextValue = ({}) => ( - {(foo) => { + {foo => { if (foo) { return
Worked!
; } diff --git a/test/snippets/simple-lit-example.ts b/test/snippets/simple-lit-example.ts index 3c53f03abf..1b10b61db7 100644 --- a/test/snippets/simple-lit-example.ts +++ b/test/snippets/simple-lit-example.ts @@ -3,7 +3,7 @@ import { LitElement, html, css } from "lit"; import { customElement, property, eventOptions } from "lit/decorators.js"; var loadedResolve; -var loadedPromise = new Promise((resolve) => { +var loadedPromise = new Promise(resolve => { loadedResolve = resolve; }); @@ -35,11 +35,7 @@ export class MyElement extends LitElement { @property() planet = "Earth"; render() { - return html` - ${this.planet} - `; + return html` ${this.planet} `; } @eventOptions({ once: true }) diff --git a/test/snippets/spread_with_key.tsx b/test/snippets/spread_with_key.tsx index d9f842d27f..2dc0c70726 100644 --- a/test/snippets/spread_with_key.tsx +++ b/test/snippets/spread_with_key.tsx @@ -4,12 +4,7 @@ import React from "react"; export function SpreadWithTheKey({ className }: Props) { const rest = {}; return ( -
console.log("click")} - > +
console.log("click")}> Rendered component containing warning
); diff --git a/test/snippets/string-escapes.js b/test/snippets/string-escapes.js index 436140939f..5fbc8da6cc 100644 --- a/test/snippets/string-escapes.js +++ b/test/snippets/string-escapes.js @@ -30,31 +30,23 @@ const encoder = new TextEncoder(); const encodedObj = encoder.encode(JSON.stringify(obj)); // ------------------------------------------------------------ const correctEncodedObj = [ - 123, 34, 92, 114, 92, 110, 34, 58, 34, 92, 114, 92, 110, 34, 44, 34, 92, 110, - 34, 58, 34, 92, 110, 34, 44, 34, 92, 116, 34, 58, 34, 92, 116, 34, 44, 34, 92, - 102, 34, 58, 34, 92, 102, 34, 44, 34, 92, 117, 48, 48, 48, 98, 34, 58, 34, 92, - 117, 48, 48, 48, 98, 34, 44, 34, 226, 128, 168, 34, 58, 34, 226, 128, 168, 34, - 44, 34, 226, 128, 169, 34, 58, 34, 226, 128, 169, 34, 44, 34, 92, 117, 48, 48, - 48, 48, 34, 58, 34, 92, 117, 48, 48, 48, 48, 194, 160, 110, 117, 108, 108, 32, - 98, 121, 116, 101, 34, 44, 34, 240, 159, 152, 138, 34, 58, 34, 240, 159, 152, - 138, 34, 44, 34, 240, 159, 152, 131, 34, 58, 34, 240, 159, 152, 131, 34, 44, - 34, 240, 159, 149, 181, 240, 159, 143, 189, 226, 128, 141, 226, 153, 130, 239, - 184, 143, 34, 58, 34, 240, 159, 149, 181, 240, 159, 143, 189, 226, 128, 141, - 226, 153, 130, 239, 184, 143, 34, 44, 34, 227, 139, 161, 34, 58, 34, 227, 139, - 161, 34, 44, 34, 226, 152, 186, 34, 58, 34, 226, 152, 186, 34, 44, 34, 227, - 130, 183, 34, 58, 34, 227, 130, 183, 34, 44, 34, 240, 159, 145, 139, 34, 58, - 34, 240, 159, 145, 139, 34, 44, 34, 102, 34, 58, 34, 226, 130, 135, 34, 44, - 34, 226, 152, 185, 34, 58, 34, 226, 152, 185, 34, 44, 34, 226, 152, 187, 34, - 58, 34, 226, 152, 187, 34, 44, 34, 99, 104, 105, 108, 100, 114, 101, 110, 34, - 58, 49, 50, 51, 125, + 123, 34, 92, 114, 92, 110, 34, 58, 34, 92, 114, 92, 110, 34, 44, 34, 92, 110, 34, 58, 34, 92, 110, 34, 44, 34, 92, + 116, 34, 58, 34, 92, 116, 34, 44, 34, 92, 102, 34, 58, 34, 92, 102, 34, 44, 34, 92, 117, 48, 48, 48, 98, 34, 58, 34, + 92, 117, 48, 48, 48, 98, 34, 44, 34, 226, 128, 168, 34, 58, 34, 226, 128, 168, 34, 44, 34, 226, 128, 169, 34, 58, 34, + 226, 128, 169, 34, 44, 34, 92, 117, 48, 48, 48, 48, 34, 58, 34, 92, 117, 48, 48, 48, 48, 194, 160, 110, 117, 108, 108, + 32, 98, 121, 116, 101, 34, 44, 34, 240, 159, 152, 138, 34, 58, 34, 240, 159, 152, 138, 34, 44, 34, 240, 159, 152, 131, + 34, 58, 34, 240, 159, 152, 131, 34, 44, 34, 240, 159, 149, 181, 240, 159, 143, 189, 226, 128, 141, 226, 153, 130, 239, + 184, 143, 34, 58, 34, 240, 159, 149, 181, 240, 159, 143, 189, 226, 128, 141, 226, 153, 130, 239, 184, 143, 34, 44, 34, + 227, 139, 161, 34, 58, 34, 227, 139, 161, 34, 44, 34, 226, 152, 186, 34, 58, 34, 226, 152, 186, 34, 44, 34, 227, 130, + 183, 34, 58, 34, 227, 130, 183, 34, 44, 34, 240, 159, 145, 139, 34, 58, 34, 240, 159, 145, 139, 34, 44, 34, 102, 34, + 58, 34, 226, 130, 135, 34, 44, 34, 226, 152, 185, 34, 58, 34, 226, 152, 185, 34, 44, 34, 226, 152, 187, 34, 58, 34, + 226, 152, 187, 34, 44, 34, 99, 104, 105, 108, 100, 114, 101, 110, 34, 58, 49, 50, 51, 125, ]; export const jsxVariants = ( <> - "\r\n": "\r\n", "\n": "\n", "\t": "\t", "\f": "\f", "\v": "\v", "\u2028": - "\u2028", "\u2029": "\u2029", "😊": "😊", "😃": "😃", "🕵🏽‍♂️": "🕵🏽‍♂️", "㋡": - "㋡", "☺": "☺", シ: "シ", "👋": "👋", f: f, "☹": "☹", "☻": "☻", children: - 123, + "\r\n": "\r\n", "\n": "\n", "\t": "\t", "\f": "\f", "\v": "\v", "\u2028": "\u2028", "\u2029": "\u2029", "😊": "😊", + "😃": "😃", "🕵🏽‍♂️": "🕵🏽‍♂️", "㋡": "㋡", "☺": "☺", シ: "シ", "👋": "👋", f: f, "☹": "☹", "☻": "☻", children: 123,
diff --git a/test/snippets/styledcomponents-output.js b/test/snippets/styledcomponents-output.js index fca6e84078..91c8717705 100644 --- a/test/snippets/styledcomponents-output.js +++ b/test/snippets/styledcomponents-output.js @@ -3,8 +3,7 @@ import React from "react"; import ReactDOM from "react-dom"; const ErrorScreenRoot = styled.div` - font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, - sans-serif; + font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; position: fixed; top: 0; left: 0; @@ -18,8 +17,7 @@ const ErrorScreenRoot = styled.div` text-align: center; background-color: #0b2988; color: #fff; - font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, - sans-serif; + font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; line-height: 1.5em; & > p { @@ -35,23 +33,15 @@ export function test() { if (typeof window !== "undefined") { const reactEl = document.createElement("div"); document.body.appendChild(reactEl); - ReactDOM.render( - - The react child should have this text - , - reactEl, - ); + ReactDOM.render(The react child should have this text, reactEl); const style = document.querySelector("style[data-styled]"); console.assert(style, "style tag should exist"); console.assert( - style.textContent.split("").every((a) => a.codePointAt(0) < 128), + style.textContent.split("").every(a => a.codePointAt(0) < 128), "style tag should not contain invalid unicode codepoints", ); - console.assert( - document.querySelector("#error-el").textContent === - "The react child should have this text", - ); + console.assert(document.querySelector("#error-el").textContent === "The react child should have this text"); ReactDOM.unmountComponentAtNode(reactEl); reactEl.remove(); diff --git a/test/snippets/template-literal.js b/test/snippets/template-literal.js index a5749a5553..8d8f649171 100644 --- a/test/snippets/template-literal.js +++ b/test/snippets/template-literal.js @@ -1,4 +1,4 @@ -const css = (templ) => templ.toString(); +const css = templ => templ.toString(); const fooNoBracesUTF8 = css` before @@ -25,8 +25,7 @@ const fooUTF16 = css` `; -const templateLiteralWhichDefinesAFunction = ((...args) => - args[args.length - 1]().toString())` +const templateLiteralWhichDefinesAFunction = ((...args) => args[args.length - 1]().toString())` before 🙃 ${() => true} after @@ -35,17 +34,11 @@ const templateLiteralWhichDefinesAFunction = ((...args) => export function test() { for (let foo of [fooNoBracesUT16, fooNoBracesUTF8, fooUTF16, fooUTF8]) { - console.assert( - foo.includes("before"), - `Expected ${foo} to include "before"`, - ); + console.assert(foo.includes("before"), `Expected ${foo} to include "before"`); console.assert(foo.includes("after"), `Expected ${foo} to include "after"`); } - console.assert( - templateLiteralWhichDefinesAFunction.includes("true"), - "Expected fooFunction to include 'true'", - ); + console.assert(templateLiteralWhichDefinesAFunction.includes("true"), "Expected fooFunction to include 'true'"); return testDone(import.meta.url); } diff --git a/test/snippets/type-only-imports.ts b/test/snippets/type-only-imports.ts index c43fcf2781..38d02c7436 100644 --- a/test/snippets/type-only-imports.ts +++ b/test/snippets/type-only-imports.ts @@ -3,8 +3,7 @@ import type Bacon from "tree"; import type { SilentSymbolCollisionsAreOkayInTypeScript } from "./app"; export const baconator: Bacon = true; -export const SilentSymbolCollisionsAreOkayInTypeScript: SilentSymbolCollisionsAreOkayInTypeScript = - true; +export const SilentSymbolCollisionsAreOkayInTypeScript: SilentSymbolCollisionsAreOkayInTypeScript = true; export function test() { console.assert(SilentSymbolCollisionsAreOkayInTypeScript);