Repository navigation
chore: use TypeScript parser instead of line matching in update_pw.mjs - #337
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Replace the line-based stripFileHeader() and the line-based expect-types path rewrite with edits driven by the TypeScript 7 (experimental) API AST. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated from playwright-core/playwright 1.64.0. Compared to the line-based script this keeps the JSDoc of `Serializable` and the `URLPattern` comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mxschmitt
force-pushed
the
chore/update-pw-ts-parser
branch
from
October 8, 2026 21:41
c9a2576 to
d9d87e9
Compare
Test Results SummaryThis comment shows the latest test results for this pull request.
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
update_pw.mjsbuilt the Monaco autocompletion types (frontend/src/components/Editor/types.txt) by editing the upstream.d.tsfiles line by line. This PR swaps that for edits based on an AST from the TypeScript 7 experimental API (typescript/unstable/*):stripFileHeader()→stripModuleSyntax(): parses each file and removes top-levelimport/import =/export … fromstatements whose module can't resolve in the concatenated file (relative paths and Node.js builtins). It also removes the file header (copyright,///directives) but keeps any comment block directly attached to the first remaining statement.expect-typespath rewrite: replaces thesplit('\n').map(line.replace(...))withrewriteModuleSpecifiers(). This only rewrites string literals that are module specifiers (in import/export declarations,import =andimport('…')types) and keeps the original quote style.APIsession using an in-memory virtual FS (createVirtualFileSystem).types.txt.package.jsonwithtypescript@^7.0.2(the same version asfrontend/), and updates CONTRIBUTING/AGENTS to runnpm cifirst.Output changes
I diffed the old and new scripts on the same upstream files. The new script only adds back two comments that the line scanner was dropping by mistake:
Serializable(structs.d.ts); the old scanner treated it as part of the copyright headerURLPatternexplanation comment (types.d.ts)The
@ts-ignoredzodimports are kept, as before. Runningtsc7 over the old and newtypes.txtgives the same diagnostics.The second commit regenerates
types.txt(Playwright 1.64.0) with the new script. On top of #336 the only change is the two restored comments (5 lines).Testing
updateFrontendTypes()with the old and new scripts and diffed the results (only the two comments above differ).///+ copyright header removal,// @ts-ignorekept on a remaining first import, specifier rewrite inimport type,export * fromandimport('…')(other string literals left alone).tsc --noEmiton old and new output: same error set.🤖 Generated with Claude Code