mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: re-export all exports (#9241)
Adds index files to subfolders and removes generation of types.ts in puppeteer-core.
This commit is contained in:
parent
15604f474a
commit
30c6b13eec
@ -136,6 +136,7 @@ sidebar_label: API
|
||||
| [launch](./puppeteer.launch.md) | |
|
||||
| [networkConditions](./puppeteer.networkconditions.md) | |
|
||||
| [PredefinedNetworkConditions](./puppeteer.predefinednetworkconditions.md) | A list of network conditions to be used with [Page.emulateNetworkConditions()](./puppeteer.page.emulatenetworkconditions.md). |
|
||||
| [puppeteer](./puppeteer.puppeteer.md) | |
|
||||
|
||||
## Type Aliases
|
||||
|
||||
|
@ -8,6 +8,6 @@ sidebar_label: connect
|
||||
|
||||
```typescript
|
||||
connect: (
|
||||
options: import('puppeteer-core/internal/common/Puppeteer.js').ConnectOptions
|
||||
) => Promise<import('./types.js').Browser>;
|
||||
options: import('puppeteer-core/internal/puppeteer-core.js').ConnectOptions
|
||||
) => Promise<import('puppeteer-core/internal/puppeteer-core.js').Browser>;
|
||||
```
|
||||
|
@ -9,7 +9,7 @@ sidebar_label: createBrowserFetcher
|
||||
```typescript
|
||||
createBrowserFetcher: (
|
||||
options: Partial<
|
||||
import('puppeteer-core/internal/node/BrowserFetcher.js').BrowserFetcherOptions
|
||||
import('puppeteer-core/internal/puppeteer-core.js').BrowserFetcherOptions
|
||||
>
|
||||
) => import('puppeteer-core/internal/node/BrowserFetcher.js').BrowserFetcher;
|
||||
) => import('puppeteer-core/internal/puppeteer-core.js').BrowserFetcher;
|
||||
```
|
||||
|
@ -7,5 +7,5 @@ sidebar_label: defaultArgs
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
defaultArgs: (options?: import("puppeteer-core/internal/node/LaunchOptions.js").BrowserLaunchArgumentOptions | undefined) => string[]
|
||||
defaultArgs: (options?: import("puppeteer-core/internal/puppeteer-core.js").BrowserLaunchArgumentOptions | undefined) => string[]
|
||||
```
|
||||
|
@ -9,7 +9,7 @@ sidebar_label: executablePath
|
||||
```typescript
|
||||
executablePath: (
|
||||
channel?:
|
||||
| import('puppeteer-core/internal/node/LaunchOptions.js').ChromeReleaseChannel
|
||||
| import('puppeteer-core/internal/puppeteer-core.js').ChromeReleaseChannel
|
||||
| undefined
|
||||
) => string;
|
||||
```
|
||||
|
@ -9,7 +9,7 @@ sidebar_label: launch
|
||||
```typescript
|
||||
launch: (
|
||||
options?:
|
||||
| import('puppeteer-core/internal/node/PuppeteerNode.js').PuppeteerLaunchOptions
|
||||
| import('puppeteer-core/internal/puppeteer-core.js').PuppeteerLaunchOptions
|
||||
| undefined
|
||||
) => Promise<import('./types.js').Browser>;
|
||||
) => Promise<import('puppeteer-core/internal/puppeteer-core.js').Browser>;
|
||||
```
|
||||
|
@ -1,29 +1,11 @@
|
||||
---
|
||||
sidebar_label: Puppeteer
|
||||
sidebar_label: puppeteer
|
||||
---
|
||||
|
||||
# Puppeteer class
|
||||
|
||||
The main Puppeteer class.
|
||||
|
||||
IMPORTANT: if you are using Puppeteer in a Node environment, you will get an instance of [PuppeteerNode](./puppeteer.puppeteernode.md) when you import or require `puppeteer`. That class extends `Puppeteer`, so has all the methods documented below as well as all that are defined on [PuppeteerNode](./puppeteer.puppeteernode.md).
|
||||
# puppeteer variable
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
export declare class Puppeteer
|
||||
puppeteer: PuppeteerNode;
|
||||
```
|
||||
|
||||
## Remarks
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Puppeteer` class.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ----------------------------------------------------------------------------------------------------- | ------------------- | ---------------------------------------------------------------------- |
|
||||
| [clearCustomQueryHandlers()](./puppeteer.puppeteer.clearcustomqueryhandlers.md) | <code>static</code> | Unregisters all custom query handlers. |
|
||||
| [connect(options)](./puppeteer.puppeteer.connect.md) | | This method attaches Puppeteer to an existing browser instance. |
|
||||
| [customQueryHandlerNames()](./puppeteer.puppeteer.customqueryhandlernames.md) | <code>static</code> | Gets the names of all custom query handlers. |
|
||||
| [registerCustomQueryHandler(name, queryHandler)](./puppeteer.puppeteer.registercustomqueryhandler.md) | <code>static</code> | Registers a [custom query handler](./puppeteer.customqueryhandler.md). |
|
||||
| [unregisterCustomQueryHandler(name)](./puppeteer.puppeteer.unregistercustomqueryhandler.md) | <code>static</code> | Unregisters a custom query handler for a given name. |
|
||||
|
@ -4,10 +4,6 @@ sidebar_label: PuppeteerNode.createBrowserFetcher
|
||||
|
||||
# PuppeteerNode.createBrowserFetcher() method
|
||||
|
||||
> Warning: This API is now obsolete.
|
||||
>
|
||||
> If you are using `puppeteer-core`, do not use this method. Just construct [BrowserFetcher](./puppeteer.browserfetcher.md) manually.
|
||||
|
||||
#### Signature:
|
||||
|
||||
```typescript
|
||||
@ -27,3 +23,7 @@ class PuppeteerNode {
|
||||
[BrowserFetcher](./puppeteer.browserfetcher.md)
|
||||
|
||||
A new BrowserFetcher instance.
|
||||
|
||||
## Remarks
|
||||
|
||||
If you are using `puppeteer-core`, do not use this method. Just construct [BrowserFetcher](./puppeteer.browserfetcher.md) manually.
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||
"mainEntryPointFilePath": "<projectFolder>/lib/esm/puppeteer/types.d.ts",
|
||||
"mainEntryPointFilePath": "<projectFolder>/lib/esm/puppeteer/puppeteer-core.d.ts",
|
||||
"bundledPackages": [],
|
||||
|
||||
"apiReport": {
|
||||
|
@ -69,8 +69,7 @@
|
||||
"src/templates/**"
|
||||
],
|
||||
"output": [
|
||||
"src/generated/**",
|
||||
"src/types.ts"
|
||||
"src/generated/**"
|
||||
]
|
||||
},
|
||||
"build:third_party": {
|
||||
|
19
packages/puppeteer-core/src/api/api.ts
Normal file
19
packages/puppeteer-core/src/api/api.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
export * from './Browser.js';
|
||||
export * from './BrowserContext.js';
|
||||
export * from './Page.js';
|
@ -15,12 +15,14 @@
|
||||
*/
|
||||
|
||||
import {Protocol} from 'devtools-protocol';
|
||||
|
||||
import {assert} from '../util/assert.js';
|
||||
import {CDPSession} from './Connection.js';
|
||||
import {ElementHandle} from './ElementHandle.js';
|
||||
import {Frame} from './Frame.js';
|
||||
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorld.js';
|
||||
import {PuppeteerQueryHandler} from './QueryHandler.js';
|
||||
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
||||
|
||||
import type {ElementHandle} from './ElementHandle.js';
|
||||
import type {PuppeteerQueryHandler} from './QueryHandler.js';
|
||||
import type {Frame} from './Frame.js';
|
||||
|
||||
async function queryAXTree(
|
||||
client: CDPSession,
|
||||
@ -115,7 +117,7 @@ const waitFor: PuppeteerQueryHandler['waitFor'] = async (
|
||||
) => {
|
||||
let frame: Frame;
|
||||
let element: ElementHandle<Node> | undefined;
|
||||
if (elementOrFrame instanceof Frame) {
|
||||
if ('isOOPFrame' in elementOrFrame) {
|
||||
frame = elementOrFrame;
|
||||
} else {
|
||||
frame = elementOrFrame.frame;
|
||||
@ -151,11 +153,13 @@ const waitFor: PuppeteerQueryHandler['waitFor'] = async (
|
||||
if (element) {
|
||||
await element.dispose();
|
||||
}
|
||||
if (!(result instanceof ElementHandle)) {
|
||||
|
||||
const handle = result?.asElement();
|
||||
if (!handle) {
|
||||
await result?.dispose();
|
||||
return null;
|
||||
}
|
||||
return result.frame.worlds[MAIN_WORLD].transferHandle(result);
|
||||
return handle.frame.worlds[MAIN_WORLD].transferHandle(handle);
|
||||
};
|
||||
|
||||
const queryAll: PuppeteerQueryHandler['queryAll'] = async (
|
||||
|
@ -26,10 +26,9 @@ import {MouseButton} from './Input.js';
|
||||
import {
|
||||
IsolatedWorld,
|
||||
IsolatedWorldChart,
|
||||
MAIN_WORLD,
|
||||
PUPPETEER_WORLD,
|
||||
WaitForSelectorOptions,
|
||||
} from './IsolatedWorld.js';
|
||||
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
||||
import {LifecycleWatcher, PuppeteerLifeCycleEvent} from './LifecycleWatcher.js';
|
||||
import {Page} from '../api/Page.js';
|
||||
import {getQueryHandlerAndSelector} from './QueryHandler.js';
|
||||
|
@ -22,7 +22,8 @@ import {EventEmitter} from './EventEmitter.js';
|
||||
import {EVALUATION_SCRIPT_URL, ExecutionContext} from './ExecutionContext.js';
|
||||
import {Frame} from './Frame.js';
|
||||
import {FrameTree} from './FrameTree.js';
|
||||
import {IsolatedWorld, MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorld.js';
|
||||
import {IsolatedWorld} from './IsolatedWorld.js';
|
||||
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
||||
import {NetworkManager} from './NetworkManager.js';
|
||||
import {Page} from '../api/Page.js';
|
||||
import {Target} from './Target.js';
|
||||
|
@ -16,12 +16,10 @@
|
||||
|
||||
import {Protocol} from 'devtools-protocol';
|
||||
import {source as injectedSource} from '../generated/injected.js';
|
||||
import type PuppeteerUtil from '../injected/injected.js';
|
||||
import {assert} from '../util/assert.js';
|
||||
import {createDeferredPromise} from '../util/DeferredPromise.js';
|
||||
import {isErrorLike} from '../util/ErrorLike.js';
|
||||
import {CDPSession} from './Connection.js';
|
||||
import {ElementHandle} from './ElementHandle.js';
|
||||
import {ExecutionContext} from './ExecutionContext.js';
|
||||
import {Frame} from './Frame.js';
|
||||
import {FrameManager} from './FrameManager.js';
|
||||
@ -33,6 +31,10 @@ import {TimeoutSettings} from './TimeoutSettings.js';
|
||||
import {EvaluateFunc, HandleFor, InnerLazyParams, NodeFor} from './types.js';
|
||||
import {createJSHandle, debugError, pageBindingInitString} from './util.js';
|
||||
import {TaskManager, WaitTask} from './WaitTask.js';
|
||||
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
||||
|
||||
import type PuppeteerUtil from '../injected/injected.js';
|
||||
import type {ElementHandle} from './ElementHandle.js';
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -70,20 +72,6 @@ export interface PageBinding {
|
||||
pptrFunction: Function;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique key for {@link IsolatedWorldChart} to denote the default world.
|
||||
* Execution contexts are automatically created in the default world.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const MAIN_WORLD = Symbol('mainWorld');
|
||||
/**
|
||||
* A unique key for {@link IsolatedWorldChart} to denote the puppeteer world.
|
||||
* This world contains all puppeteer-internal bindings/code.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const PUPPETEER_WORLD = Symbol('puppeteerWorld');
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
30
packages/puppeteer-core/src/common/IsolatedWorlds.ts
Normal file
30
packages/puppeteer-core/src/common/IsolatedWorlds.ts
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A unique key for {@link IsolatedWorldChart} to denote the default world.
|
||||
* Execution contexts are automatically created in the default world.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const MAIN_WORLD = Symbol('mainWorld');
|
||||
/**
|
||||
* A unique key for {@link IsolatedWorldChart} to denote the puppeteer world.
|
||||
* This world contains all puppeteer-internal bindings/code.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const PUPPETEER_WORLD = Symbol('puppeteerWorld');
|
@ -57,7 +57,8 @@ import {FrameManager, FrameManagerEmittedEvents} from './FrameManager.js';
|
||||
import {HTTPRequest} from './HTTPRequest.js';
|
||||
import {HTTPResponse} from './HTTPResponse.js';
|
||||
import {Keyboard, Mouse, MouseButton, Touchscreen} from './Input.js';
|
||||
import {MAIN_WORLD, WaitForSelectorOptions} from './IsolatedWorld.js';
|
||||
import {WaitForSelectorOptions} from './IsolatedWorld.js';
|
||||
import {MAIN_WORLD} from './IsolatedWorlds.js';
|
||||
import {JSHandle} from './JSHandle.js';
|
||||
import {
|
||||
Credentials,
|
||||
|
@ -18,11 +18,8 @@ import PuppeteerUtil from '../injected/injected.js';
|
||||
import {ariaHandler} from './AriaQueryHandler.js';
|
||||
import {ElementHandle} from './ElementHandle.js';
|
||||
import {Frame} from './Frame.js';
|
||||
import {
|
||||
MAIN_WORLD,
|
||||
PUPPETEER_WORLD,
|
||||
WaitForSelectorOptions,
|
||||
} from './IsolatedWorld.js';
|
||||
import {WaitForSelectorOptions} from './IsolatedWorld.js';
|
||||
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
||||
|
||||
/**
|
||||
* @public
|
||||
|
20
packages/puppeteer-core/src/common/bidi/bidi.ts
Normal file
20
packages/puppeteer-core/src/common/bidi/bidi.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
export * from './Browser.js';
|
||||
export * from './BrowserContext.js';
|
||||
export * from './Page.js';
|
||||
export * from './Connection.js';
|
69
packages/puppeteer-core/src/common/common.ts
Normal file
69
packages/puppeteer-core/src/common/common.ts
Normal file
@ -0,0 +1,69 @@
|
||||
/**
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
export * from './Accessibility.js';
|
||||
export * from './AriaQueryHandler.js';
|
||||
export * from './Browser.js';
|
||||
export * from './BrowserConnector.js';
|
||||
export * from './BrowserWebSocketTransport.js';
|
||||
export * from './ChromeTargetManager.js';
|
||||
export * from './Configuration.js';
|
||||
export * from './Connection.js';
|
||||
export * from './ConnectionTransport.js';
|
||||
export * from './ConsoleMessage.js';
|
||||
export * from './Coverage.js';
|
||||
export * from './Debug.js';
|
||||
export * from './Device.js';
|
||||
export * from './Dialog.js';
|
||||
export * from './ElementHandle.js';
|
||||
export * from './EmulationManager.js';
|
||||
export * from './Errors.js';
|
||||
export * from './EventEmitter.js';
|
||||
export * from './ExecutionContext.js';
|
||||
export * from './fetch.js';
|
||||
export * from './FileChooser.js';
|
||||
export * from './FirefoxTargetManager.js';
|
||||
export * from './Frame.js';
|
||||
export * from './FrameManager.js';
|
||||
export * from './FrameTree.js';
|
||||
export * from './HTTPRequest.js';
|
||||
export * from './HTTPResponse.js';
|
||||
export * from './Input.js';
|
||||
export * from './IsolatedWorld.js';
|
||||
export * from './IsolatedWorlds.js';
|
||||
export * from './JSHandle.js';
|
||||
export * from './LazyArg.js';
|
||||
export * from './LifecycleWatcher.js';
|
||||
export * from './NetworkEventManager.js';
|
||||
export * from './NetworkManager.js';
|
||||
export * from './NodeWebSocketTransport.js';
|
||||
export * from './Page.js';
|
||||
export * from './PDFOptions.js';
|
||||
export * from './PredefinedNetworkConditions.js';
|
||||
export * from './Product.js';
|
||||
export * from './Puppeteer.js';
|
||||
export * from './PuppeteerViewport.js';
|
||||
export * from './SecurityDetails.js';
|
||||
export * from './Target.js';
|
||||
export * from './TargetManager.js';
|
||||
export * from './TaskQueue.js';
|
||||
export * from './TimeoutSettings.js';
|
||||
export * from './Tracing.js';
|
||||
export * from './types.js';
|
||||
export * from './USKeyboardLayout.js';
|
||||
export * from './util.js';
|
||||
export * from './WaitTask.js';
|
||||
export * from './WebWorker.js';
|
@ -279,12 +279,13 @@ export class PuppeteerNode extends Puppeteer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated If you are using `puppeteer-core`, do not use this method. Just
|
||||
* construct {@link BrowserFetcher} manually.
|
||||
*
|
||||
* @param options - Set of configurable options to specify the settings of the
|
||||
* BrowserFetcher.
|
||||
*
|
||||
* @remarks
|
||||
* If you are using `puppeteer-core`, do not use this method. Just
|
||||
* construct {@link BrowserFetcher} manually.
|
||||
*
|
||||
* @returns A new BrowserFetcher instance.
|
||||
*/
|
||||
createBrowserFetcher(
|
||||
|
24
packages/puppeteer-core/src/node/node.ts
Normal file
24
packages/puppeteer-core/src/node/node.ts
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
export * from './BrowserFetcher.js';
|
||||
export * from './BrowserRunner.js';
|
||||
export * from './ChromeLauncher.js';
|
||||
export * from './FirefoxLauncher.js';
|
||||
export * from './LaunchOptions.js';
|
||||
export * from './PipeTransport.js';
|
||||
export * from './ProductLauncher.js';
|
||||
export * from './PuppeteerNode.js';
|
@ -15,15 +15,17 @@
|
||||
*/
|
||||
|
||||
export {Protocol} from 'devtools-protocol';
|
||||
export * from './common/Device.js';
|
||||
export * from './common/Errors.js';
|
||||
export * from './common/PredefinedNetworkConditions.js';
|
||||
export * from './common/Puppeteer.js';
|
||||
|
||||
export * from './api/api.js';
|
||||
export * from './common/common.js';
|
||||
export * from './node/node.js';
|
||||
export * from './revisions.js';
|
||||
export * from './util/util.js';
|
||||
|
||||
/**
|
||||
* @deprecated Use the query handler API defined on {@link Puppeteer}
|
||||
*/
|
||||
export * from './common/QueryHandler.js';
|
||||
export * from './node/BrowserFetcher.js';
|
||||
|
||||
import {PuppeteerNode} from './node/PuppeteerNode.js';
|
||||
|
||||
@ -36,11 +38,6 @@ const puppeteer = new PuppeteerNode({
|
||||
|
||||
export const {
|
||||
connect,
|
||||
/**
|
||||
* @deprecated Construct {@link BrowserFetcher} manually.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
createBrowserFetcher,
|
||||
defaultArgs,
|
||||
executablePath,
|
||||
|
@ -1,75 +0,0 @@
|
||||
// AUTOGENERATED - Use `npm run generate:sources` to regenerate.
|
||||
|
||||
export * from './api/Browser.js';
|
||||
export * from './api/BrowserContext.js';
|
||||
export * from './api/Page.js';
|
||||
export * from './common/Accessibility.js';
|
||||
export * from './common/AriaQueryHandler.js';
|
||||
export * from './common/Browser.js';
|
||||
export * from './common/BrowserConnector.js';
|
||||
export * from './common/BrowserWebSocketTransport.js';
|
||||
export * from './common/ChromeTargetManager.js';
|
||||
export * from './common/Configuration.js';
|
||||
export * from './common/Connection.js';
|
||||
export * from './common/ConnectionTransport.js';
|
||||
export * from './common/ConsoleMessage.js';
|
||||
export * from './common/Coverage.js';
|
||||
export * from './common/Debug.js';
|
||||
export * from './common/Device.js';
|
||||
export * from './common/Dialog.js';
|
||||
export * from './common/ElementHandle.js';
|
||||
export * from './common/EmulationManager.js';
|
||||
export * from './common/Errors.js';
|
||||
export * from './common/EventEmitter.js';
|
||||
export * from './common/ExecutionContext.js';
|
||||
export * from './common/fetch.js';
|
||||
export * from './common/FileChooser.js';
|
||||
export * from './common/FirefoxTargetManager.js';
|
||||
export * from './common/Frame.js';
|
||||
export * from './common/FrameManager.js';
|
||||
export * from './common/FrameTree.js';
|
||||
export * from './common/HTTPRequest.js';
|
||||
export * from './common/HTTPResponse.js';
|
||||
export * from './common/Input.js';
|
||||
export * from './common/IsolatedWorld.js';
|
||||
export * from './common/JSHandle.js';
|
||||
export * from './common/LazyArg.js';
|
||||
export * from './common/LifecycleWatcher.js';
|
||||
export * from './common/NetworkEventManager.js';
|
||||
export * from './common/NetworkManager.js';
|
||||
export * from './common/NodeWebSocketTransport.js';
|
||||
export * from './common/Page.js';
|
||||
export * from './common/PDFOptions.js';
|
||||
export * from './common/PredefinedNetworkConditions.js';
|
||||
export * from './common/Product.js';
|
||||
export * from './common/Puppeteer.js';
|
||||
export * from './common/PuppeteerViewport.js';
|
||||
export * from './common/QueryHandler.js';
|
||||
export * from './common/SecurityDetails.js';
|
||||
export * from './common/Target.js';
|
||||
export * from './common/TargetManager.js';
|
||||
export * from './common/TaskQueue.js';
|
||||
export * from './common/TimeoutSettings.js';
|
||||
export * from './common/Tracing.js';
|
||||
export * from './common/types.js';
|
||||
export * from './common/USKeyboardLayout.js';
|
||||
export * from './common/util.js';
|
||||
export * from './common/WaitTask.js';
|
||||
export * from './common/WebWorker.js';
|
||||
export * from './environment.js';
|
||||
export * from './generated/injected.js';
|
||||
export * from './generated/version.js';
|
||||
export * from './node/BrowserFetcher.js';
|
||||
export * from './node/BrowserRunner.js';
|
||||
export * from './node/ChromeLauncher.js';
|
||||
export * from './node/FirefoxLauncher.js';
|
||||
export * from './node/LaunchOptions.js';
|
||||
export * from './node/PipeTransport.js';
|
||||
export * from './node/ProductLauncher.js';
|
||||
export * from './node/PuppeteerNode.js';
|
||||
export * from './puppeteer-core.js';
|
||||
export * from './revisions.js';
|
||||
export * from './util/assert.js';
|
||||
export * from './util/DebuggableDeferredPromise.js';
|
||||
export * from './util/DeferredPromise.js';
|
||||
export * from './util/ErrorLike.js';
|
20
packages/puppeteer-core/src/util/util.ts
Normal file
20
packages/puppeteer-core/src/util/util.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
export * from './assert.js';
|
||||
export * from './DebuggableDeferredPromise.js';
|
||||
export * from './DeferredPromise.js';
|
||||
export * from './ErrorLike.js';
|
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
import esbuild from 'esbuild';
|
||||
import {mkdir, mkdtemp, readFile, rm, writeFile} from 'fs/promises';
|
||||
import {sync as glob} from 'glob';
|
||||
import path, {join, resolve} from 'path';
|
||||
import {chdir} from 'process';
|
||||
import {job} from '../../../tools/internal/job.js';
|
||||
@ -9,8 +8,6 @@ import {job} from '../../../tools/internal/job.js';
|
||||
const packageRoot = resolve(join(__dirname, '..'));
|
||||
chdir(packageRoot);
|
||||
|
||||
const INCLUDED_FOLDERS = ['common', 'generated', 'node', 'util', 'api'];
|
||||
|
||||
(async () => {
|
||||
await job('', async ({outputs}) => {
|
||||
await Promise.all(
|
||||
@ -70,22 +67,6 @@ const INCLUDED_FOLDERS = ['common', 'generated', 'node', 'util', 'api'];
|
||||
|
||||
await Promise.all([versionJob, injectedJob]);
|
||||
|
||||
const sources = glob(
|
||||
`src/{@(${INCLUDED_FOLDERS.join('|')})/*.ts,!(types).ts}`
|
||||
);
|
||||
await job('', async ({outputs}) => {
|
||||
let types =
|
||||
'// AUTOGENERATED - Use `npm run generate:sources` to regenerate.\n\n';
|
||||
for (const input of sources.map(source => {
|
||||
return `.${source.slice(3)}`;
|
||||
})) {
|
||||
types += `export * from '${input.replace('.ts', '.js')}';\n`;
|
||||
}
|
||||
await writeFile(outputs[0]!, types);
|
||||
})
|
||||
.outputs(['src/types.ts'])
|
||||
.build();
|
||||
|
||||
if (process.env['PUBLISH']) {
|
||||
job('', async ({inputs}) => {
|
||||
const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||
"mainEntryPointFilePath": "<projectFolder>/lib/esm/puppeteer/types.d.ts",
|
||||
"mainEntryPointFilePath": "<projectFolder>/lib/esm/puppeteer/puppeteer.d.ts",
|
||||
"bundledPackages": ["puppeteer-core"],
|
||||
|
||||
"apiReport": {
|
||||
|
@ -60,18 +60,6 @@
|
||||
"generate:package-json"
|
||||
]
|
||||
},
|
||||
"generate:sources": {
|
||||
"command": "tsx tools/generate_sources.ts",
|
||||
"dependencies": [
|
||||
"../puppeteer-core:build"
|
||||
],
|
||||
"files": [
|
||||
"tools/generate_sources.ts"
|
||||
],
|
||||
"output": [
|
||||
"src/types.ts"
|
||||
]
|
||||
},
|
||||
"generate:package-json": {
|
||||
"command": "echo '{\"type\": \"module\"}' > lib/esm/package.json",
|
||||
"clean": "if-file-deleted",
|
||||
@ -114,8 +102,7 @@
|
||||
"command": "tsc -b",
|
||||
"clean": "if-file-deleted",
|
||||
"dependencies": [
|
||||
"../puppeteer-core:build",
|
||||
"generate:sources"
|
||||
"../puppeteer-core:build"
|
||||
],
|
||||
"files": [
|
||||
"src/**",
|
||||
|
@ -15,16 +15,8 @@
|
||||
*/
|
||||
|
||||
export {Protocol} from 'devtools-protocol';
|
||||
export * from 'puppeteer-core/internal/common/Device.js';
|
||||
export * from 'puppeteer-core/internal/common/Errors.js';
|
||||
export * from 'puppeteer-core/internal/common/PredefinedNetworkConditions.js';
|
||||
export * from 'puppeteer-core/internal/common/Puppeteer.js';
|
||||
/**
|
||||
* @deprecated Use the query handler API defined on {@link Puppeteer}
|
||||
*/
|
||||
export * from 'puppeteer-core/internal/common/QueryHandler.js';
|
||||
export * from 'puppeteer-core/internal/node/BrowserFetcher.js';
|
||||
export {LaunchOptions} from 'puppeteer-core/internal/node/LaunchOptions.js';
|
||||
|
||||
export * from 'puppeteer-core/internal/puppeteer-core.js';
|
||||
|
||||
import {PuppeteerNode} from 'puppeteer-core/internal/node/PuppeteerNode.js';
|
||||
import {getConfiguration} from './getConfiguration.js';
|
||||
|
@ -1,76 +0,0 @@
|
||||
// AUTOGENERATED - Use `npm run generate:sources` to regenerate.
|
||||
|
||||
export * from 'puppeteer-core/internal/api/Browser.js';
|
||||
export * from 'puppeteer-core/internal/api/BrowserContext.js';
|
||||
export * from 'puppeteer-core/internal/api/Page.js';
|
||||
export * from 'puppeteer-core/internal/common/Accessibility.js';
|
||||
export * from 'puppeteer-core/internal/common/AriaQueryHandler.js';
|
||||
export * from 'puppeteer-core/internal/common/Browser.js';
|
||||
export * from 'puppeteer-core/internal/common/BrowserConnector.js';
|
||||
export * from 'puppeteer-core/internal/common/BrowserWebSocketTransport.js';
|
||||
export * from 'puppeteer-core/internal/common/ChromeTargetManager.js';
|
||||
export * from 'puppeteer-core/internal/common/Configuration.js';
|
||||
export * from 'puppeteer-core/internal/common/Connection.js';
|
||||
export * from 'puppeteer-core/internal/common/ConnectionTransport.js';
|
||||
export * from 'puppeteer-core/internal/common/ConsoleMessage.js';
|
||||
export * from 'puppeteer-core/internal/common/Coverage.js';
|
||||
export * from 'puppeteer-core/internal/common/Debug.js';
|
||||
export * from 'puppeteer-core/internal/common/Device.js';
|
||||
export * from 'puppeteer-core/internal/common/Dialog.js';
|
||||
export * from 'puppeteer-core/internal/common/ElementHandle.js';
|
||||
export * from 'puppeteer-core/internal/common/EmulationManager.js';
|
||||
export * from 'puppeteer-core/internal/common/Errors.js';
|
||||
export * from 'puppeteer-core/internal/common/EventEmitter.js';
|
||||
export * from 'puppeteer-core/internal/common/ExecutionContext.js';
|
||||
export * from 'puppeteer-core/internal/common/fetch.js';
|
||||
export * from 'puppeteer-core/internal/common/FileChooser.js';
|
||||
export * from 'puppeteer-core/internal/common/FirefoxTargetManager.js';
|
||||
export * from 'puppeteer-core/internal/common/Frame.js';
|
||||
export * from 'puppeteer-core/internal/common/FrameManager.js';
|
||||
export * from 'puppeteer-core/internal/common/FrameTree.js';
|
||||
export * from 'puppeteer-core/internal/common/HTTPRequest.js';
|
||||
export * from 'puppeteer-core/internal/common/HTTPResponse.js';
|
||||
export * from 'puppeteer-core/internal/common/Input.js';
|
||||
export * from 'puppeteer-core/internal/common/IsolatedWorld.js';
|
||||
export * from 'puppeteer-core/internal/common/JSHandle.js';
|
||||
export * from 'puppeteer-core/internal/common/LazyArg.js';
|
||||
export * from 'puppeteer-core/internal/common/LifecycleWatcher.js';
|
||||
export * from 'puppeteer-core/internal/common/NetworkEventManager.js';
|
||||
export * from 'puppeteer-core/internal/common/NetworkManager.js';
|
||||
export * from 'puppeteer-core/internal/common/NodeWebSocketTransport.js';
|
||||
export * from 'puppeteer-core/internal/common/Page.js';
|
||||
export * from 'puppeteer-core/internal/common/PDFOptions.js';
|
||||
export * from 'puppeteer-core/internal/common/PredefinedNetworkConditions.js';
|
||||
export * from 'puppeteer-core/internal/common/Product.js';
|
||||
export * from 'puppeteer-core/internal/common/Puppeteer.js';
|
||||
export * from 'puppeteer-core/internal/common/PuppeteerViewport.js';
|
||||
export * from 'puppeteer-core/internal/common/QueryHandler.js';
|
||||
export * from 'puppeteer-core/internal/common/SecurityDetails.js';
|
||||
export * from 'puppeteer-core/internal/common/Target.js';
|
||||
export * from 'puppeteer-core/internal/common/TargetManager.js';
|
||||
export * from 'puppeteer-core/internal/common/TaskQueue.js';
|
||||
export * from 'puppeteer-core/internal/common/TimeoutSettings.js';
|
||||
export * from 'puppeteer-core/internal/common/Tracing.js';
|
||||
export * from 'puppeteer-core/internal/common/types.js';
|
||||
export * from 'puppeteer-core/internal/common/USKeyboardLayout.js';
|
||||
export * from 'puppeteer-core/internal/common/util.js';
|
||||
export * from 'puppeteer-core/internal/common/WaitTask.js';
|
||||
export * from 'puppeteer-core/internal/common/WebWorker.js';
|
||||
export * from 'puppeteer-core/internal/environment.js';
|
||||
export * from 'puppeteer-core/internal/generated/injected.js';
|
||||
export * from 'puppeteer-core/internal/generated/version.js';
|
||||
export * from 'puppeteer-core/internal/node/BrowserFetcher.js';
|
||||
export * from 'puppeteer-core/internal/node/BrowserRunner.js';
|
||||
export * from 'puppeteer-core/internal/node/ChromeLauncher.js';
|
||||
export * from 'puppeteer-core/internal/node/FirefoxLauncher.js';
|
||||
export * from 'puppeteer-core/internal/node/LaunchOptions.js';
|
||||
export * from 'puppeteer-core/internal/node/PipeTransport.js';
|
||||
export * from 'puppeteer-core/internal/node/ProductLauncher.js';
|
||||
export * from 'puppeteer-core/internal/node/PuppeteerNode.js';
|
||||
export * from 'puppeteer-core/internal/revisions.js';
|
||||
export * from 'puppeteer-core/internal/util/assert.js';
|
||||
export * from 'puppeteer-core/internal/util/DebuggableDeferredPromise.js';
|
||||
export * from 'puppeteer-core/internal/util/DeferredPromise.js';
|
||||
export * from 'puppeteer-core/internal/util/ErrorLike.js';
|
||||
export * from './getConfiguration.js';
|
||||
export * from './puppeteer.js';
|
@ -1,52 +0,0 @@
|
||||
/**
|
||||
* Copyright 2022 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 {readFile, writeFile} from 'fs/promises';
|
||||
import {sync as glob} from 'glob';
|
||||
import {join} from 'path';
|
||||
|
||||
const INCLUDED_FOLDERS = [];
|
||||
|
||||
const puppeteerTypes = join(__dirname, '..', 'src', 'types.ts');
|
||||
const puppeteerCoreTypes = join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'puppeteer-core',
|
||||
'src',
|
||||
'types.ts'
|
||||
);
|
||||
|
||||
(async () => {
|
||||
let content = await readFile(puppeteerCoreTypes, 'utf-8');
|
||||
content = content.replace(/\.\//g, 'puppeteer-core/internal/');
|
||||
content = content.replace(
|
||||
"export * from 'puppeteer-core/internal/puppeteer-core.js';\n",
|
||||
''
|
||||
);
|
||||
|
||||
const sources = glob(
|
||||
`src/{@(${INCLUDED_FOLDERS.join('|')})/*.ts,!(types).ts}`,
|
||||
{cwd: join(__dirname, '..')}
|
||||
);
|
||||
for (const input of sources.map(source => {
|
||||
return `.${source.slice(3)}`;
|
||||
})) {
|
||||
content += `export * from '${input.replace('.ts', '.js')}';\n`;
|
||||
}
|
||||
|
||||
await writeFile(puppeteerTypes, content);
|
||||
})();
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import expect from 'expect';
|
||||
import {PUPPETEER_WORLD} from 'puppeteer-core/internal/common/IsolatedWorld.js';
|
||||
import {PUPPETEER_WORLD} from 'puppeteer-core/internal/common/IsolatedWorlds.js';
|
||||
import {
|
||||
getTestState,
|
||||
setupTestBrowserHooks,
|
||||
|
Loading…
Reference in New Issue
Block a user