@lvce-editor/test-with-playwright-worker 14.2.0 → 14.3.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/workerMain.js +40 -39
- package/package.json +2 -2
package/dist/workerMain.js
CHANGED
|
@@ -377,6 +377,27 @@ const IpcChildWithNodeWorker$1 = {
|
|
|
377
377
|
wrap: wrap$b
|
|
378
378
|
};
|
|
379
379
|
|
|
380
|
+
class CommandNotFoundError extends Error {
|
|
381
|
+
constructor(command) {
|
|
382
|
+
super(`Command not found ${command}`);
|
|
383
|
+
this.name = 'CommandNotFoundError';
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const commands = Object.create(null);
|
|
387
|
+
const register = commandMap => {
|
|
388
|
+
Object.assign(commands, commandMap);
|
|
389
|
+
};
|
|
390
|
+
const getCommand = key => {
|
|
391
|
+
return commands[key];
|
|
392
|
+
};
|
|
393
|
+
const execute = (command, ...args) => {
|
|
394
|
+
const fn = getCommand(command);
|
|
395
|
+
if (!fn) {
|
|
396
|
+
throw new CommandNotFoundError(command);
|
|
397
|
+
}
|
|
398
|
+
return fn(...args);
|
|
399
|
+
};
|
|
400
|
+
|
|
380
401
|
const Two$1 = '2.0';
|
|
381
402
|
const callbacks = Object.create(null);
|
|
382
403
|
const get$1 = id => {
|
|
@@ -578,7 +599,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
578
599
|
}
|
|
579
600
|
};
|
|
580
601
|
};
|
|
581
|
-
const create$1 = (id, error) => {
|
|
602
|
+
const create$1$1 = (id, error) => {
|
|
582
603
|
return {
|
|
583
604
|
jsonrpc: Two$1,
|
|
584
605
|
id,
|
|
@@ -589,9 +610,9 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
589
610
|
const prettyError = preparePrettyError(error);
|
|
590
611
|
logError(error, prettyError);
|
|
591
612
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
592
|
-
return create$1(id, errorProperty);
|
|
613
|
+
return create$1$1(id, errorProperty);
|
|
593
614
|
};
|
|
594
|
-
const create = (message, result) => {
|
|
615
|
+
const create$4 = (message, result) => {
|
|
595
616
|
return {
|
|
596
617
|
jsonrpc: Two$1,
|
|
597
618
|
id: message.id,
|
|
@@ -600,7 +621,7 @@ const create = (message, result) => {
|
|
|
600
621
|
};
|
|
601
622
|
const getSuccessResponse = (message, result) => {
|
|
602
623
|
const resultProperty = result ?? null;
|
|
603
|
-
return create(message, resultProperty);
|
|
624
|
+
return create$4(message, resultProperty);
|
|
604
625
|
};
|
|
605
626
|
const getErrorResponseSimple = (id, error) => {
|
|
606
627
|
return {
|
|
@@ -692,36 +713,17 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
692
713
|
throw new JsonRpcError('unexpected message');
|
|
693
714
|
};
|
|
694
715
|
|
|
695
|
-
class CommandNotFoundError extends Error {
|
|
696
|
-
constructor(command) {
|
|
697
|
-
super(`Command not found ${command}`);
|
|
698
|
-
this.name = 'CommandNotFoundError';
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
const commands = Object.create(null);
|
|
702
|
-
const register = commandMap => {
|
|
703
|
-
Object.assign(commands, commandMap);
|
|
704
|
-
};
|
|
705
|
-
const getCommand = key => {
|
|
706
|
-
return commands[key];
|
|
707
|
-
};
|
|
708
|
-
const execute = (command, ...args) => {
|
|
709
|
-
const fn = getCommand(command);
|
|
710
|
-
if (!fn) {
|
|
711
|
-
throw new CommandNotFoundError(command);
|
|
712
|
-
}
|
|
713
|
-
return fn(...args);
|
|
714
|
-
};
|
|
715
|
-
|
|
716
716
|
const Two = '2.0';
|
|
717
|
-
|
|
717
|
+
|
|
718
|
+
const create$3 = (method, params) => {
|
|
718
719
|
return {
|
|
719
720
|
jsonrpc: Two,
|
|
720
721
|
method,
|
|
721
722
|
params
|
|
722
723
|
};
|
|
723
724
|
};
|
|
724
|
-
|
|
725
|
+
|
|
726
|
+
const create$2 = (id, method, params) => {
|
|
725
727
|
const message = {
|
|
726
728
|
id,
|
|
727
729
|
jsonrpc: Two,
|
|
@@ -730,15 +732,14 @@ const create$s = (id, method, params) => {
|
|
|
730
732
|
};
|
|
731
733
|
return message;
|
|
732
734
|
};
|
|
735
|
+
|
|
733
736
|
let id = 0;
|
|
734
|
-
const create$
|
|
737
|
+
const create$1 = () => {
|
|
735
738
|
return ++id;
|
|
736
739
|
};
|
|
737
740
|
|
|
738
|
-
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
739
|
-
|
|
740
741
|
const registerPromise = map => {
|
|
741
|
-
const id = create$
|
|
742
|
+
const id = create$1();
|
|
742
743
|
const {
|
|
743
744
|
promise,
|
|
744
745
|
resolve
|
|
@@ -756,7 +757,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
756
757
|
id,
|
|
757
758
|
promise
|
|
758
759
|
} = registerPromise(callbacks);
|
|
759
|
-
const message = create$
|
|
760
|
+
const message = create$2(id, method, params);
|
|
760
761
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
761
762
|
ipc.sendAndTransfer(message);
|
|
762
763
|
} else {
|
|
@@ -792,12 +793,13 @@ const createRpc = ipc => {
|
|
|
792
793
|
* @deprecated
|
|
793
794
|
*/
|
|
794
795
|
send(method, ...params) {
|
|
795
|
-
const message = create$
|
|
796
|
+
const message = create$3(method, params);
|
|
796
797
|
ipc.send(message);
|
|
797
798
|
}
|
|
798
799
|
};
|
|
799
800
|
return rpc;
|
|
800
801
|
};
|
|
802
|
+
|
|
801
803
|
const requiresSocket = () => {
|
|
802
804
|
return false;
|
|
803
805
|
};
|
|
@@ -812,6 +814,7 @@ const handleMessage = event => {
|
|
|
812
814
|
const actualExecute = event?.target?.execute || execute;
|
|
813
815
|
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
814
816
|
};
|
|
817
|
+
|
|
815
818
|
const handleIpc = ipc => {
|
|
816
819
|
if ('addEventListener' in ipc) {
|
|
817
820
|
ipc.addEventListener('message', handleMessage);
|
|
@@ -820,6 +823,7 @@ const handleIpc = ipc => {
|
|
|
820
823
|
ipc.on('message', handleMessage);
|
|
821
824
|
}
|
|
822
825
|
};
|
|
826
|
+
|
|
823
827
|
const listen = async (module, options) => {
|
|
824
828
|
const rawIpc = await module.listen(options);
|
|
825
829
|
if (module.signal) {
|
|
@@ -828,7 +832,8 @@ const listen = async (module, options) => {
|
|
|
828
832
|
const ipc = module.wrap(rawIpc);
|
|
829
833
|
return ipc;
|
|
830
834
|
};
|
|
831
|
-
|
|
835
|
+
|
|
836
|
+
const create = async ({
|
|
832
837
|
commandMap
|
|
833
838
|
}) => {
|
|
834
839
|
// TODO create a commandMap per rpc instance
|
|
@@ -838,10 +843,6 @@ const create$7 = async ({
|
|
|
838
843
|
const rpc = createRpc(ipc);
|
|
839
844
|
return rpc;
|
|
840
845
|
};
|
|
841
|
-
const NodeWorkerRpcClient = {
|
|
842
|
-
__proto__: null,
|
|
843
|
-
create: create$7
|
|
844
|
-
};
|
|
845
846
|
|
|
846
847
|
const rpcs = Object.create(null);
|
|
847
848
|
const set = (id, rpc) => {
|
|
@@ -1377,7 +1378,7 @@ const main = async () => {
|
|
|
1377
1378
|
on('SIGINT', handleSigint);
|
|
1378
1379
|
on('SIGTERM', handleSigTerm);
|
|
1379
1380
|
on('uncaughtExceptionMonitor', handleUncaughtExceptionMonitor);
|
|
1380
|
-
const rpc = await
|
|
1381
|
+
const rpc = await create({
|
|
1381
1382
|
commandMap: commandMap
|
|
1382
1383
|
});
|
|
1383
1384
|
set(Cli, rpc);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/test-with-playwright-worker",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"description": "Worker package for test-with-playwright",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"type": "module",
|
|
13
13
|
"main": "dist/workerMain.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@playwright/test": "1.58.
|
|
15
|
+
"@playwright/test": "1.58.2"
|
|
16
16
|
},
|
|
17
17
|
"engines": {
|
|
18
18
|
"node": ">=24"
|