@lvce-editor/shared-process 0.15.25 → 0.15.27
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/builtinCommands.json +4 -0
- package/extensions/builtin.language-basics-css/src/tokenizeCss.js +3 -0
- package/extensions/builtin.language-basics-typescript/src/tokenizeTypeScript.js +47 -0
- package/package.json +4 -4
- package/src/parts/DirentType/DirentType.js +7 -6
- package/src/parts/GetDirentType/GetDirentType.js +3 -1
- package/src/parts/ProcessListeners/ProcessListeners.js +17 -0
- package/src/sharedProcessMain.js +4 -24
|
@@ -220,6 +220,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
220
220
|
} else if ((next = part.match(RE_CURLY_OPEN))) {
|
|
221
221
|
token = TokenType.CurlyOpen
|
|
222
222
|
state = State.InsideSelector
|
|
223
|
+
} else if ((next = part.match(RE_SELECTOR_CLASS))) {
|
|
224
|
+
token = TokenType.CssSelectorClass
|
|
225
|
+
state = State.AfterSelector
|
|
223
226
|
} else if ((next = part.match(RE_SELECTOR))) {
|
|
224
227
|
token = TokenType.CssSelector
|
|
225
228
|
state = State.AfterSelector
|
|
@@ -37,6 +37,7 @@ const State = {
|
|
|
37
37
|
InsideBacktickString: 34,
|
|
38
38
|
AfterInterfaceName: 35,
|
|
39
39
|
AfterKeywordImport: 36,
|
|
40
|
+
AfterKeywordFunction: 37,
|
|
40
41
|
// AfterKeywordImport: 27,
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -246,6 +247,7 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
246
247
|
break
|
|
247
248
|
case 'let':
|
|
248
249
|
case 'const':
|
|
250
|
+
case 'var':
|
|
249
251
|
token = TokenType.Keyword
|
|
250
252
|
state = State.AfterKeywordDeclaration
|
|
251
253
|
break
|
|
@@ -281,6 +283,10 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
281
283
|
token = TokenType.KeywordOperator
|
|
282
284
|
state = State.TopLevelContent
|
|
283
285
|
break
|
|
286
|
+
case 'function':
|
|
287
|
+
token = TokenType.Keyword
|
|
288
|
+
state = State.AfterKeywordFunction
|
|
289
|
+
break
|
|
284
290
|
default:
|
|
285
291
|
token = TokenType.Keyword
|
|
286
292
|
state = State.TopLevelContent
|
|
@@ -398,6 +404,15 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
398
404
|
} else if ((next = part.match(RE_SEMICOLON))) {
|
|
399
405
|
token = TokenType.Punctuation
|
|
400
406
|
state = State.TopLevelContent
|
|
407
|
+
} else if ((next = part.match(RE_COMMA))) {
|
|
408
|
+
token = TokenType.Punctuation
|
|
409
|
+
state = State.AfterKeywordDeclaration
|
|
410
|
+
} else if ((next = part.match(RE_PUNCTUATION))) {
|
|
411
|
+
token = TokenType.Punctuation
|
|
412
|
+
state = State.AfterKeywordDeclaration
|
|
413
|
+
} else if ((next = part.match(RE_QUOTE_DOUBLE))) {
|
|
414
|
+
token = TokenType.Punctuation
|
|
415
|
+
state = State.InsideDoubleQuoteString
|
|
401
416
|
} else {
|
|
402
417
|
line
|
|
403
418
|
part
|
|
@@ -745,6 +760,9 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
745
760
|
} else if ((next = part.match(RE_VARIABLE_NAME))) {
|
|
746
761
|
token = TokenType.VariableName
|
|
747
762
|
state = State.InsideObjectDestructuringAfterValue
|
|
763
|
+
} else if ((next = part.match(RE_QUOTE_DOUBLE))) {
|
|
764
|
+
token = TokenType.Punctuation
|
|
765
|
+
state = State.InsideDoubleQuoteString
|
|
748
766
|
} else {
|
|
749
767
|
throw new Error('no')
|
|
750
768
|
}
|
|
@@ -756,6 +774,21 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
756
774
|
} else if ((next = part.match(RE_CURLY_CLOSE))) {
|
|
757
775
|
token = TokenType.Punctuation
|
|
758
776
|
state = State.AfterKeywordDeclaration
|
|
777
|
+
} else if ((next = part.match(RE_COLON))) {
|
|
778
|
+
token = TokenType.Punctuation
|
|
779
|
+
state = State.InsideObjectDestructuringAfterValue
|
|
780
|
+
} else if ((next = part.match(RE_VARIABLE_NAME))) {
|
|
781
|
+
token = TokenType.VariableName
|
|
782
|
+
state = State.InsideObjectDestructuringAfterValue
|
|
783
|
+
} else if ((next = part.match(RE_PUNCTUATION))) {
|
|
784
|
+
token = TokenType.Punctuation
|
|
785
|
+
state = State.TopLevelContent
|
|
786
|
+
} else if ((next = part.match(RE_QUOTE_DOUBLE))) {
|
|
787
|
+
token = TokenType.Punctuation
|
|
788
|
+
state = State.InsideDoubleQuoteString
|
|
789
|
+
} else if ((next = part.match(RE_QUOTE_SINGLE))) {
|
|
790
|
+
token = TokenType.Punctuation
|
|
791
|
+
state = State.InsideSingleQuoteString
|
|
759
792
|
} else {
|
|
760
793
|
throw new Error('no')
|
|
761
794
|
}
|
|
@@ -959,6 +992,20 @@ export const tokenizeLine = (line, lineState) => {
|
|
|
959
992
|
throw new Error('no')
|
|
960
993
|
}
|
|
961
994
|
break
|
|
995
|
+
case State.AfterKeywordFunction:
|
|
996
|
+
if ((next = part.match(RE_WHITESPACE))) {
|
|
997
|
+
token = TokenType.Whitespace
|
|
998
|
+
state = State.AfterKeywordFunction
|
|
999
|
+
} else if ((next = part.match(RE_VARIABLE_NAME))) {
|
|
1000
|
+
token = TokenType.FunctionName
|
|
1001
|
+
state = State.TopLevelContent
|
|
1002
|
+
} else if ((next = part.match(RE_PUNCTUATION))) {
|
|
1003
|
+
token = TokenType.Punctuation
|
|
1004
|
+
state = State.TopLevelContent
|
|
1005
|
+
} else {
|
|
1006
|
+
throw new Error('no')
|
|
1007
|
+
}
|
|
1008
|
+
break
|
|
962
1009
|
default:
|
|
963
1010
|
state
|
|
964
1011
|
throw new Error('no')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.27",
|
|
4
4
|
"description": "Utility package for @lvce-editor/server",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/code-frame": "^7.21.4",
|
|
20
|
-
"@lvce-editor/extension-host": "0.15.
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.15.
|
|
22
|
-
"@lvce-editor/pty-host": "0.15.
|
|
20
|
+
"@lvce-editor/extension-host": "0.15.27",
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.15.27",
|
|
22
|
+
"@lvce-editor/pty-host": "0.15.27",
|
|
23
23
|
"debug": "^4.3.4",
|
|
24
24
|
"execa": "^7.1.1",
|
|
25
25
|
"exit-hook": "^3.2.0",
|
|
@@ -3,9 +3,10 @@ export const CharacterDevice = 2
|
|
|
3
3
|
export const Directory = 3
|
|
4
4
|
export const DirectoryExpanded = 4
|
|
5
5
|
export const DirectoryExpanding = 5
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
6
|
+
export const Fifo = 6
|
|
7
|
+
export const File = 7
|
|
8
|
+
export const Socket = 8
|
|
9
|
+
export const Symlink = 9
|
|
10
|
+
export const SymLinkFile = 10
|
|
11
|
+
export const SymLinkFolder = 11
|
|
12
|
+
export const Unknown = 12
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as ErrorHandling from '../ErrorHandling/ErrorHandling.js'
|
|
2
|
+
import * as ExitCode from '../ExitCode/ExitCode.js'
|
|
3
|
+
import * as Process from '../Process/Process.js'
|
|
4
|
+
|
|
5
|
+
export const handleDisconnect = () => {
|
|
6
|
+
console.info('[shared process] disconnected')
|
|
7
|
+
Process.exit(ExitCode.Success)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const handleSigTerm = () => {
|
|
11
|
+
console.info('[shared-process] sigterm')
|
|
12
|
+
Process.exit(ExitCode.Success)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const handleUncaughtExceptionMonitor = (error) => {
|
|
16
|
+
ErrorHandling.handleUncaughtExceptionMonitor(error)
|
|
17
|
+
}
|
package/src/sharedProcessMain.js
CHANGED
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
import * as Command from './parts/Command/Command.js'
|
|
2
|
-
import * as ErrorHandling from './parts/ErrorHandling/ErrorHandling.js'
|
|
3
|
-
import * as ExitCode from './parts/ExitCode/ExitCode.js'
|
|
4
2
|
import * as Module from './parts/Module/Module.js'
|
|
5
3
|
import * as ParentIpc from './parts/ParentIpc/ParentIpc.js'
|
|
6
|
-
import * as
|
|
4
|
+
import * as ProcessListeners from './parts/ProcessListeners/ProcessListeners.js'
|
|
7
5
|
import * as Signal from './parts/Signal/Signal.js'
|
|
8
|
-
// TODO handle structure: one shared process multiple extension hosts
|
|
9
|
-
|
|
10
|
-
// TODO use named functions here
|
|
11
|
-
|
|
12
|
-
const handleDisconnect = () => {
|
|
13
|
-
console.info('[shared process] disconnected')
|
|
14
|
-
Process.exit(ExitCode.Success)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// const handleBeforeExit = () => {
|
|
18
|
-
// console.info('[shared process] will exit now')
|
|
19
|
-
// }
|
|
20
|
-
|
|
21
|
-
const handleSigTerm = () => {
|
|
22
|
-
console.info('[shared-process] sigterm')
|
|
23
|
-
Process.exit(ExitCode.Success)
|
|
24
|
-
}
|
|
25
6
|
|
|
26
7
|
const main = async () => {
|
|
27
8
|
Command.setLoad(Module.load)
|
|
28
|
-
|
|
29
|
-
process.on(
|
|
30
|
-
process.on(
|
|
31
|
-
process.on('uncaughtExceptionMonitor', ErrorHandling.handleUncaughtExceptionMonitor)
|
|
9
|
+
process.on('disconnect', ProcessListeners.handleDisconnect)
|
|
10
|
+
process.on(Signal.SIGTERM, ProcessListeners.handleSigTerm)
|
|
11
|
+
process.on('uncaughtExceptionMonitor', ProcessListeners.handleUncaughtExceptionMonitor)
|
|
32
12
|
await ParentIpc.listen()
|
|
33
13
|
}
|
|
34
14
|
|