-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
misc(tsc): reorganize and expose external interfaces #4788
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/** | ||
* @license Copyright 2018 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
declare namespace LH.Audit { | ||
export interface ScoringModes { | ||
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. enum? 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. it looks like we can't (at least in a 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. I could be wrong, but I can't make it work. Playground example 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 mean you're not a fan of this!? 😆 |
||
NUMERIC: 'numeric'; | ||
BINARY: 'binary'; | ||
} | ||
|
||
export type ScoringModeValue = Audit.ScoringModes[keyof Audit.ScoringModes]; | ||
|
||
export interface Meta { | ||
name: string; | ||
description: string; | ||
helpText: string; | ||
requiredArtifacts: Array<string>; | ||
failureDescription?: string; | ||
informative?: boolean; | ||
manual?: boolean; | ||
scoreDisplayMode?: Audit.ScoringModeValue; | ||
} | ||
|
||
export interface Heading { | ||
key: string; | ||
itemType: string; | ||
text: string; | ||
} | ||
|
||
export interface HeadingsResult { | ||
results: number; | ||
headings: Array<Audit.Heading>; | ||
passes: boolean; | ||
debugString?: string; | ||
} | ||
|
||
// TODO: placeholder typedefs until Details are typed | ||
export interface DetailsRendererDetailsSummary { | ||
wastedMs?: number; | ||
wastedBytes?: number; | ||
} | ||
|
||
// TODO: placeholder typedefs until Details are typed | ||
export interface DetailsRendererDetailsJSON { | ||
type: 'table'; | ||
headings: Array<Audit.Heading>; | ||
items: Array<{[x: string]: string}>; | ||
summary: DetailsRendererDetailsSummary; | ||
} | ||
|
||
// Type returned by Audit.audit(). Only rawValue is required. | ||
export interface Product { | ||
rawValue: boolean | number | null; | ||
displayValue?: string; | ||
debugString?: string; | ||
score?: number; | ||
extendedInfo?: {value: string}; | ||
notApplicable?: boolean; | ||
error?: boolean; | ||
// TODO: define details | ||
details?: object; | ||
} | ||
|
||
/* Audit result returned in Lighthouse report. All audits offer a description and score of 0-1 */ | ||
export interface Result { | ||
rawValue: boolean | number | null; | ||
displayValue: string; | ||
debugString?: string; | ||
score: number; | ||
scoreDisplayMode: ScoringModeValue; | ||
description: string; | ||
extendedInfo?: {value: string}; | ||
notApplicable?: boolean; | ||
error?: boolean; | ||
name: string; | ||
helpText?: string; | ||
informative?: boolean; | ||
manual?: boolean; | ||
// TODO: define details | ||
details?: object; | ||
} | ||
|
||
export interface Results { | ||
[metric: string]: Result; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @license Copyright 2018 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
declare namespace LH.Gatherer { | ||
export interface PassContext { | ||
options: object; | ||
} | ||
|
||
export interface LoadData { | ||
networkRecords: Array<LH.NetworkRequest>; | ||
devtoolsLog: Array<void>; | ||
trace: {trraceEvents: Array<LH.TraceEvent>} | ||
} | ||
} |
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.
global namespaces are merged, so this adds to the
LH
namespace defined inexterns.d.ts