nodejs_chromium 1.1.23 → 1.1.25

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.
Files changed (2) hide show
  1. package/index.js +7 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -66,6 +66,7 @@ async function newBrowser(params) {
66
66
  incognito = true, //使用无痕模式启动
67
67
  path = void 0, //Chrome路径,linux下必填
68
68
  slowMo = 1, //每一步停留时间
69
+ clean = false, //启动前清空上次会话
69
70
  env = void 0, //string,指定浏览器可见的环境变量。process.env 的内容。
70
71
  proxy = null, //代理,如:https://proxy.com:789/
71
72
  wait = true, //是否等待初始页面准备好。当用户明确禁用该功能时很有用(例如 Chrome 的 --no-startup-window)
@@ -73,7 +74,7 @@ async function newBrowser(params) {
73
74
  } = params;
74
75
 
75
76
  const userDataDir = `runtime/.cache/${id}`;
76
- await NormalClose(userDataDir); // 在启动前修改,禁止显示【要恢复页面吗?chromium 未正确关闭。】
77
+ if (clean) await NormalClose(userDataDir); // 在启动前修改,禁止显示【要恢复页面吗?chromium 未正确关闭。】
77
78
 
78
79
  let option = {
79
80
  userDataDir,
@@ -115,6 +116,11 @@ async function newBrowser(params) {
115
116
  '--lang=zh-CN', //设置中文环境
116
117
  '--disable-extensions', //禁止启动扩展
117
118
  '--disable-dev-shm-usage', //Linux系统中使用普通的文件系统缓存避免因为/dev/shm大小不足而导致的问题
119
+
120
+ '--no-zygote', //禁用 Zygote 进程,减少进程创建开销
121
+ '--single-process', // 单进程运行(适合简单任务,减少进程通信开销)
122
+ '--disable-images', // 非必要时禁用图片加载(大幅提速)
123
+
118
124
  ]
119
125
  }
120
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodejs_chromium",
3
- "version": "1.1.23",
3
+ "version": "1.1.25",
4
4
  "type": "module",
5
5
  "description": "for pupeteer chromium",
6
6
  "main": "index.js",