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

Replace typeof before DCE #7788

Merged
merged 2 commits into from
Mar 9, 2022
Merged

Replace typeof before DCE #7788

merged 2 commits into from
Mar 9, 2022

Conversation

mischnic
Copy link
Member

@mischnic mischnic commented Mar 3, 2022

Part of #7691

For these patterns:

(function(root, factory) {
    if ( typeof exports === 'object' ) {
        if ( typeof module === 'object' ) {
            module.exports = factory( require("js-sha256"), require("base64-js") );
        } else {
            exports["keycloak"] = factory( require("js-sha256"), require("base64-js") );
        }
    } else {
		...inlined js-sha256 and base64-js...
	}
...

Parcel would previously include both the requires and the else branch

@height
Copy link

height bot commented Mar 3, 2022

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@mischnic mischnic force-pushed the falsy-branch-typeof branch from 8edc3ba to 1514c67 Compare March 3, 2022 10:09
@devongovett devongovett merged commit 083e530 into v2 Mar 9, 2022
@devongovett devongovett deleted the falsy-branch-typeof branch March 9, 2022 04:23
wbinnssmith pushed a commit that referenced this pull request Mar 10, 2022
wbinnssmith pushed a commit that referenced this pull request May 12, 2022
* internalization bug

* Cleanup

* Always add assets to reachable bundles

* cleanup

* fixed test regressions

* add ref edges whenever there are bundle edges

* add edge from bundlegroups to bundles wip

* * Get inline bundles in bundle group in HTML packager
* Traverse each bundle instead of iterating each outbound node
* Add edge between root and bundle

* use and follow reference edges again

* set env whenever we create bundles

* Check to add parallel edges from all paths to an asset from a bundle

* Always register referenced bundles before pruning when building bundle manifest

* Revert "set env whenever we create bundles"

This reverts commit 73ad828.

* Add test for referenced roots in bundle manifest

* Add reused sibling bundles to asyncBundleRootGraph

* Add test case for asset that has both an async and sync import

* ExperimentalBundler: stop at isolated bundles

* ExperimentalBundler: fix step 7 comment

* ExperimentalBundler: initialize entry bundles with no ancestors

* ExperimentalBundler: accept shared bundles extracted from workers

* Remove unused async bundles if needed

* Scope-hositing with new bundler: allow less duplication

* Uncomment line in getSymbolResolution

* Consider sibling availability before removing from ancestorAssets

* Uncomment line in getSymbolResolution

* Upgrade flow to 0.173.0 (#7809)

* Remove reachableBundles

* Bump lmdb (#7797)

* Replace typeof before DCE (#7788)

* Consider sibling availability before removing from ancestorAssets

* Consider assets in siblings before duplicating

* Remove unrelated change

* Don't consider any of parent's async bundles as sibling

* Remove unused structure

* remove eager bundle reuse and related lending code

* Alter tests with mode production and correct assets with logic for splittable bundles

* Skip unused dependencies in experimental bundler

* Implement getBundleFromBundleRoot

* Only add dependencies to CSS module JS, not CSS

* Handle multiple assets on dependencies in reachability

* ScopeHoistingPackager: Handle different wrapped ancestries in wrapping dfs

* skip assets for reachable if isolated or inline fix invariant

* Use bundleGroup instead of bundle root for determining needsStableName

* Add bundle.mainEntryAsset

* fixup! Add bundle.mainEntryAsset

Co-authored-by: Gora Kong <[email protected]>
Co-authored-by: Will Binns-Smith <[email protected]>
Co-authored-by: Eric Eldredge <[email protected]>
Co-authored-by: Niklas Mischkulnig <[email protected]>
Co-authored-by: Agnieszka Gawrys <[email protected]>
Co-authored-by: Devon Govett <[email protected]>
gorakong pushed a commit that referenced this pull request Nov 3, 2022
* upstream/v2: (26 commits)
  Replace typeof before DCE (#7788)
  Bump lmdb (#7797)
  Upgrade flow to 0.173.0 (#7809)
  Prevent `term-size` from being bundled (#7750)
  Pin [email protected] (#7763)
  Fix Windows CI (#7774)
  Upgrade Flow to 0.171.0 (#7667)
  Move tests to GitHub actions (#7678)
  v2.3.2
  Fix autoinstalling node builtins (#7735)
  Fix lint
  Use pinned versions
  Don't build native packages again during publish step
  Fix build
  Fix autoinstall
  v2.3.1
  Add diagnostic for failed autoinstall of node polyfill (#7682)
  v2.3.0
  Changelog for 2.3.0
  Support React 18 prereleases and experimental versions with automatic JSX runtime (#7642)
  ...
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.

2 participants