Skip to content
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

Add options argument to register functions to pass to pirates #573

Merged
merged 1 commit into from
Dec 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 31 additions & 23 deletions src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,47 @@ export function addHook(extension: string, options: Options, hookOptions?: HookO
);
}

export function registerJS(): void {
addHook(".js", {transforms: ["imports", "flow", "jsx"]});
export function registerJS(hookOptions?: HookOptions): void {
addHook(".js", {transforms: ["imports", "flow", "jsx"]}, hookOptions);
}

export function registerJSX(): void {
addHook(".jsx", {transforms: ["imports", "flow", "jsx"]});
export function registerJSX(hookOptions?: HookOptions): void {
addHook(".jsx", {transforms: ["imports", "flow", "jsx"]}, hookOptions);
}

export function registerTS(): void {
addHook(".ts", {transforms: ["imports", "typescript"]});
export function registerTS(hookOptions?: HookOptions): void {
addHook(".ts", {transforms: ["imports", "typescript"]}, hookOptions);
}

export function registerTSX(): void {
addHook(".tsx", {transforms: ["imports", "typescript", "jsx"]});
export function registerTSX(hookOptions?: HookOptions): void {
addHook(".tsx", {transforms: ["imports", "typescript", "jsx"]}, hookOptions);
}

export function registerTSLegacyModuleInterop(): void {
addHook(".ts", {
transforms: ["imports", "typescript"],
enableLegacyTypeScriptModuleInterop: true,
});
export function registerTSLegacyModuleInterop(hookOptions?: HookOptions): void {
addHook(
".ts",
{
transforms: ["imports", "typescript"],
enableLegacyTypeScriptModuleInterop: true,
},
hookOptions,
);
}

export function registerTSXLegacyModuleInterop(): void {
addHook(".tsx", {
transforms: ["imports", "typescript", "jsx"],
enableLegacyTypeScriptModuleInterop: true,
});
export function registerTSXLegacyModuleInterop(hookOptions?: HookOptions): void {
addHook(
".tsx",
{
transforms: ["imports", "typescript", "jsx"],
enableLegacyTypeScriptModuleInterop: true,
},
hookOptions,
);
}

export function registerAll(): void {
registerJS();
registerJSX();
registerTS();
registerTSX();
export function registerAll(hookOptions?: HookOptions): void {
registerJS(hookOptions);
registerJSX(hookOptions);
registerTS(hookOptions);
registerTSX(hookOptions);
}