-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
report: use source maps to show original file name #10930
Changes from all commits
25493dd
15009ae
cfd62ed
d61abda
f22bd04
5cd23f8
832ceca
7af5053
9ceca12
3feb713
16b7771
c63b65e
0fbf2fc
e853c83
49d19be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -218,12 +218,23 @@ declare global { | |||||
*/ | ||||||
export interface SourceLocationValue { | ||||||
type: 'source-location'; | ||||||
/** urls from the network are always valid urls. otherwise, urls come from either a comment or header, and may not be well-formed. */ | ||||||
/** A "url" representing the source file. May not be a valid URL, see `urlProvider`. */ | ||||||
url: string; | ||||||
/** 'network' when the url is the actual, observed resource url. 'comment' when the url comes from a sourceMapURL comment or X-SourceMap header */ | ||||||
/** | ||||||
* - `network` when the url is the actual, observed resource url. This is always a valid URL. | ||||||
* - `comment` when the url comes from a sourceURL comment. This could be anything, really. | ||||||
*/ | ||||||
urlProvider: 'network' | 'comment'; | ||||||
/** Zero-indexed. */ | ||||||
line: number; | ||||||
column: number; | ||||||
/** The original file location from the source map. */ | ||||||
original?: { | ||||||
connorjclark marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
/** The relevant file from the map's `sources` array. */ | ||||||
file: string; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be a misnomer. This value comes from a source maps I added a comment to note this. |
||||||
line: number; | ||||||
column: number; | ||||||
}; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also... do you know what's up with this comment? lighthouse/types/audit-details.d.ts Line 221 in 40baa22
" urls from the network are always valid urls" vs "urls [...] may not be well-formed" 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can put absolutely anything in a soruceMappingURL comment or the associated header. Treating this user input as a well-formed URL is error prone. In some cases the protocol hides the true resource (network) url from us, if there is a comment url present. see
so we must have a distinction between these two sources of "url", which is what |
||||||
} | ||||||
|
||||||
/** | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may need a few more tests to hit the different cases, e.g. when there's no source map and the
title
is appended to the titlerenderTextURL()
produces, we'd want to be sure to get an alert if changes torenderTextURL
broke the rendering ofsource-location
.