Compare commits
127 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
cd113882ea | |
|
|
f664837067 | |
|
|
1dbbfc7ac4 | |
|
|
dfd47f4102 | |
|
|
540387d11a | |
|
|
a64b8612f6 | |
|
|
c031905fbf | |
|
|
517b6c43a4 | |
|
|
f9f32ca64c | |
|
|
2f7267da42 | |
|
|
b580ec7aae | |
|
|
58613272ad | |
|
|
8028819dfe | |
|
|
995bc5a604 | |
|
|
c51ae58407 | |
|
|
2c715c4e97 | |
|
|
2bcd54a6c8 | |
|
|
bd9c5e9014 | |
|
|
3e6aa79fb8 | |
|
|
d0543e6139 | |
|
|
41223a10e9 | |
|
|
e4de013045 | |
|
|
4ce60bdd4d | |
|
|
0f12e5f2d7 | |
|
|
94b8687686 | |
|
|
bb952358a2 | |
|
|
2c5dabf81b | |
|
|
c0b12ce7be | |
|
|
ce553320d8 | |
|
|
c640690f16 | |
|
|
8efe5f9145 | |
|
|
aaa9fa63d0 | |
|
|
800c97f871 | |
|
|
1da7ed4b19 | |
|
|
918c7ffe9e | |
|
|
01c4850279 | |
|
|
9a6247d0e3 | |
|
|
da5037292d | |
|
|
8206092f26 | |
|
|
81f83bbd65 | |
|
|
986fca4ff3 | |
|
|
6e07eb0d63 | |
|
|
857ae08500 | |
|
|
424f3e9058 | |
|
|
85db6ca4e2 | |
|
|
0f93a89596 | |
|
|
68f6d4858f | |
|
|
590f35ee6e | |
|
|
24fa1a2210 | |
|
|
30743fd482 | |
|
|
29004cbb13 | |
|
|
b5766d628b | |
|
|
031b2d8bc4 | |
|
|
247f748834 | |
|
|
849e769e78 | |
|
|
a93aa49c50 | |
|
|
05d4445708 | |
|
|
2f52e9a534 | |
|
|
7cfd79de38 | |
|
|
e5334713e3 | |
|
|
6dba931a9a | |
|
|
80cf8e79ce | |
|
|
62b5d05260 | |
|
|
5597e45f59 | |
|
|
2b5ff55015 | |
|
|
f52f2c825c | |
|
|
3f02dfe58e | |
|
|
cdf28b5a76 | |
|
|
49c1b7671c | |
|
|
ec5856facc | |
|
|
2578196d06 | |
|
|
dc23b5d6ed | |
|
|
fc6b69d653 | |
|
|
c683d75545 | |
|
|
6fe1820833 | |
|
|
1b84efe984 | |
|
|
28b086cee9 | |
|
|
b6817b6bac | |
|
|
b8a1c5f2c0 | |
|
|
d63a8efc0d | |
|
|
ad676965b2 | |
|
|
438c79c490 | |
|
|
46b552d4a3 | |
|
|
057856d4af | |
|
|
4f485287b4 | |
|
|
8fdbb07701 | |
|
|
4f8549ce5b | |
|
|
1c43eae4d7 | |
|
|
bcdd0e5ad0 | |
|
|
e77f679a6b | |
|
|
8a39891caa | |
|
|
339cbe0e19 | |
|
|
18c8adb646 | |
|
|
b91a150173 | |
|
|
693a7f4abd | |
|
|
3a22d405ce | |
|
|
9b25726538 | |
|
|
edd4995bdf | |
|
|
cf7443fedc | |
|
|
0e04dd710c | |
|
|
8b63fb075d | |
|
|
6d190e5ebb | |
|
|
29c2468ccf | |
|
|
506d4c2cd7 | |
|
|
a6e6e8dfad | |
|
|
5042a820c1 | |
|
|
161d9efbf5 | |
|
|
67e1c394a5 | |
|
|
1c2e225f14 | |
|
|
93954a5217 | |
|
|
60971353a8 | |
|
|
8ec8c6edbe | |
|
|
a3999e7b35 | |
|
|
27ba2eeaf9 | |
|
|
11d63b6be6 | |
|
|
9626bb09d9 | |
|
|
6fc18b6935 | |
|
|
aeee592507 | |
|
|
9f0ae64364 | |
|
|
2f57d09fe6 | |
|
|
74283507ac | |
|
|
657597064f | |
|
|
07b12068f8 | |
|
|
b8a406a793 | |
|
|
b21fdacfc3 | |
|
|
3b51330eeb | |
|
|
7c333430bd |
|
|
@ -12,12 +12,12 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version: 20.x
|
||||||
|
|
||||||
- name: Install Packages
|
- name: Install Packages
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
@ -29,7 +29,7 @@ jobs:
|
||||||
run: make chromium.zip
|
run: make chromium.zip
|
||||||
|
|
||||||
- name: Upload Layer Artifact
|
- name: Upload Layer Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: chromium
|
name: chromium
|
||||||
path: chromium.zip
|
path: chromium.zip
|
||||||
|
|
@ -45,20 +45,21 @@ jobs:
|
||||||
version:
|
version:
|
||||||
- 16
|
- 16
|
||||||
- 18
|
- 18
|
||||||
|
- 20
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: "3.x"
|
||||||
|
|
||||||
- name: Setup AWS SAM CLI
|
- name: Setup AWS SAM CLI
|
||||||
uses: aws-actions/setup-sam@v2
|
uses: aws-actions/setup-sam@v2
|
||||||
|
|
||||||
- name: Download Layer Artifact
|
- name: Download Layer Artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: chromium
|
name: chromium
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,15 @@ jobs:
|
||||||
name: Build and release
|
name: Build and release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
# Install jq so I can edit package.json from the command line
|
# Install jq so I can edit package.json from the command line
|
||||||
- run: sudo apt-get install jq -y
|
- run: sudo apt-get install jq -y
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version: 20.x
|
||||||
registry-url: https://registry.npmjs.org/
|
registry-url: https://registry.npmjs.org/
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
|
@ -59,7 +58,7 @@ jobs:
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
- name: Upload items to Github Release
|
- name: Upload items to Github Release
|
||||||
uses: ncipollo/release-action@v1.12.0
|
uses: ncipollo/release-action@v1.14.0
|
||||||
with:
|
with:
|
||||||
tag: ${{ github.ref_name }}
|
tag: ${{ github.ref_name }}
|
||||||
body: |
|
body: |
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,4 @@ _/amazon/.aws-sam
|
||||||
*.tgz
|
*.tgz
|
||||||
examples/**/package-lock.json
|
examples/**/package-lock.json
|
||||||
examples/**/.serverless
|
examples/**/.serverless
|
||||||
|
docker
|
||||||
|
|
|
||||||
13
Makefile
13
Makefile
|
|
@ -8,20 +8,23 @@ pretest:
|
||||||
npm install --prefix _/amazon/handlers puppeteer-core@latest --bin-links=false --fund=false --omit=optional --omit=dev --package-lock=false --save=false
|
npm install --prefix _/amazon/handlers puppeteer-core@latest --bin-links=false --fund=false --omit=optional --omit=dev --package-lock=false --save=false
|
||||||
|
|
||||||
test:
|
test:
|
||||||
sam local invoke --template _/amazon/template.yml --event _/amazon/events/example.com.json node18
|
sam local invoke --template _/amazon/template.yml --event _/amazon/events/example.com.json node20
|
||||||
|
|
||||||
.fonts.zip:
|
test16:
|
||||||
zip -9 --filesync --move --recurse-paths .fonts.zip .fonts/
|
sam local invoke --template _/amazon/template.yml --event _/amazon/events/example.com.json node16
|
||||||
|
|
||||||
|
test18:
|
||||||
|
sam local invoke --template _/amazon/template.yml --event _/amazon/events/example.com.json node18
|
||||||
|
|
||||||
%.zip:
|
%.zip:
|
||||||
npm install --fund=false --package-lock=false
|
npm install --fund=false --package-lock=false
|
||||||
npm run build
|
npm run build
|
||||||
mkdir -p nodejs
|
mkdir -p nodejs
|
||||||
npm install --prefix nodejs/ tar-fs@2.1.1 follow-redirects@1.15.2 --bin-links=false --fund=false --omit=optional --omit=dev --package-lock=false --save=false
|
npm install --prefix nodejs/ tar-fs@3.0.6 follow-redirects@1.15.9 --bin-links=false --fund=false --omit=optional --omit=dev --package-lock=false --save=false
|
||||||
npm pack
|
npm pack
|
||||||
mkdir -p nodejs/node_modules/@sparticuz/chromium/
|
mkdir -p nodejs/node_modules/@sparticuz/chromium/
|
||||||
tar --directory nodejs/node_modules/@sparticuz/chromium/ --extract --file sparticuz-chromium-*.tgz --strip-components=1
|
tar --directory nodejs/node_modules/@sparticuz/chromium/ --extract --file sparticuz-chromium-*.tgz --strip-components=1
|
||||||
npx clean-modules --directory nodejs --include "**/*.d.ts" "**/@types/**" "**/*.@(yaml|yml)" --yes
|
npx clean-modules --directory nodejs "**/*.d.ts" "**/@types/**" "**/*.@(yaml|yml)" --yes
|
||||||
rm sparticuz-chromium-*.tgz
|
rm sparticuz-chromium-*.tgz
|
||||||
mkdir -p $(dir $@)
|
mkdir -p $(dir $@)
|
||||||
zip -9 --filesync --move --recurse-paths $@ nodejs
|
zip -9 --filesync --move --recurse-paths $@ nodejs
|
||||||
|
|
|
||||||
86
README.md
86
README.md
|
|
@ -15,7 +15,7 @@ However, it quickly became difficult to maintain because of the pace of `puppete
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
[`puppeteer` ships with a prefered version of `chromium`](https://pptr.dev/faq/#q-why-doesnt-puppeteer-vxxx-work-with-chromium-vyyy). In order to figure out what version of `@sparticuz/chromium` you will need, please visit [Puppeteer's Chromium Support page](https://pptr.dev/chromium-support).
|
[`puppeteer` ships with a preferred version of `chromium`](https://pptr.dev/faq/#q-why-doesnt-puppeteer-vxxx-work-with-chromium-vyyy). In order to figure out what version of `@sparticuz/chromium` you will need, please visit [Puppeteer's Chromium Support page](https://pptr.dev/chromium-support).
|
||||||
|
|
||||||
> For example, as of today, the latest version of `puppeteer` is `18.0.5`. The latest version of `chromium` stated on `puppeteer`'s support page is `106.0.5249.0`. So you need to install `@sparticuz/chromium@106`.
|
> For example, as of today, the latest version of `puppeteer` is `18.0.5`. The latest version of `chromium` stated on `puppeteer`'s support page is `106.0.5249.0`. So you need to install `@sparticuz/chromium@106`.
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ npm install --save puppeteer-core@$PUPPETEER_VERSION
|
||||||
npm install --save-dev @sparticuz/chromium@$CHROMIUM_VERSION
|
npm install --save-dev @sparticuz/chromium@$CHROMIUM_VERSION
|
||||||
```
|
```
|
||||||
|
|
||||||
If your vendor does not allow large deploys (`chromium.br` is 50+ MB), you'll need to host the `chromium-v#-pack.tar` separatly and use the [`@sparticuz/chromium-min` package](https://github.com/Sparticuz/chromium#-min-package).
|
If your vendor does not allow large deploys (`chromium.br` is 50+ MB), you'll need to host the `chromium-v#-pack.tar` separately and use the [`@sparticuz/chromium-min` package](https://github.com/Sparticuz/chromium#-min-package).
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
npm install --save @sparticuz/chromium-min@$CHROMIUM_VERSION
|
npm install --save @sparticuz/chromium-min@$CHROMIUM_VERSION
|
||||||
|
|
@ -39,7 +39,7 @@ If you wish to install an older version of Chromium, take a look at [@sparticuz/
|
||||||
The @sparticuz/chromium version schema is as follows:
|
The @sparticuz/chromium version schema is as follows:
|
||||||
`MajorChromiumVersion.MinorChromiumIncrement.@Sparticuz/chromiumPatchLevel`
|
`MajorChromiumVersion.MinorChromiumIncrement.@Sparticuz/chromiumPatchLevel`
|
||||||
|
|
||||||
Beacuse this package follows Chromium's releases, it does NOT follow semantic versioning. **Breaking changes can occur with the 'patch' level.** Please check the release notes for information on breaking changes.
|
Because this package follows Chromium's releases, it does NOT follow semantic versioning. **Breaking changes can occur with the 'patch' level.** Please check the release notes for information on breaking changes.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|
@ -50,7 +50,9 @@ const test = require("node:test");
|
||||||
const puppeteer = require("puppeteer-core");
|
const puppeteer = require("puppeteer-core");
|
||||||
const chromium = require("@sparticuz/chromium");
|
const chromium = require("@sparticuz/chromium");
|
||||||
|
|
||||||
// Optional: If you'd like to use the legacy headless mode. "new" is the default.
|
// Optional: If you'd like to use the new headless mode. "shell" is the default.
|
||||||
|
// NOTE: Because we build the shell binary, this option does not work.
|
||||||
|
// However, this option will stay so when we migrate to full chromium it will work.
|
||||||
chromium.setHeadlessMode = true;
|
chromium.setHeadlessMode = true;
|
||||||
|
|
||||||
// Optional: If you'd like to disable webgl, true is the default.
|
// Optional: If you'd like to disable webgl, true is the default.
|
||||||
|
|
@ -157,13 +159,13 @@ Here are some example projects and help with other services
|
||||||
- [Serverless Framework with Lambda Layer](https://github.com/Sparticuz/chromium/tree/master/examples/serverless-with-lambda-layer)
|
- [Serverless Framework with Lambda Layer](https://github.com/Sparticuz/chromium/tree/master/examples/serverless-with-lambda-layer)
|
||||||
- [Serverless Framework with Pre-existing Lambda Layer](https://github.com/Sparticuz/chromium/tree/master/examples/serverless-with-preexisting-lambda-layer)
|
- [Serverless Framework with Pre-existing Lambda Layer](https://github.com/Sparticuz/chromium/tree/master/examples/serverless-with-preexisting-lambda-layer)
|
||||||
- [Chromium-min](https://github.com/Sparticuz/chromium/tree/master/examples/remote-min-binary)
|
- [Chromium-min](https://github.com/Sparticuz/chromium/tree/master/examples/remote-min-binary)
|
||||||
- AWS SAM _TODO_
|
- [AWS SAM](https://github.com/Sparticuz/chromium/tree/master/examples/aws-sam)
|
||||||
- [Webpack](https://github.com/Sparticuz/chromium/issues/24#issuecomment-1343196897)
|
- [Webpack](https://github.com/Sparticuz/chromium/issues/24#issuecomment-1343196897)
|
||||||
- [Netlify](https://github.com/Sparticuz/chromium/issues/24#issuecomment-1414107620)
|
- [Netlify](https://github.com/Sparticuz/chromium/issues/24#issuecomment-1414107620)
|
||||||
|
|
||||||
### Running Locally & Headless/Headful mode
|
### Running Locally & Headless/Headful mode
|
||||||
|
|
||||||
This version of `chromium` is built using the `headless.gn` build variables, which does not appear to even include a GUI. [Also, at this point, AWS Lambda 2 does not support a modern version of `glibc`](https://github.com/aws/aws-lambda-base-images/issues/59), so this package does not include an ARM version yet, which means it will not work on any M Series Apple products. If you need to test your code using a headful or ARM version, please use your locally installed version of `chromium/chrome`, or you may use the `puppeteer` provided version.
|
This version of `chromium` is built using the `headless.gn` build variables, which does not appear to even include a GUI. [Also, at this point, AWS Lambda 2 does not support a modern version of `glibc`](https://github.com/aws/aws-lambda-base-images/issues/59), so this package does not include an ARM version yet, which means it will not work on any M Series Apple products. If you need to test your code using a headful or ARM version, please use your locally installed version of `chromium/chrome`, or you may use the `puppeteer` provided version. Users have reported installing `rosetta` on MacOS will also work.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
npx @puppeteer/browsers install chromium@latest --path /tmp/localChromium
|
npx @puppeteer/browsers install chromium@latest --path /tmp/localChromium
|
||||||
|
|
@ -171,7 +173,7 @@ npx @puppeteer/browsers install chromium@latest --path /tmp/localChromium
|
||||||
|
|
||||||
For more information on installing a specific version of `chromium`, checkout [@puppeteer/browsers](https://www.npmjs.com/package/@puppeteer/browsers).
|
For more information on installing a specific version of `chromium`, checkout [@puppeteer/browsers](https://www.npmjs.com/package/@puppeteer/browsers).
|
||||||
|
|
||||||
For example, you can set your code to use an ENV variable such as `IS_LOCAL`, then use if/else statments to direct puppeteer to the correct environment.
|
For example, you can set your code to use an ENV variable such as `IS_LOCAL`, then use if/else statements to direct puppeteer to the correct environment.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
|
|
@ -184,6 +186,68 @@ const browser = await puppeteer.launch({
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Frequently asked questions
|
||||||
|
|
||||||
|
### Can I use ARM or Graviton instances?
|
||||||
|
|
||||||
|
Amazon's default Lambda base image is quite old at this point and does not support newer versions of `glibc` that chromium requires. When Amazon Linux 2023 comes to Lambda as the default base image, ARM support should be possible. Ref: https://github.com/Sparticuz/chrome-aws-lambda/pull/11, https://github.com/aws/aws-lambda-base-images/issues/59
|
||||||
|
|
||||||
|
### Can I use Google Chrome or Chrome for Testing, what is headless_shell?
|
||||||
|
|
||||||
|
`headless_shell` is a purpose built version of `chromium` specific for headless purposes. It does not include the GUI at all and only works via remote debugging connection. Ref: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md, https://source.chromium.org/chromium/chromium/src/+/main:headless/app/headless_shell.cc
|
||||||
|
|
||||||
|
### Can I use the "new" Headless mode?
|
||||||
|
|
||||||
|
From what I can tell, `headless_shell` does not seem to include support for the "new" headless mode.
|
||||||
|
|
||||||
|
### It doesn't work with Webpack!?!
|
||||||
|
|
||||||
|
Try marking this package as an external. Ref: https://webpack.js.org/configuration/externals/
|
||||||
|
|
||||||
|
### 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
|
## Fonts
|
||||||
|
|
||||||
The Amazon Linux 2 AWS Lambda runtime is not provisioned with any font faces.
|
The Amazon Linux 2 AWS Lambda runtime is not provisioned with any font faces.
|
||||||
|
|
@ -214,7 +278,7 @@ This method should be invoked _before_ launching Chromium.
|
||||||
|
|
||||||
Alternatively, it's also possible to provision fonts via AWS Lambda Layers.
|
Alternatively, it's also possible to provision fonts via AWS Lambda Layers.
|
||||||
|
|
||||||
Simply create a directory named `.fonts` and place any font faces you want there:
|
Simply create a directory named `.fonts` or `fonts` and place any font faces you want there:
|
||||||
|
|
||||||
```
|
```
|
||||||
.fonts
|
.fonts
|
||||||
|
|
@ -225,7 +289,7 @@ Simply create a directory named `.fonts` and place any font faces you want there
|
||||||
Afterwards, you just need to ZIP the directory and upload it as a AWS Lambda Layer:
|
Afterwards, you just need to ZIP the directory and upload it as a AWS Lambda Layer:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
zip -9 --filesync --move --recurse-paths .fonts.zip .fonts/
|
zip -9 --filesync --move --recurse-paths fonts.zip fonts/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Graphics
|
## Graphics
|
||||||
|
|
@ -240,8 +304,8 @@ By default, this package uses `swiftshader`/`angle` to do CPU acceleration for W
|
||||||
| `args` | `Array<string>` | Provides a list of recommended additional [Chromium flags](https://github.com/GoogleChrome/chrome-launcher/blob/master/docs/chrome-flags-for-tools.md). |
|
| `args` | `Array<string>` | Provides a list of recommended additional [Chromium flags](https://github.com/GoogleChrome/chrome-launcher/blob/master/docs/chrome-flags-for-tools.md). |
|
||||||
| `defaultViewport` | `Object` | Returns a sensible default viewport for serverless. |
|
| `defaultViewport` | `Object` | Returns a sensible default viewport for serverless. |
|
||||||
| `executablePath(location?: string)` | `Promise<string>` | Returns the path the Chromium binary was extracted to. |
|
| `executablePath(location?: string)` | `Promise<string>` | Returns the path the Chromium binary was extracted to. |
|
||||||
| `setHeadlessMode` | `void` | Sets the headless mode to either `true` or `"new"` |
|
| `setHeadlessMode` | `void` | Sets the headless mode to either `true` or `"shell"` |
|
||||||
| `headless` | `true \| "new"` | Returns `true` or `"new"` depending on what version of chrome's headless you are running |
|
| `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` |
|
| `setGraphicsMode` | `void` | Sets the graphics mode to either `true` or `false` |
|
||||||
| `graphics` | `boolean` | Returns a boolean depending on whether webgl is enabled or disabled |
|
| `graphics` | `boolean` | Returns a boolean depending on whether webgl is enabled or disabled |
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,21 +3,14 @@
|
||||||
"url": "https://example.com",
|
"url": "https://example.com",
|
||||||
"expected": {
|
"expected": {
|
||||||
"title": "Example Domain",
|
"title": "Example Domain",
|
||||||
"screenshot": "fdd55bf210cb00e00cadf3098055611d11293d02"
|
"screenshot": "e610a8be5568f23c453b08928460aae3ae0b4b0a"
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://example.com",
|
|
||||||
"expected": {
|
|
||||||
"title": "Example Domain",
|
|
||||||
"screenshot": "fdd55bf210cb00e00cadf3098055611d11293d02"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "https://get.webgl.org",
|
"url": "https://get.webgl.org",
|
||||||
"expected": {
|
"expected": {
|
||||||
"remove": "logo-container",
|
"remove": "logo-container",
|
||||||
"screenshot": "7a63a9a18f32dcdad78e1e0a03364fade25c85a8"
|
"screenshot": "ec6c79a571b4cb5727c6fc23f9da30de3868138c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const { ok } = require('assert');
|
const { ok } = require("node:assert");
|
||||||
const { createHash } = require('crypto');
|
const { createHash } = require("node:crypto");
|
||||||
const puppeteer = require("puppeteer-core");
|
const puppeteer = require("puppeteer-core");
|
||||||
const chromium = require('@sparticuz/chromium');
|
const chromium = require("@sparticuz/chromium");
|
||||||
|
|
||||||
exports.handler = async (event, context) => {
|
exports.handler = async (event, context) => {
|
||||||
let browser = null;
|
let browser = null;
|
||||||
|
|
@ -10,40 +10,49 @@ exports.handler = async (event, context) => {
|
||||||
browser = await puppeteer.launch({
|
browser = await puppeteer.launch({
|
||||||
args: chromium.args,
|
args: chromium.args,
|
||||||
defaultViewport: chromium.defaultViewport,
|
defaultViewport: chromium.defaultViewport,
|
||||||
|
dumpio: true,
|
||||||
executablePath: await chromium.executablePath(),
|
executablePath: await chromium.executablePath(),
|
||||||
headless: chromium.headless,
|
headless: chromium.headless,
|
||||||
ignoreHTTPSErrors: true,
|
acceptInsecureCerts: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const contexts = [
|
console.log("Chromium version", await browser.version());
|
||||||
browser.defaultBrowserContext(),
|
|
||||||
];
|
|
||||||
|
|
||||||
while (contexts.length < event.length) {
|
for (let job of event) {
|
||||||
contexts.push(await browser.createIncognitoBrowserContext());
|
const page = await browser.newPage();
|
||||||
|
|
||||||
|
if (job.hasOwnProperty("url") === true) {
|
||||||
|
await page.goto(job.url, { waitUntil: ["domcontentloaded", "load"] });
|
||||||
|
|
||||||
|
if (job.hasOwnProperty("expected") === true) {
|
||||||
|
if (job.expected.hasOwnProperty("title") === true) {
|
||||||
|
ok(
|
||||||
|
(await page.title()) === job.expected.title,
|
||||||
|
`Title assertion failed.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let context of contexts) {
|
if (job.expected.hasOwnProperty("screenshot") === true) {
|
||||||
const job = event.shift();
|
if (job.expected.hasOwnProperty("remove") === true) {
|
||||||
const page = await context.newPage();
|
|
||||||
|
|
||||||
if (job.hasOwnProperty('url') === true) {
|
|
||||||
await page.goto(job.url, { waitUntil: ['domcontentloaded', 'load'] });
|
|
||||||
|
|
||||||
if (job.hasOwnProperty('expected') === true) {
|
|
||||||
if (job.expected.hasOwnProperty('title') === true) {
|
|
||||||
ok(await page.title() === job.expected.title, `Title assertion failed.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (job.expected.hasOwnProperty('screenshot') === true) {
|
|
||||||
if (job.expected.hasOwnProperty('remove') === true) {
|
|
||||||
await page.evaluate((selector) => {
|
await page.evaluate((selector) => {
|
||||||
document.getElementById(selector).remove();
|
document.getElementById(selector).remove();
|
||||||
}, job.expected.remove);
|
}, job.expected.remove);
|
||||||
}
|
}
|
||||||
const screenshot = await page.screenshot();
|
const screenshot = Buffer.from(await page.screenshot());
|
||||||
// console.log(screenshot.toString('base64'), createHash('sha1').update(screenshot.toString('base64')).digest('hex'));
|
/*
|
||||||
ok(createHash('sha1').update(screenshot.toString('base64')).digest('hex') === job.expected.screenshot, `Screenshot assertion failed.`);
|
console.log(
|
||||||
|
`data:image/png;base64,${screenshot.toString("base64")}`,
|
||||||
|
createHash("sha1")
|
||||||
|
.update(screenshot.toString("base64"))
|
||||||
|
.digest("hex")
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
ok(
|
||||||
|
createHash("sha1")
|
||||||
|
.update(screenshot.toString("base64"))
|
||||||
|
.digest("hex") === job.expected.screenshot,
|
||||||
|
`Screenshot assertion failed.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -52,6 +61,9 @@ exports.handler = async (event, context) => {
|
||||||
throw error.message;
|
throw error.message;
|
||||||
} finally {
|
} finally {
|
||||||
if (browser !== null) {
|
if (browser !== null) {
|
||||||
|
for (const page of await browser.pages()) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
await browser.close();
|
await browser.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ Resources:
|
||||||
CompatibleRuntimes:
|
CompatibleRuntimes:
|
||||||
- nodejs16.x
|
- nodejs16.x
|
||||||
- nodejs18.x
|
- nodejs18.x
|
||||||
|
- nodejs20.x
|
||||||
|
|
||||||
node16:
|
node16:
|
||||||
Type: AWS::Serverless::Function
|
Type: AWS::Serverless::Function
|
||||||
|
|
@ -37,3 +38,14 @@ Resources:
|
||||||
- AWSLambdaBasicExecutionRole
|
- AWSLambdaBasicExecutionRole
|
||||||
- AWSXRayDaemonWriteAccess
|
- AWSXRayDaemonWriteAccess
|
||||||
Tracing: Active
|
Tracing: Active
|
||||||
|
node20:
|
||||||
|
Type: AWS::Serverless::Function
|
||||||
|
Properties:
|
||||||
|
Layers:
|
||||||
|
- !Ref layer
|
||||||
|
Handler: handlers/index.handler
|
||||||
|
Runtime: nodejs20.x
|
||||||
|
Policies:
|
||||||
|
- AWSLambdaBasicExecutionRole
|
||||||
|
- AWSXRayDaemonWriteAccess
|
||||||
|
Tracing: Active
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@
|
||||||
[localhost:vars]
|
[localhost:vars]
|
||||||
ansible_connection=local
|
ansible_connection=local
|
||||||
ansible_python_interpreter=python
|
ansible_python_interpreter=python
|
||||||
image=ami-08d090f841c8435e9
|
image=ami-06c68f701d8090592
|
||||||
region=us-east-1
|
region=us-east-1
|
||||||
instance_size=c6i.12xlarge
|
instance_size=c7i.12xlarge
|
||||||
|
|
||||||
[aws]
|
[aws]
|
||||||
|
|
||||||
|
|
@ -14,4 +14,4 @@ instance_size=c6i.12xlarge
|
||||||
ansible_connection=ssh
|
ansible_connection=ssh
|
||||||
ansible_python_interpreter=auto_silent
|
ansible_python_interpreter=auto_silent
|
||||||
ansible_ssh_private_key_file=ansible.pem
|
ansible_ssh_private_key_file=ansible.pem
|
||||||
chromium_revision=1121455
|
chromium_revision=1343869
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
ebs:
|
ebs:
|
||||||
delete_on_termination: true
|
delete_on_termination: true
|
||||||
volume_type: io2
|
volume_type: io2
|
||||||
volume_size: 128
|
volume_size: 256
|
||||||
iops: 3000
|
iops: 3000
|
||||||
register: ec2
|
register: ec2
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
wait_for:
|
wait_for:
|
||||||
host: "{{ ec2.instances[0].public_ip_address }}"
|
host: "{{ ec2.instances[0].public_ip_address }}"
|
||||||
port: 22
|
port: 22
|
||||||
timeout: 240
|
timeout: 320
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: AWS
|
- name: AWS
|
||||||
|
|
@ -236,12 +236,6 @@
|
||||||
path: /srv/source/chromium/src/out/Headless
|
path: /srv/source/chromium/src/out/Headless
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Mounting Build Directory in Memory
|
|
||||||
become: true
|
|
||||||
become_user: root
|
|
||||||
shell: |
|
|
||||||
mount --types tmpfs --options size=24G,nr_inodes=128k,mode=1777 tmpfs /srv/source/chromium/src/out/Headless
|
|
||||||
|
|
||||||
- name: Creating Headless Chromium Configuration
|
- name: Creating Headless Chromium Configuration
|
||||||
copy:
|
copy:
|
||||||
content: |
|
content: |
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
BIN
bin/aws.tar.br
BIN
bin/aws.tar.br
Binary file not shown.
BIN
bin/chromium.br
BIN
bin/chromium.br
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1 @@
|
||||||
|
.aws-sam
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Chromium as a Layer for AWS SAM
|
||||||
|
|
||||||
|
1. Install AWS SAM CLI: https://github.com/aws/aws-sam-cli/
|
||||||
|
|
||||||
|
1. Ensure Docker is installed and running: https://www.docker.com/
|
||||||
|
|
||||||
|
1. Build the project:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sam build
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Invoke the AWS Lambda Function locally with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sam local invoke ExampleFunction
|
||||||
|
```
|
||||||
|
|
||||||
|
This example connects to https://www.example.com and outputs the page's title as the function result. See the source code in [`app.mjs`](functions/exampleFunction/app.mjs) for more details.
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
import chromium from '@sparticuz/chromium';
|
||||||
|
import puppeteer from 'puppeteer-core';
|
||||||
|
|
||||||
|
export const lambdaHandler = async (event, context) => {
|
||||||
|
const browser = await puppeteer.launch({
|
||||||
|
args: chromium.args,
|
||||||
|
defaultViewport: chromium.defaultViewport,
|
||||||
|
executablePath: await chromium.executablePath(),
|
||||||
|
headless: chromium.headless,
|
||||||
|
});
|
||||||
|
|
||||||
|
const page = await browser.newPage();
|
||||||
|
|
||||||
|
await page.goto("https://www.example.com", { waitUntil: "networkidle0" });
|
||||||
|
|
||||||
|
const browserVersion = await browser.version();
|
||||||
|
const pageTitle = await page.title();
|
||||||
|
|
||||||
|
await page.close();
|
||||||
|
|
||||||
|
await browser.close();
|
||||||
|
|
||||||
|
return { result: 'success', browserVersion, pageTitle };
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name": "ExampleFunction",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "AWS Lambda Function that loads Chromium. Refer to https://github.com/Sparticuz/chromium#install for compatible versions.",
|
||||||
|
"main": "app.mjs",
|
||||||
|
"devDependencies": {
|
||||||
|
"@sparticuz/chromium": "^119.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"puppeteer-core": "^21.5.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "ChromiumLayer",
|
||||||
|
"private": true,
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Chromium layer for AWS Lambda",
|
||||||
|
"dependencies": {
|
||||||
|
"@sparticuz/chromium": "^119.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
AWSTemplateFormatVersion: "2010-09-09"
|
||||||
|
Transform: AWS::Serverless-2016-10-31
|
||||||
|
Description: Example configuration for AWS SAM and Chromium
|
||||||
|
|
||||||
|
Resources:
|
||||||
|
ChromiumLayer:
|
||||||
|
Type: AWS::Serverless::LayerVersion
|
||||||
|
Properties:
|
||||||
|
Description: Chromium with Node.js integration for AWS Lambda
|
||||||
|
ContentUri: layers/chromium
|
||||||
|
CompatibleRuntimes:
|
||||||
|
- &nodejsRuntime nodejs18.x
|
||||||
|
# Chromium doesn't currently have ARM support; see https://github.com/Sparticuz/chromium#can-i-use-arm-or-graviton-instances
|
||||||
|
CompatibleArchitectures:
|
||||||
|
- &chromiumArch x86_64
|
||||||
|
RetentionPolicy: Delete
|
||||||
|
Metadata:
|
||||||
|
BuildMethod: *nodejsRuntime
|
||||||
|
BuildArchitecture: *chromiumArch
|
||||||
|
|
||||||
|
ExampleFunction:
|
||||||
|
Type: AWS::Serverless::Function
|
||||||
|
Properties:
|
||||||
|
CodeUri: functions/exampleFunction
|
||||||
|
Handler: app.lambdaHandler
|
||||||
|
Runtime: *nodejsRuntime
|
||||||
|
Architectures:
|
||||||
|
- *chromiumArch
|
||||||
|
Layers:
|
||||||
|
- !Ref ChromiumLayer
|
||||||
|
# Adjust as necessary
|
||||||
|
Timeout: 30
|
||||||
|
MemorySize: 1024
|
||||||
|
|
@ -1,61 +1,65 @@
|
||||||
{
|
{
|
||||||
"name": "@sparticuz/chromium",
|
"name": "@sparticuz/chromium",
|
||||||
"version": "113.0.0",
|
"version": "130.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@sparticuz/chromium",
|
"name": "@sparticuz/chromium",
|
||||||
"version": "113.0.0",
|
"version": "130.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.2",
|
"follow-redirects": "^1.15.9",
|
||||||
"tar-fs": "^2.1.1"
|
"tar-fs": "^3.0.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/node16": "^1.0.3",
|
"@tsconfig/node20": "^20.1.4",
|
||||||
"@tsconfig/strictest": "^2.0.1",
|
"@tsconfig/strictest": "^2.0.5",
|
||||||
"@types/follow-redirects": "^1.14.1",
|
"@types/follow-redirects": "^1.14.4",
|
||||||
"@types/node": "^18.16.3",
|
"@types/node": "^20.16.10",
|
||||||
"@types/tar-fs": "^2.0.1",
|
"@types/tar-fs": "^2.0.4",
|
||||||
"clean-modules": "^2.0.6",
|
"clean-modules": "^3.1.1",
|
||||||
"typescript": "^5.0.4"
|
"typescript": "^5.6.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 16"
|
"node": ">= 16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tsconfig/node16": {
|
"node_modules/@tsconfig/node20": {
|
||||||
"version": "1.0.3",
|
"version": "20.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@tsconfig/node20/-/node20-20.1.4.tgz",
|
||||||
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
|
"integrity": "sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@tsconfig/strictest": {
|
"node_modules/@tsconfig/strictest": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/@tsconfig/strictest/-/strictest-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@tsconfig/strictest/-/strictest-2.0.5.tgz",
|
||||||
"integrity": "sha512-7JHHCbyCsGUxLd0pDbp24yz3zjxw2t673W5oAP6HCEdr/UUhaRhYd3SSnUsGCk+VnPVJVA4mXROzbhI+nyIk+w==",
|
"integrity": "sha512-ec4tjL2Rr0pkZ5hww65c+EEPYwxOi4Ryv+0MtjeaSQRJyq322Q27eOQiFbuNgw2hpL4hB1/W/HBGk3VKS43osg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/follow-redirects": {
|
"node_modules/@types/follow-redirects": {
|
||||||
"version": "1.14.1",
|
"version": "1.14.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/follow-redirects/-/follow-redirects-1.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/follow-redirects/-/follow-redirects-1.14.4.tgz",
|
||||||
"integrity": "sha512-THBEFwqsLuU/K62B5JRwab9NW97cFmL4Iy34NTMX0bMycQVzq2q7PKOkhfivIwxdpa/J72RppgC42vCHfwKJ0Q==",
|
"integrity": "sha512-GWXfsD0Jc1RWiFmMuMFCpXMzi9L7oPDVwxUnZdg89kDNnqsRfUKXEtUYtA98A6lig1WXH/CYY/fvPW9HuN5fTA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "18.16.3",
|
"version": "20.16.10",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.10.tgz",
|
||||||
"integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==",
|
"integrity": "sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~6.19.2"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/tar-fs": {
|
"node_modules/@types/tar-fs": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/tar-fs/-/tar-fs-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/tar-fs/-/tar-fs-2.0.4.tgz",
|
||||||
"integrity": "sha512-qlsQyIY9sN7p221xHuXKNoMfUenOcvEBN4zI8dGsYbYCqHtTarXOEXSIgUnK+GcR0fZDse6pAIc5pIrCh9NefQ==",
|
"integrity": "sha512-ipPec0CjTmVDWE+QKr9cTmIIoTl7dFG/yARCM5MqK8i6CNLIG1P8x4kwDsOQY1ChZOZjH0wO9nvfgBvWl4R3kA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
|
|
@ -71,151 +75,76 @@
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ansi-regex": {
|
"node_modules/b4a": {
|
||||||
"version": "5.0.1",
|
"version": "1.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz",
|
||||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
"integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw=="
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"node_modules/ansi-styles": {
|
"node_modules/bare-events": {
|
||||||
"version": "4.3.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.2.0.tgz",
|
||||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
"integrity": "sha512-Yyyqff4PIFfSuthCZqLlPISTWHmnQxoPuAvkmgzsJEmG3CesdIv6Xweayl0JkCZJSB2yYIdJyEz97tpxNhgjbg==",
|
||||||
"dev": true,
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/bare-fs": {
|
||||||
|
"version": "2.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-2.1.5.tgz",
|
||||||
|
"integrity": "sha512-5t0nlecX+N2uJqdxe9d18A98cp2u9BETelbjKpiVgQqzzmVNFYWEAjQHqS+2Khgto1vcwhik9cXucaj5ve2WWA==",
|
||||||
|
"optional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"color-convert": "^2.0.1"
|
"bare-events": "^2.0.0",
|
||||||
},
|
"bare-os": "^2.0.0",
|
||||||
"engines": {
|
"bare-path": "^2.0.0",
|
||||||
"node": ">=8"
|
"streamx": "^2.13.0"
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/arg": {
|
"node_modules/bare-os": {
|
||||||
"version": "5.0.2",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.2.0.tgz",
|
||||||
"integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==",
|
"integrity": "sha512-hD0rOPfYWOMpVirTACt4/nK8mC55La12K5fY1ij8HAdfQakD62M+H4o4tpfKzVGLgRDTuk3vjA4GqGXXCeFbag==",
|
||||||
"dev": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"node_modules/base64-js": {
|
"node_modules/bare-path": {
|
||||||
"version": "1.5.1",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/bare-path/-/bare-path-2.1.0.tgz",
|
||||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
"integrity": "sha512-DIIg7ts8bdRKwJRJrUMy/PICEaQZaPGZ26lsSx9MJSwIhSrcdHn7/C8W+XmnG/rKi6BaRcz+JO00CjZteybDtw==",
|
||||||
"funding": [
|
"optional": true,
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "patreon",
|
|
||||||
"url": "https://www.patreon.com/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "consulting",
|
|
||||||
"url": "https://feross.org/support"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/bl": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"buffer": "^5.5.0",
|
"bare-os": "^2.1.0"
|
||||||
"inherits": "^2.0.4",
|
|
||||||
"readable-stream": "^3.4.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/buffer": {
|
|
||||||
"version": "5.7.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
|
||||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "patreon",
|
|
||||||
"url": "https://www.patreon.com/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "consulting",
|
|
||||||
"url": "https://feross.org/support"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"base64-js": "^1.3.1",
|
|
||||||
"ieee754": "^1.1.13"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/chownr": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
|
|
||||||
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
|
|
||||||
},
|
|
||||||
"node_modules/clean-modules": {
|
"node_modules/clean-modules": {
|
||||||
"version": "2.0.6",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/clean-modules/-/clean-modules-2.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/clean-modules/-/clean-modules-3.1.1.tgz",
|
||||||
"integrity": "sha512-e3R40CfLfzS3tlBWO5RcIMZYsIecEERklMln5qb4HvvujyvLLTi2lPEhhCGtH5gJL+4t0lVguiynMHXNkNdoDA==",
|
"integrity": "sha512-t/7dNtn6vQYxujYxdwZeLa0NsLE92KQ0XeV3CDJ2TXgLTvn3ijmjlQN0Dm9wjYQgC0miZiF66ClTQzgIeYw96A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"arg": "^5.0.1",
|
"clipanion": "^3.2.1",
|
||||||
"picomatch": "^2.3.0",
|
"picomatch": "^2.3.0",
|
||||||
"pretty-bytes": "^5.6.0",
|
"pretty-bytes": "^6.1.0",
|
||||||
"pretty-ms": "^7.0.1",
|
"pretty-ms": "^8.0.0",
|
||||||
"supports-color": "^8.1.1",
|
"supports-color": "^9.4.0"
|
||||||
"yargs": "^17.1.1"
|
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"clean-modules": "bin/cli.js"
|
"clean-modules": "bin/cli.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cliui": {
|
"node_modules/clipanion": {
|
||||||
"version": "8.0.1",
|
"version": "3.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/clipanion/-/clipanion-3.2.1.tgz",
|
||||||
"integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
|
"integrity": "sha512-dYFdjLb7y1ajfxQopN05mylEpK9ZX0sO1/RfMXdfmwjlIsPkbh4p7A682x++zFPLDCo1x3p82dtljHf5cW2LKA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"string-width": "^4.2.0",
|
"typanion": "^3.8.0"
|
||||||
"strip-ansi": "^6.0.1",
|
|
||||||
"wrap-ansi": "^7.0.0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"peerDependencies": {
|
||||||
"node": ">=12"
|
"typanion": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/color-convert": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"color-name": "~1.1.4"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=7.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/color-name": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/emoji-regex": {
|
|
||||||
"version": "8.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
|
||||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/end-of-stream": {
|
"node_modules/end-of-stream": {
|
||||||
"version": "1.4.4",
|
"version": "1.4.4",
|
||||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||||
|
|
@ -224,25 +153,22 @@
|
||||||
"once": "^1.4.0"
|
"once": "^1.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/escalade": {
|
"node_modules/fast-fifo": {
|
||||||
"version": "3.1.1",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.0.tgz",
|
||||||
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
|
"integrity": "sha512-IgfweLvEpwyA4WgiQe9Nx6VV2QkML2NkvZnk1oKnIzXgXdWxuhF7zw4DvLTPZJn6PIUneiAXPF24QmoEqHTjyw=="
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"node_modules/follow-redirects": {
|
"node_modules/follow-redirects": {
|
||||||
"version": "1.15.2",
|
"version": "1.15.9",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
|
||||||
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
|
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "individual",
|
"type": "individual",
|
||||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.0"
|
"node": ">=4.0"
|
||||||
},
|
},
|
||||||
|
|
@ -252,67 +178,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fs-constants": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
|
||||||
},
|
|
||||||
"node_modules/get-caller-file": {
|
|
||||||
"version": "2.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
|
||||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": "6.* || 8.* || >= 10.*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/has-flag": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ieee754": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
|
||||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "patreon",
|
|
||||||
"url": "https://www.patreon.com/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "consulting",
|
|
||||||
"url": "https://feross.org/support"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/inherits": {
|
|
||||||
"version": "2.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
|
||||||
},
|
|
||||||
"node_modules/is-fullwidth-code-point": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mkdirp-classic": {
|
|
||||||
"version": "0.5.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
|
|
||||||
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
|
|
||||||
},
|
|
||||||
"node_modules/once": {
|
"node_modules/once": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
|
|
@ -322,12 +187,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/parse-ms": {
|
"node_modules/parse-ms": {
|
||||||
"version": "2.1.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-3.0.0.tgz",
|
||||||
"integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==",
|
"integrity": "sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/picomatch": {
|
"node_modules/picomatch": {
|
||||||
|
|
@ -343,27 +211,27 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/pretty-bytes": {
|
"node_modules/pretty-bytes": {
|
||||||
"version": "5.6.0",
|
"version": "6.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-6.1.1.tgz",
|
||||||
"integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==",
|
"integrity": "sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": "^14.13.1 || >=16.0.0"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/pretty-ms": {
|
"node_modules/pretty-ms": {
|
||||||
"version": "7.0.1",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz",
|
||||||
"integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==",
|
"integrity": "sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"parse-ms": "^2.1.0"
|
"parse-ms": "^3.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=14.16"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
|
@ -378,197 +246,86 @@
|
||||||
"once": "^1.3.1"
|
"once": "^1.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/readable-stream": {
|
"node_modules/queue-tick": {
|
||||||
"version": "3.6.0",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz",
|
||||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
"integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag=="
|
||||||
|
},
|
||||||
|
"node_modules/streamx": {
|
||||||
|
"version": "2.15.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.1.tgz",
|
||||||
|
"integrity": "sha512-fQMzy2O/Q47rgwErk/eGeLu/roaFWV0jVsogDmrszM9uIw8L5OA+t+V93MgYlufNptfjmYR1tOMWhei/Eh7TQA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"inherits": "^2.0.3",
|
"fast-fifo": "^1.1.0",
|
||||||
"string_decoder": "^1.1.1",
|
"queue-tick": "^1.0.1"
|
||||||
"util-deprecate": "^1.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/require-directory": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/safe-buffer": {
|
|
||||||
"version": "5.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
||||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "patreon",
|
|
||||||
"url": "https://www.patreon.com/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "consulting",
|
|
||||||
"url": "https://feross.org/support"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/string_decoder": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
|
||||||
"dependencies": {
|
|
||||||
"safe-buffer": "~5.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/string-width": {
|
|
||||||
"version": "4.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
|
||||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"emoji-regex": "^8.0.0",
|
|
||||||
"is-fullwidth-code-point": "^3.0.0",
|
|
||||||
"strip-ansi": "^6.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/strip-ansi": {
|
|
||||||
"version": "6.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
|
||||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": "^5.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/supports-color": {
|
"node_modules/supports-color": {
|
||||||
"version": "8.1.1",
|
"version": "9.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.4.0.tgz",
|
||||||
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
|
"integrity": "sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
|
||||||
"has-flag": "^4.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/chalk/supports-color?sponsor=1"
|
"url": "https://github.com/chalk/supports-color?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tar-fs": {
|
"node_modules/tar-fs": {
|
||||||
"version": "2.1.1",
|
"version": "3.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.6.tgz",
|
||||||
"integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
|
"integrity": "sha512-iokBDQQkUyeXhgPYaZxmczGPhnhXZ0CmrqI+MOb/WFGS9DW5wnfrLgtjUJBvz50vQ3qfRwJ62QVoCFu8mPVu5w==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chownr": "^1.1.1",
|
|
||||||
"mkdirp-classic": "^0.5.2",
|
|
||||||
"pump": "^3.0.0",
|
"pump": "^3.0.0",
|
||||||
"tar-stream": "^2.1.4"
|
"tar-stream": "^3.1.5"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"bare-fs": "^2.1.1",
|
||||||
|
"bare-path": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tar-stream": {
|
"node_modules/tar-stream": {
|
||||||
"version": "2.2.0",
|
"version": "3.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz",
|
||||||
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
"integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bl": "^4.0.3",
|
"b4a": "^1.6.4",
|
||||||
"end-of-stream": "^1.4.1",
|
"fast-fifo": "^1.2.0",
|
||||||
"fs-constants": "^1.0.0",
|
"streamx": "^2.15.0"
|
||||||
"inherits": "^2.0.3",
|
|
||||||
"readable-stream": "^3.1.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/typanion": {
|
||||||
|
"version": "3.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/typanion/-/typanion-3.14.0.tgz",
|
||||||
|
"integrity": "sha512-ZW/lVMRabETuYCd9O9ZvMhAh8GslSqaUjxmK/JLPCh6l73CvLBiuXswj/+7LdnWOgYsQ130FqLzFz5aGT4I3Ug==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.0.4",
|
"version": "5.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz",
|
||||||
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
|
"integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.20"
|
"node": ">=14.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/util-deprecate": {
|
"node_modules/undici-types": {
|
||||||
"version": "1.0.2",
|
"version": "6.19.6",
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.6.tgz",
|
||||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
"integrity": "sha512-e/vggGopEfTKSvj4ihnOLTsqhrKRN3LeO6qSN/GxohhuRv8qH9bNQ4B8W7e/vFL+0XTnmHPB4/kegunZGA4Org==",
|
||||||
},
|
|
||||||
"node_modules/wrap-ansi": {
|
|
||||||
"version": "7.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
|
||||||
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"license": "MIT"
|
||||||
"ansi-styles": "^4.0.0",
|
|
||||||
"string-width": "^4.1.0",
|
|
||||||
"strip-ansi": "^6.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"node_modules/wrappy": {
|
"node_modules/wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||||
},
|
|
||||||
"node_modules/y18n": {
|
|
||||||
"version": "5.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
|
||||||
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/yargs": {
|
|
||||||
"version": "17.7.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz",
|
|
||||||
"integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"cliui": "^8.0.1",
|
|
||||||
"escalade": "^3.1.1",
|
|
||||||
"get-caller-file": "^2.0.5",
|
|
||||||
"require-directory": "^2.1.1",
|
|
||||||
"string-width": "^4.2.3",
|
|
||||||
"y18n": "^5.0.5",
|
|
||||||
"yargs-parser": "^21.1.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/yargs-parser": {
|
|
||||||
"version": "21.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
|
|
||||||
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
package.json
20
package.json
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@sparticuz/chromium",
|
"name": "@sparticuz/chromium",
|
||||||
"version": "113.0.0",
|
"version": "130.0.0",
|
||||||
"description": "Chromium Binary for Serverless Platforms",
|
"description": "Chromium Binary for Serverless Platforms",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"aws",
|
"aws",
|
||||||
|
|
@ -36,17 +36,17 @@
|
||||||
"test": "make clean && make && make pretest && make test"
|
"test": "make clean && make && make pretest && make test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.2",
|
"follow-redirects": "^1.15.9",
|
||||||
"tar-fs": "^2.1.1"
|
"tar-fs": "^3.0.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/node16": "^1.0.3",
|
"@tsconfig/node20": "^20.1.4",
|
||||||
"@tsconfig/strictest": "^2.0.1",
|
"@tsconfig/strictest": "^2.0.5",
|
||||||
"@types/follow-redirects": "^1.14.1",
|
"@types/follow-redirects": "^1.14.4",
|
||||||
"@types/node": "^18.16.3",
|
"@types/node": "^20.16.10",
|
||||||
"@types/tar-fs": "^2.0.1",
|
"@types/tar-fs": "^2.0.4",
|
||||||
"clean-modules": "^2.0.6",
|
"clean-modules": "^3.1.1",
|
||||||
"typescript": "^5.0.4"
|
"typescript": "^5.6.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 16"
|
"node": ">= 16"
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,36 @@ export const isValidUrl = (input: string) => {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the running instance is inside an AWS Lambda container.
|
* Determines if the running instance is inside an AWS Lambda container.
|
||||||
* @returns
|
* AWS_EXECUTION_ENV is for native Lambda instances
|
||||||
|
* AWS_LAMBDA_JS_RUNTIME is for netlify instances
|
||||||
|
* @returns boolean indicating if the running instance is inside a Lambda container
|
||||||
*/
|
*/
|
||||||
export const isRunningInAwsLambda = () => {
|
export const isRunningInAwsLambda = () => {
|
||||||
if (
|
if (
|
||||||
process.env["AWS_EXECUTION_ENV"] &&
|
process.env["AWS_EXECUTION_ENV"] &&
|
||||||
/^AWS_Lambda_nodejs/.test(process.env["AWS_EXECUTION_ENV"]) === true
|
process.env["AWS_EXECUTION_ENV"].includes("AWS_Lambda_nodejs") &&
|
||||||
|
!process.env["AWS_EXECUTION_ENV"].includes("20.x")
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
} else if (
|
||||||
|
process.env["AWS_LAMBDA_JS_RUNTIME"] &&
|
||||||
|
process.env["AWS_LAMBDA_JS_RUNTIME"].includes("nodejs") &&
|
||||||
|
!process.env["AWS_LAMBDA_JS_RUNTIME"].includes("20.x")
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const isRunningInAwsLambdaNode20 = () => {
|
||||||
|
if (
|
||||||
|
process.env["AWS_EXECUTION_ENV"] &&
|
||||||
|
process.env["AWS_EXECUTION_ENV"].includes("20.x")
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
} else if (
|
||||||
|
process.env["AWS_LAMBDA_JS_RUNTIME"] &&
|
||||||
|
process.env["AWS_LAMBDA_JS_RUNTIME"].includes("20.x")
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,12 @@ import { https } from "follow-redirects";
|
||||||
import LambdaFS from "./lambdafs";
|
import LambdaFS from "./lambdafs";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { URL } from "node:url";
|
import { URL } from "node:url";
|
||||||
import { downloadAndExtract, isRunningInAwsLambda, isValidUrl } from "./helper";
|
import {
|
||||||
|
downloadAndExtract,
|
||||||
|
isRunningInAwsLambda,
|
||||||
|
isValidUrl,
|
||||||
|
isRunningInAwsLambdaNode20,
|
||||||
|
} from "./helper";
|
||||||
|
|
||||||
/** Viewport taken from https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.viewport.md */
|
/** Viewport taken from https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.viewport.md */
|
||||||
interface Viewport {
|
interface Viewport {
|
||||||
|
|
@ -46,17 +51,36 @@ interface Viewport {
|
||||||
|
|
||||||
if (isRunningInAwsLambda()) {
|
if (isRunningInAwsLambda()) {
|
||||||
if (process.env["FONTCONFIG_PATH"] === undefined) {
|
if (process.env["FONTCONFIG_PATH"] === undefined) {
|
||||||
process.env["FONTCONFIG_PATH"] = "/tmp/aws";
|
process.env["FONTCONFIG_PATH"] = "/tmp/fonts";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env["LD_LIBRARY_PATH"] === undefined) {
|
if (process.env["LD_LIBRARY_PATH"] === undefined) {
|
||||||
process.env["LD_LIBRARY_PATH"] = "/tmp/aws/lib";
|
process.env["LD_LIBRARY_PATH"] = "/tmp/al2/lib";
|
||||||
} else if (
|
} else if (
|
||||||
process.env["LD_LIBRARY_PATH"].startsWith("/tmp/aws/lib") !== true
|
process.env["LD_LIBRARY_PATH"].startsWith("/tmp/al2/lib") !== true
|
||||||
) {
|
) {
|
||||||
process.env["LD_LIBRARY_PATH"] = [
|
process.env["LD_LIBRARY_PATH"] = [
|
||||||
...new Set([
|
...new Set([
|
||||||
"/tmp/aws/lib",
|
"/tmp/al2/lib",
|
||||||
|
...process.env["LD_LIBRARY_PATH"].split(":"),
|
||||||
|
]),
|
||||||
|
].join(":");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRunningInAwsLambdaNode20()) {
|
||||||
|
if (process.env["FONTCONFIG_PATH"] === undefined) {
|
||||||
|
process.env["FONTCONFIG_PATH"] = "/tmp/fonts";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env["LD_LIBRARY_PATH"] === undefined) {
|
||||||
|
process.env["LD_LIBRARY_PATH"] = "/tmp/al2023/lib";
|
||||||
|
} else if (
|
||||||
|
process.env["LD_LIBRARY_PATH"].startsWith("/tmp/al2023/lib") !== true
|
||||||
|
) {
|
||||||
|
process.env["LD_LIBRARY_PATH"] = [
|
||||||
|
...new Set([
|
||||||
|
"/tmp/al2023/lib",
|
||||||
...process.env["LD_LIBRARY_PATH"].split(":"),
|
...process.env["LD_LIBRARY_PATH"].split(":"),
|
||||||
]),
|
]),
|
||||||
].join(":");
|
].join(":");
|
||||||
|
|
@ -69,7 +93,7 @@ class Chromium {
|
||||||
* https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless
|
* https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless
|
||||||
* @values true or "new"
|
* @values true or "new"
|
||||||
*/
|
*/
|
||||||
private static headlessMode: true | "new" = "new";
|
private static headlessMode: true | "shell" = "shell";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If true, the graphics stack and webgl is enabled,
|
* If true, the graphics stack and webgl is enabled,
|
||||||
|
|
@ -199,6 +223,7 @@ class Chromium {
|
||||||
"--no-default-browser-check", // https://source.chromium.org/search?q=lang:cpp+symbol:kNoDefaultBrowserCheck&ss=chromium
|
"--no-default-browser-check", // https://source.chromium.org/search?q=lang:cpp+symbol:kNoDefaultBrowserCheck&ss=chromium
|
||||||
"--no-pings", // https://source.chromium.org/search?q=lang:cpp+symbol:kNoPings&ss=chromium
|
"--no-pings", // https://source.chromium.org/search?q=lang:cpp+symbol:kNoPings&ss=chromium
|
||||||
"--single-process", // Needs to be single-process to avoid `prctl(PR_SET_NO_NEW_PRIVS) failed` error
|
"--single-process", // Needs to be single-process to avoid `prctl(PR_SET_NO_NEW_PRIVS) failed` error
|
||||||
|
"--font-render-hinting=none", // https://github.com/puppeteer/puppeteer/issues/2410#issuecomment-560573612
|
||||||
];
|
];
|
||||||
const chromiumDisableFeatures = [
|
const chromiumDisableFeatures = [
|
||||||
"AudioServiceOutOfProcess",
|
"AudioServiceOutOfProcess",
|
||||||
|
|
@ -215,9 +240,11 @@ class Chromium {
|
||||||
];
|
];
|
||||||
|
|
||||||
// https://chromium.googlesource.com/chromium/src/+/main/docs/gpu/swiftshader.md
|
// https://chromium.googlesource.com/chromium/src/+/main/docs/gpu/swiftshader.md
|
||||||
this.graphics
|
// Blocked by https://github.com/Sparticuz/chromium/issues/247
|
||||||
? graphicsFlags.push("--use-gl=angle", "--use-angle=swiftshader")
|
//this.graphics
|
||||||
: graphicsFlags.push("--disable-webgl");
|
// ? graphicsFlags.push("--use-gl=angle", "--use-angle=swiftshader")
|
||||||
|
// : graphicsFlags.push("--disable-webgl");
|
||||||
|
graphicsFlags.push("--use-gl=angle", "--use-angle=swiftshader");
|
||||||
|
|
||||||
const insecureFlags = [
|
const insecureFlags = [
|
||||||
"--allow-running-insecure-content", // https://source.chromium.org/search?q=lang:cpp+symbol:kAllowRunningInsecureContent&ss=chromium
|
"--allow-running-insecure-content", // https://source.chromium.org/search?q=lang:cpp+symbol:kAllowRunningInsecureContent&ss=chromium
|
||||||
|
|
@ -229,7 +256,7 @@ class Chromium {
|
||||||
];
|
];
|
||||||
|
|
||||||
const headlessFlags = [
|
const headlessFlags = [
|
||||||
this.headless === "new" ? "--headless='new'" : "--headless",
|
this.headless === "shell" ? "--headless='shell'" : "--headless",
|
||||||
];
|
];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
@ -300,14 +327,20 @@ class Chromium {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the required files
|
// Extract the required files
|
||||||
const promises = [LambdaFS.inflate(`${input}/chromium.br`)];
|
const promises = [
|
||||||
|
LambdaFS.inflate(`${input}/chromium.br`),
|
||||||
|
LambdaFS.inflate(`${input}/fonts.tar.br`),
|
||||||
|
];
|
||||||
if (this.graphics) {
|
if (this.graphics) {
|
||||||
// Only inflate graphics stack if needed
|
// Only inflate graphics stack if needed
|
||||||
promises.push(LambdaFS.inflate(`${input}/swiftshader.tar.br`));
|
promises.push(LambdaFS.inflate(`${input}/swiftshader.tar.br`));
|
||||||
}
|
}
|
||||||
if (isRunningInAwsLambda()) {
|
if (isRunningInAwsLambda()) {
|
||||||
// If running in AWS Lambda, extract more required files
|
// If running in AWS Lambda, extract more required files
|
||||||
promises.push(LambdaFS.inflate(`${input}/aws.tar.br`));
|
promises.push(LambdaFS.inflate(`${input}/al2.tar.br`));
|
||||||
|
}
|
||||||
|
if (isRunningInAwsLambdaNode20()) {
|
||||||
|
promises.push(LambdaFS.inflate(`${input}/al2023.tar.br`));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Await all extractions
|
// Await all extractions
|
||||||
|
|
@ -318,10 +351,10 @@ class Chromium {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the headless mode.
|
* Returns the headless mode.
|
||||||
* `true` means the 'old' (legacy, chromium < 112) headless mode.
|
* "shell" means the 'old' (legacy, chromium < 112) headless mode.
|
||||||
* "new" means the 'new' headless mode.
|
* `true` means the 'new' headless mode.
|
||||||
* https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless
|
* https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless
|
||||||
* @returns true | "new"
|
* @returns true | "shell"
|
||||||
*/
|
*/
|
||||||
public static get headless() {
|
public static get headless() {
|
||||||
return this.headlessMode;
|
return this.headlessMode;
|
||||||
|
|
@ -329,18 +362,18 @@ class Chromium {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the headless mode.
|
* Sets the headless mode.
|
||||||
* `true` means the 'old' (legacy, chromium < 112) headless mode.
|
* "shell" means the 'old' (legacy, chromium < 112) headless mode.
|
||||||
* "new" means the 'new' headless mode.
|
* `true` means the 'new' headless mode.
|
||||||
* https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless
|
* https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless
|
||||||
* @default "new"
|
* @default "shell"
|
||||||
*/
|
*/
|
||||||
public static set setHeadlessMode(value: true | "new") {
|
public static set setHeadlessMode(value: true | "shell") {
|
||||||
if (
|
if (
|
||||||
(typeof value === "string" && value !== "new") ||
|
(typeof value === "string" && value !== "shell") ||
|
||||||
(typeof value === "boolean" && value !== true)
|
(typeof value === "boolean" && value !== true)
|
||||||
) {
|
) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Headless mode must be either \`true\` or 'new', you entered '${value}'`
|
`Headless mode must be either \`true\` or 'shell', you entered '${value}'`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.headlessMode = value;
|
this.headlessMode = value;
|
||||||
|
|
@ -367,7 +400,11 @@ class Chromium {
|
||||||
`Graphics mode must be a boolean, you entered '${value}'`
|
`Graphics mode must be a boolean, you entered '${value}'`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.graphicsMode = value;
|
|
||||||
|
// Disabling 'disabling the gpu'
|
||||||
|
// Blocked by https://github.com/Sparticuz/chromium/issues/247
|
||||||
|
// this.graphicsMode = value;
|
||||||
|
this.graphicsMode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,4 +72,4 @@ class LambdaFS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export = LambdaFS;
|
export default LambdaFS;
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": ["@tsconfig/node20/tsconfig", "@tsconfig/strictest"],
|
||||||
"@tsconfig/node16/tsconfig",
|
|
||||||
"@tsconfig/strictest"
|
|
||||||
],
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"lib": [
|
"lib": ["dom", "ES2023"],
|
||||||
"dom"
|
"module": "NodeNext",
|
||||||
],
|
"moduleResolution": "NodeNext",
|
||||||
"outDir": "build",
|
"outDir": "build"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["source"]
|
||||||
"source"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue