@expo/cli 0.10.7 → 0.10.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.
- package/build/bin/cli +2 -2
- package/build/src/register/registerAsync.js +2 -7
- package/build/src/register/registerAsync.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +2 -2
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +2 -2
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/device.js +21 -4
- package/build/src/start/server/metro/inspector-proxy/device.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/NetworkResponse.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/PageReload.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js +22 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js +55 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.js +17 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js +39 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/types.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/proxy.js +14 -6
- package/build/src/start/server/metro/inspector-proxy/proxy.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +2 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js +38 -0
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -0
- package/build/src/start/server/type-generation/__typetests__/generateFixtures.js +38 -0
- package/build/src/start/server/type-generation/__typetests__/generateFixtures.js.map +1 -0
- package/build/src/start/server/type-generation/__typetests__/route.test.js +165 -0
- package/build/src/start/server/type-generation/__typetests__/route.test.js.map +1 -0
- package/build/src/start/server/type-generation/routes.js +175 -62
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/open.js +26 -0
- package/build/src/utils/open.js.map +1 -0
- package/package.json +11 -9
- package/build/src/start/server/metro/inspector-proxy/handlers/DebuggerScriptSource.js +0 -87
- package/build/src/start/server/metro/inspector-proxy/handlers/DebuggerScriptSource.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeCompat.js +0 -63
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeCompat.js.map +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.openBrowserAsync = openBrowserAsync;
|
|
6
|
+
var _betterOpn = _interopRequireDefault(require("better-opn"));
|
|
7
|
+
function _interopRequireDefault(obj) {
|
|
8
|
+
return obj && obj.__esModule ? obj : {
|
|
9
|
+
default: obj
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
async function openBrowserAsync(target, options) {
|
|
13
|
+
if (process.platform !== "win32") {
|
|
14
|
+
return await (0, _betterOpn).default(target, options);
|
|
15
|
+
}
|
|
16
|
+
const oldSystemRoot = process.env.SYSTEMROOT;
|
|
17
|
+
try {
|
|
18
|
+
var _SYSTEMROOT;
|
|
19
|
+
process.env.SYSTEMROOT = (_SYSTEMROOT = process.env.SYSTEMROOT) != null ? _SYSTEMROOT : process.env.SystemRoot;
|
|
20
|
+
return await (0, _betterOpn).default(target, options);
|
|
21
|
+
} finally{
|
|
22
|
+
process.env.SYSTEMROOT = oldSystemRoot;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/open.ts"],"sourcesContent":["import betterOpenBrowserAsync from 'better-opn';\n\n/**\n * Due to a bug in `open`, which is used as fallback on Windows, we need to ensure `process.env.SYSTEMROOT` is set.\n * This environment variable is set by Windows on `SystemRoot`, causing `open` to execute a command with an \"unknown\" drive letter.\n *\n * @see https://github.com/sindresorhus/open/issues/205\n */\nexport async function openBrowserAsync(\n target: string,\n options?: any\n): Promise<import('child_process').ChildProcess | false> {\n if (process.platform !== 'win32') {\n return await betterOpenBrowserAsync(target, options);\n }\n\n const oldSystemRoot = process.env.SYSTEMROOT;\n try {\n process.env.SYSTEMROOT = process.env.SYSTEMROOT ?? process.env.SystemRoot;\n return await betterOpenBrowserAsync(target, options);\n } finally {\n process.env.SYSTEMROOT = oldSystemRoot;\n }\n}\n"],"names":["openBrowserAsync","target","options","process","platform","betterOpenBrowserAsync","oldSystemRoot","env","SYSTEMROOT","SystemRoot"],"mappings":"AAAA;;;;QAQsBA,gBAAgB,GAAhBA,gBAAgB;AARH,IAAA,UAAY,kCAAZ,YAAY,EAAA;;;;;;AAQxC,eAAeA,gBAAgB,CACpCC,MAAc,EACdC,OAAa,EAC0C;IACvD,IAAIC,OAAO,CAACC,QAAQ,KAAK,OAAO,EAAE;QAChC,OAAO,MAAMC,CAAAA,GAAAA,UAAsB,AAAiB,CAAA,QAAjB,CAACJ,MAAM,EAAEC,OAAO,CAAC,CAAC;KACtD;IAED,MAAMI,aAAa,GAAGH,OAAO,CAACI,GAAG,CAACC,UAAU,AAAC;IAC7C,IAAI;YACuBL,WAAsB;QAA/CA,OAAO,CAACI,GAAG,CAACC,UAAU,GAAGL,CAAAA,WAAsB,GAAtBA,OAAO,CAACI,GAAG,CAACC,UAAU,YAAtBL,WAAsB,GAAIA,OAAO,CAACI,GAAG,CAACE,UAAU,CAAC;QAC1E,OAAO,MAAMJ,CAAAA,GAAAA,UAAsB,AAAiB,CAAA,QAAjB,CAACJ,MAAM,EAAEC,OAAO,CAAC,CAAC;KACtD,QAAS;QACRC,OAAO,CAACI,GAAG,CAACC,UAAU,GAAGF,aAAa,CAAC;KACxC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.9",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"@babel/runtime": "^7.20.0",
|
|
41
41
|
"@expo/code-signing-certificates": "0.0.5",
|
|
42
42
|
"@expo/config": "~8.1.0",
|
|
43
|
-
"@expo/env": "0.0.5",
|
|
44
43
|
"@expo/config-plugins": "~7.2.0",
|
|
45
|
-
"@expo/dev-server": "0.5.
|
|
44
|
+
"@expo/dev-server": "0.5.4",
|
|
46
45
|
"@expo/devcert": "^1.0.0",
|
|
46
|
+
"@expo/env": "0.0.5",
|
|
47
47
|
"@expo/json-file": "^8.2.37",
|
|
48
48
|
"@expo/metro-config": "~0.10.0",
|
|
49
49
|
"@expo/osascript": "^2.0.31",
|
|
50
50
|
"@expo/package-manager": "~1.0.0",
|
|
51
51
|
"@expo/plist": "^0.0.20",
|
|
52
|
-
"@expo/prebuild-config": "6.2.
|
|
52
|
+
"@expo/prebuild-config": "6.2.6",
|
|
53
53
|
"@expo/rudder-sdk-node": "1.1.1",
|
|
54
54
|
"@expo/spawn-async": "1.5.0",
|
|
55
55
|
"@expo/xcpretty": "^4.2.1",
|
|
@@ -107,12 +107,12 @@
|
|
|
107
107
|
]
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@graphql-codegen/cli": "2.16.3",
|
|
111
|
-
"@graphql-codegen/typescript": "2.8.7",
|
|
112
|
-
"@graphql-codegen/typescript-operations": "2.5.12",
|
|
113
110
|
"@expo/multipart-body-parser": "^1.0.0",
|
|
114
111
|
"@expo/ngrok": "4.1.0",
|
|
115
112
|
"@expo/webpack-config": "^0.17.4",
|
|
113
|
+
"@graphql-codegen/cli": "2.16.3",
|
|
114
|
+
"@graphql-codegen/typescript": "2.8.7",
|
|
115
|
+
"@graphql-codegen/typescript-operations": "2.5.12",
|
|
116
116
|
"@swc/core": "^1.2.126",
|
|
117
117
|
"@taskr/clear": "1.1.0",
|
|
118
118
|
"@taskr/esnext": "1.1.0",
|
|
@@ -146,7 +146,9 @@
|
|
|
146
146
|
"nullthrows": "^1.1.1",
|
|
147
147
|
"structured-headers": "^0.4.1",
|
|
148
148
|
"taskr": "1.1.0",
|
|
149
|
-
"tree-kill": "^1.2.2"
|
|
149
|
+
"tree-kill": "^1.2.2",
|
|
150
|
+
"jest-runner-tsd": "^6.0.0",
|
|
151
|
+
"tsd": "^0.28.1"
|
|
150
152
|
},
|
|
151
|
-
"gitHead": "
|
|
153
|
+
"gitHead": "4e550a9fb6804351e36f9087aeb84c94d87d631b"
|
|
152
154
|
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
6
|
-
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
function _interopRequireDefault(obj) {
|
|
9
|
-
return obj && obj.__esModule ? obj : {
|
|
10
|
-
default: obj
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
class DebuggerScriptSourceHandler {
|
|
14
|
-
constructor(device){
|
|
15
|
-
this.device = device;
|
|
16
|
-
}
|
|
17
|
-
onDebuggerMessage(message, { socket }) {
|
|
18
|
-
// See: https://github.com/facebook/metro/blob/65d801cb60c06c1b17f428ca79491db73c53ef87/packages/metro-inspector-proxy/src/Device.js#L488-L544
|
|
19
|
-
if (message.method === "Debugger.getScriptSource") {
|
|
20
|
-
const { scriptId } = message.params;
|
|
21
|
-
const pathOrUrl = this.device._scriptIdToSourcePathMapping.get(scriptId);
|
|
22
|
-
// Unkown scriptId provided, can't reply
|
|
23
|
-
if (!pathOrUrl) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
// Fetch the source from URL, if the path is a bundle URL
|
|
27
|
-
if (isUrl(pathOrUrl)) {
|
|
28
|
-
(0, _nodeFetch).default(pathOrUrl).then((response)=>response.ok ? response.text() : respond(socket, message, {
|
|
29
|
-
error: `Received status ${response.status} while fetching: ${pathOrUrl}`
|
|
30
|
-
})
|
|
31
|
-
).then((scriptSource)=>{
|
|
32
|
-
if (scriptSource !== null) {
|
|
33
|
-
respond(socket, message, {
|
|
34
|
-
scriptSource
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
// Fetch the source from file directly, using the project root as starting directory
|
|
41
|
-
try {
|
|
42
|
-
const relativePath = _path.default.resolve(this.device._projectRoot, pathOrUrl);
|
|
43
|
-
respond(socket, message, {
|
|
44
|
-
scriptSource: _fs.default.readFileSync(relativePath, "utf8")
|
|
45
|
-
});
|
|
46
|
-
} catch (error) {
|
|
47
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
48
|
-
respond(socket, message, {
|
|
49
|
-
error: `Failed to load "${pathOrUrl}": ${errorMessage}`
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.DebuggerScriptSourceHandler = DebuggerScriptSourceHandler;
|
|
58
|
-
function respond(socket, request, response) {
|
|
59
|
-
if ("error" in response) {
|
|
60
|
-
socket.send(JSON.stringify({
|
|
61
|
-
id: request.id,
|
|
62
|
-
error: {
|
|
63
|
-
message: response.error
|
|
64
|
-
}
|
|
65
|
-
}));
|
|
66
|
-
} else {
|
|
67
|
-
socket.send(JSON.stringify({
|
|
68
|
-
id: request.id,
|
|
69
|
-
result: response
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
function isUrl(pathOrUrl) {
|
|
75
|
-
try {
|
|
76
|
-
const url = new URL(pathOrUrl);
|
|
77
|
-
return [
|
|
78
|
-
"http",
|
|
79
|
-
"https"
|
|
80
|
-
].some((protocol)=>url.protocol.toLowerCase().startsWith(protocol)
|
|
81
|
-
);
|
|
82
|
-
} catch {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
//# sourceMappingURL=DebuggerScriptSource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/DebuggerScriptSource.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\nimport fs from 'fs';\nimport type { DebuggerInfo, Device as MetroDevice } from 'metro-inspector-proxy';\nimport fetch from 'node-fetch';\nimport path from 'path';\nimport type WS from 'ws';\n\nimport { CdpMessage, DebuggerRequest, DebuggerResponse, InspectorHandler } from './types';\n\n// TODO(cedric): remove this custom handler when fully switching over to `metro@>=0.75.1`\nexport class DebuggerScriptSourceHandler implements InspectorHandler {\n constructor(private readonly device: MetroDevice) {}\n\n onDebuggerMessage(\n message: DebuggerRequest<DebuggerGetScriptSource>,\n { socket }: Pick<DebuggerInfo, 'socket'>\n ) {\n // See: https://github.com/facebook/metro/blob/65d801cb60c06c1b17f428ca79491db73c53ef87/packages/metro-inspector-proxy/src/Device.js#L488-L544\n if (message.method === 'Debugger.getScriptSource') {\n const { scriptId } = message.params;\n const pathOrUrl = this.device._scriptIdToSourcePathMapping.get(scriptId);\n\n // Unkown scriptId provided, can't reply\n if (!pathOrUrl) {\n return false;\n }\n\n // Fetch the source from URL, if the path is a bundle URL\n if (isUrl(pathOrUrl)) {\n fetch(pathOrUrl)\n .then((response) =>\n response.ok\n ? response.text()\n : respond(socket, message, {\n error: `Received status ${response.status} while fetching: ${pathOrUrl}`,\n })\n )\n .then((scriptSource) => {\n if (scriptSource !== null) {\n respond(socket, message, { scriptSource });\n }\n });\n\n return true;\n }\n\n // Fetch the source from file directly, using the project root as starting directory\n try {\n const relativePath = path.resolve(this.device._projectRoot, pathOrUrl);\n respond(socket, message, { scriptSource: fs.readFileSync(relativePath, 'utf8') });\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n respond(socket, message, {\n error: `Failed to load \"${pathOrUrl}\": ${errorMessage}`,\n });\n }\n\n return true;\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-getScriptSource */\nexport type DebuggerGetScriptSource = CdpMessage<\n 'Debugger.getScriptSource',\n Protocol.Debugger.GetScriptSourceRequest,\n Protocol.Debugger.GetScriptSourceResponse\n>;\n\nfunction respond<T extends CdpMessage>(\n socket: WS,\n request: DebuggerRequest<T>,\n response: DebuggerResponse<T>['result'] | { error: string }\n) {\n if ('error' in response) {\n socket.send(JSON.stringify({ id: request.id, error: { message: response.error } }));\n } else {\n socket.send(JSON.stringify({ id: request.id, result: response }));\n }\n\n return null;\n}\n\nfunction isUrl(pathOrUrl: string) {\n try {\n const url = new URL(pathOrUrl);\n return ['http', 'https'].some((protocol) => url.protocol.toLowerCase().startsWith(protocol));\n } catch {\n return false;\n }\n}\n"],"names":["DebuggerScriptSourceHandler","constructor","device","onDebuggerMessage","message","socket","method","scriptId","params","pathOrUrl","_scriptIdToSourcePathMapping","get","isUrl","fetch","then","response","ok","text","respond","error","status","scriptSource","relativePath","path","resolve","_projectRoot","fs","readFileSync","errorMessage","Error","String","request","send","JSON","stringify","id","result","url","URL","some","protocol","toLowerCase","startsWith"],"mappings":"AAAA;;;;AACe,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAED,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAMhB,MAAMA,2BAA2B;IACtCC,YAA6BC,MAAmB,CAAE;aAArBA,MAAmB,GAAnBA,MAAmB;KAAI;IAEpDC,iBAAiB,CACfC,OAAiD,EACjD,EAAEC,MAAM,CAAA,EAAgC,EACxC;QACA,8IAA8I;QAC9I,IAAID,OAAO,CAACE,MAAM,KAAK,0BAA0B,EAAE;YACjD,MAAM,EAAEC,QAAQ,CAAA,EAAE,GAAGH,OAAO,CAACI,MAAM,AAAC;YACpC,MAAMC,SAAS,GAAG,IAAI,CAACP,MAAM,CAACQ,4BAA4B,CAACC,GAAG,CAACJ,QAAQ,CAAC,AAAC;YAEzE,wCAAwC;YACxC,IAAI,CAACE,SAAS,EAAE;gBACd,OAAO,KAAK,CAAC;aACd;YAED,yDAAyD;YACzD,IAAIG,KAAK,CAACH,SAAS,CAAC,EAAE;gBACpBI,CAAAA,GAAAA,UAAK,AAAW,CAAA,QAAX,CAACJ,SAAS,CAAC,CACbK,IAAI,CAAC,CAACC,QAAQ,GACbA,QAAQ,CAACC,EAAE,GACPD,QAAQ,CAACE,IAAI,EAAE,GACfC,OAAO,CAACb,MAAM,EAAED,OAAO,EAAE;wBACvBe,KAAK,EAAE,CAAC,gBAAgB,EAAEJ,QAAQ,CAACK,MAAM,CAAC,iBAAiB,EAAEX,SAAS,CAAC,CAAC;qBACzE,CAAC;gBAAA,CACP,CACAK,IAAI,CAAC,CAACO,YAAY,GAAK;oBACtB,IAAIA,YAAY,KAAK,IAAI,EAAE;wBACzBH,OAAO,CAACb,MAAM,EAAED,OAAO,EAAE;4BAAEiB,YAAY;yBAAE,CAAC,CAAC;qBAC5C;iBACF,CAAC,CAAC;gBAEL,OAAO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QACF,MAAM4B,GAAG,GAAG,IAAIC,GAAG,CAAC7B,SAAS,CAAC,AAAC;QAC/B,OAAO;YAAC,MAAM;YAAE,OAAO;SAAC,CAAC8B,IAAI,CAAC,CAACC,QAAQ,GAAKH,GAAG,CAACG,QAAQ,CAACC,WAAW,EAAE,CAACC,UAAU,CAACF,QAAQ,CAAC;QAAA,CAAC,CAAC;KAC9F,CAAC,OAAM;QACN,OAAO,KAAK,CAAC;KACd;CACF"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
class VscodeCompatHandler {
|
|
6
|
-
/** Keep track of `Runtime.getProperties` responses to intercept, by request id */ interceptGetProperties = new Set();
|
|
7
|
-
onDebuggerMessage(message, { socket }) {
|
|
8
|
-
// Hermes doesn't seem to handle this request, but `locations` have to be returned.
|
|
9
|
-
// Respond with an empty location to make it "spec compliant" with Chrome DevTools.
|
|
10
|
-
if (message.method === "Debugger.getPossibleBreakpoints") {
|
|
11
|
-
const response = {
|
|
12
|
-
id: message.id,
|
|
13
|
-
result: {
|
|
14
|
-
locations: []
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
socket.send(JSON.stringify(response));
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
// Vscode doesn't seem to work nicely with missing `description` fields on `RemoteObject` instances.
|
|
21
|
-
// See: https://github.com/microsoft/vscode-js-debug/issues/1583
|
|
22
|
-
if (message.method === "Runtime.getProperties") {
|
|
23
|
-
this.interceptGetProperties.add(message.id);
|
|
24
|
-
}
|
|
25
|
-
// Hermes and vscode have trouble setting breakpoints by `urlRegex` through `Debugger.setBreakpointByUrl`.
|
|
26
|
-
// Vscode adds `file://` to a URL containing `http://`, which confuses Hermes and sets it to the wrong location.
|
|
27
|
-
// Hermes needs to create the breakpoint to get the proper ID, but it must be unbounded.
|
|
28
|
-
// Once the sourcemap is loaded, vscode will rebind the unbounded breakpoint to the correct location (using `Debugger.setBreakpoint`).
|
|
29
|
-
if (message.method === "Debugger.setBreakpointByUrl" && message.params.urlRegex) {
|
|
30
|
-
// Explicitly force the breakpoint to be unbounded
|
|
31
|
-
message.params.url = "file://__invalid_url__";
|
|
32
|
-
delete message.params.urlRegex;
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
onDeviceMessage(message) {
|
|
37
|
-
// Vscode doesn't seem to work nicely with missing `description` fields on `RemoteObject` instances.
|
|
38
|
-
// See: https://github.com/microsoft/vscode-js-debug/issues/1583
|
|
39
|
-
if ("id" in message && this.interceptGetProperties.has(message.id)) {
|
|
40
|
-
this.interceptGetProperties.delete(message.id);
|
|
41
|
-
var _result;
|
|
42
|
-
for (const item of (_result = message.result.result) != null ? _result : []){
|
|
43
|
-
var ref;
|
|
44
|
-
// Force-fully format the properties description to be an empty string
|
|
45
|
-
// See: https://github.com/facebook/hermes/issues/114
|
|
46
|
-
if (item.value) {
|
|
47
|
-
var _description;
|
|
48
|
-
item.value.description = (_description = item.value.description) != null ? _description : "";
|
|
49
|
-
}
|
|
50
|
-
// Avoid passing the `objectId` for symbol types.
|
|
51
|
-
// When collapsing in vscode, it will fetch information about the symbol using the `objectId`.
|
|
52
|
-
// The `Runtime.getProperties` request of the symbol hard-crashes Hermes.
|
|
53
|
-
if (((ref = item.value) == null ? void 0 : ref.type) === "symbol" && item.value.objectId) {
|
|
54
|
-
delete item.value.objectId;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.VscodeCompatHandler = VscodeCompatHandler;
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=VscodeCompat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeCompat.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\nimport type { DebuggerInfo } from 'metro-inspector-proxy';\n\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\n\nexport class VscodeCompatHandler implements InspectorHandler {\n /** Keep track of `Runtime.getProperties` responses to intercept, by request id */\n interceptGetProperties = new Set<number>();\n\n onDebuggerMessage(\n message:\n | DebuggerRequest<DebuggerGetPossibleBreakpoints>\n | DebuggerRequest<DebuggerSetBreakpointByUrl>\n | DebuggerRequest<RuntimeGetProperties>,\n { socket }: Pick<DebuggerInfo, 'socket'>\n ) {\n // Hermes doesn't seem to handle this request, but `locations` have to be returned.\n // Respond with an empty location to make it \"spec compliant\" with Chrome DevTools.\n if (message.method === 'Debugger.getPossibleBreakpoints') {\n const response: DeviceResponse<DebuggerGetPossibleBreakpoints> = {\n id: message.id,\n result: { locations: [] },\n };\n socket.send(JSON.stringify(response));\n return true;\n }\n\n // Vscode doesn't seem to work nicely with missing `description` fields on `RemoteObject` instances.\n // See: https://github.com/microsoft/vscode-js-debug/issues/1583\n if (message.method === 'Runtime.getProperties') {\n this.interceptGetProperties.add(message.id);\n }\n\n // Hermes and vscode have trouble setting breakpoints by `urlRegex` through `Debugger.setBreakpointByUrl`.\n // Vscode adds `file://` to a URL containing `http://`, which confuses Hermes and sets it to the wrong location.\n // Hermes needs to create the breakpoint to get the proper ID, but it must be unbounded.\n // Once the sourcemap is loaded, vscode will rebind the unbounded breakpoint to the correct location (using `Debugger.setBreakpoint`).\n if (message.method === 'Debugger.setBreakpointByUrl' && message.params.urlRegex) {\n // Explicitly force the breakpoint to be unbounded\n message.params.url = 'file://__invalid_url__';\n delete message.params.urlRegex;\n }\n\n return false;\n }\n\n onDeviceMessage(message: DeviceResponse<RuntimeGetProperties>) {\n // Vscode doesn't seem to work nicely with missing `description` fields on `RemoteObject` instances.\n // See: https://github.com/microsoft/vscode-js-debug/issues/1583\n if ('id' in message && this.interceptGetProperties.has(message.id)) {\n this.interceptGetProperties.delete(message.id);\n\n for (const item of message.result.result ?? []) {\n // Force-fully format the properties description to be an empty string\n // See: https://github.com/facebook/hermes/issues/114\n if (item.value) {\n item.value.description = item.value.description ?? '';\n }\n\n // Avoid passing the `objectId` for symbol types.\n // When collapsing in vscode, it will fetch information about the symbol using the `objectId`.\n // The `Runtime.getProperties` request of the symbol hard-crashes Hermes.\n if (item.value?.type === 'symbol' && item.value.objectId) {\n delete item.value.objectId;\n }\n }\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-getPossibleBreakpoints */\nexport type DebuggerGetPossibleBreakpoints = CdpMessage<\n 'Debugger.getPossibleBreakpoints',\n Protocol.Debugger.GetPossibleBreakpointsRequest,\n Protocol.Debugger.GetPossibleBreakpointsResponse\n>;\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-setBreakpointByUrl */\nexport type DebuggerSetBreakpointByUrl = CdpMessage<\n 'Debugger.setBreakpointByUrl',\n Protocol.Debugger.SetBreakpointByUrlRequest,\n Protocol.Debugger.SetBreakpointByUrlResponse\n>;\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Runtime/#method-getProperties */\nexport type RuntimeGetProperties = CdpMessage<\n 'Runtime.getProperties',\n Protocol.Runtime.GetPropertiesRequest,\n Protocol.Runtime.GetPropertiesResponse\n>;\n"],"names":["VscodeCompatHandler","interceptGetProperties","Set","onDebuggerMessage","message","socket","method","response","id","result","locations","send","JSON","stringify","add","params","urlRegex","url","onDeviceMessage","has","delete","item","value","description","type","objectId"],"mappings":"AAAA;;;;AAKO,MAAMA,mBAAmB;IAC9B,kFAAkF,CAClFC,sBAAsB,GAAG,IAAIC,GAAG,EAAU,CAAC;IAE3CC,iBAAiB,CACfC,OAGyC,EACzC,EAAEC,MAAM,CAAA,EAAgC,EACxC;QACA,mFAAmF;QACnF,mFAAmF;QACnF,IAAID,OAAO,CAACE,MAAM,KAAK,iCAAiC,EAAE;YACxD,MAAMC,QAAQ,GAAmD;gBAC/DC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