roku-debug 0.23.7 → 0.23.9

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.
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProtocolCapabilities = void 0;
4
+ const semver = require("semver");
5
+ /**
6
+ * Encapsulates the version-based capability checks for the BrightScript debug protocol.
7
+ * Used by `DebugProtocolClient` for the live session (version set during the handshake),
8
+ * and by `DebugProtocolAdapter` as a standalone fallback seeded from the device-info
9
+ * `brightscript-debugger-version` when no client has connected yet.
10
+ */
11
+ class ProtocolCapabilities {
12
+ constructor(protocolVersion, osVersion) {
13
+ this.protocolVersion = ProtocolCapabilities.resolveProtocolVersion(protocolVersion, osVersion);
14
+ }
15
+ /**
16
+ * Some Roku firmware versions support the debug protocol but omit `brightscript-debugger-version`
17
+ * from device-info, so fall back to deriving the protocol version from the OS version when the
18
+ * caller didn't get one from the device.
19
+ */
20
+ static resolveProtocolVersion(protocolVersion, osVersion) {
21
+ if (semver.valid(protocolVersion)) {
22
+ return protocolVersion;
23
+ }
24
+ const coercedOs = osVersion ? semver.coerce(osVersion) : null;
25
+ if (!coercedOs) {
26
+ return protocolVersion;
27
+ }
28
+ for (const entry of ProtocolCapabilities.osToProtocolVersions) {
29
+ if (semver.gte(coercedOs, entry.os)) {
30
+ return entry.protocol;
31
+ }
32
+ }
33
+ return protocolVersion;
34
+ }
35
+ /**
36
+ * Prior to protocol v3.1.0, the Roku device would regularly set the wrong thread as "active",
37
+ * so this flag lets us know if we should use our better-than-nothing workaround
38
+ */
39
+ get enableThreadHoppingWorkaround() {
40
+ return semver.satisfies(this.protocolVersion, '<3.1.0');
41
+ }
42
+ /**
43
+ * Starting in protocol v3.1.0, component library breakpoints must be added in the format
44
+ * `lib:/<library_name>/<filepath>`, but prior they didn't require this.
45
+ */
46
+ get enableComponentLibrarySpecificBreakpoints() {
47
+ return semver.satisfies(this.protocolVersion, '>=3.1.0');
48
+ }
49
+ /**
50
+ * Starting in protocol v3.1.0, breakpoints can support conditional expressions.
51
+ */
52
+ get supportsConditionalBreakpoints() {
53
+ return semver.satisfies(this.protocolVersion, '>=3.1.0');
54
+ }
55
+ /**
56
+ * Starting in protocol v3.1.0, breakpoints can carry a hit count (ignoreCount).
57
+ */
58
+ get supportsHitConditionalBreakpoints() {
59
+ return semver.satisfies(this.protocolVersion, '>=3.1.0');
60
+ }
61
+ get supportsBreakpointRegistrationWhileRunning() {
62
+ return semver.satisfies(this.protocolVersion, '>=3.2.0');
63
+ }
64
+ get supportsBreakpointVerification() {
65
+ return semver.satisfies(this.protocolVersion, '>=3.2.0');
66
+ }
67
+ get supportsVirtualVariables() {
68
+ return semver.satisfies(this.protocolVersion, '>=3.3.0');
69
+ }
70
+ get supportsExceptionBreakpoints() {
71
+ return semver.satisfies(this.protocolVersion, '>=3.3.0');
72
+ }
73
+ /**
74
+ * Due to casing issues with the variables request on older protocols, we first try the
75
+ * request in the supplied case and retry in lower case on failure.
76
+ */
77
+ get enableVariablesLowerCaseRetry() {
78
+ return semver.satisfies(this.protocolVersion, '<3.1.0');
79
+ }
80
+ /**
81
+ * The `execute` command was unreliable before protocol v3.0.0.
82
+ */
83
+ get supportsExecuteCommand() {
84
+ return semver.satisfies(this.protocolVersion, '>=3.0.0');
85
+ }
86
+ /**
87
+ * The device emits compile-error update events starting in protocol v3.1.0.
88
+ */
89
+ get supportsCompileErrorReporting() {
90
+ return semver.satisfies(this.protocolVersion, '>=3.1.0');
91
+ }
92
+ }
93
+ exports.ProtocolCapabilities = ProtocolCapabilities;
94
+ /**
95
+ * Roku OS versions that introduced each debug protocol version, ordered newest-first so
96
+ * we can pick the highest protocol whose OS floor the device meets.
97
+ */
98
+ ProtocolCapabilities.osToProtocolVersions = [
99
+ { os: '14.1.0', protocol: '3.3.0' },
100
+ { os: '12.0.0', protocol: '3.2.0' },
101
+ { os: '11.5.0', protocol: '3.1.0' },
102
+ { os: '11.0.0', protocol: '3.0.0' },
103
+ { os: '9.3.0', protocol: '2.0.0' },
104
+ { os: '9.2.0', protocol: '1.0.1' }
105
+ ];
106
+ //# sourceMappingURL=ProtocolCapabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProtocolCapabilities.js","sourceRoot":"","sources":["../../../src/debugProtocol/client/ProtocolCapabilities.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC;;;;;GAKG;AACH,MAAa,oBAAoB;IAC7B,YAAY,eAAmC,EAAE,SAAkB;QAC/D,IAAI,CAAC,eAAe,GAAG,oBAAoB,CAAC,sBAAsB,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IACnG,CAAC;IAiBD;;;;OAIG;IACK,MAAM,CAAC,sBAAsB,CAAC,eAAmC,EAAE,SAA6B;QACpG,IAAI,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE;YAC/B,OAAO,eAAe,CAAC;SAC1B;QACD,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9D,IAAI,CAAC,SAAS,EAAE;YACZ,OAAO,eAAe,CAAC;SAC1B;QACD,KAAK,MAAM,KAAK,IAAI,oBAAoB,CAAC,oBAAoB,EAAE;YAC3D,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE;gBACjC,OAAO,KAAK,CAAC,QAAQ,CAAC;aACzB;SACJ;QACD,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,IAAW,6BAA6B;QACpC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACH,IAAW,yCAAyC;QAChD,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAC7D,C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,OAAO,EAAE;IACnC,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE;IACnC,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE;IACnC,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE;IAClC,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE;CACrC,CAAC"}
@@ -96,6 +96,7 @@ export declare class BrightScriptDebugSession extends LoggingDebugSession {
96
96
  */
97
97
  private normalizeLaunchConfig;
98
98
  launchRequest(response: DebugProtocol.LaunchResponse, config: LaunchConfiguration): Promise<void>;
99
+ protected configurationDoneRequest(response: DebugProtocol.ConfigurationDoneResponse, args: DebugProtocol.ConfigurationDoneArguments): Promise<void>;
99
100
  /**
100
101
  * Activate all required functionality for profiling
101
102
  */
@@ -117,6 +118,7 @@ export declare class BrightScriptDebugSession extends LoggingDebugSession {
117
118
  * Anytime a roku adapter emits diagnostics, this method is called to handle it.
118
119
  */
119
120
  private handleDiagnostics;
121
+ private publishTimeout;
120
122
  private publish;
121
123
  private pendingSendLogPromise;
122
124
  /**
@@ -147,6 +149,12 @@ export declare class BrightScriptDebugSession extends LoggingDebugSession {
147
149
  * Stage, insert breakpoints, and package the main project
148
150
  */
149
151
  prepareMainProject(): Promise<void>;
152
+ /**
153
+ * Inject breakpoint STOP statements into the staged main project and create the zip package.
154
+ * Runs after the DAP `InitializedEvent` so client-side `setBreakpoints` requests have landed
155
+ * before any STOPs are written to the staged .brs files (telnet path) and before the zip is sealed.
156
+ */
157
+ private packageMainProject;
150
158
  /**
151
159
  * Accepts custom events and requests from the extension
152
160
  * @param command name of the command to execute
@@ -155,9 +163,15 @@ export declare class BrightScriptDebugSession extends LoggingDebugSession {
155
163
  /**
156
164
  * Stores the path to the staging folder for each component library
157
165
  */
158
- protected prepareAndHostComponentLibraries(componentLibraries: ComponentLibraryConfiguration[], port: number): Promise<void>;
166
+ protected prepareComponentLibraries(componentLibraries: ComponentLibraryConfiguration[]): Promise<void>;
167
+ /**
168
+ * Inject breakpoint STOPs into the staged complibs, seal their zips, install installable ones,
169
+ * and start static file hosting. Runs in `configurationDoneRequest` (after `InitializedEvent`)
170
+ * so client-side `setBreakpoints` requests have landed before the staged .brs files are written
171
+ * and the zips are sealed.
172
+ */
173
+ protected packageAndHostComponentLibraries(componentLibraries: ComponentLibraryConfiguration[], port: number): Promise<void>;
159
174
  protected sourceRequest(response: DebugProtocol.SourceResponse, args: DebugProtocol.SourceArguments): void;
160
- protected configurationDoneRequest(response: DebugProtocol.ConfigurationDoneResponse, args: DebugProtocol.ConfigurationDoneArguments): void;
161
175
  /**
162
176
  * Called every time a breakpoint is created, modified, or deleted, for each file. This receives the entire list of breakpoints every time.
163
177
  */