@iflyrpa/playwright 1.1.2-beta.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.
@@ -0,0 +1,33 @@
1
+ /*!
2
+ * negotiator
3
+ * Copyright(c) 2012 Federico Romero
4
+ * Copyright(c) 2012-2014 Isaac Z. Schlueter
5
+ * Copyright(c) 2015 Douglas Christopher Wilson
6
+ * MIT Licensed
7
+ */
8
+
9
+ /**
10
+ * @license
11
+ * Copyright (c) 2010-2012 Mikeal Rogers
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ * Unless required by applicable law or agreed to in writing,
17
+ * software distributed under the License is distributed on an "AS
18
+ * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
19
+ * express or implied. See the License for the specific language
20
+ * governing permissions and limitations under the License.
21
+ */
22
+
23
+ /**
24
+ * @preserve
25
+ * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
26
+ *
27
+ * @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a>
28
+ * @see http://github.com/homebrewing/brauhaus-diff
29
+ * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
30
+ * @see http://github.com/garycourt/murmurhash-js
31
+ * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
32
+ * @see http://sites.google.com/site/murmurhash/
33
+ */
@@ -0,0 +1,12 @@
1
+ import { type LoggerImplement } from "@iflyrpa/share";
2
+ export declare class Logger implements LoggerImplement {
3
+ static instance: Logger | null;
4
+ private stream;
5
+ constructor(cachePath: string);
6
+ static getInstance(cachePath: string): Logger;
7
+ debug(...msg: any[]): void;
8
+ info(...msg: any[]): void;
9
+ warn(...msg: any[]): void;
10
+ error(prefix: string, err?: unknown): void;
11
+ close(): void;
12
+ }
@@ -0,0 +1,10 @@
1
+ import type { Task } from "./task";
2
+ export declare class PackageManager {
3
+ private task;
4
+ constructor(task: Task);
5
+ private getManifest;
6
+ private extract;
7
+ require(module: string): any;
8
+ install(name: string, version: string): Promise<void>;
9
+ update(name: string): Promise<string>;
10
+ }
@@ -0,0 +1,7 @@
1
+ declare class SentryInstance {
2
+ private sentry;
3
+ constructor(dsn: string);
4
+ captureException(error: unknown): void;
5
+ }
6
+ export declare const sentry: SentryInstance;
7
+ export {};
package/dist/task.d.ts ADDED
@@ -0,0 +1,53 @@
1
+ import type { AutomateTask, ElectronApplication, PageParams } from "@iflyrpa/share";
2
+ import { Logger } from "./logger";
3
+ import { PackageManager } from "./packageManager";
4
+ export interface TaskParams {
5
+ debug?: boolean;
6
+ cachePath: string;
7
+ forceUpdate?: boolean;
8
+ }
9
+ export declare class Task implements AutomateTask {
10
+ logger: Logger;
11
+ cachePath: string;
12
+ debug: boolean;
13
+ packagesDir: string;
14
+ packageManager: PackageManager;
15
+ private playwrightPackage;
16
+ private electronPackage;
17
+ private _electronApp;
18
+ /**
19
+ * 应用是否已关闭
20
+ */
21
+ isClosed: boolean;
22
+ constructor({ cachePath, debug }: TaskParams);
23
+ /**
24
+ * 安装 playwright
25
+ * @returns
26
+ */
27
+ private installPlaywright;
28
+ /**
29
+ * 安装 electron
30
+ * @returns
31
+ */
32
+ private installElectron;
33
+ /**
34
+ * 启动 Electron
35
+ * @returns
36
+ */
37
+ launchApp(): Promise<ElectronApplication>;
38
+ /**
39
+ * 临时文件目录
40
+ * @returns
41
+ */
42
+ getTmpPath(): string;
43
+ /**
44
+ * 清空临时文件
45
+ */
46
+ private clearTmpPath;
47
+ /**
48
+ * 关闭 playwright 启动的 electron 客户端
49
+ * @returns
50
+ */
51
+ close(): Promise<void>;
52
+ createPage(pageParams: PageParams): Promise<import("playwright-core").Page>;
53
+ }
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "@iflyrpa/playwright",
3
3
  "type": "module",
4
- "version": "1.1.2-beta.1",
4
+ "version": "1.1.2-beta.2",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js",
9
+ "require": "./dist/index.cjs"
10
+ }
11
+ },
5
12
  "main": "./dist/index.cjs",
6
- "module": "./dist/index.mjs",
13
+ "module": "./dist/index.js",
7
14
  "types": "./dist/index.d.ts",
8
- "author": "bijinfeng",
9
- "license": "ISC",
10
15
  "files": [
11
16
  "dist"
12
17
  ],
@@ -14,13 +19,12 @@
14
19
  "playwright": "^1.46.1"
15
20
  },
16
21
  "devDependencies": {
17
- "@types/pacote": "^11.1.8",
18
- "esno": "^4.7.0",
19
- "pacote": "^20.0.0",
22
+ "@rslib/core": "^0.3.1",
23
+ "@types/node": "^22.8.1",
20
24
  "playwright": "^1.46.1",
21
25
  "typescript": "^5.5.2",
22
- "unbuild": "^2.0.0",
23
- "@iflyrpa/share": "0.0.2"
26
+ "@iflyrpa/share": "0.0.2",
27
+ "@iflyrpa/pacote": "1.0.0"
24
28
  },
25
29
  "dependencies": {
26
30
  "@electron/get": "^2.0.0",
@@ -31,8 +35,7 @@
31
35
  "@iflyrpa/share": "0.0.2"
32
36
  },
33
37
  "scripts": {
34
- "build": "unbuild",
35
- "dev": "unbuild --stub",
36
- "start": "esno src/index.ts"
38
+ "build": "rslib build",
39
+ "dev": "rslib build --watch"
37
40
  }
38
41
  }
@@ -1,170 +0,0 @@
1
- 'use strict';
2
-
3
- async function pMap(
4
- iterable,
5
- mapper,
6
- {
7
- concurrency = Number.POSITIVE_INFINITY,
8
- stopOnError = true,
9
- signal,
10
- } = {},
11
- ) {
12
- return new Promise((resolve, reject_) => {
13
- if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) {
14
- throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
15
- }
16
-
17
- if (typeof mapper !== 'function') {
18
- throw new TypeError('Mapper function is required');
19
- }
20
-
21
- if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) {
22
- throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
23
- }
24
-
25
- const result = [];
26
- const errors = [];
27
- const skippedIndexesMap = new Map();
28
- let isRejected = false;
29
- let isResolved = false;
30
- let isIterableDone = false;
31
- let resolvingCount = 0;
32
- let currentIndex = 0;
33
- const iterator = iterable[Symbol.iterator] === undefined ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
34
-
35
- const reject = reason => {
36
- isRejected = true;
37
- isResolved = true;
38
- reject_(reason);
39
- };
40
-
41
- if (signal) {
42
- if (signal.aborted) {
43
- reject(signal.reason);
44
- }
45
-
46
- signal.addEventListener('abort', () => {
47
- reject(signal.reason);
48
- });
49
- }
50
-
51
- const next = async () => {
52
- if (isResolved) {
53
- return;
54
- }
55
-
56
- const nextItem = await iterator.next();
57
-
58
- const index = currentIndex;
59
- currentIndex++;
60
-
61
- // Note: `iterator.next()` can be called many times in parallel.
62
- // This can cause multiple calls to this `next()` function to
63
- // receive a `nextItem` with `done === true`.
64
- // The shutdown logic that rejects/resolves must be protected
65
- // so it runs only one time as the `skippedIndex` logic is
66
- // non-idempotent.
67
- if (nextItem.done) {
68
- isIterableDone = true;
69
-
70
- if (resolvingCount === 0 && !isResolved) {
71
- if (!stopOnError && errors.length > 0) {
72
- reject(new AggregateError(errors)); // eslint-disable-line unicorn/error-message
73
- return;
74
- }
75
-
76
- isResolved = true;
77
-
78
- if (skippedIndexesMap.size === 0) {
79
- resolve(result);
80
- return;
81
- }
82
-
83
- const pureResult = [];
84
-
85
- // Support multiple `pMapSkip`'s.
86
- for (const [index, value] of result.entries()) {
87
- if (skippedIndexesMap.get(index) === pMapSkip) {
88
- continue;
89
- }
90
-
91
- pureResult.push(value);
92
- }
93
-
94
- resolve(pureResult);
95
- }
96
-
97
- return;
98
- }
99
-
100
- resolvingCount++;
101
-
102
- // Intentionally detached
103
- (async () => {
104
- try {
105
- const element = await nextItem.value;
106
-
107
- if (isResolved) {
108
- return;
109
- }
110
-
111
- const value = await mapper(element, index);
112
-
113
- // Use Map to stage the index of the element.
114
- if (value === pMapSkip) {
115
- skippedIndexesMap.set(index, value);
116
- }
117
-
118
- result[index] = value;
119
-
120
- resolvingCount--;
121
- await next();
122
- } catch (error) {
123
- if (stopOnError) {
124
- reject(error);
125
- } else {
126
- errors.push(error);
127
- resolvingCount--;
128
-
129
- // In that case we can't really continue regardless of `stopOnError` state
130
- // since an iterable is likely to continue throwing after it throws once.
131
- // If we continue calling `next()` indefinitely we will likely end up
132
- // in an infinite loop of failed iteration.
133
- try {
134
- await next();
135
- } catch (error) {
136
- reject(error);
137
- }
138
- }
139
- }
140
- })();
141
- };
142
-
143
- // Create the concurrent runners in a detached (non-awaited)
144
- // promise. We need this so we can await the `next()` calls
145
- // to stop creating runners before hitting the concurrency limit
146
- // if the iterable has already been marked as done.
147
- // NOTE: We *must* do this for async iterators otherwise we'll spin up
148
- // infinite `next()` calls by default and never start the event loop.
149
- (async () => {
150
- for (let index = 0; index < concurrency; index++) {
151
- try {
152
- // eslint-disable-next-line no-await-in-loop
153
- await next();
154
- } catch (error) {
155
- reject(error);
156
- break;
157
- }
158
-
159
- if (isIterableDone || isRejected) {
160
- break;
161
- }
162
- }
163
- })();
164
- });
165
- }
166
-
167
- const pMapSkip = Symbol('skip');
168
-
169
- exports.default = pMap;
170
- exports.pMapSkip = pMapSkip;
@@ -1,167 +0,0 @@
1
- async function pMap(
2
- iterable,
3
- mapper,
4
- {
5
- concurrency = Number.POSITIVE_INFINITY,
6
- stopOnError = true,
7
- signal,
8
- } = {},
9
- ) {
10
- return new Promise((resolve, reject_) => {
11
- if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) {
12
- throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
13
- }
14
-
15
- if (typeof mapper !== 'function') {
16
- throw new TypeError('Mapper function is required');
17
- }
18
-
19
- if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) {
20
- throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
21
- }
22
-
23
- const result = [];
24
- const errors = [];
25
- const skippedIndexesMap = new Map();
26
- let isRejected = false;
27
- let isResolved = false;
28
- let isIterableDone = false;
29
- let resolvingCount = 0;
30
- let currentIndex = 0;
31
- const iterator = iterable[Symbol.iterator] === undefined ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
32
-
33
- const reject = reason => {
34
- isRejected = true;
35
- isResolved = true;
36
- reject_(reason);
37
- };
38
-
39
- if (signal) {
40
- if (signal.aborted) {
41
- reject(signal.reason);
42
- }
43
-
44
- signal.addEventListener('abort', () => {
45
- reject(signal.reason);
46
- });
47
- }
48
-
49
- const next = async () => {
50
- if (isResolved) {
51
- return;
52
- }
53
-
54
- const nextItem = await iterator.next();
55
-
56
- const index = currentIndex;
57
- currentIndex++;
58
-
59
- // Note: `iterator.next()` can be called many times in parallel.
60
- // This can cause multiple calls to this `next()` function to
61
- // receive a `nextItem` with `done === true`.
62
- // The shutdown logic that rejects/resolves must be protected
63
- // so it runs only one time as the `skippedIndex` logic is
64
- // non-idempotent.
65
- if (nextItem.done) {
66
- isIterableDone = true;
67
-
68
- if (resolvingCount === 0 && !isResolved) {
69
- if (!stopOnError && errors.length > 0) {
70
- reject(new AggregateError(errors)); // eslint-disable-line unicorn/error-message
71
- return;
72
- }
73
-
74
- isResolved = true;
75
-
76
- if (skippedIndexesMap.size === 0) {
77
- resolve(result);
78
- return;
79
- }
80
-
81
- const pureResult = [];
82
-
83
- // Support multiple `pMapSkip`'s.
84
- for (const [index, value] of result.entries()) {
85
- if (skippedIndexesMap.get(index) === pMapSkip) {
86
- continue;
87
- }
88
-
89
- pureResult.push(value);
90
- }
91
-
92
- resolve(pureResult);
93
- }
94
-
95
- return;
96
- }
97
-
98
- resolvingCount++;
99
-
100
- // Intentionally detached
101
- (async () => {
102
- try {
103
- const element = await nextItem.value;
104
-
105
- if (isResolved) {
106
- return;
107
- }
108
-
109
- const value = await mapper(element, index);
110
-
111
- // Use Map to stage the index of the element.
112
- if (value === pMapSkip) {
113
- skippedIndexesMap.set(index, value);
114
- }
115
-
116
- result[index] = value;
117
-
118
- resolvingCount--;
119
- await next();
120
- } catch (error) {
121
- if (stopOnError) {
122
- reject(error);
123
- } else {
124
- errors.push(error);
125
- resolvingCount--;
126
-
127
- // In that case we can't really continue regardless of `stopOnError` state
128
- // since an iterable is likely to continue throwing after it throws once.
129
- // If we continue calling `next()` indefinitely we will likely end up
130
- // in an infinite loop of failed iteration.
131
- try {
132
- await next();
133
- } catch (error) {
134
- reject(error);
135
- }
136
- }
137
- }
138
- })();
139
- };
140
-
141
- // Create the concurrent runners in a detached (non-awaited)
142
- // promise. We need this so we can await the `next()` calls
143
- // to stop creating runners before hitting the concurrency limit
144
- // if the iterable has already been marked as done.
145
- // NOTE: We *must* do this for async iterators otherwise we'll spin up
146
- // infinite `next()` calls by default and never start the event loop.
147
- (async () => {
148
- for (let index = 0; index < concurrency; index++) {
149
- try {
150
- // eslint-disable-next-line no-await-in-loop
151
- await next();
152
- } catch (error) {
153
- reject(error);
154
- break;
155
- }
156
-
157
- if (isIterableDone || isRejected) {
158
- break;
159
- }
160
- }
161
- })();
162
- });
163
- }
164
-
165
- const pMapSkip = Symbol('skip');
166
-
167
- export { pMap as default, pMapSkip };
package/dist/index.d.cts DELETED
@@ -1,86 +0,0 @@
1
- import { Action } from '@iflyrpa/actions';
2
- export { ActionMethodParams } from '@iflyrpa/actions';
3
- import * as playwright_core from 'playwright-core';
4
- import { LoggerImplement, AutomateTask, ElectronApplication, PageParams } from '@iflyrpa/share';
5
-
6
- declare class Logger implements LoggerImplement {
7
- static instance: Logger | null;
8
- private stream;
9
- constructor(cachePath: string);
10
- static getInstance(cachePath: string): Logger;
11
- debug(...msg: any[]): void;
12
- info(...msg: any[]): void;
13
- warn(...msg: any[]): void;
14
- error(prefix: string, err?: unknown): void;
15
- close(): void;
16
- }
17
-
18
- declare class PackageManager {
19
- private task;
20
- constructor(task: Task);
21
- private getManifest;
22
- private extract;
23
- require(module: string): any;
24
- install(name: string, version: string): Promise<void>;
25
- update(name: string): Promise<string>;
26
- }
27
-
28
- interface TaskParams {
29
- debug?: boolean;
30
- cachePath: string;
31
- forceUpdate?: boolean;
32
- }
33
- declare class Task implements AutomateTask {
34
- logger: Logger;
35
- cachePath: string;
36
- debug: boolean;
37
- packagesDir: string;
38
- packageManager: PackageManager;
39
- private playwrightPackage;
40
- private electronPackage;
41
- private _electronApp;
42
- /**
43
- * 应用是否已关闭
44
- */
45
- isClosed: boolean;
46
- constructor({ cachePath, debug }: TaskParams);
47
- /**
48
- * 安装 playwright
49
- * @returns
50
- */
51
- private installPlaywright;
52
- /**
53
- * 安装 electron
54
- * @returns
55
- */
56
- private installElectron;
57
- /**
58
- * 启动 Electron
59
- * @returns
60
- */
61
- launchApp(): Promise<ElectronApplication>;
62
- /**
63
- * 临时文件目录
64
- * @returns
65
- */
66
- getTmpPath(): string;
67
- /**
68
- * 清空临时文件
69
- */
70
- private clearTmpPath;
71
- /**
72
- * 关闭 playwright 启动的 electron 客户端
73
- * @returns
74
- */
75
- close(): Promise<void>;
76
- createPage(pageParams: PageParams): Promise<playwright_core.Page>;
77
- }
78
-
79
- declare class RpaTask extends Task {
80
- actions: Action;
81
- constructor(params: TaskParams);
82
- private update;
83
- }
84
- declare const version: string;
85
-
86
- export { RpaTask, version };
package/dist/index.d.mts DELETED
@@ -1,86 +0,0 @@
1
- import { Action } from '@iflyrpa/actions';
2
- export { ActionMethodParams } from '@iflyrpa/actions';
3
- import * as playwright_core from 'playwright-core';
4
- import { LoggerImplement, AutomateTask, ElectronApplication, PageParams } from '@iflyrpa/share';
5
-
6
- declare class Logger implements LoggerImplement {
7
- static instance: Logger | null;
8
- private stream;
9
- constructor(cachePath: string);
10
- static getInstance(cachePath: string): Logger;
11
- debug(...msg: any[]): void;
12
- info(...msg: any[]): void;
13
- warn(...msg: any[]): void;
14
- error(prefix: string, err?: unknown): void;
15
- close(): void;
16
- }
17
-
18
- declare class PackageManager {
19
- private task;
20
- constructor(task: Task);
21
- private getManifest;
22
- private extract;
23
- require(module: string): any;
24
- install(name: string, version: string): Promise<void>;
25
- update(name: string): Promise<string>;
26
- }
27
-
28
- interface TaskParams {
29
- debug?: boolean;
30
- cachePath: string;
31
- forceUpdate?: boolean;
32
- }
33
- declare class Task implements AutomateTask {
34
- logger: Logger;
35
- cachePath: string;
36
- debug: boolean;
37
- packagesDir: string;
38
- packageManager: PackageManager;
39
- private playwrightPackage;
40
- private electronPackage;
41
- private _electronApp;
42
- /**
43
- * 应用是否已关闭
44
- */
45
- isClosed: boolean;
46
- constructor({ cachePath, debug }: TaskParams);
47
- /**
48
- * 安装 playwright
49
- * @returns
50
- */
51
- private installPlaywright;
52
- /**
53
- * 安装 electron
54
- * @returns
55
- */
56
- private installElectron;
57
- /**
58
- * 启动 Electron
59
- * @returns
60
- */
61
- launchApp(): Promise<ElectronApplication>;
62
- /**
63
- * 临时文件目录
64
- * @returns
65
- */
66
- getTmpPath(): string;
67
- /**
68
- * 清空临时文件
69
- */
70
- private clearTmpPath;
71
- /**
72
- * 关闭 playwright 启动的 electron 客户端
73
- * @returns
74
- */
75
- close(): Promise<void>;
76
- createPage(pageParams: PageParams): Promise<playwright_core.Page>;
77
- }
78
-
79
- declare class RpaTask extends Task {
80
- actions: Action;
81
- constructor(params: TaskParams);
82
- private update;
83
- }
84
- declare const version: string;
85
-
86
- export { RpaTask, version };