diff options
author | 2022-06-22 23:21:48 -0700 | |
---|---|---|
committer | 2022-06-22 23:21:48 -0700 | |
commit | 729d445b6885f69dd2c6355f38707bd42851c791 (patch) | |
tree | f87a7c408929ea3f57bbb7ace380cf869da83c0e /bench/snippets/scanner | |
parent | 25f820c6bf1d8ec6d444ef579cc036b8c0607b75 (diff) | |
download | bun-jarred/rename.tar.gz bun-jarred/rename.tar.zst bun-jarred/rename.zip |
change the directory structurejarred/rename
Diffstat (limited to 'bench/snippets/scanner')
-rwxr-xr-x | bench/snippets/scanner/bun.lockb | bin | 6186 -> 0 bytes | |||
-rw-r--r-- | bench/snippets/scanner/package.json | 6 | ||||
-rw-r--r-- | bench/snippets/scanner/remix-route.ts | 15 | ||||
-rw-r--r-- | bench/snippets/scanner/scan-imports-only.js | 15 | ||||
-rw-r--r-- | bench/snippets/scanner/scan.bun.js | 21 | ||||
-rw-r--r-- | bench/snippets/scanner/scan.node-esbuild.mjs | 42 |
6 files changed, 0 insertions, 99 deletions
diff --git a/bench/snippets/scanner/bun.lockb b/bench/snippets/scanner/bun.lockb Binary files differdeleted file mode 100755 index 90bb78996..000000000 --- a/bench/snippets/scanner/bun.lockb +++ /dev/null diff --git a/bench/snippets/scanner/package.json b/bench/snippets/scanner/package.json deleted file mode 100644 index 7bb4e8990..000000000 --- a/bench/snippets/scanner/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "scan", - "dependencies": { - "esbuild": "^0.14.11" - } -}
\ No newline at end of file diff --git a/bench/snippets/scanner/remix-route.ts b/bench/snippets/scanner/remix-route.ts deleted file mode 100644 index dbacf3a4c..000000000 --- a/bench/snippets/scanner/remix-route.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { useParams } from "remix"; -import type { LoaderFunction, ActionFunction } from "remix"; - -export const loader: LoaderFunction = async ({ params }) => { - console.log(params.postId); -}; - -export const action: ActionFunction = async ({ params }) => { - console.log(params.postId); -}; - -export default function PostRoute() { - const params = useParams(); - console.log(params.postId); -} diff --git a/bench/snippets/scanner/scan-imports-only.js b/bench/snippets/scanner/scan-imports-only.js deleted file mode 100644 index 53222d57c..000000000 --- a/bench/snippets/scanner/scan-imports-only.js +++ /dev/null @@ -1,15 +0,0 @@ -import { readFileSync } from "fs"; -const fixture = ["action", "default", "loader"]; - -const transpiler = new Bun.Transpiler({ - loader: "ts", -}); - -console.time("Get exports"); -const ITERATIONS = parseInt(process.env.ITERATIONS || "1") || 1; -for (let i = 0; i < ITERATIONS; i++) { - const imports = transpiler.scanImports( - readFileSync("remix-route.ts", "utf8") - ); -} -console.timeEnd("Get exports"); diff --git a/bench/snippets/scanner/scan.bun.js b/bench/snippets/scanner/scan.bun.js deleted file mode 100644 index eb2b09452..000000000 --- a/bench/snippets/scanner/scan.bun.js +++ /dev/null @@ -1,21 +0,0 @@ -import { readFileSync } from "fs"; -const fixture = ["action", "default", "loader"]; -const ITERATIONS = parseInt(process.env.ITERATIONS || "1") || 1; - -const transpiler = new Bun.Transpiler({ - loader: "ts", -}); - -console.time("Get exports"); -const file = readFileSync("remix-route.ts", "utf8"); -for (let i = 0; i < ITERATIONS; i++) { - const { imports, exports } = transpiler.scan(file); - - for (let j = 0; j < fixture.length; j++) { - if (fixture[j] !== exports[j]) { - throw new Error("Mismatch"); - } - } -} - -console.timeEnd("Get exports"); diff --git a/bench/snippets/scanner/scan.node-esbuild.mjs b/bench/snippets/scanner/scan.node-esbuild.mjs deleted file mode 100644 index 1a7fa79d8..000000000 --- a/bench/snippets/scanner/scan.node-esbuild.mjs +++ /dev/null @@ -1,42 +0,0 @@ -import { build, buildSync } from "esbuild"; -import { readFileSync } from "fs"; -const fixture = ["action", "default", "loader"]; -const ITERATIONS = parseInt(process.env.ITERATIONS || "1") || 1; - -const opts = { - metafile: true, - format: "esm", - platform: "neutral", - write: false, - logLevel: "silent", - stdin: { - contents: readFileSync("remix-route.ts", "utf8"), - loader: "ts", - sourcefile: "remix-route.js", - }, -}; - -const getExports = ({ metafile }) => { - for (let i = 0; i < fixture.length; i++) { - if (fixture[i] !== metafile.outputs["stdin.js"].exports[i]) { - throw new Error("Mismatch"); - } - } -}; - -console.time("Get exports"); - -if (!process.env.SYNC) { - var promises = new Array(ITERATIONS); - for (let i = 0; i < ITERATIONS; i++) { - promises[i] = build(opts).then(getExports); - } - - await Promise.all(promises); -} else { - for (let i = 0; i < ITERATIONS; i++) { - getExports(buildSync(opts)); - } -} - -console.timeEnd("Get exports"); |