ember-inspector 4.13.1-alpha.2025.7.8 → 4.13.1-alpha.2025.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/index.html +1 -1
- package/app/styles/app.scss +1 -0
- package/dist/bookmarklet/load_inspector.js +1 -0
- package/dist/bookmarklet/panes-3-16-0/assets/{chunk.524.da00a6f90eaebf44c4a7.js → chunk.524.659d83812026e721dfd0.js} +4 -4
- package/dist/{firefox/panes-3-16-0/assets/chunk.582.1294decb8a46b69a538a.js → bookmarklet/panes-3-16-0/assets/chunk.582.5b4008f88fe48ebd8416.js} +5 -5
- package/dist/bookmarklet/panes-3-16-0/assets/ember-inspector.css +835 -0
- package/dist/bookmarklet/panes-3-16-0/assets/ember-inspector.js +42 -4
- package/dist/bookmarklet/panes-3-16-0/assets/vendor.css +0 -836
- package/dist/bookmarklet/panes-3-16-0/assets/vendor.js +3967 -4019
- package/dist/bookmarklet/panes-3-16-0/base-object-HAEdWjmg.js +59 -0
- package/dist/bookmarklet/panes-3-16-0/basic-DfbgtngO.js +144 -0
- package/dist/bookmarklet/panes-3-16-0/basic-debug.js +6 -0
- package/dist/bookmarklet/panes-3-16-0/bookmarklet-debug.js +34 -0
- package/dist/bookmarklet/panes-3-16-0/chrome-debug.js +12 -0
- package/dist/bookmarklet/panes-3-16-0/ember.js +108 -0
- package/dist/bookmarklet/panes-3-16-0/ember_debug.js +22 -10646
- package/dist/bookmarklet/panes-3-16-0/evented-BCTya3yE.js +62 -0
- package/dist/bookmarklet/panes-3-16-0/firefox-debug.js +32 -0
- package/dist/bookmarklet/panes-3-16-0/index.html +3 -3
- package/dist/bookmarklet/panes-3-16-0/internals-CRmXMEzb.js +12 -0
- package/dist/bookmarklet/panes-3-16-0/main.js +7642 -0
- package/dist/bookmarklet/panes-3-16-0/port.js +108 -0
- package/dist/bookmarklet/panes-3-16-0/profile-node.js +60 -0
- package/dist/bookmarklet/panes-3-16-0/promise-assembler.js +218 -0
- package/dist/bookmarklet/panes-3-16-0/runloop-CF-Qpqgy.js +1138 -0
- package/dist/bookmarklet/panes-3-16-0/start-inspector-BPAW_WLv.js +376 -0
- package/dist/bookmarklet/panes-3-16-0/type-check.js +119 -0
- package/dist/bookmarklet/panes-3-16-0/version.js +90 -0
- package/dist/bookmarklet/panes-3-16-0/versions.js +4 -0
- package/dist/bookmarklet/panes-3-16-0/web-extension-C3pMNVSY.js +144 -0
- package/dist/bookmarklet/panes-3-16-0/websocket-debug.js +60 -0
- package/dist/chrome/content-script.js +1 -0
- package/dist/chrome/manifest.json +3 -3
- package/dist/{firefox/panes-3-16-0/assets/chunk.524.da00a6f90eaebf44c4a7.js → chrome/panes-3-16-0/assets/chunk.524.659d83812026e721dfd0.js} +4 -4
- package/dist/{bookmarklet/panes-3-16-0/assets/chunk.582.1294decb8a46b69a538a.js → chrome/panes-3-16-0/assets/chunk.582.5b4008f88fe48ebd8416.js} +5 -5
- package/dist/chrome/panes-3-16-0/assets/ember-inspector.css +835 -0
- package/dist/chrome/panes-3-16-0/assets/ember-inspector.js +42 -4
- package/dist/chrome/panes-3-16-0/assets/vendor.css +0 -836
- package/dist/chrome/panes-3-16-0/assets/vendor.js +3967 -4019
- package/dist/chrome/panes-3-16-0/base-object-HAEdWjmg.js +59 -0
- package/dist/chrome/panes-3-16-0/basic-DfbgtngO.js +144 -0
- package/dist/chrome/panes-3-16-0/basic-debug.js +6 -0
- package/dist/chrome/panes-3-16-0/bookmarklet-debug.js +34 -0
- package/dist/chrome/panes-3-16-0/chrome-debug.js +12 -0
- package/dist/chrome/panes-3-16-0/ember.js +108 -0
- package/dist/chrome/panes-3-16-0/ember_debug.js +12 -10658
- package/dist/chrome/panes-3-16-0/evented-BCTya3yE.js +62 -0
- package/dist/chrome/panes-3-16-0/firefox-debug.js +32 -0
- package/dist/chrome/panes-3-16-0/index.html +3 -3
- package/dist/chrome/panes-3-16-0/internals-CRmXMEzb.js +12 -0
- package/dist/chrome/panes-3-16-0/main.js +7642 -0
- package/dist/chrome/panes-3-16-0/port.js +108 -0
- package/dist/chrome/panes-3-16-0/profile-node.js +60 -0
- package/dist/chrome/panes-3-16-0/promise-assembler.js +218 -0
- package/dist/chrome/panes-3-16-0/runloop-CF-Qpqgy.js +1138 -0
- package/dist/chrome/panes-3-16-0/start-inspector-BPAW_WLv.js +376 -0
- package/dist/chrome/panes-3-16-0/type-check.js +119 -0
- package/dist/chrome/panes-3-16-0/version.js +90 -0
- package/dist/chrome/panes-3-16-0/versions.js +4 -0
- package/dist/chrome/panes-3-16-0/web-extension-C3pMNVSY.js +144 -0
- package/dist/chrome/panes-3-16-0/websocket-debug.js +60 -0
- package/dist/firefox/content-script.js +1 -0
- package/dist/firefox/manifest.json +3 -3
- package/dist/{chrome/panes-3-16-0/assets/chunk.524.da00a6f90eaebf44c4a7.js → firefox/panes-3-16-0/assets/chunk.524.659d83812026e721dfd0.js} +4 -4
- package/dist/{websocket/assets/chunk.582.1294decb8a46b69a538a.js → firefox/panes-3-16-0/assets/chunk.582.5b4008f88fe48ebd8416.js} +5 -5
- package/dist/firefox/panes-3-16-0/assets/ember-inspector.css +835 -0
- package/dist/firefox/panes-3-16-0/assets/ember-inspector.js +42 -4
- package/dist/firefox/panes-3-16-0/assets/vendor.css +0 -836
- package/dist/firefox/panes-3-16-0/assets/vendor.js +3967 -4019
- package/dist/firefox/panes-3-16-0/base-object-HAEdWjmg.js +59 -0
- package/dist/firefox/panes-3-16-0/basic-DfbgtngO.js +144 -0
- package/dist/firefox/panes-3-16-0/basic-debug.js +6 -0
- package/dist/firefox/panes-3-16-0/bookmarklet-debug.js +34 -0
- package/dist/firefox/panes-3-16-0/chrome-debug.js +12 -0
- package/dist/firefox/panes-3-16-0/ember.js +108 -0
- package/dist/firefox/panes-3-16-0/ember_debug.js +28 -10654
- package/dist/firefox/panes-3-16-0/evented-BCTya3yE.js +62 -0
- package/dist/firefox/panes-3-16-0/firefox-debug.js +32 -0
- package/dist/firefox/panes-3-16-0/index.html +3 -3
- package/dist/firefox/panes-3-16-0/internals-CRmXMEzb.js +12 -0
- package/dist/firefox/panes-3-16-0/main.js +7642 -0
- package/dist/firefox/panes-3-16-0/port.js +108 -0
- package/dist/firefox/panes-3-16-0/profile-node.js +60 -0
- package/dist/firefox/panes-3-16-0/promise-assembler.js +218 -0
- package/dist/firefox/panes-3-16-0/runloop-CF-Qpqgy.js +1138 -0
- package/dist/firefox/panes-3-16-0/start-inspector-BPAW_WLv.js +376 -0
- package/dist/firefox/panes-3-16-0/type-check.js +119 -0
- package/dist/firefox/panes-3-16-0/version.js +90 -0
- package/dist/firefox/panes-3-16-0/versions.js +4 -0
- package/dist/firefox/panes-3-16-0/web-extension-C3pMNVSY.js +144 -0
- package/dist/firefox/panes-3-16-0/websocket-debug.js +60 -0
- package/dist/websocket/assets/{chunk.524.da00a6f90eaebf44c4a7.js → chunk.524.659d83812026e721dfd0.js} +4 -4
- package/dist/{chrome/panes-3-16-0/assets/chunk.582.1294decb8a46b69a538a.js → websocket/assets/chunk.582.5b4008f88fe48ebd8416.js} +5 -5
- package/dist/websocket/assets/ember-inspector.css +835 -0
- package/dist/websocket/assets/ember-inspector.js +42 -4
- package/dist/websocket/assets/vendor.css +0 -836
- package/dist/websocket/assets/vendor.js +3967 -4019
- package/dist/websocket/base-object-HAEdWjmg.js +59 -0
- package/dist/websocket/basic-DfbgtngO.js +144 -0
- package/dist/websocket/basic-debug.js +6 -0
- package/dist/websocket/bookmarklet-debug.js +34 -0
- package/dist/websocket/chrome-debug.js +12 -0
- package/dist/websocket/ember.js +108 -0
- package/dist/websocket/ember_debug.js +36 -10634
- package/dist/websocket/evented-BCTya3yE.js +62 -0
- package/dist/websocket/firefox-debug.js +32 -0
- package/dist/websocket/index.html +3 -3
- package/dist/websocket/internals-CRmXMEzb.js +12 -0
- package/dist/websocket/main.js +7642 -0
- package/dist/websocket/port.js +108 -0
- package/dist/websocket/profile-node.js +60 -0
- package/dist/websocket/promise-assembler.js +218 -0
- package/dist/websocket/runloop-CF-Qpqgy.js +1138 -0
- package/dist/websocket/start-inspector-BPAW_WLv.js +376 -0
- package/dist/websocket/type-check.js +119 -0
- package/dist/websocket/version.js +90 -0
- package/dist/websocket/versions.js +4 -0
- package/dist/websocket/web-extension-C3pMNVSY.js +144 -0
- package/dist/websocket/websocket-debug.js +60 -0
- package/ember-cli-build.js +28 -91
- package/ember_debug/adapters/basic.js +9 -29
- package/ember_debug/adapters/web-extension.js +4 -4
- package/ember_debug/adapters/websocket.js +2 -2
- package/ember_debug/container-debug.js +1 -1
- package/ember_debug/data-debug.js +2 -2
- package/ember_debug/debug-port.js +1 -1
- package/ember_debug/deprecation-debug.js +6 -6
- package/ember_debug/entrypoints/basic-debug.js +6 -0
- package/ember_debug/entrypoints/bookmarklet-debug.js +6 -0
- package/ember_debug/entrypoints/chrome-debug.js +6 -0
- package/ember_debug/entrypoints/firefox-debug.js +6 -0
- package/ember_debug/entrypoints/websocket-debug.js +6 -0
- package/ember_debug/general-debug.js +3 -3
- package/ember_debug/lib/boot-ember-inspector.js +9 -0
- package/ember_debug/lib/get-applications.js +27 -0
- package/ember_debug/lib/load-ember-debug-in-webpage.js +30 -0
- package/ember_debug/lib/send-apps.js +14 -0
- package/ember_debug/lib/send-version-miss.js +39 -0
- package/ember_debug/lib/setup-instance-initializer.js +16 -0
- package/ember_debug/lib/start-inspector.js +211 -0
- package/ember_debug/lib/version-test.js +73 -0
- package/ember_debug/lib/versions.js +3 -0
- package/ember_debug/libs/capture-render-tree.js +1 -1
- package/ember_debug/libs/promise-assembler.js +4 -4
- package/ember_debug/libs/render-tree.js +5 -5
- package/ember_debug/libs/source-map.js +1 -1
- package/ember_debug/libs/view-inspection.js +3 -3
- package/ember_debug/main.js +17 -20
- package/ember_debug/models/profile-manager.js +5 -6
- package/ember_debug/models/profile-node.js +1 -1
- package/ember_debug/models/promise.js +2 -2
- package/ember_debug/object-inspector.js +9 -9
- package/ember_debug/package.json +3 -1
- package/ember_debug/port.js +4 -4
- package/ember_debug/promise-debug.js +4 -4
- package/ember_debug/render-debug.js +5 -5
- package/ember_debug/rollup.config.js +5 -29
- package/ember_debug/route-debug.js +7 -7
- package/ember_debug/services/session.js +1 -1
- package/ember_debug/utils/ember/object/internals.js +1 -6
- package/ember_debug/utils/ember/runloop.js +2 -7
- package/ember_debug/utils/ember-object-names.js +2 -2
- package/ember_debug/utils/ember.js +72 -28
- package/ember_debug/utils/get-object-name.js +1 -1
- package/ember_debug/utils/type-check.js +2 -2
- package/ember_debug/view-debug.js +4 -4
- package/package.json +6 -9
- package/skeletons/bookmarklet/load_inspector.js +1 -0
- package/skeletons/web-extension/content-script.js +1 -0
- package/skeletons/web-extension/manifest.json +3 -3
- package/tests/ember_debug/profile-manager-test.js +1 -3
- package/tests/index.html +1 -2
- package/tests/integration/injection-test.js +3 -3
- package/tests/test-helper.js +0 -3
- package/ember_debug/utils/ember/debug.js +0 -21
- package/ember_debug/utils/ember/instrumentation.js +0 -11
- package/ember_debug/utils/rsvp.js +0 -14
- package/ember_debug/vendor/loader.js +0 -54
- package/ember_debug/vendor/startup-wrapper.js +0 -402
- package/lib/ui/app/components/ui/disclosure-triangle.js +0 -1
- package/lib/ui/app/components/ui/disclosure.js +0 -1
- package/lib/ui/app/components/ui/drag-handle.js +0 -1
- package/lib/ui/app/components/ui/draggable-column.js +0 -1
- package/lib/ui/app/components/ui/empty-message.js +0 -1
- package/lib/ui/app/components/ui/error-page.js +0 -1
- package/lib/ui/app/components/ui/open-links-in-new-window.js +0 -1
- package/lib/ui/app/components/ui/resizable-column.js +0 -1
- package/lib/ui/app/components/ui/send-to-console.js +0 -1
- package/lib/ui/app/components/ui/toolbar-clear-button.js +0 -1
- package/lib/ui/app/components/ui/toolbar-divider.js +0 -1
- package/lib/ui/app/components/ui/toolbar-reload-button.js +0 -1
- package/lib/ui/app/components/ui/toolbar-search-field.js +0 -1
- package/lib/ui/app/components/ui/warning-message.js +0 -1
- package/lib/ui/index.js +0 -34
- package/lib/ui/package.json +0 -13
- /package/{lib/ui/addon/components → app/components/ui}/disclosure-triangle.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/disclosure.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/disclosure.js +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/drag-handle.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/drag-handle.js +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/draggable-column.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/draggable-column.js +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/empty-message.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/error-page.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/open-links-in-new-window.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/open-links-in-new-window.js +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/resizable-column.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/resizable-column.js +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/send-to-console.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/toolbar-clear-button.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/toolbar-divider.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/toolbar-reload-button.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/toolbar-search-field.hbs +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/toolbar-search-field.js +0 -0
- /package/{lib/ui/addon/components → app/components/ui}/warning-message.hbs +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_disclosure-triangle.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_drag-handle.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_empty-message.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_error-page.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_goto-source.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_list.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_nav.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_object-inspector-toggle.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_pill.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_send-to-console.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_split.scss +0 -0
- /package/{lib/ui/addon/styles/addon.scss → app/styles/ui/_ui.scss} +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/_warning.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_checkbox.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_divider.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_icon-button.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_index.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_radio.scss +0 -0
- /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_search.scss +0 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { EMBER_VERSIONS_SUPPORTED } from './versions.js';
|
|
2
|
+
|
|
3
|
+
function loadEmberDebugInWebpage(callback) {
|
|
4
|
+
const waitForEmberLoad = new Promise(resolve => {
|
|
5
|
+
if (window.requireModule) {
|
|
6
|
+
const has = window.requireModule.has || function has(id) {
|
|
7
|
+
return !!(window.requireModule.entries[id] || window.requireModule.entries[id + '/index']);
|
|
8
|
+
};
|
|
9
|
+
if (has('ember')) {
|
|
10
|
+
return resolve();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* NOTE: if the above (for some reason) fails and the consuming app has
|
|
16
|
+
* deprecation-workflow's throwOnUnhandled: true
|
|
17
|
+
* or set \`ember-global\`'s handler to 'throw'
|
|
18
|
+
* and is using at least \`ember-source@3.27\`
|
|
19
|
+
*
|
|
20
|
+
* this will throw an exception in the consuming project
|
|
21
|
+
*/
|
|
22
|
+
if (window.Ember) return resolve();
|
|
23
|
+
window.addEventListener('Ember', resolve, {
|
|
24
|
+
once: true
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
waitForEmberLoad.then(callback);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* eslint-disable ember/no-test-import-export */
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @method compare
|
|
34
|
+
* @param {Number} val
|
|
35
|
+
* @param {Number} number
|
|
36
|
+
* @return {Number}
|
|
37
|
+
* 0: same
|
|
38
|
+
* -1: <
|
|
39
|
+
* 1: >
|
|
40
|
+
*/
|
|
41
|
+
function compare(val, number) {
|
|
42
|
+
if (val === number) {
|
|
43
|
+
return 0;
|
|
44
|
+
} else if (val < number) {
|
|
45
|
+
return -1;
|
|
46
|
+
} else if (val > number) {
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Remove -alpha, -beta, etc from versions
|
|
53
|
+
*
|
|
54
|
+
* @param {String} version
|
|
55
|
+
* @return {String} The cleaned up version
|
|
56
|
+
*/
|
|
57
|
+
function cleanupVersion(version) {
|
|
58
|
+
return version.replace(/-.*/g, '');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Compares two Ember versions.
|
|
63
|
+
*
|
|
64
|
+
* Returns:
|
|
65
|
+
* `-1` if version1 < version
|
|
66
|
+
* 0 if version1 == version2
|
|
67
|
+
* 1 if version1 > version2
|
|
68
|
+
*
|
|
69
|
+
* @param {String} version1
|
|
70
|
+
* @param {String} version2
|
|
71
|
+
* @return {Boolean} result of the comparison
|
|
72
|
+
*/
|
|
73
|
+
function compareVersion(version1, version2) {
|
|
74
|
+
let compared, i;
|
|
75
|
+
version1 = cleanupVersion(version1).split('.');
|
|
76
|
+
version2 = cleanupVersion(version2).split('.');
|
|
77
|
+
for (i = 0; i < 3; i++) {
|
|
78
|
+
compared = compare(+version1[i], +version2[i]);
|
|
79
|
+
if (compared !== 0) {
|
|
80
|
+
return compared;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Checks if a version is between two different versions.
|
|
88
|
+
* version should be >= left side, < right side
|
|
89
|
+
*
|
|
90
|
+
* @param {String} version1
|
|
91
|
+
* @param {String} version2
|
|
92
|
+
* @return {Boolean}
|
|
93
|
+
*/
|
|
94
|
+
function versionTest(version, between) {
|
|
95
|
+
var fromVersion = between[0];
|
|
96
|
+
var toVersion = between[1];
|
|
97
|
+
if (compareVersion(version, fromVersion) === -1) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return !toVersion || compareVersion(version, toVersion) === -1;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function sendApps(adapter, apps) {
|
|
104
|
+
const serializedApps = apps.map(app => {
|
|
105
|
+
return {
|
|
106
|
+
applicationName: app.applicationName,
|
|
107
|
+
applicationId: app.applicationId
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
adapter.sendMessage({
|
|
111
|
+
type: 'apps-loaded',
|
|
112
|
+
apps: serializedApps,
|
|
113
|
+
from: 'inspectedWindow'
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* eslint-disable ember/new-module-imports */
|
|
118
|
+
/**
|
|
119
|
+
* Get all the Ember.Application instances from Ember.Namespace.NAMESPACES
|
|
120
|
+
* and add our own applicationId and applicationName to them
|
|
121
|
+
* @return {*}
|
|
122
|
+
*/
|
|
123
|
+
function getApplications(Ember) {
|
|
124
|
+
var namespaces = Ember.A(Ember.Namespace.NAMESPACES);
|
|
125
|
+
var apps = namespaces.filter(function (namespace) {
|
|
126
|
+
return namespace instanceof Ember.Application;
|
|
127
|
+
});
|
|
128
|
+
return apps.map(function (app) {
|
|
129
|
+
// Add applicationId and applicationName to the app
|
|
130
|
+
var applicationId = Ember.guidFor(app);
|
|
131
|
+
var applicationName = app.name || app.modulePrefix || `(unknown app - ${applicationId})`;
|
|
132
|
+
Object.assign(app, {
|
|
133
|
+
applicationId,
|
|
134
|
+
applicationName
|
|
135
|
+
});
|
|
136
|
+
return app;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function bootEmberInspector(appInstance) {
|
|
141
|
+
appInstance.application.__inspector__booted = true;
|
|
142
|
+
appInstance.__inspector__booted = true;
|
|
143
|
+
|
|
144
|
+
// Boot the inspector (or re-boot if already booted, for example in tests)
|
|
145
|
+
window.EmberInspector._application = appInstance.application;
|
|
146
|
+
window.EmberInspector.owner = appInstance;
|
|
147
|
+
window.EmberInspector.start(true);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* eslint-disable ember/new-module-imports */
|
|
151
|
+
function setupInstanceInitializer(Ember, app, callback) {
|
|
152
|
+
if (!app.__inspector__setup) {
|
|
153
|
+
app.__inspector__setup = true;
|
|
154
|
+
|
|
155
|
+
// We include the app's guid in the initializer name because in Ember versions < 3
|
|
156
|
+
// registering an instance initializer with the same name, even if on a different app,
|
|
157
|
+
// triggers an error because instance initializers seem to be global instead of per app.
|
|
158
|
+
app.instanceInitializer({
|
|
159
|
+
name: 'ember-inspector-app-instance-booted-' + Ember.guidFor(app),
|
|
160
|
+
initialize: function (instance) {
|
|
161
|
+
callback(instance);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* eslint-disable ember/new-module-imports */
|
|
168
|
+
let channel = new MessageChannel();
|
|
169
|
+
let port = channel.port1;
|
|
170
|
+
window.postMessage('debugger-client', '*', [channel.port2]);
|
|
171
|
+
let registeredMiss = false;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* This function is called if the app's Ember version
|
|
175
|
+
* is not supported by this version of the inspector.
|
|
176
|
+
*
|
|
177
|
+
* It sends a message to the inspector app to redirect
|
|
178
|
+
* to an inspector version that supports this Ember version.
|
|
179
|
+
*/
|
|
180
|
+
function sendVersionMiss(Ember) {
|
|
181
|
+
if (registeredMiss) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
registeredMiss = true;
|
|
185
|
+
port.addEventListener('message', message => {
|
|
186
|
+
if (message.type === 'check-version') {
|
|
187
|
+
sendVersionMismatch();
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
sendVersionMismatch();
|
|
191
|
+
port.start();
|
|
192
|
+
function sendVersionMismatch() {
|
|
193
|
+
port.postMessage({
|
|
194
|
+
name: 'version-mismatch',
|
|
195
|
+
version: Ember.VERSION,
|
|
196
|
+
from: 'inspectedWindow'
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* eslint-disable ember/new-module-imports, ember/no-test-import-export */
|
|
202
|
+
|
|
203
|
+
let Ember;
|
|
204
|
+
function onReady(callback) {
|
|
205
|
+
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
|
206
|
+
setTimeout(completed);
|
|
207
|
+
} else {
|
|
208
|
+
document.addEventListener('DOMContentLoaded', completed, false);
|
|
209
|
+
// For some reason DOMContentLoaded doesn't always work
|
|
210
|
+
window.addEventListener('load', completed, false);
|
|
211
|
+
}
|
|
212
|
+
function completed() {
|
|
213
|
+
document.removeEventListener('DOMContentLoaded', completed, false);
|
|
214
|
+
window.removeEventListener('load', completed, false);
|
|
215
|
+
callback();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function onEmberReady(callback) {
|
|
219
|
+
var triggered = false;
|
|
220
|
+
var triggerOnce = function () {
|
|
221
|
+
if (triggered) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (!Ember) {
|
|
225
|
+
try {
|
|
226
|
+
Ember = requireModule('ember/barrel')['default'];
|
|
227
|
+
} catch {
|
|
228
|
+
// noop
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
Ember = Ember || requireModule('ember')['default'];
|
|
232
|
+
} catch {
|
|
233
|
+
Ember = window.Ember;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (!Ember) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
// `Ember.Application` load hook triggers before all of Ember is ready.
|
|
240
|
+
// In this case we ignore and wait for the `Ember` load hook.
|
|
241
|
+
if (!Ember.RSVP) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
triggered = true;
|
|
245
|
+
callback();
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// Newest Ember versions >= 1.10
|
|
249
|
+
|
|
250
|
+
const later = () => setTimeout(triggerOnce, 0);
|
|
251
|
+
window.addEventListener('Ember', later, {
|
|
252
|
+
once: true
|
|
253
|
+
});
|
|
254
|
+
// Oldest Ember versions or if this was injected after Ember has loaded.
|
|
255
|
+
onReady(triggerOnce);
|
|
256
|
+
}
|
|
257
|
+
function startInspector(adapter) {
|
|
258
|
+
// There's probably a better way
|
|
259
|
+
// to determine when the application starts
|
|
260
|
+
// but this definitely works
|
|
261
|
+
function onApplicationStart(callback) {
|
|
262
|
+
if (typeof Ember === 'undefined') {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const adapterInstance = new adapter();
|
|
266
|
+
adapterInstance.onMessageReceived(function (message) {
|
|
267
|
+
if (message.type === 'app-picker-loaded') {
|
|
268
|
+
sendApps(adapterInstance, getApplications(Ember));
|
|
269
|
+
}
|
|
270
|
+
if (message.type === 'app-selected') {
|
|
271
|
+
let current = window.EmberInspector._application;
|
|
272
|
+
let selected = getApplications(Ember).find(app => Ember.guidFor(app) === message.applicationId);
|
|
273
|
+
if (selected && current !== selected && selected.__deprecatedInstance__) {
|
|
274
|
+
bootEmberInspector(selected.__deprecatedInstance__);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
var apps = getApplications(Ember);
|
|
279
|
+
sendApps(adapterInstance, apps);
|
|
280
|
+
function loadInstance(app) {
|
|
281
|
+
const applicationInstances = app._applicationInstances && [...app._applicationInstances];
|
|
282
|
+
let instance = app.__deprecatedInstance__ || applicationInstances[0];
|
|
283
|
+
if (instance) {
|
|
284
|
+
// App started
|
|
285
|
+
setupInstanceInitializer(Ember, app, callback);
|
|
286
|
+
callback(instance);
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
var app;
|
|
291
|
+
for (var i = 0, l = apps.length; i < l; i++) {
|
|
292
|
+
app = apps[i];
|
|
293
|
+
// We check for the existance of an application instance because
|
|
294
|
+
// in Ember > 3 tests don't destroy the app when they're done but the app has no booted instances.
|
|
295
|
+
if (app._readinessDeferrals === 0) {
|
|
296
|
+
if (loadInstance(app)) {
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// app already run initializers, but no instance, use _bootPromise and didBecomeReady
|
|
302
|
+
if (app._bootPromise) {
|
|
303
|
+
app._bootPromise.then(app => {
|
|
304
|
+
loadInstance(app);
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
app.reopen({
|
|
308
|
+
didBecomeReady() {
|
|
309
|
+
this._super.apply(this, arguments);
|
|
310
|
+
setTimeout(() => loadInstance(app), 0);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
Ember.Application.initializer({
|
|
315
|
+
name: 'ember-inspector-booted',
|
|
316
|
+
initialize: function (app) {
|
|
317
|
+
setupInstanceInitializer(app, callback);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
return async function startInspector() {
|
|
322
|
+
// global to prevent injection
|
|
323
|
+
if (window.NO_EMBER_DEBUG) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// If Ember doesn't exist, we should stop here to avoid issues with accessing `Ember.VERSION`
|
|
328
|
+
if (!Ember) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (!versionTest(Ember.VERSION, EMBER_VERSIONS_SUPPORTED)) {
|
|
332
|
+
// Wrong inspector version. Redirect to the correct version.
|
|
333
|
+
sendVersionMiss(Ember);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// prevent from injecting twice
|
|
338
|
+
if (!window.EmberInspector) {
|
|
339
|
+
let emberDebugMainModule = (await import('./main.js')).default;
|
|
340
|
+
if (!emberDebugMainModule) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
window.EmberInspector = emberDebugMainModule;
|
|
344
|
+
window.EmberInspector.Adapter = adapter;
|
|
345
|
+
onApplicationStart(function appStarted(instance) {
|
|
346
|
+
let app = instance.application;
|
|
347
|
+
if (!('__inspector__booted' in app)) {
|
|
348
|
+
// Watch for app reset/destroy
|
|
349
|
+
app.reopen({
|
|
350
|
+
reset: function () {
|
|
351
|
+
this.__inspector__booted = false;
|
|
352
|
+
this._super.apply(this, arguments);
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
if (instance && !('__inspector__booted' in instance)) {
|
|
357
|
+
instance.reopen({
|
|
358
|
+
// Clean up on instance destruction
|
|
359
|
+
willDestroy() {
|
|
360
|
+
if (window.EmberInspector.owner === instance) {
|
|
361
|
+
window.EmberInspector.destroyContainer();
|
|
362
|
+
window.EmberInspector.clear();
|
|
363
|
+
}
|
|
364
|
+
return this._super.apply(this, arguments);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
if (!window.EmberInspector._application) {
|
|
368
|
+
setTimeout(() => bootEmberInspector(instance), 0);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export { loadEmberDebugInWebpage as l, onEmberReady as o, startInspector as s };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { EmberObject, inspect as inspect$1, Debug, meta, ComputedProperty, InternalsMetal } from './ember.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if given key on the passed object is a computed property
|
|
5
|
+
* @param object
|
|
6
|
+
* @param key
|
|
7
|
+
* @return {boolean|*}
|
|
8
|
+
*/
|
|
9
|
+
function isComputed(object, key) {
|
|
10
|
+
// Ember > 3.10
|
|
11
|
+
if (Debug.isComputed && Debug.isComputed(object, key)) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (meta(object) && meta(object).peekDescriptors(key)) {
|
|
15
|
+
return !!meta(object).peekDescriptors(key)._getter;
|
|
16
|
+
}
|
|
17
|
+
if (getDescriptorFor(object, key) instanceof ComputedProperty) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* This allows us to pass in a COMPUTED_DECORATOR function and get the descriptor for it.
|
|
24
|
+
* It should be implemented Ember side eventually.
|
|
25
|
+
* @param {EmberObject} object The object we are inspecting
|
|
26
|
+
* @param {String} key The key for the property on the object
|
|
27
|
+
*/
|
|
28
|
+
function getDescriptorFor(object, key) {
|
|
29
|
+
if (object[key]?.isDescriptor) {
|
|
30
|
+
return object[key];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// exists longer than ember 3.10
|
|
34
|
+
if (Debug.isComputed) {
|
|
35
|
+
const {
|
|
36
|
+
descriptorForDecorator,
|
|
37
|
+
descriptorForProperty
|
|
38
|
+
} = InternalsMetal || {};
|
|
39
|
+
return descriptorForDecorator?.(object[key]) || descriptorForProperty?.(object, key);
|
|
40
|
+
}
|
|
41
|
+
return object[key];
|
|
42
|
+
}
|
|
43
|
+
function typeOf(obj) {
|
|
44
|
+
return Object.prototype.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
|
|
45
|
+
}
|
|
46
|
+
function inspect(value) {
|
|
47
|
+
if (typeof value === 'function') {
|
|
48
|
+
return `${value.name || 'function'}() { ... }`;
|
|
49
|
+
} else if (value instanceof EmberObject) {
|
|
50
|
+
return value.toString();
|
|
51
|
+
} else if (value instanceof HTMLElement) {
|
|
52
|
+
return `<${value.tagName.toLowerCase()}>`;
|
|
53
|
+
} else if (typeOf(value) === 'array') {
|
|
54
|
+
if (value.length === 0) {
|
|
55
|
+
return '[]';
|
|
56
|
+
} else if (value.length === 1) {
|
|
57
|
+
return `[ ${inspect(value[0])} ]`;
|
|
58
|
+
} else {
|
|
59
|
+
return `[ ${inspect(value[0])}, ... ]`;
|
|
60
|
+
}
|
|
61
|
+
} else if (value instanceof Error) {
|
|
62
|
+
return `Error: ${value.message}`;
|
|
63
|
+
} else if (value === null) {
|
|
64
|
+
return 'null';
|
|
65
|
+
} else if (typeOf(value) === 'date') {
|
|
66
|
+
return value.toString();
|
|
67
|
+
} else if (typeof value === 'object') {
|
|
68
|
+
// `Ember.inspect` is able to handle this use case,
|
|
69
|
+
// but it is very slow as it loops over all props,
|
|
70
|
+
// so summarize to just first 2 props
|
|
71
|
+
// if it defines a toString, we use that instead
|
|
72
|
+
if (typeof value.toString === 'function' && value.toString !== Object.prototype.toString && value.toString !== Function.prototype.toString) {
|
|
73
|
+
try {
|
|
74
|
+
return `<Object:${value.toString()}>`;
|
|
75
|
+
} catch {
|
|
76
|
+
//
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
let ret = [];
|
|
80
|
+
let v;
|
|
81
|
+
let count = 0;
|
|
82
|
+
let broken = false;
|
|
83
|
+
for (let key in value) {
|
|
84
|
+
if (!('hasOwnProperty' in value) || value.hasOwnProperty(key)) {
|
|
85
|
+
if (count++ > 1) {
|
|
86
|
+
broken = true;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
v = value[key];
|
|
90
|
+
if (v === 'toString') {
|
|
91
|
+
continue;
|
|
92
|
+
} // ignore useless items
|
|
93
|
+
if (typeOf(v).includes('function')) {
|
|
94
|
+
v = `function ${v.name}() { ... }`;
|
|
95
|
+
}
|
|
96
|
+
if (typeOf(v) === 'array') {
|
|
97
|
+
v = `[Array : ${v.length}]`;
|
|
98
|
+
}
|
|
99
|
+
if (typeOf(v) === 'object') {
|
|
100
|
+
v = '[Object]';
|
|
101
|
+
}
|
|
102
|
+
// to avoid TypeError: Cannot convert a Symbol value to a string
|
|
103
|
+
if (typeOf(v) === 'symbol') {
|
|
104
|
+
v = v.toString();
|
|
105
|
+
}
|
|
106
|
+
ret.push(`${key}: ${v}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
let suffix = ' }';
|
|
110
|
+
if (broken) {
|
|
111
|
+
suffix = ' ...}';
|
|
112
|
+
}
|
|
113
|
+
return `{ ${ret.join(', ')}${suffix}`;
|
|
114
|
+
} else {
|
|
115
|
+
return inspect$1(value);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { getDescriptorFor, inspect, isComputed, typeOf };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares two Ember versions.
|
|
3
|
+
*
|
|
4
|
+
* Returns:
|
|
5
|
+
* `-1` if version1 < version
|
|
6
|
+
* 0 if version1 == version2
|
|
7
|
+
* 1 if version1 > version2
|
|
8
|
+
*
|
|
9
|
+
* @param {String} version1
|
|
10
|
+
* @param {String} version2
|
|
11
|
+
* @return {Boolean} result of the comparison
|
|
12
|
+
*/
|
|
13
|
+
function compareVersion(version1, version2) {
|
|
14
|
+
let compared, i;
|
|
15
|
+
version1 = cleanupVersion(version1).split('.');
|
|
16
|
+
version2 = cleanupVersion(version2).split('.');
|
|
17
|
+
for (i = 0; i < 3; i++) {
|
|
18
|
+
compared = compare(+version1[i], +version2[i]);
|
|
19
|
+
if (compared !== 0) {
|
|
20
|
+
return compared;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param specifier e.g. ^5.12.0
|
|
29
|
+
* @param version 5.13
|
|
30
|
+
* @return {boolean}
|
|
31
|
+
*/
|
|
32
|
+
function isInVersionSpecifier(specifier, version) {
|
|
33
|
+
let compared, i, version2;
|
|
34
|
+
let operator = specifier[0];
|
|
35
|
+
if (Number.isNaN(+operator)) {
|
|
36
|
+
specifier = specifier.slice(1);
|
|
37
|
+
}
|
|
38
|
+
specifier = cleanupVersion(specifier).split('.');
|
|
39
|
+
version2 = cleanupVersion(version).split('.');
|
|
40
|
+
if (operator === '~' && specifier[1] !== version2[1]) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (operator === '^' && specifier[0] !== version2[0]) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (operator === '>' && specifier[0] > version2[0]) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
for (i = 0; i < 3; i++) {
|
|
50
|
+
compared = compare(+specifier[i], +version2[i]);
|
|
51
|
+
if (compared < 0) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (compared > 0) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Remove -alpha, -beta, etc from versions
|
|
63
|
+
*
|
|
64
|
+
* @param {String} version
|
|
65
|
+
* @return {String} The cleaned up version
|
|
66
|
+
*/
|
|
67
|
+
function cleanupVersion(version) {
|
|
68
|
+
return version.replace(/-.*/g, '');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @method compare
|
|
73
|
+
* @param {Number} val
|
|
74
|
+
* @param {Number} number
|
|
75
|
+
* @return {Number}
|
|
76
|
+
* 0: same
|
|
77
|
+
* -1: <
|
|
78
|
+
* 1: >
|
|
79
|
+
*/
|
|
80
|
+
function compare(val, number) {
|
|
81
|
+
if (val === number) {
|
|
82
|
+
return 0;
|
|
83
|
+
} else if (val < number) {
|
|
84
|
+
return -1;
|
|
85
|
+
} else if (val > number) {
|
|
86
|
+
return 1;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { compareVersion, isInVersionSpecifier };
|