Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
652 changes: 627 additions & 25 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@
"languages": [
{
"id": "rn-output-log",
"aliases": ["RN Output Log"],
"extensions": [".rn-output"]
"aliases": [
"RN Output Log"
],
"extensions": [
".rn-output"
]
}
],
"walkthroughs": [
Expand Down Expand Up @@ -1417,7 +1421,8 @@
"compile-smoke-tests": "cd test/smoke && tsc",
"smoke-tests": "cd test/smoke && tsc && node ./node_modules/mocha/bin/_mocha --config ./.mocharc.js --reporter mocha-multi-reporters",
"smoke-build": "node gulp_scripts/smoke-build.js",
"smoke-build-test": "node gulp_scripts/smoke-build.js --test"
"smoke-build-test": "node gulp_scripts/smoke-build.js --test",
"postinstall": "patch-package"
},
"prettier": {
"trailingComma": "all",
Expand All @@ -1427,7 +1432,9 @@
"endOfLine": "auto",
"overrides": [
{
"files": ["*.md"],
"files": [
"*.md"
],
"options": {
"tabWidth": 2,
"printWidth": 80
Expand All @@ -1436,7 +1443,6 @@
]
},
"dependencies": {
"@vscode/debugadapter": "^1.63.0",
"@vscode/js-debug-browsers": "^1.1.2",
"command-exists": "1.2.9",
"configstore": "5.0.1",
Expand Down Expand Up @@ -1495,6 +1501,8 @@
"@types/ws": "0.0.39",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@typescript/native-preview": "^7.0.0-dev.20260302.1",
"@vscode/debugadapter": "^1.68.0",
"@vscode/test-electron": "^2.5.2",
"@vscode/vsce": "^2.19.0",
"ansi-colors": "3.2.4",
Expand Down Expand Up @@ -1525,6 +1533,7 @@
"mochawesome": "^7.1.3",
"ncp": "2.0.0",
"nyc": "^15.1.0",
"patch-package": "^8.0.1",
"playwright": "^1.56.1",
"plugin-error": "1.0.1",
"prettier": "2.4.0",
Expand Down
13 changes: 13 additions & 0 deletions patches/@vscode+debugprotocol+1.68.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/@vscode/debugprotocol/lib/debugProtocol.d.ts b/node_modules/@vscode/debugprotocol/lib/debugProtocol.d.ts
index 4204bc2..4013f23 100644
--- a/node_modules/@vscode/debugprotocol/lib/debugProtocol.d.ts
+++ b/node_modules/@vscode/debugprotocol/lib/debugProtocol.d.ts
@@ -6,7 +6,7 @@
/** Declaration module describing the VS Code debug protocol.
Auto-generated from json schema. Do not edit manually.
*/
-export declare module DebugProtocol {
+export declare namespace DebugProtocol {

/** Base class of requests, responses, and events. */
interface ProtocolMessage {
13 changes: 13 additions & 0 deletions patches/vscode-debugprotocol+1.51.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/vscode-debugprotocol/lib/debugProtocol.d.ts b/node_modules/vscode-debugprotocol/lib/debugProtocol.d.ts
index a6a9f8d..3081db4 100644
--- a/node_modules/vscode-debugprotocol/lib/debugProtocol.d.ts
+++ b/node_modules/vscode-debugprotocol/lib/debugProtocol.d.ts
@@ -1,7 +1,7 @@
/** Declaration module describing the VS Code debug protocol.
Auto-generated from json schema. Do not edit manually.
*/
-export declare module DebugProtocol {
+export declare namespace DebugProtocol {
/** Base class of requests, responses, and events. */
interface ProtocolMessage {
/** Sequence number (also known as message ID). For protocol messages of type 'request' this ID can be used to cancel the request. */
4 changes: 2 additions & 2 deletions src/cdp-proxy/CDPMessageHandlers/baseCDPMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { Connection } from "vscode-cdp-proxy";
import { ICDPMessageHandler, ProcessedCDPMessage } from "./ICDPMessageHandler";

export abstract class BaseCDPMessageHandler implements ICDPMessageHandler {
protected debuggerTarget: Connection | null;
protected applicationTarget: Connection | null;
protected debuggerTarget: Connection | null = null;
protected applicationTarget: Connection | null = null;

public processDebuggerCDPMessage(event: any): ProcessedCDPMessage {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/cdp-proxy/debuggerEndpointHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class DebuggerEndpointHelper {
const internalError = ErrorHelper.getInternalError(
InternalErrorCode.CouldNotConnectToDebugTarget,
browserURL,
err.message,
(err as Error).message,
);

if (cancellationToken.isCancellationRequested) {
Expand Down
10 changes: 5 additions & 5 deletions src/cdp-proxy/reactNativeCDPProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ export class ReactNativeCDPProxy {
APPLICATION_REPLY: "Reply From Target To Debugger",
};

private server: Server | null;
private server: Server | null = null;
private hostAddress: string;
private port: number;
private debuggerTarget: Connection | null;
private applicationTarget: Connection | null;
private debuggerTarget: Connection | null = null;
private applicationTarget: Connection | null = null;
private logger: OutputChannelLogger;
private logLevel: LogLevel;
private debuggerEndpointHelper: DebuggerEndpointHelper;
private CDPMessageHandler: BaseCDPMessageHandler;
private applicationTargetPort: number;
private CDPMessageHandler!: BaseCDPMessageHandler;
private applicationTargetPort: number = 0;
private browserInspectUri: string;
private cancellationToken: CancellationToken | undefined;
private applicationTargetEventEmitter: EventEmitter<unknown> = new EventEmitter();
Expand Down
2 changes: 1 addition & 1 deletion src/common/commandExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class CommandExecutor {
});
return stdout;
} catch (reason) {
return reason;
return reason as string;
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/common/entryPointHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ export class EntryPointHandler {
Telemetry.init(appName, appVersion, reporter);
return this.runFunction(appName, error, codeToRun, true, extProps);
} catch (error) {
this.logger.error(error);
this.logger.error(
error instanceof Error ? error.message : String(error),
error instanceof Error ? error : undefined,
);
throw error;
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/common/node/childProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export class ChildProcess {
command,
options,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(error: Error, stdout: string, stderr: string) => {
(
error: nodeChildProcess.ExecException | null,
stdout: string | Buffer,
stderr: string | Buffer,
) => {
if (error) {
reject(
ErrorHelper.getNestedError(
Expand All @@ -69,7 +73,7 @@ export class ChildProcess {
),
);
} else {
resolve(stdout);
resolve(stdout.toString());
}
},
);
Expand Down
6 changes: 3 additions & 3 deletions src/common/node/fileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class FileSystem {
throw new Error(`Expected ${dir} to be a directory`);
}
} catch (err) {
if (err && err.code === "ENOENT") {
if (err && (err as NodeJS.ErrnoException).code === "ENOENT") {
return this.mkDir(dir);
}
throw err;
Expand All @@ -38,7 +38,7 @@ export class FileSystem {
throw new Error(`Expected ${file} to be a file`);
}
} catch (err) {
if (err && err.code === "ENOENT") {
if (err && (err as NodeJS.ErrnoException).code === "ENOENT") {
return this.writeFile(file, contents);
}
throw err;
Expand Down Expand Up @@ -128,7 +128,7 @@ export class FileSystem {
const stats = await this.stat(directoryPath);
return stats.isDirectory();
} catch (err) {
if (err.code === "ENOENT") {
if ((err as NodeJS.ErrnoException).code === "ENOENT") {
return false;
}
throw err;
Expand Down
2 changes: 1 addition & 1 deletion src/common/outputVerifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class OutputVerifier {
try {
await spawnResult.outcome;
} catch (error) {
processError = error;
processError = error as any;
}

const failurePatterns = await this.generatePatternToFailure();
Expand Down
4 changes: 2 additions & 2 deletions src/common/packageLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class PackageLoader {
resolve(module);
return true;
} catch (e) {
if (packageWasInstalled || e.code !== "MODULE_NOT_FOUND") {
if (packageWasInstalled || (e as NodeJS.ErrnoException).code !== "MODULE_NOT_FOUND") {
reject(e);
return true;
}
Expand Down Expand Up @@ -216,7 +216,7 @@ export class PackageLoader {
packageConfig: PackageConfig,
...additionalDependencies: PackageConfig[]
): Promise<T> {
return new Promise(async (resolve: (value: T) => void, reject) => {
return new Promise(async (resolve, reject) => {
const tryToRequire = this.getTryToRequireFunction(packageConfig, resolve, reject);
if (!(await tryToRequire())) {
this.tryToRequireAfterInstall(
Expand Down
10 changes: 5 additions & 5 deletions src/common/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import { ChildProcess } from "child_process";
import * as path from "path";
import * as assert from "assert";
import assert = require("assert");
import * as semver from "semver";
import * as vscode from "vscode";
import * as nls from "vscode-nls";
import * as WebSocket from "ws";
import WebSocket = require("ws");
import { logger } from "@vscode/debugadapter";
import { GeneralPlatform } from "../extension/generalPlatform";
import { ExponentHelper } from "../extension/exponent/exponentHelper";
Expand Down Expand Up @@ -74,9 +74,9 @@ export class Packager {
private static OPN_PACKAGE_MAIN_FILENAME = "index.js";
private static PNPM_PACKAGE_NAME = ".pnpm";
private static fs: FileSystem = new FileSystem();
private expoHelper: ExponentHelper;
private expoHelper?: ExponentHelper;
private runOptions?: IRunOptions;
private nodeVersion: string;
private nodeVersion?: string;

constructor(
private workspacePath: string,
Expand Down Expand Up @@ -680,7 +680,7 @@ export class Packager {
await XDL.stopAll(this.projectPath);
this.logger.debug("Exponent Stopped");
} catch (error) {
if (error.code !== "NOT_LOGGED_IN") {
if ((error as NodeJS.ErrnoException).code !== "NOT_LOGGED_IN") {
throw error;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { HostPlatform } from "./hostPlatform";
/**
* Telemetry module specialized for vscode integration.
*/
export module Telemetry {
export namespace Telemetry {
export let appName: string;
export let isOptedIn: boolean = false;
export let reporter: ITelemetryReporter;
Expand Down Expand Up @@ -127,8 +127,8 @@ export module Telemetry {
* This event will include a property called reserved.activity.duration which represents time in milliseconds.
*/
export class TelemetryActivity extends TelemetryEvent {
private startTime: [number, number];
private endTime: [number, number];
private startTime!: [number, number];
private endTime!: [number, number];

constructor(name: string, properties?: ITelemetryProperties) {
super(name, properties);
Expand Down
2 changes: 1 addition & 1 deletion src/common/telemetryGenerators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export abstract class TelemetryGeneratorBase {
const code = codeToMeasure();
return await code;
} catch (error) {
this.addError(error);
this.addError(error as Error);
return Promise.reject(error);
} finally {
this.finishTime(name, startTime);
Expand Down
6 changes: 3 additions & 3 deletions src/debugger/appWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import * as path from "path";
import { EventEmitter } from "events";
import * as vscode from "vscode";
import * as WebSocket from "ws";
import WebSocket = require("ws");
import { logger } from "@vscode/debugadapter";
import * as nls from "vscode-nls";
import { ensurePackagerRunning } from "../common/packagerStatus";
Expand Down Expand Up @@ -215,9 +215,9 @@ function fetch(url) {
private packagerRemoteRoot?: string;
private packagerLocalRoot?: string;
private debuggerWorkerUrlPath?: string;
private socketToApp: WebSocket;
private socketToApp!: WebSocket;
private cancellationToken: vscode.CancellationToken;
private singleLifetimeWorker: IDebuggeeWorker | null;
private singleLifetimeWorker: IDebuggeeWorker | null = null;
private webSocketConstructor: (url: string) => WebSocket;

private executionLimiter = new ExecutionsLimiter();
Expand Down
10 changes: 5 additions & 5 deletions src/debugger/debugSessionBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ export abstract class DebugSessionBase extends LoggingDebugSession {
protected readonly terminateCommand: string;
protected readonly pwaNodeSessionName: string;

protected appLauncher: AppLauncher;
protected projectRootPath: string;
protected appLauncher!: AppLauncher;
protected projectRootPath!: string;
protected isSettingsInitialized: boolean; // used to prevent parameters reinitialization when attach is called from launch function
protected previousAttachArgs: IAttachRequestArgs;
protected cdpProxyLogLevel: LogLevel;
protected previousAttachArgs!: IAttachRequestArgs;
protected cdpProxyLogLevel!: LogLevel;
protected debugSessionStatus: DebugSessionStatus;
protected nodeSession: vscode.DebugSession | null;
protected rnSession: RNSession;
Expand Down Expand Up @@ -238,7 +238,7 @@ export abstract class DebugSessionBase extends LoggingDebugSession {
localize(
"CouldNotStopMonitoringLogcat",
"Couldn't stop monitoring logcat: {0}",
err.message || err,
err instanceof Error ? err.message : String(err),
),
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/debugger/direct/directDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ export class DirectDebugSession extends DebugSessionBase {
} catch (error) {
throw ErrorHelper.getInternalError(
InternalErrorCode.ApplicationLaunchFailed,
error.message || error,
(error as Error).message || error,
);
}
// if debugging is enabled start attach request
await this.vsCodeDebugSession.customRequest("attach", launchArgs);
this.sendResponse(response);
} catch (error) {
this.terminateWithErrorResponse(error, response);
this.terminateWithErrorResponse(error as Error, response);
}
}

Expand Down Expand Up @@ -276,7 +276,7 @@ export class DirectDebugSession extends DebugSessionBase {
this.terminateWithErrorResponse(
ErrorHelper.getInternalError(
InternalErrorCode.CouldNotAttachToDebugger,
error.message || error,
(error as Error).message || error,
),
response,
);
Expand Down
4 changes: 2 additions & 2 deletions src/debugger/forkedAppWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export class ForkedAppWorker implements IDebuggeeWorker {
/** A promise that we use to make sure that worker has been loaded completely before start sending IPC messages */
protected workerLoaded: Promise<void> | undefined;
private bundleLoaded: Promise<void> | undefined;
private logWriteStream: fs.WriteStream;
private logDirectory: string | null;
private logWriteStream!: fs.WriteStream;
private logDirectory: string | null = null;

constructor(
private packagerAddress: string,
Expand Down
4 changes: 2 additions & 2 deletions src/debugger/rnDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ export class RNDebugSession extends DebugSessionBase {
} catch (error) {
throw ErrorHelper.getInternalError(
InternalErrorCode.ApplicationLaunchFailed,
error.message || error,
(error as Error).message || error,
);
}
// if debugging is enabled start attach request
await this.vsCodeDebugSession.customRequest("attach", launchArgs);
this.sendResponse(response);
} catch (error) {
this.terminateWithErrorResponse(error, response);
this.terminateWithErrorResponse(error as Error, response);
}
}

Expand Down
Loading