@karinjs/plugin-puppeteer 1.0.20 → 1.1.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.
@@ -6,7 +6,7 @@ import { basePath } from 'node-karin/root';
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@karinjs/plugin-puppeteer",
9
- version: "1.0.20",
9
+ version: "1.1.0",
10
10
  description: "karin\u7684 puppeteer\u622A\u56FE\u3001\u6E32\u67D3\u63D2\u4EF6",
11
11
  keywords: [
12
12
  "karin",
@@ -22,24 +22,21 @@ var package_default = {
22
22
  main: "dist/index.js",
23
23
  types: "dist/index.d.ts",
24
24
  files: [
25
- "dist",
26
- "!LICENSE",
27
- "!README.md"
25
+ "dist"
28
26
  ],
29
27
  scripts: {
30
28
  build: "tsc && tsup",
31
- dev: "tsx src/index.ts",
29
+ dev: "tsx src/app.ts",
32
30
  "dev:test": "node dist/index.js",
33
31
  pub: "pnpm publish --access public",
34
32
  rm: `node -e "require('fs').rmSync('dist', { recursive: true, force: true })"`,
35
33
  sync: 'curl -X PUT "https://registry-direct.npmmirror.com/-/package/@karinjs/plugin-puppeteer/syncs"'
36
34
  },
37
35
  dependencies: {
38
- "@karinjs/puppeteer": "workspace:*"
36
+ "@snapka/puppeteer": "0.1.3"
39
37
  },
40
38
  devDependencies: {
41
- "@karinjs/puppeteer-types": "workspace:*",
42
- "node-karin": "^1.7.12"
39
+ "node-karin": "^1.13.0"
43
40
  },
44
41
  karin: {
45
42
  main: "src/index.ts",
@@ -48,49 +45,30 @@ var package_default = {
48
45
  "ts-web": "src/web.config.ts",
49
46
  files: [
50
47
  "config"
51
- ],
52
- env: [
53
- {
54
- key: "PUPPETEER_CACHE_DIR",
55
- value: "",
56
- comment: "Puppeteer\u7F13\u5B58\u7684\u9ED8\u8BA4\u6839\u76EE\u5F55"
57
- },
58
- {
59
- key: "PUPPETEER_CACHE_VERSION",
60
- value: "",
61
- comment: "\u8BB0\u5F55puppeteer\u4E0B\u8F7D\u8FC7\u7684\u6D4F\u89C8\u5668\u4FE1\u606F"
62
- },
63
- {
64
- key: "PUPPETEER_CHROME_HEADLESS_SHELL_VERSION",
65
- value: "",
66
- comment: "Puppeteer\u4E0B\u8F7D\u6D4F\u89C8\u5668\u7684\u7248\u672C"
67
- },
68
- {
69
- key: "PUPPETEER_EXECUTABLE_PATH",
70
- value: "",
71
- comment: "Puppeteer\u53EF\u6267\u884C\u6587\u4EF6\u8DEF\u5F84 \u914D\u7F6E\u540E\u5C06\u4F7F\u7528\u6B64\u8DEF\u5F84\u7684\u6D4F\u89C8\u5668"
72
- },
73
- {
74
- key: "PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL",
75
- value: "",
76
- comment: "Puppeteer\u6D4F\u89C8\u5668host\u5730\u5740"
77
- }
78
48
  ]
79
49
  },
80
50
  timestamp: "2025-10-01T00:47:22.222Z"
81
51
  };
82
52
  var HMR_KEY = "karin-plugin-puppeteer-hmr";
83
53
  var defaultConfig = {
84
- downloadBrowser: "chrome",
85
54
  protocol: "cdp",
86
- headless: true,
55
+ headless: "shell",
87
56
  debug: false,
88
- maxPages: 10,
89
- idleTime: 500,
90
- hmr: false,
91
- executablePath: "",
92
- pipe: false,
93
- userDataDir: "",
57
+ findBrowser: true,
58
+ slowMo: 0,
59
+ maxOpenPages: 10,
60
+ pageMode: "reuse",
61
+ pageIdleTimeout: 6e4,
62
+ retries: 2,
63
+ defaultViewport: {
64
+ width: 800,
65
+ height: 600
66
+ },
67
+ download: {
68
+ enable: true,
69
+ browser: "chrome-headless-shell",
70
+ version: "latest"
71
+ },
94
72
  args: [
95
73
  "--window-size=800,600",
96
74
  // 设置窗口大小
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
-
2
- export { }
1
+ export * from '@snapka/puppeteer';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
- import { getConfig, HMR_KEY, pluginVersion, pluginName } from './chunk-WMPJFMK4.js';
1
+ import { getConfig, HMR_KEY, pluginVersion, pluginName } from './chunk-CWS2WGE3.js';
2
2
  import path from 'node:path';
3
- import { launch } from '@karinjs/puppeteer';
3
+ import { snapka } from '@snapka/puppeteer';
4
+ export * from '@snapka/puppeteer';
4
5
  import { karin, registerRender, renderTpl, logger } from 'node-karin';
5
6
 
6
7
  var formatBytes = (bytes) => {
@@ -12,7 +13,7 @@ var formatBytes = (bytes) => {
12
13
  };
13
14
  var getScreenshotByteSize = (payload, encoding) => {
14
15
  try {
15
- if (payload == null) return void 0;
16
+ if (payload == null) return null;
16
17
  const enc = (encoding || "").toLowerCase();
17
18
  if (Array.isArray(payload)) {
18
19
  let total = 0;
@@ -36,35 +37,32 @@ var getScreenshotByteSize = (payload, encoding) => {
36
37
  if (anyPayload.buffer instanceof ArrayBuffer) return anyPayload.buffer.byteLength;
37
38
  if (typeof anyPayload.byteLength === "number") return anyPayload.byteLength;
38
39
  if (typeof anyPayload.length === "number") return anyPayload.length;
39
- return void 0;
40
+ return null;
40
41
  } catch {
41
- return void 0;
42
+ return null;
42
43
  }
43
44
  };
44
45
  var main = async () => {
45
46
  const config = getConfig();
46
- const browser = await launch(config);
47
- karin.on(HMR_KEY, (cfg) => browser.hmrConfig(cfg));
47
+ const browser = await snapka.launch(config);
48
+ karin.on(HMR_KEY, async () => {
49
+ await browser.restart();
50
+ });
48
51
  const name = "@karinjs/plugin-puppeteer";
49
52
  registerRender(name, async (options) => {
50
53
  options.encoding = "base64";
51
54
  const data = renderTpl(options);
52
55
  data.encoding = options.encoding;
53
56
  const time = Date.now();
54
- const result = await browser.screenshot(data);
57
+ const { run } = await browser.screenshot(data);
58
+ const result = await run();
55
59
  const fileName = typeof data?.file === "string" ? path.basename(data.file) : "unknown";
56
- if (!result.status) {
57
- logger.info(
58
- `[${name}][${fileName}] \u622A\u56FE\u5931\u8D25 \u8017\u65F6: ${logger.green(Date.now() - time + "")} ms`
59
- );
60
- throw new Error(result.data.message || "\u622A\u56FE\u5931\u8D25", { cause: result.data });
61
- }
62
- const sizeBytes = getScreenshotByteSize(result.data, options.encoding);
63
- const sizeStr = sizeBytes != null ? `\u5927\u5C0F: ${logger.green(formatBytes(sizeBytes))} ` : "";
60
+ const sizeBytes = getScreenshotByteSize(result, options.encoding);
61
+ const sizeStr = typeof sizeBytes === "number" ? `\u5927\u5C0F: ${logger.green(formatBytes(sizeBytes))} ` : "";
64
62
  logger.info(
65
63
  `[${name}][${fileName}] \u622A\u56FE\u5B8C\u6210 ${sizeStr}\u8017\u65F6: ${logger.green(Date.now() - time + "")} ms`
66
64
  );
67
- return result.data;
65
+ return result;
68
66
  });
69
67
  logger.info(`${logger.violet(`[\u63D2\u4EF6:${pluginVersion}]`)} ${logger.green(pluginName)} \u521D\u59CB\u5316\u5B8C\u6210~`);
70
68
  };
@@ -1,10 +1,10 @@
1
- import { LaunchOptions } from '@karinjs/puppeteer';
1
+ import { PuppeteerLaunchOptions } from '@snapka/puppeteer';
2
2
  import { GetConfigResponse, ComponentConfig } from 'node-karin';
3
3
 
4
4
  declare const webConfig: {
5
5
  info: GetConfigResponse['info'];
6
6
  components: () => ComponentConfig[];
7
- save: (config: LaunchOptions) => {
7
+ save: (config: PuppeteerLaunchOptions) => {
8
8
  success: boolean;
9
9
  message: string;
10
10
  };
@@ -1,4 +1,4 @@
1
- import { package_default, saveConfig, getConfig } from './chunk-WMPJFMK4.js';
1
+ import { package_default, saveConfig, getConfig } from './chunk-CWS2WGE3.js';
2
2
  import { components } from 'node-karin';
3
3
 
4
4
  var webConfig = {
@@ -25,22 +25,54 @@ var webConfig = {
25
25
  components: () => {
26
26
  const config = getConfig();
27
27
  return [
28
+ components.switch.create("downloadEnable", {
29
+ label: "\u542F\u7528\u6D4F\u89C8\u5668\u4E0B\u8F7D",
30
+ description: "\u662F\u5426\u542F\u7528\u6D4F\u89C8\u5668\u81EA\u52A8\u4E0B\u8F7D\u529F\u80FD",
31
+ defaultSelected: config.download?.enable !== false,
32
+ color: "success"
33
+ }),
28
34
  components.radio.group("downloadBrowser", {
29
35
  label: "\u4E0B\u8F7D\u7684\u6D4F\u89C8\u5668",
30
36
  orientation: "horizontal",
31
- description: "\u6CA1\u6709\u6D4F\u89C8\u5668\u65F6\uFF0C\u4E0B\u8F7D\u7684\u6D4F\u89C8\u5668\u7248\u672C\uFF0Clinux\u63A8\u8350 chrome-headless-shell",
32
- defaultValue: config.downloadBrowser,
37
+ description: "\u6CA1\u6709\u6D4F\u89C8\u5668\u65F6\uFF0C\u4E0B\u8F7D\u7684\u6D4F\u89C8\u5668\u7C7B\u578B\uFF0Clinux\u63A8\u8350 chrome-headless-shell",
38
+ defaultValue: config.download?.browser || "chrome",
33
39
  radio: [
34
40
  components.radio.create("chrome", {
35
41
  label: "chrome",
36
42
  value: "chrome"
37
43
  }),
44
+ components.radio.create("chromium", {
45
+ label: "chromium",
46
+ value: "chromium"
47
+ }),
38
48
  components.radio.create("chrome-headless-shell", {
39
49
  label: "chrome-headless-shell",
40
50
  value: "chrome-headless-shell"
41
51
  })
42
52
  ]
43
53
  }),
54
+ components.input.string("downloadVersion", {
55
+ label: "\u4E0B\u8F7D\u6D4F\u89C8\u5668\u7248\u672C",
56
+ description: "\u652F\u6301\uFF1Alatest\u3001stable\u3001beta\u3001dev\u3001canary \u6216\u7279\u5B9A\u7248\u672C\u53F7",
57
+ defaultValue: config.download?.version || "stable",
58
+ isRequired: false,
59
+ className: "inline-block p-2"
60
+ }),
61
+ components.input.string("downloadDir", {
62
+ label: "\u4E0B\u8F7D\u76EE\u5F55",
63
+ description: "\u6D4F\u89C8\u5668\u4E0B\u8F7D\u4FDD\u5B58\u76EE\u5F55\uFF0C\u4E3A\u7A7A\u5219\u4F7F\u7528\u9ED8\u8BA4\u8DEF\u5F84",
64
+ defaultValue: config.download?.dir || "",
65
+ isRequired: false,
66
+ className: "inline-block p-2"
67
+ }),
68
+ components.input.string("downloadBaseUrl", {
69
+ label: "\u81EA\u5B9A\u4E49\u4E0B\u8F7D\u6E90",
70
+ description: "\u81EA\u5B9A\u4E49\u4E0B\u8F7D\u6E90URL\uFF0C\u4E0D\u5EFA\u8BAE\u8BBE\u7F6E",
71
+ defaultValue: config.download?.baseUrl || "",
72
+ isRequired: false,
73
+ className: "inline-block p-2"
74
+ }),
75
+ components.divider.create("divider0"),
44
76
  components.radio.group("protocol", {
45
77
  label: "protocol",
46
78
  orientation: "horizontal",
@@ -62,23 +94,24 @@ var webConfig = {
62
94
  components.divider.create("divider1"),
63
95
  components.radio.group("headless", {
64
96
  label: "\u65E0\u5934\u6A21\u5F0F",
65
- description: "\u662F\u5426\u65E0\u5934\u6A21\u5F0F\uFF0C\u65E0\u5934\u6A21\u5F0F\u4E0B\uFF0C\u6D4F\u89C8\u5668\u5C06\u540E\u53F0\u8FD0\u884C\uFF0C\u4E0D\u4F1A\u6253\u5F00\u6D4F\u89C8\u5668\u7A97\u53E3",
66
- defaultValue: String(config.headless),
97
+ orientation: "horizontal",
98
+ description: "\u65E0\u5934\u6A21\u5F0F\u914D\u7F6E\uFF0C\u6700\u65B0\u7248chrome\u652F\u6301\u6240\u6709\u9009\u9879",
99
+ defaultValue: config.headless || "new",
67
100
  radio: [
68
- components.radio.create("headless:true", {
69
- label: "true",
70
- value: "true",
71
- description: "\u6253\u5F00\u65E0\u5934\u6A21\u5F0F"
72
- }),
73
- components.radio.create("headless:false", {
74
- label: "false",
75
- value: "false",
76
- description: "\u5173\u95ED\u65E0\u5934\u6A21\u5F0F"
101
+ components.radio.create("new", {
102
+ label: "new",
103
+ value: "new",
104
+ description: "\u4F7F\u7528\u65B0\u7684\u65E0\u5934\u6A21\u5F0F\uFF08\u63A8\u8350\uFF09"
77
105
  }),
78
106
  components.radio.create("shell", {
79
107
  label: "shell",
80
108
  value: "shell",
81
- description: "\u4F7F\u7528chrome-headless-shell"
109
+ description: "\u4F7F\u7528\u4F20\u7EDF\u65E0\u5934\u6A21\u5F0F\uFF08\u4EC5chrome-headless-shell\uFF09"
110
+ }),
111
+ components.radio.create("false", {
112
+ label: "false",
113
+ value: "false",
114
+ description: "\u4EE5\u6709\u5934\u6A21\u5F0F\u542F\u52A8\u6D4F\u89C8\u5668"
82
115
  })
83
116
  ]
84
117
  }),
@@ -89,6 +122,13 @@ var webConfig = {
89
122
  defaultSelected: config.debug,
90
123
  color: "success"
91
124
  }),
125
+ // findBrowser
126
+ components.switch.create("findBrowser", {
127
+ label: "\u81EA\u52A8\u67E5\u627E\u6D4F\u89C8\u5668",
128
+ description: "\u542F\u7528\u540E\u4F1A\u4F7F\u7528 @snapka/browser-finder \u67E5\u627E\u7CFB\u7EDF\u6D4F\u89C8\u5668\u3001puppeteer\u3001playwright\u4E0B\u8F7D\u7684\u6D4F\u89C8\u5668",
129
+ defaultSelected: config.findBrowser !== false,
130
+ color: "success"
131
+ }),
92
132
  // hmr
93
133
  components.switch.create("hmr", {
94
134
  label: "\u70ED\u66F4\u65B0",
@@ -104,11 +144,25 @@ var webConfig = {
104
144
  color: "success"
105
145
  }),
106
146
  components.divider.create("divider2"),
107
- // maxPages
108
- components.input.number("maxPages", {
147
+ // slowMo
148
+ components.input.number("slowMo", {
149
+ label: "\u6162\u52A8\u4F5C\u5EF6\u8FDF",
150
+ description: "\u64CD\u4F5C\u6162\u52A8\u4F5C\u5EF6\u8FDF\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09\uFF0C\u7528\u4E8E\u8C03\u8BD5",
151
+ defaultValue: (config.slowMo || 0) + "",
152
+ className: "inline-block p-2",
153
+ rules: [
154
+ {
155
+ min: 0,
156
+ max: 1e4,
157
+ error: "\u6162\u52A8\u4F5C\u5EF6\u8FDF\u5FC5\u987B\u57280-10000\u4E4B\u95F4"
158
+ }
159
+ ]
160
+ }),
161
+ // maxOpenPages
162
+ components.input.number("maxOpenPages", {
109
163
  label: "\u6700\u5927\u6807\u7B7E\u9875",
110
164
  description: "\u6700\u591A\u540C\u65F6\u6253\u5F00\u7684\u6807\u7B7E\u9875\u6570\u91CF\uFF0C\u8D85\u51FA\u540E\u5C06\u4F1A\u81EA\u52A8\u6392\u961F",
111
- defaultValue: config.maxPages + "",
165
+ defaultValue: (config.maxOpenPages || 10) + "",
112
166
  className: "inline-block p-2",
113
167
  rules: [
114
168
  {
@@ -118,17 +172,50 @@ var webConfig = {
118
172
  }
119
173
  ]
120
174
  }),
121
- // idleTime
122
- components.input.number("idleTime", {
123
- label: "\u7F51\u7EDC\u8BF7\u6C42\u7A7A\u95F2\u65F6\u95F4",
124
- description: "\u7F51\u7EDC\u8BF7\u6C42\u7A7A\u95F2\u65F6\u95F4\uFF0C\u5355\u4F4D\u4E3A\u6BEB\u79D2",
125
- defaultValue: config.idleTime + "",
175
+ // pageMode
176
+ components.radio.group("pageMode", {
177
+ label: "\u9875\u9762\u6A21\u5F0F",
178
+ orientation: "horizontal",
179
+ description: "\u9875\u9762\u7BA1\u7406\u6A21\u5F0F\uFF1A\u590D\u7528\u6A21\u5F0F\u6027\u80FD\u66F4\u597D\uFF0C\u4E00\u6B21\u6027\u6A21\u5F0F\u9694\u79BB\u6027\u66F4\u5F3A",
180
+ defaultValue: config.pageMode || "reuse",
181
+ radio: [
182
+ components.radio.create("reuse", {
183
+ label: "reuse",
184
+ value: "reuse",
185
+ description: "\u590D\u7528\u6A21\u5F0F\uFF08\u63A8\u8350\uFF09"
186
+ }),
187
+ components.radio.create("disposable", {
188
+ label: "disposable",
189
+ value: "disposable",
190
+ description: "\u4E00\u6B21\u6027\u6A21\u5F0F"
191
+ })
192
+ ]
193
+ }),
194
+ // pageIdleTimeout
195
+ components.input.number("pageIdleTimeout", {
196
+ label: "\u9875\u9762\u7A7A\u95F2\u8D85\u65F6",
197
+ description: "\u9875\u9762\u5728\u6C60\u4E2D\u7A7A\u95F2\u8D85\u8FC7\u6B64\u65F6\u95F4\u540E\u4F1A\u88AB\u81EA\u52A8\u9500\u6BC1\uFF08\u6BEB\u79D2\uFF09\uFF0C\u8BBE\u7F6E\u4E3A0\u8868\u793A\u6C38\u4E0D\u8D85\u65F6",
198
+ defaultValue: (config.pageIdleTimeout || 6e4) + "",
126
199
  className: "inline-block p-2",
127
200
  rules: [
128
201
  {
129
- min: 1,
130
- max: 999999,
131
- error: "\u7F51\u7EDC\u8BF7\u6C42\u7A7A\u95F2\u65F6\u95F4\u5FC5\u987B\u57281-999999\u4E4B\u95F4"
202
+ min: 0,
203
+ max: 999999999,
204
+ error: "\u9875\u9762\u7A7A\u95F2\u8D85\u65F6\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E0"
205
+ }
206
+ ]
207
+ }),
208
+ // retries
209
+ components.input.number("retries", {
210
+ label: "\u91CD\u8BD5\u6B21\u6570",
211
+ description: "\u64CD\u4F5C\u5931\u8D25\u65F6\u7684\u6700\u5927\u91CD\u8BD5\u6B21\u6570",
212
+ defaultValue: (config.retries || 2) + "",
213
+ className: "inline-block p-2",
214
+ rules: [
215
+ {
216
+ min: 0,
217
+ max: 10,
218
+ error: "\u91CD\u8BD5\u6B21\u6570\u5FC5\u987B\u57280-10\u4E4B\u95F4"
132
219
  }
133
220
  ]
134
221
  }),
@@ -148,6 +235,34 @@ var webConfig = {
148
235
  isRequired: false,
149
236
  className: "inline-block p-2"
150
237
  }),
238
+ // defaultViewport width
239
+ components.input.number("viewportWidth", {
240
+ label: "\u9ED8\u8BA4\u89C6\u7A97\u5BBD\u5EA6",
241
+ description: "\u9ED8\u8BA4\u89C6\u7A97\u5BBD\u5EA6\uFF08\u50CF\u7D20\uFF09",
242
+ defaultValue: (config.defaultViewport?.width || 800) + "",
243
+ className: "inline-block p-2",
244
+ rules: [
245
+ {
246
+ min: 1,
247
+ max: 1e4,
248
+ error: "\u89C6\u7A97\u5BBD\u5EA6\u5FC5\u987B\u57281-10000\u4E4B\u95F4"
249
+ }
250
+ ]
251
+ }),
252
+ // defaultViewport height
253
+ components.input.number("viewportHeight", {
254
+ label: "\u9ED8\u8BA4\u89C6\u7A97\u9AD8\u5EA6",
255
+ description: "\u9ED8\u8BA4\u89C6\u7A97\u9AD8\u5EA6\uFF08\u50CF\u7D20\uFF09",
256
+ defaultValue: (config.defaultViewport?.height || 600) + "",
257
+ className: "inline-block p-2",
258
+ rules: [
259
+ {
260
+ min: 1,
261
+ max: 1e4,
262
+ error: "\u89C6\u7A97\u9AD8\u5EA6\u5FC5\u987B\u57281-10000\u4E4B\u95F4"
263
+ }
264
+ ]
265
+ }),
151
266
  // 分隔线
152
267
  components.divider.create("divider4"),
153
268
  // args
@@ -163,10 +278,43 @@ var webConfig = {
163
278
  },
164
279
  /** 前端点击保存之后调用的方法 */
165
280
  save: (config) => {
281
+ if (!config.download) {
282
+ config.download = {};
283
+ }
284
+ if (config.downloadEnable !== void 0) {
285
+ config.download.enable = config.downloadEnable;
286
+ delete config.downloadEnable;
287
+ }
288
+ if (config.downloadBrowser) {
289
+ config.download.browser = config.downloadBrowser;
290
+ delete config.downloadBrowser;
291
+ }
292
+ if (config.downloadVersion) {
293
+ config.download.version = config.downloadVersion;
294
+ delete config.downloadVersion;
295
+ }
296
+ if (config.downloadDir) {
297
+ config.download.dir = config.downloadDir;
298
+ delete config.downloadDir;
299
+ }
300
+ if (config.downloadBaseUrl) {
301
+ config.download.baseUrl = config.downloadBaseUrl;
302
+ delete config.downloadBaseUrl;
303
+ }
304
+ if (config.viewportWidth !== void 0 || config.viewportHeight !== void 0) {
305
+ config.defaultViewport = {
306
+ width: Number(config.viewportWidth || 800),
307
+ height: Number(config.viewportHeight || 600)
308
+ };
309
+ delete config.viewportWidth;
310
+ delete config.viewportHeight;
311
+ }
166
312
  config = {
167
313
  ...config,
168
- maxPages: Number(config.maxPages),
169
- idleTime: Number(config.idleTime)
314
+ maxOpenPages: Number(config.maxOpenPages),
315
+ pageIdleTimeout: Number(config.pageIdleTimeout),
316
+ retries: Number(config.retries),
317
+ slowMo: Number(config.slowMo || 0)
170
318
  };
171
319
  saveConfig(config);
172
320
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karinjs/plugin-puppeteer",
3
- "version": "1.0.20",
3
+ "version": "1.1.0",
4
4
  "description": "karin的 puppeteer截图、渲染插件",
5
5
  "keywords": [
6
6
  "karin",
@@ -16,16 +16,13 @@
16
16
  "main": "dist/index.js",
17
17
  "types": "dist/index.d.ts",
18
18
  "files": [
19
- "dist",
20
- "!LICENSE",
21
- "!README.md"
19
+ "dist"
22
20
  ],
23
21
  "dependencies": {
24
- "@karinjs/puppeteer": "2.2.4"
22
+ "@snapka/puppeteer": "0.1.3"
25
23
  },
26
24
  "devDependencies": {
27
- "node-karin": "^1.7.12",
28
- "@karinjs/puppeteer-types": "0.0.6"
25
+ "node-karin": "^1.13.0"
29
26
  },
30
27
  "karin": {
31
28
  "main": "src/index.ts",
@@ -34,39 +31,12 @@
34
31
  "ts-web": "src/web.config.ts",
35
32
  "files": [
36
33
  "config"
37
- ],
38
- "env": [
39
- {
40
- "key": "PUPPETEER_CACHE_DIR",
41
- "value": "",
42
- "comment": "Puppeteer缓存的默认根目录"
43
- },
44
- {
45
- "key": "PUPPETEER_CACHE_VERSION",
46
- "value": "",
47
- "comment": "记录puppeteer下载过的浏览器信息"
48
- },
49
- {
50
- "key": "PUPPETEER_CHROME_HEADLESS_SHELL_VERSION",
51
- "value": "",
52
- "comment": "Puppeteer下载浏览器的版本"
53
- },
54
- {
55
- "key": "PUPPETEER_EXECUTABLE_PATH",
56
- "value": "",
57
- "comment": "Puppeteer可执行文件路径 配置后将使用此路径的浏览器"
58
- },
59
- {
60
- "key": "PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL",
61
- "value": "",
62
- "comment": "Puppeteer浏览器host地址"
63
- }
64
34
  ]
65
35
  },
66
36
  "timestamp": "2025-10-01T00:47:22.222Z",
67
37
  "scripts": {
68
38
  "build": "tsc && tsup",
69
- "dev": "tsx src/index.ts",
39
+ "dev": "tsx src/app.ts",
70
40
  "dev:test": "node dist/index.js",
71
41
  "pub": "pnpm publish --access public",
72
42
  "rm": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",