refactor: don't expose isPromise as an internal module (#19139)
This commit is contained in:
parent
949f8685d2
commit
69369cf365
6 changed files with 9 additions and 19 deletions
|
@ -123,7 +123,6 @@ auto_filenames = {
|
|||
"lib/browser/api/module-keys.js",
|
||||
"lib/common/api/clipboard.js",
|
||||
"lib/common/api/deprecate.ts",
|
||||
"lib/common/api/is-promise.js",
|
||||
"lib/common/api/module-list.js",
|
||||
"lib/common/api/native-image.js",
|
||||
"lib/common/api/shell.js",
|
||||
|
@ -132,6 +131,7 @@ auto_filenames = {
|
|||
"lib/common/crash-reporter.js",
|
||||
"lib/common/electron-binding-setup.ts",
|
||||
"lib/common/error-utils.js",
|
||||
"lib/common/is-promise.ts",
|
||||
"lib/common/web-view-methods.js",
|
||||
"lib/renderer/api/crash-reporter.js",
|
||||
"lib/renderer/api/desktop-capturer.ts",
|
||||
|
@ -252,7 +252,6 @@ auto_filenames = {
|
|||
"lib/common/api/clipboard.js",
|
||||
"lib/common/api/deprecate.ts",
|
||||
"lib/common/api/exports/electron.js",
|
||||
"lib/common/api/is-promise.js",
|
||||
"lib/common/api/module-list.js",
|
||||
"lib/common/api/native-image.js",
|
||||
"lib/common/api/shell.js",
|
||||
|
@ -262,6 +261,7 @@ auto_filenames = {
|
|||
"lib/common/electron-binding-setup.ts",
|
||||
"lib/common/error-utils.js",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/is-promise.ts",
|
||||
"lib/common/parse-features-string.js",
|
||||
"lib/common/reset-search-paths.ts",
|
||||
"lib/common/web-view-methods.js",
|
||||
|
@ -277,7 +277,6 @@ auto_filenames = {
|
|||
"lib/common/api/clipboard.js",
|
||||
"lib/common/api/deprecate.ts",
|
||||
"lib/common/api/exports/electron.js",
|
||||
"lib/common/api/is-promise.js",
|
||||
"lib/common/api/module-list.js",
|
||||
"lib/common/api/native-image.js",
|
||||
"lib/common/api/shell.js",
|
||||
|
@ -287,6 +286,7 @@ auto_filenames = {
|
|||
"lib/common/electron-binding-setup.ts",
|
||||
"lib/common/error-utils.js",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/is-promise.ts",
|
||||
"lib/common/reset-search-paths.ts",
|
||||
"lib/common/web-view-methods.js",
|
||||
"lib/renderer/api/crash-reporter.js",
|
||||
|
@ -327,7 +327,6 @@ auto_filenames = {
|
|||
"lib/common/api/clipboard.js",
|
||||
"lib/common/api/deprecate.ts",
|
||||
"lib/common/api/exports/electron.js",
|
||||
"lib/common/api/is-promise.js",
|
||||
"lib/common/api/module-list.js",
|
||||
"lib/common/api/native-image.js",
|
||||
"lib/common/api/shell.js",
|
||||
|
@ -337,6 +336,7 @@ auto_filenames = {
|
|||
"lib/common/electron-binding-setup.ts",
|
||||
"lib/common/error-utils.js",
|
||||
"lib/common/init.ts",
|
||||
"lib/common/is-promise.ts",
|
||||
"lib/common/reset-search-paths.ts",
|
||||
"lib/renderer/api/crash-reporter.js",
|
||||
"lib/renderer/api/desktop-capturer.ts",
|
||||
|
|
|
@ -9,8 +9,6 @@ const eventBinding = process.electronBinding('event')
|
|||
const clipboard = process.electronBinding('clipboard')
|
||||
const features = process.electronBinding('features')
|
||||
|
||||
const { isPromise } = electron
|
||||
|
||||
const { getContentScripts } = require('@electron/internal/browser/chrome-extension')
|
||||
const { crashReporterInit } = require('@electron/internal/browser/crash-reporter-init')
|
||||
const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal')
|
||||
|
@ -20,6 +18,7 @@ const guestViewManager = require('@electron/internal/browser/guest-view-manager'
|
|||
const bufferUtils = require('@electron/internal/common/buffer-utils')
|
||||
const errorUtils = require('@electron/internal/common/error-utils')
|
||||
const clipboardUtils = require('@electron/internal/common/clipboard-utils')
|
||||
const { isPromise } = require('@electron/internal/common/is-promise')
|
||||
|
||||
const hasProp = {}.hasOwnProperty
|
||||
|
||||
|
|
|
@ -6,6 +6,5 @@ module.exports = [
|
|||
{ 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: 'isPromise', loader: () => require('./is-promise'), private: true }
|
||||
{ name: 'deprecate', loader: () => require('./deprecate'), private: true }
|
||||
]
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
'use strict'
|
||||
|
||||
module.exports = function isPromise (val) {
|
||||
export function isPromise (val: any) {
|
||||
return (
|
||||
val &&
|
||||
val.then &&
|
|
@ -1,12 +1,11 @@
|
|||
'use strict'
|
||||
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
const { isPromise } = require('electron')
|
||||
const resolvePromise = Promise.resolve.bind(Promise)
|
||||
|
||||
const { CallbacksRegistry } = require('@electron/internal/renderer/callbacks-registry')
|
||||
const bufferUtils = require('@electron/internal/common/buffer-utils')
|
||||
const errorUtils = require('@electron/internal/common/error-utils')
|
||||
const { isPromise } = require('@electron/internal/common/is-promise')
|
||||
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal')
|
||||
|
||||
const callbacksRegistry = new CallbacksRegistry()
|
||||
|
@ -216,7 +215,7 @@ function metaToValue (meta) {
|
|||
value: () => meta.value,
|
||||
array: () => meta.members.map((member) => metaToValue(member)),
|
||||
buffer: () => bufferUtils.metaToBuffer(meta.value),
|
||||
promise: () => resolvePromise({ then: metaToValue(meta.then) }),
|
||||
promise: () => Promise.resolve({ then: metaToValue(meta.then) }),
|
||||
error: () => metaToPlainObject(meta),
|
||||
date: () => new Date(meta.value),
|
||||
exception: () => { throw errorUtils.deserialize(meta.value) }
|
||||
|
|
|
@ -34,10 +34,5 @@ module.exports = [
|
|||
name: 'deprecate',
|
||||
load: () => require('@electron/internal/common/api/deprecate'),
|
||||
private: true
|
||||
},
|
||||
{
|
||||
name: 'isPromise',
|
||||
load: () => require('@electron/internal/common/api/is-promise'),
|
||||
private: true
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue