@expo/cli 0.13.2 → 0.15.0
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 +30 -27
- package/build/bin/cli.map +1 -1
- package/build/src/api/getVersions.js.map +1 -1
- package/build/src/api/rest/cache/response.js.map +1 -1
- package/build/src/api/rest/client.js +2 -2
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/config/configAsync.js +1 -1
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/config/index.js +2 -2
- package/build/src/config/index.js.map +1 -1
- package/build/src/customize/generate.js +1 -1
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/typescript.js +6 -4
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/export/createMetadataJson.js +3 -2
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +44 -17
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/index.js +4 -4
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +3 -3
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +74 -83
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +81 -21
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportHermes.js +24 -14
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +109 -58
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +2 -2
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +56 -23
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +11 -9
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +101 -0
- package/build/src/export/metroAssetLocalPath.js.map +1 -0
- package/build/src/export/persistMetroAssets.js +94 -21
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/resolveOptions.js +1 -1
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +9 -48
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +1 -1
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/web/index.js +2 -2
- package/build/src/export/web/index.js.map +1 -1
- package/build/src/export/writeContents.js +6 -3
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/applyPlugins.js +52 -0
- package/build/src/install/applyPlugins.js.map +1 -0
- package/build/src/install/checkPackages.js +2 -2
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js +84 -0
- package/build/src/install/fixPackages.js.map +1 -0
- package/build/src/install/installAsync.js +32 -61
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +79 -0
- package/build/src/install/installExpoPackage.js.map +1 -0
- package/build/src/login/index.js +1 -1
- package/build/src/login/index.js.map +1 -1
- package/build/src/logout/index.js +1 -1
- package/build/src/logout/index.js.map +1 -1
- package/build/src/prebuild/clearNativeFolder.js +1 -1
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js +3 -3
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +21 -30
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/index.js +3 -3
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +39 -17
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +2 -2
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +6 -6
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +49 -36
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js +2 -2
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/register/index.js +1 -1
- package/build/src/register/index.js.map +1 -1
- package/build/src/run/android/index.js +2 -2
- package/build/src/run/android/index.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +35 -2
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/index.js +2 -2
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +12 -4
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +20 -3
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/index.js +3 -3
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +30 -11
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +14 -10
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +6 -1
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +63 -0
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -0
- package/build/src/start/server/getStaticRenderFunctions.js +21 -20
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +67 -64
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +4 -19
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +187 -0
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -0
- package/build/src/start/server/metro/createJResolver.js +149 -0
- package/build/src/start/server/metro/createJResolver.js.map +1 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js +13 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/externals.js +25 -3
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/formatFileCandidates.js +72 -0
- package/build/src/start/server/metro/formatFileCandidates.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/device.js +3 -1
- package/build/src/start/server/metro/inspector-proxy/device.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js +3 -4
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js +24 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js +11 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/index.js +10 -7
- package/build/src/start/server/metro/inspector-proxy/index.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +37 -16
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +3 -2
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +6 -3
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +19 -10
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +43 -0
- package/build/src/start/server/metro/serializeHtml.js.map +1 -0
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +1 -2
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +268 -191
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +114 -40
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +61 -0
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/ExpoMiddleware.js +2 -2
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +45 -68
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +30 -26
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +7 -7
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +5 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +3 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +8 -7
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +123 -0
- package/build/src/start/server/middleware/metroOptions.js.map +1 -0
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/expo-env.js +1 -1
- package/build/src/start/server/type-generation/expo-env.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +1 -0
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/utils/analytics/getMetroDebugProperties.js +1 -2
- package/build/src/utils/analytics/getMetroDebugProperties.js.map +1 -1
- package/build/src/utils/analytics/getMetroProperties.js +1 -2
- package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/args.js +4 -2
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/cocoapods.js +2 -1
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/dir.js +18 -8
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/env.js +6 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +2 -4
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/prompts.js +1 -28
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/whoami/index.js +1 -1
- package/build/src/whoami/index.js.map +1 -1
- package/package.json +16 -16
- package/static/shims/react-native-web/dist/cjs/exports/AppRegistry/AppContainer.js +13 -0
- package/static/shims/react-native-web/dist/cjs/exports/BackHandler/index.js +10 -0
- package/static/shims/react-native-web/dist/exports/AppRegistry/AppContainer.js +12 -0
- package/static/shims/react-native-web/dist/exports/BackHandler/index.js +7 -0
- package/build/src/export/createBundles.js +0 -37
- package/build/src/export/createBundles.js.map +0 -1
- package/build/src/start/server/metro/resolveFromProject.js +0 -90
- package/build/src/start/server/metro/resolveFromProject.js.map +0 -1
- package/build/src/start/server/middleware/resolveEntryPoint.js +0 -42
- package/build/src/start/server/middleware/resolveEntryPoint.js.map +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.formatFileCandidates = formatFileCandidates;
|
|
6
|
+
var _path = _interopRequireDefault(require("path"));
|
|
7
|
+
function _interopRequireDefault(obj) {
|
|
8
|
+
return obj && obj.__esModule ? obj : {
|
|
9
|
+
default: obj
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function groupExtensions(exts) {
|
|
13
|
+
// Reverse the extensions and split into parts
|
|
14
|
+
const extParts = exts.map((ext)=>ext.split(".").reverse()
|
|
15
|
+
);
|
|
16
|
+
// Find the maximum depth of extension parts
|
|
17
|
+
const maxDepth = Math.max(...extParts.map((parts)=>parts.length
|
|
18
|
+
));
|
|
19
|
+
// Initialize groups based on the max depth
|
|
20
|
+
const groups = Array.from({
|
|
21
|
+
length: maxDepth
|
|
22
|
+
}, ()=>new Set()
|
|
23
|
+
);
|
|
24
|
+
extParts.forEach((parts)=>{
|
|
25
|
+
parts.forEach((part, i)=>{
|
|
26
|
+
// Add parts to the corresponding group based on their depth
|
|
27
|
+
groups[i].add(part);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
// Cycle groups and remove duplicates that appear forwards
|
|
31
|
+
groups.forEach((group, index)=>{
|
|
32
|
+
// Remove duplicates that appear forwards
|
|
33
|
+
// NOTE: This doesn't support extensions like `.native.native.js`
|
|
34
|
+
groups.forEach((otherGroup, otherIndex)=>{
|
|
35
|
+
if (index < otherIndex) {
|
|
36
|
+
otherGroup.forEach((part)=>group.delete(part)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
// Convert sets back to arrays and reverse groups to correct order
|
|
42
|
+
return groups.map((group)=>Array.from(group)
|
|
43
|
+
).reverse();
|
|
44
|
+
}
|
|
45
|
+
function createMatcherPatternForExtensions(exts) {
|
|
46
|
+
let formatted = "";
|
|
47
|
+
if (exts.length) {
|
|
48
|
+
// Apply grouping function
|
|
49
|
+
const groups = groupExtensions(exts);
|
|
50
|
+
formatted += groups.map((group, index)=>{
|
|
51
|
+
return index < groups.length - 1 ? `(${group.map((ext)=>`.${ext}`
|
|
52
|
+
).join("|")})?` : `.(${group.join("|")})`;
|
|
53
|
+
}).join("");
|
|
54
|
+
}
|
|
55
|
+
return formatted;
|
|
56
|
+
}
|
|
57
|
+
function formatFileCandidates(candidates, allowIndex = false) {
|
|
58
|
+
if (candidates.type === "asset") {
|
|
59
|
+
return candidates.name;
|
|
60
|
+
}
|
|
61
|
+
let formatted = candidates.filePathPrefix;
|
|
62
|
+
if (allowIndex) {
|
|
63
|
+
formatted += `(${_path.default.sep}index)?`;
|
|
64
|
+
}
|
|
65
|
+
const extensions = candidates.candidateExts// Drop additional dots, the first character if it is a dot, and remove empty strings.
|
|
66
|
+
.map((ext)=>ext.replace(/\.+/g, ".").replace(/^\./g, "")
|
|
67
|
+
).filter(Boolean);
|
|
68
|
+
formatted += createMatcherPatternForExtensions(extensions);
|
|
69
|
+
return formatted;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=formatFileCandidates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/formatFileCandidates.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * A fork of my proposed Metro change https://github.com/facebook/metro/pull/1036/files\n */\n\nimport type { FileCandidates } from 'metro-resolver';\nimport path from 'path';\n\nfunction groupExtensions(exts: readonly string[]): string[][] {\n // Reverse the extensions and split into parts\n const extParts = exts.map((ext) => ext.split('.').reverse());\n\n // Find the maximum depth of extension parts\n const maxDepth = Math.max(...extParts.map((parts) => parts.length));\n\n // Initialize groups based on the max depth\n const groups = Array.from({ length: maxDepth }, () => new Set<string>());\n\n extParts.forEach((parts) => {\n parts.forEach((part, i) => {\n // Add parts to the corresponding group based on their depth\n groups[i].add(part);\n });\n });\n\n // Cycle groups and remove duplicates that appear forwards\n groups.forEach((group, index) => {\n // Remove duplicates that appear forwards\n // NOTE: This doesn't support extensions like `.native.native.js`\n groups.forEach((otherGroup, otherIndex) => {\n if (index < otherIndex) {\n otherGroup.forEach((part) => group.delete(part));\n }\n });\n });\n\n // Convert sets back to arrays and reverse groups to correct order\n return groups.map((group) => Array.from(group)).reverse();\n}\n\nfunction createMatcherPatternForExtensions(exts: readonly string[]): string {\n let formatted = '';\n\n if (exts.length) {\n // Apply grouping function\n const groups = groupExtensions(exts);\n\n formatted += groups\n .map((group, index) => {\n return index < groups.length - 1\n ? `(${group.map((ext) => `.${ext}`).join('|')})?`\n : `.(${group.join('|')})`;\n })\n .join('');\n }\n\n return formatted;\n}\n\nexport function formatFileCandidates(\n candidates: FileCandidates,\n allowIndex: boolean = false\n): string {\n if (candidates.type === 'asset') {\n return candidates.name;\n }\n\n let formatted = candidates.filePathPrefix;\n\n if (allowIndex) {\n formatted += `(${path.sep}index)?`;\n }\n\n const extensions = candidates.candidateExts\n // Drop additional dots, the first character if it is a dot, and remove empty strings.\n .map((ext) => ext.replace(/\\.+/g, '.').replace(/^\\./g, ''))\n .filter(Boolean);\n\n formatted += createMatcherPatternForExtensions(extensions);\n\n return formatted;\n}\n"],"names":["formatFileCandidates","groupExtensions","exts","extParts","map","ext","split","reverse","maxDepth","Math","max","parts","length","groups","Array","from","Set","forEach","part","i","add","group","index","otherGroup","otherIndex","delete","createMatcherPatternForExtensions","formatted","join","candidates","allowIndex","type","name","filePathPrefix","path","sep","extensions","candidateExts","replace","filter","Boolean"],"mappings":"AAUA;;;;QAsDgBA,oBAAoB,GAApBA,oBAAoB;AArDnB,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAEvB,SAASC,eAAe,CAACC,IAAuB,EAAc;IAC5D,8CAA8C;IAC9C,MAAMC,QAAQ,GAAGD,IAAI,CAACE,GAAG,CAAC,CAACC,GAAG,GAAKA,GAAG,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,OAAO,EAAE;IAAA,CAAC,AAAC;IAE7D,4CAA4C;IAC5C,MAAMC,QAAQ,GAAGC,IAAI,CAACC,GAAG,IAAIP,QAAQ,CAACC,GAAG,CAAC,CAACO,KAAK,GAAKA,KAAK,CAACC,MAAM;IAAA,CAAC,CAAC,AAAC;IAEpE,2CAA2C;IAC3C,MAAMC,MAAM,GAAGC,KAAK,CAACC,IAAI,CAAC;QAAEH,MAAM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AAG,CAAC,CAAC;YAAA,CAAC,CAACuB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAC/C,CAAC,EAAE,EAAEP,KAAK,CAACO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAC7B,CAAC,CACDA,IAAI,CAAC,EAAE,CAAC,CAAC;KACb;IAED,OAAOD,SAAS,CAAC;CAClB;AAEM,SAAS3B,oBAAoB,CAClC6B,UAA0B,EAC1BC,UAAmB,GAAG,KAAK,EACnB;IACR,IAAID,UAAU,CAACE,IAAI,KAAK,OAAO,EAAE;QAC/B,OAAOF,UAAU,CAACG,IAAI,CAAC;KACxB;IAED,IAAIL,SAAS,GAAGE,UAAU,CAACI,cAAc,AAAC;IAE1C,IAAIH,UAAU,EAAE;QACdH,SAAS,IAAI,CAAC,CAAC,EAAEO,KAAI,QAAA,CAACC,GAAG,CAAC,OAAO,CAAC,CAAC;KACpC;IAED,MAAMC,UAAU,GAAGP,UAAU,CAACQ,aAAa,AACzC,sFAAsF;KACrFjC,GAAG,CAAC,CAACC,GAAG,GAAKA,GAAG,CAACiC,OAAO,SAAS,GAAG,CAAC,CAACA,OAAO,SAAS,EAAE,CAAC;IAAA,CAAC,CAC1DC,MAAM,CAACC,OAAO,CAAC,AAAC;IAEnBb,SAAS,IAAID,iCAAiC,CAACU,UAAU,CAAC,CAAC;IAE3D,OAAOT,SAAS,CAAC;CAClB"}
|
|
@@ -9,6 +9,7 @@ var _pageReload = require("./handlers/PageReload");
|
|
|
9
9
|
var _vscodeDebuggerGetPossibleBreakpoints = require("./handlers/VscodeDebuggerGetPossibleBreakpoints");
|
|
10
10
|
var _vscodeDebuggerScriptParsed = require("./handlers/VscodeDebuggerScriptParsed");
|
|
11
11
|
var _vscodeDebuggerSetBreakpointByUrl = require("./handlers/VscodeDebuggerSetBreakpointByUrl");
|
|
12
|
+
var _vscodeRuntimeCallFunctionOn = require("./handlers/VscodeRuntimeCallFunctionOn");
|
|
12
13
|
var _vscodeRuntimeGetProperties = require("./handlers/VscodeRuntimeGetProperties");
|
|
13
14
|
function _interopRequireDefault(obj) {
|
|
14
15
|
return obj && obj.__esModule ? obj : {
|
|
@@ -26,7 +27,8 @@ function createInspectorDeviceClass(metroBundler, MetroDeviceClass) {
|
|
|
26
27
|
new _vscodeDebuggerGetPossibleBreakpoints.VscodeDebuggerGetPossibleBreakpointsHandler(),
|
|
27
28
|
new _vscodeDebuggerScriptParsed.VscodeDebuggerScriptParsedHandler(this),
|
|
28
29
|
new _vscodeDebuggerSetBreakpointByUrl.VscodeDebuggerSetBreakpointByUrlHandler(),
|
|
29
|
-
new _vscodeRuntimeGetProperties.VscodeRuntimeGetPropertiesHandler(),
|
|
30
|
+
new _vscodeRuntimeGetProperties.VscodeRuntimeGetPropertiesHandler(),
|
|
31
|
+
new _vscodeRuntimeCallFunctionOn.VscodeRuntimeCallFunctionOnHandler(),
|
|
30
32
|
];
|
|
31
33
|
onDeviceMessage(message, info) {
|
|
32
34
|
var ref;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/device.ts"],"sourcesContent":["import type { DebuggerInfo, Device as MetroDevice } from 'metro-inspector-proxy';\nimport fetch from 'node-fetch';\nimport type WS from 'ws';\n\nimport { NetworkResponseHandler } from './handlers/NetworkResponse';\nimport { PageReloadHandler } from './handlers/PageReload';\nimport { VscodeDebuggerGetPossibleBreakpointsHandler } from './handlers/VscodeDebuggerGetPossibleBreakpoints';\nimport { VscodeDebuggerScriptParsedHandler } from './handlers/VscodeDebuggerScriptParsed';\nimport { VscodeDebuggerSetBreakpointByUrlHandler } from './handlers/VscodeDebuggerSetBreakpointByUrl';\nimport { VscodeRuntimeGetPropertiesHandler } from './handlers/VscodeRuntimeGetProperties';\nimport { DeviceRequest, InspectorHandler, DebuggerRequest } from './handlers/types';\nimport { MetroBundlerDevServer } from '../MetroBundlerDevServer';\n\n/** Export the supported debugger types this inspector proxy can handle */\nexport type DebuggerType = 'vscode' | 'generic';\n\n/** The debugger information being tracked by this device class */\nexport type ExpoDebuggerInfo = DebuggerInfo & { debuggerType?: DebuggerType };\n\nexport function createInspectorDeviceClass(\n metroBundler: MetroBundlerDevServer,\n MetroDeviceClass: typeof MetroDevice\n) {\n return class ExpoInspectorDevice extends MetroDeviceClass implements InspectorHandler {\n /** Stores information about currently connected debugger (if any). */\n _debuggerConnection: ExpoDebuggerInfo | null = null;\n\n /** All handlers that should be used to intercept or reply to CDP events */\n public handlers: InspectorHandler[] = [\n // Generic handlers\n new NetworkResponseHandler(),\n new PageReloadHandler(metroBundler),\n // Vscode-specific handlers\n new VscodeDebuggerGetPossibleBreakpointsHandler(),\n new VscodeDebuggerScriptParsedHandler(this),\n new VscodeDebuggerSetBreakpointByUrlHandler(),\n new VscodeRuntimeGetPropertiesHandler(),\n ];\n\n onDeviceMessage(message: any, info: DebuggerInfo): boolean {\n return this.handlers.some((handler) => handler.onDeviceMessage?.(message, info) ?? false);\n }\n\n onDebuggerMessage(message: any, info: DebuggerInfo): boolean {\n return this.handlers.some((handler) => handler.onDebuggerMessage?.(message, info) ?? false);\n }\n\n /**\n * Handle a new device connection with the same device identifier.\n * When the app and device name matches, we can reuse the debugger connection.\n * Else, we have to shut the debugger connection down.\n */\n handleDuplicateDeviceConnection(newDevice: InstanceType<typeof MetroDeviceClass>) {\n if (this._app !== newDevice._app || this._name !== newDevice._name) {\n this._deviceSocket.close();\n this._debuggerConnection?.socket.close();\n return;\n }\n\n const oldDebugger = this._debuggerConnection;\n this._debuggerConnection = null;\n\n if (oldDebugger) {\n oldDebugger.socket.removeAllListeners();\n this._deviceSocket.close();\n newDevice.handleDebuggerConnection(oldDebugger.socket, oldDebugger.pageId);\n }\n }\n\n /**\n * Handle a new debugger connection to this device.\n * This adds the `debuggerType` property to the `DebuggerInfo` object.\n * With that information, we can enable or disable debugger-specific handlers.\n */\n handleDebuggerConnectionWithType(socket: WS, pageId: string, debuggerType: DebuggerType): void {\n this.handleDebuggerConnection(socket, pageId);\n\n if (this._debuggerConnection) {\n this._debuggerConnection.debuggerType = debuggerType;\n }\n }\n\n /** Hook into the message life cycle to answer more complex CDP messages */\n async _processMessageFromDevice(message: DeviceRequest<any>, info: DebuggerInfo) {\n if (!this.onDeviceMessage(message, info)) {\n await super._processMessageFromDevice(message, info);\n }\n }\n\n /** Hook into the message life cycle to answer more complex CDP messages */\n _interceptMessageFromDebugger(\n request: DebuggerRequest,\n info: DebuggerInfo,\n socket: WS\n ): boolean {\n // Note, `socket` is the exact same as `info.socket`\n if (this.onDebuggerMessage(request, info)) {\n return true;\n }\n\n return super._interceptMessageFromDebugger(request, info, socket);\n }\n\n /**\n * Overwrite the default text fetcher, to load sourcemaps from sources other than `localhost`.\n * @todo Cedric: remove the custom `DebuggerScriptSource` handler when switching over to `metro@>=0.75.1`\n * @see https://github.com/facebook/metro/blob/77f445f1bcd2264ad06174dbf8d542bc75834d29/packages/metro-inspector-proxy/src/Device.js#L573-L588\n * @since metro-inspector-proxy@0.75.1\n */\n async _fetchText(url: URL): Promise<string> {\n const LENGTH_LIMIT_BYTES = 350_000_000; // 350mb\n\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Received status ${response.status} while fetching: ${url}`);\n }\n\n const contentLength = response.headers.get('Content-Length');\n if (contentLength && Number(contentLength) > LENGTH_LIMIT_BYTES) {\n throw new Error('Expected file size is too large (more than 350mb)');\n }\n\n const text = await response.text();\n if (Buffer.byteLength(text, 'utf8') > LENGTH_LIMIT_BYTES) {\n throw new Error('File size is too large (more than 350mb)');\n }\n\n return text;\n }\n };\n}\n"],"names":["createInspectorDeviceClass","metroBundler","MetroDeviceClass","ExpoInspectorDevice","_debuggerConnection","handlers","NetworkResponseHandler","PageReloadHandler","VscodeDebuggerGetPossibleBreakpointsHandler","VscodeDebuggerScriptParsedHandler","VscodeDebuggerSetBreakpointByUrlHandler","VscodeRuntimeGetPropertiesHandler","onDeviceMessage","message","info","handler","some","onDebuggerMessage","handleDuplicateDeviceConnection","newDevice","_app","_name","_deviceSocket","close","socket","oldDebugger","removeAllListeners","handleDebuggerConnection","pageId","handleDebuggerConnectionWithType","debuggerType","_processMessageFromDevice","_interceptMessageFromDebugger","request","_fetchText","url","LENGTH_LIMIT_BYTES","response","fetch","ok","Error","status","contentLength","headers","get","Number","text","Buffer","byteLength"],"mappings":"AAAA;;;;QAmBgBA,0BAA0B,GAA1BA,0BAA0B;AAlBxB,IAAA,UAAY,kCAAZ,YAAY,EAAA;AAGS,IAAA,gBAA4B,WAA5B,4BAA4B,CAAA;AACjC,IAAA,WAAuB,WAAvB,uBAAuB,CAAA;AACG,IAAA,qCAAiD,WAAjD,iDAAiD,CAAA;AAC3D,IAAA,2BAAuC,WAAvC,uCAAuC,CAAA;AACjC,IAAA,iCAA6C,WAA7C,6CAA6C,CAAA;AACnD,IAAA,2BAAuC,WAAvC,uCAAuC,CAAA;;;;;;AAUlF,SAASA,0BAA0B,CACxCC,YAAmC,EACnCC,gBAAoC,EACpC;IACA,OAAO,MAAMC,mBAAmB,SAASD,gBAAgB;QACvD,sEAAsE,CACtEE,mBAAmB,GAA4B,IAAI,CAAC;QAEpD,2EAA2E,CAC3E,AAAOC,QAAQ,GAAuB;YACpC,mBAAmB;YACnB,IAAIC,gBAAsB,uBAAA,EAAE;YAC5B,IAAIC,WAAiB,kBAAA,CAACN,YAAY,CAAC;YACnC,2BAA2B;YAC3B,IAAIO,qCAA2C,4CAAA,EAAE;YACjD,IAAIC,2BAAiC,kCAAA,CAAC,IAAI,CAAC;YAC3C,IAAIC,iCAAuC,wCAAA,EAAE;YAC7C,IAAIC,2BAAiC,kCAAA,EAAE;SACxC,CAAC;QAEFC,eAAe,CAACC,OAAY,EAAEC,IAAkB,EAAW;gBAClBC,GAAwC;YAA/E,OAAO,IAAI,CAACV,QAAQ,CAACW,IAAI,CAAC,CAACD,OAAO;gBAAKA,OAAAA,CAAAA,GAAwC,GAAxCA,OAAO,CAACH,eAAe,QAAiB,GAAxCG,KAA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,kBAAkB,EAAE;gBAC/D,MAAM,IAAII,KAAK,CAAC,mDAAmD,CAAC,CAAC;aACtE;YAED,MAAMM,IAAI,GAAG,MAAMT,QAAQ,CAACS,IAAI,EAAE,AAAC;YACnC,IAAIC,MAAM,CAACC,UAAU,CAACF,IAAI,EAAE,MAAM,CAAC,GAAGV,kBAAkB,EAAE;gBACxD,MAAM,IAAII,KAAK,CAAC,0CAA0C,CAAC,CAAC;aAC7D;YAED,OAAOM,IAAI,CAAC;SACb;KACF,CAAC;CACH"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/device.ts"],"sourcesContent":["import type { DebuggerInfo, Device as MetroDevice } from 'metro-inspector-proxy';\nimport fetch from 'node-fetch';\nimport type WS from 'ws';\n\nimport { NetworkResponseHandler } from './handlers/NetworkResponse';\nimport { PageReloadHandler } from './handlers/PageReload';\nimport { VscodeDebuggerGetPossibleBreakpointsHandler } from './handlers/VscodeDebuggerGetPossibleBreakpoints';\nimport { VscodeDebuggerScriptParsedHandler } from './handlers/VscodeDebuggerScriptParsed';\nimport { VscodeDebuggerSetBreakpointByUrlHandler } from './handlers/VscodeDebuggerSetBreakpointByUrl';\nimport { VscodeRuntimeCallFunctionOnHandler } from './handlers/VscodeRuntimeCallFunctionOn';\nimport { VscodeRuntimeGetPropertiesHandler } from './handlers/VscodeRuntimeGetProperties';\nimport { DeviceRequest, InspectorHandler, DebuggerRequest } from './handlers/types';\nimport { MetroBundlerDevServer } from '../MetroBundlerDevServer';\n\n/** Export the supported debugger types this inspector proxy can handle */\nexport type DebuggerType = 'vscode' | 'generic';\n\n/** The debugger information being tracked by this device class */\nexport type ExpoDebuggerInfo = DebuggerInfo & { debuggerType?: DebuggerType };\n\nexport function createInspectorDeviceClass(\n metroBundler: MetroBundlerDevServer,\n MetroDeviceClass: typeof MetroDevice\n) {\n return class ExpoInspectorDevice extends MetroDeviceClass implements InspectorHandler {\n /** Stores information about currently connected debugger (if any). */\n _debuggerConnection: ExpoDebuggerInfo | null = null;\n\n /** All handlers that should be used to intercept or reply to CDP events */\n public handlers: InspectorHandler[] = [\n // Generic handlers\n new NetworkResponseHandler(),\n new PageReloadHandler(metroBundler),\n // Vscode-specific handlers\n new VscodeDebuggerGetPossibleBreakpointsHandler(),\n new VscodeDebuggerScriptParsedHandler(this),\n new VscodeDebuggerSetBreakpointByUrlHandler(),\n new VscodeRuntimeGetPropertiesHandler(),\n new VscodeRuntimeCallFunctionOnHandler(),\n ];\n\n onDeviceMessage(message: any, info: DebuggerInfo): boolean {\n return this.handlers.some((handler) => handler.onDeviceMessage?.(message, info) ?? false);\n }\n\n onDebuggerMessage(message: any, info: DebuggerInfo): boolean {\n return this.handlers.some((handler) => handler.onDebuggerMessage?.(message, info) ?? false);\n }\n\n /**\n * Handle a new device connection with the same device identifier.\n * When the app and device name matches, we can reuse the debugger connection.\n * Else, we have to shut the debugger connection down.\n */\n handleDuplicateDeviceConnection(newDevice: InstanceType<typeof MetroDeviceClass>) {\n if (this._app !== newDevice._app || this._name !== newDevice._name) {\n this._deviceSocket.close();\n this._debuggerConnection?.socket.close();\n return;\n }\n\n const oldDebugger = this._debuggerConnection;\n this._debuggerConnection = null;\n\n if (oldDebugger) {\n oldDebugger.socket.removeAllListeners();\n this._deviceSocket.close();\n newDevice.handleDebuggerConnection(oldDebugger.socket, oldDebugger.pageId);\n }\n }\n\n /**\n * Handle a new debugger connection to this device.\n * This adds the `debuggerType` property to the `DebuggerInfo` object.\n * With that information, we can enable or disable debugger-specific handlers.\n */\n handleDebuggerConnectionWithType(socket: WS, pageId: string, debuggerType: DebuggerType): void {\n this.handleDebuggerConnection(socket, pageId);\n\n if (this._debuggerConnection) {\n this._debuggerConnection.debuggerType = debuggerType;\n }\n }\n\n /** Hook into the message life cycle to answer more complex CDP messages */\n async _processMessageFromDevice(message: DeviceRequest<any>, info: DebuggerInfo) {\n if (!this.onDeviceMessage(message, info)) {\n await super._processMessageFromDevice(message, info);\n }\n }\n\n /** Hook into the message life cycle to answer more complex CDP messages */\n _interceptMessageFromDebugger(\n request: DebuggerRequest,\n info: DebuggerInfo,\n socket: WS\n ): boolean {\n // Note, `socket` is the exact same as `info.socket`\n if (this.onDebuggerMessage(request, info)) {\n return true;\n }\n\n return super._interceptMessageFromDebugger(request, info, socket);\n }\n\n /**\n * Overwrite the default text fetcher, to load sourcemaps from sources other than `localhost`.\n * @todo Cedric: remove the custom `DebuggerScriptSource` handler when switching over to `metro@>=0.75.1`\n * @see https://github.com/facebook/metro/blob/77f445f1bcd2264ad06174dbf8d542bc75834d29/packages/metro-inspector-proxy/src/Device.js#L573-L588\n * @since metro-inspector-proxy@0.75.1\n */\n async _fetchText(url: URL): Promise<string> {\n const LENGTH_LIMIT_BYTES = 350_000_000; // 350mb\n\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Received status ${response.status} while fetching: ${url}`);\n }\n\n const contentLength = response.headers.get('Content-Length');\n if (contentLength && Number(contentLength) > LENGTH_LIMIT_BYTES) {\n throw new Error('Expected file size is too large (more than 350mb)');\n }\n\n const text = await response.text();\n if (Buffer.byteLength(text, 'utf8') > LENGTH_LIMIT_BYTES) {\n throw new Error('File size is too large (more than 350mb)');\n }\n\n return text;\n }\n };\n}\n"],"names":["createInspectorDeviceClass","metroBundler","MetroDeviceClass","ExpoInspectorDevice","_debuggerConnection","handlers","NetworkResponseHandler","PageReloadHandler","VscodeDebuggerGetPossibleBreakpointsHandler","VscodeDebuggerScriptParsedHandler","VscodeDebuggerSetBreakpointByUrlHandler","VscodeRuntimeGetPropertiesHandler","VscodeRuntimeCallFunctionOnHandler","onDeviceMessage","message","info","handler","some","onDebuggerMessage","handleDuplicateDeviceConnection","newDevice","_app","_name","_deviceSocket","close","socket","oldDebugger","removeAllListeners","handleDebuggerConnection","pageId","handleDebuggerConnectionWithType","debuggerType","_processMessageFromDevice","_interceptMessageFromDebugger","request","_fetchText","url","LENGTH_LIMIT_BYTES","response","fetch","ok","Error","status","contentLength","headers","get","Number","text","Buff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EAAE,AAAC;YACnC,IAAIC,MAAM,CAACC,UAAU,CAACF,IAAI,EAAE,MAAM,CAAC,GAAGV,kBAAkB,EAAE;gBACxD,MAAM,IAAII,KAAK,CAAC,0CAA0C,CAAC,CAAC;aAC7D;YAED,OAAOM,IAAI,CAAC;SACb;KACF,CAAC;CACH"}
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
var _utils = require("./utils");
|
|
5
6
|
class VscodeDebuggerGetPossibleBreakpointsHandler {
|
|
6
7
|
onDebuggerMessage(message, { socket , debuggerType }) {
|
|
7
8
|
if (debuggerType === "vscode" && message.method === "Debugger.getPossibleBreakpoints") {
|
|
8
|
-
|
|
9
|
+
return (0, _utils).respond(socket, {
|
|
9
10
|
id: message.id,
|
|
10
11
|
result: {
|
|
11
12
|
locations: []
|
|
12
13
|
}
|
|
13
|
-
};
|
|
14
|
-
socket.send(JSON.stringify(response));
|
|
15
|
-
return true;
|
|
14
|
+
});
|
|
16
15
|
}
|
|
17
16
|
return false;
|
|
18
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\nimport { ExpoDebuggerInfo } from '../device';\n\n/**\n * Hermes doesn't seem to handle this request, but `locations` have to be returned.\n * Respond with an empty location to make it \"spec compliant\" with Chrome DevTools.\n */\nexport class VscodeDebuggerGetPossibleBreakpointsHandler implements InspectorHandler {\n onDebuggerMessage(\n message: DebuggerRequest<DebuggerGetPossibleBreakpoints>,\n { socket, debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (debuggerType === 'vscode' && message.method === 'Debugger.getPossibleBreakpoints') {\n
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\nimport { respond } from './utils';\nimport { ExpoDebuggerInfo } from '../device';\n\n/**\n * Hermes doesn't seem to handle this request, but `locations` have to be returned.\n * Respond with an empty location to make it \"spec compliant\" with Chrome DevTools.\n */\nexport class VscodeDebuggerGetPossibleBreakpointsHandler implements InspectorHandler {\n onDebuggerMessage(\n message: DebuggerRequest<DebuggerGetPossibleBreakpoints>,\n { socket, debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (debuggerType === 'vscode' && message.method === 'Debugger.getPossibleBreakpoints') {\n return respond<DeviceResponse<DebuggerGetPossibleBreakpoints>>(socket, {\n id: message.id,\n result: { locations: [] },\n });\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-getPossibleBreakpoints */\nexport type DebuggerGetPossibleBreakpoints = CdpMessage<\n 'Debugger.getPossibleBreakpoints',\n Protocol.Debugger.GetPossibleBreakpointsRequest,\n Protocol.Debugger.GetPossibleBreakpointsResponse\n>;\n"],"names":["VscodeDebuggerGetPossibleBreakpointsHandler","onDebuggerMessage","message","socket","debuggerType","method","respond","id","result","locations"],"mappings":"AAAA;;;;AAGwB,IAAA,MAAS,WAAT,SAAS,CAAA;AAO1B,MAAMA,2CAA2C;IACtDC,iBAAiB,CACfC,OAAwD,EACxD,EAAEC,MAAM,CAAA,EAAEC,YAAY,CAAA,EAAoB,EACjC;QACT,IAAIA,YAAY,KAAK,QAAQ,IAAIF,OAAO,CAACG,MAAM,KAAK,iCAAiC,EAAE;YACrF,OAAOC,CAAAA,GAAAA,MAAO,AAGZ,CAAA,QAHY,CAAiDH,MAAM,EAAE;gBACrEI,EAAE,EAAEL,OAAO,CAACK,EAAE;gBACdC,MAAM,EAAE;oBAAEC,SAAS,EAAE,EAAE;iBAAE;aAC1B,CAAC,CAAC;SACJ;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAdYT,2CAA2C,GAA3CA,2CAA2C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
var _utils = require("./utils");
|
|
6
|
+
class VscodeRuntimeCallFunctionOnHandler {
|
|
7
|
+
onDebuggerMessage(message, { socket , debuggerType }) {
|
|
8
|
+
if (debuggerType === "vscode" && message.method === "Runtime.callFunctionOn") {
|
|
9
|
+
return (0, _utils).respond(socket, {
|
|
10
|
+
id: message.id,
|
|
11
|
+
result: {
|
|
12
|
+
// We don't know the `type` and vscode allows `type: undefined`
|
|
13
|
+
result: {
|
|
14
|
+
objectId: message.params.objectId
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.VscodeRuntimeCallFunctionOnHandler = VscodeRuntimeCallFunctionOnHandler;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=VscodeRuntimeCallFunctionOn.js.map
|
package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\nimport { respond } from './utils';\nimport { ExpoDebuggerInfo } from '../device';\n\n/**\n * Vscode is trying to inject a script to fetch information about \"Stringy\" variables.\n * Unfortunately, this script causes a Hermes exception and crashes the app.\n *\n * @see https://github.com/expo/vscode-expo/issues/231\n * @see https://github.com/microsoft/vscode-js-debug/blob/dcccaf3972d675cc1e5c776450bb4c3dc8c178c1/src/adapter/stackTrace.ts#L319-L324\n */\nexport class VscodeRuntimeCallFunctionOnHandler implements InspectorHandler {\n onDebuggerMessage(\n message: DebuggerRequest<RuntimeCallFunctionOn>,\n { socket, debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (debuggerType === 'vscode' && message.method === 'Runtime.callFunctionOn') {\n return respond<DeviceResponse<RuntimeCallFunctionOn>>(socket, {\n id: message.id,\n result: {\n // We don't know the `type` and vscode allows `type: undefined`\n result: { objectId: message.params.objectId } as any,\n },\n });\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Runtime/#method-callFunctionOn */\nexport type RuntimeCallFunctionOn = CdpMessage<\n 'Runtime.callFunctionOn',\n Protocol.Runtime.CallFunctionOnRequest,\n Protocol.Runtime.CallFunctionOnResponse\n>;\n"],"names":["VscodeRuntimeCallFunctionOnHandler","onDebuggerMessage","message","socket","debuggerType","method","respond","id","result","objectId","params"],"mappings":"AAAA;;;;AAGwB,IAAA,MAAS,WAAT,SAAS,CAAA;AAU1B,MAAMA,kCAAkC;IAC7CC,iBAAiB,CACfC,OAA+C,EAC/C,EAAEC,MAAM,CAAA,EAAEC,YAAY,CAAA,EAAoB,EACjC;QACT,IAAIA,YAAY,KAAK,QAAQ,IAAIF,OAAO,CAACG,MAAM,KAAK,wBAAwB,EAAE;YAC5E,OAAOC,CAAAA,GAAAA,MAAO,AAMZ,CAAA,QANY,CAAwCH,MAAM,EAAE;gBAC5DI,EAAE,EAAEL,OAAO,CAACK,EAAE;gBACdC,MAAM,EAAE;oBACN,+DAA+D;oBAC/DA,MAAM,EAAE;wBAAEC,QAAQ,EAAEP,OAAO,CAACQ,MAAM,CAACD,QAAQ;qBAAE;iBAC9C;aACF,CAAC,CAAC;SACJ;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAjBYT,kCAAkC,GAAlCA,kCAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/utils.ts"],"sourcesContent":["import type WS from 'ws';\n\nimport { DebuggerResponse, DeviceResponse } from './types';\n\n/**\n * Helper function to respond to a message from the debugger or device.\n * The return value is used to stop the message propagation, \"canceling\" further handling.\n *\n * @example ```\n * return respond<DeviceResponse<CDP>>(socket, { id: message.id, result: {} });\n * ```\n */\nexport function respond<T = DeviceResponse | DebuggerResponse>(socket: WS, message: T) {\n socket.send(JSON.stringify(message));\n return true;\n}\n"],"names":["respond","socket","message","send","JSON","stringify"],"mappings":"AAAA;;;;QAYgBA,OAAO,GAAPA,OAAO;AAAhB,SAASA,OAAO,CAAwCC,MAAU,EAAEC,OAAU,EAAE;IACrFD,MAAM,CAACE,IAAI,CAACC,IAAI,CAACC,SAAS,CAACH,OAAO,CAAC,CAAC,CAAC;IACrC,OAAO,IAAI,CAAC;CACb"}
|
|
@@ -9,18 +9,21 @@ Object.defineProperty(exports, "ExpoInspectorProxy", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
exports.createInspectorProxy = createInspectorProxy;
|
|
12
|
-
var
|
|
12
|
+
var _metroInspectorProxy = require("metro-inspector-proxy");
|
|
13
|
+
var _device = _interopRequireDefault(require("metro-inspector-proxy/src/Device"));
|
|
14
|
+
var _device1 = require("./device");
|
|
13
15
|
var _proxy = require("./proxy");
|
|
14
|
-
|
|
16
|
+
function _interopRequireDefault(obj) {
|
|
17
|
+
return obj && obj.__esModule ? obj : {
|
|
18
|
+
default: obj
|
|
19
|
+
};
|
|
20
|
+
}
|
|
15
21
|
const debug = require("debug")("expo:metro:inspector-proxy");
|
|
16
22
|
function createInspectorProxy(metroBundler, projectRoot) {
|
|
17
23
|
debug("Expo inspector proxy enabled");
|
|
18
|
-
// Import the installed `metro-inspector-proxy` from the project
|
|
19
|
-
// We use these base classes to extend functionality
|
|
20
|
-
const { InspectorProxy: MetroInspectorProxy } = (0, _resolveFromProject).importMetroInspectorProxyFromProject(projectRoot);
|
|
21
24
|
// The device is slightly more complicated, we need to extend that class
|
|
22
|
-
const ExpoInspectorDevice = (0,
|
|
23
|
-
const inspectorProxy = new _proxy.ExpoInspectorProxy(new
|
|
25
|
+
const ExpoInspectorDevice = (0, _device1).createInspectorDeviceClass(metroBundler, _device.default);
|
|
26
|
+
const inspectorProxy = new _proxy.ExpoInspectorProxy(new _metroInspectorProxy.InspectorProxy(projectRoot), ExpoInspectorDevice);
|
|
24
27
|
return inspectorProxy;
|
|
25
28
|
}
|
|
26
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/index.ts"],"sourcesContent":["import { InspectorProxy as MetroInspectorProxy } from 'metro-inspector-proxy';\nimport Device from 'metro-inspector-proxy/src/Device';\n\nimport { createInspectorDeviceClass } from './device';\nimport { ExpoInspectorProxy } from './proxy';\nimport { MetroBundlerDevServer } from '../MetroBundlerDevServer';\n\nexport { ExpoInspectorProxy } from './proxy';\n\nconst debug = require('debug')('expo:metro:inspector-proxy') as typeof console.log;\n\nexport function createInspectorProxy(metroBundler: MetroBundlerDevServer, projectRoot: string) {\n debug('Expo inspector proxy enabled');\n\n // The device is slightly more complicated, we need to extend that class\n const ExpoInspectorDevice = createInspectorDeviceClass(metroBundler, Device);\n\n const inspectorProxy = new ExpoInspectorProxy(\n new MetroInspectorProxy(projectRoot),\n ExpoInspectorDevice\n );\n\n return inspectorProxy;\n}\n"],"names":["ExpoInspectorProxy","createInspectorProxy","debug","require","metroBundler","projectRoot","ExpoInspectorDevice","createInspectorDeviceClass","Device","inspectorProxy","MetroInspectorProxy"],"mappings":"AAAA;;;;+BAOSA,oBAAkB;;;eAHQ,MAAS,CAGnCA,kBAAkB;;;QAIXC,oBAAoB,GAApBA,oBAAoB;AAXkB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AAC1D,IAAA,OAAkC,kCAAlC,kCAAkC,EAAA;AAEV,IAAA,QAAU,WAAV,UAAU,CAAA;AAClB,IAAA,MAAS,WAAT,SAAS,CAAA;;;;;;AAK5C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,AAAsB,AAAC;AAE5E,SAASF,oBAAoB,CAACG,YAAmC,EAAEC,WAAmB,EAAE;IAC7FH,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAEtC,wEAAwE;IACxE,MAAMI,mBAAmB,GAAGC,CAAAA,GAAAA,QAA0B,AAAsB,CAAA,2BAAtB,CAACH,YAAY,EAAEI,OAAM,QAAA,CAAC,AAAC;IAE7E,MAAMC,cAAc,GAAG,IAAIT,MAAkB,mBAAA,CAC3C,IAAIU,oBAAmB,eAAA,CAACL,WAAW,CAAC,EACpCC,mBAAmB,CACpB,AAAC;IAEF,OAAOG,cAAc,CAAC;CACvB"}
|
|
@@ -6,12 +6,12 @@ exports.loadMetroConfigAsync = loadMetroConfigAsync;
|
|
|
6
6
|
exports.instantiateMetroAsync = instantiateMetroAsync;
|
|
7
7
|
exports.isWatchEnabled = isWatchEnabled;
|
|
8
8
|
var _config = require("@expo/config");
|
|
9
|
+
var ExpoMetroConfig = _interopRequireWildcard(require("@expo/metro-config"));
|
|
9
10
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
10
11
|
var _metroCore = require("metro-core");
|
|
11
12
|
var _semver = _interopRequireDefault(require("semver"));
|
|
12
13
|
var _url = require("url");
|
|
13
14
|
var _metroTerminalReporter = require("./MetroTerminalReporter");
|
|
14
|
-
var _resolveFromProject = require("./resolveFromProject");
|
|
15
15
|
var _router = require("./router");
|
|
16
16
|
var _runServerFork = require("./runServer-fork");
|
|
17
17
|
var _withMetroMultiPlatform = require("./withMetroMultiPlatform");
|
|
@@ -32,6 +32,27 @@ function _interopRequireDefault(obj) {
|
|
|
32
32
|
default: obj
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
+
function _interopRequireWildcard(obj) {
|
|
36
|
+
if (obj && obj.__esModule) {
|
|
37
|
+
return obj;
|
|
38
|
+
} else {
|
|
39
|
+
var newObj = {};
|
|
40
|
+
if (obj != null) {
|
|
41
|
+
for(var key in obj){
|
|
42
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
44
|
+
if (desc.get || desc.set) {
|
|
45
|
+
Object.defineProperty(newObj, key, desc);
|
|
46
|
+
} else {
|
|
47
|
+
newObj[key] = obj[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
newObj.default = obj;
|
|
53
|
+
return newObj;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
35
56
|
function gteSdkVersion(exp, sdkVersion) {
|
|
36
57
|
if (!exp.sdkVersion) {
|
|
37
58
|
return false;
|
|
@@ -46,8 +67,7 @@ function gteSdkVersion(exp, sdkVersion) {
|
|
|
46
67
|
}
|
|
47
68
|
}
|
|
48
69
|
async function loadMetroConfigAsync(projectRoot, options, { exp =(0, _config).getConfig(projectRoot, {
|
|
49
|
-
skipSDKVersionRequirement: true
|
|
50
|
-
skipPlugins: true
|
|
70
|
+
skipSDKVersionRequirement: true
|
|
51
71
|
}).exp , isExporting }) {
|
|
52
72
|
var ref, ref1;
|
|
53
73
|
let reportEvent;
|
|
@@ -62,7 +82,6 @@ async function loadMetroConfigAsync(projectRoot, options, { exp =(0, _config).ge
|
|
|
62
82
|
}
|
|
63
83
|
}
|
|
64
84
|
};
|
|
65
|
-
const ExpoMetroConfig = (0, _resolveFromProject).importExpoMetroConfig(projectRoot);
|
|
66
85
|
let config = await ExpoMetroConfig.loadAsync(projectRoot, {
|
|
67
86
|
reporter,
|
|
68
87
|
...options
|
|
@@ -74,30 +93,34 @@ async function loadMetroConfigAsync(projectRoot, options, { exp =(0, _config).ge
|
|
|
74
93
|
var ref3;
|
|
75
94
|
// This token will be used in the asset plugin to ensure the path is correct for writing locally.
|
|
76
95
|
// @ts-expect-error: typed as readonly.
|
|
77
|
-
config.transformer.publicPath = `/assets?export_path=${((ref3 = (ref2 = exp.experiments) == null ? void 0 : ref2.
|
|
96
|
+
config.transformer.publicPath = `/assets?export_path=${((ref3 = (ref2 = exp.experiments) == null ? void 0 : ref2.baseUrl) != null ? ref3 : "") + "/assets"}`;
|
|
78
97
|
} else {
|
|
79
98
|
// @ts-expect-error: typed as readonly
|
|
80
99
|
config.transformer.publicPath = "/assets/?unstable_path=.";
|
|
81
100
|
}
|
|
82
101
|
} else {
|
|
83
102
|
var ref4;
|
|
84
|
-
if (isExporting && ((ref4 = exp.experiments) == null ? void 0 : ref4.
|
|
103
|
+
if (isExporting && ((ref4 = exp.experiments) == null ? void 0 : ref4.baseUrl)) {
|
|
85
104
|
var ref5;
|
|
86
105
|
// This token will be used in the asset plugin to ensure the path is correct for writing locally.
|
|
87
106
|
// @ts-expect-error: typed as readonly.
|
|
88
|
-
config.transformer.publicPath = (ref5 = exp.experiments) == null ? void 0 : ref5.
|
|
107
|
+
config.transformer.publicPath = (ref5 = exp.experiments) == null ? void 0 : ref5.baseUrl;
|
|
89
108
|
}
|
|
90
109
|
}
|
|
91
110
|
const platformBundlers = (0, _platformBundlers).getPlatformBundlers(exp);
|
|
92
|
-
var ref6;
|
|
111
|
+
var ref6, ref7;
|
|
93
112
|
config = await (0, _withMetroMultiPlatform).withMetroMultiPlatformAsync(projectRoot, {
|
|
94
113
|
routerDirectory: (0, _router).getRouterDirectoryModuleIdWithManifest(projectRoot, exp),
|
|
95
114
|
config,
|
|
96
115
|
platformBundlers,
|
|
97
|
-
isTsconfigPathsEnabled:
|
|
98
|
-
webOutput: (
|
|
116
|
+
isTsconfigPathsEnabled: (ref6 = (ref = exp.experiments) == null ? void 0 : ref.tsconfigPaths) != null ? ref6 : true,
|
|
117
|
+
webOutput: (ref7 = (ref1 = exp.web) == null ? void 0 : ref1.output) != null ? ref7 : "single",
|
|
118
|
+
isFastResolverEnabled: _env.env.EXPO_USE_FAST_RESOLVER,
|
|
119
|
+
isExporting
|
|
99
120
|
});
|
|
100
|
-
(
|
|
121
|
+
if (process.env.NODE_ENV !== "test") {
|
|
122
|
+
(0, _rudderstackClient).logEventAsync("metro config", (0, _getMetroProperties).getMetroProperties(projectRoot, exp, config));
|
|
123
|
+
}
|
|
101
124
|
return {
|
|
102
125
|
config,
|
|
103
126
|
setEventReporter: (logger)=>reportEvent = logger
|
|
@@ -109,14 +132,13 @@ async function instantiateMetroAsync(metroBundler, options, { isExporting }) {
|
|
|
109
132
|
const projectRoot = metroBundler.projectRoot;
|
|
110
133
|
// TODO: When we bring expo/metro-config into the expo/expo repo, then we can upstream this.
|
|
111
134
|
const { exp } = (0, _config).getConfig(projectRoot, {
|
|
112
|
-
skipSDKVersionRequirement: true
|
|
113
|
-
skipPlugins: true
|
|
135
|
+
skipSDKVersionRequirement: true
|
|
114
136
|
});
|
|
115
137
|
const { config: metroConfig , setEventReporter } = await loadMetroConfigAsync(projectRoot, options, {
|
|
116
138
|
exp,
|
|
117
139
|
isExporting
|
|
118
140
|
});
|
|
119
|
-
const { createDevServerMiddleware , securityHeadersMiddleware } = (
|
|
141
|
+
const { createDevServerMiddleware , securityHeadersMiddleware } = require("@react-native-community/cli-server-api");
|
|
120
142
|
const { middleware , messageSocketEndpoint , eventsSocketEndpoint , websocketEndpoints } = createDevServerMiddleware({
|
|
121
143
|
port: metroConfig.server.port,
|
|
122
144
|
watchFolders: metroConfig.watchFolders
|
|
@@ -138,10 +160,9 @@ async function instantiateMetroAsync(metroBundler, options, { isExporting }) {
|
|
|
138
160
|
};
|
|
139
161
|
middleware.use((0, _metroDebuggerMiddleware).createDebuggerTelemetryMiddleware(projectRoot, exp));
|
|
140
162
|
const { server: server1 , metro } = await (0, _runServerFork).runServer(metroBundler, metroConfig, {
|
|
141
|
-
hmrEnabled: true,
|
|
142
163
|
// @ts-expect-error: Inconsistent `websocketEndpoints` type between metro and @react-native-community/cli-server-api
|
|
143
164
|
websocketEndpoints,
|
|
144
|
-
watch: isWatchEnabled()
|
|
165
|
+
watch: !isExporting && isWatchEnabled()
|
|
145
166
|
});
|
|
146
167
|
(0, _mutations).prependMiddleware(middleware, (req, res, next)=>{
|
|
147
168
|
// If the URL is a Metro asset request, then we need to skip all other middleware to prevent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport type { LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport { Server as ConnectServer } from 'connect';\nimport http from 'http';\nimport type Metro from 'metro';\nimport { Terminal } from 'metro-core';\nimport semver from 'semver';\nimport { URL } from 'url';\n\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { importCliServerApiFromProject, importExpoMetroConfig } from './resolveFromProject';\nimport { getRouterDirectoryModuleIdWithManifest } from './router';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { MetroDevServerOptions } from '../../../export/fork-bundleAsync';\nimport { Log } from '../../../log';\nimport { getMetroProperties } from '../../../utils/analytics/getMetroProperties';\nimport { createDebuggerTelemetryMiddleware } from '../../../utils/analytics/metroDebuggerMiddleware';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { env } from '../../../utils/env';\nimport { getMetroServerRoot } from '../middleware/ManifestMiddleware';\nimport createJsInspectorMiddleware from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware, replaceMiddlewareWith } from '../middleware/mutations';\nimport { remoteDevtoolsCorsMiddleware } from '../middleware/remoteDevtoolsCorsMiddleware';\nimport { remoteDevtoolsSecurityHeadersMiddleware } from '../middleware/remoteDevtoolsSecurityHeadersMiddleware';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { suppressRemoteDebuggingErrorMiddleware } from '../middleware/suppressErrorMiddleware';\nimport { getPlatformBundlers } from '../platformBundlers';\n\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\nfunction gteSdkVersion(exp: Pick<ExpoConfig, 'sdkVersion'>, sdkVersion: string): boolean {\n if (!exp.sdkVersion) {\n return false;\n }\n\n if (exp.sdkVersion === 'UNVERSIONED') {\n return true;\n }\n\n try {\n return semver.gte(exp.sdkVersion, sdkVersion);\n } catch {\n throw new Error(`${exp.sdkVersion} is not a valid version. Must be in the form of x.y.z`);\n }\n}\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\n {\n exp = getConfig(projectRoot, { skipSDKVersionRequirement: true, skipPlugins: true }).exp,\n isExporting,\n }: { exp?: ExpoConfig; isExporting: boolean }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n const serverRoot = getMetroServerRoot(projectRoot);\n\n const terminal = new Terminal(process.stdout);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const reporter = {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n };\n\n const ExpoMetroConfig = importExpoMetroConfig(projectRoot);\n let config = await ExpoMetroConfig.loadAsync(projectRoot, { reporter, ...options });\n\n if (\n // Requires SDK 50 for expo-assets hashAssetPlugin change.\n !exp.sdkVersion ||\n gteSdkVersion(exp, '50.0.0')\n ) {\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.basePath ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n } else {\n if (isExporting && exp.experiments?.basePath) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = exp.experiments?.basePath;\n }\n }\n\n const platformBundlers = getPlatformBundlers(exp);\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n routerDirectory: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n config,\n platformBundlers,\n isTsconfigPathsEnabled: !!exp.experiments?.tsconfigPaths,\n webOutput: exp.web?.output ?? 'single',\n });\n\n logEventAsync('metro config', getMetroProperties(projectRoot, exp, config));\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: Omit<MetroDevServerOptions, 'logger'>,\n { isExporting }: { isExporting: boolean }\n): Promise<{\n metro: Metro.Server;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n // TODO: When we bring expo/metro-config into the expo/expo repo, then we can upstream this.\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n skipPlugins: true,\n });\n\n const { config: metroConfig, setEventReporter } = await loadMetroConfigAsync(\n projectRoot,\n options,\n { exp, isExporting }\n );\n\n const { createDevServerMiddleware, securityHeadersMiddleware } =\n importCliServerApiFromProject(projectRoot);\n\n const { middleware, messageSocketEndpoint, eventsSocketEndpoint, websocketEndpoints } =\n createDevServerMiddleware({\n port: metroConfig.server.port,\n watchFolders: metroConfig.watchFolders,\n });\n\n // securityHeadersMiddleware does not support cross-origin requests for remote devtools to get the sourcemap.\n // We replace with the enhanced version.\n replaceMiddlewareWith(\n middleware as ConnectServer,\n securityHeadersMiddleware,\n remoteDevtoolsSecurityHeadersMiddleware\n );\n\n middleware.use(remoteDevtoolsCorsMiddleware);\n\n prependMiddleware(middleware, suppressRemoteDebuggingErrorMiddleware);\n\n middleware.use('/inspector', createJsInspectorMiddleware());\n\n // TODO: We can probably drop this now.\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: Metro.Server) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n\n middleware.use(createDebuggerTelemetryMiddleware(projectRoot, exp));\n\n const { server, metro } = await runServer(metroBundler, metroConfig, {\n hmrEnabled: true,\n // @ts-expect-error: Inconsistent `websocketEndpoints` type between metro and @react-native-community/cli-server-api\n websocketEndpoints,\n watch: isWatchEnabled(),\n });\n\n prependMiddleware(middleware, (req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n // If the URL is a Metro asset request, then we need to skip all other middleware to prevent\n // the community CLI's serve-static from hosting `/assets/index.html` in place of all assets if it exists.\n // /assets/?unstable_path=.\n if (req.url) {\n const url = new URL(req.url!, 'http://localhost:8000');\n if (url.pathname.match(/^\\/assets\\/?/) && url.searchParams.get('unstable_path') != null) {\n return metro.processRequest(req, res, next);\n }\n }\n return next();\n });\n\n setEventReporter(eventsSocketEndpoint.reportEvent);\n\n return {\n metro,\n server,\n middleware,\n messageSocket: messageSocketEndpoint,\n };\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["loadMetroConfigAsync","instantiateMetroAsync","isWatchEnabled","gteSdkVersion","exp","sdkVersion","semver","gte","Error","projectRoot","options","getConfig","skipSDKVersionRequirement","skipPlugins","isExporting","reportEvent","serverRoot","getMetroServerRoot","terminal","Terminal","process","stdout","terminalReporter","MetroTerminalReporter","reporter","update","event","ExpoMetroConfig","importExpoMetroConfig","config","loadAsync","transformer","publicPath","experiments","basePath","platformBundlers","getPlatformBundlers","withMetroMultiPlatformAsync","routerDirectory","getRouterDirectoryModuleIdWithManifest","isTsconfigPathsEnabled","tsconfigPaths","webOutput","web","output","logEventAsync","getMetroProperties","setEventReporter","logger","metroBundler","metroConfig","createDevServerMiddleware","securityHeadersMiddleware","importCliServerApiFromProject","middleware","messageSocketEndpoint","eventsSocketEndpoint","websocketEndpoints","port","server","watchFolders","replaceMiddlewareWith","remoteDevtoolsSecurityHeadersMiddleware","use","remoteDevtoolsCorsMiddleware","prependMiddleware","suppressRemoteDebuggingErrorMiddleware","createJsInspectorMiddleware","customEnhanceMiddleware","enhanceMiddleware","metroMiddleware","createDebuggerTelemetryMiddleware","metro","runServer","hmrEnabled","watch","req","res","next","url","URL","pathname","match","searchParams","get","processRequest","messageSocket","env","CI","Log","log","chalk"],"mappings":"AAAA;;;;QAoDsBA,oBAAoB,GAApBA,oBAAoB;QAqEpBC,qBAAqB,GAArBA,qBAAqB;QA6F3BC,cAAc,GAAdA,cAAc;AAtNQ,IAAA,OAAc,WAAd,cAAc,CAAA;AAElC,IAAA,MAAO,kCAAP,OAAO,EAAA;AAIA,IAAA,UAAY,WAAZ,YAAY,CAAA;AAClB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACP,IAAA,IAAK,WAAL,KAAK,CAAA;AAGa,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AACM,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACpC,IAAA,OAAU,WAAV,UAAU,CAAA;AACvC,IAAA,cAAkB,WAAlB,kBAAkB,CAAA;AACA,IAAA,uBAA0B,WAA1B,0BAA0B,CAAA;AAElD,IAAA,IAAc,WAAd,cAAc,CAAA;AACC,IAAA,mBAA6C,WAA7C,6CAA6C,CAAA;AAC9B,IAAA,wBAAkD,WAAlD,kDAAkD,CAAA;AACtE,IAAA,kBAA4C,WAA5C,4CAA4C,CAAA;AACtD,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACL,IAAA,mBAAkC,WAAlC,kCAAkC,CAAA;AAC7B,IAAA,4BAAqD,kCAArD,qDAAqD,EAAA;AACpC,IAAA,UAAy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,CAAC,CAAC;IAEnD,OAAO;QACLyD,KAAK;QACLb,MAAM,EAANA,OAAM;QACNL,UAAU;QACVgC,aAAa,EAAE/B,qBAAqB;KACrC,CAAC;CACH;AAMM,SAASrD,cAAc,GAAG;IAC/B,IAAIqF,IAAG,IAAA,CAACC,EAAE,EAAE;QACVC,IAAG,IAAA,CAACC,GAAG,CACLC,MAAK,QAAA,CAAC,8FAA8F,CAAC,CACtG,CAAC;KACH;IAED,OAAO,CAACJ,IAAG,IAAA,CAACC,EAAE,CAAC;CAChB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport * as ExpoMetroConfig from '@expo/metro-config';\nimport type { LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport { Server as ConnectServer } from 'connect';\nimport http from 'http';\nimport type Metro from 'metro';\nimport { Terminal } from 'metro-core';\nimport semver from 'semver';\nimport { URL } from 'url';\n\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { getRouterDirectoryModuleIdWithManifest } from './router';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { MetroDevServerOptions } from '../../../export/fork-bundleAsync';\nimport { Log } from '../../../log';\nimport { getMetroProperties } from '../../../utils/analytics/getMetroProperties';\nimport { createDebuggerTelemetryMiddleware } from '../../../utils/analytics/metroDebuggerMiddleware';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { env } from '../../../utils/env';\nimport { getMetroServerRoot } from '../middleware/ManifestMiddleware';\nimport createJsInspectorMiddleware from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware, replaceMiddlewareWith } from '../middleware/mutations';\nimport { remoteDevtoolsCorsMiddleware } from '../middleware/remoteDevtoolsCorsMiddleware';\nimport { remoteDevtoolsSecurityHeadersMiddleware } from '../middleware/remoteDevtoolsSecurityHeadersMiddleware';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { suppressRemoteDebuggingErrorMiddleware } from '../middleware/suppressErrorMiddleware';\nimport { getPlatformBundlers } from '../platformBundlers';\n\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\nfunction gteSdkVersion(exp: Pick<ExpoConfig, 'sdkVersion'>, sdkVersion: string): boolean {\n if (!exp.sdkVersion) {\n return false;\n }\n\n if (exp.sdkVersion === 'UNVERSIONED') {\n return true;\n }\n\n try {\n return semver.gte(exp.sdkVersion, sdkVersion);\n } catch {\n throw new Error(`${exp.sdkVersion} is not a valid version. Must be in the form of x.y.z`);\n }\n}\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\n {\n exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp,\n isExporting,\n }: { exp?: ExpoConfig; isExporting: boolean }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n const serverRoot = getMetroServerRoot(projectRoot);\n\n const terminal = new Terminal(process.stdout);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const reporter = {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n };\n\n let config = await ExpoMetroConfig.loadAsync(projectRoot, { reporter, ...options });\n\n if (\n // Requires SDK 50 for expo-assets hashAssetPlugin change.\n !exp.sdkVersion ||\n gteSdkVersion(exp, '50.0.0')\n ) {\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n } else {\n if (isExporting && exp.experiments?.baseUrl) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = exp.experiments?.baseUrl;\n }\n }\n\n const platformBundlers = getPlatformBundlers(exp);\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n routerDirectory: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n config,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n webOutput: exp.web?.output ?? 'single',\n isFastResolverEnabled: env.EXPO_USE_FAST_RESOLVER,\n isExporting,\n });\n\n if (process.env.NODE_ENV !== 'test') {\n logEventAsync('metro config', getMetroProperties(projectRoot, exp, config));\n }\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: Omit<MetroDevServerOptions, 'logger'>,\n { isExporting }: { isExporting: boolean }\n): Promise<{\n metro: Metro.Server;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n // TODO: When we bring expo/metro-config into the expo/expo repo, then we can upstream this.\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n });\n\n const { config: metroConfig, setEventReporter } = await loadMetroConfigAsync(\n projectRoot,\n options,\n { exp, isExporting }\n );\n\n const { createDevServerMiddleware, securityHeadersMiddleware } =\n require('@react-native-community/cli-server-api') as typeof import('@react-native-community/cli-server-api');\n\n const { middleware, messageSocketEndpoint, eventsSocketEndpoint, websocketEndpoints } =\n createDevServerMiddleware({\n port: metroConfig.server.port,\n watchFolders: metroConfig.watchFolders,\n });\n\n // securityHeadersMiddleware does not support cross-origin requests for remote devtools to get the sourcemap.\n // We replace with the enhanced version.\n replaceMiddlewareWith(\n middleware as ConnectServer,\n securityHeadersMiddleware,\n remoteDevtoolsSecurityHeadersMiddleware\n );\n\n middleware.use(remoteDevtoolsCorsMiddleware);\n\n prependMiddleware(middleware, suppressRemoteDebuggingErrorMiddleware);\n\n middleware.use('/inspector', createJsInspectorMiddleware());\n\n // TODO: We can probably drop this now.\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: Metro.Server) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n\n middleware.use(createDebuggerTelemetryMiddleware(projectRoot, exp));\n\n const { server, metro } = await runServer(metroBundler, metroConfig, {\n // @ts-expect-error: Inconsistent `websocketEndpoints` type between metro and @react-native-community/cli-server-api\n websocketEndpoints,\n watch: !isExporting && isWatchEnabled(),\n });\n\n prependMiddleware(middleware, (req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n // If the URL is a Metro asset request, then we need to skip all other middleware to prevent\n // the community CLI's serve-static from hosting `/assets/index.html` in place of all assets if it exists.\n // /assets/?unstable_path=.\n if (req.url) {\n const url = new URL(req.url!, 'http://localhost:8000');\n if (url.pathname.match(/^\\/assets\\/?/) && url.searchParams.get('unstable_path') != null) {\n return metro.processRequest(req, res, next);\n }\n }\n return next();\n });\n\n setEventReporter(eventsSocketEndpoint.reportEvent);\n\n return {\n metro,\n server,\n middleware,\n messageSocket: messageSocketEndpoint,\n };\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["loadMetroConfigAsync","instantiateMetroAsync","isWatchEnabled","ExpoMetroConfig","gteSdkVersion","exp","sdkVersion","semver","gte","Error","projectRoot","options","getConfig","skipSDKVersionRequirement","isExporting","reportEvent","serverRoot","getMetroServerRoot","terminal","Terminal","process","stdout","terminalReporter","MetroTerminalReporter","reporter","update","event","config","loadAsync","transformer","publicPath","experiments","baseUrl","platformBundlers","getPlatformBundlers","withMetroMultiPlatformAsync","routerDirectory","getRouterDirectoryModuleIdWithManifest","isTsconfigPathsEnabled","tsconfigPaths","webOutput","web","output","isFastResolverEnabled","env","EXPO_USE_FAST_RESOLVER","NODE_ENV","logEventAsync","getMetroProperties","setEventReporter","logger","metroBundler","metroConfig","createDevServerMiddleware","securityHeadersMiddleware","require","middleware","messageSocketEndpoint","eventsSocketEndpoint","websocketEndpoints","port","server","watchFolders","replaceMiddlewareWith","remoteDevtoolsSecurityHeadersMiddleware","use","remoteDevtoolsCorsMiddleware","prependMiddleware","suppressRemoteDebuggingErrorMiddleware","createJsInspectorMiddleware","customEnhanceMiddleware","enhanceMiddleware","metroMiddleware","createDebuggerTelemetryMiddleware","metro","runServer","watch","req","res","next","url","URL","pathname","match","searchParams","get","processRequest","messageSocket","CI","Log","log","chalk"],"mappings":"AAAA;;;;QAoDsBA,oBAAoB,GAApBA,oBAAoB;QAwEpBC,qBAAqB,GAArBA,qBAAqB;QA2F3BC,cAAc,GAAdA,cAAc;AAvNQ,IAAA,OAAc,WAAd,cAAc,CAAA;AACxCC,IAAAA,eAAe,mCAAM,oBAAoB,EAA1B;AAET,IAAA,MAAO,kCAAP,OAAO,EAAA;AAIA,IAAA,UAAY,WAAZ,YAAY,CAAA;AAClB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACP,IAAA,IAAK,WAAL,KAAK,CAAA;AAGa,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AACR,IAAA,OAAU,WAAV,UAAU,CAAA;AACvC,IAAA,cAAkB,WAAlB,kBAAkB,CAAA;AACA,IAAA,uBAA0B,WAA1B,0BAA0B,CAAA;AAElD,IAAA,IAAc,WAAd,cAAc,CAAA;AACC,IAAA,mBAA6C,WAA7C,6CAA6C,CAAA;AAC9B,IAAA,wBAAkD,WAAlD,kDAAkD,CAAA;AACtE,IAAA,kBAA4C,WAA5C,4CAA4C,CAAA;AACtD,IAAA,IAAoB,WAApB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AG,EAAEC,IAAI,CAAC,CAAC;aAC7C;SACF;QACD,OAAOA,IAAI,EAAE,CAAC;KACf,CAAC,CAAC;IAEH9B,gBAAgB,CAACS,oBAAoB,CAAC3C,WAAW,CAAC,CAAC;IAEnD,OAAO;QACL2D,KAAK;QACLb,MAAM,EAANA,OAAM;QACNL,UAAU;QACV+B,aAAa,EAAE9B,qBAAqB;KACrC,CAAC;CACH;AAMM,SAASvD,cAAc,GAAG;IAC/B,IAAI0C,IAAG,IAAA,CAAC4C,EAAE,EAAE;QACVC,IAAG,IAAA,CAACC,GAAG,CACLC,MAAK,QAAA,CAAC,8FAA8F,CAAC,CACtG,CAAC;KACH;IAED,OAAO,CAAC/C,IAAG,IAAA,CAAC4C,EAAE,CAAC;CAChB"}
|
|
@@ -38,7 +38,8 @@ async function logMetroErrorWithStack(projectRoot, { stack , codeFrame , error
|
|
|
38
38
|
var ref;
|
|
39
39
|
const maxWarningLineLength = Math.max(200, process.stdout.columns);
|
|
40
40
|
const lineText = codeFrame.content;
|
|
41
|
-
const isPreviewTooLong =
|
|
41
|
+
const isPreviewTooLong = codeFrame.content.split("\n").some((line)=>line.length > maxWarningLineLength
|
|
42
|
+
);
|
|
42
43
|
const column = (ref = codeFrame.location) == null ? void 0 : ref.column;
|
|
43
44
|
// When the preview is too long, we skip reading the file and attempting to apply
|
|
44
45
|
// code coloring, this is because it can get very slow.
|
|
@@ -188,7 +189,7 @@ async function getErrorOverlayHtmlAsync({ error , projectRoot }) {
|
|
|
188
189
|
dev: true,
|
|
189
190
|
platform: "web",
|
|
190
191
|
minify: false,
|
|
191
|
-
|
|
192
|
+
baseUrl: ""
|
|
192
193
|
});
|
|
193
194
|
const htmlWithJs = html.replace("</body>", `<script src=${errorOverlayEntry}></script></body>`);
|
|
194
195
|
return htmlWithJs;
|