mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: remove more import cycles (#11231)
This commit is contained in:
parent
39e9d5e1ec
commit
b9ce89e460
@ -131,7 +131,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
'import/no-cycle': ['warn', {maxDepth: Infinity}],
|
'import/no-cycle': [
|
||||||
|
'warn',
|
||||||
|
{maxDepth: Infinity, allowUnsafeDynamicCyclicDependency: true},
|
||||||
|
],
|
||||||
|
|
||||||
'no-restricted-syntax': [
|
'no-restricted-syntax': [
|
||||||
'error',
|
'error',
|
||||||
|
@ -18,7 +18,7 @@ import type {Protocol} from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
||||||
import {FrameEvent} from '../api/Frame.js';
|
import {FrameEvent} from '../api/Frame.js';
|
||||||
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
import {EventEmitter} from '../common/EventEmitter.js';
|
||||||
import type {TimeoutSettings} from '../common/TimeoutSettings.js';
|
import type {TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
import {debugError, PuppeteerURL, UTILITY_WORLD_NAME} from '../common/util.js';
|
import {debugError, PuppeteerURL, UTILITY_WORLD_NAME} from '../common/util.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
@ -31,6 +31,8 @@ import {isTargetClosedError} from './Connection.js';
|
|||||||
import {DeviceRequestPromptManager} from './DeviceRequestPrompt.js';
|
import {DeviceRequestPromptManager} from './DeviceRequestPrompt.js';
|
||||||
import {ExecutionContext} from './ExecutionContext.js';
|
import {ExecutionContext} from './ExecutionContext.js';
|
||||||
import {CdpFrame} from './Frame.js';
|
import {CdpFrame} from './Frame.js';
|
||||||
|
import type {FrameManagerEvents} from './FrameManagerEvents.js';
|
||||||
|
import {FrameManagerEvent} from './FrameManagerEvents.js';
|
||||||
import {FrameTree} from './FrameTree.js';
|
import {FrameTree} from './FrameTree.js';
|
||||||
import type {IsolatedWorld} from './IsolatedWorld.js';
|
import type {IsolatedWorld} from './IsolatedWorld.js';
|
||||||
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
||||||
@ -38,37 +40,6 @@ import {NetworkManager} from './NetworkManager.js';
|
|||||||
import type {CdpPage} from './Page.js';
|
import type {CdpPage} from './Page.js';
|
||||||
import type {CdpTarget} from './Target.js';
|
import type {CdpTarget} from './Target.js';
|
||||||
|
|
||||||
/**
|
|
||||||
* We use symbols to prevent external parties listening to these events.
|
|
||||||
* They are internal to Puppeteer.
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
||||||
export namespace FrameManagerEvent {
|
|
||||||
export const FrameAttached = Symbol('FrameManager.FrameAttached');
|
|
||||||
export const FrameNavigated = Symbol('FrameManager.FrameNavigated');
|
|
||||||
export const FrameDetached = Symbol('FrameManager.FrameDetached');
|
|
||||||
export const FrameSwapped = Symbol('FrameManager.FrameSwapped');
|
|
||||||
export const LifecycleEvent = Symbol('FrameManager.LifecycleEvent');
|
|
||||||
export const FrameNavigatedWithinDocument = Symbol(
|
|
||||||
'FrameManager.FrameNavigatedWithinDocument'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface FrameManagerEvents extends Record<EventType, unknown> {
|
|
||||||
[FrameManagerEvent.FrameAttached]: CdpFrame;
|
|
||||||
[FrameManagerEvent.FrameNavigated]: CdpFrame;
|
|
||||||
[FrameManagerEvent.FrameDetached]: CdpFrame;
|
|
||||||
[FrameManagerEvent.FrameSwapped]: CdpFrame;
|
|
||||||
[FrameManagerEvent.LifecycleEvent]: CdpFrame;
|
|
||||||
[FrameManagerEvent.FrameNavigatedWithinDocument]: CdpFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TIME_FOR_WAITING_FOR_SWAP = 100; // ms.
|
const TIME_FOR_WAITING_FOR_SWAP = 100; // ms.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
49
packages/puppeteer-core/src/cdp/FrameManagerEvents.ts
Normal file
49
packages/puppeteer-core/src/cdp/FrameManagerEvents.ts
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2023 Google Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type {EventType} from '../common/EventEmitter.js';
|
||||||
|
|
||||||
|
import type {CdpFrame} from './Frame.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We use symbols to prevent external parties listening to these events.
|
||||||
|
* They are internal to Puppeteer.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
|
export namespace FrameManagerEvent {
|
||||||
|
export const FrameAttached = Symbol('FrameManager.FrameAttached');
|
||||||
|
export const FrameNavigated = Symbol('FrameManager.FrameNavigated');
|
||||||
|
export const FrameDetached = Symbol('FrameManager.FrameDetached');
|
||||||
|
export const FrameSwapped = Symbol('FrameManager.FrameSwapped');
|
||||||
|
export const LifecycleEvent = Symbol('FrameManager.LifecycleEvent');
|
||||||
|
export const FrameNavigatedWithinDocument = Symbol(
|
||||||
|
'FrameManager.FrameNavigatedWithinDocument'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface FrameManagerEvents extends Record<EventType, unknown> {
|
||||||
|
[FrameManagerEvent.FrameAttached]: CdpFrame;
|
||||||
|
[FrameManagerEvent.FrameNavigated]: CdpFrame;
|
||||||
|
[FrameManagerEvent.FrameDetached]: CdpFrame;
|
||||||
|
[FrameManagerEvent.FrameSwapped]: CdpFrame;
|
||||||
|
[FrameManagerEvent.LifecycleEvent]: CdpFrame;
|
||||||
|
[FrameManagerEvent.FrameNavigatedWithinDocument]: CdpFrame;
|
||||||
|
}
|
@ -27,7 +27,7 @@ import {Deferred} from '../util/Deferred.js';
|
|||||||
import {DisposableStack} from '../util/disposable.js';
|
import {DisposableStack} from '../util/disposable.js';
|
||||||
|
|
||||||
import type {CdpFrame} from './Frame.js';
|
import type {CdpFrame} from './Frame.js';
|
||||||
import {FrameManagerEvent} from './FrameManager.js';
|
import {FrameManagerEvent} from './FrameManagerEvents.js';
|
||||||
import type {NetworkManager} from './NetworkManager.js';
|
import type {NetworkManager} from './NetworkManager.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +76,8 @@ import {EmulationManager} from './EmulationManager.js';
|
|||||||
import {createCdpHandle} from './ExecutionContext.js';
|
import {createCdpHandle} from './ExecutionContext.js';
|
||||||
import {FirefoxTargetManager} from './FirefoxTargetManager.js';
|
import {FirefoxTargetManager} from './FirefoxTargetManager.js';
|
||||||
import type {CdpFrame} from './Frame.js';
|
import type {CdpFrame} from './Frame.js';
|
||||||
import {FrameManager, FrameManagerEvent} from './FrameManager.js';
|
import {FrameManager} from './FrameManager.js';
|
||||||
|
import {FrameManagerEvent} from './FrameManagerEvents.js';
|
||||||
import {CdpKeyboard, CdpMouse, CdpTouchscreen} from './Input.js';
|
import {CdpKeyboard, CdpMouse, CdpTouchscreen} from './Input.js';
|
||||||
import {MAIN_WORLD} from './IsolatedWorlds.js';
|
import {MAIN_WORLD} from './IsolatedWorlds.js';
|
||||||
import {releaseObject} from './JSHandle.js';
|
import {releaseObject} from './JSHandle.js';
|
||||||
|
Loading…
Reference in New Issue
Block a user