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

core: gather source maps #9101

Merged
merged 90 commits into from
Jul 25, 2019
Merged

core: gather source maps #9101

merged 90 commits into from
Jul 25, 2019

Conversation

connorjclark
Copy link
Collaborator

#9097

Gather source maps.

Nothing done with them yet.

@connorjclark
Copy link
Collaborator Author

connorjclark commented Jun 1, 2019

WIP b/c no tests, and:

I want to put source maps in a new artifact, because gathering them is a lot of network requests and parsing that should only be done if an audit explicitly needs it - which, right now, does not exist.

It could be in a new gatherer, but I'd like to use the Debugger.onScriptParsed to collect the sourceMapURL (instead of parsing it ourselves). So we can add sourceMapURL to ScriptElements, and make a computed artifact, cool. But we don't have the driver in computed artifacts (afaict), so can't make fetch requests in the page to collect the source maps.

Is there a nice way to pass the driver to a computed artifact? Or is it better to forgo Debugger.onScriptParsed and just parse for sourceMapURL?

@patrickhulce
Copy link
Collaborator

Is there a nice way to pass the driver to a computed artifact?

Sadly, no. Computed artifacts are firmly in audit phase territory and there's no way to have dependencies between artifacts unless one is a BaseArtifact

Or is it better to forgo Debugger.onScriptParsed and just parse for sourceMapURL?

I'm not sure I understand the decision here, since it sounds like if you needed a separate gatherer either way you could have the separate one listen on Debugger.onScriptParsed for now? At some point in the future it might make sense to merge these two if the set of audits that need them overlap significantly enough.

@connorjclark
Copy link
Collaborator Author

I'm not sure I understand the decision here, since it sounds like if you needed a separate gatherer either way you could have the separate one listen on Debugger.onScriptParsed for now?

Failed to realize it's not required to do that in the script-elements. yeah separate gatherer makes 100% sense now.

const a = 1;
// Use this obnoxious URL because using a non-existent url from localhost will return a
// bunch of HTML, which will be parsed, and no fetch error occurs.
//# sourceMappingURL=http://www.this-will-not-exist-blah-go-rockets.com/some-map.js.map
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i guess i could do http://localhost:1234 ...

Copy link
Collaborator

Choose a reason for hiding this comment

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

go-rockets

😱

haha 😉 to your actual point though, :1234 is the default for parcel which I tend to have running so that might cause something unexpected too ;) haha

how about an entirely invalid URL? or is that then testing something different you're not concerned about?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i suppose anything that results in a fetch error will work, including a malformed URL.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

go-rockets

Did that just to get a rise out of you ;)

@connorjclark connorjclark changed the title Gather source maps core: gather source maps Jun 1, 2019
@codecov
Copy link

codecov bot commented Jun 1, 2019

Codecov Report

Merging #9101 into master will decrease coverage by 0.01%.
The diff coverage is 94.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9101      +/-   ##
==========================================
- Coverage   91.44%   91.43%   -0.02%     
==========================================
  Files         291      292       +1     
  Lines        9929     9981      +52     
==========================================
+ Hits         9080     9126      +46     
- Misses        849      855       +6
Flag Coverage Δ
#smoke 84.43% <94.87%> (-0.33%) ⬇️
#unit 89.24% <15.38%> (-0.29%) ⬇️
Impacted Files Coverage Δ
lighthouse-core/config/default-config.js 87.5% <ø> (ø) ⬆️
lighthouse-core/gather/gatherers/source-maps.js 94.87% <94.87%> (ø)
lighthouse-core/audits/user-timings.js 96% <0%> (-4%) ⬇️
...house-core/computed/metrics/lantern-speed-index.js 97.14% <0%> (-2.86%) ⬇️
lighthouse-core/gather/gather-runner.js 99.05% <0%> (-0.95%) ⬇️
lighthouse-core/lib/manifest-parser.js 90.55% <0%> (+1.07%) ⬆️

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 0eacf06...5da78cf. Read the comment docs.

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@connorjclark
Copy link
Collaborator Author

it seems half of these comments could be @googlebot 👎

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@connorjclark
Copy link
Collaborator Author

@brendankenny @exterkamp ya'll wanna add your personal emails to the CLA thing? click the Googler link above

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

🗺 🚜
LGTM!

@brendankenny brendankenny merged commit 9cbfa47 into master Jul 25, 2019
@brendankenny brendankenny deleted the gather-source-maps branch July 25, 2019 19:25
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants