forked from firefox-devtools/debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
110 lines (89 loc) · 3.09 KB
/
index.js
File metadata and controls
110 lines (89 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
import { workerUtils } from "devtools-utils";
const { WorkerDispatcher } = workerUtils;
import type { AstLocation, AstPosition } from "./types";
import type { SourceLocation, Source, SourceId } from "../../types";
import type { SourceScope } from "./getScopes/visitor";
import type { SymbolDeclarations } from "./getSymbols";
import type { PausePointsMap } from "../../reducers/types";
const dispatcher = new WorkerDispatcher();
export const start = (url: string, win: any = window) =>
dispatcher.start(url, win);
export const stop = () => dispatcher.stop();
export const findOutOfScopeLocations = async (
sourceId: string,
position: AstPosition
): Promise<AstLocation[]> =>
dispatcher.invoke("findOutOfScopeLocations", sourceId, position);
export const getNextStep = async (
sourceId: SourceId,
pausedPosition: AstPosition
): Promise<?SourceLocation> =>
dispatcher.invoke("getNextStep", sourceId, pausedPosition);
export const clearASTs = async (): Promise<void> =>
dispatcher.invoke("clearASTs");
export const getScopes = async (
location: SourceLocation
): Promise<SourceScope[]> => dispatcher.invoke("getScopes", location);
export const clearScopes = async (): Promise<void> =>
dispatcher.invoke("clearScopes");
export const clearSymbols = async (): Promise<void> =>
dispatcher.invoke("clearSymbols");
export const getSymbols = async (
sourceId: string
): Promise<SymbolDeclarations> => dispatcher.invoke("getSymbols", sourceId);
export const hasSource = async (sourceId: SourceId): Promise<Source> =>
dispatcher.invoke("hasSource", sourceId);
export const setSource = async (source: Source): Promise<void> =>
dispatcher.invoke("setSource", source);
export const clearSources = async (): Promise<void> =>
dispatcher.invoke("clearSources");
export const hasSyntaxError = async (input: string): Promise<string | false> =>
dispatcher.invoke("hasSyntaxError", input);
export const mapExpression = async (
expression: string,
mappings: {
[string]: string | null
} | null,
bindings: string[],
shouldMapBindings?: boolean,
shouldMapAwait?: boolean
): Promise<{ expression: string }> =>
dispatcher.invoke(
"mapExpression",
expression,
mappings,
bindings,
shouldMapBindings,
shouldMapAwait
);
export const getFramework = async (sourceId: string): Promise<?string> =>
dispatcher.invoke("getFramework", sourceId);
export const getPausePoints = async (
sourceId: string
): Promise<PausePointsMap> => dispatcher.invoke("getPausePoints", sourceId);
export type {
SourceScope,
BindingData,
BindingLocation,
BindingLocationType,
BindingDeclarationLocation,
BindingMetaValue,
BindingType
} from "./getScopes";
export type {
AstLocation,
AstPosition,
PausePoint,
PausePointsMap
} from "./types";
export type {
ClassDeclaration,
SymbolDeclaration,
SymbolDeclarations,
IdentifierDeclaration,
FunctionDeclaration
} from "./getSymbols";