@lvce-editor/output-view 2.25.0 → 2.26.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.
@@ -1455,7 +1455,7 @@ const aggregateLines = lines => {
1455
1455
  let repeatCount = 0;
1456
1456
  for (const line of lines) {
1457
1457
  const key = getAggregationKey(line);
1458
- if (result.length > 0 && key === previousKey) {
1458
+ if (key === previousKey && result.length > 0) {
1459
1459
  repeatCount++;
1460
1460
  const previousIndex = result.length - 1;
1461
1461
  result[previousIndex] = withRepeatCount(result.at(-1), repeatCount);
@@ -1469,7 +1469,7 @@ const aggregateLines = lines => {
1469
1469
  };
1470
1470
 
1471
1471
  const isFileNotFoundError = error => {
1472
- return error?.message?.includes('File not found') ?? false;
1472
+ return !!error && typeof error === 'object' && 'message' in error && typeof error.message === 'string' && error.message.includes('File not found');
1473
1473
  };
1474
1474
 
1475
1475
  const Filter$2 = 'Filter';
@@ -1503,12 +1503,14 @@ const trimTrailingPunctuation = value => {
1503
1503
  return value.slice(0, end);
1504
1504
  };
1505
1505
  const getLinkMatch = text => {
1506
- const match = text.match(RE_URL);
1506
+ const match = RE_URL.exec(text);
1507
1507
  return match ? trimTrailingPunctuation(match[0]) : null;
1508
1508
  };
1509
1509
 
1510
1510
  const isStructuredLogEntry = value => {
1511
- return value?.category === 'Window' && typeof value.level === 'string' && typeof value.line === 'number' && typeof value.message === 'string' && typeof value.source === 'string' && typeof value.timestamp === 'string';
1511
+ if (!value || typeof value !== 'object') return false;
1512
+ const entry = value;
1513
+ return entry.category === 'Window' && typeof entry.level === 'string' && typeof entry.line === 'number' && typeof entry.message === 'string' && typeof entry.source === 'string' && typeof entry.timestamp === 'string';
1512
1514
  };
1513
1515
  const getSourceLabel = (source, line) => {
1514
1516
  const withoutQueryOrFragment = source.split(/[?#]/, 1)[0];
@@ -1558,7 +1560,7 @@ const RE_SOURCE_LINK = /^(?:lvce(?:-oss)?:\/\/|file:\/\/)/;
1558
1560
  const RE_SOURCE_LOCATION = /:(\d+)(?::(\d+))?$/;
1559
1561
  const getLinkPart = match => {
1560
1562
  if (RE_SOURCE_LINK.test(match)) {
1561
- const locationMatch = match.match(RE_SOURCE_LOCATION);
1563
+ const locationMatch = RE_SOURCE_LOCATION.exec(match);
1562
1564
  const lineNumber = locationMatch ? Number(locationMatch[1]) : undefined;
1563
1565
  const columnNumber = locationMatch?.[2] ? Number(locationMatch[2]) : undefined;
1564
1566
  return {
@@ -2336,7 +2338,6 @@ const handleFileChange = async watchId => {
2336
2338
  for (const key of keys) {
2337
2339
  const instance = get(key);
2338
2340
  if (instance.newState.watchId === watchId) {
2339
- // @ts-ignore
2340
2341
  await invoke$1('Output.refresh');
2341
2342
  }
2342
2343
  }
@@ -2359,10 +2360,7 @@ const setupChangeListener = async (oldWatchId, newWatchId, uri) => {
2359
2360
  unregisterWatchCallback(oldWatchId);
2360
2361
  await unwatchFile(oldWatchId);
2361
2362
  }
2362
- if (!uri) {
2363
- return;
2364
- }
2365
- if (isExtensionOutputUri(uri)) {
2363
+ if (!uri || isExtensionOutputUri(uri)) {
2366
2364
  return;
2367
2365
  }
2368
2366
  const rpcId = OutputWorker;
@@ -2629,32 +2627,17 @@ const loadOptions = async (platform, applicationId) => {
2629
2627
  }] : []), ...detailOptions, ...extensionOptions];
2630
2628
  };
2631
2629
 
2632
- const getSavedFilterValue = savedState => {
2633
- if (savedState && typeof savedState.filterValue === 'string') {
2634
- return savedState.filterValue;
2635
- }
2636
- return '';
2637
- };
2638
- const getSavedSelectedOption = savedState => {
2639
- if (savedState && typeof savedState.selectedOption === 'string') {
2640
- return savedState.selectedOption;
2641
- }
2642
- return '';
2643
- };
2644
- const getSavedScrollLockEnabled = savedState => {
2645
- if (savedState && typeof savedState.scrollLockEnabled === 'boolean') {
2646
- return savedState.scrollLockEnabled;
2647
- }
2648
- return false;
2649
- };
2650
2630
  const restoreState = savedState => {
2651
- const filterValue = getSavedFilterValue(savedState);
2652
- const selectedOption = getSavedSelectedOption(savedState);
2653
- const scrollLockEnabled = getSavedScrollLockEnabled(savedState);
2654
- return {
2631
+ const saved = savedState && typeof savedState === 'object' ? savedState : {};
2632
+ const {
2655
2633
  filterValue,
2656
2634
  scrollLockEnabled,
2657
2635
  selectedOption
2636
+ } = saved;
2637
+ return {
2638
+ filterValue: typeof filterValue === 'string' ? filterValue : '',
2639
+ scrollLockEnabled: typeof scrollLockEnabled === 'boolean' && scrollLockEnabled,
2640
+ selectedOption: typeof selectedOption === 'string' ? selectedOption : ''
2658
2641
  };
2659
2642
  };
2660
2643
 
@@ -2662,7 +2645,7 @@ const isString = value => {
2662
2645
  return typeof value === 'string';
2663
2646
  };
2664
2647
  const getSavedCollapsedUris = savedState => {
2665
- if (savedState && savedState.collapsedUris && Array.isArray(savedState.collapsedUris) && savedState.collapsedUris.every(isString)) {
2648
+ if (savedState && typeof savedState === 'object' && 'collapsedUris' in savedState && Array.isArray(savedState.collapsedUris) && savedState.collapsedUris.every(isString)) {
2666
2649
  return savedState.collapsedUris;
2667
2650
  }
2668
2651
  return [];
@@ -3039,7 +3022,6 @@ const renderEventListeners = () => {
3039
3022
  preventDefault: true
3040
3023
  }, {
3041
3024
  name: HandleFilterInput,
3042
- // @ts-ignore
3043
3025
  params: ['handleFilterInput', 'event.target.value', User]
3044
3026
  }, {
3045
3027
  name: HandleClearFilterClick,
@@ -3192,6 +3174,7 @@ const commandMap = {
3192
3174
  'Output.loadContent2': wrapCommand(loadContent),
3193
3175
  'Output.openFindWidget': wrapCommand(openFindWidget),
3194
3176
  'Output.refresh': wrapCommand(refresh),
3177
+ 'Output.refreshOptions': wrapCommand(refreshOptions),
3195
3178
  'Output.render2': render2,
3196
3179
  'Output.renderActions': wrapGetter(renderActions),
3197
3180
  'Output.renderEventListeners': renderEventListeners,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/output-view",
3
- "version": "2.25.0",
3
+ "version": "2.26.0",
4
4
  "description": "Output View Worker",
5
5
  "repository": {
6
6
  "type": "git",