forked from vercel/turborepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support HMR Update Source Maps (vercel#371)
This allows us to reference the source maps for individual chunk items when delivering them for HMR updates. We currently send down the update via a `JSON.stringify()` of the updated module's code. We then `eval` this code to generate the new "module", and call registered hot handlers with the new module to update their scopes. Thankfully, we can include a `sourceMappingUrl` comment in the evaled code, so we can get away with deferring creating the source map's content until dev tools is opened. This is a first pass, it really needs to be cleaned up. But at least it's working. Co-authored-by: Tobias Koppers <[email protected]>
- Loading branch information
1 parent
7f69b27
commit 9f3b7d0
Showing
21 changed files
with
154 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
crates/turbopack/tests/snapshot/*/output/ linguist-generated=true | ||
crates/turbopack/tests/snapshot/*/output/** linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 10 additions & 7 deletions
17
...ack/tests/snapshot/example/async_chunk/output/snapshot_example_async_chunk_input_index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
...ample/async_chunk/output/snapshot_example_async_chunk_input_index.js.d48f51079f679975.map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"version": 3, | ||
"sections": [ | ||
{"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/snapshot/example/async_chunk/input/index.js"],"sourcesContent":["import('foo').then(({ foo }) => {\n foo(true)\n})\n"],"names":[],"mappings":"AAAA,wIAAa,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAA,EAAE,GAAK;IAC9B,GAAG,CAAC,IAAI,CAAC;AACX,CAAC,CAAC"}}, | ||
{"offset": {"line": 5, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] | ||
} |
2 changes: 1 addition & 1 deletion
2
...t/example/async_chunk/output/snapshot_example_async_chunk_input_node_modules_foo_index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
.../output/snapshot_example_async_chunk_input_node_modules_foo_index.js.cf8ba911a655ce0a.map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"version": 3, | ||
"sections": [ | ||
{"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/snapshot/example/async_chunk/input/node_modules/foo/index.js"],"sourcesContent":["export function foo(value) {\n console.assert(value);\n}\n"],"names":[],"mappings":"AAAA;;;AAAO,SAAS,GAAG,CAAC,KAAK,EAAE;IACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC"}}, | ||
{"offset": {"line": 8, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] | ||
} |
File renamed without changes.
17 changes: 10 additions & 7 deletions
17
...s/turbopack/tests/snapshot/example/chunked/output/snapshot_example_chunked_input_index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...pshot/example/chunked/output/snapshot_example_chunked_input_index.js.c6c2def1c0038195.map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"version": 3, | ||
"sections": [ | ||
{"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/snapshot/example/chunked/input/index.js"],"sourcesContent":["import { foo } from 'foo'\n\nfoo(true)\n"],"names":[],"mappings":"AAAA;;;AAEA,uIAAI,IAAI,CAAC"}}, | ||
{"offset": {"line": 6, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] | ||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../snapshot/example/chunked/output/snapshot_example_chunked_input_node_modules_foo_index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
...nked/output/snapshot_example_chunked_input_node_modules_foo_index.js.cf8ba911a655ce0a.map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"version": 3, | ||
"sections": [ | ||
{"offset": {"line": 2, "column": 0}, "map": {"version":3,"sources":["/[project]/snapshot/example/chunked/input/node_modules/foo/index.js"],"sourcesContent":["export function foo(value) {\n console.assert(value);\n}\n"],"names":[],"mappings":"AAAA;;;AAAO,SAAS,GAAG,CAAC,KAAK,EAAE;IACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC"}}, | ||
{"offset": {"line": 8, "column": 0}, "map": {"version": 3, "names": [], "sources": [], "mappings": "A"}}] | ||
} |
Oops, something went wrong.