1 | /**
|
2 | * @license
|
3 | * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
4 | * This code may only be used under the BSD style license found at
|
5 | * http://polymer.github.io/LICENSE.txt
|
6 | * The complete set of authors may be found at
|
7 | * http://polymer.github.io/AUTHORS.txt
|
8 | * The complete set of contributors may be found at
|
9 | * http://polymer.github.io/CONTRIBUTORS.txt
|
10 | * Code distributed by Google as part of the polymer project is also
|
11 | * subject to an additional IP rights grant found at
|
12 | * http://polymer.github.io/PATENTS.txt
|
13 | */
|
14 | import { Analyzer } from '../core/analyzer';
|
15 | import { ImmutableArray } from '../model/immutable';
|
16 | import { ScannedFeature, Warning } from '../model/model';
|
17 | import { ParsedDocument } from '../parser/document';
|
18 | /**
|
19 | * An object that can scan and find "features" in a particular
|
20 | * document type.
|
21 | *
|
22 | * @template D The document type
|
23 | * @template A the AST type
|
24 | * @template V the visitor type
|
25 | */
|
26 | export interface Scanner<D extends ParsedDocument<A, V>, A, V> {
|
27 | scan(document: D, visit: (visitor: V) => Promise<void>): Promise<{
|
28 | features: ImmutableArray<ScannedFeature>;
|
29 | warnings?: ImmutableArray<Warning>;
|
30 | }>;
|
31 | }
|
32 | export interface ScannerConstructor {
|
33 | new (analyzer: Analyzer): Scanner<ParsedDocument, {} | null | undefined, {}>;
|
34 | }
|