@expo/cli 56.1.3 → 56.1.5

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.
Files changed (33) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/src/api/endpoint.js +1 -1
  3. package/build/src/api/endpoint.js.map +1 -1
  4. package/build/src/api/user/actions.js +7 -0
  5. package/build/src/api/user/actions.js.map +1 -1
  6. package/build/src/api/user/expoSsoLauncher.js +76 -24
  7. package/build/src/api/user/expoSsoLauncher.js.map +1 -1
  8. package/build/src/api/user/user.js +12 -0
  9. package/build/src/api/user/user.js.map +1 -1
  10. package/build/src/customize/typescript.js.map +1 -1
  11. package/build/src/events/index.js +1 -1
  12. package/build/src/start/platforms/ios/simctl.js +4 -0
  13. package/build/src/start/platforms/ios/simctl.js.map +1 -1
  14. package/build/src/start/server/metro/MetroBundlerDevServer.js +57 -45
  15. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  16. package/build/src/start/server/metro/debugging/createDebugMiddleware.js +1 -1
  17. package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
  18. package/build/src/start/server/metro/instantiateMetro.js +2 -1
  19. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  20. package/build/src/start/server/metro/runServer-fork.js +10 -1
  21. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  22. package/build/src/start/server/metro/withMetroMultiPlatform.js +8 -4
  23. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  24. package/build/src/start/server/serverLogLikeMetro.js +2 -2
  25. package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
  26. package/build/src/start/server/type-generation/routes.js +1 -3
  27. package/build/src/start/server/type-generation/routes.js.map +1 -1
  28. package/build/src/utils/open.js +243 -11
  29. package/build/src/utils/open.js.map +1 -1
  30. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  31. package/build/src/utils/telemetry/utils/context.js +1 -1
  32. package/package.json +17 -18
  33. package/static/loading-page/index.html +35 -1
@@ -84,13 +84,6 @@ function _private() {
84
84
  };
85
85
  return data;
86
86
  }
87
- function _https() {
88
- const data = /*#__PURE__*/ _interop_require_default(require("https"));
89
- _https = function() {
90
- return data;
91
- };
92
- return data;
93
- }
94
87
  function _path() {
95
88
  const data = /*#__PURE__*/ _interop_require_default(require("path"));
96
89
  _path = function() {
@@ -928,13 +921,13 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
928
921
  apiRoutes: hasApiRoutes,
929
922
  exporting: !!options.isExporting
930
923
  });
931
- const { metro, hmrServer, server, middleware, messageSocket } = await (0, _instantiateMetro.instantiateMetroAsync)(this, parsedOptions, {
924
+ const { metro, hmrServer, address, server, middleware, messageSocket } = await (0, _instantiateMetro.instantiateMetroAsync)(this, parsedOptions, {
932
925
  isExporting: !!options.isExporting,
933
926
  exp
934
927
  });
935
- const protocol = server instanceof _https().default.Server ? 'https' : 'http';
936
928
  // Required for symbolication:
937
- process.env.EXPO_DEV_SERVER_ORIGIN = `${protocol}://localhost:${options.port}`;
929
+ const serverBaseUrl = `${(address == null ? void 0 : address.protocol) ?? 'http'}://localhost:${(address == null ? void 0 : address.port) ?? options.port}`;
930
+ process.env.EXPO_DEV_SERVER_ORIGIN = serverBaseUrl;
938
931
  if (!options.isExporting) {
939
932
  var _metro__config_server, _metro__config;
940
933
  const manifestMiddleware = await this.getManifestMiddlewareAsync(options);
@@ -1007,7 +1000,6 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1007
1000
  metro,
1008
1001
  server
1009
1002
  }, ({ changes })=>{
1010
- var _exp_extra_router, _exp_extra;
1011
1003
  if (hasApiRoutes) {
1012
1004
  // NOTE(EvanBacon): We aren't sure what files the API routes are using so we'll just invalidate
1013
1005
  // aggressively to ensure we always have the latest. The only caching we really get here is for
@@ -1025,12 +1017,6 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1025
1017
  }
1026
1018
  }
1027
1019
  }
1028
- // Handle loader file changes for HMR
1029
- if ((_exp_extra = exp.extra) == null ? void 0 : (_exp_extra_router = _exp_extra.router) == null ? void 0 : _exp_extra_router.unstable_useServerDataLoaders) {
1030
- for (const change of changes.modifiedFiles){
1031
- this.handleLoaderFileChange(change[0]);
1032
- }
1033
- }
1034
1020
  });
1035
1021
  }
1036
1022
  // If React 19 is enabled, then add RSC middleware to the dev server.
@@ -1122,6 +1108,11 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1122
1108
  this.metro = null;
1123
1109
  this.hmrServer = null;
1124
1110
  this.ssrHmrClients = new Map();
1111
+ for (const unlisten of this.loaderGraphListeners.values()){
1112
+ unlisten();
1113
+ }
1114
+ this.loaderGraphListeners.clear();
1115
+ this.pendingLoaderInvalidationChangeIds.clear();
1125
1116
  callback == null ? void 0 : callback(err);
1126
1117
  });
1127
1118
  };
@@ -1131,11 +1122,11 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1131
1122
  server,
1132
1123
  location: {
1133
1124
  // The port is the main thing we want to send back.
1134
- port: options.port,
1125
+ port: (address == null ? void 0 : address.port) ?? options.port,
1135
1126
  // localhost isn't always correct.
1136
1127
  host: 'localhost',
1137
- url: `${protocol}://localhost:${options.port}`,
1138
- protocol
1128
+ url: serverBaseUrl,
1129
+ protocol: (address == null ? void 0 : address.protocol) ?? 'http'
1139
1130
  },
1140
1131
  middleware,
1141
1132
  messageSocket
@@ -1355,8 +1346,6 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1355
1346
  isLoaderBundle: true
1356
1347
  });
1357
1348
  if (routeModule.loader) {
1358
- // Register this module for loader HMR
1359
- this.setupLoaderHmr(modulePath);
1360
1349
  const maybeResponse = await routeModule.loader(request, route.params);
1361
1350
  let data;
1362
1351
  if (maybeResponse instanceof Response) {
@@ -1433,29 +1422,48 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1433
1422
  };
1434
1423
  this.registerSsrHmrAsync(url.toString(), onReload);
1435
1424
  }
1436
- setupLoaderHmr(modulePath) {
1437
- if (this.watchedLoaderFiles.has(modulePath)) {
1425
+ // Subscribe to a loader bundle's Metro graph so we can broadcast `loader-invalidate` and
1426
+ // drop the SSR module eval cache when the loader's dependency graph is dirtied. This avoids
1427
+ // the full-page reload the old stub used and keeps client state across loader edits.
1428
+ setupLoaderGraphListener(graphId, resolvedEntryFilePath, graph) {
1429
+ if (this.loaderGraphListeners.has(graphId) || !this.metro) {
1438
1430
  return;
1439
1431
  }
1440
- this.watchedLoaderFiles.add(modulePath);
1441
- debug('[Loader HMR] Registering loader file for HMR:', modulePath);
1442
- }
1443
- handleLoaderFileChange(changedFilePath) {
1444
- for (const loaderPath of this.watchedLoaderFiles){
1445
- const possibleExtensions = [
1446
- '.tsx',
1447
- '.ts',
1448
- '.jsx',
1449
- '.js'
1450
- ];
1451
- const isLoaderFile = possibleExtensions.some((ext)=>changedFilePath === loaderPath + ext || changedFilePath === loaderPath);
1452
- if (isLoaderFile) {
1453
- debug('[Loader HMR] Loader file changed, triggering reload:', changedFilePath);
1454
- this.broadcastMessage('sendDevCommand', {
1455
- name: 'reload'
1456
- });
1432
+ const deltaBundler = this.metro.getBundler().getDeltaBundler();
1433
+ const onChange = async (changeEvent)=>{
1434
+ debug('[Loader HMR] Graph change detected for:', resolvedEntryFilePath);
1435
+ if (!this.shouldBroadcastLoaderInvalidation(changeEvent == null ? void 0 : changeEvent.changeId)) {
1436
+ return;
1437
+ }
1438
+ if (typeof globalThis.__c === 'function') {
1439
+ globalThis.__c();
1457
1440
  }
1441
+ this.broadcastMessage('sendDevCommand', {
1442
+ name: 'loader-invalidate',
1443
+ data: {
1444
+ scope: 'all'
1445
+ }
1446
+ });
1447
+ };
1448
+ const unlisten = deltaBundler.listen(graph, onChange);
1449
+ this.loaderGraphListeners.set(graphId, unlisten);
1450
+ }
1451
+ shouldBroadcastLoaderInvalidation(changeId) {
1452
+ if (!changeId) {
1453
+ return true;
1458
1454
  }
1455
+ if (this.pendingLoaderInvalidationChangeIds.has(changeId)) {
1456
+ return false;
1457
+ }
1458
+ this.pendingLoaderInvalidationChangeIds.add(changeId);
1459
+ // All listeners for a single filesystem change are dispatched synchronously from one
1460
+ // DeltaCalculator EventEmitter.emit(), so dedupe collisions resolve within microseconds.
1461
+ // The timeout exists only to bound memory: without it, this Set would accumulate one entry
1462
+ // per change for the lifetime of the dev server.
1463
+ setTimeout(()=>{
1464
+ this.pendingLoaderInvalidationChangeIds.delete(changeId);
1465
+ }, 500);
1466
+ return true;
1459
1467
  }
1460
1468
  // Direct Metro access
1461
1469
  // Emulates the Metro dev server .bundle endpoint without having to go through a server.
@@ -1502,13 +1510,14 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1502
1510
  type: 'bundle_build_started'
1503
1511
  });
1504
1512
  try {
1513
+ var _transformOptions_customTransformOptions;
1505
1514
  let delta;
1506
1515
  let revision;
1507
1516
  try {
1508
- var _transformOptions_customTransformOptions;
1517
+ var _transformOptions_customTransformOptions1;
1509
1518
  // TODO: Some bug in Metro/RSC causes this to break when changing imports in server components.
1510
1519
  // We should resolve the bug because it results in ~6x faster bundling to reuse the graph revision.
1511
- if (((_transformOptions_customTransformOptions = transformOptions.customTransformOptions) == null ? void 0 : _transformOptions_customTransformOptions.environment) === 'react-server') {
1520
+ if (((_transformOptions_customTransformOptions1 = transformOptions.customTransformOptions) == null ? void 0 : _transformOptions_customTransformOptions1.environment) === 'react-server') {
1512
1521
  const props = await this.metro.getBundler().initializeGraph(// NOTE: Using absolute path instead of relative input path is a breaking change.
1513
1522
  // entryFile,
1514
1523
  resolvedEntryFilePath, transformOptions, resolverOptions, {
@@ -1534,6 +1543,9 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1534
1543
  (0, _metroErrorInterface.dropStackIfContainsCodeFrame)(error);
1535
1544
  throw error;
1536
1545
  }
1546
+ if (!this.instanceMetroOptions.isExporting && transformOptions.dev !== false && ((_transformOptions_customTransformOptions = transformOptions.customTransformOptions) == null ? void 0 : _transformOptions_customTransformOptions.isLoaderBundle) === 'true') {
1547
+ this.setupLoaderGraphListener(revision.graphId, resolvedEntryFilePath, revision.graph);
1548
+ }
1537
1549
  bundlePerfLogger == null ? void 0 : bundlePerfLogger.annotate({
1538
1550
  int: {
1539
1551
  graph_node_count: revision.graph.dependencies.size
@@ -1665,7 +1677,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1665
1677
  });
1666
1678
  }
1667
1679
  constructor(...args){
1668
- super(...args), this.metro = null, this.hmrServer = null, this.ssrHmrClients = new Map(), // Set when the server is started.
1680
+ super(...args), this.metro = null, this.hmrServer = null, this.ssrHmrClients = new Map(), this.loaderGraphListeners = new Map(), this.pendingLoaderInvalidationChangeIds = new Set(), // Set when the server is started.
1669
1681
  this.instanceMetroOptions = {}, this.ssrLoadModule = async (filePath, specificOptions = {}, extras = {})=>{
1670
1682
  // NOTE(@kitten): We don't properly initialize the server-side modules
1671
1683
  // Instead, we first load an entrypoint with an empty bundle to initialize the runtime instead
@@ -1685,7 +1697,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
1685
1697
  }
1686
1698
  return (0, _getStaticRenderFunctions.evalMetroAndWrapFunctions)(this.projectRoot, res.src, res.filename, res.map, specificOptions.isExporting ?? this.instanceMetroOptions.isExporting);
1687
1699
  }, this.rscRenderer = null, this.onReloadRscEvent = null, // API Routes
1688
- this.pendingRouteOperations = new Map(), this.watchedLoaderFiles = new Set();
1700
+ this.pendingRouteOperations = new Map();
1689
1701
  }
1690
1702
  }
1691
1703
  function getBuildID(buildNumber) {