-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4767 from Agoric/mfig-xsnap-logging
Rework `xsnap/src/object-inspect.js`
- Loading branch information
Showing
12 changed files
with
707 additions
and
587 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
Binary file not shown.
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,24 @@ | ||
import objectInspectSources from '../dist/src-object-inspect.js'; | ||
|
||
// Ensure the object inspector is confined. | ||
const c = new Compartment(); | ||
harden(c.globalThis); | ||
|
||
// Transform the imported inspector module source string into an evaluable | ||
// string. We could have played more games with bundlers to do something less | ||
// fragile, but even so, SES should fail-safe if this replacement doesn't match. | ||
// | ||
// The goal (presuming the file ends with a single export default statement): | ||
// `...\n export default harden(inspect0);` | ||
// becomes: | ||
// `...\n /* export default */ harden(inspect0);` | ||
// and we can evaluate it to obtain the completion value as the object inspector. | ||
const src = objectInspectSources.replace( | ||
/(^|\s)(export\s+default)(\s+)/g, | ||
'$1/* $2 */$3', | ||
); | ||
const objectInspect = c.evaluate( | ||
`${src}\n//# sourceURL=xsnap/src/object-inspect.js\n`, | ||
); | ||
|
||
export default objectInspect; |
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
Oops, something went wrong.