@sparticuz/chromium
Advanced tools
Comparing version 123.0.0 to 123.0.1
@@ -45,2 +45,14 @@ "use strict"; | ||
/** | ||
* Determines the headless mode that chromium will run at | ||
* https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless | ||
* @values true or "new" | ||
*/ | ||
static headlessMode = "shell"; | ||
/** | ||
* If true, the graphics stack and webgl is enabled, | ||
* If false, webgl will be disabled. | ||
* (If false, the swiftshader.tar.br file will also not extract) | ||
*/ | ||
static graphicsMode = true; | ||
/** | ||
* Downloads or symlinks a custom font and returns its basename, patching the environment so that Chromium can find it. | ||
@@ -170,5 +182,7 @@ */ | ||
// https://chromium.googlesource.com/chromium/src/+/main/docs/gpu/swiftshader.md | ||
this.graphics | ||
? graphicsFlags.push("--use-gl=angle", "--use-angle=swiftshader") | ||
: graphicsFlags.push("--disable-webgl"); | ||
// Blocked by https://github.com/Sparticuz/chromium/issues/247 | ||
//this.graphics | ||
// ? graphicsFlags.push("--use-gl=angle", "--use-angle=swiftshader") | ||
// : graphicsFlags.push("--disable-webgl"); | ||
graphicsFlags.push("--use-gl=angle", "--use-angle=swiftshader"); | ||
const insecureFlags = [ | ||
@@ -312,14 +326,2 @@ "--allow-running-insecure-content", // https://source.chromium.org/search?q=lang:cpp+symbol:kAllowRunningInsecureContent&ss=chromium | ||
} | ||
/** | ||
* Determines the headless mode that chromium will run at | ||
* https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless | ||
* @values true or "new" | ||
*/ | ||
Chromium.headlessMode = "shell"; | ||
/** | ||
* If true, the graphics stack and webgl is enabled, | ||
* If false, webgl will be disabled. | ||
* (If false, the swiftshader.tar.br file will also not extract) | ||
*/ | ||
Chromium.graphicsMode = true; | ||
module.exports = Chromium; |
@@ -9,2 +9,2 @@ declare class LambdaFS { | ||
} | ||
export = LambdaFS; | ||
export default LambdaFS; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const node_fs_1 = require("node:fs"); | ||
@@ -61,2 +62,2 @@ const node_os_1 = require("node:os"); | ||
} | ||
module.exports = LambdaFS; | ||
exports.default = LambdaFS; |
{ | ||
"name": "@sparticuz/chromium", | ||
"version": "123.0.0", | ||
"version": "123.0.1", | ||
"description": "Chromium Binary for Serverless Platforms", | ||
@@ -43,9 +43,9 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tsconfig/node16": "^16.1.1", | ||
"@tsconfig/strictest": "^2.0.3", | ||
"@tsconfig/node20": "^20.1.4", | ||
"@tsconfig/strictest": "^2.0.5", | ||
"@types/follow-redirects": "^1.14.4", | ||
"@types/node": "^20.11.30", | ||
"@types/node": "^20.12.3", | ||
"@types/tar-fs": "^2.0.4", | ||
"clean-modules": "^3.0.5", | ||
"typescript": "^5.4.2" | ||
"typescript": "^5.4.3" | ||
}, | ||
@@ -52,0 +52,0 @@ "engines": { |
@@ -207,2 +207,46 @@ # @sparticuz/chromium | ||
### I'm experiencing timeouts or failures closing Chromium | ||
This is a common issue. Chromium sometimes opens up more pages than you ask for. You can try the following | ||
```typescript | ||
for (const page of await browser.pages()) { | ||
await page.close(); | ||
} | ||
await browser.close(); | ||
``` | ||
You can also try the following if one of the calls is hanging for some reason. | ||
```typescript | ||
await Promise.race([browser.close(), browser.close(), browser.close()]); | ||
``` | ||
Always `await browser.close()`, even if your script is returning an error. | ||
### I need Accessible pdf files | ||
This is due to the way @sparticuz/chromium is built. If you require accessible pdf's, you'll need to | ||
recompile chromium yourself with the following patch. You can then use that binary with @sparticuz/chromium-min. | ||
_Note_: This will increase the time required to generate a PDF. | ||
```patch | ||
diff --git a/_/ansible/plays/chromium.yml b/_/ansible/plays/chromium.yml | ||
index b42c740..49111d7 100644 | ||
--- a/_/ansible/plays/chromium.yml | ||
+++ b/_/ansible/plays/chromium.yml | ||
@@ -249,8 +249,9 @@ | ||
blink_symbol_level = 0 | ||
dcheck_always_on = false | ||
disable_histogram_support = false | ||
- enable_basic_print_dialog = false | ||
enable_basic_printing = true | ||
+ enable_pdf = true | ||
+ enable_tagged_pdf = true | ||
enable_keystone_registration_framework = false | ||
enable_linux_installer = false | ||
enable_media_remoting = false | ||
``` | ||
## Fonts | ||
@@ -264,4 +308,4 @@ | ||
| `executablePath(location?: string)` | `Promise<string>` | Returns the path the Chromium binary was extracted to. | | ||
| `setHeadlessMode` | `void` | Sets the headless mode to either `true` or `"shell"` | | ||
| `headless` | `true \| "shell"` | Returns `true` or `"shell"` depending on what version of chrome's headless you are running | | ||
| `setHeadlessMode` | `void` | Sets the headless mode to either `true` or `"shell"` | | ||
| `headless` | `true \| "shell"` | Returns `true` or `"shell"` depending on what version of chrome's headless you are running | | ||
| `setGraphicsMode` | `void` | Sets the graphics mode to either `true` or `false` | | ||
@@ -268,0 +312,0 @@ | `graphics` | `boolean` | Returns a boolean depending on whether webgl is enabled or disabled | |
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
63704181
568
424