@lvce-editor/eslint-plugin-rpc 19.0.1 → 19.1.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/index.js +1535 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,205 @@
1
- const rpcRegistryModule = '@lvce-editor/rpc-registry';
1
+ const meta$4 = {
2
+ docs: {
3
+ description: 'Disallow the low-level @lvce-editor/ipc and @lvce-editor/json-rpc packages in favor of @lvce-editor/rpc'
4
+ },
5
+ messages: {
6
+ noLowLevelPackage: 'Do not import {{source}}. Use @lvce-editor/rpc, which wraps IPC and JSON-RPC handling.',
7
+ useRpcReplacement: 'Do not import {{name}} from {{source}}. Use {{replacement}} from @lvce-editor/rpc instead.'
8
+ },
9
+ schema: [{
10
+ additionalProperties: false,
11
+ properties: {
12
+ allow: {
13
+ items: {
14
+ type: 'string'
15
+ },
16
+ type: 'array'
17
+ }
18
+ },
19
+ type: 'object'
20
+ }],
21
+ type: 'suggestion'
22
+ };
23
+ const lowLevelPackages = ['@lvce-editor/ipc', '@lvce-editor/json-rpc'];
24
+
25
+ // @lvce-editor/ipc classes and the @lvce-editor/rpc class that wraps the same transport.
26
+ const replacements = {
27
+ IpcChildWithElectronMessagePort: 'ElectronMessagePortRpcClient',
28
+ IpcChildWithElectronUtilityProcess: 'ElectronUtilityProcessRpcClient',
29
+ IpcChildWithElectronWindow: 'ElectronWindowRpcClient',
30
+ IpcChildWithMessagePort: 'MessagePortRpcClient',
31
+ IpcChildWithModuleWorker: 'WebWorkerRpcClient',
32
+ IpcChildWithNodeForkedProcess: 'NodeForkedProcessRpcClient',
33
+ IpcChildWithNodeWorker: 'NodeWorkerRpcClient',
34
+ IpcChildWithWebSocket: 'NodeWebSocketRpcClient',
35
+ IpcParentWithElectronUtilityProcess: 'ElectronUtilityProcessRpcParent',
36
+ IpcParentWithMessagePort: 'MessagePortRpcParent',
37
+ IpcParentWithModuleWorker: 'ModuleWorkerRpcParent',
38
+ IpcParentWithNodeForkedProcess: 'NodeForkedProcessRpcParent',
39
+ IpcParentWithNodeWorker: 'NodeWorkerRpcParent',
40
+ IpcParentWithWebSocket: 'WebSocketRpcParent'
41
+ };
42
+ const getPackageName = source => {
43
+ return lowLevelPackages.find(name => source === name || source.startsWith(`${name}/`));
44
+ };
45
+ const getImportedName = (specifier, key) => {
46
+ const node = key === 'imported' && specifier.type === 'ImportSpecifier' ? specifier.imported : specifier.local;
47
+ if (node.type === 'Identifier') {
48
+ return node.name;
49
+ }
50
+ return typeof node.value === 'string' ? node.value : undefined;
51
+ };
52
+ const create$4 = context => {
53
+ const [options] = context.options;
54
+ const allowed = new Set(options?.allow);
55
+ const getReportedPackage = source => {
56
+ if (source?.type !== 'Literal' || typeof source.value !== 'string') {
57
+ return undefined;
58
+ }
59
+ const packageName = getPackageName(source.value);
60
+ return packageName && !allowed.has(packageName) ? packageName : undefined;
61
+ };
62
+ const reportSpecifiers = (node, source, specifiers) => {
63
+ let reported = false;
64
+ for (const specifier of specifiers) {
65
+ if (specifier.type !== 'ImportSpecifier' && specifier.type !== 'ExportSpecifier') {
66
+ continue;
67
+ }
68
+ const name = getImportedName(specifier, specifier.type === 'ImportSpecifier' ? 'imported' : 'local');
69
+ const replacement = name === undefined ? undefined : replacements[name];
70
+ if (!replacement) {
71
+ continue;
72
+ }
73
+ reported = true;
74
+ context.report({
75
+ data: {
76
+ name: name ?? '',
77
+ replacement,
78
+ source
79
+ },
80
+ messageId: 'useRpcReplacement',
81
+ node: specifier
82
+ });
83
+ }
84
+ if (!reported) {
85
+ context.report({
86
+ data: {
87
+ source
88
+ },
89
+ messageId: 'noLowLevelPackage',
90
+ node: node.source ?? node
91
+ });
92
+ }
93
+ };
94
+ return {
95
+ ExportAllDeclaration(node) {
96
+ const source = getReportedPackage(node.source);
97
+ if (source) {
98
+ context.report({
99
+ data: {
100
+ source
101
+ },
102
+ messageId: 'noLowLevelPackage',
103
+ node: node.source
104
+ });
105
+ }
106
+ },
107
+ ExportNamedDeclaration(node) {
108
+ const source = getReportedPackage(node.source);
109
+ if (source) {
110
+ reportSpecifiers(node, source, node.specifiers);
111
+ }
112
+ },
113
+ ImportDeclaration(node) {
114
+ const source = getReportedPackage(node.source);
115
+ if (source) {
116
+ reportSpecifiers(node, source, node.specifiers);
117
+ }
118
+ },
119
+ ImportExpression(node) {
120
+ const source = getReportedPackage(node.source);
121
+ if (source) {
122
+ context.report({
123
+ data: {
124
+ source
125
+ },
126
+ messageId: 'noLowLevelPackage',
127
+ node: node.source
128
+ });
129
+ }
130
+ }
131
+ };
132
+ };
133
+
134
+ const noLowLevelRpcPackages = {
135
+ __proto__: null,
136
+ create: create$4,
137
+ meta: meta$4
138
+ };
139
+
140
+ const meta$3 = {
141
+ docs: {
142
+ description: 'Disallow building JSON-RPC messages for LVCE commands by hand'
143
+ },
144
+ messages: {
145
+ noManualJsonRpcMessage: "Do not build JSON-RPC messages by hand. Use rpc.send('{{method}}', ...) or rpc.invoke('{{method}}', ...) from @lvce-editor/rpc instead."
146
+ },
147
+ schema: [],
148
+ type: 'suggestion'
149
+ };
150
+
151
+ // LVCE command ids look like Namespace.method. Other JSON-RPC protocols, such as the
152
+ // Language Server Protocol (initialize, textDocument/didOpen), are not reported.
153
+ const commandIdPattern = /^[A-Z][A-Za-z0-9]*\.[A-Za-z0-9]+$/;
154
+ const getPropertyName$1 = property => {
155
+ if (property.computed) {
156
+ return undefined;
157
+ }
158
+ if (property.key.type === 'Identifier') {
159
+ return property.key.name;
160
+ }
161
+ return property.key.type === 'Literal' && typeof property.key.value === 'string' ? property.key.value : undefined;
162
+ };
163
+ const getStringProperty = (node, name) => {
164
+ for (const property of node.properties) {
165
+ if (property.type === 'Property' && getPropertyName$1(property) === name && property.value.type === 'Literal' && typeof property.value.value === 'string') {
166
+ return property.value.value;
167
+ }
168
+ }
169
+ return undefined;
170
+ };
171
+ const create$3 = context => {
172
+ return {
173
+ ObjectExpression(node) {
174
+ if (getStringProperty(node, 'jsonrpc') !== '2.0') {
175
+ return;
176
+ }
177
+ const method = getStringProperty(node, 'method');
178
+ if (method === undefined || !commandIdPattern.test(method)) {
179
+ return;
180
+ }
181
+ context.report({
182
+ data: {
183
+ method
184
+ },
185
+ messageId: 'noManualJsonRpcMessage',
186
+ node
187
+ });
188
+ }
189
+ };
190
+ };
191
+
192
+ const noManualJsonRpcMessages = {
193
+ __proto__: null,
194
+ create: create$3,
195
+ meta: meta$3
196
+ };
197
+
198
+ const rpcRegistryModule$1 = '@lvce-editor/rpc-registry';
2
199
  const isWorkerName = name => {
3
200
  return typeof name === 'string' && (/(?:Worker|Process)$/.test(name) || name === 'ExtensionHost' || name === 'ProcessExplorer');
4
201
  };
5
- const meta$1 = {
202
+ const meta$2 = {
6
203
  docs: {
7
204
  description: 'Disallow destructuring RPC registry workers to preserve tree shaking'
8
205
  },
@@ -11,7 +208,7 @@ const meta$1 = {
11
208
  },
12
209
  type: 'problem'
13
210
  };
14
- const findVariable = (scope, name) => {
211
+ const findVariable$1 = (scope, name) => {
15
212
  let currentScope = scope;
16
213
  while (currentScope) {
17
214
  const variable = currentScope.set.get(name);
@@ -23,46 +220,55 @@ const findVariable = (scope, name) => {
23
220
  return undefined;
24
221
  };
25
222
  const isImportFromRpcRegistry = definition => {
26
- return definition.type === 'ImportBinding' && definition.parent?.source?.value === rpcRegistryModule;
223
+ return definition.type === 'ImportBinding' && definition.parent.source.value === rpcRegistryModule$1;
27
224
  };
28
225
  const isWorkerImport = variable => {
29
226
  return variable?.defs.some(definition => {
30
- if (!isImportFromRpcRegistry(definition) || definition.node?.type !== 'ImportSpecifier') {
227
+ if (!isImportFromRpcRegistry(definition) || definition.node.type !== 'ImportSpecifier') {
31
228
  return false;
32
229
  }
33
230
  const {
34
231
  imported
35
232
  } = definition.node;
36
- return isWorkerName(imported?.name ?? imported?.value);
37
- });
233
+ return isWorkerName(imported.type === 'Identifier' ? imported.name : imported.value);
234
+ }) ?? false;
38
235
  };
39
236
  const isRpcRegistryNamespaceImport = variable => {
40
237
  return variable?.defs.some(definition => {
41
- return isImportFromRpcRegistry(definition) && definition.node?.type === 'ImportNamespaceSpecifier';
42
- });
238
+ return isImportFromRpcRegistry(definition) && definition.node.type === 'ImportNamespaceSpecifier';
239
+ }) ?? false;
240
+ };
241
+
242
+ // Wrappers that do not change the value: optional chaining and TypeScript assertions (not part of ESTree).
243
+ const wrapperTypes = new Set(['ChainExpression', 'TSAsExpression', 'TSNonNullExpression', 'TSSatisfiesExpression', 'TSTypeAssertion']);
244
+ const isNode = node => {
245
+ return typeof node === 'object' && node !== null && 'type' in node && typeof node.type === 'string';
43
246
  };
44
247
  const unwrapExpression = node => {
45
- if (['ChainExpression', 'TSAsExpression', 'TSNonNullExpression', 'TSSatisfiesExpression', 'TSTypeAssertion'].includes(node?.type)) {
248
+ if (!isNode(node)) {
249
+ return undefined;
250
+ }
251
+ if (wrapperTypes.has(node.type) && 'expression' in node) {
46
252
  return unwrapExpression(node.expression);
47
253
  }
48
254
  return node;
49
255
  };
50
256
  const isWorkerProperty = node => {
51
257
  if (node.computed) {
52
- return node.property?.type === 'Literal' && isWorkerName(node.property.value);
258
+ return node.property.type === 'Literal' && isWorkerName(node.property.value);
53
259
  }
54
- return node.property?.type === 'Identifier' && isWorkerName(node.property.name);
260
+ return node.property.type === 'Identifier' && isWorkerName(node.property.name);
55
261
  };
56
262
  const isWorkerExpression = (context, expression, node) => {
57
263
  const unwrappedExpression = unwrapExpression(expression);
58
264
  const scope = context.sourceCode.getScope(node);
59
265
  if (unwrappedExpression?.type === 'Identifier') {
60
- return isWorkerImport(findVariable(scope, unwrappedExpression.name));
266
+ return isWorkerImport(findVariable$1(scope, unwrappedExpression.name));
61
267
  }
62
- if (unwrappedExpression?.type !== 'MemberExpression' || unwrappedExpression.object?.type !== 'Identifier' || !isWorkerProperty(unwrappedExpression)) {
268
+ if (unwrappedExpression?.type !== 'MemberExpression' || unwrappedExpression.object.type !== 'Identifier' || !isWorkerProperty(unwrappedExpression)) {
63
269
  return false;
64
270
  }
65
- return isRpcRegistryNamespaceImport(findVariable(scope, unwrappedExpression.object.name));
271
+ return isRpcRegistryNamespaceImport(findVariable$1(scope, unwrappedExpression.object.name));
66
272
  };
67
273
  const reportObjectPattern = (context, pattern) => {
68
274
  context.report({
@@ -70,7 +276,7 @@ const reportObjectPattern = (context, pattern) => {
70
276
  node: pattern
71
277
  });
72
278
  };
73
- const create$1 = context => {
279
+ const create$2 = context => {
74
280
  return {
75
281
  AssignmentExpression(node) {
76
282
  if (node.left.type === 'ObjectPattern' && isWorkerExpression(context, node.right, node)) {
@@ -86,16 +292,1321 @@ const create$1 = context => {
86
292
  };
87
293
 
88
294
  const noRpcRegistryDestructuring = {
295
+ __proto__: null,
296
+ create: create$2,
297
+ meta: meta$2
298
+ };
299
+
300
+ // Generated by packages/build/src/updateRpcRegistryMethods.ts from @lvce-editor/rpc-registry@9.67.1. Do not edit.
301
+
302
+ const rpcRegistryMethods = {
303
+ AuthProcess: {
304
+ 'OAuthServer.create': {
305
+ hasRest: false,
306
+ method: 'createOauthServer',
307
+ parameterCount: 1
308
+ },
309
+ 'OAuthServer.dispose': {
310
+ hasRest: false,
311
+ method: 'disposeOauthServer',
312
+ parameterCount: 1
313
+ },
314
+ 'OAuthServer.getCode': {
315
+ hasRest: false,
316
+ method: 'getCode',
317
+ parameterCount: 0
318
+ }
319
+ },
320
+ AuthWorker: {
321
+ 'Auth.clearMocks': {
322
+ hasRest: false,
323
+ method: 'clearMocks',
324
+ parameterCount: 0
325
+ },
326
+ 'Auth.login': {
327
+ hasRest: false,
328
+ method: 'login',
329
+ parameterCount: 1
330
+ },
331
+ 'Auth.logout': {
332
+ hasRest: false,
333
+ method: 'logout',
334
+ parameterCount: 1
335
+ }
336
+ },
337
+ BlobWorker: {
338
+ 'Blob.base64StringToBlob': {
339
+ hasRest: false,
340
+ method: 'base64StringToBlob',
341
+ parameterCount: 2
342
+ },
343
+ 'Blob.binaryStringToBlob': {
344
+ hasRest: false,
345
+ method: 'binaryStringToBlob',
346
+ parameterCount: 2
347
+ },
348
+ 'Blob.blobToBinaryString': {
349
+ hasRest: false,
350
+ method: 'blobToBinaryString',
351
+ parameterCount: 1
352
+ },
353
+ 'Blob.terminate': {
354
+ hasRest: false,
355
+ method: 'terminate',
356
+ parameterCount: 0
357
+ }
358
+ },
359
+ CacheWorker: {
360
+ 'Cache.getCacheStorageItem': {
361
+ hasRest: false,
362
+ method: 'getCacheStorageItem',
363
+ parameterCount: 4
364
+ },
365
+ 'Cache.getCacheStorageJsonItem': {
366
+ hasRest: false,
367
+ method: 'getCacheStorageJsonItem',
368
+ parameterCount: 4
369
+ },
370
+ 'Cache.removeCacheStorageItem': {
371
+ hasRest: false,
372
+ method: 'removeCacheStorageItem',
373
+ parameterCount: 4
374
+ },
375
+ 'Cache.setCacheStorageItem': {
376
+ hasRest: false,
377
+ method: 'setCacheStorageItem',
378
+ parameterCount: 6
379
+ },
380
+ 'Cache.setCacheStorageJsonItem': {
381
+ hasRest: false,
382
+ method: 'setCacheStorageJsonItem',
383
+ parameterCount: 5
384
+ },
385
+ 'IndexedDb.addIndexedDbFileHandle': {
386
+ hasRest: false,
387
+ method: 'addIndexedDbFileHandle',
388
+ parameterCount: 3
389
+ },
390
+ 'IndexedDb.getIndexedDbFileHandle': {
391
+ hasRest: false,
392
+ method: 'getIndexedDbFileHandle',
393
+ parameterCount: 2
394
+ },
395
+ 'IndexedDb.removeIndexedDbFileHandle': {
396
+ hasRest: false,
397
+ method: 'removeIndexedDbFileHandle',
398
+ parameterCount: 2
399
+ },
400
+ 'Opfs.readFile': {
401
+ hasRest: false,
402
+ method: 'readFile',
403
+ parameterCount: 1
404
+ },
405
+ 'Opfs.removeFile': {
406
+ hasRest: false,
407
+ method: 'removeFile',
408
+ parameterCount: 1
409
+ },
410
+ 'Opfs.writeFile': {
411
+ hasRest: false,
412
+ method: 'writeFile',
413
+ parameterCount: 2
414
+ }
415
+ },
416
+ ChatCoordinatorWorker: {
417
+ 'ChatNetwork.makeApiRequest': {
418
+ hasRest: false,
419
+ method: 'makeApiRequest',
420
+ parameterCount: 1
421
+ },
422
+ 'ChatNetwork.makeStreamingApiRequest': {
423
+ hasRest: false,
424
+ method: 'makeStreamingApiRequest',
425
+ parameterCount: 1
426
+ }
427
+ },
428
+ ChatDebugWorker: {
429
+ 'ChatDebug.create': {
430
+ hasRest: false,
431
+ method: 'create',
432
+ parameterCount: 1
433
+ },
434
+ 'ChatDebug.loadContent': {
435
+ hasRest: false,
436
+ method: 'loadContent',
437
+ parameterCount: 1
438
+ }
439
+ },
440
+ ChatMathWorker: {
441
+ 'ChatMath.getMathBlockDom': {
442
+ hasRest: false,
443
+ method: 'getMathBlockDom',
444
+ parameterCount: 1
445
+ },
446
+ 'ChatMath.getMathInlineDom': {
447
+ hasRest: false,
448
+ method: 'getMathInlineDom',
449
+ parameterCount: 1
450
+ }
451
+ },
452
+ ChatMessageParsingWorker: {
453
+ 'ChatNetwork.makeApiRequest': {
454
+ hasRest: false,
455
+ method: 'makeApiRequest',
456
+ parameterCount: 1
457
+ },
458
+ 'ChatNetwork.makeStreamingApiRequest': {
459
+ hasRest: false,
460
+ method: 'makeStreamingApiRequest',
461
+ parameterCount: 1
462
+ }
463
+ },
464
+ ChatNetworkWorker: {
465
+ 'ChatNetwork.makeApiRequest': {
466
+ hasRest: false,
467
+ method: 'makeApiRequest',
468
+ parameterCount: 1
469
+ },
470
+ 'ChatNetwork.makeStreamingApiRequest': {
471
+ hasRest: false,
472
+ method: 'makeStreamingApiRequest',
473
+ parameterCount: 1
474
+ }
475
+ },
476
+ ChatStorageWorker: {
477
+ 'ChatStorage.appendEvent': {
478
+ hasRest: false,
479
+ method: 'appendEvent',
480
+ parameterCount: 1
481
+ },
482
+ 'ChatStorage.clear': {
483
+ hasRest: false,
484
+ method: 'clear',
485
+ parameterCount: 0
486
+ },
487
+ 'ChatStorage.deleteSession': {
488
+ hasRest: false,
489
+ method: 'deleteSession',
490
+ parameterCount: 1
491
+ },
492
+ 'ChatStorage.get': {
493
+ hasRest: false,
494
+ method: 'get',
495
+ parameterCount: 1
496
+ },
497
+ 'ChatStorage.getEvents': {
498
+ hasRest: false,
499
+ method: 'getEvents',
500
+ parameterCount: 1
501
+ },
502
+ 'ChatStorage.getSession': {
503
+ hasRest: false,
504
+ method: 'getSession',
505
+ parameterCount: 1
506
+ },
507
+ 'ChatStorage.listSessions': {
508
+ hasRest: false,
509
+ method: 'listSessions',
510
+ parameterCount: 1
511
+ },
512
+ 'ChatStorage.save': {
513
+ hasRest: false,
514
+ method: 'save',
515
+ parameterCount: 1
516
+ },
517
+ 'ChatStorage.setSession': {
518
+ hasRest: false,
519
+ method: 'setSession',
520
+ parameterCount: 1
521
+ }
522
+ },
523
+ ChatToolWorker: {
524
+ 'ChatTool.execute': {
525
+ hasRest: false,
526
+ method: 'execute',
527
+ parameterCount: 3
528
+ },
529
+ 'ChatTool.getTools': {
530
+ hasRest: false,
531
+ method: 'getTools',
532
+ parameterCount: 0
533
+ }
534
+ },
535
+ ChatViewModelWorker: {
536
+ 'ChatNetwork.makeApiRequest': {
537
+ hasRest: false,
538
+ method: 'makeApiRequest',
539
+ parameterCount: 1
540
+ },
541
+ 'ChatNetwork.makeStreamingApiRequest': {
542
+ hasRest: false,
543
+ method: 'makeStreamingApiRequest',
544
+ parameterCount: 1
545
+ }
546
+ },
547
+ ClipBoardWorker: {
548
+ 'ClipBoard.readNativeFiles': {
549
+ hasRest: false,
550
+ method: 'readNativeFiles',
551
+ parameterCount: 0
552
+ },
553
+ 'ClipBoard.readText': {
554
+ hasRest: false,
555
+ method: 'readText',
556
+ parameterCount: 0
557
+ },
558
+ 'ClipBoard.writeImage': {
559
+ hasRest: false,
560
+ method: 'writeImage',
561
+ parameterCount: 1
562
+ },
563
+ 'ClipBoard.writeText': {
564
+ hasRest: false,
565
+ method: 'writeText',
566
+ parameterCount: 1
567
+ }
568
+ },
569
+ DebugWorker: {
570
+ 'RunAndDebug.getHighlight': {
571
+ hasRest: false,
572
+ method: 'getDebugHighlights',
573
+ parameterCount: 1
574
+ }
575
+ },
576
+ DiffWorker: {
577
+ 'Diff.execute': {
578
+ hasRest: false,
579
+ method: 'execute',
580
+ parameterCount: 3
581
+ },
582
+ 'Diff.getTools': {
583
+ hasRest: false,
584
+ method: 'getTools',
585
+ parameterCount: 0
586
+ }
587
+ },
588
+ DragAndDropWorker: {
589
+ 'DragAndDrop.getDroppedFilesByDropId': {
590
+ hasRest: false,
591
+ method: 'getDroppedFilesByDropId',
592
+ parameterCount: 1
593
+ },
594
+ 'DragAndDrop.getDroppedItemsByDropId': {
595
+ hasRest: false,
596
+ method: 'getDroppedItemsByDropId',
597
+ parameterCount: 2
598
+ },
599
+ 'DragAndDrop.getDroppedUrisByDropId': {
600
+ hasRest: false,
601
+ method: 'getDroppedUrisByDropId',
602
+ parameterCount: 2
603
+ }
604
+ },
605
+ EditorWorker: {
606
+ 'Editor.closeFind2': {
607
+ hasRest: false,
608
+ method: 'closeFind2',
609
+ parameterCount: 1
610
+ },
611
+ 'Editor.getLanguageId': {
612
+ hasRest: false,
613
+ method: 'getLanguageId',
614
+ parameterCount: 1
615
+ },
616
+ 'Editor.getOffsetAtCursor': {
617
+ hasRest: false,
618
+ method: 'getOffsetAtCursor',
619
+ parameterCount: 1
620
+ },
621
+ 'Editor.getProblems': {
622
+ hasRest: false,
623
+ method: 'getProblems',
624
+ parameterCount: 0
625
+ },
626
+ 'Editor.getUri': {
627
+ hasRest: false,
628
+ method: 'getUri',
629
+ parameterCount: 1
630
+ },
631
+ 'Editor.getWordAtOffset2': {
632
+ hasRest: false,
633
+ method: 'getWordAtOffset2',
634
+ parameterCount: 1
635
+ },
636
+ 'Editor.getWordBefore2': {
637
+ hasRest: false,
638
+ method: 'getWordBefore',
639
+ parameterCount: 3
640
+ },
641
+ 'Editor.rerender': {
642
+ hasRest: false,
643
+ method: 'rerenderEditor',
644
+ parameterCount: 0
645
+ }
646
+ },
647
+ EmbedsProcess: {
648
+ 'ElectronWebContentsView.backward': {
649
+ hasRest: false,
650
+ method: 'backward',
651
+ parameterCount: 1
652
+ },
653
+ 'ElectronWebContentsView.copyImageAt': {
654
+ hasRest: false,
655
+ method: 'copyImageAt',
656
+ parameterCount: 3
657
+ },
658
+ 'ElectronWebContentsView.createWebContentsView': {
659
+ hasRest: false,
660
+ method: 'createWebContentsView',
661
+ parameterCount: 2
662
+ },
663
+ 'ElectronWebContentsView.disposeWebContentsView': {
664
+ hasRest: false,
665
+ method: 'disposeWebContentsView',
666
+ parameterCount: 1
667
+ },
668
+ 'ElectronWebContentsView.focus': {
669
+ hasRest: false,
670
+ method: 'focus',
671
+ parameterCount: 1
672
+ },
673
+ 'ElectronWebContentsView.forward': {
674
+ hasRest: false,
675
+ method: 'forward',
676
+ parameterCount: 1
677
+ },
678
+ 'ElectronWebContentsView.getDomTree': {
679
+ hasRest: false,
680
+ method: 'getDomTree',
681
+ parameterCount: 1
682
+ },
683
+ 'ElectronWebContentsView.hide': {
684
+ hasRest: false,
685
+ method: 'hide',
686
+ parameterCount: 1
687
+ },
688
+ 'ElectronWebContentsView.insertCss': {
689
+ hasRest: false,
690
+ method: 'insertCss',
691
+ parameterCount: 2
692
+ },
693
+ 'ElectronWebContentsView.insertJavaScript': {
694
+ hasRest: false,
695
+ method: 'insertJavaScript',
696
+ parameterCount: 2
697
+ },
698
+ 'ElectronWebContentsView.inspectElement': {
699
+ hasRest: false,
700
+ method: 'inspectElement',
701
+ parameterCount: 3
702
+ },
703
+ 'ElectronWebContentsView.openDevtools': {
704
+ hasRest: false,
705
+ method: 'openDevtools',
706
+ parameterCount: 1
707
+ },
708
+ 'ElectronWebContentsView.reload': {
709
+ hasRest: false,
710
+ method: 'reload',
711
+ parameterCount: 1
712
+ },
713
+ 'ElectronWebContentsView.resizeWebContentsView': {
714
+ hasRest: false,
715
+ method: 'resizeWebContentsView',
716
+ parameterCount: 5
717
+ },
718
+ 'ElectronWebContentsView.setIframeSrcFallback': {
719
+ hasRest: false,
720
+ method: 'setIframeSrcFallback',
721
+ parameterCount: 2
722
+ },
723
+ 'ElectronWebContentsView.show': {
724
+ hasRest: false,
725
+ method: 'show',
726
+ parameterCount: 1
727
+ }
728
+ },
729
+ ErrorWorker: {
730
+ 'Errors.prepare': {
731
+ hasRest: false,
732
+ method: 'prepare',
733
+ parameterCount: 1
734
+ }
735
+ },
736
+ ExtensionHost: {
737
+ 'ExtensionHost.getRuntimeStatus': {
738
+ hasRest: false,
739
+ method: 'getRuntimeStatus',
740
+ parameterCount: 1
741
+ },
742
+ 'ExtensionHostReference.executeFileReferenceProvider': {
743
+ hasRest: false,
744
+ method: 'executeFileReferenceProvider',
745
+ parameterCount: 1
746
+ },
747
+ 'ExtensionHostReference.executeReferenceProvider': {
748
+ hasRest: false,
749
+ method: 'executeReferenceProvider',
750
+ parameterCount: 2
751
+ }
752
+ },
753
+ ExtensionManagementWorker: {
754
+ 'Extensions.disableWorkspace': {
755
+ hasRest: false,
756
+ method: 'disableWorkspace',
757
+ parameterCount: 1
758
+ },
759
+ 'Extensions.enableWorkspace': {
760
+ hasRest: false,
761
+ method: 'enableWorkspace',
762
+ parameterCount: 1
763
+ },
764
+ 'Extensions.getAllExtensions': {
765
+ hasRest: false,
766
+ method: 'getAllExtensions',
767
+ parameterCount: 2
768
+ },
769
+ 'Extensions.getLanguages': {
770
+ hasRest: false,
771
+ method: 'getLanguages',
772
+ parameterCount: 2
773
+ },
774
+ 'Extensions.getRunningExtensions': {
775
+ hasRest: false,
776
+ method: 'getRunningExtensions',
777
+ parameterCount: 2
778
+ }
779
+ },
780
+ FileSearchWorker: {
781
+ 'QuickPick.showQuickInput': {
782
+ hasRest: false,
783
+ method: 'showQuickInput',
784
+ parameterCount: 1
785
+ }
786
+ },
787
+ FileSystemProcess: {
788
+ 'FileSystem.appendFile': {
789
+ hasRest: false,
790
+ method: 'appendFile',
791
+ parameterCount: 2
792
+ },
793
+ 'FileSystem.copy': {
794
+ hasRest: false,
795
+ method: 'copy',
796
+ parameterCount: 2
797
+ },
798
+ 'FileSystem.exists': {
799
+ hasRest: false,
800
+ method: 'exists',
801
+ parameterCount: 1
802
+ },
803
+ 'FileSystem.getFolderSize': {
804
+ hasRest: false,
805
+ method: 'getFolderSize',
806
+ parameterCount: 1
807
+ },
808
+ 'FileSystem.getPathSeparator': {
809
+ hasRest: false,
810
+ method: 'getPathSeparator',
811
+ parameterCount: 1
812
+ },
813
+ 'FileSystem.getRealPath': {
814
+ hasRest: false,
815
+ method: 'getRealPath',
816
+ parameterCount: 1
817
+ },
818
+ 'FileSystem.mkdir': {
819
+ hasRest: false,
820
+ method: 'mkdir',
821
+ parameterCount: 1
822
+ },
823
+ 'FileSystem.readDirWithFileTypes': {
824
+ hasRest: false,
825
+ method: 'readDirWithFileTypes',
826
+ parameterCount: 1
827
+ },
828
+ 'FileSystem.readFile': {
829
+ hasRest: false,
830
+ method: 'readFile',
831
+ parameterCount: 1
832
+ },
833
+ 'FileSystem.readJson': {
834
+ hasRest: false,
835
+ method: 'readJson',
836
+ parameterCount: 1
837
+ },
838
+ 'FileSystem.remove': {
839
+ hasRest: false,
840
+ method: 'remove',
841
+ parameterCount: 1
842
+ },
843
+ 'FileSystem.rename': {
844
+ hasRest: false,
845
+ method: 'rename',
846
+ parameterCount: 2
847
+ },
848
+ 'FileSystem.stat': {
849
+ hasRest: false,
850
+ method: 'stat',
851
+ parameterCount: 1
852
+ },
853
+ 'FileSystem.writeFile': {
854
+ hasRest: false,
855
+ method: 'writeFile',
856
+ parameterCount: 2
857
+ }
858
+ },
859
+ FileSystemWorker: {
860
+ 'FileSystem.appendFile': {
861
+ hasRest: false,
862
+ method: 'appendFile',
863
+ parameterCount: 2
864
+ },
865
+ 'FileSystem.copy': {
866
+ hasRest: false,
867
+ method: 'copy',
868
+ parameterCount: 2
869
+ },
870
+ 'FileSystem.exists': {
871
+ hasRest: false,
872
+ method: 'exists',
873
+ parameterCount: 1
874
+ },
875
+ 'FileSystem.getFolderSize': {
876
+ hasRest: false,
877
+ method: 'getFolderSize',
878
+ parameterCount: 1
879
+ },
880
+ 'FileSystem.getPathSeparator': {
881
+ hasRest: false,
882
+ method: 'getPathSeparator',
883
+ parameterCount: 1
884
+ },
885
+ 'FileSystem.getRealPath': {
886
+ hasRest: false,
887
+ method: 'getRealPath',
888
+ parameterCount: 1
889
+ },
890
+ 'FileSystem.mkdir': {
891
+ hasRest: false,
892
+ method: 'mkdir',
893
+ parameterCount: 1
894
+ },
895
+ 'FileSystem.readDirWithFileTypes': {
896
+ hasRest: false,
897
+ method: 'readDirWithFileTypes',
898
+ parameterCount: 1
899
+ },
900
+ 'FileSystem.readFile': {
901
+ hasRest: false,
902
+ method: 'readFile',
903
+ parameterCount: 1
904
+ },
905
+ 'FileSystem.readFileAsBlob': {
906
+ hasRest: false,
907
+ method: 'readFileAsBlob',
908
+ parameterCount: 1
909
+ },
910
+ 'FileSystem.remove': {
911
+ hasRest: false,
912
+ method: 'remove',
913
+ parameterCount: 1
914
+ },
915
+ 'FileSystem.rename': {
916
+ hasRest: false,
917
+ method: 'rename',
918
+ parameterCount: 2
919
+ },
920
+ 'FileSystem.stat': {
921
+ hasRest: false,
922
+ method: 'stat',
923
+ parameterCount: 1
924
+ },
925
+ 'FileSystem.writeFile': {
926
+ hasRest: false,
927
+ method: 'writeFile',
928
+ parameterCount: 2
929
+ }
930
+ },
931
+ FindWidgetWorker: {
932
+ 'FindWidget.diffInstance': {
933
+ hasRest: false,
934
+ method: 'diffInstance',
935
+ parameterCount: 1
936
+ },
937
+ 'FindWidget.renderInstance': {
938
+ hasRest: false,
939
+ method: 'renderInstance',
940
+ parameterCount: 2
941
+ }
942
+ },
943
+ IconThemeWorker: {
944
+ 'IconTheme.getIcons': {
945
+ hasRest: false,
946
+ method: 'getIcons',
947
+ parameterCount: 1
948
+ }
949
+ },
950
+ MainProcess: {
951
+ 'ElectronDeveloper.getWorkerMemoryUsage': {
952
+ hasRest: false,
953
+ method: 'getWorkerMemoryUsage',
954
+ parameterCount: 2
955
+ },
956
+ 'ElectronDialog.showMessageBox': {
957
+ hasRest: false,
958
+ method: 'showMessageBox',
959
+ parameterCount: 1
960
+ },
961
+ 'SecretStorage.get': {
962
+ hasRest: false,
963
+ method: 'getSecret',
964
+ parameterCount: 2
965
+ }
966
+ },
967
+ MarkdownWorker: {
968
+ 'Markdown.getVirtualDom': {
969
+ hasRest: false,
970
+ method: 'getVirtualDom',
971
+ parameterCount: 1
972
+ },
973
+ 'Markdown.render': {
974
+ hasRest: false,
975
+ method: 'render',
976
+ parameterCount: 2
977
+ }
978
+ },
979
+ OpenerWorker: {
980
+ 'Open.enableMemoryOpener': {
981
+ hasRest: false,
982
+ method: 'enableMemoryOpener',
983
+ parameterCount: 0
984
+ },
985
+ 'Open.openExternal': {
986
+ hasRest: false,
987
+ method: 'openExternal',
988
+ parameterCount: 1
989
+ },
990
+ 'Open.openUrl': {
991
+ hasRest: false,
992
+ method: 'openUrl',
993
+ parameterCount: 2
994
+ },
995
+ 'Open.readOpenedUrl': {
996
+ hasRest: false,
997
+ method: 'readOpenedUrl',
998
+ parameterCount: 0
999
+ },
1000
+ 'Open.showSaveDialog': {
1001
+ hasRest: false,
1002
+ method: 'showSaveDialog',
1003
+ parameterCount: 2
1004
+ }
1005
+ },
1006
+ PreviewSandBoxWorker: {
1007
+ 'SandBox.handleInput': {
1008
+ hasRest: false,
1009
+ method: 'handleInput',
1010
+ parameterCount: 3
1011
+ },
1012
+ 'SandBox.handleKeyDown': {
1013
+ hasRest: false,
1014
+ method: 'handleKeyDown',
1015
+ parameterCount: 3
1016
+ },
1017
+ 'SandBox.handleKeyUp': {
1018
+ hasRest: false,
1019
+ method: 'handleKeyUp',
1020
+ parameterCount: 3
1021
+ },
1022
+ 'SandBox.initialize': {
1023
+ hasRest: false,
1024
+ method: 'initialize',
1025
+ parameterCount: 3
1026
+ },
1027
+ 'SandBox.terminate': {
1028
+ hasRest: false,
1029
+ method: 'terminate',
1030
+ parameterCount: 0
1031
+ }
1032
+ },
1033
+ PreviewWorker: {
1034
+ 'Preview.terminate': {
1035
+ hasRest: false,
1036
+ method: 'terminate',
1037
+ parameterCount: 0
1038
+ }
1039
+ },
1040
+ ProcessExplorer: {
1041
+ 'ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage': {
1042
+ hasRest: false,
1043
+ method: 'listProcessesWithMemoryUsage',
1044
+ parameterCount: 2
1045
+ }
1046
+ },
1047
+ QuickPickWorker: {
1048
+ 'QuickPick.showQuickInput': {
1049
+ hasRest: false,
1050
+ method: 'showQuickInput',
1051
+ parameterCount: 1
1052
+ }
1053
+ },
1054
+ RendererProcess: {
1055
+ 'ClipBoard.read': {
1056
+ hasRest: false,
1057
+ method: 'readClipBoard',
1058
+ parameterCount: 0
1059
+ },
1060
+ 'ClipBoard.readText': {
1061
+ hasRest: false,
1062
+ method: 'readClipBoardText',
1063
+ parameterCount: 0
1064
+ }
1065
+ },
1066
+ RendererWorker: {
1067
+ 'ClipBoard.readText': {
1068
+ hasRest: false,
1069
+ method: 'readClipBoardText',
1070
+ parameterCount: 0
1071
+ },
1072
+ 'ColorTheme.getColorThemeNames': {
1073
+ hasRest: false,
1074
+ method: 'getColorThemeNames',
1075
+ parameterCount: 0
1076
+ },
1077
+ 'ColorTheme.setColorTheme': {
1078
+ hasRest: false,
1079
+ method: 'setColorTheme',
1080
+ parameterCount: 1
1081
+ },
1082
+ 'ComponentState.getComponents': {
1083
+ hasRest: false,
1084
+ method: 'getComponents',
1085
+ parameterCount: 0
1086
+ },
1087
+ 'ContextMenu.show': {
1088
+ hasRest: true,
1089
+ method: 'showContextMenu',
1090
+ parameterCount: 3
1091
+ },
1092
+ 'DropData.get': {
1093
+ hasRest: false,
1094
+ method: 'getDropData',
1095
+ parameterCount: 2
1096
+ },
1097
+ 'Editor.rerender': {
1098
+ hasRest: false,
1099
+ method: 'rerenderEditor',
1100
+ parameterCount: 1
1101
+ },
1102
+ 'Editor.save': {
1103
+ hasRest: false,
1104
+ method: 'saveEditor',
1105
+ parameterCount: 0
1106
+ },
1107
+ 'ElectronDialog.showMessageBox': {
1108
+ hasRest: false,
1109
+ method: 'showMessageBox',
1110
+ parameterCount: 1
1111
+ },
1112
+ 'ElectronWindow.close': {
1113
+ hasRest: false,
1114
+ method: 'closeWindow',
1115
+ parameterCount: 0
1116
+ },
1117
+ 'ElectronWindow.maximize': {
1118
+ hasRest: false,
1119
+ method: 'maximizeWindow',
1120
+ parameterCount: 0
1121
+ },
1122
+ 'ElectronWindow.minimize': {
1123
+ hasRest: false,
1124
+ method: 'minimizeWindow',
1125
+ parameterCount: 0
1126
+ },
1127
+ 'ElectronWindow.unmaximize': {
1128
+ hasRest: false,
1129
+ method: 'unmaximizeWindow',
1130
+ parameterCount: 0
1131
+ },
1132
+ 'ExtensionHost.getCommands': {
1133
+ hasRest: false,
1134
+ method: 'getExtensionCommands',
1135
+ parameterCount: 0
1136
+ },
1137
+ 'ExtensionHost.searchFileWithFetch': {
1138
+ hasRest: false,
1139
+ method: 'searchFileFetch',
1140
+ parameterCount: 1
1141
+ },
1142
+ 'ExtensionHost.searchFileWithHtml': {
1143
+ hasRest: false,
1144
+ method: 'searchFileHtml',
1145
+ parameterCount: 1
1146
+ },
1147
+ 'ExtensionHost.searchFileWithMemory': {
1148
+ hasRest: false,
1149
+ method: 'searchFileMemory',
1150
+ parameterCount: 1
1151
+ },
1152
+ 'ExtensionHostManagement.activateByEvent': {
1153
+ hasRest: false,
1154
+ method: 'activateByEvent',
1155
+ parameterCount: 3
1156
+ },
1157
+ 'ExtensionManagement.disable': {
1158
+ hasRest: false,
1159
+ method: 'disableExtension',
1160
+ parameterCount: 1
1161
+ },
1162
+ 'ExtensionManagement.enable': {
1163
+ hasRest: false,
1164
+ method: 'enableExtension',
1165
+ parameterCount: 1
1166
+ },
1167
+ 'ExtensionManagement.getAllExtensions': {
1168
+ hasRest: false,
1169
+ method: 'getAllExtensions',
1170
+ parameterCount: 0
1171
+ },
1172
+ 'ExtensionManagement.getExtension': {
1173
+ hasRest: false,
1174
+ method: 'getExtension',
1175
+ parameterCount: 1
1176
+ },
1177
+ 'ExtensionManagement.install': {
1178
+ hasRest: false,
1179
+ method: 'installExtension',
1180
+ parameterCount: 1
1181
+ },
1182
+ 'ExtensionManagement.uninstall': {
1183
+ hasRest: false,
1184
+ method: 'uninstallExtension',
1185
+ parameterCount: 1
1186
+ },
1187
+ 'FileHandles.get': {
1188
+ hasRest: false,
1189
+ method: 'getFileHandles',
1190
+ parameterCount: 1
1191
+ },
1192
+ 'FilePicker.showSaveFilePicker': {
1193
+ hasRest: false,
1194
+ method: 'showSaveFilePicker',
1195
+ parameterCount: 0
1196
+ },
1197
+ 'FileSystem.getBlob': {
1198
+ hasRest: false,
1199
+ method: 'getBlob',
1200
+ parameterCount: 1
1201
+ },
1202
+ 'FileSystem.getFolderSize': {
1203
+ hasRest: false,
1204
+ method: 'getFolderSize',
1205
+ parameterCount: 1
1206
+ },
1207
+ 'FileSystem.readFile': {
1208
+ hasRest: false,
1209
+ method: 'readFile',
1210
+ parameterCount: 1
1211
+ },
1212
+ 'FileSystemHandle.getFilePathElectron': {
1213
+ hasRest: false,
1214
+ method: 'getFilePathElectron',
1215
+ parameterCount: 1
1216
+ },
1217
+ 'Focus.setAdditionalFocus': {
1218
+ hasRest: false,
1219
+ method: 'setAdditionalFocus',
1220
+ parameterCount: 1
1221
+ },
1222
+ 'Focus.setFocus': {
1223
+ hasRest: false,
1224
+ method: 'setFocus',
1225
+ parameterCount: 1
1226
+ },
1227
+ 'GetActiveEditor.getActiveEditorId': {
1228
+ hasRest: false,
1229
+ method: 'getActiveEditorId',
1230
+ parameterCount: 0
1231
+ },
1232
+ 'GetWindowId.getWindowId': {
1233
+ hasRest: false,
1234
+ method: 'getWindowId',
1235
+ parameterCount: 0
1236
+ },
1237
+ 'IconTheme.getFileIcon': {
1238
+ hasRest: false,
1239
+ method: 'getFileIcon',
1240
+ parameterCount: 1
1241
+ },
1242
+ 'IconTheme.getFolderIcon': {
1243
+ hasRest: false,
1244
+ method: 'getFolderIcon',
1245
+ parameterCount: 1
1246
+ },
1247
+ 'KeyBindingsInitial.getKeyBindings': {
1248
+ hasRest: false,
1249
+ method: 'getKeyBindings',
1250
+ parameterCount: 0
1251
+ },
1252
+ 'Layout.createViewlet': {
1253
+ hasRest: false,
1254
+ method: 'createViewlet',
1255
+ parameterCount: 5
1256
+ },
1257
+ 'Layout.getBadgeCounts': {
1258
+ hasRest: false,
1259
+ method: 'getBadgeCounts',
1260
+ parameterCount: 0
1261
+ },
1262
+ 'Layout.getModuleId': {
1263
+ hasRest: false,
1264
+ method: 'getViewletModuleId',
1265
+ parameterCount: 1
1266
+ },
1267
+ 'Layout.handleWorkspaceRefresh': {
1268
+ hasRest: false,
1269
+ method: 'handleWorkspaceRefresh',
1270
+ parameterCount: 0
1271
+ },
1272
+ 'Layout.showPanel': {
1273
+ hasRest: false,
1274
+ method: 'showPanel',
1275
+ parameterCount: 0
1276
+ },
1277
+ 'Layout.showPreview': {
1278
+ hasRest: false,
1279
+ method: 'showPreview',
1280
+ parameterCount: 0
1281
+ },
1282
+ 'Main.handleModifiedStatusChange': {
1283
+ hasRest: false,
1284
+ method: 'handleModifiedStatusChange',
1285
+ parameterCount: 2
1286
+ },
1287
+ 'Markdown.getVirtualDom': {
1288
+ hasRest: false,
1289
+ method: 'getMarkdownDom',
1290
+ parameterCount: 1
1291
+ },
1292
+ 'Markdown.renderMarkdown': {
1293
+ hasRest: false,
1294
+ method: 'renderMarkdown',
1295
+ parameterCount: 2
1296
+ },
1297
+ 'Panel.toggleView': {
1298
+ hasRest: false,
1299
+ method: 'togglePanelView',
1300
+ parameterCount: 1
1301
+ },
1302
+ 'PlatformPaths.getLogsDir': {
1303
+ hasRest: false,
1304
+ method: 'getLogsDir',
1305
+ parameterCount: 0
1306
+ },
1307
+ 'Preferences.get': {
1308
+ hasRest: false,
1309
+ method: 'getPreference',
1310
+ parameterCount: 1
1311
+ },
1312
+ 'Preferences.getAll': {
1313
+ hasRest: false,
1314
+ method: 'getAllPreferences',
1315
+ parameterCount: 0
1316
+ },
1317
+ 'Process.getChromeVersion': {
1318
+ hasRest: false,
1319
+ method: 'getChromeVersion',
1320
+ parameterCount: 0
1321
+ },
1322
+ 'Process.getElectronVersion': {
1323
+ hasRest: false,
1324
+ method: 'getElectronVersion',
1325
+ parameterCount: 0
1326
+ },
1327
+ 'Process.getNodeVersion': {
1328
+ hasRest: false,
1329
+ method: 'getNodeVersion',
1330
+ parameterCount: 0
1331
+ },
1332
+ 'Process.getV8Version': {
1333
+ hasRest: false,
1334
+ method: 'getV8Version',
1335
+ parameterCount: 0
1336
+ },
1337
+ 'RecentlyOpened.getRecentlyOpened': {
1338
+ hasRest: false,
1339
+ method: 'getRecentlyOpened',
1340
+ parameterCount: 0
1341
+ },
1342
+ 'Run And Debug.handleChange': {
1343
+ hasRest: false,
1344
+ method: 'handleDebugChange',
1345
+ parameterCount: 1
1346
+ },
1347
+ 'SideBar.show': {
1348
+ hasRest: false,
1349
+ method: 'showSideBar',
1350
+ parameterCount: 2
1351
+ },
1352
+ 'Viewlet.closeWidget': {
1353
+ hasRest: false,
1354
+ method: 'closeWidget',
1355
+ parameterCount: 1
1356
+ },
1357
+ 'Viewlet.dispose': {
1358
+ hasRest: false,
1359
+ method: 'disposeEditor',
1360
+ parameterCount: 1
1361
+ },
1362
+ 'Viewlet.resize': {
1363
+ hasRest: false,
1364
+ method: 'resizeViewlet',
1365
+ parameterCount: 2
1366
+ },
1367
+ 'WebView.getSecret': {
1368
+ hasRest: false,
1369
+ method: 'getWebViewSecret',
1370
+ parameterCount: 1
1371
+ },
1372
+ 'WidgetLifecycle.allocateRendererId': {
1373
+ hasRest: false,
1374
+ method: 'allocateWidgetRendererId',
1375
+ parameterCount: 0
1376
+ },
1377
+ 'WidgetLifecycle.attach': {
1378
+ hasRest: false,
1379
+ method: 'attachWidget',
1380
+ parameterCount: 1
1381
+ },
1382
+ 'WidgetLifecycle.update': {
1383
+ hasRest: false,
1384
+ method: 'updateWidget',
1385
+ parameterCount: 1
1386
+ },
1387
+ 'Workspace.getPath': {
1388
+ hasRest: false,
1389
+ method: 'getWorkspacePath',
1390
+ parameterCount: 0
1391
+ }
1392
+ },
1393
+ SearchProcess: {
1394
+ 'TextSearch.getIncrementalResults': {
1395
+ hasRest: false,
1396
+ method: 'getIncrementalResults',
1397
+ parameterCount: 3
1398
+ },
1399
+ 'TextSearch.searchIncremental': {
1400
+ hasRest: false,
1401
+ method: 'searchIncremental',
1402
+ parameterCount: 1
1403
+ }
1404
+ },
1405
+ SettingsWorker: {
1406
+ 'SettingsWorker.getSettingsItems2': {
1407
+ hasRest: false,
1408
+ method: 'getSettingsItems2',
1409
+ parameterCount: 0
1410
+ },
1411
+ 'SettingsWorker.getTabs': {
1412
+ hasRest: false,
1413
+ method: 'getTabs',
1414
+ parameterCount: 0
1415
+ }
1416
+ },
1417
+ SyntaxHighlightingWorker: {
1418
+ 'GetTokensViewport.getTokensViewport': {
1419
+ hasRest: false,
1420
+ method: 'getTokensViewPort',
1421
+ parameterCount: 6
1422
+ },
1423
+ 'TokenizeIncremental.tokenizeIncremental': {
1424
+ hasRest: false,
1425
+ method: 'tokenizeIncremental',
1426
+ parameterCount: 6
1427
+ },
1428
+ 'Tokenizer.load': {
1429
+ hasRest: false,
1430
+ method: 'loadTokenizer',
1431
+ parameterCount: 2
1432
+ }
1433
+ },
1434
+ TextMeasurementWorker: {
1435
+ 'TextMeasurement.ensureFont': {
1436
+ hasRest: false,
1437
+ method: 'ensureFont',
1438
+ parameterCount: 2
1439
+ },
1440
+ 'TextMeasurement.measureTextBlockHeight': {
1441
+ hasRest: false,
1442
+ method: 'measureTextBlockHeight',
1443
+ parameterCount: 5
1444
+ },
1445
+ 'TextMeasurement.measureTextWidth': {
1446
+ hasRest: false,
1447
+ method: 'measureTextWidth',
1448
+ parameterCount: 7
1449
+ },
1450
+ 'TextMeasurement.measureTextWidths': {
1451
+ hasRest: false,
1452
+ method: 'measureTextWidths',
1453
+ parameterCount: 7
1454
+ }
1455
+ },
1456
+ TextSearchWorker: {
1457
+ 'TextSearch.getIncrementalResults': {
1458
+ hasRest: false,
1459
+ method: 'getIncrementalResults',
1460
+ parameterCount: 3
1461
+ },
1462
+ 'TextSearch.getPullResults': {
1463
+ hasRest: false,
1464
+ method: 'getPullResults',
1465
+ parameterCount: 1
1466
+ },
1467
+ 'TextSearch.search': {
1468
+ hasRest: true,
1469
+ method: 'search',
1470
+ parameterCount: 0
1471
+ },
1472
+ 'TextSearch.searchIncremental': {
1473
+ hasRest: true,
1474
+ method: 'searchIncremental',
1475
+ parameterCount: 0
1476
+ }
1477
+ }
1478
+ };
1479
+
1480
+ const meta$1 = {
1481
+ docs: {
1482
+ description: 'Prefer the typed @lvce-editor/rpc-registry method over invoke with a command id'
1483
+ },
1484
+ fixable: 'code',
1485
+ messages: {
1486
+ preferRegistryMethod: "Use {{module}}.{{method}}(...) instead of {{module}}.invoke('{{commandId}}', ...)."
1487
+ },
1488
+ schema: [],
1489
+ type: 'suggestion'
1490
+ };
1491
+ const rpcRegistryModule = '@lvce-editor/rpc-registry';
1492
+ const findVariable = (scope, name) => {
1493
+ let currentScope = scope;
1494
+ while (currentScope) {
1495
+ const variable = currentScope.set.get(name);
1496
+ if (variable) {
1497
+ return variable;
1498
+ }
1499
+ currentScope = currentScope.upper;
1500
+ }
1501
+ return undefined;
1502
+ };
1503
+ const getImportDefinition = variable => {
1504
+ const definition = variable?.defs[0];
1505
+ if (definition?.type !== 'ImportBinding' || definition.parent.source.value !== rpcRegistryModule) {
1506
+ return undefined;
1507
+ }
1508
+ return definition;
1509
+ };
1510
+ const getPropertyName = node => {
1511
+ if (!node.computed && node.property.type === 'Identifier') {
1512
+ return node.property.name;
1513
+ }
1514
+ if (node.computed && node.property.type === 'Literal' && typeof node.property.value === 'string') {
1515
+ return node.property.value;
1516
+ }
1517
+ return undefined;
1518
+ };
1519
+ const getStaticString = node => {
1520
+ if (node?.type === 'Literal' && typeof node.value === 'string') {
1521
+ return node.value;
1522
+ }
1523
+ if (node?.type === 'TemplateLiteral' && node.expressions.length === 0) {
1524
+ return node.quasis[0]?.value.cooked ?? undefined;
1525
+ }
1526
+ return undefined;
1527
+ };
1528
+ const acceptsArguments = (registryMethod, argumentCount) => {
1529
+ return registryMethod.hasRest ? argumentCount >= registryMethod.parameterCount : argumentCount === registryMethod.parameterCount;
1530
+ };
1531
+ const create$1 = context => {
1532
+ const {
1533
+ sourceCode
1534
+ } = context;
1535
+
1536
+ // Returns the registry module name (for example RendererWorker) when the object is that rpc-registry export.
1537
+ const getRegistryModuleName = (object, node) => {
1538
+ const scope = sourceCode.getScope(node);
1539
+ if (object.type === 'Identifier') {
1540
+ const definition = getImportDefinition(findVariable(scope, object.name));
1541
+ if (definition?.node.type !== 'ImportSpecifier') {
1542
+ return undefined;
1543
+ }
1544
+ const {
1545
+ imported
1546
+ } = definition.node;
1547
+ return imported.type === 'Identifier' ? imported.name : String(imported.value);
1548
+ }
1549
+ if (object.type === 'MemberExpression' && object.object.type === 'Identifier') {
1550
+ const definition = getImportDefinition(findVariable(scope, object.object.name));
1551
+ return definition?.node.type === 'ImportNamespaceSpecifier' ? getPropertyName(object) : undefined;
1552
+ }
1553
+ return undefined;
1554
+ };
1555
+ return {
1556
+ CallExpression(node) {
1557
+ const {
1558
+ callee
1559
+ } = node;
1560
+ if (node.optional || callee.type !== 'MemberExpression' || callee.optional || getPropertyName(callee) !== 'invoke') {
1561
+ return;
1562
+ }
1563
+ const [commandIdNode, ...forwarded] = node.arguments;
1564
+ const commandId = getStaticString(commandIdNode);
1565
+ if (commandId === undefined || forwarded.some(argument => argument.type === 'SpreadElement')) {
1566
+ return;
1567
+ }
1568
+ const moduleName = getRegistryModuleName(callee.object, node);
1569
+ if (moduleName === undefined || !Object.hasOwn(rpcRegistryMethods, moduleName)) {
1570
+ return;
1571
+ }
1572
+ const methods = rpcRegistryMethods[moduleName];
1573
+ if (!Object.hasOwn(methods, commandId)) {
1574
+ return;
1575
+ }
1576
+ const registryMethod = methods[commandId];
1577
+ if (!acceptsArguments(registryMethod, forwarded.length)) {
1578
+ return;
1579
+ }
1580
+ const canFix = sourceCode.getCommentsInside(node).length === 0;
1581
+ context.report({
1582
+ data: {
1583
+ commandId,
1584
+ method: registryMethod.method,
1585
+ module: moduleName
1586
+ },
1587
+ fix: canFix ? fixer => {
1588
+ const objectText = sourceCode.getText(callee.object);
1589
+ const argumentText = forwarded.map(argument => sourceCode.getText(argument)).join(', ');
1590
+ return fixer.replaceText(node, `${objectText}.${registryMethod.method}(${argumentText})`);
1591
+ } : null,
1592
+ messageId: 'preferRegistryMethod',
1593
+ node: callee
1594
+ });
1595
+ }
1596
+ };
1597
+ };
1598
+
1599
+ const preferRegistryMethod = {
89
1600
  __proto__: null,
90
1601
  create: create$1,
91
1602
  meta: meta$1
92
1603
  };
93
1604
 
94
1605
  const isMockRpcVariable = declaration => {
95
- return declaration?.id?.type === 'Identifier' && declaration.id.name === 'mockRpc';
1606
+ return declaration.id.type === 'Identifier' && declaration.id.name === 'mockRpc';
96
1607
  };
97
1608
  const isRegisterMockRpcCall = expression => {
98
- return expression?.type === 'CallExpression' && expression.callee?.type === 'MemberExpression' && expression.callee.property?.type === 'Identifier' && expression.callee.property.name === 'registerMockRpc';
1609
+ return expression?.type === 'CallExpression' && expression.callee.type === 'MemberExpression' && expression.callee.property.type === 'Identifier' && expression.callee.property.name === 'registerMockRpc';
99
1610
  };
100
1611
  const shouldUseUsing = node => {
101
1612
  return node.declarations.some(declaration => isMockRpcVariable(declaration) && isRegisterMockRpcCall(declaration.init));
@@ -136,8 +1647,11 @@ const plugin = {
136
1647
  version: '0.0.1'
137
1648
  },
138
1649
  rules: {
1650
+ 'no-low-level-rpc-packages': noLowLevelRpcPackages,
1651
+ 'no-manual-json-rpc-messages': noManualJsonRpcMessages,
139
1652
  'no-renderer-worker-destructuring': noRpcRegistryDestructuring,
140
1653
  'no-rpc-registry-destructuring': noRpcRegistryDestructuring,
1654
+ 'prefer-registry-method': preferRegistryMethod,
141
1655
  'prefer-using-mock-rpc': preferUsingMockRpc
142
1656
  }
143
1657
  };
@@ -147,7 +1661,10 @@ const recommended = [{
147
1661
  rpc: plugin
148
1662
  },
149
1663
  rules: {
1664
+ 'rpc/no-low-level-rpc-packages': 'error',
1665
+ 'rpc/no-manual-json-rpc-messages': 'error',
150
1666
  'rpc/no-rpc-registry-destructuring': 'error',
1667
+ 'rpc/prefer-registry-method': 'error',
151
1668
  'rpc/prefer-using-mock-rpc': 'error'
152
1669
  }
153
1670
  }];