microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
1.10.2

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/jsDebugConfigAdapter.ts

67lines · 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 {
34472878RedMickey5 years ago7public static createDebuggingConfigForPureRN(
8attachArgs: IAttachRequestArgs,
9cdpProxyPort: number,
10sessionId: string,
11): any {
1bdccb66RedMickey6 years ago12return Object.assign({}, JsDebugConfigAdapter.getExistingExtraArgs(attachArgs), {
13type: "pwa-node",
14request: "attach",
15name: "Attach",
16continueOnAttach: true,
17port: cdpProxyPort,
18// The unique identifier of the debug session. It is used to distinguish React Native extension's
19// debug sessions from other ones. So we can save and process only the extension's debug sessions
20// in vscode.debug API methods "onDidStartDebugSession" and "onDidTerminateDebugSession".
21rnDebugSessionId: sessionId,
a32e1e1fYuri Skorokhodov5 years ago22// Fixes https://github.com/microsoft/vscode/issues/102042
34472878RedMickey5 years ago23resolveSourceMapLocations: ["!**/debuggerWorker.js"],
1bdccb66RedMickey6 years ago24});
25}
26
34472878RedMickey5 years ago27public static createDebuggingConfigForRNHermes(
28attachArgs: IAttachRequestArgs,
29cdpProxyPort: number,
30sessionId: string,
31): any {
1bdccb66RedMickey6 years ago32return Object.assign({}, JsDebugConfigAdapter.getExistingExtraArgs(attachArgs), {
33type: "pwa-node",
34request: "attach",
35name: "Attach",
36continueOnAttach: true,
37port: cdpProxyPort,
38// The unique identifier of the debug session. It is used to distinguish React Native extension's
39// debug sessions from other ones. So we can save and process only the extension's debug sessions
40// in vscode.debug API methods "onDidStartDebugSession" and "onDidTerminateDebugSession".
41rnDebugSessionId: sessionId,
ccef4e60RedMickey4 years ago42// We need to provide js-debug with the "**" pattern, so that it can get source maps over a http URL.
43// We need to allow "**/node_modules/expo/**" path, since Expo source maps URL contains it.
44resolveSourceMapLocations: ["**", "!**/node_modules/!(expo)/**"],
1bdccb66RedMickey6 years ago45});
46}
47
48private static getExistingExtraArgs(attachArgs: IAttachRequestArgs): any {
09f6024fHeniker4 years ago49const existingExtraArgs: any = {};
1bdccb66RedMickey6 years ago50if (attachArgs.env) {
51existingExtraArgs.env = attachArgs.env;
52}
53if (attachArgs.envFile) {
54existingExtraArgs.envFile = attachArgs.envFile;
55}
4dfc9ffdRedMickey5 years ago56existingExtraArgs.sourceMaps = attachArgs.sourceMaps;
81fc1822JiglioNero4 years ago57existingExtraArgs.sourceMapRenames = attachArgs.sourceMapRenames;
1bdccb66RedMickey6 years ago58if (attachArgs.sourceMapPathOverrides) {
59existingExtraArgs.sourceMapPathOverrides = attachArgs.sourceMapPathOverrides;
60}
61if (attachArgs.skipFiles) {
62existingExtraArgs.skipFiles = attachArgs.skipFiles;
63}
64
65return existingExtraArgs;
66}
67}