-
Notifications
You must be signed in to change notification settings - Fork 138
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
Allow arbitrary Sucrase configuration in sucrase/register and the CLI #792
Comments
alangpierce
added a commit
that referenced
this issue
Jul 18, 2023
Supersedes #670 Progress toward #792 This PR adds to the CLI a number of options that had been added. The CLI could still use some work in terms of error reporting and behavior, but this should hopefully get it closer to parity with other use cases. The CLI previously had no tests, so this also adds an integration test suite exercising each new and existing Sucrase option (though it's not yet at full coverage).
alangpierce
added a commit
that referenced
this issue
Jul 18, 2023
Supersedes #670 Progress toward #792 This PR adds to the CLI a number of options that had been added. The CLI could still use some work in terms of error reporting and behavior, but this should hopefully get it closer to parity with other use cases. The CLI previously had no tests, so this also adds an integration test suite exercising each new and existing Sucrase option (though it's not yet at full coverage).
alangpierce
added a commit
that referenced
this issue
Jul 18, 2023
Fixes #792 This PR adds a new environment variable SUCRASE_OPTIONS that works with the require hook and other tools that are based on the require hook (`sucrase-node` and programmatically registering a hook). Its format is simply a JSON string that is parsed and merged with the usual options. Hopefully this will be rare, especially after a semver-major change to better defaults, but it's important for some cases.
alangpierce
added a commit
that referenced
this issue
Jul 19, 2023
Fixes #792 This PR adds a new environment variable SUCRASE_OPTIONS that works with the require hook and other tools that are based on the require hook (`sucrase-node` and programmatically registering a hook). Its format is simply a JSON string that is parsed and merged with the usual options. Hopefully this will be rare, especially after a semver-major change to better defaults, but it's important for some cases.
Implemented via the two above PRs. I was originally planning to have a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The original hope of this project was to keep configuration so minimal and opinionated that config is only needed for advanced use cases where you'd already be invoking Sucrase directly from JS. Unfortunately, JSX and Node ESM have both moved in a direction that make configuration more necessary, so it's harder to keep a zero-config mindset, so this issue tracks:
sucrase/register
.I'm still hoping to avoid the need for a config file and the complexity that that entails, at least for now.
Some of the need for config could be avoided via a semver-major release with better defaults (e.g.
disableESTransforms
on by default), though with a major release also comes the need to configure the system for the old behavior, so I think a more accessible system is probably necessary regardless.Current plan:
sucrase/register
orsucrase-node
, aSUCRASE_OPTIONS
environment variable can hold a JSON value setting any options that are merged in before transform.sucrase
CLI, the missing CLI options should be added as direct flags (e.g. Add cli option--disable-es-transforms
#670 , plus the other new ones since then), and there should also be an--options-json
option to specify the options as JSON.The text was updated successfully, but these errors were encountered: