Skip to content

Inspector support for vite #20892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions broccoli/amd-compat-entrypoints/ember.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ d('@ember/debug/lib/warn', emberDebugLibWarn);
import * as emberDebugContainerDebugAdapter from '@ember/debug/container-debug-adapter';
d('@ember/debug/container-debug-adapter', emberDebugContainerDebugAdapter);

import * as emberDebugInspectorSupport from '@ember/debug/inspector-support';
d('@ember/debug/inspector-support', emberDebugInspectorSupport);

import * as emberDebugDataAdapter from '@ember/debug/data-adapter';
d('@ember/debug/data-adapter', emberDebugDataAdapter);

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
"@ember/debug/container-debug-adapter.js": "ember-source/@ember/debug/container-debug-adapter.js",
"@ember/debug/data-adapter.js": "ember-source/@ember/debug/data-adapter.js",
"@ember/debug/index.js": "ember-source/@ember/debug/index.js",
"@ember/debug/inspector-support.js": "ember-source/@ember/debug/inspector-support.js",
"@ember/debug/lib/assert.js": "ember-source/@ember/debug/lib/assert.js",
"@ember/debug/lib/capture-render-tree.js": "ember-source/@ember/debug/lib/capture-render-tree.js",
"@ember/debug/lib/deprecate.js": "ember-source/@ember/debug/lib/deprecate.js",
Expand Down Expand Up @@ -400,4 +401,4 @@
}
},
"packageManager": "[email protected]"
}
}
36 changes: 36 additions & 0 deletions packages/@ember/debug/inspector-support.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// eslint-disable-next-line no-var, @typescript-eslint/no-unused-vars
var emberInspectorLoader: any;

globalThis.emberInspectorLoader = {
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const SECRET = Symbol.for('__ember-inspector_loader_please_🙏_dont_import_this_its_not_public_api_thank_you_❤️__');

globalThis[SECRET] = {
// ...

// eslint-disable-next-line disable-features/disable-async-await
async load() {
// TODO we probably want to be more careful about what we expose here
return {
Application: await import('@ember/application'),
ApplicationNamespace: await import('@ember/application/namespace'),
Array: await import('@ember/array'),
ArrayMutable: await import('@ember/array/mutable'),
ArrayProxy: await import('@ember/array/proxy'),
Component: await import('@ember/component'),
Controller: await import('@ember/controller'),
Debug: await import('@ember/debug'),
EmberObject: await import('@ember/object'),
EnumerableMutable: await import('@ember/enumerable/mutable'),
InternalsEnvironment: await import('@ember/-internals/environment'),
InternalsMeta: await import('@ember/-internals/meta'),
InternalsMetal: await import('@ember/-internals/metal'),
InternalsUtils: await import('@ember/-internals/utils'),
Instrumentation: await import('@ember/instrumentation'),
Object: await import('@ember/object'),
ObjectCore: await import('@ember/object/core'),
ObjectInternals: await import('@ember/object/internals'),
ObjectEvented: await import('@ember/object/evented'),
ObjectObservable: await import('@ember/object/observable'),
ObjectPromiseProxyMixin: await import('@ember/object/promise-proxy-mixin'),
ObjectProxy: await import('@ember/object/proxy'),
Service: await import('@ember/service'),
VERSION: await import('ember/version'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can VERSION be outside the load function? it's like 3 bytes and would allow the inspector to branch functionality before loading (via load() all these modules)

RSVP: await import('rsvp'),
};
},
};
3 changes: 2 additions & 1 deletion packages/@ember/debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"exports": {
".": "./index.ts",
"./container-debug-adapter": "./container-debug-adapter.ts",
"./data-adapter": "./data-adapter.ts"
"./data-adapter": "./data-adapter.ts",
"./inspector-support": "./inspector-support.ts"
},
"dependencies": {
"@ember/-internals": "workspace:*",
Expand Down
Loading