-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! make shim opt-in via process.env
- Loading branch information
Showing
5 changed files
with
30 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global globalThis */ | ||
|
||
// TODO consider adding env option setting APIs to @endo/env-options | ||
// TODO should set up globalThis.process.env if absent | ||
const env = (globalThis.process || {}).env || {}; | ||
|
||
env.SES_NON_TRAPPING_SHIM = 'enabled'; |
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,10 +1,22 @@ | ||
/* global globalThis */ | ||
import { getEnvironmentOption } from '@endo/env-options'; | ||
import { ReflectPlus, ObjectPlus, ProxyPlus } from './src/non-trapping-pony.js'; | ||
|
||
globalThis.Reflect = ReflectPlus; | ||
const nonTrappingShimOption = getEnvironmentOption( | ||
'SES_NON_TRAPPING_SHIM', | ||
'disabled', | ||
['enabled'], | ||
); | ||
|
||
globalThis.Object = ObjectPlus; | ||
// eslint-disable-next-line no-extend-native | ||
Object.prototype.constructor = ObjectPlus; | ||
if (nonTrappingShimOption === 'enabled') { | ||
// TODO figure this out, either remove directive or change to | ||
// at-ts-expect-error. | ||
// @ts-ignore type of ReflectPlus vs Reflect, I think | ||
globalThis.Reflect = ReflectPlus; | ||
|
||
globalThis.Proxy = ProxyPlus; | ||
globalThis.Object = ObjectPlus; | ||
// eslint-disable-next-line no-extend-native | ||
Object.prototype.constructor = ObjectPlus; | ||
|
||
globalThis.Proxy = ProxyPlus; | ||
} |
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