@lvce-editor/shared-process 0.16.23 → 0.17.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.
@@ -87,10 +87,10 @@ export const TokenMap = {
87
87
  [TokenType.CssPseudoSelector]: 'CssPseudoSelector',
88
88
  }
89
89
 
90
- const RE_SELECTOR = /^[\.a-zA-Z\d\->+~_%\\\p{L}]+/u
91
- const RE_SELECTOR_ID = /^#[\w\-\_]+/
90
+ const RE_SELECTOR_ELEMENT = /^[a-zA-Z\d\->+~_%\\\p{L}]+/u
91
+ const RE_SELECTOR_ID = /^#[\w\-\_\\]+/
92
92
  const RE_PSEUDO_SELECTOR = /^:[\p{L}\-]+/u
93
- const RE_SELECTOR_CLASS = /^\.[\w\-_\p{L}]+/u
93
+ const RE_SELECTOR_CLASS = /^\.[\w\-_\p{L}\p{Emoji_Presentation}]+/u
94
94
  const RE_WHITESPACE = /^\s+/
95
95
  const RE_CURLY_OPEN = /^\{/
96
96
  const RE_CURLY_CLOSE = /^\}/
@@ -165,7 +165,7 @@ export const tokenizeLine = (line, lineState) => {
165
165
  if ((next = part.match(RE_SELECTOR_CLASS))) {
166
166
  token = TokenType.CssSelectorClass
167
167
  state = State.AfterSelector
168
- } else if ((next = part.match(RE_SELECTOR))) {
168
+ } else if ((next = part.match(RE_SELECTOR_ELEMENT))) {
169
169
  token = TokenType.CssSelector
170
170
  state = State.AfterSelector
171
171
  } else if ((next = part.match(RE_SELECTOR_ID))) {
@@ -232,7 +232,7 @@ export const tokenizeLine = (line, lineState) => {
232
232
  } else if ((next = part.match(RE_SELECTOR_CLASS))) {
233
233
  token = TokenType.CssSelectorClass
234
234
  state = State.AfterSelector
235
- } else if ((next = part.match(RE_SELECTOR))) {
235
+ } else if ((next = part.match(RE_SELECTOR_ELEMENT))) {
236
236
  token = TokenType.CssSelector
237
237
  state = State.AfterSelector
238
238
  } else if ((next = part.match(RE_SELECTOR_ID))) {
@@ -253,6 +253,10 @@ export const tokenizeLine = (line, lineState) => {
253
253
  } else if ((next = part.match(RE_VERTICAL_LINE))) {
254
254
  token = TokenType.Punctuation
255
255
  state = State.AfterSelector
256
+ } else if ((next = part.match(RE_BLOCK_COMMENT_START))) {
257
+ stack.push(state)
258
+ token = TokenType.Comment
259
+ state = State.InsideBlockComment
256
260
  } else if ((next = part.match(RE_SLASH))) {
257
261
  token = TokenType.Punctuation
258
262
  state = State.AfterSelector
@@ -29,7 +29,9 @@ export const TokenType = {
29
29
  KeywordThis: 12,
30
30
  Class: 13,
31
31
  Comment: 14,
32
+ Text: 117,
32
33
  FunctionName: 885,
34
+ KeywordImport: 215,
33
35
  }
34
36
 
35
37
  export const TokenMap = {
@@ -49,6 +51,8 @@ export const TokenMap = {
49
51
  [TokenType.Class]: 'Class',
50
52
  [TokenType.Comment]: 'Comment',
51
53
  [TokenType.FunctionName]: 'Function',
54
+ [TokenType.Text]: 'Text',
55
+ [TokenType.KeywordImport]: 'KeywordImport',
52
56
  }
53
57
 
54
58
  export const initialLineState = {
@@ -77,6 +81,7 @@ const RE_CURLY_OPEN = /^\{/
77
81
  const RE_ANYTHING_UNTIL_END = /^.+/s
78
82
  const RE_SLASH = /^\//
79
83
  const RE_FUNCTION_CALL_NAME = /^[\w]+(?=\s*(\())/
84
+ const RE_ANYTHING = /^.+/u
80
85
 
81
86
  export const hasArrayReturn = true
82
87
 
@@ -128,6 +133,8 @@ export const tokenizeLine = (line, lineState) => {
128
133
  case 'extends':
129
134
  token = TokenType.Keyword
130
135
  state = State.AfterKeywordBeforeClass
136
+ case 'import':
137
+ token = TokenType.KeywordImport
131
138
  break
132
139
  default:
133
140
  token = TokenType.Keyword
@@ -166,6 +173,9 @@ export const tokenizeLine = (line, lineState) => {
166
173
  } else if ((next = part.match(RE_ATTRIBUTE))) {
167
174
  token = TokenType.Attribute
168
175
  state = State.TopLevelContent
176
+ } else if ((next = part.match(RE_ANYTHING))) {
177
+ token = TokenType.Text
178
+ state = State.TopLevelContent
169
179
  } else {
170
180
  part //?
171
181
  throw new Error('no')
@@ -22,6 +22,7 @@ const State = {
22
22
  InsideBacktickString: 17,
23
23
  AfterPropertyDot: 18,
24
24
  AfterKeywordClass: 19,
25
+ AfterKeywordVariableDeclaration: 20,
25
26
  }
26
27
 
27
28
  /**
@@ -55,6 +56,7 @@ export const TokenType = {
55
56
  KeywordOperator: 887,
56
57
  KeywordFunction: 889,
57
58
  Class: 890,
59
+ KeywordVoid: 891,
58
60
  }
59
61
 
60
62
  export const TokenMap = {
@@ -84,6 +86,7 @@ export const TokenMap = {
84
86
  [TokenType.KeywordThis]: 'KeywordThis',
85
87
  [TokenType.KeywordOperator]: 'KeywordOperator',
86
88
  [TokenType.KeywordFunction]: 'KeywordFunction',
89
+ [TokenType.KeywordVoid]: 'KeywordVoid',
87
90
  [TokenType.Class]: 'Class',
88
91
  }
89
92
 
@@ -129,7 +132,7 @@ const RE_STRING_BACKTICK_QUOTE_CONTENT = /^[^`\\\$]+/
129
132
  const RE_STRING_ESCAPE = /^\\./
130
133
  const RE_SHEBANG = /^#!.*/
131
134
  const RE_FUNCTION_CALL_NAME =
132
- /^[\w]+(?=\s*(\(|\=\s*(?:async\s*)?function|\=\s*(?:async\s*)?\())/
135
+ /^[\w\$]+(?=\s*(\(|\=\s*(?:async\s*)?function|\=\s*(?:async\s*)?\())/
133
136
 
134
137
  const RE_DECORATOR = /^@\w+/
135
138
  const RE_BACKSLASH = /^\\/
@@ -144,7 +147,10 @@ const RE_REGEX =
144
147
  const RE_VARIABLE_NAME_SPECIAL = /\p{L}/u
145
148
  const RE_VARIABLE_NAME_SPECIAL_2 = /./u
146
149
  const RE_BUILTIN_CLASS =
147
- /^(?:Array|Object|Promise|ArrayBuffer|URL|URLSearchParams|WebSocket|FileSystemHandle|Function|StorageEvent|MessageEvent|MessageChannel|Int32Array|Boolean|String|Error|Set|RegExp|Map|WeakMap|RangeError|Date|Headers|Response|Request|Buffer|MessagePort|FileHandle|X509Certificate|Blob|HTMLElement)\b/
150
+ /^(?:Array|Object|Promise|ArrayBuffer|URL|URLSearchParams|WebSocket|FileSystemHandle|Function|StorageEvent|MessageEvent|MessageChannel|Int32Array|Boolean|String|Error|Set|RegExp|Map|WeakMap|RangeError|Date|Headers|Response|Request|Buffer|MessagePort|FileHandle|X509Certificate|Blob|HTMLElement|HTMLFormElement)\b/
151
+
152
+ const RE_PROPERTY_NAME = /^[a-z]\w*(?=\s*\:)/
153
+ const RE_PROPERTY_NAME_FUNCTION = /^[a-z]\w*(?=\s*\()/
148
154
 
149
155
  export const initialLineState = {
150
156
  state: State.TopLevelContent,
@@ -176,6 +182,71 @@ export const tokenizeLine = (line, lineState) => {
176
182
  if ((next = part.match(RE_WHITESPACE))) {
177
183
  token = TokenType.Whitespace
178
184
  state = State.TopLevelContent
185
+ } else if ((next = part.match(RE_PROPERTY_NAME_FUNCTION))) {
186
+ switch (next[0]) {
187
+ case 'function':
188
+ token = TokenType.KeywordFunction
189
+ state = State.TopLevelContent
190
+ break
191
+ case 'async':
192
+ token = TokenType.KeywordModifier
193
+ state = State.TopLevelContent
194
+ break
195
+ case 'await':
196
+ token = TokenType.KeywordModifier
197
+ state = State.TopLevelContent
198
+ break
199
+ case 'as':
200
+ case 'switch':
201
+ case 'default':
202
+ case 'case':
203
+ case 'else':
204
+ case 'if':
205
+ case 'break':
206
+ case 'throw':
207
+ case 'for':
208
+ case 'try':
209
+ case 'catch':
210
+ case 'finally':
211
+ case 'continue':
212
+ case 'while':
213
+ token = TokenType.KeywordControl
214
+ state = State.TopLevelContent
215
+ break
216
+ case 'return':
217
+ token = TokenType.KeywordReturn
218
+ state = State.TopLevelContent
219
+ break
220
+ case 'new':
221
+ token = TokenType.KeywordNew
222
+ state = State.TopLevelContent
223
+ break
224
+ case 'this':
225
+ token = TokenType.KeywordThis
226
+ state = State.TopLevelContent
227
+ break
228
+ case 'import':
229
+ case 'export':
230
+ case 'from':
231
+ token = TokenType.KeywordImport
232
+ state = State.TopLevelContent
233
+ break
234
+ case 'constructor':
235
+ case 'super':
236
+ token = TokenType.Keyword
237
+ state = State.TopLevelContent
238
+ break
239
+ default:
240
+ token = TokenType.FunctionName
241
+ state = State.TopLevelContent
242
+ break
243
+ }
244
+ } else if ((next = part.match(RE_PROPERTY_NAME))) {
245
+ token = TokenType.VariableName
246
+ state = State.TopLevelContent
247
+ if (part === 'default:') {
248
+ token = TokenType.KeywordControl
249
+ }
179
250
  } else if ((next = part.match(RE_KEYWORD))) {
180
251
  switch (next[0]) {
181
252
  case 'true':
@@ -257,6 +328,16 @@ export const tokenizeLine = (line, lineState) => {
257
328
  token = TokenType.Keyword
258
329
  state = State.AfterKeywordClass
259
330
  break
331
+ case 'var':
332
+ case 'let':
333
+ case 'const':
334
+ token = TokenType.Keyword
335
+ state = State.AfterKeywordVariableDeclaration
336
+ break
337
+ case 'void':
338
+ token = TokenType.KeywordVoid
339
+ state = State.TopLevelContent
340
+ break
260
341
  default:
261
342
  token = TokenType.Keyword
262
343
  state = State.TopLevelContent
@@ -478,6 +559,39 @@ export const tokenizeLine = (line, lineState) => {
478
559
  throw new Error('no')
479
560
  }
480
561
  break
562
+ case State.AfterKeywordVariableDeclaration:
563
+ if ((next = part.match(RE_WHITESPACE))) {
564
+ token = TokenType.Whitespace
565
+ state = State.AfterKeywordVariableDeclaration
566
+ } else if ((next = part.match(RE_FUNCTION_CALL_NAME))) {
567
+ token = TokenType.FunctionName
568
+ state = State.TopLevelContent
569
+ } else if ((next = part.match(RE_VARIABLE_NAME))) {
570
+ token = TokenType.VariableName
571
+ state = State.TopLevelContent
572
+ } else if ((next = part.match(RE_CURLY_OPEN))) {
573
+ token = TokenType.Punctuation
574
+ state = State.TopLevelContent
575
+ } else if ((next = part.match(RE_LINE_COMMENT))) {
576
+ token = TokenType.Comment
577
+ state = State.AfterKeywordVariableDeclaration
578
+ } else if ((next = part.match(RE_BLOCK_COMMENT_START))) {
579
+ stack.push(state)
580
+ token = TokenType.Comment
581
+ state = State.InsideBlockComment
582
+ } else if ((next = part.match(RE_PUNCTUATION))) {
583
+ token = TokenType.Punctuation
584
+ state = State.TopLevelContent
585
+ } else if ((next = part.match(RE_VARIABLE_NAME_SPECIAL))) {
586
+ token = TokenType.VariableName
587
+ state = State.TopLevelContent
588
+ } else if ((next = part.match(RE_VARIABLE_NAME_SPECIAL_2))) {
589
+ token = TokenType.VariableName
590
+ state = State.TopLevelContent
591
+ } else {
592
+ throw new Error(`no`)
593
+ }
594
+ break
481
595
  default:
482
596
  state
483
597
  throw new Error('no')
@@ -196,7 +196,7 @@ const RE_KEYWORD_READONLY = /^readonly\b/
196
196
  const RE_SHEBANG = /^\#\!\/.*/
197
197
  const RE_SPREAD = /^\.\.\./
198
198
  const RE_BUILTIN_CLASS =
199
- /^(?:Array|Object|Promise|ArrayBuffer|URL|URLSearchParams|WebSocket|FileSystemHandle|Function|StorageEvent|MessageEvent|MessageChannel|Int32Array|Boolean|String|Error|Set|RegExp|Map|WeakMap|RangeError|Date|Headers|Response|Request|Buffer|MessagePort|FileHandle|X509Certificate|Blob|HTMLElement)\b/
199
+ /^(?:Array|Object|Promise|ArrayBuffer|URL|URLSearchParams|WebSocket|FileSystemHandle|Function|StorageEvent|MessageEvent|MessageChannel|Int32Array|Boolean|String|Error|Set|RegExp|Map|WeakMap|RangeError|Date|Headers|Response|Request|Buffer|MessagePort|FileHandle|X509Certificate|Blob|HTMLElement|MutationRecord|HTMLVideoElement)\b/
200
200
 
201
201
  const RE_KEYWORD_NEW = /^new\b/
202
202
  const RE_KEYWORD_IMPLEMENTS = /^implements\b/
@@ -700,7 +700,7 @@ export const tokenizeLine = (line, lineState) => {
700
700
  state = State.AfterType
701
701
  } else if ((next = part.match(RE_EQUAL))) {
702
702
  token = TokenType.Punctuation
703
- state = State.TopLevelContent
703
+ state = stack.pop() || State.TopLevelContent
704
704
  } else if ((next = part.match(RE_QUESTION_MARK_COLON))) {
705
705
  token = TokenType.Punctuation
706
706
  state = State.BeforeType
@@ -1120,7 +1120,6 @@ export const tokenizeLine = (line, lineState) => {
1120
1120
  token = TokenType.Punctuation
1121
1121
  state = State.BeforeType
1122
1122
  } else if ((next = part.match(RE_CURLY_CLOSE))) {
1123
- stack
1124
1123
  token = TokenType.Punctuation
1125
1124
  state = stack.pop() || State.TopLevelContent
1126
1125
  } else if ((next = part.match(RE_SEMICOLON))) {
@@ -1161,6 +1160,10 @@ export const tokenizeLine = (line, lineState) => {
1161
1160
  stack.push(state)
1162
1161
  token = TokenType.Punctuation
1163
1162
  state = State.InsideDoubleQuoteString
1163
+ } else if ((next = part.match(RE_ROUND_OPEN))) {
1164
+ stack.push(State.AfterMethodParameters)
1165
+ token = TokenType.Punctuation
1166
+ state = State.InsideMethodParameters
1164
1167
  } else if ((next = part.match(RE_ANYTHING_UNTIL_END))) {
1165
1168
  token = TokenType.Text
1166
1169
  state = State.TopLevelContent
@@ -1375,6 +1378,8 @@ export const tokenizeLine = (line, lineState) => {
1375
1378
  state = State.AfterMethodParameters
1376
1379
  } else if ((next = part.match(RE_ARROW))) {
1377
1380
  token = TokenType.Punctuation
1381
+ // TODO depending on whether this is a type function
1382
+ // this can be either a type or a value
1378
1383
  state = State.BeforeType
1379
1384
  } else if ((next = part.match(RE_ANYTHING_UNTIL_END))) {
1380
1385
  token = TokenType.Punctuation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.16.23",
3
+ "version": "0.17.1",
4
4
  "description": "Utility package for @lvce-editor/server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,11 +17,11 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/code-frame": "^7.22.5",
20
- "@lvce-editor/extension-host": "0.16.23",
21
- "@lvce-editor/extension-host-helper-process": "0.16.23",
22
- "@lvce-editor/pty-host": "0.16.23",
20
+ "@lvce-editor/extension-host": "0.17.1",
21
+ "@lvce-editor/extension-host-helper-process": "0.17.1",
22
+ "@lvce-editor/pty-host": "0.17.1",
23
23
  "debug": "^4.3.4",
24
- "execa": "^7.1.1",
24
+ "execa": "^7.2.0",
25
25
  "exit-hook": "^3.2.0",
26
26
  "got": "^13.0.0",
27
27
  "is-object": "^1.0.2",
@@ -1,19 +1,15 @@
1
1
  import { spawn } from 'node:child_process'
2
- import { tmpdir } from 'node:os'
3
- import { join } from 'node:path'
4
2
  import * as Assert from '../Assert/Assert.js'
5
3
  import * as Download from '../Download/Download.js'
4
+ import * as FirstNodeWorkerEventType from '../FirstNodeWorkerEventType/FirstNodeWorkerEventType.js'
5
+ import * as GetFirstSpawnedProcessEvent from '../GetFirstSpawnedProcessEvent/GetFirstSpawnedProcessEvent.js'
6
+ import * as GetNsisUpdateArgs from '../GetNsisUpdateArgs/GetNsisUpdateArgs.js'
7
+ import * as GetNsisDownloadPath from '../GetNsisUpdateDownloadPath/GetNsisUpdateDownloadPath.js'
6
8
  import * as GetWindowsNsisDownloadUrl from '../GetWindowsNsisDownloadUrl/GetWindowsNsisDownloadUrl.js'
7
9
  import * as Logger from '../Logger/Logger.js'
8
10
  import * as Platform from '../Platform/Platform.js'
9
11
  import { VError } from '../VError/VError.js'
10
12
 
11
- const getOutfilePath = (version) => {
12
- Assert.string(version)
13
- const outFile = join(tmpdir(), `nsis-update-${version}`)
14
- return outFile
15
- }
16
-
17
13
  export const downloadUpdate = async (version) => {
18
14
  try {
19
15
  Assert.string(version)
@@ -21,7 +17,7 @@ export const downloadUpdate = async (version) => {
21
17
  const setupName = Platform.getSetupName()
22
18
  const fileName = `${setupName}-v${version}.exe`
23
19
  const downLoadUrl = GetWindowsNsisDownloadUrl.getDownloadUrl(repository, version, fileName)
24
- const outFile = getOutfilePath(version)
20
+ const outFile = GetNsisDownloadPath.getNsisUpdateDownloadPath(version)
25
21
  Logger.info(`[shared-process] downloading nsis update: ${downLoadUrl} -> ${outFile}`)
26
22
  await Download.download(downLoadUrl, outFile)
27
23
  Logger.info(`[shared-process] downloaded nsis update: ${outFile}`)
@@ -31,44 +27,17 @@ export const downloadUpdate = async (version) => {
31
27
  }
32
28
  }
33
29
 
34
- const getNsisUpdateArgs = () => {
35
- const args = []
36
- args.push('--updated')
37
- args.push('/S')
38
- args.push('--force-run')
39
- return args
40
- }
41
-
42
- const getFirstNsisProcessEvent = async (childProcess) => {
43
- const { type, event } = await new Promise((resolve) => {
44
- const cleanup = (value) => {
45
- childProcess.off('error', handleError)
46
- childProcess.off('exit', handleExit)
47
- resolve(value)
48
- }
49
- const handleError = (event) => {
50
- cleanup({ type: 'error', event })
51
- }
52
- const handleExit = (event) => {
53
- cleanup({ type: 'exit', event })
54
- }
55
- childProcess.on('error', handleError)
56
- childProcess.on('exit', handleExit)
57
- })
58
- return {
59
- type,
60
- event,
61
- }
62
- }
63
-
64
30
  export const installAndRestart = async (downloadPath) => {
65
31
  try {
66
32
  Assert.string(downloadPath)
67
- const args = getNsisUpdateArgs()
33
+ const args = GetNsisUpdateArgs.getNsisUpdateArgs()
68
34
  Logger.info(`[shared-process] spawning nsis update: ${downloadPath}`)
69
- const child = spawn(downloadPath, args, { stdio: 'inherit' })
70
- const { type, event } = await getFirstNsisProcessEvent(child)
71
- if (type === 'error') {
35
+ const child = spawn(downloadPath, args, {
36
+ stdio: 'inherit',
37
+ detached: true,
38
+ })
39
+ const { type, event } = await GetFirstSpawnedProcessEvent.getFirstSpawnedProcessEvent(child)
40
+ if (type === FirstNodeWorkerEventType.Error) {
72
41
  throw new Error(`Child process error: ${event}`)
73
42
  }
74
43
  Logger.info(`[shared-process] finished nsis update`)
@@ -34,6 +34,9 @@ export const link = async (path) => {
34
34
  const to = Path.join(linkedExtensionsPath, manifest.id)
35
35
  await SymLink.createSymLink(path, to)
36
36
  } catch (error) {
37
+ if (error && error.code === ErrorCodes.E_MANIFEST_NOT_FOUND) {
38
+ throw new VError(`Failed to link extension: Extension manifest not found '${error.path}'`)
39
+ }
37
40
  if (error && error.code === ErrorCodes.EEXIST) {
38
41
  return linkFallBack(path)
39
42
  }
@@ -1,25 +1,16 @@
1
1
  import isObject from 'is-object'
2
2
  import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js'
3
3
  import * as ExtensionManifestStatus from '../ExtensionManifestStatus/ExtensionManifestStatus.js'
4
+ import * as InferExtensionId from '../InferExtensionId/InferExtensionId.js'
5
+ import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js'
4
6
  import * as ReadJson from '../JsonFile/JsonFile.js'
5
7
  import * as Path from '../Path/Path.js'
6
- import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js'
7
8
  import { VError } from '../VError/VError.js'
8
9
 
9
- const RE_EXTENSION_FRAGMENT = /.+(\/|\\)(.+)$/
10
-
11
- const inferExtensionId = (absolutePath) => {
12
- const match = absolutePath.match(RE_EXTENSION_FRAGMENT)
13
- if (match) {
14
- return match[2]
15
- }
16
- return ''
17
- }
18
-
19
10
  // TODO json parsing and error handling should happen in renderer process
20
11
  export const get = async (path) => {
12
+ const absolutePath = Path.join(path, 'extension.json')
21
13
  try {
22
- const absolutePath = Path.join(path, 'extension.json')
23
14
  const json = await ReadJson.readJson(absolutePath)
24
15
  if (!isObject(json)) {
25
16
  // TODO should include stack of extension json file here
@@ -31,7 +22,7 @@ export const get = async (path) => {
31
22
  status: ExtensionManifestStatus.Resolved,
32
23
  }
33
24
  } catch (error) {
34
- const id = inferExtensionId(path)
25
+ const id = InferExtensionId.inferExtensionId(path)
35
26
  const enhancedError = new VError(error, `Failed to load extension manifest for ${id}`)
36
27
  if (IsEnoentError.isEnoentError(error)) {
37
28
  try {
@@ -48,6 +39,8 @@ export const get = async (path) => {
48
39
  }
49
40
  } catch {}
50
41
  // @ts-ignore
42
+ enhancedError.path = absolutePath
43
+ // @ts-ignore
51
44
  enhancedError.code = ErrorCodes.E_MANIFEST_NOT_FOUND
52
45
  } else {
53
46
  // @ts-ignore
@@ -0,0 +1,9 @@
1
+ import * as GetFirstEvent from '../GetFirstEvent/GetFirstEvent.js'
2
+ import * as FirstNodeWorkerEventType from '../FirstNodeWorkerEventType/FirstNodeWorkerEventType.js'
3
+
4
+ export const getFirstSpawnedProcessEvent = (childProcess) => {
5
+ return GetFirstEvent.getFirstEvent(childProcess, {
6
+ error: FirstNodeWorkerEventType.Error,
7
+ exit: FirstNodeWorkerEventType.Exit,
8
+ })
9
+ }
@@ -0,0 +1,7 @@
1
+ export const getNsisUpdateArgs = () => {
2
+ const args = []
3
+ args.push('--updated')
4
+ args.push('/S')
5
+ args.push('--force-run')
6
+ return args
7
+ }
@@ -0,0 +1,11 @@
1
+ import { tmpdir } from 'node:os'
2
+ import { join } from 'node:path'
3
+ import * as Assert from '../Assert/Assert.js'
4
+ import * as Platform from '../Platform/Platform.js'
5
+
6
+ export const getNsisUpdateDownloadPath = (version) => {
7
+ Assert.string(version)
8
+ const name = Platform.applicationName
9
+ const outFile = join(tmpdir(), `${name}-update-${version}.exe`)
10
+ return outFile
11
+ }
@@ -1,6 +1,8 @@
1
1
  import * as Assert from '../Assert/Assert.js'
2
2
 
3
3
  export const getDownloadUrl = (repository, version, fileName) => {
4
+ Assert.string(repository)
4
5
  Assert.string(version)
6
+ Assert.string(fileName)
5
7
  return `https://github.com/${repository}/releases/download/v${version}/${fileName}`
6
8
  }
@@ -0,0 +1,9 @@
1
+ const RE_EXTENSION_FRAGMENT = /.+(\/|\\)(.+)$/
2
+
3
+ export const inferExtensionId = (absolutePath) => {
4
+ const match = absolutePath.match(RE_EXTENSION_FRAGMENT)
5
+ if (match) {
6
+ return match[2]
7
+ }
8
+ return ''
9
+ }
@@ -169,11 +169,11 @@ export const getSetupName = () => {
169
169
  return 'Lvce-Setup'
170
170
  }
171
171
 
172
- export const version = '0.16.23'
172
+ export const version = '0.17.1'
173
173
 
174
- export const commit = 'd1cdc79'
174
+ export const commit = 'b3e9c7f'
175
175
 
176
- export const date = '2023-08-04T20:52:23.000Z'
176
+ export const date = '2023-08-05T20:50:47.000Z'
177
177
 
178
178
  export const getVersion = () => {
179
179
  return version