@push.rocks/smartpuppeteer 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.smartconfig.json CHANGED
@@ -20,12 +20,17 @@
20
20
  ]
21
21
  },
22
22
  "release": {
23
- "registries": [
24
- "https://verdaccio.lossless.digital",
25
- "https://registry.npmjs.org"
26
- ],
27
- "accessLevel": "public"
28
- }
23
+ "targets": {
24
+ "npm": {
25
+ "registries": [
26
+ "https://verdaccio.lossless.digital",
27
+ "https://registry.npmjs.org"
28
+ ],
29
+ "accessLevel": "public"
30
+ }
31
+ }
32
+ },
33
+ "schemaVersion": 2
29
34
  },
30
35
  "@git.zone/tsdoc": {
31
36
  "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartpuppeteer',
6
- version: '2.0.6',
6
+ version: '2.0.7',
7
7
  description: 'Provides simplified access to Puppeteer for automation and testing purposes.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSw0QkFBNEI7SUFDbEMsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLDhFQUE4RTtDQUM1RixDQUFBIn0=
@@ -3,4 +3,5 @@ export interface IEnvAwareOptions {
3
3
  forceNoSandbox?: boolean;
4
4
  usePipe?: boolean;
5
5
  }
6
+ export declare const resolveBrowserExecutablePath: (candidateNamesArg?: string[]) => string | undefined;
6
7
  export declare const getEnvAwareBrowserInstance: (optionsArg?: IEnvAwareOptions) => Promise<plugins.puppeteer.Browser>;
@@ -1,4 +1,19 @@
1
1
  import * as plugins from './smartpuppeteer.plugins.js';
2
+ export const resolveBrowserExecutablePath = (candidateNamesArg = [
3
+ 'google-chrome',
4
+ 'chromium',
5
+ 'chromium-browser',
6
+ ]) => {
7
+ for (const candidateName of candidateNamesArg) {
8
+ const executablePath = plugins.smartshell.which.sync(candidateName, {
9
+ nothrow: true,
10
+ });
11
+ if (executablePath) {
12
+ return executablePath;
13
+ }
14
+ }
15
+ return undefined;
16
+ };
2
17
  export const getEnvAwareBrowserInstance = async (optionsArg = {}) => {
3
18
  const options = {
4
19
  forceNoSandbox: false,
@@ -14,9 +29,7 @@ export const getEnvAwareBrowserInstance = async (optionsArg = {}) => {
14
29
  console.warn('********************************************************');
15
30
  }
16
31
  // Automatically choose an executable if available: prefer google-chrome, then chromium, then chromium-browser.
17
- const execPath = plugins.smartshell.which.sync('google-chrome') ||
18
- plugins.smartshell.which.sync('chromium') ||
19
- plugins.smartshell.which.sync('chromium-browser');
32
+ const execPath = resolveBrowserExecutablePath();
20
33
  const executablePathOptions = execPath ? { executablePath: execPath } : {};
21
34
  console.log('Launching puppeteer browser with arguments:');
22
35
  console.log(chromeArgs);
@@ -34,4 +47,4 @@ export const getEnvAwareBrowserInstance = async (optionsArg = {}) => {
34
47
  });
35
48
  return headlessBrowser;
36
49
  };
37
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRwdXBwZXRlZXIuY2xhc3Nlcy5zbWFydHB1cHBldGVlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0cHVwcGV0ZWVyLmNsYXNzZXMuc21hcnRwdXBwZXRlZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLE9BQU8sTUFBTSw2QkFBNkIsQ0FBQztBQU92RCxNQUFNLENBQUMsTUFBTSwwQkFBMEIsR0FBRyxLQUFLLEVBQzdDLGFBQStCLEVBQUUsRUFDRyxFQUFFO0lBQ3RDLE1BQU0sT0FBTyxHQUFxQjtRQUNoQyxjQUFjLEVBQUUsS0FBSztRQUNyQixHQUFHLFVBQVU7S0FDZCxDQUFDO0lBRUYsSUFBSSxVQUFVLEdBQWEsRUFBRSxDQUFDO0lBQzlCLElBQ0UsT0FBTyxDQUFDLEdBQUcsQ0FBQyxFQUFFO1FBQ2QsT0FBTyxDQUFDLGNBQWM7UUFDdEIsT0FBTyxDQUFDLEVBQUUsQ0FBQyxRQUFRLEVBQUUsQ0FBQyxRQUFRLEtBQUssTUFBTSxFQUN6QyxDQUFDO1FBQ0QsVUFBVSxHQUFHLFVBQVUsQ0FBQyxNQUFNLENBQUMsQ0FBQyxjQUFjLEVBQUUsMEJBQTBCLENBQUMsQ0FBQyxDQUFDO1FBQzdFLE9BQU8sQ0FBQyxJQUFJLENBQUMsMERBQTBELENBQUMsQ0FBQztRQUN6RSxPQUFPLENBQUMsSUFBSSxDQUFDLG1FQUFtRSxDQUFDLENBQUM7UUFDbEY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FJO1FBQzdCLFFBQVEsRUFBRSxJQUFJO1FBQ2QsR0FBRyxxQkFBcUI7S0FDekIsQ0FBQyxDQUFDO0lBRUgsT0FBTyxlQUFlLENBQUM7QUFDekIsQ0FBQyxDQUFDIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@push.rocks/smartpuppeteer",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "private": false,
5
5
  "description": "Provides simplified access to Puppeteer for automation and testing purposes.",
6
6
  "main": "dist_ts/index.js",
@@ -8,21 +8,15 @@
8
8
  "type": "module",
9
9
  "author": "Task Venture Capital GmbH <hello@task.vc>",
10
10
  "license": "MIT",
11
- "scripts": {
12
- "test": "tstest test/",
13
- "format": "gitzone format",
14
- "build": "tsbuild --web",
15
- "buildDocs": "tsdoc"
16
- },
17
11
  "devDependencies": {
18
- "@git.zone/tsbuild": "^4.4.0",
19
- "@git.zone/tsrun": "^2.0.3",
20
- "@git.zone/tstest": "^3.6.3",
21
- "@types/node": "^25.6.0"
12
+ "@git.zone/tsbuild": "^4.4.2",
13
+ "@git.zone/tsrun": "^2.0.5",
14
+ "@git.zone/tstest": "^3.6.7",
15
+ "@types/node": "^25.9.5"
22
16
  },
23
17
  "dependencies": {
24
18
  "@push.rocks/smartdelay": "^3.0.1",
25
- "@push.rocks/smartshell": "^3.3.8",
19
+ "@push.rocks/smartshell": "^3.5.0",
26
20
  "puppeteer": "^24.42.0",
27
21
  "tree-kill": "^1.2.2"
28
22
  },
@@ -56,5 +50,11 @@
56
50
  "repository": {
57
51
  "type": "git",
58
52
  "url": "https://code.foss.global/push.rocks/smartpuppeteer.git"
53
+ },
54
+ "scripts": {
55
+ "test": "tstest test/",
56
+ "format": "gitzone format",
57
+ "build": "tsbuild --web",
58
+ "buildDocs": "tsdoc"
59
59
  }
60
- }
60
+ }
package/readme.md CHANGED
@@ -1,17 +1,17 @@
1
1
  # @push.rocks/smartpuppeteer
2
- simplified access to puppeteer
3
2
 
4
- ## Install
5
- To install `@push.rocks/smartpuppeteer` in your project, run the following command using npm:
3
+ Simplified access to Puppeteer with environment-aware browser startup helpers.
6
4
 
7
- ```sh
8
- npm install @push.rocks/smartpuppeteer --save
9
- ```
5
+ ## Issue Reporting and Security
10
6
 
11
- Or using yarn:
7
+ For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
8
+
9
+ ## Install
10
+
11
+ Install `@push.rocks/smartpuppeteer` with pnpm:
12
12
 
13
13
  ```sh
14
- yarn add @push.rocks/smartpuppeteer
14
+ pnpm add @push.rocks/smartpuppeteer
15
15
  ```
16
16
 
17
17
  ## Usage
@@ -34,6 +34,19 @@ const initializeBrowser = async () => {
34
34
  };
35
35
  ```
36
36
 
37
+ `getEnvAwareBrowserInstance()` checks `google-chrome`, `chromium`, and `chromium-browser` in that order. Missing candidates are skipped safely. When none resolve, Puppeteer chooses its default executable.
38
+
39
+ Use `resolveBrowserExecutablePath()` directly when you need to inspect the selected executable or provide your own ordered candidate list:
40
+
41
+ ```typescript
42
+ import { resolveBrowserExecutablePath } from '@push.rocks/smartpuppeteer';
43
+
44
+ const executablePath: string | undefined = resolveBrowserExecutablePath([
45
+ 'chromium',
46
+ 'chromium-browser',
47
+ ]);
48
+ ```
49
+
37
50
  ### Opening a Page and Navigating
38
51
  After obtaining a browser instance, you commonly want to open a page and navigate to a URL:
39
52
 
@@ -115,19 +128,21 @@ incognitoBrowser.start()
115
128
 
116
129
  ## License and Legal Information
117
130
 
118
- This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
131
+ This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the repository license file.
119
132
 
120
133
  **Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
121
134
 
122
135
  ### Trademarks
123
136
 
124
- This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
137
+ This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
138
+
139
+ Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
125
140
 
126
141
  ### Company Information
127
142
 
128
- Task Venture Capital GmbH
129
- Registered at District court Bremen HRB 35230 HB, Germany
143
+ Task Venture Capital GmbH<br>
144
+ Registered at District Court Bremen HRB 35230 HB, Germany
130
145
 
131
- For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
146
+ For any legal inquiries or further information, please contact us via email at hello@task.vc.
132
147
 
133
148
  By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartpuppeteer',
6
- version: '2.0.6',
6
+ version: '2.0.7',
7
7
  description: 'Provides simplified access to Puppeteer for automation and testing purposes.'
8
8
  }
@@ -5,6 +5,24 @@ export interface IEnvAwareOptions {
5
5
  usePipe?: boolean;
6
6
  }
7
7
 
8
+ export const resolveBrowserExecutablePath = (
9
+ candidateNamesArg: string[] = [
10
+ 'google-chrome',
11
+ 'chromium',
12
+ 'chromium-browser',
13
+ ],
14
+ ): string | undefined => {
15
+ for (const candidateName of candidateNamesArg) {
16
+ const executablePath = plugins.smartshell.which.sync(candidateName, {
17
+ nothrow: true,
18
+ });
19
+ if (executablePath) {
20
+ return executablePath;
21
+ }
22
+ }
23
+ return undefined;
24
+ };
25
+
8
26
  export const getEnvAwareBrowserInstance = async (
9
27
  optionsArg: IEnvAwareOptions = {}
10
28
  ): Promise<plugins.puppeteer.Browser> => {
@@ -26,10 +44,7 @@ export const getEnvAwareBrowserInstance = async (
26
44
  }
27
45
 
28
46
  // Automatically choose an executable if available: prefer google-chrome, then chromium, then chromium-browser.
29
- const execPath =
30
- plugins.smartshell.which.sync('google-chrome') ||
31
- plugins.smartshell.which.sync('chromium') ||
32
- plugins.smartshell.which.sync('chromium-browser');
47
+ const execPath = resolveBrowserExecutablePath();
33
48
 
34
49
  const executablePathOptions = execPath ? { executablePath: execPath } : {};
35
50