Skip to content

Commit f132c01

Browse files
committed
it is worked
1 parent d378ca8 commit f132c01

File tree

4 files changed

+61
-20
lines changed

4 files changed

+61
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"license": "MPL-2.0",
1818
"dependencies": {
1919
"@devprotocol/util-ts": "^4.0.0",
20-
"@sparticuz/chromium-min": "^130.0.0",
20+
"@sparticuz/chromium": "^132.0.0",
2121
"aws-lambda": "^1.0.7",
2222
"puppeteer-core": "23.6.0"
2323
},

rollup.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ import typescript from '@rollup/plugin-typescript'
22
import { nodeResolve } from '@rollup/plugin-node-resolve'
33
import commonjs from '@rollup/plugin-commonjs'
44
import json from '@rollup/plugin-json'
5+
import packageJson from './package.json' with { type: 'json' }
56

67
export default {
8+
external: [
9+
...Object.keys(packageJson.dependencies),
10+
...Object.keys(packageJson.devDependencies),
11+
],
712
input: 'src/index.ts',
813
output: {
9-
dir: 'dist',
14+
file: 'dist/index.js',
1015
format: 'es',
1116
},
1217
plugins: [typescript(), commonjs(), nodeResolve(), json()],

src/index.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable functional/no-expression-statements */
22
import type { Handler } from 'aws-lambda'
33
import type { APIGatewayEvent, APIGatewayProxyResult } from 'aws-lambda'
4-
import chromium from '@sparticuz/chromium-min'
4+
import chromium from '@sparticuz/chromium'
55
import { Chromium } from './libs/chromium.js'
66
import type { PuppeteerLifeCycleEvent } from 'puppeteer-core'
77

@@ -12,24 +12,16 @@ const exePath =
1212
? '/usr/bin/google-chrome'
1313
: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
1414

15-
const chromiumPack =
16-
'https://github.com/Sparticuz/chromium/releases/download/v121.0.0/chromium-v121.0.0-pack.tar'
17-
1815
const Localoptions = {
1916
args: [],
2017
executablePath: exePath,
2118
headless: true,
2219
}
23-
await chromium.font(
24-
'https://raw.githack.com/dev-protocol/stackroom/main/fonts/IBM_Plex_Sans_JP/IBMPlexSansJP-Medium.ttf',
25-
)
26-
await chromium.font(
27-
'https://raw.githack.com/googlei18n/noto-emoji/master/fonts/NotoColorEmoji.ttf',
28-
)
2920
const serverOptions = {
3021
args: chromium.args,
31-
executablePath: await chromium.executablePath(chromiumPack),
22+
executablePath: await chromium.executablePath(),
3223
headless: true,
24+
ignoreHTTPSErrors: true,
3325
}
3426
const puppeteerLifeCycleEvents = [
3527
'load',
@@ -41,7 +33,7 @@ const puppeteerLifeCycleEvents = [
4133
export const handler: Handler = async (
4234
event: APIGatewayEvent,
4335
): Promise<APIGatewayProxyResult> => {
44-
const url = new URL(event.path)
36+
const url = new URL(event.path, 'http://localhost')
4537
const { isDev, height, width, cacheControl, gotoThenWaitUntil } = {
4638
isDev: url.searchParams.get('dev') === 'true',
4739
height: url.searchParams.get('h'),

yarn.lock

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,13 @@ __metadata:
445445
languageName: node
446446
linkType: hard
447447

448-
"@sparticuz/chromium-min@npm:^130.0.0":
449-
version: 130.0.0
450-
resolution: "@sparticuz/chromium-min@npm:130.0.0"
448+
"@sparticuz/chromium@npm:^132.0.0":
449+
version: 132.0.0
450+
resolution: "@sparticuz/chromium@npm:132.0.0"
451451
dependencies:
452452
follow-redirects: "npm:^1.15.9"
453-
tar-fs: "npm:^3.0.6"
454-
checksum: 10c0/4d52a326b1cf57eef666f1f442fc57a759ce26b9e5198d2c924fd66c466fa6c0096f59cbbc694beee8c1c43057d43a9a5da9cfbd41b5f3c44ba24bc72b386ffa
453+
tar-fs: "npm:^3.0.8"
454+
checksum: 10c0/7c9a0bfa1d2485741bc1faf1f048635f4927f8971735e8c1ad397a9f31f892841da5b064bdfa8cc3639d3e13ef8cb12ffd0cf5e358d7828146eb2b84a615a2d6
455455
languageName: node
456456
linkType: hard
457457

@@ -984,13 +984,31 @@ __metadata:
984984
languageName: node
985985
linkType: hard
986986

987+
"bare-fs@npm:^4.0.1":
988+
version: 4.0.1
989+
resolution: "bare-fs@npm:4.0.1"
990+
dependencies:
991+
bare-events: "npm:^2.0.0"
992+
bare-path: "npm:^3.0.0"
993+
bare-stream: "npm:^2.0.0"
994+
checksum: 10c0/db2f4e2646faa011e322cbdc4615fe0cac865a03c2f76d7c686eccf96b0b5eea2bc71dfa37e8cfb14f4f61f8cd3ca95ff7b745d37c55fca319e40ec351d4ae0c
995+
languageName: node
996+
linkType: hard
997+
987998
"bare-os@npm:^2.1.0":
988999
version: 2.4.4
9891000
resolution: "bare-os@npm:2.4.4"
9901001
checksum: 10c0/e7d1a7b2100c05da8d25b60d0d48cf850c6f57064577a3f2f51cf18d417fbcfd6967ed2d8314320914ed69e0f2ebcf54eb1b36092dd172d8e8f969cf8cccf041
9911002
languageName: node
9921003
linkType: hard
9931004

1005+
"bare-os@npm:^3.0.1":
1006+
version: 3.4.0
1007+
resolution: "bare-os@npm:3.4.0"
1008+
checksum: 10c0/2d1a4467ef8aff0a13d738e549aac30bbecf7631721f7099de78d6f8fc0ced9334ab391e489de28d69809f788f64081ac25108303a9a9e122f9bf87a8d589025
1009+
languageName: node
1010+
linkType: hard
1011+
9941012
"bare-path@npm:^2.0.0, bare-path@npm:^2.1.0":
9951013
version: 2.1.3
9961014
resolution: "bare-path@npm:2.1.3"
@@ -1000,6 +1018,15 @@ __metadata:
10001018
languageName: node
10011019
linkType: hard
10021020

1021+
"bare-path@npm:^3.0.0":
1022+
version: 3.0.0
1023+
resolution: "bare-path@npm:3.0.0"
1024+
dependencies:
1025+
bare-os: "npm:^3.0.1"
1026+
checksum: 10c0/56a3ca82a9f808f4976cb1188640ac206546ce0ddff582afafc7bd2a6a5b31c3bd16422653aec656eeada2830cfbaa433c6cbf6d6b4d9eba033d5e06d60d9a68
1027+
languageName: node
1028+
linkType: hard
1029+
10031030
"bare-stream@npm:^2.0.0":
10041031
version: 2.3.0
10051032
resolution: "bare-stream@npm:2.3.0"
@@ -3333,6 +3360,23 @@ __metadata:
33333360
languageName: node
33343361
linkType: hard
33353362

3363+
"tar-fs@npm:^3.0.8":
3364+
version: 3.0.8
3365+
resolution: "tar-fs@npm:3.0.8"
3366+
dependencies:
3367+
bare-fs: "npm:^4.0.1"
3368+
bare-path: "npm:^3.0.0"
3369+
pump: "npm:^3.0.0"
3370+
tar-stream: "npm:^3.1.5"
3371+
dependenciesMeta:
3372+
bare-fs:
3373+
optional: true
3374+
bare-path:
3375+
optional: true
3376+
checksum: 10c0/b70bb2ad0490ab13b48edd10bd648bb54c52b681981cdcdc3aa4517e98ad94c94659ddca1925872ee658d781b9fcdd2b1c808050647f06b1bca157dd2fcae038
3377+
languageName: node
3378+
linkType: hard
3379+
33363380
"tar-stream@npm:^3.1.5":
33373381
version: 3.1.7
33383382
resolution: "tar-stream@npm:3.1.7"
@@ -3368,7 +3412,7 @@ __metadata:
33683412
"@rollup/plugin-json": "npm:^6.1.0"
33693413
"@rollup/plugin-node-resolve": "npm:^16.0.0"
33703414
"@rollup/plugin-typescript": "npm:^12.1.2"
3371-
"@sparticuz/chromium-min": "npm:^130.0.0"
3415+
"@sparticuz/chromium": "npm:^132.0.0"
33723416
"@types/aws-lambda": "npm:^8.10.147"
33733417
"@types/dotenv": "npm:8.2.3"
33743418
"@types/eslint-config-prettier": "npm:^6.11.3"

0 commit comments

Comments
 (0)