-
Notifications
You must be signed in to change notification settings - Fork 1
fix(txe): emit the CLI bundle at a path tsc-only rebuilds cannot clobber #38
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
base: main
Are you sure you want to change the base?
Changes from all commits
ee340c8
b32c018
7df2583
0990ac2
a62941f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,11 @@ import { StubBaseAccountContract } from '../../defaults/stub_account_contract.js | |
| * Lazily loads the Schnorr stub contract artifact (browser-compatible). | ||
| */ | ||
| export async function getStubSchnorrAccountContractArtifact() { | ||
| // Cannot assert this import as it's incompatible with bundlers like vite | ||
| // Cannot add `with { type: 'json' }` to this import as it's incompatible with bundlers like vite | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: the generator that emits this same block was missed — |
||
| // https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352 | ||
| // Even if now supported by all major browsers, the MIME type is replaced with | ||
| // "text/javascript" | ||
| // In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| const { default: json } = await import('../../../artifacts/SimulatedSchnorrAccount.json'); | ||
| return loadContractArtifact(json); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,8 +108,12 @@ const redirects = [ | |
| ]; | ||
|
|
||
| const entryPoints = { | ||
| // src/bin/index.ts → dest/bin/index.js (overwrites the tsc-emitted file). | ||
| 'bin/index': 'src/bin/index.ts', | ||
| // src/bin/index.ts → dest/bin/index.bundle.js. The `.bundle` suffix (like worker/server below) | ||
| // keeps the output at a path tsc never emits: a tsc-only rebuild (e.g. `yarn build` at the | ||
| // yarn-project root) must not be able to replace a bundle with unbundled output, because the | ||
| // unbundled tree reaches dynamic JSON imports that Node's ESM loader rejects | ||
| // (ERR_IMPORT_ATTRIBUTE_MISSING) — TXE only runs correctly from the bundles. | ||
| 'bin/index.bundle': 'src/bin/index.ts', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that esbuild stops overwriting it, swc's |
||
| // src/worker.ts → dest/worker.bundle.js (the file the pool spawns). | ||
| 'worker.bundle': 'src/worker.ts', | ||
| // src/rpc_server.ts → dest/server.bundle.js (the entry the parent `@aztec/aztec` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| "import": "./dest/server.bundle.js" | ||
| } | ||
| }, | ||
| "bin": "./dest/bin/index.js", | ||
| "bin": "./dest/bin/index.bundle.js", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| "typedocOptions": { | ||
| "entryPoints": [ | ||
| "./src/index.ts" | ||
|
|
@@ -21,8 +21,8 @@ | |
| "build:dev": "../scripts/tsc.sh --watch", | ||
| "clean": "rm -rf ./dest .tsbuildinfo", | ||
| "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}", | ||
| "dev": "LOG_LEVEL=\"debug; trace: simulator:state_manager; info: json-rpc:proxy\" node ./dest/bin/index.js", | ||
| "start": "node --no-warnings ./dest/bin/index.js", | ||
| "dev": "node ./esbuild.config.mjs && LOG_LEVEL=\"debug; trace: simulator:state_manager; info: json-rpc:proxy\" node ./dest/bin/index.bundle.js", | ||
| "start": "node ./esbuild.config.mjs && node --no-warnings ./dest/bin/index.bundle.js", | ||
| "start:oracle-test-resolver": "node --no-warnings ./dest/bin/oracle_test_server.js", | ||
| "check_txe_oracle_version": "node ./dest/bin/check_txe_oracle_version.js" | ||
| }, | ||
|
|
@@ -100,7 +100,7 @@ | |
| "typescript": "^5.3.3" | ||
| }, | ||
| "files": [ | ||
| "dest/bin/index.js", | ||
| "dest/bin/index.bundle.js", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| "dest/worker.bundle.js", | ||
| "dest/server.bundle.js", | ||
| "dest/chunk-*.js", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,9 +50,9 @@ export async function buildSharedContractStore(): Promise<{ dataDir: string; sch | |
|
|
||
| /** | ||
| * Resolves `worker.bundle.js` whether this code is running unbundled (next to dispatcher_pool.js | ||
| * inside `dest/`) or bundled into `dest/bin/index.js` (one directory deeper). `import.meta.url` | ||
| * refers to whichever module the calling code actually lives in; we try both relative locations | ||
| * and use whichever exists. | ||
| * inside `dest/`) or bundled into `dest/bin/index.bundle.js` (one directory deeper). | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With splitting on, this code ends up in a |
||
| * `import.meta.url` refers to whichever module the calling code actually lives in; we try both | ||
| * relative locations and use whichever exists. | ||
| */ | ||
| // worker.bundle.js is esbuild's bundling of src/worker.ts (see esbuild.config.mjs). | ||
| // @dependency ./worker.ts | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one doesn't go through
yarn start, so it misses the rebundle you added. After a root-onlyyarn buildit runs whatever the last esbuild left behind, and after ayarn cleanthe file isn't there at all. Shouldstart_txesbundle first too?