Skip to content

Commit

Permalink
no glimmer component
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Oct 14, 2024
1 parent ef36fbc commit 235ab99
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default class DataDebug extends DebugPort {
return owner.resolveRegistration(name);
}


get objectInspector() {
return this.namespace?.objectInspector;
}
Expand Down
68 changes: 36 additions & 32 deletions packages/@ember/debug/ember-inspector-support/deprecation-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ import SourceMap from '@ember/debug/ember-inspector-support/libs/source-map';
import { registerDeprecationHandler } from '@ember/debug';
import { guidFor } from '@ember/debug/ember-inspector-support/utils/ember/object/internals';
import { cancel, debounce } from '@ember/runloop';
import SourceMapSupport from '@ember/debug/ember-inspector-support/libs/source-map';
import type SourceMapSupport from '@ember/debug/ember-inspector-support/libs/source-map';

export default class DeprecationDebug extends DebugPort {
options: any;
private _warned!: boolean;
debounce: any;
private _watching: any;
deprecationsToSend: { stackStr: string, message: string, url: string, count: number, id: string, sources: any[] }[];
deprecationsToSend: {
stackStr: string;
message: string;
url: string;
count: number;
id: string;
sources: any[];
}[];
private sourceMap!: SourceMapSupport;
groupedDeprecations: any;
deprecations: any;
Expand All @@ -36,7 +43,10 @@ export default class DeprecationDebug extends DebugPort {
this.sendPending();
},

sendStackTraces(this: DeprecationDebug, message: { deprecation: { message: string; sources: { stackStr: string }[] } }) {
sendStackTraces(
this: DeprecationDebug,
message: { deprecation: { message: string; sources: { stackStr: string }[] } }
) {
let deprecation = message.deprecation;
deprecation.sources.forEach((source) => {
let stack = source.stackStr;
Expand Down Expand Up @@ -97,26 +107,23 @@ export default class DeprecationDebug extends DebugPort {
*/
fetchSourceMap(stackStr: string) {
if (this.emberCliConfig && this.emberCliConfig.environment === 'development') {
return this.sourceMap.map(stackStr).then(
(mapped: any[]) => {
if (mapped && mapped.length > 0) {
let source = mapped.find(
(item: any) =>
item.source &&
Boolean(item.source.match(new RegExp(this.emberCliConfig.modulePrefix)))
);

if (source) {
source.found = true;
} else {
source = mapped[0];
source.found = false;
}
return source;
return this.sourceMap.map(stackStr).then((mapped: any[]) => {
if (mapped && mapped.length > 0) {
let source = mapped.find(
(item: any) =>
item.source &&
Boolean(item.source.match(new RegExp(this.emberCliConfig.modulePrefix)))
);

if (source) {
source.found = true;
} else {
source = mapped[0];
source.found = false;
}
},
null
);
return source;
}
}, null);
} else {
return Promise.resolve(null);
}
Expand Down Expand Up @@ -150,16 +157,13 @@ export default class DeprecationDebug extends DebugPort {
let found = obj.sources.find((s: any) => s.stackStr === deprecation.stackStr);
if (!found) {
let stackStr = deprecation.stackStr;
promise = this.fetchSourceMap(stackStr).then(
(map) => {
obj.sources.push({ map, stackStr });
if (map) {
obj.hasSourceMap = true;
}
return undefined;
},
null
);
promise = this.fetchSourceMap(stackStr).then((map) => {
obj.sources.push({ map, stackStr });
if (map) {
obj.hasSourceMap = true;
}
return undefined;
}, null);
}
return promise.then(() => {
delete obj.stackStr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import type Mixin from '@ember/object/mixin';
import ObjectProxy from '@ember/object/proxy';
import ArrayProxy from '@ember/array/proxy';
import Component from '@ember/component';
import GlimmerComponent from '@glimmer/component';

const keys = Object.keys;

Expand Down Expand Up @@ -1228,7 +1227,7 @@ function getDebugInfo(object: any) {
'element',
'targetObject'
);
} else if (GlimmerComponent && object instanceof GlimmerComponent) {
} else if (object.constructor.name === 'GlimmerDebugComponent') {
// These properties don't really exist on Glimmer Components, but
// reading their values trigger a development mode assertion. The
// more correct long term fix is to make getters lazy (shows "..."
Expand Down

0 comments on commit 235ab99

Please sign in to comment.