@lvce-editor/shared-process 0.115.14 → 0.115.16

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.
@@ -56,6 +56,7 @@
56
56
  "simpleBrowser.audioIndicator.enabled": true,
57
57
  "simpleBrowser.chromeTheme": "light",
58
58
  "simpleBrowser.fullWidth.doubleControlEnabled": true,
59
+ "simpleBrowser.fullWidth.hideTitleBar": false,
59
60
  "simpleBrowser.suggestions": false,
60
61
  "simpleBrowser.shortcuts": [],
61
62
  "simpleBrowser.tabHover.enabled": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.115.14",
3
+ "version": "0.115.16",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -3,4 +3,7 @@ import * as AutoUpdater from './AutoUpdater.js'
3
3
  export const Commands = {
4
4
  'AutoUpdater.getAutoUpdateType': AutoUpdater.getAutoUpdateType,
5
5
  'AutoUpdater.getLatestVersion': AutoUpdater.getLatestVersion,
6
+ 'AutoUpdater.getPlatform': AutoUpdater.getPlatform,
7
+ 'AutoUpdater.restartMacUpdate': AutoUpdater.restartMacUpdate,
8
+ 'AutoUpdater.stageMacUpdate': AutoUpdater.stageMacUpdate,
6
9
  }
@@ -1,7 +1,9 @@
1
+ import { fileURLToPath } from 'node:url'
1
2
  import * as AutoUpdateType from '../AutoUpdateType/AutoUpdateType.js'
2
3
  import * as CompareVersion from '../CompareVersion/CompareVersion.js'
3
4
  import * as GetLatestReleaseVersion from '../GetLatestReleaseVersion/GetLatestReleaseVersion.js'
4
5
  import * as IsAppImage from '../IsAppImage/IsAppImage.js'
6
+ import * as MainProcess from '../MainProcess/MainProcess.js'
5
7
  import * as Platform from '../Platform/Platform.js'
6
8
  import { VError } from '../VError/VError.js'
7
9
 
@@ -34,3 +36,12 @@ export const getLatestVersion = async () => {
34
36
  console.log('not update is available')
35
37
  }
36
38
  }
39
+
40
+ export const getPlatform = () => process.platform
41
+
42
+ export const stageMacUpdate = (diskPath, version) => {
43
+ const path = fileURLToPath(diskPath)
44
+ return MainProcess.invoke('ElectronMacUpdater.stage', path, version)
45
+ }
46
+
47
+ export const restartMacUpdate = () => MainProcess.invoke('ElectronMacUpdater.restart')
@@ -3,6 +3,6 @@ import { fileURLToPath } from 'url'
3
3
 
4
4
  export const getBuiltinExtensionsPath = () => {
5
5
  const staticServerPath = fileURLToPath(import.meta.resolve('@lvce-editor/static-server'))
6
- const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', 'cdcc8b7', 'extensions')
6
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '76edee8', 'extensions')
7
7
  return builtinExtensionsPath
8
8
  }
@@ -36,6 +36,14 @@ export const getMimeType = (fileExtension) => {
36
36
  return MimeType.Markdown
37
37
  case '.mp3':
38
38
  return MimeType.AudioMpeg
39
+ case '.mp4':
40
+ return MimeType.VideoMp4
41
+ case '.oga':
42
+ case '.ogg':
43
+ case '.opus':
44
+ return MimeType.AudioOgg
45
+ case '.ogv':
46
+ return MimeType.VideoOgg
39
47
  case '.png':
40
48
  return MimeType.ImagePng
41
49
  case '.svg':
@@ -45,6 +53,8 @@ export const getMimeType = (fileExtension) => {
45
53
  return MimeType.ImageTiff
46
54
  case '.ttf':
47
55
  return MimeType.FontTtf
56
+ case '.wav':
57
+ return MimeType.AudioWav
48
58
  case '.webm':
49
59
  return MimeType.VideoWebm
50
60
  case '.webp':
@@ -9,7 +9,7 @@ export const getTerminalSpawnOptions = () => {
9
9
  }
10
10
  if (Platform.isMacOs) {
11
11
  return {
12
- args: ['-i'],
12
+ args: ['-il'],
13
13
  command: 'zsh',
14
14
  }
15
15
  }
@@ -4,6 +4,7 @@ export const AudioMidi = 'audio/midi'
4
4
  export const AudioMpeg = 'audio/mpeg'
5
5
  export const AudioOgg = 'audio/ogg'
6
6
  export const AudioOpus = 'audio/opus'
7
+ export const AudioWav = 'audio/wav'
7
8
  export const AudioXaac = 'audio/x-aac'
8
9
  export const AudioXMsWma = 'audio/x-ms-wma'
9
10
  export const AudioXWav = 'audio/x-wav'
@@ -31,6 +32,7 @@ export const TextPlain = 'text/plain'
31
32
  export const TextXml = 'text/xml'
32
33
  export const VideoMp4 = 'video/mp4'
33
34
  export const VideoMpeg = 'video/mpeg'
35
+ export const VideoOgg = 'video/ogg'
34
36
  export const VideoQuickTime = 'video/quicktime'
35
37
  export const VideoWebm = 'video/webm'
36
38
  export const VideoXFlv = 'video/x-flv'
@@ -150,6 +150,8 @@ export const load = (moduleId) => {
150
150
  return import('../Screen/Screen.ipc.js')
151
151
  case ModuleId.SendMessagePortToMainProcess:
152
152
  return import('../SendMessagePortToMainProcess/SendMessagePortToMainProcess.ipc.js')
153
+ case ModuleId.ShellCommand:
154
+ return import('../ShellCommand/ShellCommand.ipc.js')
153
155
  case ModuleId.TemporaryMessagePort:
154
156
  return import('../TemporaryMessagePort/TemporaryMessagePort.ipc.js')
155
157
  case ModuleId.Terminal:
@@ -82,3 +82,4 @@ export const FileWatcherExplorer = 94
82
82
  export const HandleMessagePortForFileWatcherExplorer = 95
83
83
  export const RemoteCli = 96
84
84
  export const BrowserFind = 97
85
+ export const ShellCommand = 98
@@ -9,6 +9,9 @@ export const getModuleId = (commandId) => {
9
9
  return ModuleId.AttachDebugger
10
10
  case 'AutoUpdater.getAutoUpdateType':
11
11
  case 'AutoUpdater.getLatestVersion':
12
+ case 'AutoUpdater.getPlatform':
13
+ case 'AutoUpdater.restartMacUpdate':
14
+ case 'AutoUpdater.stageMacUpdate':
12
15
  return ModuleId.AutoUpdater
13
16
  case 'AutoUpdaterAppImage.downloadUpdate':
14
17
  case 'AutoUpdaterAppImage.installAndRestart':
@@ -294,6 +297,9 @@ export const getModuleId = (commandId) => {
294
297
  return ModuleId.Screen
295
298
  case 'SendMessagePortToMainProcess.sendMessagePortToMainProcess':
296
299
  return ModuleId.SendMessagePortToMainProcess
300
+ case 'ShellCommand.getMenuEntries':
301
+ case 'ShellCommand.install':
302
+ return ModuleId.ShellCommand
297
303
  case 'TemporaryMessagePort.getPortTuple2':
298
304
  case 'TemporaryMessagePort.getPortTuple3':
299
305
  case 'TemporaryMessagePort.handlePorts':
@@ -56,11 +56,11 @@ export const getSetupName = () => {
56
56
  return 'Lvce-Setup'
57
57
  }
58
58
 
59
- export const version = '0.115.14'
59
+ export const version = '0.115.16'
60
60
 
61
- export const commit = 'cdcc8b7'
61
+ export const commit = '76edee8'
62
62
 
63
- export const date = '2026-09-15T16:42:26.000Z'
63
+ export const date = '2026-09-16T12:32:43.000Z'
64
64
 
65
65
  export const getVersion = () => {
66
66
  return version
@@ -2,5 +2,5 @@ import { join } from 'node:path'
2
2
  import * as Root from '../Root/Root.js'
3
3
 
4
4
  export const getPreloadUrl = () => {
5
- return join(Root.root, 'static', 'cdcc8b7', 'packages', 'preload', 'dist', 'index.js')
5
+ return join(Root.root, 'static', '76edee8', 'packages', 'preload', 'dist', 'index.js')
6
6
  }
@@ -0,0 +1,8 @@
1
+ import * as ShellCommand from './ShellCommand.js'
2
+
3
+ export const name = 'ShellCommand'
4
+
5
+ export const Commands = {
6
+ getMenuEntries: ShellCommand.getMenuEntries,
7
+ install: ShellCommand.install,
8
+ }
@@ -0,0 +1,66 @@
1
+ import { execFile } from 'node:child_process'
2
+ import { constants } from 'node:fs'
3
+ import { access, lstat, mkdir, readlink, symlink } from 'node:fs/promises'
4
+ import { dirname, join, resolve } from 'node:path'
5
+ import { promisify } from 'node:util'
6
+ import * as IsElectron from '../IsElectron/IsElectron.js'
7
+ import * as Platform from '../Platform/Platform.js'
8
+ import * as Root from '../Root/Root.js'
9
+
10
+ const execFileAsync = promisify(execFile)
11
+
12
+ export const getMenuEntries = () => {
13
+ if (!Platform.isMacOs || !IsElectron.isElectron) {
14
+ return []
15
+ }
16
+ return [{ id: 'ShellCommand.install', label: `Shell Command: Install '${Platform.applicationName}' command in PATH` }]
17
+ }
18
+
19
+ const shellQuote = (value) => `'${value.replaceAll("'", "'\\''")}'`
20
+
21
+ export const getInstallScript = (source, destination) => {
22
+ return `/bin/mkdir -p ${shellQuote(dirname(destination))} && /bin/ln -s ${shellQuote(source)} ${shellQuote(destination)}`
23
+ }
24
+
25
+ const elevate = async (script) => {
26
+ await execFileAsync('/usr/bin/osascript', ['-e', 'on run argv\n do shell script (item 1 of argv) with administrator privileges\nend run', script])
27
+ }
28
+
29
+ export const installLink = async (source, destination, runElevated = elevate) => {
30
+ // Check the packaged launcher before creating directories or prompting for privileges.
31
+ await access(source, constants.X_OK)
32
+ const existing = await lstat(destination).catch((error) => {
33
+ if (error.code === 'ENOENT') {
34
+ return undefined
35
+ }
36
+ throw error
37
+ })
38
+ if (existing) {
39
+ if (existing.isSymbolicLink() && resolve(dirname(destination), await readlink(destination)) === source) {
40
+ return destination
41
+ }
42
+ throw new Error(`Cannot install shell command: ${destination} already exists. Move or remove it first.`)
43
+ }
44
+ try {
45
+ await mkdir(dirname(destination), { recursive: true })
46
+ await symlink(source, destination)
47
+ } catch (error) {
48
+ if (error.code !== 'EACCES' && error.code !== 'EPERM') {
49
+ throw error
50
+ }
51
+ // ln deliberately has no force flag, including after the privilege prompt.
52
+ await runElevated(getInstallScript(source, destination))
53
+ }
54
+ return destination
55
+ }
56
+
57
+ export const install = async () => {
58
+ if (!Platform.isMacOs || !IsElectron.isElectron) {
59
+ throw new Error('Installing the shell command is only supported in the macOS desktop app.')
60
+ }
61
+ const source = join(Root.root, 'bin', Platform.applicationName)
62
+ if (source.startsWith('/Volumes/') || source.includes('/AppTranslocation/')) {
63
+ throw new Error('Move the application to Applications and reopen it before installing the shell command.')
64
+ }
65
+ return installLink(source, join('/usr/local/bin', Platform.applicationName))
66
+ }