File tree Expand file tree Collapse file tree 8 files changed +30
-60
lines changed Expand file tree Collapse file tree 8 files changed +30
-60
lines changed Original file line number Diff line number Diff line change 11
11
( ( window ) => {
12
12
const core = Deno . core ;
13
13
const {
14
+ Error,
14
15
RegExp,
15
16
ArrayPrototypeMap,
16
17
StringPrototypeCharCodeAt,
275
276
return StringPrototypeMatch ( s , HTTP_BETWEEN_WHITESPACE ) ?. [ 1 ] ?? "" ;
276
277
}
277
278
279
+ class AssertionError extends Error {
280
+ constructor ( msg ) {
281
+ super ( msg ) ;
282
+ this . name = "AssertionError" ;
283
+ }
284
+ }
285
+
286
+ /**
287
+ * @param {unknown } cond
288
+ * @param {string= } msg
289
+ * @returns {asserts cond }
290
+ */
291
+ function assert ( cond , msg = "Assertion failed." ) {
292
+ if ( ! cond ) {
293
+ throw new AssertionError ( msg ) ;
294
+ }
295
+ }
296
+
278
297
window . __bootstrap . infra = {
279
298
collectSequenceOfCodepoints,
280
299
ASCII_DIGIT ,
299
318
collectHttpQuotedString,
300
319
forgivingBase64Encode,
301
320
forgivingBase64Decode,
321
+ AssertionError,
322
+ assert,
302
323
} ;
303
324
} ) ( globalThis ) ;
Original file line number Diff line number Diff line change 6
6
const {
7
7
ArrayPrototypePush,
8
8
ArrayPrototypeShift,
9
- Error,
10
9
FunctionPrototypeCall,
11
10
Map,
12
11
MapPrototypeDelete,
22
21
TypeError,
23
22
} = window . __bootstrap . primordials ;
24
23
const { webidl } = window . __bootstrap ;
25
-
26
- // Shamelessly cribbed from extensions/fetch/11_streams.js
27
- class AssertionError extends Error {
28
- constructor ( msg ) {
29
- super ( msg ) ;
30
- this . name = "AssertionError" ;
31
- }
32
- }
33
-
34
- /**
35
- * @param {unknown } cond
36
- * @param {string= } msg
37
- * @returns {asserts cond }
38
- */
39
- function assert ( cond , msg = "Assertion failed." ) {
40
- if ( ! cond ) {
41
- throw new AssertionError ( msg ) ;
42
- }
43
- }
24
+ const { assert } = window . __bootstrap . infra ;
44
25
45
26
function opNow ( ) {
46
27
return core . opSync ( "op_now" ) ;
Original file line number Diff line number Diff line change 21
21
BigInt64ArrayPrototype,
22
22
BigUint64ArrayPrototype,
23
23
DataView,
24
- Error,
25
24
Int8ArrayPrototype,
26
25
Int16ArrayPrototype,
27
26
Int32ArrayPrototype,
58
57
WeakMapPrototypeSet,
59
58
} = globalThis . __bootstrap . primordials ;
60
59
const consoleInternal = window . __bootstrap . console ;
61
-
62
- class AssertionError extends Error {
63
- constructor ( msg ) {
64
- super ( msg ) ;
65
- this . name = "AssertionError" ;
66
- }
67
- }
68
-
69
- /**
70
- * @param {unknown } cond
71
- * @param {string= } msg
72
- * @returns {asserts cond }
73
- */
74
- function assert ( cond , msg = "Assertion failed." ) {
75
- if ( ! cond ) {
76
- throw new AssertionError ( msg ) ;
77
- }
78
- }
60
+ const { AssertionError, assert } = window . __bootstrap . infra ;
79
61
80
62
/** @template T */
81
63
class Deferred {
Original file line number Diff line number Diff line change 4
4
( ( window ) => {
5
5
const {
6
6
decodeURIComponent,
7
- Error,
8
7
ObjectPrototypeIsPrototypeOf,
9
8
Promise,
10
9
SafeArrayIterator,
34
33
}
35
34
}
36
35
37
- class AssertionError extends Error {
38
- constructor ( msg ) {
39
- super ( msg ) ;
40
- this . name = "AssertionError" ;
41
- }
42
- }
43
-
44
- function assert ( cond , msg = "Assertion failed." ) {
45
- if ( ! cond ) {
46
- throw new AssertionError ( msg ) ;
47
- }
48
- }
49
-
50
36
function createResolvable ( ) {
51
37
let resolve ;
52
38
let reject ;
154
140
log,
155
141
setLogDebug,
156
142
createResolvable,
157
- assert,
158
- AssertionError,
159
143
pathFromURL,
160
144
writable,
161
145
nonEnumerable,
Original file line number Diff line number Diff line change 6
6
"use strict" ;
7
7
8
8
( ( window ) => {
9
- const { assert } = window . __bootstrap . util ;
9
+ const { assert } = window . __bootstrap . infra ;
10
10
const {
11
11
TypedArrayPrototypeSubarray,
12
12
TypedArrayPrototypeSlice,
Original file line number Diff line number Diff line change 5
5
const core = window . Deno . core ;
6
6
const { FsFile } = window . __bootstrap . files ;
7
7
const { readAll } = window . __bootstrap . io ;
8
- const { assert, pathFromURL } = window . __bootstrap . util ;
8
+ const { pathFromURL } = window . __bootstrap . util ;
9
+ const { assert } = window . __bootstrap . infra ;
9
10
const {
10
11
ArrayPrototypeMap,
11
12
TypeError,
Original file line number Diff line number Diff line change 6
6
const { setExitHandler } = window . __bootstrap . os ;
7
7
const { Console, inspectArgs } = window . __bootstrap . console ;
8
8
const { serializePermissions } = window . __bootstrap . permissions ;
9
- const { assert } = window . __bootstrap . util ;
9
+ const { assert } = window . __bootstrap . infra ;
10
10
const {
11
11
AggregateErrorPrototype,
12
12
ArrayPrototypeFilter,
82
82
"op_fdatasync_async" : [ "flush pending data operations for a file to disk" , "awaiting the result of a `Deno.fdatasync` call" ] ,
83
83
"op_fetch_send" : [ "send a HTTP request" , "awaiting the result of a `fetch` call" ] ,
84
84
"op_ffi_call_nonblocking" : [ "do a non blocking ffi call" , "awaiting the returned promise" ] ,
85
- "op_ffi_call_ptr_nonblocking" : [ "do a non blocking ffi call" , "awaiting the returned promise" ] ,
85
+ "op_ffi_call_ptr_nonblocking" : [ "do a non blocking ffi call" , "awaiting the returned promise" ] ,
86
86
"op_flock_async" : [ "lock a file" , "awaiting the result of a `Deno.flock` call" ] ,
87
87
"op_fs_events_poll" : [ "get the next file system event" , "breaking out of a for await loop looping over `Deno.FsEvents`" ] ,
88
88
"op_fstat_async" : [ "get file metadata" , "awaiting the result of a `Deno.File#fstat` call" ] ,
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ delete Object.prototype.__proto__;
25
25
PromisePrototypeThen,
26
26
TypeError,
27
27
} = window . __bootstrap . primordials ;
28
+ const infra = window . __bootstrap . infra ;
28
29
const util = window . __bootstrap . util ;
29
30
const eventTarget = window . __bootstrap . eventTarget ;
30
31
const globalInterfaces = window . __bootstrap . globalInterfaces ;
@@ -705,7 +706,7 @@ delete Object.prototype.__proto__;
705
706
ObjectFreeze ( globalThis . Deno . core ) ;
706
707
} else {
707
708
delete globalThis . Deno ;
708
- util . assert ( globalThis . Deno === undefined ) ;
709
+ infra . assert ( globalThis . Deno === undefined ) ;
709
710
}
710
711
}
711
712
You can’t perform that action at this time.
0 commit comments