Skip to content

Commit

Permalink
refactor: don't expose deprecate as an internal module
Browse files Browse the repository at this point in the history
  • Loading branch information
miniak authored and Milan Burda committed Aug 11, 2022
1 parent 81d95b5 commit 23210b5
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 21 deletions.
5 changes: 1 addition & 4 deletions filenames.auto.gni
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ auto_filenames = {
]

sandbox_bundle_deps = [
"lib/common/api/deprecate.ts",
"lib/common/api/native-image.ts",
"lib/common/define-properties.ts",
"lib/common/ipc-messages.ts",
Expand Down Expand Up @@ -238,11 +237,11 @@ auto_filenames = {
"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",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
"lib/common/define-properties.ts",
"lib/common/deprecate.ts",
"lib/common/init.ts",
"lib/common/ipc-messages.ts",
"lib/common/reset-search-paths.ts",
Expand All @@ -259,7 +258,6 @@ auto_filenames = {

renderer_bundle_deps = [
"lib/common/api/clipboard.ts",
"lib/common/api/deprecate.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
Expand Down Expand Up @@ -298,7 +296,6 @@ auto_filenames = {

worker_bundle_deps = [
"lib/common/api/clipboard.ts",
"lib/common/api/deprecate.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.ts",
"lib/common/api/shell.ts",
Expand Down
3 changes: 2 additions & 1 deletion lib/browser/api/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as fs from 'fs';

import { Menu, deprecate } from 'electron/main';
import { Menu } from 'electron/main';
import { deprecate } from '@electron/internal/common/deprecate';

const bindings = process._linkedBinding('electron_browser_app');
const commandLine = process._linkedBinding('electron_common_command_line');
Expand Down
3 changes: 2 additions & 1 deletion lib/browser/api/crash-reporter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { app, deprecate } from 'electron/main';
import { app } from 'electron/main';
import { deprecate } from '@electron/internal/common/deprecate';

const binding = process._linkedBinding('electron_browser_crash_reporter');

Expand Down
3 changes: 2 additions & 1 deletion lib/browser/api/web-contents.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, ipcMain, session, webFrameMain, deprecate } from 'electron/main';
import { app, ipcMain, session, webFrameMain } from 'electron/main';
import type { BrowserWindowConstructorOptions, LoadURLOptions } from 'electron/main';

import * as url from 'url';
Expand All @@ -10,6 +10,7 @@ import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-util
import { MessagePortMain } from '@electron/internal/browser/message-port-main';
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl';
import { deprecate } from '@electron/internal/common/deprecate';

// session is not used here, the purpose is to make sure session is initialized
// before the webContents module.
Expand Down
4 changes: 1 addition & 3 deletions lib/common/api/module-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
export const commonModuleList: ElectronInternal.ModuleEntry[] = [
{ name: 'clipboard', loader: () => require('./clipboard') },
{ name: 'nativeImage', loader: () => require('./native-image') },
{ name: 'shell', loader: () => require('./shell') },
// The internal modules, invisible unless you know their names.
{ name: 'deprecate', loader: () => require('./deprecate'), private: true }
{ name: 'shell', loader: () => require('./shell') }
];
1 change: 0 additions & 1 deletion lib/common/define-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export function defineProperties (targetExports: Object, moduleList: ElectronInt
const descriptors: PropertyDescriptorMap = {};
for (const module of moduleList) {
descriptors[module.name] = {
enumerable: !module.private,
get: handleESModule(module.loader)
};
}
Expand Down
4 changes: 1 addition & 3 deletions lib/common/api/deprecate.ts → lib/common/deprecate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function warnOnce (oldName: string, newName?: string) {
};
}

const deprecate: ElectronInternal.DeprecationUtil = {
export const deprecate: ElectronInternal.DeprecationUtil = {
warnOnce,
setHandler: (handler) => { deprecationHandler = handler; },
getHandler: () => deprecationHandler,
Expand Down Expand Up @@ -131,5 +131,3 @@ const deprecate: ElectronInternal.DeprecationUtil = {
});
}
};

export default deprecate;
6 changes: 0 additions & 6 deletions lib/sandboxed_renderer/api/module-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,5 @@ export const moduleList: ElectronInternal.ModuleEntry[] = [
{
name: 'webFrame',
loader: () => require('@electron/internal/renderer/api/web-frame')
},
// The internal modules, invisible unless you know their names.
{
name: 'deprecate',
loader: () => require('@electron/internal/common/api/deprecate'),
private: true
}
];
2 changes: 1 addition & 1 deletion spec-main/api-deprecate-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { deprecate } from 'electron/main';
import { deprecate } from '../lib/common/deprecate';

describe('deprecate', () => {
let throwing: boolean;
Expand Down

0 comments on commit 23210b5

Please sign in to comment.