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

Use globalThis instead of global in auto.js #413

Merged
merged 2 commits into from
Jul 3, 2023
Merged

Conversation

staltz
Copy link
Contributor

@staltz staltz commented Mar 3, 2022

I was using auto just like the Option 1 in the readme said, and it wasn't working. Then I finally did what this comment said, and it worked. So maybe we should use globalThis instead of global.

Disclaimer: I have edited the code directly in GitHub and I haven't tested this code change. Consider this PR as a light suggestion, I don't mind if you close it.

@charpeni
Copy link
Owner

Thanks for sending this! This is also related to #366.

I'll test this.

@staltz
Copy link
Contributor Author

staltz commented Mar 2, 2023

After one year has passed, gentle reminder this is still relevant. :)

@charpeni
Copy link
Owner

charpeni commented Mar 3, 2023

@staltz If I remember correctly, I've refactored all of this on main but failed to release it since then. 😢

I've refactored how this works, but before releasing it, I wanted to add and update existing tests—mostly with other platforms. Then, I got stuck updating versions, and expo deprecated how to upload builds, so my CircleCI is now outdated, and then the new version is still not released a year later... The infrastructure of tests for this repository is quite tedious to maintain. 😬

Sorry about that! Until I could get time to fix tests and release a new version, I would highly suggest trying to consume main directly.

Copy link
Owner

@charpeni charpeni left a comment

Choose a reason for hiding this comment

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

Thank you!

@charpeni charpeni merged commit 3b313f4 into charpeni:main Jul 3, 2023
@staltz staltz deleted the patch-1 branch July 3, 2023 17:01
creature-water-valley referenced this pull request in ws-4020/mobile-app-crib-notes Jul 25, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[react-native-url-polyfill](https://togithub.com/charpeni/react-native-url-polyfill)
| [`^1.3.0` ->
`^2.0.0`](https://renovatebot.com/diffs/npm/react-native-url-polyfill/1.3.0/2.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-url-polyfill/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-url-polyfill/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-url-polyfill/1.3.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-url-polyfill/1.3.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charpeni/react-native-url-polyfill
(react-native-url-polyfill)</summary>

###
[`v2.0.0`](https://togithub.com/charpeni/react-native-url-polyfill/releases/tag/v2.0.0)

[Compare
Source](https://togithub.com/charpeni/react-native-url-polyfill/compare/v1.3.0...v2.0.0)

#### Highlights

> ⚠️ It was released as a major version because it contains significant
changes, but we don't expect any breaking changes. The upgrade should be
seamless.

##### Official support for Expo & web.

We're now testing `react-native-url-polyfill` against latest versions of
Expo to prevent any issues.

Also, previously, relying on `react-native-url-polyfill/auto` would also
apply the polyfill if executed on the web (e.g., via
`react-native-web`). Starting from now, `react-native-url-polyfill/auto`
won't apply on the web platform and will be a no-op. If you would like
to still apply it on web, you'll need to rely on `setupPolyfill`
directly as such:

```js
import { setupURLPolyfill } from 'react-native-url-polyfill';

setupURLPolyfill();
```

##### Moving away from React Native's internals

To better support different versions of React Native and web usages, we
moved away from using `polyfillGlobal`, which is part of React Native's
internals. Instead, we use `globalThis`. See
[https://github.com/charpeni/react-native-url-polyfill/pull/373](https://togithub.com/charpeni/react-native-url-polyfill/pull/373)
and
[https://github.com/charpeni/react-native-url-polyfill/pull/413](https://togithub.com/charpeni/react-native-url-polyfill/pull/413).

#### What's Changed

- Remove usage of RN's polyfillGlobal by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/373](https://togithub.com/charpeni/react-native-url-polyfill/pull/373)
- Fix a phrasing issue in README by
[@&#8203;plbrault](https://togithub.com/plbrault) in
[https://github.com/charpeni/react-native-url-polyfill/pull/442](https://togithub.com/charpeni/react-native-url-polyfill/pull/442)
- Add test for Expo 48 by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/453](https://togithub.com/charpeni/react-native-url-polyfill/pull/453)
- Use globalThis instead of global in auto.js by
[@&#8203;staltz](https://togithub.com/staltz) in
[https://github.com/charpeni/react-native-url-polyfill/pull/413](https://togithub.com/charpeni/react-native-url-polyfill/pull/413)
- Fix Typescript error by [@&#8203;raykle](https://togithub.com/raykle)
in
[https://github.com/charpeni/react-native-url-polyfill/pull/444](https://togithub.com/charpeni/react-native-url-polyfill/pull/444)
- Add `bundle-size` script by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/455](https://togithub.com/charpeni/react-native-url-polyfill/pull/455)
- Don't auto polyfill on web by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/456](https://togithub.com/charpeni/react-native-url-polyfill/pull/456)
- Only default export is available soon by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/458](https://togithub.com/charpeni/react-native-url-polyfill/pull/458)

#### New Contributors

- [@&#8203;plbrault](https://togithub.com/plbrault) made their first
contribution in
[https://github.com/charpeni/react-native-url-polyfill/pull/442](https://togithub.com/charpeni/react-native-url-polyfill/pull/442)
- [@&#8203;staltz](https://togithub.com/staltz) made their first
contribution in
[https://github.com/charpeni/react-native-url-polyfill/pull/413](https://togithub.com/charpeni/react-native-url-polyfill/pull/413)
- [@&#8203;raykle](https://togithub.com/raykle) made their first
contribution in
[https://github.com/charpeni/react-native-url-polyfill/pull/444](https://togithub.com/charpeni/react-native-url-polyfill/pull/444)

**Full Changelog**:
charpeni/react-native-url-polyfill@v1.3.0...v2.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ws-4020/mobile-app-crib-notes).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44LjExIiwidXBkYXRlZEluVmVyIjoiMzYuOC4xMSIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
github-merge-queue bot referenced this pull request in valora-inc/wallet Apr 27, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[react-native-url-polyfill](https://togithub.com/charpeni/react-native-url-polyfill)
| [`^1.3.0` ->
`^2.0.0`](https://renovatebot.com/diffs/npm/react-native-url-polyfill/1.3.0/2.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-url-polyfill/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-url-polyfill/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-url-polyfill/1.3.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-url-polyfill/1.3.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charpeni/react-native-url-polyfill
(react-native-url-polyfill)</summary>

###
[`v2.0.0`](https://togithub.com/charpeni/react-native-url-polyfill/releases/tag/v2.0.0)

[Compare
Source](https://togithub.com/charpeni/react-native-url-polyfill/compare/v1.3.0...v2.0.0)

#### Highlights

> ⚠️ It was released as a major version because it contains significant
changes, but we don't expect any breaking changes. The upgrade should be
seamless.

##### Official support for Expo & web.

We're now testing `react-native-url-polyfill` against latest versions of
Expo to prevent any issues.

Also, previously, relying on `react-native-url-polyfill/auto` would also
apply the polyfill if executed on the web (e.g., via
`react-native-web`). Starting from now, `react-native-url-polyfill/auto`
won't apply on the web platform and will be a no-op. If you would like
to still apply it on web, you'll need to rely on `setupPolyfill`
directly as such:

```js
import { setupURLPolyfill } from 'react-native-url-polyfill';

setupURLPolyfill();
```

##### Moving away from React Native's internals

To better support different versions of React Native and web usages, we
moved away from using `polyfillGlobal`, which is part of React Native's
internals. Instead, we use `globalThis`. See
[https://github.com/charpeni/react-native-url-polyfill/pull/373](https://togithub.com/charpeni/react-native-url-polyfill/pull/373)
and
[https://github.com/charpeni/react-native-url-polyfill/pull/413](https://togithub.com/charpeni/react-native-url-polyfill/pull/413).

#### What's Changed

- Remove usage of RN's polyfillGlobal by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/373](https://togithub.com/charpeni/react-native-url-polyfill/pull/373)
- Fix a phrasing issue in README by
[@&#8203;plbrault](https://togithub.com/plbrault) in
[https://github.com/charpeni/react-native-url-polyfill/pull/442](https://togithub.com/charpeni/react-native-url-polyfill/pull/442)
- Add test for Expo 48 by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/453](https://togithub.com/charpeni/react-native-url-polyfill/pull/453)
- Use globalThis instead of global in auto.js by
[@&#8203;staltz](https://togithub.com/staltz) in
[https://github.com/charpeni/react-native-url-polyfill/pull/413](https://togithub.com/charpeni/react-native-url-polyfill/pull/413)
- Fix Typescript error by [@&#8203;raykle](https://togithub.com/raykle)
in
[https://github.com/charpeni/react-native-url-polyfill/pull/444](https://togithub.com/charpeni/react-native-url-polyfill/pull/444)
- Add `bundle-size` script by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/455](https://togithub.com/charpeni/react-native-url-polyfill/pull/455)
- Don't auto polyfill on web by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/456](https://togithub.com/charpeni/react-native-url-polyfill/pull/456)
- Only default export is available soon by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/458](https://togithub.com/charpeni/react-native-url-polyfill/pull/458)

#### New Contributors

- [@&#8203;plbrault](https://togithub.com/plbrault) made their first
contribution in
[https://github.com/charpeni/react-native-url-polyfill/pull/442](https://togithub.com/charpeni/react-native-url-polyfill/pull/442)
- [@&#8203;staltz](https://togithub.com/staltz) made their first
contribution in
[https://github.com/charpeni/react-native-url-polyfill/pull/413](https://togithub.com/charpeni/react-native-url-polyfill/pull/413)
- [@&#8203;raykle](https://togithub.com/raykle) made their first
contribution in
[https://github.com/charpeni/react-native-url-polyfill/pull/444](https://togithub.com/charpeni/react-native-url-polyfill/pull/444)

**Full Changelog**:
charpeni/react-native-url-polyfill@v1.3.0...v2.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMjEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjMyMS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJucG0iLCJyZW5vdmF0ZSJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
shottah referenced this pull request in zed-io/kolektivo May 15, 2024
…inc#5356)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[react-native-url-polyfill](https://togithub.com/charpeni/react-native-url-polyfill)
| [`^1.3.0` ->
`^2.0.0`](https://renovatebot.com/diffs/npm/react-native-url-polyfill/1.3.0/2.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-url-polyfill/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-url-polyfill/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-url-polyfill/1.3.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-url-polyfill/1.3.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charpeni/react-native-url-polyfill
(react-native-url-polyfill)</summary>

###
[`v2.0.0`](https://togithub.com/charpeni/react-native-url-polyfill/releases/tag/v2.0.0)

[Compare
Source](https://togithub.com/charpeni/react-native-url-polyfill/compare/v1.3.0...v2.0.0)

#### Highlights

> ⚠️ It was released as a major version because it contains significant
changes, but we don't expect any breaking changes. The upgrade should be
seamless.

##### Official support for Expo & web.

We're now testing `react-native-url-polyfill` against latest versions of
Expo to prevent any issues.

Also, previously, relying on `react-native-url-polyfill/auto` would also
apply the polyfill if executed on the web (e.g., via
`react-native-web`). Starting from now, `react-native-url-polyfill/auto`
won't apply on the web platform and will be a no-op. If you would like
to still apply it on web, you'll need to rely on `setupPolyfill`
directly as such:

```js
import { setupURLPolyfill } from 'react-native-url-polyfill';

setupURLPolyfill();
```

##### Moving away from React Native's internals

To better support different versions of React Native and web usages, we
moved away from using `polyfillGlobal`, which is part of React Native's
internals. Instead, we use `globalThis`. See
[https://github.com/charpeni/react-native-url-polyfill/pull/373](https://togithub.com/charpeni/react-native-url-polyfill/pull/373)
and
[https://github.com/charpeni/react-native-url-polyfill/pull/413](https://togithub.com/charpeni/react-native-url-polyfill/pull/413).

#### What's Changed

- Remove usage of RN's polyfillGlobal by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/373](https://togithub.com/charpeni/react-native-url-polyfill/pull/373)
- Fix a phrasing issue in README by
[@&#8203;plbrault](https://togithub.com/plbrault) in
[https://github.com/charpeni/react-native-url-polyfill/pull/442](https://togithub.com/charpeni/react-native-url-polyfill/pull/442)
- Add test for Expo 48 by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/453](https://togithub.com/charpeni/react-native-url-polyfill/pull/453)
- Use globalThis instead of global in auto.js by
[@&#8203;staltz](https://togithub.com/staltz) in
[https://github.com/charpeni/react-native-url-polyfill/pull/413](https://togithub.com/charpeni/react-native-url-polyfill/pull/413)
- Fix Typescript error by [@&#8203;raykle](https://togithub.com/raykle)
in
[https://github.com/charpeni/react-native-url-polyfill/pull/444](https://togithub.com/charpeni/react-native-url-polyfill/pull/444)
- Add `bundle-size` script by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/455](https://togithub.com/charpeni/react-native-url-polyfill/pull/455)
- Don't auto polyfill on web by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/456](https://togithub.com/charpeni/react-native-url-polyfill/pull/456)
- Only default export is available soon by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/charpeni/react-native-url-polyfill/pull/458](https://togithub.com/charpeni/react-native-url-polyfill/pull/458)

#### New Contributors

- [@&#8203;plbrault](https://togithub.com/plbrault) made their first
contribution in
[https://github.com/charpeni/react-native-url-polyfill/pull/442](https://togithub.com/charpeni/react-native-url-polyfill/pull/442)
- [@&#8203;staltz](https://togithub.com/staltz) made their first
contribution in
[https://github.com/charpeni/react-native-url-polyfill/pull/413](https://togithub.com/charpeni/react-native-url-polyfill/pull/413)
- [@&#8203;raykle](https://togithub.com/raykle) made their first
contribution in
[https://github.com/charpeni/react-native-url-polyfill/pull/444](https://togithub.com/charpeni/react-native-url-polyfill/pull/444)

**Full Changelog**:
charpeni/react-native-url-polyfill@v1.3.0...v2.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMjEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjMyMS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJucG0iLCJyZW5vdmF0ZSJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants