Skip to content

Commit

Permalink
fix(register): do not send undefined source code for compilation (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
fargito authored Jul 3, 2024
1 parent 9644be5 commit 3499611
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/register/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ const injectInlineSourceMap = ({
}

export function compile(
sourcecode: string,
sourcecode: string | undefined,
filename: string,
options: ts.CompilerOptions & {
fallbackToTs?: (filename: string) => boolean
},
): string

export function compile(
sourcecode: string,
sourcecode: string | undefined,
filename: string,
options: ts.CompilerOptions & {
fallbackToTs?: (filename: string) => boolean
Expand All @@ -64,7 +64,7 @@ export function compile(
): string

export function compile(
sourcecode: string,
sourcecode: string | undefined,
filename: string,
options: ts.CompilerOptions & {
fallbackToTs?: (filename: string) => boolean
Expand All @@ -73,7 +73,7 @@ export function compile(
): Promise<string>

export function compile(
sourcecode: string,
sourcecode: string | undefined,
filename: string,
options: ts.CompilerOptions & {
fallbackToTs?: (filename: string) => boolean
Expand All @@ -82,14 +82,15 @@ export function compile(
): string | Promise<string>

export function compile(
sourcecode: string,
sourcecode: string | undefined,
filename: string,
options: ts.CompilerOptions & {
fallbackToTs?: (filename: string) => boolean
},
async = false,
) {
if (
typeof sourcecode === 'undefined' ||
(filename.includes('node_modules') && !AVAILABLE_TS_EXTENSION_PATTERN.test(filename)) ||
!AVAILABLE_EXTENSION_PATTERN.test(filename)
) {
Expand Down

0 comments on commit 3499611

Please sign in to comment.