@lvce-editor/editor-worker 16.4.0 → 16.6.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.
@@ -1177,7 +1177,7 @@ const TextMeasurementWorker = 7011;
1177
1177
  const FocusEditorText$1 = 12;
1178
1178
 
1179
1179
  const rpcs = Object.create(null);
1180
- const set$d = (id, rpc) => {
1180
+ const set$e = (id, rpc) => {
1181
1181
  rpcs[id] = rpc;
1182
1182
  };
1183
1183
  const get$7 = id => {
@@ -1210,7 +1210,7 @@ const create$9 = rpcId => {
1210
1210
  const mockRpc = createMockRpc({
1211
1211
  commandMap
1212
1212
  });
1213
- set$d(rpcId, mockRpc);
1213
+ set$e(rpcId, mockRpc);
1214
1214
  // @ts-ignore
1215
1215
  mockRpc[Symbol.dispose] = () => {
1216
1216
  remove$8(rpcId);
@@ -1219,32 +1219,32 @@ const create$9 = rpcId => {
1219
1219
  return mockRpc;
1220
1220
  },
1221
1221
  set(rpc) {
1222
- set$d(rpcId, rpc);
1222
+ set$e(rpcId, rpc);
1223
1223
  }
1224
1224
  };
1225
1225
  };
1226
1226
 
1227
1227
  const {
1228
1228
  dispose: dispose$2,
1229
- invoke: invoke$d,
1229
+ invoke: invoke$e,
1230
1230
  invokeAndTransfer: invokeAndTransfer$2,
1231
1231
  registerMockRpc,
1232
- set: set$c
1232
+ set: set$d
1233
1233
  } = create$9(ExtensionHostWorker);
1234
1234
  const executeReferenceProvider = async (id, offset) => {
1235
1235
  // @ts-ignore
1236
- return invoke$d('ExtensionHostReference.executeReferenceProvider', id, offset);
1236
+ return invoke$e('ExtensionHostReference.executeReferenceProvider', id, offset);
1237
1237
  };
1238
1238
  const executeFileReferenceProvider = async id => {
1239
1239
  // @ts-ignore
1240
- return invoke$d('ExtensionHostReference.executeFileReferenceProvider', id);
1240
+ return invoke$e('ExtensionHostReference.executeFileReferenceProvider', id);
1241
1241
  };
1242
1242
  const getRuntimeStatus = async extensionId => {
1243
1243
  // @ts-ignore
1244
- return invoke$d('ExtensionHost.getRuntimeStatus', extensionId);
1244
+ return invoke$e('ExtensionHost.getRuntimeStatus', extensionId);
1245
1245
  };
1246
1246
  const getEnabledOutputProviderIds = async () => {
1247
- const channels = await invoke$d('Output.getEnabledProviders');
1247
+ const channels = await invoke$e('Output.getEnabledProviders');
1248
1248
  return channels;
1249
1249
  };
1250
1250
 
@@ -1255,21 +1255,21 @@ const ExtensionHost = {
1255
1255
  executeReferenceProvider,
1256
1256
  getEnabledOutputProviderIds,
1257
1257
  getRuntimeStatus,
1258
- invoke: invoke$d,
1258
+ invoke: invoke$e,
1259
1259
  invokeAndTransfer: invokeAndTransfer$2,
1260
1260
  registerMockRpc,
1261
- set: set$c
1261
+ set: set$d
1262
1262
  };
1263
1263
 
1264
1264
  const {
1265
- invoke: invoke$c,
1266
- set: set$b
1265
+ invoke: invoke$d,
1266
+ set: set$c
1267
1267
  } = create$9(ExtensionManagementWorker);
1268
1268
 
1269
1269
  const {
1270
- invoke: invoke$b,
1270
+ invoke: invoke$c,
1271
1271
  invokeAndTransfer: invokeAndTransfer$1,
1272
- set: set$a
1272
+ set: set$b
1273
1273
  } = create$9(RendererWorker$1);
1274
1274
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1275
1275
  number(uid);
@@ -1277,7 +1277,12 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1277
1277
  number(x);
1278
1278
  number(y);
1279
1279
  // @ts-ignore
1280
- await invoke$b('ContextMenu.show2', uid, menuId, x, y, args);
1280
+ await invoke$c('ContextMenu.show2', uid, menuId, x, y, args);
1281
+ };
1282
+ const sendMessagePortToOpenerWorker = async (port, rpcId) => {
1283
+ const command = 'HandleMessagePort.handleMessagePort';
1284
+ // @ts-ignore
1285
+ await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker', port, command, rpcId);
1281
1286
  };
1282
1287
  const sendMessagePortToTextMeasurementWorker = async port => {
1283
1288
  const command = 'TextMeasurement.handleMessagePort';
@@ -1289,6 +1294,12 @@ const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
1289
1294
  await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
1290
1295
  };
1291
1296
 
1297
+ const rpcId$1 = 4561;
1298
+ const {
1299
+ invoke: invoke$b,
1300
+ set: set$a
1301
+ } = create$9(rpcId$1);
1302
+
1292
1303
  const {
1293
1304
  set: set$9
1294
1305
  } = create$9(IconThemeWorker);
@@ -1313,7 +1324,7 @@ const createLazyRpc = rpcId => {
1313
1324
  let factory;
1314
1325
  const createRpc = async () => {
1315
1326
  const rpc = await factory();
1316
- set$d(rpcId, rpc);
1327
+ set$e(rpcId, rpc);
1317
1328
  };
1318
1329
  const ensureRpc = async () => {
1319
1330
  if (!rpcPromise) {
@@ -1343,7 +1354,7 @@ const activateByEvent = async (event, assetDir, platform) => {
1343
1354
  string(event);
1344
1355
  // Assert.string(assetDir)
1345
1356
  // Assert.number(platform)
1346
- await invoke$b('ExtensionHostManagement.activateByEvent', event, assetDir, platform);
1357
+ await invoke$c('ExtensionHostManagement.activateByEvent', event, assetDir, platform);
1347
1358
  };
1348
1359
 
1349
1360
  const codeGeneratorAccept = state => {
@@ -2632,7 +2643,8 @@ const getRegexMatches = (text, regex) => {
2632
2643
  // URL matching regex pattern - matches common URL schemes
2633
2644
  // Supports: http://, https://, ftp://, ftps://, file://
2634
2645
  // Also matches URLs without explicit scheme (www.example.com)
2635
- const URL_PATTERN = /(?:(?:https?|ftp|ftps|file):\/\/)?(?:www\.)?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\/[^\s]*)?/g;
2646
+ // Excludes trailing quotes which are commonly used in JSON strings
2647
+ const URL_PATTERN = /(?:(?:https?|ftp|ftps|file):\/\/)?(?:www\.)?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\/[^\s"']*)?/g;
2636
2648
 
2637
2649
  // Regex to check if URL has a scheme (http://, https://, ftp://, etc.)
2638
2650
  const HAS_SCHEME_PATTERN = /^(?:https?|ftp|ftps|file):\/\//;
@@ -3412,7 +3424,7 @@ const getLanguageId$1 = (uri, languages) => {
3412
3424
  const getLanguages = async (platform, assetDir) => {
3413
3425
  number(platform);
3414
3426
  string(assetDir);
3415
- const languages = await invoke$c('Extensions.getLanguages', platform, assetDir);
3427
+ const languages = await invoke$d('Extensions.getLanguages', platform, assetDir);
3416
3428
  return languages;
3417
3429
  };
3418
3430
 
@@ -3421,7 +3433,7 @@ const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpa
3421
3433
  };
3422
3434
 
3423
3435
  const get$1 = async key => {
3424
- const value = await invoke$b('Preferences.get', key);
3436
+ const value = await invoke$c('Preferences.get', key);
3425
3437
  return value;
3426
3438
  };
3427
3439
 
@@ -3567,7 +3579,7 @@ const updateDiagnostics = async newState => {
3567
3579
  };
3568
3580
  set$6(newState.id, latest.oldState, newEditor);
3569
3581
  // @ts-ignore
3570
- await invoke$b('Editor.rerender', newState.id);
3582
+ await invoke$c('Editor.rerender', newState.id);
3571
3583
  return newEditor;
3572
3584
  } catch (error) {
3573
3585
  // @ts-ignore
@@ -4109,7 +4121,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
4109
4121
  const y$1 = y(editor, rowIndex);
4110
4122
  const displayErrorMessage = message;
4111
4123
  // @ts-ignore
4112
- await invoke$b('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
4124
+ await invoke$c('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
4113
4125
  if (!isError) {
4114
4126
  const handleTimeout = () => {
4115
4127
  editorHideMessage(editor);
@@ -4166,7 +4178,7 @@ const braceCompletion = async (editor, text) => {
4166
4178
  // @ts-ignore
4167
4179
  const offset = offsetAt(editor, editor.cursor);
4168
4180
  // @ts-ignore
4169
- const result = await invoke$b('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
4181
+ const result = await invoke$c('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
4170
4182
  if (result) {
4171
4183
  const closingBrace = getMatchingClosingBrace$1(text);
4172
4184
  const insertText = text + closingBrace;
@@ -4434,7 +4446,7 @@ const compositionEnd = (editor, data) => {
4434
4446
  const writeText = async text => {
4435
4447
  try {
4436
4448
  string(text);
4437
- await invoke$b('ClipBoard.writeText', /* text */text);
4449
+ await invoke$c('ClipBoard.writeText', /* text */text);
4438
4450
  } catch (error) {
4439
4451
  throw new VError(error, 'Failed to write text to clipboard');
4440
4452
  }
@@ -5072,7 +5084,7 @@ const deleteWordRight = editor => {
5072
5084
 
5073
5085
  const findAllReferences$1 = async editor => {
5074
5086
  // @ts-ignore
5075
- await invoke$b('SideBar.show', 'References', /* focus */true);
5087
+ await invoke$c('SideBar.show', 'References', /* focus */true);
5076
5088
  return editor;
5077
5089
  };
5078
5090
 
@@ -5160,7 +5172,7 @@ const getWordBefore = (editor, rowIndex, columnIndex) => {
5160
5172
  // @ts-ignore
5161
5173
  const getDefinition = async (editor, offset) => {
5162
5174
  // @ts-ignore
5163
- const definition = await invoke$b('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
5175
+ const definition = await invoke$c('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
5164
5176
  return definition;
5165
5177
  };
5166
5178
 
@@ -5367,7 +5379,7 @@ const goTo = async ({
5367
5379
  startColumnIndex: definition.startColumnIndex,
5368
5380
  startRowIndex: definition.startRowIndex
5369
5381
  };
5370
- await invoke$b(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
5382
+ await invoke$c(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
5371
5383
  return editor;
5372
5384
  } catch (error) {
5373
5385
  // TODO if editor is already disposed at this point, do nothing
@@ -5445,7 +5457,7 @@ const getNoLocationFoundMessage = info => {
5445
5457
 
5446
5458
  const getTypeDefinition = async (editor, offset) => {
5447
5459
  // @ts-ignore
5448
- const definition = await invoke$b('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
5460
+ const definition = await invoke$c('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
5449
5461
  return definition;
5450
5462
  };
5451
5463
 
@@ -5516,13 +5528,17 @@ const setPosition$1 = position => {
5516
5528
  state$3.position = position;
5517
5529
  };
5518
5530
 
5519
- const openExternal = async url => {
5520
- await invoke$b('Open.openUrl', url);
5531
+ const openExternal = async (url, platform) => {
5532
+ // @ts-ignore
5533
+ await invoke$b('Open.openUrl', url, platform);
5521
5534
  };
5522
5535
 
5523
5536
  // TODO first change cursor position, then run go to definition
5524
5537
  // cursor should appear at mousedown position immediately
5525
5538
  const handleSingleClickWithAlt = async (editor, position) => {
5539
+ const {
5540
+ platform
5541
+ } = editor;
5526
5542
  const {
5527
5543
  columnIndex,
5528
5544
  rowIndex
@@ -5533,7 +5549,7 @@ const handleSingleClickWithAlt = async (editor, position) => {
5533
5549
  const url = getUrlAtOffset(editor, offset);
5534
5550
  if (url) {
5535
5551
  // Open the link
5536
- await openExternal(url);
5552
+ await openExternal(url, platform);
5537
5553
  return editor;
5538
5554
  }
5539
5555
 
@@ -6223,7 +6239,7 @@ const indentMore = editor => {
6223
6239
 
6224
6240
  const getLanguageConfiguration = async editor => {
6225
6241
  // @ts-ignore
6226
- return invoke$b('Languages.getLanguageConfiguration', {
6242
+ return invoke$c('Languages.getLanguageConfiguration', {
6227
6243
  languageId: editor.languageId,
6228
6244
  uri: editor.uri
6229
6245
  });
@@ -6637,7 +6653,7 @@ const launch = async () => {
6637
6653
  return;
6638
6654
  }
6639
6655
  const rpc = await launchFindWidgetWorker();
6640
- set$d(rpcId, rpc);
6656
+ set$e(rpcId, rpc);
6641
6657
  };
6642
6658
  const invoke$3 = async (method, ...params) => {
6643
6659
  const rpc = get$7(rpcId);
@@ -6804,7 +6820,7 @@ const pasteText = (editor, text) => {
6804
6820
 
6805
6821
  const paste = async editor => {
6806
6822
  // @ts-ignore
6807
- const text = await invoke$b('ClipBoard.readText');
6823
+ const text = await invoke$c('ClipBoard.readText');
6808
6824
  string(text);
6809
6825
  return pasteText(editor, text);
6810
6826
  };
@@ -6950,7 +6966,7 @@ const save = async editor => {
6950
6966
  } = editor;
6951
6967
  const newEditor = await getNewEditor(editor);
6952
6968
  const content = getText$1(newEditor);
6953
- await invoke$b('FileSystem.writeFile', uri, content);
6969
+ await invoke$c('FileSystem.writeFile', uri, content);
6954
6970
  return newEditor;
6955
6971
  } catch (error) {
6956
6972
  // @ts-ignore
@@ -7260,7 +7276,7 @@ const selectInsideString = editor => {
7260
7276
 
7261
7277
  const getNewSelections = async (editor, selections) => {
7262
7278
  // @ts-ignore
7263
- const newSelections = await invoke$b('ExtensionHostSelection.executeGrowSelection', editor, selections);
7279
+ const newSelections = await invoke$c('ExtensionHostSelection.executeGrowSelection', editor, selections);
7264
7280
  if (newSelections.length === 0) {
7265
7281
  return selections;
7266
7282
  }
@@ -7668,7 +7684,7 @@ const showHover3 = async editor => {
7668
7684
 
7669
7685
  const EditorHover = 'EditorHover';
7670
7686
  const showHover = async state => {
7671
- await invoke$b('Viewlet.openWidget', EditorHover);
7687
+ await invoke$c('Viewlet.openWidget', EditorHover);
7672
7688
  return state;
7673
7689
  };
7674
7690
 
@@ -8349,7 +8365,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
8349
8365
  const typeWithAutoClosingTag = async (editor, text) => {
8350
8366
  const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
8351
8367
  // @ts-ignore
8352
- const result = await invoke$b('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
8368
+ const result = await invoke$c('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
8353
8369
  if (!result) {
8354
8370
  const changes = editorReplaceSelections(editor, [text], EditorType);
8355
8371
  return scheduleDocumentAndCursorsSelections(editor, changes);
@@ -9373,7 +9389,7 @@ const getEditorSourceActions = async editorId => {
9373
9389
  languageId
9374
9390
  } = newState;
9375
9391
  // @ts-ignore
9376
- const allActions = await invoke$b('GetEditorSourceActions.getEditorSourceActions');
9392
+ const allActions = await invoke$c('GetEditorSourceActions.getEditorSourceActions');
9377
9393
  const filtered = filterActions(allActions, languageId);
9378
9394
  return filtered;
9379
9395
  };
@@ -9396,14 +9412,14 @@ const getWordAtOffset = editor => {
9396
9412
  };
9397
9413
 
9398
9414
  const setFocus = async focusKey => {
9399
- await invoke$b('Focus.setFocus', focusKey);
9415
+ await invoke$c('Focus.setFocus', focusKey);
9400
9416
  };
9401
9417
  const unsetAdditionalFocus = async focusKey => {
9402
9418
  if (!focusKey) {
9403
9419
  return;
9404
9420
  }
9405
9421
  // @ts-ignore
9406
- await invoke$b('Focus.removeAdditionalFocus', focusKey);
9422
+ await invoke$c('Focus.removeAdditionalFocus', focusKey);
9407
9423
  };
9408
9424
 
9409
9425
  const FocusEditor = 12;
@@ -10135,7 +10151,7 @@ const handleMessagePort = async (port, rpcId) => {
10135
10151
  messagePort: port
10136
10152
  });
10137
10153
  if (rpcId) {
10138
- set$d(rpcId, rpc);
10154
+ set$e(rpcId, rpc);
10139
10155
  }
10140
10156
  };
10141
10157
 
@@ -10239,7 +10255,7 @@ const hotReload = async () => {
10239
10255
 
10240
10256
  // TODO ask renderer worker to rerender all editors
10241
10257
  // @ts-ignore
10242
- await invoke$b(`Editor.rerender`);
10258
+ await invoke$c(`Editor.rerender`);
10243
10259
  isReloading = false;
10244
10260
  };
10245
10261
 
@@ -10284,7 +10300,23 @@ const createExtensionManagementWorkerRpc = async () => {
10284
10300
  const initializeExtensionManagementWorker = async () => {
10285
10301
  try {
10286
10302
  const rpc = await createExtensionManagementWorkerRpc();
10287
- set$b(rpc);
10303
+ set$c(rpc);
10304
+ } catch {
10305
+ // ignore
10306
+ }
10307
+ };
10308
+
10309
+ const send$2 = port => {
10310
+ // @ts-ignore
10311
+ return sendMessagePortToOpenerWorker(port);
10312
+ };
10313
+ const initializeOpenerWorker = async () => {
10314
+ try {
10315
+ const rpc = await LazyTransferMessagePortRpcParent.create({
10316
+ commandMap: {},
10317
+ send: send$2
10318
+ });
10319
+ set$a(rpc);
10288
10320
  } catch {
10289
10321
  // ignore
10290
10322
  }
@@ -10351,7 +10383,7 @@ const launchCompletionWorker = async () => {
10351
10383
 
10352
10384
  const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
10353
10385
  setFactory(launchCompletionWorker);
10354
- await Promise.all([initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental), initializeExtensionHost(), initializeExtensionManagementWorker(), initializeTextMeasurementWorker()]);
10386
+ await Promise.all([initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental), initializeExtensionHost(), initializeExtensionManagementWorker(), initializeTextMeasurementWorker(), initializeOpenerWorker()]);
10355
10387
  };
10356
10388
 
10357
10389
  // TODO move cursor
@@ -10817,7 +10849,7 @@ const updateDebugInfo = async debugId => {
10817
10849
  };
10818
10850
  set$6(key, oldState, newEditor);
10819
10851
  // @ts-ignore
10820
- await invoke$b('Editor.rerender', key);
10852
+ await invoke$c('Editor.rerender', key);
10821
10853
  };
10822
10854
 
10823
10855
  const keep = ['ActivateByEvent.activateByEvent', 'ExtensionHostManagement.activateByEvent', 'Editor.applyEdit2', 'Editor.applyEdits2', 'Editor.closeFind2', 'Editor.closeWidget2', 'Editor.create', 'Editor.getKeyBindings', 'Editor.getSourceActions', 'Editor.getLines2', 'Editor.getPositionAtCursor', 'Editor.getOffsetAtCursor', 'Editor.getQuickPickMenuEntries', 'Editor.getSelections', 'Editor.hotReload', 'Editor.getSelections2', 'Editor.getDiagnostics', 'Editor.getText', 'Editor.getWordAt', 'Editor.getWordAt2', 'Editor.getWordAtOffset2', 'Editor.getUri', 'Editor.getWordBefore', 'Editor.getWordBefore2', 'Editor.offsetAt', 'Editor.render', 'Editor.setSelections2', 'Editor.updateDebugInfo', 'Editor.getLanguageId', 'Editor.getProblems', 'Editor.getKeys', 'Editor.getMenuIds', 'Editor.getMenuEntries', 'Editor.getMenuEntries2', 'Font.ensure', 'HandleMessagePort.handleMessagePort', 'Hover.getHoverInfo', 'Hover.handleSashPointerDown', 'Hover.handleSashPointerMove', 'Hover.handleSashPointerUp', 'Hover.loadContent', 'Hover.render', 'Initialize.initialize', 'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker'
@@ -11142,7 +11174,7 @@ const listen = async () => {
11142
11174
  const rpc = await WebWorkerRpcClient.create({
11143
11175
  commandMap: commandMap
11144
11176
  });
11145
- set$a(rpc);
11177
+ set$b(rpc);
11146
11178
  };
11147
11179
 
11148
11180
  const CodeGeneratorInput = 'CodeGeneratorInput';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "16.4.0",
3
+ "version": "16.6.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"