@lvce-editor/main-process 6.30.1 → 6.31.0

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.
@@ -3443,7 +3443,7 @@ const remove$1 = pid => {
3443
3443
  number(pid);
3444
3444
  delete state$5.all[pid];
3445
3445
  };
3446
- const getAll = () => {
3446
+ const getAll$1 = () => {
3447
3447
  return Object.entries(state$5.all);
3448
3448
  };
3449
3449
  const getByName = name => {
@@ -4117,6 +4117,9 @@ const hasWebContents = id => {
4117
4117
  const get$3 = id => {
4118
4118
  return state$2.views[id];
4119
4119
  };
4120
+ const getAll = () => {
4121
+ return Object.values(state$2.views);
4122
+ };
4120
4123
  const remove = id => {
4121
4124
  delete state$2.views[id];
4122
4125
  };
@@ -5154,9 +5157,21 @@ const createMessagePort = async (ipcId, port, webContentsId) => {
5154
5157
  return webContentsId;
5155
5158
  };
5156
5159
 
5160
+ const getWebContentsViewName = url => {
5161
+ if (URL.canParse(url)) {
5162
+ const {
5163
+ hostname
5164
+ } = new URL(url);
5165
+ if (hostname) {
5166
+ return `renderer (webcontentsview, ${hostname})`;
5167
+ }
5168
+ }
5169
+ return 'renderer (webcontentsview)';
5170
+ };
5157
5171
  const createPidMap = () => {
5158
5172
  const browserWindows = BrowserWindow.getAllWindows();
5159
- const utilityProcesses = getAll();
5173
+ const webContentsViews = getAll();
5174
+ const utilityProcesses = getAll$1();
5160
5175
  const pidWindowMap = Object.create(null);
5161
5176
  for (const browserWindow of browserWindows) {
5162
5177
  const {
@@ -5171,13 +5186,13 @@ const createPidMap = () => {
5171
5186
  const pid = devToolsWebContents.getOSProcessId();
5172
5187
  pidWindowMap[pid] = 'chrome-devtools';
5173
5188
  }
5174
- const views = browserWindow.getBrowserViews(); // TODO use webcontents views
5175
- for (const view of views) {
5176
- const viewWebContents = view.webContents;
5177
- const pid = viewWebContents.getOSProcessId();
5178
- const displayName = `browser-view-${viewWebContents.id}`;
5179
- pidWindowMap[pid] = displayName;
5180
- }
5189
+ }
5190
+ for (const value of webContentsViews) {
5191
+ const {
5192
+ webContents
5193
+ } = value.view;
5194
+ const pid = webContents.getOSProcessId();
5195
+ pidWindowMap[pid] = getWebContentsViewName(webContents.getURL());
5181
5196
  }
5182
5197
  for (const [pid, value] of utilityProcesses) {
5183
5198
  // @ts-ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.30.1",
3
+ "version": "6.31.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"