@iflyrpa/playwright 4.0.9-beta.5 → 4.1.0-beta.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/dist/index.cjs +147 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +202 -1
- package/dist/index.js +141 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d3aada0e-06e9-513f-bfca-6baab8e99f26")}catch(e){}}();
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
4
|
"../../node_modules/.pnpm/cross-fetch@4.1.0_encoding@0.1.13/node_modules/cross-fetch/dist/node-ponyfill.js": function(module, exports1, __webpack_require__) {
|
|
5
5
|
const nodeFetch = __webpack_require__("../../node_modules/.pnpm/node-fetch@2.7.0_encoding@0.1.13/node_modules/node-fetch/lib/index.mjs");
|
|
@@ -2555,11 +2555,17 @@ var __webpack_exports__ = {};
|
|
|
2555
2555
|
"use strict";
|
|
2556
2556
|
__webpack_require__.r(__webpack_exports__);
|
|
2557
2557
|
__webpack_require__.d(__webpack_exports__, {
|
|
2558
|
+
getLatestVersionRecord: ()=>getLatestVersionRecord,
|
|
2559
|
+
getMaxUpdateLevel: ()=>getMaxUpdateLevel,
|
|
2560
|
+
getVersionRecord: ()=>getVersionRecord,
|
|
2561
|
+
RpaTask: ()=>RpaTask,
|
|
2558
2562
|
version: ()=>src_version,
|
|
2559
|
-
|
|
2563
|
+
compareVersion: ()=>compareVersion,
|
|
2564
|
+
getVersionRecordsSince: ()=>getVersionRecordsSince,
|
|
2565
|
+
getVersionHistory: ()=>getVersionHistory
|
|
2560
2566
|
});
|
|
2561
2567
|
const actions_namespaceObject = require("@iflyrpa/actions");
|
|
2562
|
-
var package_namespaceObject = JSON.parse('{"i8":"4.0
|
|
2568
|
+
var package_namespaceObject = JSON.parse('{"i8":"4.1.0-beta.0"}');
|
|
2563
2569
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
2564
2570
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
2565
2571
|
const external_node_path_namespaceObject = require("node:path");
|
|
@@ -5385,10 +5391,45 @@ app.on("window-all-closed", (e) => e.preventDefault());
|
|
|
5385
5391
|
return obj;
|
|
5386
5392
|
}
|
|
5387
5393
|
const NPM_REGISTRY = "https://registry.npmmirror.com/";
|
|
5394
|
+
const LATEST_TAG = "latest";
|
|
5395
|
+
const BETA_TAG = "beta";
|
|
5396
|
+
function compareVersion(a, b) {
|
|
5397
|
+
const parse = (v)=>{
|
|
5398
|
+
const [core, pre] = v.split("-");
|
|
5399
|
+
const nums = core.split(".").map(Number);
|
|
5400
|
+
return {
|
|
5401
|
+
nums,
|
|
5402
|
+
pre
|
|
5403
|
+
};
|
|
5404
|
+
};
|
|
5405
|
+
const va = parse(a);
|
|
5406
|
+
const vb = parse(b);
|
|
5407
|
+
for(let i = 0; i < 3; i++){
|
|
5408
|
+
const diff = (va.nums[i] ?? 0) - (vb.nums[i] ?? 0);
|
|
5409
|
+
if (0 !== diff) return diff;
|
|
5410
|
+
}
|
|
5411
|
+
if (!va.pre && !vb.pre) return 0;
|
|
5412
|
+
if (!va.pre) return 1;
|
|
5413
|
+
if (!vb.pre) return -1;
|
|
5414
|
+
const pa = va.pre.split(".");
|
|
5415
|
+
const pb = vb.pre.split(".");
|
|
5416
|
+
for(let i = 0; i < Math.max(pa.length, pb.length); i++){
|
|
5417
|
+
const sa = pa[i];
|
|
5418
|
+
const sb = pb[i];
|
|
5419
|
+
if (void 0 === sa) return -1;
|
|
5420
|
+
if (void 0 === sb) return 1;
|
|
5421
|
+
const na = Number(sa);
|
|
5422
|
+
const nb = Number(sb);
|
|
5423
|
+
const bothNumeric = !Number.isNaN(na) && !Number.isNaN(nb);
|
|
5424
|
+
const diff = bothNumeric ? na - nb : sa.localeCompare(sb);
|
|
5425
|
+
if (0 !== diff) return diff;
|
|
5426
|
+
}
|
|
5427
|
+
return 0;
|
|
5428
|
+
}
|
|
5388
5429
|
class PackageManager {
|
|
5389
5430
|
async getManifest(module) {
|
|
5390
5431
|
try {
|
|
5391
|
-
return pacote_default().manifest(module, {
|
|
5432
|
+
return await pacote_default().manifest(module, {
|
|
5392
5433
|
registry: NPM_REGISTRY
|
|
5393
5434
|
});
|
|
5394
5435
|
} catch (error) {
|
|
@@ -5419,9 +5460,25 @@ app.on("window-all-closed", (e) => e.preventDefault());
|
|
|
5419
5460
|
const plugin = this.require(packageName);
|
|
5420
5461
|
if (!plugin) await this.extract(name, version);
|
|
5421
5462
|
}
|
|
5422
|
-
async
|
|
5423
|
-
|
|
5424
|
-
|
|
5463
|
+
async getVersionByTag(name, distTag = LATEST_TAG) {
|
|
5464
|
+
try {
|
|
5465
|
+
const manifest = await this.getManifest(`${name}@${distTag}`);
|
|
5466
|
+
return manifest.version;
|
|
5467
|
+
} catch (error) {
|
|
5468
|
+
if (distTag === LATEST_TAG) throw error;
|
|
5469
|
+
this.task.logger.warn(`${name}@${distTag} 不存在,回退到 ${LATEST_TAG}`);
|
|
5470
|
+
const manifest = await this.getManifest(`${name}@${LATEST_TAG}`);
|
|
5471
|
+
return manifest.version;
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
async getLatestVersion(name, useBeta = false) {
|
|
5475
|
+
const latest = await this.getVersionByTag(name, LATEST_TAG);
|
|
5476
|
+
if (!useBeta) return latest;
|
|
5477
|
+
const beta = await this.getVersionByTag(name, BETA_TAG);
|
|
5478
|
+
return compareVersion(beta, latest) > 0 ? beta : latest;
|
|
5479
|
+
}
|
|
5480
|
+
async update(name, useBeta = false) {
|
|
5481
|
+
const version = await this.getLatestVersion(name, useBeta);
|
|
5425
5482
|
const plugin = this.require(`${name}@${version}/package.json`);
|
|
5426
5483
|
if (!plugin) await this.extract(name, version);
|
|
5427
5484
|
return version;
|
|
@@ -5637,6 +5694,25 @@ app.on("window-all-closed", (e) => e.preventDefault());
|
|
|
5637
5694
|
this.electronPackage = this.installElectron();
|
|
5638
5695
|
}
|
|
5639
5696
|
}
|
|
5697
|
+
var version_history_namespaceObject = JSON.parse('{"name":"@iflyrpa/playwright","currentVersion":"4.0.9","lastUpdate":"2026-08-14","maxVersions":10,"versions":[{"version":"4.0.9","releaseDate":"2026-08-14","releaseNote":["1"],"updateLevel":1,"updateStrategy":"建议更新","changeType":"patch"}]}');
|
|
5698
|
+
function getVersionHistory() {
|
|
5699
|
+
return version_history_namespaceObject;
|
|
5700
|
+
}
|
|
5701
|
+
function getLatestVersionRecord() {
|
|
5702
|
+
return getVersionHistory().versions[0] ?? null;
|
|
5703
|
+
}
|
|
5704
|
+
function getVersionRecord(version) {
|
|
5705
|
+
return getVersionHistory().versions.find((v)=>v.version === version) ?? null;
|
|
5706
|
+
}
|
|
5707
|
+
function getVersionRecordsSince(fromVersion) {
|
|
5708
|
+
const { versions } = getVersionHistory();
|
|
5709
|
+
const index = versions.findIndex((v)=>v.version === fromVersion);
|
|
5710
|
+
return -1 === index ? versions : versions.slice(0, index);
|
|
5711
|
+
}
|
|
5712
|
+
function getMaxUpdateLevel(records) {
|
|
5713
|
+
if (0 === records.length) return null;
|
|
5714
|
+
return records.reduce((max, r)=>r.updateLevel > max ? r.updateLevel : max, 0);
|
|
5715
|
+
}
|
|
5640
5716
|
function src_define_property(obj, key, value) {
|
|
5641
5717
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
5642
5718
|
value: value,
|
|
@@ -5650,21 +5726,80 @@ app.on("window-all-closed", (e) => e.preventDefault());
|
|
|
5650
5726
|
class RpaTask extends Task {
|
|
5651
5727
|
registerActions(rpaAction) {
|
|
5652
5728
|
this.actions = new rpaAction.Action(this);
|
|
5729
|
+
this.currentActionVersion = rpaAction.version;
|
|
5653
5730
|
this.setActionVersion(rpaAction.version);
|
|
5654
5731
|
}
|
|
5732
|
+
getActionVersion() {
|
|
5733
|
+
return this.currentActionVersion;
|
|
5734
|
+
}
|
|
5735
|
+
getActionVersionInfo() {
|
|
5736
|
+
return {
|
|
5737
|
+
current: this.currentActionVersion,
|
|
5738
|
+
bundled: this.bundledActionVersion,
|
|
5739
|
+
latest: this.latestActionVersion,
|
|
5740
|
+
hasUpdate: !!this.latestActionVersion && this.latestActionVersion !== this.currentActionVersion,
|
|
5741
|
+
applied: this.appliedUpdate,
|
|
5742
|
+
channel: this.updateChannel,
|
|
5743
|
+
error: this.updateError
|
|
5744
|
+
};
|
|
5745
|
+
}
|
|
5746
|
+
useBetaChannel() {
|
|
5747
|
+
const useBeta = this.isFeatOn(actions_namespaceObject.BetaFlag);
|
|
5748
|
+
this.updateChannel = useBeta ? "beta" : "latest";
|
|
5749
|
+
return useBeta;
|
|
5750
|
+
}
|
|
5751
|
+
async checkActionUpdate() {
|
|
5752
|
+
try {
|
|
5753
|
+
this.latestActionVersion = await this.packageManager.getLatestVersion(this.actionName, this.useBetaChannel());
|
|
5754
|
+
this.updateError = void 0;
|
|
5755
|
+
} catch (error) {
|
|
5756
|
+
this.updateError = error instanceof Error ? error.message : String(error);
|
|
5757
|
+
this.logger.error("检查脚本版本失败", error);
|
|
5758
|
+
}
|
|
5759
|
+
return this.getActionVersionInfo();
|
|
5760
|
+
}
|
|
5761
|
+
waitForActionUpdate() {
|
|
5762
|
+
if (!this.updateTask) this.updateTask = this.update();
|
|
5763
|
+
return this.updateTask;
|
|
5764
|
+
}
|
|
5655
5765
|
async update() {
|
|
5656
5766
|
try {
|
|
5657
|
-
const version = await this.packageManager.update(this.actionName);
|
|
5767
|
+
const version = await this.packageManager.update(this.actionName, this.useBetaChannel());
|
|
5768
|
+
this.latestActionVersion = version;
|
|
5769
|
+
if (version === this.currentActionVersion) {
|
|
5770
|
+
this.appliedUpdate = false;
|
|
5771
|
+
return this.getActionVersionInfo();
|
|
5772
|
+
}
|
|
5658
5773
|
const rpaPackage = this.packageManager.require(`${this.actionName}@${version}/dist/bundle.js`);
|
|
5659
|
-
(null == rpaPackage ? void 0 : rpaPackage.Action)
|
|
5774
|
+
if (null == rpaPackage ? void 0 : rpaPackage.Action) {
|
|
5775
|
+
this.registerActions(rpaPackage);
|
|
5776
|
+
this.appliedUpdate = true;
|
|
5777
|
+
this.updateError = void 0;
|
|
5778
|
+
this.logger.info(`脚本已热更新至 ${version}`);
|
|
5779
|
+
} else {
|
|
5780
|
+
this.appliedUpdate = false;
|
|
5781
|
+
this.updateError = `加载 ${this.actionName}@${version} 失败`;
|
|
5782
|
+
this.logger.warn(this.updateError);
|
|
5783
|
+
}
|
|
5660
5784
|
} catch (error) {
|
|
5785
|
+
this.appliedUpdate = false;
|
|
5786
|
+
this.updateError = error instanceof Error ? error.message : String(error);
|
|
5661
5787
|
this.logger.error("更新依赖失败", error);
|
|
5662
5788
|
}
|
|
5789
|
+
return this.getActionVersionInfo();
|
|
5790
|
+
}
|
|
5791
|
+
verifyActionMemoryUpdate() {
|
|
5792
|
+
var _this_actions;
|
|
5793
|
+
if (!(null === (_this_actions = this.actions) || void 0 === _this_actions ? void 0 : _this_actions.getActionVersionMarker)) return {
|
|
5794
|
+
error: "getActionVersionMarker 方法不存在,可能是旧版本的 @iflyrpa/actions",
|
|
5795
|
+
currentVersion: this.currentActionVersion
|
|
5796
|
+
};
|
|
5797
|
+
return this.actions.getActionVersionMarker();
|
|
5663
5798
|
}
|
|
5664
5799
|
constructor(params){
|
|
5665
|
-
super(params), src_define_property(this, "actions", void 0), src_define_property(this, "actionName", "@iflyrpa/actions");
|
|
5800
|
+
super(params), src_define_property(this, "actions", void 0), src_define_property(this, "actionName", "@iflyrpa/actions"), src_define_property(this, "bundledActionVersion", actions_namespaceObject.version), src_define_property(this, "currentActionVersion", actions_namespaceObject.version), src_define_property(this, "latestActionVersion", null), src_define_property(this, "appliedUpdate", false), src_define_property(this, "updateChannel", "latest"), src_define_property(this, "updateError", void 0), src_define_property(this, "updateTask", null);
|
|
5666
5801
|
this.registerActions(actions_namespaceObject);
|
|
5667
|
-
params.forceUpdate
|
|
5802
|
+
if (params.forceUpdate) this.updateTask = this.update();
|
|
5668
5803
|
}
|
|
5669
5804
|
}
|
|
5670
5805
|
const src_version = package_namespaceObject.i8;
|
|
@@ -5676,4 +5811,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
|
|
|
5676
5811
|
});
|
|
5677
5812
|
|
|
5678
5813
|
//# sourceMappingURL=index.cjs.map
|
|
5679
|
-
//# debugId=
|
|
5814
|
+
//# debugId=d3aada0e-06e9-513f-bfca-6baab8e99f26
|