puppeteer-core
Advanced tools
Comparing version 21.2.0 to 21.2.1
@@ -17,3 +17,2 @@ /** | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { ChildProcess } from 'child_process'; | ||
@@ -20,0 +19,0 @@ import { Protocol } from 'devtools-protocol'; |
@@ -16,3 +16,2 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import Protocol from 'devtools-protocol'; | ||
@@ -19,0 +18,0 @@ import { Symbol } from '../../third_party/disposablestack/disposablestack.js'; |
@@ -16,3 +16,2 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import { TimeoutSettings } from '../common/TimeoutSettings.js'; | ||
@@ -19,0 +18,0 @@ import { EvaluateFunc, HandleFor, InnerLazyParams } from '../common/types.js'; |
@@ -29,2 +29,3 @@ /** | ||
get javascriptEnabled(): boolean; | ||
clients(): CDPSession[]; | ||
emulateViewport(viewport: Viewport): Promise<boolean>; | ||
@@ -31,0 +32,0 @@ emulateIdleState(overrides?: { |
@@ -47,2 +47,21 @@ "use strict"; | ||
const util_js_1 = require("./util.js"); | ||
class EmulatedState { | ||
#state; | ||
#clientProvider; | ||
#updater; | ||
constructor(initialState, clientProvider, updater) { | ||
this.#state = initialState; | ||
this.#clientProvider = clientProvider; | ||
this.#updater = updater; | ||
} | ||
async setState(state) { | ||
this.#state = state; | ||
await this.sync(); | ||
} | ||
async sync() { | ||
await Promise.all(this.#clientProvider.clients().map(client => { | ||
return this.#updater(client, this.#state); | ||
})); | ||
} | ||
} | ||
/** | ||
@@ -207,3 +226,5 @@ * @internal | ||
#hasTouch = false; | ||
#viewportState = {}; | ||
#viewportState = new EmulatedState({ | ||
active: false, | ||
}, this, this.#applyViewport); | ||
#idleOverridesState = { | ||
@@ -252,3 +273,3 @@ active: false, | ||
// the target is unpaused. | ||
void this.#syncViewport().catch(util_js_1.debugError); | ||
void this.#viewportState.sync().catch(util_js_1.debugError); | ||
void this.#syncIdleState().catch(util_js_1.debugError); | ||
@@ -267,7 +288,10 @@ void this.#syncTimezoneState().catch(util_js_1.debugError); | ||
} | ||
clients() { | ||
return [this.#client, ...Array.from(this.#secondaryClients)]; | ||
} | ||
async emulateViewport(viewport) { | ||
this.#viewportState = { | ||
await this.#viewportState.setState({ | ||
viewport, | ||
}; | ||
await this.#syncViewport(); | ||
active: true, | ||
}); | ||
const mobile = viewport.isMobile || false; | ||
@@ -280,10 +304,2 @@ const hasTouch = viewport.hasTouch || false; | ||
} | ||
async #syncViewport() { | ||
await Promise.all([ | ||
this.#applyViewport(this.#client, this.#viewportState), | ||
...Array.from(this.#secondaryClients).map(client => { | ||
return this.#applyViewport(client, this.#viewportState); | ||
}), | ||
]); | ||
} | ||
get #applyViewport() { return _private_applyViewport_descriptor.value; } | ||
@@ -290,0 +306,0 @@ async emulateIdleState(overrides) { |
@@ -166,3 +166,3 @@ /** | ||
new (mutex: Mutex): { | ||
"__#47540@#mutex": Mutex; | ||
"__#47567@#mutex": Mutex; | ||
[Symbol.dispose](): void; | ||
@@ -169,0 +169,0 @@ }; |
/** | ||
* @internal | ||
*/ | ||
export declare const packageVersion = "21.2.0"; | ||
export declare const packageVersion = "21.2.1"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
*/ | ||
exports.packageVersion = '21.2.0'; | ||
exports.packageVersion = '21.2.1'; | ||
//# sourceMappingURL=version.js.map |
@@ -40,3 +40,3 @@ /** | ||
customQuerySelectors: { | ||
"__#47498@#selectors": Map<string, CustomQuerySelectors.CustomQuerySelector>; | ||
"__#47524@#selectors": Map<string, CustomQuerySelectors.CustomQuerySelector>; | ||
register(name: string, handler: import("../puppeteer-core.js").CustomQueryHandler): void; | ||
@@ -43,0 +43,0 @@ unregister(name: string): void; |
@@ -1,4 +0,19 @@ | ||
/// <reference types="node" /> | ||
import 'disposablestack/auto'; | ||
declare global { | ||
interface SymbolConstructor { | ||
/** | ||
* A method that is used to release resources held by an object. Called by the semantics of the `using` statement. | ||
*/ | ||
readonly dispose: unique symbol; | ||
/** | ||
* A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement. | ||
*/ | ||
readonly asyncDispose: unique symbol; | ||
} | ||
interface Disposable { | ||
[Symbol.dispose](): void; | ||
} | ||
interface AsyncDisposable { | ||
[Symbol.asyncDispose](): PromiseLike<void>; | ||
} | ||
class DisposableStack implements Disposable { | ||
@@ -5,0 +20,0 @@ constructor(); |
@@ -17,3 +17,2 @@ /** | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { ChildProcess } from 'child_process'; | ||
@@ -20,0 +19,0 @@ import { Protocol } from 'devtools-protocol'; |
@@ -16,3 +16,2 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import Protocol from 'devtools-protocol'; | ||
@@ -19,0 +18,0 @@ import { Symbol } from '../../third_party/disposablestack/disposablestack.js'; |
@@ -16,3 +16,2 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import { TimeoutSettings } from '../common/TimeoutSettings.js'; | ||
@@ -19,0 +18,0 @@ import { EvaluateFunc, HandleFor, InnerLazyParams } from '../common/types.js'; |
@@ -29,2 +29,3 @@ /** | ||
get javascriptEnabled(): boolean; | ||
clients(): CDPSession[]; | ||
emulateViewport(viewport: Viewport): Promise<boolean>; | ||
@@ -31,0 +32,0 @@ emulateIdleState(overrides?: { |
@@ -44,2 +44,21 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { | ||
import { debugError } from './util.js'; | ||
class EmulatedState { | ||
#state; | ||
#clientProvider; | ||
#updater; | ||
constructor(initialState, clientProvider, updater) { | ||
this.#state = initialState; | ||
this.#clientProvider = clientProvider; | ||
this.#updater = updater; | ||
} | ||
async setState(state) { | ||
this.#state = state; | ||
await this.sync(); | ||
} | ||
async sync() { | ||
await Promise.all(this.#clientProvider.clients().map(client => { | ||
return this.#updater(client, this.#state); | ||
})); | ||
} | ||
} | ||
/** | ||
@@ -204,3 +223,5 @@ * @internal | ||
#hasTouch = false; | ||
#viewportState = {}; | ||
#viewportState = new EmulatedState({ | ||
active: false, | ||
}, this, this.#applyViewport); | ||
#idleOverridesState = { | ||
@@ -249,3 +270,3 @@ active: false, | ||
// the target is unpaused. | ||
void this.#syncViewport().catch(debugError); | ||
void this.#viewportState.sync().catch(debugError); | ||
void this.#syncIdleState().catch(debugError); | ||
@@ -264,7 +285,10 @@ void this.#syncTimezoneState().catch(debugError); | ||
} | ||
clients() { | ||
return [this.#client, ...Array.from(this.#secondaryClients)]; | ||
} | ||
async emulateViewport(viewport) { | ||
this.#viewportState = { | ||
await this.#viewportState.setState({ | ||
viewport, | ||
}; | ||
await this.#syncViewport(); | ||
active: true, | ||
}); | ||
const mobile = viewport.isMobile || false; | ||
@@ -277,10 +301,2 @@ const hasTouch = viewport.hasTouch || false; | ||
} | ||
async #syncViewport() { | ||
await Promise.all([ | ||
this.#applyViewport(this.#client, this.#viewportState), | ||
...Array.from(this.#secondaryClients).map(client => { | ||
return this.#applyViewport(client, this.#viewportState); | ||
}), | ||
]); | ||
} | ||
get #applyViewport() { return _private_applyViewport_descriptor.value; } | ||
@@ -287,0 +303,0 @@ async emulateIdleState(overrides) { |
@@ -166,3 +166,3 @@ /** | ||
new (mutex: Mutex): { | ||
"__#1096@#mutex": Mutex; | ||
"__#1097@#mutex": Mutex; | ||
[Symbol.dispose](): void; | ||
@@ -169,0 +169,0 @@ }; |
/** | ||
* @internal | ||
*/ | ||
export declare const packageVersion = "21.2.0"; | ||
export declare const packageVersion = "21.2.1"; | ||
//# sourceMappingURL=version.d.ts.map |
/** | ||
* @internal | ||
*/ | ||
export const packageVersion = '21.2.0'; | ||
export const packageVersion = '21.2.1'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,4 +0,19 @@ | ||
/// <reference types="node" /> | ||
import 'disposablestack/auto'; | ||
declare global { | ||
interface SymbolConstructor { | ||
/** | ||
* A method that is used to release resources held by an object. Called by the semantics of the `using` statement. | ||
*/ | ||
readonly dispose: unique symbol; | ||
/** | ||
* A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement. | ||
*/ | ||
readonly asyncDispose: unique symbol; | ||
} | ||
interface Disposable { | ||
[Symbol.dispose](): void; | ||
} | ||
interface AsyncDisposable { | ||
[Symbol.asyncDispose](): PromiseLike<void>; | ||
} | ||
class DisposableStack implements Disposable { | ||
@@ -5,0 +20,0 @@ constructor(); |
{ | ||
"name": "puppeteer-core", | ||
"version": "21.2.0", | ||
"version": "21.2.1", | ||
"description": "A high-level API to control headless Chrome over the DevTools Protocol", | ||
@@ -143,3 +143,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@puppeteer/browsers": "1.7.0", | ||
"@puppeteer/browsers": "1.7.1", | ||
"chromium-bidi": "0.4.26", | ||
@@ -149,3 +149,3 @@ "cross-fetch": "4.0.0", | ||
"devtools-protocol": "0.0.1159816", | ||
"ws": "8.14.0" | ||
"ws": "8.14.1" | ||
}, | ||
@@ -152,0 +152,0 @@ "devDependencies": { |
@@ -29,2 +29,3 @@ /** | ||
viewport?: Viewport; | ||
active: boolean; | ||
} | ||
@@ -80,2 +81,35 @@ | ||
interface ClientProvider { | ||
clients(): CDPSession[]; | ||
} | ||
class EmulatedState<T extends {active: boolean}> { | ||
#state: T; | ||
#clientProvider: ClientProvider; | ||
#updater: (client: CDPSession, state: T) => Promise<void>; | ||
constructor( | ||
initialState: T, | ||
clientProvider: ClientProvider, | ||
updater: (client: CDPSession, state: T) => Promise<void> | ||
) { | ||
this.#state = initialState; | ||
this.#clientProvider = clientProvider; | ||
this.#updater = updater; | ||
} | ||
async setState(state: T): Promise<void> { | ||
this.#state = state; | ||
await this.sync(); | ||
} | ||
async sync(): Promise<void> { | ||
await Promise.all( | ||
this.#clientProvider.clients().map(client => { | ||
return this.#updater(client, this.#state); | ||
}) | ||
); | ||
} | ||
} | ||
/** | ||
@@ -90,3 +124,9 @@ * @internal | ||
#viewportState: ViewportState = {}; | ||
#viewportState = new EmulatedState<ViewportState>( | ||
{ | ||
active: false, | ||
}, | ||
this, | ||
this.#applyViewport | ||
); | ||
#idleOverridesState: IdleOverridesState = { | ||
@@ -139,3 +179,3 @@ active: false, | ||
// the target is unpaused. | ||
void this.#syncViewport().catch(debugError); | ||
void this.#viewportState.sync().catch(debugError); | ||
void this.#syncIdleState().catch(debugError); | ||
@@ -156,9 +196,12 @@ void this.#syncTimezoneState().catch(debugError); | ||
clients(): CDPSession[] { | ||
return [this.#client, ...Array.from(this.#secondaryClients)]; | ||
} | ||
async emulateViewport(viewport: Viewport): Promise<boolean> { | ||
this.#viewportState = { | ||
await this.#viewportState.setState({ | ||
viewport, | ||
}; | ||
active: true, | ||
}); | ||
await this.#syncViewport(); | ||
const mobile = viewport.isMobile || false; | ||
@@ -174,11 +217,2 @@ const hasTouch = viewport.hasTouch || false; | ||
async #syncViewport() { | ||
await Promise.all([ | ||
this.#applyViewport(this.#client, this.#viewportState), | ||
...Array.from(this.#secondaryClients).map(client => { | ||
return this.#applyViewport(client, this.#viewportState); | ||
}), | ||
]); | ||
} | ||
@invokeAtMostOnceForArguments | ||
@@ -185,0 +219,0 @@ async #applyViewport( |
/** | ||
* @internal | ||
*/ | ||
export const packageVersion = '21.2.0'; | ||
export const packageVersion = '21.2.1'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5877794
118488
+ Added@puppeteer/browsers@1.7.1(transitive)
+ Addedproxy-agent@6.3.1(transitive)
+ Addedws@8.14.1(transitive)
- Removed@puppeteer/browsers@1.7.0(transitive)
- Removedproxy-agent@6.3.0(transitive)
- Removedws@8.14.0(transitive)
Updated@puppeteer/browsers@1.7.1
Updatedws@8.14.1