-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
[compiler][ez] Clean up pragma parsing for tests + playground #31347
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
/** | ||
* For snap test fixtures and playground only. | ||
*/ | ||
export function parseConfigPragma(pragma: string): EnvironmentConfig { |
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.
Before this just used environment defaults, now we're explicitly adding in dummy values just for tests/playground. Let's rename? parseConfigPragmaForTests()
or similar
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.
Done!
Move environment config parsing for `inlineJsxTransform`, `lowerContextAccess`, and some dev-only options out of snap (test fixture). These should now be available for playground via `@inlineJsxTransform` and `lowerContextAccess`. Other small change: Changed zod fields from `nullish()` -> `nullable().default(null)`. [`nullish`](https://zod.dev/?id=nullish) fields accept `null | undefined` and default to `undefined`. We don't distinguish between null and undefined for any of these options, so let's only accept null + default to null. This also makes EnvironmentConfig in the playground more accurate. Previously, some fields just didn't show up as `prettyFormat({field: undefined})` does not print `field`.
Move environment config parsing for
inlineJsxTransform
,lowerContextAccess
, and some dev-only options out of snap (test fixture). These should now be available for playground via@inlineJsxTransform
andlowerContextAccess
.Other small change:
Changed zod fields from
nullish()
->nullable().default(null)
.nullish
fields acceptnull | undefined
and default toundefined
. We don't distinguish between null and undefined for any of these options, so let's only accept null + default to null. This also makes EnvironmentConfig in the playground more accurate. Previously, some fields just didn't show up asprettyFormat({field: undefined})
does not printfield
.See playground:
Before (note environment options missing)
After (note environment options not missing)
@inlineJsxTransform
and a few others now also work