mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

PR-URL: https://github.com/nodejs/node/pull/59141 Fixes: https://github.com/nodejs/node/issues/59102 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
73 lines
1.6 KiB
TypeScript
73 lines
1.6 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
|
|
export declare function transform(src: string | Uint8Array, opts?: Options): Promise<TransformOutput>;
|
|
export declare function transformSync(src: string | Uint8Array, opts?: Options): TransformOutput;
|
|
export type { Options, TransformOutput };
|
|
|
|
|
|
|
|
interface Options {
|
|
module?: boolean;
|
|
filename?: string;
|
|
mode?: Mode;
|
|
transform?: TransformConfig;
|
|
deprecatedTsModuleAsError?: boolean;
|
|
sourceMap?: boolean;
|
|
}
|
|
|
|
interface TransformConfig {
|
|
/**
|
|
* @see https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
|
|
*/
|
|
verbatimModuleSyntax?: boolean;
|
|
/**
|
|
* Native class properties support
|
|
*/
|
|
nativeClassProperties?: boolean;
|
|
importNotUsedAsValues?: "remove" | "preserve";
|
|
/**
|
|
* Don't create `export {}`.
|
|
* By default, strip creates `export {}` for modules to preserve module
|
|
* context.
|
|
*
|
|
* @see https://github.com/swc-project/swc/issues/1698
|
|
*/
|
|
noEmptyExport?: boolean;
|
|
importExportAssignConfig?: "Classic" | "Preserve" | "NodeNext" | "EsNext";
|
|
/**
|
|
* Disables an optimization that inlines TS enum member values
|
|
* within the same module that assumes the enum member values
|
|
* are never modified.
|
|
*
|
|
* Defaults to false.
|
|
*/
|
|
tsEnumIsMutable?: boolean;
|
|
|
|
/**
|
|
* Available only on nightly builds.
|
|
*/
|
|
jsx?: JsxConfig;
|
|
}
|
|
|
|
interface JsxConfig {
|
|
/**
|
|
* How to transform JSX.
|
|
*
|
|
* @default "react-jsx"
|
|
*/
|
|
transform?: "react-jsx" | "react-jsxdev";
|
|
}
|
|
|
|
|
|
|
|
type Mode = "strip-only" | "transform";
|
|
|
|
|
|
|
|
interface TransformOutput {
|
|
code: string;
|
|
map?: string;
|
|
}
|
|
|
|
|