From 18cc33055db5f2cf2a5a79e1fdb86ee7105eb711 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Wed, 10 Nov 2021 17:54:51 +0100 Subject: [PATCH] chore: move libs only used in browser out of common (#31780) --- filenames.auto.gni | 4 ++-- lib/browser/api/web-contents.ts | 2 +- lib/browser/guest-view-manager.ts | 4 ++-- lib/browser/guest-window-manager.ts | 2 +- lib/{common => browser}/parse-features-string.ts | 2 +- lib/{common => browser}/web-view-events.ts | 0 spec-main/internal-spec.ts | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename lib/{common => browser}/parse-features-string.ts (97%) rename lib/{common => browser}/web-view-events.ts (100%) diff --git a/filenames.auto.gni b/filenames.auto.gni index eb9632f19b89..8738398d9703 100644 --- a/filenames.auto.gni +++ b/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", diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts index fb100e8798d6..959e16eb3820 100644 --- a/lib/browser/api/web-contents.ts +++ b/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'; diff --git a/lib/browser/guest-view-manager.ts b/lib/browser/guest-view-manager.ts index 59e9c9f87a05..f3aeeeeffd49 100644 --- a/lib/browser/guest-view-manager.ts +++ b/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 { diff --git a/lib/browser/guest-window-manager.ts b/lib/browser/guest-window-manager.ts index c17227a3a982..08b2ecbc9213 100644 --- a/lib/browser/guest-window-manager.ts +++ b/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'] diff --git a/lib/common/parse-features-string.ts b/lib/browser/parse-features-string.ts similarity index 97% rename from lib/common/parse-features-string.ts rename to lib/browser/parse-features-string.ts index ec3e4e20bbde..47b3f06a0b76 100644 --- a/lib/common/parse-features-string.ts +++ b/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; type IntegerBrowserWindowOptionKeys = { diff --git a/lib/common/web-view-events.ts b/lib/browser/web-view-events.ts similarity index 100% rename from lib/common/web-view-events.ts rename to lib/browser/web-view-events.ts diff --git a/spec-main/internal-spec.ts b/spec-main/internal-spec.ts index 0668c9c83152..45d5f6605b1b 100644 --- a/spec-main/internal-spec.ts +++ b/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) => { const features = parseCommaSeparatedKeyValue(string); expect(features).to.deep.equal(parsed);