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

feat(typescript-plugins): use babel to transpile .ts plugins #79

Merged
merged 1 commit into from
Jan 24, 2018

Conversation

eventualbuddha
Copy link
Collaborator

Fixes #51 and supersedes #57. The gist of this is that I updated the babel dependencies from 6.x to 7.x, which adds support for transpiling TypeScript. I ended up writing my own @babel/register-alike to make it easier to support both .js files and .ts files.

cc @mcMickJuice @hzoo

@@ -47,38 +45,6 @@ export default class TransformRunner {
return transform(source.content, {
filename: source.path,
babelrc: false,
parserOpts: {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this stuff moved into RecastPlugin since parser and generator options are now handled by plugin hooks.

@eventualbuddha eventualbuddha merged commit 79c144a into master Jan 24, 2018
@eventualbuddha eventualbuddha deleted the update-babel-deps branch January 24, 2018 01:33
@hzoo
Copy link

hzoo commented Jan 24, 2018

I ended up writing my own @babel/register-alike to make it easier to support both .js files and .ts files.

I think if the functionality is missing we should modify register in a similar way if possible @loganfsmyth

@eventualbuddha
Copy link
Collaborator Author

I expect it might be possible to use @babel/preset-typescript and @babel/preset-env even with .js files and have it work. Maybe I’ll just do that.

@eventualbuddha
Copy link
Collaborator Author

Actually, the main issue I had was that ignore and only were getting set even when I didn't provide them. I think the workaround would be for me to specify both of them like so:

  ignore: [/node_modules/],
  only: [/.*/]

By default you end up with ignore and only that restrict it to the current working directory and not node_modules, which might be fine except that remote plugins get downloaded to a temp directory which could be anywhere. I'm happy to use @babel/register instead if it doesn't require too much futzing to get it working. Using pirates directly is pretty clean, except that I have to hardcode the list of extensions.

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

Successfully merging this pull request may close these issues.

2 participants