You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Upgrade es-module-lexer to 3.x in instrument-bundler #1617
Area: InstrumentsInstrument authoring API, bundling, runtime, rendering, measures and the built-in libraryChoreType: maintenance with no user-visible change (dependency upgrades, tooling, tests, refactors)Difficulty: MediumStraightforward change, about a day or lessPriority: LowNice to have, cosmetic or speculative
es-module-lexer is held at 2.3.2 in packages/instrument-bundler by the dependency update on the deps branch. The newest release eligible under the repo's 7-day minimumReleaseAge on 2026-10-04 was 3.0.2.
Why it was not upgraded
3.0 changes both the shape of parse results and how the lexer initialises. Running the instrument-bundler suite against 3.0.2 gave 15 failures across 4 files:
The default export returns new records. They are tagged unions without the s/e/ss/se/d/n/t fields, and ImportType is now a type-only export. So ImportType[t] at packages/instrument-bundler/src/parse.ts:294 throws at runtime.
parse.test.ts asserts the old valuesimportType: 'Static' and 'Dynamic'.
init is now a function (3.0.2).await init; at parse.ts:27 becomes a no-op. That matters in the browser, where the playground bundles instruments on the main thread.
What is required
Port parse.ts to the new records, or import from es-module-lexer/minimal, which keeps the 2.x record shape.
Replace the ImportType[t] lookup with an explicit map, and call await init().
Update parse.test.ts and run the instrument-bundler suite.
Check bundling in the playground (the esbuild-wasm path) in a browser, and run testing/src/specs/playground.spec.ts.
The PR body puts one keyword in front of a list: Closes #1624, #1626, #1618, …, #1617, …. GitHub needs the keyword before each number (docs: "Use full syntax for each issue"), and gh pr view 1660 --json closingIssuesReferences returns only #1624. Merged as is, it leaves this issue and the 12 others in that list open. Change the line to Closes #1624, closes #1626, … before merging.
The conflict is not in this commit
fb4f73f is the only commit on the branch that touches parse.ts, parse.test.ts, or the bundler's package.json and AGENTS.md, and main has not changed any of them since the branch point (c7a6364). Against d86740e, the PR's one conflicting file is apps/outreach/src/plugins/starlight-plugin-typedoc/starlight.ts, from the typedoc commit (bb760ef). If #1660 stays stuck, fb4f73f also applies cleanly to d86740e by itself. Its new test does not need Vitest 5: lexerCalls is a plain array, not a mock, so clearMocks never resets it.
Before merging
3.0.3 (2026-10-05) and 3.0.4 (2026-10-15) are now past the 7-day minimumReleaseAge. types/lexer.d.ts is byte-identical in 3.0.2 and 3.0.4, so the port compiles against either. The release notes list TypeScript lexing fixes, an import-attribute parsing fix and release CI. Staying on the locked 3.0.2 is fine.
Recheck await init() after the Vite 8 rebase. fb4f73f's message says the playground's production bundle keeps it, but that commit comes before 2bda841, which moves the playground to Rolldown. The line is a standalone top-level statement in a file that "sideEffects": ["**/cli.ts"] marks side-effect free, the pattern packages/instrument-bundler/AGENTS.md:62-68 warns a bundler may delete. Nothing visibly fails if it goes. parse.test.ts checks the order only in Node, and playground.spec.ts runs against the playground dev server (testing/playwright.config.ts:61-66), which serves parse.ts as its own module. Build the playground on the rebased branch and check that the chunk containing the lexer still awaits init().
Triage note written with Claude Code. Code references point at main @ d86740e.
Area: InstrumentsInstrument authoring API, bundling, runtime, rendering, measures and the built-in libraryChoreType: maintenance with no user-visible change (dependency upgrades, tooling, tests, refactors)Difficulty: MediumStraightforward change, about a day or lessPriority: LowNice to have, cosmetic or speculative
Activity
joshunrau commentedon Oct 26, 2026
Covered by #1660 (fb4f73f). That PR is open and conflicting, so this stays open until it merges.
Merging #1660 as written will not close this
The PR body puts one keyword in front of a list:
Closes #1624, #1626, #1618, …, #1617, …. GitHub needs the keyword before each number (docs: "Use full syntax for each issue"), andgh pr view 1660 --json closingIssuesReferencesreturns only #1624. Merged as is, it leaves this issue and the 12 others in that list open. Change the line toCloses #1624, closes #1626, …before merging.The conflict is not in this commit
fb4f73f is the only commit on the branch that touches
parse.ts,parse.test.ts, or the bundler'spackage.jsonandAGENTS.md, andmainhas not changed any of them since the branch point (c7a6364). Against d86740e, the PR's one conflicting file isapps/outreach/src/plugins/starlight-plugin-typedoc/starlight.ts, from the typedoc commit (bb760ef). If #1660 stays stuck, fb4f73f also applies cleanly to d86740e by itself. Its new test does not need Vitest 5:lexerCallsis a plain array, not a mock, soclearMocksnever resets it.Before merging
minimumReleaseAge.types/lexer.d.tsis byte-identical in 3.0.2 and 3.0.4, so the port compiles against either. The release notes list TypeScript lexing fixes, an import-attribute parsing fix and release CI. Staying on the locked 3.0.2 is fine.await init()after the Vite 8 rebase. fb4f73f's message says the playground's production bundle keeps it, but that commit comes before 2bda841, which moves the playground to Rolldown. The line is a standalone top-level statement in a file that"sideEffects": ["**/cli.ts"]marks side-effect free, the patternpackages/instrument-bundler/AGENTS.md:62-68warns a bundler may delete. Nothing visibly fails if it goes.parse.test.tschecks the order only in Node, andplayground.spec.tsruns against the playground dev server (testing/playwright.config.ts:61-66), which servesparse.tsas its own module. Build the playground on the rebased branch and check that the chunk containing the lexer still awaitsinit().Triage note written with Claude Code. Code references point at
main@d86740e.build(instrument-bundler): upgrade es-module-lexer to 3