@lvce-editor/shared-process 0.11.12 → 0.12.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.
Files changed (115) hide show
  1. package/config/defaultKeyBindings.json +5 -0
  2. package/config/defaultSettings.json +4 -0
  3. package/config/fileMap.json +1 -2
  4. package/extensions/builtin.language-basics-css/README.md +2 -0
  5. package/extensions/builtin.language-basics-css/src/tokenizeCss.js +7 -0
  6. package/extensions/builtin.language-basics-dotenv/extension.json +7 -1
  7. package/extensions/builtin.language-basics-graphql/extension.json +1 -1
  8. package/extensions/builtin.language-basics-graphql/src/tokenizeGraphql.js +408 -4
  9. package/extensions/builtin.language-basics-html/src/tokenizeHtml.js +99 -4
  10. package/extensions/builtin.language-basics-javascript/src/tokenizeJavaScript.js +61 -2
  11. package/extensions/builtin.language-basics-json/extension.json +6 -1
  12. package/extensions/builtin.language-basics-json/src/tokenizeJson.js +27 -0
  13. package/extensions/builtin.language-basics-jsx/README.md +14 -0
  14. package/extensions/builtin.language-basics-jsx/extension.json +13 -0
  15. package/extensions/builtin.language-basics-jsx/src/tokenizeJsx.js +648 -0
  16. package/extensions/builtin.language-basics-julia/src/tokenizeJulia.js +52 -1
  17. package/extensions/builtin.language-basics-markdown/src/tokenizeMarkdown.js +105 -2
  18. package/extensions/builtin.language-basics-mdx/README.md +14 -0
  19. package/extensions/builtin.language-basics-mdx/extension.json +12 -0
  20. package/extensions/builtin.language-basics-mdx/src/tokenizeMdx.js +395 -0
  21. package/extensions/builtin.language-basics-shellscript/src/tokenizeShellScript.js +38 -15
  22. package/extensions/builtin.language-basics-toml/src/tokenizeToml.js +29 -1
  23. package/extensions/builtin.language-basics-typescript/extension.json +1 -1
  24. package/extensions/builtin.language-basics-typescript/src/tokenizeTypeScript.js +177 -11
  25. package/extensions/builtin.language-basics-vue/README.md +14 -0
  26. package/extensions/builtin.language-basics-vue/extension.json +13 -0
  27. package/extensions/builtin.language-basics-vue/src/tokenizeVue.js +327 -0
  28. package/extensions/builtin.language-basics-xml/extension.json +3 -2
  29. package/extensions/builtin.language-basics-xml/src/tokenizeXml.js +26 -3
  30. package/extensions/builtin.language-basics-yaml/src/tokenizeYaml.js +9 -2
  31. package/extensions/builtin.theme-atom-one-dark/color-theme.json +20 -0
  32. package/extensions/builtin.theme-ayu/color-theme.json +10 -1
  33. package/extensions/builtin.theme-cobalt2/color-theme.json +20 -0
  34. package/extensions/builtin.theme-gruvbox/color-theme.json +20 -0
  35. package/extensions/builtin.theme-noctis-uva/color-theme.json +20 -0
  36. package/extensions/builtin.theme-palenight/color-theme.json +8 -0
  37. package/extensions/builtin.theme-slime/color-theme.json +16 -0
  38. package/extensions/builtin.vscode-icons/icon-theme.json +40 -2
  39. package/extensions/builtin.vscode-icons/icons/file_type_bazel_ignore.svg +1 -0
  40. package/extensions/builtin.vscode-icons/icons/file_type_bazel_version.svg +1 -0
  41. package/extensions/builtin.vscode-icons/icons/file_type_eleventy.svg +1 -0
  42. package/extensions/builtin.vscode-icons/icons/file_type_eleventy2.svg +1 -0
  43. package/extensions/builtin.vscode-icons/icons/file_type_light_eleventy.svg +1 -0
  44. package/extensions/builtin.vscode-icons/icons/file_type_light_eleventy2.svg +1 -0
  45. package/extensions/builtin.vscode-icons/icons/file_type_light_rome.svg +1 -0
  46. package/extensions/builtin.vscode-icons/icons/file_type_light_tree.svg +1 -0
  47. package/extensions/builtin.vscode-icons/icons/file_type_mondoo.svg +1 -0
  48. package/extensions/builtin.vscode-icons/icons/file_type_nuxt.svg +1 -1
  49. package/extensions/builtin.vscode-icons/icons/file_type_rome.svg +1 -0
  50. package/extensions/builtin.vscode-icons/icons/file_type_sapphire_framework_cli.svg +1 -0
  51. package/extensions/builtin.vscode-icons/icons/file_type_shellcheck.svg +91 -0
  52. package/extensions/builtin.vscode-icons/icons/file_type_shuttle.svg +1 -0
  53. package/extensions/builtin.vscode-icons/icons/file_type_tree.svg +1 -0
  54. package/extensions/builtin.vscode-icons/icons/folder_type_nuxt.svg +1 -1
  55. package/extensions/builtin.vscode-icons/icons/folder_type_nuxt_opened.svg +1 -1
  56. package/package.json +9 -8
  57. package/src/parts/CleanStack/CleanStack.js +5 -0
  58. package/src/parts/Cli/Cli.js +5 -4
  59. package/src/parts/CliCommandType/CliCommandType.js +10 -0
  60. package/src/parts/CliInstall/CliInstall.js +3 -2
  61. package/src/parts/CliLink/CliLink.js +3 -2
  62. package/src/parts/CliList/CliList.js +3 -1
  63. package/src/parts/ClipBoard/ClipBoard.js +3 -2
  64. package/src/parts/ClipBoard/ClipBoardGnome.js +15 -31
  65. package/src/parts/CommandNotFoundError/CommandNotFoundError.js +9 -0
  66. package/src/parts/DesktopType/DesktopType.js +3 -0
  67. package/src/parts/Download/Download.js +1 -1
  68. package/src/parts/DownloadAndExtract/DownloadAndExtract.js +2 -2
  69. package/src/parts/Error/FileSystemError.js +1 -1
  70. package/src/parts/ErrorCodes/ErrorCodes.js +2 -0
  71. package/src/parts/ErrorHandling/ErrorHandling.js +4 -3
  72. package/src/parts/ExecCommand/ExecCommand.js +25 -0
  73. package/src/parts/ExecPromise/ExecPromise.js +4 -0
  74. package/src/parts/ExitCode/ExitCode.js +5 -0
  75. package/src/parts/ExportStatic/ExportStatic.js +2 -2
  76. package/src/parts/ExtensionHost/ExtensionHost.ipc.js +0 -1
  77. package/src/parts/ExtensionHost/ExtensionHost.js +1 -1
  78. package/src/parts/ExtensionHostIpc/ExtensionHostIpcWithChildProcess.js +3 -8
  79. package/src/parts/ExtensionHostIpc/ExtensionHostIpcWithWorker.js +3 -7
  80. package/src/parts/ExtensionInstallFromFile/ExtensionInstallFromFile.js +2 -5
  81. package/src/parts/ExtensionInstallFromGitHub/ExtensionInstallFromGitHub.js +1 -1
  82. package/src/parts/ExtensionInstallFromUrl/ExtensionInstallFromUrl.js +3 -3
  83. package/src/parts/ExtensionLink/ExtensionLink.js +19 -0
  84. package/src/parts/ExtensionManagement/ExtensionManagement.ipc.js +1 -1
  85. package/src/parts/ExtensionManagement/ExtensionManagementColorTheme.js +3 -2
  86. package/src/parts/ExtensionManagement/ExtensionManagementLanguages.js +7 -14
  87. package/src/parts/ExtensionManifest/ExtensionManifest.js +14 -4
  88. package/src/parts/ExtractZip/ExtractZip.js +1 -1
  89. package/src/parts/FileSystem/FileSystem.js +0 -1
  90. package/src/parts/GetResponse/GetResponse.js +2 -1
  91. package/src/parts/GitLsFiles/GitLsFiles.ipc.js +2 -0
  92. package/src/parts/GitLsFiles/GitLsFiles.js +21 -5
  93. package/src/parts/Hash/Hash.js +7 -0
  94. package/src/parts/IpcChild/IpcChild.js +6 -0
  95. package/src/parts/IpcChildModule/IpcChildModule.js +12 -0
  96. package/src/parts/IpcChildType/IpcChildType.js +13 -0
  97. package/src/parts/IpcChildWithNodeForkedProcess/IpcChildWithNodeForkedProcess.js +19 -0
  98. package/src/parts/IpcChildWithNodeWorker/IpcChildWithNodeWorker.js +27 -0
  99. package/src/parts/MergeStacks/MergeStacks.js +19 -0
  100. package/src/parts/ModuleMap/ModuleMap.js +4 -1
  101. package/src/parts/NormalizeErrorLine/NormalizeErrorLine.js +9 -0
  102. package/src/parts/OutputChannel/OutputChannel.ipc.js +1 -1
  103. package/src/parts/ParentIpc/ParentIpc.js +6 -10
  104. package/src/parts/ParseInt/ParseInt.js +3 -0
  105. package/src/parts/Platform/Platform.js +16 -21
  106. package/src/parts/Preferences/Preferences.js +2 -1
  107. package/src/parts/PrettyError/PrettyError.js +12 -23
  108. package/src/parts/PrintPrettyError/PrintPrettyError.js +3 -0
  109. package/src/parts/Process/Process.js +2 -2
  110. package/src/parts/ProtocolType/ProtocolType.js +3 -0
  111. package/src/parts/RecentlyOpened/RecentlyOpened.js +1 -1
  112. package/src/parts/Stats/Stats.js +8 -11
  113. package/src/parts/SymLink/SymLink.js +2 -14
  114. package/src/parts/TextDocument/TextDocument.js +3 -1
  115. package/src/parts/VError/VError.js +5 -22
@@ -0,0 +1 @@
1
+ <svg version="1.1" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="a" x1="36.036" x2="171.04" y1="171.21" y2="36.209" gradientTransform="matrix(1.2523 0 0 1.2523 -93.833 -117.64)" gradientUnits="userSpaceOnUse"><stop stop-color="#F42929" offset="0"/><stop stop-color="#FF8A3F" offset=".49479"/><stop stop-color="#E5E938" offset="1"/></linearGradient></defs><title>file_type_shuttle</title><g transform="matrix(.16512 0 0 .16512 10.022 13.873)"><path d="m78.693-71.892-42.285 42.284h-42.284l-42.284 42.283h42.284v42.285h-42.284v42.284h42.284v-42.284h42.284v42.284l42.285-42.284v-42.285l42.284-42.283v-42.284z" clip-rule="evenodd" fill="url(#a)" fill-rule="evenodd" stroke-width="1.2523"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg version="1.1" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><title>file_type_tree</title><path d="m1.916 1.9727v6.9883h-0.0058594v0.93164h0.0058594v5.7344h-0.0058594v0.93164h0.0058594v5.7363h-0.0058594v0.92969h0.0058594v5.7363h-0.0058594v0.93164h0.0058594v0.00586h0.93164v-0.00586h26.988v-0.93164h-26.988v-5.7363h13.77v-0.92969h-13.77v-5.7363h13.77v-0.93164h-13.77v-5.7344h7.8711v-0.93164h-7.8711v-6.9883h-0.93164z" fill="#94a09c" stroke-width="1.2"/></svg>
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0483A8" d="M27.5,5.5h-9.3l-2.1,4.2H4.4v16.8h25.2v-21H27.5z M27.5,9.7h-8.2l1.1-2.1h7.1V9.7z"/><path fill-rule="evenodd" clip-rule="evenodd" fill="#80EEC0" d="M17.9,13.2c-0.7-1.1-2.3-1.1-2.9,0L7.9,25.4c-0.7,1.1,0.2,2.5,1.5,2.5h5.5c-0.6-0.5-0.8-1.3-0.3-2l5.4-9.2 L17.9,13.2L17.9,13.2z"/><path fill="#00DC82" d="M22.4,15.9c0.5-0.9,1.9-0.9,2.4,0l5.9,10c0.5,0.9-0.1,2.1-1.2,2.1H17.8c-1.1,0-1.7-1.1-1.2-2.1L22.4,15.9z"/></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0483A8" d="M27.5 5.5h-9.3l-2.1 4.2H4.4v16.8h25.2v-21h-2.1Zm0 4.2h-8.2l1.1-2.1h7.1v2.1Z"/><g clip-path="url(#a)"><path fill="#00DC82" d="M20.3759 27.8156h8.8633c.2815 0 .5581-.073.8019-.2119.2438-.1388.4462-.3385.5869-.5789.1407-.2405.2147-.5132.2146-.7908-.0001-.2777-.0743-.5504-.2153-.7907L24.675 15.2762c-.1407-.2404-.3431-.4401-.5868-.5789-.2438-.1388-.5203-.2118-.8018-.2118-.2814 0-.5579.073-.8017.2118-.2437.1388-.4461.3385-.5868.5789l-1.522 2.6014-2.9757-5.087c-.1408-.2404-.3433-.44-.5871-.5788-.2438-.1387-.5204-.2118-.8019-.2118s-.558.0731-.8019.2118c-.2438.1388-.4462.3384-.5871.5788L7.21529 25.4433c-.14092.2403-.21517.513-.21529.7907-.00012.2776.07389.5503.21459.7908.1407.2404.34312.4401.58692.5789.24379.1389.52036.2119.80188.2119H14.167c2.2044 0 3.8301-.9549 4.9487-2.8178l2.7157-4.6381 1.4546-2.4821 4.3656 7.4558h-5.8202l-1.4555 2.4822Zm-6.2996-2.4847-3.8827-.0009 5.8202-9.9406 2.904 4.9703-1.9443 3.3221c-.7429 1.2087-1.5868 1.6491-2.8972 1.6491Z"/></g><defs><clipPath id="a"><path fill="#fff" d="M7 12h24v16H7z"/></clipPath></defs></svg>
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7FAECC" d="M27.4,5.5h-9.2l-2.1,4.2H4.3v16.8h25.2v-21H27.4z M27.4,24.2H6.6V11.8h20.8V24.2z M27.4,9.7h-8.2l1-2.1h7.1L27.4,9.7L27.4,9.7z"/><polygon fill="#7FAECC" points="25.7,13.7 0.5,13.7 4.3,26.5 29.5,26.5 "/><path fill-rule="evenodd" clip-rule="evenodd" fill="#80EEC0" d="M17.9,13.2c-0.7-1.1-2.3-1.1-2.9,0L7.9,25.4c-0.7,1.1,0.2,2.5,1.5,2.5h5.5c-0.6-0.5-0.8-1.3-0.3-2l5.4-9.2L17.9,13.2L17.9,13.2z"/><path fill="#00DC82" d="M22.4,15.9c0.5-0.9,1.9-0.9,2.4,0l5.9,10c0.5,0.9-0.1,2.1-1.2,2.1H17.8c-1.1,0-1.7-1.1-1.2-2.1L22.4,15.9z"/></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7FAECC" d="M27.4 5.5h-9.2l-2.1 4.2H4.3v16.8h25.2v-21h-2.1Zm0 18.7H6.6V11.8h20.8v12.4Zm0-14.5h-8.2l1-2.1h7.1l.1 2.1Z"/><path fill="#7FAECC" d="M25.7 13.7H.5l3.8 12.8h25.2l-3.8-12.8Z"/><path fill="#00DC82" d="M20.3759 27.8156h8.8633c.2815 0 .5581-.073.8019-.2119.2438-.1388.4462-.3385.5869-.5789.1407-.2405.2147-.5132.2146-.7908-.0001-.2777-.0743-.5504-.2153-.7907L24.675 15.2762c-.1407-.2404-.3431-.4401-.5868-.5789-.2438-.1388-.5203-.2118-.8018-.2118-.2814 0-.5579.073-.8017.2118-.2437.1388-.4461.3385-.5868.5789l-1.522 2.6014-2.9757-5.087c-.1408-.2404-.3433-.44-.5871-.5788-.2438-.1387-.5204-.2118-.8019-.2118s-.558.0731-.8019.2118c-.2438.1388-.4462.3384-.5871.5788L7.21529 25.4433c-.14092.2403-.21517.513-.21529.7907-.00012.2776.07389.5503.21459.7908.1407.2404.34312.4401.58692.5789.24379.1389.52036.2119.80188.2119H14.167c2.2044 0 3.8301-.9549 4.9487-2.8178l2.7157-4.6381 1.4546-2.4821 4.3656 7.4558h-5.8202l-1.4555 2.4822Zm-6.2996-2.4847-3.8827-.0009 5.8202-9.9406 2.904 4.9703-1.9443 3.3221c-.7429 1.2087-1.5868 1.6491-2.8972 1.6491Z"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.11.12",
3
+ "version": "0.12.1",
4
4
  "description": "Utility package for @lvce-editor/server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,19 +17,20 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/code-frame": "^7.18.6",
20
- "@lvce-editor/extension-host": "0.11.12",
21
- "@lvce-editor/extension-host-helper-process": "0.11.12",
22
- "@lvce-editor/pty-host": "0.11.12",
20
+ "@lvce-editor/extension-host": "0.12.1",
21
+ "@lvce-editor/extension-host-helper-process": "0.12.1",
22
+ "@lvce-editor/pty-host": "0.12.1",
23
23
  "debug": "^4.3.4",
24
24
  "execa": "^6.1.0",
25
- "exit-hook": "^3.1.4",
25
+ "exit-hook": "^3.2.0",
26
26
  "got": "^12.5.3",
27
27
  "is-object": "^1.0.2",
28
28
  "lines-and-columns": "^2.0.3",
29
- "open": "^8.4.0",
30
- "p-queue": "^7.3.0",
29
+ "open": "^8.4.1",
30
+ "p-queue": "^7.3.4",
31
31
  "parse-json": "^6.0.2",
32
- "tail": "^2.2.5",
32
+ "symlink-dir": "^5.1.1",
33
+ "tail": "^2.2.6",
33
34
  "tar-fs": "^2.1.1",
34
35
  "tmp-promise": "^3.0.3",
35
36
  "trash": "^8.1.0",
@@ -0,0 +1,5 @@
1
+ import npmCleanStack from 'clean-stack'
2
+
3
+ export const cleanStack = (stack) => {
4
+ return npmCleanStack(stack)
5
+ }
@@ -1,15 +1,16 @@
1
+ import * as CliCommandType from '../CliCommandType/CliCommandType.js'
1
2
  import * as Logger from '../Logger/Logger.js'
2
3
  import * as Process from '../Process/Process.js'
3
4
 
4
5
  const getModule = (argv0) => {
5
6
  switch (argv0) {
6
- case 'install':
7
+ case CliCommandType.Install:
7
8
  return import('../CliInstall/CliInstall.js')
8
- case 'list':
9
+ case CliCommandType.List:
9
10
  return import('../CliList/CliList.js')
10
- case 'link':
11
+ case CliCommandType.Link:
11
12
  return import('../CliLink/CliLink.js')
12
- case 'unlink':
13
+ case CliCommandType.Unlink:
13
14
  return import('../CliUnlink/CliUnlink.js')
14
15
  default:
15
16
  throw new Error(`command not found ${argv0}`)
@@ -0,0 +1,10 @@
1
+ export const Version = 'version'
2
+ export const Help = 'help'
3
+ export const Wait = 'wait'
4
+ export const BuiltinSelfTest = 'built-in-self-test'
5
+ export const Web = 'web'
6
+ export const SandBox = 'sandbox'
7
+ export const Install = 'install'
8
+ export const List = 'list'
9
+ export const Link = 'link'
10
+ export const Unlink = 'unlink'
@@ -1,3 +1,4 @@
1
+ import * as ExitCode from '../ExitCode/ExitCode.js'
1
2
  import * as ExtensionInstall from '../ExtensionInstall/ExtensionInstall.js'
2
3
  import * as Logger from '../Logger/Logger.js'
3
4
  import * as Process from '../Process/Process.js'
@@ -13,12 +14,12 @@ export const handleCliArgs = async (argv) => {
13
14
  } catch (error) {
14
15
  if (error && error.message && error.message.includes('Response code')) {
15
16
  Logger.error(error.message)
16
- Process.setExitCode(128)
17
+ Process.setExitCode(ExitCode.ExpectedError)
17
18
  return
18
19
  }
19
20
  if (error && error.message && error.message.includes('getaddrinfo EAI_AGAIN')) {
20
21
  Logger.error(error.message)
21
- Process.setExitCode(128)
22
+ Process.setExitCode(ExitCode.ExpectedError)
22
23
  return
23
24
  }
24
25
  throw error
@@ -1,5 +1,6 @@
1
- import * as ExtensionLink from '../ExtensionLink/ExtensionLink.js'
2
1
  import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js'
2
+ import * as ExitCode from '../ExitCode/ExitCode.js'
3
+ import * as ExtensionLink from '../ExtensionLink/ExtensionLink.js'
3
4
  import * as Logger from '../Logger/Logger.js'
4
5
  import * as Process from '../Process/Process.js'
5
6
 
@@ -10,7 +11,7 @@ export const handleCliArgs = async (argv) => {
10
11
  } catch (error) {
11
12
  if (error && error.code === ErrorCodes.E_MANIFEST_NOT_FOUND) {
12
13
  Logger.error(error.message)
13
- Process.setExitCode(128)
14
+ Process.setExitCode(ExitCode.ExpectedError)
14
15
  return
15
16
  }
16
17
  throw error
@@ -1,4 +1,5 @@
1
1
  import * as ExtensionList from '../ExtensionList/ExtensionList.js'
2
+ import * as JoinLines from '../JoinLines/JoinLines.js'
2
3
  import * as Logger from '../Logger/Logger.js'
3
4
 
4
5
  const getOutputLine = (extension) => {
@@ -6,7 +7,8 @@ const getOutputLine = (extension) => {
6
7
  }
7
8
 
8
9
  const getOutput = (extensions) => {
9
- return extensions.map(getOutputLine).join('\n')
10
+ const lines = extensions.map(getOutputLine)
11
+ return JoinLines.joinLines(lines)
10
12
  }
11
13
 
12
14
  export const handleCliArgs = async (argv) => {
@@ -1,11 +1,12 @@
1
1
  import * as Platform from '../Platform/Platform.js'
2
+ import * as DesktopType from '../DesktopType/DesktopType.js'
2
3
 
3
4
  const getClipboard = () => {
4
5
  const desktop = Platform.getDesktop()
5
6
  switch (desktop) {
6
- case 'gnome':
7
+ case DesktopType.Gnome:
7
8
  return import('./ClipBoardGnome.js')
8
- case 'windows':
9
+ case DesktopType.Windows:
9
10
  return import('./ClipBoardWindows.js')
10
11
  default:
11
12
  return import('./ClipBoardNoop.js')
@@ -4,6 +4,7 @@
4
4
 
5
5
  import VError from 'verror'
6
6
  import * as Exec from '../Exec/Exec.js'
7
+ import * as JoinLines from '../JoinLines/JoinLines.js'
7
8
  import * as SplitLines from '../SplitLines/SplitLines.js'
8
9
 
9
10
  const removePrefix = (file) => {
@@ -20,17 +21,12 @@ const addPrefix = (file) => {
20
21
  export const readFiles = async () => {
21
22
  let result
22
23
  try {
23
- result = await Exec.exec(
24
- 'xclip',
25
- ['-selection', 'clipboard', '-o', '-t', 'x-special/gnome-copied-files'],
26
- {}
27
- )
24
+ result = await Exec.exec('xclip', ['-selection', 'clipboard', '-o', '-t', 'x-special/gnome-copied-files'], {})
28
25
  } catch (error) {
29
26
  if (
30
27
  error &&
31
28
  // @ts-ignore
32
- error.stderr ===
33
- 'Error: target x-special/gnome-copied-files not available'
29
+ error.stderr === 'Error: target x-special/gnome-copied-files not available'
34
30
  ) {
35
31
  return
36
32
  }
@@ -47,31 +43,19 @@ export const readFiles = async () => {
47
43
 
48
44
  export const writeFiles = async (type, files) => {
49
45
  const filesWithPrefix = files.map(addPrefix)
50
- const gnomeCopiedFilesContent = [type, ...filesWithPrefix].join('\n')
51
- const uriListContent = filesWithPrefix.join('\n')
52
- const plainContent = files.join('\n')
46
+ const gnomeCopiedFilesContent = JoinLines.joinLines([type, ...filesWithPrefix])
47
+ const uriListContent = JoinLines.joinLines(filesWithPrefix)
48
+ const plainContent = JoinLines.joinLines(files)
53
49
  try {
54
- await Exec.exec(
55
- 'xclip',
56
- ['-i', '-selection', 'clipboard', '-t', 'x-special/gnome-copied-files'],
57
- {
58
- input: gnomeCopiedFilesContent,
59
- }
60
- )
61
- await Exec.exec(
62
- 'xclip',
63
- ['-i', '-selection', 'clipboard', '-t', 'text/uri-list'],
64
- {
65
- input: uriListContent,
66
- }
67
- )
68
- await Exec.exec(
69
- 'xclip',
70
- ['-i', '-selection', 'clipboard', '-t', 'text/plain'],
71
- {
72
- input: plainContent,
73
- }
74
- )
50
+ await Exec.exec('xclip', ['-i', '-selection', 'clipboard', '-t', 'x-special/gnome-copied-files'], {
51
+ input: gnomeCopiedFilesContent,
52
+ })
53
+ await Exec.exec('xclip', ['-i', '-selection', 'clipboard', '-t', 'text/uri-list'], {
54
+ input: uriListContent,
55
+ })
56
+ await Exec.exec('xclip', ['-i', '-selection', 'clipboard', '-t', 'text/plain'], {
57
+ input: plainContent,
58
+ })
75
59
  } catch (error) {
76
60
  // @ts-ignore
77
61
  throw new VError(error, 'Failed to copy files to clipboard')
@@ -0,0 +1,9 @@
1
+ import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js'
2
+
3
+ export class CommandNotFoundError extends Error {
4
+ constructor(id) {
5
+ super(`command ${id} not found`)
6
+ this.name = 'CommandNotFoundError'
7
+ this.code = ErrorCodes.E_COMMAND_NOT_FOUND
8
+ }
9
+ }
@@ -0,0 +1,3 @@
1
+ export const Gnome = 'gnome'
2
+ export const Windows = 'windows'
3
+ export const Unknown = ''
@@ -1,7 +1,7 @@
1
- import got, { RequestError } from 'got'
2
1
  import { createWriteStream } from 'node:fs'
3
2
  import { mkdir, rm } from 'node:fs/promises'
4
3
  import { pipeline } from 'node:stream/promises'
4
+ import got, { RequestError } from 'got'
5
5
  import VError from 'verror'
6
6
  import * as Path from '../Path/Path.js'
7
7
 
@@ -1,7 +1,7 @@
1
+ import { pipeline } from 'node:stream/promises'
2
+ import { createGunzip } from 'node:zlib'
1
3
  import got, { RequestError } from 'got'
2
- import { pipeline } from 'stream/promises'
3
4
  import tar from 'tar-fs'
4
- import { createGunzip } from 'zlib'
5
5
  import { VError } from '../VError/VError.js'
6
6
 
7
7
  export const downloadAndExtractTarGz = async ({ url, outDir, strip }) => {
@@ -1,4 +1,4 @@
1
- import VError from 'verror'
1
+ import { VError } from '../VError/VError.js'
2
2
 
3
3
  export class FileSystemError extends VError {
4
4
  constructor(error, message) {
@@ -3,6 +3,7 @@ export const E_ICON_THEME_NOT_FOUND = 'E_ICON_THEME_NOT_FOUND'
3
3
  export const E_MANIFEST_NOT_FOUND = 'E_MANIFEST_NOT_FOUND'
4
4
  export const ECONNRESET = 'ECONNRESET'
5
5
  export const EEXIST = 'EEXIST'
6
+ export const EISDIR = 'EISDIR'
6
7
  export const ELOOP = 'ELOOP'
7
8
  export const ENOENT = 'ENOENT'
8
9
  export const ENOTDIR = 'ENOTDIR'
@@ -11,3 +12,4 @@ export const EPIPE = 'EPIPE'
11
12
  export const ERR_IPC_CHANNEL_CLOSED = 'ERR_IPC_CHANNEL_CLOSED'
12
13
  export const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND'
13
14
  export const EXDEV = 'EXDEV'
15
+ export const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND'
@@ -1,8 +1,9 @@
1
1
  import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js'
2
+ import * as ExitCode from '../ExitCode/ExitCode.js'
3
+ import * as JsonRpcVersion from '../JsonRpcVersion/JsonRpcVersion.js'
2
4
  import * as PrettyError from '../PrettyError/PrettyError.js'
3
- import * as Socket from '../Socket/Socket.js'
4
5
  import * as Process from '../Process/Process.js'
5
- import * as JsonRpcVersion from '../JsonRpcVersion/JsonRpcVersion.js'
6
+ import * as Socket from '../Socket/Socket.js'
6
7
 
7
8
  export const state = {
8
9
  seenErrors: [],
@@ -70,5 +71,5 @@ export const handleUncaughtExceptionMonitor = (error, origin) => {
70
71
  // console.error(prettyError.message)
71
72
  console.error(prettyError.codeFrame)
72
73
  console.error(prettyError.stack)
73
- Process.exit(1)
74
+ Process.exit(ExitCode.Error)
74
75
  }
@@ -0,0 +1,25 @@
1
+ import * as NodeChildProcess from 'node:child_process'
2
+ import { once } from 'node:events'
3
+ import * as ExecPromise from '../ExecPromise/ExecPromise.js'
4
+ import * as Hash from '../Hash/Hash.js'
5
+
6
+ export const execCommand = async (command, args, options) => {
7
+ const { stdout, stderr } = await ExecPromise.execPromise(command, args, options)
8
+ return {
9
+ stdout,
10
+ stderr,
11
+ }
12
+ }
13
+
14
+ export const execCommandHash = async (command, args, options) => {
15
+ const child = NodeChildProcess.spawn(command, args, options)
16
+ const hash = Hash.createHash('sha1')
17
+ child.stdout.pipe(hash)
18
+ await once(child, 'exit')
19
+ const finalHash = hash.digest('hex')
20
+ return finalHash
21
+ }
22
+
23
+ export const execSync = (command) => {
24
+ return NodeChildProcess.execSync(command).toString().trim()
25
+ }
@@ -0,0 +1,4 @@
1
+ import { execFile } from 'node:child_process'
2
+ import { promisify } from 'node:util'
3
+
4
+ export const execPromise = promisify(execFile)
@@ -0,0 +1,5 @@
1
+ export const Error = 1
2
+
3
+ export const ExpectedError = 128
4
+
5
+ export const Sucess = 0
@@ -228,6 +228,7 @@ const applyOverrides = async ({ root, commitHash, pathPrefix }) => {
228
228
  }
229
229
  await replace(Path.join(root, 'dist', 'manifest.json'), `/${commitHash}`, `${pathPrefix}/${commitHash}`)
230
230
  await replace(Path.join(root, 'dist', commitHash, 'css', 'parts', 'ViewletTitleBarButtons.css'), `/${commitHash}`, `${pathPrefix}/${commitHash}`)
231
+ await replace(Path.join(root, 'dist', commitHash, 'css', 'App.css'), `/${commitHash}`, `${pathPrefix}/${commitHash}`)
231
232
  }
232
233
 
233
234
  const addExtensionSeo = async ({ root, name, description }) => {
@@ -390,7 +391,6 @@ const generateTestOverviewHtml = (dirents) => {
390
391
  <html lang="en">
391
392
  <head>
392
393
  <meta charset="UTF-8" />
393
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
394
394
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
395
395
  <title>Tests</title>
396
396
  </head>
@@ -446,7 +446,7 @@ const addTestFiles = async ({ testPath, commitHash, root, pathPrefix }) => {
446
446
  export const exportStatic = async ({ root, pathPrefix, extensionPath, testPath }) => {
447
447
  if (pathPrefix === 'auto') {
448
448
  const extensionJson = await readExtensionManifest(Path.join(extensionPath, 'extension.json'))
449
- const id = extensionJson.id
449
+ const { id } = extensionJson
450
450
  const [author, name] = id.split('.')
451
451
  pathPrefix = `/${name}`
452
452
  }
@@ -6,7 +6,6 @@ import * as ExtensionHostKeyBindings from './ExtensionHostKeyBindings.js'
6
6
  // prettier-ignore
7
7
  export const Commands = {
8
8
 
9
-
10
9
  'ExtensionHost.dispose': ExtensionHost.dispose,
11
10
  'ExtensionHost.getCommands': ExtensionHostCommand.getCommandsIpc,
12
11
  'ExtensionHost.send': ExtensionHost.send,
@@ -18,7 +18,7 @@ export const state = {
18
18
  // TODO this function is very ugly and has probably memory leaks
19
19
  const createExtensionHost = async (socket) => {
20
20
  Assert.object(socket)
21
- const ipc = ExtensionHostIpc.create()
21
+ const ipc = await ExtensionHostIpc.create()
22
22
  const rpc = ExtensionHostRpc.create(ipc, socket)
23
23
  return rpc
24
24
  }
@@ -1,16 +1,11 @@
1
1
  import * as ChildProcess from '../ChildProcess/ChildProcess.js'
2
2
  import * as Platform from '../Platform/Platform.js'
3
3
 
4
- export const create = () => {
5
- const extensionHostPath = Platform.getExtensionHostPath()
4
+ export const create = async () => {
5
+ const extensionHostPath = await Platform.getExtensionHostPath()
6
6
  const childProcess = ChildProcess.fork(
7
7
  extensionHostPath,
8
- [
9
- '--ipc-type=websocket',
10
- '--experimental-json-modules',
11
- '--max-old-space-size=60',
12
- '--enable-source-maps',
13
- ],
8
+ ['--ipc-type=websocket', '--experimental-json-modules', '--max-old-space-size=60', '--enable-source-maps'],
14
9
  {
15
10
  env: {
16
11
  ...process.env,
@@ -1,14 +1,10 @@
1
1
  import { Worker } from 'node:worker_threads'
2
2
  import * as Platform from '../Platform/Platform.js'
3
3
 
4
- export const create = () => {
5
- const extensionHostPath = Platform.getExtensionHostPath()
4
+ export const create = async () => {
5
+ const extensionHostPath = await Platform.getExtensionHostPath()
6
6
  const child = new Worker(extensionHostPath, {
7
- execArgv: [
8
- '--experimental-json-modules',
9
- '--max-old-space-size=60',
10
- '--enable-source-maps',
11
- ],
7
+ execArgv: ['--experimental-json-modules', '--max-old-space-size=60', '--enable-source-maps'],
12
8
  env: {
13
9
  ...process.env,
14
10
  LOGS_DIR: Platform.getLogsDir(),
@@ -17,15 +17,12 @@ export const install = async ({ path }) => {
17
17
  try {
18
18
  const cachedExtensionsPath = Platform.getCachedExtensionsPath()
19
19
  const cachedExtensionFolderName = getCachedExtensionFolderName(path)
20
- const cachedExtensionPath = Path.join(
21
- cachedExtensionsPath,
22
- cachedExtensionFolderName
23
- )
20
+ const cachedExtensionPath = Path.join(cachedExtensionsPath, cachedExtensionFolderName)
24
21
  await Extract.extractTarBr(path, cachedExtensionPath)
25
22
  const extensionsPath = Platform.getExtensionsPath()
26
23
  const manifestPath = Path.join(cachedExtensionPath, 'extension.json')
27
24
  const manifestJson = await JsonFile.readJson(manifestPath)
28
- const id = manifestJson.id
25
+ const { id } = manifestJson
29
26
  if (!id) {
30
27
  throw new Error('missing id in extension manifest')
31
28
  }
@@ -18,7 +18,7 @@ export const install = async ({ user, repo, branch }) => {
18
18
  const extensionsPath = Platform.getExtensionsPath()
19
19
  const manifestPath = Path.join(cachedExtensionPath, 'extension.json')
20
20
  const manifestJson = await JsonFile.readJson(manifestPath)
21
- const id = manifestJson.id
21
+ const { id } = manifestJson
22
22
  if (!id) {
23
23
  throw new Error('missing id in extension manifest')
24
24
  }
@@ -1,5 +1,5 @@
1
- import { rename, rm } from 'fs/promises'
2
- import { join } from 'path'
1
+ import { rename, rm } from 'node:fs/promises'
2
+ import { join } from 'node:path'
3
3
  import VError from 'verror'
4
4
  import * as Download from '../Download/Download.js'
5
5
  import * as Extract from '../Extract/Extract.js'
@@ -19,7 +19,7 @@ export const install = async ({ url }) => {
19
19
  await Extract.extractTarBr(tmpFile, tmpDir)
20
20
  const manifestPath = join(tmpDir, 'extension.json')
21
21
  const manifestJson = await JsonFile.readJson(manifestPath)
22
- const id = manifestJson.id
22
+ const { id } = manifestJson
23
23
  if (!id) {
24
24
  throw new Error('missing id in extension manifest')
25
25
  }
@@ -23,6 +23,22 @@ const linkFallBack = async (path) => {
23
23
  }
24
24
  }
25
25
 
26
+ const linkMonoRepo = async (path, error) => {
27
+ try {
28
+ const monoRepoPath = Path.join(path, 'packages', 'extension')
29
+ const manifest = await ExtensionManifest.get(monoRepoPath)
30
+ if (manifest.status === ExtensionManifestStatus.Rejected) {
31
+ throw manifest.reason
32
+ }
33
+ const linkedExtensionsPath = Platform.getLinkedExtensionsPath()
34
+ // @ts-ignore
35
+ const to = Path.join(linkedExtensionsPath, manifest.id)
36
+ await SymLink.createSymLink(monoRepoPath, to)
37
+ } catch {
38
+ throw error
39
+ }
40
+ }
41
+
26
42
  export const link = async (path) => {
27
43
  try {
28
44
  const manifest = await ExtensionManifest.get(path)
@@ -37,6 +53,9 @@ export const link = async (path) => {
37
53
  if (error && error.code === ErrorCodes.EEXIST) {
38
54
  return linkFallBack(path)
39
55
  }
56
+ if (error && error.code === ErrorCodes.E_MANIFEST_NOT_FOUND) {
57
+ await linkMonoRepo(path, new VError(error, `Failed to link extension`))
58
+ }
40
59
  throw new VError(error, `Failed to link extension`)
41
60
  }
42
61
  }
@@ -10,7 +10,7 @@ export const Commands = {
10
10
  'ExtensionHost.getIconThemeJson': ExtensionHostIconTheme.getIconTheme,
11
11
  'ExtensionHost.getLanguageConfiguration': ExtensionHostLanguages.getLanguageConfiguration,
12
12
  'ExtensionHost.getLanguages': ExtensionHostLanguages.getLanguages,
13
- 'ExtensionHost.watchColorTheme':ExtensionHostColorTheme.watch,
13
+ 'ExtensionHost.watchColorTheme': ExtensionHostColorTheme.watch,
14
14
  'ExtensionManagement.disable': ExtensionManagement.disable,
15
15
  'ExtensionManagement.enable': ExtensionManagement.enable,
16
16
  'ExtensionManagement.getAllExtensions': ExtensionManagement.getExtensions,
@@ -3,9 +3,10 @@ import * as Error from '../Error/Error.js'
3
3
  import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js'
4
4
  import * as FileSystemWatch from '../FileSystemWatch/FileSystemWatch.js'
5
5
  import * as ReadJson from '../JsonFile/JsonFile.js'
6
+ import * as JsonRpcVersion from '../JsonRpcVersion/JsonRpcVersion.js'
6
7
  import * as Path from '../Path/Path.js'
8
+ import * as Process from '../Process/Process.js'
7
9
  import * as ExtensionManagement from './ExtensionManagement.js'
8
- import * as JsonRpcVersion from '../JsonRpcVersion/JsonRpcVersion.js'
9
10
 
10
11
  // TODO test this function
11
12
  // TODO very similar with getIconTheme
@@ -73,7 +74,7 @@ export const watch = async (socket, colorThemeId) => {
73
74
  // console.log({ socket, colorThemeId })
74
75
  const extensions = await ExtensionManagement.getExtensions()
75
76
  const colorThemePath = await getColorThemePath(extensions, colorThemeId)
76
- const verbose = process.argv.includes('--verbose')
77
+ const verbose = Process.argv.includes('--verbose')
77
78
  if (verbose) {
78
79
  console.info(`[shared-process] starting to watch color theme ${colorThemeId} at ${colorThemePath}`)
79
80
  }
@@ -1,9 +1,7 @@
1
1
  import { join } from 'node:path'
2
2
  import { pathToFileURL } from 'node:url'
3
3
  import VError from 'verror'
4
- import * as Error from '../Error/Error.js'
5
4
  import * as ReadJson from '../JsonFile/JsonFile.js'
6
- import * as Path from '../Path/Path.js'
7
5
  import * as ExtensionManagement from './ExtensionManagement.js'
8
6
 
9
7
  const getExtensionLanguages = (extension) => {
@@ -23,22 +21,21 @@ const getLanguagesFromExtension = (extension) => {
23
21
  if (!extension.languages) {
24
22
  return []
25
23
  }
24
+ const extensionPath = extension.path
26
25
  const getLanguageFromExtension = (language) => {
27
26
  if (language.tokenize) {
28
27
  if (typeof language.tokenize !== 'string') {
29
- console.warn(
30
- `[info] ${
31
- language.id
32
- }: language.tokenize must be of type string but was of type ${typeof language.tokenize}`
33
- )
28
+ console.warn(`[info] ${language.id}: language.tokenize must be of type string but was of type ${typeof language.tokenize}`)
34
29
  return {
35
30
  ...language,
31
+ extensionPath,
36
32
  tokenize: '',
37
33
  }
38
34
  }
39
35
  return {
40
36
  ...language,
41
- tokenize: toRemoteUrl(join(extension.path, language.tokenize)),
37
+ extensionPath,
38
+ tokenize: toRemoteUrl(join(extensionPath, language.tokenize)),
42
39
  }
43
40
  }
44
41
  return language
@@ -72,13 +69,9 @@ const getLanguageConfigurationPathFromExtensions = (extensions, languageId) => {
72
69
  export const getLanguageConfiguration = async (languageId) => {
73
70
  try {
74
71
  const extensions = await ExtensionManagement.getExtensions()
75
- const languageConfigurationPath =
76
- getLanguageConfigurationPathFromExtensions(extensions, languageId)
72
+ const languageConfigurationPath = getLanguageConfigurationPathFromExtensions(extensions, languageId)
77
73
  return await ReadJson.readJson(languageConfigurationPath)
78
74
  } catch (error) {
79
- throw new VError(
80
- error,
81
- `Failed to load language configuration for ${languageId}`
82
- )
75
+ throw new VError(error, `Failed to load language configuration for ${languageId}`)
83
76
  }
84
77
  }