@@ -4,22 +4,12 @@ const {
4
4
ArrayPrototypeMap,
5
5
JSONParse,
6
6
ObjectKeys,
7
- ObjectGetOwnPropertyDescriptor,
8
- ObjectPrototypeHasOwnProperty,
9
7
RegExpPrototypeExec,
10
8
RegExpPrototypeSymbolSplit,
11
9
SafeMap,
12
10
StringPrototypeSplit,
13
11
} = primordials ;
14
12
15
- function ObjectGetValueSafe ( obj , key ) {
16
- const desc = ObjectGetOwnPropertyDescriptor ( obj , key ) ;
17
- if ( desc === undefined ) {
18
- return undefined ;
19
- }
20
- return ObjectPrototypeHasOwnProperty ( desc , 'value' ) ? desc . value : undefined ;
21
- }
22
-
23
13
// See https://sourcemaps.info/spec.html for SourceMap V3 specification.
24
14
const { Buffer } = require ( 'buffer' ) ;
25
15
let debug = require ( 'internal/util/debuglog' ) . debuglog ( 'source_map' , ( fn ) => {
@@ -301,11 +291,11 @@ function sourceMapCacheToObject() {
301
291
302
292
function appendCJSCache ( obj ) {
303
293
for ( const value of getCjsSourceMapCache ( ) ) {
304
- obj [ ObjectGetValueSafe ( value , ' filename' ) ] = {
294
+ obj [ value . filename ] = {
305
295
__proto__ : null ,
306
- lineLengths : ObjectGetValueSafe ( value , ' lineLengths' ) ,
307
- data : ObjectGetValueSafe ( value , ' data' ) ,
308
- url : ObjectGetValueSafe ( value , ' url' )
296
+ lineLengths : value . lineLengths ,
297
+ data : value . data ,
298
+ url : value . url ,
309
299
} ;
310
300
}
311
301
}
@@ -320,8 +310,8 @@ function findSourceMap(sourceURL) {
320
310
let entry = esmSourceMapCache . get ( sourceURL ) ?? generatedSourceMapCache . get ( sourceURL ) ;
321
311
if ( entry === undefined ) {
322
312
for ( const value of getCjsSourceMapCache ( ) ) {
323
- const filename = ObjectGetValueSafe ( value , ' filename' ) ;
324
- const cachedSourceURL = ObjectGetValueSafe ( value , ' sourceURL' ) ;
313
+ const filename = value . filename ;
314
+ const cachedSourceURL = value . sourceURL ;
325
315
if ( sourceURL === filename || sourceURL === cachedSourceURL ) {
326
316
entry = value ;
327
317
}
@@ -330,9 +320,9 @@ function findSourceMap(sourceURL) {
330
320
if ( entry === undefined ) {
331
321
return undefined ;
332
322
}
333
- let sourceMap = ObjectGetValueSafe ( entry , ' sourceMap' ) ;
323
+ let sourceMap = entry . sourceMap ;
334
324
if ( sourceMap === undefined ) {
335
- sourceMap = new SourceMap ( ObjectGetValueSafe ( entry , ' data' ) ) ;
325
+ sourceMap = new SourceMap ( entry . data ) ;
336
326
entry . sourceMap = sourceMap ;
337
327
}
338
328
return sourceMap ;
0 commit comments