microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
c73f53cb7e73b23ef50e6c58df7a845972d341cb

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/debugger/jsDebugConfigAdapter.ts

62lines · modeblame

1bdccb66RedMickey6 years ago1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4import { IAttachRequestArgs } from "./debugSessionBase";
5
6export class JsDebugConfigAdapter {
7public static createDebuggingConfigForPureRN(attachArgs: IAttachRequestArgs, cdpProxyPort: number, sessionId: string): any {
8return Object.assign({}, JsDebugConfigAdapter.getExistingExtraArgs(attachArgs), {
9type: "pwa-node",
10request: "attach",
11name: "Attach",
12continueOnAttach: true,
13port: cdpProxyPort,
14// The unique identifier of the debug session. It is used to distinguish React Native extension's
15// debug sessions from other ones. So we can save and process only the extension's debug sessions
16// in vscode.debug API methods "onDidStartDebugSession" and "onDidTerminateDebugSession".
17rnDebugSessionId: sessionId,
a32e1e1fYuri Skorokhodov5 years ago18// Fixes https://github.com/microsoft/vscode/issues/102042
19resolveSourceMapLocations: [
20"!**/debuggerWorker.js"
21],
1bdccb66RedMickey6 years ago22});
23}
24
25public static createDebuggingConfigForRNHermes(attachArgs: IAttachRequestArgs, cdpProxyPort: number, sessionId: string): any {
26return Object.assign({}, JsDebugConfigAdapter.getExistingExtraArgs(attachArgs), {
27type: "pwa-node",
28request: "attach",
29name: "Attach",
30continueOnAttach: true,
31port: cdpProxyPort,
32// The unique identifier of the debug session. It is used to distinguish React Native extension's
33// debug sessions from other ones. So we can save and process only the extension's debug sessions
34// in vscode.debug API methods "onDidStartDebugSession" and "onDidTerminateDebugSession".
35rnDebugSessionId: sessionId,
2eb6cdb6RedMickey5 years ago36// We need to provide js-debug with the "**" pattern, so that it can get source maps over a http URL
37resolveSourceMapLocations: [
38"**",
39"!**/node_modules/**"
40],
1bdccb66RedMickey6 years ago41});
42}
43
44private static getExistingExtraArgs(attachArgs: IAttachRequestArgs): any {
45let existingExtraArgs: any = {};
46if (attachArgs.env) {
47existingExtraArgs.env = attachArgs.env;
48}
49if (attachArgs.envFile) {
50existingExtraArgs.envFile = attachArgs.envFile;
51}
4dfc9ffdRedMickey5 years ago52existingExtraArgs.sourceMaps = attachArgs.sourceMaps;
1bdccb66RedMickey6 years ago53if (attachArgs.sourceMapPathOverrides) {
54existingExtraArgs.sourceMapPathOverrides = attachArgs.sourceMapPathOverrides;
55}
56if (attachArgs.skipFiles) {
57existingExtraArgs.skipFiles = attachArgs.skipFiles;
58}
59
60return existingExtraArgs;
61}
62}