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

transformSync output regression in 0.8.22 #596

Closed
eigilsagafos opened this issue Dec 14, 2020 · 4 comments
Closed

transformSync output regression in 0.8.22 #596

eigilsagafos opened this issue Dec 14, 2020 · 4 comments

Comments

@eigilsagafos
Copy link

After the 0.8.22 release transformSync returns a stringified Uint8Array

@evanw
Copy link
Owner

evanw commented Dec 14, 2020

I believe you but I am unable to reproduce this. It returns a string for me. This test is currently passing, for example.

Can you provide me with more information? Do you have a code sample that reproduces the problem? What platform is this on?

evanw added a commit that referenced this issue Dec 14, 2020
@eigilsagafos
Copy link
Author

@evanw So, I did some more digging. So seems to me that passing a buffer to transformSync is the issue. This has worked before.

Does not work in 0.8.22

const code = readFileSync(filename)
const result = transformSync(code, {
    loader: "ts"
})

Works in 0.8.22

const code = readFileSync(filename)
const result = transformSync(code.toString(), {
    loader: "ts"
})

@evanw
Copy link
Owner

evanw commented Dec 14, 2020

Ah, I see. That wasn't intentionally supported. This is the type definition for transformSync:

export declare function transformSync(input: string, options?: TransformOptions): TransformResult;

I can make sure this isn't silently allowed like it is now.

@eigilsagafos
Copy link
Author

I see :) Thanks for pointing that out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants