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): export * as ns support #511

Merged
merged 4 commits into from Aug 3, 2020

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jul 27, 2020

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

I can't add tests yet because Babel 7.11 is not yet published.

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

@babel/preset-env 7.11 will support export * as ns(babel/babel#11849), where a new caller support flag supportsExportNamespaceFrom is introduced. This PR declares this flag so Babel can skip export-namespace-from transform when it is bundled from Rollup.

The Rollup 1 peer dependence is bumped to 1.26.0, in which export * as ns was initially supported.

BREAKING CHANGES: rollup 1 dependency is bumped to ^1.26.0
Copy link
Contributor

@pnevares pnevares left a comment

Choose a reason for hiding this comment

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

👍

@@ -45,6 +45,7 @@ const unpackInputPluginOptions = ({ skipPreflightCheck = false, ...rest }) => {
supportsStaticESM: true,
supportsDynamicImport: true,
supportsTopLevelAwait: true,
supportsExportNamespaceFrom: true,
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be possible to make this conditional (from Rollup's perspective) to avoid changing peer dep range and thus avoid this being a breaking change. I bet it should be rather easily possible to read Babel's version somehow as well, right?

Copy link
Contributor Author

@JLHwung JLHwung Jul 29, 2020

Choose a reason for hiding this comment

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

We don't need detect Babel version, undeclared caller flags will be considered as noop for preset-env.

I have updated PR to check rollup versions. however it seems that I can not retrieve version from rollup/package.json.

@@ -1,4 +1,5 @@
import * as babel from '@babel/core';
import { VERSION } from "rollup";
Copy link
Member

Choose a reason for hiding this comment

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

I'm not 100% sure but it probably would be better to grab this from this: https://rollupjs.org/guide/en/#thismeta-rollupversion-string-watchmode-boolean . This would require moving unpackInputPluginOptions call to one of the hooks (buildStart?) though.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch. One more argument is that importing rollup from a plugin is not guaranteed to give you the correct Rollup version in more complex npm dependency scenarios, especially if Rollup is used programmatically while this.meta.rollupVersion is guaranteed to be correct.

Copy link
Member

@Andarist Andarist left a comment

Choose a reason for hiding this comment

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

@shellscape could you recheck commits format?

@shellscape shellscape changed the title declares export * as ns support feat(babel): export * as ns support Aug 1, 2020
@shellscape
Copy link
Collaborator

@Andarist yeah I'll fix that on merge

@shellscape
Copy link
Collaborator

@JLHwung you have the following in your first commit on this fork:

BREAKING CHANGES: rollup 1 dependency is bumped to ^1.26.0

But the "no" checkbox for Breaking Changes is checked. You also don't have a corresponding update to package.json - is one needed?

@Andarist
Copy link
Member

Andarist commented Aug 1, 2020

@shellscape the PR had a breaking change in it at first but it has been changed to avoid it after a review

@JLHwung
Copy link
Contributor Author

JLHwung commented Aug 1, 2020

@JLHwung you have the following in your first commit on this fork:


BREAKING CHANGES: rollup 1 dependency is bumped to ^1.26.0

But the "no" checkbox for Breaking Changes is checked. You also don't have a corresponding update to package.json - is one needed?

I wish I could edit the commit history but unfortunately I don't get computers in hands for a few days. Can you rebase interactively? Thank you.

@shellscape shellscape merged commit 5fa1559 into rollup:master Aug 3, 2020
@shellscape
Copy link
Collaborator

shellscape commented Aug 13, 2020

Hey folks, I tried publishing these changes just now and ran into an error with running the tests after the update to Ava. I have an issue open (avajs/ava#2559) and will wait to hear back. I really don't want to publish without tests running successfully.

We're cool now. New version published

LarsDenBakker pushed a commit to LarsDenBakker/plugins that referenced this pull request Sep 12, 2020
* declares export * as ns support

* check rollup version

* oof

* refactor: get rollupVersion from this.meta in options hook
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

5 participants