roku-debug 0.12.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/FileUtils.js +3 -3
  3. package/dist/FileUtils.js.map +1 -1
  4. package/dist/adapters/DebugProtocolAdapter.d.ts +7 -1
  5. package/dist/adapters/DebugProtocolAdapter.js +54 -2
  6. package/dist/adapters/DebugProtocolAdapter.js.map +1 -1
  7. package/dist/adapters/TelnetAdapter.d.ts +16 -0
  8. package/dist/adapters/TelnetAdapter.js +4 -0
  9. package/dist/adapters/TelnetAdapter.js.map +1 -1
  10. package/dist/debugProtocol/Debugger.d.ts +0 -5
  11. package/dist/debugProtocol/Debugger.js +3 -11
  12. package/dist/debugProtocol/Debugger.js.map +1 -1
  13. package/dist/debugProtocol/responses/ListBreakpointsResponse.d.ts +2 -1
  14. package/dist/debugProtocol/responses/ListBreakpointsResponse.js +1 -1
  15. package/dist/debugProtocol/responses/ListBreakpointsResponse.js.map +1 -1
  16. package/dist/debugSession/BrightScriptDebugSession.d.ts +7 -2
  17. package/dist/debugSession/BrightScriptDebugSession.js +63 -30
  18. package/dist/debugSession/BrightScriptDebugSession.js.map +1 -1
  19. package/dist/interfaces.d.ts +4 -0
  20. package/dist/managers/ActionQueue.d.ts +9 -0
  21. package/dist/managers/ActionQueue.js +38 -0
  22. package/dist/managers/ActionQueue.js.map +1 -0
  23. package/dist/managers/BreakpointManager.d.ts +128 -27
  24. package/dist/managers/BreakpointManager.js +292 -89
  25. package/dist/managers/BreakpointManager.js.map +1 -1
  26. package/dist/managers/FileManager.js +3 -3
  27. package/dist/managers/FileManager.js.map +1 -1
  28. package/dist/managers/LocationManager.js +1 -1
  29. package/dist/managers/LocationManager.js.map +1 -1
  30. package/dist/managers/ProjectManager.d.ts +3 -2
  31. package/dist/managers/ProjectManager.js +11 -4
  32. package/dist/managers/ProjectManager.js.map +1 -1
  33. package/package.json +3 -3
  34. package/roku-debug-0.13.0.tgz +0 -0
  35. package/roku-debug-0.12.2.tgz +0 -0
@@ -12,16 +12,14 @@ export declare class BreakpointManager {
12
12
  rootDir: string;
13
13
  enableSourceMaps?: boolean;
14
14
  };
15
+ private emitter;
16
+ private emit;
15
17
  /**
16
- * Tell the breakpoint manager that no new breakpoints can be verified
17
- * (most likely due to the app being launched and roku not supporting dynamic breakpoints)
18
+ * Subscribe to an event
18
19
  */
19
- lockBreakpoints(): void;
20
- /**
21
- * Indicates whether the app has been launched or not.
22
- * This will determine whether the breakpoints should be written to the files, or marked as not verified (greyed out in vscode)
23
- */
24
- private areBreakpointsLocked;
20
+ on(eventName: 'breakpoints-verified', handler: (data: {
21
+ breakpoints: AugmentedSourceBreakpoint[];
22
+ }) => any): any;
25
23
  /**
26
24
  * A map of breakpoints by what file they were set in.
27
25
  * This does not handle any source-to-dest mapping...these breakpoints are stored in the file they were set in.
@@ -29,17 +27,47 @@ export declare class BreakpointManager {
29
27
  * (this concept may need to be modified once we get live breakpoint support)
30
28
  */
31
29
  private breakpointsByFilePath;
32
- static breakpointIdSequence: number;
30
+ /**
31
+ * A sequence used to generate unique client breakpoint IDs
32
+ */
33
+ private breakpointIdSequence;
33
34
  /**
34
35
  * breakpoint lines are 1-based, and columns are zero-based
35
36
  */
36
- registerBreakpoint(sourceFilePath: string, breakpoint: AugmentedSourceBreakpoint | DebugProtocol.SourceBreakpoint): void;
37
+ setBreakpoint(srcPath: string, breakpoint: AugmentedSourceBreakpoint | DebugProtocol.SourceBreakpoint): AugmentedSourceBreakpoint;
38
+ /**
39
+ * Find a breakpoint by its hash
40
+ * @returns the breakpoint, or undefined if not found
41
+ */
42
+ private getBreakpointByHash;
43
+ /**
44
+ * Find a list of breakpoints by their hashes
45
+ * @returns the breakpoint, or undefined if not found
46
+ */
47
+ private getBreakpointsByHashes;
48
+ /**
49
+ * Mark this breakpoint as verified
50
+ */
51
+ verifyBreakpoint(hash: string, deviceId: number): void;
52
+ /**
53
+ * Whenever breakpoints get verified, they need to be synced back to vscode.
54
+ * This queues up a future function that will emit a batch of all verified breakpoints.
55
+ * @param hash the breakpoint hash that identifies this specific breakpoint based on its features
56
+ */
57
+ private queueVerifyEvent;
58
+ private verifiedBreakpointKeys;
59
+ private isVerifyEventQueued;
60
+ /**
61
+ * Generate a key based on the features of the breakpoint. Every breakpoint that exists at the same location
62
+ * and has the same features should have the same key.
63
+ */
64
+ getBreakpointKey(filePath: string, breakpoint: DebugProtocol.SourceBreakpoint | AugmentedSourceBreakpoint): string;
37
65
  /**
38
66
  * Set/replace/delete the list of breakpoints for this file.
39
- * @param sourceFilePath
67
+ * @param srcPath
40
68
  * @param allBreakpointsForFile
41
69
  */
42
- replaceBreakpoints(sourceFilePath: string, allBreakpointsForFile: DebugProtocol.SourceBreakpoint[]): AugmentedSourceBreakpoint[];
70
+ replaceBreakpoints(srcPath: string, allBreakpointsForFile: DebugProtocol.SourceBreakpoint[]): AugmentedSourceBreakpoint[];
43
71
  /**
44
72
  * Get a list of all breakpoint tasks that should be performed.
45
73
  * This will also exclude files with breakpoints that are not in scope.
@@ -53,6 +81,11 @@ export declare class BreakpointManager {
53
81
  * Write "stop" lines into source code for each breakpoint of each file in the given project
54
82
  */
55
83
  writeBreakpointsForProject(project: Project): Promise<void>;
84
+ private registerPermanentBreakpoint;
85
+ /**
86
+ * The list of breakpoints that were permanently written to a file at the start of a debug session. Used for line offset calculations.
87
+ */
88
+ private permanentBreakpointsBySrcPath;
56
89
  /**
57
90
  * Write breakpoints to the specified file, and update the sourcemaps to match
58
91
  */
@@ -63,48 +96,117 @@ export declare class BreakpointManager {
63
96
  /**
64
97
  * Get the list of breakpoints for the specified file path, or an empty array
65
98
  */
66
- getBreakpointsForFile(filePath: string): AugmentedSourceBreakpoint[];
99
+ private getBreakpointsForFile;
100
+ /**
101
+ * Get the permanent breakpoint with the specified hash
102
+ * @returns the breakpoint with the matching hash, or undefined
103
+ */
104
+ getPermanentBreakpoint(hash: string): BreakpointWorkItem;
105
+ /**
106
+ * Get the list of breakpoints that were written to the source file
107
+ */
108
+ getPermanentBreakpointsForFile(srcPath: string): BreakpointWorkItem[];
67
109
  /**
68
110
  * File paths can be different casing sometimes,
69
111
  * so find the existing key if it exists, or return the file path if it doesn't exist
70
112
  */
71
113
  sanitizeSourceFilePath(filePath: string): string;
114
+ /**
115
+ * Determine if there's a breakpoint set at the given staging folder and line.
116
+ * This is not trivial, so only run when absolutely necessary
117
+ * @param projects the list of projects to scan
118
+ * @param pkgPath the path to the file in the staging directory
119
+ * @param line the 0-based line for the breakpoint
120
+ */
121
+ lineHasBreakpoint(projects: Project[], pkgPath: string, line: number): Promise<boolean>;
122
+ /**
123
+ * Get a diff of all breakpoints that have changed since the last time the diff was retrieved.
124
+ * Sets the new baseline to the current state, so the next diff will be based on this new baseline.
125
+ *
126
+ * All projects should be passed in every time.
127
+ */
128
+ getDiff(projects: Project[]): Promise<Diff>;
129
+ /**
130
+ * Flag indicating whether a `getDiff` function is currently running
131
+ */
132
+ private isGetDiffRunning;
133
+ private lastState;
134
+ }
135
+ export interface Diff {
136
+ added: BreakpointWorkItem[];
137
+ removed: BreakpointWorkItem[];
138
+ unchanged: BreakpointWorkItem[];
72
139
  }
73
- interface AugmentedSourceBreakpoint extends DebugProtocol.SourceBreakpoint {
140
+ export interface AugmentedSourceBreakpoint extends DebugProtocol.SourceBreakpoint {
74
141
  /**
75
- * An ID for this breakpoint, which is used to set/unset breakpoints in the client
142
+ * The path to the source file where this breakpoint was originally set
76
143
  */
77
- id: number;
144
+ srcPath: string;
145
+ /**
146
+ * A unique hash generated for the breakpoint at this exact file/line/column/feature. Every breakpoint with these same features should get the same hash
147
+ */
148
+ hash: string;
78
149
  /**
79
- * Was this breakpoint added before launch? That means this breakpoint was written into the source code as a `stop` statement,
80
- * so if users toggle this breakpoint line on and off, it should get verified every time.
150
+ * The device-provided breakpoint id. A missing ID means this breakpoint has not yet been verified by the device.
81
151
  */
82
- wasAddedBeforeLaunch: boolean;
152
+ deviceId?: number;
153
+ /**
154
+ * A unique ID the debug adapter generates to help send updates to the client about this breakpoint
155
+ */
156
+ id: number;
83
157
  /**
84
158
  * This breakpoint has been verified (i.e. we were able to set it at the given location)
85
159
  */
86
160
  verified: boolean;
161
+ }
162
+ export interface BreakpointWorkItem {
87
163
  /**
88
- * Since breakpoints are written into the source code, we can't delete the `wasAddedBeforeLaunch` breakpoints,
89
- * otherwise the non-sourcemap debugging process's line offsets could get messed up. So, for the `wasAddedBeforeLaunch`
90
- * breakpoints, we need to mark them as hidden when the user unsets them.
164
+ * The path to the source file where this breakpoint was originally set
165
+ */
166
+ srcPath: string;
167
+ /**
168
+ * The absolute path to the file in the staging folder
91
169
  */
92
- isHidden: boolean;
93
- }
94
- interface BreakpointWorkItem {
95
- sourceFilePath: string;
96
170
  stagingFilePath: string;
171
+ /**
172
+ * The device path (i.e. `pkg:/source/main.brs`)
173
+ */
174
+ pkgPath: string;
175
+ /**
176
+ * The path to the rootDir for this breakpoint
177
+ */
97
178
  rootDirFilePath: string;
98
179
  /**
99
180
  * The 1-based line number
100
181
  */
101
182
  line: number;
183
+ /**
184
+ * The device-provided breakpoint id. A missing ID means this breakpoint has not yet been verified by the device.
185
+ */
186
+ deviceId?: number;
187
+ /**
188
+ * An id generated by the debug adapter used to identify this breakpoint in the client
189
+ */
190
+ id: number;
191
+ /**
192
+ * A unique hash generated for the breakpoint at this exact file/line/column/feature. Every breakpoint with these same features should get the same hash
193
+ */
194
+ hash: string;
102
195
  /**
103
196
  * The 0-based column index
104
197
  */
105
198
  column: number;
199
+ /**
200
+ * If set, this breakpoint will only activate when this condition evaluates to true
201
+ */
106
202
  condition?: string;
203
+ /**
204
+ * If set, this breakpoint will only activate once the breakpoint has been hit this many times.
205
+ */
107
206
  hitCondition?: string;
207
+ /**
208
+ * If set, this breakpoint will emit a log message at runtime and will not actually stop at the breakpoint
209
+ */
108
210
  logMessage?: string;
109
211
  /**
110
212
  * `sourceMap` means derived from a source map.
@@ -113,4 +215,3 @@ interface BreakpointWorkItem {
113
215
  */
114
216
  type: 'fileMap' | 'sourceDirs' | 'sourceMap';
115
217
  }
116
- export {};