@expo/cli 0.14.0 → 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 +5 -4
- 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/customize/typescript.js +3 -1
- 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/resolveOptions.js +3 -3
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +69 -80
- 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 +4 -4
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +55 -20
- 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 +12 -10
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +9 -7
- 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/writeContents.js +3 -2
- 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/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/prebuildAsync.js +37 -15
- 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/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/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 -23
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +48 -64
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +4 -3
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +62 -45
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- 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/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 +32 -10
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +4 -1
- 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 +261 -201
- 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 +15 -66
- 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/type-generation/__typetests__/fixtures/basic.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 +1 -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 +3 -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/package.json +15 -14
- package/static/shims/react-native-web/dist/cjs/exports/AppRegistry/AppContainer.js +13 -0
- package/static/shims/react-native-web/dist/exports/AppRegistry/AppContainer.js +12 -0
- package/build/src/start/server/metro/resolveFromProject.js +0 -90
- package/build/src/start/server/metro/resolveFromProject.js.map +0 -1
|
@@ -14,6 +14,7 @@ var _fetchRouterManifest = require("./fetchRouterManifest");
|
|
|
14
14
|
var _instantiateMetro = require("./instantiateMetro");
|
|
15
15
|
var _metroWatchTypeScriptFiles = require("./metroWatchTypeScriptFiles");
|
|
16
16
|
var _router = require("./router");
|
|
17
|
+
var _serializeHtml = require("./serializeHtml");
|
|
17
18
|
var _waitForMetroToObserveTypeScriptFile = require("./waitForMetroToObserveTypeScriptFile");
|
|
18
19
|
var _log = require("../../../log");
|
|
19
20
|
var _getDevClientProperties = _interopRequireDefault(require("../../../utils/analytics/getDevClientProperties"));
|
|
@@ -24,6 +25,7 @@ var _bundlerDevServer = require("../BundlerDevServer");
|
|
|
24
25
|
var _getStaticRenderFunctions = require("../getStaticRenderFunctions");
|
|
25
26
|
var _contextModuleSourceMapsMiddleware = require("../middleware/ContextModuleSourceMapsMiddleware");
|
|
26
27
|
var _createFileMiddleware = require("../middleware/CreateFileMiddleware");
|
|
28
|
+
var _devToolsPluginMiddleware = require("../middleware/DevToolsPluginMiddleware");
|
|
27
29
|
var _faviconMiddleware = require("../middleware/FaviconMiddleware");
|
|
28
30
|
var _historyFallbackMiddleware = require("../middleware/HistoryFallbackMiddleware");
|
|
29
31
|
var _interstitialPageMiddleware = require("../middleware/InterstitialPageMiddleware");
|
|
@@ -31,6 +33,7 @@ var _manifestMiddleware = require("../middleware/ManifestMiddleware");
|
|
|
31
33
|
var _reactDevToolsPageMiddleware = require("../middleware/ReactDevToolsPageMiddleware");
|
|
32
34
|
var _runtimeRedirectMiddleware = require("../middleware/RuntimeRedirectMiddleware");
|
|
33
35
|
var _serveStaticMiddleware = require("../middleware/ServeStaticMiddleware");
|
|
36
|
+
var _metroOptions = require("../middleware/metroOptions");
|
|
34
37
|
var _mutations = require("../middleware/mutations");
|
|
35
38
|
var _startTypescriptTypeGeneration = require("../type-generation/startTypescriptTypeGeneration");
|
|
36
39
|
function _interopRequireDefault(obj) {
|
|
@@ -82,17 +85,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
82
85
|
(options.devClient ? Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT : await (0, _port).getFreePortAsync(EXPO_GO_METRO_PORT));
|
|
83
86
|
return port;
|
|
84
87
|
}
|
|
85
|
-
async
|
|
86
|
-
const manifest = await (0, _fetchRouterManifest).fetchManifest(this.projectRoot, {
|
|
87
|
-
asJson: true,
|
|
88
|
-
appDir
|
|
89
|
-
});
|
|
90
|
-
if (!manifest) {
|
|
91
|
-
throw new _errors.CommandError("EXPO_ROUTER_SERVER_MANIFEST", "Unexpected error: server manifest could not be fetched.");
|
|
92
|
-
}
|
|
93
|
-
return manifest;
|
|
94
|
-
}
|
|
95
|
-
async exportExpoRouterApiRoutesAsync({ mode , appDir , outputDir }) {
|
|
88
|
+
async exportExpoRouterApiRoutesAsync({ mode , appDir , outputDir , prerenderManifest , baseUrl }) {
|
|
96
89
|
const manifest = await this.getExpoRouterRoutesManifestAsync({
|
|
97
90
|
appDir
|
|
98
91
|
});
|
|
@@ -104,7 +97,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
104
97
|
mode,
|
|
105
98
|
appDir,
|
|
106
99
|
port: (ref = this.getInstance()) == null ? void 0 : ref.location.port,
|
|
107
|
-
shouldThrow: true
|
|
100
|
+
shouldThrow: true,
|
|
101
|
+
baseUrl
|
|
108
102
|
});
|
|
109
103
|
const artifactFilename = _path.default.join(outputDir, _path.default.relative(appDir, filepath.replace(/\.[tj]sx?$/, ".js")));
|
|
110
104
|
files.set(artifactFilename, contents);
|
|
@@ -112,31 +106,35 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
112
106
|
route.file = artifactFilename;
|
|
113
107
|
}
|
|
114
108
|
return {
|
|
115
|
-
manifest
|
|
109
|
+
manifest: {
|
|
110
|
+
...manifest,
|
|
111
|
+
htmlRoutes: prerenderManifest.htmlRoutes
|
|
112
|
+
},
|
|
116
113
|
files
|
|
117
114
|
};
|
|
118
115
|
}
|
|
119
|
-
async
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return htmlFromSerialAssets(resources, {
|
|
125
|
-
dev: isDev,
|
|
126
|
-
template,
|
|
127
|
-
basePath,
|
|
128
|
-
bundleUrl: isDev ? devBundleUrl : undefined
|
|
116
|
+
async getExpoRouterRoutesManifestAsync({ appDir }) {
|
|
117
|
+
// getBuiltTimeServerManifest
|
|
118
|
+
const manifest = await (0, _fetchRouterManifest).fetchManifest(this.projectRoot, {
|
|
119
|
+
asJson: true,
|
|
120
|
+
appDir
|
|
129
121
|
});
|
|
122
|
+
if (!manifest) {
|
|
123
|
+
throw new _errors.CommandError("EXPO_ROUTER_SERVER_MANIFEST", "Unexpected error: server manifest could not be fetched.");
|
|
124
|
+
}
|
|
125
|
+
return manifest;
|
|
130
126
|
}
|
|
131
|
-
async getStaticRenderFunctionAsync({ mode , minify =mode !== "development" }) {
|
|
127
|
+
async getStaticRenderFunctionAsync({ mode , minify =mode !== "development" , baseUrl }) {
|
|
132
128
|
const url = this.getDevServerUrl();
|
|
133
|
-
const { getStaticContent , getManifest } = await (0, _getStaticRenderFunctions).getStaticRenderFunctions(this.projectRoot, url, {
|
|
129
|
+
const { getStaticContent , getManifest , getBuildTimeServerManifestAsync } = await (0, _getStaticRenderFunctions).getStaticRenderFunctions(this.projectRoot, url, {
|
|
134
130
|
minify,
|
|
135
131
|
dev: mode !== "production",
|
|
136
132
|
// Ensure the API Routes are included
|
|
137
|
-
environment: "node"
|
|
133
|
+
environment: "node",
|
|
134
|
+
baseUrl
|
|
138
135
|
});
|
|
139
136
|
return {
|
|
137
|
+
serverManifest: await getBuildTimeServerManifestAsync(),
|
|
140
138
|
// Get routes from Expo Router.
|
|
141
139
|
manifest: await getManifest({
|
|
142
140
|
fetchData: true,
|
|
@@ -148,25 +146,25 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
148
146
|
}
|
|
149
147
|
};
|
|
150
148
|
}
|
|
151
|
-
async getStaticResourcesAsync({ mode , minify =mode !== "development" , includeMaps }) {
|
|
149
|
+
async getStaticResourcesAsync({ mode , minify =mode !== "development" , includeMaps , baseUrl , mainModuleName }) {
|
|
152
150
|
var ref;
|
|
153
|
-
const devBundleUrlPathname = (0,
|
|
151
|
+
const devBundleUrlPathname = (0, _metroOptions).createBundleUrlPath({
|
|
154
152
|
platform: "web",
|
|
155
153
|
mode,
|
|
156
154
|
minify,
|
|
157
155
|
environment: "client",
|
|
158
156
|
serializerOutput: "static",
|
|
159
157
|
serializerIncludeMaps: includeMaps,
|
|
160
|
-
mainModuleName: (0, _manifestMiddleware).resolveMainModuleName(this.projectRoot, {
|
|
158
|
+
mainModuleName: mainModuleName != null ? mainModuleName : (0, _manifestMiddleware).resolveMainModuleName(this.projectRoot, {
|
|
161
159
|
platform: "web"
|
|
162
160
|
}),
|
|
163
|
-
lazy: (0,
|
|
161
|
+
lazy: (0, _metroOptions).shouldEnableAsyncImports(this.projectRoot),
|
|
162
|
+
baseUrl
|
|
164
163
|
});
|
|
165
164
|
const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl());
|
|
166
165
|
// Fetch the generated HTML from our custom Metro serializer
|
|
167
166
|
const results = await (0, _nodeFetch).default(bundleUrl.toString());
|
|
168
167
|
const txt = await results.text();
|
|
169
|
-
// console.log('STAT:', results.status, results.statusText);
|
|
170
168
|
let data;
|
|
171
169
|
try {
|
|
172
170
|
data = JSON.parse(txt);
|
|
@@ -180,7 +178,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
180
178
|
throw error;
|
|
181
179
|
}
|
|
182
180
|
// NOTE: This could potentially need more validation in the future.
|
|
183
|
-
if (Array.isArray(data)) {
|
|
181
|
+
if ("artifacts" in data && Array.isArray(data.artifacts)) {
|
|
184
182
|
return data;
|
|
185
183
|
}
|
|
186
184
|
if (data != null && (data.errors || ((ref = data.type) == null ? void 0 : ref.match(/.*Error$/)))) {
|
|
@@ -205,39 +203,42 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
205
203
|
}
|
|
206
204
|
throw new Error("Invalid resources returned from the Metro serializer. Expected array, found: " + data);
|
|
207
205
|
}
|
|
208
|
-
async getStaticPageAsync(pathname, { mode , minify =mode !== "development" ,
|
|
209
|
-
const devBundleUrlPathname = (0,
|
|
206
|
+
async getStaticPageAsync(pathname, { mode , minify =mode !== "development" , baseUrl }) {
|
|
207
|
+
const devBundleUrlPathname = (0, _metroOptions).createBundleUrlPath({
|
|
210
208
|
platform: "web",
|
|
211
209
|
mode,
|
|
212
210
|
environment: "client",
|
|
213
211
|
mainModuleName: (0, _manifestMiddleware).resolveMainModuleName(this.projectRoot, {
|
|
214
212
|
platform: "web"
|
|
215
213
|
}),
|
|
216
|
-
lazy: (0,
|
|
214
|
+
lazy: (0, _metroOptions).shouldEnableAsyncImports(this.projectRoot),
|
|
215
|
+
baseUrl
|
|
217
216
|
});
|
|
218
217
|
const bundleStaticHtml = async ()=>{
|
|
219
218
|
const { getStaticContent } = await (0, _getStaticRenderFunctions).getStaticRenderFunctions(this.projectRoot, this.getDevServerUrl(), {
|
|
220
219
|
minify: false,
|
|
221
220
|
dev: mode !== "production",
|
|
222
221
|
// Ensure the API Routes are included
|
|
223
|
-
environment: "node"
|
|
222
|
+
environment: "node",
|
|
223
|
+
baseUrl
|
|
224
224
|
});
|
|
225
225
|
const location = new URL(pathname, this.getDevServerUrl());
|
|
226
226
|
return await getStaticContent(location);
|
|
227
227
|
};
|
|
228
|
-
const [resources, staticHtml] = await Promise.all([
|
|
228
|
+
const [{ artifacts: resources }, staticHtml] = await Promise.all([
|
|
229
229
|
this.getStaticResourcesAsync({
|
|
230
230
|
mode,
|
|
231
|
-
minify
|
|
231
|
+
minify,
|
|
232
|
+
baseUrl
|
|
232
233
|
}),
|
|
233
234
|
bundleStaticHtml(),
|
|
234
235
|
]);
|
|
235
|
-
const content =
|
|
236
|
+
const content = (0, _serializeHtml).serializeHtmlWithAssets({
|
|
236
237
|
mode,
|
|
237
238
|
resources,
|
|
238
239
|
template: staticHtml,
|
|
239
240
|
devBundleUrl: devBundleUrlPathname,
|
|
240
|
-
|
|
241
|
+
baseUrl
|
|
241
242
|
});
|
|
242
243
|
return {
|
|
243
244
|
content,
|
|
@@ -299,6 +300,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
299
300
|
scheme: (_scheme = options.location.scheme) != null ? _scheme : null
|
|
300
301
|
}).getHandler());
|
|
301
302
|
middleware.use(new _reactDevToolsPageMiddleware.ReactDevToolsPageMiddleware(this.projectRoot).getHandler());
|
|
303
|
+
middleware.use(new _devToolsPluginMiddleware.DevToolsPluginMiddleware(this.projectRoot, this.devToolsPluginManager).getHandler());
|
|
302
304
|
const deepLinkMiddleware = new _runtimeRedirectMiddleware.RuntimeRedirectMiddleware(this.projectRoot, {
|
|
303
305
|
onDeepLink: getDeepLinkHandler(this.projectRoot),
|
|
304
306
|
getLocation: ({ runtime })=>{
|
|
@@ -332,25 +334,26 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
332
334
|
middleware.use(new _faviconMiddleware.FaviconMiddleware(this.projectRoot).getHandler());
|
|
333
335
|
if (useServerRendering) {
|
|
334
336
|
var ref2;
|
|
337
|
+
const baseUrl = (0, _metroOptions).getBaseUrlFromExpoConfig(exp);
|
|
335
338
|
const appDir = (0, _router).getRouterDirectoryWithManifest(this.projectRoot, exp);
|
|
336
339
|
middleware.use((0, _createServerRouteMiddleware).createRouteHandlerMiddleware(this.projectRoot, {
|
|
337
340
|
...options,
|
|
338
341
|
appDir,
|
|
342
|
+
baseUrl,
|
|
339
343
|
getWebBundleUrl: manifestMiddleware.getWebBundleUrl.bind(manifestMiddleware),
|
|
340
344
|
getStaticPageAsync: (pathname)=>{
|
|
341
345
|
var _mode;
|
|
342
346
|
return this.getStaticPageAsync(pathname, {
|
|
343
347
|
mode: (_mode = options.mode) != null ? _mode : "development",
|
|
344
348
|
minify: options.minify,
|
|
345
|
-
|
|
346
|
-
basePath: ""
|
|
349
|
+
baseUrl
|
|
347
350
|
});
|
|
348
351
|
}
|
|
349
352
|
}));
|
|
350
353
|
// @ts-expect-error: TODO
|
|
351
354
|
if (((ref2 = exp.web) == null ? void 0 : ref2.output) === "server") {
|
|
352
355
|
// Cache observation for API Routes...
|
|
353
|
-
(0, _waitForMetroToObserveTypeScriptFile).observeApiRouteChanges(
|
|
356
|
+
(0, _waitForMetroToObserveTypeScriptFile).observeApiRouteChanges(appDir, {
|
|
354
357
|
metro,
|
|
355
358
|
server
|
|
356
359
|
}, async (filepath, op)=>{
|
|
@@ -359,7 +362,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
359
362
|
if (op === "change" || op === "add") {
|
|
360
363
|
(0, _bundleApiRoutes).rebundleApiRoute(this.projectRoot, filepath, {
|
|
361
364
|
...options,
|
|
362
|
-
appDir
|
|
365
|
+
appDir,
|
|
366
|
+
baseUrl
|
|
363
367
|
});
|
|
364
368
|
}
|
|
365
369
|
if (op === "delete") {
|
|
@@ -469,25 +473,5 @@ function getDeepLinkHandler(projectRoot) {
|
|
|
469
473
|
});
|
|
470
474
|
};
|
|
471
475
|
}
|
|
472
|
-
function htmlFromSerialAssets(assets, { dev , template , basePath , bundleUrl }) {
|
|
473
|
-
// Combine the CSS modules into tags that have hot refresh data attributes.
|
|
474
|
-
const styleString = assets.filter((asset)=>asset.type === "css"
|
|
475
|
-
).map(({ metadata , filename , source })=>{
|
|
476
|
-
if (dev) {
|
|
477
|
-
return `<style data-expo-css-hmr="${metadata.hmrId}">` + source + "\n</style>";
|
|
478
|
-
} else {
|
|
479
|
-
return [
|
|
480
|
-
`<link rel="preload" href="${basePath}/${filename}" as="style">`,
|
|
481
|
-
`<link rel="stylesheet" href="${basePath}/${filename}">`,
|
|
482
|
-
].join("");
|
|
483
|
-
}
|
|
484
|
-
}).join("");
|
|
485
|
-
const jsAssets = assets.filter((asset)=>asset.type === "js"
|
|
486
|
-
);
|
|
487
|
-
const scripts = bundleUrl ? `<script src="${bundleUrl}" defer></script>` : jsAssets.map(({ filename })=>{
|
|
488
|
-
return `<script src="${basePath}/${filename}" defer></script>`;
|
|
489
|
-
}).join("");
|
|
490
|
-
return template.replace("</head>", `${styleString}</head>`).replace("</body>", `${scripts}\n</body>`);
|
|
491
|
-
}
|
|
492
476
|
|
|
493
477
|
//# sourceMappingURL=MetroBundlerDevServer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\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 */\nimport { getConfig } from '@expo/config';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { bundleApiRoute, rebundleApiRoute } from './bundleApiRoutes';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport { getRouterDirectoryWithManifest, isApiRouteConvention } from './router';\nimport { observeApiRouteChanges, observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { FaviconMiddleware } from '../middleware/FaviconMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport {\n createBundleUrlPath,\n resolveMainModuleName,\n shouldEnableAsyncImports,\n} from '../middleware/ManifestMiddleware';\nimport { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nexport class ForwardHtmlError extends CommandError {\n constructor(\n message: string,\n public html: string,\n public statusCode: number\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n async getExpoRouterRoutesManifestAsync({ appDir }: { appDir: string }) {\n const manifest = await fetchManifest(this.projectRoot, {\n asJson: true,\n appDir,\n });\n\n if (!manifest) {\n throw new CommandError(\n 'EXPO_ROUTER_SERVER_MANIFEST',\n 'Unexpected error: server manifest could not be fetched.'\n );\n }\n\n return manifest;\n }\n\n async exportExpoRouterApiRoutesAsync({\n mode,\n appDir,\n outputDir,\n }: {\n mode: 'development' | 'production';\n appDir: string;\n outputDir: string;\n }) {\n const manifest = await this.getExpoRouterRoutesManifestAsync({\n appDir,\n });\n\n const files: Map<string, string> = new Map();\n\n for (const route of manifest.apiRoutes) {\n const filepath = path.join(appDir, route.file);\n const contents = await bundleApiRoute(this.projectRoot, filepath, {\n mode,\n appDir,\n port: this.getInstance()?.location.port,\n shouldThrow: true,\n });\n const artifactFilename = path.join(\n outputDir,\n path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js'))\n );\n files.set(artifactFilename, contents!);\n // Remap the manifest files to represent the output files.\n route.file = artifactFilename;\n }\n\n return { manifest, files };\n }\n\n async composeResourcesWithHtml({\n mode,\n resources,\n template,\n devBundleUrl,\n basePath,\n }: {\n mode: 'development' | 'production';\n resources: SerialAsset[];\n template: string;\n /** asset prefix used for deploying to non-standard origins like GitHub pages. */\n basePath: string;\n devBundleUrl?: string;\n }): Promise<string> {\n if (!resources) {\n return '';\n }\n const isDev = mode === 'development';\n return htmlFromSerialAssets(resources, {\n dev: isDev,\n template,\n basePath,\n bundleUrl: isDev ? devBundleUrl : undefined,\n });\n }\n\n async getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n }) {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest } = await getStaticRenderFunctions(\n this.projectRoot,\n url,\n {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n }\n );\n return {\n // Get routes from Expo Router.\n manifest: await getManifest({ fetchData: true, preserveApiRoutes: false }),\n // Get route generating function\n async renderAsync(path: string) {\n return await getStaticContent(new URL(path, url));\n },\n };\n }\n\n async getStaticResourcesAsync({\n mode,\n minify = mode !== 'development',\n includeMaps,\n }: {\n mode: string;\n minify?: boolean;\n includeMaps?: boolean;\n }): Promise<SerialAsset[]> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeMaps,\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n // console.log('STAT:', results.status, results.statusText);\n let data: any;\n try {\n data = JSON.parse(txt);\n } catch (error: any) {\n debug(txt);\n\n // Metro can throw this error when the initial module id cannot be resolved.\n if (!results.ok && txt.startsWith('<!DOCTYPE html>')) {\n throw new ForwardHtmlError(\n `Metro failed to bundle the project. Check the console for more information.`,\n txt,\n results.status\n );\n }\n\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n throw error;\n }\n\n // NOTE: This could potentially need more validation in the future.\n if (Array.isArray(data)) {\n return data;\n }\n\n if (data != null && (data.errors || data.type?.match(/.*Error$/))) {\n // {\n // type: 'InternalError',\n // errors: [],\n // message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\\n' +\n // '\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\\n' +\n // '\\n' +\n // '\\x1B[0m \\x1B[90m 287 |\\x1B[39m }\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 288 |\\x1B[39m \\x1B[36mif\\x1B[39m (error \\x1B[36minstanceof\\x1B[39m \\x1B[33mInvalidPackageError\\x1B[39m) {\\x1B[0m\\n' +\n // '\\x1B[0m\\x1B[31m\\x1B[1m>\\x1B[22m\\x1B[39m\\x1B[90m 289 |\\x1B[39m \\x1B[36mthrow\\x1B[39m \\x1B[36mnew\\x1B[39m \\x1B[33mPackageResolutionError\\x1B[39m({\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m |\\x1B[39m \\x1B[31m\\x1B[1m^\\x1B[22m\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 290 |\\x1B[39m packageError\\x1B[33m:\\x1B[39m error\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 291 |\\x1B[39m originModulePath\\x1B[33m:\\x1B[39m \\x1B[36mfrom\\x1B[39m\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 292 |\\x1B[39m targetModuleName\\x1B[33m:\\x1B[39m to\\x1B[33m,\\x1B[39m\\x1B[0m'\n // }\n // The Metro logger already showed this error.\n throw new Error(data.message);\n }\n\n throw new Error(\n 'Invalid resources returned from the Metro serializer. Expected array, found: ' + data\n );\n }\n\n async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n basePath,\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n basePath: string;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [resources, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ mode, minify }),\n bundleStaticHtml(),\n ]);\n const content = await this.composeResourcesWithHtml({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n basePath,\n });\n return {\n content,\n resources,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n\n // Use the unversioned metro config.\n // TODO: Deprecate this property when expo-cli goes away.\n unversioned: false,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n }\n );\n\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n onDeepLink: getDeepLinkHandler(this.projectRoot),\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n middleware.use(new CreateFileMiddleware(this.projectRoot).getHandler());\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n const { exp } = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.\n middleware.use(new FaviconMiddleware(this.projectRoot).getHandler());\n\n if (useServerRendering) {\n const appDir = getRouterDirectoryWithManifest(this.projectRoot, exp);\n middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n ...options,\n appDir,\n getWebBundleUrl: manifestMiddleware.getWebBundleUrl.bind(manifestMiddleware),\n getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname, {\n mode: options.mode ?? 'development',\n minify: options.minify,\n // No base path in development\n basePath: '',\n });\n },\n })\n );\n\n // @ts-expect-error: TODO\n if (exp.web?.output === 'server') {\n // Cache observation for API Routes...\n observeApiRouteChanges(\n this.projectRoot,\n {\n metro,\n server,\n },\n async (filepath, op) => {\n if (isApiRouteConvention(filepath)) {\n debug(`[expo-cli] ${op} ${filepath}`);\n if (op === 'change' || op === 'add') {\n rebundleApiRoute(this.projectRoot, filepath, {\n ...options,\n appDir,\n });\n }\n\n if (op === 'delete') {\n // TODO: Cancel the bundling of the deleted route.\n }\n }\n }\n );\n }\n } else {\n // This MUST run last since it's the fallback.\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\n return {\n server,\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware,\n messageSocket,\n };\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite.js'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n return startTypescriptTypeGenerationAsync({\n server: this.instance?.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n}\n\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n\nfunction htmlFromSerialAssets(\n assets: SerialAsset[],\n {\n dev,\n template,\n basePath,\n bundleUrl,\n }: {\n dev: boolean;\n template: string;\n basePath: string;\n /** This is dev-only. */\n bundleUrl?: string;\n }\n) {\n // Combine the CSS modules into tags that have hot refresh data attributes.\n const styleString = assets\n .filter((asset) => asset.type === 'css')\n .map(({ metadata, filename, source }) => {\n if (dev) {\n return `<style data-expo-css-hmr=\"${metadata.hmrId}\">` + source + '\\n</style>';\n } else {\n return [\n `<link rel=\"preload\" href=\"${basePath}/${filename}\" as=\"style\">`,\n `<link rel=\"stylesheet\" href=\"${basePath}/${filename}\">`,\n ].join('');\n }\n })\n .join('');\n\n const jsAssets = assets.filter((asset) => asset.type === 'js');\n\n const scripts = bundleUrl\n ? `<script src=\"${bundleUrl}\" defer></script>`\n : jsAssets\n .map(({ filename }) => {\n return `<script src=\"${basePath}/${filename}\" defer></script>`;\n })\n .join('');\n\n return template\n .replace('</head>', `${styleString}</head>`)\n .replace('</body>', `${scripts}\\n</body>`);\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","ForwardHtmlError","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","getExpoRouterRoutesManifestAsync","appDir","manifest","fetchManifest","projectRoot","asJson","exportExpoRouterApiRoutesAsync","mode","outputDir","files","Map","route","apiRoutes","filepath","path","join","file","contents","bundleApiRoute","getInstance","location","shouldThrow","artifactFilename","relative","replace","set","composeResourcesWithHtml","resources","template","devBundleUrl","basePath","isDev","htmlFromSerialAssets","dev","bundleUrl","undefined","getStaticRenderFunctionAsync","minify","url","getDevServerUrl","getStaticContent","getManifest","getStaticRenderFunctions","environment","fetchData","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","includeMaps","data","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","serializerIncludeMaps","mainModuleName","resolveMainModuleName","lazy","shouldEnableAsyncImports","results","fetch","toString","txt","text","JSON","parse","error","ok","startsWith","status","Log","Array","isArray","errors","type","match","Error","getStaticPageAsync","pathname","bundleStaticHtml","staticHtml","Promise","all","content","watchEnvironmentVariables","instance","envFiles","getFiles","NODE_ENV","map","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","unversioned","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","isExporting","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","getConfig","skipSDKVersionRequirement","useServerRendering","includes","web","output","ServeStaticMiddleware","FaviconMiddleware","getRouterDirectoryWithManifest","createRouteHandlerMiddleware","getWebBundleUrl","bind","observeApiRouteChanges","op","isApiRouteConvention","rebundleApiRoute","HistoryFallbackMiddleware","internal","originalClose","close","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","logEventAsync","getDevClientProperties","assets","styleString","filter","asset","metadata","filename","source","hmrId","jsAssets","scripts"],"mappings":"AAMA;;;;QAmjBgBA,kBAAkB,GAAlBA,kBAAkB;AAnjBR,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEJ,IAAA,MAAO,kCAAP,OAAO,EAAA;AACP,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AAE0B,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACvB,IAAA,4BAA+B,WAA/B,+BAA+B,CAAA;AAC9C,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AACf,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AAChB,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AACF,IAAA,OAAU,WAAV,UAAU,CAAA;AACpB,IAAA,oCAAuC,WAAvC,uCAAuC,CAAA;AAC9E,IAAA,IAAc,WAAd,cAAc,CAAA;AACC,IAAA,uBAAiD,kCAAjD,iDAAiD,EAAA;AACtD,IAAA,kBAA4C,WAA5C,4CAA4C,CAAA;AAC7C,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACnB,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACmB,IAAA,iBAAqB,WAArB,qBAAqB,CAAA;AACrD,IAAA,yBAA6B,WAA7B,6BAA6B,CAAA;AACpB,IAAA,kCAAiD,WAAjD,iDAAiD,CAAA;AAC9D,IAAA,qBAAoC,WAApC,oCAAoC,CAAA;AACvC,IAAA,kBAAiC,WAAjC,iCAAiC,CAAA;AACzB,IAAA,0BAAyC,WAAzC,yCAAyC,CAAA;AACxC,IAAA,2BAA0C,WAA1C,0CAA0C,CAAA;AAK9E,IAAA,mBAAkC,WAAlC,kCAAkC,CAAA;AACG,IAAA,4BAA2C,WAA3C,2CAA2C,CA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B,OAAO,CAAC,aAAa,EAAElJ,QAAQ,CAAC,CAAC,EAAEkJ,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KAChE,CAAC,CACDjK,IAAI,CAAC,EAAE,CAAC,AAAC;IAEhB,OAAOa,QAAQ,CACZJ,OAAO,CAAC,SAAS,EAAE,CAAC,EAAEoJ,WAAW,CAAC,OAAO,CAAC,CAAC,CAC3CpJ,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE4J,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;CAC9C"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\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 */\nimport { getConfig } from '@expo/config';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport { AssetData } from 'metro';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { bundleApiRoute, rebundleApiRoute } from './bundleApiRoutes';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport { getRouterDirectoryWithManifest, isApiRouteConvention } from './router';\nimport { serializeHtmlWithAssets } from './serializeHtml';\nimport { observeApiRouteChanges, observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { DevToolsPluginMiddleware } from '../middleware/DevToolsPluginMiddleware';\nimport { FaviconMiddleware } from '../middleware/FaviconMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport { resolveMainModuleName } from '../middleware/ManifestMiddleware';\nimport { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n shouldEnableAsyncImports,\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n} from '../middleware/metroOptions';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nexport class ForwardHtmlError extends CommandError {\n constructor(\n message: string,\n public html: string,\n public statusCode: number\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n async exportExpoRouterApiRoutesAsync({\n mode,\n appDir,\n outputDir,\n prerenderManifest,\n baseUrl,\n }: {\n mode: 'development' | 'production';\n appDir: string;\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: ExpoRouterServerManifestV1;\n baseUrl: string;\n }) {\n const manifest = await this.getExpoRouterRoutesManifestAsync({ appDir });\n\n const files: Map<string, string> = new Map();\n\n for (const route of manifest.apiRoutes) {\n const filepath = path.join(appDir, route.file);\n const contents = await bundleApiRoute(this.projectRoot, filepath, {\n mode,\n appDir,\n port: this.getInstance()?.location.port,\n shouldThrow: true,\n baseUrl,\n });\n const artifactFilename = path.join(\n outputDir,\n path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js'))\n );\n files.set(artifactFilename, contents!);\n // Remap the manifest files to represent the output files.\n route.file = artifactFilename;\n }\n\n return {\n manifest: {\n ...manifest,\n htmlRoutes: prerenderManifest.htmlRoutes,\n },\n files,\n };\n }\n\n async getExpoRouterRoutesManifestAsync({ appDir }: { appDir: string }) {\n // getBuiltTimeServerManifest\n const manifest = await fetchManifest(this.projectRoot, {\n asJson: true,\n appDir,\n });\n\n if (!manifest) {\n throw new CommandError(\n 'EXPO_ROUTER_SERVER_MANIFEST',\n 'Unexpected error: server manifest could not be fetched.'\n );\n }\n\n return manifest;\n }\n\n async getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n baseUrl,\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n }) {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await getStaticRenderFunctions(this.projectRoot, url, {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ fetchData: true, preserveApiRoutes: false }),\n // Get route generating function\n async renderAsync(path: string) {\n return await getStaticContent(new URL(path, url));\n },\n };\n }\n\n async getStaticResourcesAsync({\n mode,\n minify = mode !== 'development',\n includeMaps,\n baseUrl,\n mainModuleName,\n }: {\n mode: string;\n minify?: boolean;\n includeMaps?: boolean;\n baseUrl?: string;\n mainModuleName?: string;\n }): Promise<{ artifacts: SerialAsset[]; assets?: AssetData[] }> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeMaps,\n mainModuleName:\n mainModuleName ?? resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n baseUrl,\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n let data: any;\n try {\n data = JSON.parse(txt);\n } catch (error: any) {\n debug(txt);\n\n // Metro can throw this error when the initial module id cannot be resolved.\n if (!results.ok && txt.startsWith('<!DOCTYPE html>')) {\n throw new ForwardHtmlError(\n `Metro failed to bundle the project. Check the console for more information.`,\n txt,\n results.status\n );\n }\n\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n throw error;\n }\n\n // NOTE: This could potentially need more validation in the future.\n if ('artifacts' in data && Array.isArray(data.artifacts)) {\n return data;\n }\n\n if (data != null && (data.errors || data.type?.match(/.*Error$/))) {\n // {\n // type: 'InternalError',\n // errors: [],\n // message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\\n' +\n // '\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\\n' +\n // '\\n' +\n // '\\x1B[0m \\x1B[90m 287 |\\x1B[39m }\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 288 |\\x1B[39m \\x1B[36mif\\x1B[39m (error \\x1B[36minstanceof\\x1B[39m \\x1B[33mInvalidPackageError\\x1B[39m) {\\x1B[0m\\n' +\n // '\\x1B[0m\\x1B[31m\\x1B[1m>\\x1B[22m\\x1B[39m\\x1B[90m 289 |\\x1B[39m \\x1B[36mthrow\\x1B[39m \\x1B[36mnew\\x1B[39m \\x1B[33mPackageResolutionError\\x1B[39m({\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m |\\x1B[39m \\x1B[31m\\x1B[1m^\\x1B[22m\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 290 |\\x1B[39m packageError\\x1B[33m:\\x1B[39m error\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 291 |\\x1B[39m originModulePath\\x1B[33m:\\x1B[39m \\x1B[36mfrom\\x1B[39m\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 292 |\\x1B[39m targetModuleName\\x1B[33m:\\x1B[39m to\\x1B[33m,\\x1B[39m\\x1B[0m'\n // }\n // The Metro logger already showed this error.\n throw new Error(data.message);\n }\n\n throw new Error(\n 'Invalid resources returned from the Metro serializer. Expected array, found: ' + data\n );\n }\n\n async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n baseUrl,\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n baseUrl,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [{ artifacts: resources }, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ mode, minify, baseUrl }),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n });\n return {\n content,\n resources,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n\n // Use the unversioned metro config.\n // TODO: Deprecate this property when expo-cli goes away.\n unversioned: false,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n }\n );\n\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\n middleware.use(\n new DevToolsPluginMiddleware(this.projectRoot, this.devToolsPluginManager).getHandler()\n );\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n onDeepLink: getDeepLinkHandler(this.projectRoot),\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n middleware.use(new CreateFileMiddleware(this.projectRoot).getHandler());\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n const { exp } = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.\n middleware.use(new FaviconMiddleware(this.projectRoot).getHandler());\n\n if (useServerRendering) {\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n const appDir = getRouterDirectoryWithManifest(this.projectRoot, exp);\n middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n ...options,\n appDir,\n baseUrl,\n getWebBundleUrl: manifestMiddleware.getWebBundleUrl.bind(manifestMiddleware),\n getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname, {\n mode: options.mode ?? 'development',\n minify: options.minify,\n baseUrl,\n });\n },\n })\n );\n\n // @ts-expect-error: TODO\n if (exp.web?.output === 'server') {\n // Cache observation for API Routes...\n observeApiRouteChanges(\n appDir,\n {\n metro,\n server,\n },\n async (filepath, op) => {\n if (isApiRouteConvention(filepath)) {\n debug(`[expo-cli] ${op} ${filepath}`);\n if (op === 'change' || op === 'add') {\n rebundleApiRoute(this.projectRoot, filepath, {\n ...options,\n appDir,\n baseUrl,\n });\n }\n\n if (op === 'delete') {\n // TODO: Cancel the bundling of the deleted route.\n }\n }\n }\n );\n }\n } else {\n // This MUST run last since it's the fallback.\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\n return {\n server,\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware,\n messageSocket,\n };\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite.js'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n return startTypescriptTypeGenerationAsync({\n server: this.instance?.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n}\n\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","ForwardHtmlError","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","mode","appDir","outputDir","prerenderManifest","baseUrl","manifest","getExpoRouterRoutesManifestAsync","files","Map","route","apiRoutes","filepath","path","join","file","contents","bundleApiRoute","projectRoot","getInstance","location","shouldThrow","artifactFilename","relative","replace","set","htmlRoutes","fetchManifest","asJson","getStaticRenderFunctionAsync","minify","url","getDevServerUrl","getStaticContent","getManifest","getBuildTimeServerManifestAsync","getStaticRenderFunctions","dev","environment","serverManifest","fetchData","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","includeMaps","mainModuleName","data","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","serializerIncludeMaps","resolveMainModuleName","lazy","shouldEnableAsyncImports","bundleUrl","results","fetch","toString","txt","text","JSON","parse","error","ok","startsWith","status","Log","Array","isArray","artifacts","errors","type","match","Error","getStaticPageAsync","pathname","bundleStaticHtml","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","watchEnvironmentVariables","instance","envFiles","getFiles","NODE_ENV","map","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","unversioned","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","isExporting","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","getConfig","skipSDKVersionRequirement","useServerRendering","includes","web","output","ServeStaticMiddleware","FaviconMiddleware","getBaseUrlFromExpoConfig","getRouterDirectoryWithManifest","createRouteHandlerMiddleware","getWebBundleUrl","bind","observeApiRouteChanges","op","isApiRouteConvention","rebundleApiRoute","HistoryFallbackMiddleware","internal","originalClose","close","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","logEventAsync","getDevClientProperties"],"mappings":"AAMA;;;;QAsjBgBA,kBAAkB,GAAlBA,kBAAkB;AAtjBR,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEJ,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEP,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AAE0B,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACvB,IAAA,4BAA+B,WAA/B,+BAA+B,CAAA;AAClB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AAC3C,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AAChB,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AACF,IAAA,OAAU,WAAV,UAAU,CAAA;AACvC,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AACE,IAAA,oCAAuC,WAAvC,uCAAuC,CAAA;AAC9E,IAAA,IAAc,WAAd,cAAc,CAAA;AACC,IAAA,uBAAiD,kCAAjD,iDAAiD,EAAA;AACtD,IAAA,kBAA4C,WAA5C,4CAA4C,CAAA;AAC7C,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACnB,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACmB,IAAA,iBAAqB,WAArB,qBAAqB,CAAA;AACrD,IAAA,yBAA6B,WAA7B,6BAA6B,CAAA;AACpB,IAAA,kCAAiD,WAAjD,iDAAiD,CAAA;AAC9D,IAAA,qBAAoC,WAApC,oCAAoC,CAAA;AAChC,IAAA,yBAAwC,WAAxC,wCAAwC,CAAA;AAC/C,IAAA,kBAAiC,WAAjC,iCAAiC,CAAA;AACzB,IAA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a;QACvC,OAAO;YAAC,mBAAmB;YAAE,qBAAqB;YAAE,oBAAoB;SAAC,CAAC;KAC3E;CACF;QAtfY1L,qBAAqB,GAArBA,qBAAqB;AAwf3B,SAASZ,kBAAkB,CAAC2C,WAAmB,EAAmB;IACvE,OAAO,OAAO,EAAE4G,OAAO,CAAA,EAAE,GAAK;QAC5B,IAAIA,OAAO,KAAK,MAAM,EAAE,OAAO;QAC/B,MAAM,EAAEK,GAAG,CAAA,EAAE,GAAGC,CAAAA,GAAAA,OAAS,AAAa,CAAA,UAAb,CAAClH,WAAW,CAAC,AAAC;QACvC,MAAM4J,CAAAA,GAAAA,kBAAa,AAGjB,CAAA,cAHiB,CAAC,0BAA0B,EAAE;YAC9C3G,MAAM,EAAE,SAAS;YACjB,GAAG4G,CAAAA,GAAAA,uBAAsB,AAAkB,CAAA,QAAlB,CAAC7J,WAAW,EAAEiH,GAAG,CAAC;SAC5C,CAAC,CAAC;KACJ,CAAC;CACH"}
|
|
@@ -6,7 +6,7 @@ exports.bundleApiRoute = bundleApiRoute;
|
|
|
6
6
|
exports.rebundleApiRoute = rebundleApiRoute;
|
|
7
7
|
var _metroErrorInterface = require("./metroErrorInterface");
|
|
8
8
|
var _getStaticRenderFunctions = require("../getStaticRenderFunctions");
|
|
9
|
-
const debug = require("debug")("expo:
|
|
9
|
+
const debug = require("debug")("expo:api-routes");
|
|
10
10
|
const pendingRouteOperations = new Map();
|
|
11
11
|
async function bundleApiRoute(projectRoot, filepath, options) {
|
|
12
12
|
if (pendingRouteOperations.has(filepath)) {
|
|
@@ -15,12 +15,13 @@ async function bundleApiRoute(projectRoot, filepath, options) {
|
|
|
15
15
|
const devServerUrl = `http://localhost:${options.port}`;
|
|
16
16
|
async function bundleAsync() {
|
|
17
17
|
try {
|
|
18
|
-
debug("
|
|
18
|
+
debug("Bundle API route:", options.appDir, filepath);
|
|
19
19
|
const middleware = await (0, _getStaticRenderFunctions).requireFileContentsWithMetro(projectRoot, devServerUrl, filepath, {
|
|
20
20
|
minify: options.mode === "production",
|
|
21
21
|
dev: options.mode !== "production",
|
|
22
22
|
// Ensure Node.js
|
|
23
|
-
environment: "node"
|
|
23
|
+
environment: "node",
|
|
24
|
+
baseUrl: options.baseUrl
|
|
24
25
|
});
|
|
25
26
|
return middleware;
|
|
26
27
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/bundleApiRoutes.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\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\nimport { logMetroErrorAsync } from './metroErrorInterface';\nimport { requireFileContentsWithMetro } from '../getStaticRenderFunctions';\n\nconst debug = require('debug')('expo:
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/bundleApiRoutes.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\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\nimport { logMetroErrorAsync } from './metroErrorInterface';\nimport { requireFileContentsWithMetro } from '../getStaticRenderFunctions';\n\nconst debug = require('debug')('expo:api-routes') as typeof console.log;\n\nconst pendingRouteOperations = new Map<string, Promise<string | null>>();\n\nexport type ApiRouteOptions = {\n mode?: string;\n appDir: string;\n port?: number;\n shouldThrow?: boolean;\n baseUrl: string;\n};\n\n// Bundle the API Route with Metro and return the string contents to be evaluated in the server.\nexport async function bundleApiRoute(\n projectRoot: string,\n filepath: string,\n options: ApiRouteOptions\n): Promise<string | null | undefined> {\n if (pendingRouteOperations.has(filepath)) {\n return pendingRouteOperations.get(filepath);\n }\n\n const devServerUrl = `http://localhost:${options.port}`;\n\n async function bundleAsync() {\n try {\n debug('Bundle API route:', options.appDir, filepath);\n\n const middleware = await requireFileContentsWithMetro(projectRoot, devServerUrl, filepath, {\n minify: options.mode === 'production',\n dev: options.mode !== 'production',\n // Ensure Node.js\n environment: 'node',\n baseUrl: options.baseUrl,\n });\n\n return middleware;\n } catch (error: any) {\n if (error instanceof Error) {\n await logMetroErrorAsync({ error, projectRoot });\n }\n if (options.shouldThrow) {\n throw error;\n }\n // TODO: improve error handling, maybe have this be a mock function which returns the static error html\n return null;\n } finally {\n // pendingRouteOperations.delete(filepath);\n }\n }\n const route = bundleAsync();\n\n pendingRouteOperations.set(filepath, route);\n return route;\n}\n\nexport async function rebundleApiRoute(\n projectRoot: string,\n filepath: string,\n options: ApiRouteOptions\n) {\n pendingRouteOperations.delete(filepath);\n return bundleApiRoute(projectRoot, filepath, options);\n}\n"],"names":["bundleApiRoute","rebundleApiRoute","debug","require","pendingRouteOperations","Map","projectRoot","filepath","options","has","get","devServerUrl","port","bundleAsync","appDir","middleware","requireFileContentsWithMetro","minify","mode","dev","environment","baseUrl","error","Error","logMetroErrorAsync","shouldThrow","route","set","delete"],"mappings":"AAOA;;;;QAgBsBA,cAAc,GAAdA,cAAc;QA2CdC,gBAAgB,GAAhBA,gBAAgB;AA3DH,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AACb,IAAA,yBAA6B,WAA7B,6BAA6B,CAAA;AAE1E,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,AAAsB,AAAC;AAExE,MAAMC,sBAAsB,GAAG,IAAIC,GAAG,EAAkC,AAAC;AAWlE,eAAeL,cAAc,CAClCM,WAAmB,EACnBC,QAAgB,EAChBC,OAAwB,EACY;IACpC,IAAIJ,sBAAsB,CAACK,GAAG,CAACF,QAAQ,CAAC,EAAE;QACxC,OAAOH,sBAAsB,CAACM,GAAG,CAACH,QAAQ,CAAC,CAAC;KAC7C;IAED,MAAMI,YAAY,GAAG,CAAC,iBAAiB,EAAEH,OAAO,CAACI,IAAI,CAAC,CAAC,AAAC;IAExD,eAAeC,WAAW,GAAG;QAC3B,IAAI;YACFX,KAAK,CAAC,mBAAmB,EAAEM,OAAO,CAACM,MAAM,EAAEP,QAAQ,CAAC,CAAC;YAErD,MAAMQ,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