ember-inspector 4.13.1-alpha.2025.7.29 → 4.13.1-alpha.2025.7.30

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.
Files changed (200) hide show
  1. package/app/index.html +1 -1
  2. package/app/styles/app.scss +1 -0
  3. package/dist/bookmarklet/load_inspector.js +1 -0
  4. package/dist/bookmarklet/panes-3-16-0/assets/{chunk.524.4d9a488d82e60abd83d3.js → chunk.524.984a16186ec2ee340140.js} +4 -4
  5. package/dist/{firefox/panes-3-16-0/assets/chunk.582.688907397cfa1358668e.js → bookmarklet/panes-3-16-0/assets/chunk.582.866bd83d4661b3b843fd.js} +5 -5
  6. package/dist/bookmarklet/panes-3-16-0/assets/ember-inspector.css +835 -0
  7. package/dist/bookmarklet/panes-3-16-0/assets/ember-inspector.js +42 -4
  8. package/dist/bookmarklet/panes-3-16-0/assets/vendor.css +0 -836
  9. package/dist/bookmarklet/panes-3-16-0/assets/vendor.js +3967 -4019
  10. package/dist/bookmarklet/panes-3-16-0/base-object-HAEdWjmg.js +59 -0
  11. package/dist/bookmarklet/panes-3-16-0/basic-DfbgtngO.js +144 -0
  12. package/dist/bookmarklet/panes-3-16-0/basic-debug.js +6 -0
  13. package/dist/bookmarklet/panes-3-16-0/bookmarklet-debug.js +34 -0
  14. package/dist/bookmarklet/panes-3-16-0/chrome-debug.js +12 -0
  15. package/dist/bookmarklet/panes-3-16-0/ember.js +108 -0
  16. package/dist/bookmarklet/panes-3-16-0/ember_debug.js +22 -10556
  17. package/dist/bookmarklet/panes-3-16-0/evented-BCTya3yE.js +62 -0
  18. package/dist/bookmarklet/panes-3-16-0/firefox-debug.js +32 -0
  19. package/dist/bookmarklet/panes-3-16-0/index.html +3 -3
  20. package/dist/bookmarklet/panes-3-16-0/internals-CRmXMEzb.js +12 -0
  21. package/dist/bookmarklet/panes-3-16-0/main.js +7642 -0
  22. package/dist/bookmarklet/panes-3-16-0/port.js +108 -0
  23. package/dist/bookmarklet/panes-3-16-0/profile-node.js +60 -0
  24. package/dist/bookmarklet/panes-3-16-0/promise-assembler.js +218 -0
  25. package/dist/bookmarklet/panes-3-16-0/runloop-CF-Qpqgy.js +1138 -0
  26. package/dist/bookmarklet/panes-3-16-0/start-inspector-BPAW_WLv.js +376 -0
  27. package/dist/bookmarklet/panes-3-16-0/type-check.js +119 -0
  28. package/dist/bookmarklet/panes-3-16-0/version.js +90 -0
  29. package/dist/bookmarklet/panes-3-16-0/versions.js +4 -0
  30. package/dist/bookmarklet/panes-3-16-0/web-extension-C3pMNVSY.js +144 -0
  31. package/dist/bookmarklet/panes-3-16-0/websocket-debug.js +60 -0
  32. package/dist/chrome/content-script.js +1 -0
  33. package/dist/chrome/manifest.json +3 -3
  34. package/dist/{firefox/panes-3-16-0/assets/chunk.524.4d9a488d82e60abd83d3.js → chrome/panes-3-16-0/assets/chunk.524.984a16186ec2ee340140.js} +4 -4
  35. package/dist/{bookmarklet/panes-3-16-0/assets/chunk.582.688907397cfa1358668e.js → chrome/panes-3-16-0/assets/chunk.582.866bd83d4661b3b843fd.js} +5 -5
  36. package/dist/chrome/panes-3-16-0/assets/ember-inspector.css +835 -0
  37. package/dist/chrome/panes-3-16-0/assets/ember-inspector.js +42 -4
  38. package/dist/chrome/panes-3-16-0/assets/vendor.css +0 -836
  39. package/dist/chrome/panes-3-16-0/assets/vendor.js +3967 -4019
  40. package/dist/chrome/panes-3-16-0/base-object-HAEdWjmg.js +59 -0
  41. package/dist/chrome/panes-3-16-0/basic-DfbgtngO.js +144 -0
  42. package/dist/chrome/panes-3-16-0/basic-debug.js +6 -0
  43. package/dist/chrome/panes-3-16-0/bookmarklet-debug.js +34 -0
  44. package/dist/chrome/panes-3-16-0/chrome-debug.js +12 -0
  45. package/dist/chrome/panes-3-16-0/ember.js +108 -0
  46. package/dist/chrome/panes-3-16-0/ember_debug.js +12 -10568
  47. package/dist/chrome/panes-3-16-0/evented-BCTya3yE.js +62 -0
  48. package/dist/chrome/panes-3-16-0/firefox-debug.js +32 -0
  49. package/dist/chrome/panes-3-16-0/index.html +3 -3
  50. package/dist/chrome/panes-3-16-0/internals-CRmXMEzb.js +12 -0
  51. package/dist/chrome/panes-3-16-0/main.js +7642 -0
  52. package/dist/chrome/panes-3-16-0/port.js +108 -0
  53. package/dist/chrome/panes-3-16-0/profile-node.js +60 -0
  54. package/dist/chrome/panes-3-16-0/promise-assembler.js +218 -0
  55. package/dist/chrome/panes-3-16-0/runloop-CF-Qpqgy.js +1138 -0
  56. package/dist/chrome/panes-3-16-0/start-inspector-BPAW_WLv.js +376 -0
  57. package/dist/chrome/panes-3-16-0/type-check.js +119 -0
  58. package/dist/chrome/panes-3-16-0/version.js +90 -0
  59. package/dist/chrome/panes-3-16-0/versions.js +4 -0
  60. package/dist/chrome/panes-3-16-0/web-extension-C3pMNVSY.js +144 -0
  61. package/dist/chrome/panes-3-16-0/websocket-debug.js +60 -0
  62. package/dist/firefox/content-script.js +1 -0
  63. package/dist/firefox/manifest.json +3 -3
  64. package/dist/{chrome/panes-3-16-0/assets/chunk.524.4d9a488d82e60abd83d3.js → firefox/panes-3-16-0/assets/chunk.524.984a16186ec2ee340140.js} +4 -4
  65. package/dist/{websocket/assets/chunk.582.688907397cfa1358668e.js → firefox/panes-3-16-0/assets/chunk.582.866bd83d4661b3b843fd.js} +5 -5
  66. package/dist/firefox/panes-3-16-0/assets/ember-inspector.css +835 -0
  67. package/dist/firefox/panes-3-16-0/assets/ember-inspector.js +42 -4
  68. package/dist/firefox/panes-3-16-0/assets/vendor.css +0 -836
  69. package/dist/firefox/panes-3-16-0/assets/vendor.js +3967 -4019
  70. package/dist/firefox/panes-3-16-0/base-object-HAEdWjmg.js +59 -0
  71. package/dist/firefox/panes-3-16-0/basic-DfbgtngO.js +144 -0
  72. package/dist/firefox/panes-3-16-0/basic-debug.js +6 -0
  73. package/dist/firefox/panes-3-16-0/bookmarklet-debug.js +34 -0
  74. package/dist/firefox/panes-3-16-0/chrome-debug.js +12 -0
  75. package/dist/firefox/panes-3-16-0/ember.js +108 -0
  76. package/dist/firefox/panes-3-16-0/ember_debug.js +28 -10564
  77. package/dist/firefox/panes-3-16-0/evented-BCTya3yE.js +62 -0
  78. package/dist/firefox/panes-3-16-0/firefox-debug.js +32 -0
  79. package/dist/firefox/panes-3-16-0/index.html +3 -3
  80. package/dist/firefox/panes-3-16-0/internals-CRmXMEzb.js +12 -0
  81. package/dist/firefox/panes-3-16-0/main.js +7642 -0
  82. package/dist/firefox/panes-3-16-0/port.js +108 -0
  83. package/dist/firefox/panes-3-16-0/profile-node.js +60 -0
  84. package/dist/firefox/panes-3-16-0/promise-assembler.js +218 -0
  85. package/dist/firefox/panes-3-16-0/runloop-CF-Qpqgy.js +1138 -0
  86. package/dist/firefox/panes-3-16-0/start-inspector-BPAW_WLv.js +376 -0
  87. package/dist/firefox/panes-3-16-0/type-check.js +119 -0
  88. package/dist/firefox/panes-3-16-0/version.js +90 -0
  89. package/dist/firefox/panes-3-16-0/versions.js +4 -0
  90. package/dist/firefox/panes-3-16-0/web-extension-C3pMNVSY.js +144 -0
  91. package/dist/firefox/panes-3-16-0/websocket-debug.js +60 -0
  92. package/dist/websocket/assets/{chunk.524.4d9a488d82e60abd83d3.js → chunk.524.984a16186ec2ee340140.js} +4 -4
  93. package/dist/{chrome/panes-3-16-0/assets/chunk.582.688907397cfa1358668e.js → websocket/assets/chunk.582.866bd83d4661b3b843fd.js} +5 -5
  94. package/dist/websocket/assets/ember-inspector.css +835 -0
  95. package/dist/websocket/assets/ember-inspector.js +42 -4
  96. package/dist/websocket/assets/vendor.css +0 -836
  97. package/dist/websocket/assets/vendor.js +3967 -4019
  98. package/dist/websocket/base-object-HAEdWjmg.js +59 -0
  99. package/dist/websocket/basic-DfbgtngO.js +144 -0
  100. package/dist/websocket/basic-debug.js +6 -0
  101. package/dist/websocket/bookmarklet-debug.js +34 -0
  102. package/dist/websocket/chrome-debug.js +12 -0
  103. package/dist/websocket/ember.js +108 -0
  104. package/dist/websocket/ember_debug.js +36 -10544
  105. package/dist/websocket/evented-BCTya3yE.js +62 -0
  106. package/dist/websocket/firefox-debug.js +32 -0
  107. package/dist/websocket/index.html +3 -3
  108. package/dist/websocket/internals-CRmXMEzb.js +12 -0
  109. package/dist/websocket/main.js +7642 -0
  110. package/dist/websocket/port.js +108 -0
  111. package/dist/websocket/profile-node.js +60 -0
  112. package/dist/websocket/promise-assembler.js +218 -0
  113. package/dist/websocket/runloop-CF-Qpqgy.js +1138 -0
  114. package/dist/websocket/start-inspector-BPAW_WLv.js +376 -0
  115. package/dist/websocket/type-check.js +119 -0
  116. package/dist/websocket/version.js +90 -0
  117. package/dist/websocket/versions.js +4 -0
  118. package/dist/websocket/web-extension-C3pMNVSY.js +144 -0
  119. package/dist/websocket/websocket-debug.js +60 -0
  120. package/ember-cli-build.js +28 -91
  121. package/ember_debug/entrypoints/basic-debug.js +6 -0
  122. package/ember_debug/entrypoints/bookmarklet-debug.js +6 -0
  123. package/ember_debug/entrypoints/chrome-debug.js +6 -0
  124. package/ember_debug/entrypoints/firefox-debug.js +6 -0
  125. package/ember_debug/entrypoints/websocket-debug.js +6 -0
  126. package/ember_debug/lib/boot-ember-inspector.js +9 -0
  127. package/ember_debug/lib/get-applications.js +27 -0
  128. package/ember_debug/lib/load-ember-debug-in-webpage.js +30 -0
  129. package/ember_debug/lib/send-apps.js +14 -0
  130. package/ember_debug/lib/send-version-miss.js +39 -0
  131. package/ember_debug/lib/setup-instance-initializer.js +16 -0
  132. package/ember_debug/lib/start-inspector.js +211 -0
  133. package/ember_debug/lib/version-test.js +73 -0
  134. package/ember_debug/lib/versions.js +3 -0
  135. package/ember_debug/package.json +2 -0
  136. package/ember_debug/rollup.config.js +5 -29
  137. package/package.json +5 -9
  138. package/skeletons/bookmarklet/load_inspector.js +1 -0
  139. package/skeletons/web-extension/content-script.js +1 -0
  140. package/skeletons/web-extension/manifest.json +3 -3
  141. package/tests/index.html +1 -2
  142. package/tests/integration/injection-test.js +3 -3
  143. package/tests/test-helper.js +0 -3
  144. package/ember_debug/vendor/loader.js +0 -54
  145. package/ember_debug/vendor/startup-wrapper.js +0 -390
  146. package/lib/ui/app/components/ui/disclosure-triangle.js +0 -1
  147. package/lib/ui/app/components/ui/disclosure.js +0 -1
  148. package/lib/ui/app/components/ui/drag-handle.js +0 -1
  149. package/lib/ui/app/components/ui/draggable-column.js +0 -1
  150. package/lib/ui/app/components/ui/empty-message.js +0 -1
  151. package/lib/ui/app/components/ui/error-page.js +0 -1
  152. package/lib/ui/app/components/ui/open-links-in-new-window.js +0 -1
  153. package/lib/ui/app/components/ui/resizable-column.js +0 -1
  154. package/lib/ui/app/components/ui/send-to-console.js +0 -1
  155. package/lib/ui/app/components/ui/toolbar-clear-button.js +0 -1
  156. package/lib/ui/app/components/ui/toolbar-divider.js +0 -1
  157. package/lib/ui/app/components/ui/toolbar-reload-button.js +0 -1
  158. package/lib/ui/app/components/ui/toolbar-search-field.js +0 -1
  159. package/lib/ui/app/components/ui/warning-message.js +0 -1
  160. package/lib/ui/index.js +0 -34
  161. package/lib/ui/package.json +0 -13
  162. /package/{lib/ui/addon/components → app/components/ui}/disclosure-triangle.hbs +0 -0
  163. /package/{lib/ui/addon/components → app/components/ui}/disclosure.hbs +0 -0
  164. /package/{lib/ui/addon/components → app/components/ui}/disclosure.js +0 -0
  165. /package/{lib/ui/addon/components → app/components/ui}/drag-handle.hbs +0 -0
  166. /package/{lib/ui/addon/components → app/components/ui}/drag-handle.js +0 -0
  167. /package/{lib/ui/addon/components → app/components/ui}/draggable-column.hbs +0 -0
  168. /package/{lib/ui/addon/components → app/components/ui}/draggable-column.js +0 -0
  169. /package/{lib/ui/addon/components → app/components/ui}/empty-message.hbs +0 -0
  170. /package/{lib/ui/addon/components → app/components/ui}/error-page.hbs +0 -0
  171. /package/{lib/ui/addon/components → app/components/ui}/open-links-in-new-window.hbs +0 -0
  172. /package/{lib/ui/addon/components → app/components/ui}/open-links-in-new-window.js +0 -0
  173. /package/{lib/ui/addon/components → app/components/ui}/resizable-column.hbs +0 -0
  174. /package/{lib/ui/addon/components → app/components/ui}/resizable-column.js +0 -0
  175. /package/{lib/ui/addon/components → app/components/ui}/send-to-console.hbs +0 -0
  176. /package/{lib/ui/addon/components → app/components/ui}/toolbar-clear-button.hbs +0 -0
  177. /package/{lib/ui/addon/components → app/components/ui}/toolbar-divider.hbs +0 -0
  178. /package/{lib/ui/addon/components → app/components/ui}/toolbar-reload-button.hbs +0 -0
  179. /package/{lib/ui/addon/components → app/components/ui}/toolbar-search-field.hbs +0 -0
  180. /package/{lib/ui/addon/components → app/components/ui}/toolbar-search-field.js +0 -0
  181. /package/{lib/ui/addon/components → app/components/ui}/warning-message.hbs +0 -0
  182. /package/{lib/ui/addon/styles → app/styles/ui}/_disclosure-triangle.scss +0 -0
  183. /package/{lib/ui/addon/styles → app/styles/ui}/_drag-handle.scss +0 -0
  184. /package/{lib/ui/addon/styles → app/styles/ui}/_empty-message.scss +0 -0
  185. /package/{lib/ui/addon/styles → app/styles/ui}/_error-page.scss +0 -0
  186. /package/{lib/ui/addon/styles → app/styles/ui}/_goto-source.scss +0 -0
  187. /package/{lib/ui/addon/styles → app/styles/ui}/_list.scss +0 -0
  188. /package/{lib/ui/addon/styles → app/styles/ui}/_nav.scss +0 -0
  189. /package/{lib/ui/addon/styles → app/styles/ui}/_object-inspector-toggle.scss +0 -0
  190. /package/{lib/ui/addon/styles → app/styles/ui}/_pill.scss +0 -0
  191. /package/{lib/ui/addon/styles → app/styles/ui}/_send-to-console.scss +0 -0
  192. /package/{lib/ui/addon/styles → app/styles/ui}/_split.scss +0 -0
  193. /package/{lib/ui/addon/styles/addon.scss → app/styles/ui/_ui.scss} +0 -0
  194. /package/{lib/ui/addon/styles → app/styles/ui}/_warning.scss +0 -0
  195. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_checkbox.scss +0 -0
  196. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_divider.scss +0 -0
  197. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_icon-button.scss +0 -0
  198. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_index.scss +0 -0
  199. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_radio.scss +0 -0
  200. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_search.scss +0 -0
@@ -0,0 +1,144 @@
1
+ import { B as BasicAdapter } from './basic-DfbgtngO.js';
2
+ import { typeOf } from './type-check.js';
3
+ import { getEnv } from './ember.js';
4
+ import { r as run } from './runloop-CF-Qpqgy.js';
5
+
6
+ const {
7
+ isArray
8
+ } = Array;
9
+ const {
10
+ keys
11
+ } = Object;
12
+ class WebExtension extends BasicAdapter {
13
+ // eslint-disable-next-line ember/classic-decorator-hooks
14
+ init() {
15
+ this._channel = new MessageChannel();
16
+ this._chromePort = this._channel?.port1;
17
+ super.init();
18
+ }
19
+ connect() {
20
+ const channel = this._channel;
21
+ return super.connect().then(() => {
22
+ window.postMessage('debugger-client', '*', [channel.port2]);
23
+ this._listen();
24
+ }, null);
25
+ }
26
+ sendMessage(options = {}) {
27
+ // If prototype extensions are disabled, `Ember.A()` arrays
28
+ // would not be considered native arrays, so it's not possible to
29
+ // "clone" them through postMessage unless they are converted to a
30
+ // native array.
31
+ options = deepClone(options);
32
+ try {
33
+ this._chromePort.postMessage(options);
34
+ } catch (e) {
35
+ console.log('failed to send message', e);
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Open the devtools "Elements" and select an DOM node.
41
+ *
42
+ * @param {Node|Function} value The DOM node to select
43
+ */
44
+ inspectValue(value) {
45
+ // NOTE:
46
+ //
47
+ // Basically, we are just trying to call `inspect(node)` here.
48
+ // However, `inspect` is a special function that is in the global
49
+ // scope but not on the global object (i.e. `window.inspect`) does
50
+ // not work. This sometimes causes problems, because, e.g. if the
51
+ // page has a div with the ID `inspect`, `window.inspect` will point
52
+ // to that div and shadow the "global" inspect function with no way
53
+ // to get it back. That causes "`inspect` is not a function" errors.
54
+ //
55
+ // As it turns out, however, when the extension page evals, the
56
+ // `inspect` function does not get shadowed. So, we can ask the
57
+ // inspector extension page to call that function for us, using
58
+ // `inspected.Window.eval('inspect(node)')`.
59
+ //
60
+ // However, since we cannot just send the DOM node directly to the
61
+ // extension, we will have to store it in a temporary global variable
62
+ // so that the extension can find it.
63
+
64
+ let name = `__EMBER_INSPECTOR_${(Math.random() * 100000000).toFixed(0)}`;
65
+ window[name] = value;
66
+ this.namespace.port.send('view:inspectJSValue', {
67
+ name
68
+ });
69
+ }
70
+ _listen() {
71
+ let chromePort = this._chromePort;
72
+ chromePort.addEventListener('message', event => {
73
+ const message = event.data;
74
+
75
+ // We should generally not be run-wrapping here. Starting a runloop in
76
+ // ember-debug will cause the inspected app to revalidate/rerender. We
77
+ // are generally not intending to cause changes to the rendered output
78
+ // of the app, so this is generally unnecessary, and in big apps this
79
+ // could be quite slow. There is nothing special about the `view:*`
80
+ // messages – I (GC) just happened to have reviewed all of them recently
81
+ // and can be quite sure that they don't need the runloop. We should
82
+ // audit the rest of them and see if we can remove the else branch. I
83
+ // think we most likely can. In the limited cases (if any) where the
84
+ // runloop is needed, the callback code should just do the wrapping
85
+ // themselves.
86
+ if (message.type.startsWith('view:')) {
87
+ this._messageReceived(message);
88
+ } else {
89
+ run(() => {
90
+ this._messageReceived(message);
91
+ });
92
+ }
93
+ });
94
+ chromePort.start();
95
+ }
96
+ }
97
+
98
+ // On some older Ember version `Ember.ENV.EXTEND_PROTOTYPES` is not
99
+ // guarenteed to be an object. While this code only support 3.4+ (all
100
+ // of which normalizes `EXTEND_PROTOTYPES` for us), startup-wrapper.js
101
+ // eagerly require/load ember-debug modules, which ultimately causes
102
+ // this top-level code to run, even we are going to pick a different
103
+ // adapter later. See GH #1114.
104
+ const HAS_ARRAY_PROTOTYPE_EXTENSIONS = (() => {
105
+ try {
106
+ return getEnv().EXTEND_PROTOTYPES.Array === true;
107
+ } catch {
108
+ return false;
109
+ }
110
+ })();
111
+ let deepClone;
112
+ if (HAS_ARRAY_PROTOTYPE_EXTENSIONS) {
113
+ deepClone = function deepClone(item) {
114
+ return item;
115
+ };
116
+ } else {
117
+ /**
118
+ * Recursively clones all arrays. Needed because Chrome
119
+ * refuses to clone Ember Arrays when extend prototypes is disabled.
120
+ *
121
+ * If the item passed is an array, a clone of the array is returned.
122
+ * If the item is an object or an array, or array properties/items are cloned.
123
+ *
124
+ * @param {Mixed} item The item to clone
125
+ * @return {Mixed}
126
+ */
127
+ deepClone = function deepClone(item) {
128
+ let clone = item;
129
+ if (isArray(item)) {
130
+ clone = new Array(item.length);
131
+ item.forEach((child, key) => {
132
+ clone[key] = deepClone(child);
133
+ });
134
+ } else if (item && typeOf(item) === 'object') {
135
+ clone = {};
136
+ keys(item).forEach(key => {
137
+ clone[key] = deepClone(item[key]);
138
+ });
139
+ }
140
+ return clone;
141
+ };
142
+ }
143
+
144
+ export { WebExtension as W };
@@ -0,0 +1,60 @@
1
+ import { l as loadEmberDebugInWebpage, o as onEmberReady, s as startInspector } from './start-inspector-BPAW_WLv.js';
2
+ import { B as BasicAdapter, o as onReady } from './basic-DfbgtngO.js';
3
+ import { r as run } from './runloop-CF-Qpqgy.js';
4
+ import './versions.js';
5
+ import './base-object-HAEdWjmg.js';
6
+ import './ember.js';
7
+
8
+ class adapter extends BasicAdapter {
9
+ sendMessage(options = {}) {
10
+ this.socket.emit('emberInspectorMessage', options);
11
+ }
12
+ get socket() {
13
+ return window.EMBER_INSPECTOR_CONFIG.remoteDebugSocket;
14
+ }
15
+ _listen() {
16
+ this.socket.on('emberInspectorMessage', message => {
17
+ // We should generally not be run-wrapping here. Starting a runloop in
18
+ // ember-debug will cause the inspected app to revalidate/rerender. We
19
+ // are generally not intending to cause changes to the rendered output
20
+ // of the app, so this is generally unnecessary, and in big apps this
21
+ // could be quite slow. There is nothing special about the `view:*`
22
+ // messages – I (GC) just happened to have reviewed all of them recently
23
+ // and can be quite sure that they don't need the runloop. We should
24
+ // audit the rest of them and see if we can remove the else branch. I
25
+ // think we most likely can. In the limited cases (if any) where the
26
+ // runloop is needed, the callback code should just do the wrapping
27
+ // themselves.
28
+ if (message.type.startsWith('view:')) {
29
+ this._messageReceived(message);
30
+ } else {
31
+ run(() => {
32
+ this._messageReceived(message);
33
+ });
34
+ }
35
+ });
36
+ }
37
+ _disconnect() {
38
+ this.socket.removeAllListeners('emberInspectorMessage');
39
+ }
40
+ connect() {
41
+ return new Promise((resolve, reject) => {
42
+ onReady(() => {
43
+ if (this.isDestroyed) {
44
+ reject();
45
+ }
46
+ const EMBER_INSPECTOR_CONFIG = window.EMBER_INSPECTOR_CONFIG;
47
+ if (typeof EMBER_INSPECTOR_CONFIG === 'object' && EMBER_INSPECTOR_CONFIG.remoteDebugSocket) {
48
+ resolve();
49
+ }
50
+ });
51
+ }).then(() => {
52
+ this._listen();
53
+ });
54
+ }
55
+ willDestroy() {
56
+ this._disconnect();
57
+ }
58
+ }
59
+
60
+ loadEmberDebugInWebpage(() => onEmberReady(startInspector(adapter)));
@@ -9,7 +9,12 @@ const writeFile = require('broccoli-file-creator');
9
9
  const replace = require('broccoli-string-replace');
10
10
  const Funnel = require('broccoli-funnel');
11
11
  const packageJson = require('./package.json');
12
- const { map, mv } = stew;
12
+ const { mv } = stew;
13
+
14
+ const {
15
+ EMBER_VERSIONS_SUPPORTED,
16
+ PREVIOUS_EMBER_VERSIONS_SUPPORTED,
17
+ } = require('ember-debug/versions');
13
18
 
14
19
  const options = {
15
20
  autoImport: {
@@ -84,95 +89,30 @@ module.exports = function (defaults) {
84
89
  app.import('node_modules/compare-versions/index.js');
85
90
  app.import('node_modules/normalize.css/normalize.css');
86
91
 
87
- let emberDebug = 'ember_debug/dist';
88
-
89
- emberDebug = new Funnel(emberDebug, {
90
- destDir: 'ember-debug',
91
- include: ['**/*.js'],
92
- });
93
-
94
- const previousEmberVersionsSupportedString = `[${packageJson.previousEmberVersionsSupported
95
- .map(function (item) {
96
- return `'${item}'`;
97
- })
98
- .join(',')}]`;
99
- const emberVersionsSupportedString = `[${packageJson.emberVersionsSupported
100
- .map(function (item) {
101
- return `'${item}'`;
102
- })
103
- .join(',')}]`;
104
-
105
- let startupWrapper = new Funnel('ember_debug', {
106
- srcDir: 'vendor',
107
- files: ['startup-wrapper.js'],
108
- });
109
-
110
- startupWrapper = replace(startupWrapper, {
111
- files: ['startup-wrapper.js'],
112
- patterns: [
113
- {
114
- match: /{{EMBER_VERSIONS_SUPPORTED}}/,
115
- replacement: emberVersionsSupportedString,
116
- },
117
- ],
118
- });
119
-
120
- const loader = new Funnel('ember_debug', {
121
- srcDir: 'vendor',
122
- files: ['loader.js'],
123
- });
124
-
125
- emberDebug = mergeTrees([startupWrapper, emberDebug, loader]);
126
-
127
- emberDebug = concatFiles(emberDebug, {
128
- headerFiles: ['loader.js'],
129
- inputFiles: ['**/*.js'],
130
- outputFile: '/ember_debug.js',
131
- sourceMapConfig: { enabled: false },
132
- });
133
-
134
- function wrapWithLoader(content) {
135
- return `(function loadEmberDebugInWebpage() {
136
- const waitForEmberLoad = new Promise((resolve) => {
137
- if (window.requireModule) {
138
- const has =
139
- window.requireModule.has ||
140
- function has(id) {
141
- return !!(
142
- window.requireModule.entries[id] ||
143
- window.requireModule.entries[id + '/index']
144
- );
145
- };
146
- if (has('ember')) {
147
- return resolve();
148
- }
149
- }
150
-
151
- /**
152
- * NOTE: if the above (for some reason) fails and the consuming app has
153
- * deprecation-workflow's throwOnUnhandled: true
154
- * or set \`ember-global\`'s handler to 'throw'
155
- * and is using at least \`ember-source@3.27\`
156
- *
157
- * this will throw an exception in the consuming project
158
- */
159
- if (window.Ember) return resolve();
160
-
161
- window.addEventListener('Ember', resolve, { once: true });
162
- });
163
- waitForEmberLoad.then(() => ${content});
164
- })()
165
- `;
166
- }
92
+ const previousEmberVersionsSupportedString = JSON.stringify(
93
+ PREVIOUS_EMBER_VERSIONS_SUPPORTED,
94
+ );
95
+ const emberVersionsSupportedString = JSON.stringify(EMBER_VERSIONS_SUPPORTED);
167
96
 
168
97
  const emberDebugs = [];
98
+
169
99
  ['basic', 'chrome', 'firefox', 'bookmarklet', 'websocket'].forEach(
170
100
  function (dist) {
171
- emberDebugs[dist] = map(emberDebug, '**/*.js', function (content) {
172
- return wrapWithLoader(
173
- `(function(adapter) {\n${content}\n}('${dist}'))`,
174
- );
175
- });
101
+ let emberDebug = 'ember_debug/dist';
102
+
103
+ let entryPoint = concatFiles(
104
+ new Funnel(emberDebug, {
105
+ destDir: 'ember-debug',
106
+ include: [`${dist}-debug.js`],
107
+ }),
108
+ {
109
+ inputFiles: ['**/*.js'],
110
+ outputFile: '/ember_debug.js',
111
+ sourceMapConfig: { enabled: false },
112
+ },
113
+ );
114
+
115
+ emberDebugs[dist] = mergeTrees([emberDebug, entryPoint]);
176
116
  },
177
117
  );
178
118
 
@@ -190,10 +130,7 @@ module.exports = function (defaults) {
190
130
  patterns: emberInspectorVersionPattern,
191
131
  });
192
132
 
193
- const minimumVersion = packageJson.emberVersionsSupported[0].replace(
194
- /\./g,
195
- '-',
196
- );
133
+ const minimumVersion = EMBER_VERSIONS_SUPPORTED[0].replace(/\./g, '-');
197
134
  const webExtensionRoot = `panes-${minimumVersion}`;
198
135
 
199
136
  let tabLabel;
@@ -264,7 +201,7 @@ module.exports = function (defaults) {
264
201
  skeletonBookmarklet,
265
202
  ]);
266
203
 
267
- packageJson.previousEmberVersionsSupported.forEach(function (version) {
204
+ PREVIOUS_EMBER_VERSIONS_SUPPORTED.forEach(function (version) {
268
205
  version = version.replace(/\./g, '-');
269
206
  if (env === 'production') {
270
207
  const prevDist = `dist_prev/${env}`;
@@ -0,0 +1,6 @@
1
+ import loadEmberDebugInWebpage from '../lib/load-ember-debug-in-webpage';
2
+ import { onEmberReady, startInspector } from '../lib/start-inspector';
3
+
4
+ import adapter from '../adapters/basic';
5
+
6
+ loadEmberDebugInWebpage(() => onEmberReady(startInspector(adapter)));
@@ -0,0 +1,6 @@
1
+ import loadEmberDebugInWebpage from '../lib/load-ember-debug-in-webpage';
2
+ import { onEmberReady, startInspector } from '../lib/start-inspector';
3
+
4
+ import adapter from '../adapters/bookmarklet';
5
+
6
+ loadEmberDebugInWebpage(() => onEmberReady(startInspector(adapter)));
@@ -0,0 +1,6 @@
1
+ import loadEmberDebugInWebpage from '../lib/load-ember-debug-in-webpage';
2
+ import { onEmberReady, startInspector } from '../lib/start-inspector';
3
+
4
+ import adapter from '../adapters/chrome';
5
+
6
+ loadEmberDebugInWebpage(() => onEmberReady(startInspector(adapter)));
@@ -0,0 +1,6 @@
1
+ import loadEmberDebugInWebpage from '../lib/load-ember-debug-in-webpage';
2
+ import { onEmberReady, startInspector } from '../lib/start-inspector';
3
+
4
+ import adapter from '../adapters/firefox';
5
+
6
+ loadEmberDebugInWebpage(() => onEmberReady(startInspector(adapter)));
@@ -0,0 +1,6 @@
1
+ import loadEmberDebugInWebpage from '../lib/load-ember-debug-in-webpage';
2
+ import { onEmberReady, startInspector } from '../lib/start-inspector';
3
+
4
+ import adapter from '../adapters/websocket';
5
+
6
+ loadEmberDebugInWebpage(() => onEmberReady(startInspector(adapter)));
@@ -0,0 +1,9 @@
1
+ export default function bootEmberInspector(appInstance) {
2
+ appInstance.application.__inspector__booted = true;
3
+ appInstance.__inspector__booted = true;
4
+
5
+ // Boot the inspector (or re-boot if already booted, for example in tests)
6
+ window.EmberInspector._application = appInstance.application;
7
+ window.EmberInspector.owner = appInstance;
8
+ window.EmberInspector.start(true);
9
+ }
@@ -0,0 +1,27 @@
1
+ /* eslint-disable ember/new-module-imports */
2
+ /**
3
+ * Get all the Ember.Application instances from Ember.Namespace.NAMESPACES
4
+ * and add our own applicationId and applicationName to them
5
+ * @return {*}
6
+ */
7
+ export default function getApplications(Ember) {
8
+ var namespaces = Ember.A(Ember.Namespace.NAMESPACES);
9
+
10
+ var apps = namespaces.filter(function (namespace) {
11
+ return namespace instanceof Ember.Application;
12
+ });
13
+
14
+ return apps.map(function (app) {
15
+ // Add applicationId and applicationName to the app
16
+ var applicationId = Ember.guidFor(app);
17
+ var applicationName =
18
+ app.name || app.modulePrefix || `(unknown app - ${applicationId})`;
19
+
20
+ Object.assign(app, {
21
+ applicationId,
22
+ applicationName,
23
+ });
24
+
25
+ return app;
26
+ });
27
+ }
@@ -0,0 +1,30 @@
1
+ export default function loadEmberDebugInWebpage(callback) {
2
+ const waitForEmberLoad = new Promise((resolve) => {
3
+ if (window.requireModule) {
4
+ const has =
5
+ window.requireModule.has ||
6
+ function has(id) {
7
+ return !!(
8
+ window.requireModule.entries[id] ||
9
+ window.requireModule.entries[id + '/index']
10
+ );
11
+ };
12
+ if (has('ember')) {
13
+ return resolve();
14
+ }
15
+ }
16
+
17
+ /**
18
+ * NOTE: if the above (for some reason) fails and the consuming app has
19
+ * deprecation-workflow's throwOnUnhandled: true
20
+ * or set \`ember-global\`'s handler to 'throw'
21
+ * and is using at least \`ember-source@3.27\`
22
+ *
23
+ * this will throw an exception in the consuming project
24
+ */
25
+ if (window.Ember) return resolve();
26
+
27
+ window.addEventListener('Ember', resolve, { once: true });
28
+ });
29
+ waitForEmberLoad.then(callback);
30
+ }
@@ -0,0 +1,14 @@
1
+ export default function sendApps(adapter, apps) {
2
+ const serializedApps = apps.map((app) => {
3
+ return {
4
+ applicationName: app.applicationName,
5
+ applicationId: app.applicationId,
6
+ };
7
+ });
8
+
9
+ adapter.sendMessage({
10
+ type: 'apps-loaded',
11
+ apps: serializedApps,
12
+ from: 'inspectedWindow',
13
+ });
14
+ }
@@ -0,0 +1,39 @@
1
+ /* eslint-disable ember/new-module-imports */
2
+ let channel = new MessageChannel();
3
+ let port = channel.port1;
4
+ window.postMessage('debugger-client', '*', [channel.port2]);
5
+
6
+ let registeredMiss = false;
7
+
8
+ /**
9
+ * This function is called if the app's Ember version
10
+ * is not supported by this version of the inspector.
11
+ *
12
+ * It sends a message to the inspector app to redirect
13
+ * to an inspector version that supports this Ember version.
14
+ */
15
+ export default function sendVersionMiss(Ember) {
16
+ if (registeredMiss) {
17
+ return;
18
+ }
19
+
20
+ registeredMiss = true;
21
+
22
+ port.addEventListener('message', (message) => {
23
+ if (message.type === 'check-version') {
24
+ sendVersionMismatch();
25
+ }
26
+ });
27
+
28
+ sendVersionMismatch();
29
+
30
+ port.start();
31
+
32
+ function sendVersionMismatch() {
33
+ port.postMessage({
34
+ name: 'version-mismatch',
35
+ version: Ember.VERSION,
36
+ from: 'inspectedWindow',
37
+ });
38
+ }
39
+ }
@@ -0,0 +1,16 @@
1
+ /* eslint-disable ember/new-module-imports */
2
+ export default function setupInstanceInitializer(Ember, app, callback) {
3
+ if (!app.__inspector__setup) {
4
+ app.__inspector__setup = true;
5
+
6
+ // We include the app's guid in the initializer name because in Ember versions < 3
7
+ // registering an instance initializer with the same name, even if on a different app,
8
+ // triggers an error because instance initializers seem to be global instead of per app.
9
+ app.instanceInitializer({
10
+ name: 'ember-inspector-app-instance-booted-' + Ember.guidFor(app),
11
+ initialize: function (instance) {
12
+ callback(instance);
13
+ },
14
+ });
15
+ }
16
+ }