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

allow PluginPass.file.addImport to create empty import statements #6022

Merged
merged 2 commits into from
Jul 28, 2017
Merged

allow PluginPass.file.addImport to create empty import statements #6022

merged 2 commits into from
Jul 28, 2017

Conversation

chocolateboy
Copy link
Contributor

Q A
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? Yes
Deprecations? No
Spec Compliancy? No
Tests Added/Pass? Yes
Fixed Tickets Fixes #6021
License MIT

Omitting addImport's second argument creates an import statement with an empty specifiers array i.e. an empty import statement:

plugin

    Program (path, { file }) {
        file.addImport('foo-bar/register')
    }

output

import "foo-bar/register";

 #6021

omitting addImport's second argument creates an import statement with an
empty `specifiers` array i.e. an empty import statement:

plugin:

    Program (path, { file }) {
        file.addImport('foo-bar/register')
    }

output:

    import "foo-bar/register";
@existentialism existentialism added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Jul 28, 2017
@hzoo
Copy link
Member

hzoo commented Jul 28, 2017

Awesome!! nice work here (and we should add this method to the handbook in a section if someone wants to do that)

Ah I see you wanted this for https://github.com/chocolateboy/babel-plugin-source-map-support/blob/master/src/plugin.js, which is what babel-register adds as well.

@hzoo hzoo merged commit 605adc9 into babel:7.0 Jul 28, 2017
@chocolateboy chocolateboy deleted the plugin-add-empty-import branch August 7, 2017 19:13
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants