[compiler][snap] Fixes to relative path resolution; compile subcommand#462
[compiler][snap] Fixes to relative path resolution; compile subcommand#462everettbu wants to merge 1 commit into
Conversation
More snap improvements for use with agents: * `yarn snap compile [--debug] <path>` for compiling any file, optionally with debug logs * `yarn snap minimize <path>` now accepts path as a positional param for consistency w 'compile' command * Both compile/minimize commands properly handle paths relative to the compiler/ directory. When using `yarn snap` the current working directory is compiler/packages/snap, but you're generally running it from the compiler directory so this matches expectations of callers better.
Greptile OverviewGreptile SummaryThis PR adds new Implementation-wise, snap’s path constants are split into One functional issue was introduced in the new CLI flows: both Confidence Score: 4/5
Important Files Changed
|
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: compiler/packages/snap/src/runner.ts
Line: 171:176
Comment:
**Single-line input bug**
`firstLine` is computed as `input.substring(0, input.indexOf('\n'))`. If the file has no newline, `indexOf` returns `-1` and `substring` returns `''`, so `parseLanguage(firstLine)`, `parseSourceType(firstLine)`, and `parseConfigPragmaForTests(firstLine, ...)` run with an empty string. This breaks `snap minimize`/`snap compile` for valid one-line repro files. Also appears in the compile subcommand at runner.ts:224-229.
How can I resolve this? If you propose a fix, please make it concise. |
|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#35688
Original author: josephsavona
More snap improvements for use with agents:
yarn snap compile [--debug] <path>for compiling any file, optionally with debug logsyarn snap minimize <path>now accepts path as a positional param for consistency w 'compile' commandyarn snapthe current working directory is compiler/packages/snap, but you're generally running it from the compiler directory so this matches expectations of callers better.