-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(repo): drop bun for vitest, node, and esbuild #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ce01066
refactor(repo): drop bun for vitest, node, and esbuild
haydenshively 93ce48d
fix(repo): make tryCatch thenable-safe and restore the local build step
haydenshively 3eeb3e8
refactor(market-making): port main's new test files off bun:test
haydenshively 96d901f
fix(repo): reconcile migration with main
haydenshively 6c9dac2
fix(market-making): build playground with vite
haydenshively 2f09bd5
ci(checks): run browser smoke with pnpm
haydenshively 0acd366
fix(market-making): preserve relative playground assets
haydenshively bede192
test(market-making): stabilize node playground smoke
haydenshively c4bc9c0
fix(market-making): port main additions off bun
haydenshively 058c276
fix(repo): cover playground checks with pnpm
haydenshively 4e85f0c
test(market-making): rename migrated tool fixtures
haydenshively c1c85db
fix(market-making): restore dynamic jsdoc inventory
haydenshively 97afb1b
test(market-making): tolerate reaped install children
haydenshively adda072
fix(repo): finish bun removal migration
haydenshively File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
|
|
||
| # Dependencies | ||
| node_modules | ||
| .pnpm-store | ||
|
|
||
| # Local env files | ||
| .env | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import type { Plugin } from 'esbuild' | ||
|
|
||
| import { build as esbuild } from 'esbuild' | ||
| import { rmSync } from 'node:fs' | ||
| import { readFile } from 'node:fs/promises' | ||
| import { dirname, join } from 'node:path' | ||
| import { fileURLToPath } from 'node:url' | ||
| import { transformSolTemplates } from 'soltag/unplugin' | ||
|
|
||
| import { BundleFailedError } from './bundle-failed.error' | ||
|
|
||
| // Bundles the bot entrypoint (and the soltag-dependent operator script) to `dist/` with the | ||
| // `sol``` templates compiled to literal ABIs/bytecode, so production runs a plain `node` with no | ||
| // runtime transform. This replaces the bunfig `preload` that used to compile them at startup. | ||
|
|
||
| const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..') | ||
| const DIST_DIR = join(ROOT, 'dist') | ||
| rmSync(DIST_DIR, { recursive: true, force: true }) | ||
|
|
||
| const ESCAPED = ROOT.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') | ||
| // This bot's own TS sources only — bundled workspace deps ship prebuilt dist and hold no templates. | ||
| const INCLUDE = new RegExp(`^${ESCAPED}/(?:src|scripts)/.*\\.tsx?$`) | ||
|
|
||
| const soltagPlugin: Plugin = { | ||
| name: 'soltag', | ||
| setup(build) { | ||
| build.onLoad({ filter: INCLUDE }, async ({ path }) => { | ||
| const source = await readFile(path, 'utf8') | ||
| // Enable the optimizer — the lens's per-element computation has enough locals to hit | ||
| // "stack too deep" without it. | ||
| const transformed = transformSolTemplates(source, path, { | ||
| solc: { optimizer: { enabled: true, runs: 200 } } | ||
| }) | ||
| return { contents: transformed?.code ?? source, loader: 'ts' as const } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| try { | ||
| await esbuild({ | ||
| entryPoints: [join(ROOT, 'src/index.ts'), join(ROOT, 'scripts/probe-live-lens.ts')], | ||
| outdir: DIST_DIR, | ||
| outbase: ROOT, | ||
| bundle: true, | ||
| platform: 'node', | ||
| format: 'esm', | ||
| // CJS deps reaching for require() inside an ESM bundle need a real require. | ||
| banner: { | ||
| js: "import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);" | ||
| }, | ||
| plugins: [soltagPlugin] | ||
| }) | ||
| } catch (error) { | ||
| throw new BundleFailedError(error instanceof Error ? error.message : String(error)) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /** Signals that the production bundle could not be produced. */ | ||
| export class BundleFailedError extends Error { | ||
| /** | ||
| * Creates a tooling failure from the bundler's own message, without retaining source contents. | ||
| * @param detail - Bundler-reported reason for the failure. | ||
| */ | ||
| constructor(readonly detail: string) { | ||
| super(`Bundle failed: ${detail}`) | ||
| this.name = 'BundleFailedError' | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.