Browse Source

chore: move libs only used in browser out of common (#31780)

Milan Burda 3 years ago
parent
commit
18cc33055d

+ 2 - 2
filenames.auto.gni

@@ -232,7 +232,9 @@ auto_filenames = {
     "lib/browser/ipc-main-internal-utils.ts",
     "lib/browser/ipc-main-internal.ts",
     "lib/browser/message-port-main.ts",
+    "lib/browser/parse-features-string.ts",
     "lib/browser/rpc-server.ts",
+    "lib/browser/web-view-events.ts",
     "lib/common/api/clipboard.ts",
     "lib/common/api/deprecate.ts",
     "lib/common/api/module-list.ts",
@@ -241,9 +243,7 @@ auto_filenames = {
     "lib/common/define-properties.ts",
     "lib/common/init.ts",
     "lib/common/ipc-messages.ts",
-    "lib/common/parse-features-string.ts",
     "lib/common/reset-search-paths.ts",
-    "lib/common/web-view-events.ts",
     "lib/common/web-view-methods.ts",
     "lib/common/webpack-globals-provider.ts",
     "lib/renderer/ipc-renderer-internal-utils.ts",

+ 1 - 1
lib/browser/api/web-contents.ts

@@ -4,7 +4,7 @@ import type { BrowserWindowConstructorOptions, LoadURLOptions } from 'electron/m
 import * as url from 'url';
 import * as path from 'path';
 import { openGuestWindow, makeWebPreferences, parseContentTypeFormat } from '@electron/internal/browser/guest-window-manager';
-import { parseFeatures } from '@electron/internal/common/parse-features-string';
+import { parseFeatures } from '@electron/internal/browser/parse-features-string';
 import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
 import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
 import { MessagePortMain } from '@electron/internal/browser/message-port-main';

+ 2 - 2
lib/browser/guest-view-manager.ts

@@ -1,9 +1,9 @@
 import { webContents } from 'electron/main';
 import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
 import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
-import { parseWebViewWebPreferences } from '@electron/internal/common/parse-features-string';
+import { parseWebViewWebPreferences } from '@electron/internal/browser/parse-features-string';
 import { syncMethods, asyncMethods, properties } from '@electron/internal/common/web-view-methods';
-import { webViewEvents } from '@electron/internal/common/web-view-events';
+import { webViewEvents } from '@electron/internal/browser/web-view-events';
 import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
 
 interface GuestInstance {

+ 1 - 1
lib/browser/guest-window-manager.ts

@@ -7,7 +7,7 @@
  */
 import { BrowserWindow } from 'electron/main';
 import type { BrowserWindowConstructorOptions, Referrer, WebContents, LoadURLOptions } from 'electron/main';
-import { parseFeatures } from '@electron/internal/common/parse-features-string';
+import { parseFeatures } from '@electron/internal/browser/parse-features-string';
 import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
 
 type PostData = LoadURLOptions['postData']

+ 1 - 1
lib/common/parse-features-string.ts → lib/browser/parse-features-string.ts

@@ -2,7 +2,7 @@
  * Utilities to parse comma-separated key value pairs used in browser APIs.
  * For example: "x=100,y=200,width=500,height=500"
  */
-import { BrowserWindowConstructorOptions } from 'electron';
+import { BrowserWindowConstructorOptions } from 'electron/main';
 
 type RequiredBrowserWindowConstructorOptions = Required<BrowserWindowConstructorOptions>;
 type IntegerBrowserWindowOptionKeys = {

+ 0 - 0
lib/common/web-view-events.ts → lib/browser/web-view-events.ts


+ 1 - 1
spec-main/internal-spec.ts

@@ -2,7 +2,7 @@ import { expect } from 'chai';
 
 describe('feature-string parsing', () => {
   it('is indifferent to whitespace around keys and values', () => {
-    const { parseCommaSeparatedKeyValue } = require('../lib/common/parse-features-string');
+    const { parseCommaSeparatedKeyValue } = require('../lib/browser/parse-features-string');
     const checkParse = (string: string, parsed: Record<string, string | boolean>) => {
       const features = parseCommaSeparatedKeyValue(string);
       expect(features).to.deep.equal(parsed);