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

Tweak helper compilation targets #12615

Merged
merged 4 commits into from Jan 12, 2021

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jan 12, 2021

Q                       A
License MIT

This PR is extracted from #10897 but only includes small clean-up of @babel/helper-compilation-targets. It also adds browsers: "ie 6" to those test fixtures which does not specify a valid target, so the tests can be more focused and will not be impacted when we later align the preset-env defaults to browserlists defaults.

When `hasTargets` is `false`,  `targets` is always an empty object by definition, `objectToBrowserslist({})` always return `[]` therefore we can remove `objectToBrowserslist`.
@JLHwung JLHwung added the PR: Internal 🏠 A type of pull request used for our changelog categories label Jan 12, 2021
@babel-bot
Copy link
Collaborator

babel-bot commented Jan 12, 2021

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/37377/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 12, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 7f8994f:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@@ -4,5 +4,6 @@
"targets": { "node": 12 },
"shippedProposals": true
}]
]
],
"plugins": [["external-helpers", { "helperVersion": "7.100" }]]
Copy link
Member

Choose a reason for hiding this comment

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

OT: We should really have something like "helperVersion": "__TEST__CURRENT__", and then the test runner replaces __TEST__CURRENT__ with the current version.

  1. This will work across majors
  2. There is no risk of actually reaching the fake version we are using here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can also introduce externalHelpers option for fixture runner that automatically plug in external-helpers with latest helperVersion. So we can place { externalHelpers: true } to the root of fixtures folders in most packages which do not care whether the helper is externalized.

Copy link
Member

Choose a reason for hiding this comment

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

That's a great idea

@JLHwung JLHwung force-pushed the refactor-helper-compilation-targets branch from adf23e0 to 7f8994f Compare January 12, 2021 16:42
@@ -33,7 +33,6 @@ import "core-js/modules/es.array.map.js";
import "core-js/modules/es.array.of.js";
import "core-js/modules/es.array.reduce.js";
import "core-js/modules/es.array.reduce-right.js";
import "core-js/modules/es.array.reverse.js";
Copy link
Contributor Author

@JLHwung JLHwung Jan 12, 2021

Choose a reason for hiding this comment

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

Interesting, after specifying ie 6 as targets, es.array.reverse is removed!

Just checked it is expected, array.reverse is supported since ie 5.5, but marked unsupported until Safari 12.0.2 (probably some bug related): https://unpkg.com/core-js-compat@3.8.2/data.json

@JLHwung JLHwung merged commit eda4130 into babel:main Jan 12, 2021
@JLHwung JLHwung deleted the refactor-helper-compilation-targets branch January 12, 2021 18:09
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Apr 14, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2021
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: Internal 🏠 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