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

fix: systemjs re-traverses helpers #16225

Merged
merged 11 commits into from Jan 22, 2024

Conversation

liuxingbaoyu
Copy link
Member

Q                       A
Fixed Issues? Fixes #16219
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass?
Documentation PR Link
Any Dependency Changes?
License MIT

@babel-bot
Copy link
Collaborator

babel-bot commented Jan 18, 2024

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

@nicolo-ribaudo
Copy link
Member

Given that the inline helper is difficult to read and if we regress it's likely we would just think "oh a change in the helper, lets commit it", could you add an exec.js test like the one described in the issue?

@liuxingbaoyu
Copy link
Member Author

liuxingbaoyu commented Jan 19, 2024

I tried, but we can't use exec.js with systemjs and I haven't figured out a good way to test this.

@liuxingbaoyu
Copy link
Member Author

liuxingbaoyu commented Jan 19, 2024

CI is weird and fails randomly.
But I can't reproduce it locally.
May be related to zloirock/core-js#1292.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

I'm debugging this locally

Comment on lines 19 to 25
const System = {
register: function (_, module) {
ret = module().execute();
},
};

eval((require, System, content));
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand how this line works -- why do we need to use (require, System, content)?

But also, please do not use eval since the evaluated code can mess up with the global environment 😅 Could you use runCodeInTestContext instead?

Copy link
Member

Choose a reason for hiding this comment

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

Ok let's see if this makes the flakyness go away

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just to make eslint happy. :)
I tried using vm, but it was blocked by require, and I didn't think of runCodeInTestContext.

@nicolo-ribaudo nicolo-ribaudo added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Jan 19, 2024
@liuxingbaoyu
Copy link
Member Author

@nicolo-ribaudo Thank you!

Comment on lines +3 to +8
// delete global.Symbol doesn't work with jest in node 6
Object.defineProperty(global, "Symbol", {
configurable: true,
writable: true,
value: undefined
});
Copy link
Member Author

Choose a reason for hiding this comment

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

To be honest, I don't understand how jest affects our isolation environment in node 6.

Copy link
Member

Choose a reason for hiding this comment

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

Jest does bad things to the global object to implement isolation-but-not-too-much, this workaround is good enough.

@nicolo-ribaudo nicolo-ribaudo merged commit dfa4cc6 into babel:main Jan 22, 2024
50 checks passed
liuxingbaoyu added a commit to liuxingbaoyu/babel that referenced this pull request Mar 5, 2024
Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
Vylpes pushed a commit to Vylpes/random-bunny that referenced this pull request Apr 10, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@babel/traverse](https://babel.dev/docs/en/next/babel-traverse) ([source](https://github.com/babel/babel)) | resolutions | patch | [`7.23.7` -> `7.23.9`](https://renovatebot.com/diffs/npm/@babel%2ftraverse/7.23.7/7.23.9) |

---

### Release Notes

<details>
<summary>babel/babel (@&#8203;babel/traverse)</summary>

### [`v7.23.9`](https://github.com/babel/babel/blob/HEAD/CHANGELOG.md#v7239-2024-01-25)

[Compare Source](babel/babel@v7.23.7...v7.23.9)

##### 🐛 Bug Fix

-   `babel-helper-transform-fixture-test-runner`, `babel-plugin-transform-function-name`, `babel-plugin-transform-modules-systemjs`, `babel-preset-env`
    -   [#&#8203;16225](babel/babel#16225) fix: `systemjs` re-traverses helpers ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16226](babel/babel#16226) Improve decorated private method check ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-plugin-proposal-decorators`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-runtime`, `babel-preset-env`
    -   [#&#8203;16224](babel/babel#16224) Properly sort `core-js@3` imports ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))
-   `babel-traverse`
    -   [#&#8203;15383](babel/babel#15383) fix: Don't throw in `getTypeAnnotation` when using TS+inference ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   Other
    -   [#&#8203;16210](babel/babel#16210) \[eslint] Fix `no-use-before-define` for class ref in fields ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 🏠 Internal

-   `babel-core`, `babel-parser`, `babel-template`
    -   [#&#8203;16222](babel/babel#16222) Migrate `eslint-parser` to cts ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-types`
    -   [#&#8203;16213](babel/babel#16213) Remove `@babel/types` props that are not produced by the parser ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))

##### 🏃‍♀️ Performance

-   `babel-parser`
    -   [#&#8203;16072](babel/babel#16072) perf: Improve parser performance for typescript ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))

##### 🔬 Output optimization

-   `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-destructuring-private`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-class-properties`, `babel-plugin-transform-class-static-block`, `babel-plugin-transform-new-target`, `babel-plugin-transform-parameters`, `babel-plugin-transform-private-methods`, `babel-preset-env`
    -   [#&#8203;16218](babel/babel#16218) Improve temporary variables for decorators ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helpers`, `babel-plugin-proposal-explicit-resource-management`, `babel-runtime-corejs2`, `babel-runtime-corejs3`, `babel-runtime`
    -   [#&#8203;15959](babel/babel#15959) Improve output of `using` ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))

</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 [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/142
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
@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 23, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2024
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.

[Bug]: toPrimitive() does not use the typeof() function
4 participants