@lvce-editor/search-process 15.1.1 → 15.2.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/index.js +101 -52
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -202,7 +202,6 @@ const walkValue = (value, transferrables, isTransferrable) => {
|
|
|
202
202
|
for (const property of Object.values(value)) {
|
|
203
203
|
walkValue(property, transferrables, isTransferrable);
|
|
204
204
|
}
|
|
205
|
-
return;
|
|
206
205
|
}
|
|
207
206
|
};
|
|
208
207
|
const getTransferrables = value => {
|
|
@@ -405,7 +404,14 @@ class IpcError extends VError {
|
|
|
405
404
|
const cause = new Error(message);
|
|
406
405
|
// @ts-ignore
|
|
407
406
|
cause.code = code;
|
|
408
|
-
|
|
407
|
+
if (stack) {
|
|
408
|
+
Object.defineProperty(cause, 'stack', {
|
|
409
|
+
configurable: true,
|
|
410
|
+
enumerable: false,
|
|
411
|
+
value: stack,
|
|
412
|
+
writable: true
|
|
413
|
+
});
|
|
414
|
+
}
|
|
409
415
|
super(cause, betterMessage);
|
|
410
416
|
} else {
|
|
411
417
|
super(betterMessage);
|
|
@@ -738,13 +744,13 @@ const signal$4 = webSocket => {
|
|
|
738
744
|
webSocket.resume();
|
|
739
745
|
};
|
|
740
746
|
const wrap$9 = webSocket => {
|
|
741
|
-
|
|
747
|
+
const wrap = {
|
|
742
748
|
dispose() {
|
|
743
|
-
|
|
749
|
+
wrap.webSocket.close();
|
|
744
750
|
},
|
|
745
751
|
// @ts-ignore
|
|
746
752
|
off(event, listener) {
|
|
747
|
-
|
|
753
|
+
wrap.webSocket.off(event, listener);
|
|
748
754
|
},
|
|
749
755
|
// @ts-ignore
|
|
750
756
|
on(event, listener) {
|
|
@@ -758,7 +764,7 @@ const wrap$9 = webSocket => {
|
|
|
758
764
|
const data = deserialize(message);
|
|
759
765
|
const event = {
|
|
760
766
|
data,
|
|
761
|
-
target:
|
|
767
|
+
target: wrap
|
|
762
768
|
};
|
|
763
769
|
listener(event);
|
|
764
770
|
};
|
|
@@ -771,7 +777,7 @@ const wrap$9 = webSocket => {
|
|
|
771
777
|
// @ts-ignore
|
|
772
778
|
send(message) {
|
|
773
779
|
const stringifiedMessage = serialize(message);
|
|
774
|
-
|
|
780
|
+
wrap.webSocket.send(stringifiedMessage);
|
|
775
781
|
},
|
|
776
782
|
start() {
|
|
777
783
|
throw new Error('start method is deprecated');
|
|
@@ -782,6 +788,7 @@ const wrap$9 = webSocket => {
|
|
|
782
788
|
*/
|
|
783
789
|
wrappedListener: undefined
|
|
784
790
|
};
|
|
791
|
+
return wrap;
|
|
785
792
|
};
|
|
786
793
|
const IpcChildWithWebSocket = {
|
|
787
794
|
__proto__: null,
|
|
@@ -864,7 +871,10 @@ const constructError = (message, type, name) => {
|
|
|
864
871
|
if (ErrorConstructor === Error) {
|
|
865
872
|
const error = new Error(message);
|
|
866
873
|
if (name && name !== 'VError') {
|
|
867
|
-
error
|
|
874
|
+
Object.defineProperty(error, 'name', {
|
|
875
|
+
configurable: true,
|
|
876
|
+
value: name
|
|
877
|
+
});
|
|
868
878
|
}
|
|
869
879
|
return error;
|
|
870
880
|
}
|
|
@@ -881,8 +891,10 @@ const getCurrentStack = () => {
|
|
|
881
891
|
const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
|
882
892
|
return currentStack;
|
|
883
893
|
};
|
|
884
|
-
const getNewLineIndex$1 = (string, startIndex
|
|
885
|
-
|
|
894
|
+
const getNewLineIndex$1 = (string, startIndex) => {
|
|
895
|
+
{
|
|
896
|
+
return string.indexOf(NewLine$1);
|
|
897
|
+
}
|
|
886
898
|
};
|
|
887
899
|
const getParentStack = error => {
|
|
888
900
|
let parentStack = error.stack || error.data || error.message || '';
|
|
@@ -893,55 +905,91 @@ const getParentStack = error => {
|
|
|
893
905
|
};
|
|
894
906
|
const MethodNotFound = -32601;
|
|
895
907
|
const Custom = -32001;
|
|
908
|
+
const setStack = (error, stack) => {
|
|
909
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, 'stack');
|
|
910
|
+
if (descriptor) {
|
|
911
|
+
if (!descriptor.configurable && !descriptor.writable) {
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
if (!descriptor.configurable && descriptor.writable) {
|
|
915
|
+
error.stack = stack;
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
Object.defineProperty(error, 'stack', {
|
|
920
|
+
configurable: true,
|
|
921
|
+
value: stack,
|
|
922
|
+
writable: true
|
|
923
|
+
});
|
|
924
|
+
};
|
|
925
|
+
const restoreExistingError = (error, currentStack) => {
|
|
926
|
+
if (typeof error.stack === 'string') {
|
|
927
|
+
setStack(error, `${error.stack}${NewLine$1}${currentStack}`);
|
|
928
|
+
}
|
|
929
|
+
return error;
|
|
930
|
+
};
|
|
931
|
+
const restoreMethodNotFoundError = (error, currentStack) => {
|
|
932
|
+
const restoredError = new JsonRpcError(error.message);
|
|
933
|
+
const parentStack = getParentStack(error);
|
|
934
|
+
setStack(restoredError, `${parentStack}${NewLine$1}${currentStack}`);
|
|
935
|
+
return restoredError;
|
|
936
|
+
};
|
|
937
|
+
const restoreStackFromData = (restoredError, error, currentStack) => {
|
|
938
|
+
if (error.data.stack && error.data.type && error.message) {
|
|
939
|
+
setStack(restoredError, `${error.data.type}: ${error.message}${NewLine$1}${error.data.stack}${NewLine$1}${currentStack}`);
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
if (error.data.stack) {
|
|
943
|
+
setStack(restoredError, error.data.stack);
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
const applyDataProperties = (restoredError, error) => {
|
|
947
|
+
restoreStackFromData(restoredError, error, getCurrentStack());
|
|
948
|
+
if (error.data.codeFrame) {
|
|
949
|
+
// @ts-ignore
|
|
950
|
+
restoredError.codeFrame = error.data.codeFrame;
|
|
951
|
+
}
|
|
952
|
+
if (error.data.code) {
|
|
953
|
+
// @ts-ignore
|
|
954
|
+
restoredError.code = error.data.code;
|
|
955
|
+
}
|
|
956
|
+
if (error.data.type) {
|
|
957
|
+
// @ts-ignore
|
|
958
|
+
restoredError.name = error.data.type;
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
const applyDirectProperties = (restoredError, error) => {
|
|
962
|
+
if (error.stack) {
|
|
963
|
+
const lowerStack = restoredError.stack || '';
|
|
964
|
+
const indexNewLine = getNewLineIndex$1(lowerStack);
|
|
965
|
+
const parentStack = getParentStack(error);
|
|
966
|
+
// @ts-ignore
|
|
967
|
+
setStack(restoredError, `${parentStack}${lowerStack.slice(indexNewLine)}`);
|
|
968
|
+
}
|
|
969
|
+
if (error.codeFrame) {
|
|
970
|
+
// @ts-ignore
|
|
971
|
+
restoredError.codeFrame = error.codeFrame;
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
const restoreMessageError = (error, _currentStack) => {
|
|
975
|
+
const restoredError = constructError(error.message, error.type, error.name);
|
|
976
|
+
if (error.data) {
|
|
977
|
+
applyDataProperties(restoredError, error);
|
|
978
|
+
} else {
|
|
979
|
+
applyDirectProperties(restoredError, error);
|
|
980
|
+
}
|
|
981
|
+
return restoredError;
|
|
982
|
+
};
|
|
896
983
|
const restoreJsonRpcError = error => {
|
|
897
984
|
const currentStack = getCurrentStack();
|
|
898
985
|
if (error && error instanceof Error) {
|
|
899
|
-
|
|
900
|
-
error.stack = error.stack + NewLine$1 + currentStack;
|
|
901
|
-
}
|
|
902
|
-
return error;
|
|
986
|
+
return restoreExistingError(error, currentStack);
|
|
903
987
|
}
|
|
904
988
|
if (error && error.code && error.code === MethodNotFound) {
|
|
905
|
-
|
|
906
|
-
const parentStack = getParentStack(error);
|
|
907
|
-
restoredError.stack = parentStack + NewLine$1 + currentStack;
|
|
908
|
-
return restoredError;
|
|
989
|
+
return restoreMethodNotFoundError(error, currentStack);
|
|
909
990
|
}
|
|
910
991
|
if (error && error.message) {
|
|
911
|
-
|
|
912
|
-
if (error.data) {
|
|
913
|
-
if (error.data.stack && error.data.type && error.message) {
|
|
914
|
-
restoredError.stack = error.data.type + ': ' + error.message + NewLine$1 + error.data.stack + NewLine$1 + currentStack;
|
|
915
|
-
} else if (error.data.stack) {
|
|
916
|
-
restoredError.stack = error.data.stack;
|
|
917
|
-
}
|
|
918
|
-
if (error.data.codeFrame) {
|
|
919
|
-
// @ts-ignore
|
|
920
|
-
restoredError.codeFrame = error.data.codeFrame;
|
|
921
|
-
}
|
|
922
|
-
if (error.data.code) {
|
|
923
|
-
// @ts-ignore
|
|
924
|
-
restoredError.code = error.data.code;
|
|
925
|
-
}
|
|
926
|
-
if (error.data.type) {
|
|
927
|
-
// @ts-ignore
|
|
928
|
-
restoredError.name = error.data.type;
|
|
929
|
-
}
|
|
930
|
-
} else {
|
|
931
|
-
if (error.stack) {
|
|
932
|
-
const lowerStack = restoredError.stack || '';
|
|
933
|
-
// @ts-ignore
|
|
934
|
-
const indexNewLine = getNewLineIndex$1(lowerStack);
|
|
935
|
-
const parentStack = getParentStack(error);
|
|
936
|
-
// @ts-ignore
|
|
937
|
-
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
938
|
-
}
|
|
939
|
-
if (error.codeFrame) {
|
|
940
|
-
// @ts-ignore
|
|
941
|
-
restoredError.codeFrame = error.codeFrame;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
return restoredError;
|
|
992
|
+
return restoreMessageError(error);
|
|
945
993
|
}
|
|
946
994
|
if (typeof error === 'string') {
|
|
947
995
|
return new Error(`JsonRpc Error: ${error}`);
|
|
@@ -1584,6 +1632,7 @@ const toTextSearchResult = (parsedLine, remaining, charsBefore, charsAfter) => {
|
|
|
1584
1632
|
end: endColumnIndex - previewStart,
|
|
1585
1633
|
endColumnIndex,
|
|
1586
1634
|
lineNumber,
|
|
1635
|
+
rowIndex: lineNumber - 1,
|
|
1587
1636
|
start: startColumnIndex - previewStart,
|
|
1588
1637
|
startColumnIndex,
|
|
1589
1638
|
text: previewText,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/search-process",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.2.0",
|
|
4
4
|
"description": "Search Process",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lvce Editor",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@lvce-editor/constants": "^5.14.0",
|
|
22
22
|
"execa": "^9.6.1",
|
|
23
|
-
"ws": "^8.21.
|
|
23
|
+
"ws": "^8.21.1"
|
|
24
24
|
},
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"@lvce-editor/ripgrep": "^5.
|
|
26
|
+
"@lvce-editor/ripgrep": "^5.2.0"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=24"
|