@browserless.io/browserless 2.17.1 → 2.18.0
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/CHANGELOG.md +8 -1
- package/build/http.d.ts +41 -41
- package/build/http.js +41 -41
- package/build/routes/chrome/http/content.post.body.json +8 -8
- package/build/routes/chrome/http/pdf.post.body.json +8 -8
- package/build/routes/chrome/http/scrape.post.body.json +8 -8
- package/build/routes/chrome/http/screenshot.post.body.json +8 -8
- package/build/routes/chromium/http/content.post.body.json +8 -8
- package/build/routes/chromium/http/pdf.post.body.json +8 -8
- package/build/routes/chromium/http/scrape.post.body.json +8 -8
- package/build/routes/chromium/http/screenshot.post.body.json +8 -8
- package/build/shared/utils/function/handler.js +3 -2
- package/package.json +7 -7
- package/scripts/build-open-api.js +4 -3
- package/src/http.ts +41 -41
- package/src/shared/utils/function/handler.ts +3 -3
- package/static/docs/swagger.json +12 -12
- package/static/docs/swagger.min.json +11 -11
- package/static/function/client.js +1 -1
- package/static/function/index.html +1 -1
|
@@ -3,9 +3,10 @@ import fs from 'fs';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
export default (config, logger, options = {}) => async (req, browser) => {
|
|
5
5
|
const isJson = req.headers['content-type']?.includes('json');
|
|
6
|
+
const functionPath = HTTPRoutes.function.replace('?(/)', '');
|
|
6
7
|
const functionAssetLocation = path.join(config.getStatic(), 'function');
|
|
7
|
-
const functionRequestPath = makeExternalURL(config.getExternalAddress(),
|
|
8
|
-
const functionIndexHTML = makeExternalURL(config.getExternalAddress(),
|
|
8
|
+
const functionRequestPath = makeExternalURL(config.getExternalAddress(), functionPath);
|
|
9
|
+
const functionIndexHTML = makeExternalURL(config.getExternalAddress(), functionPath, '/index.html');
|
|
9
10
|
const { code: rawCode, context: rawContext } = isJson
|
|
10
11
|
? req.body
|
|
11
12
|
: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browserless.io/browserless",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"license": "SSPL",
|
|
5
5
|
"description": "The browserless platform",
|
|
6
6
|
"author": "browserless.io",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"playwright-1.42": "npm:playwright-core@1.42.1",
|
|
62
62
|
"playwright-1.43": "npm:playwright-core@1.43.1",
|
|
63
63
|
"playwright-1.44": "npm:playwright-core@1.44.1",
|
|
64
|
-
"playwright-core": "^1.46.
|
|
65
|
-
"puppeteer-core": "^23.1.
|
|
64
|
+
"playwright-core": "^1.46.1",
|
|
65
|
+
"puppeteer-core": "^23.1.1",
|
|
66
66
|
"puppeteer-extra": "^3.3.6",
|
|
67
67
|
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
|
68
68
|
"queue": "^7.0.0",
|
|
69
|
-
"systeminformation": "^5.23.
|
|
69
|
+
"systeminformation": "^5.23.5",
|
|
70
70
|
"tar-fs": "^3.0.6"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/http-proxy": "^1.17.15",
|
|
77
77
|
"@types/micromatch": "^4.0.9",
|
|
78
78
|
"@types/mocha": "^10.0.7",
|
|
79
|
-
"@types/node": "^22.
|
|
79
|
+
"@types/node": "^22.5.0",
|
|
80
80
|
"@types/sinon": "^17.0.3",
|
|
81
81
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
82
82
|
"@typescript-eslint/parser": "^7.18.0",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"chai": "^5.1.1",
|
|
85
85
|
"cross-env": "^7.0.3",
|
|
86
86
|
"env-cmd": "^10.1.0",
|
|
87
|
-
"esbuild": "^0.23.
|
|
87
|
+
"esbuild": "^0.23.1",
|
|
88
88
|
"esbuild-plugin-polyfill-node": "^0.3.0",
|
|
89
89
|
"eslint": "^8.57.0",
|
|
90
90
|
"eslint-plugin-typescript-sort-keys": "^3.2.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"sinon": "^18.0.0",
|
|
98
98
|
"ts-node": "^10.9.2",
|
|
99
99
|
"typescript": "^5.5.4",
|
|
100
|
-
"typescript-json-schema": "^0.
|
|
100
|
+
"typescript-json-schema": "^0.65.1"
|
|
101
101
|
},
|
|
102
102
|
"playwrightVersions": {
|
|
103
103
|
"default": "playwright-core",
|
|
@@ -109,9 +109,10 @@ const buildOpenAPI = async (
|
|
|
109
109
|
const query = routeModule.replace('.js', '.query.json');
|
|
110
110
|
const response = routeModule.replace('.js', '.response.json');
|
|
111
111
|
const isWebSocket = routeModule.includes('/ws/') || name.endsWith('ws');
|
|
112
|
-
const path =
|
|
113
|
-
? route.path.join(' ')
|
|
114
|
-
|
|
112
|
+
const path = (
|
|
113
|
+
Array.isArray(route.path) ? route.path.join(' ') : route.path
|
|
114
|
+
).replace(/\?\(\/\)/g, '');
|
|
115
|
+
|
|
115
116
|
const {
|
|
116
117
|
tags,
|
|
117
118
|
description,
|
package/src/http.ts
CHANGED
|
@@ -82,54 +82,54 @@ export enum Methods {
|
|
|
82
82
|
export enum WebsocketRoutes {
|
|
83
83
|
'/' = '?(/)',
|
|
84
84
|
browser = '/devtools/browser/*',
|
|
85
|
-
chrome = '/chrome',
|
|
86
|
-
chromePlaywright = '/chrome/playwright',
|
|
87
|
-
chromium = '/chromium',
|
|
88
|
-
chromiumPlaywright = '/chromium/playwright',
|
|
89
|
-
firefoxPlaywright = '/firefox/playwright',
|
|
85
|
+
chrome = '/chrome?(/)',
|
|
86
|
+
chromePlaywright = '/chrome/playwright?(/)',
|
|
87
|
+
chromium = '/chromium?(/)',
|
|
88
|
+
chromiumPlaywright = '/chromium/playwright?(/)',
|
|
89
|
+
firefoxPlaywright = '/firefox/playwright?(/)',
|
|
90
90
|
page = '/devtools/page/*',
|
|
91
|
-
playwrightChrome = '/playwright/chrome',
|
|
92
|
-
playwrightChromium = '/playwright/chromium',
|
|
93
|
-
playwrightFirefox = '/playwright/firefox',
|
|
94
|
-
playwrightWebkit = '/playwright/webkit',
|
|
95
|
-
webkitPlaywright = '/webkit/playwright',
|
|
91
|
+
playwrightChrome = '/playwright/chrome?(/)',
|
|
92
|
+
playwrightChromium = '/playwright/chromium?(/)',
|
|
93
|
+
playwrightFirefox = '/playwright/firefox?(/)',
|
|
94
|
+
playwrightWebkit = '/playwright/webkit?(/)',
|
|
95
|
+
webkitPlaywright = '/webkit/playwright?(/)',
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export enum HTTPRoutes {
|
|
99
|
-
chromeContent = '/chrome/content',
|
|
100
|
-
chromeDownload = '/chrome/download',
|
|
101
|
-
chromeFunction = '/chrome/function',
|
|
102
|
-
chromePdf = '/chrome/pdf',
|
|
103
|
-
chromePerformance = '/chrome/performance',
|
|
104
|
-
chromeScrape = '/chrome/scrape',
|
|
105
|
-
chromeScreenshot = '/chrome/screenshot',
|
|
106
|
-
chromiumContent = '/chromium/content',
|
|
107
|
-
chromiumDownload = '/chromium/download',
|
|
108
|
-
chromiumFunction = '/chromium/function',
|
|
109
|
-
chromiumPdf = '/chromium/pdf',
|
|
110
|
-
chromiumPerformance = '/chromium/performance',
|
|
111
|
-
chromiumScrape = '/chromium/scrape',
|
|
112
|
-
chromiumScreenshot = '/chromium/screenshot',
|
|
113
|
-
content = '/content',
|
|
114
|
-
download = '/download',
|
|
115
|
-
function = '/function',
|
|
116
|
-
jsonList = '/json/list',
|
|
117
|
-
jsonNew = '/json/new',
|
|
118
|
-
jsonProtocol = '/json/protocol',
|
|
119
|
-
jsonVersion = '/json/version',
|
|
120
|
-
pdf = '/pdf',
|
|
121
|
-
performance = '/performance',
|
|
122
|
-
scrape = '/scrape',
|
|
123
|
-
screenshot = '/screenshot',
|
|
99
|
+
chromeContent = '/chrome/content?(/)',
|
|
100
|
+
chromeDownload = '/chrome/download?(/)',
|
|
101
|
+
chromeFunction = '/chrome/function?(/)',
|
|
102
|
+
chromePdf = '/chrome/pdf?(/)',
|
|
103
|
+
chromePerformance = '/chrome/performance?(/)',
|
|
104
|
+
chromeScrape = '/chrome/scrape?(/)',
|
|
105
|
+
chromeScreenshot = '/chrome/screenshot?(/)',
|
|
106
|
+
chromiumContent = '/chromium/content?(/)',
|
|
107
|
+
chromiumDownload = '/chromium/download?(/)',
|
|
108
|
+
chromiumFunction = '/chromium/function?(/)',
|
|
109
|
+
chromiumPdf = '/chromium/pdf?(/)',
|
|
110
|
+
chromiumPerformance = '/chromium/performance?(/)',
|
|
111
|
+
chromiumScrape = '/chromium/scrape?(/)',
|
|
112
|
+
chromiumScreenshot = '/chromium/screenshot?(/)',
|
|
113
|
+
content = '/content?(/)',
|
|
114
|
+
download = '/download?(/)',
|
|
115
|
+
function = '/function?(/)',
|
|
116
|
+
jsonList = '/json/list?(/)',
|
|
117
|
+
jsonNew = '/json/new?(/)',
|
|
118
|
+
jsonProtocol = '/json/protocol?(/)',
|
|
119
|
+
jsonVersion = '/json/version?(/)',
|
|
120
|
+
pdf = '/pdf?(/)',
|
|
121
|
+
performance = '/performance?(/)',
|
|
122
|
+
scrape = '/scrape?(/)',
|
|
123
|
+
screenshot = '/screenshot?(/)',
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export enum HTTPManagementRoutes {
|
|
127
|
-
active = '/active',
|
|
128
|
-
config = '/config',
|
|
129
|
-
metrics = '/metrics',
|
|
130
|
-
metricsTotal = '/metrics/total',
|
|
131
|
-
pressure = '/pressure',
|
|
132
|
-
sessions = '/sessions',
|
|
127
|
+
active = '/active?(/)',
|
|
128
|
+
config = '/config?(/)',
|
|
129
|
+
metrics = '/metrics?(/)',
|
|
130
|
+
metricsTotal = '/metrics/total?(/)',
|
|
131
|
+
pressure = '/pressure?(/)',
|
|
132
|
+
sessions = '/sessions?(/)',
|
|
133
133
|
static = '/',
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -41,15 +41,15 @@ export default (config: Config, logger: Logger, options: HandlerOptions = {}) =>
|
|
|
41
41
|
browser: BrowserInstance,
|
|
42
42
|
): Promise<{ contentType: string; page: Page; payload: unknown }> => {
|
|
43
43
|
const isJson = req.headers['content-type']?.includes('json');
|
|
44
|
-
|
|
44
|
+
const functionPath = HTTPRoutes.function.replace('?(/)', '');
|
|
45
45
|
const functionAssetLocation = path.join(config.getStatic(), 'function');
|
|
46
46
|
const functionRequestPath = makeExternalURL(
|
|
47
47
|
config.getExternalAddress(),
|
|
48
|
-
|
|
48
|
+
functionPath,
|
|
49
49
|
);
|
|
50
50
|
const functionIndexHTML = makeExternalURL(
|
|
51
51
|
config.getExternalAddress(),
|
|
52
|
-
|
|
52
|
+
functionPath,
|
|
53
53
|
'/index.html',
|
|
54
54
|
);
|
|
55
55
|
|