ses 0.18.5 → 0.18.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEWS.md +34 -1
- package/README.md +4 -4
- package/dist/lockdown.cjs +3339 -3192
- package/dist/lockdown.mjs +3339 -3192
- package/dist/lockdown.umd.js +3339 -3192
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses.cjs +3339 -3192
- package/dist/ses.mjs +3339 -3192
- package/dist/ses.umd.js +3339 -3192
- package/dist/ses.umd.min.js +1 -1
- package/index.js +3 -31
- package/package.json +7 -7
- package/src/assert-shim.js +4 -0
- package/src/assert-sloppy-mode.js +11 -0
- package/src/compartment-shim.js +11 -288
- package/src/compartment.js +292 -0
- package/src/error/note-log-args.js +2 -3
- package/src/error/stringify-utils.js +25 -1
- package/src/get-anonymous-intrinsics.js +1 -1
- package/src/lockdown-shim.js +19 -379
- package/src/lockdown.js +392 -0
- package/src/make-safe-evaluator.js +2 -2
- package/src/permits.js +14 -8
- package/src/tame-date-constructor.js +37 -21
- package/src/tame-math-object.js +20 -1
- package/src/transforms.js +1 -1
- package/types.d.ts +25 -8
package/types.d.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// version of harden.
|
|
20
20
|
export type Harden = <T>(value: T) => T; // not Hardened<T>;
|
|
21
21
|
|
|
22
|
-
export interface
|
|
22
|
+
export interface RepairOptions {
|
|
23
23
|
regExpTaming?: 'safe' | 'unsafe';
|
|
24
24
|
localeTaming?: 'safe' | 'unsafe';
|
|
25
25
|
consoleTaming?: 'safe' | 'unsafe';
|
|
@@ -36,6 +36,11 @@ export interface LockdownOptions {
|
|
|
36
36
|
__hardenTaming__?: 'safe' | 'unsafe';
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// Deprecated in favor of the more specific RepairOptions
|
|
40
|
+
export type LockdownOptions = RepairOptions;
|
|
41
|
+
|
|
42
|
+
export type RepairIntrinsics = (options?: LockdownOptions) => void;
|
|
43
|
+
export type HardenIntrinsics = () => void;
|
|
39
44
|
export type Lockdown = (options?: LockdownOptions) => void;
|
|
40
45
|
|
|
41
46
|
export type __LiveExportMap__ = Record<string, [string, boolean]>;
|
|
@@ -172,19 +177,13 @@ export type Raise = (reason: Error) => void;
|
|
|
172
177
|
// eslint-disable-next-line no-use-before-define
|
|
173
178
|
export type MakeAssert = (raise?: Raise, unredacted?: boolean) => Assert;
|
|
174
179
|
|
|
175
|
-
export interface
|
|
180
|
+
export interface AssertionFunctions {
|
|
176
181
|
(
|
|
177
182
|
value: any,
|
|
178
183
|
details?: Details,
|
|
179
184
|
errorConstructor?: ErrorConstructor,
|
|
180
185
|
): asserts value;
|
|
181
186
|
typeof: AssertTypeof;
|
|
182
|
-
error(
|
|
183
|
-
details?: Details,
|
|
184
|
-
errorConstructor?: ErrorConstructor,
|
|
185
|
-
options?: AssertMakeErrorOptions,
|
|
186
|
-
): Error;
|
|
187
|
-
fail(details?: Details, errorConstructor?: ErrorConstructor): never;
|
|
188
187
|
equal(
|
|
189
188
|
left: any,
|
|
190
189
|
right: any,
|
|
@@ -192,6 +191,15 @@ export interface Assert {
|
|
|
192
191
|
errorConstructor?: ErrorConstructor,
|
|
193
192
|
): void;
|
|
194
193
|
string(specimen: any, details?: Details): asserts specimen is string;
|
|
194
|
+
fail(details?: Details, errorConstructor?: ErrorConstructor): never;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface AssertionUtilities {
|
|
198
|
+
error(
|
|
199
|
+
details?: Details,
|
|
200
|
+
errorConstructor?: ErrorConstructor,
|
|
201
|
+
options?: AssertMakeErrorOptions,
|
|
202
|
+
): Error;
|
|
195
203
|
note(error: Error, details: Details): void;
|
|
196
204
|
details(
|
|
197
205
|
template: TemplateStringsArray | string[],
|
|
@@ -200,9 +208,16 @@ export interface Assert {
|
|
|
200
208
|
Fail(template: TemplateStringsArray | string[], ...args: any): never;
|
|
201
209
|
quote(payload: any, spaces?: string | number): ToStringable;
|
|
202
210
|
bare(payload: any, spaces?: string | number): ToStringable;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface DeprecatedAssertionUtilities {
|
|
203
214
|
makeAssert: MakeAssert;
|
|
204
215
|
}
|
|
205
216
|
|
|
217
|
+
export type Assert = AssertionFunctions &
|
|
218
|
+
AssertionUtilities &
|
|
219
|
+
DeprecatedAssertionUtilities;
|
|
220
|
+
|
|
206
221
|
interface CompartmentEvaluateOptions {
|
|
207
222
|
sloppyGlobalsMode?: boolean;
|
|
208
223
|
__moduleShimLexicals__?: Object;
|
|
@@ -214,6 +229,8 @@ interface CompartmentEvaluateOptions {
|
|
|
214
229
|
declare global {
|
|
215
230
|
var harden: Harden;
|
|
216
231
|
|
|
232
|
+
var repairIntrinsics: RepairIntrinsics;
|
|
233
|
+
var hardenIntrinsics: HardenIntrinsics;
|
|
217
234
|
var lockdown: Lockdown;
|
|
218
235
|
|
|
219
236
|
var assert: Assert;
|