-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(xsnap-lockdown): Migrate object-inspect bundle from Rollup t…
…o Endo
- Loading branch information
Showing
6 changed files
with
23 additions
and
34 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
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,24 +1,11 @@ | ||
import objectInspectSources from '../dist/src-object-inspect.js'; | ||
import objectInspectSources from '../dist/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-lockdown/lib/object-inspect.js\n`, | ||
); | ||
`(${objectInspectSources.source})`, | ||
)().default; | ||
|
||
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
This file was deleted.
Oops, something went wrong.
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