pinokiod 7.1.77 → 7.1.79

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/kernel/shell.js CHANGED
@@ -16,6 +16,7 @@ const sudo = require("sudo-prompt-programfiles-x86");
16
16
  const unparse = require('yargs-unparser-custom-flag');
17
17
  const Util = require('./util')
18
18
  const Environment = require('./environment')
19
+ const { applyWindowsNodePackageManagerEnv } = require('./windows_node_package_manager_env')
19
20
  const ShellParser = require('./shell_parser')
20
21
  const AnsiStreamTracker = require('./ansi_stream_tracker')
21
22
  const ShellStateSync = require('./shell_state_sync')
@@ -179,10 +180,6 @@ class Shell {
179
180
  this.env.CONDA_SHORTCUTS = 0
180
181
  this.env.CONDA_CONSOLE = 'json'
181
182
 
182
- if (this.platform === "win32") {
183
- this.env.npm_config_symlink = "false"
184
- }
185
-
186
183
  // this.env.TCELL_MINIMIZE=1
187
184
  this.env.CMAKE_OBJECT_PATH_MAX = 1024
188
185
  this.env.PYTORCH_ENABLE_MPS_FALLBACK = 1
@@ -305,6 +302,12 @@ class Shell {
305
302
  delete this.env[key]
306
303
  }
307
304
  }
305
+
306
+ if (this.platform === "win32") {
307
+ await applyWindowsNodePackageManagerEnv(this.env, {
308
+ targetPath: params && params.path ? params.path : this.kernel.homedir,
309
+ })
310
+ }
308
311
  }
309
312
  isCmdShell(shellName=this.shell) {
310
313
  const name = (shellName || '').toLowerCase()
@@ -0,0 +1,92 @@
1
+ const fs = require('fs')
2
+ const os = require('os')
3
+ const path = require('path')
4
+
5
+ const windowsDirectoryLinkCache = new Map()
6
+
7
+ async function findExistingAncestor(targetPath) {
8
+ let current = path.resolve(targetPath)
9
+ while (true) {
10
+ const exists = await fs.promises.access(current, fs.constants.F_OK).then(() => true).catch(() => false)
11
+ if (exists) {
12
+ return current
13
+ }
14
+ const parent = path.dirname(current)
15
+ if (!parent || parent === current) {
16
+ return null
17
+ }
18
+ current = parent
19
+ }
20
+ }
21
+
22
+ async function windowsDirectoryLinksWork(targetPath) {
23
+ const ancestor = await findExistingAncestor(targetPath || os.homedir())
24
+ if (!ancestor) {
25
+ return true
26
+ }
27
+
28
+ const cacheKey = path.parse(path.resolve(ancestor)).root.toLowerCase()
29
+ if (windowsDirectoryLinkCache.has(cacheKey)) {
30
+ return windowsDirectoryLinkCache.get(cacheKey)
31
+ }
32
+
33
+ const probePromise = (async () => {
34
+ let probeDir = null
35
+ try {
36
+ probeDir = await fs.promises.mkdtemp(path.join(ancestor, ".pinokio-link-probe-"))
37
+ const sourceDir = path.resolve(probeDir, "source")
38
+ const linkDir = path.resolve(probeDir, "link")
39
+ await fs.promises.mkdir(sourceDir)
40
+ await fs.promises.symlink(path.resolve(sourceDir), linkDir, "junction")
41
+ return true
42
+ } catch (_) {
43
+ return false
44
+ } finally {
45
+ if (probeDir) {
46
+ await fs.promises.rm(probeDir, { recursive: true, force: true }).catch(() => {})
47
+ }
48
+ }
49
+ })()
50
+
51
+ windowsDirectoryLinkCache.set(cacheKey, probePromise)
52
+ return probePromise
53
+ }
54
+
55
+ function getFirstDefinedEnv(env, keys) {
56
+ for (const key of keys) {
57
+ const value = env[key]
58
+ if (typeof value === "string" && value.trim()) {
59
+ return value.trim()
60
+ }
61
+ }
62
+ return null
63
+ }
64
+
65
+ async function applyWindowsNodePackageManagerEnv(env, options = {}) {
66
+ delete env.npm_config_symlink
67
+ delete env.NPM_CONFIG_SYMLINK
68
+ delete env.pnpm_config_symlink
69
+ delete env.PNPM_CONFIG_SYMLINK
70
+
71
+ const explicitNodeLinker = getFirstDefinedEnv(env, [
72
+ "npm_config_node_linker",
73
+ "NPM_CONFIG_NODE_LINKER",
74
+ "pnpm_config_node_linker",
75
+ "PNPM_CONFIG_NODE_LINKER",
76
+ ])
77
+ if (explicitNodeLinker) {
78
+ return
79
+ }
80
+
81
+ const targetPath = options.targetPath || os.homedir()
82
+ if (await windowsDirectoryLinksWork(targetPath)) {
83
+ return
84
+ }
85
+
86
+ env.npm_config_node_linker = "hoisted"
87
+ env.NPM_CONFIG_NODE_LINKER = "hoisted"
88
+ }
89
+
90
+ module.exports = {
91
+ applyWindowsNodePackageManagerEnv,
92
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "7.1.77",
3
+ "version": "7.1.79",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -69,6 +69,7 @@
69
69
  requireAlternate: false,
70
70
  restrictToBase: true,
71
71
  forceCanonicalQr: true,
72
+ closeOnMouseLeave: true,
72
73
  allowQrPortMismatch: true,
73
74
  skipPeerFallback: true
74
75
  })
@@ -3,6 +3,7 @@
3
3
  let tabLinkActiveLink = null
4
4
  let tabLinkPendingLink = null
5
5
  let tabLinkHideTimer = null
6
+ let tabLinkCloseOnMouseLeave = false
6
7
  let tabLinkLocalInfoPromise = null
7
8
  let tabLinkLocalInfoExpiry = 0
8
9
  let tabLinkRouterInfoPromise = null
@@ -137,7 +138,9 @@
137
138
  }
138
139
  })
139
140
  tabLinkPopoverEl.addEventListener("mouseleave", () => {
140
- hideTabLinkPopover({ immediate: true })
141
+ if (tabLinkCloseOnMouseLeave) {
142
+ hideTabLinkPopover({ immediate: true })
143
+ }
141
144
  })
142
145
  tabLinkPopoverEl.addEventListener("click", (event) => {
143
146
  const item = event.target.closest(".tab-link-popover-item")
@@ -1421,6 +1424,7 @@
1421
1424
  tabLinkActiveLink = null
1422
1425
  tabLinkPendingLink = null
1423
1426
  tabLinkHideTimer = null
1427
+ tabLinkCloseOnMouseLeave = false
1424
1428
  }
1425
1429
 
1426
1430
  if (tabLinkHideTimer) {
@@ -1449,6 +1453,7 @@
1449
1453
  const requireAlternate = options && options.requireAlternate === false ? false : true
1450
1454
  const restrictToBase = options && options.restrictToBase === true
1451
1455
  const forceCanonicalQr = options && options.forceCanonicalQr === true
1456
+ tabLinkCloseOnMouseLeave = options && options.closeOnMouseLeave === true
1452
1457
  let sameOrigin = false
1453
1458
  let canonicalBase = canonicalizeUrl(effectiveHref)
1454
1459
  if (canonicalBase && isHttpUrl(canonicalBase)) {
@@ -1869,7 +1874,10 @@
1869
1874
  hideTabLinkPopover({ immediate: true })
1870
1875
  return
1871
1876
  }
1872
- renderTabLinkPopover(link, { requireAlternate: false })
1877
+ renderTabLinkPopover(link, {
1878
+ requireAlternate: false,
1879
+ closeOnMouseLeave: false
1880
+ })
1873
1881
  }
1874
1882
 
1875
1883
  const handleTriggerClick = (event) => {
@@ -8319,6 +8319,7 @@ const rerenderMenuSection = (container, html) => {
8319
8319
  const closeFloatingMenus = () => {
8320
8320
  closeStatusDropdowns()
8321
8321
  closeAllNestedMenus()
8322
+ hideTabLinkPopover({ immediate: true })
8322
8323
  }
8323
8324
 
8324
8325
  const openNestedMenu = (menu, toggle) => {