@lvce-editor/shared-process 0.17.4 → 0.17.6
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/extensions/builtin.language-basics-go/src/tokenizeGo.js +71 -6
- package/extensions/builtin.language-basics-kotlin/src/tokenizeKotlin.js +10 -3
- package/extensions/builtin.language-basics-less/src/tokenizeLess.js +25 -0
- package/extensions/builtin.language-basics-perl/src/tokenizePerl.js +9 -2
- package/extensions/builtin.language-basics-python/src/tokenizePython.js +1 -0
- package/extensions/builtin.language-basics-shellscript/src/tokenizeShellScript.js +15 -4
- package/extensions/builtin.language-basics-xml/extension.json +2 -1
- package/package.json +6 -6
- package/src/parts/AutoUpdateType/AutoUpdateType.js +2 -1
- package/src/parts/AutoUpdater/AutoUpdater.js +3 -0
- package/src/parts/CommandNotFoundError/CommandNotFoundError.js +1 -1
- package/src/parts/Crash/Crash.ipc.js +3 -0
- package/src/parts/Crash/Crash.js +5 -0
- package/src/parts/DesktopCapturer/DesktopCapturer.ipc.js +7 -0
- package/src/parts/DesktopCapturer/DesktopCapturer.js +5 -0
- package/src/parts/ElectronApplicationMenu/ElectronApplicationMenu.ipc.js +7 -0
- package/src/parts/ElectronApplicationMenu/ElectronApplicationMenu.js +5 -0
- package/src/parts/ElectronBrowserView/ElectronBrowserView.ipc.js +8 -0
- package/src/parts/ElectronBrowserView/ElectronBrowserView.js +9 -0
- package/src/parts/ElectronClipBoard/ElectronClipBoard.ipc.js +7 -0
- package/src/parts/ElectronClipBoard/ElectronClipBoard.js +5 -0
- package/src/parts/ElectronContentTracing/ElectronContentTracing.js +9 -0
- package/src/parts/ElectronDialog/ElectronDialog.ipc.js +8 -0
- package/src/parts/ElectronDialog/ElectronDialog.js +9 -0
- package/src/parts/ElectronNetLog/ElectronNetLog.ipc.js +8 -0
- package/src/parts/ElectronNetLog/ElectronNetLog.js +12 -0
- package/src/parts/ElectronWindowAbout/ElectronWindowAbout.ipc.js +7 -0
- package/src/parts/ElectronWindowAbout/ElectronWindowAbout.js +5 -0
- package/src/parts/Exec/Exec.js +4 -0
- package/src/parts/Exit/Exit.ipc.js +7 -0
- package/src/parts/Exit/Exit.js +6 -0
- package/src/parts/GetAccurateMemoryUsage/GetAccurateMemoryUsage.js +2 -12
- package/src/parts/Module/Module.js +26 -2
- package/src/parts/ModuleId/ModuleId.js +55 -42
- package/src/parts/ModuleMap/ModuleMap.js +56 -21
- package/src/parts/OpenExternal/OpenExternal.ipc.js +8 -0
- package/src/parts/OpenExternal/OpenExternal.js +9 -0
- package/src/parts/Os/Os.ipc.js +7 -0
- package/src/parts/Os/Os.js +5 -0
- package/src/parts/ParseMemory/ParseMemory.js +11 -0
- package/src/parts/Path/Path.js +0 -8
- package/src/parts/Platform/Platform.ipc.js +2 -1
- package/src/parts/Platform/Platform.js +9 -3
- package/src/parts/PrettyError/PrettyError.js +1 -29
- package/src/parts/Process/Process.ipc.js +1 -0
- package/src/parts/Process/Process.js +4 -0
- package/src/parts/ProcessId/ProcessId.ipc.js +8 -0
- package/src/parts/ProcessId/ProcessId.js +7 -0
- package/src/parts/WaitForProcessToExit/WaitForProcessToExit.js +2 -2
- package/src/sharedProcessMain.js +2 -0
- /package/src/parts/{Window → ElectronWindow}/ElectronWindow.ipc.js +0 -0
- /package/src/parts/{Window → ElectronWindow}/ElectronWindow.js +0 -0
|
@@ -5,6 +5,8 @@ export const State = {
|
|
|
5
5
|
TopLevelContent: 1,
|
|
6
6
|
InsideDoubleQuoteString: 2,
|
|
7
7
|
InsideLineComment: 3,
|
|
8
|
+
InsideBacktickString: 4,
|
|
9
|
+
AfterKeywordFunc: 5,
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -19,7 +21,7 @@ export const TokenType = {
|
|
|
19
21
|
String: 50,
|
|
20
22
|
Numeric: 30,
|
|
21
23
|
FunctionName: 112,
|
|
22
|
-
|
|
24
|
+
TypePrimitive: 36,
|
|
23
25
|
Text: 117,
|
|
24
26
|
PunctuationTag: 228,
|
|
25
27
|
TagName: 118,
|
|
@@ -32,6 +34,8 @@ export const TokenType = {
|
|
|
32
34
|
VariableName: 952,
|
|
33
35
|
LanguageConstant: 953,
|
|
34
36
|
KeywordControl: 954,
|
|
37
|
+
KeywordImport: 955,
|
|
38
|
+
KeywordReturn: 956,
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
export const TokenMap = {
|
|
@@ -41,8 +45,8 @@ export const TokenMap = {
|
|
|
41
45
|
[TokenType.Comment]: 'Comment',
|
|
42
46
|
[TokenType.String]: 'String',
|
|
43
47
|
[TokenType.Numeric]: 'Numeric',
|
|
44
|
-
[TokenType.FunctionName]: '
|
|
45
|
-
[TokenType.
|
|
48
|
+
[TokenType.FunctionName]: 'Function',
|
|
49
|
+
[TokenType.TypePrimitive]: 'TypePrimitive',
|
|
46
50
|
[TokenType.Text]: 'Text',
|
|
47
51
|
[TokenType.PunctuationTag]: 'PunctuationTag',
|
|
48
52
|
[TokenType.TagName]: 'TagName',
|
|
@@ -55,6 +59,8 @@ export const TokenMap = {
|
|
|
55
59
|
[TokenType.VariableName]: 'VariableName',
|
|
56
60
|
[TokenType.LanguageConstant]: 'LanguageConstant',
|
|
57
61
|
[TokenType.KeywordControl]: 'KeywordControl',
|
|
62
|
+
[TokenType.KeywordImport]: 'KeywordImport',
|
|
63
|
+
[TokenType.KeywordReturn]: 'KeywordReturn',
|
|
58
64
|
}
|
|
59
65
|
|
|
60
66
|
const RE_WHITESPACE = /^\s+/
|
|
@@ -84,7 +90,7 @@ const RE_ROUND_CLOSE = /^\)/
|
|
|
84
90
|
const RE_DOT = /^\./
|
|
85
91
|
const RE_EQUAL_SIGN = /^=/
|
|
86
92
|
const RE_SINGLE_QUOTE = /^'/
|
|
87
|
-
const RE_PUNCTUATION = /^[\(\)=\+\-><\.,\/\*\^\[\]\{\}
|
|
93
|
+
const RE_PUNCTUATION = /^[\(\)=\+\-><\.,\/\*\^\[\]\{\}\|:\;\%!\&\*]/
|
|
88
94
|
const RE_ANYTHING_UNTIL_END = /^.+/s
|
|
89
95
|
const RE_START_OF_FUNCTION = /^( )*\(/
|
|
90
96
|
const RE_COLON_COLON = /^::/
|
|
@@ -94,7 +100,7 @@ const RE_SQUARE_OPEN_SQUARE_OPEN = /^\[\[/
|
|
|
94
100
|
const RE_SQUARE_CLOSE_SQUARE_CLOSE = /^\]\]/
|
|
95
101
|
const RE_STRING_MULTILINE_CONTENT = /^.+?(?=\]\]|$)/s
|
|
96
102
|
const RE_KEYWORD =
|
|
97
|
-
/^(?:var|type|true|switch|struct|select|return|range|package|map|interface|import|if|goto|go|for|func|false|default|continue|const|chan|case|break)\b/
|
|
103
|
+
/^(?:var|type|true|switch|struct|select|return|range|package|map|interface|import|if|goto|go|for|func|false|default|continue|const|chan|case|break|nil|else|string|int64|bool)\b/
|
|
98
104
|
const RE_TEXT = /^.+/s
|
|
99
105
|
const RE_QUOTE_SINGLE = /^'/
|
|
100
106
|
const RE_QUOTE_DOUBLE = /^"/
|
|
@@ -141,9 +147,11 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
141
147
|
token = TokenType.Whitespace
|
|
142
148
|
state = State.TopLevelContent
|
|
143
149
|
} else if ((next = part.match(RE_KEYWORD))) {
|
|
150
|
+
state = State.TopLevelContent
|
|
144
151
|
switch (next[0]) {
|
|
145
152
|
case 'true':
|
|
146
153
|
case 'false':
|
|
154
|
+
case 'nil':
|
|
147
155
|
token = TokenType.LanguageConstant
|
|
148
156
|
break
|
|
149
157
|
case 'as':
|
|
@@ -162,11 +170,28 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
162
170
|
case 'while':
|
|
163
171
|
token = TokenType.KeywordControl
|
|
164
172
|
break
|
|
173
|
+
case 'import':
|
|
174
|
+
token = TokenType.KeywordImport
|
|
175
|
+
break
|
|
176
|
+
case 'return':
|
|
177
|
+
token = TokenType.KeywordReturn
|
|
178
|
+
break
|
|
179
|
+
case 'bool':
|
|
180
|
+
case 'string':
|
|
181
|
+
case 'int64':
|
|
182
|
+
token = TokenType.TypePrimitive
|
|
183
|
+
break
|
|
184
|
+
case 'range':
|
|
185
|
+
token = TokenType.FunctionName
|
|
186
|
+
break
|
|
187
|
+
case 'func':
|
|
188
|
+
token = TokenType.Keyword
|
|
189
|
+
state = State.AfterKeywordFunc
|
|
190
|
+
break
|
|
165
191
|
default:
|
|
166
192
|
token = TokenType.Keyword
|
|
167
193
|
break
|
|
168
194
|
}
|
|
169
|
-
state = State.TopLevelContent
|
|
170
195
|
} else if ((next = part.match(RE_VARIABLE_NAME))) {
|
|
171
196
|
token = TokenType.VariableName
|
|
172
197
|
state = State.TopLevelContent
|
|
@@ -182,6 +207,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
182
207
|
} else if ((next = part.match(RE_QUOTE_DOUBLE))) {
|
|
183
208
|
token = TokenType.Punctuation
|
|
184
209
|
state = State.InsideDoubleQuoteString
|
|
210
|
+
} else if ((next = part.match(RE_QUOTE_BACKTICK))) {
|
|
211
|
+
token = TokenType.String
|
|
212
|
+
state = State.InsideBacktickString
|
|
185
213
|
} else if ((next = part.match(RE_TEXT))) {
|
|
186
214
|
token = TokenType.Text
|
|
187
215
|
state = State.TopLevelContent
|
|
@@ -207,6 +235,23 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
207
235
|
throw new Error('no')
|
|
208
236
|
}
|
|
209
237
|
break
|
|
238
|
+
case State.InsideBacktickString:
|
|
239
|
+
if ((next = part.match(RE_QUOTE_BACKTICK))) {
|
|
240
|
+
token = TokenType.Punctuation
|
|
241
|
+
state = State.TopLevelContent
|
|
242
|
+
} else if ((next = part.match(RE_STRING_BACKTICK_QUOTE_CONTENT))) {
|
|
243
|
+
token = TokenType.String
|
|
244
|
+
state = State.InsideBacktickString
|
|
245
|
+
} else if ((next = part.match(RE_STRING_ESCAPE))) {
|
|
246
|
+
token = TokenType.String
|
|
247
|
+
state = State.InsideBacktickString
|
|
248
|
+
} else if ((next = part.match(RE_BACKSLASH))) {
|
|
249
|
+
token = TokenType.String
|
|
250
|
+
state = State.InsideBacktickString
|
|
251
|
+
} else {
|
|
252
|
+
throw new Error('no')
|
|
253
|
+
}
|
|
254
|
+
break
|
|
210
255
|
case State.InsideLineComment:
|
|
211
256
|
if ((next = part.match(RE_TEXT))) {
|
|
212
257
|
token = TokenType.Comment
|
|
@@ -215,6 +260,26 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
215
260
|
throw new Error('no')
|
|
216
261
|
}
|
|
217
262
|
break
|
|
263
|
+
case State.AfterKeywordFunc:
|
|
264
|
+
if ((next = part.match(RE_WHITESPACE))) {
|
|
265
|
+
token = TokenType.Whitespace
|
|
266
|
+
state = State.AfterKeywordFunc
|
|
267
|
+
} else if ((next = part.match(RE_VARIABLE_NAME))) {
|
|
268
|
+
token = TokenType.FunctionName
|
|
269
|
+
state = State.TopLevelContent
|
|
270
|
+
} else if ((next = part.match(RE_LINE_COMMENT))) {
|
|
271
|
+
token = TokenType.Comment
|
|
272
|
+
state = State.AfterKeywordFunc
|
|
273
|
+
} else if ((next = part.match(RE_PUNCTUATION))) {
|
|
274
|
+
token = TokenType.Punctuation
|
|
275
|
+
state = State.TopLevelContent
|
|
276
|
+
} else if ((next = part.match(RE_ANYTHING_UNTIL_END))) {
|
|
277
|
+
token = TokenType.Text
|
|
278
|
+
state = State.TopLevelContent
|
|
279
|
+
} else {
|
|
280
|
+
throw new Error(`no`)
|
|
281
|
+
}
|
|
282
|
+
break
|
|
218
283
|
default:
|
|
219
284
|
state
|
|
220
285
|
throw new Error('no')
|
|
@@ -49,10 +49,10 @@ const RE_ANYTHING_UNTIL_CLOSE_BRACE = /^[^\}]+/
|
|
|
49
49
|
const RE_QUOTE_DOUBLE = /^"/
|
|
50
50
|
const RE_STRING_DOUBLE_QUOTE_CONTENT = /^[^"]+/
|
|
51
51
|
const RE_KEYWORD =
|
|
52
|
-
/^(?:while|when|var|val|typeof|typealias|try|true|throw|this|super|return|package|object|null|is|interface|in|if|fun|for|false|else|do|continue|class|break|as)\b/
|
|
52
|
+
/^(?:while|when|var|val|typeof|typealias|try|true|throw|this|super|return|package|object|null|is|interface|in|if|fun|for|false|else|do|continue|class|break|as|enum|String)\b/
|
|
53
53
|
|
|
54
|
-
const RE_VARIABLE_NAME = /^[a-zA-Z]+/
|
|
55
|
-
const RE_PUNCTUATION = /^[:,;\{\}\[\]\.=\(\)
|
|
54
|
+
const RE_VARIABLE_NAME = /^[a-zA-Z\_\$]+/
|
|
55
|
+
const RE_PUNCTUATION = /^[:,;\{\}\[\]\.=\(\)<>\-]/
|
|
56
56
|
const RE_NUMERIC = /^\d+/
|
|
57
57
|
|
|
58
58
|
export const initialLineState = {
|
|
@@ -62,12 +62,19 @@ export const initialLineState = {
|
|
|
62
62
|
|
|
63
63
|
export const hasArrayReturn = true
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param {any} lineStateA
|
|
68
|
+
* @param {*} lineStateB
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
65
71
|
export const isEqualLineState = (lineStateA, lineStateB) => {
|
|
66
72
|
return lineStateA.state === lineStateB.state
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
/**
|
|
70
76
|
* @param {string} line
|
|
77
|
+
* @param {any} lineState
|
|
71
78
|
*/
|
|
72
79
|
export const tokenizeLine = (line, lineState) => {
|
|
73
80
|
let next = null
|
|
@@ -75,6 +75,7 @@ export const State = {
|
|
|
75
75
|
InsideSingleQuoteString: 16,
|
|
76
76
|
AfterFunctionNameInsideArguments: 17,
|
|
77
77
|
AfterKeywordImport: 18,
|
|
78
|
+
AfterLessVariableName: 19,
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
export const initialLineState = {
|
|
@@ -127,6 +128,7 @@ const RE_ANYTHING_BUT_CURLY = /^[^\{\}]+/s
|
|
|
127
128
|
const RE_LINE_COMMENT = /\/\/.*/
|
|
128
129
|
const RE_NESTED_SELECTOR = /^[\w\.\-\s]+(?=\s*(?:\{|,))/
|
|
129
130
|
const RE_AMPERSAND = /^\&/
|
|
131
|
+
const RE_LESS_VARIABLE_NAME = /^@[\w\-]+(?=\:)/
|
|
130
132
|
|
|
131
133
|
/**
|
|
132
134
|
* @param {string} line
|
|
@@ -167,6 +169,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
167
169
|
} else if ((next = part.match(RE_SQUARE_OPEN))) {
|
|
168
170
|
token = TokenType.Punctuation
|
|
169
171
|
state = State.InsideAttributeSelector
|
|
172
|
+
} else if ((next = part.match(RE_LESS_VARIABLE_NAME))) {
|
|
173
|
+
token = TokenType.Variable
|
|
174
|
+
state = State.AfterLessVariableName
|
|
170
175
|
} else if ((next = part.match(RE_QUERY))) {
|
|
171
176
|
switch (next[0]) {
|
|
172
177
|
case '@font-face':
|
|
@@ -565,6 +570,26 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
565
570
|
throw new Error('no')
|
|
566
571
|
}
|
|
567
572
|
break
|
|
573
|
+
case State.AfterLessVariableName:
|
|
574
|
+
if ((next = part.match(RE_COLON))) {
|
|
575
|
+
token = TokenType.Punctuation
|
|
576
|
+
state = State.AfterLessVariableName
|
|
577
|
+
} else if ((next = part.match(RE_WHITESPACE))) {
|
|
578
|
+
token = TokenType.Whitespace
|
|
579
|
+
state = State.AfterLessVariableName
|
|
580
|
+
} else if ((next = part.match(RE_NUMERIC))) {
|
|
581
|
+
token = TokenType.Numeric
|
|
582
|
+
state = State.AfterLessVariableName
|
|
583
|
+
} else if ((next = part.match(RE_SEMICOLON))) {
|
|
584
|
+
token = TokenType.Punctuation
|
|
585
|
+
state = stack.pop() || State.TopLevelContent
|
|
586
|
+
} else if ((next = part.match(RE_PROPERTY_VALUE))) {
|
|
587
|
+
token = TokenType.CssPropertyValue
|
|
588
|
+
state = State.AfterLessVariableName
|
|
589
|
+
} else {
|
|
590
|
+
throw new Error('no')
|
|
591
|
+
}
|
|
592
|
+
break
|
|
568
593
|
default:
|
|
569
594
|
console.log({ state, line })
|
|
570
595
|
throw new Error('no')
|
|
@@ -62,13 +62,15 @@ const RE_ANYTHING_UNTIL_CLOSE_BRACE = /^[^\}]+/
|
|
|
62
62
|
const RE_QUOTE_DOUBLE = /^"/
|
|
63
63
|
const RE_STRING_DOUBLE_QUOTE_CONTENT = /^[^"]+/
|
|
64
64
|
const RE_KEYWORD =
|
|
65
|
-
/^(?:case|continue|default|die|no|else|elsif|eval|exit|for|foreach|given|goto|if|last|next|push|redo|require|return|select|shift|sub|switch|unless|until|use|wait|when|while)\b/
|
|
65
|
+
/^(?:case|continue|default|die|my|no|else|elsif|eval|exit|for|foreach|given|goto|if|last|next|push|print|redo|require|return|select|shift|sub|switch|unless|unshift|until|use|wait|when|while)\b/
|
|
66
66
|
const RE_STRING_SINGLE_QUOTE_CONTENT = /^[^']+/
|
|
67
67
|
const RE_VARIABLE_NAME = /^[$a-zA-Z\_@%]+/
|
|
68
|
-
const RE_PUNCTUATION =
|
|
68
|
+
const RE_PUNCTUATION =
|
|
69
|
+
/^[:,;\{\}\[\]\.=\(\)<>\\\-\?~\|\/\[\\*\$\]^!&\+\{\}\(\)]/
|
|
69
70
|
const RE_NUMERIC = /^\d+/
|
|
70
71
|
const RE_QUOTE_BACKTICK = /^`/
|
|
71
72
|
const RE_QUOTE_SINGLE = /^'/
|
|
73
|
+
const RE_FUNCTION_NAME = /^\w+(?=\s*\()/
|
|
72
74
|
|
|
73
75
|
export const initialLineState = {
|
|
74
76
|
state: State.TopLevelContent,
|
|
@@ -120,10 +122,12 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
120
122
|
token = TokenType.KeywordReturn
|
|
121
123
|
break
|
|
122
124
|
case 'shift':
|
|
125
|
+
case 'unshift':
|
|
123
126
|
case 'push':
|
|
124
127
|
case 'eval':
|
|
125
128
|
case 'exit':
|
|
126
129
|
case 'die':
|
|
130
|
+
case 'print':
|
|
127
131
|
token = TokenType.Function
|
|
128
132
|
break
|
|
129
133
|
default:
|
|
@@ -134,6 +138,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
134
138
|
} else if ((next = part.match(RE_PUNCTUATION))) {
|
|
135
139
|
token = TokenType.Punctuation
|
|
136
140
|
state = State.TopLevelContent
|
|
141
|
+
} else if ((next = part.match(RE_FUNCTION_NAME))) {
|
|
142
|
+
token = TokenType.Function
|
|
143
|
+
state = State.TopLevelContent
|
|
137
144
|
} else if ((next = part.match(RE_VARIABLE_NAME))) {
|
|
138
145
|
token = TokenType.VariableName
|
|
139
146
|
state = State.TopLevelContent
|
|
@@ -74,17 +74,17 @@ const RE_STRING_DOUBLE_QUOTE_CONTENT = /^[^"\\]+/
|
|
|
74
74
|
const RE_STRING_SINGLE_QUOTE_CONTENT = /^[^']+/
|
|
75
75
|
const RE_STRING_BACKTICK_QUOTE_CONTENT = /^[^`]+/
|
|
76
76
|
const RE_KEYWORD =
|
|
77
|
-
/^(?:7z|7za|7zr|Xdialog|alias|anacron|apk|apt-get|ar|asciidoctor|awk|base64|basename|bash|bg|bind|blkid|break|brew|brotli|builtin|bunzip|bunzip2|caller|cargo|case|cat|catdoc|cd|chmod|chown|circleci|clear|cmp|command|compgen|complete|continue|cp|cryptsetup|curl|curl|cut|cygstart|dde-open|defaults|deno|diff|dirname|dirs|disown|do|docker|done|done|dpkg-trigger|dpkg|du|echo|egrep|elif|else|emulate|enable|enlightenment_open|esac|eval|eval_gettext|exec|exit|expr|false|fc|fg|fi|find|for|free|function|fuzzponent|fzf|g\+\+|gatsby|gcc|gcloud|gdbus|getopts|gio|git|gnome-open|google-chrome-beta|google-chrome|grep|groupadd|grub-mount|gs|gulp|gvfs-open|gzip|hash|hdiutil|head|help|hexdump|history|identity|if|ifconfig|
|
|
77
|
+
/^(?:7z|7za|7zr|Xdialog|alias|anacron|apk|apt-get|ar|asciidoctor|awk|base64|basename|bash|bg|bind|blkid|break|brew|brotli|builtin|bunzip|bunzip2|caller|cargo|case|cat|catdoc|cd|chmod|chown|circleci|clear|cmp|command|compgen|complete|composite|continue|convert|cp|cryptsetup|curl|curl|cut|cygstart|dde-open|defaults|deno|diff|dirname|dirs|disown|do|docker|done|done|dpkg-trigger|dpkg|du|echo|egrep|elif|else|emulate|enable|enlightenment_open|esac|eval|eval_gettext|exec|exit|expr|false|fc|fg|fi|find|for|free|function|fuzzponent|fzf|g\+\+|gatsby|gcc|gcloud|gdbus|getopts|gio|git|gnome-open|google-chrome-beta|google-chrome|go|grep|groupadd|grub-mount|gs|gulp|gvfs-open|gzip|hash|hdiutil|head|help|hexdump|history|icotool|identity|if|ifconfig|install-plugin|in|install|ip|jobs|jq|kbd_mode|kde-open|kdialog|kfmclient|kill|killall|killproc|ldconfig|less|let|lha|ln|loadkeys|local|logout|ls|ls|lunzip|lzip|lzma|makepkg|miniunz|miniunzip|mkdir|mktemp|mount|mpicc|mv|node|nohup|npm|npx|open|pacman|paste|pcmanfm|pdftotext|pkg|pkill|plutil|png2icns|pnpm|popd|prezip-bin|print|printf|println|ps|pushd|pwd|python3|rar|read|readlink|readonly|realpath|return|rm|route|rpm|rsvg-convert|rsync|sed|set|setfont|sh|sha256sum|shift|shopt|sleep|snap|sort|source|sponge|start-stop-daemon|stty|sudo|suspend|tail|tar|tee|test|texi2dvi|then|times|touch|trap|true|tty|tune2fs|type|ulimit|umask|umask|unalias|unarj|unmkinitramfs|unmount|unrar|unset|unwrapdiff|unzip|unzoo|update-alternatives|update-desktop-database|update-mime-database|useradd|vim|wait|wc|wget|which|while|wp|xargs|xprop|xunit-viewer|xz|yarn|yum|zenity|zip|zoo|zsh|zstd)\b/
|
|
78
78
|
|
|
79
79
|
const RE_VARIABLE_NAME = /^[a-zA-Z\_\/\-\$][a-zA-Z\_\/\-\$#\d\-]*/
|
|
80
80
|
const RE_PUNCTUATION = /^[:,;\{\}\[\]\.=\(\)<>\!\|\+\&\>\)]/
|
|
81
|
-
const RE_NUMERIC = /^\d+(?=\s
|
|
81
|
+
const RE_NUMERIC = /^\d+(?=\s|;|$)/
|
|
82
82
|
const RE_FUNCTION_NAME = /^\w+(?=\s*\()/
|
|
83
83
|
const RE_EOF_START = /^<<\s*([\w\!]+)/
|
|
84
84
|
const RE_EOF_CONTENT = /.*/s
|
|
85
85
|
const RE_STRING_ESCAPE = /^\\./
|
|
86
86
|
const RE_BACKSLASH_AT_END = /^\\$/
|
|
87
|
-
const RE_OR =
|
|
87
|
+
const RE_OR = /^\|\|/
|
|
88
88
|
|
|
89
89
|
export const initialLineState = {
|
|
90
90
|
state: State.TopLevelContent,
|
|
@@ -180,6 +180,8 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
180
180
|
case 'command':
|
|
181
181
|
case 'compgen':
|
|
182
182
|
case 'complete':
|
|
183
|
+
case 'composite':
|
|
184
|
+
case 'convert':
|
|
183
185
|
case 'cp':
|
|
184
186
|
case 'cryptsetup':
|
|
185
187
|
case 'curl':
|
|
@@ -222,6 +224,7 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
222
224
|
case 'gio':
|
|
223
225
|
case 'git':
|
|
224
226
|
case 'gnome-open':
|
|
227
|
+
case 'go':
|
|
225
228
|
case 'google-chrome':
|
|
226
229
|
case 'google-chrome-beta':
|
|
227
230
|
case 'grep':
|
|
@@ -237,6 +240,7 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
237
240
|
case 'help':
|
|
238
241
|
case 'hexdump':
|
|
239
242
|
case 'history':
|
|
243
|
+
case 'icotool':
|
|
240
244
|
case 'identity':
|
|
241
245
|
case 'ifconfig':
|
|
242
246
|
case 'install':
|
|
@@ -250,6 +254,7 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
250
254
|
case 'kfmclient':
|
|
251
255
|
case 'kill':
|
|
252
256
|
case 'killall':
|
|
257
|
+
case 'killproc':
|
|
253
258
|
case 'ldconfig':
|
|
254
259
|
case 'less':
|
|
255
260
|
case 'lha':
|
|
@@ -275,10 +280,13 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
275
280
|
case 'npx':
|
|
276
281
|
case 'open':
|
|
277
282
|
case 'pacman':
|
|
283
|
+
case 'paste':
|
|
278
284
|
case 'pcmanfm':
|
|
279
285
|
case 'pdftotext':
|
|
280
286
|
case 'pkg':
|
|
287
|
+
case 'pkill':
|
|
281
288
|
case 'plutil':
|
|
289
|
+
case 'png2icns':
|
|
282
290
|
case 'pnpm':
|
|
283
291
|
case 'popd':
|
|
284
292
|
case 'prezip-bin':
|
|
@@ -295,6 +303,7 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
295
303
|
case 'rm':
|
|
296
304
|
case 'route':
|
|
297
305
|
case 'rpm':
|
|
306
|
+
case 'rsvg-convert':
|
|
298
307
|
case 'rsync':
|
|
299
308
|
case 'sed':
|
|
300
309
|
case 'set':
|
|
@@ -346,7 +355,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
346
355
|
case 'which':
|
|
347
356
|
case 'wp':
|
|
348
357
|
case 'xargs':
|
|
358
|
+
case 'Xdialog':
|
|
349
359
|
case 'xprop':
|
|
360
|
+
case 'xunit-viewer':
|
|
350
361
|
case 'xz':
|
|
351
362
|
case 'yarn':
|
|
352
363
|
case 'yum':
|
|
@@ -355,7 +366,7 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
355
366
|
case 'zoo':
|
|
356
367
|
case 'zsh':
|
|
357
368
|
case 'zstd':
|
|
358
|
-
case '
|
|
369
|
+
case 'print':
|
|
359
370
|
token = TokenType.Function
|
|
360
371
|
state = State.AfterFunctionName
|
|
361
372
|
break
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.6",
|
|
4
4
|
"description": "Utility package for @lvce-editor/server",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/code-frame": "^7.22.10",
|
|
20
|
-
"@lvce-editor/extension-host": "0.17.
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.17.
|
|
22
|
-
"@lvce-editor/pretty-error": "^1.
|
|
23
|
-
"@lvce-editor/pty-host": "0.17.
|
|
20
|
+
"@lvce-editor/extension-host": "0.17.6",
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.17.6",
|
|
22
|
+
"@lvce-editor/pretty-error": "^1.1.0",
|
|
23
|
+
"@lvce-editor/pty-host": "0.17.6",
|
|
24
24
|
"debug": "^4.3.4",
|
|
25
|
-
"execa": "^
|
|
25
|
+
"execa": "^8.0.0",
|
|
26
26
|
"exit-hook": "^3.2.0",
|
|
27
27
|
"got": "^13.0.0",
|
|
28
28
|
"is-object": "^1.0.2",
|
|
@@ -3,7 +3,7 @@ import * as ProcessDisplayName from '../ProcessDisplayName/ProcessDisplayName.js
|
|
|
3
3
|
|
|
4
4
|
export class CommandNotFoundError extends Error {
|
|
5
5
|
constructor(id) {
|
|
6
|
-
super(`
|
|
6
|
+
super(`Command ${id} not found in ${ProcessDisplayName.processDisplayName}`)
|
|
7
7
|
this.name = 'CommandNotFoundError'
|
|
8
8
|
this.code = ErrorCodes.E_COMMAND_NOT_FOUND
|
|
9
9
|
}
|
package/src/parts/Crash/Crash.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Timeout from '../Timeout/Timeout.js'
|
|
2
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js'
|
|
2
3
|
|
|
3
4
|
const handleTimeout = () => {
|
|
4
5
|
throw new Error('oops')
|
|
@@ -7,3 +8,7 @@ const handleTimeout = () => {
|
|
|
7
8
|
export const crashSharedProcess = () => {
|
|
8
9
|
Timeout.setTimeout(handleTimeout, 0)
|
|
9
10
|
}
|
|
11
|
+
|
|
12
|
+
export const crashMainProcess = () => {
|
|
13
|
+
return ParentIpc.invoke('Crash.crashMainProcess')
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js'
|
|
2
|
+
|
|
3
|
+
export const createBrowserView = (restoreId, fallthroughKeyBindings) => {
|
|
4
|
+
return ParentIpc.invoke('ElectronBrowserView.createBrowserView', restoreId, fallthroughKeyBindings)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const disposeBrowserView = (id) => {
|
|
8
|
+
return ParentIpc.invoke('ElectronBrowserView.disposeBrowserView', id)
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js'
|
|
2
|
+
|
|
3
|
+
export const startRecording = (options) => {
|
|
4
|
+
return ParentIpc.invoke('ElectronContentTracing.startRecording', options)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const stopRecording = () => {
|
|
8
|
+
return ParentIpc.invoke('ElectronContentTracing.stopRecording')
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js'
|
|
2
|
+
|
|
3
|
+
export const showOpenDialog = (title, properties) => {
|
|
4
|
+
return ParentIpc.invoke('ELectronDialog.showOpenDialog', title, properties)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const showMessageBox = (options) => {
|
|
8
|
+
return ParentIpc.invoke('ElectronDialog.showMessageBox', options)
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} path
|
|
5
|
+
*/
|
|
6
|
+
export const startLogging = (path) => {
|
|
7
|
+
return ParentIpc.invoke('ElectronNetLog.startLogging', path)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const stopLogging = () => {
|
|
11
|
+
return ParentIpc.invoke('ElectronNetLog.stopLogging')
|
|
12
|
+
}
|
package/src/parts/Exec/Exec.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Assert from '../Assert/Assert.js'
|
|
1
2
|
import { execa } from 'execa'
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -8,6 +9,9 @@ import { execa } from 'execa'
|
|
|
8
9
|
* @returns
|
|
9
10
|
*/
|
|
10
11
|
export const exec = async (command, args, options) => {
|
|
12
|
+
Assert.string(command)
|
|
13
|
+
Assert.array(args)
|
|
14
|
+
Assert.object(options)
|
|
11
15
|
const { stdout, stderr } = await execa(command, args, options)
|
|
12
16
|
return {
|
|
13
17
|
stdout,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises'
|
|
2
2
|
import { join } from 'node:path'
|
|
3
3
|
import * as Assert from '../Assert/Assert.js'
|
|
4
|
-
import * as Character from '../Character/Character.js'
|
|
5
4
|
import * as EncodingType from '../EncodingType/EncodingType.js'
|
|
6
5
|
import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js'
|
|
7
6
|
import * as IsEsrchError from '../IsEsrchError/IsEsrchError.js'
|
|
7
|
+
import * as ParseMemory from '../ParseMemory/ParseMemory.js'
|
|
8
8
|
import { VError } from '../VError/VError.js'
|
|
9
9
|
|
|
10
10
|
const getContent = async (pid) => {
|
|
@@ -20,16 +20,6 @@ const getContent = async (pid) => {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const parseMemory = (content) => {
|
|
24
|
-
const trimmedContent = content.trim()
|
|
25
|
-
const numberBlocks = trimmedContent.split(Character.Space)
|
|
26
|
-
const pageSize = 4096
|
|
27
|
-
const rss = Number.parseInt(numberBlocks[1]) * pageSize
|
|
28
|
-
const shared = Number.parseInt(numberBlocks[2]) * pageSize
|
|
29
|
-
const memory = rss - shared
|
|
30
|
-
return memory
|
|
31
|
-
}
|
|
32
|
-
|
|
33
23
|
export const getAccurateMemoryUsage = async (pid) => {
|
|
34
24
|
try {
|
|
35
25
|
Assert.number(pid)
|
|
@@ -37,7 +27,7 @@ export const getAccurateMemoryUsage = async (pid) => {
|
|
|
37
27
|
if (!content) {
|
|
38
28
|
return -1
|
|
39
29
|
}
|
|
40
|
-
const memory = parseMemory(content)
|
|
30
|
+
const memory = ParseMemory.parseMemory(content)
|
|
41
31
|
return memory
|
|
42
32
|
} catch (error) {
|
|
43
33
|
throw new VError(error, 'Failed to get accurate memory usage')
|
|
@@ -16,18 +16,38 @@ export const load = (moduleId) => {
|
|
|
16
16
|
return import('../ChromeExtension/ChromeExtension.ipc.js')
|
|
17
17
|
case ModuleId.ClipBoard:
|
|
18
18
|
return import('../ClipBoard/ClipBoard.ipc.js')
|
|
19
|
+
case ModuleId.Crash:
|
|
20
|
+
return import('../Crash/Crash.ipc.js')
|
|
21
|
+
case ModuleId.DesktopCapturer:
|
|
22
|
+
return import('../DesktopCapturer/DesktopCapturer.ipc.js')
|
|
19
23
|
case ModuleId.Developer:
|
|
20
24
|
return import('../Developer/Developer.ipc.js')
|
|
21
25
|
case ModuleId.Download:
|
|
22
26
|
return import('../Download/Download.ipc.js')
|
|
27
|
+
case ModuleId.ElectronApplicationMenu:
|
|
28
|
+
return import('../ElectronApplicationMenu/ElectronApplicationMenu.ipc.js')
|
|
29
|
+
case ModuleId.ElectronBrowserView:
|
|
30
|
+
return import('../ElectronBrowserView/ElectronBrowserView.ipc.js')
|
|
31
|
+
case ModuleId.ElectronContentTracing:
|
|
32
|
+
return import('../ElectronContentTracing/ElectronContentTracing.js')
|
|
23
33
|
case ModuleId.ElectronContextMenu:
|
|
24
34
|
return import('../ElectronContextMenu/ElectronContextMenu.ipc.js')
|
|
35
|
+
case ModuleId.ElectronDialog:
|
|
36
|
+
return import('../ElectronDialog/ElectronDialog.ipc.js')
|
|
25
37
|
case ModuleId.ElectronInitialize:
|
|
26
38
|
return import('../ElectronInitialize/ElectronInitialize.ipc.js')
|
|
39
|
+
case ModuleId.ElectronNetLog:
|
|
40
|
+
return import('../ElectronNetLog/ElectronNetLog.ipc.js')
|
|
27
41
|
case ModuleId.ElectronProcess:
|
|
28
42
|
return import('../ElectronProcess/ElectronProcess.ipc.js')
|
|
29
43
|
case ModuleId.ElectronSafeStorage:
|
|
30
44
|
return import('../ElectronSafeStorage/ElectronSafeStorage.ipc.js')
|
|
45
|
+
case ModuleId.Window:
|
|
46
|
+
return import('../ElectronWindow/ElectronWindow.ipc.js')
|
|
47
|
+
case ModuleId.ElectronWindowAbout:
|
|
48
|
+
return import('../ElectronWindowAbout/ElectronWindowAbout.ipc.js')
|
|
49
|
+
case ModuleId.Exit:
|
|
50
|
+
return import('../Exit/Exit.ipc.js')
|
|
31
51
|
case ModuleId.ExtensionHost:
|
|
32
52
|
return import('../ExtensionHost/ExtensionHost.ipc.js')
|
|
33
53
|
case ModuleId.ExtensionManagement:
|
|
@@ -54,6 +74,8 @@ export const load = (moduleId) => {
|
|
|
54
74
|
return import('../IsAutoUpdateSupported/IsAutoUpdateSupported.ipc.js')
|
|
55
75
|
case ModuleId.ListProcessesWithMemoryUsage:
|
|
56
76
|
return import('../ListProcessesWithMemoryUsage/ListProcessesWithMemoryUsage.ipc.js')
|
|
77
|
+
case ModuleId.OpenExternal:
|
|
78
|
+
return import('../OpenExternal/OpenExternal.ipc.js')
|
|
57
79
|
case ModuleId.OpenNativeFolder:
|
|
58
80
|
return import('../OpenNativeFolder/OpenNativeFolder.ipc.js')
|
|
59
81
|
case ModuleId.OutputChannel:
|
|
@@ -66,6 +88,8 @@ export const load = (moduleId) => {
|
|
|
66
88
|
return import('../Preferences/Preferences.ipc.js')
|
|
67
89
|
case ModuleId.Process:
|
|
68
90
|
return import('../Process/Process.ipc.js')
|
|
91
|
+
case ModuleId.ProcessId:
|
|
92
|
+
return import('../ProcessId/ProcessId.ipc.js')
|
|
69
93
|
case ModuleId.RebuildNodePty:
|
|
70
94
|
return import('../RebuildNodePty/RebuildNodePty.ipc.js')
|
|
71
95
|
case ModuleId.RecentlyOpened:
|
|
@@ -80,10 +104,10 @@ export const load = (moduleId) => {
|
|
|
80
104
|
return import('../TextSearch/TextSearch.ipc.js')
|
|
81
105
|
case ModuleId.WebSocketServer:
|
|
82
106
|
return import('../WebSocketServer/WebSocketServer.ipc.js')
|
|
83
|
-
case ModuleId.Window:
|
|
84
|
-
return import('../Window/ElectronWindow.ipc.js')
|
|
85
107
|
case ModuleId.Workspace:
|
|
86
108
|
return import('../Workspace/Workspace.ipc.js')
|
|
109
|
+
case ModuleId.Os:
|
|
110
|
+
return import('../Os/Os.ipc.js')
|
|
87
111
|
default:
|
|
88
112
|
throw new Error(`module ${moduleId} not found`)
|
|
89
113
|
}
|
|
@@ -1,42 +1,55 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
12
|
-
export const
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
16
|
-
export const
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
26
|
-
export const
|
|
27
|
-
export const
|
|
28
|
-
export const
|
|
29
|
-
export const
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
33
|
-
export const
|
|
34
|
-
export const
|
|
35
|
-
export const
|
|
36
|
-
export const
|
|
37
|
-
export const
|
|
38
|
-
export const
|
|
39
|
-
export const
|
|
40
|
-
export const
|
|
41
|
-
export const
|
|
42
|
-
export const
|
|
1
|
+
export const Crash = 1
|
|
2
|
+
export const ClipBoard = 2
|
|
3
|
+
export const Developer = 3
|
|
4
|
+
export const ElectronWindowAbout = 4
|
|
5
|
+
export const ExtensionHost = 5
|
|
6
|
+
export const ExtensionManagement = 6
|
|
7
|
+
export const FileSystem = 7
|
|
8
|
+
export const ElectronApplicationMenu = 8
|
|
9
|
+
export const OpenNativeFolder = 9
|
|
10
|
+
export const ElectronDialog = 10
|
|
11
|
+
export const OutputChannel = 11
|
|
12
|
+
export const Platform = 12
|
|
13
|
+
export const ElectronClipBoard = 13
|
|
14
|
+
export const Preferences = 14
|
|
15
|
+
export const RecentlyOpened = 15
|
|
16
|
+
export const Search = 16
|
|
17
|
+
export const SearchFile = 17
|
|
18
|
+
export const Terminal = 18
|
|
19
|
+
export const ProcessId = 19
|
|
20
|
+
export const TextDocument = 20
|
|
21
|
+
export const WebSocketServer = 21
|
|
22
|
+
export const Workspace = 22
|
|
23
|
+
export const ChromeExtension = 23
|
|
24
|
+
export const Download = 24
|
|
25
|
+
export const GitLsFiles = 25
|
|
26
|
+
export const BulkReplacement = 26
|
|
27
|
+
export const InstallExtension = 27
|
|
28
|
+
export const AutoUpdater = 28
|
|
29
|
+
export const IsAutoUpdateSupported = 29
|
|
30
|
+
export const AutoUpdaterAppImage = 30
|
|
31
|
+
export const AutoUpdaterWindowsNsis = 31
|
|
32
|
+
export const RebuildNodePty = 32
|
|
33
|
+
export const ElectronNetLog = 33
|
|
34
|
+
export const OpenExternal = 34
|
|
35
|
+
export const ElectronSafeStorage = 35
|
|
36
|
+
export const ElectronInitialize = 36
|
|
37
|
+
export const HandleWebSocket = 37
|
|
38
|
+
export const Process = 38
|
|
39
|
+
export const AttachDebugger = 39
|
|
40
|
+
export const HandleElectronMessagePort = 40
|
|
41
|
+
export const ElectronProcess = 41
|
|
42
|
+
export const HandleNodeMessagePort = 42
|
|
43
|
+
export const GetTerminalSpawnOptions = 43
|
|
44
|
+
export const HandleCliArgs = 44
|
|
45
|
+
export const ListProcessesWithMemoryUsage = 45
|
|
46
|
+
export const ElectronContextMenu = 46
|
|
47
|
+
export const IncrementalTextSearch = 47
|
|
48
|
+
export const Performance = 48
|
|
49
|
+
export const ElectronBrowserView = 49
|
|
50
|
+
export const Window = 50
|
|
51
|
+
export const PassThroughElectronMessagePort = 51
|
|
52
|
+
export const Exit = 52
|
|
53
|
+
export const DesktopCapturer = 53
|
|
54
|
+
export const ElectronContentTracing = 54
|
|
55
|
+
export const Os = 55
|
|
@@ -3,8 +3,6 @@ import * as ModuleId from '../ModuleId/ModuleId.js'
|
|
|
3
3
|
|
|
4
4
|
export const getModuleId = (commandId) => {
|
|
5
5
|
switch (commandId) {
|
|
6
|
-
case 'PassthroughElectronMessagePort.passThroughElectronMessagePort':
|
|
7
|
-
return ModuleId.PassThroughElectronMessagePort
|
|
8
6
|
case 'AttachDebugger.attachDebugger':
|
|
9
7
|
return ModuleId.AttachDebugger
|
|
10
8
|
case 'AutoUpdater.getAutoUpdateType':
|
|
@@ -24,10 +22,11 @@ export const getModuleId = (commandId) => {
|
|
|
24
22
|
case 'ClipBoard.readFiles':
|
|
25
23
|
case 'ClipBoard.writeFiles':
|
|
26
24
|
return ModuleId.ClipBoard
|
|
27
|
-
case '
|
|
28
|
-
case '
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
case 'Crash.crashMainProcess':
|
|
26
|
+
case 'Crash.crashSharedProcess':
|
|
27
|
+
return ModuleId.Crash
|
|
28
|
+
case 'DesktopCapturer.getSources':
|
|
29
|
+
return ModuleId.DesktopCapturer
|
|
31
30
|
case 'Developer.allocateMemory':
|
|
32
31
|
case 'Developer.crashSharedProcess':
|
|
33
32
|
case 'Developer.createHeapSnapshot':
|
|
@@ -35,12 +34,39 @@ export const getModuleId = (commandId) => {
|
|
|
35
34
|
case 'Developer.sharedProcessMemoryUsage':
|
|
36
35
|
case 'Developer.sharedProcessStartupPerformance':
|
|
37
36
|
return ModuleId.Developer
|
|
38
|
-
case 'Performance.getNodeStartupTiming':
|
|
39
|
-
return ModuleId.Performance
|
|
40
37
|
case 'Download.download':
|
|
41
38
|
return ModuleId.Download
|
|
39
|
+
case 'ElectronApplicationMenu.setItems':
|
|
40
|
+
return ModuleId.ElectronApplicationMenu
|
|
41
|
+
case 'ElectronBrowserView.createBrowserView':
|
|
42
|
+
case 'ElectronBrowserView.disposeBrowserView':
|
|
43
|
+
return ModuleId.ElectronBrowserView
|
|
44
|
+
case 'ElectronClipBoard.writeText':
|
|
45
|
+
return ModuleId.ElectronClipBoard
|
|
46
|
+
case 'ElectronContentTracing.startRecording':
|
|
47
|
+
case 'ElectronContentTracing.stopRecording':
|
|
48
|
+
return ModuleId.ElectronContentTracing
|
|
49
|
+
case 'ElectronContextMenu.openContextMenu':
|
|
50
|
+
return ModuleId.ElectronContextMenu
|
|
51
|
+
case 'ElectronDialog.showMessageBox':
|
|
52
|
+
case 'ElectronDialog.showOpenDialog':
|
|
53
|
+
return ModuleId.ElectronDialog
|
|
42
54
|
case 'ElectronInitialize.electronInitialize':
|
|
43
55
|
return ModuleId.ElectronInitialize
|
|
56
|
+
case 'ElectronNetLog.startLogging':
|
|
57
|
+
case 'ElectronNetLog.stopLogging':
|
|
58
|
+
return ModuleId.ElectronNetLog
|
|
59
|
+
case 'ElectronProcess.getChromeVersion':
|
|
60
|
+
case 'ElectronProcess.getElectronVersion':
|
|
61
|
+
return ModuleId.ElectronProcess
|
|
62
|
+
case 'ElectronSafeStorage.decryptString':
|
|
63
|
+
case 'ElectronSafeStorage.encryptString':
|
|
64
|
+
case 'ElectronSafeStorage.isEncryptionAvailable':
|
|
65
|
+
return ModuleId.ElectronSafeStorage
|
|
66
|
+
case 'ElectronWindowAbout.open':
|
|
67
|
+
return ModuleId.ElectronWindowAbout
|
|
68
|
+
case 'Exit.exit':
|
|
69
|
+
return ModuleId.Exit
|
|
44
70
|
case 'ExtensionHost.dispose':
|
|
45
71
|
case 'ExtensionHost.enableExtension':
|
|
46
72
|
case 'ExtensionHost.executeCommand':
|
|
@@ -136,12 +162,19 @@ export const getModuleId = (commandId) => {
|
|
|
136
162
|
return ModuleId.IsAutoUpdateSupported
|
|
137
163
|
case 'ListProcessesWithMemoryUsage.listProcessesWithMemoryUsage':
|
|
138
164
|
return ModuleId.ListProcessesWithMemoryUsage
|
|
165
|
+
case 'OpenExternal.openExternal':
|
|
166
|
+
case 'OpenExternal.showItemInFolder':
|
|
167
|
+
return ModuleId.OpenExternal
|
|
139
168
|
case 'Native.openFolder':
|
|
140
169
|
case 'OpenNativeFolder.openFolder':
|
|
141
170
|
return ModuleId.OpenNativeFolder
|
|
142
171
|
case 'OutputChannel.close':
|
|
143
172
|
case 'OutputChannel.open':
|
|
144
173
|
return ModuleId.OutputChannel
|
|
174
|
+
case 'PassthroughElectronMessagePort.passThroughElectronMessagePort':
|
|
175
|
+
return ModuleId.PassThroughElectronMessagePort
|
|
176
|
+
case 'Performance.getNodeStartupTiming':
|
|
177
|
+
return ModuleId.Performance
|
|
145
178
|
case 'Platform.getAppDir':
|
|
146
179
|
case 'Platform.getBuiltinExtensionsPath':
|
|
147
180
|
case 'Platform.getCachedExtensionsPath':
|
|
@@ -156,13 +189,14 @@ export const getModuleId = (commandId) => {
|
|
|
156
189
|
case 'Platform.getHomeDir':
|
|
157
190
|
case 'Platform.getLogsDir':
|
|
158
191
|
case 'Platform.getMarketplaceUrl':
|
|
192
|
+
case 'Platform.getProductNameLong':
|
|
159
193
|
case 'Platform.getRecentlyOpenedPath':
|
|
160
194
|
case 'Platform.getTestPath':
|
|
161
|
-
case 'Platform.getUserSettingsPath':
|
|
162
195
|
case 'Platform.getUserKeyBindingsPath':
|
|
196
|
+
case 'Platform.getUserSettingsPath':
|
|
163
197
|
case 'Platform.getVersion':
|
|
164
198
|
case 'Platform.setEnvironmentVariables':
|
|
165
|
-
case 'Platform.
|
|
199
|
+
case 'Platform.getApplicationName':
|
|
166
200
|
return ModuleId.Platform
|
|
167
201
|
case 'Preferences.getAll':
|
|
168
202
|
return ModuleId.Preferences
|
|
@@ -170,7 +204,11 @@ export const getModuleId = (commandId) => {
|
|
|
170
204
|
case 'Process.getPid':
|
|
171
205
|
case 'Process.getV8Version':
|
|
172
206
|
case 'Process.kill':
|
|
207
|
+
case 'Process.getArch':
|
|
173
208
|
return ModuleId.Process
|
|
209
|
+
case 'ProcessId.getMainProcessId':
|
|
210
|
+
case 'ProcessId.getSharedProcessId':
|
|
211
|
+
return ModuleId.ProcessId
|
|
174
212
|
case 'RebuildNodePty.rebuildNodePty':
|
|
175
213
|
return ModuleId.RebuildNodePty
|
|
176
214
|
case 'RecentlyOpened.addPath':
|
|
@@ -184,25 +222,22 @@ export const getModuleId = (commandId) => {
|
|
|
184
222
|
case 'Terminal.resize':
|
|
185
223
|
case 'Terminal.write':
|
|
186
224
|
return ModuleId.Terminal
|
|
187
|
-
case 'ElectronProcess.getChromeVersion':
|
|
188
|
-
case 'ElectronProcess.getElectronVersion':
|
|
189
|
-
return ModuleId.ElectronProcess
|
|
190
225
|
case 4820:
|
|
191
226
|
return ModuleId.TextDocument
|
|
192
|
-
case 'ElectronContextMenu.openContextMenu':
|
|
193
|
-
return ModuleId.ElectronContextMenu
|
|
194
227
|
case 'WebSocketServer.handleUpgrade':
|
|
195
228
|
return ModuleId.WebSocketServer
|
|
196
|
-
case '
|
|
197
|
-
case 'Workspace.resolveRoot':
|
|
198
|
-
return ModuleId.Workspace
|
|
199
|
-
case 'ElectronWindow.minimize':
|
|
229
|
+
case 'ElectronWindow.close':
|
|
200
230
|
case 'ElectronWindow.maximize':
|
|
231
|
+
case 'ElectronWindow.minimize':
|
|
232
|
+
case 'ElectronWindow.reload':
|
|
201
233
|
case 'ElectronWindow.toggleDevtools':
|
|
202
234
|
case 'ElectronWindow.unmaximize':
|
|
203
|
-
case 'ElectronWindow.close':
|
|
204
|
-
case 'ElectronWindow.reload':
|
|
205
235
|
return ModuleId.Window
|
|
236
|
+
case 'Workspace.getHomeDir':
|
|
237
|
+
case 'Workspace.resolveRoot':
|
|
238
|
+
return ModuleId.Workspace
|
|
239
|
+
case 'Os.getTmpDir':
|
|
240
|
+
return ModuleId.Os
|
|
206
241
|
default:
|
|
207
242
|
throw new CommandNotFoundError(commandId)
|
|
208
243
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js'
|
|
2
|
+
|
|
3
|
+
export const showItemInFolder = (fullPath) => {
|
|
4
|
+
return ParentIpc.invoke('ElectronShell.showItemInFolder', fullPath)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const openExternal = (url) => {
|
|
8
|
+
return ParentIpc.invoke('ElectronShell.openExternal', url)
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as Character from '../Character/Character.js'
|
|
2
|
+
|
|
3
|
+
export const parseMemory = (content) => {
|
|
4
|
+
const trimmedContent = content.trim()
|
|
5
|
+
const numberBlocks = trimmedContent.split(Character.Space)
|
|
6
|
+
const pageSize = 4096
|
|
7
|
+
const rss = Number.parseInt(numberBlocks[1]) * pageSize
|
|
8
|
+
const shared = Number.parseInt(numberBlocks[2]) * pageSize
|
|
9
|
+
const memory = rss - shared
|
|
10
|
+
return memory
|
|
11
|
+
}
|
package/src/parts/Path/Path.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import * as NodePath from 'node:path'
|
|
2
2
|
|
|
3
|
-
export const getHomeDir = () => {}
|
|
4
|
-
|
|
5
|
-
export const getTmpDir = () => {}
|
|
6
|
-
|
|
7
|
-
export const getBuiltinExtensionDir = () => {}
|
|
8
|
-
|
|
9
|
-
export const getMarketplaceExtensionDir = () => {}
|
|
10
|
-
|
|
11
3
|
export const join = (...parts) => {
|
|
12
4
|
return NodePath.join(...parts)
|
|
13
5
|
}
|
|
@@ -7,6 +7,7 @@ export const Commands = {
|
|
|
7
7
|
getBuiltinExtensionsPath: Platform.getBuiltinExtensionsPath,
|
|
8
8
|
getCachedExtensionsPath: Platform.getCachedExtensionsPath,
|
|
9
9
|
getCacheDir: Platform.getCacheDir,
|
|
10
|
+
getApplicationName: Platform.getApplicationName,
|
|
10
11
|
getCommit: Platform.getCommit,
|
|
11
12
|
getConfigDir: Platform.getConfigDir,
|
|
12
13
|
getDataDir: Platform.getDataDir,
|
|
@@ -18,6 +19,7 @@ export const Commands = {
|
|
|
18
19
|
getLogsDir: Platform.getLogsDir,
|
|
19
20
|
getMarketplaceUrl: Platform.getMarketplaceUrl,
|
|
20
21
|
getNodePath: Platform.getNodePath,
|
|
22
|
+
getProductNameLong: Platform.getProductNameLong,
|
|
21
23
|
getRecentlyOpenedPath: Platform.getRecentlyOpenedPath,
|
|
22
24
|
getTestPath: Platform.getTestPath,
|
|
23
25
|
getTmpDir: Platform.getTmpDir,
|
|
@@ -25,5 +27,4 @@ export const Commands = {
|
|
|
25
27
|
getUserSettingsPath: Platform.getUserSettingsPath,
|
|
26
28
|
getVersion: Platform.getVersion,
|
|
27
29
|
setEnvironmentVariables: Platform.setEnvironmentVariables,
|
|
28
|
-
getProductNameLong: Platform.getProductNameLong,
|
|
29
30
|
}
|
|
@@ -24,6 +24,8 @@ export const homeDir = isWindows ? '' : homedir()
|
|
|
24
24
|
|
|
25
25
|
export const appDir = Root.root
|
|
26
26
|
|
|
27
|
+
export const isDeb = false
|
|
28
|
+
|
|
27
29
|
export const isAppImage = () => {
|
|
28
30
|
return Boolean(env.APPIMAGE)
|
|
29
31
|
}
|
|
@@ -161,6 +163,10 @@ export const getRepository = () => {
|
|
|
161
163
|
return `lvce-editor/lvce-editor`
|
|
162
164
|
}
|
|
163
165
|
|
|
166
|
+
export const getApplicationName = () => {
|
|
167
|
+
return applicationName
|
|
168
|
+
}
|
|
169
|
+
|
|
164
170
|
export const getAppImageName = () => {
|
|
165
171
|
return 'Lvce'
|
|
166
172
|
}
|
|
@@ -169,11 +175,11 @@ export const getSetupName = () => {
|
|
|
169
175
|
return 'Lvce-Setup'
|
|
170
176
|
}
|
|
171
177
|
|
|
172
|
-
export const version = '0.17.
|
|
178
|
+
export const version = '0.17.6'
|
|
173
179
|
|
|
174
|
-
export const commit = '
|
|
180
|
+
export const commit = '6e9c30c'
|
|
175
181
|
|
|
176
|
-
export const date = '2023-08-
|
|
182
|
+
export const date = '2023-08-19T15:41:33.000Z'
|
|
177
183
|
|
|
178
184
|
export const getVersion = () => {
|
|
179
185
|
return version
|
|
@@ -1,29 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { LinesAndColumns } from 'lines-and-columns'
|
|
3
|
-
import * as Json from '../Json/Json.js'
|
|
4
|
-
export { prepare } from '@lvce-editor/pretty-error'
|
|
5
|
-
|
|
6
|
-
const fixBackslashes = (string) => {
|
|
7
|
-
return string.replaceAll('\\\\', '\\')
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const prepareJsonError = (json, property, message) => {
|
|
11
|
-
const string = fixBackslashes(Json.stringify(json))
|
|
12
|
-
const stringifiedPropertyName = `"${property}"`
|
|
13
|
-
const index = string.indexOf(stringifiedPropertyName) // TODO this could be wrong in some cases, find a better way
|
|
14
|
-
console.log({ string, index })
|
|
15
|
-
const jsonError = {
|
|
16
|
-
stack: '',
|
|
17
|
-
}
|
|
18
|
-
if (index !== -1) {
|
|
19
|
-
const lines = new LinesAndColumns(string)
|
|
20
|
-
const location = lines.locationForIndex(index + stringifiedPropertyName.length + 1)
|
|
21
|
-
const codeFrame = codeFrameColumns(string, {
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
start: { line: location.line + 1, column: location.column + 1 },
|
|
24
|
-
})
|
|
25
|
-
jsonError.codeFrame = codeFrame
|
|
26
|
-
}
|
|
27
|
-
// jsonError.stack = `${bottomMessage}\n at ${filePath}`
|
|
28
|
-
return jsonError
|
|
29
|
-
}
|
|
1
|
+
export { prepare, prepareJsonError } from '@lvce-editor/pretty-error'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as ProcessExitEventType from '../ProcessExitEventType/ProcessExitEventType.js'
|
|
2
1
|
import * as GetFirstEvent from '../GetFirstEvent/GetFirstEvent.js'
|
|
2
|
+
import * as ProcessExitEventType from '../ProcessExitEventType/ProcessExitEventType.js'
|
|
3
3
|
|
|
4
|
-
export const waitForProcessToExit =
|
|
4
|
+
export const waitForProcessToExit = (childProcess) => {
|
|
5
5
|
return GetFirstEvent.getFirstEvent(childProcess, {
|
|
6
6
|
error: ProcessExitEventType.Error,
|
|
7
7
|
close: ProcessExitEventType.Exit,
|
package/src/sharedProcessMain.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setPriority } from 'node:os'
|
|
1
2
|
import * as Command from './parts/Command/Command.js'
|
|
2
3
|
import * as Module from './parts/Module/Module.js'
|
|
3
4
|
import * as ParentIpc from './parts/ParentIpc/ParentIpc.js'
|
|
@@ -10,6 +11,7 @@ const main = async () => {
|
|
|
10
11
|
process.on(Signal.SIGTERM, ProcessListeners.handleSigTerm)
|
|
11
12
|
process.on('uncaughtExceptionMonitor', ProcessListeners.handleUncaughtExceptionMonitor)
|
|
12
13
|
await ParentIpc.listen()
|
|
14
|
+
setPriority(process.pid, 19)
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
main()
|
|
File without changes
|
|
File without changes
|