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(babel): add typings #462

Merged
merged 10 commits into from Jul 7, 2020
Merged

feat(babel): add typings #462

merged 10 commits into from Jul 7, 2020

Conversation

AndrewLeedham
Copy link
Contributor

Rollup Plugin Name: babel

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Description

Adds TypeScript typings to the @rollup/plugin-babel so the plugin works nicely in TypeScript environments. I used the @rollup/plugin-commonjs typings as a template for this :)

@AndrewLeedham AndrewLeedham marked this pull request as ready for review June 19, 2020 16:02
@@ -0,0 +1,22 @@
import babel from '../types';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import babel from '../types';
import babel from '../';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

packages/babel/types/index.d.ts Outdated Show resolved Hide resolved
Copy link
Member

@NotWoods NotWoods left a comment

Choose a reason for hiding this comment

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

Looking good! One more export needed

packages/babel/types/index.d.ts Outdated Show resolved Hide resolved
@AndrewLeedham
Copy link
Contributor Author

FYI this shouldn't be merged until DefinitelyTyped/DefinitelyTyped#45613 is included as it breaks locally!

@NotWoods NotWoods changed the title feat(babel): add typings feat(babel): add typings [DO NOT MERGE] Jun 20, 2020
}

type CustomInputPluginOptions = (
options: RollupBabelInputPluginOptions & Record<string, any>
Copy link
Member

Choose a reason for hiding this comment

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

TS is not my strongest suit so take my comment with a grain of salt - maybe instead of accepting & Record<string, any> here this should be parametrized with a generic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't think the customOptions should be a 1-1 mapping, as that would limit the custom plugin, so they could not remove or add options. I think this way the user could build stronger on top if necassary.

@AndrewLeedham
Copy link
Contributor Author

FYI this shouldn't be merged until DefinitelyTyped/DefinitelyTyped#45613 is included as it breaks locally!

This was published and I updated the version here, so good to merge now :)

@NotWoods NotWoods changed the title feat(babel): add typings [DO NOT MERGE] feat(babel): add typings Jun 21, 2020
@shellscape
Copy link
Collaborator

@Andarist if you think this looks good to go, we'll merge this. As the custodian of this plugin, I'd like to get your thumbs up first.

@shellscape
Copy link
Collaborator

ping @Andarist

packages/babel/package.json Outdated Show resolved Hide resolved
packages/babel/test/types.ts Outdated Show resolved Hide resolved
packages/babel/types/index.d.ts Outdated Show resolved Hide resolved
packages/babel/types/index.d.ts Outdated Show resolved Hide resolved
@shellscape shellscape merged commit 7c6f519 into rollup:master Jul 7, 2020
LarsDenBakker pushed a commit to LarsDenBakker/plugins that referenced this pull request Sep 12, 2020
* feat(babel): add typings

* refactor(babel): typings PR feedback

* chore(babel): update lockfile

* refactor(babel): named export + dev dep

* refactor(babel): typing PR feedback round 2

* test(babel): remove old options

* chore(babel): order peerDeps

* fix(babel): typing typos

* refactor(babel): consistent typing names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants