Skip to content

Commit

Permalink
[Flight] Add findSourceMapURL option to get a URL to load Server sour…
Browse files Browse the repository at this point in the history
…ce maps from (#29708)

This lets you click a stack frame on the client and see the Server
source code inline.

<img width="871" alt="Screenshot 2024-06-01 at 11 44 24 PM"
src="https://github.com/facebook/react/assets/63648/581281ce-0dce-40c0-a084-4a6d53ba1682">

<img width="840" alt="Screenshot 2024-06-01 at 11 43 37 PM"
src="https://github.com/facebook/react/assets/63648/00dc77af-07c1-4389-9ae0-cf1f45199efb">

We could do some logic on the server that sends a source map url for
every stack frame in the RSC payload. That would make the client
potentially config free. However regardless we need the config to
describe what url scheme to use since that’s not built in to the bundler
config. In practice you likely have a common pattern for your source
maps so no need to send data over and over when we can just have a
simple function configured on the client.

The server must return a source map, even if the file is not actually
compiled since the fake file is still compiled.

The source mapping strategy can be one of two models depending on if the
server’s stack traces (`new Error().stack`) are source mapped back to
the original (`—enable-source-maps`) or represents the location in
compiled code (like in the browser).

If it represents the location in compiled code it’s actually easier. You
just serve the source map generated for that file by the tooling.

If it is already source mapped it has to generate a source map where
everything points to the same location (as if not compiled) ideally with
a segment per logical ast node.

DiffTrain build for commit ba099e4.
  • Loading branch information
sebmarkbage committed Jun 3, 2024
1 parent 9e1cf0f commit 4bd31b2
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<4887615a72d26b2ab91dc87285867a37>>
* @generated SignedSource<<e46c259f77c707213400911161b76127>>
*/

'use strict';
Expand Down Expand Up @@ -23495,7 +23495,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-d77dd31a32-20240601';
var ReactVersion = '19.0.0-rc-ba099e442b-20240602';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<961ae6d712bb58a1b013d54b624b3cb4>>
* @generated SignedSource<<3dc0798cc15fe2c5c351df969cb8ee38>>
*/

"use strict";
Expand Down Expand Up @@ -9303,7 +9303,7 @@ var devToolsConfig$jscomp$inline_1047 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-rc-d77dd31a32-20240601",
version: "19.0.0-rc-ba099e442b-20240602",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1234 = {
Expand Down Expand Up @@ -9334,7 +9334,7 @@ var internals$jscomp$inline_1234 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-d77dd31a32-20240601"
reconcilerVersion: "19.0.0-rc-ba099e442b-20240602"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1235 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d463a63e15824a8f6b8b287dee8a372a>>
* @generated SignedSource<<21eeadb2c56189bfb606330b53a5ea24>>
*/

"use strict";
Expand Down Expand Up @@ -9925,7 +9925,7 @@ var devToolsConfig$jscomp$inline_1130 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-rc-d77dd31a32-20240601",
version: "19.0.0-rc-ba099e442b-20240602",
rendererPackageName: "react-test-renderer"
};
(function (internals) {
Expand Down Expand Up @@ -9969,7 +9969,7 @@ var devToolsConfig$jscomp$inline_1130 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-d77dd31a32-20240601"
reconcilerVersion: "19.0.0-rc-ba099e442b-20240602"
});
exports._Scheduler = Scheduler;
exports.act = act;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<757cbdc8d177c7ce024d9bc5ee918224>>
* @generated SignedSource<<0b985823c75d0e9f984cd707c556bb1a>>
*/

'use strict';
Expand All @@ -24,7 +24,7 @@ if (
}
var dynamicFlagsUntyped = require('ReactNativeInternalFeatureFlags');

var ReactVersion = '19.0.0-rc-d77dd31a32-20240601';
var ReactVersion = '19.0.0-rc-ba099e442b-20240602';

// Re-export dynamic flags from the internal module.
var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<3cba2f7b79c244ffaff592fb8654dea7>>
* @generated SignedSource<<8ccc51eb81e3b432f0e4e3d079147b26>>
*/

"use strict";
Expand Down Expand Up @@ -604,4 +604,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-rc-d77dd31a32-20240601";
exports.version = "19.0.0-rc-ba099e442b-20240602";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<f1acb2f6346084960a5968e814e7a17d>>
* @generated SignedSource<<a6b9fd38b06bf79490d7c0f665b609f8>>
*/

"use strict";
Expand Down Expand Up @@ -608,7 +608,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-rc-d77dd31a32-20240601";
exports.version = "19.0.0-rc-ba099e442b-20240602";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d77dd31a329df55a051800fc76668af8da8332b4
ba099e442b602b9414693dab9cfa67e19051037c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<dcd1d94698ce06a0fff69539f6fd365f>>
* @generated SignedSource<<a9e2752327671f030ac3edaf31aa5ef6>>
*/

'use strict';
Expand Down Expand Up @@ -26230,7 +26230,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-d77dd31a32-20240601';
var ReactVersion = '19.0.0-rc-ba099e442b-20240602';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<94da57c8d5864ea56eb9fa3830971408>>
* @generated SignedSource<<c3b6bd52edfdebef5406ad3289463016>>
*/

"use strict";
Expand Down Expand Up @@ -10556,7 +10556,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1124 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-rc-d77dd31a32-20240601",
version: "19.0.0-rc-ba099e442b-20240602",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -10599,7 +10599,7 @@ var internals$jscomp$inline_1350 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-d77dd31a32-20240601"
reconcilerVersion: "19.0.0-rc-ba099e442b-20240602"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1351 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<5b3019b9ccba2039645f5e61548d4e3b>>
* @generated SignedSource<<5f60751f65cf9ffd4771f3b327d7facd>>
*/

"use strict";
Expand Down Expand Up @@ -11262,7 +11262,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1205 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-rc-d77dd31a32-20240601",
version: "19.0.0-rc-ba099e442b-20240602",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -11318,7 +11318,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-d77dd31a32-20240601"
reconcilerVersion: "19.0.0-rc-ba099e442b-20240602"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<83c2189bc2692c6f4dad2866bd0477a7>>
* @generated SignedSource<<c48be07de1a2f72642669de35a89dccf>>
*/

'use strict';
Expand Down Expand Up @@ -26586,7 +26586,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-d77dd31a32-20240601';
var ReactVersion = '19.0.0-rc-ba099e442b-20240602';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<5959e16319374685e73d43f3fc0db3ce>>
* @generated SignedSource<<4b5ae400da72101c2df5361f56373ef1>>
*/

"use strict";
Expand Down Expand Up @@ -10701,11 +10701,11 @@ function traverseOwnerTreeUp(hierarchy, instance) {
traverseOwnerTreeUp(hierarchy, instance);
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-rc-d77dd31a32-20240601" !== isomorphicReactPackageVersion)
if ("19.0.0-rc-ba099e442b-20240602" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-rc-d77dd31a32-20240601\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-rc-ba099e442b-20240602\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand Down Expand Up @@ -10755,7 +10755,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1192 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-rc-d77dd31a32-20240601",
version: "19.0.0-rc-ba099e442b-20240602",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -10798,7 +10798,7 @@ var internals$jscomp$inline_1439 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-d77dd31a32-20240601"
reconcilerVersion: "19.0.0-rc-ba099e442b-20240602"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1440 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<9b6a7e8286e01ee44568c36b6f772e2d>>
* @generated SignedSource<<d5338b8143285377bc9edad5f40f3a86>>
*/

"use strict";
Expand Down Expand Up @@ -11408,11 +11408,11 @@ function traverseOwnerTreeUp(hierarchy, instance) {
traverseOwnerTreeUp(hierarchy, instance);
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-rc-d77dd31a32-20240601" !== isomorphicReactPackageVersion)
if ("19.0.0-rc-ba099e442b-20240602" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-rc-d77dd31a32-20240601\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-rc-ba099e442b-20240602\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand Down Expand Up @@ -11462,7 +11462,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1273 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-rc-d77dd31a32-20240601",
version: "19.0.0-rc-ba099e442b-20240602",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -11518,7 +11518,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-d77dd31a32-20240601"
reconcilerVersion: "19.0.0-rc-ba099e442b-20240602"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {
Expand Down

0 comments on commit 4bd31b2

Please sign in to comment.