@lvce-editor/shared-process 0.15.18 → 0.15.19

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.
@@ -43,9 +43,10 @@ export const hasArrayReturn = true
43
43
 
44
44
  const RE_KEYWORD =
45
45
  /^(?:abstract|as|assert|async|await|break|case|catch|class|const|continue|covariant|default|deferred|do|dynamic|else|enum|export|extends|extension|external|factory|false|final|finally|for|Function|get|hide|if|implements|import|in|interface|is|late|library|mixin|new|null|on|operator|part|required|rethrow|return|set|show|static|super|switch|sync|this|throw|true|try|typedef|var|void|while|with|yield)\b/
46
+
46
47
  const RE_WHITESPACE = /^\s+/
47
48
  const RE_VARIABLE_NAME = /^[a-zA-Z]+/
48
- const RE_PUNCTUATION = /^[:,;\{\}\[\]\.=\(\)>]/
49
+ const RE_PUNCTUATION = /^[:,;\{\}\[\]\.=\(\)>+<]/
49
50
  const RE_QUOTE_SINGLE = /^'/
50
51
  const RE_QUOTE_DOUBLE = /^"/
51
52
  const RE_STRING_SINGLE_QUOTE_CONTENT = /^[^']+/
@@ -89,6 +89,7 @@ const RE_SCRIPT_CONTENT_END = /^<\/script/
89
89
  const RE_STYLE_CONTENT = /^..*?(?=(?:<\/(?:style|head))|$)/s
90
90
  const RE_STYLE_CONTENT_END = /^<\/style/
91
91
  const RE_STYLE_CONTENT_END_2 = /^<\/head/
92
+ const RE_TYPE = /^[^\s\>]+/
92
93
 
93
94
  export const initialLineState = {
94
95
  state: State.TopLevelContent,
@@ -98,6 +99,8 @@ export const initialLineState = {
98
99
  embeddedLanguageStart: 0,
99
100
  embeddedLanguageEnd: 0,
100
101
  embeddedState: undefined,
102
+ specialTag: false,
103
+ type: '',
101
104
  }
102
105
 
103
106
  /**
@@ -150,6 +153,54 @@ const getEmbeddedContentState = (tag) => {
150
153
  }
151
154
  }
152
155
 
156
+ /**
157
+ * @param {string} value
158
+ */
159
+ const unquote = (value) => {
160
+ for (const quote of ["'", '"']) {
161
+ if (value.startsWith(quote) && value.endsWith(quote)) {
162
+ return value.slice(1, -1)
163
+ }
164
+ }
165
+ return value
166
+ }
167
+
168
+ /**
169
+ *
170
+ * @param {string} value
171
+ */
172
+ const getType = (value) => {
173
+ const unquotedValue = unquote(value)
174
+ switch (unquotedValue) {
175
+ case 'text/javascript':
176
+ case 'text/x-javascript':
177
+ case 'text/jscript':
178
+ case 'text/livescript':
179
+ case 'text/babel':
180
+ case 'text/ecmascript':
181
+ case 'text/x-ecmascript':
182
+ case 'application/x-javascript':
183
+ case 'application/javascript':
184
+ case 'application/x-ecmascript':
185
+ case 'application/ecmascript':
186
+ case 'module':
187
+ return 'javascript'
188
+ case 'text/x-handlebars':
189
+ case 'text/x-handlebars-template':
190
+ case 'text/handlebars-template':
191
+ case 'text/template':
192
+ case 'text/x-template':
193
+ case 'text/ng-template':
194
+ case 'text/x-ng-template':
195
+ return 'html'
196
+ case 'application/json':
197
+ case 'application/ld+json':
198
+ return 'json'
199
+ default:
200
+ return ''
201
+ }
202
+ }
203
+
153
204
  /**
154
205
  *
155
206
  * @param {string} line
@@ -166,6 +217,9 @@ export const tokenizeLine = (line, lineState) => {
166
217
  let embeddedLanguage = lineState.embeddedLanguage
167
218
  let embeddedLanguageStart = lineState.embeddedLanguageStart
168
219
  let embeddedLanguageEnd = lineState.embeddedLanguageEnd
220
+ let specialTag = lineState.specialTag
221
+ let attributeName = ''
222
+ let type = ''
169
223
  while (index < line.length) {
170
224
  const part = line.slice(index)
171
225
  switch (state) {
@@ -198,6 +252,7 @@ export const tokenizeLine = (line, lineState) => {
198
252
  token = TokenType.TagName
199
253
  state = State.InsideOpeningTag
200
254
  tag = next[0]
255
+ specialTag = tag === 'script' || tag === 'style'
201
256
  } else if ((next = part.match(RE_SLASH))) {
202
257
  token = TokenType.PunctuationTag
203
258
  state = State.AfterClosingTagAngleBrackets
@@ -219,12 +274,15 @@ export const tokenizeLine = (line, lineState) => {
219
274
  if ((next = part.match(RE_ANGLE_BRACKET_CLOSE))) {
220
275
  token = TokenType.PunctuationTag
221
276
  state = State.TopLevelContent
222
- const embeddedLanguageId = getEmbeddedLangageId(tag)
277
+ const embeddedLanguageId = type || getEmbeddedLangageId(tag)
223
278
  if (embeddedLanguageId) {
224
279
  state = getEmbeddedContentState(tag)
225
280
  embeddedLanguage = embeddedLanguageId
226
281
  embeddedLanguageStart = index + next[0].length
227
282
  }
283
+ specialTag = false
284
+ type = ''
285
+ attributeName = ''
228
286
  } else if ((next = part.match(RE_EXCLAMATION_MARK))) {
229
287
  token = TokenType.PunctuationTag
230
288
  state = State.InsideOpeningTag
@@ -281,18 +339,22 @@ export const tokenizeLine = (line, lineState) => {
281
339
  if ((next = part.match(RE_ATTRIBUTE_NAME))) {
282
340
  token = TokenType.AttributeName
283
341
  state = State.AfterAttributeName
342
+ attributeName = next[0]
284
343
  } else if ((next = part.match(RE_SELF_CLOSING))) {
285
344
  token = TokenType.PunctuationTag
286
345
  state = State.TopLevelContent
287
346
  } else if ((next = part.match(RE_ANGLE_BRACKET_CLOSE))) {
288
347
  token = TokenType.PunctuationTag
289
348
  state = State.TopLevelContent
290
- const embeddedLanguageId = getEmbeddedLangageId(tag)
349
+ const embeddedLanguageId = type || getEmbeddedLangageId(tag)
291
350
  if (embeddedLanguageId) {
292
351
  state = getEmbeddedContentState(tag)
293
352
  embeddedLanguage = embeddedLanguageId
294
353
  embeddedLanguageStart = index + next[0].length
295
354
  }
355
+ specialTag = false
356
+ type = ''
357
+ attributeName = ''
296
358
  } else if ((next = part.match(RE_DOUBLE_QUOTE))) {
297
359
  token = TokenType.Punctuation
298
360
  state = State.InsideDoubleQuoteString
@@ -314,12 +376,15 @@ export const tokenizeLine = (line, lineState) => {
314
376
  if ((next = part.match(RE_ANGLE_BRACKET_CLOSE))) {
315
377
  token = TokenType.PunctuationTag
316
378
  state = State.TopLevelContent
317
- const embeddedLanguageId = getEmbeddedLangageId(tag)
379
+ const embeddedLanguageId = type || getEmbeddedLangageId(tag)
318
380
  if (embeddedLanguageId) {
319
381
  state = getEmbeddedContentState(tag)
320
382
  embeddedLanguage = embeddedLanguageId
321
383
  embeddedLanguageStart = index + next[0].length
322
384
  }
385
+ specialTag = false
386
+ type = ''
387
+ attributeName = ''
323
388
  } else if ((next = part.match(RE_EQUAL_SIGN))) {
324
389
  token = TokenType.Punctuation
325
390
  state = State.AfterAttributeEqualSign
@@ -345,6 +410,13 @@ export const tokenizeLine = (line, lineState) => {
345
410
  }
346
411
  break
347
412
  case State.AfterAttributeEqualSign:
413
+ if (specialTag && attributeName === 'type') {
414
+ const valueMatch = part.match(RE_TYPE)
415
+ if (valueMatch) {
416
+ const value = valueMatch[0]
417
+ type = getType(value)
418
+ }
419
+ }
348
420
  if ((next = part.match(RE_DOUBLE_QUOTE))) {
349
421
  token = TokenType.PunctuationString
350
422
  state = State.InsideDoubleQuoteString
@@ -473,5 +545,7 @@ export const tokenizeLine = (line, lineState) => {
473
545
  embeddedLanguage,
474
546
  embeddedLanguageStart,
475
547
  embeddedLanguageEnd,
548
+ specialTag,
549
+ type,
476
550
  }
477
551
  }
@@ -89,6 +89,7 @@ export const TokenMap = {
89
89
 
90
90
  const RE_KEYWORD =
91
91
  /^(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|if|implements|import|in|Infinity|instanceof|interface|let|new|null|of|package|private|protected|public|return|super|switch|static|this|throw|try|true|typeof|undefined|var|void|while|with|yield)\b/
92
+
92
93
  const RE_CURLY_OPEN = /^\{/
93
94
  const RE_CURLY_CLOSE = /^\}/
94
95
  const RE_SQUARE_OPEN = /^\[/
@@ -97,6 +98,7 @@ const RE_COMMA = /^,/
97
98
  const RE_COLON = /^:/
98
99
  const RE_NUMERIC =
99
100
  /^((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b/
101
+
100
102
  const RE_NUMERIC_OCTAL = /0(?:o|O)?[0-7][0-7_]*(n)?\b/
101
103
  const RE_LINE_COMMENT_START = /^\/\//
102
104
  const RE_LINE_COMMENT_CONTENT = /^[^\n]+/
@@ -128,6 +130,7 @@ const RE_STRING_ESCAPE = /^\\./
128
130
  const RE_SHEBANG = /^#!.*/
129
131
  const RE_FUNCTION_CALL_NAME =
130
132
  /^[\w]+(?=\s*(\(|\=\s*(?:async\s*)?function|\=\s*(?:async\s*)?\())/
133
+
131
134
  const RE_DECORATOR = /^@\w+/
132
135
  const RE_BACKSLASH = /^\\/
133
136
  const RE_DOLLAR_CURLY_OPEN = /^\$\{/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.15.18",
3
+ "version": "0.15.19",
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.18",
21
- "@lvce-editor/extension-host-helper-process": "0.15.18",
22
- "@lvce-editor/pty-host": "0.15.18",
20
+ "@lvce-editor/extension-host": "0.15.19",
21
+ "@lvce-editor/extension-host-helper-process": "0.15.19",
22
+ "@lvce-editor/pty-host": "0.15.19",
23
23
  "debug": "^4.3.4",
24
24
  "execa": "^7.1.1",
25
25
  "exit-hook": "^3.2.0",
@@ -28,11 +28,7 @@
28
28
  "lines-and-columns": "^2.0.3",
29
29
  "p-queue": "^7.3.4",
30
30
  "parse-json": "^7.0.0",
31
- "symlink-dir": "^5.1.1",
32
- "tail": "^2.2.6",
33
31
  "tar-fs": "^2.1.1",
34
- "tmp-promise": "^3.0.3",
35
- "trash": "^8.1.1",
36
32
  "ws": "^8.13.0",
37
33
  "xdg-basedir": "^5.1.0"
38
34
  },
@@ -40,6 +36,10 @@
40
36
  "extract-zip": "^2.0.1",
41
37
  "keytar": "^7.9.0",
42
38
  "vscode-ripgrep-with-github-api-error-fix": "^2.8.0",
43
- "open": "^9.1.0"
39
+ "open": "^9.1.0",
40
+ "symlink-dir": "^5.1.1",
41
+ "tmp-promise": "^3.0.3",
42
+ "trash": "^8.1.1",
43
+ "tail": "^2.2.6"
44
44
  }
45
45
  }
@@ -0,0 +1,11 @@
1
+ export const Backslash = '\\'
2
+ export const Dash = '-'
3
+ export const Dot = '.'
4
+ export const EmptyString = ''
5
+ export const NewLine = '\n'
6
+ export const OpenAngleBracket = '<'
7
+ export const Slash = '/'
8
+ export const Space = ' '
9
+ export const Tab = '\t'
10
+ export const Underline = '_'
11
+ export const T = 't'
@@ -1,6 +1,6 @@
1
- import { readFile } from 'node:fs/promises'
1
+ import * as Character from '../Character/Character.js'
2
2
  import { writeFile } from '../FileSystem/FileSystem.js'
3
- import * as ReadJson from '../JsonFile/JsonFile.js'
3
+ import * as JsonFile from '../JsonFile/JsonFile.js'
4
4
 
5
5
  let settings
6
6
  let settingsPromise
@@ -9,7 +9,7 @@ const readSettings = async () => {
9
9
  // TODO allow jsonc
10
10
  if (!settings) {
11
11
  if (!settingsPromise) {
12
- settingsPromise = ReadJson.readJson('/tmp/settings.json')
12
+ settingsPromise = JsonFile.readJson('/tmp/settings.json')
13
13
  }
14
14
  await settingsPromise
15
15
  }
@@ -18,10 +18,7 @@ const readSettings = async () => {
18
18
 
19
19
  const writeSettings = async () => {
20
20
  // TODO jsonc
21
- await writeFile(
22
- '/tmp/settings.json',
23
- JSON.stringify(settings, null, 2) + '\n'
24
- )
21
+ await writeFile('/tmp/settings.json', JSON.stringify(settings, null, 2) + Character.NewLine)
25
22
  }
26
23
 
27
24
  export const get = async (key) => {
@@ -1,3 +1,4 @@
1
+ import * as Character from '../Character/Character.js'
1
2
  import * as ExitCode from '../ExitCode/ExitCode.js'
2
3
  import * as GetNewLineIndex from '../GetNewLineIndex/GetNewLineIndex.js'
3
4
  import * as IsIgnoredError from '../IsIgnoredError/IsIgnoredError.js'
@@ -62,6 +63,6 @@ export const handleUncaughtExceptionMonitor = (error, origin) => {
62
63
  return
63
64
  }
64
65
  const prettyError = PrettyError.prepare(error)
65
- Logger.error(prettyError.codeFrame + '\n' + prettyError.stack + '\n')
66
+ Logger.error(prettyError.codeFrame + Character.NewLine + prettyError.stack + Character.NewLine)
66
67
  Process.setExitCode(ExitCode.Error)
67
68
  }
@@ -119,13 +119,8 @@ const applyOverrides = async ({ root, commitHash, pathPrefix }) => {
119
119
  )
120
120
  await replace(
121
121
  Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'),
122
- `getColorThemeUrlWeb = (colorThemeId) => {
123
- return \`/extensions/builtin.theme-\${colorThemeId}/color-theme.json\`;
124
- };`,
125
- `const getColorThemeUrlWeb = (colorThemeId) => {
126
- const assetDir = getAssetDir()
127
- return \`\${assetDir}/themes/\${colorThemeId}.json\`
128
- }`
122
+ `return \`\${assetDir}/extensions/builtin.theme-\${colorThemeId}/color-theme.json\``,
123
+ `return \`\${assetDir}/themes/\${colorThemeId}.json\``
129
124
  )
130
125
  await replace(
131
126
  Path.join(root, 'dist', commitHash, 'packages', 'extension-host-worker', 'dist', 'extensionHostWorkerMain.js'),
@@ -134,13 +129,8 @@ const applyOverrides = async ({ root, commitHash, pathPrefix }) => {
134
129
  )
135
130
  await replace(
136
131
  Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'),
137
- `getIconThemeUrl = (iconThemeId) => {
138
- return \`/extensions/builtin.\${iconThemeId}/icon-theme.json\`;
139
- }`,
140
- `getIconThemeUrl = (iconThemeId) => {
141
- const assetDir = getAssetDir()
142
- return \`\${assetDir}/icon-themes/\${iconThemeId}.json\`
143
- }`
132
+ `return \`\${assetDir}/extensions/builtin.\${iconThemeId}/icon-theme.json\``,
133
+ `return \`\${assetDir}/icon-themes/\${iconThemeId}.json\``
144
134
  )
145
135
  await replace(
146
136
  Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'),
@@ -1,3 +1,5 @@
1
+ import * as Character from '../Character/Character.js'
2
+
1
3
  /**
2
4
  *
3
5
  * @param {string} string
@@ -5,5 +7,5 @@
5
7
  * @returns
6
8
  */
7
9
  export const getNewLineIndex = (string, startIndex = undefined) => {
8
- return string.indexOf('\n', startIndex)
10
+ return string.indexOf(Character.NewLine, startIndex)
9
11
  }
@@ -0,0 +1,7 @@
1
+ import * as GetTerminalSpawnOptions from './GetTerminalSpawnOptions.js'
2
+
3
+ export const name = 'GetTerminalSpawnOptions'
4
+
5
+ export const Commands = {
6
+ getTerminalSpawnOptions: GetTerminalSpawnOptions.getTerminalSpawnOptions,
7
+ }
@@ -0,0 +1,14 @@
1
+ import * as Platform from '../Platform/Platform.js'
2
+
3
+ export const getTerminalSpawnOptions = () => {
4
+ if (Platform.isWindows) {
5
+ return {
6
+ command: 'powershell.exe',
7
+ args: [],
8
+ }
9
+ }
10
+ return {
11
+ command: 'bash',
12
+ args: ['-i'],
13
+ }
14
+ }
@@ -1,3 +1,5 @@
1
+ import * as Character from '../Character/Character.js'
2
+
1
3
  export const joinLines = (lines) => {
2
- return lines.join('\n')
4
+ return lines.join(Character.NewLine)
3
5
  }
@@ -1,6 +1,7 @@
1
1
  // parsing error handling based on https://github.com/sindresorhus/parse-json/blob/main/index.js
2
2
 
3
3
  import { JsonParsingError } from '../JsonParsingError/JsonParsingError.js'
4
+ import * as Character from '../Character/Character.js'
4
5
 
5
6
  export const parse = async (string, filePath) => {
6
7
  try {
@@ -13,5 +14,5 @@ export const parse = async (string, filePath) => {
13
14
  }
14
15
 
15
16
  export const stringify = (value) => {
16
- return JSON.stringify(value, null, 2) + '\n'
17
+ return JSON.stringify(value, null, 2) + Character.NewLine
17
18
  }
@@ -9,8 +9,10 @@ const emptyError = {
9
9
  codeFrame: '',
10
10
  }
11
11
 
12
+ const RE_POSITION = /in JSON at position (\d+)/
13
+
12
14
  export const getErrorPropsFromError = (error, string, filePath) => {
13
- const indexMatch = error.message.match(/in JSON at position (\d+)/)
15
+ const indexMatch = error.message.match(RE_POSITION)
14
16
  if (indexMatch && indexMatch.length > 0) {
15
17
  const lines = new LinesAndColumns(string)
16
18
  const index = Number(indexMatch[1])
@@ -66,6 +66,8 @@ export const load = (moduleId) => {
66
66
  return import('../HandleElectronMessagePort/HandleElectronMessagePort.ipc.js')
67
67
  case ModuleId.HandleNodeMessagePort:
68
68
  return import('../HandleNodeMessagePort/HandleNodeMessagePort.ipc.js')
69
+ case ModuleId.GetTerminalSpawnOptions:
70
+ return import('../GetTerminalSpawnOptions/GetTerminalSpawnOptions.ipc.js')
69
71
  default:
70
72
  throw new Error(`module ${moduleId} not found`)
71
73
  }
@@ -30,3 +30,4 @@ export const Process = 29
30
30
  export const AttachDebugger = 30
31
31
  export const HandleElectronMessagePort = 31
32
32
  export const HandleNodeMessagePort = 32
33
+ export const GetTerminalSpawnOptions = 33
@@ -173,6 +173,8 @@ export const getModuleId = (commandId) => {
173
173
  return ModuleId.HandleNodeMessagePort
174
174
  case 'HandleElectronMessagePort.handleElectronMessagePort':
175
175
  return ModuleId.HandleElectronMessagePort
176
+ case 'GetTerminalSpawnOptions.getTerminalSpawnOptions':
177
+ return ModuleId.GetTerminalSpawnOptions
176
178
  default:
177
179
  throw new CommandNotFoundError(commandId)
178
180
  }
@@ -8,6 +8,7 @@ import * as GetActualPath from '../GetActualPath/GetActualPath.js'
8
8
  import * as JoinLines from '../JoinLines/JoinLines.js'
9
9
  import * as Json from '../Json/Json.js'
10
10
  import * as SplitLines from '../SplitLines/SplitLines.js'
11
+ import * as Logger from '../Logger/Logger.js'
11
12
 
12
13
  const RE_MODULE_NOT_FOUND_STACK = /Cannot find package '([^']+)' imported from (.+)$/
13
14
 
@@ -54,46 +55,51 @@ const prepareModuleNotFoundError = (error) => {
54
55
  }
55
56
 
56
57
  export const prepare = (error) => {
57
- if (error && error.code === ErrorCodes.ERR_MODULE_NOT_FOUND) {
58
- return prepareModuleNotFoundError(error)
59
- }
60
- const { message } = error
61
- if (error && error.cause) {
62
- const cause = error.cause()
63
- if (cause) {
64
- error = cause
58
+ try {
59
+ if (error && error.code === ErrorCodes.ERR_MODULE_NOT_FOUND) {
60
+ return prepareModuleNotFoundError(error)
65
61
  }
66
- }
67
- const lines = CleanStack.cleanStack(error.stack)
68
- const file = lines[0]
69
- let codeFrame = ''
70
- if (error.codeFrame) {
71
- codeFrame = error.codeFrame
72
- } else if (file) {
73
- let match = file.match(/\((.*):(\d+):(\d+)\)$/)
74
- if (!match) {
75
- match = file.match(/at (.*):(\d+):(\d+)$/)
62
+ const { message } = error
63
+ if (error && error.cause) {
64
+ const cause = error.cause()
65
+ if (cause) {
66
+ error = cause
67
+ }
76
68
  }
77
- if (match) {
78
- const [_, path, line, column] = match
79
- const actualPath = GetActualPath.getActualPath(path)
80
- const rawLines = readFileSync(actualPath, EncodingType.Utf8)
81
- const location = {
82
- start: {
83
- line: Number.parseInt(line),
84
- column: Number.parseInt(column),
85
- },
69
+ const lines = CleanStack.cleanStack(error.stack)
70
+ const file = lines[0]
71
+ let codeFrame = ''
72
+ if (error.codeFrame) {
73
+ codeFrame = error.codeFrame
74
+ } else if (file) {
75
+ let match = file.match(/\((.*):(\d+):(\d+)\)$/)
76
+ if (!match) {
77
+ match = file.match(/at (.*):(\d+):(\d+)$/)
78
+ }
79
+ if (match) {
80
+ const [_, path, line, column] = match
81
+ const actualPath = GetActualPath.getActualPath(path)
82
+ const rawLines = readFileSync(actualPath, EncodingType.Utf8)
83
+ const location = {
84
+ start: {
85
+ line: Number.parseInt(line),
86
+ column: Number.parseInt(column),
87
+ },
88
+ }
89
+ codeFrame = codeFrameColumns(rawLines, location)
86
90
  }
87
- codeFrame = codeFrameColumns(rawLines, location)
88
91
  }
89
- }
90
- const relevantStack = JoinLines.joinLines(lines)
91
- return {
92
- message,
93
- stack: relevantStack,
94
- codeFrame,
95
- type: error.constructor.name,
96
- code: error.code,
92
+ const relevantStack = JoinLines.joinLines(lines)
93
+ return {
94
+ message,
95
+ stack: relevantStack,
96
+ codeFrame,
97
+ type: error.constructor.name,
98
+ code: error.code,
99
+ }
100
+ } catch (otherError) {
101
+ Logger.warn(`ErrorHandling Error: ${otherError}`)
102
+ return error
97
103
  }
98
104
  }
99
105
 
@@ -1,3 +1,5 @@
1
+ import * as Character from '../Character/Character.js'
2
+
1
3
  export const splitLines = (lines) => {
2
- return lines.split('\n')
4
+ return lines.split(Character.NewLine)
3
5
  }
@@ -28,7 +28,7 @@ const createTerminal = (ptyHost, socket) => {
28
28
  }
29
29
  }
30
30
 
31
- export const create = async (socket, id, cwd) => {
31
+ export const create = async (socket, id, cwd, command, args) => {
32
32
  try {
33
33
  Assert.object(socket)
34
34
  Assert.number(id)
@@ -41,7 +41,7 @@ export const create = async (socket, id, cwd) => {
41
41
  ptyHost.send({
42
42
  jsonrpc: JsonRpcVersion.Two,
43
43
  method: 'Terminal.create',
44
- params: [id, cwd],
44
+ params: [id, cwd, command, args],
45
45
  })
46
46
  } catch (error) {
47
47
  throw new VError(error, `Failed to create terminal`)