Skip to content

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Sep 14, 2025

Remove codes like

typeof x !== 'undefined' && x

refs #12981

Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-minifier Area - Minifier C-enhancement Category - New feature or request labels Sep 14, 2025
@sapphi-red sapphi-red self-assigned this Sep 14, 2025
@sapphi-red sapphi-red marked this pull request as ready for review September 14, 2025 08:22
Copilot AI review requested due to automatic review settings September 14, 2025 08:22
@sapphi-red sapphi-red assigned Boshen and unassigned sapphi-red Sep 14, 2025
@sapphi-red sapphi-red marked this pull request as draft September 14, 2025 08:23
@sapphi-red sapphi-red requested a review from Boshen September 14, 2025 08:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the minifier to remove typeof guarded global access expressions, which are patterns commonly used to safely check if a global variable exists before accessing it. The optimization removes these redundant expressions when they don't have side effects.

  • Adds early return logic for expressions without side effects in logical and conditional expression handlers
  • Implements removal of typeof patterns like typeof x !== 'undefined' && x
  • Includes comprehensive test coverage for various comparison operators with logical and conditional expressions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sapphi-red sapphi-red marked this pull request as ready for review September 14, 2025 08:26
@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 14, 2025

Merge activity

@sapphi-red sapphi-red marked this pull request as draft September 14, 2025 08:27
@codspeed-hq
Copy link

codspeed-hq bot commented Sep 14, 2025

CodSpeed Instrumentation Performance Report

Merging #13751 will not alter performance

Comparing 09-14-feat_minifier_remove_typeof_guarded_global_access_expressions (a49d7cf) with main (c364ad1)1

Summary

✅ 37 untouched

Footnotes

  1. No successful run was found on main (3d895cf) during the generation of this report, so c364ad1 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@sapphi-red sapphi-red marked this pull request as ready for review September 14, 2025 08:28
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Sep 14, 2025
…3751)

Remove codes like
```js
typeof x !== 'undefined' && x
```

refs #12981
@graphite-app graphite-app bot force-pushed the 09-14-feat_minifier_remove_typeof_guarded_global_access_expressions branch from 263f051 to a49d7cf Compare September 14, 2025 13:21
@graphite-app graphite-app bot merged commit a49d7cf into main Sep 14, 2025
26 checks passed
@graphite-app graphite-app bot deleted the 09-14-feat_minifier_remove_typeof_guarded_global_access_expressions branch September 14, 2025 13:26
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants