Package Exports
- @selfage/puppeteer_executor_api
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@selfage/puppeteer_executor_api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@selfage/puppeteer_executor_api
Install
npm install @selfage/puppeteer_executor_api
Overview
Written in TypeScript and compiled to ES6 with inline source map & source. See @selfage/tsconfig for full compiler options. Provides Puppeteer executor environment API declarations.
Access argv
Pass-through arguments can be accessed in your executable TS/JS file via a global argv variable which is an array of strings similar to Nodejs's process.argv except no Node path and JS file name.
import '@selfage/puppeteer_executor_api'; // import for side effect which declares argv as a global variable.
// argv = ['-a', '10'] with `$ bundage prun my_file -- -a 10`
// You can use some popular tools to parse arguments.
parseArg(argv);
// or parseArg(globalThis.argv);All APIs
Below is a file of apis.ts which declares all APIs.
declare var argv: Array<string>;
declare function exit(): void;
declare function screenshot(
relativePath: string,
options: { delay?: number; fullPage?: boolean; quality?: number }
): Promise<string>;
declare function fileExists(relativePath: string): Promise<void>;
declare function readFile(relativePath: string): Promise<string>;
declare function deleteFile(relativePath: string): Promise<void>;
declare function setViewport(width: number, height: number): Promise<void>;They should be self-explanatory. You can find a working example in @selfage/test_runner.