@lvce-editor/shared-process 0.13.0 → 0.14.1
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/config/defaultKeyBindings.json +1 -784
- package/config/defaultSettings.json +8 -1
- package/extensions/builtin.language-basics-css/extension.json +2 -1
- package/extensions/builtin.language-basics-css/languageConfiguration.json +21 -0
- package/extensions/builtin.language-basics-css/src/tokenizeCss.js +10 -1
- package/extensions/builtin.language-basics-dotenv/extension.json +5 -1
- package/extensions/builtin.language-basics-go/src/tokenizeGo.js +79 -10
- package/extensions/builtin.language-basics-html/languageConfiguration.json +66 -0
- package/extensions/builtin.language-basics-html/src/tokenizeHtml.js +89 -27
- package/extensions/builtin.language-basics-java/src/tokenizeJava.js +6 -5
- package/extensions/builtin.language-basics-javascript/src/tokenizeJavaScript.js +29 -1
- package/extensions/builtin.language-basics-json/extension.json +4 -2
- package/extensions/builtin.language-basics-json/src/tokenizeJson.js +3 -0
- package/extensions/builtin.language-basics-jsx/src/tokenizeJsx.js +18 -5
- package/extensions/builtin.language-basics-typescript/src/tokenizeTypeScript.js +26 -0
- package/extensions/builtin.language-basics-vue/src/tokenizeVue.js +1 -1
- package/extensions/builtin.language-basics-xml/extension.json +3 -1
- package/extensions/builtin.theme-atom-one-dark/color-theme.json +2 -2
- package/extensions/builtin.theme-ayu/color-theme.json +6 -2
- package/extensions/builtin.theme-cobalt2/color-theme.json +5 -2
- package/extensions/builtin.theme-slime/color-theme.json +2 -2
- package/package.json +10 -11
- package/src/parts/Assert/Assert.js +1 -6
- package/src/parts/AssertionError/AssertionError.js +6 -0
- package/src/parts/BulkReplacement/BulkReplacement.ipc.js +7 -0
- package/src/parts/BulkReplacement/BulkReplacement.js +20 -0
- package/src/parts/BulkReplacementContent/BulkReplacementContent.js +30 -0
- package/src/parts/ChildProcessError/ChildProcessError.js +45 -0
- package/src/parts/ChromeExtension/ChromeExtension.js +2 -5
- package/src/parts/CleanStack/CleanStack.js +90 -2
- package/src/parts/CliList/CliList.js +3 -0
- package/src/parts/ClipBoard/ClipBoard.js +2 -2
- package/src/parts/ClipBoard/ClipBoardGnome.js +1 -2
- package/src/parts/ClipBoard/ClipBoardNoop.js +2 -2
- package/src/parts/ClipBoard/ClipBoardWindows.js +1 -3
- package/src/parts/Command/Command.js +5 -10
- package/src/parts/Credentials/Credentials.ipc.js +5 -5
- package/src/parts/Credentials/Credentials.js +2 -10
- package/src/parts/Desktop/Desktop.js +22 -0
- package/src/parts/Download/Download.js +2 -2
- package/src/parts/Error/Error.js +1 -1
- package/src/parts/ErrorCodes/ErrorCodes.js +2 -1
- package/src/parts/ErrorHandling/ErrorHandling.js +8 -14
- package/src/parts/ExportStatic/ExportStatic.js +8 -3
- package/src/parts/ExtensionHost/ExtensionHost.js +1 -2
- package/src/parts/ExtensionHost/ExtensionHostKeyBindings.js +0 -12
- package/src/parts/ExtensionHostRpc/ExtensionHostRpc.js +1 -1
- package/src/parts/ExtensionInstallFromFile/ExtensionInstallFromFile.js +1 -1
- package/src/parts/ExtensionInstallFromGitHub/ExtensionInstallFromGitHub.js +1 -1
- package/src/parts/ExtensionInstallFromUrl/ExtensionInstallFromUrl.js +1 -1
- package/src/parts/ExtensionLink/ExtensionLink.js +0 -19
- package/src/parts/ExtensionList/ExtensionList.js +11 -2
- package/src/parts/ExtensionManagement/ExtensionManagement.js +6 -58
- package/src/parts/ExtensionManagement/ExtensionManagementColorTheme.js +3 -1
- package/src/parts/ExtensionManagement/ExtensionManagementIconTheme.js +1 -1
- package/src/parts/ExtensionManagement/ExtensionManagementLanguages.js +7 -3
- package/src/parts/ExtensionManifestInputType/ExtensionManifestInputType.js +2 -0
- package/src/parts/ExtensionManifests/ExtensionManifests.js +3 -0
- package/src/parts/ExtensionManifests/ExtensionManifestsFromFolder.js +5 -15
- package/src/parts/ExtensionManifests/ExtensionManifestsFromLinkedExtensionsFolder.js +56 -0
- package/src/parts/ExtensionUninstall/ExtensionUninstall.js +18 -0
- package/src/parts/ExtensionUnlink/ExtensionUnlink.js +1 -1
- package/src/parts/Extract/Extract.js +2 -6
- package/src/parts/ExtractZip/ExtractZip.js +1 -1
- package/src/parts/{Error → FileNotFoundError}/FileNotFoundError.js +9 -2
- package/src/parts/FileSystem/FileSystem.js +6 -32
- package/src/parts/FirstNodeWorkerEventType/FirstNodeWorkerEventType.js +5 -0
- package/src/parts/GetDirentType/GetDirentType.js +27 -0
- package/src/parts/GetFirstNodeChildProcessEvent/GetFirstNodeChildProcessEvent.js +39 -0
- package/src/parts/GetFirstNodeWorkerEvent/GetFirstNodeWorkerEvent.js +21 -0
- package/src/parts/GetNewLineIndex/GetNewLineIndex.js +9 -0
- package/src/parts/GetResponse/GetResponse.js +16 -6
- package/src/parts/GetTextSearchRipGrepArgs/GetTextSearchRipGrepArgs.js +14 -0
- package/src/parts/InstallExtension/InstallExtension.ipc.js +6 -0
- package/src/parts/InstallExtension/InstallExtension.js +33 -0
- package/src/parts/IpcParent/IpcParent.js +9 -0
- package/src/parts/IpcParentModule/IpcParentModule.js +12 -0
- package/src/parts/IpcParentType/IpcParentType.js +2 -0
- package/src/parts/IpcParentWithNodeForkedProcess/IpcParentWithNodeForkedProcess.js +49 -0
- package/src/parts/IpcParentWithNodeWorker/IpcParentWithNodeWorker.js +36 -0
- package/src/parts/IsEnoentErrorWindows/IsEnoentErrorWindows.js +3 -0
- package/src/parts/IsIgnoredError/IsIgnoredError.js +14 -0
- package/src/parts/Json/Json.js +3 -5
- package/src/parts/JsonError/JsonError.js +8 -14
- package/src/parts/JsonParsingError/JsonParsingError.js +17 -0
- package/src/parts/Jsonc/Jsonc.js +304 -0
- package/src/parts/JsoncCharCode/JsoncCharCode.js +23 -0
- package/src/parts/JsoncFile/JsoncFile.js +8 -0
- package/src/parts/JsoncTokenType/JsoncTokenType.js +11 -0
- package/src/parts/LimitString/LimitString.js +3 -1
- package/src/parts/MergeStacks/MergeStacks.js +3 -2
- package/src/parts/Module/Module.js +4 -0
- package/src/parts/ModuleId/ModuleId.js +2 -0
- package/src/parts/ModuleMap/ModuleMap.js +4 -0
- package/src/parts/Native/Native.js +1 -1
- package/src/parts/ParentIpc/ParentIpc.js +2 -1
- package/src/parts/Platform/Platform.js +0 -21
- package/src/parts/Preferences/Preferences.js +6 -8
- package/src/parts/PrettyError/PrettyError.js +16 -7
- package/src/parts/PrintPrettyError/PrintPrettyError.js +3 -1
- package/src/parts/RecentlyOpened/RecentlyOpened.js +3 -7
- package/src/parts/RequiresSocket/RequiresSocket.js +1 -0
- package/src/parts/RipGrep/RipGrep.js +1 -1
- package/src/parts/SearchFile/SearchFile.js +4 -9
- package/src/parts/Socket/Socket.js +2 -7
- package/src/parts/Terminal/Terminal.ipc.js +4 -41
- package/src/parts/Terminal/Terminal.js +29 -25
- package/src/parts/TextSearch/TextSearch.js +102 -108
- package/src/parts/ToAbsolutePaths/ToAbsolutePaths.js +9 -0
- package/src/parts/ToTextSearchResult/ToTextSearchResult.js +42 -0
- package/src/parts/Trash/Trash.js +1 -2
- /package/src/parts/{RgPath/RgPath.js → RipGrepPath/RipGrepPath.js} +0 -0
|
@@ -22,6 +22,7 @@ const State = {
|
|
|
22
22
|
InsideBacktickString: 17,
|
|
23
23
|
AfterPropertyDot: 18,
|
|
24
24
|
InsideTag: 19,
|
|
25
|
+
AfterSemicolon: 20,
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -124,13 +125,13 @@ const RE_STRING_DOUBLE_QUOTE_CONTENT = /^[^"\\]+/
|
|
|
124
125
|
const RE_STRING_BACKTICK_QUOTE_CONTENT = /^[^`\\\$]+/
|
|
125
126
|
const RE_STRING_ESCAPE = /^\\./
|
|
126
127
|
const RE_SHEBANG = /^#!.*/
|
|
127
|
-
const RE_FUNCTION_CALL_NAME = /^[\w]+(?=\s*(
|
|
128
|
+
const RE_FUNCTION_CALL_NAME = /^[\w]+(?=\s*(\`|\(|\=\s*function|\=\s*\())/
|
|
128
129
|
const RE_DECORATOR = /^@\w+/
|
|
129
130
|
const RE_BACKSLASH = /^\\/
|
|
130
131
|
const RE_DOLLAR_CURLY_OPEN = /^\$\{/
|
|
131
132
|
const RE_DOLLAR = /^\$/
|
|
132
133
|
const RE_ANYTHING = /^.+/u
|
|
133
|
-
const RE_ANGLE_BRACKET_OPEN_TAG = /^<(?![\s
|
|
134
|
+
const RE_ANGLE_BRACKET_OPEN_TAG = /^<(?![\s!<=\d])/
|
|
134
135
|
const RE_ANGLE_BRACKET_CLOSE_TAG = /^<\/(?![\s!])/
|
|
135
136
|
const RE_TAGNAME = /^[!\w\:\.]+/
|
|
136
137
|
const RE_ANGLE_BRACKET_CLOSE = /^>/
|
|
@@ -155,6 +156,8 @@ const RE_EMPTY_FRAGMENT = /^<\s*\>/
|
|
|
155
156
|
const RE_VAR_CONST_LET_EXPORT =
|
|
156
157
|
/^\s*(?=(?:if|class|export|var|const|let)(?:\s+|$))/
|
|
157
158
|
|
|
159
|
+
const RE_EXPRESSION = /;\w+$/
|
|
160
|
+
|
|
158
161
|
export const initialLineState = {
|
|
159
162
|
state: State.TopLevelContent,
|
|
160
163
|
/**
|
|
@@ -260,8 +263,13 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
260
263
|
token = TokenType.Numeric
|
|
261
264
|
state = State.TopLevelContent
|
|
262
265
|
} else if ((next = part.match(RE_ANGLE_BRACKET_OPEN_TAG))) {
|
|
263
|
-
|
|
264
|
-
|
|
266
|
+
if (RE_EXPRESSION.test(line.slice(0, index))) {
|
|
267
|
+
next = part.match(RE_ANGLE_BRACKET_OPEN)
|
|
268
|
+
token = TokenType.Punctuation
|
|
269
|
+
} else {
|
|
270
|
+
token = TokenType.PunctuationTag
|
|
271
|
+
state = State.AfterOpeningAngleBracket
|
|
272
|
+
}
|
|
265
273
|
} else if ((next = part.match(RE_CURLY_CLOSE))) {
|
|
266
274
|
token = TokenType.Punctuation
|
|
267
275
|
state = stack.pop() || State.TopLevelContent
|
|
@@ -275,7 +283,11 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
275
283
|
state = State.AfterPropertyDot
|
|
276
284
|
} else if (next[0] === '}') {
|
|
277
285
|
state = stack.pop() || State.TopLevelContent
|
|
278
|
-
}
|
|
286
|
+
}
|
|
287
|
+
// else if (next[0] === ';') {
|
|
288
|
+
// state = State.AfterSemicolon
|
|
289
|
+
// }
|
|
290
|
+
else {
|
|
279
291
|
state = State.TopLevelContent
|
|
280
292
|
}
|
|
281
293
|
} else if ((next = part.match(RE_SLASH))) {
|
|
@@ -570,6 +582,7 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
570
582
|
state = State.InsideTag
|
|
571
583
|
} else {
|
|
572
584
|
part
|
|
585
|
+
line
|
|
573
586
|
throw new Error('no')
|
|
574
587
|
}
|
|
575
588
|
break
|
|
@@ -174,6 +174,8 @@ const RE_KEYWORD_TYPE = /^type\b/
|
|
|
174
174
|
const RE_KEYWORD_IN = /^in\b/
|
|
175
175
|
const RE_KEYWORD_OF = /^of\b/
|
|
176
176
|
const RE_KEYWORD_EXTENDS = /^extends\b/
|
|
177
|
+
const RE_KEYWORD_READONLY = /^readonly\b/
|
|
178
|
+
const RE_SHEBANG = /^\#\!\/.*/
|
|
177
179
|
|
|
178
180
|
export const hasArrayReturn = true
|
|
179
181
|
/**
|
|
@@ -284,6 +286,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
284
286
|
state = State.TopLevelContent
|
|
285
287
|
break
|
|
286
288
|
}
|
|
289
|
+
} else if (index === 0 && (next = part.match(RE_SHEBANG))) {
|
|
290
|
+
token = TokenType.Comment
|
|
291
|
+
state = State.TopLevelContent
|
|
287
292
|
} else if ((next = part.match(RE_VARIABLE_NAME))) {
|
|
288
293
|
token = TokenType.VariableName
|
|
289
294
|
state = State.TopLevelContent
|
|
@@ -777,6 +782,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
777
782
|
} else if ((next = part.match(RE_METHOD_NAME))) {
|
|
778
783
|
token = TokenType.Function
|
|
779
784
|
state = State.AfterMethodName
|
|
785
|
+
} else if ((next = part.match(RE_KEYWORD_READONLY))) {
|
|
786
|
+
token = TokenType.KeywordModifier
|
|
787
|
+
state = State.InsideTypeObject
|
|
780
788
|
} else if ((next = part.match(RE_VARIABLE_NAME))) {
|
|
781
789
|
token = TokenType.VariableName
|
|
782
790
|
state = State.InsideTypeObject
|
|
@@ -796,6 +804,12 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
796
804
|
} else if ((next = part.match(RE_VERTICAL_LINE))) {
|
|
797
805
|
token = TokenType.Punctuation
|
|
798
806
|
state = State.BeforeType
|
|
807
|
+
} else if ((next = part.match(RE_SQUARE_OPEN))) {
|
|
808
|
+
token = TokenType.Punctuation
|
|
809
|
+
state = State.InsideTypeObject
|
|
810
|
+
} else if ((next = part.match(RE_SQUARE_CLOSE))) {
|
|
811
|
+
token = TokenType.Punctuation
|
|
812
|
+
state = State.InsideTypeObject
|
|
799
813
|
} else {
|
|
800
814
|
part
|
|
801
815
|
throw new Error('no')
|
|
@@ -806,6 +820,12 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
806
820
|
token = TokenType.Punctuation
|
|
807
821
|
state = State.InsideMethodParameters
|
|
808
822
|
// stack.push()
|
|
823
|
+
} else if ((next = part.match(RE_COLON))) {
|
|
824
|
+
token = TokenType.Punctuation
|
|
825
|
+
state = State.AfterMethodName
|
|
826
|
+
} else if ((next = part.match(RE_WHITESPACE))) {
|
|
827
|
+
token = TokenType.Whitespace
|
|
828
|
+
state = State.AfterMethodName
|
|
809
829
|
} else {
|
|
810
830
|
throw new Error('no')
|
|
811
831
|
}
|
|
@@ -842,6 +862,12 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
842
862
|
token = TokenType.Punctuation
|
|
843
863
|
state = State.BeforeType
|
|
844
864
|
stack.push(State.InsideTypeObject)
|
|
865
|
+
} else if ((next = part.match(RE_WHITESPACE))) {
|
|
866
|
+
token = TokenType.Whitespace
|
|
867
|
+
state = State.AfterMethodParameters
|
|
868
|
+
} else if ((next = part.match(RE_ARROW))) {
|
|
869
|
+
token = TokenType.Punctuation
|
|
870
|
+
state = State.BeforeType
|
|
845
871
|
} else {
|
|
846
872
|
throw new Error('no')
|
|
847
873
|
}
|
|
@@ -58,7 +58,7 @@ const RE_ANGLE_BRACKET_ONLY = /^</
|
|
|
58
58
|
const RE_ANGLE_BRACKET_OPEN = /^</
|
|
59
59
|
const RE_ANGLE_BRACKET_OPEN_TAG = /^<(?![\s!])/
|
|
60
60
|
const RE_ANY_TEXT = /^[^\n]+/
|
|
61
|
-
const RE_ATTRIBUTE_NAME = /^[a-zA-Z\d
|
|
61
|
+
const RE_ATTRIBUTE_NAME = /^[\@a-zA-Z\d\-\:\.]+/
|
|
62
62
|
const RE_BLOCK_COMMENT_CONTENT_1 = /^.+?(?=-->)/s
|
|
63
63
|
const RE_BLOCK_COMMENT_CONTENT_2 = /^.+$/s
|
|
64
64
|
const RE_BLOCK_COMMENT_END = /^-->/
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
|
|
56
56
|
"TitleBarBackground": "#21252B",
|
|
57
57
|
"TitleBarBorderBottomColor": "",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
58
|
+
"TitleBarForeground": "rgb(157, 165, 180)",
|
|
59
|
+
"TitleBarForegroundActive": "rgb(157, 165, 180)",
|
|
60
60
|
|
|
61
61
|
"TreeItemHoverBackground": "rgba(44, 49, 58, 0.4)"
|
|
62
62
|
},
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
"MenuItemHoverForeground": "rgb(92, 97, 102)",
|
|
40
40
|
"MenuItemHoverBackground": "rgba(86, 114, 143, 0.12)",
|
|
41
|
+
"MenuItemSeparatorBackground": "#d4d4d4",
|
|
41
42
|
|
|
42
43
|
"PanelBackground": "#f8f9fa",
|
|
43
44
|
"PanelBorderTopColor": "#6b7d8f1f",
|
|
@@ -59,11 +60,14 @@
|
|
|
59
60
|
"TabActiveBackground": "",
|
|
60
61
|
"TabInactiveBackground": "",
|
|
61
62
|
|
|
62
|
-
"TitleBarBackground": "",
|
|
63
|
+
"TitleBarBackground": "rgb(248, 249, 250)",
|
|
63
64
|
"TitleBarBorderBottomColor": "",
|
|
64
|
-
"TitleBarForeground": "
|
|
65
|
+
"TitleBarForeground": "rgb(138, 145, 153)",
|
|
65
66
|
"TitleBarColorInactive": "",
|
|
66
67
|
"TitleBarItemHoverForeground": "rgba(0, 0, 0, 0.1)",
|
|
68
|
+
"TitleBarForegroundActive": "rgb(92, 97, 102)",
|
|
69
|
+
|
|
70
|
+
"TitleBarButtonCloseHoverForeground": "#fff",
|
|
67
71
|
|
|
68
72
|
"TreeItemForeground": "#8a9199",
|
|
69
73
|
"TreeItemActiveBackground": "rgba(86, 114, 143, 0.12)"
|
|
@@ -58,10 +58,13 @@
|
|
|
58
58
|
|
|
59
59
|
"TabsBackground": "rgb(18, 39, 56)",
|
|
60
60
|
|
|
61
|
-
"TitleBarBackground": "
|
|
61
|
+
"TitleBarBackground": "rgb(25, 53, 73)",
|
|
62
62
|
"TitleBarBorderBottomColor": "",
|
|
63
63
|
"TitleBarColor": "",
|
|
64
|
-
"TitleBarColorInactive": "rgba(204, 204, 204, 0.6)"
|
|
64
|
+
"TitleBarColorInactive": "rgba(204, 204, 204, 0.6)",
|
|
65
|
+
"TitleBarActiveBackground": "#15232D",
|
|
66
|
+
"TitleBarForeground": "rgba(255, 255, 255, 0.2)",
|
|
67
|
+
"TitleBarForegroundActive": "rgb(255, 255, 255)"
|
|
65
68
|
},
|
|
66
69
|
"tokenColors": [
|
|
67
70
|
{
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"ActivityBarActiveBackground": "#1f2727",
|
|
7
7
|
"ActivityBarActiveForeground": "rgb(135, 143, 140)",
|
|
8
8
|
|
|
9
|
-
"BadgeBackground": "
|
|
10
|
-
"BadgeForeground": "#
|
|
9
|
+
"BadgeBackground": "#90599b",
|
|
10
|
+
"BadgeForeground": "#eeeeee",
|
|
11
11
|
|
|
12
12
|
"EditorBackGround": "#1e2324",
|
|
13
13
|
"EditorScrollBarBackground": "rgba(57, 71, 71, 0.6)",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Utility package for @lvce-editor/server",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,30 +17,29 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/code-frame": "^7.18.6",
|
|
20
|
-
"@lvce-editor/extension-host": "0.
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.
|
|
22
|
-
"@lvce-editor/pty-host": "0.
|
|
20
|
+
"@lvce-editor/extension-host": "0.14.1",
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.14.1",
|
|
22
|
+
"@lvce-editor/pty-host": "0.14.1",
|
|
23
23
|
"debug": "^4.3.4",
|
|
24
|
-
"execa": "^
|
|
24
|
+
"execa": "^7.1.1",
|
|
25
25
|
"exit-hook": "^3.2.0",
|
|
26
|
-
"got": "^12.
|
|
26
|
+
"got": "^12.6.0",
|
|
27
27
|
"is-object": "^1.0.2",
|
|
28
28
|
"lines-and-columns": "^2.0.3",
|
|
29
|
-
"open": "^
|
|
29
|
+
"open": "^9.0.0",
|
|
30
30
|
"p-queue": "^7.3.4",
|
|
31
31
|
"parse-json": "^6.0.2",
|
|
32
32
|
"symlink-dir": "^5.1.1",
|
|
33
33
|
"tail": "^2.2.6",
|
|
34
34
|
"tar-fs": "^2.1.1",
|
|
35
35
|
"tmp-promise": "^3.0.3",
|
|
36
|
-
"trash": "^8.1.
|
|
37
|
-
"
|
|
38
|
-
"ws": "^8.12.0",
|
|
36
|
+
"trash": "^8.1.1",
|
|
37
|
+
"ws": "^8.13.0",
|
|
39
38
|
"xdg-basedir": "^5.1.0"
|
|
40
39
|
},
|
|
41
40
|
"optionalDependencies": {
|
|
42
41
|
"extract-zip": "^2.0.1",
|
|
43
42
|
"keytar": "^7.9.0",
|
|
44
|
-
"vscode-ripgrep-with-github-api-error-fix": "^2.
|
|
43
|
+
"vscode-ripgrep-with-github-api-error-fix": "^2.8.0"
|
|
45
44
|
}
|
|
46
45
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as FileSystem from '../FileSystem/FileSystem.js'
|
|
2
|
+
import * as BulkReplacementContent from '../BulkReplacementContent/BulkReplacementContent.js'
|
|
3
|
+
|
|
4
|
+
const applyEdit = async (path, ranges, replacement) => {
|
|
5
|
+
const content = await FileSystem.readFile(path)
|
|
6
|
+
const newContent = BulkReplacementContent.getNewContent(content, ranges, replacement)
|
|
7
|
+
await FileSystem.writeFile(path, newContent)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const applyBulkReplacement = async (files, ranges, replacement) => {
|
|
11
|
+
let rangeIndex = 0
|
|
12
|
+
for (const file of files) {
|
|
13
|
+
const rangeLength = ranges[rangeIndex]
|
|
14
|
+
const rangeStartIndex = rangeIndex + 1
|
|
15
|
+
const rangeEndIndex = rangeStartIndex + rangeLength
|
|
16
|
+
const fileRanges = ranges.slice(rangeStartIndex, rangeEndIndex)
|
|
17
|
+
await applyEdit(file, fileRanges, replacement)
|
|
18
|
+
rangeIndex = rangeEndIndex
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as GetNewLineIndex from '../GetNewLineIndex/GetNewLineIndex.js'
|
|
2
|
+
|
|
3
|
+
export const getNewContent = (content, ranges, replacement) => {
|
|
4
|
+
if (ranges.length === 0) {
|
|
5
|
+
return content
|
|
6
|
+
}
|
|
7
|
+
let rowIndex = 0
|
|
8
|
+
let newLineIndex = -1
|
|
9
|
+
let copiedContentIndex = 0
|
|
10
|
+
let newContent = ''
|
|
11
|
+
let previousNewLineIndex = -1
|
|
12
|
+
for (let i = 0; i < ranges.length; i += 4) {
|
|
13
|
+
while (rowIndex < ranges[i]) {
|
|
14
|
+
previousNewLineIndex = newLineIndex
|
|
15
|
+
newLineIndex = GetNewLineIndex.getNewLineIndex(content, newLineIndex + 1)
|
|
16
|
+
rowIndex++
|
|
17
|
+
}
|
|
18
|
+
const startRowIndex = ranges[i]
|
|
19
|
+
const startColumnIndex = ranges[i + 1]
|
|
20
|
+
const endRowIndex = ranges[i + 2]
|
|
21
|
+
const endColumnIndex = ranges[i + 3]
|
|
22
|
+
if (copiedContentIndex <= newLineIndex) {
|
|
23
|
+
newContent += content.slice(copiedContentIndex, newLineIndex + 1)
|
|
24
|
+
copiedContentIndex = newLineIndex + 1
|
|
25
|
+
}
|
|
26
|
+
newContent += replacement
|
|
27
|
+
copiedContentIndex += endColumnIndex - startColumnIndex
|
|
28
|
+
}
|
|
29
|
+
return newContent
|
|
30
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as SplitLines from '../SplitLines/SplitLines.js'
|
|
2
|
+
|
|
3
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/
|
|
4
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/
|
|
5
|
+
|
|
6
|
+
const RE_MASSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/
|
|
7
|
+
const RE_MASSAGE_CODE_BLOCK_END = /^\s* at/
|
|
8
|
+
|
|
9
|
+
const isUnhelpfulNativeModuleError = (stderr) => {
|
|
10
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const isMessageCodeBlockStartIndex = (line) => {
|
|
14
|
+
return RE_MASSAGE_CODE_BLOCK_START.test(line)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const isMessageCodeBlockEndIndex = (line) => {
|
|
18
|
+
return RE_MASSAGE_CODE_BLOCK_END.test(line)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const getMessageCodeBlock = (stderr) => {
|
|
22
|
+
const lines = SplitLines.splitLines(stderr)
|
|
23
|
+
const startIndex = lines.findIndex(isMessageCodeBlockStartIndex)
|
|
24
|
+
const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex)
|
|
25
|
+
const relevantLines = lines.slice(startIndex, endIndex)
|
|
26
|
+
const relevantMessage = relevantLines.join(' ').slice('Error: '.length)
|
|
27
|
+
return relevantMessage
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const getNativeModuleErrorMessage = (stderr) => {
|
|
31
|
+
const message = getMessageCodeBlock(stderr)
|
|
32
|
+
return `incompatible native node module: ${message}`
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class ChildProcessError extends Error {
|
|
36
|
+
constructor(stderr) {
|
|
37
|
+
if (isUnhelpfulNativeModuleError(stderr)) {
|
|
38
|
+
const message = getNativeModuleErrorMessage(stderr)
|
|
39
|
+
super(message)
|
|
40
|
+
} else {
|
|
41
|
+
super('child process error')
|
|
42
|
+
}
|
|
43
|
+
this.name = 'ChildProcessError'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import VError from 'verror'
|
|
2
1
|
import * as Assert from '../Assert/Assert.js'
|
|
3
2
|
import * as Download from '../Download/Download.js'
|
|
4
3
|
import * as ExtractZip from '../ExtractZip/ExtractZip.js'
|
|
5
4
|
import * as FileSystem from '../FileSystem/FileSystem.js'
|
|
6
5
|
import * as Path from '../Path/Path.js'
|
|
7
6
|
import * as Platform from '../Platform/Platform.js'
|
|
7
|
+
import { VError } from '../VError/VError.js'
|
|
8
8
|
|
|
9
9
|
const getExtensionPath = async (tmpDir) => {
|
|
10
10
|
const dirents = await FileSystem.readDirWithFileTypes(tmpDir)
|
|
@@ -19,10 +19,7 @@ export const install = async (name, url) => {
|
|
|
19
19
|
Assert.string(name)
|
|
20
20
|
Assert.string(url)
|
|
21
21
|
const cachedChromeExtensionsPath = Platform.getCachedExtensionsPath()
|
|
22
|
-
const tempFileCompressed = Path.join(
|
|
23
|
-
cachedChromeExtensionsPath,
|
|
24
|
-
`${name}.zip`
|
|
25
|
-
)
|
|
22
|
+
const tempFileCompressed = Path.join(cachedChromeExtensionsPath, `${name}.zip`)
|
|
26
23
|
const tmpDir = Path.join(cachedChromeExtensionsPath, name)
|
|
27
24
|
const chromeExtensionsPath = Platform.getChromeExtensionsPath()
|
|
28
25
|
await Download.download(url, tempFileCompressed)
|
|
@@ -1,5 +1,93 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as SplitLines from '../SplitLines/SplitLines.js'
|
|
2
|
+
|
|
3
|
+
const RE_AT = /^\s+at/
|
|
4
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/
|
|
5
|
+
const RE_OBJECT_AS = /^\s*at (async )?Object\.\w+ \[as ([\w\.]+)\]/
|
|
6
|
+
const RE_GET_RESPONSE = /^\s*at async getResponse/
|
|
7
|
+
const RE_WEBSOCKET_HANDLE_MESSAGE = /^\s*at async WebSocket.handleMessage/
|
|
8
|
+
const RE_EXECUTE_COMMAND_ASYNC = /^\s*at executeCommandAsync/
|
|
9
|
+
const RE_HANDLE_OTHER_MESSAGES_FROM_MESSAGE_PORT = /^\s*at async MessagePort\.handleOtherMessagesFromMessagePort/
|
|
10
|
+
|
|
11
|
+
const isInternalLine = (line) => {
|
|
12
|
+
return line.includes('node:') || RE_AT_PROMISE_INDEX.test(line) || line.includes('node_modules/ws')
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const isRelevantLine = (line) => {
|
|
16
|
+
return !isInternalLine(line)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const isApplicationUsefulLine = (line, index) => {
|
|
20
|
+
if (index === 0) {
|
|
21
|
+
return true
|
|
22
|
+
}
|
|
23
|
+
if (RE_GET_RESPONSE.test(line)) {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
if (RE_WEBSOCKET_HANDLE_MESSAGE.test(line)) {
|
|
27
|
+
return false
|
|
28
|
+
}
|
|
29
|
+
if (RE_EXECUTE_COMMAND_ASYNC.test(line)) {
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
if (RE_HANDLE_OTHER_MESSAGES_FROM_MESSAGE_PORT.test(line)) {
|
|
33
|
+
return false
|
|
34
|
+
}
|
|
35
|
+
return true
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const isNormalStackLine = (line) => {
|
|
39
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const cleanLine = (line) => {
|
|
43
|
+
if (line.startsWith(' at exports.')) {
|
|
44
|
+
return ' at ' + line.slice(' at exports.'.length)
|
|
45
|
+
}
|
|
46
|
+
if (line.startsWith(' at async exports.')) {
|
|
47
|
+
return ' at async ' + line.slice(' at async exports.'.length)
|
|
48
|
+
}
|
|
49
|
+
if (line.startsWith(' at async Module.')) {
|
|
50
|
+
return ' at async ' + line.slice(' at async Module.'.length)
|
|
51
|
+
}
|
|
52
|
+
if (line.startsWith(' at Module.')) {
|
|
53
|
+
return ' at ' + line.slice(' at Module.'.length)
|
|
54
|
+
}
|
|
55
|
+
const objectMatch = line.match(RE_OBJECT_AS)
|
|
56
|
+
if (objectMatch) {
|
|
57
|
+
const rest = line.slice(objectMatch[0].length)
|
|
58
|
+
if (objectMatch[1]) {
|
|
59
|
+
return ' at ' + objectMatch[1] + objectMatch[2] + rest
|
|
60
|
+
}
|
|
61
|
+
return ' at ' + objectMatch[2] + rest
|
|
62
|
+
}
|
|
63
|
+
return line
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const getDetails = (lines) => {
|
|
67
|
+
const index = lines.findIndex(isNormalStackLine)
|
|
68
|
+
return {
|
|
69
|
+
custom: lines.slice(0, index),
|
|
70
|
+
actualStack: lines.slice(index).map(cleanLine),
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const RE_PATH_1 = /^\/(.*)(\d+)$/
|
|
75
|
+
|
|
76
|
+
const mergeCustom = (custom, relevantStack) => {
|
|
77
|
+
if (custom.length === 0) {
|
|
78
|
+
return relevantStack
|
|
79
|
+
}
|
|
80
|
+
const firstLine = custom[0]
|
|
81
|
+
if (RE_PATH_1.test(firstLine)) {
|
|
82
|
+
return [` at ${firstLine}`, ...relevantStack]
|
|
83
|
+
}
|
|
84
|
+
return relevantStack
|
|
85
|
+
}
|
|
2
86
|
|
|
3
87
|
export const cleanStack = (stack) => {
|
|
4
|
-
|
|
88
|
+
const lines = SplitLines.splitLines(stack)
|
|
89
|
+
const { custom, actualStack } = getDetails(lines)
|
|
90
|
+
const relevantStack = actualStack.filter(isRelevantLine).filter(isApplicationUsefulLine)
|
|
91
|
+
const merged = mergeCustom(custom, relevantStack)
|
|
92
|
+
return merged
|
|
5
93
|
}
|
|
@@ -3,6 +3,9 @@ import * as JoinLines from '../JoinLines/JoinLines.js'
|
|
|
3
3
|
import * as Logger from '../Logger/Logger.js'
|
|
4
4
|
|
|
5
5
|
const getOutputLine = (extension) => {
|
|
6
|
+
if (extension.symlink) {
|
|
7
|
+
return `${extension.id} -> ${extension.symlink}`
|
|
8
|
+
}
|
|
6
9
|
return `${extension.id}: ${extension.version}`
|
|
7
10
|
}
|
|
8
11
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Desktop from '../Desktop/Desktop.js'
|
|
2
2
|
import * as DesktopType from '../DesktopType/DesktopType.js'
|
|
3
3
|
|
|
4
4
|
const getClipboard = () => {
|
|
5
|
-
const desktop =
|
|
5
|
+
const desktop = Desktop.getDesktop()
|
|
6
6
|
switch (desktop) {
|
|
7
7
|
case DesktopType.Gnome:
|
|
8
8
|
return import('./ClipBoardGnome.js')
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// see also http://manpages.ubuntu.com/manpages/bionic/man1/xclip.1.html
|
|
3
3
|
// on gnome, get current selection targets with `xclip -selection clipboard -t TARGETS -o`
|
|
4
4
|
|
|
5
|
-
import VError from 'verror'
|
|
6
5
|
import * as Exec from '../Exec/Exec.js'
|
|
7
6
|
import * as JoinLines from '../JoinLines/JoinLines.js'
|
|
8
7
|
import * as SplitLines from '../SplitLines/SplitLines.js'
|
|
8
|
+
import { VError } from '../VError/VError.js'
|
|
9
9
|
|
|
10
10
|
const removePrefix = (file) => {
|
|
11
11
|
if (file.startsWith('file://')) {
|
|
@@ -57,7 +57,6 @@ export const writeFiles = async (type, files) => {
|
|
|
57
57
|
input: plainContent,
|
|
58
58
|
})
|
|
59
59
|
} catch (error) {
|
|
60
|
-
// @ts-ignore
|
|
61
60
|
throw new VError(error, 'Failed to copy files to clipboard')
|
|
62
61
|
}
|
|
63
62
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as Desktop from '../Desktop/Desktop.js'
|
|
2
2
|
|
|
3
3
|
export const readFiles = async () => {
|
|
4
4
|
return {
|
|
@@ -9,6 +9,6 @@ export const readFiles = async () => {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const writeFiles = (type, files) => {
|
|
12
|
-
const desktop =
|
|
12
|
+
const desktop = Desktop.getDesktop()
|
|
13
13
|
console.info(`writing files to clipboard is not yet supported on ${desktop}`)
|
|
14
14
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import clipboardEx from 'electron-clipboard-ex'
|
|
2
|
-
|
|
3
|
-
import VError from 'verror'
|
|
2
|
+
import { VError } from '../VError/VError.js'
|
|
4
3
|
|
|
5
4
|
export const readFiles = async () => {
|
|
6
5
|
const filePaths = clipboardEx.readFilePaths()
|
|
@@ -16,7 +15,6 @@ export const writeFiles = async (type, files) => {
|
|
|
16
15
|
try {
|
|
17
16
|
clipboardEx.writeFilePaths(files)
|
|
18
17
|
} catch (error) {
|
|
19
|
-
// @ts-ignore
|
|
20
18
|
throw new VError(error, 'Failed to copy files to clipboard')
|
|
21
19
|
}
|
|
22
20
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CommandNotFoundError } from '../CommandNotFoundError/CommandNotFoundError.js'
|
|
1
2
|
import * as ModuleMap from '../ModuleMap/ModuleMap.js'
|
|
2
3
|
import { VError } from '../VError/VError.js'
|
|
3
4
|
|
|
@@ -19,9 +20,7 @@ const initializeModule = (module) => {
|
|
|
19
20
|
}
|
|
20
21
|
return
|
|
21
22
|
}
|
|
22
|
-
throw new Error(
|
|
23
|
-
`module ${module.name} is missing an initialize function and commands`
|
|
24
|
-
)
|
|
23
|
+
throw new Error(`module ${module.name} is missing an initialize function and commands`)
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
const loadModule = async (moduleId) => {
|
|
@@ -29,11 +28,7 @@ const loadModule = async (moduleId) => {
|
|
|
29
28
|
const module = await state.load(moduleId)
|
|
30
29
|
initializeModule(module)
|
|
31
30
|
} catch (error) {
|
|
32
|
-
if (
|
|
33
|
-
error &&
|
|
34
|
-
error instanceof SyntaxError &&
|
|
35
|
-
error.stack === `SyntaxError: ${error.message}`
|
|
36
|
-
) {
|
|
31
|
+
if (error && error instanceof SyntaxError && error.stack === `SyntaxError: ${error.message}`) {
|
|
37
32
|
Error.captureStackTrace(error, loadModule)
|
|
38
33
|
}
|
|
39
34
|
throw new VError(error, `failed to load module ${moduleId}`)
|
|
@@ -68,9 +63,9 @@ const executeCommandAsync = async (command, ...args) => {
|
|
|
68
63
|
return
|
|
69
64
|
}
|
|
70
65
|
hasThrown.add(command)
|
|
71
|
-
throw new
|
|
66
|
+
throw new CommandNotFoundError(command)
|
|
72
67
|
}
|
|
73
|
-
return
|
|
68
|
+
return state.commands[command](...args)
|
|
74
69
|
}
|
|
75
70
|
|
|
76
71
|
export const execute = (command, ...args) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as Credentials from './Credentials.js'
|
|
2
2
|
|
|
3
3
|
export const Commands = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
getPassword: Credentials.getPassword,
|
|
5
|
+
setPassword: Credentials.setPassword,
|
|
6
|
+
deletePassword: Credentials.deletePassword,
|
|
7
|
+
findPassword: Credentials.findPassword,
|
|
8
|
+
findCredentials: Credentials.findCredentials,
|
|
9
9
|
}
|