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

Support branching in static analysis #255

Merged
merged 1 commit into from
Jan 30, 2019
Merged

Support branching in static analysis #255

merged 1 commit into from
Jan 30, 2019

Conversation

guybedford
Copy link
Contributor

@guybedford guybedford commented Jan 30, 2019

This fixes #235 in supporting asset analysis on statements like:

`const filename = `${__dirname}/fonts/Inter-UI-${fontWeight === 'bold' ? 'Bold' : 'Regular'}.woff2`;`.

The static evaluator from https://github.com/substack/static-eval is forked and updated to support two branches throughout the analysis paths (any more branches and we go back to an unknown deoptimization state).

Thus even more complex compound cases like __dirname + '/' + (unknown ? 'a' : 'b') + (__dirname ? 'a' : 'b') all get supported fine.

Thanks @styfle for the issue, it's these observations and requests that allow the analysis to develop :)

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@04fbbe7). Click here to learn what that means.
The diff coverage is 53.77%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #255   +/-   ##
=========================================
  Coverage          ?   64.51%           
=========================================
  Files             ?       17           
  Lines             ?      854           
  Branches          ?        0           
=========================================
  Hits              ?      551           
  Misses            ?      303           
  Partials          ?        0
Impacted Files Coverage Δ
src/loaders/relocate-loader.js 97.23% <100%> (ø)
src/utils/static-eval.js 43.67% <43.67%> (ø)

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 04fbbe7...aa497b9. Read the comment docs.

@rauchg rauchg merged commit aa4114f into master Jan 30, 2019
@rauchg rauchg deleted the ternary branch January 30, 2019 21:28
This pull request was closed.
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.

Fails to deploy static files when using ternary operator
3 participants