@iflyrpa/playwright 1.1.1 → 1.1.2-beta.2
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/dist/511.cjs +99 -0
- package/dist/511.js +98 -0
- package/dist/electron/install.d.ts +12 -0
- package/dist/electron/launch.d.ts +2 -0
- package/dist/index.cjs +43976 -478
- package/dist/index.cjs.LICENSE.txt +33 -0
- package/dist/index.d.ts +5 -82
- package/dist/index.js +43668 -0
- package/dist/index.js.LICENSE.txt +33 -0
- package/dist/logger.d.ts +12 -0
- package/dist/packageManager.d.ts +10 -0
- package/dist/sentry.d.ts +7 -0
- package/dist/task.d.ts +53 -0
- package/package.json +16 -13
- package/dist/index.d.cts +0 -86
- package/dist/index.d.mts +0 -86
- package/dist/index.mjs +0 -486
package/dist/index.mjs
DELETED
|
@@ -1,486 +0,0 @@
|
|
|
1
|
-
import { Action } from '@iflyrpa/actions';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import childProcess from 'node:child_process';
|
|
5
|
-
import os from 'node:os';
|
|
6
|
-
import { downloadArtifact } from '@electron/get';
|
|
7
|
-
import extract from 'extract-zip';
|
|
8
|
-
import { ensureFileSync, pathExists, ensureFile, writeFile } from '@iflyrpa/share';
|
|
9
|
-
import log from 'loglevel';
|
|
10
|
-
import { NodeClient } from '@sentry/node';
|
|
11
|
-
import pacote from 'pacote';
|
|
12
|
-
|
|
13
|
-
const name = "@iflyrpa/playwright";
|
|
14
|
-
const type = "module";
|
|
15
|
-
const version$1 = "1.1.1";
|
|
16
|
-
const main = "./dist/index.cjs";
|
|
17
|
-
const module = "./dist/index.mjs";
|
|
18
|
-
const types = "./dist/index.d.ts";
|
|
19
|
-
const scripts = {
|
|
20
|
-
build: "unbuild",
|
|
21
|
-
dev: "unbuild --stub",
|
|
22
|
-
start: "esno src/index.ts"
|
|
23
|
-
};
|
|
24
|
-
const author = "bijinfeng";
|
|
25
|
-
const license = "ISC";
|
|
26
|
-
const files = [
|
|
27
|
-
"dist"
|
|
28
|
-
];
|
|
29
|
-
const peerDependencies = {
|
|
30
|
-
playwright: "^1.46.1"
|
|
31
|
-
};
|
|
32
|
-
const devDependencies = {
|
|
33
|
-
"@iflyrpa/share": "workspace:*",
|
|
34
|
-
"@types/pacote": "^11.1.8",
|
|
35
|
-
esno: "^4.7.0",
|
|
36
|
-
playwright: "^1.46.1",
|
|
37
|
-
typescript: "^5.5.2",
|
|
38
|
-
unbuild: "^2.0.0"
|
|
39
|
-
};
|
|
40
|
-
const dependencies = {
|
|
41
|
-
"@iflyrpa/actions": "workspace:*",
|
|
42
|
-
"@iflyrpa/share": "workspace:*",
|
|
43
|
-
"@electron/get": "^2.0.0",
|
|
44
|
-
"@sentry/node": "^5.5.0",
|
|
45
|
-
"extract-zip": "^2.0.1",
|
|
46
|
-
loglevel: "^1.9.2",
|
|
47
|
-
pacote: "^20.0.0"
|
|
48
|
-
};
|
|
49
|
-
const packageJson = {
|
|
50
|
-
name: name,
|
|
51
|
-
type: type,
|
|
52
|
-
version: version$1,
|
|
53
|
-
main: main,
|
|
54
|
-
module: module,
|
|
55
|
-
types: types,
|
|
56
|
-
scripts: scripts,
|
|
57
|
-
author: author,
|
|
58
|
-
license: license,
|
|
59
|
-
files: files,
|
|
60
|
-
peerDependencies: peerDependencies,
|
|
61
|
-
devDependencies: devDependencies,
|
|
62
|
-
dependencies: dependencies
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
var __defProp$4 = Object.defineProperty;
|
|
66
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
67
|
-
var __publicField$4 = (obj, key, value) => {
|
|
68
|
-
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
69
|
-
return value;
|
|
70
|
-
};
|
|
71
|
-
const ELECTRON_MIRROR = "http://npmmirror.com/mirrors/electron/";
|
|
72
|
-
const ELECTRON_VERSION = "22.3.27";
|
|
73
|
-
class ElectronInstall {
|
|
74
|
-
constructor(task) {
|
|
75
|
-
this.task = task;
|
|
76
|
-
__publicField$4(this, "rootDir");
|
|
77
|
-
__publicField$4(this, "electronPath");
|
|
78
|
-
__publicField$4(this, "platformPath");
|
|
79
|
-
__publicField$4(this, "version", ELECTRON_VERSION);
|
|
80
|
-
this.platformPath = this.getPlatformPath();
|
|
81
|
-
this.rootDir = path.join(task.packagesDir, `electron@${this.version}`);
|
|
82
|
-
this.electronPath = path.join(this.rootDir, this.platformPath);
|
|
83
|
-
}
|
|
84
|
-
isInstalled() {
|
|
85
|
-
try {
|
|
86
|
-
if (fs.readFileSync(path.join(this.rootDir, "version"), "utf-8").replace(/^v/, "") !== this.version) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
} catch (ignored) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
const electronPath = process.env.ELECTRON_OVERRIDE_DIST_PATH || path.join(this.rootDir, this.platformPath);
|
|
93
|
-
return fs.existsSync(electronPath);
|
|
94
|
-
}
|
|
95
|
-
getPlatformPath() {
|
|
96
|
-
const platform = process.env.npm_config_platform || os.platform();
|
|
97
|
-
switch (platform) {
|
|
98
|
-
case "mas":
|
|
99
|
-
case "darwin":
|
|
100
|
-
return "Electron.app/Contents/MacOS/Electron";
|
|
101
|
-
case "freebsd":
|
|
102
|
-
case "openbsd":
|
|
103
|
-
case "linux":
|
|
104
|
-
return "electron";
|
|
105
|
-
case "win32":
|
|
106
|
-
return "electron.exe";
|
|
107
|
-
default:
|
|
108
|
-
throw new Error(
|
|
109
|
-
`Electron builds are not available on platform: ${platform}`
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
async install() {
|
|
114
|
-
const installed = this.isInstalled();
|
|
115
|
-
this.task.logger.info(`electron@${this.version} \u662F\u5426\u5DF2\u5B89\u88C5\uFF1A${installed}`);
|
|
116
|
-
if (installed)
|
|
117
|
-
return this.electronPath;
|
|
118
|
-
const platform = process.env.npm_config_platform || process.platform;
|
|
119
|
-
let arch = process.env.npm_config_arch || process.arch;
|
|
120
|
-
if (platform === "darwin" && process.platform === "darwin" && arch === "x64" && process.env.npm_config_arch === void 0) {
|
|
121
|
-
try {
|
|
122
|
-
const output = childProcess.execSync(
|
|
123
|
-
"sysctl -in sysctl.proc_translated"
|
|
124
|
-
);
|
|
125
|
-
if (output.toString().trim() === "1") {
|
|
126
|
-
arch = "arm64";
|
|
127
|
-
}
|
|
128
|
-
} catch {
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
try {
|
|
132
|
-
this.task.logger.info(`electron@${this.version} \u5F00\u59CB\u4E0B\u8F7D\u8D44\u6E90`);
|
|
133
|
-
const zipPath = await downloadArtifact({
|
|
134
|
-
version: this.version,
|
|
135
|
-
artifactName: "electron",
|
|
136
|
-
force: process.env.force_no_cache === "true",
|
|
137
|
-
cacheRoot: process.env.electron_config_cache,
|
|
138
|
-
checksums: void 0,
|
|
139
|
-
mirrorOptions: { mirror: ELECTRON_MIRROR },
|
|
140
|
-
// 使用国内镜像下载
|
|
141
|
-
platform,
|
|
142
|
-
arch
|
|
143
|
-
});
|
|
144
|
-
this.task.logger.info(`electron@${this.version} \u5F00\u59CB\u89E3\u538B\u8D44\u6E90`);
|
|
145
|
-
process.noAsar = true;
|
|
146
|
-
await extract(zipPath, { dir: this.rootDir });
|
|
147
|
-
this.task.logger.info(`electron@${this.version} \u4E0B\u8F7D\u6210\u529F`);
|
|
148
|
-
return this.electronPath;
|
|
149
|
-
} catch (error) {
|
|
150
|
-
this.task.logger.error(`electron@${this.version} \u4E0B\u8F7D\u5931\u8D25`, error);
|
|
151
|
-
throw error;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
var __defProp$3 = Object.defineProperty;
|
|
157
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
158
|
-
var __publicField$3 = (obj, key, value) => {
|
|
159
|
-
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
160
|
-
return value;
|
|
161
|
-
};
|
|
162
|
-
class SentryInstance {
|
|
163
|
-
constructor(dsn) {
|
|
164
|
-
__publicField$3(this, "sentry");
|
|
165
|
-
if (!dsn)
|
|
166
|
-
return;
|
|
167
|
-
this.sentry = new NodeClient({
|
|
168
|
-
dsn,
|
|
169
|
-
defaultIntegrations: false
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
captureException(error) {
|
|
173
|
-
this.sentry?.captureException(error);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
const sentry = new SentryInstance(process.env.RPA_SENTRY_DSN);
|
|
177
|
-
|
|
178
|
-
var __defProp$2 = Object.defineProperty;
|
|
179
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
180
|
-
var __publicField$2 = (obj, key, value) => {
|
|
181
|
-
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
182
|
-
return value;
|
|
183
|
-
};
|
|
184
|
-
const _Logger = class _Logger {
|
|
185
|
-
constructor(cachePath) {
|
|
186
|
-
__publicField$2(this, "stream");
|
|
187
|
-
if (_Logger.instance) {
|
|
188
|
-
return _Logger.instance;
|
|
189
|
-
}
|
|
190
|
-
const logFile = path.join(cachePath, "rpa.log");
|
|
191
|
-
ensureFileSync(logFile);
|
|
192
|
-
this.stream = fs.createWriteStream(logFile, { flags: "a" });
|
|
193
|
-
log.setLevel("debug");
|
|
194
|
-
log.methodFactory = (methodName) => {
|
|
195
|
-
return (message) => {
|
|
196
|
-
this.stream.write(
|
|
197
|
-
`[${( new Date()).toLocaleString()}] ${methodName.toUpperCase()}: ${message}
|
|
198
|
-
`
|
|
199
|
-
);
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
log.setLevel(log.getLevel());
|
|
203
|
-
_Logger.instance = this;
|
|
204
|
-
}
|
|
205
|
-
static getInstance(cachePath) {
|
|
206
|
-
if (!_Logger.instance) {
|
|
207
|
-
_Logger.instance = new _Logger(cachePath);
|
|
208
|
-
}
|
|
209
|
-
return _Logger.instance;
|
|
210
|
-
}
|
|
211
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
212
|
-
debug(...msg) {
|
|
213
|
-
log.debug(...msg);
|
|
214
|
-
}
|
|
215
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
216
|
-
info(...msg) {
|
|
217
|
-
log.info(...msg);
|
|
218
|
-
}
|
|
219
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
220
|
-
warn(...msg) {
|
|
221
|
-
log.warn(...msg);
|
|
222
|
-
}
|
|
223
|
-
// error 级别的日志上报 sentry
|
|
224
|
-
error(prefix, err) {
|
|
225
|
-
const error = err || prefix;
|
|
226
|
-
if (err instanceof Error) {
|
|
227
|
-
err.message = `${prefix}\uFF1A${err.message}`;
|
|
228
|
-
}
|
|
229
|
-
log.error(error);
|
|
230
|
-
sentry.captureException(error);
|
|
231
|
-
}
|
|
232
|
-
close() {
|
|
233
|
-
this.stream.end();
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
__publicField$2(_Logger, "instance", null);
|
|
237
|
-
let Logger = _Logger;
|
|
238
|
-
|
|
239
|
-
const template = `
|
|
240
|
-
const { app } = require("electron");
|
|
241
|
-
|
|
242
|
-
app.whenReady().then(() => {});
|
|
243
|
-
|
|
244
|
-
app.on("window-all-closed", (e) => e.preventDefault());
|
|
245
|
-
`;
|
|
246
|
-
const generateFile = async (dir) => {
|
|
247
|
-
const filePath = path.join(dir, "main.js");
|
|
248
|
-
const isPathExists = await pathExists(filePath);
|
|
249
|
-
if (!isPathExists) {
|
|
250
|
-
await ensureFile(filePath);
|
|
251
|
-
await writeFile(filePath, template);
|
|
252
|
-
}
|
|
253
|
-
return filePath;
|
|
254
|
-
};
|
|
255
|
-
const launchElectronApp = async (cachePath, playwright, electronPath) => {
|
|
256
|
-
const logger = Logger.getInstance(cachePath);
|
|
257
|
-
try {
|
|
258
|
-
const mainPath = await generateFile(cachePath);
|
|
259
|
-
const electronApp = await playwright._electron.launch({
|
|
260
|
-
executablePath: electronPath,
|
|
261
|
-
// 获取 Electron 可执行文件的路径
|
|
262
|
-
args: [mainPath],
|
|
263
|
-
cwd: cachePath
|
|
264
|
-
});
|
|
265
|
-
logger.info(`electron \u542F\u52A8\u6210\u529F\uFF1A${electronPath} ${mainPath}`);
|
|
266
|
-
return electronApp;
|
|
267
|
-
} catch (error) {
|
|
268
|
-
logger.error("electron \u542F\u52A8\u5931\u8D25\uFF1A", error);
|
|
269
|
-
throw error;
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
const NPM_REGISTRY = "https://registry.npmmirror.com/";
|
|
274
|
-
class PackageManager {
|
|
275
|
-
constructor(task) {
|
|
276
|
-
this.task = task;
|
|
277
|
-
}
|
|
278
|
-
// 获取依赖信息
|
|
279
|
-
async getManifest(module) {
|
|
280
|
-
try {
|
|
281
|
-
return pacote.manifest(module, { registry: NPM_REGISTRY });
|
|
282
|
-
} catch (error) {
|
|
283
|
-
this.task.logger.error("\u83B7\u53D6\u4F9D\u8D56\u4FE1\u606F\u5931\u8D25", error);
|
|
284
|
-
throw error;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
// 安装依赖
|
|
288
|
-
async extract(name, version = "latest") {
|
|
289
|
-
const packageName = `${name}@${version}`;
|
|
290
|
-
try {
|
|
291
|
-
this.task.logger.info(`${packageName} \u5F00\u59CB\u5B89\u88C5`);
|
|
292
|
-
await pacote.extract(
|
|
293
|
-
packageName,
|
|
294
|
-
path.join(this.task.packagesDir, packageName),
|
|
295
|
-
{ registry: NPM_REGISTRY }
|
|
296
|
-
);
|
|
297
|
-
this.task.logger.info(`${packageName} \u5B89\u88C5\u6210\u529F`);
|
|
298
|
-
} catch (error) {
|
|
299
|
-
this.task.logger.error(`${packageName} \u5B89\u88C5\u5931\u8D25`, error);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
// 查询本地安装的依赖
|
|
303
|
-
require(module) {
|
|
304
|
-
try {
|
|
305
|
-
return require(path.join(this.task.packagesDir, module));
|
|
306
|
-
} catch (error) {
|
|
307
|
-
return null;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
// 安装依赖
|
|
311
|
-
async install(name, version) {
|
|
312
|
-
const packageName = `${name}@${version}`;
|
|
313
|
-
const plugin = this.require(packageName);
|
|
314
|
-
this.task.logger.info(`${packageName} \u662F\u5426\u5DF2\u5B89\u88C5\uFF1A${!!plugin}`);
|
|
315
|
-
if (!plugin) {
|
|
316
|
-
await this.extract(name, version);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
// 更新依赖
|
|
320
|
-
async update(name) {
|
|
321
|
-
const manifest = await this.getManifest(`${name}@latest`);
|
|
322
|
-
const version = manifest.version;
|
|
323
|
-
const plugin = this.require(`${name}@${version}`);
|
|
324
|
-
if (!plugin) {
|
|
325
|
-
await this.extract(name, version);
|
|
326
|
-
}
|
|
327
|
-
return version;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
var __defProp$1 = Object.defineProperty;
|
|
332
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
333
|
-
var __publicField$1 = (obj, key, value) => {
|
|
334
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
335
|
-
return value;
|
|
336
|
-
};
|
|
337
|
-
const PLAYWRIGHT_VERSION = "1.46.1";
|
|
338
|
-
const PLAYWRIGHT_NAME = "playwright-core";
|
|
339
|
-
class Task {
|
|
340
|
-
constructor({ cachePath, debug }) {
|
|
341
|
-
__publicField$1(this, "logger");
|
|
342
|
-
__publicField$1(this, "cachePath");
|
|
343
|
-
__publicField$1(this, "debug");
|
|
344
|
-
__publicField$1(this, "packagesDir");
|
|
345
|
-
// 依赖安装目录
|
|
346
|
-
__publicField$1(this, "packageManager");
|
|
347
|
-
__publicField$1(this, "playwrightPackage");
|
|
348
|
-
__publicField$1(this, "electronPackage");
|
|
349
|
-
__publicField$1(this, "_electronApp", null);
|
|
350
|
-
/**
|
|
351
|
-
* 应用是否已关闭
|
|
352
|
-
*/
|
|
353
|
-
__publicField$1(this, "isClosed", false);
|
|
354
|
-
this.cachePath = cachePath;
|
|
355
|
-
this.packagesDir = path.join(cachePath, "packages");
|
|
356
|
-
this.debug = debug || false;
|
|
357
|
-
this.logger = Logger.getInstance(cachePath);
|
|
358
|
-
this.packageManager = new PackageManager(this);
|
|
359
|
-
this.playwrightPackage = this.installPlaywright();
|
|
360
|
-
this.electronPackage = this.installElectron();
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* 安装 playwright
|
|
364
|
-
* @returns
|
|
365
|
-
*/
|
|
366
|
-
async installPlaywright() {
|
|
367
|
-
const packageName = `${PLAYWRIGHT_NAME}@${PLAYWRIGHT_VERSION}`;
|
|
368
|
-
await this.packageManager.install(PLAYWRIGHT_NAME, PLAYWRIGHT_VERSION);
|
|
369
|
-
return this.packageManager.require(packageName);
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* 安装 electron
|
|
373
|
-
* @returns
|
|
374
|
-
*/
|
|
375
|
-
installElectron() {
|
|
376
|
-
return new ElectronInstall(this).install();
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* 启动 Electron
|
|
380
|
-
* @returns
|
|
381
|
-
*/
|
|
382
|
-
async launchApp() {
|
|
383
|
-
if (!this._electronApp) {
|
|
384
|
-
const [playwright, electronPath] = await Promise.all([
|
|
385
|
-
this.playwrightPackage,
|
|
386
|
-
this.electronPackage
|
|
387
|
-
]);
|
|
388
|
-
this._electronApp = await launchElectronApp(
|
|
389
|
-
this.cachePath,
|
|
390
|
-
playwright,
|
|
391
|
-
electronPath
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
return this._electronApp;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* 临时文件目录
|
|
398
|
-
* @returns
|
|
399
|
-
*/
|
|
400
|
-
getTmpPath() {
|
|
401
|
-
return path.join(this.cachePath, "tmp");
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* 清空临时文件
|
|
405
|
-
*/
|
|
406
|
-
clearTmpPath() {
|
|
407
|
-
const tmpPath = this.getTmpPath();
|
|
408
|
-
return fs.rm(tmpPath, { recursive: true, force: true }, (err) => {
|
|
409
|
-
if (err) {
|
|
410
|
-
this.logger.error("\u5220\u9664\u4E34\u65F6\u6587\u4EF6\u5931\u8D25\uFF0C", err);
|
|
411
|
-
} else {
|
|
412
|
-
this.logger.info("\u5220\u9664\u4E34\u65F6\u6587\u4EF6\u6210\u529F");
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* 关闭 playwright 启动的 electron 客户端
|
|
418
|
-
* @returns
|
|
419
|
-
*/
|
|
420
|
-
async close() {
|
|
421
|
-
this.logger.info("\u5173\u95ED\u5E94\u7528");
|
|
422
|
-
this.clearTmpPath();
|
|
423
|
-
this.logger.close();
|
|
424
|
-
await this._electronApp?.close();
|
|
425
|
-
this.isClosed = true;
|
|
426
|
-
this._electronApp = null;
|
|
427
|
-
}
|
|
428
|
-
async createPage(pageParams) {
|
|
429
|
-
const electronApp = await this.launchApp();
|
|
430
|
-
const [page] = await Promise.all([
|
|
431
|
-
electronApp.waitForEvent("window"),
|
|
432
|
-
electronApp.evaluate(
|
|
433
|
-
async (electron, { pageParams: pageParams2 }) => {
|
|
434
|
-
await electron.app.whenReady();
|
|
435
|
-
const window = new electron.BrowserWindow({
|
|
436
|
-
show: pageParams2.show,
|
|
437
|
-
width: 1500,
|
|
438
|
-
height: 800,
|
|
439
|
-
webPreferences: {
|
|
440
|
-
nodeIntegration: true,
|
|
441
|
-
contextIsolation: false
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
if (pageParams2.cookies) {
|
|
445
|
-
await Promise.all(
|
|
446
|
-
pageParams2.cookies.map(
|
|
447
|
-
(cookie) => electron.session.defaultSession.cookies.set(cookie)
|
|
448
|
-
)
|
|
449
|
-
);
|
|
450
|
-
}
|
|
451
|
-
await window.loadURL(pageParams2.url);
|
|
452
|
-
},
|
|
453
|
-
{ pageParams }
|
|
454
|
-
)
|
|
455
|
-
]);
|
|
456
|
-
return page;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
var __defProp = Object.defineProperty;
|
|
461
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
462
|
-
var __publicField = (obj, key, value) => {
|
|
463
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
464
|
-
return value;
|
|
465
|
-
};
|
|
466
|
-
class RpaTask extends Task {
|
|
467
|
-
constructor(params) {
|
|
468
|
-
super(params);
|
|
469
|
-
__publicField(this, "actions");
|
|
470
|
-
this.actions = new Action(this);
|
|
471
|
-
params.forceUpdate && this.update();
|
|
472
|
-
}
|
|
473
|
-
async update() {
|
|
474
|
-
try {
|
|
475
|
-
const name = "@iflyrpa/actions";
|
|
476
|
-
const version2 = await this.packageManager.update(name);
|
|
477
|
-
const actionPackage = this.packageManager.require(`${name}@${version2}`);
|
|
478
|
-
actionPackage?.actions && (this.actions = actionPackage.actions);
|
|
479
|
-
} catch (error) {
|
|
480
|
-
this.logger.error("\u66F4\u65B0\u4F9D\u8D56\u5931\u8D25", error);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
const version = packageJson.version;
|
|
485
|
-
|
|
486
|
-
export { RpaTask, version };
|