Skip to content

Commit b0f2e36

Browse files
lydelltjenkinson
andauthored
fix(sucrase): Pass disableESTransforms option and make types match options we support (#984)
* fix(sucrase): Pass `disableESTransforms` option The `disableESTransforms` option was added in [Sucrase 3.19.0]. The TypeScript types that ship with `@rollup/plugin-sucrase` says that `disableESTransforms` is a valid option, but supplying makes no difference. This passes the option on to Sucrase. [Sucrase 3.19.0]: https://github.com/alangpierce/sucrase/blob/c15268c2cd1ef4d613f41978478a8061c483aaae/CHANGELOG.md#3190-2021-06-23 * feat(sucrase): switch types to allow list to match options passed through Co-authored-by: Tom Jenkinson <[email protected]>
1 parent 6afa82c commit b0f2e36

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

packages/sucrase/src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = function sucrase(opts = {}) {
3838
enableLegacyTypeScriptModuleInterop: opts.enableLegacyTypeScriptModuleInterop,
3939
enableLegacyBabel5ModuleInterop: opts.enableLegacyBabel5ModuleInterop,
4040
production: opts.production,
41+
disableESTransforms: opts.disableESTransforms,
4142
filePath: id,
4243
sourceMapOptions: {
4344
compiledFilename: id

packages/sucrase/test/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const config: RollupOptions = {
1717
jsxFragmentPragma: 'React.fragment',
1818
jsxPragma: 'React',
1919
production: true,
20+
disableESTransforms: true,
2021
transforms: ['jsx']
2122
})
2223
]

packages/sucrase/types/index.d.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@ import { FilterPattern } from '@rollup/pluginutils';
22
import { Plugin } from 'rollup';
33
import { Options as SucraseOptions } from 'sucrase/dist/Options';
44

5-
interface RollupSucraseOptions extends Omit<SucraseOptions, 'filePath' | 'sourceMapOptions'> {
5+
interface RollupSucraseOptions
6+
extends Pick<
7+
SucraseOptions,
8+
| 'transforms'
9+
| 'jsxPragma'
10+
| 'jsxFragmentPragma'
11+
| 'enableLegacyTypeScriptModuleInterop'
12+
| 'enableLegacyBabel5ModuleInterop'
13+
| 'production'
14+
| 'disableESTransforms'
15+
> {
616
/**
717
* A minimatch pattern, or array of patterns, which specifies the files in the build the plugin
818
* should operate on.

0 commit comments

Comments
 (0)