ses 1.3.0 → 1.4.1
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/dist/lockdown.cjs +254 -35
- package/dist/lockdown.mjs +254 -35
- package/dist/lockdown.umd.js +254 -35
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses.cjs +254 -35
- package/dist/ses.mjs +254 -35
- package/dist/ses.umd.js +254 -35
- package/dist/ses.umd.min.js +1 -1
- package/index.js +1 -0
- package/package.json +11 -11
- package/src/commons.js +3 -0
- package/src/console-shim.js +50 -0
- package/src/error/README.md +9 -1
- package/src/error/console.js +146 -17
- package/src/lockdown-shim.js +4 -2
- package/src/lockdown.js +1 -1
- package/src/make-eval-function.js +1 -1
- package/src/make-hardener.js +1 -1
- package/src/tame-regexp-constructor.js +13 -6
package/dist/ses.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ses@1.
|
|
1
|
+
// ses@1.4.1
|
|
2
2
|
'use strict';
|
|
3
3
|
(() => {
|
|
4
4
|
const functors = [
|
|
@@ -164,6 +164,9 @@ const arrayIncludes= uncurryThis(arrayPrototype.includes);$h_once.arr
|
|
|
164
164
|
const arrayJoin= uncurryThis(arrayPrototype.join);
|
|
165
165
|
/** @type {<T, U>(thisArg: readonly T[], callbackfn: (value: T, index: number, array: T[]) => U, cbThisArg?: any) => U[]} */$h_once.arrayJoin(arrayJoin);
|
|
166
166
|
const arrayMap= /** @type {any} */ uncurryThis(arrayPrototype.map);$h_once.arrayMap(arrayMap);
|
|
167
|
+
const arrayFlatMap= /** @type {any} */
|
|
168
|
+
uncurryThis(arrayPrototype.flatMap);$h_once.arrayFlatMap(arrayFlatMap);
|
|
169
|
+
|
|
167
170
|
const arrayPop= uncurryThis(arrayPrototype.pop);
|
|
168
171
|
/** @type {<T>(thisArg: T[], ...items: T[]) => number} */$h_once.arrayPop(arrayPop);
|
|
169
172
|
const arrayPush= uncurryThis(arrayPrototype.push);$h_once.arrayPush(arrayPush);
|
|
@@ -2030,7 +2033,7 @@ const assert= makeAssert();$h_once.assert(assert);
|
|
|
2030
2033
|
|
|
2031
2034
|
|
|
2032
2035
|
/**
|
|
2033
|
-
* @
|
|
2036
|
+
* @import {Harden} from '../types.js'
|
|
2034
2037
|
*/
|
|
2035
2038
|
|
|
2036
2039
|
// Obtain the string tag accessor of of TypedArray so we can indirectly use the
|
|
@@ -4683,21 +4686,28 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
|
|
|
4683
4686
|
return construct(FERAL_REG_EXP, rest, new.target);
|
|
4684
4687
|
};
|
|
4685
4688
|
|
|
4686
|
-
const speciesDesc= getOwnPropertyDescriptor(FERAL_REG_EXP, speciesSymbol);
|
|
4687
|
-
if( !speciesDesc) {
|
|
4688
|
-
throw TypeError('no RegExp[Symbol.species] descriptor');
|
|
4689
|
-
}
|
|
4690
|
-
|
|
4691
4689
|
defineProperties(ResultRegExp, {
|
|
4692
4690
|
length: { value: 2},
|
|
4693
4691
|
prototype: {
|
|
4694
4692
|
value: RegExpPrototype,
|
|
4695
4693
|
writable: false,
|
|
4696
4694
|
enumerable: false,
|
|
4697
|
-
configurable: false}
|
|
4695
|
+
configurable: false}});
|
|
4696
|
+
|
|
4698
4697
|
|
|
4699
|
-
|
|
4698
|
+
// Hermes does not have `Symbol.species`. We should support such platforms.
|
|
4699
|
+
if( speciesSymbol) {
|
|
4700
|
+
const speciesDesc= getOwnPropertyDescriptor(
|
|
4701
|
+
FERAL_REG_EXP,
|
|
4702
|
+
speciesSymbol);
|
|
4700
4703
|
|
|
4704
|
+
if( !speciesDesc) {
|
|
4705
|
+
throw TypeError('no RegExp[Symbol.species] descriptor');
|
|
4706
|
+
}
|
|
4707
|
+
defineProperties(ResultRegExp, {
|
|
4708
|
+
[speciesSymbol]: speciesDesc});
|
|
4709
|
+
|
|
4710
|
+
}
|
|
4701
4711
|
return ResultRegExp;
|
|
4702
4712
|
};
|
|
4703
4713
|
|
|
@@ -5267,7 +5277,7 @@ function tameLocaleMethods(intrinsics, localeTaming= 'safe') {
|
|
|
5267
5277
|
* @param {Function} safeEvaluate
|
|
5268
5278
|
*/
|
|
5269
5279
|
const makeEvalFunction= (safeEvaluate)=>{
|
|
5270
|
-
// We use the
|
|
5280
|
+
// We use the concise method syntax to create an eval without a
|
|
5271
5281
|
// [[Construct]] behavior (such that the invocation "new eval()" throws
|
|
5272
5282
|
// TypeError: eval is not a constructor"), but which still accepts a
|
|
5273
5283
|
// 'this' binding.
|
|
@@ -6617,7 +6627,11 @@ function tameDomains(domainTaming= 'safe') {
|
|
|
6617
6627
|
})()
|
|
6618
6628
|
,
|
|
6619
6629
|
// === functors[34] ===
|
|
6620
|
-
({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, importMeta: $h____meta, }) => (function () { 'use strict'; let WeakSet,arrayFilter,arrayMap,arrayPush,defineProperty,freeze,fromEntries,isError,stringEndsWith,weaksetAdd,weaksetHas;$h_imports([["../commons.js", [["WeakSet", [$h_a => (WeakSet = $h_a)]],["arrayFilter", [$h_a => (arrayFilter = $h_a)]],["arrayMap", [$h_a => (arrayMap = $h_a)]],["arrayPush", [$h_a => (arrayPush = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["fromEntries", [$h_a => (fromEntries = $h_a)]],["isError", [$h_a => (isError = $h_a)]],["stringEndsWith", [$h_a => (stringEndsWith = $h_a)]],["weaksetAdd", [$h_a => (weaksetAdd = $h_a)]],["weaksetHas", [$h_a => (weaksetHas = $h_a)]]]],["./types.js", []],["./internal-types.js", []]]);
|
|
6630
|
+
({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, importMeta: $h____meta, }) => (function () { 'use strict'; let WeakSet,arrayFilter,arrayFlatMap,arrayMap,arrayPop,arrayPush,defineProperty,freeze,fromEntries,isError,stringEndsWith,stringIncludes,stringSplit,weaksetAdd,weaksetHas;$h_imports([["../commons.js", [["WeakSet", [$h_a => (WeakSet = $h_a)]],["arrayFilter", [$h_a => (arrayFilter = $h_a)]],["arrayFlatMap", [$h_a => (arrayFlatMap = $h_a)]],["arrayMap", [$h_a => (arrayMap = $h_a)]],["arrayPop", [$h_a => (arrayPop = $h_a)]],["arrayPush", [$h_a => (arrayPush = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["fromEntries", [$h_a => (fromEntries = $h_a)]],["isError", [$h_a => (isError = $h_a)]],["stringEndsWith", [$h_a => (stringEndsWith = $h_a)]],["stringIncludes", [$h_a => (stringIncludes = $h_a)]],["stringSplit", [$h_a => (stringSplit = $h_a)]],["weaksetAdd", [$h_a => (weaksetAdd = $h_a)]],["weaksetHas", [$h_a => (weaksetHas = $h_a)]]]],["./types.js", []],["./internal-types.js", []]]);
|
|
6631
|
+
|
|
6632
|
+
|
|
6633
|
+
|
|
6634
|
+
|
|
6621
6635
|
|
|
6622
6636
|
|
|
6623
6637
|
|
|
@@ -6665,8 +6679,17 @@ function tameDomains(domainTaming= 'safe') {
|
|
|
6665
6679
|
|
|
6666
6680
|
/** @typedef {keyof VirtualConsole | 'profile' | 'profileEnd'} ConsoleProps */
|
|
6667
6681
|
|
|
6668
|
-
/**
|
|
6669
|
-
|
|
6682
|
+
/**
|
|
6683
|
+
* Those console methods whose actual parameters are `(fmt?, ...args)`
|
|
6684
|
+
* even if their TypeScript types claim otherwise.
|
|
6685
|
+
*
|
|
6686
|
+
* Each is paired with what we consider to be their log severity level.
|
|
6687
|
+
* This is the same as the log severity of these on other
|
|
6688
|
+
* platform console implementations when they all agree.
|
|
6689
|
+
*
|
|
6690
|
+
* @type {readonly [ConsoleProps, LogSeverity | undefined][]}
|
|
6691
|
+
*/
|
|
6692
|
+
const consoleLevelMethods= freeze([
|
|
6670
6693
|
['debug', 'debug'], // (fmt?, ...args) verbose level on Chrome
|
|
6671
6694
|
['log', 'log'], // (fmt?, ...args) info level on Chrome
|
|
6672
6695
|
['info', 'info'], // (fmt?, ...args)
|
|
@@ -6674,13 +6697,22 @@ const consoleLevelMethods= freeze([
|
|
|
6674
6697
|
['error', 'error'], // (fmt?, ...args)
|
|
6675
6698
|
|
|
6676
6699
|
['trace', 'log'], // (fmt?, ...args)
|
|
6677
|
-
['dirxml', 'log'], // (fmt?, ...args)
|
|
6678
|
-
['group', 'log'], // (fmt?, ...args)
|
|
6679
|
-
['groupCollapsed', 'log'] // (fmt?, ...args)
|
|
6700
|
+
['dirxml', 'log'], // (fmt?, ...args) but TS typed (...data)
|
|
6701
|
+
['group', 'log'], // (fmt?, ...args) but TS typed (...label)
|
|
6702
|
+
['groupCollapsed', 'log'] // (fmt?, ...args) but TS typed (...label)
|
|
6680
6703
|
]);
|
|
6681
6704
|
|
|
6682
|
-
/**
|
|
6683
|
-
|
|
6705
|
+
/**
|
|
6706
|
+
* Those console methods other than those already enumerated by
|
|
6707
|
+
* `consoleLevelMethods`.
|
|
6708
|
+
*
|
|
6709
|
+
* Each is paired with what we consider to be their log severity level.
|
|
6710
|
+
* This is the same as the log severity of these on other
|
|
6711
|
+
* platform console implementations when they all agree.
|
|
6712
|
+
*
|
|
6713
|
+
* @type {readonly [ConsoleProps, LogSeverity | undefined][]}
|
|
6714
|
+
*/$h_once.consoleLevelMethods(consoleLevelMethods);
|
|
6715
|
+
const consoleOtherMethods= freeze([
|
|
6684
6716
|
['assert', 'error'], // (value, fmt?, ...args)
|
|
6685
6717
|
['timeLog', 'log'], // (label?, ...args) no fmt string
|
|
6686
6718
|
|
|
@@ -6703,8 +6735,8 @@ const consoleOtherMethods= freeze([
|
|
|
6703
6735
|
['timeStamp', undefined] // (label?)
|
|
6704
6736
|
]);
|
|
6705
6737
|
|
|
6706
|
-
/** @type {readonly [ConsoleProps, LogSeverity | undefined][]}
|
|
6707
|
-
const
|
|
6738
|
+
/** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */$h_once.consoleOtherMethods(consoleOtherMethods);
|
|
6739
|
+
const consoleWhitelist= freeze([
|
|
6708
6740
|
...consoleLevelMethods,
|
|
6709
6741
|
...consoleOtherMethods]);
|
|
6710
6742
|
|
|
@@ -6736,10 +6768,10 @@ const consoleWhitelist= freeze([
|
|
|
6736
6768
|
* ]);
|
|
6737
6769
|
*/
|
|
6738
6770
|
|
|
6739
|
-
//
|
|
6771
|
+
// //////////////////////////// Logging Console ////////////////////////////////
|
|
6740
6772
|
|
|
6741
|
-
/** @type {MakeLoggingConsoleKit}
|
|
6742
|
-
const
|
|
6773
|
+
/** @type {MakeLoggingConsoleKit} */
|
|
6774
|
+
const makeLoggingConsoleKit= (
|
|
6743
6775
|
loggedErrorHandler,
|
|
6744
6776
|
{ shouldResetForDebugging= false}= {})=>
|
|
6745
6777
|
{
|
|
@@ -6781,10 +6813,24 @@ const makeLoggingConsoleKit= (
|
|
|
6781
6813
|
};$h_once.makeLoggingConsoleKit(makeLoggingConsoleKit);
|
|
6782
6814
|
freeze(makeLoggingConsoleKit);
|
|
6783
6815
|
|
|
6816
|
+
/**
|
|
6817
|
+
* Makes the same calls on a `baseConsole` that were made on a
|
|
6818
|
+
* `loggingConsole` to produce this `log`. In this way, a logging console
|
|
6819
|
+
* can be used as a buffer to delay the application of these calls to a
|
|
6820
|
+
* `baseConsole`.
|
|
6821
|
+
*
|
|
6822
|
+
* @param {LogRecord[]} log
|
|
6823
|
+
* @param {VirtualConsole} baseConsole
|
|
6824
|
+
*/
|
|
6825
|
+
const pumpLogToConsole= (log, baseConsole)=> {
|
|
6826
|
+
for( const [name, ...args]of log) {
|
|
6827
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
6828
|
+
baseConsole[name](...args);
|
|
6829
|
+
}
|
|
6830
|
+
};
|
|
6831
|
+
// //////////////////////////// Causal Console /////////////////////////////////
|
|
6784
6832
|
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
/** @type {ErrorInfo} */
|
|
6833
|
+
/** @type {ErrorInfo} */$h_once.pumpLogToConsole(pumpLogToConsole);
|
|
6788
6834
|
const ErrorInfo= {
|
|
6789
6835
|
NOTE: 'ERROR_NOTE:',
|
|
6790
6836
|
MESSAGE: 'ERROR_MESSAGE:',
|
|
@@ -6794,7 +6840,7 @@ const ErrorInfo= {
|
|
|
6794
6840
|
freeze(ErrorInfo);
|
|
6795
6841
|
|
|
6796
6842
|
/** @type {MakeCausalConsole} */
|
|
6797
|
-
const
|
|
6843
|
+
const makeCausalConsole= (baseConsole, loggedErrorHandler)=> {
|
|
6798
6844
|
if( !baseConsole) {
|
|
6799
6845
|
return undefined;
|
|
6800
6846
|
}
|
|
@@ -6982,11 +7028,105 @@ const makeCausalConsole= (baseConsole, loggedErrorHandler)=> {
|
|
|
6982
7028
|
};$h_once.makeCausalConsole(makeCausalConsole);
|
|
6983
7029
|
freeze(makeCausalConsole);
|
|
6984
7030
|
|
|
7031
|
+
/**
|
|
7032
|
+
* @typedef {(...args: unknown[]) => void} Logger
|
|
7033
|
+
*/
|
|
6985
7034
|
|
|
6986
|
-
|
|
7035
|
+
/**
|
|
7036
|
+
* This is a rather horrible kludge to indent the output to a logger in
|
|
7037
|
+
* the case where some arguments are strings containing newlines. Part of
|
|
7038
|
+
* the problem is that console-like loggers, including the one in ava,
|
|
7039
|
+
* join the string arguments of the log message with a space.
|
|
7040
|
+
* Because of this, there's an extra space at the beginning of each of
|
|
7041
|
+
* the split lines. So this kludge compensated by putting an extra empty
|
|
7042
|
+
* string at the beginning, so that the logger will add the same extra
|
|
7043
|
+
* joiner.
|
|
7044
|
+
* TODO: Fix this horrible kludge, and indent in a sane manner.
|
|
7045
|
+
*
|
|
7046
|
+
* @param {string} str
|
|
7047
|
+
* @param {string} sep
|
|
7048
|
+
* @param {string[]} indents
|
|
7049
|
+
* @returns {string[]}
|
|
7050
|
+
*/
|
|
7051
|
+
const indentAfterAllSeps= (str, sep, indents)=> {
|
|
7052
|
+
const [firstLine, ...restLines]= stringSplit(str, sep);
|
|
7053
|
+
const indentedRest= arrayFlatMap(restLines, (line)=>[sep, ...indents, line]);
|
|
7054
|
+
return ['', firstLine, ...indentedRest];
|
|
7055
|
+
};
|
|
7056
|
+
|
|
7057
|
+
/**
|
|
7058
|
+
* @param {LoggedErrorHandler} loggedErrorHandler
|
|
7059
|
+
*/
|
|
7060
|
+
const defineCausalConsoleFromLogger= (loggedErrorHandler)=>{
|
|
7061
|
+
/**
|
|
7062
|
+
* Implement the `VirtualConsole` API badly by turning all calls into
|
|
7063
|
+
* calls on `tlogger`. We need to do this to have `console` logging
|
|
7064
|
+
* turn into calls to Ava's `t.log`, so these console log messages
|
|
7065
|
+
* are output in the right place.
|
|
7066
|
+
*
|
|
7067
|
+
* @param {Logger} tlogger
|
|
7068
|
+
* @returns {VirtualConsole}
|
|
7069
|
+
*/
|
|
7070
|
+
const makeCausalConsoleFromLogger= (tlogger)=>{
|
|
7071
|
+
const indents= [];
|
|
7072
|
+
const logWithIndent= (...args)=> {
|
|
7073
|
+
if( indents.length> 0) {
|
|
7074
|
+
args= arrayFlatMap(args, (arg)=>
|
|
7075
|
+
typeof arg=== 'string'&& stringIncludes(arg, '\n')?
|
|
7076
|
+
indentAfterAllSeps(arg, '\n', indents):
|
|
7077
|
+
[arg]);
|
|
7078
|
+
|
|
7079
|
+
args= [...indents, ...args];
|
|
7080
|
+
}
|
|
7081
|
+
return tlogger(...args);
|
|
7082
|
+
};
|
|
7083
|
+
const makeNamed= (name, fn)=>
|
|
7084
|
+
({ [name]: (...args)=> fn(...args)})[ name];
|
|
7085
|
+
|
|
7086
|
+
const baseConsole= fromEntries([
|
|
7087
|
+
...arrayMap(consoleLevelMethods, ([name])=> [
|
|
7088
|
+
name,
|
|
7089
|
+
makeNamed(name, logWithIndent)]),
|
|
7090
|
+
|
|
7091
|
+
...arrayMap(consoleOtherMethods, ([name])=> [
|
|
7092
|
+
name,
|
|
7093
|
+
makeNamed(name, (...args)=> logWithIndent(name, ...args))])]);
|
|
7094
|
+
|
|
7095
|
+
|
|
7096
|
+
// https://console.spec.whatwg.org/#grouping
|
|
7097
|
+
for( const name of ['group', 'groupCollapsed']) {
|
|
7098
|
+
if( baseConsole[name]) {
|
|
7099
|
+
baseConsole[name]= makeNamed(name, (...args)=> {
|
|
7100
|
+
if( args.length>= 1) {
|
|
7101
|
+
// Prefix the logged data with "group" or "groupCollapsed".
|
|
7102
|
+
logWithIndent(...args);
|
|
7103
|
+
}
|
|
7104
|
+
// A single space is enough;
|
|
7105
|
+
// the host console will separate them with additional spaces.
|
|
7106
|
+
arrayPush(indents, ' ');
|
|
7107
|
+
});
|
|
7108
|
+
}
|
|
7109
|
+
}
|
|
7110
|
+
if( baseConsole.groupEnd) {
|
|
7111
|
+
baseConsole.groupEnd= makeNamed('groupEnd', (...args)=> {
|
|
7112
|
+
arrayPop(indents);
|
|
7113
|
+
});
|
|
7114
|
+
}
|
|
7115
|
+
harden(baseConsole);
|
|
7116
|
+
const causalConsole= makeCausalConsole(
|
|
7117
|
+
/** @type {VirtualConsole} */ baseConsole,
|
|
7118
|
+
loggedErrorHandler);
|
|
7119
|
+
|
|
7120
|
+
return (/** @type {VirtualConsole} */ causalConsole);
|
|
7121
|
+
};
|
|
7122
|
+
return freeze(makeCausalConsoleFromLogger);
|
|
7123
|
+
};$h_once.defineCausalConsoleFromLogger(defineCausalConsoleFromLogger);
|
|
7124
|
+
freeze(defineCausalConsoleFromLogger);
|
|
7125
|
+
|
|
7126
|
+
// ///////////////////////// Filter Console ////////////////////////////////////
|
|
6987
7127
|
|
|
6988
7128
|
/** @type {FilterConsole} */
|
|
6989
|
-
const
|
|
7129
|
+
const filterConsole= (baseConsole, filter, _topic= undefined)=> {
|
|
6990
7130
|
// TODO do something with optional topic string
|
|
6991
7131
|
const whitelist= arrayFilter(
|
|
6992
7132
|
consoleWhitelist,
|
|
@@ -10103,7 +10243,7 @@ const tameFauxDataProperties= (intrinsics)=>{
|
|
|
10103
10243
|
|
|
10104
10244
|
|
|
10105
10245
|
|
|
10106
|
-
/** @
|
|
10246
|
+
/** @import {LockdownOptions} from '../types.js' */
|
|
10107
10247
|
|
|
10108
10248
|
const { Fail, details: d, quote: q}= assert;
|
|
10109
10249
|
|
|
@@ -10497,8 +10637,10 @@ const repairIntrinsics= (options= {})=> {
|
|
|
10497
10637
|
|
|
10498
10638
|
|
|
10499
10639
|
|
|
10640
|
+
/** @import {LockdownOptions} from '../types.js' */
|
|
10641
|
+
|
|
10500
10642
|
/**
|
|
10501
|
-
* @param {
|
|
10643
|
+
* @param {LockdownOptions} options
|
|
10502
10644
|
*/
|
|
10503
10645
|
globalThis.lockdown= (options)=>{
|
|
10504
10646
|
const hardenIntrinsics= repairIntrinsics(options);
|
|
@@ -10506,7 +10648,7 @@ globalThis.lockdown= (options)=>{
|
|
|
10506
10648
|
};
|
|
10507
10649
|
|
|
10508
10650
|
/**
|
|
10509
|
-
* @param {
|
|
10651
|
+
* @param {LockdownOptions} options
|
|
10510
10652
|
*/
|
|
10511
10653
|
globalThis.repairIntrinsics= (options)=>{
|
|
10512
10654
|
const hardenIntrinsics= repairIntrinsics(options);
|
|
@@ -10550,7 +10692,60 @@ globalThis.assert= assert;
|
|
|
10550
10692
|
})()
|
|
10551
10693
|
,
|
|
10552
10694
|
// === functors[53] ===
|
|
10553
|
-
({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, importMeta: $h____meta, }) => (function () { 'use strict';
|
|
10695
|
+
({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, importMeta: $h____meta, }) => (function () { 'use strict'; let symbolFor,globalThis,defineCausalConsoleFromLogger,loggedErrorHandler;$h_imports([["./commons.js", [["symbolFor", [$h_a => (symbolFor = $h_a)]],["globalThis", [$h_a => (globalThis = $h_a)]]]],["./error/console.js", [["defineCausalConsoleFromLogger", [$h_a => (defineCausalConsoleFromLogger = $h_a)]]]],["./error/assert.js", [["loggedErrorHandler", [$h_a => (loggedErrorHandler = $h_a)]]]]]);
|
|
10696
|
+
|
|
10697
|
+
|
|
10698
|
+
|
|
10699
|
+
// TODO possible additional exports. Some are privileged.
|
|
10700
|
+
// export { loggedErrorHandler };
|
|
10701
|
+
// export {
|
|
10702
|
+
// makeCausalConsole,
|
|
10703
|
+
// consoleLevelMethods,
|
|
10704
|
+
// consoleOtherMethods,
|
|
10705
|
+
// makeLoggingConsoleKit,
|
|
10706
|
+
// filterConsole,
|
|
10707
|
+
// pumpLogToConsole,
|
|
10708
|
+
// } from './src/error/console.js';
|
|
10709
|
+
// export { assertLogs, throwsAndLogs } from './src/error/throws-and-logs.js';
|
|
10710
|
+
|
|
10711
|
+
/**
|
|
10712
|
+
* Makes a Console like the
|
|
10713
|
+
* [SES causal `console`](https://github.com/endojs/endo/blob/master/packages/ses/src/error/README.md)
|
|
10714
|
+
* but whose output is redirected to the supplied `logger` function.
|
|
10715
|
+
*/
|
|
10716
|
+
const makeCausalConsoleFromLoggerForSesAva=
|
|
10717
|
+
defineCausalConsoleFromLogger(loggedErrorHandler);
|
|
10718
|
+
|
|
10719
|
+
/**
|
|
10720
|
+
*`makeCausalConsoleFromLoggerForSesAva` is privileged because it exposes
|
|
10721
|
+
* unredacted error info onto the `Logger` provided by the caller. It
|
|
10722
|
+
* should not be made available to non-privileged code.
|
|
10723
|
+
*
|
|
10724
|
+
* Further, we consider this particular API choice to be experimental
|
|
10725
|
+
* and may change in the future. It is currently only intended for use by
|
|
10726
|
+
* `@endo/ses-ava`, with which it will be co-maintained.
|
|
10727
|
+
*
|
|
10728
|
+
* Thus, this `console-shim.js` makes `makeCausalConsoleFromLoggerForSesAva`
|
|
10729
|
+
* available on `globalThis` which it *assumes* is the global of the start
|
|
10730
|
+
* compartment and is therefore allowed to hold powers that should not be
|
|
10731
|
+
* available in constructed compartments. It makes it available as the value of
|
|
10732
|
+
* a global property named by a registered symbol named
|
|
10733
|
+
* `MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA`.
|
|
10734
|
+
*
|
|
10735
|
+
* Anyone accessing this, including `@endo/ses-ava`, should feature test for
|
|
10736
|
+
* this and be tolerant of its absence. It may indeed disappear from later
|
|
10737
|
+
* versions of the ses-shim.
|
|
10738
|
+
*/
|
|
10739
|
+
const MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA= symbolFor(
|
|
10740
|
+
'MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA');
|
|
10741
|
+
|
|
10742
|
+
|
|
10743
|
+
globalThis[MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA]=
|
|
10744
|
+
makeCausalConsoleFromLoggerForSesAva;
|
|
10745
|
+
})()
|
|
10746
|
+
,
|
|
10747
|
+
// === functors[54] ===
|
|
10748
|
+
({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, importMeta: $h____meta, }) => (function () { 'use strict'; $h_imports([["./src/lockdown-shim.js", []],["./src/compartment-shim.js", []],["./src/assert-shim.js", []],["./src/console-shim.js", []]]);
|
|
10554
10749
|
})()
|
|
10555
10750
|
,
|
|
10556
10751
|
]; // functors end
|
|
@@ -10660,6 +10855,7 @@ globalThis.assert= assert;
|
|
|
10660
10855
|
arrayIncludes: cell("arrayIncludes"),
|
|
10661
10856
|
arrayJoin: cell("arrayJoin"),
|
|
10662
10857
|
arrayMap: cell("arrayMap"),
|
|
10858
|
+
arrayFlatMap: cell("arrayFlatMap"),
|
|
10663
10859
|
arrayPop: cell("arrayPop"),
|
|
10664
10860
|
arrayPush: cell("arrayPush"),
|
|
10665
10861
|
arraySlice: cell("arraySlice"),
|
|
@@ -10840,10 +11036,13 @@ globalThis.assert= assert;
|
|
|
10840
11036
|
tameDomains: cell("tameDomains"),
|
|
10841
11037
|
},
|
|
10842
11038
|
{
|
|
11039
|
+
consoleLevelMethods: cell("consoleLevelMethods"),
|
|
11040
|
+
consoleOtherMethods: cell("consoleOtherMethods"),
|
|
10843
11041
|
makeLoggingConsoleKit: cell("makeLoggingConsoleKit"),
|
|
11042
|
+
pumpLogToConsole: cell("pumpLogToConsole"),
|
|
10844
11043
|
makeCausalConsole: cell("makeCausalConsole"),
|
|
11044
|
+
defineCausalConsoleFromLogger: cell("defineCausalConsoleFromLogger"),
|
|
10845
11045
|
filterConsole: cell("filterConsole"),
|
|
10846
|
-
consoleWhitelist: cell("consoleWhitelist"),
|
|
10847
11046
|
},
|
|
10848
11047
|
{
|
|
10849
11048
|
makeRejectionHandlers: cell("makeRejectionHandlers"),
|
|
@@ -10908,6 +11107,8 @@ globalThis.assert= assert;
|
|
|
10908
11107
|
},
|
|
10909
11108
|
{
|
|
10910
11109
|
},
|
|
11110
|
+
{
|
|
11111
|
+
},
|
|
10911
11112
|
];
|
|
10912
11113
|
|
|
10913
11114
|
Object.defineProperties(cells[3], Object.getOwnPropertyDescriptors(cells[2]));
|
|
@@ -11030,6 +11231,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
11030
11231
|
arrayIncludes: cells[0].arrayIncludes.set,
|
|
11031
11232
|
arrayJoin: cells[0].arrayJoin.set,
|
|
11032
11233
|
arrayMap: cells[0].arrayMap.set,
|
|
11234
|
+
arrayFlatMap: cells[0].arrayFlatMap.set,
|
|
11033
11235
|
arrayPop: cells[0].arrayPop.set,
|
|
11034
11236
|
arrayPush: cells[0].arrayPush.set,
|
|
11035
11237
|
arraySlice: cells[0].arraySlice.set,
|
|
@@ -11538,10 +11740,13 @@ function observeImports(map, importName, importIndex) {
|
|
|
11538
11740
|
liveVar: {
|
|
11539
11741
|
},
|
|
11540
11742
|
onceVar: {
|
|
11743
|
+
consoleLevelMethods: cells[34].consoleLevelMethods.set,
|
|
11744
|
+
consoleOtherMethods: cells[34].consoleOtherMethods.set,
|
|
11541
11745
|
makeLoggingConsoleKit: cells[34].makeLoggingConsoleKit.set,
|
|
11746
|
+
pumpLogToConsole: cells[34].pumpLogToConsole.set,
|
|
11542
11747
|
makeCausalConsole: cells[34].makeCausalConsole.set,
|
|
11748
|
+
defineCausalConsoleFromLogger: cells[34].defineCausalConsoleFromLogger.set,
|
|
11543
11749
|
filterConsole: cells[34].filterConsole.set,
|
|
11544
|
-
consoleWhitelist: cells[34].consoleWhitelist.set,
|
|
11545
11750
|
},
|
|
11546
11751
|
importMeta: {},
|
|
11547
11752
|
});
|
|
@@ -11824,11 +12029,25 @@ function observeImports(map, importName, importIndex) {
|
|
|
11824
12029
|
importMeta: {},
|
|
11825
12030
|
});
|
|
11826
12031
|
functors[53]({
|
|
12032
|
+
imports(entries) {
|
|
12033
|
+
const map = new Map(entries);
|
|
12034
|
+
observeImports(map, "./commons.js", 0);
|
|
12035
|
+
observeImports(map, "./error/console.js", 34);
|
|
12036
|
+
observeImports(map, "./error/assert.js", 9);
|
|
12037
|
+
},
|
|
12038
|
+
liveVar: {
|
|
12039
|
+
},
|
|
12040
|
+
onceVar: {
|
|
12041
|
+
},
|
|
12042
|
+
importMeta: {},
|
|
12043
|
+
});
|
|
12044
|
+
functors[54]({
|
|
11827
12045
|
imports(entries) {
|
|
11828
12046
|
const map = new Map(entries);
|
|
11829
12047
|
observeImports(map, "./src/lockdown-shim.js", 50);
|
|
11830
12048
|
observeImports(map, "./src/compartment-shim.js", 51);
|
|
11831
12049
|
observeImports(map, "./src/assert-shim.js", 52);
|
|
12050
|
+
observeImports(map, "./src/console-shim.js", 53);
|
|
11832
12051
|
},
|
|
11833
12052
|
liveVar: {
|
|
11834
12053
|
},
|