1 | export type Transform = "jsx" | "typescript" | "flow" | "imports" | "react-hot-loader" | "jest";
|
2 | export interface SourceMapOptions {
|
3 | /**
|
4 | * The name to use in the "file" field of the source map. This should be the name of the compiled
|
5 | * file.
|
6 | */
|
7 | compiledFilename: string;
|
8 | }
|
9 | export interface Options {
|
10 | /**
|
11 | * Unordered array of transform names describing both the allowed syntax
|
12 | * (where applicable) and the transformation behavior.
|
13 | */
|
14 | transforms: Array<Transform>;
|
15 | /**
|
16 | * Opts out of all ES syntax transformations: optional chaining, nullish
|
17 | * coalescing, class fields, numeric separators, optional catch binding.
|
18 | */
|
19 | disableESTransforms?: boolean;
|
20 | /**
|
21 | * Transformation mode for the JSX transform.
|
22 | * - "classic" refers to the original behavior using `React.createElement`.
|
23 | * - "automatic" refers to the transform behavior released with React 17,
|
24 | * where the `jsx` function (or a variation) is automatically imported.
|
25 | * - "preserve" leaves the JSX as-is.
|
26 | *
|
27 | * Default value: "classic".
|
28 | */
|
29 | jsxRuntime?: "classic" | "automatic" | "preserve";
|
30 | /**
|
31 | * Compile code for production use. Currently only applies to the JSX
|
32 | * transform.
|
33 | */
|
34 | production?: boolean;
|
35 | /**
|
36 | * If specified, import path prefix to use in place of "react" when compiling
|
37 | * JSX with the automatic runtime.
|
38 | */
|
39 | jsxImportSource?: string;
|
40 | /**
|
41 | * If specified, function name to use in place of React.createClass when
|
42 | * compiling JSX with the classic runtime.
|
43 | */
|
44 | jsxPragma?: string;
|
45 | /**
|
46 | * If specified, function name to use in place of React.Fragment when
|
47 | * compiling JSX with the classic runtime.
|
48 | */
|
49 | jsxFragmentPragma?: string;
|
50 | /**
|
51 | * If specified, disable automatic removal of type-only import and export
|
52 | * statements and names. Only statements and names that explicitly use the
|
53 | * `type` keyword are removed.
|
54 | */
|
55 | keepUnusedImports?: boolean;
|
56 | /**
|
57 | * If specified, the imports transform does not attempt to change dynamic
|
58 | * import() expressions into require() calls.
|
59 | */
|
60 | preserveDynamicImport?: boolean;
|
61 | /**
|
62 | * Only relevant when targeting ESM (i.e. when the imports transform is *not*
|
63 | * specified). This flag changes the behavior of TS require imports:
|
64 | *
|
65 | * import Foo = require("foo");
|
66 | *
|
67 | * to import createRequire, create a require function, and use that function.
|
68 | * This is the TS behavior with module: nodenext and makes it easier for the
|
69 | * same code to target ESM and CJS.
|
70 | */
|
71 | injectCreateRequireForImportRequire?: boolean;
|
72 | /**
|
73 | * If true, replicate the import behavior of TypeScript's esModuleInterop: false.
|
74 | */
|
75 | enableLegacyTypeScriptModuleInterop?: boolean;
|
76 | /**
|
77 | * If true, replicate the import behavior Babel 5 and babel-plugin-add-module-exports.
|
78 | */
|
79 | enableLegacyBabel5ModuleInterop?: boolean;
|
80 | /**
|
81 | * If specified, we also return a RawSourceMap object alongside the code.
|
82 | * filePath must be specified if this option is enabled.
|
83 | */
|
84 | sourceMapOptions?: SourceMapOptions;
|
85 | /**
|
86 | * File path to use in error messages, React display names, and source maps.
|
87 | */
|
88 | filePath?: string;
|
89 | }
|
90 | export declare function validateOptions(options: Options): void;
|