dsh-web-fetch-playwright 0.2.5 → 0.2.6
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/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/dsh.plugin.json +1 -1
- package/lib/client.js +22 -22
- package/lib/index.js +5 -3
- package/lib/types/playwright-resolve.d.ts +3 -1
- package/package.json +2 -2
- package/src/playwright-resolve.ts +5 -3
package/README.md
CHANGED
|
@@ -81,6 +81,8 @@ Local backend resolution order:
|
|
|
81
81
|
2. A `playwright` executable on `$PATH` (its package knows that installation's browser registry).
|
|
82
82
|
3. The bundled `playwright-core` — requires `PLAYWRIGHT_BROWSERS_PATH` or browsers in the default cache; otherwise the error suggests `playwright install chromium`.
|
|
83
83
|
|
|
84
|
+
> **Windows note** — `$PATH` is scanned with the platform delimiter (`;`), but npm/pnpm global installs expose `playwright` as `.cmd`/`.ps1` shims whose location does not walk up to the package root, so discovery may still land on step 3 (the bundled core). To drive a specific installation's browser registry, point `playwrightPath` at the `playwright` package directory or a browser executable.
|
|
85
|
+
|
|
84
86
|
CDP mode needs no local browser: the provider holds **one shared connection** for its lifetime (reconnecting automatically if it drops, and reconnecting to the new endpoint when the setting changes), and every fetch leases a tab in the remote browser that closes when the fetch completes. Concurrency therefore counts tabs, which is why the CDP default is high (50). Unloading the plugin drops the shared connection (the remote browser itself is never closed).
|
|
85
87
|
|
|
86
88
|
### The CDP context modes (share the browser's profile or not)
|
package/README.zh-CN.md
CHANGED
|
@@ -81,6 +81,8 @@ bundle 插件加入 profile 层栈后需**重启 `dsh web`** 生效;卸载用
|
|
|
81
81
|
2. `$PATH` 上的 `playwright`(其包自带该安装的浏览器注册表);
|
|
82
82
|
3. 插件内置的 `playwright-core`——需要 `PLAYWRIGHT_BROWSERS_PATH` 或默认缓存里有浏览器,否则报错会提示 `playwright install chromium`。
|
|
83
83
|
|
|
84
|
+
> **Windows 说明** —— `$PATH` 已按平台分隔符(`;`)扫描,但 npm/pnpm 全局安装暴露的 `playwright` 是 `.cmd`/`.ps1` 垫片,从垫片位置向上找不到包根,自动发现可能仍落在第 3 步(内置 core)。要使用指定安装的浏览器注册表,请把 `playwrightPath` 显式指向 `playwright` 包目录或浏览器二进制。
|
|
85
|
+
|
|
84
86
|
CDP 模式不需要本地浏览器:插件在生命周期内对远端浏览器保持**一条共享连接**(连接断开自动重连,地址改动后自动换连),每次抓取只租用远端浏览器里的一个标签页,抓取结束即关闭。因此并发数按"标签页"计,默认也更高(50)。插件卸载时断开共享连接(绝不会关闭远端浏览器本身)。
|
|
85
87
|
|
|
86
88
|
### CDP 上下文模式(是否共享浏览器 profile)
|
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-web-fetch-playwright",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Playwright/CDP web-fetch provider for DeepSeek Harness: renders pages in a real browser, denoises them (Readability + DOMPurify), and returns markdown.",
|
|
5
5
|
"entry": {
|
|
6
6
|
"name": "dsh-web-fetch-playwright",
|
package/lib/client.js
CHANGED
|
@@ -390,21 +390,21 @@ window.__ModuleLoader__.load({
|
|
|
390
390
|
document.head.appendChild(tag);
|
|
391
391
|
}
|
|
392
392
|
var PluginCard_module_css_default = {
|
|
393
|
-
"footer": "UM8-Rq_footer",
|
|
394
393
|
"pending": "UM8-Rq_pending",
|
|
395
|
-
"
|
|
396
|
-
"
|
|
394
|
+
"chevron": "UM8-Rq_chevron",
|
|
395
|
+
"header": "UM8-Rq_header",
|
|
397
396
|
"headText": "UM8-Rq_headText",
|
|
398
397
|
"card": "UM8-Rq_card",
|
|
399
|
-
"chevronOpen": "UM8-Rq_chevronOpen",
|
|
400
398
|
"body": "UM8-Rq_body",
|
|
399
|
+
"readOnly": "UM8-Rq_readOnly",
|
|
401
400
|
"description": "UM8-Rq_description",
|
|
401
|
+
"chevronOpen": "UM8-Rq_chevronOpen",
|
|
402
|
+
"discard": "UM8-Rq_discard",
|
|
403
|
+
"footer": "UM8-Rq_footer",
|
|
402
404
|
"failed": "UM8-Rq_failed",
|
|
403
|
-
"header": "UM8-Rq_header",
|
|
404
405
|
"name": "UM8-Rq_name",
|
|
405
|
-
"
|
|
406
|
-
"
|
|
407
|
-
"readOnly": "UM8-Rq_readOnly"
|
|
406
|
+
"cardOpen": "UM8-Rq_cardOpen",
|
|
407
|
+
"save": "UM8-Rq_save"
|
|
408
408
|
};
|
|
409
409
|
//#endregion
|
|
410
410
|
//#region src/client/PluginCard.tsx
|
|
@@ -521,26 +521,26 @@ window.__ModuleLoader__.load({
|
|
|
521
521
|
document.head.appendChild(tag);
|
|
522
522
|
}
|
|
523
523
|
var fields_module_css_default = {
|
|
524
|
-
"radioContent": "CFSaVG_radioContent",
|
|
525
|
-
"hintIndented": "CFSaVG_hintIndented",
|
|
526
|
-
"radioGroup": "CFSaVG_radioGroup",
|
|
527
|
-
"input": "CFSaVG_input",
|
|
528
|
-
"radioLabel": "CFSaVG_radioLabel",
|
|
529
|
-
"radioPick": "CFSaVG_radioPick",
|
|
530
|
-
"badges": "CFSaVG_badges",
|
|
531
|
-
"badge": "CFSaVG_badge",
|
|
532
524
|
"fieldEmbedded": "CFSaVG_fieldEmbedded",
|
|
533
|
-
"hint": "CFSaVG_hint",
|
|
534
525
|
"reset": "CFSaVG_reset",
|
|
535
|
-
"field": "CFSaVG_field",
|
|
536
|
-
"head": "CFSaVG_head",
|
|
537
|
-
"checkboxRow": "CFSaVG_checkboxRow",
|
|
538
526
|
"label": "CFSaVG_label",
|
|
527
|
+
"hintIndented": "CFSaVG_hintIndented",
|
|
539
528
|
"radioOption": "CFSaVG_radioOption",
|
|
529
|
+
"badges": "CFSaVG_badges",
|
|
540
530
|
"invalid": "CFSaVG_invalid",
|
|
541
|
-
"
|
|
531
|
+
"radioGroup": "CFSaVG_radioGroup",
|
|
532
|
+
"radioLabel": "CFSaVG_radioLabel",
|
|
533
|
+
"hint": "CFSaVG_hint",
|
|
534
|
+
"checkboxRow": "CFSaVG_checkboxRow",
|
|
542
535
|
"inputInvalid": "CFSaVG_inputInvalid",
|
|
543
|
-
"
|
|
536
|
+
"radioPick": "CFSaVG_radioPick",
|
|
537
|
+
"radioText": "CFSaVG_radioText",
|
|
538
|
+
"radioHint": "CFSaVG_radioHint",
|
|
539
|
+
"badge": "CFSaVG_badge",
|
|
540
|
+
"input": "CFSaVG_input",
|
|
541
|
+
"radioContent": "CFSaVG_radioContent",
|
|
542
|
+
"head": "CFSaVG_head",
|
|
543
|
+
"field": "CFSaVG_field"
|
|
544
544
|
};
|
|
545
545
|
//#endregion
|
|
546
546
|
//#region src/client/fields.tsx
|
package/lib/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Readability } from "@mozilla/readability";
|
|
|
8
8
|
import TurndownService from "turndown";
|
|
9
9
|
import { gfm } from "@joplin/turndown-plugin-gfm";
|
|
10
10
|
import { accessSync, constants, readFileSync, realpathSync, statSync } from "node:fs";
|
|
11
|
-
import { dirname, join } from "node:path";
|
|
11
|
+
import { delimiter, dirname, join } from "node:path";
|
|
12
12
|
import { pathToFileURL } from "node:url";
|
|
13
13
|
//#region src/config.ts
|
|
14
14
|
/**
|
|
@@ -693,13 +693,15 @@ const EXECUTABLE_MAGICS = [
|
|
|
693
693
|
Buffer.from([77, 90])
|
|
694
694
|
];
|
|
695
695
|
/**
|
|
696
|
-
* Find `name` as an executable file on `$PATH
|
|
696
|
+
* Find `name` as an executable file on `$PATH`, split on the platform
|
|
697
|
+
* delimiter (`;` on Windows, `:` elsewhere — issue #1: a literal `:` made
|
|
698
|
+
* Windows discovery always miss).
|
|
697
699
|
* @param name - the executable basename.
|
|
698
700
|
* @returns the first matching path, or undefined.
|
|
699
701
|
*/
|
|
700
702
|
function findOnPath(name) {
|
|
701
703
|
const pathValue = process.env.PATH ?? "";
|
|
702
|
-
for (const dir of pathValue.split(
|
|
704
|
+
for (const dir of pathValue.split(delimiter)) {
|
|
703
705
|
if (dir === "") continue;
|
|
704
706
|
const candidate = join(dir, name);
|
|
705
707
|
try {
|
|
@@ -26,7 +26,9 @@ export interface ResolvedPlaywright {
|
|
|
26
26
|
source: string;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Find `name` as an executable file on `$PATH
|
|
29
|
+
* Find `name` as an executable file on `$PATH`, split on the platform
|
|
30
|
+
* delimiter (`;` on Windows, `:` elsewhere — issue #1: a literal `:` made
|
|
31
|
+
* Windows discovery always miss).
|
|
30
32
|
* @param name - the executable basename.
|
|
31
33
|
* @returns the first matching path, or undefined.
|
|
32
34
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-web-fetch-playwright",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Playwright/CDP web-fetch provider for DeepSeek Harness: renders pages in a real browser, denoises them (Readability + DOMPurify), and returns markdown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"LICENSE"
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "
|
|
35
|
+
"build": "node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\" && tsc -p tsconfig.build.json --emitDeclarationOnly && tsdown",
|
|
36
36
|
"prepare": "pnpm run build",
|
|
37
37
|
"prepublishOnly": "pnpm run build",
|
|
38
38
|
"typecheck": "tsc --noEmit",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { accessSync, constants, readFileSync, realpathSync, statSync } from 'node:fs'
|
|
20
|
-
import { dirname, join } from 'node:path'
|
|
20
|
+
import { delimiter, dirname, join } from 'node:path'
|
|
21
21
|
import { createRequire } from 'node:module'
|
|
22
22
|
import { pathToFileURL } from 'node:url'
|
|
23
23
|
import type { PlaywrightChromium } from './types.ts'
|
|
@@ -41,13 +41,15 @@ export interface ResolvedPlaywright {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Find `name` as an executable file on `$PATH
|
|
44
|
+
* Find `name` as an executable file on `$PATH`, split on the platform
|
|
45
|
+
* delimiter (`;` on Windows, `:` elsewhere — issue #1: a literal `:` made
|
|
46
|
+
* Windows discovery always miss).
|
|
45
47
|
* @param name - the executable basename.
|
|
46
48
|
* @returns the first matching path, or undefined.
|
|
47
49
|
*/
|
|
48
50
|
export function findOnPath(name: string): string | undefined {
|
|
49
51
|
const pathValue = process.env.PATH ?? ''
|
|
50
|
-
for (const dir of pathValue.split(
|
|
52
|
+
for (const dir of pathValue.split(delimiter)) {
|
|
51
53
|
if (dir === '') continue
|
|
52
54
|
const candidate = join(dir, name)
|
|
53
55
|
try {
|