Skip to content

Don't polyfill Temporal and Intl onto the global object#851

Merged
ryzokuken merged 1 commit intomainfrom
778-no-globalthis-polyfill
Aug 27, 2020
Merged

Don't polyfill Temporal and Intl onto the global object#851
ryzokuken merged 1 commit intomainfrom
778-no-globalthis-polyfill

Conversation

@ptomato
Copy link
Copy Markdown
Collaborator

@ptomato ptomato commented Aug 26, 2020

In order to avoid breaking the web when Temporal is shipped, don't
polyfill onto the global object. We don't want any if (typeof Temporal === undefined) checks in the wild until browsers actually start
shipping Temporal.

We do still need it on the global object for the browser playground and
the test262 tests, so we now have two separate entry points to the
library: index.mjs and polyfill.mjs.

Closes: #778

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 26, 2020

Codecov Report

Merging #851 into main will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #851   +/-   ##
=======================================
  Coverage   92.35%   92.35%           
=======================================
  Files          17       17           
  Lines        4840     4840           
  Branches      751      751           
=======================================
  Hits         4470     4470           
  Misses        363      363           
  Partials        7        7           
Flag Coverage Δ
#test262 57.78% <100.00%> (ø)
#tests 87.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
polyfill/lib/shim.mjs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8fa7b1...46aad33. Read the comment docs.

Copy link
Copy Markdown
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

usually i use the term "shim" for a self-installing polyfill ¯\_(ツ)_/¯

In order to avoid breaking the web when Temporal is shipped, don't
polyfill onto the global object. We don't want any `if (typeof Temporal
=== undefined)` checks in the wild until browsers actually start
shipping Temporal.

We do still need it on the global object for the browser playground and
the test262 tests, so we now have two separate entry points to the
library: index.mjs and shim.mjs.

Closes: #778
@ptomato ptomato force-pushed the 778-no-globalthis-polyfill branch from 2c5ec07 to 46aad33 Compare August 26, 2020 22:41
Copy link
Copy Markdown
Member

@ryzokuken ryzokuken left a comment

Choose a reason for hiding this comment

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

Perfect, thanks a ton.

@ryzokuken ryzokuken merged commit 9223ba8 into main Aug 27, 2020
@ryzokuken ryzokuken deleted the 778-no-globalthis-polyfill branch August 27, 2020 05:03
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.

[Polyfill] Usage and Install recommendations

3 participants