@@ -8,29 +8,16 @@ import {
8
8
inspect ,
9
9
} from 'ember-debug/utils/type-check' ;
10
10
import { compareVersion } from 'ember-debug/utils/version' ;
11
- import {
12
- EmberObject ,
13
- meta as emberMeta ,
14
- VERSION ,
15
- CoreObject ,
16
- ObjectProxy ,
17
- ArrayProxy ,
18
- Service ,
19
- Component ,
20
- } from 'ember-debug/utils/ember' ;
11
+ import { classes , debug , object , ember } from 'ember-debug/utils/ember' ;
21
12
import { cacheFor , guidFor } from 'ember-debug/utils/ember/object/internals' ;
22
13
import { _backburner , join } from 'ember-debug/utils/ember/runloop' ;
23
14
import emberNames from './utils/ember-object-names' ;
24
15
import getObjectName from './utils/get-object-name' ;
25
16
import { EmberLoader } from 'ember-debug/utils/ember/loader' ;
26
17
27
- const GlimmerComponent = ( ( ) => {
28
- try {
29
- return EmberLoader . require ( '@glimmer/component' ) . default ;
30
- } catch ( e ) {
31
- // ignore, return undefined
32
- }
33
- } ) ( ) ;
18
+ const { CoreObject, ObjectProxy } = classes ;
19
+ const { VERSION } = ember ;
20
+ const { meta : emberMeta } = object ;
34
21
35
22
let tagValue , tagValidate , track , tagForProperty ;
36
23
@@ -122,7 +109,7 @@ function inspectValue(object, key, computedValue) {
122
109
return { type : `type-${ typeOf ( value ) } ` , inspect : inspect ( value ) } ;
123
110
}
124
111
125
- if ( value instanceof EmberObject ) {
112
+ if ( value instanceof classes . EmberObject ) {
126
113
return { type : 'type-ember-object' , inspect : value . toString ( ) } ;
127
114
} else if ( isComputed ( object , key ) ) {
128
115
string = '<computed>' ;
@@ -276,8 +263,7 @@ export default class extends DebugPort {
276
263
const tracked = ( this . trackedTags [ objectId ] =
277
264
this . trackedTags [ objectId ] || { } ) ;
278
265
279
- const desc = Object . getOwnPropertyDescriptor ( object , item . name ) ;
280
- const isSetter = desc && isMandatorySetter ( desc ) ;
266
+ const isSetter = debug . isMandatorySetter ( object , item . name ) ;
281
267
282
268
if ( HAS_GLIMMER_TRACKING && item . canTrack && ! isSetter ) {
283
269
let tagInfo = tracked [ item . name ] || {
@@ -461,7 +447,7 @@ export default class extends DebugPort {
461
447
canSend ( val ) {
462
448
return (
463
449
val &&
464
- ( val instanceof EmberObject ||
450
+ ( val instanceof classes . EmberObject ||
465
451
val instanceof Object ||
466
452
typeOf ( val ) === 'object' ||
467
453
typeOf ( val ) === 'array' )
@@ -518,7 +504,7 @@ export default class extends DebugPort {
518
504
value = value . stack ;
519
505
}
520
506
let args = [ value ] ;
521
- if ( value instanceof EmberObject ) {
507
+ if ( value instanceof classes . EmberObject ) {
522
508
args . unshift ( inspect ( value ) ) ;
523
509
}
524
510
this . adapter . log ( 'Ember Inspector ($E): ' , ...args ) ;
@@ -704,7 +690,7 @@ export default class extends DebugPort {
704
690
}
705
691
706
692
if (
707
- object instanceof ArrayProxy &&
693
+ object instanceof classes . ArrayProxy &&
708
694
object . content &&
709
695
! object . _showProxyDetails
710
696
) {
@@ -910,7 +896,7 @@ function addProperties(properties, hash) {
910
896
continue ;
911
897
}
912
898
913
- let options = { isMandatorySetter : isMandatorySetter ( desc ) } ;
899
+ let options = { isMandatorySetter : debug . isMandatorySetter ( desc ) } ;
914
900
915
901
if ( typeof hash [ prop ] === 'object' && hash [ prop ] !== null ) {
916
902
options . isService =
@@ -923,7 +909,7 @@ function addProperties(properties, hash) {
923
909
}
924
910
925
911
if ( ! options . isService ) {
926
- options . isService = desc . value instanceof Service ;
912
+ options . isService = desc . value instanceof classes . Service ;
927
913
}
928
914
}
929
915
if ( options . isService ) {
@@ -1255,7 +1241,7 @@ function getDebugInfo(object) {
1255
1241
let debugInfo = null ;
1256
1242
let objectDebugInfo = object . _debugInfo ;
1257
1243
if ( objectDebugInfo && typeof objectDebugInfo === 'function' ) {
1258
- if ( object instanceof ObjectProxy && object . content ) {
1244
+ if ( object instanceof classes . ObjectProxy && object . content ) {
1259
1245
object = object . content ;
1260
1246
}
1261
1247
debugInfo = objectDebugInfo . call ( object ) ;
@@ -1268,7 +1254,7 @@ function getDebugInfo(object) {
1268
1254
skipProperties . push ( 'isDestroyed' , 'isDestroying' , 'container' ) ;
1269
1255
// 'currentState' and 'state' are un-observable private properties.
1270
1256
// The rest are skipped to reduce noise in the inspector.
1271
- if ( Component && object instanceof Component ) {
1257
+ if ( classes . EmberComponent && object instanceof classes . EmberComponent ) {
1272
1258
skipProperties . push (
1273
1259
'currentState' ,
1274
1260
'state' ,
@@ -1284,7 +1270,7 @@ function getDebugInfo(object) {
1284
1270
'element' ,
1285
1271
'targetObject'
1286
1272
) ;
1287
- } else if ( GlimmerComponent && object instanceof GlimmerComponent ) {
1273
+ } else if ( classes . GlimmerComponent && object instanceof classes . GlimmerComponent ) {
1288
1274
// These properties don't really exist on Glimmer Components, but
1289
1275
// reading their values trigger a development mode assertion. The
1290
1276
// more correct long term fix is to make getters lazy (shows "..."
@@ -1303,7 +1289,7 @@ function calculateCP(object, item, errorsForObject) {
1303
1289
const property = item . name ;
1304
1290
delete errorsForObject [ property ] ;
1305
1291
try {
1306
- if ( object instanceof ArrayProxy && property == parseInt ( property ) ) {
1292
+ if ( object instanceof classes . ArrayProxy && property == parseInt ( property ) ) {
1307
1293
return object . objectAt ( property ) ;
1308
1294
}
1309
1295
return item . isGetter || property . includes ?. ( '.' )
0 commit comments