@expo/cli 0.19.0 → 0.19.2
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 +1 -1
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +49 -1
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/createHandlersFactory.js +1 -3
- package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js +11 -4
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +2 -36
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/utils/env.js +0 -3
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +3 -4
- package/build/src/start/server/metro/debugging/messageHandlers/PageReload.js +0 -26
- package/build/src/start/server/metro/debugging/messageHandlers/PageReload.js.map +0 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +0 -75
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +0 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +0 -15
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +0 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +0 -104
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +0 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +0 -125
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +0 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +0 -145
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +0 -1
package/build/bin/cli
CHANGED
|
@@ -13,14 +13,23 @@ function _chalk() {
|
|
|
13
13
|
};
|
|
14
14
|
return data;
|
|
15
15
|
}
|
|
16
|
+
function _ws() {
|
|
17
|
+
const data = require("ws");
|
|
18
|
+
_ws = function() {
|
|
19
|
+
return data;
|
|
20
|
+
};
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
16
23
|
const _createHandlersFactory = require("./createHandlersFactory");
|
|
17
24
|
const _log = require("../../../../log");
|
|
18
25
|
const _env = require("../../../../utils/env");
|
|
26
|
+
const _networkResponse = require("./messageHandlers/NetworkResponse");
|
|
19
27
|
function _interopRequireDefault(obj) {
|
|
20
28
|
return obj && obj.__esModule ? obj : {
|
|
21
29
|
default: obj
|
|
22
30
|
};
|
|
23
31
|
}
|
|
32
|
+
const debug = require("debug")("expo:metro:debugging:middleware");
|
|
24
33
|
function createDebugMiddleware(metroBundler) {
|
|
25
34
|
// Load the React Native debugging tools from project
|
|
26
35
|
// TODO: check if this works with isolated modules
|
|
@@ -32,7 +41,7 @@ function createDebugMiddleware(metroBundler) {
|
|
|
32
41
|
hostType: "lan"
|
|
33
42
|
}),
|
|
34
43
|
logger: createLogger(_chalk().default.bold("Debug:")),
|
|
35
|
-
unstable_customInspectorMessageHandler: (0, _createHandlersFactory.createHandlersFactory)(
|
|
44
|
+
unstable_customInspectorMessageHandler: (0, _createHandlersFactory.createHandlersFactory)(),
|
|
36
45
|
unstable_experiments: {
|
|
37
46
|
// Enable the Network tab in React Native DevTools
|
|
38
47
|
enableNetworkInspector: true,
|
|
@@ -41,6 +50,8 @@ function createDebugMiddleware(metroBundler) {
|
|
|
41
50
|
enableOpenDebuggerRedirect: _env.env.EXPO_DEBUG
|
|
42
51
|
}
|
|
43
52
|
});
|
|
53
|
+
// NOTE(cedric): add a temporary websocket to handle Network-related CDP events
|
|
54
|
+
websocketEndpoints["/inspector/network"] = createNetworkWebsocket(websocketEndpoints["/inspector/debug"]);
|
|
44
55
|
return {
|
|
45
56
|
debugMiddleware: middleware,
|
|
46
57
|
debugWebsocketEndpoints: websocketEndpoints
|
|
@@ -53,5 +64,42 @@ function createLogger(logPrefix) {
|
|
|
53
64
|
error: (...args)=>_log.Log.error(logPrefix, ...args)
|
|
54
65
|
};
|
|
55
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* This adds a dedicated websocket connection that handles Network-related CDP events.
|
|
69
|
+
* It's a temporary solution until Fusebox either implements the Network CDP domain,
|
|
70
|
+
* or allows external domain agents that can send messages over the CDP socket to the debugger.
|
|
71
|
+
* The Network websocket rebroadcasts events on the debugger CDP connections.
|
|
72
|
+
*/ function createNetworkWebsocket(debuggerWebsocket) {
|
|
73
|
+
const wss = new (_ws()).WebSocketServer({
|
|
74
|
+
noServer: true,
|
|
75
|
+
perMessageDeflate: true,
|
|
76
|
+
// Don't crash on exceptionally large messages - assume the device is
|
|
77
|
+
// well-behaved and the debugger is prepared to handle large messages.
|
|
78
|
+
maxPayload: 0
|
|
79
|
+
});
|
|
80
|
+
wss.on("connection", (networkSocket)=>{
|
|
81
|
+
networkSocket.on("message", (data)=>{
|
|
82
|
+
try {
|
|
83
|
+
// Parse the network message, to determine how the message should be handled
|
|
84
|
+
const message = JSON.parse(data.toString());
|
|
85
|
+
if (message.method === "Expo(Network.receivedResponseBody)" && message.params) {
|
|
86
|
+
// If its a response body, write it to the global storage
|
|
87
|
+
const { requestId , ...requestInfo } = message.params;
|
|
88
|
+
_networkResponse.NETWORK_RESPONSE_STORAGE.set(requestId, requestInfo);
|
|
89
|
+
} else {
|
|
90
|
+
// Otherwise, directly re-broadcast the Network events to all connected debuggers
|
|
91
|
+
debuggerWebsocket.clients.forEach((debuggerSocket)=>{
|
|
92
|
+
if (debuggerSocket.readyState === debuggerSocket.OPEN) {
|
|
93
|
+
debuggerSocket.send(data.toString());
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
} catch (error) {
|
|
98
|
+
debug("Failed to handle Network CDP event", error);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
return wss;
|
|
103
|
+
}
|
|
56
104
|
|
|
57
105
|
//# sourceMappingURL=createDebugMiddleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/debugging/createDebugMiddleware.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { createHandlersFactory } from './createHandlersFactory';\nimport { Log } from '../../../../log';\nimport { env } from '../../../../utils/env';\nimport { type MetroBundlerDevServer } from '../MetroBundlerDevServer';\n\nexport function createDebugMiddleware(metroBundler: MetroBundlerDevServer) {\n // Load the React Native debugging tools from project\n // TODO: check if this works with isolated modules\n const { createDevMiddleware } =\n require('@react-native/dev-middleware') as typeof import('@react-native/dev-middleware');\n\n const { middleware, websocketEndpoints } = createDevMiddleware({\n projectRoot: metroBundler.projectRoot,\n serverBaseUrl: metroBundler.getUrlCreator().constructUrl({ scheme: 'http', hostType: 'lan' }),\n logger: createLogger(chalk.bold('Debug:')),\n unstable_customInspectorMessageHandler: createHandlersFactory(
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/debugging/createDebugMiddleware.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { WebSocketServer } from 'ws';\n\nimport { createHandlersFactory } from './createHandlersFactory';\nimport { Log } from '../../../../log';\nimport { env } from '../../../../utils/env';\nimport { type MetroBundlerDevServer } from '../MetroBundlerDevServer';\nimport { NETWORK_RESPONSE_STORAGE } from './messageHandlers/NetworkResponse';\n\nconst debug = require('debug')('expo:metro:debugging:middleware') as typeof console.log;\n\nexport function createDebugMiddleware(metroBundler: MetroBundlerDevServer) {\n // Load the React Native debugging tools from project\n // TODO: check if this works with isolated modules\n const { createDevMiddleware } =\n require('@react-native/dev-middleware') as typeof import('@react-native/dev-middleware');\n\n const { middleware, websocketEndpoints } = createDevMiddleware({\n projectRoot: metroBundler.projectRoot,\n serverBaseUrl: metroBundler.getUrlCreator().constructUrl({ scheme: 'http', hostType: 'lan' }),\n logger: createLogger(chalk.bold('Debug:')),\n unstable_customInspectorMessageHandler: createHandlersFactory(),\n unstable_experiments: {\n // Enable the Network tab in React Native DevTools\n enableNetworkInspector: true,\n // Only enable opening the browser version of React Native DevTools when debugging.\n // This is useful when debugging the React Native DevTools by going to `/open-debugger` in the browser.\n enableOpenDebuggerRedirect: env.EXPO_DEBUG,\n },\n });\n\n // NOTE(cedric): add a temporary websocket to handle Network-related CDP events\n websocketEndpoints['/inspector/network'] = createNetworkWebsocket(\n websocketEndpoints['/inspector/debug']\n );\n\n return {\n debugMiddleware: middleware,\n debugWebsocketEndpoints: websocketEndpoints,\n };\n}\n\nfunction createLogger(\n logPrefix: string\n): Parameters<typeof import('@react-native/dev-middleware').createDevMiddleware>[0]['logger'] {\n return {\n info: (...args) => Log.log(logPrefix, ...args),\n warn: (...args) => Log.warn(logPrefix, ...args),\n error: (...args) => Log.error(logPrefix, ...args),\n };\n}\n\n/**\n * This adds a dedicated websocket connection that handles Network-related CDP events.\n * It's a temporary solution until Fusebox either implements the Network CDP domain,\n * or allows external domain agents that can send messages over the CDP socket to the debugger.\n * The Network websocket rebroadcasts events on the debugger CDP connections.\n */\nfunction createNetworkWebsocket(debuggerWebsocket: WebSocketServer) {\n const wss = new WebSocketServer({\n noServer: true,\n perMessageDeflate: true,\n // Don't crash on exceptionally large messages - assume the device is\n // well-behaved and the debugger is prepared to handle large messages.\n maxPayload: 0,\n });\n\n wss.on('connection', (networkSocket) => {\n networkSocket.on('message', (data) => {\n try {\n // Parse the network message, to determine how the message should be handled\n const message = JSON.parse(data.toString());\n\n if (message.method === 'Expo(Network.receivedResponseBody)' && message.params) {\n // If its a response body, write it to the global storage\n const { requestId, ...requestInfo } = message.params;\n NETWORK_RESPONSE_STORAGE.set(requestId, requestInfo);\n } else {\n // Otherwise, directly re-broadcast the Network events to all connected debuggers\n debuggerWebsocket.clients.forEach((debuggerSocket) => {\n if (debuggerSocket.readyState === debuggerSocket.OPEN) {\n debuggerSocket.send(data.toString());\n }\n });\n }\n } catch (error) {\n debug('Failed to handle Network CDP event', error);\n }\n });\n });\n\n return wss;\n}\n"],"names":["createDebugMiddleware","debug","require","metroBundler","createDevMiddleware","middleware","websocketEndpoints","projectRoot","serverBaseUrl","getUrlCreator","constructUrl","scheme","hostType","logger","createLogger","chalk","bold","unstable_customInspectorMessageHandler","createHandlersFactory","unstable_experiments","enableNetworkInspector","enableOpenDebuggerRedirect","env","EXPO_DEBUG","createNetworkWebsocket","debugMiddleware","debugWebsocketEndpoints","logPrefix","info","args","Log","log","warn","error","debuggerWebsocket","wss","WebSocketServer","noServer","perMessageDeflate","maxPayload","on","networkSocket","data","message","JSON","parse","toString","method","params","requestId","requestInfo","NETWORK_RESPONSE_STORAGE","set","clients","forEach","debuggerSocket","readyState","OPEN","send"],"mappings":"AAAA;;;;+BAWgBA,uBAAqB;;aAArBA,qBAAqB;;;8DAXnB,OAAO;;;;;;;yBACO,IAAI;;;;;;uCAEE,yBAAyB;qBAC3C,iBAAiB;qBACjB,uBAAuB;iCAEF,mCAAmC;;;;;;AAE5E,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,iCAAiC,CAAC,AAAsB,AAAC;AAEjF,SAASF,qBAAqB,CAACG,YAAmC,EAAE;IACzE,qDAAqD;IACrD,kDAAkD;IAClD,MAAM,EAAEC,mBAAmB,CAAA,EAAE,GAC3BF,OAAO,CAAC,8BAA8B,CAAC,AAAiD,AAAC;IAE3F,MAAM,EAAEG,UAAU,CAAA,EAAEC,kBAAkB,CAAA,EAAE,GAAGF,mBAAmB,CAAC;QAC7DG,WAAW,EAAEJ,YAAY,CAACI,WAAW;QACrCC,aAAa,EAAEL,YAAY,CAACM,aAAa,EAAE,CAACC,YAAY,CAAC;YAAEC,MAAM,EAAE,MAAM;YAAEC,QAAQ,EAAE,KAAK;SAAE,CAAC;QAC7FC,MAAM,EAAEC,YAAY,CAACC,MAAK,EAAA,QAAA,CAACC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1CC,sCAAsC,EAAEC,IAAAA,sBAAq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KAAK,CAACH,IAAI,CAACI,QAAQ,EAAE,CAAC,AAAC;gBAE5C,IAAIH,OAAO,CAACI,MAAM,KAAK,oCAAoC,IAAIJ,OAAO,CAACK,MAAM,EAAE;oBAC7E,yDAAyD;oBACzD,MAAM,EAAEC,SAAS,CAAA,EAAE,GAAGC,WAAW,EAAE,GAAGP,OAAO,CAACK,MAAM,AAAC;oBACrDG,gBAAwB,yBAAA,CAACC,GAAG,CAACH,SAAS,EAAEC,WAAW,CAAC,CAAC;gBACvD,OAAO;oBACL,iFAAiF;oBACjFhB,iBAAiB,CAACmB,OAAO,CAACC,OAAO,CAAC,CAACC,cAAc,GAAK;wBACpD,IAAIA,cAAc,CAACC,UAAU,KAAKD,cAAc,CAACE,IAAI,EAAE;4BACrDF,cAAc,CAACG,IAAI,CAAChB,IAAI,CAACI,QAAQ,EAAE,CAAC,CAAC;wBACvC,CAAC;oBACH,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,EAAE,OAAOb,KAAK,EAAE;gBACdhC,KAAK,CAAC,oCAAoC,EAAEgC,KAAK,CAAC,CAAC;YACrD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAOE,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "createHandlersFactory", {
|
|
|
7
7
|
get: ()=>createHandlersFactory
|
|
8
8
|
});
|
|
9
9
|
const _networkResponse = require("./messageHandlers/NetworkResponse");
|
|
10
|
-
const _pageReload = require("./messageHandlers/PageReload");
|
|
11
10
|
const _vscodeDebuggerGetPossibleBreakpoints = require("./messageHandlers/VscodeDebuggerGetPossibleBreakpoints");
|
|
12
11
|
const _vscodeDebuggerSetBreakpointByUrl = require("./messageHandlers/VscodeDebuggerSetBreakpointByUrl");
|
|
13
12
|
const _vscodeRuntimeCallFunctionOn = require("./messageHandlers/VscodeRuntimeCallFunctionOn");
|
|
@@ -15,7 +14,7 @@ const _vscodeRuntimeEvaluate = require("./messageHandlers/VscodeRuntimeEvaluate"
|
|
|
15
14
|
const _vscodeRuntimeGetProperties = require("./messageHandlers/VscodeRuntimeGetProperties");
|
|
16
15
|
const _pageIsSupported = require("./pageIsSupported");
|
|
17
16
|
const debug = require("debug")("expo:metro:debugging:messageHandlers");
|
|
18
|
-
function createHandlersFactory(
|
|
17
|
+
function createHandlersFactory() {
|
|
19
18
|
return (connection)=>{
|
|
20
19
|
debug("Initializing for connection: ", connection.page.title);
|
|
21
20
|
if (!(0, _pageIsSupported.pageIsSupported)(connection.page)) {
|
|
@@ -25,7 +24,6 @@ function createHandlersFactory(metroBundler) {
|
|
|
25
24
|
const handlers = [
|
|
26
25
|
// Generic handlers
|
|
27
26
|
new _networkResponse.NetworkResponseHandler(connection),
|
|
28
|
-
new _pageReload.PageReloadHandler(connection, metroBundler),
|
|
29
27
|
// Vscode-specific handlers
|
|
30
28
|
new _vscodeDebuggerGetPossibleBreakpoints.VscodeDebuggerGetPossibleBreakpointsHandler(connection),
|
|
31
29
|
new _vscodeDebuggerSetBreakpointByUrl.VscodeDebuggerSetBreakpointByUrlHandler(connection),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/debugging/createHandlersFactory.ts"],"sourcesContent":["import type { CreateCustomMessageHandlerFn } from '@react-native/dev-middleware';\n\nimport { NetworkResponseHandler } from './messageHandlers/NetworkResponse';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/debugging/createHandlersFactory.ts"],"sourcesContent":["import type { CreateCustomMessageHandlerFn } from '@react-native/dev-middleware';\n\nimport { NetworkResponseHandler } from './messageHandlers/NetworkResponse';\nimport { VscodeDebuggerGetPossibleBreakpointsHandler } from './messageHandlers/VscodeDebuggerGetPossibleBreakpoints';\nimport { VscodeDebuggerSetBreakpointByUrlHandler } from './messageHandlers/VscodeDebuggerSetBreakpointByUrl';\nimport { VscodeRuntimeCallFunctionOnHandler } from './messageHandlers/VscodeRuntimeCallFunctionOn';\nimport { VscodeRuntimeEvaluateHandler } from './messageHandlers/VscodeRuntimeEvaluate';\nimport { VscodeRuntimeGetPropertiesHandler } from './messageHandlers/VscodeRuntimeGetProperties';\nimport { pageIsSupported } from './pageIsSupported';\n\nconst debug = require('debug')('expo:metro:debugging:messageHandlers') as typeof console.log;\n\nexport function createHandlersFactory(): CreateCustomMessageHandlerFn {\n return (connection) => {\n debug('Initializing for connection: ', connection.page.title);\n\n if (!pageIsSupported(connection.page)) {\n debug('Aborted, unsupported page capabiltiies:', connection.page.capabilities);\n return null;\n }\n\n const handlers = [\n // Generic handlers\n new NetworkResponseHandler(connection),\n // Vscode-specific handlers\n new VscodeDebuggerGetPossibleBreakpointsHandler(connection),\n new VscodeDebuggerSetBreakpointByUrlHandler(connection),\n new VscodeRuntimeGetPropertiesHandler(connection),\n new VscodeRuntimeCallFunctionOnHandler(connection),\n new VscodeRuntimeEvaluateHandler(connection),\n ].filter((middleware) => middleware.isEnabled());\n\n if (!handlers.length) {\n debug('Aborted, all handlers are disabled');\n return null;\n }\n\n debug(\n 'Initialized with handlers: ',\n handlers.map((middleware) => middleware.constructor.name).join(', ')\n );\n\n return {\n handleDeviceMessage: (message: any) =>\n withMessageDebug(\n 'device',\n message,\n handlers.some((middleware) => middleware.handleDeviceMessage?.(message))\n ),\n handleDebuggerMessage: (message: any) =>\n withMessageDebug(\n 'debugger',\n message,\n handlers.some((middleware) => middleware.handleDebuggerMessage?.(message))\n ),\n };\n };\n}\n\nfunction withMessageDebug(type: 'device' | 'debugger', message: any, result?: null | boolean) {\n const status = result ? 'handled' : 'ignored';\n const prefix = type === 'device' ? '(debugger) <- (device)' : '(debugger) -> (device)';\n\n try {\n debug(`%s = %s:`, prefix, status, JSON.stringify(message));\n } catch {\n debug(`%s = %s:`, prefix, status, 'message not serializable');\n }\n\n return result || undefined;\n}\n"],"names":["createHandlersFactory","debug","require","connection","page","title","pageIsSupported","capabilities","handlers","NetworkResponseHandler","VscodeDebuggerGetPossibleBreakpointsHandler","VscodeDebuggerSetBreakpointByUrlHandler","VscodeRuntimeGetPropertiesHandler","VscodeRuntimeCallFunctionOnHandler","VscodeRuntimeEvaluateHandler","filter","middleware","isEnabled","length","map","constructor","name","join","handleDeviceMessage","message","withMessageDebug","some","handleDebuggerMessage","type","result","status","prefix","JSON","stringify","undefined"],"mappings":"AAAA;;;;+BAYgBA,uBAAqB;;aAArBA,qBAAqB;;iCAVE,mCAAmC;sDACd,wDAAwD;kDAC5D,oDAAoD;6CACzD,+CAA+C;uCACrD,yCAAyC;4CACpC,8CAA8C;iCAChE,mBAAmB;AAEnD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,sCAAsC,CAAC,AAAsB,AAAC;AAEtF,SAASF,qBAAqB,GAAiC;IACpE,OAAO,CAACG,UAAU,GAAK;QACrBF,KAAK,CAAC,+BAA+B,EAAEE,UAAU,CAACC,IAAI,CAACC,KAAK,CAAC,CAAC;QAE9D,IAAI,CAACC,IAAAA,gBAAe,gBAAA,EAACH,UAAU,CAACC,IAAI,CAAC,EAAE;YACrCH,KAAK,CAAC,yCAAyC,EAAEE,UAAU,CAACC,IAAI,CAACG,YAAY,CAAC,CAAC;YAC/E,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAMC,QAAQ,GAAG;YACf,mBAAmB;YACnB,IAAIC,gBAAsB,uBAAA,CAACN,UAAU,CAAC;YACtC,2BAA2B;YAC3B,IAAIO,qCAA2C,4CAAA,CAACP,UAAU,CAAC;YAC3D,IAAIQ,iCAAuC,wCAAA,CAACR,UAAU,CAAC;YACvD,IAAIS,2BAAiC,kCAAA,CAACT,UAAU,CAAC;YACjD,IAAIU,4BAAkC,mCAAA,CAACV,UAAU,CAAC;YAClD,IAAIW,sBAA4B,6BAAA,CAACX,UAAU,CAAC;SAC7C,CAACY,MAAM,CAAC,CAACC,UAAU,GAAKA,UAAU,CAACC,SAAS,EAAE,CAAC,AAAC;QAEjD,IAAI,CAACT,QAAQ,CAACU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,CAAC,CAAC,QAAQ,CAAC,EAAE8B,MAAM,EAAED,MAAM,EAAE,0BAA0B,CAAC,CAAC;IAChE,CAAC;IAED,OAAOD,MAAM,IAAIK,SAAS,CAAC;AAC7B,CAAC"}
|
|
@@ -2,13 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
NETWORK_RESPONSE_STORAGE: ()=>NETWORK_RESPONSE_STORAGE,
|
|
13
|
+
NetworkResponseHandler: ()=>NetworkResponseHandler
|
|
8
14
|
});
|
|
9
15
|
const _messageHandler = require("../MessageHandler");
|
|
16
|
+
const NETWORK_RESPONSE_STORAGE = new Map();
|
|
10
17
|
class NetworkResponseHandler extends _messageHandler.MessageHandler {
|
|
11
|
-
/** All known responses, mapped by request id */ storage =
|
|
18
|
+
/** All known responses, mapped by request id */ storage = NETWORK_RESPONSE_STORAGE;
|
|
12
19
|
isEnabled() {
|
|
13
20
|
return this.page.capabilities.nativeNetworkInspection !== true;
|
|
14
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/debugging/messageHandlers/NetworkResponse.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport { MessageHandler } from '../MessageHandler';\nimport type {\n CdpMessage,\n DeviceRequest,\n DebuggerRequest,\n DebuggerResponse,\n DeviceResponse,\n} from '../types';\n\nexport class NetworkResponseHandler extends MessageHandler {\n /** All known responses, mapped by request id */\n storage =
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/start/server/metro/debugging/messageHandlers/NetworkResponse.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport { MessageHandler } from '../MessageHandler';\nimport type {\n CdpMessage,\n DeviceRequest,\n DebuggerRequest,\n DebuggerResponse,\n DeviceResponse,\n} from '../types';\n\n/**\n * The global network response storage, as a workaround for the network inspector.\n * @see createDebugMiddleware#createNetworkWebsocket\n */\nexport const NETWORK_RESPONSE_STORAGE = new Map<\n string,\n DebuggerResponse<NetworkGetResponseBody>['result']\n>();\n\nexport class NetworkResponseHandler extends MessageHandler {\n /** All known responses, mapped by request id */\n storage = NETWORK_RESPONSE_STORAGE;\n\n isEnabled() {\n return this.page.capabilities.nativeNetworkInspection !== true;\n }\n\n handleDeviceMessage(message: DeviceRequest<NetworkReceivedResponseBody>) {\n if (message.method === 'Expo(Network.receivedResponseBody)') {\n const { requestId, ...requestInfo } = message.params;\n this.storage.set(requestId, requestInfo);\n return true;\n }\n\n return false;\n }\n\n handleDebuggerMessage(message: DebuggerRequest<NetworkGetResponseBody>) {\n if (\n message.method === 'Network.getResponseBody' &&\n this.storage.has(message.params.requestId)\n ) {\n return this.sendToDebugger<DeviceResponse<NetworkGetResponseBody>>({\n id: message.id,\n result: this.storage.get(message.params.requestId)!,\n });\n }\n\n return false;\n }\n}\n\n/** Custom message to transfer the response body data to the proxy */\nexport type NetworkReceivedResponseBody = CdpMessage<\n 'Expo(Network.receivedResponseBody)',\n Protocol.Network.GetResponseBodyRequest & Protocol.Network.GetResponseBodyResponse,\n never\n>;\n\n/** @see https://chromedevtools.github.io/devtools-protocol/1-2/Network/#method-getResponseBody */\nexport type NetworkGetResponseBody = CdpMessage<\n 'Network.getResponseBody',\n Protocol.Network.GetResponseBodyRequest,\n Protocol.Network.GetResponseBodyResponse\n>;\n"],"names":["NETWORK_RESPONSE_STORAGE","NetworkResponseHandler","Map","MessageHandler","storage","isEnabled","page","capabilities","nativeNetworkInspection","handleDeviceMessage","message","method","requestId","requestInfo","params","set","handleDebuggerMessage","has","sendToDebugger","id","result","get"],"mappings":"AAAA;;;;;;;;;;;IAeaA,wBAAwB,MAAxBA,wBAAwB;IAKxBC,sBAAsB,MAAtBA,sBAAsB;;gCAlBJ,mBAAmB;AAa3C,MAAMD,wBAAwB,GAAG,IAAIE,GAAG,EAG5C,AAAC;AAEG,MAAMD,sBAAsB,SAASE,eAAc,eAAA;IACxD,8CAA8C,GAC9CC,OAAO,GAAGJ,wBAAwB,CAAC;IAEnCK,SAAS,GAAG;QACV,OAAO,IAAI,CAACC,IAAI,CAACC,YAAY,CAACC,uBAAuB,KAAK,IAAI,CAAC;IACjE;IAEAC,mBAAmB,CAACC,OAAmD,EAAE;QACvE,IAAIA,OAAO,CAACC,MAAM,KAAK,oCAAoC,EAAE;YAC3D,MAAM,EAAEC,SAAS,CAAA,EAAE,GAAGC,WAAW,EAAE,GAAGH,OAAO,CAACI,MAAM,AAAC;YACrD,IAAI,CAACV,OAAO,CAACW,GAAG,CAACH,SAAS,EAAEC,WAAW,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,KAAK,CAAC;IACf;IAEAG,qBAAqB,CAACN,OAAgD,EAAE;QACtE,IACEA,OAAO,CAACC,MAAM,KAAK,yBAAyB,IAC5C,IAAI,CAACP,OAAO,CAACa,GAAG,CAACP,OAAO,CAACI,MAAM,CAACF,SAAS,CAAC,EAC1C;YACA,OAAO,IAAI,CAACM,cAAc,CAAyC;gBACjEC,EAAE,EAAET,OAAO,CAACS,EAAE;gBACdC,MAAM,EAAE,IAAI,CAAChB,OAAO,CAACiB,GAAG,CAACX,OAAO,CAACI,MAAM,CAACF,SAAS,CAAC;aACnD,CAAC,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC;IACf;CACD"}
|
|
@@ -10,7 +10,6 @@ function _export(target, all) {
|
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
12
|
openJsInspector: ()=>openJsInspector,
|
|
13
|
-
closeJsInspector: ()=>closeJsInspector,
|
|
14
13
|
queryInspectorAppAsync: ()=>queryInspectorAppAsync,
|
|
15
14
|
queryAllInspectorAppsAsync: ()=>queryAllInspectorAppsAsync,
|
|
16
15
|
promptInspectorAppAsync: ()=>promptInspectorAppAsync
|
|
@@ -22,9 +21,6 @@ function _chalk() {
|
|
|
22
21
|
};
|
|
23
22
|
return data;
|
|
24
23
|
}
|
|
25
|
-
const _launchBrowser = require("./LaunchBrowser");
|
|
26
|
-
const _log = require("../../../../log");
|
|
27
|
-
const _env = require("../../../../utils/env");
|
|
28
24
|
const _prompts = require("../../../../utils/prompts");
|
|
29
25
|
const _pageIsSupported = require("../../metro/debugging/pageIsSupported");
|
|
30
26
|
function _interopRequireDefault(obj) {
|
|
@@ -33,17 +29,10 @@ function _interopRequireDefault(obj) {
|
|
|
33
29
|
};
|
|
34
30
|
}
|
|
35
31
|
const debug = require("debug")("expo:start:server:middleware:inspector:jsInspector");
|
|
36
|
-
|
|
37
|
-
function openJsInspector(metroBaseUrl, app) {
|
|
38
|
-
if (_env.env.EXPO_USE_UNSTABLE_DEBUGGER) {
|
|
39
|
-
return openExperimentalJsInspector(metroBaseUrl, app);
|
|
40
|
-
} else {
|
|
41
|
-
return openClassicJsInspector(app);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async function openExperimentalJsInspector(metroBaseUrl, app) {
|
|
32
|
+
async function openJsInspector(metroBaseUrl, app) {
|
|
45
33
|
var ref;
|
|
46
34
|
if (!((ref = app.reactNative) == null ? void 0 : ref.logicalDeviceId)) {
|
|
35
|
+
debug("Failed to open React Native DevTools, target is missing device ID");
|
|
47
36
|
return false;
|
|
48
37
|
}
|
|
49
38
|
const url = new URL("/open-debugger", metroBaseUrl);
|
|
@@ -58,29 +47,6 @@ async function openExperimentalJsInspector(metroBaseUrl, app) {
|
|
|
58
47
|
}
|
|
59
48
|
return response.ok;
|
|
60
49
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Chrome DevTools UI implemented for SDK <49.
|
|
63
|
-
* TODO(cedric): Remove this when we fully swap over to the new React Native JS Inspector.
|
|
64
|
-
*/ async function openClassicJsInspector(app) {
|
|
65
|
-
_log.Log.log((0, _chalk().default)`{bold Debug:} Opening JavaScript inspector in the browser...`);
|
|
66
|
-
// To update devtoolsFrontendRev, find the full commit hash in the url:
|
|
67
|
-
// https://chromium.googlesource.com/chromium/src.git/+log/refs/tags/{CHROME_VERSION}/chrome/VERSION
|
|
68
|
-
//
|
|
69
|
-
// 1. Replace {CHROME_VERSION} with the target chrome version
|
|
70
|
-
// 2. Click the first log item in the webpage
|
|
71
|
-
// 3. The full commit hash is the desired revision
|
|
72
|
-
const devtoolsFrontendRev = "d9568d04d7dd79269c5a655d7ada69650c5a8336"; // Chrome 100.0.4896.75
|
|
73
|
-
const urlBase = `https://chrome-devtools-frontend.appspot.com/serve_rev/@${devtoolsFrontendRev}/devtools_app.html`;
|
|
74
|
-
const ws = app.webSocketDebuggerUrl.replace(/^ws:\/\//, "");
|
|
75
|
-
const url = `${urlBase}?panel=console&ws=${encodeURIComponent(ws)}`;
|
|
76
|
-
await closeJsInspector();
|
|
77
|
-
openingBrowserInstance = await (0, _launchBrowser.launchInspectorBrowserAsync)(url);
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
async function closeJsInspector() {
|
|
81
|
-
await (openingBrowserInstance == null ? void 0 : openingBrowserInstance.close());
|
|
82
|
-
openingBrowserInstance = null;
|
|
83
|
-
}
|
|
84
50
|
async function queryInspectorAppAsync(metroServerOrigin, appId) {
|
|
85
51
|
const apps = await queryAllInspectorAppsAsync(metroServerOrigin);
|
|
86
52
|
return apps.find((app)=>app.description === appId) ?? null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/middleware/inspector/JsInspector.ts"],"sourcesContent":["import type { CustomMessageHandlerConnection } from '@react-native/dev-middleware';\nimport chalk from 'chalk';\n\nimport { launchInspectorBrowserAsync, type LaunchBrowserInstance } from './LaunchBrowser';\nimport { Log } from '../../../../log';\nimport { env } from '../../../../utils/env';\nimport { selectAsync } from '../../../../utils/prompts';\nimport { pageIsSupported } from '../../metro/debugging/pageIsSupported';\n\nconst debug = require('debug')(\n 'expo:start:server:middleware:inspector:jsInspector'\n) as typeof console.log;\n\nexport interface MetroInspectorProxyApp {\n /** Unique device ID combined with the page ID */\n id: string;\n /** Information about the underlying CDP implementation, e.g. \"React Native Bridgeless [C++ connection]\" */\n title: string;\n /** The application ID that is currently running on the device, e.g. \"dev.expo.bareexpo\" */\n description: string;\n /** The CDP debugger type, which should always be \"node\" */\n type: 'node';\n /** The internal `devtools://..` URL for the debugger to connect to */\n devtoolsFrontendUrl: string;\n /** The websocket URL for the debugger to connect to */\n webSocketDebuggerUrl: string;\n /**\n * Human-readable device name\n * @since react-native@0.73\n */\n deviceName: string;\n /**\n * React Native specific information, like the unique device ID and native capabilities\n * @since react-native@0.74\n */\n reactNative?: {\n /** The unique device ID */\n logicalDeviceId: string;\n /** All supported native capabilities */\n capabilities: CustomMessageHandlerConnection['page']['capabilities'];\n };\n}\n\nlet openingBrowserInstance: LaunchBrowserInstance | null = null;\n\nexport function openJsInspector(metroBaseUrl: string, app: MetroInspectorProxyApp) {\n if (env.EXPO_USE_UNSTABLE_DEBUGGER) {\n return openExperimentalJsInspector(metroBaseUrl, app);\n } else {\n return openClassicJsInspector(app);\n }\n}\n\nasync function openExperimentalJsInspector(metroBaseUrl: string, app: MetroInspectorProxyApp) {\n if (!app.reactNative?.logicalDeviceId) {\n return false;\n }\n\n const url = new URL('/open-debugger', metroBaseUrl);\n url.searchParams.set('appId', app.description);\n url.searchParams.set('device', app.reactNative.logicalDeviceId);\n url.searchParams.set('target', app.id);\n\n const response = await fetch(url, { method: 'POST' });\n if (!response.ok) {\n debug('Failed to open React Native DevTools, received response:', response.status);\n }\n\n return response.ok;\n}\n\n/**\n * Chrome DevTools UI implemented for SDK <49.\n * TODO(cedric): Remove this when we fully swap over to the new React Native JS Inspector.\n */\nasync function openClassicJsInspector(app: MetroInspectorProxyApp) {\n Log.log(chalk`{bold Debug:} Opening JavaScript inspector in the browser...`);\n\n // To update devtoolsFrontendRev, find the full commit hash in the url:\n // https://chromium.googlesource.com/chromium/src.git/+log/refs/tags/{CHROME_VERSION}/chrome/VERSION\n //\n // 1. Replace {CHROME_VERSION} with the target chrome version\n // 2. Click the first log item in the webpage\n // 3. The full commit hash is the desired revision\n const devtoolsFrontendRev = 'd9568d04d7dd79269c5a655d7ada69650c5a8336'; // Chrome 100.0.4896.75\n\n const urlBase = `https://chrome-devtools-frontend.appspot.com/serve_rev/@${devtoolsFrontendRev}/devtools_app.html`;\n const ws = app.webSocketDebuggerUrl.replace(/^ws:\\/\\//, '');\n const url = `${urlBase}?panel=console&ws=${encodeURIComponent(ws)}`;\n await closeJsInspector();\n openingBrowserInstance = await launchInspectorBrowserAsync(url);\n return true;\n}\n\nexport async function closeJsInspector() {\n await openingBrowserInstance?.close();\n openingBrowserInstance = null;\n}\n\nexport async function queryInspectorAppAsync(\n metroServerOrigin: string,\n appId: string\n): Promise<MetroInspectorProxyApp | null> {\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n return apps.find((app) => app.description === appId) ?? null;\n}\n\nexport async function queryAllInspectorAppsAsync(\n metroServerOrigin: string\n): Promise<MetroInspectorProxyApp[]> {\n const resp = await fetch(`${metroServerOrigin}/json/list`);\n const apps: MetroInspectorProxyApp[] = transformApps(await resp.json());\n // Only use targets with better reloading support\n return apps.filter((app) => pageIsSupported(app));\n}\n\nexport async function promptInspectorAppAsync(apps: MetroInspectorProxyApp[]) {\n if (apps.length === 1) {\n return apps[0];\n }\n\n // Check if multiple devices are connected with the same device names\n // In this case, append the actual app id (device ID + page number) to the prompt\n const hasDuplicateNames = apps.some(\n (app, index) => index !== apps.findIndex((other) => app.deviceName === other.deviceName)\n );\n\n const choices = apps.map((app) => {\n const name = app.deviceName ?? 'Unknown device';\n return {\n title: hasDuplicateNames ? chalk`${name}{dim - ${app.id}}` : name,\n value: app.id,\n app,\n };\n });\n\n const value = await selectAsync(chalk`Debug target {dim (Hermes only)}`, choices);\n\n return choices.find((item) => item.value === value)?.app;\n}\n\n// The description of `React Native Experimental (Improved Chrome Reloads)` target is `don't use` from metro.\n// This function tries to transform the unmeaningful description to appId\nfunction transformApps(apps: MetroInspectorProxyApp[]): MetroInspectorProxyApp[] {\n const deviceIdToAppId: Record<string, string> = {};\n\n for (const app of apps) {\n if (app.description !== \"don't use\") {\n const deviceId = app.reactNative?.logicalDeviceId ?? app.id.split('-')[0];\n const appId = app.description;\n deviceIdToAppId[deviceId] = appId;\n }\n }\n\n return apps.map((app) => {\n if (app.description === \"don't use\") {\n const deviceId = app.reactNative?.logicalDeviceId ?? app.id.split('-')[0];\n app.description = deviceIdToAppId[deviceId] ?? app.description;\n }\n return app;\n });\n}\n"],"names":["openJsInspector","closeJsInspector","queryInspectorAppAsync","queryAllInspectorAppsAsync","promptInspectorAppAsync","debug","require","openingBrowserInstance","metroBaseUrl","app","env","EXPO_USE_UNSTABLE_DEBUGGER","openExperimentalJsInspector","openClassicJsInspector","reactNative","logicalDeviceId","url","URL","searchParams","set","description","id","response","fetch","method","ok","status","Log","log","chalk","devtoolsFrontendRev","urlBase","ws","webSocketDebuggerUrl","replace","encodeURIComponent","launchInspectorBrowserAsync","close","metroServerOrigin","appId","apps","find","resp","transformApps","json","filter","pageIsSupported","choices","length","hasDuplicateNames","some","index","findIndex","other","deviceName","map","name","title","value","selectAsync","item","deviceIdToAppId","deviceId","split"],"mappings":"AAAA;;;;;;;;;;;IA6CgBA,eAAe,MAAfA,eAAe;IAiDTC,gBAAgB,MAAhBA,gBAAgB;IAKhBC,sBAAsB,MAAtBA,sBAAsB;IAQtBC,0BAA0B,MAA1BA,0BAA0B;IAS1BC,uBAAuB,MAAvBA,uBAAuB;;;8DAnH3B,OAAO;;;;;;+BAE+C,iBAAiB;qBACrE,iBAAiB;qBACjB,uBAAuB;yBACf,2BAA2B;iCACvB,uCAAuC;;;;;;AAEvE,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,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AAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/middleware/inspector/JsInspector.ts"],"sourcesContent":["import type { CustomMessageHandlerConnection } from '@react-native/dev-middleware';\nimport chalk from 'chalk';\n\nimport { selectAsync } from '../../../../utils/prompts';\nimport { pageIsSupported } from '../../metro/debugging/pageIsSupported';\n\nconst debug = require('debug')(\n 'expo:start:server:middleware:inspector:jsInspector'\n) as typeof console.log;\n\nexport interface MetroInspectorProxyApp {\n /** Unique device ID combined with the page ID */\n id: string;\n /** Information about the underlying CDP implementation, e.g. \"React Native Bridgeless [C++ connection]\" */\n title: string;\n /** The application ID that is currently running on the device, e.g. \"dev.expo.bareexpo\" */\n description: string;\n /** The CDP debugger type, which should always be \"node\" */\n type: 'node';\n /** The internal `devtools://..` URL for the debugger to connect to */\n devtoolsFrontendUrl: string;\n /** The websocket URL for the debugger to connect to */\n webSocketDebuggerUrl: string;\n /**\n * Human-readable device name\n * @since react-native@0.73\n */\n deviceName: string;\n /**\n * React Native specific information, like the unique device ID and native capabilities\n * @since react-native@0.74\n */\n reactNative?: {\n /** The unique device ID */\n logicalDeviceId: string;\n /** All supported native capabilities */\n capabilities: CustomMessageHandlerConnection['page']['capabilities'];\n };\n}\n\n/**\n * Launch the React Native DevTools by executing the `POST /open-debugger` request.\n * This endpoint is handled through `@react-native/dev-middleware`.\n */\nexport async function openJsInspector(metroBaseUrl: string, app: MetroInspectorProxyApp) {\n if (!app.reactNative?.logicalDeviceId) {\n debug('Failed to open React Native DevTools, target is missing device ID');\n return false;\n }\n\n const url = new URL('/open-debugger', metroBaseUrl);\n url.searchParams.set('appId', app.description);\n url.searchParams.set('device', app.reactNative.logicalDeviceId);\n url.searchParams.set('target', app.id);\n\n const response = await fetch(url, { method: 'POST' });\n if (!response.ok) {\n debug('Failed to open React Native DevTools, received response:', response.status);\n }\n\n return response.ok;\n}\n\nexport async function queryInspectorAppAsync(\n metroServerOrigin: string,\n appId: string\n): Promise<MetroInspectorProxyApp | null> {\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n return apps.find((app) => app.description === appId) ?? null;\n}\n\nexport async function queryAllInspectorAppsAsync(\n metroServerOrigin: string\n): Promise<MetroInspectorProxyApp[]> {\n const resp = await fetch(`${metroServerOrigin}/json/list`);\n const apps: MetroInspectorProxyApp[] = transformApps(await resp.json());\n // Only use targets with better reloading support\n return apps.filter((app) => pageIsSupported(app));\n}\n\nexport async function promptInspectorAppAsync(apps: MetroInspectorProxyApp[]) {\n if (apps.length === 1) {\n return apps[0];\n }\n\n // Check if multiple devices are connected with the same device names\n // In this case, append the actual app id (device ID + page number) to the prompt\n const hasDuplicateNames = apps.some(\n (app, index) => index !== apps.findIndex((other) => app.deviceName === other.deviceName)\n );\n\n const choices = apps.map((app) => {\n const name = app.deviceName ?? 'Unknown device';\n return {\n title: hasDuplicateNames ? chalk`${name}{dim - ${app.id}}` : name,\n value: app.id,\n app,\n };\n });\n\n const value = await selectAsync(chalk`Debug target {dim (Hermes only)}`, choices);\n\n return choices.find((item) => item.value === value)?.app;\n}\n\n// The description of `React Native Experimental (Improved Chrome Reloads)` target is `don't use` from metro.\n// This function tries to transform the unmeaningful description to appId\nfunction transformApps(apps: MetroInspectorProxyApp[]): MetroInspectorProxyApp[] {\n const deviceIdToAppId: Record<string, string> = {};\n\n for (const app of apps) {\n if (app.description !== \"don't use\") {\n const deviceId = app.reactNative?.logicalDeviceId ?? app.id.split('-')[0];\n const appId = app.description;\n deviceIdToAppId[deviceId] = appId;\n }\n }\n\n return apps.map((app) => {\n if (app.description === \"don't use\") {\n const deviceId = app.reactNative?.logicalDeviceId ?? app.id.split('-')[0];\n app.description = deviceIdToAppId[deviceId] ?? app.description;\n }\n return app;\n });\n}\n"],"names":["openJsInspector","queryInspectorAppAsync","queryAllInspectorAppsAsync","promptInspectorAppAsync","debug","require","metroBaseUrl","app","reactNative","logicalDeviceId","url","URL","searchParams","set","description","id","response","fetch","method","ok","status","metroServerOrigin","appId","apps","find","resp","transformApps","json","filter","pageIsSupported","choices","length","hasDuplicateNames","some","index","findIndex","other","deviceName","map","name","title","chalk","value","selectAsync","item","deviceIdToAppId","deviceId","split"],"mappings":"AAAA;;;;;;;;;;;IA4CsBA,eAAe,MAAfA,eAAe;IAmBfC,sBAAsB,MAAtBA,sBAAsB;IAQtBC,0BAA0B,MAA1BA,0BAA0B;IAS1BC,uBAAuB,MAAvBA,uBAAuB;;;8DA/E3B,OAAO;;;;;;yBAEG,2BAA2B;iCACvB,uCAAuC;;;;;;AAEvE,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,oDAAoD,CACrD,AAAsB,AAAC;AAoCjB,eAAeL,eAAe,CAACM,YAAoB,EAAEC,GAA2B,EAAE;QAClFA,GAAe;IAApB,IAAI,CAACA,CAAAA,CAAAA,GAAe,GAAfA,GAAG,CAACC,WAAW,SAAiB,GAAhCD,KAAAA,CAAgC,GAAhCA,GAAe,CAAEE,eAAe,CAAA,EAAE;QACrCL,KAAK,CAAC,mEAAmE,CAAC,CAAC;QAC3E,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAMM,GAAG,GAAG,IAAIC,GAAG,CAAC,gBAAgB,EAAEL,YAAY,CAAC,AAAC;IACpDI,GAAG,CAACE,YAAY,CAACC,GAAG,CAAC,OAAO,EAAEN,GAAG,CAACO,WAAW,CAAC,CAAC;IAC/CJ,GAAG,CAACE,YAAY,CAACC,GAAG,CAAC,QAAQ,EAAEN,GAAG,CAACC,WAAW,CAACC,eAAe,CAAC,CAAC;IAChEC,GAAG,CAACE,YAAY,CAACC,GAAG,CAAC,QAAQ,EAAEN,GAAG,CAACQ,EAAE,CAAC,CAAC;IAEvC,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAACP,GAAG,EAAE;QAAEQ,MAAM,EAAE,MAAM;KAAE,CAAC,AAAC;IACtD,IAAI,CAACF,QAAQ,CAACG,EAAE,EAAE;QAChBf,KAAK,CAAC,0DAA0D,EAAEY,QAAQ,CAACI,MAAM,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K;QACvB,IAAIA,GAAG,CAACO,WAAW,KAAK,WAAW,EAAE;gBAClBP,GAAe;YAAhC,MAAMuC,QAAQ,GAAGvC,CAAAA,CAAAA,GAAe,GAAfA,GAAG,CAACC,WAAW,SAAiB,GAAhCD,KAAAA,CAAgC,GAAhCA,GAAe,CAAEE,eAAe,CAAA,IAAIF,GAAG,CAACQ,EAAE,CAACgC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,AAAC;YAC1ExC,GAAG,CAACO,WAAW,GAAG+B,eAAe,CAACC,QAAQ,CAAC,IAAIvC,GAAG,CAACO,WAAW,CAAC;QACjE,CAAC;QACD,OAAOP,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/build/src/utils/env.js
CHANGED
|
@@ -136,9 +136,6 @@ class Env {
|
|
|
136
136
|
/** Disable Environment Variable injection in client bundles. */ get EXPO_NO_CLIENT_ENV_VARS() {
|
|
137
137
|
return (0, _getenv().boolish)("EXPO_NO_CLIENT_ENV_VARS", false);
|
|
138
138
|
}
|
|
139
|
-
/** Enable the React Native JS Inspector, instead of the "classic" Chrome DevTools (SDK <=49) */ get EXPO_USE_UNSTABLE_DEBUGGER() {
|
|
140
|
-
return (0, _getenv().boolish)("EXPO_USE_UNSTABLE_DEBUGGER", false);
|
|
141
|
-
}
|
|
142
139
|
/** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */ get EXPO_ADB_USER() {
|
|
143
140
|
return (0, _getenv().string)("EXPO_ADB_USER", "0");
|
|
144
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { boolish, int, string } from 'getenv';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Disable all network requests */\n get EXPO_OFFLINE() {\n return boolish('EXPO_OFFLINE', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** Disable detaching telemetry to separate process */\n get EXPO_NO_TELEMETRY_DETACH() {\n return boolish('EXPO_NO_TELEMETRY_DETACH', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n return string('EXPO_UNIVERSE_DIR', '');\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', false);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', false);\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Disable the app select redirect page. */\n get EXPO_NO_REDIRECT_PAGE() {\n return boolish('EXPO_NO_REDIRECT_PAGE', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN', '');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n\n /** Higher priority `$EDIOTR` variable for indicating which editor to use when pressing `o` in the Terminal UI. */\n get EXPO_EDITOR(): string {\n return string('EXPO_EDITOR', '');\n }\n\n /**\n * Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.\n * This is useful for browser editors that require custom proxy URLs.\n */\n get EXPO_PACKAGER_PROXY_URL(): string {\n return string('EXPO_PACKAGER_PROXY_URL', '');\n }\n\n /**\n * **Experimental** - Disable using `exp.direct` as the hostname for\n * `--tunnel` connections. This enables **https://** forwarding which\n * can be used to test universal links on iOS.\n *\n * This may cause issues with `expo-linking` and Expo Go.\n *\n * Select the exact subdomain by passing a string value that is not one of: `true`, `false`, `1`, `0`.\n */\n get EXPO_TUNNEL_SUBDOMAIN(): string | boolean {\n const subdomain = string('EXPO_TUNNEL_SUBDOMAIN', '');\n if (['0', 'false', ''].includes(subdomain)) {\n return false;\n } else if (['1', 'true'].includes(subdomain)) {\n return true;\n }\n return subdomain;\n }\n\n /**\n * Force Expo CLI to use the [`resolver.resolverMainFields`](https://facebook.github.io/metro/docs/configuration/#resolvermainfields) from the project `metro.config.js` for all platforms.\n *\n * By default, Expo CLI will use `['browser', 'module', 'main']` (default for Webpack) for web and the user-defined main fields for other platforms.\n */\n get EXPO_METRO_NO_MAIN_FIELD_OVERRIDE(): boolean {\n return boolish('EXPO_METRO_NO_MAIN_FIELD_OVERRIDE', false);\n }\n\n /**\n * HTTP/HTTPS proxy to connect to for network requests. Configures [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).\n */\n get HTTP_PROXY(): string {\n return process.env.HTTP_PROXY || process.env.http_proxy || '';\n }\n\n /**\n * Use the network inspector by overriding the metro inspector proxy with a custom version.\n * @deprecated This has been replaced by `@react-native/dev-middleware` and is now unused.\n */\n get EXPO_NO_INSPECTOR_PROXY(): boolean {\n return boolish('EXPO_NO_INSPECTOR_PROXY', false);\n }\n\n /** Disable lazy bundling in Metro bundler. */\n get EXPO_NO_METRO_LAZY() {\n return boolish('EXPO_NO_METRO_LAZY', false);\n }\n\n /** Enable the unstable inverse dependency stack trace for Metro bundling errors. */\n get EXPO_METRO_UNSTABLE_ERRORS() {\n return boolish('EXPO_METRO_UNSTABLE_ERRORS', false);\n }\n\n /** Enable the unstable fast resolver for Metro. */\n get EXPO_USE_FAST_RESOLVER() {\n return boolish('EXPO_USE_FAST_RESOLVER', false);\n }\n\n /** Disable Environment Variable injection in client bundles. */\n get EXPO_NO_CLIENT_ENV_VARS(): boolean {\n return boolish('EXPO_NO_CLIENT_ENV_VARS', false);\n }\n\n /** Enable the React Native JS Inspector, instead of the \"classic\" Chrome DevTools (SDK <=49) */\n get EXPO_USE_UNSTABLE_DEBUGGER(): boolean {\n return boolish('EXPO_USE_UNSTABLE_DEBUGGER', false);\n }\n\n /** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */\n get EXPO_ADB_USER(): string {\n return string('EXPO_ADB_USER', '0');\n }\n\n /** Used internally to enable E2E utilities. This behavior is not stable to external users. */\n get __EXPO_E2E_TEST(): boolean {\n return boolish('__EXPO_E2E_TEST', false);\n }\n\n /** Unstable: Force single-bundle exports in production. */\n get EXPO_NO_BUNDLE_SPLITTING(): boolean {\n return boolish('EXPO_NO_BUNDLE_SPLITTING', false);\n }\n\n /** Enable unstable/experimental Atlas to gather bundle information during development or export */\n get EXPO_UNSTABLE_ATLAS() {\n return boolish('EXPO_UNSTABLE_ATLAS', false);\n }\n\n /** Unstable: Enable tree shaking for Metro. */\n get EXPO_UNSTABLE_TREE_SHAKING() {\n return boolish('EXPO_UNSTABLE_TREE_SHAKING', false);\n }\n\n /** Unstable: Enable eager bundling where transformation runs uncached after the entire bundle has been created. This is required for production tree shaking and less optimized for development bundling. */\n get EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH() {\n return boolish('EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH', false);\n }\n\n /** Enable the use of Expo's custom metro require implementation. The custom require supports better debugging, tree shaking, and React Server Components. */\n get EXPO_USE_METRO_REQUIRE() {\n return boolish('EXPO_USE_METRO_REQUIRE', false);\n }\n\n /** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */\n get __EXPO_EAGER_BUNDLE_OPTIONS() {\n return string('__EXPO_EAGER_BUNDLE_OPTIONS', '');\n }\n\n /** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */\n get EXPO_NO_DEPLOY(): boolean {\n return boolish('EXPO_NO_DEPLOY', false);\n }\n\n /** Enable hydration during development when rendering Expo Web */\n get EXPO_WEB_DEV_HYDRATE(): boolean {\n return boolish('EXPO_WEB_DEV_HYDRATE', false);\n }\n}\n\nexport const env = new Env();\n"],"names":["env","Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_OFFLINE","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_NO_TELEMETRY_DETACH","EXPO_UNIVERSE_DIR","string","WEB_HOST","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_NO_REDIRECT_PAGE","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","EXPO_PUBLIC_FOLDER","EXPO_EDITOR","EXPO_PACKAGER_PROXY_URL","EXPO_TUNNEL_SUBDOMAIN","subdomain","includes","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","HTTP_PROXY","process","http_proxy","EXPO_NO_INSPECTOR_PROXY","EXPO_NO_METRO_LAZY","EXP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EAAE,KAAK,CAAC,CAAC;IACtD;IAEA,2MAA2M,OACvMyC,kCAAkC,GAAG;QACvC,OAAOzC,IAAAA,OAAO,EAAA,QAAA,EAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;IAC9D;IAEA,2JAA2J,OACvJ0C,sBAAsB,GAAG;QAC3B,OAAO1C,IAAAA,OAAO,EAAA,QAAA,EAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAClD;IAEA,uHAAuH,OACnH2C,2BAA2B,GAAG;QAChC,OAAOjC,IAAAA,OAAM,EAAA,OAAA,EAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;IACnD;IAEA,yKAAyK,OACrKkC,cAAc,GAAY;QAC5B,OAAO5C,IAAAA,OAAO,EAAA,QAAA,EAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;IAC1C;IAEA,gEAAgE,OAC5D6C,oBAAoB,GAAY;QAClC,OAAO7C,IAAAA,OAAO,EAAA,QAAA,EAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;IAChD;CACD;AAEM,MAAMH,GAAG,GAAG,IAAIC,GAAG,EAAE,AAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { boolish, int, string } from 'getenv';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Disable all network requests */\n get EXPO_OFFLINE() {\n return boolish('EXPO_OFFLINE', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** Disable detaching telemetry to separate process */\n get EXPO_NO_TELEMETRY_DETACH() {\n return boolish('EXPO_NO_TELEMETRY_DETACH', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n return string('EXPO_UNIVERSE_DIR', '');\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', false);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', false);\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Disable the app select redirect page. */\n get EXPO_NO_REDIRECT_PAGE() {\n return boolish('EXPO_NO_REDIRECT_PAGE', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN', '');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n\n /** Higher priority `$EDIOTR` variable for indicating which editor to use when pressing `o` in the Terminal UI. */\n get EXPO_EDITOR(): string {\n return string('EXPO_EDITOR', '');\n }\n\n /**\n * Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.\n * This is useful for browser editors that require custom proxy URLs.\n */\n get EXPO_PACKAGER_PROXY_URL(): string {\n return string('EXPO_PACKAGER_PROXY_URL', '');\n }\n\n /**\n * **Experimental** - Disable using `exp.direct` as the hostname for\n * `--tunnel` connections. This enables **https://** forwarding which\n * can be used to test universal links on iOS.\n *\n * This may cause issues with `expo-linking` and Expo Go.\n *\n * Select the exact subdomain by passing a string value that is not one of: `true`, `false`, `1`, `0`.\n */\n get EXPO_TUNNEL_SUBDOMAIN(): string | boolean {\n const subdomain = string('EXPO_TUNNEL_SUBDOMAIN', '');\n if (['0', 'false', ''].includes(subdomain)) {\n return false;\n } else if (['1', 'true'].includes(subdomain)) {\n return true;\n }\n return subdomain;\n }\n\n /**\n * Force Expo CLI to use the [`resolver.resolverMainFields`](https://facebook.github.io/metro/docs/configuration/#resolvermainfields) from the project `metro.config.js` for all platforms.\n *\n * By default, Expo CLI will use `['browser', 'module', 'main']` (default for Webpack) for web and the user-defined main fields for other platforms.\n */\n get EXPO_METRO_NO_MAIN_FIELD_OVERRIDE(): boolean {\n return boolish('EXPO_METRO_NO_MAIN_FIELD_OVERRIDE', false);\n }\n\n /**\n * HTTP/HTTPS proxy to connect to for network requests. Configures [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).\n */\n get HTTP_PROXY(): string {\n return process.env.HTTP_PROXY || process.env.http_proxy || '';\n }\n\n /**\n * Use the network inspector by overriding the metro inspector proxy with a custom version.\n * @deprecated This has been replaced by `@react-native/dev-middleware` and is now unused.\n */\n get EXPO_NO_INSPECTOR_PROXY(): boolean {\n return boolish('EXPO_NO_INSPECTOR_PROXY', false);\n }\n\n /** Disable lazy bundling in Metro bundler. */\n get EXPO_NO_METRO_LAZY() {\n return boolish('EXPO_NO_METRO_LAZY', false);\n }\n\n /** Enable the unstable inverse dependency stack trace for Metro bundling errors. */\n get EXPO_METRO_UNSTABLE_ERRORS() {\n return boolish('EXPO_METRO_UNSTABLE_ERRORS', false);\n }\n\n /** Enable the unstable fast resolver for Metro. */\n get EXPO_USE_FAST_RESOLVER() {\n return boolish('EXPO_USE_FAST_RESOLVER', false);\n }\n\n /** Disable Environment Variable injection in client bundles. */\n get EXPO_NO_CLIENT_ENV_VARS(): boolean {\n return boolish('EXPO_NO_CLIENT_ENV_VARS', false);\n }\n\n /** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */\n get EXPO_ADB_USER(): string {\n return string('EXPO_ADB_USER', '0');\n }\n\n /** Used internally to enable E2E utilities. This behavior is not stable to external users. */\n get __EXPO_E2E_TEST(): boolean {\n return boolish('__EXPO_E2E_TEST', false);\n }\n\n /** Unstable: Force single-bundle exports in production. */\n get EXPO_NO_BUNDLE_SPLITTING(): boolean {\n return boolish('EXPO_NO_BUNDLE_SPLITTING', false);\n }\n\n /** Enable unstable/experimental Atlas to gather bundle information during development or export */\n get EXPO_UNSTABLE_ATLAS() {\n return boolish('EXPO_UNSTABLE_ATLAS', false);\n }\n\n /** Unstable: Enable tree shaking for Metro. */\n get EXPO_UNSTABLE_TREE_SHAKING() {\n return boolish('EXPO_UNSTABLE_TREE_SHAKING', false);\n }\n\n /** Unstable: Enable eager bundling where transformation runs uncached after the entire bundle has been created. This is required for production tree shaking and less optimized for development bundling. */\n get EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH() {\n return boolish('EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH', false);\n }\n\n /** Enable the use of Expo's custom metro require implementation. The custom require supports better debugging, tree shaking, and React Server Components. */\n get EXPO_USE_METRO_REQUIRE() {\n return boolish('EXPO_USE_METRO_REQUIRE', false);\n }\n\n /** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */\n get __EXPO_EAGER_BUNDLE_OPTIONS() {\n return string('__EXPO_EAGER_BUNDLE_OPTIONS', '');\n }\n\n /** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */\n get EXPO_NO_DEPLOY(): boolean {\n return boolish('EXPO_NO_DEPLOY', false);\n }\n\n /** Enable hydration during development when rendering Expo Web */\n get EXPO_WEB_DEV_HYDRATE(): boolean {\n return boolish('EXPO_WEB_DEV_HYDRATE', false);\n }\n}\n\nexport const env = new Env();\n"],"names":["env","Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_OFFLINE","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_NO_TELEMETRY_DETACH","EXPO_UNIVERSE_DIR","string","WEB_HOST","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_NO_REDIRECT_PAGE","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","EXPO_PUBLIC_FOLDER","EXPO_EDITOR","EXPO_PACKAGER_PROXY_URL","EXPO_TUNNEL_SUBDOMAIN","subdomain","includes","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","HTTP_PROXY","process","http_proxy","EXPO_NO_INSPECTOR_PROXY","EXPO_NO_METRO_LAZY","EXPO_METRO_UNSTABLE_ERRORS","EXPO_USE_FAST_RESOLVER","EXPO_NO_CLIENT_ENV_VARS","EXPO_ADB_USER","__EXPO_E2E_TEST","EXPO_NO_BUNDLE_SPLITTING","EXPO_UNSTABLE_ATLAS","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","EXPO_USE_METRO_REQUIRE","__EXPO_EAGER_BUNDLE_OPTIONS","EXPO_NO_DEPLOY","EXPO_WEB_DEV_HYDRATE"],"mappings":"AAAA;;;;+BA+NaA,KAAG;;aAAHA,GAAG;;;yBA/NqB,QAAQ;;;;;;AAE7C,mFAAmF;AAEnF,6CAA6C;AAE7C,MAAMC,GAAG;I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AAA,EAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;IAChD;CACD;AAEM,MAAMH,GAAG,GAAG,IAAIC,GAAG,EAAE,AAAC"}
|
|
@@ -31,7 +31,7 @@ class FetchClient {
|
|
|
31
31
|
this.headers = {
|
|
32
32
|
accept: "application/json",
|
|
33
33
|
"content-type": "application/json",
|
|
34
|
-
"user-agent": `expo-cli/${"0.19.
|
|
34
|
+
"user-agent": `expo-cli/${"0.19.2"}`,
|
|
35
35
|
authorization: "Basic " + _nodeBuffer().Buffer.from(`${target}:`).toString("base64")
|
|
36
36
|
};
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@expo/rudder-sdk-node": "^1.1.1",
|
|
56
56
|
"@expo/spawn-async": "^1.7.2",
|
|
57
57
|
"@expo/xcpretty": "^4.3.0",
|
|
58
|
-
"@react-native/dev-middleware": "0.76.0
|
|
58
|
+
"@react-native/dev-middleware": "0.76.0",
|
|
59
59
|
"@urql/core": "^2.3.6",
|
|
60
60
|
"@urql/exchange-retry": "0.3.0",
|
|
61
61
|
"accepts": "^1.3.8",
|
|
@@ -85,7 +85,6 @@
|
|
|
85
85
|
"minimatch": "^3.0.4",
|
|
86
86
|
"node-forge": "^1.3.1",
|
|
87
87
|
"npm-package-arg": "^11.0.0",
|
|
88
|
-
"open": "^8.3.0",
|
|
89
88
|
"ora": "^3.4.0",
|
|
90
89
|
"picomatch": "^3.0.1",
|
|
91
90
|
"pretty-bytes": "^5.6.0",
|
|
@@ -168,5 +167,5 @@
|
|
|
168
167
|
"tree-kill": "^1.2.2",
|
|
169
168
|
"tsd": "^0.28.1"
|
|
170
169
|
},
|
|
171
|
-
"gitHead": "
|
|
170
|
+
"gitHead": "2e4f18d41da033c5ced0a4a045d91cf5250016b7"
|
|
172
171
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "PageReloadHandler", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>PageReloadHandler
|
|
8
|
-
});
|
|
9
|
-
const _messageHandler = require("../MessageHandler");
|
|
10
|
-
class PageReloadHandler extends _messageHandler.MessageHandler {
|
|
11
|
-
constructor(connection, metroBundler){
|
|
12
|
-
super(connection);
|
|
13
|
-
this.metroBundler = metroBundler;
|
|
14
|
-
}
|
|
15
|
-
handleDebuggerMessage(message) {
|
|
16
|
-
if (message.method === "Page.reload") {
|
|
17
|
-
this.metroBundler.broadcastMessage("reload");
|
|
18
|
-
return this.sendToDebugger({
|
|
19
|
-
id: message.id
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=PageReload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/debugging/messageHandlers/PageReload.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport type { MetroBundlerDevServer } from '../../MetroBundlerDevServer';\nimport { MessageHandler } from '../MessageHandler';\nimport type { CdpMessage, Connection, DebuggerRequest } from '../types';\n\nexport class PageReloadHandler extends MessageHandler {\n private metroBundler: Pick<MetroBundlerDevServer, 'broadcastMessage'>;\n\n constructor(\n connection: Connection,\n metroBundler: Pick<MetroBundlerDevServer, 'broadcastMessage'>\n ) {\n super(connection);\n this.metroBundler = metroBundler;\n }\n\n handleDebuggerMessage(message: DebuggerRequest<PageReload>) {\n if (message.method === 'Page.reload') {\n this.metroBundler.broadcastMessage('reload');\n return this.sendToDebugger({ id: message.id });\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/1-2/Page/#method-reload */\nexport type PageReload = CdpMessage<'Page.reload', Protocol.Page.ReloadRequest, never>;\n"],"names":["PageReloadHandler","MessageHandler","constructor","connection","metroBundler","handleDebuggerMessage","message","method","broadcastMessage","sendToDebugger","id"],"mappings":"AAAA;;;;+BAMaA,mBAAiB;;aAAjBA,iBAAiB;;gCAHC,mBAAmB;AAG3C,MAAMA,iBAAiB,SAASC,eAAc,eAAA;IAGnDC,YACEC,UAAsB,EACtBC,YAA6D,CAC7D;QACA,KAAK,CAACD,UAAU,CAAC,CAAC;QAClB,IAAI,CAACC,YAAY,GAAGA,YAAY,CAAC;IACnC;IAEAC,qBAAqB,CAACC,OAAoC,EAAE;QAC1D,IAAIA,OAAO,CAACC,MAAM,KAAK,aAAa,EAAE;YACpC,IAAI,CAACH,YAAY,CAACI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC7C,OAAO,IAAI,CAACC,cAAc,CAAC;gBAAEC,EAAE,EAAEJ,OAAO,CAACI,EAAE;aAAE,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,KAAK,CAAC;IACf;CACD"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
createLaunchBrowser: ()=>createLaunchBrowser,
|
|
13
|
-
findSupportedBrowserTypeAsync: ()=>findSupportedBrowserTypeAsync,
|
|
14
|
-
launchInspectorBrowserAsync: ()=>launchInspectorBrowserAsync
|
|
15
|
-
});
|
|
16
|
-
function _os() {
|
|
17
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("os"));
|
|
18
|
-
_os = function() {
|
|
19
|
-
return data;
|
|
20
|
-
};
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
const _launchBrowserTypes = require("./LaunchBrowser.types");
|
|
24
|
-
const _launchBrowserImplLinux = /*#__PURE__*/ _interopRequireDefault(require("./LaunchBrowserImplLinux"));
|
|
25
|
-
const _launchBrowserImplMacOS = /*#__PURE__*/ _interopRequireDefault(require("./LaunchBrowserImplMacOS"));
|
|
26
|
-
const _launchBrowserImplWindows = /*#__PURE__*/ _interopRequireDefault(require("./LaunchBrowserImplWindows"));
|
|
27
|
-
function _interopRequireDefault(obj) {
|
|
28
|
-
return obj && obj.__esModule ? obj : {
|
|
29
|
-
default: obj
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
const IS_WSL = require("is-wsl") && !require("is-docker")();
|
|
33
|
-
function createLaunchBrowser() {
|
|
34
|
-
let launchBrowser;
|
|
35
|
-
if (_os().default.platform() === "darwin") {
|
|
36
|
-
launchBrowser = new _launchBrowserImplMacOS.default();
|
|
37
|
-
} else if (_os().default.platform() === "win32" || IS_WSL) {
|
|
38
|
-
launchBrowser = new _launchBrowserImplWindows.default();
|
|
39
|
-
} else if (_os().default.platform() === "linux") {
|
|
40
|
-
launchBrowser = new _launchBrowserImplLinux.default();
|
|
41
|
-
} else {
|
|
42
|
-
throw new Error("[createLaunchBrowser] Unsupported host platform");
|
|
43
|
-
}
|
|
44
|
-
return launchBrowser;
|
|
45
|
-
}
|
|
46
|
-
async function findSupportedBrowserTypeAsync(launchBrowser) {
|
|
47
|
-
const supportedBrowsers = Object.values(_launchBrowserTypes.LaunchBrowserTypesEnum);
|
|
48
|
-
for (const browserType of supportedBrowsers){
|
|
49
|
-
if (await launchBrowser.isSupportedBrowser(browserType)) {
|
|
50
|
-
return browserType;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
throw new Error(`[findSupportedBrowserTypeAsync] Unable to find a browser on the host to open the inspector. Supported browsers: ${supportedBrowsers.join(", ")}`);
|
|
54
|
-
}
|
|
55
|
-
async function launchInspectorBrowserAsync(url, browser, browserType) {
|
|
56
|
-
const launchBrowser = browser ?? createLaunchBrowser();
|
|
57
|
-
const launchBrowserType = browserType ?? await findSupportedBrowserTypeAsync(launchBrowser);
|
|
58
|
-
const tempBrowserDir = await launchBrowser.createTempBrowserDir("expo-inspector");
|
|
59
|
-
// For dev-client connecting metro in LAN, the request to fetch sourcemaps may be blocked by Chromium
|
|
60
|
-
// with insecure-content (https page send xhr for http resource).
|
|
61
|
-
// Adding `--allow-running-insecure-content` to overcome this limitation
|
|
62
|
-
// without users manually allow insecure-content in site settings.
|
|
63
|
-
// However, if there is existing chromium browser process, the argument will not take effect.
|
|
64
|
-
// We also pass a `--user-data-dir=` as temporary profile and force chromium to create new browser process.
|
|
65
|
-
const launchArgs = [
|
|
66
|
-
`--app=${url}`,
|
|
67
|
-
"--allow-running-insecure-content",
|
|
68
|
-
`--user-data-dir=${tempBrowserDir}`,
|
|
69
|
-
"--no-first-run",
|
|
70
|
-
"--no-default-browser-check",
|
|
71
|
-
];
|
|
72
|
-
return launchBrowser.launchAsync(launchBrowserType, launchArgs);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
//# sourceMappingURL=LaunchBrowser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/middleware/inspector/LaunchBrowser.ts"],"sourcesContent":["import os from 'os';\n\nimport {\n LaunchBrowserTypesEnum,\n type LaunchBrowser,\n type LaunchBrowserInstance,\n type LaunchBrowserTypes,\n} from './LaunchBrowser.types';\nimport LaunchBrowserImplLinux from './LaunchBrowserImplLinux';\nimport LaunchBrowserImplMacOS from './LaunchBrowserImplMacOS';\nimport LaunchBrowserImplWindows from './LaunchBrowserImplWindows';\n\nexport type { LaunchBrowserInstance };\n\nconst IS_WSL = require('is-wsl') && !require('is-docker')();\n\n/**\n * A factory to create a LaunchBrowser instance based on the host platform\n */\nexport function createLaunchBrowser(): LaunchBrowser {\n let launchBrowser: LaunchBrowser;\n if (os.platform() === 'darwin') {\n launchBrowser = new LaunchBrowserImplMacOS();\n } else if (os.platform() === 'win32' || IS_WSL) {\n launchBrowser = new LaunchBrowserImplWindows();\n } else if (os.platform() === 'linux') {\n launchBrowser = new LaunchBrowserImplLinux();\n } else {\n throw new Error('[createLaunchBrowser] Unsupported host platform');\n }\n return launchBrowser;\n}\n\n/**\n * Find a supported browser type on the host\n */\nexport async function findSupportedBrowserTypeAsync(\n launchBrowser: LaunchBrowser\n): Promise<LaunchBrowserTypes> {\n const supportedBrowsers = Object.values(LaunchBrowserTypesEnum);\n for (const browserType of supportedBrowsers) {\n if (await launchBrowser.isSupportedBrowser(browserType)) {\n return browserType;\n }\n }\n\n throw new Error(\n `[findSupportedBrowserTypeAsync] Unable to find a browser on the host to open the inspector. Supported browsers: ${supportedBrowsers.join(\n ', '\n )}`\n );\n}\n\n/**\n * Launch a browser for inspector\n */\nexport async function launchInspectorBrowserAsync(\n url: string,\n browser?: LaunchBrowser,\n browserType?: LaunchBrowserTypes\n): Promise<LaunchBrowserInstance> {\n const launchBrowser = browser ?? createLaunchBrowser();\n const launchBrowserType = browserType ?? (await findSupportedBrowserTypeAsync(launchBrowser));\n\n const tempBrowserDir = await launchBrowser.createTempBrowserDir('expo-inspector');\n\n // For dev-client connecting metro in LAN, the request to fetch sourcemaps may be blocked by Chromium\n // with insecure-content (https page send xhr for http resource).\n // Adding `--allow-running-insecure-content` to overcome this limitation\n // without users manually allow insecure-content in site settings.\n // However, if there is existing chromium browser process, the argument will not take effect.\n // We also pass a `--user-data-dir=` as temporary profile and force chromium to create new browser process.\n const launchArgs = [\n `--app=${url}`,\n '--allow-running-insecure-content',\n `--user-data-dir=${tempBrowserDir}`,\n '--no-first-run',\n '--no-default-browser-check',\n ];\n\n return launchBrowser.launchAsync(launchBrowserType, launchArgs);\n}\n"],"names":["createLaunchBrowser","findSupportedBrowserTypeAsync","launchInspectorBrowserAsync","IS_WSL","require","launchBrowser","os","platform","LaunchBrowserImplMacOS","LaunchBrowserImplWindows","LaunchBrowserImplLinux","Error","supportedBrowsers","Object","values","LaunchBrowserTypesEnum","browserType","isSupportedBrowser","join","url","browser","launchBrowserType","tempBrowserDir","createTempBrowserDir","launchArgs","launchAsync"],"mappings":"AAAA;;;;;;;;;;;IAmBgBA,mBAAmB,MAAnBA,mBAAmB;IAiBbC,6BAA6B,MAA7BA,6BAA6B;IAoB7BC,2BAA2B,MAA3BA,2BAA2B;;;8DAxDlC,IAAI;;;;;;oCAOZ,uBAAuB;6EACK,0BAA0B;6EAC1B,0BAA0B;+EACxB,4BAA4B;;;;;;AAIjE,MAAMC,MAAM,GAAGC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAACA,OAAO,CAAC,WAAW,CAAC,EAAE,AAAC;AAKrD,SAASJ,mBAAmB,GAAkB;IACnD,IAAIK,aAAa,AAAe,AAAC;IACjC,IAAIC,GAAE,EAAA,QAAA,CAACC,QAAQ,EAAE,KAAK,QAAQ,EAAE;QAC9BF,aAAa,GAAG,IAAIG,uBAAsB,QAAA,EAAE,CAAC;IAC/C,OAAO,IAAIF,GAAE,EAAA,QAAA,CAACC,QAAQ,EAAE,KAAK,OAAO,IAAIJ,MAAM,EAAE;QAC9CE,aAAa,GAAG,IAAII,yBAAwB,QAAA,EAAE,CAAC;IACjD,OAAO,IAAIH,GAAE,EAAA,QAAA,CAACC,QAAQ,EAAE,KAAK,OAAO,EAAE;QACpCF,aAAa,GAAG,IAAIK,uBAAsB,QAAA,EAAE,CAAC;IAC/C,OAAO;QACL,MAAM,IAAIC,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,OAAON,aAAa,CAAC;AACvB,CAAC;AAKM,eAAeJ,6BAA6B,CACjDI,aAA4B,EACC;IAC7B,MAAMO,iBAAiB,GAAGC,MAAM,CAACC,MAAM,CAACC,mBAAsB,uBAAA,CAAC,AAAC;IAChE,KAAK,MAAMC,WAAW,IAAIJ,iBAAiB,CAAE;QAC3C,IAAI,MAAMP,aAAa,CAACY,kBAAkB,CAACD,WAAW,CAAC,EAAE;YACvD,OAAOA,WAAW,CAAC;QACrB,CAAC;IACH,CAAC;IAED,MAAM,IAAIL,KAAK,CACb,CAAC,gHAAgH,EAAEC,iBAAiB,CAACM,IAAI,CACvI,IAAI,CACL,CAAC,CAAC,CACJ,CAAC;AACJ,CAAC;AAKM,eAAehB,2BAA2B,CAC/CiB,GAAW,EACXC,OAAuB,EACvBJ,WAAgC,EACA;IAChC,MAAMX,aAAa,GAAGe,OAAO,IAAIpB,mBAAmB,EAAE,AAAC;IACvD,MAAMqB,iBAAiB,GAAGL,WAAW,IAAK,MAAMf,6BAA6B,CAACI,aAAa,CAAC,AAAC,AAAC;IAE9F,MAAMiB,cAAc,GAAG,MAAMjB,aAAa,CAACkB,oBAAoB,CAAC,gBAAgB,CAAC,AAAC;IAElF,qGAAqG;IACrG,iEAAiE;IACjE,wEAAwE;IACxE,kEAAkE;IAClE,6FAA6F;IAC7F,2GAA2G;IAC3G,MAAMC,UAAU,GAAG;QACjB,CAAC,MAAM,EAAEL,GAAG,CAAC,CAAC;QACd,kCAAkC;QAClC,CAAC,gBAAgB,EAAEG,cAAc,CAAC,CAAC;QACnC,gBAAgB;QAChB,4BAA4B;KAC7B,AAAC;IAEF,OAAOjB,aAAa,CAACoB,WAAW,CAACJ,iBAAiB,EAAEG,UAAU,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "LaunchBrowserTypesEnum", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>LaunchBrowserTypesEnum
|
|
8
|
-
});
|
|
9
|
-
const LaunchBrowserTypesEnum = {
|
|
10
|
-
CHROME: "Google Chrome",
|
|
11
|
-
EDGE: "Microsoft Edge",
|
|
12
|
-
BRAVE: "Brave"
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=LaunchBrowser.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/middleware/inspector/LaunchBrowser.types.ts"],"sourcesContent":["export interface LaunchBrowserInstance {\n close: () => Promise<void>;\n}\n\n/**\n * Supported browser types enum\n */\nexport const LaunchBrowserTypesEnum = {\n CHROME: 'Google Chrome',\n EDGE: 'Microsoft Edge',\n BRAVE: 'Brave',\n} as const;\n\n/**\n * Supported browser types\n */\nexport type LaunchBrowserTypes =\n (typeof LaunchBrowserTypesEnum)[keyof typeof LaunchBrowserTypesEnum];\n\n/**\n * A browser launcher\n */\nexport interface LaunchBrowser {\n /**\n * Return whether the given `browserType` is supported\n */\n isSupportedBrowser: (browserType: LaunchBrowserTypes) => Promise<boolean>;\n\n /**\n * Create temp directory for browser profile\n *\n * @param baseDirName The base directory name for the created directory\n */\n createTempBrowserDir: (baseDirName: string) => Promise<string>;\n\n /**\n * Launch the browser\n */\n launchAsync: (browserType: LaunchBrowserTypes, args: string[]) => Promise<LaunchBrowserInstance>;\n\n /**\n * Close current browser instance\n */\n close: () => Promise<void>;\n}\n"],"names":["LaunchBrowserTypesEnum","CHROME","EDGE","BRAVE"],"mappings":"AAAA;;;;+BAOaA,wBAAsB;;aAAtBA,sBAAsB;;AAA5B,MAAMA,sBAAsB,GAAG;IACpCC,MAAM,EAAE,eAAe;IACvBC,IAAI,EAAE,gBAAgB;IACtBC,KAAK,EAAE,OAAO;CACf,AAAS,AAAC"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, /**
|
|
6
|
-
* Browser implementation for Linux
|
|
7
|
-
*/ "default", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: ()=>LaunchBrowserImplLinux
|
|
10
|
-
});
|
|
11
|
-
function _spawnAsync() {
|
|
12
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("@expo/spawn-async"));
|
|
13
|
-
_spawnAsync = function() {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
function _open() {
|
|
19
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("open"));
|
|
20
|
-
_open = function() {
|
|
21
|
-
return data;
|
|
22
|
-
};
|
|
23
|
-
return data;
|
|
24
|
-
}
|
|
25
|
-
function _path() {
|
|
26
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
27
|
-
_path = function() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
|
-
const _launchBrowserTypes = require("./LaunchBrowser.types");
|
|
33
|
-
function _interopRequireDefault(obj) {
|
|
34
|
-
return obj && obj.__esModule ? obj : {
|
|
35
|
-
default: obj
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
class LaunchBrowserImplLinux {
|
|
39
|
-
MAP = {
|
|
40
|
-
[_launchBrowserTypes.LaunchBrowserTypesEnum.CHROME]: [
|
|
41
|
-
"google-chrome",
|
|
42
|
-
"google-chrome-stable",
|
|
43
|
-
"chromium"
|
|
44
|
-
],
|
|
45
|
-
[_launchBrowserTypes.LaunchBrowserTypesEnum.EDGE]: [
|
|
46
|
-
"microsoft-edge",
|
|
47
|
-
"microsoft-edge-dev"
|
|
48
|
-
],
|
|
49
|
-
[_launchBrowserTypes.LaunchBrowserTypesEnum.BRAVE]: [
|
|
50
|
-
"brave"
|
|
51
|
-
]
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* On Linux, the supported appId is an array, this function finds the available appId and caches it
|
|
55
|
-
*/ async getAppId(browserType) {
|
|
56
|
-
if (this._appId == null || !this.MAP[browserType].includes(this._appId)) {
|
|
57
|
-
for (const appId of this.MAP[browserType]){
|
|
58
|
-
try {
|
|
59
|
-
const { status } = await (0, _spawnAsync().default)("which", [
|
|
60
|
-
appId
|
|
61
|
-
], {
|
|
62
|
-
stdio: "ignore"
|
|
63
|
-
});
|
|
64
|
-
if (status === 0) {
|
|
65
|
-
this._appId = appId;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
} catch {}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (this._appId == null) {
|
|
72
|
-
throw new Error(`Unable to find supported browser - tried[${this.MAP[browserType].join(", ")}]`);
|
|
73
|
-
}
|
|
74
|
-
return this._appId;
|
|
75
|
-
}
|
|
76
|
-
async isSupportedBrowser(browserType) {
|
|
77
|
-
let result = false;
|
|
78
|
-
try {
|
|
79
|
-
await this.getAppId(browserType);
|
|
80
|
-
result = true;
|
|
81
|
-
} catch {
|
|
82
|
-
result = false;
|
|
83
|
-
}
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
async createTempBrowserDir(baseDirName) {
|
|
87
|
-
return _path().default.join(require("temp-dir"), baseDirName);
|
|
88
|
-
}
|
|
89
|
-
async launchAsync(browserType, args) {
|
|
90
|
-
const appId = await this.getAppId(browserType);
|
|
91
|
-
this._process = await _open().default.openApp(appId, {
|
|
92
|
-
arguments: args
|
|
93
|
-
});
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
async close() {
|
|
97
|
-
var ref;
|
|
98
|
-
(ref = this._process) == null ? void 0 : ref.kill();
|
|
99
|
-
this._process = undefined;
|
|
100
|
-
this._appId = undefined;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
//# sourceMappingURL=LaunchBrowserImplLinux.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/middleware/inspector/LaunchBrowserImplLinux.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport { type ChildProcess } from 'child_process';\nimport open from 'open';\nimport path from 'path';\n\nimport {\n LaunchBrowserTypes,\n type LaunchBrowser,\n type LaunchBrowserInstance,\n LaunchBrowserTypesEnum,\n} from './LaunchBrowser.types';\n\n/**\n * Browser implementation for Linux\n */\nexport default class LaunchBrowserImplLinux implements LaunchBrowser, LaunchBrowserInstance {\n private _appId: string | undefined;\n private _process: ChildProcess | undefined;\n\n MAP = {\n [LaunchBrowserTypesEnum.CHROME]: ['google-chrome', 'google-chrome-stable', 'chromium'],\n [LaunchBrowserTypesEnum.EDGE]: ['microsoft-edge', 'microsoft-edge-dev'],\n [LaunchBrowserTypesEnum.BRAVE]: ['brave'],\n };\n\n /**\n * On Linux, the supported appId is an array, this function finds the available appId and caches it\n */\n private async getAppId(browserType: LaunchBrowserTypes): Promise<string> {\n if (this._appId == null || !this.MAP[browserType].includes(this._appId)) {\n for (const appId of this.MAP[browserType]) {\n try {\n const { status } = await spawnAsync('which', [appId], { stdio: 'ignore' });\n if (status === 0) {\n this._appId = appId;\n break;\n }\n } catch {}\n }\n }\n\n if (this._appId == null) {\n throw new Error(\n `Unable to find supported browser - tried[${this.MAP[browserType].join(', ')}]`\n );\n }\n\n return this._appId;\n }\n\n async isSupportedBrowser(browserType: LaunchBrowserTypes): Promise<boolean> {\n let result = false;\n try {\n await this.getAppId(browserType);\n result = true;\n } catch {\n result = false;\n }\n return result;\n }\n\n async createTempBrowserDir(baseDirName: string) {\n return path.join(require('temp-dir'), baseDirName);\n }\n\n async launchAsync(\n browserType: LaunchBrowserTypes,\n args: string[]\n ): Promise<LaunchBrowserInstance> {\n const appId = await this.getAppId(browserType);\n this._process = await open.openApp(appId, { arguments: args });\n return this;\n }\n\n async close(): Promise<void> {\n this._process?.kill();\n this._process = undefined;\n this._appId = undefined;\n }\n}\n"],"names":["LaunchBrowserImplLinux","MAP","LaunchBrowserTypesEnum","CHROME","EDGE","BRAVE","getAppId","browserType","_appId","includes","appId","status","spawnAsync","stdio","Error","join","isSupportedBrowser","result","createTempBrowserDir","baseDirName","path","require","launchAsync","args","_process","open","openApp","arguments","close","kill","undefined"],"mappings":"AAAA;;;;+BAYA;;CAEC,GACD,SAgEC;;aAhEoBA,sBAAsB;;;8DAfpB,mBAAmB;;;;;;;8DAEzB,MAAM;;;;;;;8DACN,MAAM;;;;;;oCAOhB,uBAAuB;;;;;;AAKf,MAAMA,sBAAsB;IAIzCC,GAAG,GAAG;QACJ,CAACC,mBAAsB,uBAAA,CAACC,MAAM,CAAC,EAAE;YAAC,eAAe;YAAE,sBAAsB;YAAE,UAAU;SAAC;QACtF,CAACD,mBAAsB,uBAAA,CAACE,IAAI,CAAC,EAAE;YAAC,gBAAgB;YAAE,oBAAoB;SAAC;QACvE,CAACF,mBAAsB,uBAAA,CAACG,KAAK,CAAC,EAAE;YAAC,OAAO;SAAC;KAC1C,CAAC;IAEF;;GAEC,SACaC,QAAQ,CAACC,WAA+B,EAAmB;QACvE,IAAI,IAAI,CAACC,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAACP,GAAG,CAACM,WAAW,CAAC,CAACE,QAAQ,CAAC,IAAI,CAACD,MAAM,CAAC,EAAE;YACvE,KAAK,MAAME,KAAK,IAAI,IAAI,CAACT,GAAG,CAACM,WAAW,CAAC,CAAE;gBACzC,IAAI;oBACF,MAAM,EAAEI,MAAM,CAAA,EAAE,GAAG,MAAMC,IAAAA,WAAU,EAAA,QAAA,EAAC,OAAO,EAAE;wBAACF,KAAK;qBAAC,EAAE;wBAAEG,KAAK,EAAE,QAAQ;qBAAE,CAAC,AAAC;oBAC3E,IAAIF,MAAM,KAAK,CAAC,EAAE;wBAChB,IAAI,CAACH,MAAM,GAAGE,KAAK,CAAC;wBACpB,MAAM;oBACR,CAAC;gBACH,EAAE,OAAM,CAAC,CAAC;YACZ,CAAC;QACH,CAAC;QAED,IAAI,IAAI,CAACF,MAAM,IAAI,IAAI,EAAE;YACvB,MAAM,IAAIM,KAAK,CACb,CAAC,yCAAyC,EAAE,IAAI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|
|
6
|
-
* Browser implementation for macOS
|
|
7
|
-
*/ "default", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: ()=>LaunchBrowserImplMacOS
|
|
10
|
-
});
|
|
11
|
-
function _osascript() {
|
|
12
|
-
const data = /*#__PURE__*/ _interopRequireWildcard(require("@expo/osascript"));
|
|
13
|
-
_osascript = function() {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
function _childProcess() {
|
|
19
|
-
const data = require("child_process");
|
|
20
|
-
_childProcess = function() {
|
|
21
|
-
return data;
|
|
22
|
-
};
|
|
23
|
-
return data;
|
|
24
|
-
}
|
|
25
|
-
function _glob() {
|
|
26
|
-
const data = require("glob");
|
|
27
|
-
_glob = function() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
|
-
function _path() {
|
|
33
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
34
|
-
_path = function() {
|
|
35
|
-
return data;
|
|
36
|
-
};
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
const _launchBrowserTypes = require("./LaunchBrowser.types");
|
|
40
|
-
function _interopRequireDefault(obj) {
|
|
41
|
-
return obj && obj.__esModule ? obj : {
|
|
42
|
-
default: obj
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
46
|
-
if (typeof WeakMap !== "function") return null;
|
|
47
|
-
var cacheBabelInterop = new WeakMap();
|
|
48
|
-
var cacheNodeInterop = new WeakMap();
|
|
49
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
50
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
51
|
-
})(nodeInterop);
|
|
52
|
-
}
|
|
53
|
-
function _interopRequireWildcard(obj, nodeInterop) {
|
|
54
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
55
|
-
return obj;
|
|
56
|
-
}
|
|
57
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
58
|
-
return {
|
|
59
|
-
default: obj
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
63
|
-
if (cache && cache.has(obj)) {
|
|
64
|
-
return cache.get(obj);
|
|
65
|
-
}
|
|
66
|
-
var newObj = {};
|
|
67
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
68
|
-
for(var key in obj){
|
|
69
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
70
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
71
|
-
if (desc && (desc.get || desc.set)) {
|
|
72
|
-
Object.defineProperty(newObj, key, desc);
|
|
73
|
-
} else {
|
|
74
|
-
newObj[key] = obj[key];
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
newObj.default = obj;
|
|
79
|
-
if (cache) {
|
|
80
|
-
cache.set(obj, newObj);
|
|
81
|
-
}
|
|
82
|
-
return newObj;
|
|
83
|
-
}
|
|
84
|
-
class LaunchBrowserImplMacOS {
|
|
85
|
-
MAP = {
|
|
86
|
-
[_launchBrowserTypes.LaunchBrowserTypesEnum.CHROME]: "google chrome",
|
|
87
|
-
[_launchBrowserTypes.LaunchBrowserTypesEnum.EDGE]: "microsoft edge",
|
|
88
|
-
[_launchBrowserTypes.LaunchBrowserTypesEnum.BRAVE]: "brave browser"
|
|
89
|
-
};
|
|
90
|
-
async isSupportedBrowser(browserType) {
|
|
91
|
-
let result = false;
|
|
92
|
-
try {
|
|
93
|
-
await _osascript().execAsync(`id of application "${this.MAP[browserType]}"`);
|
|
94
|
-
result = true;
|
|
95
|
-
} catch {
|
|
96
|
-
result = false;
|
|
97
|
-
}
|
|
98
|
-
return result;
|
|
99
|
-
}
|
|
100
|
-
async createTempBrowserDir(baseDirName) {
|
|
101
|
-
return _path().default.join(require("temp-dir"), baseDirName);
|
|
102
|
-
}
|
|
103
|
-
async launchAsync(browserType, args) {
|
|
104
|
-
var ref;
|
|
105
|
-
const appDirectory = await _osascript().execAsync(`POSIX path of (path to application "${this.MAP[browserType]}")`);
|
|
106
|
-
const appPath = (ref = (0, _glob().sync)("Contents/MacOS/*", {
|
|
107
|
-
cwd: appDirectory.trim(),
|
|
108
|
-
absolute: true
|
|
109
|
-
})) == null ? void 0 : ref[0];
|
|
110
|
-
if (!appPath) {
|
|
111
|
-
throw new Error(`Cannot find application path from ${appDirectory}Contents/MacOS`);
|
|
112
|
-
}
|
|
113
|
-
this._process = (0, _childProcess().spawn)(appPath, args, {
|
|
114
|
-
stdio: "ignore"
|
|
115
|
-
});
|
|
116
|
-
return this;
|
|
117
|
-
}
|
|
118
|
-
async close() {
|
|
119
|
-
var ref;
|
|
120
|
-
(ref = this._process) == null ? void 0 : ref.kill();
|
|
121
|
-
this._process = undefined;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
//# sourceMappingURL=LaunchBrowserImplMacOS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/middleware/inspector/LaunchBrowserImplMacOS.ts"],"sourcesContent":["import * as osascript from '@expo/osascript';\nimport { spawn, type ChildProcess } from 'child_process';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport {\n LaunchBrowserTypes,\n type LaunchBrowser,\n type LaunchBrowserInstance,\n LaunchBrowserTypesEnum,\n} from './LaunchBrowser.types';\n\n/**\n * Browser implementation for macOS\n */\nexport default class LaunchBrowserImplMacOS implements LaunchBrowser, LaunchBrowserInstance {\n private _process: ChildProcess | undefined;\n\n MAP = {\n [LaunchBrowserTypesEnum.CHROME]: 'google chrome',\n [LaunchBrowserTypesEnum.EDGE]: 'microsoft edge',\n [LaunchBrowserTypesEnum.BRAVE]: 'brave browser',\n };\n\n async isSupportedBrowser(browserType: LaunchBrowserTypes): Promise<boolean> {\n let result = false;\n try {\n await osascript.execAsync(`id of application \"${this.MAP[browserType]}\"`);\n result = true;\n } catch {\n result = false;\n }\n return result;\n }\n\n async createTempBrowserDir(baseDirName: string) {\n return path.join(require('temp-dir'), baseDirName);\n }\n\n async launchAsync(\n browserType: LaunchBrowserTypes,\n args: string[]\n ): Promise<LaunchBrowserInstance> {\n const appDirectory = await osascript.execAsync(\n `POSIX path of (path to application \"${this.MAP[browserType]}\")`\n );\n const appPath = globSync('Contents/MacOS/*', { cwd: appDirectory.trim(), absolute: true })?.[0];\n if (!appPath) {\n throw new Error(`Cannot find application path from ${appDirectory}Contents/MacOS`);\n }\n this._process = spawn(appPath, args, { stdio: 'ignore' });\n\n return this;\n }\n\n async close(): Promise<void> {\n this._process?.kill();\n this._process = undefined;\n }\n}\n"],"names":["LaunchBrowserImplMacOS","MAP","LaunchBrowserTypesEnum","CHROME","EDGE","BRAVE","isSupportedBrowser","browserType","result","osascript","execAsync","createTempBrowserDir","baseDirName","path","join","require","launchAsync","args","globSync","appDirectory","appPath","cwd","trim","absolute","Error","_process","spawn","stdio","close","kill","undefined"],"mappings":"AAAA;;;;+BAYA;;CAEC,GACD,SA4CC;;aA5CoBA,sBAAsB;;;+DAfhB,iBAAiB;;;;;;;yBACH,eAAe;;;;;;;yBACvB,MAAM;;;;;;;8DACtB,MAAM;;;;;;oCAOhB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKf,MAAMA,sBAAsB;IAGzCC,GAAG,GAAG;QACJ,CAACC,mBAAsB,uBAAA,CAACC,MAAM,CAAC,EAAE,eAAe;QAChD,CAACD,mBAAsB,uBAAA,CAACE,IAAI,CAAC,EAAE,gBAAgB;QAC/C,CAACF,mBAAsB,uBAAA,CAACG,KAAK,CAAC,EAAE,eAAe;KAChD,CAAC;UAEIC,kBAAkB,CAACC,WAA+B,EAAoB;QAC1E,IAAIC,MAAM,GAAG,KAAK,AAA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ACH,QAAQ,SAAM,GAAnB,KAAA,CAAmB,GAAnB,GAAa,CAAEI,IAAI,EAAE,CAAC;QACtB,IAAI,CAACJ,QAAQ,GAAGK,SAAS,CAAC;IAC5B;CACD"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, /**
|
|
6
|
-
* Browser implementation for Windows and WSL
|
|
7
|
-
*
|
|
8
|
-
* To minimize the difference between Windows and WSL, the implementation wraps all spawn calls through powershell.
|
|
9
|
-
*/ "default", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: ()=>LaunchBrowserImplWindows
|
|
12
|
-
});
|
|
13
|
-
function _spawnAsync() {
|
|
14
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("@expo/spawn-async"));
|
|
15
|
-
_spawnAsync = function() {
|
|
16
|
-
return data;
|
|
17
|
-
};
|
|
18
|
-
return data;
|
|
19
|
-
}
|
|
20
|
-
function _open() {
|
|
21
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("open"));
|
|
22
|
-
_open = function() {
|
|
23
|
-
return data;
|
|
24
|
-
};
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
function _path() {
|
|
28
|
-
const data = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
29
|
-
_path = function() {
|
|
30
|
-
return data;
|
|
31
|
-
};
|
|
32
|
-
return data;
|
|
33
|
-
}
|
|
34
|
-
const _launchBrowserTypes = require("./LaunchBrowser.types");
|
|
35
|
-
function _interopRequireDefault(obj) {
|
|
36
|
-
return obj && obj.__esModule ? obj : {
|
|
37
|
-
default: obj
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const IS_WSL = require("is-wsl") && !require("is-docker")();
|
|
41
|
-
class LaunchBrowserImplWindows {
|
|
42
|
-
MAP = {
|
|
43
|
-
[_launchBrowserTypes.LaunchBrowserTypesEnum.CHROME]: {
|
|
44
|
-
appId: "chrome"
|
|
45
|
-
},
|
|
46
|
-
[_launchBrowserTypes.LaunchBrowserTypesEnum.EDGE]: {
|
|
47
|
-
appId: "msedge"
|
|
48
|
-
},
|
|
49
|
-
[_launchBrowserTypes.LaunchBrowserTypesEnum.BRAVE]: {
|
|
50
|
-
appId: "brave"
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
async isSupportedBrowser(browserType) {
|
|
54
|
-
let result = false;
|
|
55
|
-
try {
|
|
56
|
-
const env = await this.getPowershellEnv();
|
|
57
|
-
const { status } = await (0, _spawnAsync().default)("powershell.exe", [
|
|
58
|
-
"-c",
|
|
59
|
-
`Get-Package -Name '${browserType}'`
|
|
60
|
-
], {
|
|
61
|
-
env,
|
|
62
|
-
stdio: "ignore"
|
|
63
|
-
});
|
|
64
|
-
result = status === 0;
|
|
65
|
-
} catch {
|
|
66
|
-
result = false;
|
|
67
|
-
}
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
async createTempBrowserDir(baseDirName) {
|
|
71
|
-
let tmpDir;
|
|
72
|
-
if (IS_WSL) {
|
|
73
|
-
// On WSL, the browser is actually launched in host, the `temp-dir` returns the linux /tmp path where host browsers cannot reach into.
|
|
74
|
-
// We should get the temp path through the `$TEMP` windows environment variable.
|
|
75
|
-
tmpDir = (await (0, _spawnAsync().default)("powershell.exe", [
|
|
76
|
-
"-c",
|
|
77
|
-
'echo "$Env:TEMP"'
|
|
78
|
-
])).stdout.trim();
|
|
79
|
-
return `${tmpDir}\\${baseDirName}`;
|
|
80
|
-
} else {
|
|
81
|
-
tmpDir = require("temp-dir");
|
|
82
|
-
return _path().default.join(tmpDir, baseDirName);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
async launchAsync(browserType, args) {
|
|
86
|
-
const appId = this.MAP[browserType].appId;
|
|
87
|
-
await openWithSystemRootEnvironment(appId, {
|
|
88
|
-
arguments: args
|
|
89
|
-
});
|
|
90
|
-
this._appId = appId;
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
async close() {
|
|
94
|
-
if (this._appId != null) {
|
|
95
|
-
try {
|
|
96
|
-
// Since we wrap all spawn calls through powershell as well as from `open.openApp`, the returned ChildProcess is not the browser process.
|
|
97
|
-
// And we cannot just call `process.kill()` kill it.
|
|
98
|
-
// The implementation tries to find the pid of target chromium browser process (with --app=https://chrome-devtools-frontend.appspot.com in command arguments),
|
|
99
|
-
// and uses taskkill to terminate the process.
|
|
100
|
-
const env = await this.getPowershellEnv();
|
|
101
|
-
await (0, _spawnAsync().default)("powershell.exe", [
|
|
102
|
-
"-c",
|
|
103
|
-
`taskkill.exe /pid @(Get-WmiObject Win32_Process -Filter "name = '${this._appId}.exe' AND CommandLine LIKE '%chrome-devtools-frontend.appspot.com%'" | Select-Object -ExpandProperty ProcessId)`,
|
|
104
|
-
], {
|
|
105
|
-
env,
|
|
106
|
-
stdio: "ignore"
|
|
107
|
-
});
|
|
108
|
-
} catch {}
|
|
109
|
-
this._appId = undefined;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* This method is used to get the powershell environment variables for `Get-Package` command.
|
|
114
|
-
* Especially for powershell 7, its default `PSModulePath` is different from powershell 5 and `Get-Package` command is not available.
|
|
115
|
-
* We need to set the PSModulePath to include the default value of powershell 5.
|
|
116
|
-
*/ async getPowershellEnv() {
|
|
117
|
-
if (this._powershellEnv) {
|
|
118
|
-
return this._powershellEnv;
|
|
119
|
-
}
|
|
120
|
-
const PSModulePath = (await (0, _spawnAsync().default)("powershell.exe", [
|
|
121
|
-
"-c",
|
|
122
|
-
'echo "$PSHOME\\Modules"'
|
|
123
|
-
])).stdout.trim();
|
|
124
|
-
this._powershellEnv = {
|
|
125
|
-
PSModulePath
|
|
126
|
-
};
|
|
127
|
-
return this._powershellEnv;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Due to a bug in `open` on Windows PowerShell, we need to ensure `process.env.SYSTEMROOT` is set.
|
|
132
|
-
* This environment variable is set by Windows on `SystemRoot`, causing `open` to execute a command with an "unknown" drive letter.
|
|
133
|
-
*
|
|
134
|
-
* @see https://github.com/sindresorhus/open/issues/205
|
|
135
|
-
*/ async function openWithSystemRootEnvironment(appId, options) {
|
|
136
|
-
const oldSystemRoot = process.env.SYSTEMROOT;
|
|
137
|
-
try {
|
|
138
|
-
process.env.SYSTEMROOT = process.env.SYSTEMROOT ?? process.env.SystemRoot;
|
|
139
|
-
return await _open().default.openApp(appId, options);
|
|
140
|
-
} finally{
|
|
141
|
-
process.env.SYSTEMROOT = oldSystemRoot;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
//# sourceMappingURL=LaunchBrowserImplWindows.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/middleware/inspector/LaunchBrowserImplWindows.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport open from 'open';\nimport path from 'path';\n\nimport {\n LaunchBrowserTypes,\n type LaunchBrowser,\n type LaunchBrowserInstance,\n LaunchBrowserTypesEnum,\n} from './LaunchBrowser.types';\n\nconst IS_WSL = require('is-wsl') && !require('is-docker')();\n\n/**\n * Browser implementation for Windows and WSL\n *\n * To minimize the difference between Windows and WSL, the implementation wraps all spawn calls through powershell.\n */\nexport default class LaunchBrowserImplWindows implements LaunchBrowser, LaunchBrowserInstance {\n private _appId: string | undefined;\n private _powershellEnv: { [key: string]: string } | undefined;\n\n MAP = {\n [LaunchBrowserTypesEnum.CHROME]: {\n appId: 'chrome',\n },\n [LaunchBrowserTypesEnum.EDGE]: {\n appId: 'msedge',\n },\n [LaunchBrowserTypesEnum.BRAVE]: {\n appId: 'brave',\n },\n };\n\n async isSupportedBrowser(browserType: LaunchBrowserTypes): Promise<boolean> {\n let result = false;\n try {\n const env = await this.getPowershellEnv();\n const { status } = await spawnAsync(\n 'powershell.exe',\n ['-c', `Get-Package -Name '${browserType}'`],\n {\n env,\n stdio: 'ignore',\n }\n );\n result = status === 0;\n } catch {\n result = false;\n }\n return result;\n }\n\n async createTempBrowserDir(baseDirName: string) {\n let tmpDir;\n if (IS_WSL) {\n // On WSL, the browser is actually launched in host, the `temp-dir` returns the linux /tmp path where host browsers cannot reach into.\n // We should get the temp path through the `$TEMP` windows environment variable.\n tmpDir = (await spawnAsync('powershell.exe', ['-c', 'echo \"$Env:TEMP\"'])).stdout.trim();\n return `${tmpDir}\\\\${baseDirName}`;\n } else {\n tmpDir = require('temp-dir');\n return path.join(tmpDir, baseDirName);\n }\n }\n\n async launchAsync(\n browserType: LaunchBrowserTypes,\n args: string[]\n ): Promise<LaunchBrowserInstance> {\n const appId = this.MAP[browserType].appId;\n await openWithSystemRootEnvironment(appId, { arguments: args });\n this._appId = appId;\n return this;\n }\n\n async close(): Promise<void> {\n if (this._appId != null) {\n try {\n // Since we wrap all spawn calls through powershell as well as from `open.openApp`, the returned ChildProcess is not the browser process.\n // And we cannot just call `process.kill()` kill it.\n // The implementation tries to find the pid of target chromium browser process (with --app=https://chrome-devtools-frontend.appspot.com in command arguments),\n // and uses taskkill to terminate the process.\n const env = await this.getPowershellEnv();\n await spawnAsync(\n 'powershell.exe',\n [\n '-c',\n `taskkill.exe /pid @(Get-WmiObject Win32_Process -Filter \"name = '${this._appId}.exe' AND CommandLine LIKE '%chrome-devtools-frontend.appspot.com%'\" | Select-Object -ExpandProperty ProcessId)`,\n ],\n {\n env,\n stdio: 'ignore',\n }\n );\n } catch {}\n this._appId = undefined;\n }\n }\n\n /**\n * This method is used to get the powershell environment variables for `Get-Package` command.\n * Especially for powershell 7, its default `PSModulePath` is different from powershell 5 and `Get-Package` command is not available.\n * We need to set the PSModulePath to include the default value of powershell 5.\n */\n private async getPowershellEnv(): Promise<{ [key: string]: string }> {\n if (this._powershellEnv) {\n return this._powershellEnv;\n }\n const PSModulePath = (\n await spawnAsync('powershell.exe', ['-c', 'echo \"$PSHOME\\\\Modules\"'])\n ).stdout.trim();\n this._powershellEnv = {\n PSModulePath,\n };\n return this._powershellEnv;\n }\n}\n\n/**\n * Due to a bug in `open` on Windows PowerShell, 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 */\nasync function openWithSystemRootEnvironment(\n appId: string | readonly string[],\n options?: open.OpenAppOptions\n): Promise<import('child_process').ChildProcess> {\n const oldSystemRoot = process.env.SYSTEMROOT;\n try {\n process.env.SYSTEMROOT = process.env.SYSTEMROOT ?? process.env.SystemRoot;\n return await open.openApp(appId, options);\n } finally {\n process.env.SYSTEMROOT = oldSystemRoot;\n }\n}\n"],"names":["LaunchBrowserImplWindows","IS_WSL","require","MAP","LaunchBrowserTypesEnum","CHROME","appId","EDGE","BRAVE","isSupportedBrowser","browserType","result","env","getPowershellEnv","status","spawnAsync","stdio","createTempBrowserDir","baseDirName","tmpDir","stdout","trim","path","join","launchAsync","args","openWithSystemRootEnvironment","arguments","_appId","close","undefined","_powershellEnv","PSModulePath","options","oldSystemRoot","process","SYSTEMROOT","SystemRoot","open","openApp"],"mappings":"AAAA;;;;+BAaA;;;;CAIC,GACD,SAmGC;;aAnGoBA,wBAAwB;;;8DAlBtB,mBAAmB;;;;;;;8DACzB,MAAM;;;;;;;8DACN,MAAM;;;;;;oCAOhB,uBAAuB;;;;;;AAE9B,MAAMC,MAAM,GAAGC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAACA,OAAO,CAAC,WAAW,CAAC,EAAE,AAAC;AAO7C,MAAMF,wBAAwB;IAI3CG,GAAG,GAAG;QACJ,CAACC,mBAAsB,uBAAA,CAACC,MAAM,CAAC,EAAE;YAC/BC,KAAK,EAAE,QAAQ;SAChB;QACD,CAACF,mBAAsB,uBAAA,CAACG,IAAI,CAAC,EAAE;YAC7BD,KAAK,EAAE,QAAQ;SAChB;QACD,CAACF,mB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