@lvce-editor/test-worker 3.7.0 → 3.9.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.
Files changed (2) hide show
  1. package/dist/testWorkerMain.js +111 -49
  2. package/package.json +8 -62
@@ -430,10 +430,10 @@ const create$4 = (method, params) => {
430
430
  };
431
431
  };
432
432
  const callbacks = Object.create(null);
433
- const set = (id, fn) => {
433
+ const set$1 = (id, fn) => {
434
434
  callbacks[id] = fn;
435
435
  };
436
- const get = id => {
436
+ const get$1 = id => {
437
437
  return callbacks[id];
438
438
  };
439
439
  const remove = id => {
@@ -449,7 +449,7 @@ const registerPromise = () => {
449
449
  resolve,
450
450
  promise
451
451
  } = Promise.withResolvers();
452
- set(id, resolve);
452
+ set$1(id, resolve);
453
453
  return {
454
454
  id,
455
455
  promise
@@ -606,7 +606,7 @@ const warn = (...args) => {
606
606
  console.warn(...args);
607
607
  };
608
608
  const resolve = (id, response) => {
609
- const fn = get(id);
609
+ const fn = get$1(id);
610
610
  if (!fn) {
611
611
  console.log(response);
612
612
  warn(`callback ${id} may already be disposed`);
@@ -823,7 +823,7 @@ const handleIpc = ipc => {
823
823
  ipc.on('message', handleMessage);
824
824
  }
825
825
  };
826
- const listen$2 = async (module, options) => {
826
+ const listen$1 = async (module, options) => {
827
827
  const rawIpc = await module.listen(options);
828
828
  if (module.signal) {
829
829
  module.signal(rawIpc);
@@ -836,7 +836,7 @@ const create$1 = async ({
836
836
  }) => {
837
837
  // TODO create a commandMap per rpc instance
838
838
  register(commandMap);
839
- const ipc = await listen$2(IpcChildWithModuleWorkerAndMessagePort$1);
839
+ const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
840
840
  handleIpc(ipc);
841
841
  const rpc = createRpc(ipc);
842
842
  return rpc;
@@ -846,31 +846,29 @@ const WebWorkerRpcClient = {
846
846
  create: create$1
847
847
  };
848
848
 
849
- const state$1 = {
850
- rpc: undefined
849
+ const RendererWorker = 1;
850
+
851
+ const rpcs = Object.create(null);
852
+ const set = (id, rpc) => {
853
+ rpcs[id] = rpc;
851
854
  };
855
+ const get = id => {
856
+ return rpcs[id];
857
+ };
858
+
852
859
  const invoke = (method, ...params) => {
853
- const rpc = state$1.rpc;
854
- // @ts-ignore
860
+ const rpc = get(RendererWorker);
855
861
  return rpc.invoke(method, ...params);
856
862
  };
857
863
  const invokeAndTransfer = (method, ...params) => {
858
- const rpc = state$1.rpc;
859
- // @ts-ignore
864
+ const rpc = get(RendererWorker);
860
865
  return rpc.invokeAndTransfer(method, ...params);
861
866
  };
862
- const listen$1 = ipc => {
863
- };
864
- const setRpc = rpc => {
865
- state$1.rpc = rpc;
866
- };
867
867
 
868
868
  const Rpc = {
869
869
  __proto__: null,
870
870
  invoke,
871
- invokeAndTransfer,
872
- listen: listen$1,
873
- setRpc
871
+ invokeAndTransfer
874
872
  };
875
873
 
876
874
  const Fail = 'fail';
@@ -1057,6 +1055,11 @@ const expect$1 = locator => {
1057
1055
  };
1058
1056
  };
1059
1057
 
1058
+ const Expect = {
1059
+ __proto__: null,
1060
+ expect: expect$1
1061
+ };
1062
+
1060
1063
  const nameAnonymousFunction = (fn, name) => {
1061
1064
  Object.defineProperty(fn, 'name', {
1062
1065
  value: name
@@ -1180,7 +1183,9 @@ test.skip = async id => {
1180
1183
  const text = `test skipped ${id}`;
1181
1184
  await invoke('TestFrameWork.showOverlay', state, background, text);
1182
1185
  };
1183
- const expect = expect$1;
1186
+ const {
1187
+ expect
1188
+ } = Expect;
1184
1189
 
1185
1190
  const TestFrameWork = {
1186
1191
  __proto__: null,
@@ -1202,17 +1207,17 @@ const handleClickClose = async () => {
1202
1207
  const handleClickCopy = async () => {
1203
1208
  return invoke('About.handleClickCopy');
1204
1209
  };
1205
- const focusNext$6 = async () => {
1210
+ const focusNext$7 = async () => {
1206
1211
  return invoke('About.focusNext');
1207
1212
  };
1208
- const focusPrevious$4 = async () => {
1213
+ const focusPrevious$5 = async () => {
1209
1214
  return invoke('About.focusPrevious');
1210
1215
  };
1211
1216
 
1212
1217
  const TestFrameWorkComponentAbout = {
1213
1218
  __proto__: null,
1214
- focusNext: focusNext$6,
1215
- focusPrevious: focusPrevious$4,
1219
+ focusNext: focusNext$7,
1220
+ focusPrevious: focusPrevious$5,
1216
1221
  handleClickClose,
1217
1222
  handleClickCopy,
1218
1223
  handleClickOk,
@@ -1222,22 +1227,22 @@ const TestFrameWorkComponentAbout = {
1222
1227
  const focus$2 = async () => {
1223
1228
  await invoke('ActivityBar.focus');
1224
1229
  };
1225
- const focusFirst$3 = async () => {
1230
+ const focusFirst$4 = async () => {
1226
1231
  await invoke('ActivityBar.focusFirst');
1227
1232
  };
1228
- const focusLast$2 = async () => {
1233
+ const focusLast$3 = async () => {
1229
1234
  await invoke('ActivityBar.focusLast');
1230
1235
  };
1231
- const focusNext$5 = async () => {
1236
+ const focusNext$6 = async () => {
1232
1237
  await invoke('ActivityBar.focusNext');
1233
1238
  };
1234
- const focusPrevious$3 = async () => {
1239
+ const focusPrevious$4 = async () => {
1235
1240
  await invoke('ActivityBar.focusPrevious');
1236
1241
  };
1237
- const handleClick$1 = async index => {
1242
+ const handleClick$2 = async index => {
1238
1243
  await invoke('ActivityBar.handleClick', index);
1239
1244
  };
1240
- const handleContextMenu = async () => {
1245
+ const handleContextMenu$1 = async () => {
1241
1246
  await invoke('ActivityBar.handleContextMenu');
1242
1247
  };
1243
1248
  const selectCurrent = async () => {
@@ -1247,12 +1252,12 @@ const selectCurrent = async () => {
1247
1252
  const TestFrameworkComponentActivityBar = {
1248
1253
  __proto__: null,
1249
1254
  focus: focus$2,
1250
- focusFirst: focusFirst$3,
1251
- focusLast: focusLast$2,
1252
- focusNext: focusNext$5,
1253
- focusPrevious: focusPrevious$3,
1254
- handleClick: handleClick$1,
1255
- handleContextMenu,
1255
+ focusFirst: focusFirst$4,
1256
+ focusLast: focusLast$3,
1257
+ focusNext: focusNext$6,
1258
+ focusPrevious: focusPrevious$4,
1259
+ handleClick: handleClick$2,
1260
+ handleContextMenu: handleContextMenu$1,
1256
1261
  selectCurrent
1257
1262
  };
1258
1263
 
@@ -1540,7 +1545,7 @@ const openContextMenu = async index => {
1540
1545
  const focus$1 = async () => {
1541
1546
  await invoke('Explorer.focusIndex', -1);
1542
1547
  };
1543
- const focusNext$4 = async () => {
1548
+ const focusNext$5 = async () => {
1544
1549
  await invoke('Explorer.focusNext');
1545
1550
  };
1546
1551
  const focusIndex$3 = async index => {
@@ -1552,10 +1557,10 @@ const clickCurrent = async () => {
1552
1557
  const handleArrowLeft = async () => {
1553
1558
  await invoke('Explorer.handleArrowLeft');
1554
1559
  };
1555
- const focusLast$1 = async () => {
1560
+ const focusLast$2 = async () => {
1556
1561
  await invoke('Explorer.focusLast');
1557
1562
  };
1558
- const focusFirst$2 = async () => {
1563
+ const focusFirst$3 = async () => {
1559
1564
  await invoke('Explorer.focusFirst');
1560
1565
  };
1561
1566
  const removeDirent = async () => {
@@ -1567,7 +1572,7 @@ const expandRecursively = async () => {
1567
1572
  const newFile = async () => {
1568
1573
  await invoke('Explorer.newFile');
1569
1574
  };
1570
- const handleClick = async index => {
1575
+ const handleClick$1 = async index => {
1571
1576
  await invoke('Explorer.handleClick', index);
1572
1577
  };
1573
1578
  const rename = async () => {
@@ -1594,12 +1599,12 @@ const TestFrameWorkComponentExplorer = {
1594
1599
  expandAll,
1595
1600
  expandRecursively,
1596
1601
  focus: focus$1,
1597
- focusFirst: focusFirst$2,
1602
+ focusFirst: focusFirst$3,
1598
1603
  focusIndex: focusIndex$3,
1599
- focusLast: focusLast$1,
1600
- focusNext: focusNext$4,
1604
+ focusLast: focusLast$2,
1605
+ focusNext: focusNext$5,
1601
1606
  handleArrowLeft,
1602
- handleClick,
1607
+ handleClick: handleClick$1,
1603
1608
  newFile,
1604
1609
  openContextMenu,
1605
1610
  removeDirent,
@@ -1626,9 +1631,18 @@ const TestFrameWorkComponentExtension = {
1626
1631
 
1627
1632
  const Memfs = 'memfs';
1628
1633
 
1634
+ const Backslash = '\\';
1629
1635
  const Slash$1 = '/';
1630
1636
 
1631
- const Slash = Slash$1;
1637
+ const Character = {
1638
+ __proto__: null,
1639
+ Backslash,
1640
+ Slash: Slash$1
1641
+ };
1642
+
1643
+ const {
1644
+ Slash
1645
+ } = Character;
1632
1646
 
1633
1647
  const writeFile = async (path, content) => {
1634
1648
  await invoke('FileSystem.writeFile', path, content);
@@ -1677,7 +1691,7 @@ const TestFrameWorkComponentFileSystem = {
1677
1691
  writeFile
1678
1692
  };
1679
1693
 
1680
- const focusNext$3 = async () => {
1694
+ const focusNext$4 = async () => {
1681
1695
  await invoke('FindWidget.focusNext');
1682
1696
  };
1683
1697
  const setValue$2 = async value => {
@@ -1686,7 +1700,7 @@ const setValue$2 = async value => {
1686
1700
 
1687
1701
  const TestFrameWorkComponentFindWidget = {
1688
1702
  __proto__: null,
1689
- focusNext: focusNext$3,
1703
+ focusNext: focusNext$4,
1690
1704
  setValue: setValue$2
1691
1705
  };
1692
1706
 
@@ -1699,6 +1713,52 @@ const TestFrameWorkComponentIconTheme = {
1699
1713
  setIconTheme
1700
1714
  };
1701
1715
 
1716
+ const open$3 = () => {
1717
+ // TODO
1718
+ throw new Error('not implemented');
1719
+ };
1720
+ const handleInput$1 = value => {
1721
+ return invoke('KeyBindings.handleInput', value);
1722
+ };
1723
+ const handleClick = (x, y) => {
1724
+ return invoke('KeyBindings.handleClick', x, y);
1725
+ };
1726
+ const handleWheel$1 = (deltaMode, deltaY) => {
1727
+ return invoke('KeyBindings.handleWheel', deltaMode, deltaY);
1728
+ };
1729
+ const handleDoubleClick = (x, y) => {
1730
+ return invoke('KeyBindings.handleDoubleClick', x, y);
1731
+ };
1732
+ const focusNext$3 = () => {
1733
+ return invoke('KeyBindings.focusNext');
1734
+ };
1735
+ const focusPrevious$3 = () => {
1736
+ return invoke('KeyBindings.focusPrevious');
1737
+ };
1738
+ const focusFirst$2 = () => {
1739
+ return invoke('KeyBindings.focusFirst');
1740
+ };
1741
+ const focusLast$1 = () => {
1742
+ return invoke('KeyBindings.focusLast');
1743
+ };
1744
+ const handleContextMenu = (button, x, y) => {
1745
+ return invoke('KeyBindings.handleContextMenu', button, x, y);
1746
+ };
1747
+
1748
+ const TestFrameWorkComponentKeyBindingsEditor = {
1749
+ __proto__: null,
1750
+ focusFirst: focusFirst$2,
1751
+ focusLast: focusLast$1,
1752
+ focusNext: focusNext$3,
1753
+ focusPrevious: focusPrevious$3,
1754
+ handleClick,
1755
+ handleContextMenu,
1756
+ handleDoubleClick,
1757
+ handleInput: handleInput$1,
1758
+ handleWheel: handleWheel$1,
1759
+ open: open$3
1760
+ };
1761
+
1702
1762
  const getKeyOptions = rawKey => {
1703
1763
  if (rawKey.includes('+')) {
1704
1764
  const parts = rawKey.split('+');
@@ -2071,6 +2131,7 @@ const getPortTuple = () => {
2071
2131
  };
2072
2132
  };
2073
2133
 
2134
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
2074
2135
  const waitForFirstEventEvent = async port => {
2075
2136
  const {
2076
2137
  resolve,
@@ -2165,6 +2226,7 @@ const TestFrameWorkComponent = {
2165
2226
  FileSystem: TestFrameWorkComponentFileSystem,
2166
2227
  FindWidget: TestFrameWorkComponentFindWidget,
2167
2228
  IconTheme: TestFrameWorkComponentIconTheme,
2229
+ KeyBindingsEditor: TestFrameWorkComponentKeyBindingsEditor,
2168
2230
  KeyBoard: TestFrameWorkComponentKeyBoard,
2169
2231
  Main: TestFrameWorkComponentMain,
2170
2232
  Panel: TestFrameWorkComponentPanel,
@@ -2223,7 +2285,7 @@ const listen = async () => {
2223
2285
  const rpc = await WebWorkerRpcClient.create({
2224
2286
  commandMap: commandMap
2225
2287
  });
2226
- setRpc(rpc);
2288
+ set(RendererWorker, rpc);
2227
2289
  };
2228
2290
 
2229
2291
  const main = async () => {
package/package.json CHANGED
@@ -1,77 +1,23 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "3.7.0",
3
+ "version": "3.9.0",
4
4
  "description": "",
5
- "main": "dist/testWorkerMain.js",
5
+ "keywords": [],
6
+ "license": "MIT",
7
+ "author": "",
6
8
  "type": "module",
9
+ "main": "dist/testWorkerMain.js",
7
10
  "directories": {
8
11
  "test": "test"
9
12
  },
10
- "keywords": [],
11
- "author": "",
12
- "license": "MIT",
13
- "xo": {
14
- "rules": {
15
- "unicorn/filename-case": "off",
16
- "unicorn/prefer-query-selector": "off",
17
- "indent": "off",
18
- "semi": "off",
19
- "no-unused-vars": "off",
20
- "unicorn/numeric-separators-style": "off",
21
- "no-extra-semi": "off",
22
- "arrow-body-style": "off",
23
- "padded-blocks": "off",
24
- "capitalized-comments": "off",
25
- "padding-line-between-statements": "off",
26
- "arrow-parens": "off",
27
- "no-warning-comments": "off",
28
- "array-bracket-spacing": "off",
29
- "comma-spacing": "off",
30
- "unicorn/no-array-callback-reference": "off",
31
- "comma-dangle": "off",
32
- "operator-linebreak": "off",
33
- "no-case-declarations": "off",
34
- "no-undef": "off",
35
- "object-curly-spacing": "off",
36
- "object-shorthand": "off",
37
- "complexity": "off",
38
- "no-labels": "off",
39
- "no-multi-assign": "off",
40
- "max-params": "off",
41
- "no-bitwise": "off",
42
- "unicorn/prefer-math-trunc": "off",
43
- "no-await-in-loop": "off",
44
- "unicorn/prefer-add-event-listener": "off",
45
- "no-unused-expressions": "off",
46
- "node/prefer-global/process": "off",
47
- "unicorn/no-for-loop": "off",
48
- "unicorn/prevent-abbreviations": "off",
49
- "unicorn/switch-case-braces": "off",
50
- "quotes": "off",
51
- "@typescript-eslint/semi": "off",
52
- "object-curly-newline": "off",
53
- "@typescript-eslint/naming-convention": "off",
54
- "@typescript-eslint/indent": "off",
55
- "n/file-extension-in-import": "off",
56
- "@typescript-eslint/promise-function-async": "off",
57
- "@typescript-eslint/no-unsafe-argument": "off",
58
- "@typescript-eslint/quotes": "off",
59
- "@typescript-eslint/object-curly-spacing": "off",
60
- "@typescript-eslint/padding-line-between-statements": "off",
61
- "@typescript-eslint/prefer-ts-expect-error": "off",
62
- "@typescript-eslint/consistent-type-definitions": "off",
63
- "@typescript-eslint/ban-ts-comment": "off",
64
- "@typescript-eslint/no-confusing-void-expression": "off"
65
- },
66
- "ignores": [
67
- "distmin"
68
- ]
69
- },
70
13
  "nodemonConfig": {
71
14
  "watch": [
72
15
  "src"
73
16
  ],
74
17
  "ext": "ts,js",
75
18
  "exec": "node scripts/build.js"
19
+ },
20
+ "engines": {
21
+ "node": ">=22"
76
22
  }
77
23
  }